Documentation of 'jv.object.PsDialog' Java class
PsDialog ("JavaView Reference Manual")
"JavaView? v5.03.003"
jv.object

Class 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
    Author:
    Konrad Polthier
    Version:
    15.11.12, 3.10 revised (kp) Button Apply added.
    01.10.06, 3.00 revised (kp) Handle ESC key and cancel dialog.
    06.02.05, 2.30 revised (kp) Flag BUTTON_CANCEL_DISABLED removed since handled elsewhere.
    23.07.03, 2.20 revised (kp) No longer implements ItemListener interface.
    06.03.03, 2.10 revised (kp) New optional button clear added.
    09.11.02, 2.00 revised (kp) ActionSupport implemented.
    03.11.02, 1.80 revised (kp) When window is cancelled then perform same operations as with CANCEL button.
    22.03.02, 1.70 revised (ur) Internationalization.
    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)
    • 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

      All Methods Instance Methods Concrete Methods Deprecated 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 <return> 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 setLocation(int x, int y)
      Overwrites superclass method, better have an own method setLocationDPI() to avoid multiple invocations of method.
      void setParent(PsUpdateIf object)
      Set parent of this dialog.
      void setSize(int w, int h)
      Overwrites superclass method, better have an own method setSizeDPI() to avoid multiple invocations of method.
      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, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, 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
    • 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.
      • setLocation

        public void setLocation(int x,
                                int y)
        Overwrites superclass method, better have an own method setLocationDPI() to avoid multiple invocations of method.
        Overrides:
        setLocation in class java.awt.Window
        Since:
        JavaView 4.65.001
        Version:
        29.09.16, 1.00 created (kp).
        HACK:
        (kp, 29.09.16) Overwrites superclass method to provide scaling for HDPI.
      • setSize

        public void setSize(int w,
                            int h)
        Overwrites superclass method, better have an own method setSizeDPI() to avoid multiple invocations of method.
        Overrides:
        setSize in class java.awt.Window
        Since:
        JavaView 4.65.001
        Version:
        29.09.16, 1.00 created (kp).
        ToDo:
        (kp, 29.09.16) Overwrites superclass method to provide scaling for HDPI.
      • 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)
        Version:
        25.11.06, 1.00 created (kp) Copied from PsPanel.
      • 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
        Version:
        25.11.06, 1.00 created (kp) Copied from PsPanel.
      • 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
      • 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.
        Version:
        23.07.03, 1.10 revised (kp) No longer update parent.
      • 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
        Version:
        03.11.02, 1.20 revised (kp) When window is cancelled then perform same operations as with CANCEL button.
        04.09.00, 1.10 revised (kp) Invocation of reset() deactivated since PuDouble_Config sets all values to default.
      • 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 <return> 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
"JavaView? v5.03.003"

"

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

You see the box below because you did not login.