|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sage.accpac.sm.view.AbstractGettable
com.sage.accpac.sm.view.AbstractSettable
com.sage.accpac.sm.ViewField
@ThreadSafe public class ViewField
Represents a field in an Accpac view FIXME documentation
Nested Class Summary | |
---|---|
static class |
ViewField.ViewFieldPresentationType
Indicates the type of presentation information defined for a field. |
static class |
ViewField.ViewFieldType
Defines the possible data types of a view field. |
Constructor Summary | |
---|---|
protected |
ViewField(View view,
int index,
int id,
java.lang.String name)
The only constructor. |
Method Summary | |
---|---|
protected void |
confirmValid()
confirms that the instance is still valid, throwing some sort of RuntimeException otherwise. |
int |
getAttributes()
Gets the view-specific boolean attributes of the field. |
int |
getDecimalPlaces()
Gets the number of decimal places to which the number field will be stored. |
java.lang.String |
getDescription()
Gets the description of the field. |
int |
getID()
Gets the field index. |
IView |
getIView()
Gets the IView object to which this field belongs |
int |
getLengthEstimate()
Return a realistic length limit for this field. |
int |
getMaxDigits()
Gets the maximum number of digits that will be stored. |
int |
getMaxLength()
returns the maximum number of characters that might (but only might) fit in this field. |
java.lang.Object |
getMaxValue()
Gets the maximum value allowed for this field The maximum value is based solely on the field type, without regard to business logic dictating whether the value is acceptable according to its context. |
java.lang.Object |
getMinValue()
Gets the minimum value allowed for this field The minimum value is based solely on the field type, without regard to business logic dictating whether the value is acceptable according to its context. |
java.lang.String |
getName()
Gets the name of the field. |
int |
getPrecision()
Deprecated. Use getDecimalPlaces() . |
ViewFieldPresentationList |
getPresentationList()
Gets a ViewFieldPresentationList that represents the presentation
list defined for the field. |
java.lang.String |
getPresentationMask()
Gets the presentation mask of the field that controls its display format. |
ViewField.ViewFieldPresentationType |
getPresentationType()
Gets the presentation type of the field. |
ViewField.ViewFieldType |
getType()
Gets the data type of the field |
java.lang.Object |
getValue()
gets the value of the given field. |
View |
getView()
Gets the View object to which this field belongs |
boolean |
hasDynamicPresentation()
returns true if and only if the presentation of the field can change. |
boolean |
hasDynamicType()
returns true if and only if the 'type' information of the field can change. |
boolean |
isEditable()
returns true if and only if the value can be changed by the caller. |
boolean |
isEnabled()
returns true if and only if the field can be meaningfully used. |
boolean |
isRequired()
returns true if and only if the value must be changed interactively before the record can be inserted. |
boolean |
mightChange()
returns true if and only if the value of the field might change non-interactively. |
boolean |
mustCheckEditable()
returns true if and only if the caller must check regularly that the field is editable. |
int |
setToMax()
Sets the field value to the maximum value |
int |
setToMin()
Sets the field value to the minimum value |
int |
setValue(java.lang.Object newValue,
boolean verify)
sets the value of the given field. |
int |
setValueOptionalField(java.lang.Object newValue,
boolean verify,
int length)
Assign a new value to the field in an optional field. |
boolean |
wasChanged()
returns true if and only if the value of the field has been changed since the last operation that retrieved or initialized the current record of the view |
Methods inherited from class com.sage.accpac.sm.view.AbstractSettable |
---|
setBigDecimal, setBigDecimal, setBoolean, setBoolean, setBytes, setBytes, setDate, setDate, setDouble, setDouble, setInt, setInt, setShort, setShort, setString, setString, setTime, setTime, setValue |
Methods inherited from class com.sage.accpac.sm.view.AbstractGettable |
---|
getBigDecimal, getBoolean, getBytes, getDate, getDouble, getInt, getShort, getString, getTime |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.sage.accpac.sm.view.Settable |
---|
setBigDecimal, setBigDecimal, setBoolean, setBoolean, setBytes, setBytes, setDate, setDate, setDouble, setDouble, setInt, setInt, setShort, setShort, setString, setString, setTime, setTime, setValue |
Methods inherited from interface com.sage.accpac.sm.view.Gettable |
---|
getBigDecimal, getBoolean, getBytes, getDate, getDouble, getInt, getShort, getString, getTime |
Constructor Detail |
---|
protected ViewField(View view, int index, int id, java.lang.String name)
view
- the view that this is a field underindex
- the zero-based index of the field in the viewid
- the id; the unique identifier for the fieldname
- the name of the fieldMethod Detail |
---|
public int getAttributes()
This gets a bitmap of the up to 16 view-specific attributes that view implementers can assign a meaning to.
For the Accpac-specific attributes that relate to the viewAttribs function use the appropriate specific function below.
getAttributes
in interface HasFieldAttributes
HasPresentationAttributes.hasDynamicPresentation()
,
HasFieldAttributes.hasDynamicType()
,
HasFieldAttributes.mightChange()
,
HasFieldAttributes.wasChanged()
,
HasFieldAttributes.isEditable()
,
HasFieldAttributes.isEnabled()
,
HasFieldAttributes.isRequired()
,
HasFieldAttributes.mustCheckEditable()
public int getDecimalPlaces()
getDecimalPlaces
in interface HasFieldAttributes
public java.lang.String getDescription()
getDescription
in interface HasFieldIdentity
public int getID()
getID
in interface HasFieldIdentity
public IView getIView()
IView
object to which this field belongs
getIView
in interface IViewField
IView
to which this field belongspublic int getLengthEstimate()
getLengthEstimate
in interface HasFieldAttributes
HasFieldAttributes.hasDynamicType()
,
HasFieldAttributes.getMaxLength()
public int getMaxLength()
This is the largest number of characters (Unicode Code Points) that could possibly fit in the field. It is always possible that a string of this length will not fit.
See the description of HasFieldAttributes.getLengthEstimate()
for a discussion of the
influence of character encoding.
getMaxLength
in interface HasFieldAttributes
HasFieldAttributes.getLengthEstimate()
public int getMaxDigits()
getDecimalPlaces
for how many
of them are after the decimal point.
getMaxDigits
in interface HasFieldAttributes
public java.lang.Object getMaxValue()
getMaxValue
in interface HasFieldLimits
public java.lang.Object getMinValue()
getMinValue
in interface HasFieldLimits
public java.lang.String getName()
getName
in interface HasFieldIdentity
HasFieldIdentity.getID()
@Deprecated public int getPrecision()
getDecimalPlaces()
.
public ViewFieldPresentationList getPresentationList()
ViewFieldPresentationList
that represents the presentation
list defined for the field. If HasPresentationAttributes.hasDynamicPresentation()
is true,
indicating the presentation list is dynamic, the presentation list will
first be refreshed (by calling ViewFieldPresentationList.refresh()
)
from the view before being returned. Returns null if the field does not
have a presentation list.
If overriding this method, ensure that the HasPresentationAttributes.hasDynamicPresentation()
and HasPresentation.getPresentationType()
methods are compatible, overriding them
if you need to.
getPresentationList
in interface HasPresentation
ViewFieldPresentationList
for the field, or a null
referenceHasPresentationAttributes.hasDynamicPresentation()
,
HasPresentation.getPresentationType()
public java.lang.String getPresentationMask()
getPresentationMask
in interface HasPresentation
HasPresentationAttributes.hasDynamicPresentation()
,
HasPresentation.getPresentationType()
public ViewField.ViewFieldPresentationType getPresentationType()
getPresentationType
in interface HasPresentation
HasPresentationAttributes.hasDynamicPresentation()
,
HasPresentation.getPresentationMask()
,
HasPresentation.getPresentationList()
public ViewField.ViewFieldType getType()
getType
in interface HasFieldAttributes
ViewField.ViewFieldType
representing the type of the fieldpublic java.lang.Object getValue()
getValue
in interface Gettable
getValue
in class AbstractGettable
Object
containing the value, or a null reference if the
value of the field is nullGettable
public View getView()
View
object to which this field belongs
View
to which this field belongspublic boolean hasDynamicPresentation()
This is true if the field has a mask and the mask may change, or if the field has a presentation list and that list may change.
It would be very unusual for the presentation type itself to change.
hasDynamicPresentation
in interface HasPresentationAttributes
true
if, and only if, the presentation of the field can
change during the life of the field objectHasPresentation.getPresentationType()
,
HasPresentation.getPresentationMask()
,
HasPresentation.getPresentationList()
public boolean hasDynamicType()
Typically this means that the precision of a decimal type may change.
hasDynamicType
in interface HasFieldAttributes
true
if, and only if, the type information of the field
can changeHasFieldAttributes.getDecimalPlaces()
,
HasFieldAttributes.getLengthEstimate()
public boolean isEditable()
If HasFieldAttributes.mustCheckEditable()
is true then this property can change but
if it returns false then the property will remain the same.
isEditable
in interface HasFieldAttributes
true
if, and only if, the value can be changed by the
callerHasFieldAttributes.mustCheckEditable()
,
FieldChangeEvent.isEditable()
public boolean isEnabled()
If this returns false most field operations are not permitted and will result in an exception being thrown.
isEnabled
in interface HasFieldAttributes
true
if, and only if, the field can currently be
meaningfully usedFieldChangeEvent.isEnabled()
public boolean isRequired()
isRequired
in interface HasFieldAttributes
true
if, and only if, the value must be set before the
record can be insertedFieldChangeEvent.isRequired()
public boolean mightChange()
Clearly if this is true then HasFieldAttributes.isEditable()
is false.
mightChange
in interface HasFieldAttributes
true
if, and only if, the field might change automaticallypublic boolean mustCheckEditable()
If this returns true then the caller must use HasFieldAttributes.isEditable()
regularly to check that the field is still editable as that can change at
any time. If this returns false then the result of HasFieldAttributes.isEditable()
will not change during the time the view is open and so the isEditable
result can be cached.
mustCheckEditable
in interface HasFieldAttributes
true
if the caller must check the editable setting
regularlyHasFieldAttributes.isEditable()
public int setToMax()
setToMax
in interface HasFieldLimits
0
on total success10
(OLD_ERRNUM_WARNING)
if the view returned it<0
(a warning) if the view returned itViewException.FieldInvalid
if the view stated the field id is not valid
ViewException.FieldDisabled
if
the view stated that the field was disabled
ViewException.FieldReadonly
if
the view stated that the field was Read-onlypublic int setToMin()
setToMin
in interface HasFieldLimits
0
on total success10
(OLD_ERRNUM_WARNING)
if the view returned it<0
(a warning) if the view returned itViewException.FieldInvalid
if the view stated the field id is not valid
ViewException.FieldDisabled
if
the view stated that the field was disabled
ViewException.FieldReadonly
if
the view stated that the field was Read-onlypublic int setValue(java.lang.Object newValue, boolean verify)
setValue
in interface Settable
newValue
- the value to which the field is to be setverify
- whether the value should be verified. (NB some verification may
also occur even if this is false)
above
public int setValueOptionalField(java.lang.Object newValue, boolean verify, int length)
newValue
- the value to which the field will be setverify
- whether the value should be verified. (NB some verification may
also occur even if this is false)length
- the length to assume
0
on total success10
(OLD_ERRNUM_WARNING)
if the view returned it<0
(a warning) if the view returned itViewException.FieldInvalid
if the view stated the field id is not valid
ViewException.FieldDisabled
if
the view stated that the field was disabled
ViewException.FieldReadonly
if
the view stated that the field was Read-onlyViewException
- if an error occurred other than those permitted errors listed
in the return values. Call
ViewException.getReason()
to get the
error code.
StringTooLongException
- if the value is or is converted to a string and the string does
not fit in the bytes provided by the field. Query the exception
to find out how much would fit.
UncheckedCharacterCodingException
- if the value is or is converted to a string and there is a
coding problem with the string (such as wrong character set or
damaged string).public boolean wasChanged()
wasChanged
in interface HasFieldAttributes
true
if, and only if, the field value has changedprotected void confirmValid()
java.lang.RuntimeException
ViewKey.confirmValid()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |