|
||||||||||
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.gicentre.treemappa.TreeMapPanel
public class TreeMapPanel
Class to provide a visual representation of the tree map.
Nested Class Summary |
---|
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 |
---|
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 | |
---|---|
TreeMapPanel(int width,
int height,
TreeMappa treeMappa)
Creates the panel in which to place the visual representation of the tree map. |
Method Summary | |
---|---|
double[] |
getBorders()
Provides the set of ordered border width settings for each level of the treemap hierarchy. |
org.gicentre.utils.colour.ColourTable |
getColourTable()
Provides the colour table currently used to identify treemap node colours. |
java.awt.image.BufferedImage |
getImage()
Reports the treemap image assuming it can store alpha (transparency) values. |
java.awt.image.BufferedImage |
getImage(boolean hasAlpha)
Reports the treemap image. |
java.lang.String[] |
getLayouts()
Reports the currently used treemap layouts at each level of the hierarchy. |
java.awt.geom.Point2D |
getPixelToGeo(java.awt.geom.Point2D pxl)
Transforms the given point from pixel to georeferenced coordinates. |
boolean |
oCut(int level)
Removes the tree data from a the given level of the hierarchy. |
void |
paintComponent(java.awt.Graphics g)
Draws the tree map nodes. |
boolean |
setAlignment(int level,
java.lang.String alignment)
Sets the alignment setting for the given level of the treemap. |
boolean |
setAlignments(java.lang.String alignment)
Sets the alignment settings for all levels within the treemap. |
boolean |
setAllowVerticalLabels(boolean allow)
Sets a whether or not vertical text labels are allowed for tall thin rectangles. |
boolean |
setBorder(int level,
float borderSize)
Sets the border size of the nodes at the given level in the treemap. |
boolean |
setBorderColour(java.awt.Color borderColour)
Sets the colour used to display treemap borders. |
boolean |
setBorderColour(int borderColour)
Sets the colour used to display treemap borders. |
boolean |
setBorders(double borderSize)
Sets the border size of the treemap. |
boolean |
setBranchFont(int level,
java.lang.String fontName)
Sets the font used to display branch text at the given level. |
boolean |
setBranchFonts(java.lang.String fontName)
Sets the font used to display text at all branch levels. |
boolean |
setBranchMaxTextSize(int level,
float size)
Sets the maximum text size of the branch labels at the given branch level. |
boolean |
setBranchMaxTextSizes(float size)
Sets the maximum text size of the branch labels at all hierarchy levels. |
boolean |
setBranchTextColour(int level,
java.awt.Color textColour)
Sets the colour used to display branch text at the given level. |
boolean |
setBranchTextColour(int level,
int textColour)
Sets the colour used to display branch text at the given level. |
boolean |
setBranchTextColours(java.awt.Color textColour)
Sets the colour used to display text at all branch levels. |
boolean |
setBranchTextColours(int textColour)
Sets the colour used to display text at all branch levels. |
boolean |
setBranchVectorWidth(int level,
float vectWidth)
Sets the width of the branch displacement vectors at the given branch level. |
boolean |
setBranchVectorWidths(float vectWidth)
Sets the width of the branch displacement vectors at all branch levels. |
boolean |
setColourTable(org.gicentre.utils.colour.ColourTable cTable)
Sets a new colour table to be used to identify treemap node colours. |
boolean |
setLayout(int level,
java.lang.String layout)
Sets the a new layout for the given level in the treemap. |
boolean |
setLayouts(java.lang.String layout)
Sets the a new default layout for the treemap. |
boolean |
setLeafFont(java.lang.String fontName)
Sets the font used to display leaf text. |
boolean |
setLeafMaxTextSize(float size)
Sets the maximum text size of the leaf labels. |
boolean |
setLeafTextColour(java.awt.Color textColour)
Sets the colour used to display leaf text. |
boolean |
setLeafTextColour(int textColour)
Sets the colour used to display leaf text. |
boolean |
setLeafVectorWidth(float vectWidth)
Sets the width of the leaf displacement vectors. |
boolean |
setMutation(float mutation)
Sets the mutation value that controls the degree of colour mutation when using evolutionary colour scheme. |
boolean |
setRandColourLevel(int level)
Sets the level at which random colour mutation should occur when using an evolutionary colour scheme. |
boolean |
setSeed(long seed)
Sets the seed value used to generate random colour mutations in the evolutionary colour scheme. |
boolean |
setShowArrowHead(boolean showArrowHead)
Determines whether or not arrow heads are displayed when showing displacement vectors. |
boolean |
setShowBranchDisplacement(int level,
boolean showDisplacement)
Determines whether or not branch displacement vectors are shown at the given branch level. |
boolean |
setShowBranchDisplacements(boolean showDisplacement)
Determines whether or not branch displacement vectors are shown. |
boolean |
setShowBranchLabels(boolean showLabels)
Determines whether or not branch labels are to be displayed. |
boolean |
setShowLeafDisplacement(boolean showDisplacement)
Determines whether or not leaf displacement vectors are shown. |
boolean |
setShowLeafLabels(boolean showLabels)
Determines whether or not leaf labels are to be displayed. |
boolean |
setUseTransparency(boolean useTransparent)
Sets whether or not transparency is used to when drawing the treemap. |
boolean |
showStatistics()
Display the summary statistics describing the treemap. |
void |
updateData()
Updates the entire treemap using new tree data. |
void |
updateImage()
Updates the tree map display to be shown in this panel. |
void |
updateLayout()
Updates the entire treemap layout. |
boolean |
writeImage(java.lang.String imgFileName)
Writes the tree map display to an image or SVG file with the given name. |
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, 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, transferFocusBackward, 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, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TreeMapPanel(int width, int height, TreeMappa treeMappa)
width
- Default width of the tree map.height
- Default height of the tree map.treeMappa
- Object capable of creating a treemap.Method Detail |
---|
public void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
g
- Graphics context in which to draw.public java.awt.image.BufferedImage getImage()
getImage(true)
. Note that the returned image is not suitable for saving as a jpeg, bmp
or gif file. To do this, call getImage(false)
.
public java.awt.image.BufferedImage getImage(boolean hasAlpha)
hasAlpha
to true is less memory intensive, but can only be
saved as a .png file. If this image is needed to be saved as a jpg, bmp or gif file, hasAlpha
should be set to false.
hasAlpha
- Determines if image is to use transparency or not.
public boolean writeImage(java.lang.String imgFileName)
imgFileName
- Name of image file to write.
public void updateImage()
public void updateLayout()
updateImage()
instead. Requests that change the underlying tree
structure, such as swapping data between hierarchy levels should call updateData()
.
public void updateData()
updateLayout()
or updateImage()
instead.
public boolean showStatistics()
public boolean setAllowVerticalLabels(boolean allow)
updateImage()
is made.
allow
- If true, vertical labels will be permitted, if not, all labels will be horizontal.
public boolean setBorderColour(int borderColour)
updateImage()
is made.
borderColour
- New colour in which to display treemap node borders.
public boolean setBorderColour(java.awt.Color borderColour)
updateImage()
is made.
borderColour
- New colour in which to display treemap node borders.
public boolean setLeafTextColour(int textColour)
updateImage()
is made.
textColour
- New colour in which to display treemap leaf labels.
public boolean setLeafTextColour(java.awt.Color textColour)
updateImage()
is made.
textColour
- New colour in which to display treemap leaf labels.
public boolean setBranchTextColours(int textColour)
updateImage()
is made.
textColour
- New colour in which to display treemap branch labels.
public boolean setBranchTextColours(java.awt.Color textColour)
updateImage()
is made.
textColour
- New colour in which to display treemap branch labels.
public boolean setBranchTextColour(int level, int textColour)
updateImage()
is made.
level
- Hierarchy level at which to make the change.textColour
- New colour in which to display treemap branch labels at the given level.
public boolean setBranchTextColour(int level, java.awt.Color textColour)
updateImage()
is made.
level
- Hierarchy level at which to make the change.textColour
- New colour in which to display treemap branch labels at the given level.
public boolean setBranchFonts(java.lang.String fontName)
updateImage()
is made. Note also that
this will have no effect on the treemaps drawn directly in Processing via PTreeMappa.draw()
,
which uses the currently selected Processing font for all labels.
fontName
- Name of new font in which to display treemap branch labels.
public boolean setBranchFont(int level, java.lang.String fontName)
updateImage()
is made. Note also that
this will have no effect on the treemaps drawn directly in Processing via PTreeMappa.draw()
,
which uses the currently selected Processing font for all labels.
level
- Hierarchy level at which to make the change.fontName
- Name of font in which to display treemap branch labels at the given level.
public boolean setLeafFont(java.lang.String fontName)
updateImage()
is made. Note also that this will have no
effect on the treemaps drawn directly in Processing via PTreeMappa.draw()
,
which uses the currently selected Processing font for all labels.
fontName
- New font in which to display treemap leaf labels.
public boolean setLeafVectorWidth(float vectWidth)
updateImage()
is made.
vectWidth
- Width of leaf displacement vectors in pixel units.
public boolean setBranchMaxTextSize(int level, float size)
updateImage()
is made.
level
- Hierarchy level at which to make the change.size
- Maximum vertical text size in pixel units.
public boolean setBranchMaxTextSizes(float size)
updateImage()
is made.
size
- Maximum vertical text size in pixel units.
public boolean setLeafMaxTextSize(float size)
updateImage()
is made.
size
- Maximum vertical text size in pixel units.
public boolean setMutation(float mutation)
updateImage()
is made.
mutation
- Mutation index between 0 (inherits parent colour exactly) and 1 (independent of parent colour).
public boolean setRandColourLevel(int level)
updateImage()
is made.
level
- Hierarchy level beyond which colour mutation should occur.
public boolean setSeed(long seed)
updateImage()
is made.
seed
- New random seed.
public boolean setShowArrowHead(boolean showArrowHead)
updateImage()
is made.
showArrowHead
- Arrow heads shown if true.
public boolean setShowBranchDisplacement(int level, boolean showDisplacement)
updateImage()
is made.
level
- Hierarchy level at which to make the change.showDisplacement
- Displacement vectors will be shown if true.
public boolean setShowBranchDisplacements(boolean showDisplacement)
updateImage()
is made.
showDisplacement
- Displacement vectors will be shown if true.
public boolean setShowLeafDisplacement(boolean showDisplacement)
updateImage()
is made.
showDisplacement
- Displacement vectors will be shown if true.
public boolean setBranchVectorWidth(int level, float vectWidth)
updateImage()
is made.
level
- Hierarchy level at which to make the change.vectWidth
- Width of branch displacement vectors in pixel units.
public boolean setBranchVectorWidths(float vectWidth)
updateImage()
is made.
vectWidth
- Width of branch displacement vectors in pixel units.
public boolean setColourTable(org.gicentre.utils.colour.ColourTable cTable)
updateImage()
is made.
cTable
- New colour table to use when identifying treemap colours.
public boolean setUseTransparency(boolean useTransparent)
updateImage()
is made.
useTransparent
- Transparency is used if true, otherwise, opaque grey levels are used for text labels.
public boolean setShowBranchLabels(boolean showLabels)
updateImage()
is made.
showLabels
- Branch labels will be displayed if true.
public boolean setShowLeafLabels(boolean showLabels)
updateImage()
is made.
showLabels
- Leaf labels will be displayed if true.
public org.gicentre.utils.colour.ColourTable getColourTable()
public boolean setAlignments(java.lang.String alignment)
updateLayout()
is called.
alignment
- Alignment setting to use. Valid values are 'horizontal', 'vertical' and 'free'.
public boolean setAlignment(int level, java.lang.String alignment)
updateLayout()
is called.
level
- Level of the hierarchy at which the given border setting is to apply.alignment
- Alignment setting to use. Valid values are 'horizontal', 'vertical' and 'free'.
public boolean setBorders(double borderSize)
updateLayout()
is called.
borderSize
- Border size in pixels used to separate treemap nodes.
public boolean setBorder(int level, float borderSize)
updateLayout()
is called.
level
- Level of the hierarchy at which the given border setting is to apply.borderSize
- Border size in pixels used to separate treemap nodes.
public boolean setLayouts(java.lang.String layout)
updateLayout()
is called.
layout
- Name of new layout algorithm to use.
public boolean setLayout(int level, java.lang.String layout)
updateLayout()
is called.
level
- Level of the hierarchy at which the given layout setting is to apply.layout
- Name of new layout algorithm to use.
public java.lang.String[] getLayouts()
public boolean oCut(int level)
updateLayout() is made.
- Parameters:
level
- Level of the hierarchy at which to apply the operation.
- Returns:
- True if the operation has been performed successfully.
public double[] getBorders()
public java.awt.geom.Point2D getPixelToGeo(java.awt.geom.Point2D pxl)
pxl
- Pixel coordinate pair to transform.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |