/**
   * Removes the specified <code>JSChannelsPane</code> from the view.
   *
   * @param chnPane The <code>JSChannelsPane</code> to be removed.
   * @return <code>true</code> if the specified code>JSChannelsPane</code> is actually removed from
   *     the view, <code>false</code> otherwise.
   */
  public boolean removeChannelsPane(JSChannelsPane chnPane) {
    chnPane.removeListSelectionListener(this);

    tabbedPane.remove(chnPane);
    boolean b = super.removeChannelsPane(chnPane);
    for (int i = 0; i < miList.size(); i++) {
      A4n.MoveChannelsTo a = (A4n.MoveChannelsTo) miList.get(i).getAction();
      if (a.getChannelsPane().equals(chnPane)) {
        miList.remove(i);
        break;
      }
    }

    updateTabsMenu();

    if (getChannelsPaneCount() == 1) {
      A4n.closeChannelsTab.setEnabled(false);
      A4n.editTabTitle.setEnabled(false);
      tabbedPane.remove(getChannelsPane(0));
      channelsPane.remove(tabbedPane);
      channelsPane.add(getChannelsPane(0));
    }

    return b;
  }
Exemple #2
0
  protected void back() {

    Tab tabee = tabAccess.get(tab.getSelectedIndex());
    MyEditorPane p = tabee.getBeforPane();

    JScrollPane scPane = new JScrollPane(p);
    int i = tab.getSelectedIndex();
    tabcreate = false;
    change = false;
    tab.remove(i);
    change = false;
    tabcreate = false;
    tab.insertTab(tabee.getPane().getAddress(), null, scPane, null, i);
    addressBar.setText(tabee.getPane().getAddress());
    tabcreate = false;
    change = false;
    addCloseButton(i, tabee.getPane().getAddress());
    change = false;
    tabcreate = false;
    change = false;
    tab.setSelectedIndex(i);
    tabcreate = false;
    change = false;
    tabcreate = true;
  }
  private void assertTabCount(Content content) {
    //        PluginSettingsBean bean = (PluginSettingsBean)
    // SharedObjectPool.getUserData(SharedConstants.PLUGIN_SETTINGS);
    PluginSettingsBean bean = PluginKeys.PLUGIN_SETTINGS.getData();

    if (bean == null) {
      bean = new PluginSettingsBean();
    }

    int max = bean.getNumberOfTabs();

    if (max <= getTabComponent(content).getTabCount()) {
      // remove the oldest tab
      JTabbedPane tabbedPane = getTabComponent(content);
      long lastMin = Long.MAX_VALUE;
      int index = 0;
      for (int i = 0; i < tabbedPane.getTabCount(); i++) {
        JComponent tab = (JComponent) tabbedPane.getTabComponentAt(i);
        Long time = (Long) tab.getClientProperty(CREATE_TIME);
        if (time != null && lastMin < time) {
          lastMin = time;
          index = i;
        }
      }

      tabbedPane.remove(index);
    }
  }
Exemple #4
0
 /**
  * remove tab
  *
  * @param i
  */
 protected void removeTab(int i) {
   if (i == 0) System.exit(1);
   tab.remove(i - 1);
   tabcreate = false;
   tab.setSelectedIndex(tab.getTabCount() - 2);
   tabAccess.remove(i - 1);
 }
