at.spardat.xma.mdl.simple
Class SimpleWMClient

java.lang.Object
  extended byat.spardat.xma.mdl.WModel
      extended byat.spardat.xma.mdl.simple.SimpleWM
          extended byat.spardat.xma.mdl.simple.SimpleWMClient
All Implemented Interfaces:
Descriptive, IAtomic, ISimpleWM, ISimpleWMClient, IWModelClient, Synchronization, Transactional

public class SimpleWMClient
extends SimpleWM
implements ISimpleWMClient

Implementation of IWModelClient.


Field Summary
 
Fields inherited from class at.spardat.xma.mdl.simple.SimpleWM
type_, value_
 
Fields inherited from class at.spardat.xma.mdl.WModel
S_NULL
 
Constructor Summary
SimpleWMClient(short id, byte type, PageClient pm)
          Constructor
 
Method Summary
 boolean doUITransfer()
          The user of this class may forget to assign a correct formatter.
 at.spardat.enterprise.fmt.IFmt getFmt()
          Returns a clone of the associated Formatter or null if none is associated.
protected  at.spardat.enterprise.fmt.IFmt getFmtInternal()
          Returns the formatter for internal, read-only access.
 java.lang.String getFormattedString()
          Provides a string that results from applying the formatter to the internally stored value.
 PageClient getPageModelC()
          Returns the PageClient this WidgetModelC belongs to.
 UIDelegateClient getUIDelegate()
          Returns the attached UIDelegateClient.
 boolean handle(ModelChangeEvent event)
          This method does not simply apply the ChangeEvent to this, but also notifies the UIDelegateClient to allow it to synchronize the UI.
 boolean isEditable()
          Returns true if this model's widget may be modified by the end-user.
 boolean isEnabled()
          Returns true, if this model's widget is enabled.
 boolean isMandatory()
          Returns the MANDATORY-property of the associated formatter.
 boolean isValidateIfUneditable()
          Returns if this widget is validated in the editable=false state, too.
 boolean isValueValid()
          Determines if the value contained in this Model is a valid one in terms of the associated formatter.
 void setEditable(boolean what)
          Sets the editable-state of this models's widget.
 void setEnabled(boolean what)
          Sets the enabled-state of this model's widget.
 void setFmt(at.spardat.enterprise.fmt.IFmt formatter)
          Sets a new Formatter.
 void setMandatory(boolean what)
          If there is a formatter attached, this method clones the old formatter, changes the MANDATORY-property of the formatter to the provided value, and sets the formatter.
protected  boolean settersShouldBeSloppy(Page page)
          Determines if setters should ignore type violations.
 void setValidateIfUneditable(boolean what)
          If this is set to true then the widget is validated in the editable=false state, too.
 
Methods inherited from class at.spardat.xma.mdl.simple.SimpleWM
changed, clear, commit, describe, equalsCS, estimateMemory, externalize, getEncodedValue, getType, hasValue, internalize, isTrue, randomlyChange, rollback, set, set, set, set, set, set, set, set, set, set, set, set, set, set, setInternal, toBigDecimal, toByte, toBYTE, toDate, toDouble, toDOUBLE, toFloat, toFLOAT, toInt, toINTEGER, toLong, toLONG, toShort, toSHORT, toString, toString
 
Methods inherited from class at.spardat.xma.mdl.WModel
cleanUpAfterServerEvent, getId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface at.spardat.xma.mdl.simple.ISimpleWM
clear, set, set, set, set, set, set, set, set, set, set, set, set, set, set
 
Methods inherited from interface at.spardat.xma.mdl.IAtomic
getEncodedValue, getType, hasValue, isTrue, toBigDecimal, toByte, toBYTE, toDate, toDouble, toDOUBLE, toFloat, toFLOAT, toInt, toINTEGER, toLong, toLONG, toShort, toSHORT, toString, toString
 

Constructor Detail

SimpleWMClient

public SimpleWMClient(short id,
                      byte type,
                      PageClient pm)
Constructor

Parameters:
id - the unique id of a WidgetModel
type - a type constant of interface Types.
pm - the Page this model belongs to
Method Detail

isValueValid

public boolean isValueValid()
Description copied from interface: ISimpleWMClient
Determines if the value contained in this Model is a valid one in terms of the associated formatter. Note the formatter usually restricts the allowed value range of the type. Since formatters are only executing at the client side, it may be the case that the server provides values which are obeying the type, but are conflicting with the formatter.

Specified by:
isValueValid in interface ISimpleWMClient
Returns:
true if the contained value conflicts with the formatter.
See Also:
ISimpleWMClient.isValueValid()

getFmt

public at.spardat.enterprise.fmt.IFmt getFmt()
Description copied from interface: ISimpleWMClient
Returns a clone of the associated Formatter or null if none is associated.

Specified by:
getFmt in interface ISimpleWMClient
Returns:
the attached formatter
See Also:
ISimpleWMClient.getFmt()

getFmtInternal

protected at.spardat.enterprise.fmt.IFmt getFmtInternal()
Returns the formatter for internal, read-only access. May be null.


setFmt

