public class IlvDiagrammerFrame extends JFrame
IlvDiagrammerFrame
is a ready-to-use Swing application
based on the diagram component, IlvDiagrammer
, and
built using the other components of this package.
The Diagrammer application can be used to view Diagrammer data files. It also has an editing mode for modifying diagrams.
The Diagrammer application contains:
JDesktopPane
is used to manage several
diagram components contained in internal frames.
IlvDiagrammerMenuBar
IlvDiagrammerEditBar
above the working area.
IlvDiagrammerViewBar
on the leading side.
IlvDiagrammerPaletteBar
, if the application is
in editing mode.
IlvDiagrammerTree
displaying the data model as a tree.
IlvDiagrammerPropertySheet
to view and edit the properties of the
selected object.
IlvDiagrammerOverview
to see the whole diagram in
a separate small panel.
JSplitPane
s
and JTabbedPane
s on the leading side of the working area.
The application accepts the following command-line arguments:
-title <title>
A title for the application frame. By default, a localized
title is read from the resource bundle.
-mdi [true|on|yes]
Start in multidocument mode. By default, the application
starts in single-document mode.
-edit [true|on|yes]
Start in editing mode. By default, the application
starts in viewing mode (editing is not allowed). You can
switch between editing and viewing mode with the application running using
a menu item in the Options menu.
-simple [true|on|yes]
Start in "simple" mode. In this mode, the toolbars and menus
contain only a minimal set of actions to view a diagram.
This mode can be used for demos that need a simpler GUI
and where the user does not need to load other diagrams.
-psheet
Show the property sheet at startup. Default is false
-tree
Show the tree at startup. Default is false
-overview
Show the overview at startup. Default is false
-systemlf
Use the system look-and-feel. By default, the Metal look-and-feel
is used.
-data <url>
Load the specified data file at startup. No default.
-style <url>
Use the specified style sheet instead of the default style sheet.
-palette <url>
Use the specified palette file instead of the default palette.
Example::
java ilog.views.diagrammer.application.IlvDiagrammerFrame -mdi -edit -data file:/c/examples/mydata.xml -style file:/c/examples/mystyle.css
JFrame.AccessibleJFrame
Frame.AccessibleAWTFrame
Window.AccessibleAWTWindow, Window.Type
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
IlvDiagrammerFrame()
Creates the application with the default resource bundle
"ilog.views.diagrammer.application.application"
and with no default command-line arguments. |
IlvDiagrammerFrame(ResourceBundle bundle,
String[] defaultArgs)
Creates the application with the specified resource bundle.
|
IlvDiagrammerFrame(String[] defaultArgs)
Creates the application with the default resource bundle
"ilog.views.diagrammer.application.application" . |
Modifier and Type | Method and Description |
---|---|
protected IlvDiagrammer |
createDiagrammer()
Creates a new diagram component.
|
protected JToolBar[] |
createPaletteToolBars()
Creates the palette toolbar(s) for this application.
|
protected IlvDiagrammerStatusBar |
createStatusBar()
Creates the status bar for this application.
|
void |
error(ResourceBundle bundle,
String messageKey,
Object[] args,
Throwable t)
Displays an error message.
|
protected void |
exit()
Exits this application.
|
Container |
getApplicationContentPane()
Returns the container of the application or applet, that is,
the container that was passed as the
contentPane
argument to the init(java.awt.Container) method. |
URL |
getBaseURL()
Returns a URL that can be used to resolve relative URLs for loading
data files.
|
ResourceBundle |
getBundle()
Returns the resource bundle used to get localized messages for
this application.
|
IlvDiagrammer |
getCurrentDiagrammer()
Returns the currently active diagram component.
|
JDesktopPane |
getDesktopPane()
Returns the desktop pane of this application if it is in multidocument (MDI) mode,
or
null if it is in single-document (SDI) mode. |
IlvDiagrammer[] |
getDiagrammers()
Returns all the diagram components displayed by the application.
|
IlvDiagrammerToolBar |
getEditToolBar()
Returns the edit toolbar.
|
JMenuBar |
getJMenuBar()
Returns the menu bar.
|
IlvDiagrammerOverview |
getOverview()
Returns the overview component.
|
JToolBar[] |
getPaletteToolBars()
Returns the palette toolbars.
|
IlvDiagrammerPropertySheet |
getPropertySheet()
Returns the property sheet.
|
JPanel |
getSdiContainer()
Returns the container of the (single) diagram component when this
application is in single-document (SDI) mode.
|
IlvDiagrammer |
getSdiDiagrammer()
Returns the (single) diagram component when this
application is in single-document (SDI) mode.
|
IlvDiagrammerStatusBar |
getStatusBar()
Returns the status bar.
|
URL |
getStyleSheetURL()
Returns the default style sheet used by this application.
|
IlvDiagrammerTable |
getTable()
Returns the table component.
|
IlvDiagrammerTree |
getTree()
Returns the tree component.
|
IlvDiagrammerToolBar |
getViewToolBar()
Returns the view toolbar.
|
void |
init(Container contentPane)
This method is called both when the class is run as an application and when
it is run as an applet.
|
void |
init(String[] args)
This method initializes a new instance of this class when it is run as
an application.
|
void |
initFrame()
Initialize frame settings.
|
boolean |
isEditMode()
Returns
true if the application is in editing mode. |
boolean |
isFloatable()
Decides if the tool bars are floatable or not.
|
boolean |
isJnlp()
Returns
true if this class is run with JNLP. |
boolean |
isMdi()
Returns
true if the application is in multidocument (MDI) mode. |
boolean |
isOverviewVisible()
Returns
true if the overview is visible. |
boolean |
isPropertySheetVisible()
Returns
true if the property sheet is visible. |
boolean |
isTableVisible()
Returns
true if the table is visible. |
boolean |
isTreeVisible()
Returns
true if the tree is visible. |
boolean |
isUseAutomaticWaitCursor()
Tests if the wait cursor is shown automatically.
|
static void |
main(String[] args)
The main method of the application.
|
protected IlvDiagrammer |
newDiagram()
Creates a new diagram component in the application.
|
void |
parseArgs(String[] args)
Parses the command-line arguments.
|
protected void |
ready()
This method is called when the GUI is set up, after the application is
made displayable.
|
void |
setDefaultArgs(String[] defaultArgs)
Sets the default command-line arguments.
|
void |
setOverviewVisible(boolean visible)
Shows or hides the overview.
|
void |
setPropertySheetVisible(boolean visible)
Shows or hides the property sheet.
|
void |
setStyleSheetURL(URL styleSheetURL)
Changes the default style sheet used by this application.
|
void |
setTableVisible(boolean visible)
Shows or hides the table.
|
void |
setTreeVisible(boolean visible)
Shows or hides the tree.
|
void |
setUseAutomaticWaitCursor(boolean flag)
Sets whether the wait cursor is displayed as soon as a mouse click
causes any action that needs a runtime of more than 100 ms.
|
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getFont, postEvent
public IlvDiagrammerFrame(ResourceBundle bundle, String[] defaultArgs)
bundle
- The resource bundle to use instead of the default
resource bundle.defaultArgs
- You can pass default command-line arguments that will be used
if they are not overridden on the command line or in the HTML element for the applet.
For example, you can pass "-tree -psheet -edit" to start in editing mode with the
tree and the property sheet visible.public IlvDiagrammerFrame(String[] defaultArgs)
"ilog.views.diagrammer.application.application"
.defaultArgs
- You can pass default command-line arguments that will be used
if they are not overridden on the command line or in the HTML element for the applet.
For example, you can pass "-tree -psheet -edit" to start in editing mode with the
tree and the property sheet visible.public IlvDiagrammerFrame()
"ilog.views.diagrammer.application.application"
and with no default command-line arguments. Note that you can
set the default arguments later using the setDefaultArgs(java.lang.String[])
method.public static void main(String[] args)
args
- The command-line arguments.public ResourceBundle getBundle()
public JDesktopPane getDesktopPane()
null
if it is in single-document (SDI) mode.public boolean isEditMode()
true
if the application is in editing mode.public boolean isMdi()
true
if the application is in multidocument (MDI) mode.public JMenuBar getJMenuBar()
getJMenuBar
in class JFrame
public JToolBar[] getPaletteToolBars()
public IlvDiagrammerToolBar getEditToolBar()
public IlvDiagrammerToolBar getViewToolBar()
public IlvDiagrammerStatusBar getStatusBar()
public JPanel getSdiContainer()
public IlvDiagrammer getSdiDiagrammer()
public URL getStyleSheetURL()
public void setStyleSheetURL(URL styleSheetURL)
styleSheetURL
- the new style sheetpublic IlvDiagrammerTable getTable()
public IlvDiagrammerTree getTree()
public IlvDiagrammerOverview getOverview()
public IlvDiagrammerPropertySheet getPropertySheet()
public void setTreeVisible(boolean visible)
visible
- new valuepublic boolean isTreeVisible()
true
if the tree is visible.public void setPropertySheetVisible(boolean visible)
visible
- new valuepublic boolean isPropertySheetVisible()
true
if the property sheet is visible.public void setOverviewVisible(boolean visible)
visible
- new valuepublic boolean isOverviewVisible()
true
if the overview is visible.public void setTableVisible(boolean visible)
visible
- new valuepublic boolean isTableVisible()
true
if the table is visible.public IlvDiagrammer getCurrentDiagrammer()
null
.public IlvDiagrammer[] getDiagrammers()
public void setDefaultArgs(String[] defaultArgs)
Note that this method can be called only before the application is initialized,
that is, before its init(java.awt.Container)
method is called.
Typically, you will write a subclass and set the default arguments in the
constructor. If this method is called after init(java.awt.Container)
has been called, an exception is thrown.
defaultArgs
- The default command-line arguments.public void init(String[] args)
init(java.awt.Container)
method.
This method is typically called from the main
method when
this class is derived:
public class MyDiagrammerApplication extends IlvDiagrammerApplication { public static void main(String[] args) { new MyDiagrammerApplication().init(args); } }
args
- The command-line arguments passed to the main
method.public boolean isJnlp()
true
if this class is run with JNLP.public void parseArgs(String[] args)
args
- The command-line arguments. If null
,
the class is assumed to be run as an applet, and the arguments will be read
by calling the getParameter
method of the applet.public URL getBaseURL() throws MalformedURLException
MalformedURLException
public void initFrame()
public void init(Container contentPane)
For an application,
it is called from init(java.lang.String[])
, which is itself
called from main(java.lang.String[])
.
contentPane
- The panel in which the GUI will be created.public boolean isUseAutomaticWaitCursor()
true
is returned.public void setUseAutomaticWaitCursor(boolean flag)
This method activates the wait cursor mechanism via the event dispatch loop, hence the automatic wait cursor becomes effective with some delay. If modal dialogs are still open while this method is called, the effect will only be visible after all model dialogs are closed.
flag
- Set to true
so the wait cursor is displayed
automatically. The default value is true
.public boolean isFloatable()
public Container getApplicationContentPane()
contentPane
argument to the init(java.awt.Container)
method.protected void ready()
protected JToolBar[] createPaletteToolBars() throws Exception
The default implementation creates one IlvDiagrammerPaletteBar
whose contents are specified by the paletteURL
command-line
(or applet) parameter.
Subclasses can override this method to create more palette toolbars if necessary.
Exception
- If an error occurred while loading a toolbar.protected IlvDiagrammerStatusBar createStatusBar()
protected IlvDiagrammer newDiagram()
This method can be overridden if you need to perform custom operations
when a new diagram is created. If you need to create an instance of a
subclass of IlvDiagrammer
, you should
override createDiagrammer()
instead.
null
if the new diagram component
was not created (this can happen in single-document mode if the diagram
has been modified but the user clicked "No" in the confirmation box).protected IlvDiagrammer createDiagrammer()
newDiagram()
.
It can be overridden if you need to use a subclass of
IlvDiagrammer
.
The default implementation returns new IlvDiagrammer()
.IlvDiagrammer
.protected void exit()
frame
parameter set to true
), the frame is closed
and the applet is stopped. If the class is running as an application, this method calls
System.exit(0)
.public void error(ResourceBundle bundle, String messageKey, Object[] args, Throwable t)
bundle
- The set of resources used for localized messages.messageKey
- The message key, retrieved from the application's resource bundle.args
- The message arguments, if the message needs formatting.t
- The Throwable instance that caused the error, or null
.ComponentAction.error(java.awt.Component, java.util.ResourceBundle, java.lang.String, java.lang.Object[], java.lang.Throwable)
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.