All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class guinea.ui.GradeBar

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----guinea.ui.GradeBar

public class GradeBar
extends Container
implements AdjustmentListener, QuestionInterface, ControlInterface, PropertyLoader
Gradebar is a UI component with a continuous scale. The minimum and maximum values of the grade can be specified as well as number of decimal places and possible "anchors".


Variable Index

· controlCommand
· isControl
· isQuestion
· showLabels
· showValue

Constructor Index

· GradeBar()
Create a new grade bar with default grade parameters and no question.
· GradeBar(double, double, int)
Create a new grade bar with given parameters.
· GradeBar(double, double, int, String)
Create a new grade bar with given parameters.
· GradeBar(String)
Create a new grade bar with default grade parameters.

Method Index

· addAnswerListener(AnswerListener)
Add a listener that is interested to receive answer events.
· addControlListener(ControlListener)
Add a control listener to receive events from this control component.
· adjustmentValueChanged(AdjustmentEvent)
· getAnswer()
Get answer for question.
· getAnswer_internal()
· getChoiceFormat()
Get the choice format used for formatting the grade.
· getControlValue()
Get the value of this controller.
· getDecimals()
Get number of decimals.
· getMaximum()
Get the maximum value of grade.
· getMinimum()
Get the minimum value of grade.
· getPreferredSize()
Returns the preferred size of this container.
· getQuestion()
Get the text of the question.
· getQuestionFont()
Get font of the question text.
· getQuestionID()
Get the ID of the question.
· isAnswered()
See if an aswer has been given.
· isControlEnabled()
Test whether control is enabled or disabled.
· isQuestionEnabled()
Test whether question is enabled or disabled.
· paint(Graphics)
Paints the container.
· propertyLoad(Properties, String)
· removeAnswerListener(AnswerListener)
Removes the specified listener so it no longer receives control motion events from this component.
· removeControlListener(ControlListener)
Remove a control listener so that control events are no longer sent to that listener.
· reset()
Reset question to default answer and/or to unanswered state.
· setAnswer(Object)
Set answer of question.
· setChoiceFormat(ChoiceFormat)
Set the choice format for showing an adjective corresponding to a grade.
· setChoiceFormat(double[], String[])
Set the choice format for showing an adjective corresponding to a grade.
· setChoiceFormat(String)
Set the choice format for showing an adjective corresponding to a grade using a pattern.
· setControlEnabled(boolean)
Enable or disable control component.
· setControlValue(Object)
Set the value of this controller.
· setDecimals(int)
Set number of decimals to show and return in answer.
· setEnabled(boolean)
Fix an error in java's setEnabled for Containers
· setMaximum(double)
Set maximum value of grade.
· setMinimum(double)
Set minimum value of grade.
· setQuestion(String)
Set the text of the question.
· setQuestionEnabled(boolean)
Enable or disable question component.
· setQuestionFont(Font)
Set font of the question text.
· setQuestionID(String)
Set the ID of this question.
· valueToString(double)

Variables

· showValue
 protected boolean showValue
· showLabels
 protected boolean showLabels
· isQuestion
 protected boolean isQuestion
· isControl
 protected boolean isControl
· controlCommand
 protected String controlCommand

Constructors

· GradeBar
 public GradeBar()
Create a new grade bar with default grade parameters and no question.

· GradeBar
 public GradeBar(String qtext)
Create a new grade bar with default grade parameters.

Parameters:
qtext - Text of question.
· GradeBar
 public GradeBar(double minVal,
                 double maxVal,
                 int decimals)
Create a new grade bar with given parameters.

Parameters:
minVal - minimum value of grade.
maxVal - maximum value of grade.
decimals - number of decimals.
· GradeBar
 public GradeBar(double minVal,
                 double maxVal,
                 int decimals,
                 String qtext)
Create a new grade bar with given parameters.

Parameters:
minVal - minimum value of grade.
maxVal - maximum value of grade.
decimals - number of decimals.
qtext - text of question.

Methods

· setMinimum
 public void setMinimum(double minVal)
Set minimum value of grade.

Parameters:
minVal - minimum value of grade.
· getMinimum
 public double getMinimum()
Get the minimum value of grade.

Returns:
minimum value of grade.
· setMaximum
 public void setMaximum(double maxVal)
Set maximum value of grade.

Parameters:
maxVal - maximum value of grade.
· getMaximum
 public double getMaximum()
Get the maximum value of grade.

Returns:
maximum value of grade.
· paint
 public void paint(Graphics g)
Paints the container.

