Class Remote

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--javax.swing.JFrame
                                |
                                +--Remote

public class Remote
extends javax.swing.JFrame
implements java.util.Observer, java.lang.Runnable

The main REMOTE application window.

See Also:
Serialized Form

Inner Class Summary
 class Remote.AppEditClearHandler
          Inner class to handle the Edit->Clear menu item.
 class Remote.AppEditCopyHandler
          Inner class to handle the Edit->Copy menu item.
 class Remote.AppEditCutHandler
          Inner class to handle the Edit->Cut menu item.
 class Remote.AppEditPasteHandler
          Inner class to handle the Edit->Paste menu item.
 class Remote.AppEditSelectAllHandler
          Inner class to handle the Edit->Select All menu item.
 class Remote.AppFileNewHandler
          Inner class to handle the File->New menu item.
 class Remote.AppFileOpenHandler
          Inner class to handle the File->Open menu item.
 class Remote.AppFileQuitHandler
          Inner class to handle the File->Quit menu item.
 class Remote.AppFileRevertHandler
          Inner class to handle the File->Revert menu item.
 class Remote.AppFileSaveACopyAsHandler
          Inner class to handle the File->Save a Copy As...
 class Remote.AppFileSaveAsHandler
          Inner class to handle the File->Save As...
 class Remote.AppFileSaveHandler
          Inner class to handle the File->Save menu item.
 class Remote.AppHelpAboutHandler
          Inner class to handle the Help->About Remote menu item.
 class Remote.AppHelpContentsHandler
          Inner class to handle the Help->Help Contents menu item.
 class Remote.AppHelpUsingHandler
          Inner class to handle the Help->Using Help menu item.
 class Remote.AppOptionsLanguageHandler
          Inner class to handle the Options->Set Language menu item.
 class Remote.AppOptionsParserHandler
          Inner class to handle the Options->Set Robot Parser menu item.
 class Remote.AppOptionsRobotHandler
          Inner class to handle the Options->Set Robot menu item.
 class Remote.AppOptionsSaveConfigHandler
          Inner class to handle the Options->Save Configuration menu item.
 class Remote.AppSimHomeHandler
          Inner class to handle the Simulation->Home menu item.
 class Remote.AppSimStartHandler
          Inner class to handle the Simulation->Start Simulation menu item.
 class Remote.AppSimStepHandler
          Inner class to handle the Simulation->Step Simulation menu item.
 class Remote.AppSimStopHandler
          Inner class to handle the Simulation->Stop Simulation menu item.
 class Remote.AppViewRotateHandler
          Inner class to handle the View->Rotate Tool menu item.
 class Remote.AppViewTranslateHandler
          Inner class to handle the View->Translate Tool menu item.
 class Remote.AppViewZoomHandler
          Inner class to handle the View->Zoom Tool menu item.
 
Inner classes inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Field Summary
protected  boolean alreadySaved
           
protected  java.util.Hashtable cfgTable
           
static int currentProgressValue
           
protected  HelpFrame helpFrame
           
static int INITIAL_HEIGHT
           
static int INITIAL_WIDTH
           
protected  javax.swing.JPanel labelPanel
           
static javax.swing.JProgressBar progressBar
           
static javax.swing.JLabel progressLabel
           
protected  java.lang.String remoteFileDir
           
protected  java.lang.String remoteFileName
           
protected  java.lang.Thread remoteThread
           
protected  boolean requestStop
           
protected  MouseRotate rotate
           
protected  javax.swing.JToggleButton rotateButton
           
protected  java.awt.Cursor rotateCursor
           
protected  java.util.Hashtable rsrcTable
           
protected  javax.swing.JTextArea source
           
protected  boolean sourceChanged
           
protected  Robot theRobot
           
protected  javax.media.j3d.BranchGroup theScene
           
protected  SimulationEngine theSimulationEngine
           
protected  com.sun.j3d.utils.universe.SimpleUniverse theUniverse
           
protected  javax.media.j3d.Canvas3D theViewport
           
protected  javax.swing.JToolBar toolbar
           
static int totalPanels
           
protected  MouseTranslate translate
           
