verinec.gui
Class VerinecStudio

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by verinec.gui.VerinecStudio
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants, IConfigurable

public class VerinecStudio
extends JFrame
implements IConfigurable

The main class of the Gui. Provides an interface for the modules to add toolbars and menues, store and save configuration data and more.

This class is a singleton, that is you have to use the static method getInstance() to get the analyser. There is only one instance of VerinecStudio in the application.

The following keyboard shortcuts are defined:

Note that some modules define additional keyboard shortcuts, i.e. the Configurator module.

Author:
Renato Loeffel, Patrick Aebischer, david.buchmann at unifr.ch
See Also:
to learn how to run simulation in endless loop, Serialized Form

Nested Class Summary
(package private)  class VerinecStudio.AboutAction
          Displays an "About" box.
(package private)  class VerinecStudio.EscKeyAction
          Listener for keyboard typing, reacts on esc key to unselect nodes.
(package private)  class VerinecStudio.ExitAction
          Action to exit the application.
(package private)  class VerinecStudio.FindClassThread
          Thread that searches for IVerinecModules
(package private)  class VerinecStudio.LoadAction
          Execute loading of data.
(package private)  class VerinecStudio.ModulesConfig
          Configuration Dialog for adding and removing modules.
(package private)  class VerinecStudio.ModuleSelectAction
          Switch to other module.
(package private)  class VerinecStudio.NewAction
          Execute new network configuration.
(package private)  class VerinecStudio.OptionsAction
          Show preferences dialog.
(package private)  class VerinecStudio.SaveAction
          Execute saving of data.
(package private)  class VerinecStudio.SaveAsAction
          Execute save as of data.
(package private)  class VerinecStudio.SearchingDialog
          Modal Dialog that is shown during searching for Modules.
(package private)  class VerinecStudio.StudioRepository
          A repository to interact with the network currently represented in the gui.
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private static VerinecStudio _instance
           
private  JSplitPane analyserSplitPane
          This panel contains the drawScrollPanel and the infoSplitPane.
private static String CLOSE_ICON
           
private  Document config
          The module configuration.
private static String configName
          The name for the configuration data used in saveConfig(String, Document).
private static String CONFIGURE_ICON
          Icon for the configure action.
private  IVerinecModule currentModule
          The currently active module in the GUI.
private  VerinecStudio.StudioRepository currentState
          The current state of the network is stored in form of a repository.
 DrawPanel drawPanel
          This is the panel where the objects are painted.
private  JScrollPane drawScrollPanel
          This panel contains the drawpanel.
private  Action escKey
          Key listener for esc key.
private static String HELP_ICON
          Icon for the help action.
private  InfoSplitPane infoSplitPane
          This is the panel to the right, where information / editors can be attached.
private  boolean inTransition
          Whether the analyser is currently busy changing from one module to an other.
private  JLabel lblStatus
           
private static String LOAD_ICON
          Icon for the load action.
private  Action loadAction
           
private  Logger logger
           
private  JMenu menuAbout
           
private  JMenuBar menuBar
           
private  JMenu menuNetwork
           
private  JMenu menuPreferences
           
private  boolean modifyAllowed
          Wether modifying is currently allowed.
private  Action moduleSelectAction
           
private  JComboBox moduleSelector
           
private  Hashtable nameToNode
           
private static String NEW_ICON
          Icon for the new action.
private  Action newAction
           
private  HashSet nwComponentChangeListeners
          The selection state change listeners.
private  IVerinecRepository repo
          The currently used repository, or null if this is a new project.
private static String SAVE_ICON
          Icon for the save action.
private  Action saveAction
           
private static String SAVEAS_ICON
          Icon for the save as action.
private  Action saveAsAction
           
private  StandardToolbar stdToolbar
           
private static File storage
          Location where the configuration will be saved to and loaded from.
private  String title
           
