org.universAAL.ui.handler.gui.swing.model
Class Model

Package class diagram package Model
java.lang.Object
  extended by org.universAAL.ui.handler.gui.swing.model.Model
Direct Known Subclasses:
GroupModel, InputModel, OutputModel, SubmitModel

public abstract class Model
extends Object

Abstract Class for all Form Control Models.

Author:
amedrano
See Also:
FormControl

Field Summary
protected  FormControl fc
          the FormControl for which this model represents.
static String FORM_CONTROL_IN_TABLE
          A property added to FormControls added to tables
protected  JComponent jc
          The JComponent being generated.
protected  LabelModel label
          The Label Model labeling the Form Control.
protected  boolean needsLabel
          Indicates if the FormControl needs to be associated with a label.
protected  boolean needsPostNewLine
          Indicates a new line should follow this component.
protected  boolean needsPreNewLine
          Indicates this component should be in a new line
 
Constructor Summary
Model(FormControl control, Renderer renderer)
          Model constructor.
 
Method Summary
 boolean correspondsTo(String formControlURI)
          Checks if this model corresponds to the form control with the given URI.
 JComponent getComponent()
          Returns the JComponent, and updates representing this FormControl.
 LabelModel getLabelModel()
          Models (if needed) and returns the LabelModel for the FormControl.
abstract  JComponent getNewComponent()
          generate the JComponent that displays this FormControl's information.
 int getPositionInGroup()
          Calculates the position in the parent group of the modeled FormControl.
 Renderer getRenderer()
          Get the Renderer instance to which this Model is associated to
 boolean isInDialog()
          test whether this FormControl is in a Dialog type dialog.
 boolean isInIOGroup()
          test whether this FormControl is in a IO root group.
 boolean isInMainMenu()
          test whether this FormControl is in a Main Menu type dialog.
 boolean isInMessage()
          test whether this FormControl is in a Message type dialog.
 boolean isInStandardGroup()
          test whether this FormControl is in a standard buttons root group.
 boolean isInSubDialog()
          test whether this FormControl is in a Subdialog type dialog.
 boolean isInSubmitGroup()
          test whether this FormControl is in a submit buttons root group.
 boolean isInTable()
           
abstract  boolean isValid()
          Test if the JComponent information provided by the user is valid according to the FormControl's definition.
 boolean needsLabel()
          tests if there is a need to render the Label of this FormControl, as the representation might have already included.
 boolean needsPostNewLine()
           
 boolean needsPreNewLine()
           
 void update()
          Adds all the needed information to the rendered component (in Model view).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORM_CONTROL_IN_TABLE

public static final String FORM_CONTROL_IN_TABLE
A property added to FormControls added to tables

See Also:
Constant Field Values

fc

protected FormControl fc
the FormControl for which this model represents.


needsLabel

protected boolean needsLabel
Indicates if the FormControl needs to be associated with a label. True by default


needsPreNewLine

protected boolean needsPreNewLine
Indicates this component should be in a new line


needsPostNewLine

protected boolean needsPostNewLine
Indicates a new line should follow this component.


jc

protected JComponent jc
The JComponent being generated.


label

protected LabelModel label
The Label Model labeling the Form Control.

Constructor Detail

Model

public Model(FormControl control,
             Renderer renderer)
Model constructor.

Parameters:
control - The RDF component which this Model represents.
renderer -
Method Detail

needsLabel

public boolean needsLabel()
tests if there is a need to render the Label of this FormControl, as the representation might have already included.

Returns:
whether it needsLabel or not.

needsPreNewLine

public boolean needsPreNewLine()
Returns:
the needsPreNewLine

needsPostNewLine

public boolean needsPostNewLine()
Returns:
the needsPostNewLine

isInMessage

public boolean isInMessage()
test whether this FormControl is in a Message type dialog.

Returns:
true if the FormControl is in a Message Form

isInMainMenu

public boolean isInMainMenu()
test whether this FormControl is in a Main Menu type dialog.

Returns:
true if the FormControl is in a Main Menu Form

isInDialog

public boolean isInDialog()
test whether this FormControl is in a Dialog type dialog.

Returns:
true if the FormControl is in a Dialog Form

isInSubDialog

public boolean isInSubDialog()
test whether this FormControl is in a Subdialog type dialog.

Returns:
true if the FormControl is in a Subdialog Form

isInStandardGroup

public boolean isInStandardGroup()
test whether this FormControl is in a standard buttons root group.

Returns:
true if the FormControl is within the standard buttons group

isInIOGroup

public boolean isInIOGroup()
test whether this FormControl is in a IO root group.

Returns:
true if the FormControl is within the IO group

isInSubmitGroup

public boolean isInSubmitGroup()
test whether this FormControl is in a submit buttons root group.

Returns:
true if the FormControl is within the Submits group

isInTable

public boolean isInTable()

isValid

public abstract boolean isValid()
Test if the JComponent information provided by the user is valid according to the FormControl's definition.

Returns:
true if the data has passed every restriction

getComponent

public JComponent getComponent()
Returns the JComponent, and updates representing this FormControl. If it isn't already created, it generates it.

Returns:
a JComponent Representing model's information,

update

public void update()
Adds all the needed information to the rendered component (in Model view). In LAF view, it add/updates all LAF components.


getNewComponent

public abstract JComponent getNewComponent()
generate the JComponent that displays this FormControl's information.

Returns:
a JComponent initialised with the model's information,

getRenderer

public Renderer getRenderer()
Get the Renderer instance to which this Model is associated to

Returns:
the Renderer

correspondsTo

public boolean correspondsTo(String formControlURI)
Checks if this model corresponds to the form control with the given URI.

Parameters:
formControlURI - the FormControl's URI to check with.
Returns:
true if the FormControl's URI for this model is equal to formControlURI

getLabelModel

public LabelModel getLabelModel()
Models (if needed) and returns the LabelModel for the FormControl. This method May be overridden to personalize Labels for certain FormControls.

Returns:

getPositionInGroup

public int getPositionInGroup()
Calculates the position in the parent group of the modeled FormControl.

Returns:
the position the FormControl was added to the group. 0 is first, -1 if not calculable (ie, fc is rootgroup).


Copyright © 2014 universAAL Consortium. All Rights Reserved.