public class GlyphPanel extends javax.swing.JPanel implements Zoomer, javax.swing.event.ChangeListener, javax.swing.event.MouseInputListener, java.awt.event.MouseWheelListener
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
static boolean |
debugMouseEvents |
protected GlyphList |
glyphs |
protected java.awt.Dimension |
glyphsSize |
protected java.awt.Point |
lastPoint |
protected java.util.Set<ZoomListener> |
zoomListeners |
protected java.awt.geom.AffineTransform |
zoomTransform |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
GlyphPanel() |
Modifier and Type | Method and Description |
---|---|
void |
addZoomListener(ZoomListener zl)
Add given zoom listener to list of objects to be notified upon
zoom change.
|
void |
centerOn(java.awt.Rectangle r)
Center component on given rectangle.
|
protected void |
checkSize() |
javax.swing.JFrame |
getFrame() |
GlyphList |
getGlyphs() |
java.awt.Dimension |
getGlyphSize() |
protected java.awt.geom.AffineTransform |
getInverseZoom() |
double |
getZoomScale()
Obtain current zoom scale in effect.
|
boolean |
isEmpty()
Test whether this glyph panel is empty.
|
boolean |
isGlyphishVisible(Glyphish g)
Test whether given glyphish thing is currently visible
in the parental viewport.
|
void |
mouseClicked(java.awt.event.MouseEvent event) |
void |
mouseClicked(java.awt.event.MouseEvent event,
Glyphish item,
java.awt.Point p) |
void |
mouseDragged(java.awt.event.MouseEvent event) |
void |
mouseEntered(java.awt.event.MouseEvent event) |
void |
mouseExited(java.awt.event.MouseEvent event) |
void |
mouseMoved(java.awt.event.MouseEvent event) |
void |
mousePressed(java.awt.event.MouseEvent event) |
void |
mouseReleased(java.awt.event.MouseEvent event) |
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent event) |
protected void |
notifyZoomListeners() |
protected void |
paintComponent(java.awt.Graphics graphics) |
void |
removeZoomListener(ZoomListener zl)
Remove given zoom listener from list of objects to be notified
upon zoom change.
|
void |
resetGlyphs() |
void |
setGlyphs(GlyphList glyphs) |
void |
stateChanged(javax.swing.event.ChangeEvent event) |
java.awt.Point |
transformFromView(java.awt.Point p) |
void |
zoom(double factor)
Apply given factor to current zoom.
|
void |
zoomToFit()
Called to fit the subject of the zoom into the viewer.
|
void |
zoomToFit(java.awt.Dimension size)
Zoom the size of the graph so that it fits into given dimension
and its size is maximized.
|
void |
zoomToOriginal()
Change the size of graph back to its original size.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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
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
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, 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
public static boolean debugMouseEvents
protected GlyphList glyphs
protected java.awt.Dimension glyphsSize
protected java.util.Set<ZoomListener> zoomListeners
protected java.awt.geom.AffineTransform zoomTransform
protected java.awt.Point lastPoint
public GlyphList getGlyphs()
public void resetGlyphs()
public void setGlyphs(GlyphList glyphs)
public java.awt.Dimension getGlyphSize()
protected void checkSize()
public boolean isEmpty()
public void addZoomListener(ZoomListener zl)
zl
- ZoomListener to be notified upon zoom changepublic void removeZoomListener(ZoomListener zl)
zl
- ZoomListener to be removedprotected void notifyZoomListeners()
public double getZoomScale()
protected java.awt.geom.AffineTransform getInverseZoom()
public void zoom(double factor)
public void zoomToFit(java.awt.Dimension size)
null
does nothing.size
- Dimension, in which the zoomed graph must fit intopublic void zoomToFit()
Zoomer
public void zoomToOriginal()
zoomToOriginal
in interface Zoomer
public void centerOn(java.awt.Rectangle r)
null
.r
- Rectangle to center onpublic javax.swing.JFrame getFrame()
public boolean isGlyphishVisible(Glyphish g)
false
if this gpanel is not
embedded into a JViewport.
Returns false
if glyphish is not entirely
inside the currently visible rectangle. If given glyph
is null
returns false.g
- Glyphish thing to test visibility ofpublic java.awt.Point transformFromView(java.awt.Point p)
protected void paintComponent(java.awt.Graphics graphics)
paintComponent
in class javax.swing.JComponent
public void stateChanged(javax.swing.event.ChangeEvent event)
stateChanged
in interface javax.swing.event.ChangeListener
public void mouseWheelMoved(java.awt.event.MouseWheelEvent event)
mouseWheelMoved
in interface java.awt.event.MouseWheelListener
public void mouseClicked(java.awt.event.MouseEvent event)
mouseClicked
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent event)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent event)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent event)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent event)
mouseExited
in interface java.awt.event.MouseListener
public void mouseDragged(java.awt.event.MouseEvent event)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void mouseMoved(java.awt.event.MouseEvent event)
mouseMoved
in interface java.awt.event.MouseMotionListener
public void mouseClicked(java.awt.event.MouseEvent event, Glyphish item, java.awt.Point p)