private  JPanel toolbarPanel
           
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
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
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
private VerinecStudio()
          Initializes the main frame, opens a window, and creates menus and toolbars.
 
Method Summary
 void addMenu(JMenu menu)
          Add a menu to the application window (will be removed whenever the module is changed).
 void addNetworkElement(Element e)
          Used internally by NwHub when created without element.
 PCNode addNode(int x, int y)
          Create a new PCNode and add its XML to the tree.
 void addNwComponentStateListener(ChangeListener l)
          Register a class as NwComponent change listener.
 void addToolBar(JToolBar bar)
          Add a toolbar to the application window (will be removed whenever the module is changed).
private  void cleanUp()
          Delete all nodes, globals and networks (Hubs).
private  void createHubs()
          Creates the Hub objects from this.physical_networks
private  void createNodes()
          Creates the PCNode objects from this.nodes
 void disbleSaveFromMenu()
          Disable the save and new actions in the menu (used by some modules).
 void enableSaveFromMenu()
          Enable the save and new actions in the menu (used by some modules).
 boolean exit()
          Tell application to exit.
 IVerinecModule getActiveModule()
          Get the currently selected module.
private  Document getConfig()
          Load module configuration.
 ConfigPanel getConfigPanel()
          Get the modules configuration panel.
static VerinecStudio getInstance()
          Get the VerinecStudio instance.
 Vector getModules()
          Get all modules currently available in the application.
 Component[] getNetworkComponents()
          Get all network components used in this simulation as java.awt objects.
 PCNode getNodeByName(String name)
          Get a pcnode by its name.
 IVerinecRepository getRepository()
          Get the repository representing the current state of the network in the GUI.
private  void initializeGui()
          Set up the default menues etc.
 boolean isModifyAllowed()
          Find out whether the current module allows modifications to be made.
 boolean isProjectModified()
          Determines if changes to the network definitions have been made.
 Document loadConfig(String modulename)
          Get a configuration previously saved with saveConfig(String, Document).
 void loadProject()
          Display a dialog to choose a network from the repository to load.
private  void loadProject(IVerinecRepository newRep)
          Actually load a stored network from the repository.
static void main(String[] args)
          Start the program.
 void newProject()
          Set the editor to an empty network.
 void nwComponentStateChanged(NwComponent c)
          Tell the analyser that a NwComponent has changed its state.
 void reloadProject()
          Reloads the network from the repository.
 void removeNwComponentStateListener(ChangeListener l)
          Remove a class from NwComponent change listener.
private  void resetModules()
          Reset the modules drop down.
 void saveConfig(String modulename, Document config)
          Save a module or application part configuration permanently.
 void saveConfiguration(Document config)
          Save the modules configuration.
 void saveProject()
          Save the current network data under its name or ask for a name if it does not yet have one.
 void saveProjectAs()
          Saves the network under a new name.
private  boolean setActiveModule(IVerinecModule newMod)
          Changes the module of the application, letting the module load itselves.
 void setBottomComponent(Component c)
          Set a component to the bottom right corner of the application.
 void setDefaultModule()
          Load the default module, that is the first module in the configuration.
 void setModifyAllowed(boolean b)
          For the module to set if modifying is allowed.
 void setResizeWeight(double w)
          Change the ratio between upper and lower part of InfoSplitPane.
 void setStatus(String status)
          Set the text for the status bar.
 void setTopComponent(Component c)
          Set a component to the upper right corner of the application.
private  boolean unloadProject()
          Check if it is ok to unload the current project and unloads it.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
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, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
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, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, 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, isOpaque, 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, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

_instance

private static VerinecStudio _instance

menuBar

private JMenuBar menuBar

menuNetwork

private JMenu menuNetwork

menuPreferences

private JMenu menuPreferences

menuAbout

private JMenu menuAbout

moduleSelector

private JComboBox moduleSelector

moduleSelectAction

private Action moduleSelectAction

newAction

private Action newAction

loadAction

private Action loadAction

saveAction

