edu.neu.ccs.gui
Class SimpleFunctionPane

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byedu.neu.ccs.gui.DisplayPanel
                      extended byedu.neu.ccs.gui.BasePane
                          extended byedu.neu.ccs.gui.SimpleFunctionPane
All Implemented Interfaces:
Accessible, AlertListener, Displayable, EventListener, ImageObserver, JPTConstants, MalformedDataListener, MenuContainer, Serializable, SwingConstants
Direct Known Subclasses:
SimpleFunctionPaneWithIO

public class SimpleFunctionPane
extends BasePane

Class SimpleFunctionPane provides a pane that permits the interactive definition of simple functions, that is, objects of class SimpleFunction. As part of the definition of a simple function, the function is installed into the default parser.

Here is a description of the GUI.

A dropdown list provides the names of all currently installed simple functions and clicking on a name will bring up its current definition.

A simple function definition may be viewed, edited, or created from scratch using three text fields for:

There are three actions attached to buttons:

The GUI prevents the user from replacing or removing an built-in function whose class is not equal to or derived from SimpleFunction. For convenience, the names of the built-in functions are provided in a dropdown. In addition, the names of the special forms are also provided in a separate dropdown.

Version:
2.6.0
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  Annotation bodyLabel
          The label for the function body text field.
protected  TextFieldView bodyTFV
          The function body text field.
protected  SimpleAction clear
          The clear fields action.
protected  JButton clearButton
          The clear fields button.
protected  Object[] defButtons
          The array with the 3 buttons.
protected  HTable defButtonsTable
          The table with the 3 buttons.
protected  SimpleAction defFun
          The define function action.
protected  JButton defFunButton
          The define function button.
protected  VTable definitionPanel
          The full definition panel.
protected  Object[] definitionStuff
          The entities for the full definition panel.
protected  Annotation fcnsLabel
          The label for the functions dropdown list.
protected  Dropdown fcnsList
          The functions dropdown list.
protected  TablePanel innerPanel
          The inner panel.
protected  Object[][] innerStuff
          The entities for the inner panel with the various dropdowns and the function name text field.
protected  Object[] mainStuff
          The array with the fields and the buttons.
protected  VTable mainTable
          The table with the fields and the buttons.
protected  Annotation nameLabel
          The label for the function name text field.
protected  TextFieldView nameTFV
          The function name text field.
protected  Annotation ordinaryFcnsLabel
          The label for the ordinary functions dropdown list.
protected  Dropdown ordinaryFcnsList
          The ordinary functions dropdown list.
protected  Annotation paramsLabel
          The label for the function parameters text field.
protected  TextFieldView paramsTFV
          The function parameters text field.
protected  BaseParser parser
          Reference to the default JPT parser.
protected  SimpleAction remFun
          The remove function action.
protected  JButton remFunButton
          The remove function button.
protected  Annotation reservedLabel
          The label for the reserved IDs dropdown list.
protected  Dropdown reservedList
          The reserved IDs dropdown list.
protected  SimpleAction revertOrdinaryAction
          The action to revert the ordinary functions list to a blank string.
protected  SimpleAction revertReservedAction
          The action to revert the reserved list to a blank string.
protected  SimpleAction selectFcn
          The action to select a function from the functions dropdown list and show its definition.
 
Fields inherited from class edu.neu.ccs.gui.BasePane
baseFontSize, buttonFont, DEFAULT_BASE_FONT_SIZE, fieldFont, fontSize, gap, labelFont, largeFieldWidth, mediumFieldWidth, MINIMUM_FONT_SIZE, monospacedFontName, sansserifFontName, serifFontName, smallFieldWidth
 
Fields inherited from class edu.neu.ccs.gui.DisplayPanel
background, codec, CODEC
 
Fields inherited from class javax.swing.JPanel
 
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.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface edu.neu.ccs.gui.Displayable
DEFAULT_VIEW_STATE, VIEW_STATE
 
Fields inherited from interface edu.neu.ccs.util.JPTConstants
ABOVE, ALIGNMENT, BELOW, BOTTOM_LEFT, BOTTOM_RIGHT, DEFAULT, FONT, INPUT_PROPERTIES, MANDATORY, OPTIONAL, ORIENTATION, TOP_LEFT, TOP_RIGHT, VALUE
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SimpleFunctionPane()
          The constructor for a simple function definition pane.
 
Method Summary
protected  void clearFields()
          Clears the 3 text fields.
protected  void defineFunction()
          Defines a function using the data in the 3 text fields.
static void main(String[] args)
          The main method launches a simple function definition pane in its own GUI frame.
protected  void populateFcnsList()
          Populate the simple functions dropdown list with the names of all simple functions currently installed in the default parser.
protected  void populateOrdinaryFcnsList()
          Populate the ordinary functions dropdown list with the names of all ordinary functions currently installed in the default parser.
protected  void populateReservedList()
          Populate the reserved dropdown list with the reserved names currently installed in the default parser.
protected  void removeFunction()
          Removes a function using the name in the function name text field.
protected  void revertOrdinaryFcnsList()
          Revert the ordinary functions list to showing the blank string.
protected  void revertReservedList()
          Revert the ordinary functions list to showing the blank string.
protected  void selectFunction()
          The method to select a function from the functions dropdown list and show its definition.
 
Methods inherited from class edu.neu.ccs.gui.BasePane
getButtonFont, getFieldFont, getFontSize, getGap, getLabelFont, getLargeFieldWidth, getMediumFieldWidth, getSmallFieldWidth, initializeBasePane
 
