uci.gef
Class SelectionManager

java.lang.Object
  |
  +--uci.gef.SelectionManager

public class SelectionManager
extends Object
implements Serializable, KeyListener, MouseListener, MouseMotionListener

This class handles Manager selections. It is basically a collection of Selection instances. Most of its operations just dispatch the same operation to each of the Selection instances in turn.

The SelectionManager is also responsible for sending out GraphSelectionEvents to any GraphSelectionListeners that are registered.

See Also:
Selection, Serialized Form

Field Summary
protected  Editor _editor
           
protected  EventListenerList _listeners
           
protected  Vector _selections
          The collection of Selection instances
 
Constructor Summary
SelectionManager(Editor ed)
           
 
Method Summary
protected  void addAllFigs(Vector v)
           
protected  void addEnclosed(Vector affected, Fig f)
           
protected  void addFig(Fig f)
           
 void addGraphSelectionListener(GraphSelectionListener listener)
           
protected  void addSelection(Selection s)
          Add a new selection to the collection of selections
protected  void allDamaged()
           
 void cleanUp()
           
 boolean contains(int x, int y)
          Reply true iff the given point is inside one of the selected Fig's
 boolean contains(Selection s)
          Reply true if the given selection instance is part of my collection
 boolean containsFig(Fig f)
          Reply true if the given Fig is selected by any of my selection objects
 void damage()
          When the SelectionManager is damaged, that implies that each Selection should be damaged.
 void delete()
          When a multiple selection are deleted, each selection is deleted
 void deselect(Fig f)
          Deselect the given Fig
 void deselectAll()
           
 void dispose()
          When a multiple selection are deleted, each selection is deleted
 void dragHandle(int mx, int my, int an_x, int an_y, Handle h)
          If only one thing is selected, then it is possible to mouse on one of its handles, but if Manager things are selected, users can only drag the objects around
 void endTrans()
          End a transaction that damages all selected Fig's
 Selection findSelectionAt(int x, int y)
           
 Selection findSelectionFor(Fig f)
           
protected  void fireSelectionChanged()
           
 Rectangle getBounds()
           
 Rectangle getContentBounds()
           
 Vector getFigs()
          Reply the collection of all selected Fig's
 boolean getLocked()
           
 boolean hit(Rectangle r)
          Reply true iff the given point is inside one of the selected Fig's
 void hitHandle(Rectangle r, Handle h)
          If only one thing is selected, then it is possible to mouse on one of its handles, but if Manager things are selected, users can only drag the objects around
 void keyPressed(KeyEvent ke)
           
 void keyReleased(KeyEvent ke)
           
 void keyTyped(KeyEvent ke)
          When an event is passed to a multiple selection, try to pass it off to the first selection that will handle it.
static Selection makeSelectionFor(Fig f)
           
 void mouseClicked(MouseEvent me)
           
 void mouseDragged(MouseEvent me)
           
 void mouseEntered(MouseEvent me)
           
 void mouseExited(MouseEvent me)
           
 void mouseMoved(MouseEvent me)
           
 void mousePressed(MouseEvent me)
           
 void mouseReleased(MouseEvent me)
           
 void paint(Graphics g)
          Paint all selection objects
protected  void removeAllElements()
           
protected  void removeFig(Fig f)
           
 void removeGraphSelectionListener(GraphSelectionListener listener)
           
protected  void removeSelection(Selection s)
           
 void reorder(int func, Layer lay)
          When Manager selections are sent to back, each of them is sent to back.
 void select(Fig f)
           
 void select(Vector items)
           
 Vector selections()
           
 int size()
          Reply the number of selected Fig's.
 void startTrans()
          Start a transaction that damages all selected Fig's
 void toggle(Fig f)
           
 void toggle(Vector items)
           
 void translate(int dx, int dy)
          When Manager selections are moved, each of them is moved
 void updatePropertySheet()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_selections

protected Vector _selections
The collection of Selection instances

_editor

protected Editor _editor

_listeners

protected EventListenerList _listeners
Constructor Detail

SelectionManager

public SelectionManager(Editor ed)
Method Detail

addSelection

protected void addSelection(Selection s)
Add a new selection to the collection of selections

addFig

protected void addFig(Fig f)

