ilog.views
Class IlvHoverHighlightingImageOperation

java.lang.Object
  extended by ilog.views.IlvObjectInteractor
      extended by ilog.views.IlvHoverHighlightingImageOperation
All Implemented Interfaces:
Serializable

public class IlvHoverHighlightingImageOperation
extends IlvObjectInteractor

The hover highlighting image operation allows you to highlight a graphic object when the mouse hovers on it. To specify the image operation, use the method IlvManager.setHoverHighlightingImageOperation(IlvHoverHighlightingImageOperation).

This class allows you to choose an image operation and the transparency level, applied to the normal rendering of the object, to be used when displaying the highlighted graphic object. The highlighted object is drawn in a (transparent) buffered image on which the image operation is applied before being displayed on the view.

Since:
JViews 8.1
See Also:
Serialized Form

Nested Class Summary
static interface IlvHoverHighlightingImageOperation.Filter
          Inner interface that serves to filter the highlighted graphic objects.
static class IlvHoverHighlightingImageOperation.GraphicBagFilter
          A filter class that only highlights graphic objects that are an instance of IlvGraphicBag.
static class IlvHoverHighlightingImageOperation.NonGraphicBagFilter
          A filter class that only highlights graphic objects that are not an instance of IlvGraphicBag.
 
Field Summary
static BufferedImageOp BLUR_OP
          Predefined blur operation static float[] blurKernel = { ninth,ninth,ninth, ninth,ninth,ninth, ninth,ninth,ninth ; BufferedImageOp BLUR_OP = new ConvolveOp(new Kernel(3, 3, blurKernel));
static BufferedImageOp BRIGHTEN_OP
          Predefined brighten operation float[] brightKernel = { 1.5f }; BufferedImageOp BRIGHTEN_OP = new ConvolveOp(new Kernel(1, 1, brightKernel));
static BufferedImageOp GRAYSCALE_OP
          Predefined grayscale operation BufferedImageOp GRAYSCALE_OP = new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY), null);
static boolean HIGHLIGHT_SELECTION
          Indicates whether selected graphic objects should be highlighted.
static BufferedImageOp INVERT_COLORS_OP
          Predefined invert colors operation byte lut[] = new byte[256]; for (int j = 0; j < 256; j++) { lut[j] = (byte) (255 - j); } BufferedImageOp INVERT_COLORS_OP = new LookupOp(new ByteLookupTable(0, lut), null);
static BufferedImageOp SHARPEN_OP
          Predefined edge detection operation float[] sharpenKernel = { 0.0f, -1.0f, 0.0f, -1.0f, 5.0f, -1.0f, 0.0f, -1.0f, 0.0f }; BufferedImageOp SHARPEN_OP = new ConvolveOp(new Kernel(3, 3, sharpKernel),ConvolveOp.EDGE_NO_OP, null);
 
Constructor Summary
IlvHoverHighlightingImageOperation()
          Creates a new default IlvHoverHighlightingImageOperation with an INVERT_COLORS_OP operation and an alpha value of 0.8.
IlvHoverHighlightingImageOperation(BufferedImageOp imageOperation, float alpha)
          Creates a new IlvHoverHighlightingImageOperation.
 
Method Summary
protected  boolean drawHighlight()
          Draws the currently highlighted object on the target view, through an image operation.
 float getAlpha()
          Returns the alpha composition value of the highlight representation.
protected  IlvGraphic getHighlightedGraphic()
          Returns the highlighted graphic object.
 IlvHoverHighlightingImageOperation.Filter getHighlightFilter()
          Returns the filter which indicates which graphic object can be highlighted.
 BufferedImageOp getImageOperation()
          Returns the image operation used to draw the highlighted object.
protected  IlvManagerView getTargetView()
          Returns the view where the highlighted graphic object is displayed.
protected  void hideHighlight(int margin)
          Redraws the region highlighted with its initial appearance.
 void onExit(IlvGraphic sel, IlvObjectInteractorContext context)
          Tracks the exiting events to refresh the highlighted area.
 boolean processEvent(IlvGraphic obj, AWTEvent event, IlvObjectInteractorContext context)
          Processes the MOUSE_MOVED events to highlight the area where the object is located.
 void setAlpha(float alpha)
          Sets the alpha composition value of the highlight representation.
