public class EditingCompoundBehavior extends CompoundBehavior
Modifier and Type | Field and Description |
---|---|
static int |
EDITING_INDEX |
static int |
SELECTION_INDEX |
BUTTON_LEFT, BUTTON_MIDDLE, BUTTON_RIGHT, geomManager, LOG
Constructor and Description |
---|
EditingCompoundBehavior(IBehavior editing) |
Modifier and Type | Method and Description |
---|---|
void |
addMapBehavior(Behavior mt,
boolean draw)
Adds a new behavior, setting if will be real-time (when user is working with it) drawn or not.
|
boolean |
containsBehavior(Behavior mt)
Searches for
mt , returning true if is contained. |
Behavior |
getBehavior(int index)
Returns the first-level
Behavior at the specified position. |
java.awt.Image |
getImageCursor()
Gets the mouse cursor of the tool listener associated to this behavior.
|
ToolListener |
getListener()
Gets the
ToolListener used by this behavior to perform actions on the
associated MapControl object. |
boolean |
isDrawnBehavior(int index)
Returns if it's invoked the method
public void paintComponent(Graphics g) of the
first-level Behavior at the specified position, each time is painted this component. |
void |
mouseClicked(java.awt.event.MouseEvent e) |
void |
mouseDragged(java.awt.event.MouseEvent e) |
void |
mouseEntered(java.awt.event.MouseEvent e) |
void |
mouseExited(java.awt.event.MouseEvent e) |
void |
mouseMoved(java.awt.event.MouseEvent e) |
void |
mousePressed(java.awt.event.MouseEvent e) |
void |
mouseReleased(java.awt.event.MouseEvent e) |
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent e) |
void |
paintComponent(MapControlDrawer renderer)
Method executed in real-time, when user is working with a tool on the associated
MapControl
object, repainting the MapControl 's image. |
void |
paintComponent(MapControlDrawer renderer,
boolean clean) |
void |
removeMapBehavior(Behavior mt)
Removes a
Behavior that composes this one. |
void |
setDrawnBehavior(int index,
boolean draw)
Sets if will be invoked the method
public void paintComponent(Graphics g) of the
first-level Behavior at the specified position, each time is painted this component. |
void |
setListener(ToolListener listener)
Sets a tool listener to work with a
MapControl instance using these behaviors. |
void |
setMapControl(MapControl mc)
Associates this behavior to a
MapControl object. |
int |
size()
Returns the number of first-level
Behavior s in this CompoundBehavior . |
getAllControlsBehavior, iterator, setAllControlsBehavior
clean, createArc, createArc, createArc, createCircle, createEllipse, createPoint, createPoint, getMapControl, getUseSnapping, isMyButton, isMyButton, resetMyButton, setUseSnapping
public static final int EDITING_INDEX
public static final int SELECTION_INDEX
public EditingCompoundBehavior(IBehavior editing)
public void addMapBehavior(Behavior mt, boolean draw)
CompoundBehavior
Adds a new behavior, setting if will be real-time (when user is working with it) drawn or not.
When user works with a compound behavior, he/she will see on real-time the graphical changes produced at
the associated MapControl
, only by those which have their associated draw flag to true
.
addMapBehavior
in class CompoundBehavior
mt
- the new behaviordraw
- flag determining if will be real-time drawn or nopublic void removeMapBehavior(Behavior mt)
CompoundBehavior
Removes a Behavior
that composes this one.
removeMapBehavior
in class CompoundBehavior
mt
- the Behavior
to be removedpublic boolean containsBehavior(Behavior mt)
CompoundBehavior
Searches for mt
, returning true
if is contained.
containsBehavior
in class CompoundBehavior
mt
- the behavior to searchtrue
if is contained; otherwise false
public Behavior getBehavior(int index)
CompoundBehavior
Returns the first-level Behavior
at the specified position.
getBehavior
in class CompoundBehavior
index
- index of element to returnpublic boolean isDrawnBehavior(int index)
CompoundBehavior
Returns if it's invoked the method public void paintComponent(Graphics g)
of the
first-level Behavior
at the specified position, each time is painted this component.
isDrawnBehavior
in class CompoundBehavior
index
- index of elementtrue
if it's invoked the method public void paintComponent(Graphics g)
of the
first-level Behavior
at the specified position, each time is painted this component, otherwise
false
.public void setDrawnBehavior(int index, boolean draw)
CompoundBehavior
Sets if will be invoked the method public void paintComponent(Graphics g)
of the
first-level Behavior
at the specified position, each time is painted this component.
setDrawnBehavior
in class CompoundBehavior
index
- index of elementpublic int size()
CompoundBehavior
Returns the number of first-level Behavior
s in this CompoundBehavior
.
size
in class CompoundBehavior
Behavior
s in this CompoundBehavior
public java.awt.Image getImageCursor()
IBehavior
Gets the mouse cursor of the tool listener associated to this behavior.
getImageCursor
in interface IBehavior
getImageCursor
in class CompoundBehavior
public void mouseClicked(java.awt.event.MouseEvent e) throws BehaviorException
mouseClicked
in interface IBehavior
mouseClicked
in class CompoundBehavior
BehaviorException
- any exception processing the action associated to a mouse clicked event, by the IBehavior
objectMouseListener.mouseClicked(java.awt.event.MouseEvent)
public void mouseDragged(java.awt.event.MouseEvent e) throws BehaviorException
mouseDragged
in interface IBehavior
mouseDragged
in class CompoundBehavior
BehaviorException
- any exception processing the action associated to a mouse dragged event, by the IBehavior
objectMouseMotionListener.mouseDragged(java.awt.event.MouseEvent)
public void mouseEntered(java.awt.event.MouseEvent e) throws BehaviorException
mouseEntered
in interface IBehavior
mouseEntered
in class CompoundBehavior
BehaviorException
- any exception processing the action associated to a mouse entered event, by the IBehavior
objectMouseListener.mouseEntered(java.awt.event.MouseEvent)
public void mouseExited(java.awt.event.MouseEvent e) throws BehaviorException
mouseExited
in interface IBehavior
mouseExited
in class CompoundBehavior
BehaviorException
- any exception processing the action associated to a mouse exited event, by the IBehavior
objectMouseListener.mouseExited(java.awt.event.MouseEvent)
public void mouseMoved(java.awt.event.MouseEvent e) throws BehaviorException
mouseMoved
in interface IBehavior
mouseMoved
in class CompoundBehavior
BehaviorException
- any exception processing the action associated to a mouse moved event, by the IBehavior
objectMouseMotionListener.mouseMoved(java.awt.event.MouseEvent)
public void mousePressed(java.awt.event.MouseEvent e) throws BehaviorException
mousePressed
in interface IBehavior
mousePressed
in class CompoundBehavior
BehaviorException
- any exception processing the action associated to a mouse pressed event, by the IBehavior
objectMouseListener.mousePressed(java.awt.event.MouseEvent)
public void mouseReleased(java.awt.event.MouseEvent e) throws BehaviorException
mouseReleased
in interface IBehavior
mouseReleased
in class CompoundBehavior
BehaviorException
- any exception processing the action associated to a mouse released event, by the IBehavior
objectMouseListener.mouseReleased(java.awt.event.MouseEvent)
public void mouseWheelMoved(java.awt.event.MouseWheelEvent e) throws BehaviorException
mouseWheelMoved
in interface IBehavior
mouseWheelMoved
in class CompoundBehavior
BehaviorException
- any exception processing the action associated to a mouse wheel event, by the IBehavior
objectMouseWheelListener.mouseWheelMoved(java.awt.event.MouseWheelEvent)
public void paintComponent(MapControlDrawer renderer, boolean clean)
paintComponent
in class CompoundBehavior
public void paintComponent(MapControlDrawer renderer)
IBehavior
Method executed in real-time, when user is working with a tool on the associated MapControl
object, repainting the MapControl
's image.
Returns immediately in all cases, even if the complete image has not yet been loaded.
This method will be implemented according to the specific nature of each behavior, and its extra and particular features.
paintComponent
in interface IBehavior
paintComponent
in class CompoundBehavior
Graphics.drawImage(java.awt.Image, int, int, java.awt.image.ImageObserver)
public void setListener(ToolListener listener)
CompoundBehavior
MapControl
instance using these behaviors.setListener
in class CompoundBehavior
listener
- a RectangleListener
object for this behaviorpublic ToolListener getListener()
IBehavior
Gets the ToolListener
used by this behavior to perform actions on the
associated MapControl
object.
getListener
in interface IBehavior
getListener
in class CompoundBehavior
ToolListener
used by this behaviorpublic void setMapControl(MapControl mc)
IBehavior
Associates this behavior to a MapControl
object.
setMapControl
in interface IBehavior
setMapControl
in class CompoundBehavior
mc
- the MapControl
object to associateIBehavior.getMapControl()