edu.neu.ccs.gui
Class GeneralViewWrapper

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
                                            |
                                            +--edu.neu.ccs.gui.TypedViewWrapper
                                                  |
                                                  +--edu.neu.ccs.gui.GeneralViewWrapper
All Implemented Interfaces:
Accessible, AlertListener, Displayable, EventListener, GeneralView, ImageObserver, JPTConstants, MalformedDataListener, MenuContainer, Serializable, SwingConstants, TypedView

public class GeneralViewWrapper
extends TypedViewWrapper
implements GeneralView

Wrapper for a GeneralView that uses a CenterLayout and faithfully respects minimum, maximum, and preferred sizes.

Since:
1.0
See Also:
ComponentWrapper, DisplayWrapper, TypedViewWrapper, 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.TypedView
DATA_TYPE
 
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
GeneralViewWrapper(GeneralView view)
          Constructs a wrapper for the given GeneralView.
 
Method Summary
 void addActionListener(ActionListener listener)
          Adds an ActionListener.
 Stringable demandObject(Class dataType, StringableFilter filter)
          Returns a Stringable object based on the view state of the view, the temporary data type and filter, and the mandatory model.
 Stringable demandObject(StringableFilter filter)
          Returns a Stringable object based on the view state of the view, the temporary filter, and the mandatory model.
 StringableFilter getFilter()
          Returns the current filter used by this view.
 GeneralView getWrappedGeneralView()
          Returns the wrapped general view.
 GeneralView makeCopy()
          Returns a new GeneralViewWrapper that wraps a copy of the wrapped GeneralView encapsulated in this view.
 void removeActionListener(ActionListener listener)
          Removes an ActionListener.
 Stringable requestObject(Class dataType, StringableFilter filter)
          Returns a Stringable object based on the view state of the view, the temporary data type and filter, and the optional model.
 Stringable requestObject(StringableFilter filter)
          Returns a Stringable object based on the view state of the view, the temporary filter, and the optional model.
 void setDataType(Class dataType)
          Sets the current class of objects returned when a model object is demanded or requested.
 void setErrorPromptTitleSuggestion(String errorPrompt, String dialogTitle, String suggestion)
          Sets the three input property Strings for an error dialog in a single method.
 void setFilter(StringableFilter filter)
          Sets the current filter used by the view to the given StringableFilter.
 void setWrappedComponent(Component component)
          Sets the wrapped general view to the given component.
 void setWrappedGeneralView(GeneralView view)
          Sets the wrapped general view to the given GeneralView.
 
Methods inherited from class edu.neu.ccs.gui.TypedViewWrapper
demandObject, getDataType, getInputProperties, getWrappedTypedView, requestObject, setInputProperties, setWrappedTypedView
 
Methods inherited from class edu.neu.ccs.gui.DisplayWrapper
getDefaultViewState, getViewState, getWrappedDisplay, reset, setDefaultViewState, setViewState, setWrappedDisplay
 
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, setDeepBackground, setDeepBackground, 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
 
Methods inherited from interface edu.neu.ccs.gui.TypedView
demandObject, getDataType, getInputProperties, requestObject, setInputProperties
 
Methods inherited from interface edu.neu.ccs.gui.Displayable
getDefaultViewState, getViewState, reset, setDefaultViewState, setEnabled, setViewState
 

Constructor Detail

GeneralViewWrapper

public GeneralViewWrapper(GeneralView view)
Constructs a wrapper for the given GeneralView.

Parameters:
view - the general view to be wrapped
Method Detail

makeCopy

public GeneralView makeCopy()
Returns a new GeneralViewWrapper that wraps a copy of the wrapped GeneralView encapsulated in this view.

Specified by:
makeCopy in interface GeneralView
Returns:
a copy of this view

setDataType

public void setDataType(Class dataType)
Description copied from interface: GeneralView
Sets the current class of objects returned when a model object is demanded or requested.

Specified by:
setDataType in interface GeneralView
Parameters:
dataType - the new class of objects for model objects

