Package com.macrofocus.treeplot.swing
Class SwingTreePlotToolTip<N,Row,Column>
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- com.macrofocus.treeplot.swing.SwingTreePlotToolTip<N,Row,Column>
-
- Type Parameters:
N-
- All Implemented Interfaces:
TreeMapToolTip<N,Row,Column,java.awt.Color,java.awt.Font>,java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable
public class SwingTreePlotToolTip<N,Row,Column> extends javax.swing.JComponent implements TreeMapToolTip<N,Row,Column,java.awt.Color,java.awt.Font>
Default implementation of a tooltip using JidePopup as a container.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classSwingTreePlotToolTip.MouseRedispatcher-
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
-
Nested classes/interfaces inherited from interface com.macrofocus.treemap.TreeMapToolTip
TreeMapToolTip.ToolTipType
-
-
Field Summary
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description SwingTreePlotToolTip(SwingTreePlotView<N,Row,Column> view)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TreeMapPopupcreatePopup()Creates a popup.javax.swing.border.BordergetBorder()protected com.macrofocus.igraphics.CPColor<java.awt.Color>getBorderColor()java.awt.InsetsgetInsets()java.awt.ComponentgetNativeComponent()NgetNode()Gets the current node that the tooltip should display information about.TreeMapPopupgetPopup()Gets the popup or create one if one doesn't exist yet.java.awt.PointgetPopupLocation()java.awt.PointgetPreferredLocation()Gets the preferred location of the tooltip relative to the TreeMapView.java.awt.PointgetPreferredLocation(java.awt.Point p)Gets the preferred location of the tooltip relative to the TreeMapView.java.awt.DimensiongetPreferredSize(TGraphics<java.awt.Color,java.awt.Font> g)intgetPreferredWidth()Gets the preferred width of the tooltip.ToolTipTreePlotRenderergetRenderer()TreeMapToolTip.ToolTipTypegetType()Gets the type of tooltip.protected SwingTreePlotView<N,Row,Column>getView()Gets the view associated with this tooltip.protected voidhidePopup()Hides the popup.voidpaintBackground(TGraphics<java.awt.Color,java.awt.Font> g)Paints the background of the tooltip.voidpaintComponent(java.awt.Graphics g)voidpaintText(TGraphics<java.awt.Color,java.awt.Font> g)Paints the values and the labels of the tooltip.voidsetNode(N node)Sets the current node that the tooltip should display information about.voidsetPreferredWidth(int width)Sets the preferred width of the tooltip.voidsetRedispatchMouseEvent(boolean redispatchMouseEvent)Controls whether the mouse event on the tooltip should be redispatched to the TreeMapView.voidsetRenderer(ToolTipTreePlotRenderer renderer)voidsetType(TreeMapToolTip.ToolTipType type)Sets the type of the tooltip.voidshowNode(N node)Shows the current node that the tooltip should display information about.protected voidshowPopup(int x, int y)Shows the popup at the specified x and y coordinates.-
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, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, 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, updateUI
-
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, getAccessibleContext, 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, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, 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
-
Methods inherited from interface com.macrofocus.treemap.TreeMapToolTip
getHeight, getWidth, setSize
-
-
-
-
Constructor Detail
-
SwingTreePlotToolTip
public SwingTreePlotToolTip(SwingTreePlotView<N,Row,Column> view)
-
-
Method Detail
-
setRedispatchMouseEvent
public void setRedispatchMouseEvent(boolean redispatchMouseEvent)
Controls whether the mouse event on the tooltip should be redispatched to the TreeMapView.- Parameters:
redispatchMouseEvent- true to redispatch all the mouse events, false otherwise.
-
paintComponent
public void paintComponent(java.awt.Graphics g)
- Overrides:
paintComponentin classjavax.swing.JComponent
-
paintText
public void paintText(TGraphics<java.awt.Color,java.awt.Font> g)
Paints the values and the labels of the tooltip.- Specified by:
paintTextin interfaceTreeMapToolTip<N,Row,Column,java.awt.Color,java.awt.Font>- Parameters:
g- a Graphics2D object.
-
paintBackground
public void paintBackground(TGraphics<java.awt.Color,java.awt.Font> g)
Paints the background of the tooltip.- Specified by:
paintBackgroundin interfaceTreeMapToolTip<N,Row,Column,java.awt.Color,java.awt.Font>- Parameters:
g- a Graphis2D object.
-
getBorderColor
protected com.macrofocus.igraphics.CPColor<java.awt.Color> getBorderColor()
-
getBorder
public javax.swing.border.Border getBorder()
- Overrides:
getBorderin classjavax.swing.JComponent
-
getInsets
public java.awt.Insets getInsets()
- Overrides:
getInsetsin classjavax.swing.JComponent
-
getView
protected SwingTreePlotView<N,Row,Column> getView()
Gets the view associated with this tooltip.- Returns:
- the view.
-
getRenderer
public ToolTipTreePlotRenderer getRenderer()
-
setRenderer
public void setRenderer(ToolTipTreePlotRenderer renderer)
-
getNode
public N getNode()
Gets the current node that the tooltip should display information about.- Specified by:
getNodein interfaceTreeMapToolTip<N,Row,Column,java.awt.Color,java.awt.Font>- Returns:
- the current node.
-
setNode
public void setNode(N node)
Sets the current node that the tooltip should display information about.- Specified by:
setNodein interfaceTreeMapToolTip<N,Row,Column,java.awt.Color,java.awt.Font>- Parameters:
node- the node to dislay information about.
-
showNode
public void showNode(N node)
Description copied from interface:TreeMapToolTipShows the current node that the tooltip should display information about.- Specified by:
showNodein interfaceTreeMapToolTip<N,Row,Column,java.awt.Color,java.awt.Font>- Parameters:
node- the node to dislay information about.
-
getPopupLocation
public java.awt.Point getPopupLocation()
- Specified by:
getPopupLocationin interfaceTreeMapToolTip<N,Row,Column,java.awt.Color,java.awt.Font>
-
getPreferredLocation
public java.awt.Point getPreferredLocation()
Gets the preferred location of the tooltip relative to the TreeMapView.- Specified by:
getPreferredLocationin interfaceTreeMapToolTip<N,Row,Column,java.awt.Color,java.awt.Font>- Returns:
- the preferred location
-
getPreferredLocation
public java.awt.Point getPreferredLocation(java.awt.Point p)
Gets the preferred location of the tooltip relative to the TreeMapView.- Parameters:
p- the position of the mouse.- Returns:
- the preferred location.
-
getPreferredSize
public java.awt.Dimension getPreferredSize(TGraphics<java.awt.Color,java.awt.Font> g)
- Specified by:
getPreferredSizein interfaceTreeMapToolTip<N,Row,Column,java.awt.Color,java.awt.Font>- Parameters:
g-
-
getType
public TreeMapToolTip.ToolTipType getType()
Gets the type of tooltip.- Specified by:
getTypein interfaceTreeMapToolTip<N,Row,Column,java.awt.Color,java.awt.Font>- Returns:
- the type of the tooltip.
-
setType
public void setType(TreeMapToolTip.ToolTipType type)
Sets the type of the tooltip.- Specified by:
setTypein interfaceTreeMapToolTip<N,Row,Column,java.awt.Color,java.awt.Font>- Parameters:
type- the tooltip type.
-
getPreferredWidth
public int getPreferredWidth()
Gets the preferred width of the tooltip.- Specified by:
getPreferredWidthin interfaceTreeMapToolTip<N,Row,Column,java.awt.Color,java.awt.Font>- Returns:
- the preferred width.
-
setPreferredWidth
public void setPreferredWidth(int width)
Sets the preferred width of the tooltip.- Specified by:
setPreferredWidthin interfaceTreeMapToolTip<N,Row,Column,java.awt.Color,java.awt.Font>- Parameters:
width- the preferred width.
-
getPopup
public TreeMapPopup getPopup()
Gets the popup or create one if one doesn't exist yet.- Returns:
- a JidePopup component.
-
showPopup
protected void showPopup(int x, int y)Shows the popup at the specified x and y coordinates.- Parameters:
x- the x position. It is screen position.y- the y position. It is screen position.
-
hidePopup
protected void hidePopup()
Hides the popup.
-
createPopup
protected TreeMapPopup createPopup()
Creates a popup.- Returns:
- a JidePopup component.
-
getNativeComponent
public java.awt.Component getNativeComponent()
-
-