public class VizEntry extends VizObject implements IVizUpdateable
The Entry class is responsible for collecting and managing the individual values needed by the Item to perform a task. The Entry class is capable of checking bounds and validity.
The Entry's content will be maintained by a content provider, or any piece that respectfully inherits from the IEntryContentProvider. All of the getters and setters for the content (AllowedValues, type, default values, etc) will pull from the ContentProvider. If the nullary constructor is used, then the Entry will create the BasicEntryContentProvider. Entry.Value and attributes like changedState, on the other hand, will be managed specifically by Entry (this excludes default value).
The "readiness" of an Entry is used map dependencies between Entries and other Entries. An Entry may depend on a parent Entry and passing the correct key-value pair to the update() operation will mark the Entry as ready or not ready depending on the state of the parent. All Entries default to ready. The changed or modified state of the Entry is similar in that it distinguishes whether or not an Entry has been recently modified.
The Entry implements IUpdateable to update the state of the Entry based on key-value pairs. The base default implementation of update() will mark the Entry as "ready" (isReady() will return true) if the name of the Entry's parent is passed as the key and one of "ready," "yes," "y," "on," "true" or "enabled" is passed as the value (minus the commas of course). It will mark the Entry as not ready (isReady() will return false) if the value is "not ready," "no," "n," "off," "false" or "disabled" instead. Neither set of values are case sensitive ("Yes" will work as well as "yes"). It also resets the "changed" state of the Entry to false to reflect that review is required because of new information from the update. This operation should be overridden by subclasses to get tailored update behavior, but Entry.update should be called still (by using "super.update()") to handle updating because of parents and setting the changed state.
IComponentListeners can also registered with the Entry since it implements IUpdateable. The Entry will notify listeners when its value changes.
Managing the readiness of the Entry with update in the base class allows ICE to generically handle the almost trivial case of dependencies where one Entry needs to know about the state of another before revealing itself.
The Entry can also be marked as "secret" to indicate that its contents should not be displayed openly. Entries should be marked secret in their setup() operation. There is no public operation to mark them as secret, although there is an isSecret() operation to determine whether or not an Entry is secret.
Entry's may be "tagged" with values that act as secondary names or unique identifiers in systems outside of ICE. This is particularly useful for creating files based on key-value pairs of Entry names and values, but the name of the Entry needs to be some condensed or modified form of the human readable name returned by getName().
Entry is a subclass of ICEObject. It overrides ICEObject.copy(), ICEObject.clone() as specified and required by the ICEObject class.
Giving one Entry priority over another can be done in a couple of different ways. The first way is to set an Entry's required flag to true (c.f. setRequired()). Entries can also be organized based on their identification number. If an Entry is marked as "required" it should be treated as if it is required for computation and prioritized higher than others that are not required.
iComponentListener
Constructor and Description |
---|
VizEntry()
A convenience function which calls the constructor configured to run
setup()
|
VizEntry(boolean runSetup)
A constructor that will create an Entry with only a unique ID and a name.
|
VizEntry(IVizEntryContentProvider contentProvider)
A constructor that sets the entry to the content provider.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
This operation provides a deep copy of the Entry.
|
void |
copy(VizEntry otherEntry)
This operation performs a deep copy of the attributes of another Entry
into the current Entry.
|
boolean |
equals(java.lang.Object otherEntry)
This method is used to check equality between the Entry and another
Entry.
|
java.util.ArrayList<java.lang.String> |
getAllowedValues()
This Entry returns the allowed values for the Entry and should only be
used when the AllowedValueType is defined as Discrete, in which case the
value must equal one of the allowed values.
|
java.lang.String |
getComment()
Get the value of the Entry's comment.
|
java.lang.String |
getDefaultValue()
This operation returns the default value of the Entry.
|
java.lang.String |
getErrorMessage()
This operation returns a human-readable reason for a rejected value
passed to setValue().
|
java.lang.String |
getParent()
This operation retrieves the name of the Entry on which this Entry is
dependent.
|
java.lang.String |
getTag()
This operation returns the Entry's tag.
|
java.lang.String |
getValue()
This operation returns the current value of the Entry or the default
value if no other has been specified.
|
VizAllowedValueType |
getValueType()
This operation returns the type of value that is stored in the Entry.
|
int |
hashCode()
This operation returns the hashcode value of the Entry.
|
boolean |
isModified()
This operation returns true if the Entry's value was recently set and
false if the Entry's value has not been changed or if the Entry was
recently updated.
|
boolean |
isReady()
This operation returns true if the Entry should be addressed and false if
the Entry is not ready to be addressed (waiting on a parent Entry, etc.).
|
boolean |
isRequired()
This operation returns true if the Entry should be treated as a required
quantity.
|
boolean |
isSecret()
This operation returns true if the Entry is "secret" and its contents
should be obscured if displayed or printed and false if not.
|
void |
setComment(java.lang.String comment)
Set the comment on the Entry.
|
void |
setContentProvider(IVizEntryContentProvider contentProvider)
Sets the content provider.
|
void |
setParent(java.lang.String parentName)
This operation stores the name of an Entry on which this Entry is
dependent.
|
void |
setReady(boolean isReady)
This operation sets the readiness state of the Entry to the value of
isReady.
|
void |
setRequired(boolean entryRequired)
This operation sets the marks the Entry as required or not to indicate
where or not it should be treated as a required quantity.
|
void |
setTag(java.lang.String tagValue)
This operation sets the tag of the Entry.
|
boolean |
setValue(java.lang.String newValue)
This operation sets the value of the Entry to newValue and returns true
if it is successful.
|
void |
update(java.lang.String updatedKey,
java.lang.String newValue)
(non-Javadoc)
|
copy, getDescription, getId, getName, register, setDescription, setId, setName, unregister
getClass, notify, notifyAll, toString, wait, wait, wait
register, unregister
public VizEntry()
public VizEntry(boolean runSetup)
runSetup
- Whether or not to run the setup() functionpublic VizEntry(IVizEntryContentProvider contentProvider)
contentProvider
- public java.util.ArrayList<java.lang.String> getAllowedValues()
public java.lang.String getDefaultValue()
public java.lang.String getValue()
public VizAllowedValueType getValueType()
This operation returns the type of value that is stored in the Entry.
A response type of AllowedValueType.Discrete means that the answer must be one of the values from getAllowedValues().
A response of AllowedValueTypes.Continuous means that the value must exist within the range of the maximum and minimum of the values from getAllowedValues().
A response of AllowedValueType.Undefined means that the response will not be checked.
A response of AllowedValueType.File means that the response will not be checked just like an Undefined type, but should only be used for values that represent actual files. File entries render differently in the UI.
Please note that the Entry class will check the validity of the values submitted to it and the information returned from this method is purely for information purposes (deciding how to draw the client, etc.).
public void setComment(java.lang.String comment)
comment
- The comment to set on the Entry.public java.lang.String getComment()
public boolean isReady()
public boolean isModified()
public void setParent(java.lang.String parentName)
parentName
- The name of the parent Entry.public java.lang.String getParent()
public boolean setValue(java.lang.String newValue)
newValue
- The new value of the Entry. This value will be checked by the
Entry for validity.public void setReady(boolean isReady)
isReady
- The value to which the readiness state of the Entry should be
set.public void update(java.lang.String updatedKey, java.lang.String newValue)
VizObject
update
in interface IVizObject
update
in interface IVizUpdateable
update
in class VizObject
updatedKey
- A unique key that describes the value that to be updated.
newValue
- The updated value of the key.
IUpdateable#update(String updatedKey, String newValue)
public boolean equals(java.lang.Object otherEntry)
equals
in interface IVizObject
equals
in class VizObject
otherEntry
- The Entry that should be checked for equality.Identifiable#equals(Object otherObject)
public int hashCode()
hashCode
in interface IVizObject
hashCode
in class VizObject
Identifiable#hashCode()
public boolean isSecret()
public void copy(VizEntry otherEntry)
otherEntry
- The Entry from which information should be copied.public java.lang.Object clone()
clone
in interface IVizObject
clone
in class VizObject
public java.lang.String getTag()
public void setTag(java.lang.String tagValue)
tagValue
- The Entry's new tag.public java.lang.String getErrorMessage()
The error message. If the AllowedValueType of the Entry is Continuous, it will be an error of the form:
'${incorrectValue}' in an unacceptable value. The value must be between ${lowerBound} and ${upperBound}.
If the AllowedValueType is Discrete, it will be an error of the form:
'${incorrectValue}' in an unacceptable value. The value must be one of ${allowedValues}.
The variables are:
An error message will never be posted if the type is AllowedValueType.Undefined and this value will be null.
If the value of setValue() was accepted, this operation will return null.
public void setContentProvider(IVizEntryContentProvider contentProvider)
contentProvider
- The content provider.public boolean isRequired()
public void setRequired(boolean entryRequired)
entryRequired
- The value to which the required state of the Entry should be
set; true if required, false if not.