ptolemy.actor.gui.run
Class PtolemyFormEditor

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 ptolemy.actor.gui.run.PtolemyFormEditor
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class PtolemyFormEditor
extends javax.swing.JPanel

A customized version of the FormEditor class by Michael Connor (mlconnor@yahoo.com).

Since:
Ptolemy II 8.0
Version:
$Id: PtolemyFormEditor.java 57044 2010-01-27 22:41:05Z cxh $
Author:
Michael Connor and Edward A. Lee
See Also:
FormEditor, Serialized Form
Accepted Rating:
Red (cxh)
Proposed Rating:
Yellow (eal)

Nested Class Summary
private  class PtolemyFormEditor.ColSpanSpinnerModel
          Model for the column span control.
private  class PtolemyFormEditor.ComponentPaletteListModel
          Model for the palette.
private static class PtolemyFormEditor.ComponentPaletteListRenderer
          Renderer for the palette items.
private  class PtolemyFormEditor.ConstraintTableCellRenderer
          Renderer for table cells.
private  class PtolemyFormEditor.DeleteColumnAction
          Action to delete a column.
private  class PtolemyFormEditor.DeleteRowAction
          Action to delete a row.
private  class PtolemyFormEditor.GridTableModel
          The data model for the table.
private  class PtolemyFormEditor.InsertColumnAfterAction
          Action to insert a column after the selected column.
private  class PtolemyFormEditor.InsertColumnBeforeAction
          Action to insert a column before the selected column.
private  class PtolemyFormEditor.InsertRowAfterAction
          Action to insert a row after the selected one.
private  class PtolemyFormEditor.InsertRowBeforeAction
          Action to insert a row before the selected one.
private  class PtolemyFormEditor.PackAction
          Action to pack the run control panel.
private  class PtolemyFormEditor.RemoveComponentAction
          Action to remove a component.
private  class PtolemyFormEditor.RowSpanSpinnerModel
          Model for the row span control.
 
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.JSpinner _bottomInsetSpinner
          The bottom inset control.
private  javax.swing.SpinnerNumberModel _bottomInsetSpinnerModel
          Model for the bottom inset control.
private  javax.swing.JButton _columnDeleteButton
          The button to delete a column.
private  javax.swing.JButton _columnInsertAfterButton
          The button to insert after the selected column.
private  javax.swing.JButton _columnInsertBeforeButton
          The button to insert before the selected column.
private  javax.swing.JSpinner _columnSpanSpinner
          The column span control.
private  PtolemyFormEditor.ColSpanSpinnerModel _columnSpanSpinnerModel
          The model for the column span control.
protected  java.awt.Container _container
          The container.
protected  ContainerLayout _containerLayout
          The layout manager.
private  javax.swing.JComboBox _horizontalAlignmentCombo
          The horizontal alignment control.
private  java.lang.String[] _horizontalAlignmentList
          The list of horizontal alignment options.
private  RunLayoutFrame _layoutFrame
          The layout frame.
private  javax.swing.JSpinner _leftInsetSpinner
          The left inset control.
private  javax.swing.SpinnerNumberModel _leftInsetSpinnerModel
          Model for the left inset control.
private  javax.swing.Action _packAction
          Action to pack the run control window.
private static java.util.Set<java.lang.String> _propertiesToIgnore
          Properties to ignore and not present to the user.
private  javax.swing.Action _removeComponentAction
          Action to remove a component.
private  javax.swing.JButton _removeComponentButton
          Button to remove a component.
private  javax.swing.JSpinner _rightInsetSpinner
          The right inset control.
private  javax.swing.SpinnerNumberModel _rightInsetSpinnerModel
          Model for the right inset control.
private  javax.swing.JButton _rowDeleteButton
          The button to delete a row.
private  javax.swing.JButton _rowInsertAfterButton
          The button to insert a row after the selected one.
private  javax.swing.JButton _rowInsertBeforeButton
          The button to insert a row before the selected one.