Exemple #5
0
  protected void updateTabes(KeyEvent arg0) {
    Tab tabee = tabAccess.get(tab.getSelectedIndex());
    if (arg0.getKeyCode() == KeyEvent.VK_ENTER) {
      MyEditorPane pane = new MyEditorPane(addressBar.getText());
      pane.addHyperlinkListener(HYHandler);
      JScrollPane scPane = new JScrollPane(pane);
      tabee.addPane(pane);
      pane.setEditable(false);

      int i = tab.getSelectedIndex();

      tabcreate = false;
      tab.remove(i);
      tabcreate = false;
      change = false;
      tab.insertTab(tabee.getPane().getAddress(), null, scPane, null, i);
      tabcreate = false;
      addCloseButton(i, tabee.getPane().getAddress());
      change = false;
      tabcreate = false;
      tab.setSelectedIndex(i);
      change = false;
      tabcreate = false;

      loadPage(pane, tabee.getPane().getAddress());
      tabcreate = true;
      return;
    }
    tabee.setAddress(addressBar.getText());
  }
  /** Refreshes the currently visible editor with new info. */
  public void refreshEditors(DXEntry entry, DataBrokerQueryInterface ds) {
    if (currentEditor != null) {
      this.entry = entry; // TE: make sure everything is in sink.
      dataSource = ds;

      currentEditor.getDataSink().displayEntry(entry, ds); // checks for unsaved changes...

      // check that the editor hasn't changed display component
      JComponent display = currentEditor.getDisplayComponent();

      // XXX hack alert - some editor writers change their display component
      // XXX mid-flight, and expect JX to magically notice, and change the
      // XXX the display.  This code attempts to do this.

      if (indexOfComponent(display) == -1) // we have a problem - the display component has changed
      {
        String title = currentEditor.getName();
        ImageIcon icon = currentEditor.getIcon();
        String toolTip = currentEditor.getToolTip();

        int index =
            getSelectedIndex(); // find the index of the editor (XXX - this relies on the
                                // activeEditor vector tracking the inherent tab pane order)

        super.remove(index);
        super.insertTab(title, icon, display, toolTip, index);
        super.setSelectedIndex(index);
      }
    } else log.warning("internal error - no editor available in AttributeDisplay");
  }
 public void setMetricsResults(MetricDisplaySpecification displaySpecification, MetricsRun run) {
   final MetricCategory[] categories = MetricCategory.values();
   for (final MetricCategory category : categories) {
     final JTable table = tables.get(category);
     final String type = MetricsCategoryNameUtil.getShortNameForCategory(category);
     final MetricTableSpecification tableSpecification =
         displaySpecification.getSpecification(category);
     final MetricsResult results = run.getResultsForCategory(category);
     final MetricTableModel model = new MetricTableModel(results, type, tableSpecification);
     table.setModel(model);
     final Container tab = table.getParent().getParent();
     if (model.getRowCount() == 0) {
       tabbedPane.remove(tab);
       continue;
     }
     final String longName = MetricsCategoryNameUtil.getLongNameForCategory(category);
     tabbedPane.add(tab, longName);
     final MyColumnListener columnListener = new MyColumnListener(tableSpecification, table);
     final TableColumnModel columnModel = table.getColumnModel();
     columnModel.addColumnModelListener(columnListener);
     final int columnCount = columnModel.getColumnCount();
     for (int i = 0; i < columnCount; i++) {
       final TableColumn column = columnModel.getColumn(i);
       column.addPropertyChangeListener(columnListener);
     }
     setRenderers(table, type);
     setColumnWidths(table, tableSpecification);
   }
 }
Exemple #8
0
 @Override
 public void closeTextPanel() {
   // Confirm save before open another file
   if (this.isContentChanged()) {
     int ans =
         JOptionPane.showConfirmDialog(
             this,
             "The contents of "
                 + CurrentFileName
                 + " has been modified. \nDo you want to save the changes?",
             "Save to file?",
             JOptionPane.YES_NO_CANCEL_OPTION);
     if (ans == JOptionPane.CANCEL_OPTION) {
       return;
     } else if (ans == JOptionPane.YES_OPTION) {
       this.cmdSaveActionPerformed(null);
     }
   }
   if (ContainerComponent instanceof Frame) {
     ((Frame) ContainerComponent).dispose();
   } else if (ContainerComponent instanceof Dialog) {
     ((Dialog) ContainerComponent).dispose();
   } else if (ContainerComponent instanceof JTabbedPane && TabId > 0) {
     // ((JTabbedPane)ContainerComponent).remove(this.TabId);
     ((JTabbedPane) ContainerComponent).remove(this);
     TabId = 0;
   }
 }
  protected void abrirTelaCliente() {
    TelaCadastroCliente telacadastrocliente = new TelaCadastroCliente();

    telacadastrocliente.setCloseAction(e -> tabbedPane.remove(telacadastrocliente));
    tabbedPane.addTab("Cliente", telacadastrocliente);
    mostraUltima();
  }
  public void remove(int index) {
    if (activeEditors.size() == 0)
      return; // it can get a bit excitable about removing element 0 ...

    PluggableEditor ed = (PluggableEditor) activeEditors.remove(index);
    ed.unload();
    super.remove(index);
  }
 private void closeResultTab(ResultTab tab) {
   if (tab == null) {
     throw new IllegalArgumentException("Null ResultTab passed");
   }
   s_log.debug("SQLPanel.closeResultTab(" + tab.getIdentifier().toString() + ")");
   tab.closeTab();
   _tabbedExecutionsPanel.remove(tab);
 }
  /**
   * Removes specified component from the CytoPanel.
   *
   * @param component Component reference.
   */
  @Override
  public void remove(Component component) {
    // remove tab from JTabbedPane (component)
    tabbedPane.remove(component);

    // send out a notification
    notifyListeners(NOTIFICATION_COMPONENT_REMOVED);
  }
  /**
   * Removes the component from the CytoPanel at the specified index.
   *
   * @param index Component index.
   */
  @Override
  public void remove(int index) {
    // remove tab from JTabbedPane (index)
    tabbedPane.remove(index);

    // send out a notification
    notifyListeners(NOTIFICATION_COMPONENT_REMOVED);
  }
  protected void abrirTelaProduto() {

    TelaCadastroProduto telacadastroproduto = new TelaCadastroProduto();
    telacadastroproduto.setCloseAction(e -> tabbedPane.remove(telacadastroproduto));
    tabbedPane.addTab("Produto", telacadastroproduto);

    mostraUltima();
  }
 private void closeTab(Component tab) {
   if (tab instanceof ErrorPanel) {
     _tabbedExecutionsPanel.remove(tab);
   } else if (tab instanceof ResultTab) {
     closeResultTab((ResultTab) tab);
   } else if (tab instanceof CancelPanel) {
     ((CancelPanel) tab).closeBtn.doClick();
   }
 }
Exemple #16
0
 /* (non-Javadoc)
  * @see com.nullfish.app.jfd2.ui.container2.JFDContainer#setContainerVisible(boolean)
  */
 public void setContainerVisible(boolean visible) {
   if (visible) {
     if (tabbedPane.indexOfComponent(this) < 0) {
       tabbedPane.addTab("", this);
     }
   } else {
     tabbedPane.remove(this);
   }
 }
  private Component refreshViewRegion(TreeNode node) {
    Component guiComponent = node.getGuiComponent();
    if (node.isLeaf()) {
      if (guiComponent == null) {
        guiComponent = new JTabbedPane();
        node.setGuiComponent(guiComponent);
      }
      JTabbedPane tabs = (JTabbedPane) guiComponent;
      for (LeafNodeComponent compNode : node.getComponents()) {
        boolean exists = false;
        for (Component comp : tabs.getComponents()) {
          if (comp == compNode.getComponent()) {
            exists = true;
          }
        }
        if (!exists) {
          tabs.addTab(compNode.getLabel(), compNode.getComponent());
        }
      }
      for (Component comp : tabs.getComponents()) {
        boolean removed = true;
        for (LeafNodeComponent compNode : node.getComponents()) {
          if (comp == compNode.getComponent()) {
            removed = false;
          }
        }
        if (removed) {
          tabs.remove(comp);
        }
      }
      return guiComponent;
    } else {
      JSplitPane split = null;
      if (guiComponent == null) {
        split = new JSplitPane();
        node.setGuiComponent(split);
      } else {
        split = (JSplitPane) guiComponent;
      }

      split.setOrientation(
          node.isVertical() ? JSplitPane.VERTICAL_SPLIT : JSplitPane.HORIZONTAL_SPLIT);

      Component firstGuiComponent = refreshViewRegion(node.getFirst());
      if (firstGuiComponent != null /* && firstGuiComponent instanceof JTabbedPane*/) {
        split.setTopComponent(firstGuiComponent);
      }

      Component secondGuiComponent = refreshViewRegion(node.getSecond());
      if (secondGuiComponent != null /* && secondGuiComponent instanceof JTabbedPane*/) {
        split.setBottomComponent(secondGuiComponent);
      }

      return split;
    }
  }
Exemple #18
0
 /** Clear the tabs. */
 private void doClearTabs() {
   int numTabs = resultTabs.size();
   for (int i = 0; i < numTabs; i++) {
     results.remove(resultTabs.get(i));
   }
   resultTabs.clear();
   clearTabs.setEnabled(false);
   getOkButton().setEnabled(false);
   doResetFields(false);
 }
 @Override
 public void remove(Component c) {
   if (tabCount == 0) throw new RuntimeException("Tried to remove from empty tabbedpanehiddenbar");
   else if (tabCount == 1) {
     if (c == soleComponent) super.remove(c);
   } else if (tabCount == 2) {
     pane.remove(c);
     if (pane.getComponents().length == 1) {
       soleComponent = pane.getComponents()[0];
       soleTitle = pane.getTitleAt(0);
       super.remove(pane);
       super.add(soleComponent);
     }
   } else {
     pane.remove(c);
   }
   tabCount--;
   revalidate();
   repaint();
 }
  private void removeTab(@NotNull Content content, String displayName) {
    //        Component[] comps = (content.getComponent()).getComponents();
    //        JTabbedPane tabbedPane = (JTabbedPane) comps[1];
    JTabbedPane tabbedPane = getTabComponent(content);
    int index = tabbedPane.indexOfTab(displayName);
    if (index == -1) {
      return;
    }

    tabbedPane.remove(index);
  }
 public SrcCodeViewer loadfile(String fileName, String content) {
   content = content.replace("\t", "    ");
   JTabbedPane tabbedPane = center.frame.getTabbedPane();
   if (fileName != null) {
     SrcCodeViewer temp = table.get(fileName);
     tabbedPane.remove(temp);
     table.remove(fileName);
   }
   SrcCodeViewer viewer = new SrcCodeViewer(fileName, content, this.center);
   tabbedPane.addTab(fileName, viewer);
   table.put(fileName, viewer);
   return viewer;
 }
Exemple #22
0
  protected void deleteCurrentPanel() {
    JComponent tabPane = (JComponent) tabbedPane.getSelectedComponent();
    if (tabPane == null) return;

    WMSPanel wmsPanel = (WMSPanel) tabPane.getClientProperty(Constants.FEATURE_OWNER_PROPERTY);

    if (tabbedPane.getTabCount()
        > 2) // actually remove the tab only if there is more than one (plus the "+" tab)
    tabbedPane.remove(tabPane);
    else tabbedPane.setTitleAt(1, "New Server");

    if (wmsPanel != null) wmsPanel.clearPanel();
  }
  @Override
  public void remove(final int removedIndex) {
    if (removedIndex < 0) {
      return;
    }
    super.remove(removedIndex);
    _rightClickActionListeners.remove(removedIndex);
    _doubleClickActionListeners.remove(removedIndex);

    // move all right click listeners for tabs above this index down
    {
      Set<Integer> keySet = new TreeSet<Integer>(Collections.reverseOrder());
      keySet.addAll(_rightClickActionListeners.keySet());
      for (Integer key : keySet) {
        int curIndex = key.intValue();
        if (curIndex > removedIndex) {
          ActionListener actionListener = _rightClickActionListeners.get(curIndex);
          _rightClickActionListeners.remove(curIndex);
          _rightClickActionListeners.put(curIndex - 1, actionListener);
        }
      }
    }

    // move all double click listeners for tabs above this index down
    {
      Set<Integer> keySet = new TreeSet<Integer>(Collections.reverseOrder());
      keySet.addAll(_doubleClickActionListeners.keySet());
      for (Integer key : keySet) {
        int curIndex = key.intValue();
        if (curIndex > removedIndex) {
          ActionListener actionListener = _doubleClickActionListeners.get(curIndex);
          _doubleClickActionListeners.remove(curIndex);
          _doubleClickActionListeners.put(curIndex - 1, actionListener);
        }
      }
    }

    // moved all the uncloseable tabs for tabs above this index down
    {
      for (ListIterator<Integer> it = _unclosables.listIterator(); it.hasNext(); ) {
        Integer tabIndex = it.next();
        int curIndex = tabIndex.intValue();
        if (curIndex == removedIndex) {
          it.remove();
        } else if (curIndex > removedIndex) {
          it.set(curIndex - 1);
        }
      }
    }
  }
