|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
verinec.gui.VerinecStudio
public class VerinecStudio
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:
Configurator module.
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 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.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.awt.MenuContainer |
|---|
getFont, postEvent |
| Field Detail |
|---|
private static VerinecStudio _instance
private JMenuBar menuBar
private JMenu menuNetwork
private JMenu menuPreferences
private JMenu menuAbout
private JComboBox moduleSelector
private Action moduleSelectAction
private Action newAction
private Action loadAction
private Action saveAction
private Action saveAsAction
private StandardToolbar stdToolbar
private JPanel toolbarPanel
private JLabel lblStatus
private Logger logger
public DrawPanel drawPanel
private InfoSplitPane infoSplitPane
setTopComponent(Component)and
setBottomComponent(Component)of the VerinecStudio.
private JScrollPane drawScrollPanel
analyserSplitPane. When loading a new module, this scrollpane will be reset by initializeGui().
private JSplitPane analyserSplitPane
drawScrollPanel and the infoSplitPane. When loading a new module, the left pane drawScrollPanel will be set by initializeGui().
private IVerinecModule currentModule
private boolean inTransition
getActiveModule()throws an error.
private Document config
private boolean modifyAllowed
private HashSet nwComponentChangeListeners
private Action escKey
private VerinecStudio.StudioRepository currentState
private IVerinecRepository repo
private Hashtable nameToNode
private static final File storage
private final String title
private static final String LOAD_ICON
private static final String NEW_ICON
private static final String SAVE_ICON
private static final String SAVEAS_ICON
private static final String CONFIGURE_ICON
private static final String CLOSE_ICON
private static final String HELP_ICON
private static final String configName
saveConfig(String, Document).
| Constructor Detail |
|---|
private VerinecStudio()
throws VerinecException
VerinecException - If initialization fails.| Method Detail |
|---|
public static VerinecStudio getInstance()
throws VerinecException
VerinecException - If creation of VerinecStudio fails.private void initializeGui()
private void resetModules()
public void addToolBar(JToolBar bar)
bar - The Toolbar to add.public void addMenu(JMenu menu)
menu - The JMenu to add.public void setTopComponent(Component c)
c - The awt Component to put into right upper part. Pass null to
remove the component.public void setBottomComponent(Component c)
c - The awt Component to put into right lower part. Pass null to
remove the component.public void setResizeWeight(double w)
w - The new ratio, 1 meaning only upper part visible, 0 only lower part.public IVerinecRepository getRepository()
public Component[] getNetworkComponents()
public PCNode getNodeByName(String name)
throws VerinecException
name - The hostname of the node to return.
VerinecException - if no such node is existing.
public PCNode addNode(int x,
int y)
x - Horizontal coordinate for center of nodey - Vertical coordinate for center of node
public void addNetworkElement(Element e)
NwHub. It will register
itselves in the analyser.
e - The connection element to add to the XML tree.public void setModifyAllowed(boolean b)
b - True if modifying should be allowed, false otherwise.public boolean isModifyAllowed()
public void disbleSaveFromMenu()
public void enableSaveFromMenu()
public void setDefaultModule()
private boolean setActiveModule(IVerinecModule newMod)
newMod - The module to load
public IVerinecModule getActiveModule()
public Vector getModules()
private void cleanUp()
public boolean isProjectModified()
private boolean unloadProject()
public void newProject()
public void reloadProject()
public void loadProject()
loadProject(IVerinecRepository) to do the
actual work and newProject() to unload current network.
private void loadProject(IVerinecRepository newRep)
throws VerinecException
newRep - The repository to load.
VerinecException - If any error occurs.private void createNodes()
private void createHubs()
public void saveProject()
public void saveProjectAs()
public void saveConfig(String modulename,
Document config)
modulename - The name of the module storing this configuration.config - The xml configuration data to save.IConfigurablepublic Document loadConfig(String modulename)
saveConfig(String, Document).
The XML is not validated against any schema or dtd.
modulename - The name of the module the configuration was stored for.
IConfigurablepublic void setStatus(String status)
status - Text to appear in the status bar.public void nwComponentStateChanged(NwComponent c)
c - The NwComponent of which the state has changed.public void addNwComponentStateListener(ChangeListener l)
l - The listener to register.public void removeNwComponentStateListener(ChangeListener l)
l - The listener to remove.public boolean exit()
public static void main(String[] args)
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.
args - The command line arguments. They are simply ignored and have no effect.private Document getConfig()
public ConfigPanel getConfigPanel()
getConfigPanel in interface IConfigurablepublic void saveConfiguration(Document config)
saveConfiguration in interface IConfigurableconfig - The modules configuration document.
|
Copyright © 2005 Verinec, DIUF | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||