001: /*
002: * This file is part of the Echo Web Application Framework (hereinafter "Echo").
003: * Copyright (C) 2002-2005 NextApp, Inc.
004: *
005: * Version: MPL 1.1/GPL 2.0/LGPL 2.1
006: *
007: * The contents of this file are subject to the Mozilla Public License Version
008: * 1.1 (the "License"); you may not use this file except in compliance with
009: * the License. You may obtain a copy of the License at
010: * http://www.mozilla.org/MPL/
011: *
012: * Software distributed under the License is distributed on an "AS IS" basis,
013: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
014: * for the specific language governing rights and limitations under the
015: * License.
016: *
017: * Alternatively, the contents of this file may be used under the terms of
018: * either the GNU General Public License Version 2 or later (the "GPL"), or
019: * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
020: * in which case the provisions of the GPL or the LGPL are applicable instead
021: * of those above. If you wish to allow use of your version of this file only
022: * under the terms of either the GPL or the LGPL, and not to allow others to
023: * use your version of this file under the terms of the MPL, indicate your
024: * decision by deleting the provisions above and replace them with the notice
025: * and other provisions required by the GPL or the LGPL. If you do not delete
026: * the provisions above, a recipient may use your version of this file under
027: * the terms of any one of the MPL, the GPL or the LGPL.
028: */
029:
030: package nextapp.echo2.app;
031:
032: import java.util.EventListener;
033:
034: import nextapp.echo2.app.event.WindowPaneEvent;
035: import nextapp.echo2.app.event.WindowPaneListener;
036:
037: /**
038: * A <code>Component</code> which renders its contents in a floating,
039: * movable window.
040: * <p>
041: * <b>NOTE:</b> A <code>WindowPane</code> may only be added to
042: * a <code>ContentPane</code>.
043: */
044: public class WindowPane extends Component implements FloatingPane,
045: ModalSupport, PaneContainer {
046:
047: public static final String INPUT_CLOSE = "input_close";
048:
049: public static final String PROPERTY_BACKGROUND_IMAGE = "backgroundImage";
050: public static final String PROPERTY_BORDER = "border";
051: public static final String PROPERTY_CLOSABLE = "closable";
052: public static final String PROPERTY_CLOSE_ICON = "closeIcon";
053: public static final String PROPERTY_CLOSE_ICON_INSETS = "closeIconInsets";
054: public static final String PROPERTY_DEFAULT_CLOSE_OPERATION = "defaultCloseOperation";
055: public static final String PROPERTY_HEIGHT = "height";
056: public static final String PROPERTY_ICON = "icon";
057: public static final String PROPERTY_ICON_INSETS = "iconInsets";
058: public static final String PROPERTY_INSETS = "insets";
059: public static final String PROPERTY_MAXIMUM_HEIGHT = "maximumHeight";
060: public static final String PROPERTY_MAXIMUM_WIDTH = "maximumWidth";
061: public static final String PROPERTY_MINIMUM_HEIGHT = "minimumHeight";
062: public static final String PROPERTY_MINIMUM_WIDTH = "minimumWidth";
063: public static final String PROPERTY_MOVABLE = "movable";
064: public static final String PROPERTY_POSITION_X = "positionX";
065: public static final String PROPERTY_POSITION_Y = "positionY";
066: public static final String PROPERTY_RESIZABLE = "resizable";
067: public static final String PROPERTY_TITLE = "title";
068: public static final String PROPERTY_TITLE_BACKGROUND = "titleBackground";
069: public static final String PROPERTY_TITLE_BACKGROUND_IMAGE = "titleBackgroundImage";
070: public static final String PROPERTY_TITLE_BAR_INSETS = "titleBarInsets";
071: public static final String PROPERTY_TITLE_FONT = "titleFont";
072: public static final String PROPERTY_TITLE_FOREGROUND = "titleForeground";
073: public static final String PROPERTY_TITLE_HEIGHT = "titleHeight";
074: public static final String PROPERTY_TITLE_INSETS = "titleInsets";
075: public static final String PROPERTY_WIDTH = "width";
076:
077: public static final String Z_INDEX_CHANGED_PROPERTY = "zIndex";
078:
079: /**
080: * A constant for the <code>defaultCloseOperation</code> property
081: * indicating that nothing should be done when the user attempts
082: * to close a window.
083: */
084: public static final int DO_NOTHING_ON_CLOSE = 0;
085:
086: /**
087: * A constant for the <code>defaultCloseOperation</code> property
088: * indicating that a window should be hidden when the user attempts
089: * to close it.
090: */
091: public static final int HIDE_ON_CLOSE = 1;
092:
093: /**
094: * A constant for the <code>defaultCloseOperation</code> property
095: * indicating that a window should be removed from the component
096: * hierarchy when a user attempts to close it.
097: */
098: public static final int DISPOSE_ON_CLOSE = 2;
099:
100: private boolean modal = false;
101: private int zIndex = 0;
102:
103: /**
104: * Creates a new <code>WindowPane</code>.
105: */
106: public WindowPane() {
107: this (null, null, null);
108: }
109:
110: /**
111: * Creates a new <code>WindowPane</code> with the specified title
112: * and dimensions.
113: *
114: * @param title the title
115: * @param width The width
116: * @param height The height
117: */
118: public WindowPane(String title, Extent width, Extent height) {
119: super ();
120: if (title != null) {
121: setTitle(title);
122: }
123: if (width != null) {
124: setWidth(width);
125: }
126: if (height != null) {
127: setHeight(height);
128: }
129: }
130:
131: /**
132: * Adds a <code>WindowPaneListener</code> to receive event notifications.
133: *
134: * @param l the <code>WindowPaneListener</code> to add
135: */
136: public void addWindowPaneListener(WindowPaneListener l) {
137: getEventListenerList().addListener(WindowPaneListener.class, l);
138: }
139:
140: /**
141: * Notifies <code>WindowPaneListener</code>s that the user has requested
142: * to close this <code>WindowPane</code>.
143: */
144: protected void fireWindowClosing() {
145: if (!hasEventListenerList()) {
146: return;
147: }
148: EventListener[] listeners = getEventListenerList()
149: .getListeners(WindowPaneListener.class);
150: if (listeners.length == 0) {
151: return;
152: }
153: WindowPaneEvent e = new WindowPaneEvent(this );
154: for (int i = 0; i < listeners.length; ++i) {
155: ((WindowPaneListener) listeners[i]).windowPaneClosing(e);
156: }
157: }
158:
159: /**
160: * Returns the background image of the <code>WindowPane</code>.
161: *
162: * @return the background image
163: */
164: public FillImage getBackgroundImage() {
165: return (FillImage) getProperty(PROPERTY_BACKGROUND_IMAGE);
166: }
167:
168: /**
169: * Returns the border which surrounds the entire <code>WindowPane</code>.
170: *
171: * @return border
172: */
173: public FillImageBorder getBorder() {
174: return (FillImageBorder) getProperty(PROPERTY_BORDER);
175: }
176:
177: /**
178: * Returns the close button icon.
179: *
180: * @return the icon
181: */
182: public ImageReference getCloseIcon() {
183: return (ImageReference) getProperty(PROPERTY_CLOSE_ICON);
184: }
185:
186: /**
187: * Returns the inset margin around the close button icon.
188: *
189: * @return the inset margin
190: */
191: public Insets getCloseIconInsets() {
192: return (Insets) getProperty(PROPERTY_CLOSE_ICON_INSETS);
193: }
194:
195: /**
196: * Returns the default close operation.
197: *
198: * @return the default close operation, one of the following values:
199: * <ul>
200: * <li>DO_NOTHING_ON_CLOSE</li>
201: * <li>HIDE_ON_CLOSE</li>
202: * <li>DISPOSE_ON_CLOSE</li>
203: * </ul>
204: */
205: public int getDefaultCloseOperation() {
206: Integer defaultCloseOperationValue = (Integer) getProperty(PROPERTY_DEFAULT_CLOSE_OPERATION);
207: return defaultCloseOperationValue == null ? 0
208: : defaultCloseOperationValue.intValue();
209: }
210:
211: /**
212: * Returns the height of the content region of the window.
213: *
214: * @return the height
215: */
216: public Extent getHeight() {
217: return (Extent) getProperty(PROPERTY_HEIGHT);
218: }
219:
220: /**
221: * Returns the icon displayed in the title region.
222: *
223: * @return the icon
224: */
225: public ImageReference getIcon() {
226: return (ImageReference) getProperty(PROPERTY_ICON);
227: }
228:
229: /**
230: * Returns the inset margin around the icon.
231: *
232: * @return the inset margin
233: */
234: public Insets getIconInsets() {
235: return (Insets) getProperty(PROPERTY_CLOSE_ICON_INSETS);
236: }
237:
238: /**
239: * Returns the inset of the window content.
240: * This property is not rendered when the content is a <code>Pane</code>
241: * component.
242: *
243: * @return the inset
244: */
245: public Insets getInsets() {
246: return (Insets) getProperty(PROPERTY_INSETS);
247: }
248:
249: /**
250: * Returns the maximum height of the content region of the
251: * <code>WindowPane</code>.
252: *
253: * @return the maximum height
254: */
255: public Extent getMaximumHeight() {
256: return (Extent) getProperty(PROPERTY_MAXIMUM_HEIGHT);
257: }
258:
259: /**
260: * Returns the maximum width of the content region of the
261: * <code>WindowPane</code>.
262: *
263: * @return the maximum width
264: */
265: public Extent getMaximumWidth() {
266: return (Extent) getProperty(PROPERTY_MAXIMUM_WIDTH);
267: }
268:
269: /**
270: * Returns the minimum height of the content region of the
271: * <code>WindowPane</code>.
272: *
273: * @return the minimum height
274: */
275: public Extent getMinimumHeight() {
276: return (Extent) getProperty(PROPERTY_MINIMUM_HEIGHT);
277: }
278:
279: /**
280: * Returns the minimum width of the content region of the
281: * <code>WindowPane</code>.
282: *
283: * @return the minimum width
284: */
285: public Extent getMinimumWidth() {
286: return (Extent) getProperty(PROPERTY_MINIMUM_WIDTH);
287: }
288:
289: /**
290: * Returns the horizontal (Y) position of the <code>WindowPane</code> with
291: * respect to its container.
292: *
293: * @return the position
294: */
295: public Extent getPositionX() {
296: return (Extent) getProperty(PROPERTY_POSITION_X);
297: }
298:
299: /**
300: * Returns the vertical (Y) position of the <code>WindowPane</code> with
301: * respect to its container.
302: *
303: * @return the position
304: */
305: public Extent getPositionY() {
306: return (Extent) getProperty(PROPERTY_POSITION_Y);
307: }
308:
309: /**
310: * Returns the title of the <code>WindowPane</code>.
311: *
312: * @return the title
313: */
314: public String getTitle() {
315: return (String) getProperty(PROPERTY_TITLE);
316: }
317:
318: /**
319: * Returns the background color of the title region.
320: *
321: * @return the color
322: */
323: public Color getTitleBackground() {
324: return (Color) getProperty(PROPERTY_TITLE_BACKGROUND);
325: }
326:
327: /**
328: * Returns the background image of the title region.
329: *
330: * @return the background image
331: */
332: public FillImage getTitleBackgroundImage() {
333: return (FillImage) getProperty(PROPERTY_TITLE_BACKGROUND_IMAGE);
334: }
335:
336: /**
337: * Returns the horizontal inset of the entire title bar (relative to the content area).
338: * Setting this value will result in the title bar being narrower than the rest of the
339: * content region, which may be necessary to accommodate particular border styles.
340: *
341: * @return the insets
342: */
343: public Insets getTitleBarInsets() {
344: return (Insets) getProperty(PROPERTY_TITLE_BAR_INSETS);
345: }
346:
347: /**
348: * Returns the font of the title region.
349: *
350: * @return the font
351: */
352: public Font getTitleFont() {
353: return (Font) getProperty(PROPERTY_TITLE_FONT);
354: }
355:
356: /**
357: * Returns the foreground color of the title region.
358: *
359: * @return the color
360: */
361: public Color getTitleForeground() {
362: return (Color) getProperty(PROPERTY_TITLE_FOREGROUND);
363: }
364:
365: /**
366: * Returns the height of the title region.
367: *
368: * @return the height
369: */
370: public Extent getTitleHeight() {
371: return (Extent) getProperty(PROPERTY_TITLE_HEIGHT);
372: }
373:
374: /**
375: * Returns the insets of the title region.
376: *
377: * @return the insets
378: */
379: public Insets getTitleInsets() {
380: return (Insets) getProperty(PROPERTY_TITLE_INSETS);
381: }
382:
383: /**
384: * Returns the width of the content region of the window.
385: *
386: * @return the width
387: */
388: public Extent getWidth() {
389: return (Extent) getProperty(PROPERTY_WIDTH);
390: }
391:
392: /**
393: * Returns the z-index of the window with respect to its parent
394: * <code>ContentPane</code>. Windows with higher z-indices will
395: * visually obscure windows with lower z-indices.
396: *
397: * @return the z-index
398: */
399: public int getZIndex() {
400: return zIndex;
401: }
402:
403: /**
404: * Determines if the window is closable via a provided close button in
405: * the title bar.
406: *
407: * @return true if the window is closable
408: */
409: public boolean isClosable() {
410: Boolean value = (Boolean) getProperty(PROPERTY_CLOSABLE);
411: return value == null ? true : value.booleanValue();
412: }
413:
414: /**
415: * @see nextapp.echo2.app.ModalSupport#isModal()
416: */
417: public boolean isModal() {
418: return modal;
419: }
420:
421: /**
422: * Determines if the window is movable.
423: *
424: * @return true if the window is movable
425: */
426: public boolean isMovable() {
427: Boolean value = (Boolean) getProperty(PROPERTY_MOVABLE);
428: return value == null ? true : value.booleanValue();
429: }
430:
431: /**
432: * Determines if the window is resizable.
433: *
434: * @return true if the window is resizable
435: */
436: public boolean isResizable() {
437: Boolean value = (Boolean) getProperty(PROPERTY_RESIZABLE);
438: return value == null ? true : value.booleanValue();
439: }
440:
441: /**
442: * Limit content to a single child.
443: *
444: * @see nextapp.echo2.app.Component#isValidChild(nextapp.echo2.app.Component)
445: */
446: public boolean isValidChild(Component component) {
447: return getComponentCount() == 0;
448: }
449:
450: /**
451: * Only allow <code>ContentPane</code>s as parents.
452: *
453: * @see nextapp.echo2.app.Component#isValidParent(nextapp.echo2.app.Component)
454: */
455: public boolean isValidParent(Component parent) {
456: return parent instanceof ContentPane;
457: }
458:
459: /**
460: * @see nextapp.echo2.app.Component#processInput(java.lang.String, java.lang.Object)
461: */
462: public void processInput(String inputName, Object inputValue) {
463: if (INPUT_CLOSE.equals(inputName)) {
464: userClose();
465: } else if (PROPERTY_POSITION_X.equals(inputName)) {
466: setPositionX((Extent) inputValue);
467: } else if (PROPERTY_POSITION_Y.equals(inputName)) {
468: setPositionY((Extent) inputValue);
469: } else if (PROPERTY_WIDTH.equals(inputName)) {
470: setWidth((Extent) inputValue);
471: } else if (PROPERTY_HEIGHT.equals(inputName)) {
472: setHeight((Extent) inputValue);
473: } else if (Z_INDEX_CHANGED_PROPERTY.equals(inputName)) {
474: setZIndex(((Integer) inputValue).intValue());
475: }
476: }
477:
478: /**
479: * Sets the background image of the <code>WindowPane</code>.
480: *
481: * @param newValue the new background image
482: */
483: public void setBackgroundImage(FillImage newValue) {
484: setProperty(PROPERTY_BACKGROUND_IMAGE, newValue);
485: }
486:
487: /**
488: * Sets the border which surrounds the entire <code>WindowPane</code>.
489: *
490: * @param newValue the new border
491: */
492: public void setBorder(FillImageBorder newValue) {
493: setProperty(PROPERTY_BORDER, newValue);
494: }
495:
496: /**
497: * Sets whether the window is closable via a provided close button in
498: * the title bar.
499: *
500: * @param newValue true if the window is closable
501: */
502: public void setClosable(boolean newValue) {
503: setProperty(PROPERTY_CLOSABLE, new Boolean(newValue));
504: }
505:
506: /**
507: * Sets the close button icon.
508: *
509: * @param newValue the new icon
510: */
511: public void setCloseIcon(ImageReference newValue) {
512: setProperty(PROPERTY_CLOSE_ICON, newValue);
513: }
514:
515: /**
516: * Sets the inset margin around the close button icon.
517: *
518: * @param newValue the new inset margin
519: */
520: public void setCloseIconInsets(Insets newValue) {
521: setProperty(PROPERTY_CLOSE_ICON_INSETS, newValue);
522: }
523:
524: /**
525: * Sets the default close operation.
526: *
527: * @param newValue the new default close operation, one of the following
528: * values:
529: * <ul>
530: * <li>DO_NOTHING_ON_CLOSE</li>
531: * <li>HIDE_ON_CLOSE</li>
532: * <li>DISPOSE_ON_CLOSE</li>
533: * </ul>
534: */
535: public void setDefaultCloseOperation(int newValue) {
536: setProperty(PROPERTY_DEFAULT_CLOSE_OPERATION, new Integer(
537: newValue));
538: }
539:
540: /**
541: * Sets the height of the content region of the <code>WindowPane</code>.
542: * Values must be in pixel units.
543: *
544: * @param newValue the new height
545: */
546: public void setHeight(Extent newValue) {
547: Extent.validate(newValue, Extent.PX);
548: setProperty(PROPERTY_HEIGHT, newValue);
549: }
550:
551: /**
552: * Sets the icon displayed in the title region.
553: *
554: * @param newValue the new icon
555: */
556: public void setIcon(ImageReference newValue) {
557: setProperty(PROPERTY_ICON, newValue);
558: }
559:
560: /**
561: * Sets the inset margin around the icon.
562: *
563: * @param newValue the new inset margin
564: */
565: public void setIconInsets(Insets newValue) {
566: setProperty(PROPERTY_ICON_INSETS, newValue);
567: }
568:
569: /**
570: * Sets the inset of the window content.
571: * This property is not rendered when the content is a <code>Pane</code>
572: * component.
573: *
574: * @param newValue the new inset
575: */
576: public void setInsets(Insets newValue) {
577: setProperty(PROPERTY_INSETS, newValue);
578: }
579:
580: /**
581: * Sets the maximum height of the content region of the
582: * <code>WindowPane</code>.
583: * Values must be in pixel units.
584: *
585: * @param newValue the new maximum height
586: */
587: public void setMaximumHeight(Extent newValue) {
588: Extent.validate(newValue, Extent.PX);
589: setProperty(PROPERTY_MAXIMUM_HEIGHT, newValue);
590: }
591:
592: /**
593: * Sets the maximum width of the content region of the
594: * <code>WindowPane</code>.
595: * Values must be in pixel units.
596: *
597: * @param newValue the new maximum width
598: */
599: public void setMaximumWidth(Extent newValue) {
600: Extent.validate(newValue, Extent.PX);
601: setProperty(PROPERTY_MAXIMUM_WIDTH, newValue);
602: }
603:
604: /**
605: * Sets the minimum height of the content region of the
606: * <code>WindowPane</code>.
607: * Values must be in pixel units.
608: *
609: * @param newValue the new minimum height
610: */
611: public void setMinimumHeight(Extent newValue) {
612: Extent.validate(newValue, Extent.PX);
613: setProperty(PROPERTY_MINIMUM_HEIGHT, newValue);
614: }
615:
616: /**
617: * Sets the minimum width of the content region of the
618: * <code>WindowPane</code>.
619: * Values must be in pixel units.
620: *
621: * @param newValue the new minimum width
622: */
623: public void setMinimumWidth(Extent newValue) {
624: Extent.validate(newValue, Extent.PX);
625: setProperty(PROPERTY_MINIMUM_WIDTH, newValue);
626: }
627:
628: /**
629: * @see nextapp.echo2.app.ModalSupport#setModal(boolean)
630: */
631: public void setModal(boolean newValue) {
632: boolean oldValue = modal;
633: modal = newValue;
634: firePropertyChange(MODAL_CHANGED_PROPERTY,
635: new Boolean(oldValue), new Boolean(newValue));
636: }
637:
638: /**
639: * Sets whether the window is movable.
640: *
641: * @param newValue true if the window may be moved by the user
642: */
643: public void setMovable(boolean newValue) {
644: setProperty(PROPERTY_MOVABLE, new Boolean(newValue));
645: }
646:
647: /**
648: * Sets the horizontal (X) position of the <code>WindowPane</code> with
649: * respect to its container.
650: * Values must be in pixel units.
651: *
652: * @param newValue the new position
653: */
654: public void setPositionX(Extent newValue) {
655: Extent.validate(newValue, Extent.PX);
656: setProperty(PROPERTY_POSITION_X, newValue);
657: }
658:
659: /**
660: * Sets the vertical (Y) position of the <code>WindowPane</code> with
661: * respect to its container.
662: * Values must be in pixel units.
663: *
664: * @param newValue the new position
665: */
666: public void setPositionY(Extent newValue) {
667: Extent.validate(newValue, Extent.PX);
668: setProperty(PROPERTY_POSITION_Y, newValue);
669: }
670:
671: /**
672: * Sets whether the window is resizable.
673: *
674: * @param newValue true if the window may be resized by the user
675: */
676: public void setResizable(boolean newValue) {
677: setProperty(PROPERTY_RESIZABLE, new Boolean(newValue));
678: }
679:
680: /**
681: * Sets the title of the <code>WindowPane</code>.
682: *
683: * @param newValue the title
684: */
685: public void setTitle(String newValue) {
686: setProperty(PROPERTY_TITLE, newValue);
687: }
688:
689: /**
690: * Sets the background color of the title region.
691: *
692: * @param newValue the new color
693: */
694: public void setTitleBackground(Color newValue) {
695: setProperty(PROPERTY_TITLE_BACKGROUND, newValue);
696: }
697:
698: /**
699: * Sets the background image of the title region.
700: *
701: * @param newValue the new background image
702: */
703: public void setTitleBackgroundImage(FillImage newValue) {
704: setProperty(PROPERTY_TITLE_BACKGROUND_IMAGE, newValue);
705: }
706:
707: /**
708: * Sets the horizontal inset of the entire title bar (relative to the content area).
709: * Setting this value will result in the title bar being narrower than the rest of the
710: * content region, which may be necessary to accommodate particular border styles.
711: *
712: * @param newValue the new insets
713: */
714: public void setTitleBarInsets(Insets newValue) {
715: setProperty(PROPERTY_TITLE_BAR_INSETS, newValue);
716: }
717:
718: /**
719: * Sets the font of the title region.
720: *
721: * @param newValue the new font
722: */
723: public void setTitleFont(Font newValue) {
724: setProperty(PROPERTY_TITLE_FONT, newValue);
725: }
726:
727: /**
728: * Sets the foreground color of the title region.
729: *
730: * @param newValue the new color
731: */
732: public void setTitleForeground(Color newValue) {
733: setProperty(PROPERTY_TITLE_FOREGROUND, newValue);
734: }
735:
736: /**
737: * Sets the height of the title region.
738: * Values must be in pixel units.
739: *
740: * @param newValue the new height
741: */
742: public void setTitleHeight(Extent newValue) {
743: Extent.validate(newValue, Extent.PX);
744: setProperty(PROPERTY_TITLE_HEIGHT, newValue);
745: }
746:
747: /**
748: * Sets the insets of the title region.
749: *
750: * @param newValue the new insets
751: */
752: public void setTitleInsets(Insets newValue) {
753: setProperty(PROPERTY_TITLE_INSETS, newValue);
754: }
755:
756: /**
757: * Sets the width of the content region of the window.
758: * Values must be in pixel units.
759: *
760: * @param newValue the new width
761: */
762: public void setWidth(Extent newValue) {
763: Extent.validate(newValue, Extent.PX);
764: setProperty(PROPERTY_WIDTH, newValue);
765: }
766:
767: /**
768: * Sets the z-index of the window with respect to its parent
769: * <code>ContentPane</code>. Windows with higher z-indices will
770: * visually obscure windows with lower z-indices.
771: *
772: * @param newValue the new z-index
773: */
774: public void setZIndex(int newValue) {
775: int oldValue = zIndex;
776: zIndex = newValue;
777: firePropertyChange(Z_INDEX_CHANGED_PROPERTY, new Integer(
778: oldValue), new Integer(newValue));
779: }
780:
781: /**
782: * Removes a <code>WindowPaneListener</code> from receiving event notifications.
783: *
784: * @param l the <code>WindowPaneListener</code> to remove
785: */
786: public void removeWindowPaneListener(WindowPaneListener l) {
787: if (!hasEventListenerList()) {
788: return;
789: }
790: getEventListenerList().removeListener(WindowPaneListener.class,
791: l);
792: }
793:
794: /**
795: * Processes a user request to close the window (via the close button).
796: */
797: public void userClose() {
798: fireWindowClosing();
799: Integer defaultCloseOperationValue = (Integer) getRenderProperty(PROPERTY_DEFAULT_CLOSE_OPERATION);
800: int defaultCloseOperation = defaultCloseOperationValue == null ? DISPOSE_ON_CLOSE
801: : defaultCloseOperationValue.intValue();
802: switch (defaultCloseOperation) {
803: case DISPOSE_ON_CLOSE:
804: getParent().remove(this );
805: break;
806: case HIDE_ON_CLOSE:
807: setVisible(false);
808: break;
809: }
810: }
811: }
|