View Javadoc

1   /*
2    * Copyright 2006-2016 The JGUIraffe Team.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License")
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package net.sf.jguiraffe.gui.platform.swing.builder.window;
17  
18  import java.awt.Component;
19  import java.util.Collection;
20  
21  import javax.swing.JRootPane;
22  
23  import net.sf.jguiraffe.gui.builder.window.Window;
24  import net.sf.jguiraffe.gui.builder.window.WindowListener;
25  
26  /**
27   * <p>
28   * Definition of an extended window interface implemented by Swing window
29   * implementations.
30   * </p>
31   * <p>
32   * This interface has the purpose to simplify implementations of Swing based
33   * windows and support testing. It is used internally in this package.
34   * </p>
35   *
36   * @author Oliver Heger
37   * @version $Id: SwingWindow.java 205 2012-01-29 18:29:57Z oheger $
38   */
39  public interface SwingWindow extends Window
40  {
41      /**
42       * Returns a collection with all registered window listeners.
43       *
44       * @return a collection with the registered window listeners
45       */
46      Collection<WindowListener> getWindowListeners();
47  
48      /**
49       * Returns the window helper used by this window.
50       *
51       * @return the window helper
52       */
53      WindowHelper getWindowHelper();
54  
55      /**
56       * Returns the Swing component that represents this window.
57       *
58       * @return the component for this window
59       */
60      Component getComponent();
61  
62      /**
63       * Sets this window's parent window.
64       *
65       * @param parent the new parent
66       */
67      void setParentWindow(Window parent);
68  
69      /**
70       * Sets the window's controller.
71       *
72       * @param ctrl the controller
73       */
74      void setWindowController(Object ctrl);
75  
76      /**
77       * "Packs" the window. This method is called when the window is opened and
78       * no size has been set. In this case {@code pack()} must be called to
79       * ensure that a reasonable default size is calculated.
80       */
81      void packWindow();
82  
83      /**
84       * Registers an internal window listener that closes this window when the
85       * user hits the close icon in the window's title bar. This method is called
86       * by the window manager after the creation of the window if auto-close is
87       * desired.
88       */
89      void registerAutoCloseListener();
90  
91      /**
92       * Returns the root pane of the window.
93       *
94       * @return the window's root pane
95       */
96      JRootPane getRootPane();
97  
98      /**
99       * Closes this window and frees all its resources. This method is called
100      * when the {@code SwingWindow} is actually to be removed.
101      */
102     void dispose();
103 }