ilog.views.graphic
Class IlvTextSelection

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

public class IlvTextSelection
extends IlvDrawSelection

This is the selection object for graphic objects implementing IlvTextInterface. This object gives a visual feedback by showing the selected characters with a different background color and a caret to indicate the current insert position.

This selection object works closely with IlvTextEditor and allows users to do in-place WYSIWYG editing.

Since:
JViews 7.5
See Also:
IlvTextEditor, Serialized Form

Nested Class Summary
static class IlvTextSelection.Range
          This inner class is used to indicate the selection interval while editing a graphic object implementing IlvTextInterface.
 
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
IlvTextSelection(IlvGraphic graphic)
          Creates an IlvTextSelection for the specified IlvTextInterface.
IlvTextSelection(IlvGraphic graphic, boolean resizable)
          Creates an IlvTextSelection for the specified IlvTextInterface.
IlvTextSelection(IlvGraphic graphic, boolean resizable, boolean editable)
          Creates an IlvTextSelection for the specified IlvTextInterface.
 
Method Summary
 IlvRect boundingBox(IlvTransformer t)
          Returns the bounding rectangle of the object.
 boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
          Tests if a point lies within the outline of the object.
 void draw(Graphics dst, IlvTransformer t)
          Draws the selection.
 void drawWithoutHandles(Graphics dst, IlvTransformer t)
          Draws the decorations without the handles.
 String getDefaultInteractor()
          Returns the class name of IlvTextEditor.
 IlvTextSelection.Range getRange()
          Gets the range indicating the selection or the insert position.
 boolean isOnBorder(IlvPoint click, IlvTransformer t)
          This function is used to test if the click point is on the border of the selection object.
 void setRange(IlvTextSelection.Range range)
          Sets the selection range.
 void setResizable(boolean resizable)
          Defines that if users can use this selection object to resize the selected text object.
 boolean supportsResize()
          Returns true if this object allows resizing of the selected graphic object.
 
Methods inherited from class ilog.views.IlvDrawSelection
direction, getHandle, getHandle, getHandleCardinal, getHandlesRectangle, isOptimizedDrawingEnabled
 
Methods inherited from class ilog.views.IlvHandlesSelection
afterLoopAllHandles, beforeLoopAllHandles, getActiveHandlesColor, getHandlesColor, getHandlesShape, getHandlesSize, isActive, onEnter, onExit, setActiveHandlesColor, setHandlesColor, setHandlesShape, setHandlesSize, zoomable
 
Methods inherited from class ilog.views.IlvSelection
applyTransform, copy, 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

IlvTextSelection

public IlvTextSelection(IlvGraphic graphic)
Creates an IlvTextSelection for the specified IlvTextInterface.

Parameters:
graphic - The graphic object to be edited and must implement IlvTextInterface.

IlvTextSelection

public IlvTextSelection(IlvGraphic graphic,
                        boolean resizable)
Creates an IlvTextSelection for the specified IlvTextInterface.

Parameters:
graphic - The graphic object to be edited and must implement IlvTextInterface.
resizable - Indicates whether this selection object can be used to resize the selected text object. The default is True.

IlvTextSelection

public IlvTextSelection(IlvGraphic graphic,
                        boolean resizable,
                        boolean editable)
Creates an IlvTextSelection for the specified IlvTextInterface.

Parameters:
graphic - The graphic object to be edited and must implement IlvTextInterface.
resizable - Indicates whether this selection object can be used to resize the selected text object. The default is True.
editable - Specifies whether the selected text can be edited. The default is True.
Method Detail

setResizable

public void setResizable(boolean resizable)
Defines that if users can use this selection object to resize the selected text object. For example, an IlvLabel is not resizable.

Parameters:
resizable - Indicates whether the selected text object is resizable.
See Also:
supportsResize()

supportsResize

public boolean supportsResize()
Returns true if this object allows resizing of the selected graphic object. Returns false otherwise. For example, an IlvLabel is not resizable.

Overrides:
supportsResize in class IlvDrawSelection
See Also:
setResizable(boolean)

getRange

public IlvTextSelection.Range getRange()
Gets the range indicating the selection or the insert position. If the range is collapsed, it indicates the insert position.

Returns:
The range indicates the selection or the insert position.
See Also:
setRange(ilog.views.graphic.IlvTextSelection.Range), IlvTextSelection.Range

setRange

public void setRange(IlvTextSelection.Range range)
Sets the selection range.

Parameters:
range - The selection range, if collapsed, indicates the insert position.
See Also:
IlvTextSelection.Range, getRange()

boundingBox

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

Overrides:
boundingBox in class IlvDrawSelection
Parameters:
t - The transformer used to draw the object. The value null can be used for the identity transformer.
See Also:
IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer), IlvGraphic.zoomable(), IlvGraphic

contains

public boolean contains(IlvPoint p,
                        IlvPoint tp,
                        IlvTransformer t)
Tests if a point lies within the outline of the object.

Overrides:
contains in class IlvHandlesSelection
Parameters:
p - The point to be tested.
tp - The point p transformed by the transformer t.
t - The transformation used to draw the object.
Returns:
true if the point lies inside this graphic object.
See Also:
IlvGraphic

isOnBorder

public boolean isOnBorder(IlvPoint click,
                          IlvTransformer t)
This function is used to test if the click point is on the border of the selection object. This function is used when users want to move the selected text object.

Parameters:
click - The point position in view coordinates.
t - The transformer of the view.
Returns:
True, if the point is on the borders or the selection object..

draw

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

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

drawWithoutHandles

public void drawWithoutHandles(Graphics dst,
                               IlvTransformer t)
Draws the decorations without the handles.

Overrides:
drawWithoutHandles in class IlvHandlesSelection
Parameters:
dst - The destination Graphics.
t - The transformation used to draw the object.
Since:
JViews 8.0

getDefaultInteractor

public String getDefaultInteractor()
Returns the class name of IlvTextEditor.

Overrides:
getDefaultInteractor in class IlvSelection
See Also:
IlvTextEditor


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