|
|||||||||
| 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
uk.org.arlott.simon.hw.f24.lbsta.MainWindow
public class MainWindow
The main window of the application.
| Nested Class Summary | |
|---|---|
private class |
MainWindow.NetworkPanel
Network panel displayed on the main window. |
| Nested classes/interfaces inherited from class javax.swing.JFrame |
|---|
javax.swing.JFrame.AccessibleJFrame |
| Nested classes/interfaces inherited from class java.awt.Frame |
|---|
java.awt.Frame.AccessibleAWTFrame |
| Nested classes/interfaces inherited from class java.awt.Window |
|---|
java.awt.Window.AccessibleAWTWindow |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
private CommonInterface |
currentMode
The current mode. |
private java.lang.Object |
hover
The current network object the mouse is hovering over. |
private boolean |
hoverEnabled
Indicates whether or not to update the hover value on mouseover. |
private javax.swing.JPanel |
innerMainPanel
The inner main panel of the window, holds the network panel and the status text. |
private javax.swing.JPanel |
mainPanel
The main panel of the window. |
private MainWindow |
mainWindow
Constant reference to the instance of this object. |
private javax.swing.JMenuBar |
menuBar
The application menu bar. |
private javax.swing.JMenu |
mnuEdit
The Edit menu. |
private javax.swing.JRadioButtonMenuItem |
mnuEditCreateBridge
The Edit - Create Bridge menu item. |
private javax.swing.JRadioButtonMenuItem |
mnuEditCreateHost
The Edit - Create Host menu item. |
private javax.swing.JRadioButtonMenuItem |
mnuEditCreateLAN
The Edit - Create LAN menu item. |
private javax.swing.JRadioButtonMenuItem |
mnuEditModifyObject
The Edit - Modify Object menu item. |
private javax.swing.JMenu |
mnuFile
The File menu. |
private javax.swing.JMenuItem |
mnuFileExit
The File - Exit menu item. |
private javax.swing.JMenuItem |
mnuFileNew
The File - New menu item. |
private javax.swing.JMenuItem |
mnuFileOpen
The File - Open menu item. |
private javax.swing.JMenuItem |
mnuFileSave
The File - Save menu item. |
private javax.swing.JMenuItem |
mnuFileSaveAs
The File - Save As menu item. |
private javax.swing.JMenu |
mnuHelp
The Help menu. |
private javax.swing.JMenuItem |
mnuHelpAbout
The Help - About menu item. |
private javax.swing.JMenuItem |
mnuHelpLegend
The Help - Legend menu item. |
private javax.swing.JMenu |
mnuMode
The Mode menu. |
private javax.swing.JRadioButtonMenuItem |
mnuModeEdit
The Mode - Edit menu item. |
private javax.swing.JRadioButtonMenuItem |
mnuModeScript
The Mode - Script menu item. |
private javax.swing.JRadioButtonMenuItem |
mnuModeView
The Mode - View menu item. |
private javax.swing.JMenu |
mnuOptions
The Options menu. |
private javax.swing.JRadioButtonMenuItem |
mnuOptionsLeftSidebar
The Options - Left Sidebar menu item. |
private javax.swing.JRadioButtonMenuItem |
mnuOptionsRightSidebar
The Options - Right Sidebar menu item. |
private javax.swing.JMenu |
mnuSimulation
The Simultion menu. |
private javax.swing.JMenuItem |
mnuSimulationRestart
The Simulation - Restart menu item. |
private javax.swing.JMenuItem |
mnuSimulationStart
The Simulation - Start menu item. |
private javax.swing.JMenuItem |
mnuSimulationStep
The Simulation - Step menu item. |
private Network |
network
Constant reference to the Network. |
private NetworkEdit |
networkEdit
The network edit mode. |
private MainWindow.NetworkPanel |
networkPanel
The network panel where the network is drawn. |
private NetworkView |
networkView
The network view mode. |
private javax.swing.ImageIcon |
pauseIcon
The Pause menu and toolbar icon. |
private Script |
script
Constant reference to the Script |
private ScriptEdit |
scriptEdit
The script edit mode. |
private java.lang.Object |
selected
The currently selected network object. |
private java.awt.Component |
sidePanel
The current side panel. |
private java.lang.String |
sidePanelPosition
The position of the side panel, either EAST or WEST. |
private javax.swing.JSlider |
speedSelect
The speed selection slider. |
private javax.swing.JLabel |
speedValue
The current speed text. |
private javax.swing.ImageIcon |
startIcon
The Start menu and toolbar icon. |
private javax.swing.JLabel |
statusText
The status text label. |
private javax.swing.ImageIcon |
stepIcon
The Step menu and toolbar icon. |
private javax.swing.JToggleButton |
tlbEdit
The Edit mode toolbar button. |
private javax.swing.JToggleButton |
tlbEditCreateBridge
The Create Bridge toolbar button. |
private javax.swing.JToggleButton |
tlbEditCreateHost
The Create Host toolbar button. |
private javax.swing.JToggleButton |
tlbEditCreateLAN
The Create LAN toolbar button. |
private javax.swing.JToggleButton |
tlbEditModifyObject
The Modify Object toolbar button. |
private javax.swing.JToolBar.Separator |
tlbEditSeparator
The Edit mode toolbar separator. |
private javax.swing.JButton |
tlbNew
The New toolbar button. |
private javax.swing.JButton |
tlbOpen
The New toolbar button. |
private javax.swing.JButton |
tlbSave
The Save toolbar button. |
private javax.swing.JToggleButton |
tlbScript
The Script mode toolbar button. |
private javax.swing.JToggleButton |
tlbView
The View mode toolbar button. |
private javax.swing.JButton |
tlbViewRestart
The Restart toolbar button. |
private javax.swing.JToggleButton |
tlbViewStart
The Start toolbar button. |
private javax.swing.JToggleButton |
tlbViewStep
The Step toolbar button. |
private javax.swing.JToolBar |
toolBar
The application tool bar. |
| 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 | |
|---|---|
MainWindow()
Creates a new MainWindow object with the starting mode the network edit mode. |
|
| Method Summary | |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent ae)
Action event handler. |
void |
deSelect()
Deselects the currently selected network object. |
private void |
doToolbarButton(java.lang.Object o)
Performs the action associated with a toolbar button. |
void |
enableHover(boolean enabled)
Enables or disables hover detection mode. |
java.lang.Object |
getHover()
Gets the current network object the mouse is hovering over. |
java.lang.Object |
getSelected()
Gets the currently selected network object. |
void |
repaintNetworkPanel()
Repaints the network panel. |
void |
requestNetworkPanelFocus()
Requests that the network panel is given focus. |
private boolean |
saveOrDiscard(java.lang.String title)
Checks if the network has been saved and if the changes should be discarded. |
boolean |
scriptExists()
Returns if a script exists or not. |
void |
select()
Selects the network object currently being hovered over. |
void |
setPanel(java.awt.Component p)
Changes the side panel. |
void |
setScriptState(boolean exists)
Updates the state of the step button, disabling it if a script exists. |
void |
setSimulationState(boolean running,
boolean stepping,
boolean activeMode)
Updates the simulation state. |
void |
setSpeed(int speed)
Updates the actual speed of the simulation. |
void |
setStatusText(java.lang.String text)
Changes the status text. |
void |
stateChanged(javax.swing.event.ChangeEvent ce)
Change event handler. |
| 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 |
|---|
private final MainWindow mainWindow
private final Network network
Network.
private MainWindow.NetworkPanel networkPanel
private final Script script
Script
private NetworkView networkView
private NetworkEdit networkEdit
private ScriptEdit scriptEdit
private CommonInterface currentMode
private java.lang.Object hover
private boolean hoverEnabled
hover value on mouseover.
private java.lang.Object selected
private javax.swing.JPanel mainPanel
private javax.swing.JPanel innerMainPanel
private java.awt.Component sidePanel
private java.lang.String sidePanelPosition
EAST or WEST.
private javax.swing.JLabel statusText
private javax.swing.JMenuBar menuBar
private javax.swing.JToolBar toolBar
private javax.swing.JButton tlbNew
New toolbar button.
private javax.swing.JButton tlbOpen
New toolbar button.
private javax.swing.JButton tlbSave
Save toolbar button.
private javax.swing.JToggleButton tlbView
View mode toolbar button.
private javax.swing.JButton tlbViewRestart
Restart toolbar button.
private javax.swing.ImageIcon startIcon
Start menu and toolbar icon.
private javax.swing.ImageIcon stepIcon
Step menu and toolbar icon.
private javax.swing.ImageIcon pauseIcon
Pause menu and toolbar icon.
private javax.swing.JToggleButton tlbViewStart
Start toolbar button.
private javax.swing.JToggleButton tlbViewStep
Step toolbar button.
private javax.swing.JToggleButton tlbEdit
Edit mode toolbar button.
private javax.swing.JToolBar.Separator tlbEditSeparator
Edit mode toolbar separator.
private javax.swing.JToggleButton tlbEditModifyObject
Modify Object toolbar button.
private javax.swing.JToggleButton tlbEditCreateLAN
Create LAN toolbar button.
private javax.swing.JToggleButton tlbEditCreateHost
Create Host toolbar button.
private javax.swing.JToggleButton tlbEditCreateBridge
Create Bridge toolbar button.
private javax.swing.JToggleButton tlbScript
Script mode toolbar button.
private javax.swing.JSlider speedSelect
private javax.swing.JLabel speedValue
private javax.swing.JMenu mnuFile
File menu.
private javax.swing.JMenuItem mnuFileNew
File - New menu item.
private javax.swing.JMenuItem mnuFileOpen
File - Open menu item.
private javax.swing.JMenuItem mnuFileSave
File - Save menu item.
private javax.swing.JMenuItem mnuFileSaveAs
File - Save As menu item.
private javax.swing.JMenuItem mnuFileExit
File - Exit menu item.
private javax.swing.JMenu mnuMode
Mode menu.
private javax.swing.JRadioButtonMenuItem mnuModeView
Mode - View menu item.
private javax.swing.JRadioButtonMenuItem mnuModeEdit
Mode - Edit menu item.
private javax.swing.JRadioButtonMenuItem mnuModeScript
Mode - Script menu item.
private javax.swing.JMenu mnuEdit
Edit menu.
private javax.swing.JRadioButtonMenuItem mnuEditModifyObject
Edit - Modify Object menu item.
private javax.swing.JRadioButtonMenuItem mnuEditCreateLAN
Edit - Create LAN menu item.
private javax.swing.JRadioButtonMenuItem mnuEditCreateHost
Edit - Create Host menu item.
private javax.swing.JRadioButtonMenuItem mnuEditCreateBridge
Edit - Create Bridge menu item.
private javax.swing.JMenu mnuSimulation
Simultion menu.
private javax.swing.JMenuItem mnuSimulationRestart
Simulation - Restart menu item.
private javax.swing.JMenuItem mnuSimulationStart
Simulation - Start menu item.
private javax.swing.JMenuItem mnuSimulationStep
Simulation - Step menu item.
private javax.swing.JMenu mnuOptions
Options menu.
private javax.swing.JRadioButtonMenuItem mnuOptionsLeftSidebar
Options - Left Sidebar menu item.
private javax.swing.JRadioButtonMenuItem mnuOptionsRightSidebar
Options - Right Sidebar menu item.
private javax.swing.JMenu mnuHelp
Help menu.
private javax.swing.JMenuItem mnuHelpLegend
Help - Legend menu item.
private javax.swing.JMenuItem mnuHelpAbout
Help - About menu item.
| Constructor Detail |
|---|
public MainWindow()
MainWindow object with the starting mode the network edit mode.
| Method Detail |
|---|
public void actionPerformed(java.awt.event.ActionEvent ae)
actionPerformed in interface java.awt.event.ActionListenerae - The ActionEvent to be handled.private void doToolbarButton(java.lang.Object o)
o - The toolbar button that has been pressed.
public void setSimulationState(boolean running,
boolean stepping,
boolean activeMode)
running - Current running/paused state.stepping - Stepping mode in use or not.activeMode - Simulation mode is the active mode.public void setScriptState(boolean exists)
exists - Indicates that a script exists.public boolean scriptExists()
true if a script exists.public void stateChanged(javax.swing.event.ChangeEvent ce)
stateChanged in interface javax.swing.event.ChangeListenerce - The ChangeEvent to be handled.public void setSpeed(int speed)
speed - The new speed in milliseconds.private boolean saveOrDiscard(java.lang.String title)
title - The title of the prompt.
true if the network can be overwritten.public java.lang.Object getHover()
hover object.public void enableHover(boolean enabled)
enabled - New state of hover mode.public java.lang.Object getSelected()
selected object.public void select()
public void deSelect()
public void requestNetworkPanelFocus()
public void repaintNetworkPanel()
public void setPanel(java.awt.Component p)
p - The new side panel, may be null to remove.public void setStatusText(java.lang.String text)
text - The new status text, may be null to remove.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||