JavaView® v2.00.008

jv.object
Class PsDialog

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Dialog
                          |
                          +--jv.object.PsDialog
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.event.ItemListener, java.awt.MenuContainer, PsUpdateIf, java.io.Serializable, java.awt.event.WindowListener
Direct Known Subclasses:
PdColor_Dialog, PgExport_Dialog, PjEvolve_Dialog, PjImportModel_Dialog, PnCellOperator_Dialog, PnExplode_Dialog, PnMinesweeper_Dialog, PsConsole, PsJavaView_IP, PsModelInfo_IP, PuDouble_Config, PuInteger_Config, PwCleanMesh_Dialog, PwClip_Dialog, PwGeodesic_Dialog, PwHodge_Dialog, PwLIC_Dialog, PwModel_Dialog, PwSimplify_Dialog, PwVectorField_Dialog

public class PsDialog
extends java.awt.Dialog
implements PsUpdateIf, java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.event.WindowListener

Basic class for dialogs extending java.awt.Dialog by some minor features. E.g. dialog is destroyed when it receives a WINDOW.DESTROY event, and it has an easy mechanism to insert standard buttons at bottom part of dialog. The actionPerformed() method supplies default event handling which is usually sufficient.

Version:
01.11.00, 1.60 revised (kp) New button type BUTTON_SAVE added.
26.09.00, 1.50 revised (kp) Methods addPanel() and addBottomButtons() removed.
20.04.00, 1.40 revised (kp) Viewer removed as key listener.
03.10.99, 1.30 revised (kp) Implemented WindowListener instead of separate windowAdapter.
07.08.99, 1.20 revised (kp) Conversion to AWT 1.1
12.06.99, 1.10 revised (kp) Added hide button.
00.00.98, 1.00 created (kp)
Author:
Konrad Polthier
See Also:
PsPanel, Serialized Form

Inner classes inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog
 
Inner classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
static int BUTTON_CANCEL
           
static int BUTTON_CLOSE
           
static int BUTTON_HIDE
           
static int BUTTON_OK
           
static int BUTTON_RESET
           
static int BUTTON_SAVE
           
protected  int m_action
          Index of button which was pressed by user.
protected  java.awt.Button m_bCancel
          Button to reset dialog and quit.
protected  java.awt.Button m_bClose
          Button to close and dispose dialog.
protected  java.awt.Button m_bHide
          Button to hide and dispose panel.
protected  java.awt.Button m_bOk
          Button to accept selection.
protected  java.awt.Button m_bReset
          Button to reset dialog.
protected  java.awt.Button m_bSave
          Button to save and dispose dialog.
protected  java.awt.Label m_lHeader
          Header label of dialog.
protected  PsUpdateIf m_parent
          Sends update events to this instance.
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PsDialog(java.awt.Frame frame, boolean modal)
           
PsDialog(java.awt.Frame frame, java.lang.String name, boolean modal)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
           
 java.awt.Panel getBottomButtons(int flag)
          Convenient way to get a panel with standard buttons.
 PsUpdateIf getFather()
          Return parent of this dialog.
 int getUserAction()
          Get index of standard button pressed by user.
 void init()
           
 boolean instanceOf(java.lang.String aClassName)
          Deprecated. use "if (getClass() == PsObject.class)" instead
 void itemStateChanged(java.awt.event.ItemEvent event)
          Method does nothing.
 void reset()
          Inform parent to allow him to reset its variables before dialog gets destroyed.
 java.awt.Label setHeader(java.lang.String header)
          Set string of panel header and return label m_lHeader.
 void setLocation(int x, int y)
          Set location of dialog but correct of upper left corner if outside screen.
 void setParent(PsUpdateIf object)
          Set parent of this dialog.
 boolean update(java.lang.Object event)
          Update the class whenever a child has changed.
 void windowActivated(java.awt.event.WindowEvent event)
          Method does nothing.
 void windowClosed(java.awt.event.WindowEvent event)
          Invoke m_parent.update(this) and set action to BUTTON_CLOSE.
 void windowClosing(java.awt.event.WindowEvent event)
          Dispose window if user clicks on 'delete'-cross of title bar.
 void windowDeactivated(java.awt.event.WindowEvent event)
          Method does nothing.
 void windowDeiconified(java.awt.event.WindowEvent event)
          Method does nothing.
 void windowIconified(java.awt.event.WindowEvent event)
          Method does nothing.
 void windowOpened(java.awt.event.WindowEvent event)
          Method does nothing.
 
Methods inherited from class java.awt.Dialog
addNotify, dispose, getAccessibleContext, getTitle, hide, isModal, isResizable, paramString, setModal, setResizable, setTitle, show
 
Methods inherited from class java.awt.Window
addWindowListener, applyResourceBundle, applyResourceBundle, finalize, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, isShowing, pack, postEvent, processEvent, processWindowEvent, removeWindowListener, setCursor, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jv.object.PsUpdateIf
getName
 