private Action saveAction

saveAsAction

private Action saveAsAction

stdToolbar

private StandardToolbar stdToolbar

toolbarPanel

private JPanel toolbarPanel

lblStatus

private JLabel lblStatus

logger

private Logger logger

drawPanel

public DrawPanel drawPanel
This is the panel where the objects are painted. Many parts of the system need direct acces to it, so we just have it public.


infoSplitPane

private InfoSplitPane infoSplitPane
This is the panel to the right, where information / editors can be attached. Modules can add panels using setTopComponent(Component)and setBottomComponent(Component)of the VerinecStudio.


drawScrollPanel

private JScrollPane drawScrollPanel
This panel contains the drawpanel. A reference to it is kept here, because some modules remove this component from the analyserSplitPane. When loading a new module, this scrollpane will be reset by initializeGui().


analyserSplitPane

private JSplitPane analyserSplitPane
This panel contains the drawScrollPanel and the infoSplitPane. When loading a new module, the left pane drawScrollPanel will be set by initializeGui().


currentModule

private IVerinecModule currentModule
The currently active module in the GUI.


inTransition

private boolean inTransition
Whether the analyser is currently busy changing from one module to an other. During this, getActiveModule()throws an error.


config

private Document config
The module configuration.


modifyAllowed

private boolean modifyAllowed
Wether modifying is currently allowed. Defaults to true.


nwComponentChangeListeners

private HashSet nwComponentChangeListeners
The selection state change listeners. Will be notified every time a NwComponent changes its selection state.


escKey

private Action escKey
Key listener for esc key.


currentState

private VerinecStudio.StudioRepository currentState
The current state of the network is stored in form of a repository.


repo

private IVerinecRepository repo
The currently used repository, or null if this is a new project.


nameToNode

private Hashtable nameToNode

storage

private static final File storage
Location where the configuration will be saved to and loaded from. (Could be users home, but currently is just ./data)


title

private final String title
See Also:
Constant Field Values

LOAD_ICON

private static final String LOAD_ICON
Icon for the load action. Taken from Bluecurve /usr/share/icons/Bluecurve/16x16/actions/

See Also:
Constant Field Values

NEW_ICON

private static final String NEW_ICON
Icon for the new action. Taken from Bluecurve /usr/share/icons/Bluecurve/16x16/actions/

See Also:
Constant Field Values

SAVE_ICON

private static final String SAVE_ICON
Icon for the save action. Taken from Bluecurve /usr/share/icons/Bluecurve/16x16/actions/

See Also:
Constant Field Values

SAVEAS_ICON

private static final String SAVEAS_ICON
Icon for the save as action. Taken from Bluecurve /usr/share/icons/Bluecurve/16x16/actions/

See Also:
Constant Field Values

CONFIGURE_ICON

private static final String CONFIGURE_ICON
Icon for the configure action. Taken from Bluecurve /usr/share/icons/Bluecurve/16x16/actions/

See Also:
Constant Field Values

CLOSE_ICON

private static final String CLOSE_ICON
See Also:
Constant Field Values

HELP_ICON

private static final String HELP_ICON
Icon for the help action. Taken from Bluecurve /usr/share/icons/Bluecurve/16x16/actions/

See Also:
Constant Field Values

configName

private static final String configName
The name for the configuration data used in saveConfig(String, Document).

See Also:
Constant Field Values
Constructor Detail

VerinecStudio

private VerinecStudio()
               throws VerinecException
Initializes the main frame, opens a window, and creates menus and toolbars. Be aware that you can not change the order of this initialization, because there is a dependency between the instances.

Throws:
VerinecException - If initialization fails.
Method Detail

getInstance

public static VerinecStudio getInstance()
                                 throws VerinecException
Get the VerinecStudio instance. As VerinecStudio is a singleton, only one instance may exist at any time. The main routine must call show() on the analyser in order to display the window.