private  javax.swing.JSpinner _rowSpanSpinner
          The row span control.
private  PtolemyFormEditor.RowSpanSpinnerModel _rowSpanSpinnerModel
          The model for the row span control.
private  boolean _suspendConstraintControlUpdates
          Flag to suspend updates.
private  LayoutTable _table
          The layout table, built in the constructor.
private  PtolemyFormEditor.GridTableModel _tableModel
          The data model for the table.
private  javax.swing.JSpinner _topInsetSpinner
          The top inset control.
private  javax.swing.SpinnerNumberModel _topInsetSpinnerModel
          Model for the top inset control.
private  javax.swing.JComboBox _verticalAlignmentCombo
          The vertical alignment control.
private  java.lang.String[] _verticalAlignmentList
          The list of vertical alignment options.
protected  java.util.Set<java.awt.Component> newComponents
          The set of new components.
protected  java.awt.Component topComponent
          The top level component.
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PtolemyFormEditor(RunLayoutFrame layoutFrame, ContainerLayout layout, java.awt.Container container)
          Construct a new form editor.
 
Method Summary
private  CellConstraints _getComponentConstraints(java.awt.Component component)
          Return the component constraints from the layout manager.
private  java.lang.String _getComponentName(java.awt.Component control)
          Return the name of the specified component as known by the layout controller.
private  void _insertColumn(int column)
          Insert a column.
private  void _insertRow(int rowIndex)
          Insert a row.
private  void _putValue(javax.swing.AbstractAction abstractAction, java.lang.String iconName)
          Put an icon onto an AbstractAction.
private  void _setSelectedCell(int columnIndex, int rowIndex, boolean forceVisible)
          Specify the cell in the table that is selected.
private  void _setupListeners()
          Set up the listeners.
private  void _specsChanged()
          Specify that the specifications have changed.
protected  void _updateLayouts()
          Update the layouts.
 boolean editComponent(java.awt.Component component)
          Edit the component by presenting a dialog that infers the settable properties of the components.
 void setFormComponent(java.awt.Component component)
          Specify the selected component.
 void updateLayout(java.awt.Component component)
          Update the layout for the specified component.
 
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, hide, 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, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_containerLayout

protected ContainerLayout _containerLayout
The layout manager.


_container

protected java.awt.Container _container
The container.


newComponents

protected java.util.Set<java.awt.Component> newComponents
The set of new components.


topComponent

protected java.awt.Component topComponent
The top level component.


_bottomInsetSpinnerModel

private javax.swing.SpinnerNumberModel _bottomInsetSpinnerModel
Model for the bottom inset control.


_bottomInsetSpinner

private javax.swing.JSpinner _bottomInsetSpinner
The bottom inset control.


_columnDeleteButton

private javax.swing.JButton _columnDeleteButton
The button to delete a column.


_columnInsertAfterButton

private javax.swing.JButton _columnInsertAfterButton
The button to insert after the selected column.


_columnInsertBeforeButton

private javax.swing.JButton _columnInsertBeforeButton
The button to insert before the selected column.


_columnSpanSpinnerModel

private PtolemyFormEditor.ColSpanSpinnerModel _columnSpanSpinnerModel
The model for the column span control.


_columnSpanSpinner

private javax.swing.JSpinner _columnSpanSpinner
The column span control.


_horizontalAlignmentList

private java.lang.String[] _horizontalAlignmentList
The list of horizontal alignment options.


_horizontalAlignmentCombo

private javax.swing.JComboBox _horizontalAlignmentCombo
The horizontal alignment control.


_layoutFrame

private RunLayoutFrame _layoutFrame
The layout frame.


_leftInsetSpinnerModel

private javax.swing.SpinnerNumberModel _leftInsetSpinnerModel
Model for the left inset control.


_leftInsetSpinner

private javax.swing.JSpinner _leftInsetSpinner
The left inset control.


_packAction

