sk.uniba.euromath.editor.widgets
Class CreateAttributeList

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

public class CreateAttributeList
extends AbstractUserInputWidget

Manages the process of creating new attributes into newly created element. Attributes themselves are not created, their names and values are returned instead.

Author:
Martin Vysny

Nested Class Summary
 class CreateAttributeList.State
          Current state of the widget.
 
Field Summary
protected  List<QName> _names
          List of chosen attribute names.
protected  List<String> _values
          List of chosen attribute values.
protected  Composite composite
          All controls are placed here.
 NamespaceManager currentManager
          Namespace manager.
protected  ValidityMessages lastMessages
          Errors that occured during last fillData() call.
 String parentName
          Name of parent element; used only to display the name on the shell.
protected  TabFolder tabFolder
          The tab folder, where all attribute-related controls are stored.
 XMLAccess xmlAccess
          Document instance.
 
Fields inherited from class sk.uniba.euromath.editor.widgets.AbstractUserInputWidget
listeners, msgListeners
 
Constructor Summary
CreateAttributeList(Composite parent, List<AttributeListRule> listRules, String parentName, XMLAccess xmlAccess, NamespaceManager currentManager)
          Constructs the instance of the window.
 
Method Summary
protected  void fillData()
           Fills the _names, _values lists and the _namespaces set.
 Set<String> getAllNamespaces()
          Retrieves all namespaces of currently selected attributes.
 Composite getComposite()
          Returns composite that is encapsulated in this object.
 ValidityMessages getMessages()
          Checks if data contained in the widget are correct.
 List<QName> getNames()
          Returns names of actually selected attributes.
 Object getState()
          Returns the state of this widget.
 Class<?> getStateClass()
          Returns the class of the state that the widget accepts.
 List<String> getValues()
          Returns text values of attributes.
 void setState(Object state)
          Sets new state for the widget.
protected  void update()
          Recreates all namelists and updates all combo boxes.
 
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

composite

protected final Composite composite
All controls are placed here.


xmlAccess

public final XMLAccess xmlAccess
Document instance.


currentManager

public final NamespaceManager currentManager
Namespace manager.


parentName

public final String parentName
Name of parent element; used only to display the name on the shell.


tabFolder

protected TabFolder tabFolder
The tab folder, where all attribute-related controls are stored.


_names

protected List<QName> _names
List of chosen attribute names.


_values

protected List<String> _values
List of chosen attribute values.


lastMessages

protected ValidityMessages lastMessages
Errors that occured during last fillData() call.

Constructor Detail

CreateAttributeList

public CreateAttributeList(Composite parent,
                           List<AttributeListRule> listRules,
                           String parentName,
                           XMLAccess xmlAccess,
                           NamespaceManager currentManager)
Constructs the instance of the window.

Parameters:
parent - the parent composite.
listRules - the list of lists of attribute. Exactly one list will be chosen.
parentName - the name of the parent element. Used only to display the name on the shell.
xmlAccess - the xml document instance.
currentManager - the current manager.
Method Detail

update

protected void update()
Recreates all namelists and updates all combo boxes.


getComposite

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

Returns:
composite where all controls are placed.

getNames

public List<QName> getNames()
Returns names of actually selected attributes. On error, function sets error message and returns null.

Returns:
list of names, or null if fillData() fails.

getValues

public List<String> getValues()
Returns text values of attributes. On error, function sets error message and returns null.

Returns:
list containing text values of attributes. null if fillData() fails.

fillData

protected void fillData()

Fills the _names, _values lists and the _namespaces set. The tab control must not yet be disposed.

If any combobox does not have name selected then function fails - it sets both lists to null and exits, returning non-null error message. If any attribute has illegal value, then function sets error message and fails.


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.

getAllNamespaces

public Set<String> getAllNamespaces()
Retrieves all namespaces of currently selected attributes.

Returns:
all namespaces of the attributes. If there are errors on the page, the function may return null or incomplete set.

getState

public 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 state)
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:
state - 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.