protected  void setHighlightedGraphic(IlvGraphic currentObj)
          Sets the highlighted graphic object.
 void setHighlightFilter(IlvHoverHighlightingImageOperation.Filter filter)
          Sets a filter to indicate which graphic object can be highlighted.
 void setImageOperation(BufferedImageOp imageOperation)
          Sets the image operation to use to display the highlighted object.
protected  void setTargetView(IlvManagerView view)
          Sets the view where the highlighted graphic object is displayed.
 boolean showHighlight(IlvGraphic obj, IlvManagerView view)
          Draws a graphic object in the view through the image operation.
 
Methods inherited from class ilog.views.IlvObjectInteractor
Get, handleExpose, onEnter, Put
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HIGHLIGHT_SELECTION

public static boolean HIGHLIGHT_SELECTION
Indicates whether selected graphic objects should be highlighted. The default value is false.


BRIGHTEN_OP

public static final BufferedImageOp BRIGHTEN_OP
Predefined brighten operation
 float[] brightKernel = { 1.5f };
 BufferedImageOp BRIGHTEN_OP = 
   new ConvolveOp(new Kernel(1, 1, brightKernel));
 


SHARPEN_OP

public static final BufferedImageOp SHARPEN_OP
Predefined edge detection operation
 float[] sharpenKernel = { 0.0f, -1.0f, 0.0f, -1.0f, 5.0f, -1.0f, 0.0f, -1.0f, 0.0f };
 BufferedImageOp SHARPEN_OP = 
   new ConvolveOp(new Kernel(3, 3, sharpKernel),ConvolveOp.EDGE_NO_OP, null);
 


BLUR_OP

public static final BufferedImageOp BLUR_OP
Predefined blur operation
 static float[] blurKernel = { 
   ninth,ninth,ninth,
   ninth,ninth,ninth,
   ninth,ninth,ninth
 ; 
 BufferedImageOp BLUR_OP = new ConvolveOp(new Kernel(3, 3, blurKernel));
 


GRAYSCALE_OP

public static final BufferedImageOp GRAYSCALE_OP
Predefined grayscale operation
 BufferedImageOp GRAYSCALE_OP = 
   new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY), null);
 


INVERT_COLORS_OP

public static final BufferedImageOp INVERT_COLORS_OP
Predefined invert colors operation
 byte lut[] = new byte[256];
 for (int j = 0; j < 256; j++) {
   lut[j] = (byte) (255 - j);
 }
 BufferedImageOp INVERT_COLORS_OP = 
   new LookupOp(new ByteLookupTable(0, lut), null);
 

Constructor Detail

IlvHoverHighlightingImageOperation

public IlvHoverHighlightingImageOperation()
Creates a new default IlvHoverHighlightingImageOperation with an INVERT_COLORS_OP operation and an alpha value of 0.8.


IlvHoverHighlightingImageOperation

public IlvHoverHighlightingImageOperation(BufferedImageOp imageOperation,
                                          float alpha)
Creates a new IlvHoverHighlightingImageOperation.

Parameters:
imageOperation - The image operation to use. You can use your own instance, or the predefined following values:
alpha - An alpha value in the range of [0.0, 1.0].
Method Detail

setAlpha

public void setAlpha(float alpha)
Sets the alpha composition value of the highlight representation. The alpha composition value is used to render the highlighted graphic object in a transparent way. The value must be in the range of [0.0, 1.0], the value of 1 means that the object is not transparent. The default value is 0.8 (20% transparent).

Parameters:
alpha - The transparency level in the range [0.0, 1.0].
See Also:
getAlpha()

getAlpha

public float getAlpha()
Returns the alpha composition value of the highlight representation. The alpha composition value is used to render the wrapped object in a transparent way. The value is in the range of [0.0, 1.0], the value of 1 means that the object is not transparent.

Returns:
The alpha value of the highlight representation.
See Also:
setAlpha(float)

getImageOperation

