edu.neu.ccs.gui
Class DisplayWrapper

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--edu.neu.ccs.gui.DisplayPanel
                                |
                                +--edu.neu.ccs.gui.ComponentWrapper
                                      |
                                      +--edu.neu.ccs.gui.DisplayWrapper
All Implemented Interfaces:
Accessible, AlertListener, Displayable, EventListener, ImageObserver, JPTConstants, MalformedDataListener, MenuContainer, Serializable, SwingConstants
Direct Known Subclasses:
TypedViewWrapper

public class DisplayWrapper
extends ComponentWrapper

Wrapper for a single Displayable object that uses a CenterLayout and faithfully respects minimum, maximum, and preferred sizes.

Since:
1.0
See Also:
ComponentWrapper, TypedViewWrapper, GeneralViewWrapper, Serialized Form

Field Summary
 
Fields inherited from class edu.neu.ccs.gui.ComponentWrapper
wrapper
 
Fields inherited from class edu.neu.ccs.gui.DisplayPanel
background, codec, CODEC
 
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 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
 
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
DisplayWrapper(Displayable display)
          Constructs a wrapper for the given Displayable object.
 
Method Summary
 String getDefaultViewState()
          Returns the default view states for objects in the collection as an encoded String.
 String getViewState()
          Returns the view states for objects in the container as an encoded String.
 Displayable getWrappedDisplay()
          Returns the wrapped display.
 void reset()
          Recursively resets any Displayable objects held in the panel.
 void setDefaultViewState(String data)
          Sets the default view states for objects in the collection to the data encoded in the given String.
 void setViewState(String data)
          Sets the view states for Displayable objects in the container to the data encoded in the given String.
 void setWrappedComponent(Component component)
          Sets the wrapped display to the given component.
 void setWrappedDisplay(Displayable display)
          Sets the wrapped display to the given Displayable object.
 
Methods inherited from class edu.neu.ccs.gui.ComponentWrapper
getAlignment, getMaximumSize, getMinimumSize, getPreferredSize, getWrappedComponent, setAbsoluteSize, setAbsoluteSize, setAlignment, setEnabled, setMaximumSize, setMaximumSize, setMinimumSize, setMinimumSize, setPreferredSize, setPreferredSize
 
Methods inherited from class edu.neu.ccs.gui.DisplayPanel
add, add, add, add, add, addObject, addObject, addObject, addObject, dataMalformed, endAlert, frame, frame, frame, frame, frame, frame, generalDialog, generalDialog, generalDialog, generalDialog, getCodec, makeComponent, OKCancelDialog, OKCancelDialog, OKDialog, OKDialog, refreshComponent, remove, remove, removeAll, setCodec, startAlert, 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, getNextFocusableComponent, 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, setNextFocusableComponent, setOpaque, 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
 

Constructor Detail

DisplayWrapper

public DisplayWrapper(Displayable display)
Constructs a wrapper for the given Displayable object.

Parameters:
display - the displayable object to be wrapped
Method Detail

setViewState

public void setViewState(String data)
Description copied from class: DisplayPanel

Sets the view states for Displayable objects in the container to the data encoded in the given String.

If the given encoded data is null, the view states are not changed.

If the given encoded data is not null, the data is decoded into its component data elements and the view state for each of as many Displayable objects as possible is set to the state encapsulated in the corresponding data element. If the encoded data contains more data elements than there are Displayable objects in the panel, the extraneous data elements are ignored. If the encoded data contains fewer data elements than there are Displayable objects in the panel, the view states are not changed for objects that do not have a corresponding data element.

Specified by:
setViewState in interface Displayable
Overrides:
setViewState in class DisplayPanel
Parameters:
data - the encoded String data
See Also:
DisplayPanel.getViewState(), Displayable

getViewState

public String getViewState()
Description copied from class: DisplayPanel
Returns the view states for objects in the container as an encoded String. The encoded data is constructed by collecting an array containing the view states for each of the Displayable objects in the container and encoding it using the CODEC whose identifier is stored by this panel.

Specified by:
getViewState in interface Displayable
Overrides:
getViewState in class DisplayPanel
See Also:
DisplayPanel.setViewState(String), Displayable

setDefaultViewState

public void setDefaultViewState(String data)
Description copied from class: DisplayPanel
Sets the default view states for objects in the collection to the data encoded in the given String.

If the given encoded data is null, the default view states are not changed.

If the given encoded data is not null, the data is decoded into its component data elements and the default view state for each of as many Displayable objects as possible is set to the state encapsulated in the corresponding data element. If the encoded data contains more data elements than there are Displayable objects in the panel, the extraneous data elements are ignored. If the encoded data contains fewer data elements than there are Displayable objects in the panel, the default view states are not changed for objects that do not have a corresponding data element.

Specified by:
setDefaultViewState in interface Displayable
Overrides:
setDefaultViewState in class DisplayPanel
Parameters:
data - the desired default String data
See Also:
DisplayPanel.reset(), Displayable

getDefaultViewState

public String getDefaultViewState()
Description copied from class: DisplayPanel
Returns the default view states for objects in the collection as an encoded String. The encoded data is constructed by collecting an array containing the default view states for each of the Displayable objects in the container and encoding it using the CODEC whose identifier is stored by this panel.

Specified by:
getDefaultViewState in interface Displayable
Overrides:
getDefaultViewState in class DisplayPanel
See Also:
DisplayPanel.setDefaultViewState(String), DisplayPanel.reset()

reset

public void reset()
Description copied from class: DisplayPanel
Recursively resets any Displayable objects held in the panel.

Specified by:
reset in interface Displayable
Overrides:
reset in class DisplayPanel
See Also:
DisplayPanel.setDefaultViewState(String), Displayable

setWrappedComponent

public void setWrappedComponent(Component component)
Sets the wrapped display to the given component. This method should not be called directly. Rather, setWrappedDisplay should be called in order to set the wrapped Displayable object. If the given component is not Displayable, the currently wrapped display is not changed.

Overrides:
setWrappedComponent in class ComponentWrapper
Parameters:
component - the component to be wrapped
Throws:
NullPointerException - if the given object is null
See Also:
setWrappedDisplay(Displayable)

setWrappedDisplay

public void setWrappedDisplay(Displayable display)
Sets the wrapped display to the given Displayable object.

Parameters:
display - the object to be wrapped
Throws:
NullPointerException - if the given object is null
See Also:
getWrappedDisplay()

getWrappedDisplay

public Displayable getWrappedDisplay()
Returns the wrapped display.

See Also:
setWrappedDisplay(Displayable)