コード例 #1
0
  private void insertTabImpl(String title, Icon icon, Component component, String tip, int index) {
    String tabid = component.getName();
    if (tabid == null) {
      tabid = "WIN" + new java.rmi.server.UID();
      component.setName(tabid);
    }

    Component old = tabIndex.get(tabid);
    if (old != null) {
      if (indexOfComponent(old) >= 0) {
        setSelectedComponent(old);
        return;
      }
    }

    if (component instanceof OSTabbedView) {
      String s = ((OSTabbedView) component).getTitle();
      if (s != null && s.trim().length() > 0) {
        title = s;
      }
    }

    super.insertTab(title, icon, component, tip, index);
    setSelectedIndex(index);
    tabIndex.put(tabid, component);
    OSManager.getInstance().registerView(tabid, new OSViewImpl(component));
  }
コード例 #2
0
  protected boolean beforeClose(Component component) {
    int idx = indexOfComponent(component);
    if (idx >= 0) {
      String title = getTitleAt(idx);
      tabIndex.remove(title);

      String cname = component.getName();
      if (cname != null) {
        tabIndex.remove(cname);
        OSManager.getInstance().unregisterView(cname);
      }
    }
    return true;
  }