Package adams.gui.goe

Class GenericArrayEditor

    • Field Detail

      • LOGGER

        protected static Logger LOGGER
        for logging.
      • m_Label

        protected JLabel m_Label
        The label for when we can't edit that type.
      • m_ElementList

        protected BaseListWithButtons m_ElementList
        The list component displaying current values.
      • m_ElementClass

        protected Class m_ElementClass
        The class of objects allowed in the array.
      • m_ListModelBackup

        protected DefaultListModel<Object> m_ListModelBackup
        The defaultlistmodel holding the backup of our data.
      • m_ElementEditor

        protected PropertyEditor m_ElementEditor
        The property editor for the class we are editing.
      • m_IsPrimitive

        protected boolean m_IsPrimitive
        whether the objects are wrapped with BaseObject.
      • m_CanSort

        protected boolean m_CanSort
        whether the objects implement comparable.
      • m_ButtonRemove

        protected BaseButton m_ButtonRemove
        Click this to delete the selected array values.
      • m_ButtonRemoveAll

        protected BaseButton m_ButtonRemoveAll
        Click this to delete all the array values.
      • m_ButtonEdit

        protected BaseButton m_ButtonEdit
        Click this to edit the selected array value.
      • m_ButtonUp

        protected BaseButton m_ButtonUp
        Click this to move the selected array value(s) one up.
      • m_ButtonDown

        protected BaseButton m_ButtonDown
        Click this to move the selected array value(s) one down.
      • m_ButtonAdd

        protected BaseButton m_ButtonAdd
        Click to add the current object configuration to the array.
      • m_ButtonAddMultiple

        protected BaseButton m_ButtonAddMultiple
        Click to add multiple objects to the array.
      • m_ButtonCopy

        protected BaseButton m_ButtonCopy
        Click to copy the currently selected object in array into the edit field.
      • m_ButtonOK

        protected BaseButton m_ButtonOK
        Click to OK the dialog.
      • m_ButtonCancel

        protected BaseButton m_ButtonCancel
        Click to cancel the dialog.
      • m_PanelDialogButtons

        protected JPanel m_PanelDialogButtons
        the panel for the buttons.
      • m_WindowAdapter

        protected WindowAdapter m_WindowAdapter
        to catch the event when the user is closing the dialog via the "X".
      • m_Modified

        protected boolean m_Modified
        whether the content got modified.
      • m_OkAlwaysEnabled

        protected boolean m_OkAlwaysEnabled
        whether the OK button is always enabled.
      • m_View

        protected Component m_View
        the view in use.
      • m_ArrayChangeListeners

        protected Set<ChangeListener> m_ArrayChangeListeners
        the change listeners (get notified whenever items get added/removed/updated).
      • m_ModelListener

        protected ListDataListener m_ModelListener
        the listener for model updates.
    • Constructor Detail

      • GenericArrayEditor

        public GenericArrayEditor()
        Sets up the array editor.
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
        initialize in class BasePanel
      • initGUI

        protected void initGUI()
        For initializing the GUI.
        initGUI in class BasePanel
      • close

        protected void close()
        Closes and disposes the window the GOE belongs to, if possible.
      • updateButtons

        protected void updateButtons()
        Sets the correct enabled/disabled state of the buttons.
      • apply

        protected void apply()
        Accepts the array.
      • restore

        protected void restore()
        Restores the values to the original ones.
      • sort

        protected void sort​(boolean ascending)
        Sorts the values.
        ascending - if true, sorting is done ascending, otherwise descending
      • updateEditorType

        protected void updateEditorType​(Object o)
        Updates the type of object being edited, so attempts to find an appropriate propertyeditor.
        o - a value of type 'Object'
      • setValue

        public void setValue​(Object o)
        Sets the current object array.
        Specified by:
        setValue in interface PropertyEditor
        o - an object that must be an array.
      • getValue

        public Object getValue()
        Gets the current object array.
        Specified by:
        getValue in interface PropertyEditor
        the current object array
      • getElementEditor

        public PropertyEditor getElementEditor()
        Returns the element editor in use.
        the editor, null if not available
      • getJavaInitializationString

        public String getJavaInitializationString()
        Supposedly returns an initialization string to create a classifier identical to the current one, including it's state, but this doesn't appear possible given that the initialization string isn't supposed to contain multiple statements.
        Specified by:
        getJavaInitializationString in interface PropertyEditor
        the java source code initialisation string
      • isPaintable

        public boolean isPaintable()
        Returns true to indicate that we can paint a representation of the string array.
        Specified by:
        isPaintable in interface PropertyEditor
        always true
      • paintValue

        public void paintValue​(Graphics gfx,
                               Rectangle box)
        Paints a representation of the current classifier.
        Specified by:
        paintValue in interface PropertyEditor
        gfx - the graphics context to use
        box - the area we are allowed to paint into
      • getAsText

        public String getAsText()
        Returns null as we don't support getting/setting values as text.
        Specified by:
        getAsText in interface PropertyEditor
        always null
      • setAsText

        public void setAsText​(String text)
        Returns null as we don't support getting/setting values as text.
        Specified by:
        setAsText in interface PropertyEditor
        text - the text value
        IllegalArgumentException - as we don't support getting/setting values as text.
      • getTags

        public String[] getTags()
        Returns null as we don't support getting values as tags.
        Specified by:
        getTags in interface PropertyEditor
        always null
      • supportsCustomEditor

        public boolean supportsCustomEditor()
        Returns true because we do support a custom editor.
        Specified by:
        supportsCustomEditor in interface PropertyEditor
        always true
      • addOkListener

        public void addOkListener​(ActionListener a)
        This is used to hook an action listener to the ok button.
        a - The action listener.
      • addCancelListener

        public void addCancelListener​(ActionListener a)
        This is used to hook an action listener to the cancel button.
        a - The action listener.
      • removeOkListener

        public void removeOkListener​(ActionListener a)
        This is used to remove an action listener from the ok button.
        a - The action listener
      • removeCancelListener

        public void removeCancelListener​(ActionListener a)
        This is used to remove an action listener from the cancel button.
        a - The action listener
      • addObject

        public boolean addObject​(Object object)
        Adds the object to the list.
        object - the object to add
        true if successfully added
      • addMultipleObjects

        public boolean addMultipleObjects()
        If the element editor implements MultiSelectionEditor a dialog is popped up to enter multiple objects.
        true if a dialog was popped up and all objects added successfully
      • addMultipleObjects

        public boolean addMultipleObjects​(Object[] objects)
        Adds multiple objects.
        objects - the objects to add
        true if all objects were added successfully
      • removeAllObjects

        public void removeAllObjects()
        Removes all elements.
      • removeSelectedObjects

        protected void removeSelectedObjects()
        Removes all currently selected objects.
      • editSelectedObject

        protected boolean editSelectedObject()
        Edits the selected object.
        true is successfully edited
      • firePropertyChange

        public void firePropertyChange()
        Fires a property change event.
        See Also:
      • setOkAlwaysEnabled

        public void setOkAlwaysEnabled​(boolean value)
        Sets whether the OK button is always enabled, not just when array was modified.
        value - true if to always enable
      • isOkAlwaysEnabled

        public boolean isOkAlwaysEnabled()
        Returns whether the OK button is always enabled, not just when array was modified.
        true if always enabled
      • setButtonsVisible

        public void setButtonsVisible​(boolean value)
        Sets the visibility state of the OK/Cancel/action buttons.
        value - whether to show them or hide them
      • getButtonsVisible

        public boolean getButtonsVisible()
        Returns whether the OK/Cancel/action buttons are visible.
        true if visible
      • addArrayChangeListener

        public void addArrayChangeListener​(ChangeListener l)
        Adds the change listener. Gets notified whenever the array elements change.
        l - the listener to add
      • removeArrayChangeListener

        public void removeArrayChangeListener​(ChangeListener l)
        Removes the change listener.
        l - the listener to remove
      • notifyArrayChangeListeners

        protected void notifyArrayChangeListeners()
        Notifies all change listeners that the array elements have changed.