edu.neu.ccs.gui
Interface GeneralView

All Superinterfaces:
Displayable, TypedView
All Known Implementing Classes:
DropdownView, StringViewer, TextFieldView

public interface GeneralView
extends TypedView

Interface to be implemented by a class of interface objects whose view state may be appropriate for input of various classes of model objects.

Most classes that implement this interface should also implement the Fragile interface, but this is not a requirement.

It is expected that a GeneralView will extend JComponent so that it may installed in a GUI and so that it may fire property change events. This requirement is stronger than that for Displayable.

A GeneralView is a powerful and general input component that must be capable of instantiating any Stringable class of objects.

A class of input component that can only instantiate a single class of Stringable objects should implement the base TypedView interface.

Since:
1.0
Version:
2.3
See Also:
Fragile

Field Summary
 
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
 
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 makeCopy()
          Returns a copy of this GeneralView.
 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.
 
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
 

Method Detail

setDataType

public void setDataType(Class dataType)
Sets the current class of objects returned when a model object is demanded or requested.

Parameters:
dataType - the new class of objects for model objects
Throws:
Error - if the given data type is not assignable from the Stringable reference type

makeCopy

public GeneralView makeCopy()

Returns a copy of this GeneralView.

The purpose of this method is to provide a copy of the view that may be used in error handling dialogs. The copy should, as far as possible, have the same screen size and internal settings. Each GeneralView should describe what its makeCopy method actually does.

The copy should NOT share its internal document model with the original view. This will allow the copy to operate in an independent fashion from the original.

Returns:
a copy of this view

setFilter

public void setFilter(StringableFilter filter)
Sets the current filter used by the view to the given StringableFilter.

Parameters:
filter - the filter to be used

getFilter

public StringableFilter getFilter()
Returns the current filter used by this view.

Returns:
the current filter

demandObject

public Stringable demandObject(StringableFilter filter)
Returns a Stringable object based on the view state of the view, the temporary filter, and the mandatory model.

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

requestObject

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

Parameters:
filter - the temporary filter to use
Returns:
a Stringable model object
Throws:
CancelledException - if the user cancelled after an error was detected
CancelledException
See Also:
TypedView.requestObject(), demandObject(Class, StringableFilter)

demandObject

public 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.

Returns:
a Stringable model object
See Also:
TypedView.demandObject(), requestObject(Class, StringableFilter)

requestObject

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

Returns:
a Stringable model object
Throws:
CancelledException - if the user cancelled after an error was detected
CancelledException
See Also:
TypedView.requestObject(), demandObject(Class, StringableFilter)

setErrorPromptTitleSuggestion

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

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.

Parameters:
listener - the ActionListener that is to be notified
See Also:
removeActionListener(ActionListener)

removeActionListener

public void removeActionListener(ActionListener listener)
Removes an ActionListener.

Parameters:
listener - the ActionListener to remove
See Also:
addActionListener(ActionListener)