ilog.views.interactor
Class IlvManagerMagViewInteractor

java.lang.Object
  extended by ilog.views.IlvManagerViewInteractor
      extended by ilog.views.interactor.IlvManagerMagViewInteractor
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
IltManagerMagViewInteractor

public class IlvManagerMagViewInteractor
extends IlvManagerViewInteractor

An interactor that controls the visible area of a view by using a movable rectangle in another view. This interactor is used when you want to create an overview window. The overview window shows the entire contents of a manager while the main window shows only a part of the manager. When the interactor is set on the overview window, the rectangle drawn by the interactor shows the visible area of the manager in the main window. It changes the visible area of the main window when the rectangle in the overview window is moved. The view controlled by the interactor is called the target view. The rectangle drawn on the overview window can be drawn in several ways. It can be a filled rectangle or an empty rectangle. The autozoom and autotranslate modes will allow the overview to be automatically zoomed or translated to follow the display in the main window.

See Also:
Serialized Form

Field Summary
static int Filled
          The Filled drawing style
static int Wire
          The Wire drawing style
 
Constructor Summary
IlvManagerMagViewInteractor()
          Creates the interactor.
IlvManagerMagViewInteractor(IlvManagerView target, boolean boundedByView)
          Creates the interactor.
 
Method Summary
 void adjustGhost()
          Adjusts the ghost rectangle.
 void adjustView(IlvRect rect)
          Adjusts the visible area of the target view according to the specified control rectangle.
protected  void attach(IlvManagerView v)
          This method is called when the interactor is attached to the manager view.
protected  void detach()
          This method is called when the interactor is detached from the view.
 void drawGhost(Graphics g)
          Draws the rectangle showing the visible area of the target view.
 void fitOverview()
          Changes the transformer of the overview so that the rectangle representing the visible area of the manager view fits the size of the overview.
protected  void fitTransformerToContent(boolean redraw)
          Modifies the transformer of the manager view to which the interactor is attached so that all the objects are visible in the view.
 int getDrawingStyle()
          Returns the way the control rectangle is drawn.
 int getLineWidth()
          Returns the width of the line when the style is Wire.
 IlvRect getRectangle()
          Returns the control rectangle.
 int getResizeHandleSize()
          Returns the size of the resizing handles.
 IlvManagerView getTarget()
          Returns the target view of the interactor.
 boolean isAutoKeepingAspectRatio()
          Returns true if the control rectangle keeps the aspect ratio during interactive resize exactly when the target manager view has the keeping aspect ratio mode enabled.
 boolean isAutoTranslating()
          Returns true if the AutoTranslating mode is activated.
 boolean isAutoZoomConstrained()
          Returns true if the AutoZoom mode is constrained.
 boolean isAutoZooming()
          Returns true if the AutoZooming mode is activated.
 boolean isBoundedByView()
          Returns true if the control rectangle cannot be moved outside of the view.
 boolean isCenteringWhenKeepingAspectRatio()
          Returns true if resizing the control rectangle while keeping the aspect ratio preserves the center of the view.
 boolean isKeepingAspectRatio()
          Returns true if the control rectangle keeps the aspect ratio when being interactively resized.
 boolean isResizingAllowed()
          Returns true if the user can resize the control rectangle.
protected  void processMouseEvent(MouseEvent event)
          Processes mouse events.
protected  void processMouseMotionEvent(MouseEvent event)
          Processes mouse motion events.
 void resetOverview()
          Resets the internal flags of the overview that are used to manage the AutoZoom mode and the AutoZoom constrained mode.
 void setAutoKeepingAspectRatio(boolean enable)
          Sets whether keeping the aspect ratio of the control rectangle can be specified independently from keeping the aspect ratio of the target view.
 void setAutoTranslating(boolean set)
          Enables or disables the AutoTranslating mode.
 void setAutoZoomConstrained(boolean set)
          Constrains the AutoZoom mode so that the overview is never less zoomed than its content.
 void setAutoZooming(boolean set)
          Enables or disables the AutoZooming mode.
 void setBoundedByView(boolean set)
          When set to true, specifies that the control rectangle cannot be moved outside of the view.
 void setCenteringWhenKeepingAspectRatio(boolean enable)
          Sets whether resizing the control rectangle while keeping the aspect ratio preserves the center of the view.
 void setDrawingStyle(int style)
          Changes the way the control rectangle is drawn.
 void setKeepingAspectRatio(boolean enable)
          Sets whether the control rectangle keeps the aspect ratio when being interactively resized.
 void setLineWidth(int width)
          Changes the width of the line when the style is Wire.
 void setRectangle(IlvRect rect, boolean adjust)
          Changes the control rectangle.
 void setResizeHandleSize(int size)
          Changes the size of the resizing handles.
 void setResizingAllowed(boolean allow)
          Specifies whether the control rectangle can be resized.
 void setTarget(IlvManagerView view)
          Changes the target view of the interactor.
 
