|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ccg.values.ValuesEditorAdapter
com.ccg.values.stock.TimeSpanEditor
public class TimeSpanEditor
A implementation of a ValuesEditor object suitable for working with
time spans.
This class was initially developed as the test implementation of the
ValuesEditor interface. However, it is useful for those that wish to
create a time span entry field when building GUI interfaces.
It allows one to customize the following:
| Field Summary |
|---|
| Fields inherited from interface com.ccg.values.ValuesHolder |
|---|
HAS_FROM, HAS_TO, HAS_TO_FROM |
| Constructor Summary | |
|---|---|
TimeSpanEditor()
|
|
| Method Summary | |
|---|---|
Object |
createObjectInstance()
Creates a new instance of a object (with default values set) which the editor is designed to work with. |
void |
fromObject(Object o)
Transfer values from a object into this "value holder". |
JComponent |
getComponent()
Get the Swing component which the user sees. |
(package private) Date |
getDateFromString(String s)
|
Class |
getObjectClass()
Get the Class which the "values holder" is designed to work
with. |
void |
init(Lookup props)
Set the properties to be used when constructing the visual component. |
void |
toObject(Object o)
Transfer values from this "value holder" into a object. |
void |
validate()
Verify that all of the user input fields are valid. |
| Methods inherited from class com.ccg.values.ValuesEditorAdapter |
|---|
addChangeListener, checkArgument, fireChangeEvent, getCapabilities, getProxyChangeListener, getProxyDocumentListener, getProxyInputMethodListener, getProxyItemListener, getProxyListDataListener, getProxyTableModelListener, removeChangeListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TimeSpanEditor()
| Method Detail |
|---|
public Class getObjectClass()
Class which the "values holder" is designed to work
with.
This method returns the Class which the "values holder" is
designed to work with. All objects which are passed to the
toObject or fromObject methods MUST
be instances of this class.
public Object createObjectInstance()
This default implementation returns a short duration (less than two hours) from the current time.
createObjectInstance in interface ValuesEditorcreateObjectInstance in class ValuesEditorAdapterfromObject or toObject
implementation.public void init(Lookup props)
This method allows one to customize MANY of the attributes of the graphical component generated based upon the values in the properties passed.
The following affect the display and interpretation of the date/time strings the user edits:
SimpleDateFormat documentation for full
details on how to form the template string. If this value is set, then
the "date"/"time" keys are ignored.SHORT, MEDIUM, LONG, and FULL constants defined
in the DateFormat class. This setting is ignored if the
template=TEXT setting is present. If this setting is omitted, or
incorrectly set, then date information is omitted from the output format.SHORT, MEDIUM, LONG, and FULL constants defined
in the DateFormat class. This setting is ignored if the
template=TEXT setting is present. If this setting is omitted, or
incorrectly set, then time information is omitted from the output format.You can use the following to limit the range of dates/times which the user can specify (if omitted - no limits are put in place):
In addition, you may specify any of the following to adjust the start/end time defaults (change TAG to either start or end for the property you would like to adjust):
init in interface ValuesEditorinit in class ValuesEditorAdapterprops - Set of properties (implementation dependent) to initialize object with
(must not be null).
public void toObject(Object o)
throws IllegalStateException,
IllegalArgumentException,
UnsupportedOperationException,
NullPointerException
This method transfers all of the values held into the object passed. It transfers ALL values if successful. It transfers ZERO values if a exception is thrown.
o - The TimeSpan object to pass information into.
NullPointerException - If you pass null.
IllegalArgumentException - If the object passed is not the proper type.
IllegalStateException - If the "values holder" isn't in the proper state to do the transfer.
UnsupportedOperationException - If the "value holder" doesn't implement the setting of values in the
associated objects.fromObject(java.lang.Object)
public void fromObject(Object o)
throws IllegalStateException,
IllegalArgumentException,
UnsupportedOperationException,
NullPointerException
This method transfers all of the values of interest from the object passed into this "value holder". It transfers ALL values if successful. It transfers ZERO values if a exception is thrown.
o - The TimeSpan object to get values from.
NullPointerException - If you pass null.
IllegalArgumentException - If the object passed is not the proper type.
IllegalStateException - If the object isn't in the proper state to do the transfer into this
"values holder".
UnsupportedOperationException - If the "value holder" doesn't implement the getting of values from
associated objects.toObject(java.lang.Object)
public void validate()
throws IllegalStateException
This method checks the state of values within the editor. It returns cleanly if everything looks good.
IllegalStateException - If any of the user input fields have invalid values contained which the
user needs to fix prior to a commit.toObject(java.lang.Object)
public JComponent getComponent()
throws IllegalStateException
All classes which implement this interface need to be able to create a GUI editor. This method will return null if the object is unable to comply with the request at this time.
The first invocation triggers the "creation" of the graphical component.
Multiple invocations will return a reference to the same component.
IllegalStateException - If the object was not properly initialized.Date getDateFromString(String s)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||