ilog.views
Class IlvDrawSelection

java.lang.Object
  extended by ilog.views.IlvGraphic
      extended by ilog.views.IlvSelection
          extended by ilog.views.IlvHandlesSelection
              extended by ilog.views.IlvDrawSelection
All Implemented Interfaces:
IlvPersistentObject, Transferable, Serializable
Direct Known Subclasses:
IlvTextSelection, IlvUnresizeableDrawSelection

public class IlvDrawSelection
extends IlvHandlesSelection

The IlvDrawSelection class is the default selection object for graphic objects. This class draws eight handles around the bounding rectangle of an object to show that it is selected. There are four handles on each corner of the bounding rectangle and four handles in the middle of each side. The interactor allows you to reshape the object by dragging a handle, unless the method supportsResize() returns false.

Version:
1.0 12/30/96
See Also:
Serialized Form

Field Summary
 
Fields inherited from class ilog.views.IlvHandlesSelection
CIRCLE_SHAPE, defaultHandleBackgroundColor, defaultHandleColor, defaultHandleShape, defaultHandleSize, FILLED_CIRCLE_SHAPE, FILLED_SQUARE_SHAPE, SQUARE_SHAPE
 
Constructor Summary
IlvDrawSelection(IlvGraphic obj)
          Creates a new selection object.
 
Method Summary
 IlvRect boundingBox(IlvTransformer t)
          Returns the bounding box of the object.
 int direction(IlvPoint tp, IlvTransformer t)
          Returns the direction corresponding to a specified point.
 void draw(Graphics dst, IlvTransformer t)
          Draws the object.
 int getHandle(IlvPoint p, IlvTransformer t)
          Searches for a handle located at point p, when the object is drawn with the transformer t.
 IlvPoint getHandle(int i, IlvTransformer t)
          Returns the location of a handle.
 int getHandleCardinal()
          Returns the number of handles (the number here is 8).
protected  IlvRect getHandlesRectangle(IlvTransformer t)
          Returns the rectangle on which the handles are located.
 boolean isOptimizedDrawingEnabled()
          Returns true if the drawing optimization is enabled for the selected graphic object.
 boolean supportsResize()
          Returns true if this object allows resizing of the selected graphic object.
 
Methods inherited from class ilog.views.IlvHandlesSelection
afterLoopAllHandles, beforeLoopAllHandles, contains, drawWithoutHandles, getActiveHandlesColor, getHandlesColor, getHandlesShape, getHandlesSize, isActive, onEnter, onExit, setActiveHandlesColor, setHandlesColor, setHandlesShape, setHandlesSize, zoomable
 
Methods inherited from class ilog.views.IlvSelection
applyTransform, copy, getDefaultInteractor, getObject, isVisible, SetDefaultInteractor
 
Methods inherited from class ilog.views.IlvGraphic
addActionListener, addNamedPropertyListener, boundingBox, getAndAssociateObjectInteractor, getCenter, getGraphicBag, GetGraphicObject, getIntersectionWithOutline, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, hasProperty, inside, intersects, isDataFlavorSupported, isEditable, isInApplyToObject, isMovable, isPersistent, isSelectable, makeSelection, move, move, moveResize, notifyObjectInteractorToManager, processActionEvent, reDraw, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, rotate, scale, setBackground, setEditable, setFillOn, setForeground, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipText, setVisible, toString, translate, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlvDrawSelection

public IlvDrawSelection(IlvGraphic obj)
Creates a new selection object.

Parameters:
obj - The selected object.
Method Detail

direction

public int direction(IlvPoint tp,
                     IlvTransformer t)
Returns the direction corresponding to a specified point. If the point is on a handle, then the method returns the direction of the handle; otherwise it returns IlvConstants.BAD.

Parameters:
tp - The point.
t - The transformer used to draw the object.
See Also:
IlvConstants

getHandleCardinal

public int getHandleCardinal()
Returns the number of handles (the number here is 8).

Specified by:
getHandleCardinal in class IlvHandlesSelection

getHandle

public int getHandle(IlvPoint p,
                     IlvTransformer t)
Searches for a handle located at point p, when the object is drawn with the transformer t.

Overrides:
getHandle in class IlvHandlesSelection
Returns:
The index of the handle, or -1 if no handle was found.

getHandlesRectangle

protected IlvRect getHandlesRectangle(IlvTransformer t)
Returns the rectangle on which the handles are located. The default implementation returns the rectangle computed by the method IlvGraphic.boundingBox(IlvTransformer), called on the selected object.

The method can be overridden by subclasses to indicate that the base rectangle of the handles must be different from the bounding box of the object. If the rectangle returned by the overridden implementation does not completely contain the bounding box of the object, the method isOptimizedDrawingEnabled() must also be overridden to return always false.

Since:
JViews 5.0

getHandle

public IlvPoint getHandle(int i,
                          IlvTransformer t)
Returns the location of a handle.

Specified by:
getHandle in class IlvHandlesSelection
Parameters:
i - The index of the handle.
t - The transformer through which the object is drawn.

boundingBox

public IlvRect boundingBox(IlvTransformer t)
Returns the bounding box of the object.

Overrides:
boundingBox in class IlvHandlesSelection
Parameters:
t - The transformer used to draw the object. If the transformer is null, the bounding box for the identity transformer is returned.
See Also:
IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer), IlvGraphic.zoomable(), IlvGraphic

draw

public void draw(Graphics dst,
                 IlvTransformer t)
Draws the object.

Overrides:
draw in class IlvHandlesSelection
Parameters:
dst - The destination Graphics.
t - The transformation used to draw the object.
See Also:
IlvGraphic.boundingBox(ilog.views.IlvTransformer), IlvGraphic.zoomable(), IlvGraphic

isOptimizedDrawingEnabled

public boolean isOptimizedDrawingEnabled()
Returns true if the drawing optimization is enabled for the selected graphic object. Returns false otherwise.

The default implementation returns always true.

The method must be overridden to return always false if the method getHandlesRectangle(ilog.views.IlvTransformer) is overridden and returns a rectangle which does not completely contain the bounding box of the selected object.

Overrides:
isOptimizedDrawingEnabled in class IlvSelection
Since:
JViews 5.0

supportsResize

public boolean supportsResize()
Returns true if this object allows resizing of the selected graphic object. Returns false otherwise.

The default implementation always returns true. Subclasses can override this method to deal with unresizeable graphic objects.

Since:
JViews 5.0


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.