private javax.swing.Action _packAction
Action to pack the run control window.


_propertiesToIgnore

private static java.util.Set<java.lang.String> _propertiesToIgnore
Properties to ignore and not present to the user.


_removeComponentAction

private javax.swing.Action _removeComponentAction
Action to remove a component.


_removeComponentButton

private javax.swing.JButton _removeComponentButton
Button to remove a component.


_rightInsetSpinnerModel

private javax.swing.SpinnerNumberModel _rightInsetSpinnerModel
Model for the right inset control.


_rightInsetSpinner

private javax.swing.JSpinner _rightInsetSpinner
The right inset control.


_rowDeleteButton

private javax.swing.JButton _rowDeleteButton
The button to delete a row.


_rowInsertAfterButton

private javax.swing.JButton _rowInsertAfterButton
The button to insert a row after the selected one.


_rowInsertBeforeButton

private javax.swing.JButton _rowInsertBeforeButton
The button to insert a row before the selected one.


_rowSpanSpinnerModel

private PtolemyFormEditor.RowSpanSpinnerModel _rowSpanSpinnerModel
The model for the row span control.


_rowSpanSpinner

private javax.swing.JSpinner _rowSpanSpinner
The row span control.


_suspendConstraintControlUpdates

private boolean _suspendConstraintControlUpdates
Flag to suspend updates.


_table

private LayoutTable _table
The layout table, built in the constructor.


_tableModel

private PtolemyFormEditor.GridTableModel _tableModel
The data model for the table.


_topInsetSpinnerModel

private javax.swing.SpinnerNumberModel _topInsetSpinnerModel
Model for the top inset control.


_topInsetSpinner

private javax.swing.JSpinner _topInsetSpinner
The top inset control.


_verticalAlignmentList

private java.lang.String[] _verticalAlignmentList
The list of vertical alignment options.


_verticalAlignmentCombo

private javax.swing.JComboBox _verticalAlignmentCombo
The vertical alignment control.

Constructor Detail

PtolemyFormEditor

public PtolemyFormEditor(RunLayoutFrame layoutFrame,
                         ContainerLayout layout,
                         java.awt.Container container)
Construct a new form editor.

Parameters:
layoutFrame - The frame within which this editor will be added.
layout - The layout manager.
container - The container.
Method Detail

editComponent

public boolean editComponent(java.awt.Component component)
Edit the component by presenting a dialog that infers the settable properties of the components.

Parameters:
component - The component.
Returns:
true upon successful completion.

setFormComponent

public void setFormComponent(java.awt.Component component)
Specify the selected component. This causes the various constraints controls for the component to be enabled and to show the current values for the component.

Parameters:
component - The selected component.

updateLayout

public void updateLayout(java.awt.Component component)
Update the layout for the specified component.

Parameters:
component - The component to have its layout updated.

_updateLayouts

protected void _updateLayouts()
Update the layouts.


_getComponentConstraints

private CellConstraints _getComponentConstraints(java.awt.Component component)
Return the component constraints from the layout manager.

Parameters:
component - The component.
Returns:
The constraints.

_getComponentName

private java.lang.String _getComponentName(java.awt.Component control)
Return the name of the specified component as known by the layout controller.

Parameters:
control - The component.
Returns:
The name of the component in the layout.

_insertColumn

private void _insertColumn(int column)
Insert a column.

Parameters:
column - The column index.

_insertRow

private void _insertRow(int rowIndex)
Insert a row.

Parameters:
rowIndex - The row index.

_putValue

private void _putValue(javax.swing.AbstractAction abstractAction,
                       java.lang.String iconName)
Put an icon onto an AbstractAction.


_setSelectedCell

private void _setSelectedCell(int columnIndex,
                              int rowIndex,
                              boolean forceVisible)
Specify the cell in the table that is selected.


_setupListeners

private void _setupListeners()
Set up the listeners.


_specsChanged

private void _specsChanged()
Specify that the specifications have changed.