sk.uniba.euromath.editor.widgets
Class MultiWidget

java.lang.Object
  extended by sk.uniba.euromath.editor.widgets.AbstractUserInputWidget
      extended by sk.uniba.euromath.editor.widgets.MultiWidget
All Implemented Interfaces:
IUserInputWidget

public class MultiWidget
extends AbstractUserInputWidget

Encapsulates multiple widgets into one.

The widget's model is a List containing models of all child widgets, in the same order as in the getWidgets() list. You may override this behaviour to return some composition bean or the like.

Author:
Martin Vysny

Field Summary
protected  Composite parent
          composite where all widgets are placed
protected  List<? extends IUserInputWidget> widgets
          list of all encapsulated widgets.
 
Fields inherited from class sk.uniba.euromath.editor.widgets.AbstractUserInputWidget
listeners, msgListeners
 
Constructor Summary
MultiWidget(Composite parent, List<? extends IUserInputWidget> widgets)
          Creates the encapsulator.
 
Method Summary
 Composite getComposite()
          Returns composite that is encapsulated in this object.
 ValidityMessages getMessages()
          Checks if data contained in the widget are correct.
 List<Object> getState()
          Returns the state of this widget.
 Class<?> getStateClass()
          Returns the class of the state that the widget accepts.
 List<? extends IUserInputWidget> getWidgets()
          Returns a list of widgets provided to the constructor.
 void setState(Object model)
          Sets new state for the widget.
 
Methods inherited from class sk.uniba.euromath.editor.widgets.AbstractUserInputWidget
addMessageListener, addModifyListener, allowModifyEvent, fireDataModified, removeMessageListener, removeModifyListener, suppressModifyEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent

protected final Composite parent
composite where all widgets are placed


widgets

protected final List<? extends IUserInputWidget> widgets
list of all encapsulated widgets.

Constructor Detail

MultiWidget

public MultiWidget(Composite parent,
                   List<? extends IUserInputWidget> widgets)
Creates the encapsulator.

Parameters:
parent - composite where all widgets are already placed
widgets - list of all encapsulated widgets.
Method Detail

getWidgets

public final List<? extends IUserInputWidget> getWidgets()
Returns a list of widgets provided to the constructor.

Returns:
list of widgets.

getComposite

public final Composite getComposite()
Description copied from interface: IUserInputWidget
Returns composite that is encapsulated in this object.

Returns:
composite where all controls are placed.

getMessages

public ValidityMessages getMessages()
Description copied from interface: IUserInputWidget
Checks if data contained in the widget are correct. Contains error/info/warning messages that occured during last data change.

Returns:
null if data is correct, or instance of ValidityMessages if there is error, warning or info message.

getState

public List<Object> getState()
Description copied from interface: IUserInputWidget
Returns the state of this widget. The state must be in sync with the controls placed on the widget.

Returns:
the model.

getStateClass

public Class<?> getStateClass()
Description copied from interface: IUserInputWidget
Returns the class of the state that the widget accepts.

Returns:
model class, never null.

setState

public void setState(Object model)
Description copied from interface: IUserInputWidget
Sets new state for the widget. The widget must re-read all relevant properties from the state and set its controls with new values.

Parameters:
model - the model to set. You may use the construct setModel(getModel()) to reflect changes made in the model. Please note that nearly all widgets rejects null value.


Copyright © 2003-2006 null. All Rights Reserved.