addAllFigs

protected void addAllFigs(Vector v)

removeAllElements

protected void removeAllElements()

removeSelection

protected void removeSelection(Selection s)

removeFig

protected void removeFig(Fig f)

allDamaged

protected void allDamaged()

select

public void select(Fig f)

deselect

public void deselect(Fig f)
Deselect the given Fig

toggle

public void toggle(Fig f)

deselectAll

public void deselectAll()

select

public void select(Vector items)

toggle

public void toggle(Vector items)

findSelectionFor

public Selection findSelectionFor(Fig f)

findSelectionAt

public Selection findSelectionAt(int x,
                                 int y)

contains

public boolean contains(Selection s)
Reply true if the given selection instance is part of my collection

containsFig

public boolean containsFig(Fig f)
Reply true if the given Fig is selected by any of my selection objects

getLocked

public boolean getLocked()

size

public int size()
Reply the number of selected Fig's. This assumes that this collection holds only Selection instances and each of those holds one Fig

selections

public Vector selections()

getFigs

public Vector getFigs()
Reply the collection of all selected Fig's

startTrans

public void startTrans()
Start a transaction that damages all selected Fig's

endTrans

public void endTrans()
End a transaction that damages all selected Fig's

paint

public void paint(Graphics g)
Paint all selection objects

damage

public void damage()
When the SelectionManager is damaged, that implies that each Selection should be damaged.

contains

public boolean contains(int x,
                        int y)
Reply true iff the given point is inside one of the selected Fig's

hit

public boolean hit(Rectangle r)
Reply true iff the given point is inside one of the selected Fig's

getBounds

public Rectangle getBounds()

getContentBounds

public Rectangle getContentBounds()

reorder

public void reorder(int func,
                    Layer lay)
When Manager selections are sent to back, each of them is sent to back.

translate

public void translate(int dx,
                      int dy)
When Manager selections are moved, each of them is moved

addEnclosed

protected void addEnclosed(Vector affected,
                           Fig f)

hitHandle

public void hitHandle(Rectangle r,
                      Handle h)
If only one thing is selected, then it is possible to mouse on one of its handles, but if Manager things are selected, users can only drag the objects around

dragHandle

public void dragHandle(int mx,
                       int my,
                       int an_x,
                       int an_y,
                       Handle h)
If only one thing is selected, then it is possible to mouse on one of its handles, but if Manager things are selected, users can only drag the objects around

cleanUp

public void cleanUp()

delete

public void delete()
When a multiple selection are deleted, each selection is deleted

dispose

public void dispose()
When a multiple selection are deleted, each selection is deleted

keyTyped

public void keyTyped(KeyEvent ke)
When an event is passed to a multiple selection, try to pass it off to the first selection that will handle it.
Specified by:
keyTyped in interface KeyListener

keyReleased

public void keyReleased(KeyEvent ke)
Specified by:
keyReleased in interface KeyListener

keyPressed

public void keyPressed(KeyEvent ke)
Specified by:
keyPressed in interface KeyListener

mouseMoved

public void mouseMoved(MouseEvent me)
Specified by:
mouseMoved in interface MouseMotionListener

mouseDragged

public void mouseDragged(MouseEvent me)
Specified by:
mouseDragged in interface MouseMotionListener

mouseClicked

public void mouseClicked(MouseEvent me)
Specified by:
mouseClicked in interface MouseListener

mousePressed

public void mousePressed(MouseEvent me)
Specified by:
mousePressed in interface MouseListener

mouseReleased

public void mouseReleased(MouseEvent me)
Specified by:
mouseReleased in interface MouseListener

mouseExited

public void mouseExited(MouseEvent me)
Specified by:
mouseExited in interface MouseListener

mouseEntered

public void mouseEntered(MouseEvent me)
Specified by:
mouseEntered in interface MouseListener

addGraphSelectionListener

public void addGraphSelectionListener(GraphSelectionListener listener)

removeGraphSelectionListener

public void removeGraphSelectionListener(GraphSelectionListener listener)

fireSelectionChanged

protected void fireSelectionChanged()

updatePropertySheet

public void updatePropertySheet()

makeSelectionFor

public static Selection makeSelectionFor(Fig f)