org.wings
Class SOptionPane

java.lang.Object
  extended by org.wings.SComponent
      extended by org.wings.SContainer
          extended by org.wings.SForm
              extended by org.wings.SWindow
                  extended by org.wings.SDialog
                      extended by org.wings.SOptionPane
All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, LowLevelEventListener, Renderable

public class SOptionPane
extends SDialog
implements ActionListener

An immodal dialog component offering several options for selection (like Yes/No, etc.)

Author:
Armin Haaf
See Also:
Serialized Form

Field Summary
static String CANCEL_ACTION
          Action Performed Value if Cancel is choosen
static int CANCEL_OPTION
          Return value if Cancel is choosen
static int DEFAULT_OPTION
          Type meaning look and feel should not supply any options -- only use the options from the JOptionPane.
static int ERROR_MESSAGE
           
protected  SIcon icon
           
protected  SLabel imageLabel
           
static int INFORMATION_MESSAGE
           
protected  Object initialValue
           
protected  Object message
           
protected  int messageType
           
static String NO_ACTION
          Action Performed Value if No is choosen
static int NO_OPTION
          Return value if no is choosen
static String OK_ACTION
          Action Performed Value if Ok is choosen
static int OK_CANCEL_OPTION
          Used for showConfirmDialog.
static int OK_CANCEL_RESET_OPTION
          Used for showConfirmDialog.
static int OK_OPTION
          Return value if Ok is choosen
protected  SContainer optionButtons
          Panel with Option Buttons
protected  SButton optionCancel
          Cancel Button
protected  SButton optionNo
          No Button
protected  SButton optionOK
          OK Button
protected  Object[] options
           
protected  SButton optionYes
          Yes Button
static int PLAIN_MESSAGE
           
static int QUESTION_MESSAGE
           
static int RESET_OPTION
           
protected  Object selected
          The chosen option
static String UNKNOWN_ACTION
          Action Performed Value Unknow
static SIcon WARNING_IMAGE
          Icon for Warning Dialog
static int WARNING_MESSAGE
           
static String YES_ACTION
          Action Performed Value if Yes is Choosen
static int YES_NO_CANCEL_OPTION
          Used for showConfirmDialog.
static int YES_NO_CANCEL_RESET_OPTION
          Used for showConfirmDialog.
static int YES_NO_OPTION
          Used for showConfirmDialog.
static int YES_NO_RESET_OPTION
          Used for showConfirmDialog.
static int YES_OPTION
          Return Value if Yes is choosen
 
Fields inherited from class org.wings.SDialog
CLOSE_ACTION, DEFAULT_ACTION, draggable, modal, title
 
Fields inherited from class org.wings.SWindow
owner, x, y
 
Fields inherited from class org.wings.SForm
actionCommand, ENC_TYPE_MULTIPART_FORM, ENC_TYPE_TEXT_PLAIN, listenerList, URL_ENCODING
 
Fields inherited from class org.wings.SComponent
DONE_RENDERING, dynamicStyles, enabled, propertyChangeSupport, SELECTOR_ALL, START_RENDERING, visible, WHEN_FOCUSED_OR_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_IN_FOCUSED_FRAME
 
Constructor Summary
SOptionPane()
          Default Constructor for SOptionPane Against the Standard Swing Implementation there is no Standard Message
SOptionPane(Object message)
           
SOptionPane(Object message, int messageType)
           
SOptionPane(Object message, int messageType, int optionType)
          Creates an instance of JOptionPane to display a message with the specified message type and options.
SOptionPane(Object message, int messageType, int optionType, SIcon icon)
          Creates an instance of JOptionPane to display a message with the specified message type, options, and icon.
SOptionPane(Object message, int messageType, int optionType, SIcon icon, Object[] options)
          Creates an instance of JOptionPane to display a message with the specified message type, icon, and options.
SOptionPane(Object message, int messageType, int optionType, SIcon icon, Object[] options, Object initialValue)
          Creates an instance of JOptionPane to display a message with the specified message type, icon, and options, with the initially-selected option specified.
 