public void setFmt(at.spardat.enterprise.fmt.IFmt formatter)
Description copied from interface: ISimpleWMClient
Sets a new Formatter.

Specified by:
setFmt in interface ISimpleWMClient
Parameters:
formatter - to be set. It must be compatible to the type set in the superclass. For type T_STRING, any formatter may be set. For the other types, the type of the formatter must be compatible with the type specified in the superclass. For instance, if the type is T_BCD, only instances of ABcdFmt are allowed.
See Also:
ISimpleWMClient.setFmt(at.spardat.enterprise.fmt.IFmt)

doUITransfer

public boolean doUITransfer()
The user of this class may forget to assign a correct formatter. This does not matter if the type is T_STRING, but with other types, we cannot exchange strings with the UI.

Returns:
true, if formatter state is correct and data may exchanged with the UI.

getFormattedString

public java.lang.String getFormattedString()
Description copied from interface: ISimpleWMClient
Provides a string that results from applying the formatter to the internally stored value.

Specified by:
getFormattedString in interface ISimpleWMClient
See Also:
ISimpleWMClient.getFormattedString()

getUIDelegate

public UIDelegateClient getUIDelegate()
Description copied from interface: IWModelClient
Returns the attached UIDelegateClient.

Specified by:
getUIDelegate in interface IWModelClient
Returns:
at.spardat.xma.mdl.client.UIDelegateClient

handle

public boolean handle(ModelChangeEvent event)
This method does not simply apply the ChangeEvent to this, but also notifies the UIDelegateClient to allow it to synchronize the UI.

Overrides:
handle in class SimpleWM
See Also:
WModel.handle(ModelChangeEvent)

getPageModelC

public PageClient getPageModelC()
Returns the PageClient this WidgetModelC belongs to.

Returns:
PageClient, never null.

isEditable

public boolean isEditable()
Description copied from interface: IWModelClient
Returns true if this model's widget may be modified by the end-user. Returns false, if the widget may not be edited, but the content of the widget should be readable and receive focus.

Specified by:
isEditable in interface IWModelClient
See Also:
IWModelClient.isEditable()

isEnabled

public boolean isEnabled()
Description copied from interface: IWModelClient
Returns true, if this model's widget is enabled. Returns false, if it is disabled. A disabled control is displayed in a greyed look and does not receive focus.

Specified by:
isEnabled in interface IWModelClient
See Also:
IWModelClient.isEnabled()

setEditable

public void setEditable(boolean what)
Description copied from interface: IWModelClient
Sets the editable-state of this models's widget. A widget which is not editable can not be modified by the end user. Unlike the disabled-state, its contents remains readable and still receives focus.

Usually, this method is called on all widget-models of a page to set the whole page to a read-only mode.

If this method is not called, the default is true.

Specified by:
setEditable in interface IWModelClient
Parameters:
what - true if the model's widget should be editable, false otherwise.
See Also:
IWModelClient.setEditable(boolean)

setEnabled

public void setEnabled(boolean what)
Description copied from interface: IWModelClient
Sets the enabled-state of this model's widget.

Specified by:
setEnabled in interface IWModelClient
Parameters:
what - the state to set.
See Also:
IWModelClient.setEnabled(boolean)

isMandatory

public boolean isMandatory()
Description copied from interface: ISimpleWMClient
Returns the MANDATORY-property of the associated formatter. Returns false, if there is no formatter associated.

Specified by:
isMandatory in interface ISimpleWMClient
See Also:
ISimpleWMClient.isMandatory()

setMandatory

public void setMandatory(boolean what)
Description copied from interface: ISimpleWMClient
If there is a formatter attached, this method clones the old formatter, changes the MANDATORY-property of the formatter to the provided value, and sets the formatter. If there is no formatter attached, this method does nothing.

Specified by:
setMandatory in interface ISimpleWMClient
See Also:
ISimpleWMClient.setMandatory(boolean)

setValidateIfUneditable

public void setValidateIfUneditable(boolean what)
Description copied from interface: ISimpleWMClient
If this is set to true then the widget is validated in the editable=false state, too. Normally widgets in the editable=false state are not validated. So this property defaults to false, if not set otherwise.

Specified by:
setValidateIfUneditable in interface ISimpleWMClient
Parameters:
what -
Since:
version_number
See Also:
at.spardat.xma.mdl.IWModelClient#setValidateIfUneditable()

isValidateIfUneditable

public boolean isValidateIfUneditable()
Description copied from interface: ISimpleWMClient
Returns if this widget is validated in the editable=false state, too. Normally widgets in the editable=false state are not validated. So this property defaults to false, if not set otherwise.

Specified by:
isValidateIfUneditable in interface ISimpleWMClient
Returns:
the validateUneditable property
Since:
version_number
See Also:
at.spardat.xma.mdl.IWModelClient#isValidateIfUneditable()

settersShouldBeSloppy

protected boolean settersShouldBeSloppy(Page page)
Description copied from class: SimpleWM
Determines if setters should ignore type violations.

Overrides:
settersShouldBeSloppy in class SimpleWM
See Also:
SimpleWM.settersShouldBeSloppy(Page)