org.argouml.uml.diagram.ui
Class SelectionWButtons

java.lang.Object
  extended byorg.tigris.gef.base.Selection
      extended byorg.tigris.gef.base.SelectionResize
          extended byorg.argouml.uml.diagram.ui.SelectionNodeClarifiers
              extended byorg.argouml.uml.diagram.ui.SelectionWButtons
All Implemented Interfaces:
java.util.EventListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable
Direct Known Subclasses:
SelectionActionState, SelectionActor, SelectionClass, SelectionClassifierRole, SelectionComponent, SelectionComponentInstance, SelectionInterface, SelectionNode, SelectionNodeInstance, SelectionObject, SelectionState, SelectionUseCase

public abstract class SelectionWButtons
extends SelectionNodeClarifiers

See Also:
Serialized Form

Field Summary
protected  boolean _paintButtons
           
private  int _placeCounter
          Counter for counting the number of times there has been a try to place a fig.
protected  int _pressedButton
           
static boolean _showRapidButtons
           
static int IMAGE_SIZE
           
static int MARGIN
           
private static int MAX_PLACINGS
          The maximum number of tries to place a fig.
static int Num_Button_Clicks
           
static java.awt.Color PRESSED_COLOR
           
 
Fields inherited from class org.tigris.gef.base.SelectionResize
 
Fields inherited from class org.tigris.gef.base.Selection
_content, BORDER_WIDTH, HAND_SIZE
 
Constructor Summary
SelectionWButtons(org.tigris.gef.presentation.Fig f)
          Construct a new SelectionWButtons for the given Fig
 
Method Summary
 void buttonClicked(int buttonCode)
           
protected  java.lang.Object createEdgeAbove(org.tigris.gef.graph.MutableGraphModel gm, java.lang.Object newNode)
          Subclasses should override this method if they want to provide a quickbutton above the _content fig.
protected  java.lang.Object createEdgeLeft(org.tigris.gef.graph.MutableGraphModel gm, java.lang.Object newNode)
          Subclasses should override this method if they want to provide a quickbutton at the left of the _content fig.
protected  java.lang.Object createEdgeRight(org.tigris.gef.graph.MutableGraphModel gm, java.lang.Object newNode)
          Subclasses should override this method if they want to provide a quickbutton at the right of the _content fig.
protected  java.lang.Object createEdgeToSelf(org.tigris.gef.graph.MutableGraphModel gm)
          Subclasses should override this method if they want to provide a quickbutton for selfassociation.
protected  java.lang.Object createEdgeUnder(org.tigris.gef.graph.MutableGraphModel gm, java.lang.Object newNode)
          Subclasses should override this method if they want to provide a quickbutton under the _content fig.
 java.awt.Rectangle getBounds()
           
protected abstract  java.lang.Object getNewNode(int buttonCode)
          Implementors should return a new node for adding via the buttons.
 void hideButtons()
          Dont show buttons while the user is moving the Class.
 boolean hitAbove(int x, int y, int w, int h, java.awt.Rectangle r)
           
 boolean hitBelow(int x, int y, int w, int h, java.awt.Rectangle r)
           
 boolean hitLeft(int x, int y, int w, int h, java.awt.Rectangle r)
           
 boolean hitRight(int x, int y, int w, int h, java.awt.Rectangle r)
           
 boolean intersectsRect(java.awt.Rectangle r, int x, int y, int w, int h)
           
 void mouseEntered(java.awt.event.MouseEvent me)
           
 void mouseExited(java.awt.event.MouseEvent me)
           
 void mousePressed(java.awt.event.MouseEvent me)
           
 void mouseReleased(java.awt.event.MouseEvent me)
           
 void paint(java.awt.Graphics g)
          Paint the handles at the four corners and midway along each edge of the bounding box.
 void paintButton(javax.swing.Icon i, java.awt.Graphics g, int x, int y, int hi)
           
 void paintButtonAbove(javax.swing.Icon i, java.awt.Graphics g, int x, int y, int hi)
           
 void paintButtonBelow(javax.swing.Icon i, java.awt.Graphics g, int x, int y, int hi)
           
 void paintButtonLeft(javax.swing.Icon i, java.awt.Graphics g, int x, int y, int hi)
           
 void paintButtonRight(javax.swing.Icon i, java.awt.Graphics g, int x, int y, int hi)
           
abstract  void paintButtons(java.awt.Graphics g)
           
protected  boolean placeFig(org.tigris.gef.presentation.Fig figToPlace, org.tigris.gef.base.LayerPerspective layerToPlaceOn, int x, int y, java.awt.Rectangle bumpRect)
          Places a fig on the canvas in the correct position.
static void toggleShowRapidButtons()
           
 
Methods inherited from class org.tigris.gef.base.SelectionResize
dragHandle, hitHandle
 
Methods inherited from class org.tigris.gef.base.Selection
contains, contains, contains, damage, delete, dispose, endTrans, getContent, getContentBounds, getLocation, getLocked, hit, hitHandle, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseMoved, print, reorder, setcontent, stuffBounds, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IMAGE_SIZE

public static final int IMAGE_SIZE
See Also:
Constant Field Values

MARGIN

public static final int MARGIN
See Also:
Constant Field Values

PRESSED_COLOR

public static final java.awt.Color PRESSED_COLOR

MAX_PLACINGS

private static final int MAX_PLACINGS
The maximum number of tries to place a fig.

See Also:
Constant Field Values

Num_Button_Clicks

public static int Num_Button_Clicks

_showRapidButtons

public static boolean _showRapidButtons

_paintButtons

protected boolean _paintButtons

_pressedButton

protected int _pressedButton

_placeCounter

