jwo.landserf.gui
Class ScriptEditor

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 jwo.utils.gui.JWFrame
                          extended by jwo.landserf.gui.ScriptEditor
All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, Runnable, EventListener, Accessible, RootPaneContainer, WindowConstants, VariableListener

public class ScriptEditor
extends JWFrame
implements ActionListener, VariableListener

Creates a frame for managing LandScript files.

Version:
2.3, 2nd December, 2008.
Author:
Jo Wood
See Also:
Serialized Form

Nested Class Summary
 
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
 
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, 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
ScriptEditor()
          Creates a GUI for script editing.
ScriptEditor(boolean quitOnExit)
          Creates a GUI for script editing.
ScriptEditor(File file)
          Creates a GUI for script editing, initially containing the script in the given file.
ScriptEditor(File file, boolean quitOnExit)
          Creates a GUI for script editing, initially containing the script in the given file.
ScriptEditor(String initialText)
          Creates a GUI for script editing, initially containing the given text.
ScriptEditor(String initialText, boolean quitOnExit)
          Creates a GUI for script editing, initially containing the given text.
 
Method Summary
 void actionPerformed(ActionEvent event)
          Responds to a selection of menu item or button press.
 void closeDown()
          Closes down the window and depending on what was passed to the constructor, may quit the application.
 void setLogger(Logger otherLogger)
          Allows a logger to capture output from the script editor if output logging is turned on.
 void setMessage(String text)
          Displays a message in the editor's status bar.
 void updateGUI(boolean isRunning)
          Updates GUI depending on whether a script is currently running or not.
 void variableListChanged(HashMap varList)
          Updates the syntax highlighting when variables are added/removed from those stored in the current script.
 
Methods inherited from class jwo.utils.gui.JWFrame
addActionItem, addActionItem, addActionItem, addActionItem, addActionItem, addBinActionItem, addBinActionItem, addBinActionItem, addBinActionItem, addBinActionItem, addBinActionItem, addBinActionItem, addBinActionItem, addBinActionItem, addBinActionItem, addButtonSeparator, addInterruptionListener, addMenu, addMenu, addMenu, addMenuSeparator, getAction, initWindow, removeInterruptionListener, run, setMaxProgress, setMinProgress, setProgress, showProgress
 
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
 

Constructor Detail

ScriptEditor

public ScriptEditor()
Creates a GUI for script editing. This version creates an empty editor which will not quit the application when the editor is closed.


ScriptEditor

public ScriptEditor(boolean quitOnExit)
Creates a GUI for script editing. This version creates an empty editor with the option of quitting the application when the editor is closed.

Parameters:
quitOnExit - The application will quit when the window is closed if true.

ScriptEditor

public ScriptEditor(File file)
Creates a GUI for script editing, initially containing the script in the given file. This version will not quit the application when the editor is closed.

Parameters:
file - File containing script. If null, script editor is started with no script.

ScriptEditor

public ScriptEditor(String initialText)
Creates a GUI for script editing, initially containing the given text. This version will not quit the application when the editor is closed.

Parameters:
initialText - Initial text to appear in editor.

ScriptEditor

public ScriptEditor(File file,
                    boolean quitOnExit)
Creates a GUI for script editing, initially containing the script in the given file.

Parameters:
file - File containing script. If null, script editor is started with no script.
quitOnExit - The application will quit when the window is closed if true.

ScriptEditor

public ScriptEditor(String initialText,
                    boolean quitOnExit)
Creates a GUI for script editing, initially containing the given text.

Parameters:
initialText - Initial text to appear in editor.
quitOnExit - The application will quit when the window is closed if true.
Method Detail

setLogger

public void setLogger(Logger otherLogger)
Allows a logger to capture output from the script editor if output logging is turned on. This logger will be passed any standard or error output when a script is run. As each command is interpreted, it is also sent to the logger as Level.FINE. This allows script input to be separated from script output (which is sent to Level.INFO, Level.WARNING and Level.SEVERE.

Parameters:
otherLogger - Logger to receive messages.

updateGUI

public void updateGUI(boolean isRunning)
Updates GUI depending on whether a script is currently running or not.

Parameters:
isRunning - True if script is running, otherwise false.

closeDown

public void closeDown()
Closes down the window and depending on what was passed to the constructor, may quit the application.

Overrides:
closeDown in class JWFrame

variableListChanged

public void variableListChanged(HashMap varList)
Updates the syntax highlighting when variables are added/removed from those stored in the current script. variable list has changed in some way.

Specified by:
variableListChanged in interface VariableListener
Parameters:
varList - List of variables.

actionPerformed

public void actionPerformed(ActionEvent event)
Responds to a selection of menu item or button press.

Specified by:
actionPerformed in interface ActionListener
Parameters:
event - Menu/button selection event.

setMessage

public void setMessage(String text)
Displays a message in the editor's status bar. Also copies any output to any registered loggers.

Overrides:
setMessage in class JWFrame
Parameters:
text - Message to display.
See Also:
setLogger(java.util.logging.Logger)


Copyright Jo Wood, 1996-2009, last modified, 17th April, 2009