Methods inherited from class ilog.views.IlvManagerViewInteractor
addFocusListener, addKeyListener, addMouseListener, addMouseMotionListener, allowEnsureVisible, allowEnsureVisible, disableEvents, drawGhost, enableEvents, ensureVisible, ensureVisible, getManager, getManagerView, getTransformer, handleExpose, isXORGhost, processEvent, processFocusEvent, processKeyEvent, removeFocusListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, setXORGhost
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Filled

public static final int Filled
The Filled drawing style

See Also:
setDrawingStyle(int), Constant Field Values

Wire

public static final int Wire
The Wire drawing style

See Also:
setDrawingStyle(int), Constant Field Values
Constructor Detail

IlvManagerMagViewInteractor

public IlvManagerMagViewInteractor()
Creates the interactor. No target view is specified; you must use the method setTarget to specify the target view.


IlvManagerMagViewInteractor

public IlvManagerMagViewInteractor(IlvManagerView target,
                                   boolean boundedByView)
Creates the interactor.

Parameters:
target - The target view.
boundedByView - If true, the control rectangle cannot be moved outside of the view.
Method Detail

fitOverview

public void fitOverview()
Changes the transformer of the overview so that the rectangle representing the visible area of the manager view fits the size of the overview.

Since:
JViews 7.5

setResizingAllowed

public void setResizingAllowed(boolean allow)
Specifies whether the control rectangle can be resized. When resizing is allowed, a resizing handle appears at each corner of the control rectangle.

Parameters:
allow - true for allowing rectangle resize, false otherwise.
See Also:
isResizingAllowed()

isResizingAllowed

public boolean isResizingAllowed()
Returns true if the user can resize the control rectangle.

Returns:
true if allowing rectangle resizing, false otherwise.
See Also:
setResizingAllowed(boolean)

setDrawingStyle

public void setDrawingStyle(int style)
Changes the way the control rectangle is drawn.

Parameters:
style - The drawing style. Valid values for style are Filled and Wire. When the value is Filled, the control rectangle is drawn as a filled rectangle. When the value is Wire, the control rectangle is drawn as an empty rectangle with the line thickness defined by getLineWidth. The drawing can be in XOR mode or not depending on the value of IlvManagerViewInteractor.isXORGhost(). Of course when using a non XOR filled rectangle, it is advised to use a semi-transparent ghost color ( IlvManagerView.setDefaultGhostColor(Color)).
See Also:
Filled, Wire

getDrawingStyle

public int getDrawingStyle()
Returns the way the control rectangle is drawn.

Returns:
The drawing style. The returned value may be Filled or Wire. When the value is Filled, the control rectangle is drawn as an filled rectangle. When the value is Wire, the control rectangle is drawn as an empty rectangle with the line thickness defined by getLineWidth.

setLineWidth

public void setLineWidth(int width)
Changes the width of the line when the style is Wire.

Parameters:
width - The line width.
See Also:
getDrawingStyle()

getLineWidth

public int getLineWidth()
Returns the width of the line when the style is Wire.

Returns:
The line width
See Also:
getDrawingStyle()

setResizeHandleSize

public void setResizeHandleSize(int size)
Changes the size of the resizing handles.

Parameters:
size - The handle size.

getResizeHandleSize

public int getResizeHandleSize()
Returns the size of the resizing handles.

Returns:
The handle size.

getRectangle

public final IlvRect getRectangle()
Returns the control rectangle.

Returns:
The control rectangle in the view coordinate system.

setRectangle

public void setRectangle(IlvRect rect,
                         boolean adjust)
Changes the control rectangle.

Parameters:
rect - The new rectangle in the control view coordinate system.
adjust - If true, the visible area of the target view is adjusted according to the new rectangle.

setAutoZooming

public void setAutoZooming(boolean set)
Enables or disables the AutoZooming mode.
With the AutoZooming mode enabled, the overview automatically zooms when the target view is zoomed in or out to maintain a constant ratio between the zoom factor of the overview and the zoom factor of the target view.
This mode is incompatible with an overview in autoFitToContents mode.
By default, this mode is disabled.

Parameters:
set - true if enable autozooming, false otherwise.
See Also:
IlvManagerView.setAutoFitToContents(boolean), isAutoZooming(), setAutoZoomConstrained(boolean)

isAutoZooming

