uk.org.arlott.simon.hw.f24.lbsta
Class ScriptEdit

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by uk.org.arlott.simon.hw.f24.lbsta.ScriptEdit
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, CommonInterface

public class ScriptEdit
extends javax.swing.JPanel
implements CommonInterface

Script editing mode.

See Also:
Serialized Form

Nested Class Summary
private  class ScriptEdit.Entry
          Handles the changing of settings of script elements.
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
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  javax.swing.JButton delete
          The delete script button.
private  javax.swing.JPanel edit
          The list of elements.
private  MainWindow mainWindow
          The MainWindow.
private  Network network
          The Network.
private  Script script
          The Script.
private  ScriptEdit scriptEdit
          This object.
private  javax.swing.JButton start
          The create script button.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface uk.org.arlott.simon.hw.f24.lbsta.CommonInterface
MOUSE_PRIMARY, MOUSE_SECONDARY
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ScriptEdit(Script script, MainWindow mainWindow, Network network)
          Creates a new ScriptEdit object.
 
Method Summary
private  void changeType(int id)
          Handles the changing type of an element.
private  void delete(int id)
          Removes an element
 void hide()
          Switches from this mode.
 boolean keyPressed(int keyCode)
          Indicates that a key has been pressed.
private  void makeNew(int id)
          Creates a new element.
 boolean mouseClick(int button, java.lang.Object hover)
          Indicates that a mouse button has been clicked.
 boolean mouseMoved(java.awt.Point position, java.lang.Object hover)
          Indicates that the mouse has been moved.
private  void moveDown(int id)
          Moves an element down.
private  void moveUp(int id)
          Moves an element up.
 void paint(java.awt.Graphics g, java.awt.Dimension size)
          Called after the network has been drawn to allow custom drawing to take place.
 void show()
          Switches to this mode.
private  void update(int id, ScriptComponent sc)
          Updates an element.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

scriptEdit

private final ScriptEdit scriptEdit
This object.


script

private Script script
The Script.


mainWindow

private MainWindow mainWindow
The MainWindow.


network

private Network network
The Network.


edit

private final javax.swing.JPanel edit
The list of elements.


start

private final javax.swing.JButton start
The create script button.


delete

private final javax.swing.JButton delete
The delete script button.

Constructor Detail

ScriptEdit

public ScriptEdit(Script script,
                  MainWindow mainWindow,
                  Network network)
Creates a new ScriptEdit object.

Parameters:
script - The Script.
mainWindow - The MainWindow.
network - The Network.
Method Detail

mouseClick

public boolean mouseClick(int button,
                          java.lang.Object hover)
Description copied from interface: CommonInterface
Indicates that a mouse button has been clicked.

Specified by:
mouseClick in interface CommonInterface
Parameters:
button - The button pressed, either MOUSE_PRIMARY or MOUSE_SECONDARY.
hover - The object, if any, that the mouse pointer is hovering over at the time.
Returns:
A boolean indicating if the display should be redrawn or not.

mouseMoved

public boolean mouseMoved(java.awt.Point position,
                          java.lang.Object hover)
Description copied from interface: CommonInterface
Indicates that the mouse has been moved.

Specified by:
mouseMoved in interface CommonInterface
Parameters:
position - The position of the mouse pointer.
hover - The object, if any, that the mouse pointer is hovering over at the time.
Returns:
A boolean indicating if the display should be redrawn or not.

keyPressed

public boolean keyPressed(int keyCode)
Description copied from interface: CommonInterface
Indicates that a key has been pressed.

Specified by:
keyPressed in interface CommonInterface
Parameters:
keyCode - The KeyCode.getKeyCode() value.
Returns:
A boolean indicating if the display should be redrawn or not.

paint

public void paint(java.awt.Graphics g,
                  java.awt.Dimension size)
Description copied from interface: CommonInterface
Called after the network has been drawn to allow custom drawing to take place.

Specified by:
paint in interface CommonInterface
Parameters:
g - The Graphics object to draw to.
size - The visible area of the panel to be drawn on.

show

public void show()
Switches to this mode.

Specified by:
show in interface CommonInterface
Overrides:
show in class java.awt.Component

hide

public void hide()
Switches from this mode.

Specified by:
hide in interface CommonInterface
Overrides:
hide in class java.awt.Component

update

private void update(int id,
                    ScriptComponent sc)
Updates an element.

Parameters:
id - The id of the element to update.
sc - The ScriptComponent at position id.

moveUp

private void moveUp(int id)
Moves an element up.

Parameters:
id - The id of the element to move up.

moveDown

private void moveDown(int id)
Moves an element down.

Parameters:
id - The id of the element to move down.

changeType

private void changeType(int id)
Handles the changing type of an element.

Parameters:
id - The id of the element to change.

delete

private void delete(int id)
Removes an element

Parameters:
id - The id of the element to remove.

makeNew

private void makeNew(int id)
Creates a new element.

Parameters:
id - The id of the new element.