skip to main content
Maps > Programmer's documentation > Rogue Wave JViews Framework Advanced Features > Nested managers and nested graphers > Adding a manager frame
 
Adding a manager frame
Explains how to add and customize a frame around the objects in a nested manager.
*Defining and drawing a default frame and its margins
*Explains how to define a frame around the objects in a nested manager and how to set the margins.
*Using the default frame
*Explains how to use the default frame around the objects in a nested manager.
*Using the constant mode frame
*Describes the behavior of the constant mode frame, which you can use instead of the default frame.
Defining and drawing a default frame and its margins
When a manager is nested, a frame can be drawn around the objects it contains.
A default frame is provided when you create a nested manager; the default frame is defined by the class IlvDefaultManagerFrame.
Default manager frame
Defining the frame
The frame around a nested manager is defined by the interface IlvManagerFrame. The IlvManagerFrame interface defines the margin that will be added around the manager. It defines how the frame is drawn and how hit testing on the frame is performed.
To specify the frame that must be drawn around the manager, you use the following methods of the IlvManager class:
 
void setFrame(IlvManagerFrame frame)
 
IlvManagerFrame getFrame()
Note that you can remove the frame from the manager using the setFrame method with a null parameter.
Defining the margins
The following methods of the IlvManagerFrame interface define the margins that are added around the manager:
 
float getBottomMargin(IlvManager manager, IlvTransformer t)
 
float getLeftMargin(IlvManager manager, IlvTransformer t)
 
float getRightMargin(IlvManager manager, IlvTransformer t)
 
float getTopMargin(IlvManager manager, IlvTransformer t)
Manager frame margins
Drawing the default frame
The IlvManagerFrame interface provides a method to draw the frame:
 
void draw(IlvManager manager, IlvRect bbox, Graphics g, IlvTransformer t)
This method provides the manager with its bounding box in the view coordinate system that already takes the margins into account. The IlvDefaultManagerFrame fills the background and makes a border around the manager. This class also puts a title at the top of the manager that corresponds to the name of the manager, as you can see in Manager frame margins.
If the frame implementation fills the background of the manager, the frame is an opaque frame and the following method must return true:
 
boolean isOpaque(IlvManager manager)
The IlvDefaultManagerFrame object can be opaque or transparent.
*If the frame is opaque, graphic objects under the nested manager are hidden. This disallows manipulation of these graphic objects.
*If the frame is transparent, graphic objects under the nested manager are visible. This allows manipulation of the graphic objects, whether covered by the frame or not.
Using the default frame
Hit testing
To allow hit testing on the frame, the interface provides the contains method:
 
boolean contains(IlvManager manager, IlvPoint p, IlvPoint tp, IlvTransformer t)
If the frame is transparent, this method must return true for a possible border and not for the background.
Saving the frame to an IVL file
To be able to save the frame to an IVL file, the implementation must be a public class that also implements the IlvPersistentObject interface.
Copying a frame
To be able to copy a manager that has a frame, the frame must implement the copy method of the interface in such a way that it creates a clone of the frame:
 
IlvManagerFrame.copy()
Using the constant mode frame
Instead of the IlvDefaultManagerFrame, you can use the IlvConstantModeManagerFrame, a manager frame supplied with Rogue Wave JViews that handles the resize event automatically when a user reshapes a submanager. IlvConstantModeManagerFrame keeps the zoom level of the submanager unchanged by adjusting the frame margins to match the required size.
A submanager with the IlvConstantModeManagerFrame frame set has the following behavior:
*Margins are never negative.
*A minimum margin size can be set.
*The default margin size is 0.
*The submanager can only be translated.
*The frame reacts to the IlvManager.moveResize() method but not IlvManager.applyTransform(). Call IlvManager.applyTransform() to apply a specific transformation only.
*While reshaping the submanager by dragging a handle, the margin next to the handle is adjusted first. If this margin is reduced to zero, the margin on the other side of the frame is adjusted.
*When both left and right margins of a IlvConstantModeManagerFrame object become zero, the submanager stops the reshape operation.
*IlvConstantModeManagerFrame objects listens for submanager or grapher content changes. When the bounding box of the submanager grows, in order to keep the global bounding box constant the frame first tries to reduce margins.
For an example of how to use a manager frame, see <installdir> /jviews-framework/codefragments/subgraphs/index.html.

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.