setFilter

public void setFilter(StringableFilter filter)
Description copied from interface: GeneralView
Sets the current filter used by the view to the given StringableFilter.

Specified by:
setFilter in interface GeneralView
Parameters:
filter - the filter to be used

getFilter

public StringableFilter getFilter()
Description copied from interface: GeneralView
Returns the current filter used by this view.

Specified by:
getFilter in interface GeneralView
Returns:
the current filter

demandObject

public Stringable demandObject(StringableFilter filter)
Description copied from interface: GeneralView
Returns a Stringable object based on the view state of the view, the temporary filter, and the mandatory model.

Specified by:
demandObject in interface GeneralView
Parameters:
filter - the temporary filter to use
Returns:
a Stringable model object
See Also:
TypedView.demandObject(), GeneralView.requestObject(Class, StringableFilter)

requestObject

public Stringable requestObject(StringableFilter filter)
                         throws CancelledException
Description copied from interface: GeneralView
Returns a Stringable object based on the view state of the view, the temporary filter, and the optional model.

Specified by:
requestObject in interface GeneralView
Parameters:
filter - the temporary filter to use
Returns:
a Stringable model object
CancelledException
See Also:
TypedView.requestObject(), GeneralView.demandObject(Class, StringableFilter)

demandObject

public Stringable demandObject(Class dataType,
                               StringableFilter filter)
Description copied from interface: GeneralView
Returns a Stringable object based on the view state of the view, the temporary data type and filter, and the mandatory model.

Specified by:
demandObject in interface GeneralView
Returns:
a Stringable model object
See Also:
TypedView.demandObject(), GeneralView.requestObject(Class, StringableFilter)

requestObject

public Stringable requestObject(Class dataType,
                                StringableFilter filter)
                         throws CancelledException
Description copied from interface: GeneralView
Returns a Stringable object based on the view state of the view, the temporary data type and filter, and the optional model.

Specified by:
requestObject in interface GeneralView
Returns:
a Stringable model object
CancelledException
See Also:
TypedView.requestObject(), GeneralView.demandObject(Class, StringableFilter)

setWrappedComponent

public void setWrappedComponent(Component component)

Sets the wrapped general view to the given component.

This method should not be called directly.

Rather, setWrappedGeneralView should be called in order to set the wrapped GeneralView.

If the given component is not a GeneralView, the currently wrapped general view is not changed.

Overrides:
setWrappedComponent in class TypedViewWrapper
Parameters:
component - the component to be wrapped
Throws:
NullPointerException - if the given object is null
See Also:
setWrappedGeneralView(GeneralView)

setWrappedGeneralView

public void setWrappedGeneralView(GeneralView view)
Sets the wrapped general view to the given GeneralView.

Throws:
NullPointerException - if the given object is null
See Also:
getWrappedGeneralView()

getWrappedGeneralView

public GeneralView getWrappedGeneralView()
Returns the wrapped general view.

See Also:
setWrappedGeneralView(GeneralView)

setErrorPromptTitleSuggestion

public void setErrorPromptTitleSuggestion(String errorPrompt,
                                          String dialogTitle,
                                          String suggestion)
Description copied from interface: GeneralView
Sets the three input property Strings for an error dialog in a single method.

Specified by:
setErrorPromptTitleSuggestion in interface GeneralView
Parameters:
errorPrompt - the error prompt of an error dialog
dialogTitle - the dialog title of an error dialog
suggestion - the suggestion for an error dialog

addActionListener

public void addActionListener(ActionListener listener)
Adds an ActionListener.

Specified by:
addActionListener in interface GeneralView
Parameters:
listener - the ActionListener that is to be notified
See Also:
removeActionListener(ActionListener)

removeActionListener

public void removeActionListener(ActionListener listener)
Removes an ActionListener.

Specified by:
removeActionListener in interface GeneralView
Parameters:
listener - the ActionListener to remove
See Also:
addActionListener(ActionListener)