Package org.cytoscape.util.swing
Interface GravityTracker
- All Known Implementing Classes:
MenuGravityTracker
,PopupMenuGravityTracker
public interface GravityTracker
This interface sepecifies a tracker that will be used to insert items (submenus, menu items
and separators) into a menu based on their "gravity" or "weight". Items with higher gravity
will appear further down the menu.
Module: swing-util-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>swing-util-api</artifactId> </dependency>
Cytoscape Backwards Compatibility (API Interface): We expect that this interface will be used but not implemented by developers using this interface. As such, we reserve the right to add methods to the interface as part of minor version upgrades. We will not remove methods for any changes other than major version upgrades.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a new submenu into a position based on "gravity" of the new item.void
addMenuItem
(JMenuItem newMenuItem, double gravity) Adds a new menu item into a position based on "gravity" of the new item.void
addMenuSeparator
(double gravity) Adds a separator into a position based on "gravity" of the new item.getMenu()
Returns the JPopupMenu or JMenu that this gravity tracker tracks.void
removeComponent
(Component component) Removes an item from this tracker and the corresponding menu.
-
Field Details
-
USE_ALPHABETIC_ORDER
static final double USE_ALPHABETIC_ORDER- See Also:
-
-
Method Details
-
getMenu
Component getMenu()Returns the JPopupMenu or JMenu that this gravity tracker tracks.- Returns:
- the JPopupMenu or JMenu that this gravity tracker tracks
-
addMenuItem
Adds a new menu item into a position based on "gravity" of the new item.- Parameters:
newMenuItem
- the new item to insert into the menugravity
- the weight determining the insert position (use USE_ALPHABETIC_ORDER if you want alphabetic ordering)
-
addMenu
Adds a new submenu into a position based on "gravity" of the new item.- Parameters:
newSubmenu
- the new submenu to insert into the menugravity
- the weight determining the insert position
-
addMenuSeparator
void addMenuSeparator(double gravity) Adds a separator into a position based on "gravity" of the new item.- Parameters:
gravity
- the weight determining the insert position
-
removeComponent
Removes an item from this tracker and the corresponding menu.- Parameters:
component
- the item that is to be removed
-