com.jaxfront.swing.ui.tools
Class Dialog

java.lang.Object
  extended by com.jaxfront.swing.ui.tools.Dialog
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.ContainerListener, java.awt.event.KeyListener, java.util.EventListener

public class Dialog
extends java.lang.Object
implements java.awt.event.ActionListener, java.awt.event.ContainerListener, java.awt.event.KeyListener

This class represents a default JAXFront dialog that can be used in various contexts.

Version:
1.60

Field Summary
static int DEFAULT_OK_BUTTON_SEQUENCE
           
 
Constructor Summary
Dialog(java.awt.Component root, java.awt.Component content, Type rootType)
          Default constructor.
Dialog(java.awt.Component root, java.awt.Component content, Type rootType, int okButtonSequence)
          Default constructor.
Dialog(java.awt.Component root, Type rootType)
          Default constructor.
Dialog(java.awt.Component root, Type rootType, int okButtonSequence)
          Default constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 javax.swing.JDialog build()
          Builds the dialog.
 void componentAdded(java.awt.event.ContainerEvent e)
           
 void componentRemoved(java.awt.event.ContainerEvent e)
           
 void computeDialogBounds(java.awt.Component containerComponent)
          Computes the bounds for the dialog (x/y-Position, height/width).
static java.awt.Rectangle computeDialogBounds(java.awt.Component window, java.awt.Component dialog)
           
 void doLayout()
          Do the layout.
static java.lang.String getCANCELButtonName()
           
 java.awt.Container getContentPane()
           
 javax.swing.JDialog getDialogComponent()
           
 int getHeight()
          Returns the height of the dialog.
static java.lang.String getOKButtonName()
           
 int getWidth()
          Returns the width of the dialog.
 boolean isCanceled()
           
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 void release()
          Releases cache and initializes all variables.
 void repaint()
          Do the layout.
 void setBackground(java.awt.Color c)
          Sets a background color for the dialog.
 void setContent(java.awt.Component content)
          Sets the content for the dialog (Component)
 void setDialogListener(java.awt.event.ActionListener dialogListener)
          Sets a dialogListener to the buttons.
 void setForeground(java.awt.Color c)
          Sets a foreground color for the dialog.
 void setLocation(int x, int y)
          Sets the location of the dialog.
 void setLocation(java.awt.Point location)
           
 void setModal(boolean b)
          Sets the dialog modal or not.
 void setSize(java.awt.Dimension d)
          Sets the size of the dialog.
 void setTitle(java.lang.String title)
          Sets a title for the dialog.
 void setUndecorated(boolean undecorated)
          Removes the decoration of the dialog if true.
 void setVisible(boolean visible)
          Sets the visibility of the dialog.
static int showComponentDialog(java.awt.Component parent, java.awt.Component component, java.lang.String title)
           
static int showComponentDialog(java.awt.Component component, java.lang.String title)
           
static int showConfirmDialog(java.awt.Component parent, java.lang.String message)
           
static int showConfirmDialog(java.awt.Component parent, java.lang.String title, java.lang.String message)
           
static int showConfirmDialog(java.lang.String message)
           
static void showErrorDialog(java.awt.Component parent, java.awt.Component content, java.lang.String title)
           
static void showErrorDialog(java.awt.Component parent, java.lang.String message)
           
static void showErrorDialog(java.awt.Component parent, java.lang.String message, java.lang.String title)
           
static void showErrorDialog(java.awt.Component parent, java.lang.String message, java.lang.Throwable t, java.lang.String title)
           
static void showErrorDialog(java.lang.String message)
           
static void showInformationDialog(java.awt.Component parent, java.lang.String message)
           
static void showInformationDialog(java.awt.Component parent, java.lang.String title, java.lang.String message)
           
static void showInformationDialog(java.lang.String message)
           
static boolean showListDeletionDialog(Type viewType, Type typeToDelete)
           
static void showWarningDialog(java.awt.Component parent, java.lang.String message)
           
static void showWarningDialog(java.awt.Component parent, java.lang.String message, java.lang.String title)
           
static void showWarningDialog(java.lang.String message)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_OK_BUTTON_SEQUENCE

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

Dialog

public Dialog(java.awt.Component root,
              Type rootType)
Default constructor.

Parameters:
root - a root component (container) that should hold this dialog
rootType - a JAXFront type

Dialog

public Dialog(java.awt.Component root,
              Type rootType,
              int okButtonSequence)
Default constructor.

Parameters:
root - a root component (container) that should hold this dialog
rootType - a JAXFront type
okButtonSequence - defines the sequence of the buttons (if 0 -> ok button is on the left, if 1 -> ok button is on the right)

Dialog

public Dialog(java.awt.Component root,
              java.awt.Component content,
              Type rootType)
Default constructor.

Parameters:
root - a root component (container) that should hold this dialog
content - the content for the dialog (Component)
rootType - a JAXFront type

Dialog

public Dialog(java.awt.Component root,
              java.awt.Component content,
              Type rootType,
              int okButtonSequence)
Default constructor.

