001: package org.gui4j;
002:
003: import java.awt.Dimension;
004: import java.awt.Window;
005:
006: import javax.swing.JComponent;
007:
008: /**
009: */
010: public interface Gui4jWindow {
011: /**
012: * Wait until all gui events are executed.
013: */
014: void waitForGUI();
015:
016: /**
017: * Method prepare. Call this methid, before show, hide, setVisible
018: * @return Gui4jWindow (the same instance)
019: */
020: Gui4jWindow prepare();
021:
022: /**
023: * Shows or hides the window.
024: * @param show true or false
025: */
026: void setVisible(boolean show);
027:
028: /**
029: * This method closes the view. If the view is not open,
030: * nothing happens
031: */
032: void close();
033:
034: /**
035: * Show the window.
036: */
037: void show();
038:
039: /**
040: * Hide the window.
041: */
042: void hide();
043:
044: /**
045: * @return true if the window is closed
046: */
047: boolean isClosed();
048:
049: /**
050: * Resizes this view's JFrame so that all components get
051: * their preferred sizes.
052: */
053: void resize();
054:
055: /**
056: * @return the underlying swing window.
057: */
058: Window getWindow();
059:
060: /**
061: * This method is needed to change a frame's title
062: * @deprecated Use {@link #setTitle(String)} instead.
063: * @param title
064: */
065: void changeWindowTitle(String title);
066:
067: /**
068: * @return the window title
069: */
070: String getTitle();
071:
072: /**
073: * Resets the window title to the specified String.
074: * @param title
075: */
076: void setTitle(String title);
077:
078: /**
079: * Maximize the window on the desktop.
080: */
081: void maximize();
082:
083: /**
084: * Maximize the window, but stop at the given dimension.
085: * @param maxWidth maximum width
086: * @param maxHeight maximum height
087: */
088: void maximize(int maxWidth, int maxHeight);
089:
090: /**
091: * Maximize the window, but the maximum siye is limited to 1024 x 768
092: */
093: void maximize1024x768();
094:
095: /**
096: * Center the window.
097: * @param centered if true, the window will be centered
098: */
099: void center(boolean centered);
100:
101: /**
102: * Convenience method for {@link #setWindowSize(int, int)}
103: * @param d must not be <code>null</code>
104: */
105: void setWindowSize(Dimension d);
106:
107: /**
108: * Sets the window size.
109: * @param width the width
110: * @param height the height
111: */
112: void setWindowSize(int width, int height);
113:
114: /**
115: * Display the working cursor. A counter variable remembers the the number of calls of setWorkingCursor and
116: * setNormalCursor, so that only the last call of setNormalCursor really displays the normal cursor.
117: */
118: void setWorkingCursor();
119:
120: /**
121: * Restores the normal cursor. See setWorkingCursor.
122: */
123: void setNormalCursor();
124:
125: /**
126: * @return true if the window blocks for all events
127: */
128: boolean isBlocked();
129:
130: /**
131: * @param busy if true, then the wait cursor will be shown the the gui will be blocked. A counter variable remembers the number
132: * of calls with busy true and false and the last call of setBusy(false) will unlock the gui and the normal cursor will be
133: * displayed.
134: */
135: void setBusy(final boolean busy);
136:
137: /**
138: * Sets the gui to enabled false
139: */
140: void disable();
141:
142: /**
143: * Sets the gui to enabled true
144: */
145: void enable();
146:
147: /**
148: * Sets the enabled state.
149: * @param flag the enabled state
150: */
151: void setEnabled(boolean flag);
152:
153: Gui4jController getGui4jController();
154:
155: void dispose();
156:
157: void refreshAll();
158:
159: /**
160: * Returns the swing component with the given guiId.
161: * @param id the guiId from the xml file.
162: * @return JComponent
163: */
164: JComponent getSwingComponent(String id);
165:
166: }
|