public class PsDialog extends java.awt.Dialog implements PsUpdateIf, java.awt.event.ActionListener, java.awt.event.ContainerListener, java.awt.event.KeyListener, java.awt.event.WindowListener
When dialog window is canceled by pressing the cross in one of its corners, then the same operations are performed as if the user had pressed the CANCEL button.
PsPanel
,
Serialized FormModifier and Type | Field and Description |
---|---|
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 |
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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, presses ESC, doubleclicks on
a model in the model dialog or presses
|
void |
componentAdded(java.awt.event.ContainerEvent evt)
This function is called whenever a Component or a Container is added to
another Container belonging to this Dialog.
|
void |
componentRemoved(java.awt.event.ContainerEvent evt)
This function is called whenever a Component or a Container is removed from
another Container belonging to this Dialog.
|
java.awt.Panel |
getBottomButtons(int flag)
Convenient way to get a panel with standard buttons.
|
PsUpdateIf |
getFather()
Return parent of this dialog.
|
java.awt.Insets |
getInsets()
Overwrite
Container.getInsets() to create a border
measured in pixels around this panel. |
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 |
keyPressed(java.awt.event.KeyEvent evt)
This function is called whenever a Component belonging to this Dialog
(or the Dialog itself) gets the KEY_PRESSED event.
|
void |
keyReleased(java.awt.event.KeyEvent evt)
This function is called whenever a Component belonging to this Dialog
(or the Dialog itself) gets the KEY_RELEASED event.
|
void |
keyTyped(java.awt.event.KeyEvent evt)
Unused method of interface KeyListener.
|
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 |
setInsetSize(int size)
Set the global inset size.
|
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.
|
addNotify, getAccessibleContext, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, setVisible, show, toBack
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFront
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, validate
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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, 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, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getName
public static final int BUTTON_CANCEL
public static final int BUTTON_HIDE
public static final int BUTTON_OK
public static final int BUTTON_RESET
public static final int BUTTON_CLOSE
public static final int BUTTON_SAVE
public static final int BUTTON_CLEAR
public static final int BUTTON_LOAD
public PsDialog(java.awt.Frame frame, java.lang.String name, boolean modal)
Initial layout manager is jv.object.PsStackLayout.
frame
- parent frame is owner of this dialogname
- title of this dialogmodal
- if true, dialog blocks input to the parent window when shownPsDialog(Frame, boolean)
public PsDialog(java.awt.Frame frame, boolean modal)
Initial layout manager is jv.object.PsStackLayout.
frame
- parent frame is owner of this dialogmodal
- if true, dialog blocks input to the parent window when shownPsDialog(Frame, String, boolean)
public void init()
public java.awt.Insets getInsets()
Container.getInsets()
to create a border
measured in pixels around this panel. The border is either uniformly determined
by setInsetSize(int) or by, additionally, specifying a vertical inset size
using setInsetSizeVertical(int).getInsets
in class java.awt.Container
PsPanel.setInsetSize(int)
,
PsPanel.setInsetSizeVertical(int)
,
PsPanel.setBorderType(int)
public void setInsetSize(int size)
public java.awt.Panel getBottomButtons(int flag)
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) { ... }
flag
- one of the static buttons identifiers like PsDebug.BUTTON_OK.public java.awt.Label setHeader(java.lang.String header)
m_lHeader
.
Method does not add the header to the panel.public final boolean instanceOf(java.lang.String aClassName)
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.
aClassName
- name of class without package identifierspublic PsUpdateIf getFather()
getFather
in interface PsUpdateIf
setParent(PsUpdateIf)
,
update(Object)
public void setParent(PsUpdateIf object)
setParent
in interface PsUpdateIf
object
- will receive events which this
does not handlegetFather()
,
update(Object)
public boolean update(java.lang.Object event)
update
in interface PsUpdateIf
event
- carries a lot of informationgetFather()
,
setParent(PsUpdateIf)
public void reset()
public void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed
in interface java.awt.event.ActionListener
public int getUserAction()
public void windowOpened(java.awt.event.WindowEvent event)
windowOpened
in interface java.awt.event.WindowListener
public void windowClosed(java.awt.event.WindowEvent event)
windowClosed
in interface java.awt.event.WindowListener
public void windowDeiconified(java.awt.event.WindowEvent event)
windowDeiconified
in interface java.awt.event.WindowListener
public void windowIconified(java.awt.event.WindowEvent event)
windowIconified
in interface java.awt.event.WindowListener
public void windowDeactivated(java.awt.event.WindowEvent event)
windowDeactivated
in interface java.awt.event.WindowListener
public void windowActivated(java.awt.event.WindowEvent event)
windowActivated
in interface java.awt.event.WindowListener
public void windowClosing(java.awt.event.WindowEvent event)
dispose()
.windowClosing
in interface java.awt.event.WindowListener
public void addActionListener(java.awt.event.ActionListener listener)
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, ...}. For example, workshop dialog use such events to reset the scene when CANCEL or ESC has been pressed.
public void removeActionListener(java.awt.event.ActionListener listener)
fireAction(ActionEvent)
.public void componentAdded(java.awt.event.ContainerEvent evt)
Method is part of container listener interface.
componentAdded
in interface java.awt.event.ContainerListener
public void componentRemoved(java.awt.event.ContainerEvent evt)
Method is part of container listener interface.
componentRemoved
in interface java.awt.event.ContainerListener
public void keyPressed(java.awt.event.KeyEvent evt)
keyPressed
in interface java.awt.event.KeyListener
public void keyReleased(java.awt.event.KeyEvent evt)
keyReleased
in interface java.awt.event.KeyListener
public void keyTyped(java.awt.event.KeyEvent evt)
keyTyped
in interface java.awt.event.KeyListener
"