Method Summary
 void actionPerformed(ActionEvent e)
           
protected  SButton createButton(String label)
          Generic Button creation
protected  void fireActionPerformed(String pActionCommand)
          Fire a ActionEvent at each registered listener.
 Object getInputValue()
           
 int getMessageType()
          Returns the message type.
 Object getValue()
           
protected  void resetOptions()
           
 void setCG(OptionPaneCG cg)
           
 void setMessageType(int newType)
          Sets the option pane's message type.
 void setOptions(Object[] options)
           
 void setOptionType(int newType)
           
static void showConfirmDialog(SComponent parent, Object message, String title)
           
static void showConfirmDialog(SComponent parent, Object message, String title, ActionListener al)
           
static void showConfirmDialog(SComponent parent, Object message, String title, int type)
           
static void showConfirmDialog(SComponent parent, Object message, String title, int type, ActionListener al)
           
static void showConfirmDialog(SComponent parent, Object message, String title, int type, ActionListener al, SLayoutManager layout)
           
 void showInput(SComponent parent, Object message, SComponent inputElement, String title)
           
static void showInputDialog(SComponent parent, Object question, String title, int messageType, SComponent inputElement, ActionListener al)
           
static void showInputDialog(SComponent parent, Object question, String title, SComponent inputElement, ActionListener al)
           
static void showMessageDialog(SComponent parent, Object message)
           
static void showMessageDialog(SComponent parent, Object message, ActionListener al)
           
static void showMessageDialog(SComponent parent, Object message, String title)
           
static void showMessageDialog(SComponent parent, Object message, String title, int messageType)
           
static void showMessageDialog(SComponent parent, Object message, String title, int messageType, ActionListener al)
           
 void showOption(SComponent c, String title, Object message)
           
 void showPlainMessage(SComponent parent, Object message, String title)
           
static void showPlainMessageDialog(SComponent parent, Object message)
           
static void showPlainMessageDialog(SComponent parent, Object message, ActionListener al)
           
static void showPlainMessageDialog(SComponent parent, Object message, String title)
           
static void showPlainMessageDialog(SComponent parent, Object message, String title, ActionListener al)
           
static void showPlainQuestionDialog(SComponent parent, Object question, String title, ActionListener al)
           
 void showQuestion(SComponent parent, Object message, String title)
           
 void showQuestion(SComponent parent, Object question, String title, int type)
           
static void showQuestionDialog(SComponent parent, Object question, String title, ActionListener al)
           
 void showYesNo(SComponent parent, Object question, String title)
           
static void showYesNoDialog(SComponent parent, Object question, String title, ActionListener al)
           
 
Methods inherited from class org.wings.SDialog
getIcon, getTitle, hide, isClosable, isDraggable, isModal, setCG, setClosable, setDraggable, setIcon, setModal, setTitle
 
Methods inherited from class org.wings.SWindow
dispose, getOwner, getX, getY, processLowLevelEvent, setVisible, setX, setY, show
 
Methods inherited from class org.wings.SForm
addActionListener, addArmedComponent, addComponent, clearArmedComponents, fireEvents, fireFinalEvents, fireIntermediateEvents, getAction, getActionCommand, getCG, getDefaultButton, getEncodingType, getRequestURL, isEpochCheckEnabled, isPostMethod, registerFileChooser, removeActionListener, setAction, setActionCommand, setCG, setDefaultButton, setEncodingType, setEpochCheckEnabled, setPostMethod, unregisterFileChooser
 
Methods inherited from class org.wings.SContainer
add, add, add, add, addComponent, addComponent, addComponent, addContainerListener, addNotify, clone, fireContainerEvent, getComponent, getComponentCount, getComponentList, getComponents, getConstraintAt, getConstraintList, getLayout, invite, inviteEachComponent, isShowingChildren, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setCG, setLayout, setParentFrame, updateCG
 
Methods inherited from class org.wings.SComponent
addComponentListener, addDynamicStyle, addEventListener, addParentFrameListener, addPropertyChangeListener, addPropertyChangeListener, addRenderListener, addScriptListener, addStyle, fireComponentChangeEvent, fireKeyEvents, fireRenderEvent, getActionMap, getBackground, getBorder, getClientProperty, getComponentPopupMenu, getDynamicStyle, getDynamicStyles, getFocusTraversalIndex, getFont, getForeground, getHorizontalAlignment, getInputMap, getInputMap, getListenerCount, getListenerList, getListeners, getLowLevelEventId, getName, getParent, getParentFrame, getPreferredSize, getResidesInForm, getScriptListenerList, getScriptListeners, getSession, getShowAsFormComponent, getStyle, getToolTipText, getVerticalAlignment, isDifferent, isEnabled, isFocusOwner, isRecursivelyVisible, isReloadForced, isUpdatePossible, isVisible, paramString, processComponentEvent, processKeyEvents, putClientProperty, reload, reloadIfChange, reloadIfChange, reloadIfChange, reloadIfChange, reloadIfChange, reloadIfChange, reloadIfChange, reloadIfChange, reloadIfChange, removeComponentListener, removeDynamicStyle, removeEventListener, removeParentFrameListener, removePropertyChangeListener, removePropertyChangeListener, removeRenderListener, removeScriptListener, removeStyle, requestFocus, scrollRectToVisible, setActionMap, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributes, setBackground, setBorder, setCG, setComponentPopupMenu, setDynamicStyles, setEnabled, setFocusTraversalIndex, setFont, setForeground, setHorizontalAlignment, setInputMap, setInputMap, setName, setNameRaw, setParent, setPreferredSize, setReloadForced, setShowAsFormComponent, setStyle, setToolTipText, setVerticalAlignment, toString, update, write
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.wings.LowLevelEventListener
fireFinalEvents, fireIntermediateEvents, getLowLevelEventId, getName, isEnabled, isEpochCheckEnabled
 

Field Detail

YES_ACTION

public static final String YES_ACTION
Action Performed Value if Yes is Choosen

See Also:
Constant Field Values

NO_ACTION

public static final String NO_ACTION
Action Performed Value if No is choosen

See Also:
Constant Field Values

OK_ACTION

public static final String OK_ACTION
Action Performed Value if Ok is choosen

See Also:
Constant Field Values

CANCEL_ACTION

public static final String CANCEL_ACTION
Action Performed Value if Cancel is choosen

See Also:
Constant Field Values

UNKNOWN_ACTION

public static final String UNKNOWN_ACTION
Action Performed Value Unknow

See Also:
Constant Field Values

OK_OPTION

public static final int OK_OPTION
Return value if Ok is choosen

See Also:
Constant Field Values

CANCEL_OPTION

public static final int CANCEL_OPTION
Return value if Cancel is choosen

See Also:
Constant Field Values

YES_OPTION

public static final int YES_OPTION
Return Value if Yes is choosen

See Also:
Constant Field Values

NO_OPTION

public static final int NO_OPTION
Return value if no is choosen

See Also:
Constant Field Values

RESET_OPTION

public static final int RESET_OPTION
See Also:
Constant Field Values

DEFAULT_OPTION

public static final int DEFAULT_OPTION
Type meaning look and feel should not supply any options -- only use the options from the JOptionPane.

See Also:
Constant Field Values

OK_CANCEL_OPTION

public static final int OK_CANCEL_OPTION
Used for showConfirmDialog.

See Also:
Constant Field Values

OK_CANCEL_RESET_OPTION

public static final int OK_CANCEL_RESET_OPTION
Used for showConfirmDialog.

See Also:
Constant Field Values

YES_NO_OPTION

public static final int YES_NO_OPTION
Used for showConfirmDialog.

See Also:
Constant Field Values

YES_NO_RESET_OPTION

public static final int YES_NO_RESET_OPTION
Used for showConfirmDialog.

See Also:
Constant Field Values

YES_NO_CANCEL_OPTION

