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

    Fields
    Modifier and Type
    Field
    Description
    static final double
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    Returns the JPopupMenu or JMenu that this gravity tracker tracks.
    void
    Removes an item from this tracker and the corresponding menu.
  • Field Details

  • 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

      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