public class ROILayerSelectorPanel extends JPanel
JPanel.AccessibleJPanelJComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
private IDrawingLayer |
currentLayer
The currently selected layer.
|
private ROILayerWidget |
currentWidget
The currently selected widget.
|
private ILookPanel |
displayPanel
The
ILookPanel managed by this instance. |
private JLayeredPane |
layerPane
A list of all existing ROI layers.
|
private ArrayList<IDrawingLayer> |
layers
All layers of the managed
ILookPanel. |
private JLabel |
lblAdd |
private JLabel |
lblHideAll |
private JLabel |
lblMoveDown |
private JLabel |
lblMoveUp |
private JLabel |
lblRemove |
private JLabel |
lblShowAll |
private static org.apache.log4j.Logger |
logger
A custom class logger.
|
private int |
selectedLayerIndex
The currently selected layer index.
|
private Box |
selectorContainer
A container for the control elements.
|
private ButtonGroup |
selectorGroup
A button group for all radio buttons.
|
private static long |
serialVersionUID
The UID for serialization.
|
private ArrayList<ROILayerWidget> |
widgets
An ordered list of
ROILayerWidgets. |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
ROILayerSelectorPanel()
Create the panel.
|
ROILayerSelectorPanel(ILookPanel lookPanel)
Generate a new layer selection panel for the given look panel in order to
manage the ROIs.
|
| Modifier and Type | Method and Description |
|---|---|
protected IDrawingLayer |
addLayer(String name,
boolean immediateRepaint)
Add a layer widget to the end of the layer list (on top of all others).
|
private void |
cleanDrawingLayersFromPane()
Removes all instances of
IDrawingLayer ayers from the JLayeredPane. |
private void |
cleanUp(int zOrder)
Cleans all traces for a layer according to the given z-order.
|
IDrawingLayer |
createDefaultLayer()
Creates the default layer (0).
|
IDrawingLayer |
createLayer()
Creates a new layer to draw on.
|
IDrawingLayer |
createLayer(String name)
Creates a new layer with a given name to draw on.
|
IDrawingLayer |
getCurrentLayer()
Gets the currently selected layer.
|
ImageLayer |
getImageLayer()
Gets the image layer, which is located below all ROI layers.
|
IDrawingLayer |
getLayer(int zOrder)
Get a layer by the its z-order.
|
JLayeredPane |
getLayerPane()
Get the layered pane of the managed look panel.
|
List<IDrawingLayer> |
getLayers()
Get a list of all layers.
|
ILookPanel |
getLookPanel()
Gets the reference to the look panel, this selector widget is associated
with.
|
void |
hideAllLayers()
Hides all layers from the display.
|
protected ROILayerWidget |
highlightWidget(int selectedIndex)
This method selects the layer at the specified index and de-selects all
other layers.
|
private void |
initialize()
(Re)-initializes the component.
|
static void |
main(String[] args) |
void |
moveLayerDown()
Moves the selected layer one position downwards.
|
void |
moveLayerUp()
Moves the selected layer one position upwards.
|
protected void |
reIndexLayers()
Re-indexes the layers with running numbers as z-orders.
|
void |
removeLayer(int zOrder)
Removes a specified layer from the list.
|
protected void |
removeWidget(int zOrder,
boolean immediateRepaint)
Remove the selector widget at a corresponding zOrder from the container.
|
IDrawingLayer |
replaceLayers(List<IDrawingLayer> layers)
Replaces all layers with a new list of layers.
|
IDrawingLayer |
resetLayers()
Entirely removes all layers and creates a new default layer.
|
IDrawingLayer |
selectLayer(int zOrder)
Selects and highlights the layer at the given
zOrder
position. |
void |
setLayerPane(JLayeredPane layerPane)
Set the layered pane.
|
void |
setLayerToFront(DefaultDrawingLayer layer)
Sets the layer to front and repaints the active layer.
|
void |
showAllLayers()
Shows all layers from the display.
|
void |
swapLayers(int sourceIndex,
int destinationIndex)
Swap the source index with the destination index for the widgets and the
layers.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, 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, updateadd, 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, validateTreeaction, 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, transferFocusUpCycleprivate static final long serialVersionUID
private static final org.apache.log4j.Logger logger
private JLabel lblAdd
private JLabel lblRemove
private JLabel lblMoveUp
private JLabel lblMoveDown
private ButtonGroup selectorGroup
private ILookPanel displayPanel
ILookPanel managed by this instance.private ArrayList<ROILayerWidget> widgets
ROILayerWidgets. Greater indices indicate
greater z-order.private int selectedLayerIndex
private IDrawingLayer currentLayer
private ROILayerWidget currentWidget
private ArrayList<IDrawingLayer> layers
ILookPanel. The Integer is the
z-order of the corresponding layer.private JLayeredPane layerPane
private Box selectorContainer
private JLabel lblHideAll
private JLabel lblShowAll
public ROILayerSelectorPanel()
public ROILayerSelectorPanel(ILookPanel lookPanel)
lookPanel - public void hideAllLayers()
public void showAllLayers()
protected ROILayerWidget highlightWidget(int selectedIndex)
selectedIndex - the z-order of the layerprotected void removeWidget(int zOrder,
boolean immediateRepaint)
zOrder - immediateRepaint - public IDrawingLayer createDefaultLayer()
public IDrawingLayer createLayer()
public IDrawingLayer createLayer(String name)
public IDrawingLayer resetLayers()
private void initialize()
private void cleanDrawingLayersFromPane()
IDrawingLayer ayers from the JLayeredPane.public IDrawingLayer replaceLayers(List<IDrawingLayer> layers)
layers - the list of new layers, if null the list will be
replaced by a single default layerprotected IDrawingLayer addLayer(String name, boolean immediateRepaint)
name - the name of the layerimmediateRepaint - a flag whether the GUI shall be repainted immediately after
adding the layer widgetpublic IDrawingLayer selectLayer(int zOrder)
zOrder
position. The current layer is set to the selected one.zOrder - the position of the layer in the stackNoSuchElementException - if the zOrder is not within the stackpublic IDrawingLayer getLayer(int zOrder)
getCurrentLayer() does not return the same layer as this method.zOrder - the index of the layerpublic void removeLayer(int zOrder)
zOrder - the index of the layerprivate void cleanUp(int zOrder)
zOrder - public void moveLayerDown()
public void moveLayerUp()
public void swapLayers(int sourceIndex,
int destinationIndex)
sourceIndex - destinationIndex - public List<IDrawingLayer> getLayers()
public IDrawingLayer getCurrentLayer()
public ILookPanel getLookPanel()
protected void reIndexLayers()
public ImageLayer getImageLayer()
public JLayeredPane getLayerPane()
JLayeredPanepublic void setLayerPane(JLayeredPane layerPane)
layerPane - public void setLayerToFront(DefaultDrawingLayer layer)
layer - public static void main(String[] args)
Copyright © 2009–2017 Helmut Ahammer, Philipp Kainz. All rights reserved.