public static final int YES_NO_CANCEL_OPTION
Used for showConfirmDialog.

See Also:
Constant Field Values

YES_NO_CANCEL_RESET_OPTION

public static final int YES_NO_CANCEL_RESET_OPTION
Used for showConfirmDialog.

See Also:
Constant Field Values

ERROR_MESSAGE

public static final int ERROR_MESSAGE
See Also:
Constant Field Values

INFORMATION_MESSAGE

public static final int INFORMATION_MESSAGE
See Also:
Constant Field Values

WARNING_MESSAGE

public static final int WARNING_MESSAGE
See Also:
Constant Field Values

QUESTION_MESSAGE

public static final int QUESTION_MESSAGE
See Also:
Constant Field Values

PLAIN_MESSAGE

public static final int PLAIN_MESSAGE
See Also:
Constant Field Values

optionButtons

protected final SContainer optionButtons
Panel with Option Buttons


optionOK

protected final SButton optionOK
OK Button


optionCancel

protected final SButton optionCancel
Cancel Button


optionYes

protected final SButton optionYes
Yes Button


optionNo

protected final SButton optionNo
No Button


WARNING_IMAGE

public static final SIcon WARNING_IMAGE
Icon for Warning Dialog


imageLabel

protected final SLabel imageLabel

selected

protected Object selected
The chosen option

See Also:
OK_OPTION, YES_OPTION, CANCEL_OPTION, NO_OPTION

icon

protected SIcon icon

message

protected Object message

options

protected Object[] options

initialValue

protected Object initialValue

messageType

protected int messageType
Constructor Detail

SOptionPane

public SOptionPane()
Default Constructor for SOptionPane Against the Standard Swing Implementation there is no Standard Message


SOptionPane

public SOptionPane(Object message)

SOptionPane

public SOptionPane(Object message,
                   int messageType)

SOptionPane

public SOptionPane(Object message,
                   int messageType,
                   int optionType)
Creates an instance of JOptionPane to display a message with the specified message type and options.

Parameters:
message - the Object to display
messageType - the type of message to be displayed: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
optionType - the options to display in the pane: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION OK_CANCEL_OPTION

SOptionPane

public SOptionPane(Object message,
                   int messageType,
                   int optionType,
                   SIcon icon)
Creates an instance of JOptionPane to display a message with the specified message type, options, and icon.

Parameters:
message - the Object to display
messageType - the type of message to be displayed: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
optionType - the options to display in the pane: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION OK_CANCEL_OPTION
icon - the Icon image to display

SOptionPane

public SOptionPane(Object message,
                   int messageType,
                   int optionType,
                   SIcon icon,
                   Object[] options)
Creates an instance of JOptionPane to display a message with the specified message type, icon, and options. None of the options is initially selected.

The options objects should contain either instances of Components, (which are added directly) or Strings (which are wrapped in a JButton). If you provide Components, you must ensure that when the Component is clicked it messages setValue in the created JOptionPane.

Parameters:
message - the Object to display
messageType - the type of message to be displayed: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
optionType - the options to display in the pane: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION OK_CANCEL_OPTION; only meaningful if the options parameter is null
icon - the Icon image to display
options - the choices the user can select

SOptionPane

public SOptionPane(Object message,
                   int messageType,
                   int optionType,
                   SIcon icon,
                   Object[] options,
                   Object initialValue)
Creates an instance of JOptionPane to display a message with the specified message type, icon, and options, with the initially-selected option specified.

Parameters:
message - the Object to display
messageType - the type of message to be displayed: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
optionType - the options to display in the pane: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION OK_CANCEL_OPTION; only meaningful if the options parameter is null
icon - the Icon image to display
options - the choices the user can select
initialValue - the choice that is initially selected
Method Detail

setCG

public void setCG(OptionPaneCG cg)

getValue

public final Object getValue()

getInputValue

public Object getInputValue()

createButton

protected final SButton createButton(String label)
Generic Button creation


actionPerformed

