Package adams.gui.application
Class AbstractPropertiesPreferencesPanel
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- adams.gui.core.BasePanel
-
- adams.gui.application.AbstractPreferencesPanel
-
- adams.gui.application.AbstractPropertiesPreferencesPanel
-
- All Implemented Interfaces:
PreferencesPanel
,ImageObserver
,MenuContainer
,Serializable
,Comparable<PreferencesPanel>
,Accessible
- Direct Known Subclasses:
FlowPreferencesPanel
,FontsPreferencesPanel
,JVisualVMPanel
,TerminalSettingsPanel
,WekaExperimenterPreferencesPanel
,WekaExplorerPreferencesPanel
,WekaInvestigatorPreferencesPanel
public abstract class AbstractPropertiesPreferencesPanel extends AbstractPreferencesPanel
Displays all properties in a props file as preferences.- Version:
- $Revision$
- Author:
- 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 PropertiesParameterPanel
m_PanelPreferences
the panel with the preferences.-
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 AbstractPropertiesPreferencesPanel()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract String
activate()
Activates the settings.void
addPreference(String identifier, String label, AbstractChooserPanel chooser)
Adds the chooser panel at the end.void
addPreference(String identifier, String label, Component comp)
Adds a preference.void
addPropertyType(String property, PropertiesParameterPanel.PropertyType type)
Associates the preference type with the specified property.void
clearPropertyTypes()
Removes all property/preference type relations.PropertiesParameterPanel.PropertyType
getActualPropertyType(String property)
Checks whether a preference type has been specified for a particular property.Class
getArrayClass(String property)
Returns the custom array class associated with a particular property.String
getArraySeparator(String property)
Returns the custom array separator associated with a particular property.AbstractChooserPanel
getChooser(String property)
Returns the chooser associated with a particular property.Class
getEnum(String property)
Returns the enum associated with a particular property.String
getHelp(String property)
Returns the help associated with a particular property.String[]
getList(String property)
Returns the list associated with a particular property.Component
getPreference(int index)
Returns the component at the specified location.Component
getPreference(String identifier)
Returns the component associated with the identifier.int
getPreferenceCount()
Returns the number of preferences currently displayed.Properties
getPreferences()
Returns the currently display preferences as a properties object.List<String>
getPropertyOrder()
Returns the order for the properties.PropertiesParameterPanel.PropertyType
getPropertyType(String property)
Checks whether a preference type has been specified for a particular property.abstract String
getTitle()
The title of the preferences.boolean
hasArrayClass(String property)
Checks whether a custom array class has been specified for a particular property.boolean
hasArraySeparator(String property)
Checks whether a custom array separator has been specified for a particular property.boolean
hasChooser(String property)
Checks whether a chooser has been specified for a particular property.boolean
hasEnum(String property)
Checks whether a enum has been specified for a particular property.boolean
hasHelp(String property)
Checks whether a help has been specified for a particular property.boolean
hasList(String property)
Checks whether a list has been specified for a particular property.boolean
hasPropertyType(String property)
Checks whether a preference type has been specified for a particular property.protected void
initGUI()
For initializing the GUI.void
setArrayClass(String property, Class value)
Associates the custom array class with a particular property.\ Must have setText(String) and getText() methods!void
setArraySeparator(String property, String value)
Associates the custom array separator with a particular property.void
setChooser(String property, AbstractChooserPanel value)
Associates the chooser with a particular property.void
setEnum(String property, Class value)
Associates the enum with a particular property.void
setHelp(String property, String value)
Associates the help with a particular property.void
setList(String property, String[] value)
Associates the list with a particular property.void
setPreferences(Properties value)
Sets the properties to base the preferences on.void
setPropertyOrder(String[] value)
Sets the order for the properties.void
setPropertyOrder(List<String> value)
Sets the order for the properties.-
Methods inherited from class adams.gui.application.AbstractPreferencesPanel
canReset, compareTo, equals, getPanels, requiresWrapper, reset
-
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, beforeShow, closeParent, finishInit, getParentChild, getParentDialog, getParentFrame, getParentInternalFrame, getParentTitle, initFileChooser, initialize, 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, 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_PanelPreferences
protected PropertiesParameterPanel m_PanelPreferences
the panel with the preferences.
-
-
Method Detail
-
getTitle
public abstract String getTitle()
The title of the preferences.- Specified by:
getTitle
in interfacePreferencesPanel
- Specified by:
getTitle
in classAbstractPreferencesPanel
- Returns:
- the title
-
activate
public abstract String activate()
Activates the settings.- Specified by:
activate
in interfacePreferencesPanel
- Specified by:
activate
in classAbstractPreferencesPanel
- Returns:
- null if successfully activated, otherwise error message
-
clearPropertyTypes
public void clearPropertyTypes()
Removes all property/preference type relations.
-
addPreference
public void addPreference(String identifier, String label, Component comp)
Adds a preference.- Parameters:
identifier
- the unique identifier of the preferencelabel
- the label to add, the mnemonic to use is preceded by "_"comp
- the component to add- Throws:
IllegalArgumentException
- if the identifier already exists
-
addPreference
public void addPreference(String identifier, String label, AbstractChooserPanel chooser)
Adds the chooser panel at the end.- Parameters:
identifier
- the unique identifier of the preferencelabel
- the label to add, the mnemonic to use is preceded by "_"chooser
- the chooser panel to add- Throws:
IllegalArgumentException
- if the identifier already exists
-
getPreference
public Component getPreference(int index)
Returns the component at the specified location.- Parameters:
index
- the index of the specified location- Returns:
- the component at the position
-
getPreference
public Component getPreference(String identifier)
Returns the component associated with the identifier.- Parameters:
identifier
- the identifier of the preference to return- Returns:
- the associated component, null if none found
-
getPreferenceCount
public int getPreferenceCount()
Returns the number of preferences currently displayed.- Returns:
- the number of preferences
-
addPropertyType
public void addPropertyType(String property, PropertiesParameterPanel.PropertyType type)
Associates the preference type with the specified property.- Parameters:
property
- the property to associate a type withtype
- the preference type
-
hasPropertyType
public boolean hasPropertyType(String property)
Checks whether a preference type has been specified for a particular property.- Parameters:
property
- the property to associate a type with- Returns:
- true if a type has been specified
-
getPropertyType
public PropertiesParameterPanel.PropertyType getPropertyType(String property)
Checks whether a preference type has been specified for a particular property.- Parameters:
property
- the property to associate a type with- Returns:
- true if a type has been specified
-
getActualPropertyType
public PropertiesParameterPanel.PropertyType getActualPropertyType(String property)
Checks whether a preference type has been specified for a particular property.- Parameters:
property
- the property to associate a type with- Returns:
- true if a type has been specified
-
hasChooser
public boolean hasChooser(String property)
Checks whether a chooser has been specified for a particular property.- Parameters:
property
- the property check- Returns:
- true if a chooser has been specified
-
setChooser
public void setChooser(String property, AbstractChooserPanel value)
Associates the chooser with a particular property.- Parameters:
property
- the property to associate the chooser withvalue
- the chooser to use
-
getChooser
public AbstractChooserPanel getChooser(String property)
Returns the chooser associated with a particular property.- Parameters:
property
- the property to get the chooser for- Returns:
- the chooser, null if none available
-
hasArrayClass
public boolean hasArrayClass(String property)
Checks whether a custom array class has been specified for a particular property.- Parameters:
property
- the property check- Returns:
- true if a custom array class has been specified
-
setArrayClass
public void setArrayClass(String property, Class value)
Associates the custom array class with a particular property.\ Must have setText(String) and getText() methods!- Parameters:
property
- the property to associate the chooser withvalue
- the custom array class to use
-
getArrayClass
public Class getArrayClass(String property)
Returns the custom array class associated with a particular property.- Parameters:
property
- the property to get the chooser for- Returns:
- the custom array class, null if none available
-
hasArraySeparator
public boolean hasArraySeparator(String property)
Checks whether a custom array separator has been specified for a particular property. If no separator specified, comma is used.- Parameters:
property
- the property check- Returns:
- true if a custom array separator has been specified
-
setArraySeparator
public void setArraySeparator(String property, String value)
Associates the custom array separator with a particular property. If no separator specified, comma is used.- Parameters:
property
- the property to associate the chooser withvalue
- the custom array separator to use
-
getArraySeparator
public String getArraySeparator(String property)
Returns the custom array separator associated with a particular property. If no separator specified, comma is used.- Parameters:
property
- the property to get the chooser for- Returns:
- the custom array separator, null if none available
-
hasEnum
public boolean hasEnum(String property)
Checks whether a enum has been specified for a particular property.- Parameters:
property
- the property to check- Returns:
- true if a enum has been specified
-
setEnum
public void setEnum(String property, Class value)
Associates the enum with a particular property.- Parameters:
property
- the property to associate the enum withvalue
- the enum to use
-
getEnum
public Class getEnum(String property)
Returns the enum associated with a particular property.- Parameters:
property
- the property to get the enum for- Returns:
- the enum, null if none available
-
hasList
public boolean hasList(String property)
Checks whether a list has been specified for a particular property.- Parameters:
property
- the property check- Returns:
- true if a list has been specified
-
setList
public void setList(String property, String[] value)
Associates the list with a particular property.- Parameters:
property
- the property to associate the list withvalue
- the list to use
-
getList
public String[] getList(String property)
Returns the list associated with a particular property.- Parameters:
property
- the property to get the list for- Returns:
- the list, null if none available
-
hasHelp
public boolean hasHelp(String property)
Checks whether a help has been specified for a particular property.- Parameters:
property
- the property check- Returns:
- true if a help has been specified
-
setHelp
public void setHelp(String property, String value)
Associates the help with a particular property.- Parameters:
property
- the property to associate the help withvalue
- the help to use
-
getHelp
public String getHelp(String property)
Returns the help associated with a particular property.- Parameters:
property
- the property to get the help for- Returns:
- the help, null if none available
-
setPropertyOrder
public void setPropertyOrder(String[] value)
Sets the order for the properties.- Parameters:
value
- the ordered property names
-
setPropertyOrder
public void setPropertyOrder(List<String> value)
Sets the order for the properties.- Parameters:
value
- the ordered property names
-
getPropertyOrder
public List<String> getPropertyOrder()
Returns the order for the properties.- Returns:
- the ordered property names
-
setPreferences
public void setPreferences(Properties value)
Sets the properties to base the preferences on.- Parameters:
value
- the properties to use
-
getPreferences
public Properties getPreferences()
Returns the currently display preferences as a properties object.- Returns:
- the preferences
-
-