Package adams.gui.goe

Class GenericObjectEditorDialog

    • Field Detail

      • CANCEL_OPTION

        public static final int CANCEL_OPTION
        constant for dialog cancellation.
        See Also:
        Constant Field Values
      • APPROVE_OPTION

        public static final int APPROVE_OPTION
        constant for dialog approval.
        See Also:
        Constant Field Values
      • m_Current

        protected Object m_Current
        the current object.
      • m_Result

        protected int m_Result
        whether the dialog was cancelled or ok'ed.
    • Constructor Detail

      • GenericObjectEditorDialog

        public GenericObjectEditorDialog​(Dialog owner)
        Creates a modeless dialog without a title with the specified Dialog as its owner.
        Parameters:
        owner - the owning dialog
      • GenericObjectEditorDialog

        public GenericObjectEditorDialog​(Dialog owner,
                                         Dialog.ModalityType modality)
        Creates a dialog with the specified owner Dialog and modality.
        Parameters:
        owner - the owning dialog
        modality - the type of modality
      • GenericObjectEditorDialog

        public GenericObjectEditorDialog​(Dialog owner,
                                         String title)
        Creates a modeless dialog with the specified title and with the specified owner dialog.
        Parameters:
        owner - the owning dialog
        title - the title of the dialog
      • GenericObjectEditorDialog

        public GenericObjectEditorDialog​(Dialog owner,
                                         String title,
                                         Dialog.ModalityType modality)
        Creates a dialog with the specified title, modality and the specified owner Dialog.
        Parameters:
        owner - the owning dialog
        title - the title of the dialog
        modality - the type of modality
      • GenericObjectEditorDialog

        public GenericObjectEditorDialog​(Frame owner)
        Creates a modeless dialog without a title with the specified Frame as its owner.
        Parameters:
        owner - the owning frame
      • GenericObjectEditorDialog

        public GenericObjectEditorDialog​(Frame owner,
                                         boolean modal)
        Creates a dialog with the specified owner Frame, modality and an empty title.
        Parameters:
        owner - the owning frame
        modal - whether the dialog is modal or not
      • GenericObjectEditorDialog

        public GenericObjectEditorDialog​(Frame owner,
                                         String title)
        Creates a modeless dialog with the specified title and with the specified owner frame.
        Parameters:
        owner - the owning frame
        title - the title of the dialog
      • GenericObjectEditorDialog

        public GenericObjectEditorDialog​(Frame owner,
                                         String title,
                                         boolean modal)
        Creates a dialog with the specified owner Frame, modality and title.
        Parameters:
        owner - the owning frame
        title - the title of the dialog
        modal - whether the dialog is modal or not
    • Method Detail

      • initialize

        protected void initialize()
        For initializing members.
        Overrides:
        initialize in class BaseDialog
      • initGUI

        protected void initGUI()
        For initializing the GUI.
        Overrides:
        initGUI in class BaseDialog
      • setEditor

        public void setEditor​(PropertyEditor value)
        Sets the editor to use.
        Parameters:
        value - the editor to use
      • fixSize

        protected void fixSize()
        Ensures that the dialog doesn't get too big.
      • getEditor

        public PropertyEditor getEditor()
        Returns the underlying editor.
        Returns:
        the editor in use
      • isGOEEditor

        public boolean isGOEEditor()
        Returns whether the underlying editor is GenericObjectEditor.
        Returns:
        true if editor is a GenericObjectEditor one
      • getGOEEditor

        public GenericObjectEditor getGOEEditor()
        Returns the underlying GOE editor.
        Returns:
        the GOE editor in use, or null if other editor used
      • beforeShow

        protected void beforeShow()
        Hook method just before the dialog is made visible.
        Overrides:
        beforeShow in class BaseDialog
      • setCurrent

        public void setCurrent​(Object value)
        Sets the current object.
        Parameters:
        value - the current object, use null for default object
      • getCurrent

        public Object getCurrent()
        Returns the current object.
        Returns:
        the current object
      • setProposedClasses

        public void setProposedClasses​(Object[] value)
        Sets the proposed classes based on the provided objects (in case the editor is a GenericObjectEditor).
        Parameters:
        value - the proposed objects
        See Also:
        setProposedClasses(Class[])
      • setProposedClasses

        public void setProposedClasses​(Class[] value)
        Sets the proposed classes (in case the editor is a GenericObjectEditor). This call needs to happen before calling setValue(Object).
        Parameters:
        value - the proposed classes
      • getProposedClasses

        public Class[] getProposedClasses()
        Returns the proposed classes (in case the editor is a GenericObjectEditor). This call needs to happen before calling setValue(Object).
        Returns:
        the proposed classes
      • getResult

        public int getResult()
        Returns whether the dialog got cancelled or approved.
        Returns:
        the result
        See Also:
        APPROVE_OPTION, CANCEL_OPTION
      • getResultType

        public int getResultType()
        Returns whether the dialog got cancelled or approved.
        Returns:
        the result
        See Also:
        APPROVE_OPTION, CANCEL_OPTION
      • actionPerformed

        public void actionPerformed​(ActionEvent e)
        Gets called when the one of the buttons in the GOE panel gets pressed.
        Specified by:
        actionPerformed in interface ActionListener
        Parameters:
        e - the event
      • createDialog

        public static GenericObjectEditorDialog createDialog​(Container parent)
        Creates a modal dialog for the parent.
        Parameters:
        parent - the parent to make the dialog modal
        Returns:
        the dialog
      • createDialog

        public static GenericObjectEditorDialog createDialog​(Container parent,
                                                             PropertyEditor editor)
        Creates a modal dialog for the parent with the provided editor.
        Parameters:
        parent - the parent to make the dialog modal
        editor - the editor to use
        Returns:
        the dialog
      • createDialog

        public static GenericObjectEditorDialog createDialog​(Container parent,
                                                             PropertyEditor editor,
                                                             Object value)
        Creates a modal dialog for the parent with the provided editor and initial value.
        Parameters:
        parent - the parent to make the dialog modal
        editor - the editor to use, ignored if null
        value - the value to use, ignored if null
        Returns:
        the dialog
      • setUndo

        public void setUndo​(Undo value)
        Sets the undo manager to use, can be null if no undo-support wanted.
        Specified by:
        setUndo in interface UndoHandler
        Parameters:
        value - the undo manager to use
      • getUndo

        public Undo getUndo()
        Returns the current undo manager, can be null.
        Specified by:
        getUndo in interface UndoHandler
        Returns:
        the undo manager, if any
      • isUndoSupported

        public boolean isUndoSupported()
        Returns whether an Undo manager is currently available.
        Specified by:
        isUndoSupported in interface UndoHandler
        Returns:
        true if an undo manager is set
      • main

        public static void main​(String[] args)
        For testing only.
        Parameters:
        args - ignored