com.vividsolutions.jump.workbench.ui
Class LayerViewPanel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bycom.vividsolutions.jump.workbench.ui.LayerViewPanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, LayerListener, LayerManagerProxy, java.awt.MenuContainer, SelectionManagerProxy, java.io.Serializable

public class LayerViewPanel
extends javax.swing.JPanel
implements LayerListener, LayerManagerProxy, SelectionManagerProxy

Be sure to call #dispose() when the LayerViewPanel is no longer needed.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, 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
LayerViewPanel(LayerManager layerManager, LayerViewPanelContext context)
           
 
Method Summary
 void addListener(LayerViewPanelListener listener)
           
 void categoryChanged(CategoryEvent e)
           
static java.util.List components(com.vividsolutions.jts.geom.Geometry g)
           
 java.awt.Image createBlankPanelImage()
          Returns an image with the dimensions of this panel.
 void dispose()
           
 void erase(java.awt.Graphics2D g)
           
 void featuresChanged(FeatureEvent e)
          Fired when a feature is added to or removed from a layer, or when a feature is edited (using an EditTransaction).
 java.util.Collection featuresWithVertex(java.awt.geom.Point2D viewPoint, double viewTolerance, java.util.Collection features)
           
 void fill(java.awt.Graphics2D g, java.awt.Color color)
           
 void fireSelectionChanged()
           
 void flash(com.vividsolutions.jts.geom.GeometryCollection geometryCollection)
           
 void flash(java.awt.Shape shape, java.awt.Color color, java.awt.Stroke stroke, int millisecondDelay)
           
 java.lang.String format(double d)
           
protected  java.lang.String format(double d, double pixelWidthInModelUnits)
           
 Blackboard getBlackboard()
           
 LayerViewPanelContext getContext()
           
 CursorTool getCurrentCursorTool()
           
 com.vividsolutions.jts.geom.Geometry getFence()
           
 Java2DConverter getJava2DConverter()
           
 java.awt.Point getLastClickedPoint()
          Note: the popup menu is shown only if the user right-clicks the panel.
 LayerManager getLayerManager()
           
 RenderingManager getRenderingManager()
           
 SelectionManager getSelectionManager()
           
 java.lang.String getToolTipText(java.awt.event.MouseEvent event)
           
 ToolTipWriter getToolTipWriter()
           
 Viewport getViewport()
           
static boolean intersects(com.vividsolutions.jts.geom.Geometry a, com.vividsolutions.jts.geom.Geometry b)
          Workaround for the fact that GeometryCollection#intersects is not currently implemented.
 void layerChanged(LayerEvent e)
           
 void paintComponent(java.awt.Graphics g)
           
static javax.swing.JPopupMenu popupMenu()
           
 void removeListener(LayerViewPanelListener listener)
           
 void repaint()
           
 void setCurrentCursorTool(CursorTool currentCursorTool)
           
 void setViewportInitialized(boolean viewportInitialized)
          When a layer is added, if this flag is false, the viewport will be zoomed to the extent of the layer.
 void superRepaint()
           
 java.util.Map visibleLayerToFeaturesInFenceMap()
          The Fence layer will be excluded.
 java.util.Map visibleLayerToFeaturesInFenceMap(com.vividsolutions.jts.geom.Geometry fence)
          The Fence layer will be included.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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

LayerViewPanel

public LayerViewPanel(LayerManager layerManager,
                      LayerViewPanelContext context)
Method Detail

getToolTipWriter

public ToolTipWriter getToolTipWriter()

getToolTipText

public java.lang.String getToolTipText(java.awt.event.MouseEvent event)

components

public static java.util.List components(com.vividsolutions.jts.geom.Geometry g)

intersects

public static boolean intersects(com.vividsolutions.jts.geom.Geometry a,
                                 com.vividsolutions.jts.geom.Geometry b)
Workaround for the fact that GeometryCollection#intersects is not currently implemented.


visibleLayerToFeaturesInFenceMap

public java.util.Map visibleLayerToFeaturesInFenceMap()
The Fence layer will be excluded.


visibleLayerToFeaturesInFenceMap

public java.util.Map visibleLayerToFeaturesInFenceMap(com.vividsolutions.jts.geom.Geometry fence)
The Fence layer will be included.


popupMenu

public static javax.swing.JPopupMenu popupMenu()

setCurrentCursorTool

public void setCurrentCursorTool(CursorTool currentCursorTool)

setViewportInitialized

public void setViewportInitialized(boolean viewportInitialized)
When a layer is added, if this flag is false, the viewport will be zoomed to the extent of the layer.


getCurrentCursorTool

public CursorTool getCurrentCursorTool()

getLastClickedPoint

public java.awt.Point getLastClickedPoint()
Note: the popup menu is shown only if the user right-clicks the panel. Thus, popup-menu event handlers don't need to check whether the return value is null.


getViewport

public Viewport getViewport()

getJava2DConverter

public Java2DConverter getJava2DConverter()

getFence

public com.vividsolutions.jts.geom.Geometry getFence()
Returns:
the fence in model-coordinates, or null if there is no fence

getLayerManager

public LayerManager getLayerManager()
Specified by:
getLayerManager in interface LayerManagerProxy

featuresChanged

public void featuresChanged(FeatureEvent e)
Description copied from interface: LayerListener
Fired when a feature is added to or removed from a layer, or when a feature is edited (using an EditTransaction). Warning: this event is fired often.

Specified by:
featuresChanged in interface LayerListener

categoryChanged

public void categoryChanged(CategoryEvent e)
Specified by:
categoryChanged in interface LayerListener

layerChanged

public void layerChanged(LayerEvent e)
Specified by:
layerChanged in interface LayerListener

createBlankPanelImage

public java.awt.Image createBlankPanelImage()
Returns an image with the dimensions of this panel. Note that the image has an alpha component, and thus is not suitable for creating JPEGs -- they will look pinkish.


repaint

public void repaint()

superRepaint

public void superRepaint()

paintComponent

public void paintComponent(java.awt.Graphics g)

erase

public void erase(java.awt.Graphics2D g)

fill

public void fill(java.awt.Graphics2D g,
                 java.awt.Color color)

getContext

public LayerViewPanelContext getContext()

addListener

public void addListener(LayerViewPanelListener listener)

removeListener

public void removeListener(LayerViewPanelListener listener)

format

public java.lang.String format(double d)
Returns:
d rounded off to the distance represented by one pixel

format

protected java.lang.String format(double d,
                                  double pixelWidthInModelUnits)

fireSelectionChanged

public void fireSelectionChanged()

getRenderingManager

public RenderingManager getRenderingManager()

featuresWithVertex

public java.util.Collection featuresWithVertex(java.awt.geom.Point2D viewPoint,
                                               double viewTolerance,
                                               java.util.Collection features)
                                        throws java.awt.geom.NoninvertibleTransformException
Throws:
java.awt.geom.NoninvertibleTransformException

dispose

public void dispose()

flash

public void flash(java.awt.Shape shape,
                  java.awt.Color color,
                  java.awt.Stroke stroke,
                  int millisecondDelay)
Parameters:
millisecondDelay - the GUI will be unresponsive for this length of time, so keep it short!

getSelectionManager

public SelectionManager getSelectionManager()
Specified by:
getSelectionManager in interface SelectionManagerProxy

getBlackboard

public Blackboard getBlackboard()

flash

public void flash(com.vividsolutions.jts.geom.GeometryCollection geometryCollection)
           throws java.awt.geom.NoninvertibleTransformException
Throws:
java.awt.geom.NoninvertibleTransformException