public abstract class Viewer extends JFrame
Viewer
handles initialization of the
calorimeter panel with the proper settings and provides a window for
it to live in. Subclasses of Viewer
should implement a
means for events to be fed to the calorimeter display.Modifier and Type | Class and Description |
---|---|
private class |
Viewer.EcalMouseListener
The
EcalMouseListener handles removing highlighting
and crystal field information when the cursor leaves the window. |
private class |
Viewer.EcalMouseMotionListener
The
EcalMouseMotionListener handles updating of
the highlighted crystal and status panel information when the
mouse moves over the window. |
private class |
Viewer.PropertyUpdater
Updates the settings panel whenever a tracked property in the
calorimeter panel is updated.
|
JFrame.AccessibleJFrame
Frame.AccessibleAWTFrame
Window.AccessibleAWTWindow, Window.Type
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
private static int |
CELL_VALUE |
private static Color |
DEFAULT_CRYSTAL_COLOR |
private static String[] |
defaultFields |
protected CalorimeterPanel |
ecalPanel
The panel displaying the calorimeter crystals and scale.
|
private Map<String,Integer> |
fieldMap |
static Color |
HIGHLIGHT_CLUSTER_COMPONENT
The default color for highlighting cluster components.
|
static Color |
HIGHLIGHT_CLUSTER_SHARED
The default color for highlighting cluster shared hits.
|
static Color |
HIGHLIGHT_GENERIC
The default color for generic crystal highlighting.
|
private ArrayList<CrystalListener> |
listenerList |
protected JMenu[] |
menu
The base menus used displayed by the
Viewer . |
protected static int |
MENU_FILE |
private static int |
MENU_ITEM_LIN_SCALE |
private static int |
MENU_ITEM_LOG_SCALE |
protected static int |
MENU_SCALE |
protected static int |
MENU_VIEW |
private JCheckBoxMenuItem |
menuBackground |
private JCheckBoxMenuItem |
menuHighlight |
private JCheckBoxMenuItem |
menuMirrorX |
private JCheckBoxMenuItem |
menuMirrorY |
protected JMenuBar |
menuRoot
The root menu bar displayed by the
Viewer . |
private JRadioButtonMenuItem[] |
menuScaling |
private JMenuItem |
menuScreenshot |
private static long |
serialVersionUID |
protected ResizableFieldPanel |
statusPanel
The component responsible for displaying status information
about the currently selected crystal.
|
protected JScrollPane |
statusScroller
Component that allows for scrolling functionality when there
are more status panel entries then can be displayed at once.
|
private static int |
X_INDEX |
private static int |
Y_INDEX |
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
Viewer()
Initializes the viewer window and calorimeter panel.
|
Modifier and Type | Method and Description |
---|---|
void |
addCrystalListener(CrystalListener cl)
Adds the specified crystal listener to receive crystal events
from this component when the calorimeter panel's crystal status
is changed.
|
protected void |
addStatusField(String fieldName)
Adds a new field to the status panel.
|
CrystalListener[] |
getCrystalListeners()
Gets all of the crystal listeners attached to this object.
|
protected void |
insertStatusField(int index,
String fieldName)
Inserts the field at the indicated location on the status panel.
|
boolean |
isMenuVisible()
Indicates whether the menu bar is visible or not.
|
boolean |
isMirroredX()
Indicates whether the calorimeter panel displays the x-axis
in mirrored orientation or not.
|
boolean |
isMirroredY()
Indicates whether the calorimeter panel displays the y-axis
in mirrored orientation or not.
|
void |
removeCrystalListener(CrystalListener cl)
Removes the specified crystal listener so that it no longer
receives crystal events from this component.
|
private void |
resize()
Handles proper resizing of the window and its components.
|
private void |
saveScreenshot()
Saves a screenshot to the application root directory.
|
private void |
scaleChange(int activatingIndex)
Handles events generated by the scaling options radio buttons
in the scaling menu.
|
void |
setMenuVisible(boolean isVisible)
Sets the menu bar to be either visible or hidden.
|
void |
setMirrorX(boolean state)
Sets whether to mirror the x-axis on the calorimeter display.
|
void |
setMirrorY(boolean state)
Sets whether to mirror the y-axis on the calorimeter display.
|
void |
setStatusField(String fieldName,
String value)
Sets the value of the indicated status field on the calorimeter
display.
|
void |
setUseCrystalHighlighting(boolean state)
Sets whether the calorimeter panel will highlight any crystals
that the mouse cursor passes over.
|
void |
setUseLinearScale()
Sets the calorimeter panel to be displayed using a linear scale.
|
void |
setUseLogarithmicScale()
Sets the calorimeter panel to be displayed using a logarithmic
scale.
|
void |
setUseZeroEnergyColorMapping(boolean state)
Sets whether zero-energy crystals should be rendered as grey or
whether they should use the minimum-energy color from the color
scale.
|
static Point |
toEcalPoint(Point panelPoint)
Converts the calorimeter panel's coordinate pair to the LCSim
coordinate system.
|
static int |
toEcalX(int panelX)
Converts the panel x-coordinate to the calorimeter's
coordinate system.
|
static int |
toEcalY(int panelY)
Converts the panel y-coordinate to the calorimeter's
coordinate system.
|
static Point |
toPanelPoint(Point ecalPoint)
Converts the LCSim coordinate pair to the calorimeter panel's
coordinate system.
|
static int |
toPanelX(int ecalX)
Converts the LCSim x-coordinate to the calorimeter panel's
coordinate system.
|
static int |
toPanelY(int ecalY)
Converts the LCSim y-coordinate to the calorimeter panel's
coordinate system.
|
protected void |
updateStatusPanel()
Updates the information on the status panel to match that of
the calorimeter panel's currently selected crystal.
|
boolean |
usesCrystalHighlighting()
Indicates whether crystal will be highlighted when the cursor
passes over them or not.
|
boolean |
usesLinearScale()
Indicates whether the panel is scaled linearly.
|
boolean |
usesLogarithmicScale()
Indicates whether the panel is scaled logarithmically.
|
boolean |
usesZeroEnergyColorMapping()
Indicates whether zero-energy crystals are colored using the
standard color scale or rendered in grey.
|
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getFont, postEvent
private static final long serialVersionUID
private ArrayList<CrystalListener> listenerList
private final JMenuItem menuScreenshot
private final JCheckBoxMenuItem menuHighlight
private final JCheckBoxMenuItem menuBackground
private final JCheckBoxMenuItem menuMirrorX
private final JCheckBoxMenuItem menuMirrorY
private final JRadioButtonMenuItem[] menuScaling
private static final String[] defaultFields
private static final Color DEFAULT_CRYSTAL_COLOR
private static final int X_INDEX
private static final int Y_INDEX
private static final int CELL_VALUE
private static final int MENU_ITEM_LIN_SCALE
private static final int MENU_ITEM_LOG_SCALE
protected static final int MENU_FILE
protected static final int MENU_VIEW
protected static final int MENU_SCALE
protected final JMenuBar menuRoot
Viewer
.protected final JMenu[] menu
Viewer
.protected final JScrollPane statusScroller
protected final ResizableFieldPanel statusPanel
protected final CalorimeterPanel ecalPanel
public static final Color HIGHLIGHT_CLUSTER_COMPONENT
public static final Color HIGHLIGHT_CLUSTER_SHARED
public static final Color HIGHLIGHT_GENERIC
public Viewer() throws NullPointerException
NullPointerException
- Occurs if any of the additional field
arguments are null
.public final void addCrystalListener(CrystalListener cl)
cl
is null
,
no exception is thrown and no action is performed.cl
- - The listener to add.public final CrystalListener[] getCrystalListeners()
CrystalListener
objects.public boolean isMenuVisible()
true
if the menu bar is visible
and false
otherwise.public boolean isMirroredX()
true
if the panel is using mirrored
coordinates and false
if the panel is using regular
coordinates.public boolean isMirroredY()
true
if the panel is using mirrored
coordinates and false
if the panel is using regular
coordinates.public final void removeCrystalListener(CrystalListener cl)
cl
is null
, no
exception is thrown and no action is performed.cl
- - The listener to remove.public final void setMenuVisible(boolean isVisible)
isVisible
- - true
indicates that the menu is
visible and false
that it is not.public void setMirrorX(boolean state)
state
- - true
indicates that the axis should
be mirrored and false
that it should not.public void setMirrorY(boolean state)
state
- - true
indicates that the axis should
be mirrored and false
that it should not.public final void setStatusField(String fieldName, String value) throws NoSuchElementException
fieldName
- - The name of the field to set.value
- - The value to display in relation to the field.NoSuchElementException
- Occurs if an invalid field name
is provided for argument fieldName
.public void setUseCrystalHighlighting(boolean state)
state
- - true
indicates that crystals will
be highlighted and false
that they will not.public void setUseZeroEnergyColorMapping(boolean state)
state
- - false
indicates that zero-energy
crystals will be rendered in grey and true
that
they will be rendered as per the color scale.public void setUseLinearScale()
public void setUseLogarithmicScale()
public static final Point toEcalPoint(Point panelPoint)
panelPoint
- - A calorimeter panel coordinate pair..int
.public static final int toEcalX(int panelX)
panelX
- - A panel x-coordinate.int
.public static final int toEcalY(int panelY)
panelY
- - A panel y-coordinate.int
.public static final Point toPanelPoint(Point ecalPoint)
ecalPoint
- - An LCSim calorimeter coordinate pair..int
.public static final int toPanelX(int ecalX)
ecalX
- - An LCSim calorimeter x-coordinate.int
.public static final int toPanelY(int ecalY)
ecalY
- - An LCSim calorimeter y-coordinate.int
.public boolean usesCrystalHighlighting()
true
if crystals will be highlighted
and false
if they will not.public boolean usesZeroEnergyColorMapping()
false
if zero-energy crystal will
be rendered in grey and true
if they will use the
regular color scale.public boolean usesLinearScale()
true
if the scaling is linear and
false
if the scaling is logarithmic.public boolean usesLogarithmicScale()
true
if the scaling is logarithmic
and false
if the scaling is linear.protected final void addStatusField(String fieldName)
fieldName
- - The name to display for the field and that
links to the field when calling setStatusField
.protected final void insertStatusField(int index, String fieldName)
index
- - The index at which to insert the field.fieldName
- - The name to display for the field and that
links to the field when calling setStatusField
.protected void updateStatusPanel()
private void resize()
private void saveScreenshot()
private void scaleChange(int activatingIndex)
activatingIndex
- - The index of the radio button that
triggered the event.Copyright © 2019. All rights reserved.