| javax.swing.JComponent com.xoetrope.swing.survey.XQuestion
All known Subclasses: com.xoetrope.swing.survey.XKioskQuestion, com.xoetrope.swing.survey.XWrapQuestion,
XQuestion | public class XQuestion extends JComponent implements XStateListener,XTextHolder,XAttributedComponent(Code) | | Title: XQuestion
Description: A component for rendering a question and a set of mutually
exclusive answers. The possible answers are rendered as a set of check marks
Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
the GNU Public License (GPL), please see license.txt for more details. If
you make commercial use of this software you must purchase a commercial
license from Xoetrope.
$Revision: 1.12 $
|
Method Summary | |
public void | addResponse(int value, String caption) | public void | clear() | public int | findCurrentResponse(int x, int y) | public boolean | fireActionEvent() Called by XClickListener to check if a response event should be sent to the
parent form. | public Object | getComponent() | public String | getCueFileName() | public int | getId() | public String | getOutputPath() | public Dimension | getPreferredSize() Gets the preferred size of the component. | public Question | getQuestion() Gets the question. | public int | getQuestionId() Gets the question id. | public int | getQuestionType() Gets the question type. | public String | getResponse() | protected XModel | getResponsesModel(Survey survey) | public int | getScale() | public String | getSourcePath() | public String | getText() | public boolean | isOptionSelected(int idx) | public void | paint(Graphics sg) Render the question. | protected void | paintActiveCheckBox(int x, int y, Graphics g) | protected void | paintActiveRadioButton(int x, int y, Graphics g) | protected void | paintActiveResponses(Graphics g) | protected void | paintBottomBand(Graphics g) | protected void | paintCheckBox(int x, int y, Graphics g) | protected void | paintCueImage(Graphics g) | protected void | paintHighlightFrame(Graphics g) | protected void | paintQuestionText(Graphics g) | protected void | paintRadioButton(int x, int y, Graphics g) | protected void | paintResponses(Graphics g) | protected void | paintSelectedResponses(Graphics g) | public void | paintStates() | protected void | paintTopBand(Graphics g) | public void | print(Graphics g) | protected void | retrieveResponses() | public int | setAttribute(String attribName, Object attribValue) Set one or more attributes of the component. | public void | setBounds(int x, int y, int w, int h) | public void | setOutput(XModel newModel, String outputPath) Update the path values stored by this node. | public void | setOutputPath(String newPath) | public void | setScale(int newScale) Sets the scale. | public void | setSource(XModel newNode) Update the model node used in the binding. | public void | setSourcePath(String newPath) | public boolean | setState(int x, int y, int defResponse) | public void | setText(String s) Sets the control's text. | public void | setup(Component c, String dataElement, XmlElement ele) Used for custom components with an argumentless constructor. | protected void | storeFreeTextResponses() | protected void | storeResponses() | protected void | superPaint(Graphics g) | public void | update(Graphics g) | public void | updateSelectedState() |
checkHeight | protected int checkHeight(Code) | | |
checkSize | protected int checkSize(Code) | | |
currentProject | protected XProject currentProject(Code) | | |
editHeight | protected int editHeight(Code) | | |
editTable | protected XEdit[] editTable(Code) | | |
editWidth | protected int editWidth(Code) | | |
frameSize | protected int frameSize(Code) | | |
headerHeight | protected int headerHeight(Code) | | |
isLastQuestion | protected boolean isLastQuestion(Code) | | |
minScale | protected int minScale(Code) | | |
printing | protected boolean printing(Code) | | |
questionBkColor | protected static Color questionBkColor(Code) | | |
questionTextColor | protected static Color questionTextColor(Code) | | |
radioArc | protected int radioArc(Code) | | |
responseHGap | protected int responseHGap(Code) | | |
responseModel | protected XModel responseModel(Code) | | |
responseState | protected int responseState(Code) | | |
responseTextBkColor | protected static Color responseTextBkColor(Code) | | |
responseTextColor | protected static Color responseTextColor(Code) | | |
responseTextGap | protected int responseTextGap(Code) | | |
responseVGap | protected int responseVGap(Code) | | |
scale | protected int scale(Code) | | |
scaleSpecified | protected boolean scaleSpecified(Code) | | |
selectedColor | protected static Color selectedColor(Code) | | |
styleManager | protected static XStyleManager styleManager(Code) | | Style settings
|
topBandHeight | protected int topBandHeight(Code) | | |
woffset | protected int woffset(Code) | | |
xScale | protected int xScale(Code) | | |
XQuestion | public XQuestion()(Code) | | Create a new question component
|
addResponse | public void addResponse(int value, String caption)(Code) | | Adds a new response option
Parameters: value - the value of the response Parameters: caption - the text |
clear | public void clear()(Code) | | Unchecks all responses
|
findCurrentResponse | public int findCurrentResponse(int x, int y)(Code) | | Find a response state based on the coordinates of the mouse click
Parameters: x - the x coordinate of the mouse click Parameters: y - the y coordinate of the mouse click the response id or Integer.MIN_VALUE if a response was not selected |
fireActionEvent | public boolean fireActionEvent()(Code) | | Called by XClickListener to check if a response event should be sent to the
parent form. The control can also use this event to do post click processing
true if the parent is to be notified |
getComponent | public Object getComponent()(Code) | | Get the component to which this binding is attached
|
getCueFileName | public String getCueFileName()(Code) | | Get the file name of the cue image
the file name |
getId | public int getId()(Code) | | Gets the question's id
The ID |
getOutputPath | public String getOutputPath()(Code) | | Get the output/save path
|
getPreferredSize | public Dimension getPreferredSize()(Code) | | Gets the preferred size of the component.
the size as a Dimension |
getQuestion | public Question getQuestion()(Code) | | Gets the question.
the question or null if none isreferenced |
getQuestionId | public int getQuestionId()(Code) | | Gets the question id.
the Question ID |
getQuestionType | public int getQuestionType()(Code) | | Gets the question type.
The question type |
getResponse | public String getResponse()(Code) | | Gets the selected response
the response value |
getResponsesModel | protected XModel getResponsesModel(Survey survey)(Code) | | Returns the XModel node that will store the user's given
responsese to this question
Parameters: survey - the currenty survey responses model node |
getScale | public int getScale()(Code) | | Gets the scale being used by this question for its layout
the scale |
getSourcePath | public String getSourcePath()(Code) | | Get the model path
|
getText | public String getText()(Code) | | Gets the questions text
The question text |
isOptionSelected | public boolean isOptionSelected(int idx)(Code) | | Checks to see if a praticular option is selected
Parameters: idx - the index of the option true if the option is selected |
paint | public void paint(Graphics sg)(Code) | | Render the question. A header is drawn containing the question text, then
the body of the question is filled. Within the body the cue image is drawn
followed by each response spaced equally and left aligned
Parameters: sg - the graphics context |
paintActiveCheckBox | protected void paintActiveCheckBox(int x, int y, Graphics g)(Code) | | |
paintActiveRadioButton | protected void paintActiveRadioButton(int x, int y, Graphics g)(Code) | | |
paintActiveResponses | protected void paintActiveResponses(Graphics g)(Code) | | |
paintCheckBox | protected void paintCheckBox(int x, int y, Graphics g)(Code) | | |
paintHighlightFrame | protected void paintHighlightFrame(Graphics g)(Code) | | |
paintRadioButton | protected void paintRadioButton(int x, int y, Graphics g)(Code) | | |
paintSelectedResponses | protected void paintSelectedResponses(Graphics g)(Code) | | |
paintStates | public void paintStates()(Code) | | Repaints the responses so that the current response is shown
|
print | public void print(Graphics g)(Code) | | Print the page
Parameters: g - the printer graphics context |
retrieveResponses | protected void retrieveResponses()(Code) | | |
setAttribute | public int setAttribute(String attribName, Object attribValue)(Code) | | Set one or more attributes of the component. Currently this handles the
attributes
- cue, value=Cue image filename
0 for success, non zero otherwise |
setBounds | public void setBounds(int x, int y, int w, int h)(Code) | | Sets the size and location of the component and rescales the content to match
Parameters: x - Parameters: y - Parameters: w - Parameters: h - |
setOutput | public void setOutput(XModel newModel, String outputPath)(Code) | | Update the path values stored by this node. The output path is used to
store selection data and state.
Parameters: newModel - the new model for saving the output data |
setOutputPath | public void setOutputPath(String newPath)(Code) | | Set the model path for the output/state data
|
setScale | public void setScale(int newScale)(Code) | | Sets the scale. The scale controls the horizontal division of the question
area. Normally this would be set to the maximum number of responses in a
survey. For example if most questions have 5 possible answers then the scale
would be set to 5
Parameters: newScale - |
setSource | public void setSource(XModel newNode)(Code) | | Update the model node used in the binding. Note that this method does not
modify the path values stored by this node.
Parameters: newNode - the new model for the data source |
setSourcePath | public void setSourcePath(String newPath)(Code) | | Set the model path for the source data
|
setState | public boolean setState(int x, int y, int defResponse)(Code) | | Find a response state based on the coordinates of the mouse click
Parameters: x - the x coordinate of the mouse click Parameters: y - the y coordinate of the mouse click Parameters: defResponse - the default response true if a response was found |
setText | public void setText(String s)(Code) | | Sets the control's text. Used to localize the control. In the case of this
control the method does nothing since the questions are localized as part
of an entire questionaire.
Parameters: s - The new text to display. |
setup | public void setup(Component c, String dataElement, XmlElement ele)(Code) | | Used for custom components with an argumentless constructor. Constructs the
binding from the model path argument and the XML argument that defines
the binding.
This object does not implement this method and throws an UnsupportedOperationException.
Parameters: c - the component to bind Parameters: dataElement - the path to the data source Parameters: ele - the XML element which contains the binding configuration |
storeFreeTextResponses | protected void storeFreeTextResponses()(Code) | | |
storeResponses | protected void storeResponses()(Code) | | |
update | public void update(Graphics g)(Code) | | Refresh the display
Parameters: g - the graphics context |
updateSelectedState | public void updateSelectedState()(Code) | | Updates the state of the options
|
Methods inherited from javax.swing.JComponent | public void addAncestorListener(AncestorListener listener)(Code)(Java Doc) public void addNotify()(Code)(Java Doc) public synchronized void addVetoableChangeListener(VetoableChangeListener listener)(Code)(Java Doc) public void computeVisibleRect(Rectangle visibleRect)(Code)(Java Doc) public boolean contains(int x, int y)(Code)(Java Doc) public JToolTip createToolTip()(Code)(Java Doc) public void disable()(Code)(Java Doc) public void enable()(Code)(Java Doc) public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)(Code)(Java Doc) public void firePropertyChange(String propertyName, int oldValue, int newValue)(Code)(Java Doc) public void firePropertyChange(String propertyName, char oldValue, char newValue)(Code)(Java Doc) protected void fireVetoableChange(String propertyName, Object oldValue, Object newValue) throws java.beans.PropertyVetoException(Code)(Java Doc) public AccessibleContext getAccessibleContext()(Code)(Java Doc) public ActionListener getActionForKeyStroke(KeyStroke aKeyStroke)(Code)(Java Doc) final public ActionMap getActionMap()(Code)(Java Doc) public float getAlignmentX()(Code)(Java Doc) public float getAlignmentY()(Code)(Java Doc) public AncestorListener[] getAncestorListeners()(Code)(Java Doc) public boolean getAutoscrolls()(Code)(Java Doc) public int getBaseline(int width, int height)(Code)(Java Doc) public BaselineResizeBehavior getBaselineResizeBehavior()(Code)(Java Doc) public Border getBorder()(Code)(Java Doc) public Rectangle getBounds(Rectangle rv)(Code)(Java Doc) final public Object getClientProperty(Object key)(Code)(Java Doc) protected Graphics getComponentGraphics(Graphics g)(Code)(Java Doc) public JPopupMenu getComponentPopupMenu()(Code)(Java Doc) public int getConditionForKeyStroke(KeyStroke aKeyStroke)(Code)(Java Doc) public int getDebugGraphicsOptions()(Code)(Java Doc) public static Locale getDefaultLocale()(Code)(Java Doc) public FontMetrics getFontMetrics(Font font)(Code)(Java Doc) public Graphics getGraphics()(Code)(Java Doc) public int getHeight()(Code)(Java Doc) public boolean getInheritsPopupMenu()(Code)(Java Doc) final public InputMap getInputMap(int condition)(Code)(Java Doc) final public InputMap getInputMap()(Code)(Java Doc) public InputVerifier getInputVerifier()(Code)(Java Doc) public Insets getInsets()(Code)(Java Doc) public Insets getInsets(Insets insets)(Code)(Java Doc) public T[] getListeners(Class<T> listenerType)(Code)(Java Doc) public Point getLocation(Point rv)(Code)(Java Doc) public Dimension getMaximumSize()(Code)(Java Doc) public Dimension getMinimumSize()(Code)(Java Doc) public Component getNextFocusableComponent()(Code)(Java Doc) public Point getPopupLocation(MouseEvent event)(Code)(Java Doc) public Dimension getPreferredSize()(Code)(Java Doc) public KeyStroke[] getRegisteredKeyStrokes()(Code)(Java Doc) public JRootPane getRootPane()(Code)(Java Doc) public Dimension getSize(Dimension rv)(Code)(Java Doc) public Point getToolTipLocation(MouseEvent event)(Code)(Java Doc) public String getToolTipText()(Code)(Java Doc) public String getToolTipText(MouseEvent event)(Code)(Java Doc) public Container getTopLevelAncestor()(Code)(Java Doc) public TransferHandler getTransferHandler()(Code)(Java Doc) public String getUIClassID()(Code)(Java Doc) public boolean getVerifyInputWhenFocusTarget()(Code)(Java Doc) public synchronized VetoableChangeListener[] getVetoableChangeListeners()(Code)(Java Doc) public Rectangle getVisibleRect()(Code)(Java Doc) public int getWidth()(Code)(Java Doc) public int getX()(Code)(Java Doc) public int getY()(Code)(Java Doc) public void grabFocus()(Code)(Java Doc) public boolean isDoubleBuffered()(Code)(Java Doc) public static boolean isLightweightComponent(Component c)(Code)(Java Doc) public boolean isManagingFocus()(Code)(Java Doc) public boolean isOpaque()(Code)(Java Doc) public boolean isOptimizedDrawingEnabled()(Code)(Java Doc) final public boolean isPaintingForPrint()(Code)(Java Doc) public boolean isPaintingTile()(Code)(Java Doc) public boolean isRequestFocusEnabled()(Code)(Java Doc) public boolean isValidateRoot()(Code)(Java Doc) public void paint(Graphics g)(Code)(Java Doc) protected void paintBorder(Graphics g)(Code)(Java Doc) protected void paintChildren(Graphics g)(Code)(Java Doc) protected void paintComponent(Graphics g)(Code)(Java Doc) public void paintImmediately(int x, int y, int w, int h)(Code)(Java Doc) public void paintImmediately(Rectangle r)(Code)(Java Doc) protected String paramString()(Code)(Java Doc) public void print(Graphics g)(Code)(Java Doc) public void printAll(Graphics g)(Code)(Java Doc) protected void printBorder(Graphics g)(Code)(Java Doc) protected void printChildren(Graphics g)(Code)(Java Doc) protected void printComponent(Graphics g)(Code)(Java Doc) protected void processComponentKeyEvent(KeyEvent e)(Code)(Java Doc) protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed)(Code)(Java Doc) protected void processKeyEvent(KeyEvent e)(Code)(Java Doc) protected void processMouseEvent(MouseEvent e)(Code)(Java Doc) protected void processMouseMotionEvent(MouseEvent e)(Code)(Java Doc) final public void putClientProperty(Object key, Object value)(Code)(Java Doc) public void registerKeyboardAction(ActionListener anAction, String aCommand, KeyStroke aKeyStroke, int aCondition)(Code)(Java Doc) public void registerKeyboardAction(ActionListener anAction, KeyStroke aKeyStroke, int aCondition)(Code)(Java Doc) public void removeAncestorListener(AncestorListener listener)(Code)(Java Doc) public void removeNotify()(Code)(Java Doc) public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)(Code)(Java Doc) public void repaint(long tm, int x, int y, int width, int height)(Code)(Java Doc) public void repaint(Rectangle r)(Code)(Java Doc) public boolean requestDefaultFocus()(Code)(Java Doc) public void requestFocus()(Code)(Java Doc) public boolean requestFocus(boolean temporary)(Code)(Java Doc) public boolean requestFocusInWindow()(Code)(Java Doc) protected boolean requestFocusInWindow(boolean temporary)(Code)(Java Doc) public void resetKeyboardActions()(Code)(Java Doc) public void reshape(int x, int y, int w, int h)(Code)(Java Doc) public void revalidate()(Code)(Java Doc) public void scrollRectToVisible(Rectangle aRect)(Code)(Java Doc) final public void setActionMap(ActionMap am)(Code)(Java Doc) public void setAlignmentX(float alignmentX)(Code)(Java Doc) public void setAlignmentY(float alignmentY)(Code)(Java Doc) public void setAutoscrolls(boolean autoscrolls)(Code)(Java Doc) public void setBackground(Color bg)(Code)(Java Doc) public void setBorder(Border border)(Code)(Java Doc) public void setComponentPopupMenu(JPopupMenu popup)(Code)(Java Doc) public void setDebugGraphicsOptions(int debugOptions)(Code)(Java Doc) public static void setDefaultLocale(Locale l)(Code)(Java Doc) public void setDoubleBuffered(boolean aFlag)(Code)(Java Doc) public void setEnabled(boolean enabled)(Code)(Java Doc) public void setFocusTraversalKeys(int id, Set<? extends AWTKeyStroke> keystrokes)(Code)(Java Doc) public void setFont(Font font)(Code)(Java Doc) public void setForeground(Color fg)(Code)(Java Doc) public void setInheritsPopupMenu(boolean value)(Code)(Java Doc) final public void setInputMap(int condition, InputMap map)(Code)(Java Doc) public void setInputVerifier(InputVerifier inputVerifier)(Code)(Java Doc) public void setMaximumSize(Dimension maximumSize)(Code)(Java Doc) public void setMinimumSize(Dimension minimumSize)(Code)(Java Doc) public void setNextFocusableComponent(Component aComponent)(Code)(Java Doc) public void setOpaque(boolean isOpaque)(Code)(Java Doc) public void setPreferredSize(Dimension preferredSize)(Code)(Java Doc) public void setRequestFocusEnabled(boolean requestFocusEnabled)(Code)(Java Doc) public void setToolTipText(String text)(Code)(Java Doc) public void setTransferHandler(TransferHandler newHandler)(Code)(Java Doc) protected void setUI(ComponentUI newUI)(Code)(Java Doc) public void setVerifyInputWhenFocusTarget(boolean verifyInputWhenFocusTarget)(Code)(Java Doc) public void setVisible(boolean aFlag)(Code)(Java Doc) public void unregisterKeyboardAction(KeyStroke aKeyStroke)(Code)(Java Doc) public void update(Graphics g)(Code)(Java Doc) public void updateUI()(Code)(Java Doc)
|
|
|