public class IlvGroupBag extends Object implements Serializable
IlvGroupBag
is used to manage logical groups of
graphic objects contained in a manager.
An IlvGroupBag
can contain groups (instances of the class
IlvGroup
) and value sources (instances of the class
IlvValueSource
). The groups and value sources contained in a
group bag can be interconnected with the subscribe
method of the
class IlvGroupElement
.
An IlvGroupBag
is used in conjunction with an
IlvManager
. To use groups in a manager (or in a grapher), you
first create the IlvManager
instance, then you create an
IlvGroupBag
and associate it with the manager. The
IlvGroupBag
class includes methods for adding, removing,
finding, and selecting groups.
The IlvGroupBag
is separate from the IlvManager
so
that you can use groups in any subclass of IlvManager
, including
IlvGrapher
and your own subclasses.
Modifier and Type | Field and Description |
---|---|
static int |
LOCAL_REDRAW_FOR_ALL
Enables local redraw for all threads.
|
static int |
LOCAL_REDRAW_FOR_ANIMATIONS
Enables local redraw only for animations (like blinking or continuous
rotations).
|
static int |
NO_LOCAL_REDRAW
Disables local redraw for all threads.
|
Constructor and Description |
---|
IlvGroupBag()
Creates a new
IlvGroupBag implementing grouping features. |
IlvGroupBag(IlvManager manager)
Creates a new
IlvGroupBag implementing grouping features for
the specified manager. |
Modifier and Type | Method and Description |
---|---|
void |
addGroup(IlvGroup group)
Adds a group to this group bag.
|
void |
addLibrary(IlvPrototypeLibrary lib)
Adds a prototype library to the groups bag.
|
void |
addValueSource(IlvValueSource valueSource)
Adds a value source (for example, a clock value source) to the list of
value sources associated with this group bag.
|
void |
deSelectAllGroups(boolean redraw)
Deselects all the groups in the group bag.
|
void |
deSelectGroup(IlvGroup group,
boolean redraw)
Deselects a group contained in the manager associated with the group bag.
|
IlvGroup |
getGroup(String name)
Retrieves a group contained in the manager associated with this group bag
from its name.
|
static IlvGroupBag |
getGroupBag(IlvManager manager)
Returns the group bag associated with the specified manager, or
null if the manager has no associated group bag. |
int |
getGroupCount()
Returns the number of groups contained in the manager associated with this
group bag.
|
Enumeration |
getGroups()
Returns the groups contained in the manager associated with this group bag.
|
Enumeration |
getLibraries()
Returns all the prototype libraries of the group bag.
|
int |
getLocalRedraw()
Returns the local redraw policy.
|
IlvManager |
getManager()
Returns the manager associated with this group bag.
|
Enumeration |
getSelectedGroups()
Returns the groups that are selected in the group bag.
|
IlvValueSource |
getValueSource(String name)
Retrieves a value source contained in the group bag from its name.
|
Enumeration |
getValueSources()
Returns the value sources associated with this group bag.
|
static boolean |
isCheckBehaviorOverflows()
Returns
true if the checking of infinite recursive calls is
enabled. |
boolean |
isGroupSelectionEnabled()
Returns the automatic group selection flag for the group bag.
|
boolean |
isSelected(IlvGroup group)
Checks whether a group is selected, that is, if it has an associated
IlvGroupFrame created by selectGroup . |
void |
removeAllGroups()
Removes all the group from this group bag.
|
void |
removeAllValueSources()
Clears the list of value sources associated with this group bag.
|
void |
removeGroup(IlvGroup group)
Removes a group from this group bag.
|
void |
removeLibrary(IlvPrototypeLibrary lib)
Removes a prototype library from the group bag.
|
void |
removeValueSource(IlvValueSource valueSource)
Removes a value source (for example, a clock value source) from the list of
value sources associated with this group bag.
|
void |
replaceGroup(IlvGroup oldGroup,
IlvGroup group)
Replaces a group contained in this group bag with a new one.
|
void |
selectGroup(IlvGroup group,
boolean redraw)
Selects a group contained in the manager associated with this group bag.
|
void |
selectGroup(IlvGroup group,
IlvGroupFrame frame,
boolean redraw)
Selects a group contained in the manager associated with this group bag,
using an existing group frame.
|
static void |
setCheckBehaviorOverflows(boolean checkBehaviorOverflows)
Enables or disables the checking of infinite recursive calls of behaviors.
|
void |
setGroupSelectionEnabled(boolean enabled)
Enables or disables the automatic selection of groups in the group bag.
|
void |
setLocalRedraw(int localRedraw)
Sets the local redraw policy for this group bag.
|
void |
setManager(IlvManager manager)
Associates a manager with this group bag.
|
public static final int NO_LOCAL_REDRAW
setLocalRedraw(int)
,
Constant Field Valuespublic static final int LOCAL_REDRAW_FOR_ANIMATIONS
setLocalRedraw(int)
,
Constant Field Valuespublic static final int LOCAL_REDRAW_FOR_ALL
setLocalRedraw(int)
,
Constant Field Valuespublic IlvGroupBag()
IlvGroupBag
implementing grouping features.
The group bag must be attached to a manager by calling the
setManager
method.
setManager(ilog.views.IlvManager)
public IlvGroupBag(IlvManager manager)
IlvGroupBag
implementing grouping features for
the specified manager.manager
- the manager with which the group bag is associated.public void setManager(IlvManager manager)
IlvSelectInteractor
associated with a view of the
manager will treat the groups contained in the group bag as single objects.
The groups will be selected, moved and resized as if they were elementary
graphic object.
read
and write
methods of the manager
will load and save the groups and the prototype libraries contained in the
group bag.
If the group bag was already associated with a manager, the previous manager is detached from the group bag, and it will not be able to handle groups any more.
If a file had previously been loaded in the manager using the
setFileName
method, this file is reloaded. This ensures that,
if the file contained prototype instances, these instances are created and
added to the group bag.
manager
- the manager with which the group bag is associated.IlvSelectInteractor
,
IlvManager.read(java.io.InputStream)
,
IlvManager.write(ilog.views.io.IlvOutputStream)
,
IlvManager.setFileName(java.net.URL)
public IlvManager getManager()
public static IlvGroupBag getGroupBag(IlvManager manager)
null
if the manager has no associated group bag.public void addValueSource(IlvValueSource valueSource)
valueSource
- the value source to be added.public void removeValueSource(IlvValueSource valueSource)
valueSource
- the value source to be removed.public void removeAllValueSources()
public Enumeration getValueSources()
IlvValueSource
instances.public IlvValueSource getValueSource(String name)
name
- the name of the property source.null
if
the value source was not found.public void addGroup(IlvGroup group)
group
- the group to be added.public void removeGroup(IlvGroup group)
group
- the group to be removed.public void replaceGroup(IlvGroup oldGroup, IlvGroup group)
oldGroup
- the group to be replaced.group
- the new group to be added instead of oldGroup
.public void removeAllGroups()
public Enumeration getGroups()
IlvGroup
objects.public int getGroupCount()
IlvGroup
objects.public IlvGroup getGroup(String name)
name
- the name of the group.null
if the
group was not found.public void selectGroup(IlvGroup group, boolean redraw)
IlvGroupFrame
object is created for this group, and this
graphic group is selected.group
- the group to be selected.redraw
- if true
, the appropriate region of the manager is
redrawn.public void selectGroup(IlvGroup group, IlvGroupFrame frame, boolean redraw)
If frame
is non-null, this group frame is used as the
selection frame for the group. Otherwise, a new IlvGroupFrame
object is created for this group, and the frame is selected.
This method is intended to be used for undoing the deselection of a group
in an editor. In common situations, you should use the other
selectGroup
method.
group
- the group to be selected.frame
- the frame to be used as the selection feedback.redraw
- if true
, the appropriate region of the manager is
redrawn.selectGroup(ilog.views.prototypes.IlvGroup, boolean)
public void deSelectGroup(IlvGroup group, boolean redraw)
group
- the group to be deselected.redraw
- if true
, the appropriate region of the manager is
redrawn.public Enumeration getSelectedGroups()
IlvGroup
objects.public void deSelectAllGroups(boolean redraw)
redraw
- if true
, the appropriate region of the manager is
redrawn.public boolean isSelected(IlvGroup group)
IlvGroupFrame
created by selectGroup
.true
if the group is selected and false
otherwise.public void addLibrary(IlvPrototypeLibrary lib)
This method is intended to be used by GUI editors.
public void removeLibrary(IlvPrototypeLibrary lib)
This method is intended to be used by GUI editors.
public Enumeration getLibraries()
This method is intended to be used by GUI editors.
IlvPrototypeLibrary
objects.public void setGroupSelectionEnabled(boolean enabled)
enabled
is true
, when a graphic object inside a
group is selected by the manager associated with the group bag, the top
level ancestor of the group is selected by a call to
selectGroup
.public boolean isGroupSelectionEnabled()
setGroupSelectionEnabled(boolean)
public void setLocalRedraw(int localRedraw)
When local redraw is enabled, JViews immediately repaints the objects that have been modified, instead of queueing a repaint event. Using local redraw can speed up repaint operations when only a few small objects must be redrawn and/or when animations (such as blinking or rotating) are used.
If localRedraw
is LOCAL_REDRAW_FOR_ANIMATIONS
, local
redraw is enabled only for animations (for example, prototypes that have a
IlvBlinkBehavior
or a IlvRotateBehavior
).
If localRedraw
is LOCAL_REDRAW_FOR_ALL
, local redraw
is enabled for all threads.
If localRedraw
is NO_LOCAL_REDRAW
, local redraw is
disabled for all threads.
localRedraw
- The new local redraw policy.NO_LOCAL_REDRAW
,
LOCAL_REDRAW_FOR_ANIMATIONS
,
LOCAL_REDRAW_FOR_ALL
public int getLocalRedraw()
setLocalRedraw(int)
,
NO_LOCAL_REDRAW
,
LOCAL_REDRAW_FOR_ANIMATIONS
,
LOCAL_REDRAW_FOR_ALL
public static void setCheckBehaviorOverflows(boolean checkBehaviorOverflows)
The default value is false
. but the flag is set to
true
by the
IlvPrototypeLibrary.registerEditor(IlvPrototypeLibraryEditor)
method (so overflow checking is enabled in Composer in particular).
checkBehaviorOverflows
- If true
, behavior overflows are checked, otherwise
overflows are not checked.public static boolean isCheckBehaviorOverflows()
true
if the checking of infinite recursive calls is
enabled.setCheckBehaviorOverflows(boolean)
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.