Package adams.gui.core
Class AbstractNamedHistoryPanel<T>
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- adams.gui.core.BasePanel
-
- adams.gui.core.AbstractNamedHistoryPanel<T>
-
- Type Parameters:
T
- the type of objects that the history stores
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
- Direct Known Subclasses:
AbstractWorkspaceListPanel
,AssociateTab.HistoryPanel
,AttributeSelectionTab.HistoryPanel
,BufferHistoryPanel
,ClassifyTab.HistoryPanel
,ClusterTab.HistoryPanel
,DefaultAnalysisPanel.HistoryPanel
,DisplayPanelManager.DisplayPanelHistoryPanel
,ExperimentTab.HistoryPanel
,ExplorerEntryPanel
,HelpHistoryPanel
public abstract class AbstractNamedHistoryPanel<T> extends BasePanel
Abstract ancestor for panels that store a history of objects, e.g., results of experiment runs.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractNamedHistoryPanel.AbstractHistoryEntryFrame<T>
A specialized frame class for displaying a history entries.static interface
AbstractNamedHistoryPanel.FrameDisplaySupporter<T>
Interface for history panels that allow the content to be displayed in separate frames.static class
AbstractNamedHistoryPanel.HistoryEntrySelectionEvent
Event object that gets sent whenever a history entry gets selected.static interface
AbstractNamedHistoryPanel.HistoryEntrySelectionListener
Interface for listeners that want to get notified whenever a different history entry gets selected.static interface
AbstractNamedHistoryPanel.HistoryEntryToolTipProvider<T>
Interface for classes that generate tool tips for entries in the history.static interface
AbstractNamedHistoryPanel.PopupCustomizer
Interface for classes that want to customize the popup menu for the entries.-
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 boolean
m_AllowRemove
whether to allow removing of entries.protected boolean
m_AllowRename
whether to allow renaming of entries.protected BaseFlatButton
m_ButtonDown
the move down button.protected BaseFlatButton
m_ButtonRemove
the remove button.protected BaseFlatButton
m_ButtonRemoveAll
the remove all button.protected BaseFlatButton
m_ButtonUp
the move up button.protected Hashtable<String,T>
m_Entries
stores the actual objects (name <-> object relation).protected HashSet<AbstractNamedHistoryPanel.HistoryEntrySelectionListener>
m_HistoryEntrySelectionListeners
the history entry selection listeners.protected AbstractNamedHistoryPanel.HistoryEntryToolTipProvider<T>
m_HistoryEntryToolTipProvider
the tool tip generator.protected BaseList
m_List
the JList listing the history entries.protected DefaultListModel
m_ListModel
the underlying list model.protected DefaultListModel
m_ListModelFiltered
the filtered model.protected BasePanel
m_PanelList
the panel for the list.protected BasePanel
m_PanelListButtons
the panel for the list buttons.protected SearchPanel
m_PanelSearch
the panel for searching the entry names.protected Hashtable<String,Object>
m_Payloads
stores the optional payloads (name <-> object relation).protected AbstractNamedHistoryPanel.PopupCustomizer
m_PopupCustomizer
an optional customizer for the popup on the JList.protected boolean
m_SearchRegexp
whether the current search is using regular expressions.protected String
m_SearchString
the current search term.-
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 AbstractNamedHistoryPanel()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description T
addEntry(String name, T entry)
Adds the entry under the specified name.T
addEntry(String name, T entry, Object payload)
Adds the entry under the specified name.void
addHistoryEntrySelectionListener(AbstractNamedHistoryPanel.HistoryEntrySelectionListener l)
Adds a listener to the internal list of listeners that get notified when a history entry gets selected.boolean
canMoveDown()
checks whether the selected items can be moved down.boolean
canMoveUp()
checks whether the selected items can be moved up.protected void
checkedRemoveAllEntries()
Prompts the user before removing all entries.void
clear()
Removes all entries and payloads.void
clear(boolean update)
Removes all entries and payloads.void
copyEntryNames(int[] indices)
Copies the entry names of the specified indices to the clipboard.int
count()
Returns the number of entries in the list.protected BasePopupMenu
createPopup(MouseEvent e)
Generates the right-click menu for the JList.void
deserialize(Object data, MessageCollection errors)
Restores the history.Enumeration<String>
entries()
Returns the all the currently stored entries.protected void
finishInit()
Finishes the initialization.boolean
getAllowRemove()
Returns whether entries can be removed.boolean
getAllowRename()
Returns whether entries can be renamed.boolean
getAllowSearch()
Returns whether the entry list is searchable.T
getEntry(int index)
Returns the entry at the specified index.T
getEntry(String name)
Returns the entry with the specified name.String
getEntryName(int index)
Returns the name of the entry at the specified index.AbstractNamedHistoryPanel.HistoryEntryToolTipProvider<T>
getHistoryEntryToolTipProvider()
Returns the currently set tool tip provider.protected DefaultListModel
getListModel()
Returns the list model.Object
getPayload(int index)
Returns the payload at the specified index.Object
getPayload(String name)
Returns the payload with the specified name.AbstractNamedHistoryPanel.PopupCustomizer
getPopupCustomizer()
Returns the currently set popup customizer.Dimension
getPreferredSize()
Returns the preferred size for this component.String[]
getSelectedEntries()
Returns the currently selected entries.String
getSelectedEntry()
Returns the currently selected entry, the first if several selected.int
getSelectedIndex()
Returns the currently selected index, the first if several selected.int[]
getSelectedIndices()
Returns the currently selected indices.boolean
hasEntry(String name)
Checks whether the given named entry exists.boolean
hasPayload(String name)
Checks whether there is a payload available for the name.boolean
hasSearch()
Checks whether a search term has been entered by the user.int
indexOfEntry(String name)
Returns the index of the entry.protected void
initGUI()
Initializes the widgets.protected void
initialize()
Initializes the members.void
insertEntryAt(String name, T entry, int index)
Inserts the entry under the name at the specified location.void
insertEntryAt(String name, T entry, Object payload, int index)
Inserts the entry under the name at the specified location.boolean
isButtonPanelVisible()
Returns whether the buttons are shown.void
moveBottom()
moves the selected items to the end.void
moveDown()
moves the selected item down by 1.void
moveTop()
moves the selected items to the top.void
moveUp()
moves the selected items up by 1.String
newEntryName(String name)
Ensures that the name is unique, by appending an index.protected void
notifyHistoryEntrySelectionListeners(AbstractNamedHistoryPanel.HistoryEntrySelectionEvent e)
Notifies all listeners with the specified event.void
removeEntries(int[] indices)
Removes the entries with the specified indices.T
removeEntry(String name)
Removes the specified entry.void
removeHistoryEntrySelectionListener(AbstractNamedHistoryPanel.HistoryEntrySelectionListener l)
Removes a listener from the internal list of listeners that get notified when a history entry gets selected.Object
removePayload(String name)
Removes the specified payload.boolean
renameEntry()
Attempts to rename the current entry.String
renameEntry(String oldName, String newName)
Attempts to rename the entry.Object
serialize()
Returns the history.void
setAllowRemove(boolean value)
Sets whether entries can be removed.void
setAllowRename(boolean value)
Sets whether entries can be renamed.void
setAllowSearch(boolean value)
Sets whether the entry list is searchable.void
setButtonPanelVisible(boolean value)
Sets whether the buttons are shown.void
setHistoryEntryToolTipProvider(AbstractNamedHistoryPanel.HistoryEntryToolTipProvider<T> value)
Sets the tool tip provider.void
setPayload(String name, Object payload)
Set the payload for the specified entry.void
setPopupCustomizer(AbstractNamedHistoryPanel.PopupCustomizer value)
Sets the popup customizer to use.void
setSelectedEntries(String[] value)
Sets the entries to be displayed as selected.void
setSelectedEntry(String value)
Sets the entry to be displayed as selected.void
setSelectedIndex(int value)
Sets the index to be displayed as selected.void
setSelectedIndices(int[] value)
Sets the indices to be displayed as selected.protected void
showPopup(MouseEvent e)
Generates and pops up the right-click menu on the JList.protected void
updateButtons()
Updates the enabled state of the buttons.protected abstract void
updateEntry(String name)
Displays the specified entry.protected void
updateSearch()
Updates the search, filters the entries if necessary.-
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, beforeShow, closeParent, 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, 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_PanelList
protected BasePanel m_PanelList
the panel for the list.
-
m_List
protected BaseList m_List
the JList listing the history entries.
-
m_ListModel
protected DefaultListModel m_ListModel
the underlying list model.
-
m_ListModelFiltered
protected DefaultListModel m_ListModelFiltered
the filtered model.
-
m_PanelListButtons
protected BasePanel m_PanelListButtons
the panel for the list buttons.
-
m_ButtonUp
protected BaseFlatButton m_ButtonUp
the move up button.
-
m_ButtonDown
protected BaseFlatButton m_ButtonDown
the move down button.
-
m_ButtonRemove
protected BaseFlatButton m_ButtonRemove
the remove button.
-
m_ButtonRemoveAll
protected BaseFlatButton m_ButtonRemoveAll
the remove all button.
-
m_Entries
protected Hashtable<String,T> m_Entries
stores the actual objects (name <-> object relation).
-
m_Payloads
protected Hashtable<String,Object> m_Payloads
stores the optional payloads (name <-> object relation).
-
m_PopupCustomizer
protected AbstractNamedHistoryPanel.PopupCustomizer m_PopupCustomizer
an optional customizer for the popup on the JList.
-
m_HistoryEntrySelectionListeners
protected HashSet<AbstractNamedHistoryPanel.HistoryEntrySelectionListener> m_HistoryEntrySelectionListeners
the history entry selection listeners.
-
m_PanelSearch
protected SearchPanel m_PanelSearch
the panel for searching the entry names.
-
m_SearchString
protected String m_SearchString
the current search term.
-
m_SearchRegexp
protected boolean m_SearchRegexp
whether the current search is using regular expressions.
-
m_AllowRemove
protected boolean m_AllowRemove
whether to allow removing of entries.
-
m_AllowRename
protected boolean m_AllowRename
whether to allow renaming of entries.
-
m_HistoryEntryToolTipProvider
protected AbstractNamedHistoryPanel.HistoryEntryToolTipProvider<T> m_HistoryEntryToolTipProvider
the tool tip generator.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classBasePanel
-
finishInit
protected void finishInit()
Finishes the initialization.- Overrides:
finishInit
in classBasePanel
-
moveUp
public void moveUp()
moves the selected items up by 1.
-
moveDown
public void moveDown()
moves the selected item down by 1.
-
moveTop
public void moveTop()
moves the selected items to the top.
-
moveBottom
public void moveBottom()
moves the selected items to the end.
-
canMoveUp
public boolean canMoveUp()
checks whether the selected items can be moved up.- Returns:
- true if the selected items can be moved
-
canMoveDown
public boolean canMoveDown()
checks whether the selected items can be moved down.- Returns:
- true if the selected items can be moved
-
setButtonPanelVisible
public void setButtonPanelVisible(boolean value)
Sets whether the buttons are shown.- Parameters:
value
- true if buttons are shown
-
isButtonPanelVisible
public boolean isButtonPanelVisible()
Returns whether the buttons are shown.- Returns:
- true if buttons are shown
-
updateButtons
protected void updateButtons()
Updates the enabled state of the buttons.
-
setAllowRename
public void setAllowRename(boolean value)
Sets whether entries can be renamed.- Parameters:
value
- true if rename allowed
-
getAllowRename
public boolean getAllowRename()
Returns whether entries can be renamed.- Returns:
- true if rename allowed
-
setAllowRemove
public void setAllowRemove(boolean value)
Sets whether entries can be removed.- Parameters:
value
- true if remove allowed
-
getAllowRemove
public boolean getAllowRemove()
Returns whether entries can be removed.- Returns:
- true if remove allowed
-
showPopup
protected void showPopup(MouseEvent e)
Generates and pops up the right-click menu on the JList.- Parameters:
e
- the event that triggered the popup- See Also:
createPopup(MouseEvent)
-
createPopup
protected BasePopupMenu createPopup(MouseEvent e)
Generates the right-click menu for the JList.
Derived classes should override this method instead of making use of the PopupCustomizer.- Parameters:
e
- the event that triggered the popup- Returns:
- the generated menu
- See Also:
showPopup(MouseEvent)
-
checkedRemoveAllEntries
protected void checkedRemoveAllEntries()
Prompts the user before removing all entries.
-
updateEntry
protected abstract void updateEntry(String name)
Displays the specified entry.- Parameters:
name
- the name of the entry, can be null to empty display
-
updateSearch
protected void updateSearch()
Updates the search, filters the entries if necessary.
-
hasSearch
public boolean hasSearch()
Checks whether a search term has been entered by the user.- Returns:
- true if search term was entered
-
getListModel
protected DefaultListModel getListModel()
Returns the list model.- Returns:
- the list model
-
clear
public void clear()
Removes all entries and payloads.
-
clear
public void clear(boolean update)
Removes all entries and payloads.- Parameters:
update
- if true, thenupdateEntry(String)
is called
-
count
public int count()
Returns the number of entries in the list.- Returns:
- the number of entries
-
entries
public Enumeration<String> entries()
Returns the all the currently stored entries.- Returns:
- the names of the entries
-
hasEntry
public boolean hasEntry(String name)
Checks whether the given named entry exists.- Parameters:
name
- the name to look for- Returns:
- true if the entry exists
-
hasPayload
public boolean hasPayload(String name)
Checks whether there is a payload available for the name.- Parameters:
name
- the name to check for payload- Returns:
- true if entry exists and a payload is available
-
newEntryName
public String newEntryName(String name)
Ensures that the name is unique, by appending an index.- Parameters:
name
- the name to make unique- Returns:
- the unique name
-
indexOfEntry
public int indexOfEntry(String name)
Returns the index of the entry.- Parameters:
name
- the name to look for- Returns:
- the index or -1 if not found
-
getEntry
public T getEntry(String name)
Returns the entry with the specified name.- Parameters:
name
- the name of the entry- Returns:
- the object or null if not found
-
getPayload
public Object getPayload(String name)
Returns the payload with the specified name.- Parameters:
name
- the name of the entry- Returns:
- the object or null if not found or no payload available
-
getEntry
public T getEntry(int index)
Returns the entry at the specified index.- Parameters:
index
- the index of the entry- Returns:
- the object or null if not found
-
getPayload
public Object getPayload(int index)
Returns the payload at the specified index.- Parameters:
index
- the index of the payload- Returns:
- the object or null if not found
-
getEntryName
public String getEntryName(int index)
Returns the name of the entry at the specified index.- Parameters:
index
- the index of the entry- Returns:
- the name
-
addEntry
public T addEntry(String name, T entry)
Adds the entry under the specified name.- Parameters:
name
- the name of the entryentry
- the object to store- Returns:
- the entry previously stored under the same name or null if it is a new entry
-
addEntry
public T addEntry(String name, T entry, Object payload)
Adds the entry under the specified name.- Parameters:
name
- the name of the entryentry
- the object to storepayload
- the payload to attach, can be null- Returns:
- the entry previously stored under the same name or null if it is a new entry
-
setPayload
public void setPayload(String name, Object payload)
Set the payload for the specified entry.- Parameters:
name
- the name of the entrypayload
- the payload object to store
-
insertEntryAt
public void insertEntryAt(String name, T entry, int index)
Inserts the entry under the name at the specified location. Any previously existing entry with the same name will be removed.- Parameters:
name
- the name of the entryentry
- the object to storeindex
- the index to store the entry at
-
insertEntryAt
public void insertEntryAt(String name, T entry, Object payload, int index)
Inserts the entry under the name at the specified location. Any previously existing entry with the same name will be removed.- Parameters:
name
- the name of the entryentry
- the object to storepayload
- the payload to attach, can be nullindex
- the index to store the entry at
-
removeEntry
public T removeEntry(String name)
Removes the specified entry.- Parameters:
name
- the name of the entry- Returns:
- the entry that was stored under this name or null if no entry was stored with this name
-
removePayload
public Object removePayload(String name)
Removes the specified payload.- Parameters:
name
- the name of the entry to remove the payload for- Returns:
- the payload object that was stored under this name or null if no payload was stored with this name
-
setSelectedIndex
public void setSelectedIndex(int value)
Sets the index to be displayed as selected.- Parameters:
value
- the index to select
-
copyEntryNames
public void copyEntryNames(int[] indices)
Copies the entry names of the specified indices to the clipboard.- Parameters:
indices
- the entries to remove
-
removeEntries
public void removeEntries(int[] indices)
Removes the entries with the specified indices.- Parameters:
indices
- the entries to remove
-
renameEntry
public boolean renameEntry()
Attempts to rename the current entry.- Returns:
- true if renamed
- See Also:
getAllowRename()
-
renameEntry
public String renameEntry(String oldName, String newName)
Attempts to rename the entry.- Parameters:
oldName
- the current name of the entrynewName
- the new name for the entry- Returns:
- null if successful, otherwise error message
-
getSelectedIndex
public int getSelectedIndex()
Returns the currently selected index, the first if several selected.- Returns:
- the selected index, -1 if none selected
-
setSelectedIndices
public void setSelectedIndices(int[] value)
Sets the indices to be displayed as selected.- Parameters:
value
- the indices to select
-
getSelectedIndices
public int[] getSelectedIndices()
Returns the currently selected indices.- Returns:
- the selected indices
-
setSelectedEntry
public void setSelectedEntry(String value)
Sets the entry to be displayed as selected.- Parameters:
value
- the entry name
-
getSelectedEntry
public String getSelectedEntry()
Returns the currently selected entry, the first if several selected.- Returns:
- the selected entry, null if none selected
-
setSelectedEntries
public void setSelectedEntries(String[] value)
Sets the entries to be displayed as selected.- Parameters:
value
- the entry names
-
getSelectedEntries
public String[] getSelectedEntries()
Returns the currently selected entries.- Returns:
- the selected entries
-
setPopupCustomizer
public void setPopupCustomizer(AbstractNamedHistoryPanel.PopupCustomizer value)
Sets the popup customizer to use.- Parameters:
value
- the customizer, use null to turn off
-
getPopupCustomizer
public AbstractNamedHistoryPanel.PopupCustomizer getPopupCustomizer()
Returns the currently set popup customizer.- Returns:
- the customizer, can be null if none set
-
addHistoryEntrySelectionListener
public void addHistoryEntrySelectionListener(AbstractNamedHistoryPanel.HistoryEntrySelectionListener l)
Adds a listener to the internal list of listeners that get notified when a history entry gets selected.- Parameters:
l
- the listener to add
-
removeHistoryEntrySelectionListener
public void removeHistoryEntrySelectionListener(AbstractNamedHistoryPanel.HistoryEntrySelectionListener l)
Removes a listener from the internal list of listeners that get notified when a history entry gets selected.- Parameters:
l
- the listener to remove
-
notifyHistoryEntrySelectionListeners
protected void notifyHistoryEntrySelectionListeners(AbstractNamedHistoryPanel.HistoryEntrySelectionEvent e)
Notifies all listeners with the specified event.- Parameters:
e
- the event to send to the listeners
-
setHistoryEntryToolTipProvider
public void setHistoryEntryToolTipProvider(AbstractNamedHistoryPanel.HistoryEntryToolTipProvider<T> value)
Sets the tool tip provider.- Parameters:
value
- the provider, null to turn tool tips off
-
getHistoryEntryToolTipProvider
public AbstractNamedHistoryPanel.HistoryEntryToolTipProvider<T> getHistoryEntryToolTipProvider()
Returns the currently set tool tip provider.- Returns:
- the provider, null if none set
-
setAllowSearch
public void setAllowSearch(boolean value)
Sets whether the entry list is searchable.- Parameters:
value
- true if to make the list searchable
-
getAllowSearch
public boolean getAllowSearch()
Returns whether the entry list is searchable.- Returns:
- true if list is searchable
-
getPreferredSize
public Dimension getPreferredSize()
Returns the preferred size for this component.- Overrides:
getPreferredSize
in classJComponent
- Returns:
- the preferred size
-
serialize
public Object serialize()
Returns the history.- Returns:
- the history
-
deserialize
public void deserialize(Object data, MessageCollection errors)
Restores the history.- Parameters:
data
- the data to restoreerrors
- for storing errors
-
-