private int _placeCounter
Counter for counting the number of times there has been a try to place a fig.

Constructor Detail

SelectionWButtons

public SelectionWButtons(org.tigris.gef.presentation.Fig f)
Construct a new SelectionWButtons for the given Fig

Method Detail

toggleShowRapidButtons

public static void toggleShowRapidButtons()

hitAbove

public boolean hitAbove(int x,
                        int y,
                        int w,
                        int h,
                        java.awt.Rectangle r)

hitBelow

public boolean hitBelow(int x,
                        int y,
                        int w,
                        int h,
                        java.awt.Rectangle r)

hitLeft

public boolean hitLeft(int x,
                       int y,
                       int w,
                       int h,
                       java.awt.Rectangle r)

hitRight

public boolean hitRight(int x,
                        int y,
                        int w,
                        int h,
                        java.awt.Rectangle r)

intersectsRect

public boolean intersectsRect(java.awt.Rectangle r,
                              int x,
                              int y,
                              int w,
                              int h)

paint

public void paint(java.awt.Graphics g)
Paint the handles at the four corners and midway along each edge of the bounding box.

Overrides:
paint in class SelectionNodeClarifiers

paintButtons

public abstract void paintButtons(java.awt.Graphics g)

paintButtonAbove

public void paintButtonAbove(javax.swing.Icon i,
                             java.awt.Graphics g,
                             int x,
                             int y,
                             int hi)

paintButtonBelow

public void paintButtonBelow(javax.swing.Icon i,
                             java.awt.Graphics g,
                             int x,
                             int y,
                             int hi)

paintButtonLeft

public void paintButtonLeft(javax.swing.Icon i,
                            java.awt.Graphics g,
                            int x,
                            int y,
                            int hi)

paintButtonRight

public void paintButtonRight(javax.swing.Icon i,
                             java.awt.Graphics g,
                             int x,
                             int y,
                             int hi)

paintButton

public void paintButton(javax.swing.Icon i,
                        java.awt.Graphics g,
                        int x,
                        int y,
                        int hi)

getBounds

public java.awt.Rectangle getBounds()

hideButtons

public void hideButtons()
Dont show buttons while the user is moving the Class. Called from FigClass when it is translated.


buttonClicked

public void buttonClicked(int buttonCode)

mousePressed

public void mousePressed(java.awt.event.MouseEvent me)

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent me)

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent me)

mouseExited

public void mouseExited(java.awt.event.MouseEvent me)

placeFig

protected boolean placeFig(org.tigris.gef.presentation.Fig figToPlace,
                           org.tigris.gef.base.LayerPerspective layerToPlaceOn,
                           int x,
                           int y,
                           java.awt.Rectangle bumpRect)
Places a fig on the canvas in the correct position. Takes a coordinate pair x,y and a rectangle that should be avoided because there can be other figures. If the place action results in x.y coordinates for the fig to place that are not allowed (beyond the borders of the diagram), the operation is repeated with corrected parameters. If it is not possible to add the fig because there are allready to many figs, false is returned and the fig is not added.

Parameters:
figToPlace - The figure one wishes to place on a diagram
layerToPlaceOn - The layer that contains the figs
x - The x coordinate where one wishes to place the fig
y - The y coordinate where one wishes to place the fig
bumpRect - The rectangle that should be avoided since there can be other figs.
Returns:
boolean false if the fig is not placed.

getNewNode

protected abstract java.lang.Object getNewNode(int buttonCode)
Implementors should return a new node for adding via the buttons.


createEdgeAbove

protected java.lang.Object createEdgeAbove(org.tigris.gef.graph.MutableGraphModel gm,
                                           java.lang.Object newNode)
Subclasses should override this method if they want to provide a quickbutton above the _content fig. This method returns the edge (modelelement) that should be drawn in the case such a quickbutton was pressed.

Parameters:
gm -
newNode - The node (modelelement) created by pressing the quickbutton
Returns:
Object The new edge

createEdgeLeft

protected java.lang.Object createEdgeLeft(org.tigris.gef.graph.MutableGraphModel gm,
                                          java.lang.Object newNode)
Subclasses should override this method if they want to provide a quickbutton at the left of the _content fig. This method returns the edge (modelelement) that should be drawn in the case such a quickbutton was pressed.

Parameters:
gm -
newNode - The node (modelelement) created by pressing the quickbutton
Returns:
Object The new edge

createEdgeRight

protected java.lang.Object createEdgeRight(org.tigris.gef.graph.MutableGraphModel gm,
                                           java.lang.Object newNode)
Subclasses should override this method if they want to provide a quickbutton at the right of the _content fig. This method returns the edge (modelelement) that should be drawn in the case such a quickbutton was pressed.

Parameters:
gm -
newNode - The node (modelelement) created by pressing the quickbutton
Returns:
Object The new edge

createEdgeUnder

protected java.lang.Object createEdgeUnder(org.tigris.gef.graph.MutableGraphModel gm,
                                           java.lang.Object newNode)
Subclasses should override this method if they want to provide a quickbutton under the _content fig. This method returns the edge (modelelement) that should be drawn in the case such a quickbutton was pressed.

Parameters:
gm -
newNode - The node (modelelement) created by pressing the quickbutton
Returns:
Object The new edge

createEdgeToSelf

protected java.lang.Object createEdgeToSelf(org.tigris.gef.graph.MutableGraphModel gm)
Subclasses should override this method if they want to provide a quickbutton for selfassociation. This method returns the edge (modelelement) that should be drawn in the case such a quickbutton was pressed.

Parameters:
gm -
Returns:
Object The new edge


ArgoUML © 1996-2004 (20040316)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook