Exemplo n.º 1
0
 private void handleHiddenTabListTab() {
   if (indexOfComponent(hiddenComponent) >= 0) {
     // Tab is showing, remove it - it might not be needed or may no longer be at the end
     super.remove(hiddenComponent);
   }
   if (this.removedTabList.size() > 0) {
     // Only re-add tab if there are hidden ones
     super.addTab("", PLUS_ICON, hiddenComponent);
   }
 }
Exemplo n.º 2
0
 private void addTabPanel(List<AbstractPanel> panelList, TabbedPanel tab) {
   AbstractPanel panel = null;
   for (int i = 0; i < panelList.size(); i++) {
     try {
       panel = panelList.get(i);
       tab.add(panel, panel.getName());
       // ZAP: added icon
       tab.addTab(panel.getName() + " ", panel.getIcon(), panel);
     } catch (Exception e) {
       // ZAP: Log the exception
       logger.error(e.getMessage(), e);
     }
   }
 }
Exemplo n.º 3
0
  public void addTab(
      String title, Icon icon, final Component c, boolean hideable, boolean visible, int index) {
    if (c instanceof AbstractPanel) {
      ((AbstractPanel) c).setParent(this);
      ((AbstractPanel) c).setTabIndex(index);
      ((AbstractPanel) c).setHideable(hideable);
    }

    if (index == -1 || index > this.getTabCount()) {
      index = this.getTabCount();
    }
    if (icon instanceof ImageIcon) {
      icon = DisplayUtils.getScaledIcon((ImageIcon) icon);
    }

    super.insertTab(title, icon, c, c.getName(), index);

    if (!this.fullTabList.contains(c)) {
      this.fullTabList.add(c);
    }

    int pos = this.indexOfComponent(c);
    // Now assign the component for the tab

    this.setTabComponentAt(
        pos, new TabbedPanelTab(this, title, icon, c, hideable, this.isTabPinned(c)));

    if (!visible) {
      setVisible(c, false);
    }

    handleHiddenTabListTab();
  }
Exemplo n.º 4
0
  /**
   * {@inheritDoc}
   *
   * <p>Overridden to call the method {@code AbstractPanel#tabSelected()} on the currently selected
   * {@code AbstractPanel}, if any.
   *
   * @see AbstractPanel#tabSelected()
   */
  @Override
  protected void fireStateChanged() {
    super.fireStateChanged();

    Component comp = getSelectedComponent();
    if (comp instanceof AbstractPanel) {
      ((AbstractPanel) comp).tabSelected();
    }
  }
Exemplo n.º 5
0
 /** Set the title of the tab when hiding/showing tab names. */
 @Override
 public void setTitleAt(int index, String title) {
   Component tabCom = this.getTabComponentAt(index);
   if (tabCom != null && tabCom instanceof JPanel) {
     Component c = ((JPanel) tabCom).getComponent(0);
     if (c != null && c instanceof JLabel) {
       ((JLabel) c).setText(title);
     }
   } else {
     super.setTitleAt(index, title);
   }
 }