protected  javax.swing.JToggleButton translateButton
           
protected  java.awt.Cursor translateCursor
           
protected  MouseZoom zoom
           
protected  javax.swing.JToggleButton zoomButton
           
protected  java.awt.Cursor zoomCursor
           
 
Fields inherited from class javax.swing.JFrame
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, 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
 
Constructor Summary
Remote()
          Public constructor, initiates the window, menus, popup menus, and the initiates the internal simulation engine.
 
Method Summary
 javax.swing.JButton createJButton(java.lang.String s, java.lang.String a, boolean e, java.awt.event.ActionListener al)
          Creates a JButton, using the given resource string, and actioncommand string.
 javax.swing.JToggleButton createJToggleButton(java.lang.String s, java.lang.String a, boolean e, java.awt.event.ActionListener al)
          Creates a JToggleButton, using the given resource string, and actioncommand string.
 javax.swing.JToolBar createJToolBar()
          Creates the toolbar for the application.
 java.awt.MenuBar createMenuBar()
          Creates and returns the MenuBar for the application.
 java.awt.MenuItem createMenuItem(java.lang.String s, boolean sc, java.awt.event.ActionListener a)
          Creates a MenuItem.
 javax.media.j3d.BranchGroup createScene()
          Creates the BranchGroup.
 javax.swing.JPanel createStatus()
          Create the Simulation Variables JPanel.
 void disableUI()
          Disables the application's toolbar items and MenuItems, to prevent input during simulation.
protected  void displayMessage(java.lang.String title, java.lang.String message)
          Displays a message from the application.
 void enableUI()
          Enables the application's toolbar items and MenuItems, which were disabled during simulation.
 void fillResources()
          Fills up the resources using the hardcoded and soft-loaded resources.
 javax.swing.JFrame getRootComponent()
          Returns the root component.
static void main(java.lang.String[] args)
          Start the application; if two command-line arguments are given, these are assumed to be the two-letter language and country codes, which are used to set a new default Locale for the application.
 void run()
          The application Thread run loop.
 void start()
          Starts the application thread.
 void stop()
          Stops the remote thread.
 void update(java.util.Observable o, java.lang.Object arg)
          Update the object's representation of the robot whenever the model is changed elsewhere by either the parsers or the simulation engine.
 void updateStatus()
          Updates the joint variable output display.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, processWindowEvent, setContentPane, setDefaultCloseOperation, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getFrames, getIconImage, getMenuBar, getState, getTitle, isResizable, remove, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle
 
Methods inherited from class java.awt.Window
addWindowListener, applyResourceBundle, applyResourceBundle, dispose, getFocusOwner, getInputContext, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, isShowing, pack, postEvent, processEvent, removeWindowListener, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setFont, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INITIAL_WIDTH

public static int INITIAL_WIDTH

INITIAL_HEIGHT

public static int INITIAL_HEIGHT

totalPanels

public static int totalPanels

currentProgressValue

public static int currentProgressValue

progressLabel

public static javax.swing.JLabel progressLabel

progressBar

public static javax.swing.JProgressBar progressBar

theSimulationEngine

protected SimulationEngine theSimulationEngine

theRobot

protected Robot theRobot

rsrcTable

protected java.util.Hashtable rsrcTable

cfgTable

protected java.util.Hashtable cfgTable

toolbar

protected javax.swing.JToolBar toolbar

theViewport

protected javax.media.j3d.Canvas3D theViewport

theUniverse

protected com.sun.j3d.utils.universe.SimpleUniverse theUniverse

theScene

protected javax.media.j3d.BranchGroup theScene

zoomButton

protected javax.swing.JToggleButton zoomButton

translateButton

protected javax.swing.JToggleButton translateButton

rotateButton

protected javax.swing.JToggleButton rotateButton

zoom

protected MouseZoom zoom

translate

protected MouseTranslate translate

rotate

protected MouseRotate rotate

zoomCursor

protected java.awt.Cursor zoomCursor

translateCursor

protected java.awt.Cursor translateCursor

rotateCursor

protected java.awt.Cursor rotateCursor

source

