fdda.graphics
Interface Selection

All Known Implementing Classes:
ComponentSelection

public interface Selection

The interface of the object which manages selected objects. If a class wants to modify the selection, it has to implement the tagging interface 'SelectionModifier'. Thus, a certain control over who modifies it can be maintained. Listeners can register themselves to be notified of selection changes (observer pattern).

Author:
Jörg Rüdenauer

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.
 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.
 Shape getShape()
          Returns the shape of the selection
 boolean hasElement(Component element)
          Returns whether a certain component is contained 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
 

Method Detail

add

public void add(SelectionListener l)
Adds a listener

Parameters:
l - the listener

remove

public void remove(SelectionListener l)
Removes a listener

Parameters:
l - the listener

getSelectionIterator

public Iterator getSelectionIterator()
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.

Returns:
an iterator

getSelectedComponent

public Component getSelectedComponent()
If exactly one component is selected, this component is returned, else null.

Returns:
the selected component or null

getShape

public Shape getShape()
Returns the shape of the selection

Returns:
the shape

addElement

public void addElement(Component element,
                       SelectionModifier sm)
Adds a component to the 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)
Removes a component from the selection

Parameters:
element - the component
sm - the object that wants to modify the selection (a small 'proof')

replaceWith

public void replaceWith(Component element,
                        SelectionModifier sm)
Replaces the current selection with another component

Parameters:
element - the component
sm - the object that wants to modify the selection (a small 'proof')

clear

public void clear(SelectionModifier sm)
Removes all components from the selection.

Parameters:
sm - the object that wants to modify the selection (a small 'proof')

hasElement

public boolean hasElement(Component element)
Returns whether a certain component is contained in the selection

Parameters:
element - the component
Returns:
true, iff the component is currently in the selection


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