Groovy Documentation

org.geotools.swing
[Java] Class JMapViewer

java.lang.Object
  java.awt.Component
      java.awt.Container
          javax.swing.JComponent
              org.geotools.swing.JMapViewer

public class JMapViewer
extends JComponent

A Swing panel containing a map display pane and (optionally) a toolbar, status bar and map layer table.

This is an adaptation of JMapFrame into an embeddable JComponent.

Authors:
Michael Bedward
Andres Almiray
See Also:
org.geotools.swing.MapLayerTable


Nested Class Summary
enum JMapViewer.Tool

Constants for available toolbar buttons used with the enableTool method.

 
Field Summary
static String TOOLBAR_INFO_BUTTON_NAME

Name assigned to toolbar button for feature info queries.

static String TOOLBAR_PAN_BUTTON_NAME

Name assigned to toolbar button for map panning.

static String TOOLBAR_POINTER_BUTTON_NAME

Name assigned to toolbar button for default pointer.

static String TOOLBAR_RESET_BUTTON_NAME

Name assigned to toolbar button for map reset.

static String TOOLBAR_ZOOMIN_BUTTON_NAME

Name assigned to toolbar button for map zoom in.

static String TOOLBAR_ZOOMOUT_BUTTON_NAME

Name assigned to toolbar button for map zoom out.

private org.geotools.swing.MapLayerTable mapLayerTable

private org.geotools.swing.JMapPane mapPane

private boolean showLayerTable

private boolean showStatusBar

private boolean showToolBar

private org.geotools.swing.control.JMapStatusBar statusBar

private JToolBar toolBar

private Set toolSet

A Swing panel containing a map display pane and (optionally) a toolbar, status bar and map layer table.

private boolean uiSet

 
Fields inherited from class JComponent
WHEN_FOCUSED, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_IN_FOCUSED_WINDOW, UNDEFINED_CONDITION, TOOL_TIP_TEXT_KEY, TOP_ALIGNMENT, CENTER_ALIGNMENT, BOTTOM_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, WIDTH, HEIGHT, PROPERTIES, SOMEBITS, FRAMEBITS, ALLBITS, ERROR, ABORT
 
Fields inherited from class Container
TOP_ALIGNMENT, CENTER_ALIGNMENT, BOTTOM_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, WIDTH, HEIGHT, PROPERTIES, SOMEBITS, FRAMEBITS, ALLBITS, ERROR, ABORT
 
Constructor Summary
JMapViewer()

Default constructor.

JMapViewer(org.geotools.map.MapContent content)

Constructs a new JMapViewer object with specified map content.

 
Method Summary
void enableTool(JMapViewer.Tool... tool)

This method is an alternative to setShowToolBar(boolean).

org.geotools.map.MapContent getMapContent()

Get the map content associated with this viewer.

org.geotools.swing.MapLayerTable getMapLayerTable()

org.geotools.swing.JMapPane getMapPane()

Provides access to the instance of JMapPane being used by this viewer.

org.geotools.renderer.GTRenderer getRenderer()

org.geotools.swing.control.JMapStatusBar getStatusBar()

JToolBar getToolBar()

void initComponents()

Creates and lays out the viewer's components that have been specified with the enable methods (e.g.

boolean isShowLayerTable()

boolean isShowStatusBar()

boolean isShowToolBar()

void setMapContent(org.geotools.map.MapContent content)

Set the MapContent object used by this viewer.

void setRenderer(org.geotools.renderer.GTRenderer renderer)

void setShowLayerTable(boolean enabled)

Set whether a map layer table will be displayed to show the list of layers in the map content and set their order, visibility and selected status.

void setShowStatusBar(boolean enabled)

Set whether a status bar will be displayed to display cursor position and map bounds.

void setShowToolBar(boolean enabled)

Sets whether to display the default toolbar (default is false).

void validate()

JMapViewer valueOf(String name)

Returns the enum constant of this type with the specified name.

JMapViewer[] values()

Returns an array containing the constants of this enum type, in the order they are declared.

 
Methods inherited from class JComponent
contains, getLocation, print, getSize, isOpaque, enable, disable, update, getY, getX, getInsets, getInsets, setFont, getPreferredSize, getMinimumSize, getMaximumSize, getAlignmentX, getAlignmentY, paint, getListeners, addNotify, removeNotify, setFocusTraversalKeys, requestFocus, requestFocus, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, setEnabled, isDoubleBuffered, setVisible, setForeground, setBackground, getBounds, reshape, getWidth, getHeight, setPreferredSize, setMinimumSize, setMaximumSize, getBaseline, getBaselineResizeBehavior, getGraphics, getFontMetrics, repaint, repaint, printAll, requestFocusInWindow, updateUI, getUIClassID, addAncestorListener, setInheritsPopupMenu, getInheritsPopupMenu, setComponentPopupMenu, getComponentPopupMenu, isPaintingTile, isPaintingForPrint, isManagingFocus, setNextFocusableComponent, getNextFocusableComponent, setRequestFocusEnabled, isRequestFocusEnabled, grabFocus, setVerifyInputWhenFocusTarget, getVerifyInputWhenFocusTarget, setBorder, getBorder, setAlignmentY, setAlignmentX, setInputVerifier, getInputVerifier, setDebugGraphicsOptions, getDebugGraphicsOptions, registerKeyboardAction, registerKeyboardAction, unregisterKeyboardAction, getRegisteredKeyStrokes, getConditionForKeyStroke, getActionForKeyStroke, resetKeyboardActions, setInputMap, getInputMap, getInputMap, setActionMap, getActionMap, requestDefaultFocus, getDefaultLocale, setDefaultLocale, setToolTipText, getToolTipText, getToolTipText, getToolTipLocation, getPopupLocation, createToolTip, scrollRectToVisible, setAutoscrolls, getAutoscrolls, setTransferHandler, getTransferHandler, getClientProperty, putClientProperty, isLightweightComponent, setOpaque, computeVisibleRect, getVisibleRect, addVetoableChangeListener, removeVetoableChangeListener, getVetoableChangeListeners, getTopLevelAncestor, removeAncestorListener, getAncestorListeners, revalidate, isValidateRoot, isOptimizedDrawingEnabled, paintImmediately, paintImmediately, setDoubleBuffered, getRootPane, add, add, add, add, add, remove, remove, list, list, removeAll, getComponent, invalidate, validate, getComponentCount, countComponents, getComponents, insets, setComponentZOrder, getComponentZOrder, getLayout, setLayout, doLayout, layout, preferredSize, minimumSize, paintComponents, printComponents, addContainerListener, removeContainerListener, getContainerListeners, deliverEvent, getComponentAt, getComponentAt, locate, getMousePosition, findComponentAt, findComponentAt, isAncestorOf, getFocusTraversalKeys, areFocusTraversalKeysSet, isFocusCycleRoot, isFocusCycleRoot, transferFocusBackward, setFocusTraversalPolicy, getFocusTraversalPolicy, isFocusTraversalPolicySet, setFocusCycleRoot, setFocusTraversalPolicyProvider, isFocusTraversalPolicyProvider, transferFocusDownCycle, applyComponentOrientation, addPropertyChangeListener, addPropertyChangeListener, add, toString, getName, contains, size, getParent, getLocation, remove, setName, list, list, list, getSize, resize, resize, setSize, setSize, enable, location, isValid, setLocale, action, getMousePosition, getGraphicsConfiguration, dispatchEvent, isVisible, isEnabled, isDisplayable, isFocusable, getTreeLock, isLightweight, getPeer, isFocusOwner, transferFocus, getFont, isPreferredSizeSet, isMinimumSizeSet, isMaximumSizeSet, isShowing, handleEvent, postEvent, getFocusCycleRootAncestor, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, setDropTarget, getDropTarget, getToolkit, enableInputMethods, show, show, hide, getForeground, isForegroundSet, getBackground, isBackgroundSet, isFontSet, getLocale, getColorModel, getLocationOnScreen, setLocation, setLocation, move, getBounds, bounds, setBounds, setBounds, setCursor, getCursor, isCursorSet, paintAll, repaint, repaint, repaint, imageUpdate, createImage, createImage, createVolatileImage, createVolatileImage, prepareImage, prepareImage, checkImage, checkImage, setIgnoreRepaint, getIgnoreRepaint, inside, addComponentListener, removeComponentListener, getComponentListeners, addFocusListener, removeFocusListener, getFocusListeners, addHierarchyListener, removeHierarchyListener, getHierarchyListeners, addHierarchyBoundsListener, removeHierarchyBoundsListener, getHierarchyBoundsListeners, addKeyListener, removeKeyListener, getKeyListeners, addMouseListener, removeMouseListener, getMouseListeners, addMouseMotionListener, removeMouseMotionListener, getMouseMotionListeners, addMouseWheelListener, removeMouseWheelListener, getMouseWheelListeners, addInputMethodListener, removeInputMethodListener, getInputMethodListeners, getInputMethodRequests, getInputContext, mouseDown, mouseDrag, mouseUp, mouseMove, mouseEnter, mouseExit, keyDown, keyUp, gotFocus, lostFocus, isFocusTraversable, setFocusable, setFocusTraversalKeysEnabled, getFocusTraversalKeysEnabled, nextFocus, transferFocusUpCycle, hasFocus, removePropertyChangeListener, removePropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, setComponentOrientation, getComponentOrientation, wait, wait, wait, equals, hashCode, getClass, notify, notifyAll
 
Methods inherited from class Container
add, add, add, add, add, remove, remove, list, list, print, removeAll, update, getComponent, invalidate, validate, getComponentCount, countComponents, getComponents, getInsets, insets, setComponentZOrder, getComponentZOrder, getLayout, setLayout, doLayout, layout, setFont, getPreferredSize, preferredSize, getMinimumSize, minimumSize, getMaximumSize, getAlignmentX, getAlignmentY, paint, paintComponents, printComponents, addContainerListener, removeContainerListener, getContainerListeners, getListeners, deliverEvent, getComponentAt, getComponentAt, locate, getMousePosition, findComponentAt, findComponentAt, addNotify, removeNotify, isAncestorOf, setFocusTraversalKeys, getFocusTraversalKeys, areFocusTraversalKeysSet, isFocusCycleRoot, isFocusCycleRoot, transferFocusBackward, setFocusTraversalPolicy, getFocusTraversalPolicy, isFocusTraversalPolicySet, setFocusCycleRoot, setFocusTraversalPolicyProvider, isFocusTraversalPolicyProvider, transferFocusDownCycle, applyComponentOrientation, addPropertyChangeListener, addPropertyChangeListener, add, toString, getName, contains, contains, size, getParent, getLocation, getLocation, remove, setName, list, list, list, getSize, getSize, resize, resize, setSize, setSize, isOpaque, enable, enable, disable, location, isValid, setLocale, getY, getX, action, getMousePosition, getGraphicsConfiguration, dispatchEvent, isVisible, isEnabled, isDisplayable, isFocusable, getTreeLock, isLightweight, getPeer, isFocusOwner, transferFocus, getFont, isPreferredSizeSet, isMinimumSizeSet, isMaximumSizeSet, isShowing, handleEvent, postEvent, getFocusCycleRootAncestor, requestFocus, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, setDropTarget, getDropTarget, getToolkit, setEnabled, isDoubleBuffered, enableInputMethods, setVisible, show, show, hide, getForeground, setForeground, isForegroundSet, getBackground, setBackground, isBackgroundSet, isFontSet, getLocale, getColorModel, getLocationOnScreen, setLocation, setLocation, move, getBounds, getBounds, bounds, setBounds, setBounds, reshape, getWidth, getHeight, setPreferredSize, setMinimumSize, setMaximumSize, getBaseline, getBaselineResizeBehavior, getGraphics, getFontMetrics, setCursor, getCursor, isCursorSet, paintAll, repaint, repaint, repaint, repaint, printAll, imageUpdate, createImage, createImage, createVolatileImage, createVolatileImage, prepareImage, prepareImage, checkImage, checkImage, setIgnoreRepaint, getIgnoreRepaint, inside, addComponentListener, removeComponentListener, getComponentListeners, addFocusListener, removeFocusListener, getFocusListeners, addHierarchyListener, removeHierarchyListener, getHierarchyListeners, addHierarchyBoundsListener, removeHierarchyBoundsListener, getHierarchyBoundsListeners, addKeyListener, removeKeyListener, getKeyListeners, addMouseListener, removeMouseListener, getMouseListeners, addMouseMotionListener, removeMouseMotionListener, getMouseMotionListeners, addMouseWheelListener, removeMouseWheelListener, getMouseWheelListeners, addInputMethodListener, removeInputMethodListener, getInputMethodListeners, getInputMethodRequests, getInputContext, mouseDown, mouseDrag, mouseUp, mouseMove, mouseEnter, mouseExit, keyDown, keyUp, gotFocus, lostFocus, isFocusTraversable, setFocusable, setFocusTraversalKeysEnabled, getFocusTraversalKeysEnabled, requestFocusInWindow, nextFocus, transferFocusUpCycle, hasFocus, removePropertyChangeListener, removePropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, setComponentOrientation, getComponentOrientation, wait, wait, wait, equals, hashCode, getClass, notify, notifyAll
 

Field Detail

TOOLBAR_INFO_BUTTON_NAME

public static final String TOOLBAR_INFO_BUTTON_NAME
Name assigned to toolbar button for feature info queries.


