示例#1
0
 /**
  * member method to create a toolbar button for this tool, it is intended that this class be
  * overridden within more able GUI environments (in Swing we should have a tabbed interface)
  *
  * @param item the description of this tool
  */
 protected void addThisTool(final MenuItemInfo item) {
   // see if this is an action button, or it toggles as part of a group
   if (item.getToggleGroup() == null) {
     _theToolbar.addTool(item.getTool(), item.getShortCut(), item.getMnemonic());
   } else {
     _theToolbar.addToggleTool(
         item.getMenuName(), item.getTool(), item.getShortCut(), item.getMnemonic());
   }
 }
示例#2
0
  /** get ready to close, set all local references to null, to assist garbage collection */
  public void close() {
    // we'll also try to remove all of the tools
    final Enumeration<MenuItemInfo> iter = _theTools.elements();
    while (iter.hasMoreElements()) {
      final MenuItemInfo mn = iter.nextElement();
      mn.close();
    }

    // clear the dangling reference to the undo buffer
    _rightClicker.closeMe();
    _toteAdapter = null;

    // clear the file drop listener
    if (_dropSupport != null) _dropSupport.removeComponent(getChart().getPanel());

    _dropSupport.removeFileDropListener(this);

    // now remove references to the tools themselves
    _theTools.removeAllElements();

    _theChart.close();
    _theChart = null;

    if (_theTote != null) {
      _theTote.closeMe();
      _theTote = null;
    }
    if (_theToolbar != null) _theToolbar.close();
    _theToolbar = null;
    _theProperties = null;
    _theStatusBar = null;

    _theSession = null;
  }