Field Detail

m_parent

protected PsUpdateIf m_parent
Sends update events to this instance.
See Also:
PsObject.update(Object), PsPanel.update(Object)

BUTTON_CANCEL

public static final int BUTTON_CANCEL

BUTTON_HIDE

public static final int BUTTON_HIDE

BUTTON_OK

public static final int BUTTON_OK

BUTTON_RESET

public static final int BUTTON_RESET

BUTTON_CLOSE

public static final int BUTTON_CLOSE

BUTTON_SAVE

public static final int BUTTON_SAVE

m_action

protected int m_action
Index of button which was pressed by user.

m_bCancel

protected java.awt.Button m_bCancel
Button to reset dialog and quit.

m_bHide

protected java.awt.Button m_bHide
Button to hide and dispose panel.

m_bOk

protected java.awt.Button m_bOk
Button to accept selection.

m_bReset

protected java.awt.Button m_bReset
Button to reset dialog.

m_bClose

protected java.awt.Button m_bClose
Button to close and dispose dialog.

m_bSave

protected java.awt.Button m_bSave
Button to save and dispose dialog.

m_lHeader

protected java.awt.Label m_lHeader
Header label of dialog.
Constructor Detail

PsDialog

public PsDialog(java.awt.Frame frame,
                java.lang.String name,
                boolean modal)

PsDialog

public PsDialog(java.awt.Frame frame,
                boolean modal)
Method Detail

init

public void init()

getBottomButtons

public java.awt.Panel getBottomButtons(int flag)
Convenient way to get a panel with standard buttons. The class PsDialog manages ActionEvents issued by the buttons. Overwrite actionPerformed() to perform your own action.

Usage:

 Panel pButtons = dialog.getBottomButtons(PsDialog.BUTTON_CANCEL | PsDialog.BUTTON_OK);
 dialog.add("South", pButtons);
 
If a modal dialog returns, the dialog can be asked about the user action:
 if (dialog.getUserAction() == PsDialog.BUTTON_CANCEL) {
    ...
 }
 

setHeader

public java.awt.Label setHeader(java.lang.String header)
Set string of panel header and return label m_lHeader. Method does not add the header to the panel.

instanceOf

public final boolean instanceOf(java.lang.String aClassName)
Deprecated. use "if (getClass() == PsObject.class)" instead

Return true iff string is exact classname of current instance. Even if string denotes a super class method returns false. This method is different from Java operator instanceof which is true even if current instance is subclass of class 'aClassName'.
Parameters:
aClassName - name of class without package identifiers
Returns:
true if current object is exact instance of class

getFather

public PsUpdateIf getFather()
Return parent of this dialog.
Specified by:
getFather in interface PsUpdateIf
Returns:
parent of this dialog
See Also:
setParent(PsUpdateIf), update(Object)

setParent

public void setParent(PsUpdateIf object)
Set parent of this dialog. Should be overwritten by subclasses to initialize according to the data of the parent object. Subclasses should call super.setParent(object) as one of the first statements.
Specified by:
setParent in interface PsUpdateIf
See Also:
Component.getParent(), update(Object)

update

public boolean update(java.lang.Object event)
Update the class whenever a child has changed. Method is usually invoked from the children.
Specified by:
update in interface PsUpdateIf
See Also:
Component.getParent(), setParent(PsUpdateIf)

reset

public void reset()
Inform parent to allow him to reset its variables before dialog gets destroyed. Method should be overriden by subclasses, probably to reset parent.

actionPerformed

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

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent event)
Method does nothing.
Specified by:
itemStateChanged in interface java.awt.event.ItemListener

getUserAction

public int getUserAction()
Get index of standard button pressed by user. Possible values are BUTTON_OK, BUTTON_CANCEL etc.
See Also:
PsDialog

setLocation

public void setLocation(int x,
                        int y)
Set location of dialog but correct of upper left corner if outside screen.
Overrides:
setLocation in class java.awt.Component

windowOpened

public void windowOpened(java.awt.event.WindowEvent event)
Method does nothing.
Specified by:
windowOpened in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent event)
Invoke m_parent.update(this) and set action to BUTTON_CLOSE.
Specified by:
windowClosed in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent event)
Method does nothing.
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent event)
Method does nothing.
Specified by:
windowIconified in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent event)
Method does nothing.
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

windowActivated

public void windowActivated(java.awt.event.WindowEvent event)
Method does nothing.
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowClosing

public void windowClosing(java.awt.event.WindowEvent event)
Dispose window if user clicks on 'delete'-cross of title bar. Currently, method just calls dispose().
Specified by:
windowClosing in interface java.awt.event.WindowListener

JavaView® v2.00.008

The software JavaView® is copyright protected. All Rights Reserved.