Esempio n. 1
0
  public void add(final CytoPanelComponent comp) {
    if (comp instanceof CytoPanelComponent2) {
      final CytoPanelComponent2 comp2 = (CytoPanelComponent2) comp;

      if (comp2.getIdentifier() == null)
        throw new NullPointerException("'CytoPanelComponent2.identifier' must not be null");

      componentsById.put(comp2.getIdentifier(), comp2);
    }

    // Check our sizes, and override, if necessary
    checkSizes(comp.getComponent());
    // add tab to JTabbedPane
    tabbedPane.addTab(comp.getTitle(), comp.getIcon(), comp.getComponent());
    // send out a notification
    notifyListeners(NOTIFICATION_COMPONENT_ADDED);
  }
Esempio n. 2
0
  public void remove(CytoPanelComponent comp) {
    tabbedPane.remove(comp.getComponent());

    if (comp instanceof CytoPanelComponent2)
      componentsById.remove(((CytoPanelComponent2) comp).getIdentifier());
  }
Esempio n. 3
0
  @Override
  public int indexOfComponent(String identifier) {
    final CytoPanelComponent cpComp = componentsById.get(identifier);

    return cpComp != null ? indexOfComponent(cpComp.getComponent()) : -1;
  }