public abstract class AbstractContextSelectToolbarStatusPanel extends AbstractPanel implements Session.OnContextsChangedListener
Context
.unload()
,
Serialized FormJPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
protected String |
panelPrefix |
protected static short |
TOOLBAR_LOCATION_AFTER_CONTEXTS_SELECT
Location provided to
addToolBarElements(JToolBar, short, int) to add items right
after the context selection box. |
protected static short |
TOOLBAR_LOCATION_END
Location provided to
addToolBarElements(JToolBar, short, int) to add items at the
end of the toolbar |
protected static short |
TOOLBAR_LOCATION_START
Location provided to
addToolBarElements(JToolBar, short, int) to add items at the
beginning of the toolbar. |
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 |
---|
AbstractContextSelectToolbarStatusPanel(String prefix,
ImageIcon icon) |
Modifier and Type | Method and Description |
---|---|
protected int |
addToolBarElements(JToolBar toolBar,
short location,
int gridX)
Adds elements to the tool bar.
|
void |
contextAdded(Context context)
Called whenever a new context is created and added.
|
void |
contextDeleted(Context context)
Called whenever a new context is deleted.
|
void |
contextsChanged()
Called whenever the whole contexts list was changed.
|
protected void |
contextSelected(Context context)
Method called whenever a new context is selected.
|
protected ContextSelectComboBox |
getContextSelectComboBox()
Gets the Context select combo box.
|
protected JButton |
getOptionsButton()
Gets the options button.
|
Context |
getSelectedContext()
Gets the selected context.
|
protected abstract Component |
getWorkPanel()
Called in order to build the main panel displayed below the toolbar.
|
protected boolean |
hasOptions()
Called during initialization to check whether an Options button should be added to the
toolbar or not.
|
protected void |
setupToolbarElements(JToolBar toolbar)
Method used to setup the toolbar elements.
|
protected abstract void |
switchViewForContext(Context context)
Called in order to switch the data displayed on the main panel below the toolbar for a new
context.
|
void |
unload()
Unloads the status panel.
|
getDefaultAccelerator, getIcon, getMnemonic, getTabIndex, isHideable, isLocked, isPinned, isShowByDefault, isTabVisible, setDefaultAccelerator, setHideable, setIcon, setLocked, setMnemonic, setParent, setPinned, setShowByDefault, setTabFocus, setTabIndex, tabSelected
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, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, 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
protected static final short TOOLBAR_LOCATION_START
addToolBarElements(JToolBar, short, int)
to add items at the
beginning of the toolbar.protected static final short TOOLBAR_LOCATION_AFTER_CONTEXTS_SELECT
addToolBarElements(JToolBar, short, int)
to add items right
after the context selection box.protected static final short TOOLBAR_LOCATION_END
addToolBarElements(JToolBar, short, int)
to add items at the
end of the toolbarprotected String panelPrefix
protected void setupToolbarElements(JToolBar toolbar)
addToolBarElements(JToolBar, short, int)
method to add elements at various points.toolbar
- the tool bar of the status panelprotected JButton getOptionsButton()
protected ContextSelectComboBox getContextSelectComboBox()
protected int addToolBarElements(JToolBar toolBar, short location, int gridX)
TOOLBAR_LOCATION_*
constants):
TOOLBAR_LOCATION_START
TOOLBAR_LOCATION_AFTER_CONTEXTS_SELECT
TOOLBAR_LOCATION_END
TOOLBAR_LOCATION_*
constants defined in extending classes (if case)
Should be overridden by all subclasses that want to add new elements to the ScanPanel's tool bar.
The tool bar uses a GridBagLayout
, so elements have to be added with a GridBagConstraints
. For this, the LayoutHelper.getGBC(int, int, int, double)
methods
can be used. The gridX
parameter specifies the cell (as used in GridBagConstraints.gridx
) of the current row where the elements can be added.
The method must return the new coordinates of the current cell, after the elements have been added.
toolBar
- the tool barlocation
- the current location where elements will be addedgridX
- the x coordinates of the current cell in the GridBagLayout
LayoutHelper
,
GridBagConstraints
,
GridBagLayout
protected void contextSelected(Context context)
context
- the context that was selectedpublic Context getSelectedContext()
public void contextAdded(Context context)
Session.OnContextsChangedListener
contextAdded
in interface Session.OnContextsChangedListener
public void contextDeleted(Context context)
Session.OnContextsChangedListener
contextDeleted
in interface Session.OnContextsChangedListener
public void contextsChanged()
Session.OnContextsChangedListener
contextsChanged
in interface Session.OnContextsChangedListener
public void unload()
This method should be called once the panel is no longer needed, to detach it from core (persistent) classes.
protected boolean hasOptions()
true
if the tool bar should show an Options button, false
otherwiseprotected abstract Component getWorkPanel()
protected abstract void switchViewForContext(Context context)
NOTE: Should not recreate a new work panel, but change the existing one
(obtained through the first call to getWorkPanel()
) to show the new data (e.g.
change the DataModel for a table).
context
- the context for which to display the panel