info.bioinfweb.treegraph.gui.treeframe
Class TreeViewPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
info.bioinfweb.treegraph.gui.treeframe.TreeViewPanel
- All Implemented Interfaces:
- DocumentListener, info.webinsel.util.swing.scrollpaneselector.ScrollPaneSelectable, ImageObserver, MenuContainer, Serializable, Accessible, Scrollable
public class TreeViewPanel
- extends JPanel
- implements DocumentListener, Scrollable, info.webinsel.util.swing.scrollpaneselector.ScrollPaneSelectable
Shows the tree saved in the associated document in a swing GUI.
This class acts as the view-element in the MVC-paradigm, while the model is a
Document
-class.
- Author:
- Ben Stöver
- See Also:
- Serialized Form
Constructor Summary |
TreeViewPanel(Document document)
Creates a new swing-panel which shows the tree contained in document. |
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, 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 |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
START_MIN_SIZE
public static final Dimension START_MIN_SIZE
SELECTION_MARGIN
public static final float SELECTION_MARGIN
- See Also:
- Constant Field Values
PIXELS_PER_MM_100
public static final float PIXELS_PER_MM_100
- See Also:
- Constant Field Values
MIN_ZOOM
public static final float MIN_ZOOM
- See Also:
- Constant Field Values
DEFAULT_SELECTION_COLOR
public static final Color DEFAULT_SELECTION_COLOR
ALTERNATIVE_SELECTION_COLOR
public static final Color ALTERNATIVE_SELECTION_COLOR
MAX_SELECTION_COLOR_DIF
public static final int MAX_SELECTION_COLOR_DIF
- See Also:
- Constant Field Values
selection
private TreeSelection selection
document
private Document document
zoom
private float zoom
painterType
private PositionPaintType painterType
treeViewListeners
private Vector<TreeViewPanelListener> treeViewListeners
TreeViewPanel
public TreeViewPanel(Document document)
- Creates a new swing-panel which shows the tree contained in document.
This class registers itsself as a view at the given document.
- Parameters:
document
- the document to show
pixelsPerMillimeter
public float pixelsPerMillimeter()
getSelection
public TreeSelection getSelection()
getDocument
public Document getDocument()
- Returns the currently associated document.
- Returns:
- the currently assicoated document
setDocument
public void setDocument(Document document)
- Sets this view to a new model and repaints the element using the data of the
new document. This view is automatically unregistered at the old and registered at
the new document.
- Parameters:
document
- the model to assiciate with
getZoom
public float getZoom()
setZoom
public void setZoom(float zoom)
getPainterType
public PositionPaintType getPainterType()
setPainterType
public void setPainterType(PositionPaintType type)
addTreeViewListener
public void addTreeViewListener(TreeViewPanelListener listener)
removeTreeViewListener
public boolean removeTreeViewListener(TreeViewPanelListener listener)
fireSelectionChanged
public void fireSelectionChanged()
fireZoomChanged
private void fireZoomChanged()
fireSizeChanged
private void fireSizeChanged()
assignPaintSize
private void assignPaintSize()
paintComponent
protected void paintComponent(Graphics g)
- Overrides:
paintComponent
in class JComponent
paintPreview
public void paintPreview(Graphics2D g,
double scale)
- Specified by:
paintPreview
in interface info.webinsel.util.swing.scrollpaneselector.ScrollPaneSelectable
changeHappened
public void changeHappened(DocumentChangeEvent e)
- Description copied from interface:
DocumentListener
- Called every time changes were made to the document.
- Specified by:
changeHappened
in interface DocumentListener
getPreferredScrollableViewportSize
public Dimension getPreferredScrollableViewportSize()
- Specified by:
getPreferredScrollableViewportSize
in interface Scrollable
getScrollableBlockIncrement
public int getScrollableBlockIncrement(Rectangle visibleRect,
int orientation,
int direction)
- Specified by:
getScrollableBlockIncrement
in interface Scrollable
getScrollableTracksViewportHeight
public boolean getScrollableTracksViewportHeight()
- Specified by:
getScrollableTracksViewportHeight
in interface Scrollable
getScrollableTracksViewportWidth
public boolean getScrollableTracksViewportWidth()
- Specified by:
getScrollableTracksViewportWidth
in interface Scrollable
getScrollableUnitIncrement
public int getScrollableUnitIncrement(Rectangle arg0,
int arg1,
int arg2)
- Specified by:
getScrollableUnitIncrement
in interface Scrollable
getToolTipText
public String getToolTipText(MouseEvent e)
- This method is overwritten to show the internal node names or label IDs as tooltip
text.
- Overrides:
getToolTipText
in class JComponent
- Parameters:
e
- the MouseEvent
that lead to the call of this method- See Also:
JComponent.getToolTipText(java.awt.event.MouseEvent)
scrollElementToVisible
public void scrollElementToVisible(PaintableElement element)
selectionColor
public static Color selectionColor(Color bgColor)