ilog.views.graphic
Class IlvShadowRectangle

java.lang.Object
  extended by ilog.views.IlvGraphic
      extended by ilog.views.graphic.IlvRectangle
          extended by ilog.views.graphic.IlvShadowRectangle
All Implemented Interfaces:
IlvPersistentObject, Transferable, Serializable
Direct Known Subclasses:
IlvShadowLabel

public class IlvShadowRectangle
extends IlvRectangle

IlvShadowRectangle represents a rectangle with a shadow.

The default values for an IlvShadowRectangle instance are as follows:

Note: calls to the following methods result in a RuntimeException being thrown:

Example

The following code example shows how to use an IlvShadowRectangle in a simple Java application:

  IlvManager manager = new IlvManager();
  IlvShadowRectangle myDefaultRect = new IlvShadowRectangle();
  
  IlvShadowRectangle myCustomRect = new IlvShadowRectangle(
                                  new IlvRect(60,90,80,20), 
                                  6, IlvConstants.TOP_LEFT);
  myCustomRect.setForeground(Color.blue);
  myCustomRect.setBackground(Color.yellow);
  
  manager.addObject( myDefaultRect, true);
  manager.addObject( myCustomRect, true);
 

The following image shows the graphic objects created in the code example:

About Graphic Objects

IlvShadowRectangle is a custom graphic object, that is, a subclass of IlvGraphic. Graphic objects are controlled using an IlvManager instance and displayed using one or more IlvManagerView instances in a Java Swing application. For information about generic features for graphic objects, see IlvGraphic.

See Also:
IlvRect, IlvManager, IlvManagerView, IlvConstants, Serialized Form

Field Summary
 
Fields inherited from class ilog.views.graphic.IlvRectangle
BOTTOM_LEFT, BOTTOM_RIGHT, drawrect, TOP_LEFT, TOP_RIGHT
 
Constructor Summary
IlvShadowRectangle()
          Creates a new IlvShadowRectangle with a (0, 0, 100, 100) definition rectangle, a thickness of 2 and a IlvConstants.BOTTOM_RIGHT shadow position.
IlvShadowRectangle(IlvInputStream stream)
          Reads the object from an IlvInputStream.
IlvShadowRectangle(IlvRect rect)
          Creates a new IlvShadowRectangle.
IlvShadowRectangle(IlvRect rect, float thickness, int shadowPosition)
          Creates a new IlvShadowRectangle.
IlvShadowRectangle(IlvShadowRectangle source)
          Creates a new IlvShadowRectangle by copying an existing one.
 
Method Summary
 IlvGraphic copy()
          Copies the object.
 void draw(Graphics dst, IlvTransformer t)
          Draws the object.
protected  void drawContent(Graphics dst, IlvRect rect, IlvTransformer t)
          Draws the content of the object.
 int getShadowPosition()
          Returns the position of the shadow.
 float getThickness()
          Returns the thickness of the shadow.
 void setCorners(int corners)
          On IlvShadowRectangle this method does nothing.
 void setFillOn(boolean value)
          On IlvShadowRectangle this method does nothing.
 void setRadius(int radius)
          On IlvShadowRectangle this method does nothing.
 void setShadowPosition(int shadowPosition)
          Changes the position of the shadow.
 void setStrokeOn(boolean value)
          On IlvShadowRectangle this method does nothing.
 void setThickness(float thickness)
          Changes the thickness of the shadow.
 void write(IlvOutputStream stream)
          Writes the object to an IlvOutputStream.
 
Methods inherited from class ilog.views.graphic.IlvRectangle
applyTransform, boundingBox, contains, getBackground, getCorners, getDefinitionRect, getForeground, getIntersectionWithOutline, getRadius, isCornersZoomable, isFillOn, isStrokeOn, moveResize, setBackground, setCornersZoomable, setDefinitionRect, setForeground, translate
 
Methods inherited from class ilog.views.IlvGraphic
addActionListener, addNamedPropertyListener, boundingBox, getAndAssociateObjectInteractor, getCenter, getDefaultInteractor, getGraphicBag, GetGraphicObject, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, hasProperty, inside, intersects, isDataFlavorSupported, isEditable, isInApplyToObject, isMovable, isPersistent, isSelectable, isVisible, makeSelection, move, move, notifyObjectInteractorToManager, processActionEvent, reDraw, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, rotate, scale, setEditable, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setToolTipText, setVisible, toString, zoomable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlvShadowRectangle

public IlvShadowRectangle()
Creates a new IlvShadowRectangle with a (0, 0, 100, 100) definition rectangle, a thickness of 2 and a IlvConstants.BOTTOM_RIGHT shadow position.

Since:
JViews 6.0
See Also:
IlvShadowRectangle(IlvRect, float, int)

IlvShadowRectangle

public IlvShadowRectangle(IlvRect rect,
                          float thickness,
                          int shadowPosition)
Creates a new IlvShadowRectangle.

Parameters:
rect - The definition rectangle of the object.
thickness - The thickness of the shadow.
shadowPosition - The position of the shadow. Valid values are IlvConstants.TOP_LEFT, IlvConstants.BOTTOM_LEFT, IlvConstants.TOP_RIGHT, or IlvConstants.BOTTOM_RIGHT.

IlvShadowRectangle

public IlvShadowRectangle(IlvRect rect)
Creates a new IlvShadowRectangle. The thickness is set to 5 and the shadow position to IlvConstants.BOTTOM_RIGHT.

Parameters:
rect - The definition rectangle of the object.

IlvShadowRectangle

public IlvShadowRectangle(IlvShadowRectangle source)
Creates a new IlvShadowRectangle by copying an existing one.

Parameters:
source - The copied object.

IlvShadowRectangle

public IlvShadowRectangle(IlvInputStream stream)
                   throws IlvReadFileException
Reads the object from an IlvInputStream.

Parameters:
stream - The input stream.
Throws:
IlvReadFileException - if the format is not correct.
IlvReadFileException
Method Detail

copy

public IlvGraphic copy()
Copies the object. This method copies the object by calling the copy constructor.

Overrides:
copy in class IlvRectangle
Returns:
A copy of the object.
See Also:
IlvGraphic

getShadowPosition

public int getShadowPosition()
Returns the position of the shadow. The return value is one of the following: IlvConstants.TOP_LEFT, IlvConstants.BOTTOM_LEFT, IlvConstants.TOP_RIGHT, IlvConstants.BOTTOM_RIGHT.


setShadowPosition

public void setShadowPosition(int shadowPosition)
Changes the position of the shadow.

Parameters:
shadowPosition - The new position of the shadow. Valid values are IlvConstants.TOP_LEFT, IlvConstants.BOTTOM_LEFT, or IlvConstants.TOP_RIGHT, IlvConstants.BOTTOM_RIGHT.

getThickness

public float getThickness()
Returns the thickness of the shadow.


setThickness

public void setThickness(float thickness)
Changes the thickness of the shadow.

Parameters:
thickness - The new thickness.

drawContent

protected void drawContent(Graphics dst,
                           IlvRect rect,
                           IlvTransformer t)
Draws the content of the object. This method is called by the method draw. The implementation is empty, but this method can be overridden to perform additional drawings inside the shadow rectangle.

Parameters:
dst - The Graphics to perform the drawing.
rect - The rectangle defining the inner part of the shadow rectangle (that is, the bounding box with the shadow removed). Note that this rectangle is already transformed by the transformer used to draw the object.
t - The transformer used to draw the object.

setRadius

public final void setRadius(int radius)
On IlvShadowRectangle this method does nothing.

Overrides:
setRadius in class IlvRectangle
Parameters:
radius - The new radius.
Since:
JViews 5.5
See Also:
IlvRectangle.getRadius(), IlvRectangle.getCorners(), IlvRectangle.setCornersZoomable(boolean)

setStrokeOn

public final void setStrokeOn(boolean value)
On IlvShadowRectangle this method does nothing.

Overrides:
setStrokeOn in class IlvRectangle
Parameters:
value - Set to true to enable the stroke in your customized graphic object.
Since:
JViews 5.5
See Also:
IlvRectangle.isStrokeOn()

setFillOn

public final void setFillOn(boolean value)
On IlvShadowRectangle this method does nothing.

Overrides:
setFillOn in class IlvRectangle
Parameters:
value - Set to true to enable the fill style for this graphic object.
Since:
JViews 5.5
See Also:
IlvRectangle.isFillOn()

setCorners

public final void setCorners(int corners)
On IlvShadowRectangle this method does nothing.

Overrides:
setCorners in class IlvRectangle
Parameters:
corners - A combination of the following values:
  • IlvRectangle.TOP_LEFT: top left corner.
  • IlvRectangle.TOP_RIGHT: top right corner.
  • IlvRectangle.BOTTOM_RIGHT: bottom right corner.
  • IlvRectangle.BOTTOM_LEFT: bottom left corner.
    Since:
    JViews 5.5
    See Also:
    IlvRectangle.getCorners(), IlvRectangle.setCornersZoomable(boolean), IlvRectangle.setRadius(int)

  • draw

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

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

    write

    public void write(IlvOutputStream stream)
               throws IOException
    Writes the object to an IlvOutputStream. Note that even if this is a public method, you should not call it directly. You should use the write methods of the manager.

    Specified by:
    write in interface IlvPersistentObject
    Overrides:
    write in class IlvRectangle
    Parameters:
    stream - The output stream.
    Throws:
    IOException - thrown when an exception occurs during the write operation for this object.


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