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:
    java.awt.event.ActionListener, java.awt.event.ContainerListener, java.awt.event.KeyListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, PsUpdateIf
  Direct Known Subclasses:
    PdColor_Dialog, PgExport_Dialog, PjImportModel_Dialog, PjWorkshop_Dialog, PnExplode_Dialog, PsConsole, PsLicense_IP, PwIntegralLine_Dialog

      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

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

  See Also:
    `PsPanel`, Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.awt.Dialog

      `java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType`

    - ### Nested classes/interfaces inherited from class java.awt.Window

      `java.awt.Window.Type`

    - ### Nested classes/interfaces inherited from class java.awt.Component

      `java.awt.Component.BaselineResizeBehavior`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `BUTTON_APPLY`
    `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.Dialog

      `DEFAULT_MODALITY_TYPE`

    - ### 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

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

  - ### Method Summary

    Methods
    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 in the textfield of the small info panel.
    `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 overridden by subclasses, maybe to reset itself.
    `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.

    - ### Methods inherited from class java.awt.Dialog

      `addNotify, getAccessibleContext, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, setVisible, show, toBack`

    - ### Methods inherited from class java.awt.Window

      `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`

    - ### 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, 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`

    - ### 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, 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`

    - ### 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

    - #### BUTTON_APPLY

          public static final int BUTTON_APPLY

      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.

    - #### getInsets

          public java.awt.Insets getInsets()

      Overwrite `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).
      Overrides:
        `getInsets` in class `java.awt.Container`
      Since:
        JavaView 3.97.032
      See Also:
        `PsPanel.setInsetSize(int)`, `PsPanel.setInsetSizeVertical(int)`, `PsPanel.setBorderType(int)`

    - #### setInsetSize

          public void setInsetSize(int size)

      Set the global inset size. This call resets a previous vertical inset size to the new global inset size.
      Since:
        JavaView 3.97.032

    - #### 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 overridden by subclasses, maybe to reset itself. 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 identifier 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, presses ESC, 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, ...}. For example, workshop dialog use such events to reset the scene when CANCEL or ESC has been pressed.

    - #### 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)`.

    - #### componentAdded

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

      Method is part of container listener interface.

      Specified by:
        `componentAdded` in interface `java.awt.event.ContainerListener`

    - #### componentRemoved

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

      Method is part of container listener interface.

      Specified by:
        `componentRemoved` in interface `java.awt.event.ContainerListener`

    - #### keyPressed

          public 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.
      Specified by:
        `keyPressed` in interface `java.awt.event.KeyListener`

    - #### keyReleased

          public 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.
      Specified by:
        `keyReleased` in interface `java.awt.event.KeyListener`

    - #### keyTyped

          public void keyTyped(java.awt.event.KeyEvent evt)

      Unused method of interface KeyListener.
      Specified by:
        `keyTyped` in interface `java.awt.event.KeyListener`

"

The software JavaView? is copyright protected. All Rights Reserved.
"