public BufferedImageOp getImageOperation()
Returns the image operation used to draw the highlighted object.

Returns:
The image operation used to draw the highlighted object.

setImageOperation

public void setImageOperation(BufferedImageOp imageOperation)
Sets the image operation to use to display the highlighted object. Predefined image operations are available: You can also write your own implementation of an image operation.

Parameters:
imageOperation - The image operation used to draw the highlighted object.

processEvent

public boolean processEvent(IlvGraphic obj,
                            AWTEvent event,
                            IlvObjectInteractorContext context)
Processes the MOUSE_MOVED events to highlight the area where the object is located.

Specified by:
processEvent in class IlvObjectInteractor
Parameters:
obj - The graphic object.
event - The event to process.
context - The context in which the event occurred.
Returns:
true if the event was handled by this processEvent invocation, false otherwise.
See Also:
showHighlight(IlvGraphic, IlvManagerView)

onExit

public void onExit(IlvGraphic sel,
                   IlvObjectInteractorContext context)
Tracks the exiting events to refresh the highlighted area. Note: because this call is not the only place where hideHighlight(int) is called (for example, the manager also calls it when the object interactor is changed), it is not recommended to override this method, but rather hideHighlight(int) if you need to build your own subclass.

Overrides:
onExit in class IlvObjectInteractor
Parameters:
sel - The selection object.
context - The context for the object interactor.
See Also:
hideHighlight(int), IlvObjectInteractor.onExit(ilog.views.IlvGraphic, ilog.views.IlvObjectInteractorContext)

setHighlightFilter

public void setHighlightFilter(IlvHoverHighlightingImageOperation.Filter filter)
Sets a filter to indicate which graphic object can be highlighted. The default value is null, which indicates that all non-selected objects will be highlighted. To enable the highlighting of selected objects, set the value true for the flag {link HIGHLIGHT_SELECTION).

Parameters:
filter - Instance of HighlightFilter.
See Also:
IlvHoverHighlightingImageOperation.NonGraphicBagFilter, IlvHoverHighlightingImageOperation.NonGraphicBagFilter

getHighlightFilter

public IlvHoverHighlightingImageOperation.Filter getHighlightFilter()
Returns the filter which indicates which graphic object can be highlighted.

Returns:
An instance of Filter or null if no filter has been set.

showHighlight

public boolean showHighlight(IlvGraphic obj,
                             IlvManagerView view)
Draws a graphic object in the view through the image operation. Called when the hovering interaction occurs on the object.

Parameters:
obj - The graphic object.
view - The manager view.
Returns:
Whether the object was drawn or not (because is not visible or was filtered out).
See Also:
drawHighlight(), setHighlightFilter(ilog.views.IlvHoverHighlightingImageOperation.Filter)

drawHighlight

protected boolean drawHighlight()
Draws the currently highlighted object on the target view, through an image operation.

Returns:
Whether the object was drawn or not (because it did not intersect the visible area of the view or because the view is not realized).

hideHighlight

protected void hideHighlight(int margin)
Redraws the region highlighted with its initial appearance.

Parameters:
margin - Margin added for safety reason to the area to refresh.

getHighlightedGraphic

protected IlvGraphic getHighlightedGraphic()
Returns the highlighted graphic object.

Returns:
Returns the current highlighted graphic object.
See Also:
showHighlight(IlvGraphic, IlvManagerView)

setHighlightedGraphic

protected void setHighlightedGraphic(IlvGraphic currentObj)
Sets the highlighted graphic object.

Parameters:
currentObj - The highlighted graphic object.
See Also:
showHighlight(IlvGraphic, IlvManagerView), hideHighlight(int)

getTargetView

protected IlvManagerView getTargetView()
Returns the view where the highlighted graphic object is displayed.

Returns:
Returns the view where the highlighted graphic object is displayed.
See Also:
showHighlight(IlvGraphic, IlvManagerView)

setTargetView

protected void setTargetView(IlvManagerView view)
Sets the view where the highlighted graphic object is displayed.

Parameters:
view - The view where the highlighted graphic object is displayed.
See Also:
showHighlight(IlvGraphic, IlvManagerView), hideHighlight(int)


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