Exemple #24
0
  private void createTab(String title, String adress) {
    System.out.println("create tab");
    if (tab.getTabCount() > 0) tab.remove(tab.getTabCount() - 1);
    MyEditorPane pane = new MyEditorPane(adress);
    JScrollPane scPane = new JScrollPane(pane);
    pane.addHyperlinkListener(HYHandler);

    tab.addTab(title, scPane);
    addCloseButton(tab.getTabCount() - 1, title);
    pane.setEditable(false);
    tabAccess.add(new Tab(pane, new JTextField(adress)));
    if (adress != "") loadPage(pane, adress);
    tab.addTab("", new ImageIcon(iconDir + "newTab.png"), null);
  }
  /**
   * Create an internal frame for the specified tab and display the tab in the internal frame after
   * removing it from the tabbed pane.
   *
   * @param tab <TT>ResultTab</TT> to be displayed in an internal frame.
   * @throws IllegalArgumentException Thrown if a <TT>null</TT> <TT>ResultTab</TT> passed.
   */
  private void createSQLResultFrame(ResultTab tab) {
    if (tab == null) {
      throw new IllegalArgumentException("Null ResultTab passed");
    }
    s_log.debug("SQLPanel.createSQLResultFrame(" + tab.getIdentifier().toString() + ")");
    _tabbedExecutionsPanel.remove(tab);

    ResultFrameListener resultFrameListener =
        new ResultFrameListener() {
          @Override
          public void frameReplaced(ResultFrame oldFrame, ResultFrame newFrame) {
            onFrameReplaced(oldFrame, newFrame);
          }
        };

    ResultFrame frame =
        new ResultFrame(_session, tab, _resultTabFactory, resultFrameListener, true, false);
    _sqlResultFrames.add(frame);
  }
  public void deactivateRNA() {

    int count = 0;
    if (manager.postProcMan.rnaMode) {
      for (Postprocess plugin : pluginTabs) {
        if (plugin.rnaAssociated) {
          plugin.reloadPanel();
          tabPluginMap.remove(plugin);
          tab.remove(count + 1);
          count--;
        }

        count++;
      }
    }

    manager.postProcMan.rnaMode = false;
    rnaButton.setSelected(false);
    rnaButton.setEnabled(false);
  }
 public void removeDiffOverlay(MetricDisplaySpecification displaySpecification) {
   final MetricCategory[] categories = MetricCategory.values();
   for (final MetricCategory category : categories) {
     final JTable table = tables.get(category);
     final MetricTableModel model = (MetricTableModel) table.getModel();
     model.setPrevResults(null);
     final Container tab = table.getParent().getParent();
     if (model.getRowCount() == 0) {
       tabbedPane.remove(tab);
       continue;
     }
     final String longName = MetricsCategoryNameUtil.getLongNameForCategory(category);
     tabbedPane.add(tab, longName);
     final String shortName = MetricsCategoryNameUtil.getShortNameForCategory(category);
     setRenderers(table, shortName);
     final MetricTableSpecification specification =
         displaySpecification.getSpecification(category);
     setColumnWidths(table, specification);
   }
   hasOverlay = false;
 }
  /** Close current tab which is showing on the screen. */
  public void closeCurrentTab() {
    final SessionPane session = getCurrentSession();

    if (session != null) {

      // 連線中則詢問是否要斷線
      if (!session.isClosed()) {
        if (model.showConfirm(
                InternationalMessages.getString("ZTerm.Message_Confirm_Close"),
                InternationalMessages.getString("ZTerm.Title_Confirm_Close"),
                JOptionPane.YES_NO_OPTION)
            != JOptionPane.YES_OPTION) { // $NON-NLS-1$ //$NON-NLS-2$
          return;
        }

        // 通知 session 要中斷連線了
        session.close(false);

        if (!resource.getBooleanValue(Resource.REMOVE_MANUAL_DISCONNECT)) {
          return;
        }
      }

      // 通知 session 要被移除了
      session.remove();

      tabbedPane.remove(session);
      model.getSessions().remove(session);

      // 刪除分頁會影響分頁編號
      model.updateTabTitle();

      // 讓現在被選取的分頁取得 focus.
      model.updateTab();
    }
  }
 private void closeFile() {
   upperTabbedPane.remove(upperTabbedPane.getSelectedComponent());
   menuBar.setFileOpen(upperTabbedPane.getComponentCount() > 0);
   System.gc();
 }
 /**
  * Method for removing a Panel by object reference
  *
  * @param object The object to remove
  */
 public void removePanel(GPropertiesPanel object) {
   pane.remove(object);
   objects.remove(object);
 }