Overrides:
paint in class Container
· setDecimals
 public synchronized void setDecimals(int decimals)
Set number of decimals to show and return in answer.

Parameters:
decimals - number of decimals or 0 if no decimals wanted.
· getDecimals
 public int getDecimals()
Get number of decimals.

· setChoiceFormat
 public void setChoiceFormat(double limits[],
                             String names[])
Set the choice format for showing an adjective corresponding to a grade. Constructs with limits and corresponding formats based on the pattern.

See Also:
ChoiceFormat, setChoices
· setChoiceFormat
 public void setChoiceFormat(String pattern)
Set the choice format for showing an adjective corresponding to a grade using a pattern.

See Also:
ChoiceFormat, applyPattern
· setChoiceFormat
 public void setChoiceFormat(ChoiceFormat cf)
Set the choice format for showing an adjective corresponding to a grade.

Parameters:
cf - The choice format to be used.
· getChoiceFormat
 public ChoiceFormat getChoiceFormat()
Get the choice format used for formatting the grade.

Returns:
A ChoiceFormat object.
· valueToString
 protected String valueToString(double value)
· adjustmentValueChanged
 public void adjustmentValueChanged(AdjustmentEvent e)
· setQuestionEnabled
 public void setQuestionEnabled(boolean enabled)
Enable or disable question component.

Parameters:
enabled - Use true to enable, false to disable the question.
· isQuestionEnabled
 public boolean isQuestionEnabled()
Test whether question is enabled or disabled.

Returns:
true if question is enabled, false if not.
· getAnswer
 public Object getAnswer()
Get answer for question. If number of decimals is 0, returns a java.lang.Integer, otherwise returns a java.lang.Double.

Returns:
the answer as a java.lang.Number or null if question hasn't been answered.
· getAnswer_internal
 protected Object getAnswer_internal()
· setAnswer
 public void setAnswer(Object answer)
Set answer of question.

Parameters:
answer - the answer as a java.lang.Number. null clears answer (question becomes unanswered. Same as reset().
· reset
 public void reset()
Reset question to default answer and/or to unanswered state.

· isAnswered
 public boolean isAnswered()
See if an aswer has been given.

Returns:
true if user has given an answer.
· setQuestion
 public void setQuestion(String question)
Set the text of the question.

Parameters:
question - text of the question.
· getQuestion
 public String getQuestion()
Get the text of the question.

Returns:
text of the question.
· setQuestionID
 public void setQuestionID(String id)
Set the ID of this question.

Parameters:
id - ID label of question.
· getQuestionID
 public String getQuestionID()
Get the ID of the question.

Returns:
ID label of the question.
· setQuestionFont
 public void setQuestionFont(Font f)
Set font of the question text.

· getQuestionFont
 public Font getQuestionFont()
Get font of the question text.

· addAnswerListener
 public synchronized void addAnswerListener(AnswerListener listener)
Add a listener that is interested to receive answer events.

Parameters:
listener - A listener.
· removeAnswerListener
 public synchronized void removeAnswerListener(AnswerListener listener)
Removes the specified listener so it no longer receives control motion events from this component.

Parameters:
listener - A control listener.
· setControlEnabled
 public void setControlEnabled(boolean enabled)
Enable or disable control component.

Parameters:
enabled - Use true to enable, false to disable the controller.
· isControlEnabled
 public boolean isControlEnabled()
Test whether control is enabled or disabled.

Returns:
true if controller is enabled, false if not.
· setControlValue
 public void setControlValue(Object value)
Set the value of this controller. Can be used to set initial value of controlled variable.

Parameters:
value - the value to set.
· getControlValue
 public Object getControlValue()
Get the value of this controller. Can be used to get initial value of controlled variable.

Parameters:
value - The value to get.
· addControlListener
 public void addControlListener(ControlListener listener)
Add a control listener to receive events from this control component.

Parameters:
listener - a listener
· removeControlListener
 public void removeControlListener(ControlListener listener)
Remove a control listener so that control events are no longer sent to that listener.

Parameters:
listener - a listener
· setEnabled
 public void setEnabled(boolean enable)
Fix an error in java's setEnabled for Containers

Parameters:
enable - enable or disable component.
Overrides:
setEnabled in class Component
· getPreferredSize
 public Dimension getPreferredSize()
Returns the preferred size of this container.

Overrides:
getPreferredSize in class Container
· propertyLoad
 public void propertyLoad(Properties p,
                          String name) throws IllegalArgumentException

All Packages  Class Hierarchy  This Package  Previous  Next  Index