public class IlvManagerView extends Container implements IlvObjectInteractorContext, IlvULocaleAware, IlvComponentOrientationAware
A manager view is attached to a single manager at a time. However, each
manager can be connected to several views simultaneously. The manager to
which a view is attached is defined when you call the constructor; you
retrieve and change this manager by calling
setManager(IlvManager)
and getManager()
.
Each manager view contains a geometric transformer which defines the
translation, the scaling and the rotation applied to the drawing of
the graphic objects in the manager attached to this view.
A transformer is defined by an IlvTransformer
instance.
You modify the transformations associated with a view either by calling
setTransformer(IlvTransformer)
or getTransformer()
to change the transformer, or by calling methods that change the transformer
for you. Examples of this are zoom(IlvPoint, double, double, boolean)
,
translate(double, double, boolean)
, fitTransformerToContent()
.
When KeepingAspectRatio is true
, the view will
verify each modification of its transformer so that the zoom factor
remains the same along the x axis and the y axis.
The zoom level can be different on the x axis and on the y axis, for instance
in order to fit the content into a area of a given aspect ratio. If you need
to ensure the zoom level remains always the same along the two axis, use the
the method setKeepingAspectRatio(boolean)
.
The following code example shows how to use two manager view instances to display a manager in different ways.
IlvGraphic obj; IlvManager manager = new IlvManager(); // Create new graphic objects and add them to the submanager. // These graphic objects will be beneath the other objects. obj = new IlvEllipse(new IlvRect(30, 10, 50, 50), true, false); manager.addObject(obj, false); // Add a new graphic object to layer 2 in the manager obj = new IlvRectangle(new IlvRect(70,40,50,50), false, true); manager.addObject(obj, 2, false); // Add the manager to different views. IlvManagerView viewOne = new IlvManagerView(manager); IlvManagerView viewTwo = new IlvManagerView(manager); viewOne.setBackground(Color.RED); viewTwo.setBackground(Color.GREEN); // Add a grid to viewOne viewOne.setGrid(new IlvGrid()); // Zoom into viewTwo viewTwo.zoom(new IlvPoint(50,70), 2, 2, true); // Set all the graphic objects in layer 2 to be invisible // for viewOne. manager.setVisible(viewOne, 2, false, true); JFrame frame = new JFrame("IlvManagerView"); frame.setLayout(new BorderLayout(2, 2)); JSplitPane splitPane = new JSplitPane( JSplitPane.HORIZONTAL_SPLIT, viewOne, viewTwo); splitPane.setDividerLocation(140); frame.getContentPane().add(splitPane); frame.setSize(320, 200); frame.setVisible(true);
The following image shows the two views created for a single manager in the code example:
A manager view is opaque by default, that is, it paints all pixels of its assigned bounds without transpacency. In the opposite case, that is, when the components behind the view partially shine through, it is called translucent. A manager view can be made translucent in three ways:
setBackgroundPattern(Image)
or
setBackgroundPatternLocation(URL)
.setBackground(Color)
.setTransparent
(true)
.
In order to make translucency work in combination with the built-in
Swing double-buffering, on Unix/X11 platforms with Java versions older than
1.6, you need to use the JVM option
-Dsun.java2d.pmoffscreen=false
.
Double buffering prevents the screen from flickering when many objects are
being manipulated. IlvManagerView
is a lightweight Java
component and cannot manage double buffering on its own. To use double
buffering in a Swing application, just place your view in an
IlvJManagerViewPanel
or
IlvJScrollManagerView
.
Note that in a Swing application, it is not necessary to set
double buffering on (using setDoubleBuffering(boolean)
), since
Swing already handles the double buffering of all components.
For AWT, non-Swing applications, place your view in an
IlvManagerViewPanel
or
IlvScrollManagerView
.
Using triple buffering, static background layers are drawn in an additional
off-screen image, and this image is used instead of redrawing the background
graphic objects to speed up your application. Triple buffering is activated
by calling setTripleBufferedLayerCount(int)
.
A view interactor processes AWT events and controls behavior that can be
applied to a view as a whole, that is, affecting all the objects contained
in the view. View interactors are subclasses of
IlvManagerViewInteractor
that are attached to the view. The following code example shows how to add a
zoom interactor:
IlvManager manager = new IlvManager(); IlvManagerView mgrview = new IlvManagerView(manager); IlvZoomViewInteractor zoomInteractor; zoomButton = new Button("Zoom In"); ... zoomButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (zoomInteractor == null) zoomInteractor = new IlvZoomViewInteractor(); if (mgrview.getInteractor() != zoomInteractor) mgrview.setInteractor(zoomInteractor); } });
Note: use setWheelZoomingEnabled(boolean)
to allow users to zoom in and out of a view using the mouse wheel. For
scrolling using the mouse wheel, encapsulate the manager view in a
IlvJScrollManagerView
and
use its method
setWheelScrollingEnabled
.
A manager view manages a stack of view interactors, only the
interactor on top of the interactor stack is active. Subclasses of
IlvManagerViewInteractor
class allow you to perform different
tasks on the view. For example,
IlvZoomViewInteractor
allows the user to zoom to a rectangle dragged over the view using the mouse.
When the manager displayed by a view changes, the view fires a
ManagerChangedEvent
. To handle
these events, a
ManagerChangedListener
implementation instance must be registered with this view by calling
addManagerChangedListener(ManagerChangedListener)
. To remove
this listener call
removeManagerChangedListener(ManagerChangedListener)
.
When the transformer of the view changes, the view fires a
TransformerChangedEvent
event. To handle these events a
TransformerListener
implementation instance must be registered with this view by calling
addTransformerListener(TransformerListener)
. To remove this
listener call removeTransformerListener(TransformerListener)
.
When the interactor of the view changes, the view fires a
InteractorChangedEvent
event. To handle these events a
InteractorListener
implementation instance must be registered with this view by calling
addInteractorListener(InteractorListener)
. To remove this
listener call removeInteractorListener(InteractorListener)
.
In multithreaded client side applications, all changes on the manager view should be done in the AWT thread, to avoid synchronization problems and deadlocks when the AWT thread draws the component while other threads try to change it. In multithreaded server side applications, several threads can access the manager view. In this case, it is recommended to take the manager lock before taking the view lock as sketched below:
synchronized (view.getManager().getTreeLock()) { synchronized (view) { ... } }JViews code that needs both locks always obeys this order. Hence, taking locks in opposite order can lead to deadlocks and is not recommended.
Like every AWT component, the manager view has a locale and a component
orientation. Different to other AWT components, the manager view does not
inherit the locale from a parent component but always uses the locale that
was specified at construction time
(or IlvLocaleUtil.getCurrentULocale()
if none was specified), or that
was set explicitely. Changing the locale or component orientation may affect
all objects in a manager, hence it is most efficiently done when the
manager is still empty.
Modifier and Type | Class and Description |
---|---|
static interface |
IlvManagerView.FitAreaCalculator
This interface can be used to fit the transformer of the manager view
so that a certain area of the manager is visible in the view.
|
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static int |
BLINKING_AUTOMATIC
Automatic mode for the blinking behavior.
|
static int |
BLINKING_DISABLED
Mode OFF for the blinking behavior.
|
static int |
BLINKING_ENABLED
Mode ON for the blinking behavior.
|
static int |
DIRECT_REDRAW
Direct mode for redrawing of invalid regions.
|
static RenderingHints.Key |
KEY_VIEW
This
RenderingHints.Key is used to mark the
Graphics2D instances which view is currently printed. |
static int |
THREADED_REDRAW
Threaded mode for redrawing of invalid regions.
|
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
IlvManagerView()
Creates a new manager view.
|
IlvManagerView(IlvManager manager)
Creates a new manager view to display the contents of the
specified manager.
|
IlvManagerView(IlvManager manager,
IlvTransformer t)
Creates a new manager view.
|
IlvManagerView(IlvManager manager,
IlvTransformer t,
com.ibm.icu.util.ULocale locale)
Creates a new manager view.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
acceptCollapseExpandIconsEvent(MouseEvent e)
Returns whether the input event is suitable for clicking on the
expand/collapse icon of manager frames and link bundles.
|
void |
addInteractorListener(InteractorListener l)
Adds the specified interactor listener to receive interactor
changed events from the manager view when the interactor of the view is
changed.
|
void |
addManagerChangedListener(ManagerChangedListener listener)
Adds the specified listener to receive manager changed events from
this manager view when the manager displayed by this view changes.
|
void |
addNotify()
Notifies the manager view that it has been added to its parent.
|
void |
addTransformer(IlvTransformer t)
Adds the transformer on the view (composes the existing transformer
with the new one).
|
void |
addTransformerListener(TransformerListener l)
Adds the specified transformer listener to receive transformer
changed events when the transformer of this manager view changes.
|
void |
addViewDecoration(IlvManagerViewDecoration decoration)
Adds a decoration to the view.
|
IlvRect |
computeBBox()
Computes the rectangle that contains all
the graphic objects of the manager of the view.
|
IlvRect |
computeBBox(IlvTransformer t)
Computes the rectangle that contains all
the graphic objects of the manager of the view, for
a given transformer.
|
IlvTransformer |
computeTransformerFitToArea(Insets insets,
IlvManagerView.FitAreaCalculator areaCalculator,
int maxNumberOfIterations)
Computes the manager view transformer that will fit a specific area to
be visible in the view.
|
protected Image |
createDoubleBufferImage(int width,
int height)
Creates an image used for double-buffering.
|
Image |
createImage(int width,
int height)
This method creates an image used for double-buffering,
for the case where this component is opaque.
|
protected void |
doubleBufferedImageUpToDate(Image doubleBufferImage)
Called when the double buffered image becomes up to date.
|
void |
ensureVisible(IlvPoint point)
Modifies the transformer so that the specified point
becomes visible.
|
void |
ensureVisible(IlvRect r)
Modifies the transformer so that the specified rectangle
becomes visible.
|
void |
fitTransformerToArea(Insets insets,
IlvManagerView.FitAreaCalculator areaCalculator,
int maxNumberOfIterations)
Modifies the manager view transformer so that a specific area is visible
in the view.
|
void |
fitTransformerToArea(Insets insets,
IlvManagerView.FitAreaCalculator areaCalculator,
int maxNumberOfIterations,
boolean delayUntilShowing)
Modifies the manager view transformer so that a specific area is visible
in the view.
|
protected void |
fitTransformerToAreaImpl(Insets insets,
IlvManagerView.FitAreaCalculator areaCalculator,
int maxNumberOfIterations,
boolean callchanged)
Modifies the manager view transformer so that a specific area is visible
in the view.
|
void |
fitTransformerToContent()
Modifies the transformer of the manager view
so that all objects are visible in the view.
|
void |
fitTransformerToContent(boolean delayUntilShowing)
Modifies the transformer of the manager view
so that all objects are visible in the view.
|
void |
fitTransformerToContent(Insets insets)
Modifies the manager view transformer so that all objects
are visible in the view and specified margins are preserved.
|
void |
fitTransformerToContent(Insets insets,
int maxNumberOfIterations)
Modifies the manager view transformer so that all objects
are visible in the view, margins are preserved and a specified
number of iterations is used for computing the optimal transformer.
|
void |
fitTransformerToContent(Insets insets,
int maxNumberOfIterations,
boolean delayUntilShowing)
Modifies the manager view transformer so that all objects
are visible in the view, margins are preserved and a specified
number of iterations is used for computing the optimal transformer.
|
Image |
getBackgroundPattern()
Deprecated.
use
getBackgroundPatternLocation |
URL |
getBackgroundPatternLocation()
Returns the location of the background pattern of the view.
|
int |
getBlinkingMode()
Returns the mode of the blinking behavior of graphic objects displayed
in this view.
|
static IlvManagerView |
getCurrentView(Graphics g)
Returns the current manager view that is drawn into the input
Graphics . |
Color |
getDefaultGhostColor()
Returns the default ghost color of the view.
|
Color |
getDefaultXORColor()
Returns the default XOR color for the view.
|
IlvGrid |
getGrid()
Returns the grid of the view.
|
IlvManagerViewInteractor |
getInteractor()
Returns the interactor of the view, if any, or
null otherwise. |
IlvManager |
getManager()
Returns the manager displayed by this view.
|
Dimension |
getMaximumSize()
Returns the maximum size of the view.
|
double |
getMaxZoomXFactor()
Returns the maximal zoom factor allowed for the view in the x direction.
|
double |
getMaxZoomYFactor()
Returns the maximal zoom factor allowed for the view in the y direction.
|
Dimension |
getMinimumSize()
Returns the minimum size of the view.
|
double |
getMinZoomXFactor()
Returns the minimal zoom factor allowed for the view in the x direction.
|
double |
getMinZoomYFactor()
Returns the minimal zoom factor allowed for the view in the y direction.
|
protected JPopupMenu |
getPopupMenu(IlvGraphic obj,
IlvPoint p,
IlvPopupMenuManager popupManager)
Returns the Swing pop-up menu to be displayed when the pop-up is
triggered at a specified location inside the manager view.
|
JPopupMenu |
getPopupMenu(IlvPoint p,
IlvPopupMenuManager popupManager)
Returns the Swing pop-up menu to be displayed when the pop-up is
triggered at a specified location inside the manager view.
|
Dimension |
getPreferredSize()
Returns the preferred size of the view.
|
int |
getRedrawMode()
Returns the way invalid regions of the view are redrawn.
|
IlvRegion |
getRegion()
Returns the invalid region of the view.
|
long |
getRepaintSkipThreshold()
Gets the minimum delay between repaint requests.
|
com.ibm.icu.util.ULocale |
getStoredULocale()
Returns the locale of this view.
|
IlvTransformer |
getTransformer()
Returns a copy of the transformer of the manager view.
|
int |
getTripleBufferedLayerCount()
Returns the number of layers that are triple buffered.
|
com.ibm.icu.util.ULocale |
getULocale()
Returns the locale of this view.
|
IlvManagerViewDecoration |
getViewDecoration(int index)
Returns the decoration installed on the view at the specified index.
|
int |
getViewDecorationCount()
Returns the number of decorations added to the view.
|
Insets |
getViewMargins()
Returns the margin obeyed by
computeBBox() . |
boolean |
imageUpdate(Image img,
int flags,
int x,
int y,
int w,
int h)
Repaints the component when the image has changed.
|
static void |
initDisplayInfo()
Initializes the information about the display.
|
protected void |
interactorChanged(IlvManagerViewInteractor current,
IlvManagerViewInteractor previous)
Called when the interactor of the view is changed,
that is, each time an interactor is added or removed from the
interactor stack.
|
void |
invalidateRect(IlvRect rect)
Adds a rectangle to the invalid region of the view.
|
void |
invalidateTripleBuffer(boolean repaint)
Invalidates the triple buffer.
|
void |
invalidateTripleBuffer(IlvRect rect,
boolean repaint)
Invalidates partially the triple buffer.
|
void |
invalidateView()
Invalidates the entire view.
|
boolean |
isAntialiasing()
Returns
true if the antialiasing mode
of the view is on. |
boolean |
isAtZoomXFactorLimit()
Returns
true if the zoom factor of the view reached
the minimal or the maximal zoom factor limit in the x direction when
the transformer was changed. |
boolean |
isAtZoomYFactorLimit()
Returns
true if the zoom factor of the view reached
the minimal or the maximal zoom factor limit in the y direction when
the transformer was changed. |
boolean |
isAutoFitToContents()
Returns
true if the view is in autofit
mode. |
boolean |
isCollapseExpandIconsEnabled()
Indicates whether or not clicking on the expand/collapse icon of
manager frames and link bundles collapses or expands the objects.
|
boolean |
isContributingToViewBBox(int layer)
Returns
true if the specified layer is taken into account
when computing the bounding box of the view. |
boolean |
isDoubleBufferFrozen()
Returns
true if the double buffer is frozen. |
boolean |
isDoubleBuffering()
Returns the double-buffering mode of
the view.
|
boolean |
isEventDispatching()
Returns
true if AWT events
are dispatched to the listeners on the view and
to the subcomponents. |
boolean |
isInSwingParent()
Returns
true if the IlvManagerView is used
in a Swing context (i.e its parent is a JComponent ),
false otherwise. |
boolean |
isKeepingAspectRatio()
Returns
true if the view keeps the aspect ratio;
otherwise it returns false . |
boolean |
isLayerCached(int layer)
Tells whether the specified layer is cached for this view.
|
boolean |
isOpaque()
Returns true if this component is completely opaque.
|
boolean |
isOptimizedTranslation()
Returns an indication of whether the translation of the manager view
content is optimized or not.
|
boolean |
isRegisteredAtToolTipManager()
Returns whether the view is registered at the
IlvToolTipManager . |
boolean |
isSelectedWhenPopupPreferred()
Returns whether
getPopupMenu(IlvPoint,IlvPopupMenuManager)
returns preferably the topmost selected object. |
boolean |
isTransparent()
Returns
true if the view is transparent. |
boolean |
isVisible(int layer)
Returns the visibility of the specified layer in the
view.
|
boolean |
isWheelZoomingEnabled()
Indicates whether or not zooming will take place in response to movement
of the mouse wheel plus control key pressed.
|
boolean |
isWheelZoomingInverted()
Returns
true when mouse wheel zooming is inverted. |
protected void |
managerChanged(IlvManager oldManager,
IlvManager newManager)
This method is called by
setManager as
notification that the manager displayed by this view has changed. |
void |
paint(Graphics g)
Paints the view.
|
IlvManagerViewInteractor |
popInteractor()
Removes an interactor from the top of the interactor stack.
|
void |
print(Graphics g,
IlvRect area,
IlvTransformer t,
boolean includeBackground,
boolean allLayers)
Prints the contents of the view: the contents of the manager and
optionally the background.
|
protected void |
processEvent(AWTEvent evt)
Processes the events in the view.
|
protected void |
processKeyEvent(KeyEvent event)
This method is overridden to forward key events that have not yet been
consumed by the view interactor or registered
KeyListener s to
this view's IlvJManagerViewPanel or IlvJScrollManagerView
parent. |
void |
pushInteractor(IlvManagerViewInteractor interactor)
Adds the specified interactor to the top of the interactor stack.
|
void |
pushInteractor(IlvManagerViewInteractor interactor,
AWTEvent evt)
Adds the specified interactor to the top of the interactor stack.
|
void |
reDrawViews()
Repaints the invalid region of the view.
|
void |
reDrawViewsForBlinking()
Repaints the invalid region of the view if the view has blinking enabled.
|
void |
removeAllInteractors()
Removes all the interactors from the view.
|
void |
removeInteractorListener(InteractorListener l)
Removes the specified interactor listener so that it no longer receives
interactor changed events from the manager view.
|
void |
removeManagerChangedListener(ManagerChangedListener listener)
Removes the specified listener so that it no longer receives manager
changed events from this view.
|
void |
removeNotify()
Notifies the manager view that it has been removed from its parent.
|
void |
removeTransformerListener(TransformerListener l)
Removes the specified transformer listener so that it no longer
receives transformer changed events from this view.
|
void |
removeViewDecoration(IlvManagerViewDecoration decoration)
Removes a decoration from the view.
|
void |
repaint(IlvRect rect)
Repaints a region of the view.
|
void |
repaint(long tm,
int x,
int y,
int width,
int height)
Repaints the specified rectangle of this component.
|
void |
setAntialiasing(boolean set)
Changes the antialiasing mode of the view.
|
void |
setAutoFitToContents(boolean set)
Changes the autofit mode of the view.
|
void |
setAutoFitToContents(boolean set,
Insets insets,
IlvManagerView.FitAreaCalculator areaCalculator,
int maxNumberOfIterations)
Changes the autofit mode of the view.
|
void |
setBackground(Color color)
Changes the background of the view.
|
void |
setBackgroundPattern(Image pattern)
Deprecated.
use
setBackgroundPatternLocation |
void |
setBackgroundPatternLocation(URL pattern)
Changes the background pattern of the view.
|
void |
setBlinkingMode(int mode)
Sets the mode of the blinking behavior of graphic objects displayed
in this view.
|
void |
setBounds(int x,
int y,
int width,
int height)
Reshapes the view to the specified bounding box.
|
void |
setCollapseExpandIconsEnabled(boolean enable)
Enables/disables that clicking on the expand/collapse icon of
manager frames and link bundles collapses or expands the objects.
|
void |
setComponentOrientation(ComponentOrientation o)
Sets the language-sensitive orientation that is to be used to order
the elements or text within this component.
|
void |
setContributingToViewBBox(int layer,
boolean value)
Allows to indicate whether the specified layer must be taken into
account when computing the bounding box of the view.
|
void |
setCursor(Cursor cursor)
Changes the cursor of the view.
|
void |
setDefaultGhostColor(Color color)
Changes the default ghost color for the view.
|
void |
setDefaultXORColor(Color color)
Changes the default XOR color for the view.
|
void |
setDoubleBufferFrozen(boolean freeze)
Sets whether the double buffer is frozen.
|
void |
setDoubleBuffering(boolean set)
Sets the manager view in double-buffering mode.
|
void |
setEventDispatching(boolean value)
Changes the way AWT events are dispatched.
|
void |
setGrid(IlvGrid grid)
Changes the grid of the view.
|
void |
setInteractor(IlvManagerViewInteractor interactor)
Changes the interactor of the view.
|
void |
setKeepingAspectRatio(boolean set)
Allows or inhibits the ability to have different
zoom factors along the x and y axes.
|
void |
setLayerCached(int layer,
boolean enabled)
Enables or disables the cache on a specified manager layer.
|
void |
setLocale(Locale locale)
Sets the locale of this view.
|
void |
setManager(IlvManager manager)
Changes the manager displayed by this manager view.
|
void |
setMaximumSize(Dimension maximumSize)
Sets the maximum size of the view to a constant
value.
|
void |
setMaxZoomXFactor(double zoomFactor)
Sets the maximal zoom factor allowed for the view in the x direction.
|
void |
setMaxZoomYFactor(double zoomFactor)
Sets the maximal zoom factor allowed for the view in the y direction.
|
void |
setMinimumSize(Dimension minimumSize)
Sets the minimum size of the view to a constant
value.
|
void |
setMinZoomXFactor(double zoomFactor)
Sets the minimal zoom factor allowed for the view in the x direction.
|
void |
setMinZoomYFactor(double zoomFactor)
Sets the minimal zoom factor allowed for the view in the y direction.
|
void |
setOptimizedTranslation(boolean set)
Changes the optimized translation mode.
|
void |
setPreferredSize(Dimension preferredSize)
Sets the preferred size of the view to a constant
value.
|
void |
setRedrawMode(int mode)
Changes the way invalid regions of the view are redrawn.
|
void |
setRegisteredAtToolTipManager(boolean registered)
Sets whether the view is registered at the
IlvToolTipManager . |
void |
setRepaintSkipThreshold(long delay)
Sets the minimum delay between repaint requests.
|
void |
setSelectedWhenPopupPreferred(boolean enable)
Sets whether
getPopupMenu(IlvPoint,IlvPopupMenuManager)
returns preferably the topmost selected object. |
void |
setTransformer(IlvTransformer t)
Changes the transformer of the view.
|
void |
setTransparent(boolean transparent)
Changes the transparency of the view.
|
void |
setTripleBufferedLayerCount(int n)
Sets the number of triple-buffered layers for this view.
|
void |
setULocale(com.ibm.icu.util.ULocale locale)
Sets the locale of this view.
|
void |
setViewMargins(Insets i)
Sets the margin obeyed by
computeBBox()
The margins are in view coordinates. |
void |
setVisible(int layer,
boolean value)
Modifies the visibility of the specified layer in the view.
|
void |
setWheelZoomingEnabled(boolean handleWheel)
Enables/disables zooming in response to movement of the mouse wheel
plus control key pressed.
|
void |
setWheelZoomingInverted(boolean inverted)
Sets whether the zooming facility of the mouse wheel is inverted.
|
void |
setZoomFactorRange(double minZoomFactor,
double maxZoomFactor)
Sets the minimal and maximal zoom factor allowed for the view.
|
void |
snapToGrid(IlvPoint point)
Changes the coordinates of the specified point to the
closest point of the grid.
|
protected void |
transformerChanged(IlvTransformer newTransformer,
IlvTransformer oldTransformer)
This method is called when the transformer changes.
|
void |
translate(double deltax,
double deltay,
boolean redraw)
Translates the view.
|
void |
update(Graphics g)
Updates the component.
|
void |
verifyTransformer()
Checks a transformer before
setting it to a view.
|
Rectangle |
visibleRect()
Returns the visible rectangle of the view.
|
void |
zoom(IlvPoint point,
double sx,
double sy,
boolean redraw)
Zooms the transformer of the view.
|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, isValidateRoot, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBounds, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getCursor, getGraphics, isCursorSet
getComponentOrientation
public static final RenderingHints.Key KEY_VIEW
RenderingHints.Key
is used to mark the
Graphics2D
instances which view is currently printed.public static final int THREADED_REDRAW
setRedrawMode(int)
,
Constant Field Valuespublic static final int DIRECT_REDRAW
setRedrawMode(int)
,
Constant Field Valuespublic static final int BLINKING_AUTOMATIC
setBlinkingMode(int)
,
Component.isShowing()
,
Constant Field Valuespublic static final int BLINKING_ENABLED
setBlinkingMode(int)
,
Component.isShowing()
,
Constant Field Valuespublic static final int BLINKING_DISABLED
setBlinkingMode(int)
,
Constant Field Valuespublic IlvManagerView(IlvManager manager, IlvTransformer t, com.ibm.icu.util.ULocale locale)
manager
- The manager to which the view is connected.t
- The transformation used to draw the content of the manager.
A value of null
is equivalent to an Identity transformer.locale
- The locale of this component.public IlvManagerView(IlvManager manager, IlvTransformer t)
IlvLocaleUtil.getCurrentULocale()
.manager
- The manager to which the view is connected.t
- The transformation used to draw the content of the manager.
A value of null
is equivalent to an Identity transformer.public IlvManagerView(IlvManager manager)
IlvLocaleUtil.getCurrentULocale()
.manager
- The manager to which the view is connected.public IlvManagerView()
public final IlvManager getManager()
null
.setManager(ilog.views.IlvManager)
public final void setManager(IlvManager manager)
null
argument to detach
the view from its manager.
When the manager changes, a ManagerChangedEvent
is
sent to all the manager changed listeners.manager
- The new manager.getManager()
,
addManagerChangedListener(ilog.views.event.ManagerChangedListener)
,
removeManagerChangedListener(ilog.views.event.ManagerChangedListener)
public void addManagerChangedListener(ManagerChangedListener listener)
setManager
is called.listener
- The listener.removeManagerChangedListener(ilog.views.event.ManagerChangedListener)
,
setManager(ilog.views.IlvManager)
public void removeManagerChangedListener(ManagerChangedListener listener)
listener
- The listener.addManagerChangedListener(ilog.views.event.ManagerChangedListener)
,
setManager(ilog.views.IlvManager)
protected void managerChanged(IlvManager oldManager, IlvManager newManager)
setManager
as
notification that the manager displayed by this view has changed.
This method sends a ManagerChangedEvent
to all the
listeners.public final void setTransformer(IlvTransformer t)
repaint
in order to do it.
This method will send a transformer changed event
to all transformer listeners.t
- The transformer. If the value is null
,
nothing is performed and no exception is raised.getTransformer()
,
addTransformer(IlvTransformer)
,
TransformerListener
,
addTransformerListener(ilog.views.event.TransformerListener)
,
removeTransformerListener(ilog.views.event.TransformerListener)
public final IlvTransformer getTransformer()
getTransformer
in interface IlvObjectInteractorContext
setTransformer(ilog.views.IlvTransformer)
,
addTransformer(IlvTransformer)
public final void addTransformer(IlvTransformer t)
setTransformer
with the
transformer: oldTransformer.compose(t)
.
Note that this method does not repaint the view.
You must call repaint
in order to do it.
This method will send a transformer changed event
to all transformer listeners.t
- The transformer. If the value is null
,
nothing is performed and no exception is raised.setTransformer(ilog.views.IlvTransformer)
,
getTransformer()
,
TransformerListener
,
addTransformerListener(ilog.views.event.TransformerListener)
,
removeTransformerListener(ilog.views.event.TransformerListener)
protected void transformerChanged(IlvTransformer newTransformer, IlvTransformer oldTransformer)
newTransformer
- The new transformer.oldTransformer
- The previous transformer.addTransformerListener(ilog.views.event.TransformerListener)
,
removeTransformerListener(ilog.views.event.TransformerListener)
public final void addTransformerListener(TransformerListener l)
l
- The transformer listener.removeTransformerListener(ilog.views.event.TransformerListener)
public final void removeTransformerListener(TransformerListener l)
l
- The transformer listener.addTransformerListener(ilog.views.event.TransformerListener)
public final boolean isKeepingAspectRatio()
true
if the view keeps the aspect ratio;
otherwise it returns false
.
Since any type of transformation can be used to display the
contents of a manager in a view, different zoom levels
can be used along the x and y axes. This
causes a distorted image.
When KeepingAspectRatio is true
, the view will
verify each modification of its transformer so that the zoom factor
remains the same along the x axis and the y axis.setKeepingAspectRatio(boolean)
public final void setKeepingAspectRatio(boolean set)
true
, the view will
verify each modification of its transformer so that the zoom factor
remains the same along the x axis and the y axis.set
- true
to maintain the aspect ratio,
or false
otherwise.isKeepingAspectRatio()
public final void setZoomFactorRange(double minZoomFactor, double maxZoomFactor)
minZoomFactor
- The minimal zoom factor for the view.maxZoomFactor
- The maximal zoom factor for the view.setMinZoomXFactor(double)
,
setMaxZoomXFactor(double)
,
setMinZoomYFactor(double)
,
setMaxZoomYFactor(double)
,
verifyTransformer()
public final void setMinZoomXFactor(double zoomFactor)
zoomFactor
- The minimal zoom factor in the x direction.
getMinZoomXFactor()
,
setMaxZoomXFactor(double)
,
isAtZoomXFactorLimit()
,
verifyTransformer()
public final double getMinZoomXFactor()
setMinZoomXFactor(double)
public final void setMaxZoomXFactor(double zoomFactor)
zoomFactor
- The maximal zoom factor in the x direction.
getMaxZoomXFactor()
,
setMinZoomXFactor(double)
,
isAtZoomXFactorLimit()
,
verifyTransformer()
public final double getMaxZoomXFactor()
setMaxZoomXFactor(double)
public final void setMinZoomYFactor(double zoomFactor)
zoomFactor
- The minimal zoom factor in the y direction.
getMinZoomYFactor()
,
setMaxZoomYFactor(double)
,
isAtZoomYFactorLimit()
,
verifyTransformer()
public final double getMinZoomYFactor()
setMinZoomYFactor(double)
public final void setMaxZoomYFactor(double zoomFactor)
zoomFactor
- The maximal zoom factor in the y direction.
getMaxZoomYFactor()
,
setMinZoomYFactor(double)
,
isAtZoomYFactorLimit()
,
verifyTransformer()
public final double getMaxZoomYFactor()
setMaxZoomYFactor(double)
public final boolean isAtZoomXFactorLimit()
true
if the zoom factor of the view reached
the minimal or the maximal zoom factor limit in the x direction when
the transformer was changed.
This can be used to detect whether an application needs to disable the controls (buttons, menu items) that perform zooming.
setMinZoomXFactor(double)
,
setMaxZoomXFactor(double)
public final boolean isAtZoomYFactorLimit()
true
if the zoom factor of the view reached
the minimal or the maximal zoom factor limit in the y direction when
the transformer was changed.
This can be used to detect whether an application needs to disable the controls (buttons, menu items) that perform zooming.
setMinZoomYFactor(double)
,
setMaxZoomYFactor(double)
public void setInteractor(IlvManagerViewInteractor interactor)
pushInteractor
.
The specified interactor becomes active for the view. This means that
all AWT events received by the view will be processed by this interactor.
Note that an interactor can only be used in one view at a time. So it is an
error to set the same interactor to several views even if this does
not generate any exception.
An interactor changed event is sent to all the interactor listeners.interactor
- The new interactor.getInteractor()
,
pushInteractor(ilog.views.IlvManagerViewInteractor)
,
InteractorListener
,
addInteractorListener(ilog.views.event.InteractorListener)
,
removeInteractorListener(ilog.views.event.InteractorListener)
public IlvManagerViewInteractor getInteractor()
null
otherwise.
If several interactors have been pushed to the view, this method
returns the interactor that is on top of the interactor stack,
that is, the interactor that is currently active.public void pushInteractor(IlvManagerViewInteractor interactor, AWTEvent evt)
interactor
- The interactor. If the value is null
,
no action is performed and no exception is raised.evt
- The event that causes the push.popInteractor()
,
setInteractor(ilog.views.IlvManagerViewInteractor)
,
getInteractor()
,
removeAllInteractors()
,
InteractorListener
,
addInteractorListener(ilog.views.event.InteractorListener)
,
removeInteractorListener(ilog.views.event.InteractorListener)
public void pushInteractor(IlvManagerViewInteractor interactor)
Note that an interactor can only be used in one view at a time, so it is an error to push the same interactor to several views even if this does not generate an exception. An interactor changed event is sent to all the interactor listeners.
interactor
- The interactor. If the value is null
,
no action is performed and no exception is raised.popInteractor()
,
setInteractor(ilog.views.IlvManagerViewInteractor)
,
getInteractor()
,
removeAllInteractors()
,
InteractorListener
,
addInteractorListener(ilog.views.event.InteractorListener)
,
removeInteractorListener(ilog.views.event.InteractorListener)
public IlvManagerViewInteractor popInteractor()
null
if the interactor
stack is empty.pushInteractor(ilog.views.IlvManagerViewInteractor)
,
setInteractor(ilog.views.IlvManagerViewInteractor)
,
getInteractor()
,
removeAllInteractors()
,
InteractorListener
,
addInteractorListener(ilog.views.event.InteractorListener)
,
removeInteractorListener(ilog.views.event.InteractorListener)
public void removeAllInteractors()
popInteractor
until the
interactor stack is empty.
Several interactor changed events may be sent to the interactor
listeners. Such an event will be sent for each interactor in
the interactor stack.public final void addInteractorListener(InteractorListener l)
l
- The interactor listener.removeInteractorListener(ilog.views.event.InteractorListener)
public final void removeInteractorListener(InteractorListener l)
l
- The interactor listener.addInteractorListener(ilog.views.event.InteractorListener)
protected void interactorChanged(IlvManagerViewInteractor current, IlvManagerViewInteractor previous)
current
- The new interactor (may be null
).previous
- The previous interactor (may be null
).InteractorListener
,
addInteractorListener(ilog.views.event.InteractorListener)
,
removeInteractorListener(ilog.views.event.InteractorListener)
,
popInteractor()
,
pushInteractor(ilog.views.IlvManagerViewInteractor)
,
setInteractor(ilog.views.IlvManagerViewInteractor)
,
getInteractor()
,
removeAllInteractors()
public final boolean isTransparent()
true
if the view is transparent.
The default value is false
.setTransparent(boolean)
public final void setTransparent(boolean transparent)
false
.
When setting the view transparent, or when using a transparent
background color of the view, it might be necessary to set the background
of the container of the view to non-opaque (for Swing components) or to
a transparent color (for AWT components). For example, if the view is
contained in a IlvJScrollManagerView
, the code is:
scroller = new IlvJScrollManagerView(managerView); // set a transparent background color scroller.setBackground(new Color(0,0,0,0)); // set the scroll manager view nonopaque scroller.setOpaque(false); // set the manager view transparent managerView.setTransparent(true);
transparent
- Set to true
to specify a transparent view.setDoubleBuffering(boolean)
,
isTransparent()
,
setBackgroundPatternLocation(java.net.URL)
public final boolean isAntialiasing()
true
if the antialiasing mode
of the view is on.setAntialiasing(boolean)
public final void setAntialiasing(boolean set)
The default value is false
.
Note that this does not affect the antialiasing mode of the text object
such as IlvText
, IlvLabel
, IlvZoomableLabel
and so on.
Text objects have their own antialiasing flag and do not depend on this flag.
set
- true
to turn on antialiasing mode.isAntialiasing()
public final boolean isAutoFitToContents()
true
if the view is in autofit
mode. In this mode, each time the view is resized and each time
the contents of the manager displayed by this view changes,
the transformer of the view
is adjusted so that the full contents of the manager becomes visible.
For this reason, it is useless to change the transformer of the view
when the view is in the autofit mode. By default the view is
not in this mode.setAutoFitToContents(boolean)
public final void setAutoFitToContents(boolean set)
The default value is false
.
set
- true
to turn on the autofit mode.isAutoFitToContents()
public final void setAutoFitToContents(boolean set, Insets insets, IlvManagerView.FitAreaCalculator areaCalculator, int maxNumberOfIterations)
The area is provided by the FitAreaCalculator
that can calculate the area depending on dynamic conditions.
Margins are preserved and a specified number of iterations is used for
computing the optimal transformer.
For details about these parameters, see
fitTransformerToArea
.
set
- true
to turn on the autofit mode.insets
- The margins around the manager contents. Set this value
to null
for no margins.areaCalculator
- The calculator for the area to be fit.
If null
, then the
bounding box
of all visible
graphics is used.maxNumberOfIterations
- The maximum number of iterations to be
used for computing the optimal transformer.isAutoFitToContents()
,
fitTransformerToContent()
,
fitTransformerToArea(Insets, FitAreaCalculator, int)
public final void setDoubleBuffering(boolean set)
The double-buffering technique is used to remove flickering when the view or some area of the view is repainted. When the view is in double-buffering mode, the repainting is first done on an off-screen bitmap and then the bitmap is copied to the screen.
Since the IlvManagerView
is a lightweight
component, the double buffering cannot be achieved
by this class alone. The view of
the manager must be encapsulated in a heavyweight
component; that is why
in an AWT application, the IlvManagerView
must be encapsulated in an IlvManagerViewPanel
or an IlvScrollManagerView
. In a Swing
application you may encapsulate the view by an
IlvJScrollManagerView
or IlvJManagerViewPanel
.
Note that in a Swing application, it is not necessary to set
double buffering on, since Swing already handles the
double buffering of all components.
Independently of this setting, the IlvManagerView
uses a
double buffer also to speed up the drawing (in particular scrolling and
panning via translate(double, double, boolean)
) when
optimized translation
is enabled.
If you want to avoid any use of a double buffer, you need to call
setDoubleBuffering(false); setOptimizedTranslation(false);This setting should not be confused with the double-buffering done by Swing. The Swing double-buffering can be turned off either locally, by calling
component.JComponent.setDoubleBuffered(boolean)
(false}
on this view and all its ancestors up to the JRootPane
, or
globally, by calling
repaintManager.setDoubleBufferingEnabled(false)
.set
- true
to turn on double buffering.isDoubleBuffering()
,
setDoubleBufferFrozen(boolean)
,
isOptimizedTranslation()
,
IlvManagerViewPanel
,
IlvScrollManagerView
,
IlvJScrollManagerView
,
IlvJManagerViewPanel
public final boolean isDoubleBuffering()
false
.setDoubleBuffering(boolean)
public void setDoubleBufferFrozen(boolean freeze)
When frozen, the double buffer is not updated with the most recent data. This method enables you to temporarily hide changes in the manager from being displayed. When the double buffer is frozen, repainting draws the frozen contents of the double buffer and not current manager content.
When the double buffer is unfrozen, the next repaint draws the
current manager content.
We recommend that you call Component.repaint()
immediately after
unfreezing the double buffer.
Note: Double buffering must be enabled before calling
setDoubleBufferFrozen
. To set double buffering, call
setDoubleBuffering(boolean)
.
Note: Proper interaction with the manager is not possible while the double buffer is frozen. We recommend that the buffer is frozen for very short time periods only.
freeze
- Set to true
to freeze the double buffer.
Set to false
to unfreeze the double buffer.RuntimeException
- when setDoubleBufferFrozen
is called
while double buffering is not enabled. To set double buffering, call
setDoubleBuffering(boolean)
.isDoubleBufferFrozen()
,
setDoubleBuffering(boolean)
,
repaint(IlvRect)
,
Component.repaint()
public boolean isDoubleBufferFrozen()
true
if the double buffer is frozen.setDoubleBufferFrozen(boolean)
,
setDoubleBuffering(boolean)
protected Image createDoubleBufferImage(int width, int height)
width
- The width of the imageheight
- The height of the imageprotected void doubleBufferedImageUpToDate(Image doubleBufferImage)
doubleBufferImage
- The double bufferpublic Image createImage(int width, int height)
-Dsun.java2d.pmoffscreen=false
on X11 systems.createImage
in class Component
public void setRegisteredAtToolTipManager(boolean registered)
IlvToolTipManager
.public boolean isRegisteredAtToolTipManager()
IlvToolTipManager
.public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h)
imageUpdate
in interface ImageObserver
imageUpdate
in class Component
public void update(Graphics g)
public void repaint(IlvRect rect)
repaint
in interface IlvObjectInteractorContext
rect
- The bounds of the region to be repainted.public void paint(Graphics g)
public void print(Graphics g, IlvRect area, IlvTransformer t, boolean includeBackground, boolean allLayers)
g
- The graphics to perform the drawings.area
- The rectangle to print, in the coordinate system of the
manager.t
- The transformer for placing the printed area on the page.includeBackground
- If true
the background will be
painted.allLayers
- If true
all the layers, even those
not visible, will be drawn.public boolean isOpaque()
public void setBounds(int x, int y, int width, int height)
protected void processEvent(AWTEvent evt)
IlvManagerViewInteractor.processEvent(AWTEvent)
).
If the view does not have an interactor, the event is processed by the
manager (see IlvManager.processEvent(AWTEvent, IlvManagerView)
).processEvent
in class Container
evt
- The event that will be processed.IlvManagerViewInteractor
public boolean isVisible(int layer)
true
,
it does not necessarily mean that the layer is
displayed because the layer may be globally invisible.
To determine if a layer is displayed in this view, you should use
the method:
IlvManager.isVisible(IlvManagerView view, int layer)
.layer
- The index of the layer.true
if the layer is visible,
otherwise false
.setVisible(int, boolean)
,
IlvManager.isVisible(ilog.views.IlvManagerView,int)
public void setVisible(int layer, boolean value)
IlvManager.setVisible(IlvManagerView, int layer, boolean set, boolean redraw)
.layer
- The index of the layer.value
- If true
, the layer will become visible.IlvManager.setVisible(ilog.views.IlvManagerView,int,boolean,boolean)
,
isVisible(int)
public boolean isContributingToViewBBox(int layer)
true
if the specified layer is taken into account
when computing the bounding box of the view. Otherwise, the method returns
false
.
The layers of a manager can be set as contributing or not on a per-view basis. This method indicates if the specified layer is taken into account when the bounding box if computed for this view only.
layer
- The index of the layer.true
if the layer is taken into account when computing
the bounding box of the view, otherwise returns false
.setContributingToViewBBox(int, boolean)
public void setContributingToViewBBox(int layer, boolean value)
This method can be used, for instance, to influence the behavior of
fitTransformerToContent(Insets, int)
. Only layers that contribute to
the bounding box are considered by this operation.
layer
- The index of the layer.value
- If and only if true
, the layer is contributing to the bounding
box of the view.isContributingToViewBBox(int)
public IlvRect computeBBox()
setViewMargins(java.awt.Insets)
public IlvRect computeBBox(IlvTransformer t)
IlvManager.isVisible(int)
and
isVisible(int)
).isContributingToViewBBox(int)
returns
false
are not taken into account.t
- Transformer used to compute the bbox
.
A null
value is equivalent to an identity transformer.setViewMargins(java.awt.Insets)
public void setViewMargins(Insets i)
computeBBox()
The margins are in view coordinates.
The margins have the following effects:
fitTransformerToContent()
will fit the view to the
content obeying the view margins.
IlvScrollManagerView
or
IlvJScrollManagerView
will obey the view margins;
for example, when scrolling to the top left position,
you will also see the view margin.
computeBBox()
,
computeBBox(IlvTransformer)
,
getViewMargins()
public Insets getViewMargins()
computeBBox()
.
The margins are in view coordinates.setViewMargins(java.awt.Insets)
public void fitTransformerToContent()
Notice the following:
fitTransformerToContent(boolean)
if you want to call this operation before the view is visible.Component.repaint()
if you need to do so.fitTransformerToContent(Insets)
with a null
argument (no margins). For details, see the documentation
of this method.
public void fitTransformerToContent(boolean delayUntilShowing)
Notice the following:
Component.isShowing()
). If the view is not yet
showing but the parameter delayUntilShowing
is
true
, it waits until the view becomes showing before
doing the operation. This ensures that the transformer will be adapted to
the effective size of the showing view even when called at a
non-showing view.
This method calls the method
fitTransformerToContent(Insets, int, boolean)
and sets
the insets to null
(no margins) and the number of iterations
to 10
. For details, see the documentation
of this method.
delayUntilShowing
- If true
and the view is not yet
showing, it waits until the view becomes showing and then
fits the transformer to the size. If false
or if the view
is already showing, it fits the transformer immediately to the size.fitTransformerToContent()
,
fitTransformerToContent(Insets, int, boolean)
,
Component.isShowing()
public void fitTransformerToContent(Insets insets)
Notice the following:
fitTransformerToContent(Insets, int, boolean)
if you want to call this operation before the view is visible.Component.repaint()
if you need to do so.
This method calls fitTransformerToContent(Insets, int)
and sets the number of iterations to 10
.
For details, see the documentation of this method.
insets
- The margins around this manager's content.fitTransformerToContent()
,
fitTransformerToContent(Insets, int)
,
fitTransformerToContent(Insets, int, boolean)
,
setAutoFitToContents(boolean)
public void fitTransformerToContent(Insets insets, int maxNumberOfIterations)
Notice the following:
IlvManager.isVisible(int)
and
isVisible(int)
).isContributingToViewBBox(int)
returns
false
are not taken into account.IlvGraphic.zoomable()
), this method may not
be able to find the exact transformer that perfectly fits
the visible area of the view. In this case, call this method with
maxNumberOfIterations
set to a greater value
to obtain a result closer to the optimum.fitTransformerToContent(Insets, int, boolean)
if you want to call this operation before the view is visible.Component.repaint()
if you need to do so.insets
- The margins around the manager's contents. Set this value
to null
for no margins.maxNumberOfIterations
- The maximum number of iterations to be
used for computing the optimal transformer.IlvGraphic.zoomable()
,
fitTransformerToContent(Insets)
,
fitTransformerToContent(Insets, int, boolean)
,
fitTransformerToArea(Insets, FitAreaCalculator, int)
,
setAutoFitToContents(boolean)
public void fitTransformerToContent(Insets insets, int maxNumberOfIterations, boolean delayUntilShowing)
fitTransformerToContent(Insets, int)
.
Notice the following:
Component.isShowing()
). If the view is not yet
showing but the parameter delayUntilShowing
is
true
, it waits until the view becomes showing before
doing the operation. This ensures that the transformer will be adapted to
the effective size of the showing view even when called at a
non-showing view.insets
- The margins around the manager contents. Set this value
to null
for no margins.maxNumberOfIterations
- The maximum number of iterations to be
used for computing the optimal transformer.delayUntilShowing
- If true
and the view is not yet
showing, it waits until the view becomes showing and then
fits the transformer to the size. If false
or if the view
is already showing, it fits the transformer immediately to the size.fitTransformerToContent(Insets, int)
,
fitTransformerToContent(boolean)
,
fitTransformerToArea(Insets, FitAreaCalculator, int, boolean)
,
Component.isShowing()
public void fitTransformerToArea(Insets insets, IlvManagerView.FitAreaCalculator areaCalculator, int maxNumberOfIterations)
FitAreaCalculator
that can calculate the area depending on dynamic conditions.
Margins are preserved and a specified number of iterations is used for
computing the optimal transformer.
For instance, in order to zoom to all selected objects, a
FitAreaCalculator
can be created that calculates the
area of all selected objects. If nonzoomable objects are selected
(see IlvGraphic.zoomable()
), this method may not
be able to find the exact transformer that perfectly fits all
selected objects in the view. In this case, call this method with
maxNumberOfIterations
set to a greater value
to obtain a result closer to the optimum.
This method computes the transformer based on the size of the view.
Therefore, if the view is not visible, the method does nothing.
See fitTransformerToArea(Insets, FitAreaCalculator, int, boolean)
if you want to call this operation before the view is visible.
Furthermore, this method does not repaint the view, so you must call
Component.repaint()
if you need to do so.
insets
- The margins around the manager contents. Set this value
to null
for no margins.areaCalculator
- The calculator for the area to be fit.
If null
, then the
bounding box
of all visible
graphics is used.maxNumberOfIterations
- The maximum number of iterations to be
used for computing the optimal transformer.IlvGraphic.zoomable()
,
fitTransformerToContent()
,
fitTransformerToArea(Insets, FitAreaCalculator, int, boolean)
protected void fitTransformerToAreaImpl(Insets insets, IlvManagerView.FitAreaCalculator areaCalculator, int maxNumberOfIterations, boolean callchanged)
fitTransformerToArea(Insets, FitAreaCalculator, int)
and of
computeTransformerFitToArea(Insets, FitAreaCalculator, int)
.public void fitTransformerToArea(Insets insets, IlvManagerView.FitAreaCalculator areaCalculator, int maxNumberOfIterations, boolean delayUntilShowing)
FitAreaCalculator
that can calculate the area depending on dynamic conditions.
Margins are preserved and a specified number of iterations is used for
computing the optimal transformer. For details, see
fitTransformerToArea(Insets, FitAreaCalculator, int)
.
Notice the following:
Component.isShowing()
). If the view is not yet
showing but the parameter delayUntilShowing
is
true
, it waits until the view becomes showing before
doing the operation. This ensures that the transformer will be adapted to
the effective size of the showing view even when called at a
non-showing view.insets
- The margins around the manager contents. Set this value
to null
for no margins.areaCalculator
- The calculator for the area to be fit.
If null
, then the
bounding box
of all visible
graphics is used.maxNumberOfIterations
- The maximum number of iterations to be
used for computing the optimal transformer.delayUntilShowing
- If true
and the view is not yet
showing and of positive size, it waits until the view becomes showing
and of positive size and then fits the transformer to the size. If
false
or if the view is already showing and of positive
size, it fits the transformer immediately to the size.fitTransformerToArea(Insets, FitAreaCalculator, int)
,
fitTransformerToContent(boolean)
,
Component.isShowing()
,
Component.getWidth()
,
Component.getHeight()
public IlvTransformer computeTransformerFitToArea(Insets insets, IlvManagerView.FitAreaCalculator areaCalculator, int maxNumberOfIterations)
FitAreaCalculator
that can calculate the area depending on dynamic conditions.
Margins are preserved and a specified number of iterations is used for
computing the optimal transformer.
For instance, in order to compute a transformer that will zoom to all
selected objects, a FitAreaCalculator
can be created that
calculates the area of all the selected objects. If nonzoomable objects are
selected (see IlvGraphic.zoomable()
), this method may not
be able to find the exact transformer that perfectly fits all
the selected objects in the view. In this case, call this method with
maxNumberOfIterations
set to a greater value
to obtain a result closer to the optimum.
This method computes the transformer based on the size of the view. Therefore, if the view is not visible, or there is any other reason that an appropriate transformer cannot be computed, this method returns the view's current transformer.
The returned transformer is meant to be applied through
setTransformer(IlvTransformer)
, not
addTransformer(IlvTransformer)
.
insets
- The margins around the manager contents, in pixels.
Set this value to null
for no margins.areaCalculator
- The calculator for the area to be fit.
If null
, then the
bounding box
of all visible
graphics is used.maxNumberOfIterations
- The maximum number of iterations to be
used for computing the optimal transformer.IlvGraphic.zoomable()
,
fitTransformerToContent()
,
fitTransformerToArea(Insets, FitAreaCalculator, int)
,
fitTransformerToArea(Insets, FitAreaCalculator, int, boolean)
public void ensureVisible(IlvRect r)
r
- The rectangle in the view coordinate system.public void ensureVisible(IlvPoint point)
ensureVisible
in interface IlvObjectInteractorContext
point
- The point in the view coordinate system.public Rectangle visibleRect()
(0, 0, getWidth(), getHeight())
and all visible rectangles of its ancestors.public void verifyTransformer()
setTransformer
or
addTransformer
. It is used to verify
that the zoom factor is the same along the x and y axis
if the view must maintain the aspect ratio and is within the
range of the minimal and maximal zoom factor.
You do not need to call this method.public final void zoom(IlvPoint point, double sx, double sy, boolean redraw)
point
- The center of the zoom.
The position of this point is not changed on the view.sx
- The x scaling factor.sy
- The y scaling factor.redraw
- If true
, the view is redrawn.public boolean isOptimizedTranslation()
translate
method will translate the
area of the view that remains visible by a BIT BLIT
operation. For this reason only the newly visible areas are repainted.
The default value is true
.
The optimized translation works best in combination with double buffering. If double buffering is permanently disabled but optimized translation is enabled, the view might decide to use a double buffering temporarily for a sequence of multiple translation, for instance when scrolling the view continuously. This improves the speed. To ensure that no double buffering is used at all, disable double buffering and optimized translation together.
public void setOptimizedTranslation(boolean set)
true
.isOptimizedTranslation()
public void translate(double deltax, double deltay, boolean redraw)
deltax
- The x translation in the view coordinate system.deltay
- The y translation in the view coordinate system.redraw
- If true
, the view is redrawn.isOptimizedTranslation()
public void setRepaintSkipThreshold(long delay)
THREADED_REDRAW
mode. So if you do not
want your repaint requests skipped, you can turn the view into DIRECT_REDRAW
mode.delay
- The minimum delay in millisecond between repaint requests.getRepaintSkipThreshold()
public long getRepaintSkipThreshold()
setRepaintSkipThreshold(long)
public void repaint(long tm, int x, int y, int width, int height)
update
method of this component.
Note that the repaint might be delayed if the "skip threshold" is set.
repaint
in class Component
setRepaintSkipThreshold(long)
public final void setRedrawMode(int mode)
invalidateRect
.mode
- Valid values for mode
are
IlvManagerView.DIRECT_REDRAW
and IlvManagerView.THREADED_REDRAW
.
For a THREADED_REDRAW
mode, the invalid regions
are redrawn by the repainting thread of AWT; for
DIRECT_REDRAW
, the regions are redrawn directly
by the current thread.getRedrawMode()
,
invalidateRect(ilog.views.IlvRect)
,
reDrawViews()
public final int getRedrawMode()
invalidateRegion
.public final void setBlinkingMode(int mode)
BLINKING_AUTOMATIC
(the default) -
Objects with blinking behavior displayed in this view actually only
blink if the view is showing. If the view is not showing, the blinking
timers do not occupy any resources for this view.
BLINKING_ENABLED
-
Objects with blinking behavior displayed in this view blink even if
the view is not showing. Since the view is not showing, you cannot see
the blinking, but the blinking timers still occupy resources for this
view.
This is mainly useful in advanced situations where the drawing buffer
of the non-showing view is copied to some other showing component.
BLINKING_DISABLED
-
Objects with blinking behavior displayed in this view do not blink at all.
This is useful for additional views such as an overview which
does not require blinking behaviors because they are already shown in
the main view. Disabling blinking behavior releases all resources of
blinking timers. If many blinking objects are displayed in many views,
disabling blinking for some of the views increases the performance
of the system.
getBlinkingMode()
,
Component.isShowing()
public final int getBlinkingMode()
setBlinkingMode(int)
public final IlvRegion getRegion()
reDrawViews
.public final void invalidateRect(IlvRect rect)
reDrawViews
.rect
- The rectangle to add.getRegion()
,
reDrawViews()
,
invalidateView()
public final void invalidateView()
public final void reDrawViews()
public final void reDrawViewsForBlinking()
invalidateRect(ilog.views.IlvRect)
,
getRegion()
,
invalidateView()
public final Color getDefaultXORColor()
public final void setDefaultXORColor(Color color)
color
- The new XOR color.getDefaultXORColor()
,
getDefaultGhostColor()
,
setDefaultGhostColor(java.awt.Color)
,
IlvManagerViewInteractor.drawGhost(java.awt.Graphics)
public final Color getDefaultGhostColor()
public final void setDefaultGhostColor(Color color)
color
- The new ghost color.getDefaultGhostColor()
,
setDefaultXORColor(java.awt.Color)
,
getDefaultXORColor()
,
IlvManagerViewInteractor.drawGhost(java.awt.Graphics)
public final URL getBackgroundPatternLocation()
null
if the view
has no background pattern.public final void setBackgroundPatternLocation(URL pattern)
pattern
- The URL of the image, or null
to remove the pattern.getBackgroundPatternLocation()
@Deprecated public final Image getBackgroundPattern()
getBackgroundPatternLocation
@Deprecated public final void setBackgroundPattern(Image pattern)
setBackgroundPatternLocation
public void setPreferredSize(Dimension preferredSize)
getPreferredSize
will always
return this value.setPreferredSize
in class Component
preferredSize
- The new preferred size of the view.getPreferredSize()
public Dimension getPreferredSize()
setPreferredSize
,
the method will return this size; otherwise it
returns the size of the view.getPreferredSize
in class Container
setPreferredSize(java.awt.Dimension)
public void setMaximumSize(Dimension maximumSize)
getMaximumSize
will always
return this value.
Setting the maximumSize
to null
restores the default behavior.setMaximumSize
in class Component
maximumSize
- The new maximum size of the view.getMaximumSize()
public Dimension getMaximumSize()
null
value,
this method returns it; otherwise it
returns the result of the call to the getMaximumSize
method of the superclass.getMaximumSize
in class Container
setMaximumSize(java.awt.Dimension)
public void setMinimumSize(Dimension minimumSize)
getMinimumSize
will always
return this value. Setting the minimumSize
to null
restores the default behavior.setMinimumSize
in class Component
minimumSize
- The new minimum size of the view.getMinimumSize()
public Dimension getMinimumSize()
null
value,
this method returns it; otherwise it
returns the result of the call to the getMinimumSize
method of the superclass.getMinimumSize
in class Container
setMinimumSize(java.awt.Dimension)
public void setCursor(Cursor cursor)
setCursor
in interface IlvObjectInteractorContext
setCursor
in class Component
cursor
- The cursor.public void setBackground(Color color)
setBackground
in class Component
color
- The color.setTransparent(boolean)
,
setBackgroundPatternLocation(java.net.URL)
public void addViewDecoration(IlvManagerViewDecoration decoration)
removeViewDecoration(ilog.views.IlvManagerViewDecoration)
public void removeViewDecoration(IlvManagerViewDecoration decoration)
addViewDecoration(ilog.views.IlvManagerViewDecoration)
public int getViewDecorationCount()
addViewDecoration(ilog.views.IlvManagerViewDecoration)
,
removeViewDecoration(ilog.views.IlvManagerViewDecoration)
public IlvManagerViewDecoration getViewDecoration(int index)
addViewDecoration(ilog.views.IlvManagerViewDecoration)
,
removeViewDecoration(ilog.views.IlvManagerViewDecoration)
public void setGrid(IlvGrid grid)
grid
- The new grid or null
to remove the grid.getGrid()
public IlvGrid getGrid()
getGrid
in interface IlvObjectInteractorContext
null
if there is no grid.setGrid(ilog.views.IlvGrid)
public final void snapToGrid(IlvPoint point)
snapToGrid
in interface IlvObjectInteractorContext
point
- The point to snap to the grid in the view coordinate system.setGrid(ilog.views.IlvGrid)
,
getGrid()
public void removeNotify()
removeNotify
in class Container
public void addNotify()
protected void processKeyEvent(KeyEvent event)
KeyListener
s to
this view's IlvJManagerViewPanel
or IlvJScrollManagerView
parent. Because the view is not a Swing component itself, this method
routes the keystrokes up the Swing container hierarchy so that any
registered keyboard actions and/or menu accelerators are properly handled.processKeyEvent
in class Component
public void setEventDispatching(boolean value)
false
then AWT events are dispatched only
to the view interactors or to the object interactors.
If true
then AWT events are also dispatched to
the listeners of the view and to the subcomponents.
The default value is true
.isEventDispatching()
,
processEvent(AWTEvent)
public boolean isEventDispatching()
true
if AWT events
are dispatched to the listeners on the view and
to the subcomponents. The default value is true
.
If the method returns false
then AWT events are
dispatched only to the view interactors or to the object interactors.public boolean isCollapseExpandIconsEnabled()
public void setCollapseExpandIconsEnabled(boolean enable)
enable
- true
if should be done
automatically for a MouseWheelEvent,
false
otherwise.isCollapseExpandIconsEnabled()
,
setEventDispatching(boolean)
protected boolean acceptCollapseExpandIconsEvent(MouseEvent e)
true
.e
- The mouse event, which is always a mouse pressed event.public boolean isWheelZoomingEnabled()
setWheelZoomingEnabled(boolean)
public void setWheelZoomingEnabled(boolean handleWheel)
handleWheel
- true
if zooming should be done
automatically for a MouseWheelEvent,
false
otherwise.isWheelZoomingEnabled()
public void setWheelZoomingInverted(boolean inverted)
Normally, turning the mouse wheel down (towards the user) zooms in, and turning the wheel up (away from the user) zooms out. Wheel zooming inversion reverses the sense of the zoom: Turning the wheel down (towards the user) zooms out, turning the wheel up (away from the user) zooms in.
Note: This only has an effect if the wheel zooming is enabled.
inverted
- Set to true
to invert the the mouse wheel
zooming facility. Set to false
for standard wheel zooming.isWheelZoomingInverted()
,
isWheelZoomingEnabled()
public boolean isWheelZoomingInverted()
true
when mouse wheel zooming is inverted.setWheelZoomingInverted(boolean)
,
isWheelZoomingEnabled()
public int getTripleBufferedLayerCount()
setTripleBufferedLayerCount(int)
,
invalidateTripleBuffer(boolean)
,
invalidateTripleBuffer(IlvRect, boolean)
public void invalidateTripleBuffer(boolean repaint)
setTripleBufferedLayerCount(int)
,
getTripleBufferedLayerCount()
public void invalidateTripleBuffer(IlvRect rect, boolean repaint)
rect
- The dirty rectangle to be refreshed.repaint
- Indicates whether a repaint is needed immediatelypublic void setTripleBufferedLayerCount(int n)
n
, layers
with indices in the range of [0, n-1] will be triple
buffered. All layers that are triple buffered are drawn
only once in an internal offscreen image. Further repainting
of the view will simply display the bitmap. Triple buffering
is then useful in an application that has a set of background
layers that do not change. It is also important that the
view does not zoom or pan excessively because changing the
transformer of the view will invalidate and recompute the
triple buffer.n
- The number of triple-buffered layers.getTripleBufferedLayerCount()
,
invalidateTripleBuffer(boolean)
,
invalidateTripleBuffer(IlvRect, boolean)
public void setLayerCached(int layer, boolean enabled)
layer
- The layer to be cached.enabled
- If true
, the layer will be cached. Otherwise, the cache
on the specified layer will be disabled.isLayerCached(int)
public boolean isLayerCached(int layer)
layer
- The given layer.true
, if the layer is cached.setLayerCached(int, boolean)
public JPopupMenu getPopupMenu(IlvPoint p, IlvPopupMenuManager popupManager)
You can override this method to display different
pop-up menus over different parts of your manager view.
This method can return null
to turn off the pop-up menu
for this manager view.
The default implementation tests whether there is a graphic object at the specified location. If there is one, it returns the pop-up menu of this graphic object. Otherwise it returns the pop-up menu of the main manager of this manager view.
Note: Before calling this method you must enable the
manager view pop-up menu mechanism by calling
IlvPopupMenuManager.registerView(ilog.views.IlvManagerView)
.
p
- The location of the mouse in view coordinates.popupManager
- The pop-up menu manager.IlvGraphic.getPopupMenu()
protected JPopupMenu getPopupMenu(IlvGraphic obj, IlvPoint p, IlvPopupMenuManager popupManager)
IlvGraphic.getPopupMenu(IlvPoint, IlvTransformer, IlvManagerView, IlvPopupMenuManager)
on the graphic object.
obj
- The graphic object.p
- The location of the mouse in view coordinates.popupManager
- The pop-up menu manager.IlvGraphic.getPopupMenu()
public void setSelectedWhenPopupPreferred(boolean enable)
getPopupMenu(IlvPoint,IlvPopupMenuManager)
returns preferably the topmost selected object.
If enabled and the pop-up menu is triggered at a point with many overlapping
objects, the pop-up menu of the topmost selected object is chosen.
If disabled and the pop-up menu is triggered at a point with many overlapping
objects, the pop-up menu of the topmost object is chosen whether
it is selected or not.
If the pop-up menu is triggered at a point where no objects overlap,
this option has no effect.isSelectedWhenPopupPreferred()
public boolean isSelectedWhenPopupPreferred()
getPopupMenu(IlvPoint,IlvPopupMenuManager)
returns preferably the topmost selected object.setSelectedWhenPopupPreferred(boolean)
public boolean isInSwingParent()
true
if the IlvManagerView
is used
in a Swing context (i.e its parent is a JComponent
),
false
otherwise. This method is used by
IlvManagerViewInteractor
that need to create either AWT
or Swing Components.public void setComponentOrientation(ComponentOrientation o)
java.awt.Component
for details.setComponentOrientation
in interface IlvComponentOrientationAware
setComponentOrientation
in class Component
o
- The new component orientation.IlvComponentOrientationAware.getComponentOrientation()
public final com.ibm.icu.util.ULocale getStoredULocale()
public com.ibm.icu.util.ULocale getULocale()
getULocale
in interface IlvULocaleAware
IlvULocaleAware.setULocale(com.ibm.icu.util.ULocale)
public void setULocale(com.ibm.icu.util.ULocale locale)
setULocale
in interface IlvULocaleAware
locale
- The new locale.IlvULocaleAware.getULocale()
public void setLocale(Locale locale)
setULocale(com.ibm.icu.util.ULocale)
, because the class
ULocale
can contain more information such as collation
or currency than the Locale
.public static void initDisplayInfo()
public static IlvManagerView getCurrentView(Graphics g)
Graphics
.
This method can be used inside IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer)
to determine
the view that is currently drawn.
It can return null
, for instance
when printing or when drawing without a view.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.