protected javax.swing.JTextArea source

labelPanel

protected javax.swing.JPanel labelPanel

helpFrame

protected HelpFrame helpFrame

remoteFileName

protected java.lang.String remoteFileName

remoteFileDir

protected java.lang.String remoteFileDir

alreadySaved

protected boolean alreadySaved

sourceChanged

protected boolean sourceChanged

requestStop

protected boolean requestStop

remoteThread

protected java.lang.Thread remoteThread
Constructor Detail

Remote

public Remote()
Public constructor, initiates the window, menus, popup menus, and the initiates the internal simulation engine.
Parameters:
title - the Frame title.
Method Detail

main

public static void main(java.lang.String[] args)
Start the application; if two command-line arguments are given, these are assumed to be the two-letter language and country codes, which are used to set a new default Locale for the application.
Parameters:
args - the command-line arguments.

createScene

public javax.media.j3d.BranchGroup createScene()
Creates the BranchGroup.
Returns:
the 3D representation of the Robot.

createStatus

public javax.swing.JPanel createStatus()
Create the Simulation Variables JPanel.
Returns:
the completed Simulation Variable JPanel.

createMenuItem

public java.awt.MenuItem createMenuItem(java.lang.String s,
                                        boolean sc,
                                        java.awt.event.ActionListener a)
Creates a MenuItem. Should be updated to use MenuItem once Swing is stable.
Parameters:
s - the resource string to use to retrieve the language-specific label.
sc - indicates whether or not to create a MenuShortcut for this MenuItem.
a - the ActionListener to handle events.
Returns:
the completed MenuItem.

createMenuBar

public java.awt.MenuBar createMenuBar()
Creates and returns the MenuBar for the application. Update to Swing once stable, and solution to Canvas3D heavy-weight problem.
Returns:
the completed application MenuBar object.

createJButton

public javax.swing.JButton createJButton(java.lang.String s,
                                         java.lang.String a,
                                         boolean e,
                                         java.awt.event.ActionListener al)
Creates a JButton, using the given resource string, and actioncommand string.
Parameters:
s - the resource String.
a - the ActionCommand String.
e - indicates if this JButton should be enabled.
al - the ActionListener to handle events.
Returns:
the completed JButton.

createJToggleButton

public javax.swing.JToggleButton createJToggleButton(java.lang.String s,
                                                     java.lang.String a,
                                                     boolean e,
                                                     java.awt.event.ActionListener al)
Creates a JToggleButton, using the given resource string, and actioncommand string.
Parameters:
s - the resource String.
a - the ActionCommand String.
e - indicates if this JToggleButton should be selected.
al - the ActionListener to handle events.
Returns:
the completed JButton.

createJToolBar

public javax.swing.JToolBar createJToolBar()
Creates the toolbar for the application.
Returns:
the completed toolbar.

fillResources

public void fillResources()
Fills up the resources using the hardcoded and soft-loaded resources.

start

public void start()
Starts the application thread.

run

public void run()
The application Thread run loop.
Specified by:
run in interface java.lang.Runnable

stop

public void stop()
Stops the remote thread. Note that this method is not meant to implement Runnable.stop(), due to its deprecation in JDK 1.2. Instead, it changes a boolean flag, which is used to exit the run(), allowing the Thread to terminate properly.

enableUI

public void enableUI()
Enables the application's toolbar items and MenuItems, which were disabled during simulation.

disableUI

public void disableUI()
Disables the application's toolbar items and MenuItems, to prevent input during simulation.

updateStatus

public void updateStatus()
Updates the joint variable output display.

getRootComponent

public javax.swing.JFrame getRootComponent()
Returns the root component.
Returns:
this instance, which is the root of all the GUI.

displayMessage

protected void displayMessage(java.lang.String title,
                              java.lang.String message)
Displays a message from the application.
Parameters:
title - the title for the information Dialog.
message - the message for the information Dialog.

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Update the object's representation of the robot whenever the model is changed elsewhere by either the parsers or the simulation engine.
Specified by:
update in interface java.util.Observer
Parameters:
o - Observable object which is attempting to update this object.
arg - the argument Object for the update.