Interface MDIManager
This interface acts as window manager. It is the place to create new windows, close existing ones or modify their properties (size, position, etc).
Any class extending from JPanel and implementing the IWindow
interface may become an Andami window. Andami will create a real
window (normally a JInternalFrame) and put the JPanel inside the
real window. In order to differentiate the contents (panels
extending JPanel and implementing IWindow) from the real window
(normally JInternalFrames or JDialogs), we will use
window to refer to the contents and frame
to refer to the real window.
This class is implemented by the Andami Skin (currently libCorePlugin), which will decide the final implementation of frames. A different frame implementation could be used by switching the Skin.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final org.gvsig.tools.swing.api.windowmanager.WindowManager.MODEstatic final org.gvsig.tools.swing.api.windowmanager.WindowManager.MODEstatic final org.gvsig.tools.swing.api.windowmanager.WindowManager.MODE -
Method Summary
Modifier and TypeMethodDescriptionCreates a new frame with the provided contents, and shows this new window.Creates a new frame with the provided contents, and shows this new window.voidchangeWindowInfo(IWindow v, WindowInfo vi) Updates the window properties (size, location, etc) according to the provided WindowInfo object.voidClose all the currently open windowsbooleancloseSingletonWindow(Class viewClass, Object model) Close the SingletonWindow whose class and model are provided as parameters.booleancloseSingletonWindow(Object model) Close the SingletonWindow whose model is provided as parameter.voidClose the provided window.Returns the currently active window, excluding the modal windows and the PALETTE windows.IWindow[]Gets all the open windows.Returns the currently focused window, excluding the modal windows.IWindow[]Gets all the open windows (asgetAllWindows()), but in this method the windows are returned in the same deepness order that they have in the application.getSingletonWindow(Class windowClass, Object model) Return the window associated to the SingletonWindow class and the model specified.Gets the associated IWindow to the panel shown with showWindow method.Gets the WindowInfo object associated with the provided window.voidInitializes the MDIFrame.booleanvoidChange the position of the speficied window.voidmoveToFrom(IWindow win) voidForces a window to be repainted.voidSets the normal cursor and unblocks events from main window.voidsetBackgroundImage(ImageIcon image, String typeDesktop) Sets the provided image as background image in the main window.voidvoidsetMaximum(IWindow v, boolean bMaximum) Maximizes or restores the provided windowvoidShows the wait cursor and blocks all the events from main window untilrestoreCursor()is called.voidshowWindow(JPanel panel, String title, org.gvsig.tools.swing.api.windowmanager.WindowManager.MODE mode) Useful method to simplify the presentation of a window.
-
Field Details
-
WINDOW
static final org.gvsig.tools.swing.api.windowmanager.WindowManager.MODE WINDOW -
TOOL
static final org.gvsig.tools.swing.api.windowmanager.WindowManager.MODE TOOL -
DIALOG
static final org.gvsig.tools.swing.api.windowmanager.WindowManager.MODE DIALOG -
ALIGN_FIRST_LINE_START
static final int ALIGN_FIRST_LINE_START- See Also:
-
ALIGN_PAGE_START
static final int ALIGN_PAGE_START- See Also:
-
ALIGN_FIRST_LINE_END
static final int ALIGN_FIRST_LINE_END- See Also:
-
ALIGN_FIRST_LINE_END_CASCADE
static final int ALIGN_FIRST_LINE_END_CASCADE- See Also:
-
ALIGN_LINE_START
static final int ALIGN_LINE_START- See Also:
-
ALIGN_LINE_END
static final int ALIGN_LINE_END- See Also:
-
ALIGN_LAST_LINE_START
static final int ALIGN_LAST_LINE_START- See Also:
-
ALIGN_PAGE_END
static final int ALIGN_PAGE_END- See Also:
-
ALIGN_LAST_LINE_END
static final int ALIGN_LAST_LINE_END- See Also:
-
ALIGN_CENTER
static final int ALIGN_CENTER- See Also:
-
-
Method Details
-
init
Initializes the MDIFrame. It must be called before starting to use it. It receives the application's main frame (MDIFrame) as parameter.- Parameters:
f- Application's main frame.
-
addWindow
Creates a new frame with the provided contents, and shows this new window. The new frame's properties are set according to the WindowInfo object from IWindow's
getWindowInfo()method. The new frame is disposed when closed.If the provided IWindow also implements SingletonWindow, and another SingletonWindow already exists and uses the same model, this later window will be sent to the foreground and no new window will be created.
- Parameters:
p- Panel with the contents of the new window.- Returns:
- Returns the added IWindow, or in case it is a SingletonWindow and there is another SingletonWindow with the same model that it is already shown, returns this later SingletonWindow.
- Throws:
SingletonDialogAlreadyShownException
-
showWindow
void showWindow(JPanel panel, String title, org.gvsig.tools.swing.api.windowmanager.WindowManager.MODE mode) Useful method to simplify the presentation of a window. For more precise control over the behavior of the window use addWindow This methos- Parameters:
panel- to show as a windowtitle- title of the windowmode- type of the window to create
-
getSingletonWindow
Return the window associated to the SingletonWindow class and the model specified. If not exists any singleton window associated to this null is returned.- Parameters:
windowClass- , the class that implement SingletonWindowmodel- , the model associated to the SingletonWindow- Returns:
- the requested window or null.
-
addCentredWindow
Creates a new frame with the provided contents, and shows this new window. The new frame will be centered, regardless the position specified in the WindowInfo object from IWindow's
getWindowInfo()method. The new frame is disposed when closed.If the provided IWindow also implements SingletonWindow, and another SingletonWindow already exists and uses the same model, this later window will be sent to the foreground and no new window will be created.
- Parameters:
p- Panel with the contents of the new window.- Returns:
- Returns the added IWindow, or in case it is a SingletonWindow and there is another SingletonWindow with the same model that it is already shown, returns this later SingletonWindow.
- Throws:
SingletonDialogAlreadyShownException
-
addWindow
-
getActiveWindow
IWindow getActiveWindow()Returns the currently active window, excluding the modal windows and the PALETTE windows. If the currently active window is modal or PALETTE type, the previous non-modal and non-PALETTE active window is returned.
Modal windows and PALETTE windows are considered to be auxiliary windows, that is the reason why they are not returned.
- Returns:
- A reference to the active window, or null if there is no active window
-
getFocusWindow
IWindow getFocusWindow()Returns the currently focused window, excluding the modal windows. If the currently focused window is modal, the previous non-modal focused window is returned.
- Returns:
- A reference to the focused window, or null if there is no focused window
-
moveToFrom
-
getAllWindows
IWindow[] getAllWindows()Gets all the open windows. Minimized and maximized windows are included. The application's main frame is excluded; it can be accessed usingPluginServices.getMainFrame().- Returns:
- An IWindow array containing all the open windows.
-
getOrderedWindows
IWindow[] getOrderedWindows()Gets all the open windows (asgetAllWindows()), but in this method the windows are returned in the same deepness order that they have in the application.- Returns:
- An ordered array containing all the panels in the application. The first element of the array is the topmost (foreground) window in the application. The last element is the bottom (background) window.
-
closeSingletonWindow
Close the SingletonWindow whose class and model are provided as parameters.- Parameters:
viewClass- Class of the window which is to be closedmodel- Model of the window which is to be closed- Returns:
- true if there is an open window whose class and model match the provided parameteres, false otherwise.
-
closeSingletonWindow
Close the SingletonWindow whose model is provided as parameter.- Parameters:
model- Model of the window which is to be closed- Returns:
- true if there is an open window whose model matchs the provided one, false otherwise.
-
closeWindow
Close the provided window. If the window is openend with the WindowManager, use setVisible(false) in the JPanel to close it.- Parameters:
p- window to be closed
-
closeAllWindows
void closeAllWindows()Close all the currently open windows -
getWindowInfo
Gets the WindowInfo object associated with the provided window.- Parameters:
v- window whose information is to be retrieved- Returns:
- WindowInfo The WindowInfo object containing the information about the provided window
- See Also:
-
setWaitCursor
void setWaitCursor()Shows the wait cursor and blocks all the events from main window untilrestoreCursor()is called. -
restoreCursor
void restoreCursor()Sets the normal cursor and unblocks events from main window.- See Also:
-
setMaximum
Maximizes or restores the provided window- Parameters:
v- The window to be maximized or restoredbMaximum- If true, the window will be maximized, if false, it will be restored- Throws:
PropertyVetoException
-
changeWindowInfo
Updates the window properties (size, location, etc) according to the provided WindowInfo object.- Parameters:
v- The window whose properties are to be changedvi- The WindowInfo object containing the new properties to be set
-
refresh
Forces a window to be repainted. Normally, this is not necessary, as windows are refreshed when necessary.- Parameters:
win- The window to be refreshed.
-
setBackgroundImage
Sets the provided image as background image in the main window. The image will be centered, set in mosaic or expanded to fill the full window, depending on thetypeDesktopargument.- Parameters:
image- The image to be set as background imagetypeDesktop- Decides whether the image should be centered, set in mosaic or expanded. Accepted values are: Theme.CENTERED, Theme.MOSAIC and Theme.EXPAND.
-
setLocale
-
move
Change the position of the speficied window.- Parameters:
window-x-y-
-
getWindow
Gets the associated IWindow to the panel shown with showWindow method. Also panel shown with the tools WindowManager.- Parameters:
panel-- Returns:
-
getImagePreview
BufferedImage getImagePreview() -
isModalDialogShowing
boolean isModalDialogShowing() -
getInternalSize
Dimension getInternalSize()
-