|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object uic.widgets.AbstractWindow uic.widgets.MainWindow
public class MainWindow
MainWindow is the application window for any application you will create. In the Single Document Interface (which surpasses the Mutiple Document Interface) way of working every MainWindow equals one document. To create a new application you can instanciate a new MainWindow class and put your content in it followed by a call to show() Details like window positioning and size can be ignored, the MainWindow takes care of that.
Notice that closing (the last) main window will exit java automatically.
Nested Class Summary | |
---|---|
static class |
MainWindow.GlassPaneListener
Class that stops all events to the window when we are in 'help' mode to show a whatIs message. |
static class |
MainWindow.RootPane
Class that is a rootpane on the MainWindow in order to have the statusBar be correctly placed. |
Field Summary | |
---|---|
protected static int |
mainWindowCount
|
protected static MetalTheme |
myTheme
A UICompiler theme (most of the time) that is created for this window |
Fields inherited from class uic.widgets.AbstractWindow |
---|
internalWindow |
Constructor Summary | |
---|---|
MainWindow()
Empty constructor to create a new window without a specific name. |
|
MainWindow(String title)
Create a new window with title. |
Method Summary | |
---|---|
void |
cancelHelpMode()
Cancels the mode started with goToHelpMode. |
void |
closeWindowSlot()
|
protected ActionFactory |
createGui(TranslationInterface translate,
String xmlFile)
Creating an XML based UI can be done by using the returned ActionFactory to add all your actions to. |
protected Window |
createInternalWindow(Dialog owner,
String title,
boolean modal)
|
protected Window |
createInternalWindow(Frame owner,
String title,
boolean modal)
|
protected MetalTheme |
createLookAndFeel()
Called from constructor to set a look and feel on the new Frame. |
protected StatusBar |
createStatusBar()
Override this method to provide your own StatusBar implementation. |
JFrame |
getFrame()
return the top level JFrame which shows the visual MainWindow |
JMenuBar |
getMenuBar()
Return the menuBar. |
protected Preferences |
getPrefs()
Get presistence preferences object, or null if none available. |
StatusBar |
getStatusBar()
return the statusBar. |
JToolBar |
getToolbar()
Deprecated. |
JToolBar |
getToolBar()
Returns the toolbar. |
JToolBar |
getToolBar(String name)
Returns the toolbar with the specified name. |
void |
goToHelpMode()
Go to a mode where the cursor changes to a question mark and clicking on a widget will then trigger a popup with information about the widget. |
void |
openThemeConfigDialog()
Open a dialog that allows the user to configure the colors, fonts and various other settings. |
protected boolean |
queryClose()
Called before the window is closed, either by the user or indirectly by the session manager. |
void |
setAllowConfigurationDialog(boolean enable)
Configure if this window allows a theme-configuration dialog to be shown. |
void |
setAllowToolBarConfiguration(boolean enable)
Configure if each toolbar should have a popup where the user can configure what is shown. |
void |
setAllowToolBarHiding(boolean enable)
Configure if toolbar hiding widgets should be shown to the user. |
void |
setBusy(boolean busy)
Set an hourglass cursor on this window when true. |
void |
setCaption(String name)
Set the name that is displayed in the window manager |
int |
show(Point location,
Dimension size)
Overloaded, see AbstractWindow for details. |
void |
shutdown()
Called when the application exits. |
static void |
useUICTheme(boolean enabled)
To automatically set the UICTheme to the newly created window this should be set before instanciating the first mainWindow. |
Methods inherited from class uic.widgets.AbstractWindow |
---|
getBounds, getDefaultFocusComponent, getDialogSizePanel, getLocation, getRPContainer, getSize, positionDialog, positionDialog, setComponent, setDefaultFocusComponent, show, show |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static int mainWindowCount
protected static MetalTheme myTheme
Constructor Detail |
---|
public MainWindow()
public MainWindow(String title)
Method Detail |
---|
protected Window createInternalWindow(Frame owner, String title, boolean modal)
createInternalWindow
in class AbstractWindow
protected Window createInternalWindow(Dialog owner, String title, boolean modal)
createInternalWindow
in class AbstractWindow
public static void useUICTheme(boolean enabled)
enabled
- set UICTheme to new created MainWinow instances.protected MetalTheme createLookAndFeel()
public void openThemeConfigDialog() throws ClassNotFoundException
Please note that the config dialog is packaged in the optional package of UICompiler, the uic-optional.jar needs to be in the classpath for this to succeed.
IllegalStateException
- if the mainwindow was altered to not use the UICTheme.
ClassNotFoundException
- if the uic-optional.jar is missing from the classpath.public JFrame getFrame()
public int show(Point location, Dimension size)
show
in class AbstractWindow
location
- the x and y coordinates on the screen where the dialog should appear, can be null to use parents position.size
- a size hint for the dialog, can be null to use default based on the preferredSize.
protected Preferences getPrefs()
public JToolBar getToolbar()
getToolBar()
instead
public JToolBar getToolBar()
public JToolBar getToolBar(String name)
protected ActionFactory createGui(TranslationInterface translate, String xmlFile)
ActionFactory
. The file should be made
available to the JVM in the classpath, or in the current directory. It is also possible to provide
an absolute filename (starting with C:\ or / on unix), but that is not advised.
For example:
public class ReportWriter extends MainWindow { public ReportWriter() { Translate myTranslator = new Translate("reportwriter"); ActionFactory af = createGui(myTranslator, "reportwriter"); // init actions here } }By placing a "reportwriter.rc" in the root of your jar your menus and toolbars will automatically be build.
translate
- a translator object which is used to translate strings found in
the XML file, or null for the defaultTranslatorxmlFile
- the name of the file used to construct the UI from.ActionFactory
,
Translate
public JMenuBar getMenuBar()
public StatusBar getStatusBar()
protected StatusBar createStatusBar()
public void setBusy(boolean busy)
public void setCaption(String name)
public void setAllowConfigurationDialog(boolean enable)
enable
- Set true to add a menu entry for the standard configuration dialog
which allows the user to set fonts, colors, etc.
Notice that this option is normally not enabled, since it requires the uic-optional
jar to be in your path.
This only works when called before createGui(uic.TranslationInterface, java.lang.String)
is called.
IllegalStateException
- if called after the createGui has been called.public void setAllowToolBarConfiguration(boolean enable)
enable
- Set true to allow menu items which allow the user to configure toolbars
on the context menuspublic void setAllowToolBarHiding(boolean enable)
enable
- If true, show the checkboxes to show/hide toolbars
on both regular and context menus
This only works when called before createGui(uic.TranslationInterface, java.lang.String)
is called.
IllegalStateException
- if called after the createGui has been called.public void closeWindowSlot()
protected boolean queryClose()
public void shutdown()
public void goToHelpMode()
UICWhatsThis.add(java.awt.Component, java.lang.String)
UICWhatsThis.add(java.awt.Component, java.lang.String)
public void cancelHelpMode()
goToHelpMode()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |