at.spardat.xma.mdl.table
Class TableUIDelegateClient

java.lang.Object
  extended byat.spardat.xma.mdl.UIDelegateClient
      extended byat.spardat.xma.mdl.table.TableUIDelegateClient

public class TableUIDelegateClient
extends UIDelegateClient

This class manages the UI related aspects of a TableWMClient widget model


Nested Class Summary
 class TableUIDelegateClient.RowComparator
          To compare two entries of the sortPermutation instance variable
 
Constructor Summary
TableUIDelegateClient(TableWMClient wModel)
          Constructor
 
Method Summary
 void attachUI(java.lang.Object control, java.lang.Object label)
          Requirements on the attached SWT table are: The number of visible columns in the model must match the number of columns of the SWT table.
 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)
          The attached Table must delegate its SelectionEvent to this method in order to keep track of the selection state of the table.
 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 isUIAttached()
          Yields true, if this UIDelegateClient is attached, i.e., has a Control of the UI-library associated.
 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)
          Not implemented - does nothing
protected  void sortNatural()
          Resets the order to the natural order of the rows.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableUIDelegateClient

public TableUIDelegateClient(TableWMClient wModel)
Constructor

Parameters:
wModel - the widget model this UI delegate belongs to
Method Detail

handleUIEvent

public void handleUIEvent(java.lang.Object event,
                          int type)
The attached Table must delegate its SelectionEvent to this method in order to keep track of the selection state of the table. Moreover, if the table is sortable, the SelectionEvents of every TableColumn must also be notified.

Specified by:
handleUIEvent in class UIDelegateClient
Parameters:
event - the Event-object from a particular UI libraray, e.g., SWT.
type - TODO
See Also:
UIDelegateClient.handleUIEvent(java.lang.Object, int)

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
See Also:
UIDelegateClient.handleModelChangeEvent(at.spardat.xma.mdl.ModelChangeEvent)

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.
See Also:
UIDelegateClient.getWModel()

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.
See Also:
UIDelegateClient.isUIAttached()

attachUI

public void attachUI(java.lang.Object control,
                     java.lang.Object label)
              throws AttachmentExceptionClient
Requirements on the attached SWT table are:

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.
See Also:
UIDelegateClient.attachUI(java.lang.Object, java.lang.Object)

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.
See Also:
UIDelegateClient.getUIControl()

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
See Also:
UIDelegateClient.detachUI()

sortNatural

protected void sortNatural()
Resets the order to the natural order of the rows. I.e., to the state after construction and before any sort-calls.


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
See Also:
UIDelegateClient.isEnabled()

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.
See Also:
UIDelegateClient.setEnabled(boolean)

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
See Also:
UIDelegateClient.isEditable()

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.
See Also:
UIDelegateClient.setEditable(boolean)

setErrorColor

public void setErrorColor(boolean inError)
Not implemented - does nothing

Specified by:
setErrorColor in class UIDelegateClient