T
- The class of the items selected by the selector.V
- The class of the constructor argument.public abstract class AbstractSelector<T,V> extends JPanel
getPropertyName()
,
getDefaultRenderedValue(Object)
,
Serialized FormJPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
AbstractSelector(V parameters)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract T |
createNew()
Creates a new element.
|
T |
get()
Gets the selected value.
|
ComboBox |
getCombo()
Gets the ComboBox.
|
protected String |
getComboTip()
Gets the combo's initial tooltip.
|
protected Component |
getCustomizedRenderer(Component renderer,
T value,
int index,
boolean isSelected,
boolean cellHasFocus)
Returns a customized renderer used to display a specific value.
|
protected Object |
getDefaultRenderedValue(T value)
Returns the default value displayed in the combo box.
|
JLabel |
getJLabel()
Gets the label.
|
protected String |
getLabel()
Gets the widget's label.
|
JButton |
getNewButton()
Gets the new button.
|
protected Icon |
getNewButtonIcon() |
protected String |
getNewButtonTip()
Gets the new button's initial tooltip.
|
V |
getParameters()
Gets the parameters of the widget.
|
protected abstract String |
getPropertyName()
Gets the name of the property that changes when the selection changes.
|
protected boolean |
isNewButtonVisible() |
protected abstract void |
populateCombo()
Populates the combo.
|
void |
refresh()
Refreshes the widget when the parameters has changed.
|
void |
set(T value)
Sets the selected value.
|
void |
setEnabled(boolean enabled) |
void |
setParameters(V parameters)
Sets the parameters of the widget.
|
protected void |
setSelectionAfterRefresh(T old)
Sets the combo selection during a refresh.
|
void |
setToolTipText(String tip)
Sets the combo tooltip.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
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
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, getPeer, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public AbstractSelector(V parameters)
parameters
- The init parameters of the selector (that object will be used to populate the combo).protected Icon getNewButtonIcon()
public V getParameters()
AbstractSelector(Object)
public void setParameters(V parameters)
parameters
- The new parametersprotected abstract void populateCombo()
getParameters()
public void refresh()
protected void setSelectionAfterRefresh(T old)
old
- the last selected item before refresh was performed.public JLabel getJLabel()
public JButton getNewButton()
protected boolean isNewButtonVisible()
public ComboBox getCombo()
protected Component getCustomizedRenderer(Component renderer, T value, int index, boolean isSelected, boolean cellHasFocus)
renderer
- The default renderervalue
- The value to be renderedindex
- The index of the value in the comboisSelected
- True if the value is selectedcellHasFocus
- True if the value has the focusprotected Object getDefaultRenderedValue(T value)
value
- The value to be displayed (it can be null)protected abstract T createNew()
protected String getLabel()
protected String getComboTip()
protected String getNewButtonTip()
protected abstract String getPropertyName()
public T get()
public void set(T value)
value
- The value to selectpublic void setToolTipText(String tip)
setToolTipText
in class JComponent
tip
- The tooltip text.public void setEnabled(boolean enabled)
setEnabled
in class JComponent
Copyright © 2022. All rights reserved.