org.sourceforge.espro.model
Class Item

java.lang.Object
  extended by org.sourceforge.espro.model.AbstractModel
      extended by org.sourceforge.espro.model.Item
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ModelInterface

public class Item
extends AbstractModel
implements java.lang.Cloneable

The Item class support exactly one item and will be stored in the Questionnaire's items ArrayList. It knows all about how to view an item and how to get the elicited data from it.

Version:
1.1
Author:
(c) 2007 Martin Kaffanke
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.sourceforge.espro.model.AbstractModel
pcs
 
Constructor Summary
Item()
          A simple constructor.
Item(Item i)
          Creates a new Item from a given Item.
Item(java.lang.String question, ElicitationMethod method)
          This is the constructor which will normally be used.
 
Method Summary
 long getDuration()
          Returns the number of milliseconds between calling start() and end().
 java.lang.String getId()
          Returns the id of the item.
 ElicitationMethod getMethod()
          Returns the current method used in this item.
 Settings getSettings()
          Returns the item settings.
 boolean isDone()
          Returns if the Item is done.
 boolean isFrozen()
          DOCUMENT ME!
 java.lang.String readableString()
          Returns a readable string.
 void setDone(boolean done)
          Sets the Item if it is done.
 void setFrozen(boolean frozen)
          DOCUMENT ME!
 void setId(java.lang.String id)
          Sets the id of the item.
 void setMethod(ElicitationMethod method)
          Sets a method for the item.
 void setSaved(boolean saved)
          Sets the saved state.
 void setSettings(Settings settings)
          Sets the item settings.
 void start()
          Starts the timer.
 void stop()
          Stops the timer.
 java.lang.String toString()
          Returns the item as string.
 
Methods inherited from class org.sourceforge.espro.model.AbstractModel
addPropertyChangeListener, addPropertyChangeListener, isSaved, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Item

public Item()
A simple constructor. Don't forget to add the question string and the method or simply use the other constructor.


Item

public Item(java.lang.String question,
            ElicitationMethod method)
This is the constructor which will normally be used.

Parameters:
question - The question to ask the subject.
method - The Method to elicite the probability.

Item

public Item(Item i)
Creates a new Item from a given Item.

Parameters:
i - The item to copy a new item from.
Method Detail

getId

public java.lang.String getId()
Returns the id of the item.

Returns:
The id.

getMethod

public ElicitationMethod getMethod()
Returns the current method used in this item.

Returns:
The method.

getSettings

public Settings getSettings()
Returns the item settings.

Returns:
Rhe settings.

isDone

public boolean isDone()
Returns if the Item is done.

Returns:
True, if the item was dann, false otherwise.

isFrozen

public boolean isFrozen()
DOCUMENT ME!

Returns:
DOCUMENT ME!

readableString

public java.lang.String readableString()
Returns a readable string. The readable String is in the form "ItemID (MethodName)".

Returns:
The readable string.

setDone

public void setDone(boolean done)
Sets the Item if it is done. This should be done by the QuestionnaireAssistant.

Parameters:
done - True if the item is done, false otherwise.

setFrozen

public void setFrozen(boolean frozen)
DOCUMENT ME!

Parameters:
frozen - DOCUMENT ME!

setId

public void setId(java.lang.String id)
Sets the id of the item. This can be dangerous to do this manually, because the Questionnaire handles this, it will give all items a specific id.

Parameters:
id - The id to the item.

setMethod

public void setMethod(ElicitationMethod method)
Sets a method for the item.

Parameters:
method - The method to set.

setSaved

public void setSaved(boolean saved)
Sets the saved state. This is done application internally, so for endusers there will not be any reason to use that except if you plan to write a new save procedure of a questionnaire i.e. into a database.

Fires a 'saved' property change if the state changes.

Overrides:
setSaved in class AbstractModel
Parameters:
saved - the saved to set

setSettings

public void setSettings(Settings settings)
Sets the item settings.

Parameters:
settings - The settings.

toString

public java.lang.String toString()
Returns the item as string.

Overrides:
toString in class java.lang.Object
Returns:
The String version of the Item.
See Also:
Object.toString()

start

public void start()
Starts the timer.


stop

public void stop()
Stops the timer.


getDuration

public long getDuration()
Returns the number of milliseconds between calling start() and end().

Returns:
The number of milliseconds.