Returns:
The instance of VerinecStudio.
Throws:
VerinecException - If creation of VerinecStudio fails.

initializeGui

private void initializeGui()
Set up the default menues etc. Called whenever the module is changed.


resetModules

private void resetModules()
Reset the modules drop down.


addToolBar

public void addToolBar(JToolBar bar)
Add a toolbar to the application window (will be removed whenever the module is changed).

Parameters:
bar - The Toolbar to add.

addMenu

public void addMenu(JMenu menu)
Add a menu to the application window (will be removed whenever the module is changed).

Parameters:
menu - The JMenu to add.

setTopComponent

public void setTopComponent(Component c)
Set a component to the upper right corner of the application. Typically this could be a JPanel.

Parameters:
c - The awt Component to put into right upper part. Pass null to remove the component.

setBottomComponent

public void setBottomComponent(Component c)
Set a component to the bottom right corner of the application. Typically this could be a JPanel.

Parameters:
c - The awt Component to put into right lower part. Pass null to remove the component.

setResizeWeight

public void setResizeWeight(double w)
Change the ratio between upper and lower part of InfoSplitPane.

Parameters:
w - The new ratio, 1 meaning only upper part visible, 0 only lower part.

getRepository

public IVerinecRepository getRepository()
Get the repository representing the current state of the network in the GUI. Note that updates to this repository are NOT reflected in the gui! Use new NwHub, new PCNode resp. addNode and the add... methods in PCNode to create new elements or delete elements.

Returns:
Get the network information.

getNetworkComponents

public Component[] getNetworkComponents()
Get all network components used in this simulation as java.awt objects.

Returns:
NwComponents currently loaded.

getNodeByName

public PCNode getNodeByName(String name)
                     throws VerinecException
Get a pcnode by its name.

Parameters:
name - The hostname of the node to return.
Returns:
The PCNode with that name.
Throws:
VerinecException - if no such node is existing.

addNode

public PCNode addNode(int x,
                      int y)
Create a new PCNode and add its XML to the tree. If the node is to have context menues, use your modules update Component method or something similar.

Parameters:
x - Horizontal coordinate for center of node
y - Vertical coordinate for center of node
Returns:
The newly created node

addNetworkElement

public void addNetworkElement(Element e)
Used internally by NwHub when created without element. Adds a network connection (hub) element to the networks tree. Use detach on the XML to delete from the tree. If you want to make the GUI add a Hub, just create a new NwHub. It will register itselves in the analyser.

Parameters:
e - The connection element to add to the XML tree.

setModifyAllowed

public void setModifyAllowed(boolean b)
For the module to set if modifying is allowed.

Parameters:
b - True if modifying should be allowed, false otherwise.

isModifyAllowed

public boolean isModifyAllowed()
Find out whether the current module allows modifications to be made.

Returns:
True if modifying is allowed, false otherwise.

disbleSaveFromMenu

public void disbleSaveFromMenu()
Disable the save and new actions in the menu (used by some modules).


enableSaveFromMenu

public void enableSaveFromMenu()
Enable the save and new actions in the menu (used by some modules).


setDefaultModule

public void setDefaultModule()
Load the default module, that is the first module in the configuration.


setActiveModule

private boolean setActiveModule(IVerinecModule newMod)
Changes the module of the application, letting the module load itselves. Internal methods also set the active module to null during some operations.

Parameters:
newMod - The module to load
Returns:
Whether the new module was loaded successfully.

getActiveModule

public IVerinecModule getActiveModule()
Get the currently selected module. May be null.

Returns:
The currently active module (may be null).

getModules

public Vector getModules()
Get all modules currently available in the application.

Returns:
The available modules.

cleanUp

private void cleanUp()
Delete all nodes, globals and networks (Hubs).


isProjectModified

public boolean isProjectModified()
Determines if changes to the network definitions have been made. A new network with 0 nodes is considered unchanged.

Returns:
true if the network definitions are modified, false otherwise

unloadProject

