at.spardat.xma.mdl.list
Class ListUIDelegateClient

java.lang.Object
  extended byat.spardat.xma.mdl.UIDelegateClient
      extended byat.spardat.xma.mdl.list.ListUIDelegateClient

public class ListUIDelegateClient
extends UIDelegateClient

This class is the UIDelegate for a ListWMClient widget model. It manages the interaction between an SWT-combo or an SWT-list and the widget model. If a Combo is to be attached, the model must not have the style IListWM.S_MULTI_SELECT. If a List is to be attached, the model must not have the style IListWM.S_NOT_STRICT.


Constructor Summary
ListUIDelegateClient(ListWMClient wModel)
          Constructor
 
Method Summary
 void attachUI(java.lang.Object control, java.lang.Object label)
          Attaches a UI library control.
 void detachUI()
          Detaches the UI-control.
 java.lang.Object getUIControl()
          This method returns the attached UI-control.
 java.lang.Object getUILabel()
          Returns the label that has been provided via attachUI.
 WModel getWModel()
          Returns the WidgetModel this UIDelegateClient is attached to.
 void handleModelChangeEvent(ModelChangeEvent event)
          The widget model has been changed.
 void handleUIEvent(java.lang.Object event, int type)
          This method is responsible for accepting events originating from the UI library, creating corresponding ModelChangeEvents and updating the WidgetModels.
 boolean isDoPrefixSearch()
           
 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 isPrefixSearchCaseSensitive()
           
 boolean isUIAttached()
          Yields true, if this UIDelegateClient is attached, i.e., has a Control of the UI-library associated.
 void resetWidgetFromModel()
          Sets the widget to the current value of the model.
 void setDoPrefixSearch(boolean doPrefixSearch)
          determine if prefix search has to be done on this model
 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 setErrorColor(boolean inError)
          If inError, this method sets the background of the corresponding Control c to the error color defined in ComponentClient.
 void setPrefixSearchCaseSensitive(boolean prefixSearchCaseSensitive)
          determine if prefix seach has to be done case sensitive or not
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListUIDelegateClient

public ListUIDelegateClient(ListWMClient wModel)
Constructor

Parameters:
wModel - the widget model to use this UIDelegate with.
Method Detail

handleUIEvent

public void handleUIEvent(java.lang.Object event,
                          int type)
Description copied from class: UIDelegateClient
This method is responsible for accepting events originating from the UI library, creating corresponding ModelChangeEvents and updating the WidgetModels.

This method does nothing if isUIAttached() is false.

Specified by:
handleUIEvent in class UIDelegateClient
Parameters:
event - the Event-object from a particular UI libraray, e.g., SWT.
type - TODO

handleModelChangeEvent

public void handleModelChangeEvent(ModelChangeEvent event)
Description copied from class: UIDelegateClient
The widget model has been changed. The change is described by the provided event object. If this UIDelegateClient is UI-attached, this method must synchronize the change with the UI. Note that the change has already been applied to the model, i.e., the model already reflects the new (changed) state.

Specified by:
handleModelChangeEvent in class UIDelegateClient

getWModel

public WModel getWModel()
Description copied from class: UIDelegateClient
Returns the WidgetModel this UIDelegateClient is attached to.

Specified by:
getWModel in class UIDelegateClient
Returns:
the WidgetModel, never null.

isUIAttached

public boolean isUIAttached()
Description copied from class: UIDelegateClient
Yields true, if this UIDelegateClient is attached, i.e., has a Control of the UI-library associated.

Specified by:
isUIAttached in class UIDelegateClient
Returns:
true if attached.

attachUI

public void attachUI(java.lang.Object control,
                     java.lang.Object label)
              throws AttachmentExceptionClient
Description copied from class: UIDelegateClient
Attaches a UI library control. Upon successful attachement, isUIAttached() holds true.

Specified by:
attachUI in class UIDelegateClient
Parameters:
control - an object of the UI class library. For example, in the case of SWT it is a SWT Widget like a Text, Label or Check Box.
label - a widget of the UI class library which is the label for control. With SWT, typically it the control is a Text field, the label is a Label widget which usually is the widget holding the describing text in front of the Text field. The label is used in error messages. It may be null.
Throws:
AttachmentExceptionClient - if the control cannot be attached.

resetWidgetFromModel

public void resetWidgetFromModel()
Sets the widget to the current value of the model. The only situation where widget and model may differ, is if the widget contains a value not accepted by the validiator. In this case the model contains the last known valid value.


getUIControl

public java.lang.Object getUIControl()
Description copied from class: UIDelegateClient
This method returns the attached UI-control.

Specified by:
getUIControl in class UIDelegateClient
Returns:
The attached UI-control.

getUILabel

public java.lang.Object getUILabel()
Description copied from class: UIDelegateClient
Returns the label that has been provided via attachUI. Returns null if the label provided in attachUI was null.

Specified by:
getUILabel in class UIDelegateClient
See Also:
UIDelegateClient.getUILabel()

detachUI

public void detachUI()
Description copied from class: UIDelegateClient
Detaches the UI-control.

Specified by:
detachUI in class UIDelegateClient

isEditable

public boolean isEditable()
Description copied from class: UIDelegateClient
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 class UIDelegateClient

setEditable

public void setEditable(boolean what)
Description copied from class: UIDelegateClient
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 class UIDelegateClient
Parameters:
what - true if the model's widget should be editable, false otherwise.

isEnabled

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

Specified by:
isEnabled in class UIDelegateClient

setEnabled

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

Specified by:
setEnabled in class UIDelegateClient
Parameters:
what - the state to set.

isPrefixSearchCaseSensitive

public boolean isPrefixSearchCaseSensitive()
Returns:
if prefix search will be done case sensitive
Since:
1.7.3

setPrefixSearchCaseSensitive

public void setPrefixSearchCaseSensitive(boolean prefixSearchCaseSensitive)
determine if prefix seach has to be done case sensitive or not

Parameters:
prefixSearchCaseSensitive -
Since:
1.7.3

isDoPrefixSearch

public boolean isDoPrefixSearch()
Returns:
if prefix search will be done on this list model
Since:
1.8.1

setDoPrefixSearch

public void setDoPrefixSearch(boolean doPrefixSearch)
determine if prefix search has to be done on this model

Since:
1.8.1

setErrorColor

public void setErrorColor(boolean inError)
If inError, this method sets the background of the corresponding Control c to the error color defined in ComponentClient. If inError is false, the background is reset to the default color.

Specified by:
setErrorColor in class UIDelegateClient