org.jsurveylib.gui.swing.renderer
Class QuestionRenderer

java.lang.Object
  extended by org.jsurveylib.gui.swing.renderer.QuestionRenderer
All Implemented Interfaces:
SurveyElementRenderer, AnswerListener, EnableListener, ValidationListener, VisibilityListener
Direct Known Subclasses:
CheckboxRenderer, DropdownRenderer, FileChooserRenderer, RadioButtonsRenderer, TextAreaRenderer, TextFieldRenderer

public abstract class QuestionRenderer
extends java.lang.Object
implements VisibilityListener, ValidationListener, EnableListener, AnswerListener, SurveyElementRenderer

FOR INTERNAL USE ONLY.


Field Summary
static int SPACE_BEFORE_VALIDATION
           
 
Constructor Summary
QuestionRenderer(Question question)
           
 
Method Summary
 void answerChanged(Question question, boolean evaluateScript)
          This method will be called when the answer of a question is changed
 void enableStateChanged(boolean enabled)
           
 int getRowSpan()
          This returns the number of rows this question uses to render itself.
 void renderOn(javax.swing.JPanel panel, Bag bag)
          This should be called immediately after initialized.
 void shiftComponents(int shiftAmount, PageRenderer pageRenderer)
           
 void validationChanged(java.lang.String errorMessage)
           
 void visibilityChanged(boolean visible)
          The visibility status has changed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPACE_BEFORE_VALIDATION

public static final int SPACE_BEFORE_VALIDATION
See Also:
Constant Field Values
Constructor Detail

QuestionRenderer

public QuestionRenderer(Question question)
Method Detail

renderOn

public void renderOn(javax.swing.JPanel panel,
                     Bag bag)
This should be called immediately after initialized. This method renders its question on the panel passed in, using the bag to position itself.

Specified by:
renderOn in interface SurveyElementRenderer
Parameters:
panel - The panel the question will be rendered on
bag - The bag that is used for layout

visibilityChanged

public void visibilityChanged(boolean visible)
Description copied from interface: VisibilityListener
The visibility status has changed

Specified by:
visibilityChanged in interface VisibilityListener
Parameters:
visible - The new status. If true, that means the question was invisible and is now visible.

validationChanged

public void validationChanged(java.lang.String errorMessage)
Specified by:
validationChanged in interface ValidationListener

enableStateChanged

public void enableStateChanged(boolean enabled)
Specified by:
enableStateChanged in interface EnableListener

answerChanged

public void answerChanged(Question question,
                          boolean evaluateScript)
Description copied from interface: AnswerListener
This method will be called when the answer of a question is changed

Specified by:
answerChanged in interface AnswerListener
Parameters:
question - The question whose answer changed
evaluateScript - If true, the survey's script will be evaluated. If false, the script will not be evaluated.

getRowSpan

public int getRowSpan()
This returns the number of rows this question uses to render itself.

Specified by:
getRowSpan in interface SurveyElementRenderer
Returns:
The number of rows this question takes up

shiftComponents

public void shiftComponents(int shiftAmount,
                            PageRenderer pageRenderer)
Specified by:
shiftComponents in interface SurveyElementRenderer