public final boolean isAutoZooming()
Returns true if the AutoZooming mode is activated.

Returns:
true if autozooming is enabled , false otherwise.
See Also:
setAutoZooming(boolean)

setAutoTranslating

public void setAutoTranslating(boolean set)
Enables or disables the AutoTranslating mode.
When the Auto Translating mode is enabled, the overview window automatically scrolls so that the visible area of the target view remains inside the overview window.
By default, this mode is disabled.

Parameters:
set - true for enabling auto translating, false otherwise.
See Also:
isAutoTranslating()

isAutoTranslating

public final boolean isAutoTranslating()
Returns true if the AutoTranslating mode is activated.

Returns:
true if auto translating is enabled, false otherwise.
See Also:
setAutoTranslating(boolean)

setAutoZoomConstrained

public void setAutoZoomConstrained(boolean set)
Constrains the AutoZoom mode so that the overview is never less zoomed than its content.

Parameters:
set - true to enable this mode, false otherwise.
See Also:
setAutoZooming(boolean), isAutoZoomConstrained()

isAutoZoomConstrained

public final boolean isAutoZoomConstrained()
Returns true if the AutoZoom mode is constrained.

Returns:
true if this mode is enabled, false otherwise.
See Also:
setAutoZoomConstrained(boolean)

resetOverview

public void resetOverview()
Resets the internal flags of the overview that are used to manage the AutoZoom mode and the AutoZoom constrained mode. The display of the overview is reset depending on the bounding box of the target manager and on its transformer.

See Also:
setAutoZooming(boolean), setAutoZoomConstrained(boolean)

fitTransformerToContent

protected void fitTransformerToContent(boolean redraw)
Modifies the transformer of the manager view to which the interactor is attached so that all the objects are visible in the view.

The default implementation calls the method IlvManagerView.fitTransformerToContent(). If redraw is true, the manager view is repainted using IlvManagerView.repaint().

Parameters:
redraw - If true, the manager view is repainted after the modification of the transformer.

setTarget

public void setTarget(IlvManagerView view)
Changes the target view of the interactor.

Parameters:
view - The new target view.

getTarget

public IlvManagerView getTarget()
Returns the target view of the interactor.

Returns:
The target view.

processMouseEvent

protected void processMouseEvent(MouseEvent event)
Processes mouse events.

Overrides:
processMouseEvent in class IlvManagerViewInteractor
Parameters:
event - The MouseEvent
See Also:
IlvManagerViewInteractor.addMouseListener(java.awt.event.MouseListener)

processMouseMotionEvent

protected void processMouseMotionEvent(MouseEvent event)
Processes mouse motion events.

Overrides:
processMouseMotionEvent in class IlvManagerViewInteractor
Parameters:
event - The MouseEvent
See Also:
IlvManagerViewInteractor.addMouseMotionListener(java.awt.event.MouseMotionListener)

drawGhost

public void drawGhost(Graphics g)
Draws the rectangle showing the visible area of the target view.

Overrides:
drawGhost in class IlvManagerViewInteractor
Parameters:
g - The Graphic used to draw the ghost.
See Also:
IlvManagerViewInteractor.handleExpose(java.awt.Graphics), IlvManagerViewInteractor.setXORGhost(boolean)

isBoundedByView

public boolean isBoundedByView()
Returns true if the control rectangle cannot be moved outside of the view.

Returns:
true if the control rectangle cannot be moved outside of the view.
See Also:
setBoundedByView(boolean)

setBoundedByView

public void setBoundedByView(boolean set)
When set to true, specifies that the control rectangle cannot be moved outside of the view.

Parameters:
set - true if the control rectangle cannot be moved outside of the view.
See Also:
isBoundedByView()

isAutoKeepingAspectRatio

public boolean isAutoKeepingAspectRatio()
Returns true if the control rectangle keeps the aspect ratio during interactive resize exactly when the target manager view has the keeping aspect ratio mode enabled. Return true if keeping the aspect ratio of the control rectangle depends on the flag IlvManagerView.setKeepingAspectRatio(boolean) of the target view. This mode has only an effect if resizing the control rectangle is allowed.

Since:
JViews 7.5
See Also:
setAutoKeepingAspectRatio(boolean), setResizingAllowed(boolean)

setAutoKeepingAspectRatio

public void setAutoKeepingAspectRatio(boolean enable)
Sets whether keeping the aspect ratio of the control rectangle can be specified independently from keeping the aspect ratio of the target view. This mode has only an effect if resizing the control rectangle is allowed.