Parameters:
root - a root component (container) that should hold this dialog
content - the content for the dialog (Component)
rootType - a JAXFront type
okButtonSequence - defines the sequence of the buttons (if 0 -> ok button is on the left, if 1 -> ok button is on the right)
Method Detail

build

public javax.swing.JDialog build()
Builds the dialog.

Returns:
the built dialog

computeDialogBounds

public void computeDialogBounds(java.awt.Component containerComponent)
Computes the bounds for the dialog (x/y-Position, height/width).

Parameters:
containerComponent - the container that holds the dialog

setContent

public void setContent(java.awt.Component content)
Sets the content for the dialog (Component)

Parameters:
content - the content of the dialog (Component)

setUndecorated

public void setUndecorated(boolean undecorated)
Removes the decoration of the dialog if true.

Parameters:
undecorated - true if the decoration of the dialog should be invisible

setSize

public void setSize(java.awt.Dimension d)
Sets the size of the dialog.

Parameters:
d - a dimension

setLocation

public void setLocation(int x,
                        int y)
Sets the location of the dialog.

Parameters:
x - horizontal location on the screen
y - vertical location on the screen

setLocation

public void setLocation(java.awt.Point location)

setVisible

public void setVisible(boolean visible)
Sets the visibility of the dialog.

Parameters:
visible - true, if visible, false otherwise

setTitle

public void setTitle(java.lang.String title)
Sets a title for the dialog.

Parameters:
title - a text

setBackground

public void setBackground(java.awt.Color c)
Sets a background color for the dialog.

Parameters:
c - a color

setForeground

public void setForeground(java.awt.Color c)
Sets a foreground color for the dialog.

Parameters:
c - a color

doLayout

public void doLayout()
Do the layout.


repaint

public void repaint()
Do the layout.


getWidth

public int getWidth()
Returns the width of the dialog.

Returns:
the width of the dialog

getHeight

public int getHeight()
Returns the height of the dialog.

Returns:
the height of the dialog

release

public void release()
Releases cache and initializes all variables.


getOKButtonName

public static java.lang.String getOKButtonName()

getCANCELButtonName

public static java.lang.String getCANCELButtonName()

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener
See Also:
ActionListener.actionPerformed(java.awt.event.ActionEvent)

setModal

public void setModal(boolean b)
Sets the dialog modal or not.

Parameters:
b - true if the dialog should be set modal

setDialogListener

public void setDialogListener(java.awt.event.ActionListener dialogListener)
Sets a dialogListener to the buttons.

Parameters:
dialogListener - a dialogListener

computeDialogBounds

public static java.awt.Rectangle computeDialogBounds(java.awt.Component window,
                                                     java.awt.Component dialog)

componentAdded

public void componentAdded(java.awt.event.ContainerEvent e)
Specified by:
componentAdded in interface java.awt.event.ContainerListener

componentRemoved

public void componentRemoved(java.awt.event.ContainerEvent e)
Specified by:
componentRemoved in interface java.awt.event.ContainerListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in interface java.awt.event.KeyListener

isCanceled

public boolean isCanceled()

getDialogComponent

public javax.swing.JDialog getDialogComponent()

showErrorDialog

public static void showErrorDialog(java.lang.String message)

showInformationDialog

public static void showInformationDialog(java.lang.String message)

showConfirmDialog

public static int showConfirmDialog(java.lang.String message)

showWarningDialog

public static void showWarningDialog(java.lang.String message)

showErrorDialog

public static void showErrorDialog(java.awt.Component parent,
                                   java.lang.String message)

showErrorDialog

public static void showErrorDialog(java.awt.Component parent,
                                   java.lang.String message,
                                   java.lang.String title)

showErrorDialog

public static void showErrorDialog(java.awt.Component parent,
                                   java.lang.String message,
                                   java.lang.Throwable t,
                                   java.lang.String title)

showErrorDialog

public static void showErrorDialog(java.awt.Component parent,
                                   java.awt.Component content,
                                   java.lang.String title)

showInformationDialog

public static void showInformationDialog(java.awt.Component parent,
                                         java.lang.String message)

showInformationDialog

public static void showInformationDialog(java.awt.Component parent,
                                         java.lang.String title,
                                         java.lang.String message)

showComponentDialog

public static int showComponentDialog(java.awt.Component component,
                                      java.lang.String title)

showComponentDialog

public static int showComponentDialog(java.awt.Component parent,
                                      java.awt.Component component,
                                      java.lang.String title)

showConfirmDialog

public static int showConfirmDialog(java.awt.Component parent,
                                    java.lang.String message)

showConfirmDialog

public static int showConfirmDialog(java.awt.Component parent,
                                    java.lang.String title,
                                    java.lang.String message)

showWarningDialog

public static void showWarningDialog(java.awt.Component parent,
                                     java.lang.String message)

showWarningDialog

public static void showWarningDialog(java.awt.Component parent,
                                     java.lang.String message,
                                     java.lang.String title)

showListDeletionDialog

public static boolean showListDeletionDialog(Type viewType,
                                             Type typeToDelete)

getContentPane

public java.awt.Container getContentPane()