|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.peace_tools.views.ClusterSummaryView
public class ClusterSummaryView
View to display a graph of clusters to provide a summary view.
Nested Class Summary | |
---|---|
private class |
ClusterSummaryView.TickLine
A simple component to draw vertical or horizontal ticks. |
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
private java.awt.Rectangle |
area
The area in the graph pane where the actual graph is drawn. |
private javax.swing.JSlider[] |
axisScale
The x and y axis scale controllers. |
private int |
borderSize
Empty white space around the core graph to make things look good. |
private javax.swing.JToggleButton |
classify
A toggle button which when checked (or depressed) indicates that the bars must also include the classification information for each cluster displayed in the graph. |
private ClusterFile |
clusterFile
The set of clusters that we are working with. |
private ESTList |
estList
The set of ESTs that the clusters correspond to. |
private javax.swing.JPanel |
graph
The panel that is used to draw the cluster graph. |
private javax.swing.JToggleButton |
logScale
A toggle button which when checked (or depressed) indicates that the y-axis must be drawn on a logarithmic scale rather than on a linear scale. |
private float |
LogStartValue
A convenience constant to set the smallest y-axis value when the data is displayed on a log scale. |
private MainFrame |
mainFrame
Convenient reference to the main frame class that logically owns this component. |
private int |
maxClusterSize
The largest cluster in the set of clusters that we are working with. |
private static long |
serialVersionUID
Generated serialization UID (merely to keep the compiler happy) |
private int |
TickFontSize
This is a constant that provides the maximum font size we would like to use for the ticks on the graph. |
private javax.swing.JToolBar |
toolbar
The tool bar that contains some commonly used tools with the summary view and for modifying the graph size / info. |
private javax.swing.JLabel |
yLabel
The main y-axis label is drawn separately so that it can be rotated and drawn vertically in the paintGraph() method. |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, 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 |
---|
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 | |
---|---|
ClusterSummaryView(MainFrame frame,
ClusterFile clusterFile,
ESTList estList,
MSTClusterData wsEntry)
The default constructor. |
Method Summary | |
---|---|
private void |
addXAxisLabels(java.awt.Rectangle area)
Helper method to create X-axis labels. |
private void |
addYAxisLabels(java.awt.Rectangle area)
Helper method to create Y-axis labels. |
private void |
checkAndClassify()
Helper method to check and launch classification from another thread. |
private void |
createGraph()
Helper method to configure and setup the graph panel to draw the actual cluster graph. |
private java.awt.Dimension |
createLabels(float startValue,
int endValue,
int tickPixelSpacing,
int axisLength,
boolean xAxis,
java.awt.Rectangle area,
java.util.ArrayList<javax.swing.JLabel> labelList)
Helper method to create the axis labels. |
private javax.swing.JSlider |
createSlider(int size)
Helper method to create a slider with suitable scale. |
private void |
createTicks(java.util.ArrayList<javax.swing.JLabel> labelList,
boolean xAxis)
Helper method to create little tick lines on x or y axis. |
private void |
drawClassificationBars(java.awt.Graphics g,
java.awt.Rectangle barArea,
ClusterNode cluster)
Draw clustering classification information in the graph. |
private void |
drawGraph(java.awt.Graphics g)
Top-level method to draw the cluster graph. |
private int |
getStartX(int clIndex)
Helper method to translate a cluster Index to an absolute x-coordinate. |
private void |
resizeGraph()
Helper method to resize/scale the graph. |
void |
run()
Perform classification from a separate thread. |
private void |
setupAxisLabels()
Helper method to setup x and y axis labels used to draw axis information. |
private void |
setupToolBar()
Helper method to configure and setup various tools in the tool bar. |
private int |
toClusterIndex(int x)
Helper method to convert an x-coordinate in the graph to a cluster index. |
void |
workspaceChanged(WorkspaceEvent event)
Intercept and update graph if classifiers change. |
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, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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 |
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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final int TickFontSize
private javax.swing.JSlider[] axisScale
private javax.swing.JLabel yLabel
private java.awt.Rectangle area
private int borderSize
private javax.swing.JPanel graph
private final javax.swing.JToolBar toolbar
private javax.swing.JToggleButton logScale
private javax.swing.JToggleButton classify
private final int maxClusterSize
private final ClusterFile clusterFile
private final ESTList estList
private final float LogStartValue
private final MainFrame mainFrame
private static final long serialVersionUID
Constructor Detail |
---|
public ClusterSummaryView(MainFrame frame, ClusterFile clusterFile, ESTList estList, MSTClusterData wsEntry)
frame
- The main frame that logically owns this view. This
reference is used to launch the classifier dialog.clusterFile
- The data model to be used to display the
clusters from a given cluster file.estList
- The set of ESTs that contain information about
each EST in the clusters.wsEntry
- The workspace entry corresponding to the clustering
file that is being displayed by this view.Method Detail |
---|
private void setupToolBar()
private javax.swing.JSlider createSlider(int size)
size
- The default/normal size of the axis.
private void drawGraph(java.awt.Graphics g)
g
- The graphics object to be used to draw the graph.private void drawClassificationBars(java.awt.Graphics g, java.awt.Rectangle barArea, ClusterNode cluster)
g
- The graphics object to be used to draw the bars.barArea
- The area of the bar to be filled to reflect the
percentages of cluster classification information.cluster
- The cluster whose classification information is
to be displayed as percentages.private int getStartX(int clIndex)
clIndex
- The index of the cluster to be translated.
private int toClusterIndex(int x)
x
- The x-coordinate to be translated to a cluster id.
private void createGraph()
private void resizeGraph()
private void setupAxisLabels()
Note: The graph (a JPanel) does not have a layout manager. Therefore the x and y locations of the labels are completely under our control.
private void addXAxisLabels(java.awt.Rectangle area)
Note: This method must be called only after the
addYAxisLabels(Rectangle)
method has been called. This
is needed to ensure that the area of the graph has been
suitably updated.
area
- The area of the graph to be used for creating the
labels.private void addYAxisLabels(java.awt.Rectangle area)
Note: This method must be called before the
addXAxisLabels(Rectangle)
method. This method sets up
the graph area appropriately for the
addXAxisLabels(Rectangle)
method.
area
- The area of the graph to be used for creating the
labels.private void createTicks(java.util.ArrayList<javax.swing.JLabel> labelList, boolean xAxis)
labelList
- The labels to be used to determine the location
of the ticks.xAxis
- If this parameter is true, then the ticks are
for the x-axis. Otherwise the ticks are to be created for the
y-axis.private java.awt.Dimension createLabels(float startValue, int endValue, int tickPixelSpacing, int axisLength, boolean xAxis, java.awt.Rectangle area, java.util.ArrayList<javax.swing.JLabel> labelList)
startValue
- The starting value for the axis.endValue
- The ending value for the axis.tickPixelSpacing
- The pixels between ticks.axisLength
- The net length of the axis.xAxis
- If this is true, then the labels are for the x-axis.
Otherwise labels are to be created for the y-axis.area
- The net area of the graph.labelList
- An array list to which the labels created are added.
This list can be null (then labels are not added to the list).
private void checkAndClassify()
public void run()
run
in interface java.lang.Runnable
public void workspaceChanged(WorkspaceEvent event)
workspaceChanged
in interface WorkspaceListener
event
- The event that contains the information regarding the
change that has occured to the workspace.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |