es.prodevelop.gvsig.mobile.gui.dialog.control
Class LayersTable

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended byes.prodevelop.gvsig.mobile.gui.dialog.control.LayersTable
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, Refreshable, java.io.Serializable, ViewPortListener

public class LayersTable
extends java.awt.Panel
implements Refreshable, ViewPortListener

This class represents the TOC (the list of layers in the curretn view/project) Keeps a reference to the MapControl and consists of a set of rows (class LayersTableItem), one for each layer. Changes in the order of the layers are performed by this class, and it calls the MapContext to perform the redrawing. On the right side of the TOC there are some buttons that act on the selected layer. The number of selected layers can be zero or one. The forst row of the table (the one with the names of the columns) is also a LayersTableItem, created with a different constructor.

Author:
jldominguez
See Also:
MapControl, ViewLayersGraphicStatus, LayersTableItem, Serialized Form

Field Summary
 
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
LayersTable(int w, MapControl mc)
          Constructor.
 
Method Summary
 int addItem(FLayer lyr, boolean title)
          Adfds a new layer to the TOC.
 void extentChanged(ExtentEvent e, boolean repaint)
          The TOC also listens to extent changes in the viewport, since the scale visibility icons need to be updated.
 FLayer[] getLayers()
          Get current layers.
 MapControl getMapControl()
           
 double getScale()
          Gets the current scale.
 int getSelectedIndex()
          Gets the index of the elected layer.
 int getWidth()
           
 boolean isProcessing()
          Unused.
 void moveSelectedDown()
           
 void moveSelectedUp()
          Moves up one position the selected layer.
 void paint(java.awt.Graphics g)
           
 void redraw(boolean clear)
          Unused.
 void refresh(boolean update)
          Unused.
 void removeItem(int one_based_ind)
          Removes i-th layer from the TOC
 boolean sameAsLastStore()
          Checks whether the symbology settings of the layers have changed.
 void setOffsetAndRefresh(int x, int y, boolean refresh)
          Unused.
 void setProcessing(boolean b)
          Unused.
 void storeStatus()
          Keeps a copy of the current graphic settings of the layers.
 void unselectAll()
          Unselects all layers.
 void updateItem(FLayer lyr)
          Updates row associated with a layer
 void updateScaleVisibilityIcons()
          Update scale visibility icons.
 void zoomToSelected()
          Performs a zoom to the extent of the selected layer.
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LayersTable

public LayersTable(int w,
                   MapControl mc)
Constructor.

Parameters:
w - width in pixels of the table.
mc - A reference to the MapControl
Method Detail

getScale

public double getScale()
Gets the current scale. The scale influences the TOC because there is an icon to show whether the current scale is within each layer's scale limits.

Returns:
the current scale (returns x when the scale is 1:x)

removeItem

public void removeItem(int one_based_ind)
Removes i-th layer from the TOC

Parameters:
one_based_ind - the index of the layer to be removed

unselectAll

public void unselectAll()
Unselects all layers.


addItem

public int addItem(FLayer lyr,
                   boolean title)
Adfds a new layer to the TOC.

Parameters:
lyr - the layer to be added
title - whether it's the false layer that works as the title. must be false when used normally
Returns:
the new layer count

getLayers

public FLayer[] getLayers()
Get current layers. Iterates the list of LayersTableItem, exclkuding the first one (title)

Returns:
array with current layers

storeStatus

public void storeStatus()
Keeps a copy of the current graphic settings of the layers. It is iused to check whether a repainting is needed after the user has accessed the symbology dialog of any layer.


sameAsLastStore

public boolean sameAsLastStore()
Checks whether the symbology settings of the layers have changed. That would trigger a redrawing of the view.

Returns:
whether the symbology settings of the layers have changed

refresh

public void refresh(boolean update)
Unused. Needed to implement interface Refreshable.

Specified by:
refresh in interface Refreshable
Parameters:
update - whether the object has to be updated (deeper refreshment)

redraw

public void redraw(boolean clear)
Unused. Needed to implement interface Refreshable.

Specified by:
redraw in interface Refreshable
Parameters:
clear - whether the object has to be cleared before drawing again

setOffsetAndRefresh

public void setOffsetAndRefresh(int x,
                                int y,
                                boolean refresh)
Unused. Needed to implement interface Refreshable.

Specified by:
setOffsetAndRefresh in interface Refreshable
Parameters:
x - new x offset
y - new y offset
refresh - whether a new refresh has to be done

setProcessing

public void setProcessing(boolean b)
Unused. Needed to implement interface Refreshable.

Specified by:
setProcessing in interface Refreshable
Parameters:
b -

isProcessing

public boolean isProcessing()
Unused. Needed to implement interface Refreshable.

Specified by:
isProcessing in interface Refreshable
Returns:
the value of the processing switch

paint

public void paint(java.awt.Graphics g)

updateScaleVisibilityIcons

public void updateScaleVisibilityIcons()
Update scale visibility icons. This is called when the extent changes.


updateItem

public void updateItem(FLayer lyr)
Updates row associated with a layer

Parameters:
lyr - layer whose row must be updated,

moveSelectedDown

public void moveSelectedDown()

moveSelectedUp

public void moveSelectedUp()
Moves up one position the selected layer.


getMapControl

public MapControl getMapControl()

getSelectedIndex

public int getSelectedIndex()
Gets the index of the elected layer.

Returns:
the index of the elected layer

getWidth

public int getWidth()

zoomToSelected

public void zoomToSelected()
Performs a zoom to the extent of the selected layer.


extentChanged

public void extentChanged(ExtentEvent e,
                          boolean repaint)
The TOC also listens to extent changes in the viewport, since the scale visibility icons need to be updated.

Specified by:
extentChanged in interface ViewPortListener