JavaView© v3.95.000

jv.object
Class PsDialog

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Dialog
                  extended byjv.object.PsDialog
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, PsUpdateIf, java.io.Serializable, java.awt.event.WindowListener
Direct Known Subclasses:
PdColor_Dialog, PgExport_Dialog, PjImportModel_Dialog, PjWorkshop_Dialog, PnExplode_Dialog, PsConsole, PsLicense_IP, PwVectorFieldVis_Dialog

public class PsDialog
extends java.awt.Dialog
implements PsUpdateIf, java.awt.event.ActionListener, 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.

When dialog window is cancelled by pressing the cross in one of its corners, then the same operations are performed as if the user had pressed the CANCEL button.

See Also:
PsPanel, Serialized Form

Field Summary
static int BUTTON_CANCEL
           
static int BUTTON_CLEAR
           
static int BUTTON_CLOSE
           
static int BUTTON_HIDE
           
static int BUTTON_LOAD
           
static int BUTTON_OK
           
static int BUTTON_RESET
           
static int BUTTON_SAVE
           
 
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)
          Create an initially invisible new dialog without title and modal status.
PsDialog(java.awt.Frame frame, java.lang.String name, boolean modal)
          Create an initially invisible new dialog with given title and modal status.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Method forwards action events issued by buttons.
 void addActionListener(java.awt.event.ActionListener listener)
          Action events are sent when a user clicks on Ok or Cancel button, doubleclicks on a model in the model dialog or presses in the textfield of the small info panel.
 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()
          This initialization method simply set the font of this dialog.
 boolean instanceOf(java.lang.String aClassName)
          Deprecated. use "if (getClass() == PsObject.class)" instead
 void removeActionListener(java.awt.event.ActionListener listener)
          Removes (one occurrence of) a listener from internal list.
 void reset()
          Method should be overriden by subclasses, maybe to reset themself.
 java.awt.Label setHeader(java.lang.String header)
          Set string of panel header and return label m_lHeader.
 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)
          Method does nothing.
 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, isUndecorated, setModal, setResizable, setTitle, setUndecorated, show
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jv.object.PsUpdateIf
getName
 

Field Detail

BUTTON_CANCEL

public static final int BUTTON_CANCEL
See Also:
Constant Field Values

BUTTON_HIDE

public static final int BUTTON_HIDE
See Also:
Constant Field Values

BUTTON_OK

public static final int BUTTON_OK
See Also:
Constant Field Values

BUTTON_RESET

public static final int BUTTON_RESET
See Also:
Constant Field Values

BUTTON_CLOSE

public static final int BUTTON_CLOSE
See Also:
Constant Field Values

BUTTON_SAVE

public static final int BUTTON_SAVE
See Also:
Constant Field Values

BUTTON_CLEAR

public static final int BUTTON_CLEAR
See Also:
Constant Field Values

BUTTON_LOAD

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

PsDialog

public PsDialog(java.awt.Frame frame,
                java.lang.String name,
                boolean modal)
Create an initially invisible new dialog with given title and modal status. Arguments are passed in the same order to java.awt.Dialog.

Initial layout manager is jv.object.PsStackLayout.

Parameters:
frame - parent frame is owner of this dialog
name - title of this dialog
modal - if true, dialog blocks input to the parent window when shown
See Also:
PsDialog(Frame, boolean)

PsDialog

public PsDialog(java.awt.Frame frame,
                boolean modal)
Create an initially invisible new dialog without title and modal status. Arguments are passed in the same order to java.awt.Dialog.

Initial layout manager is jv.object.PsStackLayout.

Parameters:
frame - parent frame is owner of this dialog
modal - if true, dialog blocks input to the parent window when shown
See Also:
PsDialog(Frame, String, boolean)
Method Detail

init

public void init()
This initialization method simply set the font of this dialog.


getBottomButtons

public java.awt.Panel getBottomButtons(int flag)
Convenient way to get a panel with standard buttons. The return panel with buttons is not yet added to this dialog. 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(pButtons, BorderLayout.SOUTH);
 
If a modal dialog returns, the dialog can be asked about the user action:
 if (dialog.getUserAction() == PsDialog.BUTTON_CANCEL) {
    ...
 }
 

Parameters:
flag - one of the static buttons identifiers like PsDebug.BUTTON_OK.
Returns:
panel with buttons to be added to this dialog.

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'.

The current implementation checks the string only against the classname without the prefixed package names. This may change in future implementations of this method.

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
Parameters:
object - will receive events which this does not handle
See Also:
getFather(), update(Object)

update

public boolean update(java.lang.Object event)
Update the class whenever a child has changed. Method is usually invoked from a child.

Specified by:
update in interface PsUpdateIf
Parameters:
event - carries a lot of information
Returns:
true if event has been handled, otherwise false
See Also:
getFather(), setParent(PsUpdateIf)

reset

public void reset()
Method should be overriden by subclasses, maybe to reset themself. This method does nothing here but allows to reset the dialog from a script.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Method forwards action events issued by buttons. Method first calls setUserAction with the appropriate button identifyer and then calls dispose(), hide(), or reset() methods of this dialog.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

getUserAction

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


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)
Method does nothing.

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

addActionListener

public void addActionListener(java.awt.event.ActionListener listener)
Action events are sent when a user clicks on Ok or Cancel button, doubleclicks on a model in the model dialog or presses in the textfield of the small info panel. The event is sent after the model is loaded. You can check the type of the action via getUserAction().

Listeners will receive an ActionEvent whose keyId is one of the possibilities of PsDialog.BUTTON_{OK, CANCEL, ...}.


removeActionListener

public void removeActionListener(java.awt.event.ActionListener listener)
Removes (one occurrence of) a listener from internal list. Registered listeners will be effected by fireAction(ActionEvent).


JavaView© v3.95.000

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