public void actionPerformed(ActionEvent e)
Specified by:
actionPerformed in interface ActionListener

fireActionPerformed

protected void fireActionPerformed(String pActionCommand)
Description copied from class: SForm
Fire a ActionEvent at each registered listener.

Overrides:
fireActionPerformed in class SForm

resetOptions

protected void resetOptions()

setOptions

public void setOptions(Object[] options)

setMessageType

public void setMessageType(int newType)
Sets the option pane's message type. Dependent to the MessageType there wil be displayed a different Message Label

Parameters:
newType - an integer specifying the kind of message to display: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE

description: The option pane's message type.


getMessageType

public int getMessageType()
Returns the message type.

Returns:
an integer specifying the message type
See Also:
setMessageType(int)

setOptionType

public void setOptionType(int newType)

showOption

public void showOption(SComponent c,
                       String title,
                       Object message)

showPlainMessage

public void showPlainMessage(SComponent parent,
                             Object message,
                             String title)

showQuestion

public void showQuestion(SComponent parent,
                         Object message,
                         String title)

showInput

public void showInput(SComponent parent,
                      Object message,
                      SComponent inputElement,
                      String title)

showYesNo

public void showYesNo(SComponent parent,
                      Object question,
                      String title)

showQuestion

public void showQuestion(SComponent parent,
                         Object question,
                         String title,
                         int type)

showMessageDialog

public static void showMessageDialog(SComponent parent,
                                     Object message)

showMessageDialog

public static void showMessageDialog(SComponent parent,
                                     Object message,
                                     String title)

showMessageDialog

public static void showMessageDialog(SComponent parent,
                                     Object message,
                                     ActionListener al)

showMessageDialog

public static void showMessageDialog(SComponent parent,
                                     Object message,
                                     String title,
                                     int messageType)

showMessageDialog

public static void showMessageDialog(SComponent parent,
                                     Object message,
                                     String title,
                                     int messageType,
                                     ActionListener al)

showPlainMessageDialog

public static void showPlainMessageDialog(SComponent parent,
                                          Object message)

showPlainMessageDialog

public static void showPlainMessageDialog(SComponent parent,
                                          Object message,
                                          String title)

showPlainMessageDialog

public static void showPlainMessageDialog(SComponent parent,
                                          Object message,
                                          ActionListener al)

showPlainMessageDialog

public static void showPlainMessageDialog(SComponent parent,
                                          Object message,
                                          String title,
                                          ActionListener al)

showInputDialog

public static void showInputDialog(SComponent parent,
                                   Object question,
                                   String title,
                                   SComponent inputElement,
                                   ActionListener al)

showInputDialog

public static void showInputDialog(SComponent parent,
                                   Object question,
                                   String title,
                                   int messageType,
                                   SComponent inputElement,
                                   ActionListener al)

showQuestionDialog

public static void showQuestionDialog(SComponent parent,
                                      Object question,
                                      String title,
                                      ActionListener al)

showPlainQuestionDialog

public static void showPlainQuestionDialog(SComponent parent,
                                           Object question,
                                           String title,
                                           ActionListener al)

showConfirmDialog

public static void showConfirmDialog(SComponent parent,
                                     Object message,
                                     String title)

showConfirmDialog

public static void showConfirmDialog(SComponent parent,
                                     Object message,
                                     String title,
                                     ActionListener al)

showConfirmDialog

public static void showConfirmDialog(SComponent parent,
                                     Object message,
                                     String title,
                                     int type)

showConfirmDialog

public static void showConfirmDialog(SComponent parent,
                                     Object message,
                                     String title,
                                     int type,
                                     ActionListener al)

showConfirmDialog

public static void showConfirmDialog(SComponent parent,
                                     Object message,
                                     String title,
                                     int type,
                                     ActionListener al,
                                     SLayoutManager layout)

showYesNoDialog

public static void showYesNoDialog(SComponent parent,
                                   Object question,
                                   String title,
                                   ActionListener al)


wingS Swings ;-)