org.salespointframework.desktop.formsheets
Class MessageForm

java.lang.Object
  extended by org.salespointframework.desktop.formsheets.MessageForm

public class MessageForm
extends java.lang.Object

The MessageForm class displays confirmation, information, ... dialogs like the JOptionPane in SalesPoint style and uses the PreferenceStorage to save decisions made by the user, if selected. MessageForm supports: Types: Informations, Questions, Warnings and Errors as type Button configurations: Ok, Yes/No, Ok/Abort, Yes/No/Abort

Since:
4.0
Author:
Thomas Kissinger

Nested Class Summary
static class MessageForm.MessageFormIcon
          Icons available for MessageForm
static class MessageForm.MessageFormResult
          Possible results of show()
static class MessageForm.MessageFormSheet
          FormSheet for MessageForm
static class MessageForm.MessageFormSheetContentCreator
          FormSheetContentCreator for MessageForm
static class MessageForm.MessageFormType
          This enumeration contains the possible types for MessageForm
 
Field Summary
private static java.lang.String BUTTON_LABEL_ABORT
          Text on Abort button
private static java.lang.String BUTTON_LABEL_NO
          text on No Button
private static java.lang.String BUTTON_LABEL_OK
          Text on Ok button
private static java.lang.String BUTTON_LABEL_YES
          Text on Yes button
private  java.lang.String caption
          Dialog caption
private  MessageForm.MessageFormIcon icon
          Icon to display
private  java.awt.Window owner
          JFrame that owns the dialog
private  java.lang.String preferenceKey
          Key in which user decision should be stored
private static java.lang.String savePreferenceLabel
          Label near the "remember" checkbox
private  java.lang.String text
          text to display
private  MessageForm.MessageFormType type
          Type of MessageForm
 
Constructor Summary
MessageForm(java.awt.Window owner, java.lang.String caption, java.lang.String text, MessageForm.MessageFormType type, MessageForm.MessageFormIcon icon, java.lang.String preferenceKey)
          Compose a MessageForm
 
Method Summary
private  java.awt.Rectangle calculateDefaultBounds()
          Calculates the default dialog size an position
static javax.swing.Icon getIcon(MessageForm.MessageFormIcon icon)
           
static java.lang.String getSavePreferenceLabel()
          Get the Label text near the remember checkbox
static void setAbortButtonLabel(java.lang.String text)
          Replace the default abort button text
static void setNoButtonLabel(java.lang.String text)
          Replace the default No button text
static void setOkButtonLabel(java.lang.String text)
          Replace the default no button text
static void setSavePreferenceLabel(java.lang.String text)
          Replace default text near the remember checkbox
static void setYesButtonLabel(java.lang.String text)
          Replace the default yes button text
 MessageForm.MessageFormResult show()
          Blocking call to display the dialog and await users decision.
 void showParallel()
          Non Blocking call
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

owner

private java.awt.Window owner
JFrame that owns the dialog


text

private java.lang.String text
text to display


caption

private java.lang.String caption
Dialog caption


type

private MessageForm.MessageFormType type
Type of MessageForm


icon

private MessageForm.MessageFormIcon icon
Icon to display


preferenceKey

private java.lang.String preferenceKey
Key in which user decision should be stored


savePreferenceLabel

private static java.lang.String savePreferenceLabel
Label near the "remember" checkbox


BUTTON_LABEL_OK

private static java.lang.String BUTTON_LABEL_OK
Text on Ok button


BUTTON_LABEL_YES

private static java.lang.String BUTTON_LABEL_YES
Text on Yes button


BUTTON_LABEL_NO

private static java.lang.String BUTTON_LABEL_NO
text on No Button


BUTTON_LABEL_ABORT

private static java.lang.String BUTTON_LABEL_ABORT
Text on Abort button

Constructor Detail

MessageForm

public MessageForm(java.awt.Window owner,
                   java.lang.String caption,
                   java.lang.String text,
                   MessageForm.MessageFormType type,
                   MessageForm.MessageFormIcon icon,
                   java.lang.String preferenceKey)
Compose a MessageForm

Parameters:
owner - the owning JFrame of the dialog
caption - of the dialog
text - to display in the dialog
type - of dialog
icon - to display on the left side of the text
preferenceKey - where the user decision should be stored. null, if decision should never be saved
Method Detail

setSavePreferenceLabel

public static void setSavePreferenceLabel(java.lang.String text)
Replace default text near the remember checkbox

Parameters:
text -

setAbortButtonLabel

public static void setAbortButtonLabel(java.lang.String text)
Replace the default abort button text

Parameters:
text -

setNoButtonLabel

public static void setNoButtonLabel(java.lang.String text)
Replace the default No button text

Parameters:
text -

setYesButtonLabel

public static void setYesButtonLabel(java.lang.String text)
Replace the default yes button text

Parameters:
text -

setOkButtonLabel

public static void setOkButtonLabel(java.lang.String text)
Replace the default no button text

Parameters:
text -

getSavePreferenceLabel

public static java.lang.String getSavePreferenceLabel()
Get the Label text near the remember checkbox

Returns:

getIcon

public static javax.swing.Icon getIcon(MessageForm.MessageFormIcon icon)

calculateDefaultBounds

private java.awt.Rectangle calculateDefaultBounds()
Calculates the default dialog size an position

Returns:

showParallel

public void showParallel()
Non Blocking call


show

public MessageForm.MessageFormResult show()
Blocking call to display the dialog and await users decision. Dialog will not become visible, if a valid result was found in PreferenceStorage for the key

Returns: