org.vectomatic.client.rep.controller
Class ShapeSelection

java.lang.Object
  extended by org.vectomatic.client.rep.controller.ShapeSelection
All Implemented Interfaces:
EventListener, IDrawingModelListener

public class ShapeSelection
extends Object
implements IDrawingModelListener

Class to represent the currently selected shapes. Selected shapes are cloned and clones are accessed with getRootShape().

Author:
Lukas Laag

Constructor Summary
ShapeSelection(DrawingModel model)
           
 
Method Summary
 void addShapeSelectionListener(IShapeSelectionListener listener)
           
 void fireSelectionHasChanged()
           
 Shape getRootShape()
          Returns the clone of the currently selected shapes.
 List<Shape> getSelectedShapes()
          Returns a list which contains all the selected shapes.
 boolean hasAttributeChanged(Attribute attribute, IAttributeValue value)
           
 Iterator<Shape> iterator()
           
 void modelHasChanged(DrawingModel model)
          Listens to model change events.
 void removeShapeSelectionListener(IShapeSelectionListener listener)
           
 Shape select(List<Shape> shapes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShapeSelection

public ShapeSelection(DrawingModel model)
Method Detail

addShapeSelectionListener

public void addShapeSelectionListener(IShapeSelectionListener listener)

removeShapeSelectionListener

public void removeShapeSelectionListener(IShapeSelectionListener listener)

fireSelectionHasChanged

public void fireSelectionHasChanged()

getRootShape

public Shape getRootShape()
Returns the clone of the currently selected shapes. For mono selection, this is simply the selected shape clone. For multi selection, it is the temporary shape group which contains the clones of the selected shapes.


getSelectedShapes

public List<Shape> getSelectedShapes()
Returns a list which contains all the selected shapes. The list is immutable


select

public Shape select(List<Shape> shapes)
Parameters:
rootShape -

modelHasChanged

public void modelHasChanged(DrawingModel model)
Listens to model change events. Removal of a shape from the model causes the selection to be recomputed.

Specified by:
modelHasChanged in interface IDrawingModelListener

iterator

public Iterator<Shape> iterator()

hasAttributeChanged

public boolean hasAttributeChanged(Attribute attribute,
                                   IAttributeValue value)


Copyright © 2010. All Rights Reserved.