Cytoscape 3.0.1 API

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.


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
static double USE_ALPHABETIC_ORDER
           
 
Method Summary
 void addMenu(JMenu newSubmenu, double gravity)
          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.
 Component 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 Detail

USE_ALPHABETIC_ORDER

static final double USE_ALPHABETIC_ORDER
See Also:
Constant Field Values
Method Detail

getMenu

Component getMenu()
Returns the JPopupMenu or JMenu that this gravity tracker tracks.

Returns:
the JPopupMenu or JMenu that this gravity tracker tracks

addMenuItem

void addMenuItem(JMenuItem newMenuItem,
                 double gravity)
Adds a new menu item into a position based on "gravity" of the new item.

Parameters:
newMenuItem - the new item to insert into the menu
gravity - the weight determining the insert position (use USE_ALPHABETIC_ORDER if you want alphabetic ordering)

addMenu

void addMenu(JMenu newSubmenu,
             double gravity)
Adds a new submenu into a position based on "gravity" of the new item.

Parameters:
newSubmenu - the new submenu to insert into the menu
gravity - 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

void removeComponent(Component component)
Removes an item from this tracker and the corresponding menu.

Parameters:
component - the item that is to be removed

Cytoscape 3.0.1 API

Copyright 2011 Cytoscape Consortium. All rights reserved.