public 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.
IWindow
,
WindowInfo
,
SingletonWindow
Modifier and Type | Field and Description |
---|---|
static int |
ALIGN_CENTER |
static int |
ALIGN_FIRST_LINE_END |
static int |
ALIGN_FIRST_LINE_END_CASCADE |
static int |
ALIGN_FIRST_LINE_START |
static int |
ALIGN_LAST_LINE_END |
static int |
ALIGN_LAST_LINE_START |
static int |
ALIGN_LINE_END |
static int |
ALIGN_LINE_START |
static int |
ALIGN_PAGE_END |
static int |
ALIGN_PAGE_START |
static WindowManager.MODE |
DIALOG |
static WindowManager.MODE |
TOOL |
static WindowManager.MODE |
WINDOW |
Modifier and Type | Method and Description |
---|---|
IWindow |
addCentredWindow(IWindow p)
Creates a new frame with the provided contents, and shows this
new window.
|
IWindow |
addWindow(IWindow p)
Creates a new frame with the provided contents, and shows this
new window.
|
IWindow |
addWindow(IWindow p,
int align) |
void |
changeWindowInfo(IWindow v,
WindowInfo vi)
Updates the window properties (size, location, etc) according to the
provided WindowInfo object.
|
void |
closeAllWindows()
Close all the currently open windows
|
boolean |
closeSingletonWindow(Class viewClass,
Object model)
Close the SingletonWindow whose class and model are provided as
parameters.
|
boolean |
closeSingletonWindow(Object model)
Close the SingletonWindow whose model is provided as parameter.
|
void |
closeWindow(IWindow p)
Close the provided window.
|
IWindow |
getActiveWindow()
Returns the currently active window, excluding the modal windows and the
PALETTE windows.
|
IWindow[] |
getAllWindows()
Gets all the open windows.
|
IWindow |
getFocusWindow()
Returns the currently focused window, excluding the modal windows.
|
IWindow[] |
getOrderedWindows()
Gets all the open windows (as
getAllWindows() ),
but in this method the windows are returned in the same
deepness order that they have in the application. |
SingletonWindow |
getSingletonWindow(Class windowClass,
Object model)
Return the window associated to the SingletonWindow class and the model
specified.
|
IWindow |
getWindow(JPanel panel)
Gets the associated IWindow to the panel shown with showWindow method.
|
WindowInfo |
getWindowInfo(IWindow v)
Gets the WindowInfo object associated with the provided window.
|
void |
init(MDIFrame f)
Initializes the MDIFrame.
|
void |
move(IWindow window,
int x,
int y)
Change the position of the speficied window.
|
void |
moveToFrom(IWindow win) |
void |
refresh(IWindow win)
Forces a window to be repainted.
|
void |
restoreCursor()
Sets the normal cursor and unblocks events from main window.
|
void |
setBackgroundImage(ImageIcon image,
String typeDesktop)
Sets the provided image as background image in the main window.
|
void |
setLocale(Locale locale) |
void |
setMaximum(IWindow v,
boolean bMaximum)
Maximizes or restores the provided window
|
void |
setWaitCursor()
Shows the wait cursor and blocks all the events from main window until
restoreCursor() is called. |
void |
showWindow(JPanel panel,
String title,
WindowManager.MODE mode)
Useful method to simplify the presentation of a window.
|
static final WindowManager.MODE WINDOW
static final WindowManager.MODE TOOL
static final WindowManager.MODE DIALOG
static final int ALIGN_FIRST_LINE_START
static final int ALIGN_PAGE_START
static final int ALIGN_FIRST_LINE_END
static final int ALIGN_FIRST_LINE_END_CASCADE
static final int ALIGN_LINE_START
static final int ALIGN_LINE_END
static final int ALIGN_LAST_LINE_START
static final int ALIGN_PAGE_END
static final int ALIGN_LAST_LINE_END
static final int ALIGN_CENTER
void init(MDIFrame f)
f
- Application's main frame.IWindow addWindow(IWindow p) throws SingletonDialogAlreadyShownException
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.
p
- Panel with the contents of the new window.SingletonDialogAlreadyShownException
void showWindow(JPanel panel, String title, WindowManager.MODE mode)
panel
- to show as a windowtitle
- title of the windowmode
- type of the window to createSingletonWindow getSingletonWindow(Class windowClass, Object model)
windowClass,
- the class that implement SingletonWindowmodel,
- the model associated to the SingletonWindowIWindow addCentredWindow(IWindow p) throws SingletonDialogAlreadyShownException
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.
p
- Panel with the contents of the new window.SingletonDialogAlreadyShownException
IWindow addWindow(IWindow p, int align) throws SingletonDialogAlreadyShownException
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.
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.
void moveToFrom(IWindow win)
IWindow[] getAllWindows()
PluginServices.getMainFrame()
.IWindow[] getOrderedWindows()
getAllWindows()
),
but in this method the windows are returned in the same
deepness order that they have in the application.boolean closeSingletonWindow(Class viewClass, Object model)
viewClass
- Class of the window which is to be closedmodel
- Model of the window which is to be closedboolean closeSingletonWindow(Object model)
model
- Model of the window which is to be closedvoid closeWindow(IWindow p)
p
- window to be closedvoid closeAllWindows()
WindowInfo getWindowInfo(IWindow v)
v
- window whose information is to be retrievedWindowInfo
void setWaitCursor()
restoreCursor()
is called.void restoreCursor()
setWaitCursor()
void setMaximum(IWindow v, boolean bMaximum) throws PropertyVetoException
v
- The window to be maximized or restoredbMaximum
- If true, the window will be maximized,
if false, it will be restoredPropertyVetoException
void changeWindowInfo(IWindow v, WindowInfo vi)
v
- The window whose properties are to be changedvi
- The WindowInfo object containing the new properties to be setvoid refresh(IWindow win)
win
- The window to be refreshed.void setBackgroundImage(ImageIcon image, String typeDesktop)
typeDesktop
argument.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.void setLocale(Locale locale)
void move(IWindow window, int x, int y)
window
- x
- y
-