com.abstractics.utils.swing
Class AdjustableQuestionDialog

java.lang.Object
  extended bycom.abstractics.utils.swing.AdjustableQuestionDialog

public class AdjustableQuestionDialog
extends java.lang.Object

The AdjustableQuestionDialog object is a wrapper around a JDialog that contains an AdjustableQuestionPanel object. The object is constructed, and then repeated calls to the addQuestion methods can be made. Finally, the show() method can be called causing the modal dialog to be invoked, and upon returning from the call the user's answers will be available. The JDialog that this object is holding is disposed when the dialog is closed.

Version:
$Id: AdjustableQuestionDialog.java,v 1.2 2005/12/15 15:55:23 andrew Exp $
Author:
Andrew Lawrence, Copyright 2006 Abstractics, L.L.C., Licensed under the Apache License, Version 2.0

Constructor Summary
AdjustableQuestionDialog(java.awt.Dialog owner, java.lang.String title)
           
AdjustableQuestionDialog(java.awt.Frame owner, java.lang.String title)
           
 
Method Summary
 void addQuestionCheckbox(java.lang.String label)
           
 void addQuestionComboBox(java.lang.String label, java.lang.Object[] choices)
           
 void addQuestionFixed(java.lang.String label, java.lang.String text)
           
 void addQuestionFixedTextArea(java.lang.String label, java.lang.String text, int rows, int columns)
           
 void addQuestionText(java.lang.String label, int textBoxColumns)
           
 void addQuestionTextArea(java.lang.String label, int rows, int columns)
           
 javax.swing.JButton getCancelButton()
           
 javax.swing.JDialog getDialog()
           
 javax.swing.JButton getOkButton()
           
 AdjustableQuestionPanel getPanel()
           
 javax.swing.JComponent getQuestionComponent(int questionIndex)
           
 void setCancelAvailable(boolean yes)
          If the Cancel button should be shown (default) then set this to true.
 void setDefaultValues(java.lang.Object[] defaultValues)
           
 java.lang.Object[] show()
          Causes the dialog to be shown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdjustableQuestionDialog

public AdjustableQuestionDialog(java.awt.Frame owner,
                                java.lang.String title)
Parameters:
owner -
title -

AdjustableQuestionDialog

public AdjustableQuestionDialog(java.awt.Dialog owner,
                                java.lang.String title)
Parameters:
owner -
title -
Method Detail

show

public java.lang.Object[] show()
Causes the dialog to be shown. All previous answers (if any) are reset to default.

Returns:
Returns null if the user cancelled, otherwise returns an array of the answers the user gave for the questions, in order of how the questions were added to the dialog.
See Also:
AdjustableQuestionPanel.getAnswers()

setDefaultValues

public void setDefaultValues(java.lang.Object[] defaultValues)
See Also:
AdjustableQuestionPanel.setDefaultValues(Object[])

setCancelAvailable

public void setCancelAvailable(boolean yes)
If the Cancel button should be shown (default) then set this to true. If set to false, then only the OK button will be shown and ESC will not cancel the dialog.

Parameters:
yes -

getCancelButton

public javax.swing.JButton getCancelButton()
Returns:
The Cancel button of the dialog

getDialog

public javax.swing.JDialog getDialog()
Returns:
The JDialog object that this object is wrapping. NOTE: calling the show() method of this object will cause strange results.

getOkButton

public javax.swing.JButton getOkButton()
Returns:
The OK button of the dialog

getPanel

public AdjustableQuestionPanel getPanel()
Returns:
The AdjustableQuestionPanel object that this dialog object is wrapping

addQuestionComboBox

public void addQuestionComboBox(java.lang.String label,
                                java.lang.Object[] choices)
See Also:
AdjustableQuestionPanel.addQuestionComboBox(String, Object[])

addQuestionFixed

public void addQuestionFixed(java.lang.String label,
                             java.lang.String text)
See Also:
AdjustableQuestionPanel.addQuestionFixed(String, String)

addQuestionText

public void addQuestionText(java.lang.String label,
                            int textBoxColumns)
See Also:
AdjustableQuestionPanel.addQuestionText(String, int)

addQuestionTextArea

public void addQuestionTextArea(java.lang.String label,
                                int rows,
                                int columns)
See Also:
AdjustableQuestionPanel.addQuestionTextArea(String, int, int)

addQuestionFixedTextArea

public void addQuestionFixedTextArea(java.lang.String label,
                                     java.lang.String text,
                                     int rows,
                                     int columns)
See Also:
AdjustableQuestionPanel.addQuestionFixedTextArea(String, String, int, int)

addQuestionCheckbox

public void addQuestionCheckbox(java.lang.String label)
See Also:
AdjustableQuestionPanel.addQuestionCheckbox(String)

getQuestionComponent

public javax.swing.JComponent getQuestionComponent(int questionIndex)
See Also:
AdjustableQuestionPanel.getQuestionComponent(int)