private boolean unloadProject()
Check if it is ok to unload the current project and unloads it. Asks the user if the currently loaded network contains unsaved changes.

Returns:
True if the network has been unloaded, false otherwise.

newProject

public void newProject()
Set the editor to an empty network. Asks the user if he wants to save the current network and creates a clean empty space.


reloadProject

public void reloadProject()
Reloads the network from the repository. It does not ask but just discard the current state. If the network was not previously saved, it is completely removed.


loadProject

public void loadProject()
Display a dialog to choose a network from the repository to load. If the current network has been changed, asks the user wants to save. Internally calls loadProject(IVerinecRepository) to do the actual work and newProject() to unload current network.


loadProject

private void loadProject(IVerinecRepository newRep)
                  throws VerinecException
Actually load a stored network from the repository. Does not ask the user anything, drops the old network.

Parameters:
newRep - The repository to load.
Throws:
VerinecException - If any error occurs.

createNodes

private void createNodes()
Creates the PCNode objects from this.nodes


createHubs

private void createHubs()
Creates the Hub objects from this.physical_networks


saveProject

public void saveProject()
Save the current network data under its name or ask for a name if it does not yet have one.


saveProjectAs

public void saveProjectAs()
Saves the network under a new name.


saveConfig

public void saveConfig(String modulename,
                       Document config)
Save a module or application part configuration permanently. The XML is not validated against any schema or dtd.

Parameters:
modulename - The name of the module storing this configuration.
config - The xml configuration data to save.
See Also:
IConfigurable

loadConfig

public Document loadConfig(String modulename)
Get a configuration previously saved with saveConfig(String, Document). The XML is not validated against any schema or dtd.

Parameters:
modulename - The name of the module the configuration was stored for.
Returns:
The configuration data or null if there is no config with such name or the file is invalid xml.
See Also:
IConfigurable

setStatus

public void setStatus(String status)
Set the text for the status bar. The status is also logged with level finer.

Parameters:
status - Text to appear in the status bar.

nwComponentStateChanged

public void nwComponentStateChanged(NwComponent c)
Tell the analyser that a NwComponent has changed its state. VerinecStudio will notify all its ChangeListeners, using c as source of the ChangeEvent.

Parameters:
c - The NwComponent of which the state has changed.

addNwComponentStateListener

public void addNwComponentStateListener(ChangeListener l)
Register a class as NwComponent change listener. It will get notified every time one of the NwComponent gets selected, unselected or modified using the context menue. The ChangeEvent passed to the listener contains the NwComponent which changed as source.

Parameters:
l - The listener to register.

removeNwComponentStateListener

public void removeNwComponentStateListener(ChangeListener l)
Remove a class from NwComponent change listener. It wont get notified any longer.

Parameters:
l - The listener to remove.

exit

public boolean exit()
Tell application to exit. If there is unsaved data, asks the user wheter to save, discard or cancel.

Returns:
True if exiting took place, false otherwise

main

public static void main(String[] args)
Start the program. See the documentation of the class VerinecStudio for environment and keyboard options.

Creates an instance of this class. As long as the window stays open, the program keeps running. There are currently no command line arguments.

Parameters:
args - The command line arguments. They are simply ignored and have no effect.

getConfig

private Document getConfig()
Load module configuration. (Used in the constructor.) If there exists none, create the configuration with default modules (Configurator and Simulator) Saves the configuration after creation. The XML is very simple: a modules root element holds module tags with attributes name and class.

Returns:
The configuration document.

getConfigPanel

public ConfigPanel getConfigPanel()
Get the modules configuration panel.

Specified by:
getConfigPanel in interface IConfigurable
Returns:
An instance of ConfigPanel.

saveConfiguration

public void saveConfiguration(Document config)
Save the modules configuration.

Specified by:
saveConfiguration in interface IConfigurable
Parameters:
config - The modules configuration document.

Copyright © 2005 Verinec, DIUF