Package adams.gui.goe
Class PropertySheetPanel
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- adams.gui.core.BasePanel
-
- adams.gui.goe.PropertySheetPanel
-
- All Implemented Interfaces:
UserModeSupporter
,ImageObserver
,MenuContainer
,PropertyChangeListener
,Serializable
,EventListener
,Accessible
public class PropertySheetPanel extends BasePanel implements PropertyChangeListener, UserModeSupporter
Displays a property sheet where (supported) properties of the target object may be edited.- Author:
- Len Trigg ([email protected]), FracPete (fracpete at waikato dot ac dot nz)
- 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 PropertyEditor[]
m_Editors
Holds property editors of the object.protected String
m_GlobalInfo
the text from the globalInfo method, if any.protected MethodDescriptor[]
m_Methods
Holds the methods of the target.protected List<AbstractOption>
m_Options
Holds the options of this object, if it implements OptionHandler.protected BaseTextAreaWithButtons
m_PanelAbout
The panel holding global info and help, if provided by the object being editied.protected BaseHtmlEditorPane
m_PanelHelp
the editor pane.protected ParameterPanel
m_ParameterPanel
the panel for the parameters.protected PropertyDescriptor[]
m_Properties
Holds properties of the target.protected boolean
m_ShowAboutBox
whether to show/suppress the about box.protected BaseSplitPane
m_SplitPaneContent
the panel with the content.protected PropertyChangeSupport
m_Support
A support object for handling property change listeners.protected BaseTabbedPane
m_TabbedPane
the tabbed pane.protected Object
m_Target
The target object being edited.protected String[]
m_TipTexts
The tool tip text for each property.protected UserMode
m_UserMode
the user mode to use.protected Object[]
m_Values
Holds current object values for each property.protected BaseFlatButton[]
m_VarButtons
the buttons for the variable popup menu.protected JComponent[]
m_Views
Stores GUI components containing each editing component.protected static Boolean
SHOW_VARIABLE_POPUP_BUTTON
whether to show an extra button for variable popup menu.-
Fields inherited from class adams.gui.core.BasePanel
m_FileChooser
-
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 PropertySheetPanel(UserMode userMode)
Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPropertyChangeListener(PropertyChangeListener l)
Adds a PropertyChangeListener.int
editableProperties()
Gets the number of editable properties for the current target.protected String
extractFirstSentence(String text, boolean indicator)
Extracts the first sentence from the given text.protected int
findEditor(PropertyEditor editor)
Determines the index of the editor in this sheet panel.JLabel
findLabel(PropertyEditor editor)
Tries to find the label for the specified editor.AbstractOption
findOption(PropertyEditor editor)
Tries to find the option for the specified editor.BaseFlatButton
findVarButton(PropertyEditor editor)
Tries to find the variable button for the specified editor.JComponent
findView(PropertyEditor editor)
Tries to find the JComponent for the specified editor.JPanel
getAboutPanel()
Return the panel containing global info and help for the object being edited.PropertyChangeSupport
getPropertyChangeSupport()
Returns the underlying PropertyChangeSupport object.boolean
getShowAboutBox()
Returns whether the about box is displayed.static boolean
getShowVariablePopupButton()
Returns whether variable popup button should be displayed.Object
getTarget()
Returns the current target object.UserMode
getUserMode()
Returns the user mode to use for displaying the properties.protected void
initGUI()
Initializes the widgets.protected void
initHelp()
Initializes the help text for the object.protected void
initialize()
For initializing members.protected void
initSheet()
Initializes the options/methods to display.void
propertyChange(PropertyChangeEvent evt)
Updates the property sheet panel with a changed property and also passed the event along.void
removePropertyChangeListener(PropertyChangeListener l)
Removes a PropertyChangeListener.void
setShowAboutBox(boolean value)
Sets whether to show the about-box or not.void
setTarget(Object value)
Sets a new target object for customisation.void
setUserMode(UserMode value)
Sets the user mode to use for displaying the properties.protected void
updateHelpPanel()
Updates the content in the help panel.-
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, beforeShow, closeParent, finishInit, getParentChild, getParentDialog, getParentFrame, getParentInternalFrame, getParentTitle, initFileChooser, main, printErrorMessage, printException, saveComponent, setEnabledCascade, setEnabledCascade, setParentTitle, setVisible
-
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, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, 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, 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
-
SHOW_VARIABLE_POPUP_BUTTON
protected static Boolean SHOW_VARIABLE_POPUP_BUTTON
whether to show an extra button for variable popup menu.
-
m_Target
protected Object m_Target
The target object being edited.
-
m_Options
protected List<AbstractOption> m_Options
Holds the options of this object, if it implements OptionHandler.
-
m_Properties
protected PropertyDescriptor[] m_Properties
Holds properties of the target.
-
m_Methods
protected MethodDescriptor[] m_Methods
Holds the methods of the target.
-
m_Editors
protected PropertyEditor[] m_Editors
Holds property editors of the object.
-
m_Values
protected Object[] m_Values
Holds current object values for each property.
-
m_TabbedPane
protected BaseTabbedPane m_TabbedPane
the tabbed pane.
-
m_SplitPaneContent
protected BaseSplitPane m_SplitPaneContent
the panel with the content.
-
m_PanelHelp
protected BaseHtmlEditorPane m_PanelHelp
the editor pane.
-
m_ParameterPanel
protected ParameterPanel m_ParameterPanel
the panel for the parameters.
-
m_Views
protected JComponent[] m_Views
Stores GUI components containing each editing component.
-
m_VarButtons
protected BaseFlatButton[] m_VarButtons
the buttons for the variable popup menu.
-
m_TipTexts
protected String[] m_TipTexts
The tool tip text for each property.
-
m_GlobalInfo
protected String m_GlobalInfo
the text from the globalInfo method, if any.
-
m_PanelAbout
protected BaseTextAreaWithButtons m_PanelAbout
The panel holding global info and help, if provided by the object being editied.
-
m_Support
protected PropertyChangeSupport m_Support
A support object for handling property change listeners.
-
m_ShowAboutBox
protected boolean m_ShowAboutBox
whether to show/suppress the about box.
-
m_UserMode
protected UserMode m_UserMode
the user mode to use.
-
-
Constructor Detail
-
PropertySheetPanel
public PropertySheetPanel(UserMode userMode)
Default constructor.
-
-
Method Detail
-
initialize
protected void initialize()
For initializing members.- Overrides:
initialize
in classBasePanel
-
setShowAboutBox
public void setShowAboutBox(boolean value)
Sets whether to show the about-box or not. Must happen before callingsetTarget(Object)
.- Parameters:
value
- true if to show
-
getShowAboutBox
public boolean getShowAboutBox()
Returns whether the about box is displayed.- Returns:
- true if shown
-
getAboutPanel
public JPanel getAboutPanel()
Return the panel containing global info and help for the object being edited. May return null if the edited object provides no global info or tip text.- Returns:
- the about-panel.
-
getPropertyChangeSupport
public PropertyChangeSupport getPropertyChangeSupport()
Returns the underlying PropertyChangeSupport object.- Returns:
- the support object
-
propertyChange
public void propertyChange(PropertyChangeEvent evt)
Updates the property sheet panel with a changed property and also passed the event along.- Specified by:
propertyChange
in interfacePropertyChangeListener
- Parameters:
evt
- a value of type 'PropertyChangeEvent'
-
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener l)
Adds a PropertyChangeListener.- Overrides:
addPropertyChangeListener
in classContainer
- Parameters:
l
- a value of type 'PropertyChangeListener'
-
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener l)
Removes a PropertyChangeListener.- Overrides:
removePropertyChangeListener
in classComponent
- Parameters:
l
- a value of type 'PropertyChangeListener'
-
extractFirstSentence
protected String extractFirstSentence(String text, boolean indicator)
Extracts the first sentence from the given text.- Parameters:
text
- the text to processindicator
- whether to add an indicator that more text is available- Returns:
- the first sentence
-
initSheet
protected void initSheet()
Initializes the options/methods to display.
-
initHelp
protected void initHelp()
Initializes the help text for the object.- See Also:
m_GlobalInfo
,m_TipTexts
-
setTarget
public void setTarget(Object value)
Sets a new target object for customisation.- Parameters:
value
- a value of type 'Object'
-
getTarget
public Object getTarget()
Returns the current target object.- Returns:
- the target
-
setUserMode
public void setUserMode(UserMode value)
Sets the user mode to use for displaying the properties.- Specified by:
setUserMode
in interfaceUserModeSupporter
- Parameters:
value
- the mode
-
getUserMode
public UserMode getUserMode()
Returns the user mode to use for displaying the properties.- Specified by:
getUserMode
in interfaceUserModeSupporter
- Returns:
- the mode
-
updateHelpPanel
protected void updateHelpPanel()
Updates the content in the help panel.
-
editableProperties
public int editableProperties()
Gets the number of editable properties for the current target.- Returns:
- the number of editable properties.
-
findEditor
protected int findEditor(PropertyEditor editor)
Determines the index of the editor in this sheet panel.- Parameters:
editor
- the editor to look for- Returns:
- the index, or -1 if not found
-
findOption
public AbstractOption findOption(PropertyEditor editor)
Tries to find the option for the specified editor.- Parameters:
editor
- the editor to find the option for- Returns:
- the option, or null if none found
-
findView
public JComponent findView(PropertyEditor editor)
Tries to find the JComponent for the specified editor.- Parameters:
editor
- the editor to find the option for- Returns:
- the GUI component, or null if none found
-
findLabel
public JLabel findLabel(PropertyEditor editor)
Tries to find the label for the specified editor.- Parameters:
editor
- the editor to find the option for- Returns:
- the label, or null if none found
-
getShowVariablePopupButton
public static boolean getShowVariablePopupButton()
Returns whether variable popup button should be displayed.- Returns:
- true if button displayed
-
findVarButton
public BaseFlatButton findVarButton(PropertyEditor editor)
Tries to find the variable button for the specified editor.- Parameters:
editor
- the editor to find the option for- Returns:
- the button, or null if none found
-
-