If the automatic mode is on, the flag setKeepingAspectRatio(boolean) of this interactor has no effect, since the control rectangle of the interactor preserves the aspect ratio whenever the flag IlvManagerView.setKeepingAspectRatio(boolean) returns true for the target view. If the automatic mode is off, it can be specified by setKeepingAspectRatio(boolean) whether the control rectangle of the interactor preserves the aspect ratio independent from the target view. The automatic mode is disabled by default.

Since:
JViews 7.5
See Also:
isAutoKeepingAspectRatio(), setKeepingAspectRatio(boolean), setResizingAllowed(boolean), getTarget(), IlvManagerView.setKeepingAspectRatio(boolean)

isKeepingAspectRatio

public boolean isKeepingAspectRatio()
Returns true if the control rectangle keeps the aspect ratio when being interactively resized. This mode has only an effect if resizing the control rectangle is allowed, and the automatic keeping aspect ratio mode is disabled.

Since:
JViews 7.5
See Also:
setKeepingAspectRatio(boolean), setResizingAllowed(boolean), setAutoKeepingAspectRatio(boolean)

setKeepingAspectRatio

public void setKeepingAspectRatio(boolean enable)
Sets whether the control rectangle keeps the aspect ratio when being interactively resized. This is enabled by default. This mode has only an effect if resizing the control rectangle is allowed, and the automatic keeping aspect ratio mode is disabled.

The keeping aspect ratio of the control rectangle is independent from the keeping aspect ratio feature that can be set at the manager view. If keeping aspect ratio is enabled at the target view but disabled for the control rectangle, it is possible to freely resize the control rectangle, but the target view dominates, that is, at the end of the resize operation, the control rectangle snaps into size that corresponds to the aspect ratio of the target view. If keeping aspect ratio is disabled at the target view but enabled for the control rectangle, resizing the control rectangle preserves the aspect ratio on the control rectangle and also approximately on the target view, while all operations directly on the target view don't preserve the aspect ratio.

The most common case is to set keeping aspect ratio of the manager view and of the control rectangle to the same value. This most common case is supported by enabling the automatic keeping aspect ratio mode.

Since:
JViews 7.5
See Also:
isKeepingAspectRatio(), setResizingAllowed(boolean), setAutoKeepingAspectRatio(boolean), getTarget(), IlvManagerView.setKeepingAspectRatio(boolean)

isCenteringWhenKeepingAspectRatio

public boolean isCenteringWhenKeepingAspectRatio()
Returns true if resizing the control rectangle while keeping the aspect ratio preserves the center of the view. This mode has only an effect if resizing the control rectangle is allowed and should keep the aspect ratio. This means, either keeping aspect ratio is enabled or the automatic keeping aspect ratio mode is switched on and the view preserves the aspect ratio.

Since:
JViews 7.5
See Also:
setCenteringWhenKeepingAspectRatio(boolean), setResizingAllowed(boolean), setKeepingAspectRatio(boolean), setAutoKeepingAspectRatio(boolean), IlvManagerView.setKeepingAspectRatio(boolean)

setCenteringWhenKeepingAspectRatio

public void setCenteringWhenKeepingAspectRatio(boolean enable)
Sets whether resizing the control rectangle while keeping the aspect ratio preserves the center of the view. This is enabled by default. This mode has only an effect if resizing the control rectangle is allowed and should keep the aspect ratio. This means, either keeping aspect ratio is enabled or the automatic keeping aspect ratio mode is switched on and the view preserves the aspect ratio.

Since:
JViews 7.5
See Also:
isCenteringWhenKeepingAspectRatio(), setResizingAllowed(boolean), setKeepingAspectRatio(boolean), setAutoKeepingAspectRatio(boolean), IlvManagerView.setKeepingAspectRatio(boolean)

adjustGhost

public void adjustGhost()
Adjusts the ghost rectangle. This method computes the value of the control rectangle according to the visible area of the target view and redraws the control rectangle.


adjustView

public void adjustView(IlvRect rect)
Adjusts the visible area of the target view according to the specified control rectangle. You normally do not need to call this method; This method has been removed in JViews 7.5 and reintroduced in JViews 8.0 for backward compatibility.

Parameters:
rect - The new desired control rectangle.
Since:
JViews 8.0

attach

protected void attach(IlvManagerView v)
This method is called when the interactor is attached to the manager view.

Overrides:
attach in class IlvManagerViewInteractor
Parameters:
v - The manager view.
See Also:
IlvManagerViewInteractor.detach()

detach

protected void detach()
This method is called when the interactor is detached from the view.

Overrides:
detach in class IlvManagerViewInteractor
See Also:
IlvManagerViewInteractor.attach(ilog.views.IlvManagerView)


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