|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.neu.ccs.gui.GeneralViewSupport
GeneralViewSupport contains the common code to support
the features of a .GeneralView
| Field Summary | |
private JComponent |
component
The GeneralView seen as a JComponent. |
static String |
DATA_TYPE
Bound property name for the Stringable type returned
by a TypedView or GeneralView. |
static String |
DEFAULT_VIEW_STATE
Bound property name for the default view state of a Displayable object. |
private String |
defaultViewState
The default view state string. |
private StringableFactory |
factory
The factory for creating Stringable objects from input data. |
private StringableFilter |
filter
The filter used by this view object. |
static String |
FILTER
Bound property name for the filter property. |
private EventListenerList |
listenerList
The EventListenerList for the GeneralView. |
private InputProperties |
properties
The property list for this view object. |
private GeneralView |
view
The GeneralView that uses this GeneralViewSupport object. |
static String |
VIEW_STATE
Bound property name for the view state of a Displayable object. |
| 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 |
| Constructor Summary | |
GeneralViewSupport(GeneralView view,
EventListenerList listenerList,
Class dataType,
String errorPrompt,
String dialogTitle,
String suggestion)
The constructor. |
|
| Method Summary | |
void |
addMalformedDataListener(MalformedDataListener l)
Registers the given MalformedDataListener
to receive MalformedDataEvents
when the view state data is found to be malformed and
when the view state data is returned to a well-formed
value. |
Stringable |
demandObject()
Returns a Stringable object based on the view state
of the view, the current data type and filter, and the mandatory
model. |
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. |
protected void |
fireDataMalformed(MalformedDataEvent event)
Delivers MalformedDataEvents to registered listeners. |
Class |
getDataType()
Returns the current class of objects returned when a model object is demanded or requested. |
String |
getDefaultViewState()
Returns a String representation of the default view
state for this object. |
StringableFilter |
getFilter()
Returns the current filter used by this view. |
InputProperties |
getInputProperties()
Returns the input properties for this view. |
GeneralView |
getView()
Returns the view that uses this GeneralViewSupport object. |
protected boolean |
handleError(Stringable object,
int inputModel,
ParseException exception)
Performs the error handling for an input operation. |
Stringable |
obtainObject(Stringable object)
Returns a Stringable object based on the view state
data type, and filter or throws a ParseException to be
handled by other methods. |
void |
removeMalformedDataListener(MalformedDataListener l)
De-registers the given MalformedDataListener
from receiving MalformedDataEvents
when the view state data is found to be malformed and
when the view state data is returned to a well-formed
value. |
Stringable |
requestObject()
Returns a Stringable object based on the view state
of the view, the current data type and filter, and the optional
model. |
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 |
reset()
Resets the view state of this object to the default view state for this object. |
void |
setDataType(Class dataType)
Sets the current class of objects returned when a model object is demanded or requested. |
void |
setDefaultViewState(String data)
Sets the default view state for this object to the data state represented by the given String data. |
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 |
setInputProperties(InputProperties properties)
Sets the input properties for this view to the provided input properties. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String VIEW_STATE
Displayable object.
public static final String DEFAULT_VIEW_STATE
Displayable object.
public static final String DATA_TYPE
Stringable type returned
by a TypedView or GeneralView.
public static final String FILTER
private GeneralView view
private EventListenerList listenerList
private JComponent component
private StringableFactory factory
private InputProperties properties
private StringableFilter filter
private String defaultViewState
| Constructor Detail |
public GeneralViewSupport(GeneralView view,
EventListenerList listenerList,
Class dataType,
String errorPrompt,
String dialogTitle,
String suggestion)
The constructor.
The given GeneralView view is the view that uses
this GeneralViewSupport object and must not be
null. In addition, the view must be a derived
object from JComponent
The given EventListenerList list is the listener
list of the given GeneralView view and must not be
null.
The given data type is the Stringable data type
for the view. If this parameter is null it is set
to XString.class.
The parameters error prompt, dialog title, and suggestion set
defaults for the error dialog box and may be null.
view - the view that uses this support classlistenerList - the listener list of the viewdataType - the Stringable data typeerrorPrompt - the error prompt of an error dialogdialogTitle - the dialog title of an error dialogsuggestion - the suggestion for an error dialog
NullPointerException - if the view or listener
list is null
IllegalArgumentException - if the view is not
derived from JComponent| Method Detail |
public GeneralView getView()
public void setDataType(Class dataType)
dataType - the new class of objects for model objects
Error - if the given data type is not assignable from
the Stringable reference typegetDataType()public Class getDataType()
setDataType(Class)public void setFilter(StringableFilter filter)
filter - the filter to be usedpublic StringableFilter getFilter()
public Stringable obtainObject(Stringable object)
throws ParseException
Returns a Stringable object based on the view state
data type, and filter or throws a ParseException to be
handled by other methods.
Normally, this method is not called directly, but it is provided
for the convenience of callers that want to implement their own
error handler for ParseExceptions.
object - the initial default object
ParseException - if an error occurs
ParseExceptionpublic Stringable demandObject()
Stringable object based on the view state
of the view, the current data type and filter, and the mandatory
model.
Stringable model objectrequestObject(),
obtainObject(Stringable)
public Stringable requestObject()
throws CancelledException
Stringable object based on the view state
of the view, the current data type and filter, and the optional
model.
Stringable model object
CancelledException - if the user cancelled
after an error was detected
CancelledExceptiondemandObject(),
obtainObject(Stringable)public Stringable demandObject(StringableFilter filter)
Stringable object based on the view state
of the view, the temporary filter, and the mandatory model.
filter - the temporary filter to use
Stringable model objectdemandObject(),
requestObject(Class, StringableFilter)
public Stringable requestObject(StringableFilter filter)
throws CancelledException
Stringable object based on the view state
of the view, the temporary filter, and the optional model.
filter - the temporary filter to use
Stringable model object
CancelledException - if the user cancelled
after an error was detected
CancelledExceptionrequestObject(),
demandObject(Class, StringableFilter)
public Stringable demandObject(Class dataType,
StringableFilter filter)
Stringable object based on the view state
of the view, the temporary data type and filter, and the mandatory
model.
dataType - the temporary data type to usefilter - the temporary filter to use
Stringable model objectdemandObject(),
requestObject(Class, StringableFilter)
public Stringable requestObject(Class dataType,
StringableFilter filter)
throws CancelledException
Stringable object based on the view state
of the view, the temporary data type and filter, and the optional
model.
dataType - the temporary data type to usefilter - the temporary filter to use
Stringable model object
CancelledException - if the user cancelled
after an error was detected
CancelledExceptionrequestObject(),
demandObject(Class, StringableFilter)public void setInputProperties(InputProperties properties)
Sets the input properties for this view to the provided input properties.
If the given input properties list is null, the
property list for this view is set to the base property list
containing default property values.
properties - the new input properties for the viewgetInputProperties()public InputProperties getInputProperties()
setInputProperties(InputProperties)
public void setErrorPromptTitleSuggestion(String errorPrompt,
String dialogTitle,
String suggestion)
Strings for an error
dialog in a single method.
errorPrompt - the error prompt of an error dialogdialogTitle - the dialog title of an error dialogsuggestion - the suggestion for an error dialogpublic void setDefaultViewState(String data)
String data.
data - the new default data state for this objectgetDefaultViewState(),
reset()public String getDefaultViewState()
String representation of the default view
state for this object.
StringsetDefaultViewState(String),
reset()public void reset()
public void addMalformedDataListener(MalformedDataListener l)
MalformedDataListener
to receive MalformedDataEvents
when the view state data is found to be malformed and
when the view state data is returned to a well-formed
value.
l - the listener to registerremoveMalformedDataListener(MalformedDataListener),
Fragile,
EventListenerListpublic void removeMalformedDataListener(MalformedDataListener l)
MalformedDataListener
from receiving MalformedDataEvents
when the view state data is found to be malformed and
when the view state data is returned to a well-formed
value.
l - the listener to de-registeraddMalformedDataListener(MalformedDataListener),
Fragile,
EventListenerList
protected boolean handleError(Stringable object,
int inputModel,
ParseException exception)
Performs the error handling for an input operation.
Derived classes of support class may override this method and implement their own error handling strategy.
This method must either provide a correct value for the
Stringable object and return true,
or must return false if the object is still in
error or if the user cancelled the error handling procedure.
The input model must be either
JPTConstants.MANDATORY
or JPTConstants.OPTIONAL.
object - an object of the appropriate type whose state
could not be set from the view state of this view
and must therefore be set to a valid view state by
this error handlerinputModel - the input model for the input operation
that resulted in the errorexception - the ParseException that was
thrown to signal the error condition
protected void fireDataMalformed(MalformedDataEvent event)
MalformedDataEvents to registered listeners.
event - the MalformedDataEvent to deliveraddMalformedDataListener(MalformedDataListener),
removeMalformedDataListener(MalformedDataListener),
Fragile,
EventListenerList
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||