public class IlvSwingMainWindow extends IlvAbstractMainWindow
IlvMainWindow
associated with a Swing
component like a JFrame
or a Container
.
IlvMainWindow
interface; for example, for a
subclass of the JFrame
class.Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_SETTINGS_NAME
Default name for main window within the settings.
|
static String |
ICON_ATTRIBUTE
Name of the settings attribute that provides the icon of the
associated
JFrame . |
static String |
SHOW_HIDE_STATUS_BAR_CMD
Action command key for the action that shows or hides the status bar.
|
static String |
SHOW_STATUS_BAR_ATTRIBUTE
Name of the settings attribute that stores the visibility of the status
bar.
|
static String |
SWING_MAIN_WINDOW_SETTINGS_TYPE
Type of settings element that provides settings for a Swing
main window.
|
DEFAULT_CONTAINER_TEMPLATE_NAME
Constructor and Description |
---|
IlvSwingMainWindow(Container container)
Constructs a new
IlvSwingMainWindow associated with the
specified container . |
IlvSwingMainWindow(Container container,
boolean dockingBars,
boolean dockingPanes)
Constructs a new
IlvSwingMainWindow associated with the
specified container . |
IlvSwingMainWindow(JFrame frame)
Constructs a new
IlvSwingMainWindow associated with the
specified frame . |
IlvSwingMainWindow(JFrame frame,
boolean dockingBars,
boolean dockingPanes)
Constructs a new
IlvSwingMainWindow associated with the
specified frame . |
Modifier and Type | Method and Description |
---|---|
static boolean |
AddViews(IlvViewContainer container,
Container clientContainer,
IlvDocumentView[] views)
Default mechanism for adding views to a container.
|
void |
close()
Close the main frame and its associated application.
|
void |
containerActivated(IlvViewContainer viewContainer)
Invoked when a view container owned by this main window has been
activated.
|
IlvViewContainer |
getActiveViewContainer()
Returns the active document view container.
|
Applet |
getApplet()
Returns the applet used to initialize the main window.
|
IlvApplication |
getApplication()
Returns the application of the main window.
|
Container |
getContainer()
Returns the main container of the main window.
|
IlvDockingArea |
getDockingArea()
Returns the docking area associated with this main window.
|
IlvDockingBarArea |
getDockingBarArea()
Returns the docking bar area associated with this main window.
|
URL[] |
getFileChooserChoices()
Returns the array of URLs that can be selectable from the applet file
chooser.
|
URL |
getFileChooserHTMLPage()
Returns the URL to the HTML page that is displayed by the main file
chooser of the application.
|
JFrame |
getFrame()
Returns the main
JFrame that this main window is linked to - can
be null . |
Object[] |
getMainBars()
Gets the menu bars and toolbars of the main window that do not depend on a
specific document type.
|
IlvMDIClient |
getMDIClient()
Returns the MDI client of the frame.
|
Container |
getMDIClientParent()
Returns the container that contains the MDI client component.
|
IlvSettings |
getSettings()
Returns the settings that initialize the Swing main window.
|
IlvSettingsElement |
getSettingsElement()
Returns the settings element that provides the settings for this
Swing main window.
|
String |
getSettingsName()
Returns the name that identifies the main window within the settings.
|
IlvSettingsQuery |
getSettingsQuery()
Returns the query that selects the settings element that provides
the settings of this main window.
|
String |
getSettingsType()
Returns the type of the settings elements that provides the settings for
Swing main windows.
|
IlvStatusBar |
getStatusBar()
Gets the status bar contained within this main panel.
|
boolean |
isStatusBarVisible()
Determines whether the status bar is shown or hidden.
|
protected void |
localeSettingsChanged()
Invoked when the locale settings of the application have changed.
|
void |
readSettings(IlvSettingsElement settingsElement)
Reads the settings of the main window.
|
void |
registerActionMethod(String command,
String methodName)
Registers a method to be called when performing the specified action.
|
void |
registerActionStateMethod(String command,
String methodName)
Registers a method to be called when updating the specified action.
|
void |
registerStaticContainer(String name,
IlvViewContainer container)
Registers the specified view container as a static container within the
Swing main window.
|
void |
setApplication(IlvApplication application)
Sets the application associated with the main window.
|
void |
setContainer(Container container)
Sets the specified container as the main window of an application.
|
void |
setFileChooserChoices(URL[] urls)
Specifies an array of URLs that can be selected from the applet file chooser.
|
void |
setFileChooserHTMLPage(URL url)
Specifies a URL to an HTML page that is displayed by the main file chooser
of the application for selecting a document file.
|
void |
setFrame(JFrame frame)
Sets the main
JFrame that this main window is linked to - can
be null . |
void |
setMDIClient(IlvMDIClient mdiClient)
Sets the MDI client of the frame.
|
void |
setMDIClientParent(Container container)
Specifies the container that will directly contain the MDI client component
responsible for managing MDI child windows.
|
void |
setSettings(IlvSettings settings)
Sets the settings that initialize the Swing main window.
|
void |
setSettingsElement(IlvSettingsElement element)
Forces the settings of the Swing main window to be read and written from the
specified settings element.
|
void |
setSettingsName(String name)
Sets the name that identifies the main window within the settings.
|
void |
setSettingsQuery(IlvSettingsQuery query)
Sets the query that selects the settings element that provides the settings
for this main window.
|
void |
setSettingsSerializer(IlvSettingsSerializer serializer)
Replaces the default settings serializer of this Swing main window
with the specified settings serializer.
|
void |
setSettingsType(String settingsType)
Sets the type of the settings elements that provides the settings for
Swing main windows.
|
void |
setStatusBarVisible(boolean show)
Shows or hides a status bar in the associated
JFrame . |
boolean |
unregisterStaticContainer(IlvViewContainer container)
Unregisters the specified view container from the
main window.
|
void |
writeSettings(IlvSettingsElement settingsElement)
Writes the settings of the main window.
|
addContainerTemplate, getContainerTemplate, getContainerTemplateName, getContainerTemplates, registerStaticView, removeContainerTemplate, unregisterStaticView
public static final String ICON_ATTRIBUTE
JFrame
.public static final String SWING_MAIN_WINDOW_SETTINGS_TYPE
public static final String DEFAULT_SETTINGS_NAME
public static final String SHOW_STATUS_BAR_ATTRIBUTE
public static final String SHOW_HIDE_STATUS_BAR_CMD
public IlvSwingMainWindow(JFrame frame, boolean dockingBars, boolean dockingPanes)
IlvSwingMainWindow
associated with the
specified frame
.frame
- The frame to be seen as a main window by the application.dockingBars
- If true
, the main window will create a new
IlvDockingBarArea
instance and add
it, so that it fits all the content pane of the specified frame;
if false
, no docking bar area will be created.dockingPanes
- If true
, the main window will allow dockable panes;
if false
, the specified frame will not contain a docking area.setFrame(javax.swing.JFrame)
,
getFrame()
,
getApplication()
,
setApplication(ilog.views.appframe.IlvApplication)
public IlvSwingMainWindow(JFrame frame)
IlvSwingMainWindow
associated with the
specified frame
.frame
- The frame to be seen as a main window by the application.setFrame(javax.swing.JFrame)
,
getFrame()
,
getApplication()
,
setApplication(ilog.views.appframe.IlvApplication)
public IlvSwingMainWindow(Container container, boolean dockingBars, boolean dockingPanes)
IlvSwingMainWindow
associated with the
specified container
.container
- The container to be seen as a main window by the application.dockingBars
- If true
, the main window will create a new
IlvDockingBarArea
instance and add
it, so that it fits all the content pane of the specified frame;
if false
, no docking bar area will be created.dockingPanes
- If true
, the main window will allow dockable panes;
if false
, the specified frame will not contain a docking area.setContainer(java.awt.Container)
,
getContainer()
,
getApplication()
public IlvSwingMainWindow(Container container)
IlvSwingMainWindow
associated with the
specified container
.container
- The container to be seen as a main window by the application.setContainer(java.awt.Container)
,
getContainer()
,
getApplication()
public JFrame getFrame()
JFrame
that this main window is linked to - can
be null
.setFrame(javax.swing.JFrame)
public void setFrame(JFrame frame)
JFrame
that this main window is linked to - can
be null
. The content pane of the frame is set as the main
container of this main window and is the parent of the MDI client
component.frame
- The main frame linked to this main window.public void setContainer(Container container)
container
- The container to be seen as a main window by an application.setFrame(javax.swing.JFrame)
public Container getContainer()
public IlvApplication getApplication()
getApplication
in interface IlvMainWindow
getApplication
in class IlvAbstractMainWindow
IlvAbstractMainWindow.setApplication(ilog.views.appframe.IlvApplication)
public void close()
public void registerStaticContainer(String name, IlvViewContainer container)
This view container is not created when a document is created, but has been created with the main window itself. Typically, it can be defined at design time in an IDE when designing the main frame by inserting an instance of a view container within the main frame.
When a document becomes active, for example, if a container containing
one of its view(s) becomes active, the views
of the specified container are set the new active document by setting the
ilog.views.appframe.docview.IlvDocumentView#DOCUMENT_PROPERTY}
of the view to this document and its method
IlvDocumentView.initializeView(ilog.views.appframe.docview.IlvDocument)
is
called with the new active document as the parameter.
registerStaticContainer
in interface IlvMainWindow
registerStaticContainer
in class IlvAbstractMainWindow
name
- The name that identifies this view and that must be used if
calling the method IlvAbstractMainWindow.unregisterStaticView(ilog.views.appframe.docview.IlvDocumentView)
. This name also
identifies a single container template created for this view and must
then be unique among all the container templates added to this main window.container
- The static container to register.unregisterStaticContainer(ilog.views.appframe.docview.IlvViewContainer)
public boolean unregisterStaticContainer(IlvViewContainer container)
unregisterStaticContainer
in interface IlvMainWindow
unregisterStaticContainer
in class IlvAbstractMainWindow
container
- The static container to unregister.true
if the specified container was previously
registered to this main window; false
otherwise.registerStaticContainer(java.lang.String, ilog.views.appframe.docview.IlvViewContainer)
public void containerActivated(IlvViewContainer viewContainer)
By default, the first focusable component of the active view of the view container is set the focus.
This method can be overridden for managing its own focus strategy.
containerActivated
in interface IlvMainWindow
containerActivated
in class IlvAbstractMainWindow
viewContainer
- the view container that has been activated.public void setMDIClientParent(Container container)
setFrame
method.container
- The container that will contain the MDI client component.getMDIClientParent()
,
getMDIClient()
,
setMDIClient(ilog.views.appframe.swing.mdi.IlvMDIClient)
public Container getMDIClientParent()
setMainFrame
method.public void setMDIClient(IlvMDIClient mdiClient)
public IlvMDIClient getMDIClient()
public IlvViewContainer getActiveViewContainer()
public Object[] getMainBars()
getJMenuBar
and
setJMenuBar
methods) if it exists, plus all the toolbars that
are docked or floating in this frame.JToolBar
instance or a JMenuBar
instance.public void setApplication(IlvApplication application)
setApplication
in interface IlvMainWindow
setApplication
in class IlvAbstractMainWindow
application
- The application of the window.IlvAbstractMainWindow.getApplication()
public String getSettingsType()
SWING_MAIN_WINDOW_SETTINGS_TYPE
string if no
settings type has been specified with the method setSettingsType(java.lang.String)
.readSettings(ilog.views.appframe.settings.IlvSettingsElement)
,
setSettingsType(java.lang.String)
public void setSettingsType(String settingsType)
settingsType
- The new settings type.readSettings(ilog.views.appframe.settings.IlvSettingsElement)
,
getSettingsType()
,
getSettingsQuery()
public String getSettingsName()
name
attribute of the
settings element that provides the settings for the associated object.
If no name has been specified using the method setSettingsName(java.lang.String)
,
null
will be returned.setSettingsName(java.lang.String)
,
getSettingsElement()
,
getSettingsQuery()
public void setSettingsName(String name)
name
- The new settings name.public void setSettingsQuery(IlvSettingsQuery query)
query
- The new settings query.getSettingsQuery()
public IlvSettingsQuery getSettingsQuery()
If a query has been specified with the method setSettingsQuery(ilog.views.appframe.settings.IlvSettingsQuery)
,
it will be returned. Otherwise, a query is built for selecting a settings
root element with the type returned by getSettingsType()
and the
value of the name
attribute equal to the name returned
by getSettingsName()
. If getSettingsName()
returns
null
, the query selects the first root element it finds
with the settings type given by the method getSettingsType()
.
setSettingsQuery(ilog.views.appframe.settings.IlvSettingsQuery)
,
#see #getSettingsType
public void setSettingsElement(IlvSettingsElement element)
getSettingsQuery()
.element
- The settings element that provides the settings for the
Swing main window.getSettingsElement()
public IlvSettingsElement getSettingsElement()
setSettingsElement(ilog.views.appframe.settings.IlvSettingsElement)
method, it will be returned. Otherwise,
the settings element is selected from the settings given by the
application with the query returned by
getSettingsQuery()
.null
if no settings
element could be found.setSettingsElement(ilog.views.appframe.settings.IlvSettingsElement)
,
getSettingsQuery()
public IlvSettings getSettings()
setSettings(ilog.views.appframe.settings.IlvSettings)
public void setSettings(IlvSettings settings)
settings
- The new settings of the Swing main window.getSettings()
public void readSettings(IlvSettingsElement settingsElement)
settingsElement
- The root settings element that contains the
preference settings for this main window.public void writeSettings(IlvSettingsElement settingsElement)
settingsElement
- The root settings element to write the settings to.public IlvStatusBar getStatusBar()
protected void localeSettingsChanged()
public void setSettingsSerializer(IlvSettingsSerializer serializer)
As the default serializer calls the readSettings(ilog.views.appframe.settings.IlvSettingsElement)
and
writeSettings(ilog.views.appframe.settings.IlvSettingsElement)
methods for respectively reading and writing the
settings of the main window, this method should not be used by classes
that subclass the IlvSwingMainWindow
. Instead, the methods
readSettings(ilog.views.appframe.settings.IlvSettingsElement)
and writeSettings(ilog.views.appframe.settings.IlvSettingsElement)
should be overridden.
If this main window instance is used as a support for implementing
the IlvMainWindow
interface, this method should be called
to specify a new settings serializer that typically invokes
serialization methods of the implementing class. To keep the default
settings serialization, those serialization methods should invoke
the readSettings(ilog.views.appframe.settings.IlvSettingsElement)
and writeSettings(ilog.views.appframe.settings.IlvSettingsElement)
methods of this
class.
public void setStatusBarVisible(boolean show)
JFrame
.show
- If true
, the status bar will be shown. If
false
, the status bar will be hidden.public boolean isStatusBarVisible()
true
if the status bar is visible; false
otherwise.public static boolean AddViews(IlvViewContainer container, Container clientContainer, IlvDocumentView[] views)
BorderLayout.CENTER
constraint.container
- The container to add views to.clientContainer
- The client container.views
- The array of views to add to the container.true
if the specified views could be added to the
specified container.public void registerActionMethod(String command, String methodName)
The specified method must have been defined with the following signature:
public void methodName(ActionEvent e) { ... }
command
- The command key of the action to be associated with the
specified method.methodName
- The name of the method to associate with the action.public void registerActionStateMethod(String command, String methodName)
The specified method must have been defined with the following signature:
public boolean methodName(Action action) { ... }
command
- The command key of the action to be updated.methodName
- The name of the method to associate with the action with
the specified command key.public void setFileChooserHTMLPage(URL url)
<href>
tag pair.setFileChooserChoices(java.net.URL[])
method. Before the HTML page is displayed, the content of an HTML table
element it contains is replaced by a list of HTML table rows, each
row allowing one of the specified document files to be selected.The rule for retrieving the HTML table to replace the content of is:
"name"
attribute equal to IlvMDIApplet.HTML_CHOICES_TABLE_NAME
,
it is selected.url
- the URL to the HTML page.getFileChooserHTMLPage()
public URL getFileChooserHTMLPage()
setFileChooserHTMLPage(java.net.URL)
public void setFileChooserChoices(URL[] urls)
tr
tags encountered in
the file chooser HTML page template (see setFileChooserHTMLPage(java.net.URL)
).urls
- The array of document file URLs that are selectable from the
applet file chooser.getFileChooserChoices()
,
setFileChooserHTMLPage(java.net.URL)
public URL[] getFileChooserChoices()
setFileChooserChoices(java.net.URL[])
public IlvDockingArea getDockingArea()
public IlvDockingBarArea getDockingBarArea()
public Applet getApplet()
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.