Package adams.gui.goe
Class GenericObjectEditor.GOEPanel
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- adams.gui.goe.GenericObjectEditor.GOEPanel
-
- All Implemented Interfaces:
UserModeSupporter,ImageObserver,MenuContainer,Serializable,Accessible
- Enclosing class:
- GenericObjectEditor
public class GenericObjectEditor.GOEPanel extends JPanel implements UserModeSupporter
Handles the GUI side of editing values.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field Description protected BaseButtonm_ButtonCancelcancel button.protected BaseButtonm_ButtonCopyPastethe button for copy/paste menu.protected BaseButtonm_ButtonLogClearthe button for clearing the log message.protected BaseButtonm_ButtonLogCopythe button for copying the log message.protected BaseButtonm_ButtonOKok button.protected BaseButtonm_ButtonOpenOpen object from disk.protected BaseButtonm_ButtonSaveSave object to disk.protected BaseButtonm_ButtonUndoundo button.protected BaseComboBox<String>m_ComboBoxClassnameThe names of the proposed classes.protected ObjectFileChooserm_FileChooserThe filechooser for opening and saving object files.protected booleanm_FirstUpdatewhether it is the first update.protected booleanm_IgnoreChangeswhether to ignore selection changes to the combobox.protected JLabelm_LabelClassnameThe name of the current class.protected JPanelm_PanelButtonsthe panel with the buttons.protected JPanelm_PanelLeftthe left panel.protected JPanelm_PanelLogthe panel for the log messages.protected JPanelm_PanelLogAndButtonsthe panel for the log and buttons.protected JPanelm_PanelRightthe right panel.protected GenericObjectEditorClassTreePanelm_PanelTreethe class tree.protected PropertySheetPanelm_PropertySheetChildThe component that performs object customization.protected BaseSplitPanem_SplitPanethe split pane.protected BaseTextAreaWithButtonsm_TextLogthe text area for the log message.protected JPanelm_TopPanelthe top panel with the classname and choose button.protected ClassTreem_Treethe tree to use.protected booleanm_UpdateSizewhether to update the dialog size.-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from class java.awt.Component
accessibleContext, 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 Description GOEPanel()Creates the GUI editor component.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCancelListener(ActionListener a)This is used to hook an action listener to the cancel button.voidaddOkListener(ActionListener a)This is used to hook an action listener to the ok button.voidclearLogMessage()Removes the message and hides the panel.protected voidclose()Disposes the window the GOE belongs to, if possible.voidcopyLogMessage()Copies the message to the clipboard.protected ObjectcopyObject(Object source)Makes a copy of an object using OptionUtils#shallowCopy(Object), CloneHandler#getClone() or serialization.booleangetButtonsVisible()Returns whether the buttons are visible.booleangetCanChangeClassInDialog()Returns whether the user can change the class in the dialog.protected ObjectFileChoosergetFileChooser()Creates the file chooser the user will use to save/load files with.StringgetLogMessage()Returns the current log message.booleangetUpdateSize()Returns whether to update the preferred size.UserModegetUserMode()Returns the user mode.booleanhasLogMessage()Returns whether a message is currently being displayed.booleanisReadOnly()Returns whether the dialog is read-only or not.voidlog(Level level, String msg)For logging messages.voidlog(Level level, String msg, Throwable t)For logging messages.protected ObjectopenObject()Opens an object from a file selected by the user.voidremoveCancelListener(ActionListener a)This is used to remove an action listener from the cancel button.voidremoveOkListener(ActionListener a)This is used to remove an action listener from the ok button.protected voidsaveObject(Object object)Saves an object to a file selected by the user.voidsetButtonsVisible(boolean value)Sets whether to display the buttons.protected voidsetCancelButton(boolean flag)Enables/disables the cancel button.voidsetCanChangeClassInDialog(boolean value)Sets whether the user can change the class in the dialog.voidsetOkButtonText(String newLabel)Allows customization of the action label on the dialog.voidsetReadOnly(boolean value)Sets whether the dialog is read-only or not.voidsetUpdateSize(boolean value)Sets whether to update the preferred size.voidsetUserMode(UserMode value)Sets the user mode.protected voidupdateButtons()Updates the enabled state of the buttons.voidupdateChildPropertySheet()Updates the child property sheet, and creates if needed.-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
m_SplitPane
protected BaseSplitPane m_SplitPane
the split pane.
-
m_PanelLeft
protected JPanel m_PanelLeft
the left panel.
-
m_PanelRight
protected JPanel m_PanelRight
the right panel.
-
m_Tree
protected ClassTree m_Tree
the tree to use.
-
m_PanelTree
protected GenericObjectEditorClassTreePanel m_PanelTree
the class tree.
-
m_PropertySheetChild
protected PropertySheetPanel m_PropertySheetChild
The component that performs object customization.
-
m_ComboBoxClassname
protected BaseComboBox<String> m_ComboBoxClassname
The names of the proposed classes.
-
m_LabelClassname
protected JLabel m_LabelClassname
The name of the current class.
-
m_ButtonOpen
protected BaseButton m_ButtonOpen
Open object from disk.
-
m_ButtonSave
protected BaseButton m_ButtonSave
Save object to disk.
-
m_ButtonOK
protected BaseButton m_ButtonOK
ok button.
-
m_ButtonCancel
protected BaseButton m_ButtonCancel
cancel button.
-
m_ButtonUndo
protected BaseButton m_ButtonUndo
undo button.
-
m_FileChooser
protected transient ObjectFileChooser m_FileChooser
The filechooser for opening and saving object files.
-
m_ButtonCopyPaste
protected BaseButton m_ButtonCopyPaste
the button for copy/paste menu.
-
m_TopPanel
protected JPanel m_TopPanel
the top panel with the classname and choose button.
-
m_PanelLogAndButtons
protected JPanel m_PanelLogAndButtons
the panel for the log and buttons.
-
m_PanelLog
protected JPanel m_PanelLog
the panel for the log messages.
-
m_TextLog
protected BaseTextAreaWithButtons m_TextLog
the text area for the log message.
-
m_ButtonLogClear
protected BaseButton m_ButtonLogClear
the button for clearing the log message.
-
m_ButtonLogCopy
protected BaseButton m_ButtonLogCopy
the button for copying the log message.
-
m_PanelButtons
protected JPanel m_PanelButtons
the panel with the buttons.
-
m_IgnoreChanges
protected boolean m_IgnoreChanges
whether to ignore selection changes to the combobox.
-
m_UpdateSize
protected boolean m_UpdateSize
whether to update the dialog size.
-
m_FirstUpdate
protected boolean m_FirstUpdate
whether it is the first update.
-
-
Method Detail
-
updateButtons
protected void updateButtons()
Updates the enabled state of the buttons.
-
setUserMode
public void setUserMode(UserMode value)
Sets the user mode.- Specified by:
setUserModein interfaceUserModeSupporter- Parameters:
value- the mode
-
getUserMode
public UserMode getUserMode()
Returns the user mode.- Specified by:
getUserModein interfaceUserModeSupporter- Returns:
- the mode
-
setUpdateSize
public void setUpdateSize(boolean value)
Sets whether to update the preferred size.- Parameters:
value- true if to update
-
getUpdateSize
public boolean getUpdateSize()
Returns whether to update the preferred size.- Returns:
- true if to update
-
setButtonsVisible
public void setButtonsVisible(boolean value)
Sets whether to display the buttons.- Parameters:
value- true if to display
-
getButtonsVisible
public boolean getButtonsVisible()
Returns whether the buttons are visible.- Returns:
- true if displayed
-
close
protected void close()
Disposes the window the GOE belongs to, if possible.
-
setCancelButton
protected void setCancelButton(boolean flag)
Enables/disables the cancel button.- Parameters:
flag- true to enable cancel button, false to disable it
-
openObject
protected Object openObject()
Opens an object from a file selected by the user.- Returns:
- the loaded object, or null if the operation was cancelled or failed to load object or incompatible type
-
saveObject
protected void saveObject(Object object)
Saves an object to a file selected by the user.- Parameters:
object- the object to save
-
getFileChooser
protected ObjectFileChooser getFileChooser()
Creates the file chooser the user will use to save/load files with.
-
copyObject
protected Object copyObject(Object source)
Makes a copy of an object using OptionUtils#shallowCopy(Object), CloneHandler#getClone() or serialization.- Parameters:
source- the object to copy- Returns:
- a copy of the source object
-
setOkButtonText
public void setOkButtonText(String newLabel)
Allows customization of the action label on the dialog.- Parameters:
newLabel- the new string for the ok button
-
addOkListener
public void addOkListener(ActionListener a)
This is used to hook an action listener to the ok button.- Parameters:
a- The action listener.
-
addCancelListener
public void addCancelListener(ActionListener a)
This is used to hook an action listener to the cancel button.- Parameters:
a- The action listener.
-
removeOkListener
public void removeOkListener(ActionListener a)
This is used to remove an action listener from the ok button.- Parameters:
a- The action listener
-
removeCancelListener
public void removeCancelListener(ActionListener a)
This is used to remove an action listener from the cancel button.- Parameters:
a- The action listener
-
updateChildPropertySheet
public void updateChildPropertySheet()
Updates the child property sheet, and creates if needed.
-
setCanChangeClassInDialog
public void setCanChangeClassInDialog(boolean value)
Sets whether the user can change the class in the dialog.- Parameters:
value- if true then the user can change the class
-
getCanChangeClassInDialog
public boolean getCanChangeClassInDialog()
Returns whether the user can change the class in the dialog.- Returns:
- true if the user can change the class
-
setReadOnly
public void setReadOnly(boolean value)
Sets whether the dialog is read-only or not.- Parameters:
value- if true then the dialog is read-only
-
isReadOnly
public boolean isReadOnly()
Returns whether the dialog is read-only or not.- Returns:
- true if the dialog is read-only
-
log
public void log(Level level, String msg)
For logging messages.- Parameters:
level- the logging levelmsg- the message
-
log
public void log(Level level, String msg, Throwable t)
For logging messages.- Parameters:
level- the logging levelmsg- the messaget- the optional exception (if one occurred), can be null
-
clearLogMessage
public void clearLogMessage()
Removes the message and hides the panel.
-
copyLogMessage
public void copyLogMessage()
Copies the message to the clipboard.
-
hasLogMessage
public boolean hasLogMessage()
Returns whether a message is currently being displayed.- Returns:
- true if message displayed
-
getLogMessage
public String getLogMessage()
Returns the current log message.- Returns:
- the log message, null if none displayed
-
-