Methods inherited from class edu.neu.ccs.gui.DisplayPanel
add, add, add, add, add, addBorder, addObject, addObject, addObject, addObject, bevelBorderLowered, bevelBorderLowered, bevelBorderLowered, bevelBorderLowered, bevelBorderLowered, bevelBorderRaised, bevelBorderRaised, bevelBorderRaised, bevelBorderRaised, bevelBorderRaised, compoundBorder, compoundBorder, dataMalformed, emptyBorder, emptyBorder, emptyBorder, endAlert, etchBorderLowered, etchBorderLowered, etchBorderLowered, etchBorderRaised, etchBorderRaised, etchBorderRaised, frame, frame, frame, frame, frame, frame, generalDialog, generalDialog, generalDialog, generalDialog, getCodec, getDefaultViewState, getDefaultViewStates, getDisplayables, getViewState, getViewStates, lineBorder, lineBorder, lineBorder, lineBorder, makeComponent, matteBorder, matteBorder, matteBorder, matteBorder, matteBorder, matteBorder, OKCancelDialog, OKCancelDialog, OKDialog, OKDialog, refreshComponent, remove, remove, removeAll, removeBorder, reset, sandwichBorder, setCodec, setDeepBackground, setDeepBackground, setDefaultViewState, setDefaultViewStates, setEnabled, setViewState, setViewStates, startAlert, titleBorder, titleBorder, titleBorder, titleBorder, titleBorder, titleBorder, titleBorder, titleBorder, uniformizeHeight, uniformizeSize, uniformizeWidth, YesNoCancelDialog, YesNoCancelDialog
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parser

protected BaseParser parser
Reference to the default JPT parser.


fcnsLabel

protected Annotation fcnsLabel
The label for the functions dropdown list.


fcnsList

protected Dropdown fcnsList
The functions dropdown list.


selectFcn

protected SimpleAction selectFcn

The action to select a function from the functions dropdown list and show its definition.

Utilizes the method selectFunction().


ordinaryFcnsLabel

protected Annotation ordinaryFcnsLabel
The label for the ordinary functions dropdown list.


ordinaryFcnsList

protected Dropdown ordinaryFcnsList
The ordinary functions dropdown list.


revertOrdinaryAction

protected SimpleAction revertOrdinaryAction
The action to revert the ordinary functions list to a blank string.


reservedLabel

protected Annotation reservedLabel
The label for the reserved IDs dropdown list.


reservedList

protected Dropdown reservedList
The reserved IDs dropdown list.


revertReservedAction

protected SimpleAction revertReservedAction
The action to revert the reserved list to a blank string.


nameLabel

protected Annotation nameLabel
The label for the function name text field.


nameTFV

protected TextFieldView nameTFV
The function name text field.


paramsLabel

protected Annotation paramsLabel
The label for the function parameters text field.


paramsTFV

protected TextFieldView paramsTFV
The function parameters text field.


bodyLabel

protected Annotation bodyLabel
The label for the function body text field.


bodyTFV

protected TextFieldView bodyTFV
The function body text field.


innerStuff

protected Object[][] innerStuff
The entities for the inner panel with the various dropdowns and the function name text field.


innerPanel

protected TablePanel innerPanel
The inner panel.


definitionStuff

protected Object[] definitionStuff
The entities for the full definition panel.


definitionPanel

protected VTable definitionPanel
The full definition panel.


defFun

protected SimpleAction defFun

The define function action.

Utilizes the method defineFunction().


remFun

protected SimpleAction remFun

The remove function action.

Utilizes the method removeFunction().


clear

protected SimpleAction clear

The clear fields action.

Utilizes the method clearFields().


defFunButton

protected JButton defFunButton
The define function button.


remFunButton

protected JButton remFunButton
The remove function button.


clearButton

protected JButton clearButton
The clear fields button.


defButtons

protected Object[] defButtons
The array with the 3 buttons.


defButtonsTable

protected HTable defButtonsTable
The table with the 3 buttons.


mainStuff

protected Object[] mainStuff
The array with the fields and the buttons.


mainTable

protected VTable mainTable
The table with the fields and the buttons.

Constructor Detail

SimpleFunctionPane

public SimpleFunctionPane()
The constructor for a simple function definition pane.

Method Detail

populateFcnsList

protected void populateFcnsList()

Populate the simple functions dropdown list with the names of all simple functions currently installed in the default parser.

The names are sorted alphabetically and an empty string is added to the front of the list so that after the selection of a name the list can revert to showing no name.


populateOrdinaryFcnsList

protected void populateOrdinaryFcnsList()

Populate the ordinary functions dropdown list with the names of all ordinary functions currently installed in the default parser.

The names are sorted alphabetically and an empty string is added to the front of the list so that after the selection of a name the list can revert to showing no name.


revertOrdinaryFcnsList

protected void revertOrdinaryFcnsList()
Revert the ordinary functions list to showing the blank string.


populateReservedList

protected void populateReservedList()

Populate the reserved dropdown list with the reserved names currently installed in the default parser.

The names are sorted alphabetically and an empty string is added to the front of the list so that after the selection of a name the list can revert to showing no name.


revertReservedList

protected void revertReservedList()
Revert the ordinary functions list to showing the blank string.


selectFunction

protected void selectFunction()

The method to select a function from the functions dropdown list and show its definition.

After the function definition is shown, reverts the function list to showing the empty string.


defineFunction

protected void defineFunction()

Defines a function using the data in the 3 text fields.

Checks for as many errors as possible and provides an informative dialog box when errors occur.

Cannot replace an existing function that is not a simple function.


removeFunction

protected void removeFunction()

Removes a function using the name in the function name text field. Ignores the other two text fields.

Cannot remove an existing function that is not a simple function.


clearFields

protected void clearFields()
Clears the 3 text fields.


main

public static void main(String[] args)

The main method launches a simple function definition pane in its own GUI frame.

Use the call:

  SimpleFunctionPane.main(null)

Parameters:
args - ignored and may be null