TOOLBAR_PAN_BUTTON_NAME

public static final String TOOLBAR_PAN_BUTTON_NAME
Name assigned to toolbar button for map panning.


TOOLBAR_POINTER_BUTTON_NAME

public static final String TOOLBAR_POINTER_BUTTON_NAME
Name assigned to toolbar button for default pointer.


TOOLBAR_RESET_BUTTON_NAME

public static final String TOOLBAR_RESET_BUTTON_NAME
Name assigned to toolbar button for map reset.


TOOLBAR_ZOOMIN_BUTTON_NAME

public static final String TOOLBAR_ZOOMIN_BUTTON_NAME
Name assigned to toolbar button for map zoom in.


TOOLBAR_ZOOMOUT_BUTTON_NAME

public static final String TOOLBAR_ZOOMOUT_BUTTON_NAME
Name assigned to toolbar button for map zoom out.


mapLayerTable

private org.geotools.swing.MapLayerTable mapLayerTable


mapPane

private org.geotools.swing.JMapPane mapPane


showLayerTable

private boolean showLayerTable


showStatusBar

private boolean showStatusBar


showToolBar

private boolean showToolBar


statusBar

private org.geotools.swing.control.JMapStatusBar statusBar


toolBar

private JToolBar toolBar


toolSet

private Set toolSet
A Swing panel containing a map display pane and (optionally) a toolbar, status bar and map layer table.

This is an adaptation of JMapFrame into an embeddable JComponent.

Authors:
Michael Bedward
Andres Almiray
See Also:
org.geotools.swing.MapLayerTable


uiSet

private boolean uiSet


 
Constructor Detail

JMapViewer

public JMapViewer()
Default constructor. Creates a JMapViewer with no map content or renderer set


JMapViewer

public JMapViewer(org.geotools.map.MapContent content)
Constructs a new JMapViewer object with specified map content.
Parameters:
content - the map content


 
Method Detail

enableTool

public void enableTool(JMapViewer.Tool... tool)
This method is an alternative to setShowToolBar(boolean). It requests that a tool bar be created with specific tools, identified by JMapViewer.Tool constants.

 myMapFrame.enableTool(Tool.PAN, Tool.ZOOM);
 

Calling this method with no arguments or null is equivalent to enableToolBar(false).

Parameters:
tool - tools to display on the toolbar


getMapContent

public org.geotools.map.MapContent getMapContent()
Get the map content associated with this viewer. Returns null if no map content has been set explicitly with the constructor or setMapContent.
Returns:
the current MapContent object


getMapLayerTable

public org.geotools.swing.MapLayerTable getMapLayerTable()


getMapPane

public org.geotools.swing.JMapPane getMapPane()
Provides access to the instance of JMapPane being used by this viewer.
Returns:
the JMapPane object


getRenderer

public org.geotools.renderer.GTRenderer getRenderer()


getStatusBar

public org.geotools.swing.control.JMapStatusBar getStatusBar()


getToolBar

public JToolBar getToolBar()


initComponents

public void initComponents()
Creates and lays out the viewer's components that have been specified with the enable methods (e.g. setShowToolBar(boolean) ). If not called explicitly by the client this method will be invoked by setVisible(boolean) when the viewer is first shown.


isShowLayerTable

public boolean isShowLayerTable()


isShowStatusBar

public boolean isShowStatusBar()


isShowToolBar

public boolean isShowToolBar()


setMapContent

public void setMapContent(org.geotools.map.MapContent content)
Set the MapContent object used by this viewer.
throws:
IllegalArgumentException if content is null
Parameters:
content - the map content


setRenderer

public void setRenderer(org.geotools.renderer.GTRenderer renderer)


setShowLayerTable

public void setShowLayerTable(boolean enabled)
Set whether a map layer table will be displayed to show the list of layers in the map content and set their order, visibility and selected status.
Parameters:
enabled - whether the map layer table is required.


setShowStatusBar

public void setShowStatusBar(boolean enabled)
Set whether a status bar will be displayed to display cursor position and map bounds.
Parameters:
enabled - whether the status bar is required.


setShowToolBar

public void setShowToolBar(boolean enabled)
Sets whether to display the default toolbar (default is false). Calling this with state == true is equivalent to calling enableTool with all JMapViewer.Tool constants.
Parameters:
enabled - whether the toolbar is required


validate

@Override
public void validate()


valueOf

JMapViewer valueOf(String name)
Returns the enum constant of this type with the specified name.


values

JMapViewer[] values()
Returns an array containing the constants of this enum type, in the order they are declared.


 

Groovy Documentation