fdda.graphics.java2d
Class ComponentSelection

java.lang.Object
  |
  +--fdda.graphics.java2d.Component
        |
        +--fdda.graphics.java2d.Container
              |
              +--fdda.graphics.java2d.ComponentSelection
All Implemented Interfaces:
Cloneable, Component, Container, Selection

public class ComponentSelection
extends Container
implements Selection

Implementation of the selection interface as a Container subclass.

Author:
Jörg Rüdenauer

Nested Class Summary
(package private)  class ComponentSelection.SelectionIterator
          An iterator on the selection, not allowing any modifications.
 
Field Summary
 
Fields inherited from class fdda.graphics.java2d.Container
elements
 
Fields inherited from class fdda.graphics.java2d.Component
COLOR_NORMAL, COLOR_SELECTED, dirtyShape, selected, shape, x, y
 
Fields inherited from interface fdda.graphics.Component
SEL_ALL, SEL_EQUALS, SEL_MOVABLES, SEL_NOTHING
 
Constructor Summary
ComponentSelection()
          Constructor.
 
Method Summary
 void add(SelectionListener l)
          Adds a listener
 void addElement(Component element, SelectionModifier sm)
          Adds a component to the selection
 void clear(SelectionModifier sm)
          Removes all components from the selection.
protected  void fireSelectionChanged()
          Informs the listeners that the selection has changed
 Component getSelectedComponent()
          If exactly one component is selected, this component is returned, else null.
 Iterator getSelectionIterator()
          Returns an iterator over the components in the selection.
 void remove(SelectionListener l)
          Removes a listener
 void removeElement(Component element, SelectionModifier sm)
          Removes a component from the selection
 void replaceWith(Component element, SelectionModifier sm)
          Replaces the current selection with another component
 
Methods inherited from class fdda.graphics.java2d.Container
addElement, calcShape, clear, clone, deselect, draw, flatten, getIterator, getSize, getX, getY, hasElement, isFlatteningAllowed, isMovable, move, removeElement, select, selectableWith, setGraphicalSystem, visit
 
Methods inherited from class fdda.graphics.java2d.Component
getGraphicalSystem, getShape, isSelected, recalculateShape, setGraphicalSystem, setXY
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface fdda.graphics.Selection
getShape, hasElement
 
Methods inherited from interface fdda.graphics.Component
getGraphicalSystem, getShape, isSelected, recalculateShape, setGraphicalSystem, setXY
 

Constructor Detail

ComponentSelection

public ComponentSelection()
Constructor. The selection is initially empty.

Method Detail

add

public void add(SelectionListener l)
Description copied from interface: Selection
Adds a listener

Specified by:
add in interface Selection
Parameters:
l - the listener

remove

public void remove(SelectionListener l)
Description copied from interface: Selection
Removes a listener

Specified by:
remove in interface Selection
Parameters:
l - the listener

fireSelectionChanged

protected final void fireSelectionChanged()
Informs the listeners that the selection has changed


getSelectionIterator

public Iterator getSelectionIterator()
Description copied from interface: Selection
Returns an iterator over the components in the selection. The iterator is a constant iterator, i.e., you can't modify the selection through it.

Specified by:
getSelectionIterator in interface Selection
Returns:
an iterator

getSelectedComponent

public Component getSelectedComponent()
Description copied from interface: Selection
If exactly one component is selected, this component is returned, else null.

Specified by:
getSelectedComponent in interface Selection
Returns:
the selected component or null

addElement

public void addElement(Component element,
                       SelectionModifier sm)
Description copied from interface: Selection
Adds a component to the selection

Specified by:
addElement in interface Selection
Parameters:
element - the component
sm - the object that wants to modify the selection (a small 'proof')

removeElement

public void removeElement(Component element,
                          SelectionModifier sm)
Description copied from interface: Selection
Removes a component from the selection

Specified by:
removeElement in interface Selection
Parameters:
element - the component
sm - the object that wants to modify the selection (a small 'proof')

clear

public void clear(SelectionModifier sm)
Description copied from interface: Selection
Removes all components from the selection.

Specified by:
clear in interface Selection
Parameters:
sm - the object that wants to modify the selection (a small 'proof')

replaceWith

public void replaceWith(Component element,
                        SelectionModifier sm)
Description copied from interface: Selection
Replaces the current selection with another component

Specified by:
replaceWith in interface Selection
Parameters:
element - the component
sm - the object that wants to modify the selection (a small 'proof')


API documentation for FDDA version 0.9. Generated on 17/02/2004 14:12.