private void moveUpAndDownPage(boolean _up) {
   int index = tabbedPanel.getSelectedIndex();
   if (index < 0) return;
   Editor page = pageList.get(index);
   if (page == null) return;
   if (_up) {
     if (index == 0) return;
     pageList.removeElementAt(index);
     pageList.insertElementAt(page, index - 1);
     tabbedPanel.removeTabAt(index);
     tabbedPanel.insertTab(
         page.isActive() ? page.getName() : page.getName() + " (D)",
         null,
         page.getComponent(),
         tooltip,
         index - 1);
   } else {
     if (index == (pageList.size() - 1)) return;
     pageList.removeElementAt(index);
     pageList.insertElementAt(page, index + 1);
     tabbedPanel.removeTabAt(index);
     tabbedPanel.insertTab(
         page.isActive() ? page.getName() : page.getName() + " (D)",
         null,
         page.getComponent(),
         tooltip,
         index + 1);
   }
   tabbedPanel.setSelectedComponent(page.getComponent());
   changed = true;
 }
Example #2
0
  private void removeStatsTabs() {
    for (int i = tabbedPane.getTabCount() - 1; i >= 0; i--) {
      String name = tabbedPane.getTitleAt(i);

      if (name.equals("DAG Model Statistics")) {
        tabbedPane.removeTabAt(i);
      } else if (name.equals("DAG in pattern")) {
        tabbedPane.removeTabAt(i);
      }
    }
  }
Example #3
0
  public void setPanel(int plotType) {

    this.plotType = plotType;
    tabbedPane.removeAll();
    String tabTitle = StatComboPanel.plotMap.get(plotType);
    tabbedPane.insertTab(tabTitle, null, new JScrollPane(mainPanel), null, 0);
    tabbedPane.addTab(app.getMenu("Graph"), new JScrollPane(graphPanel));
    showYSettings = true;

    switch (plotType) {
      case StatComboPanel.PLOT_HISTOGRAM:
        classesPanel.setVisible(true);
        histogramPanel.setVisible(true);
        graphPanel.setVisible(true);
        scatterplotPanel.setVisible(false);
        break;

      case StatComboPanel.PLOT_DOTPLOT:
      case StatComboPanel.PLOT_BOXPLOT:
      case StatComboPanel.PLOT_NORMALQUANTILE:
        tabbedPane.removeTabAt(0);
        showYSettings = true;
        classesPanel.setVisible(false);
        histogramPanel.setVisible(false);
        graphPanel.setVisible(true);
        scatterplotPanel.setVisible(false);
        break;

      case StatComboPanel.PLOT_SCATTERPLOT:
        showYSettings = true;
        classesPanel.setVisible(false);
        histogramPanel.setVisible(false);
        graphPanel.setVisible(true);
        scatterplotPanel.setVisible(true);
        break;

      case StatComboPanel.PLOT_RESIDUAL:
        tabbedPane.removeTabAt(0);
        showYSettings = true;
        classesPanel.setVisible(false);
        histogramPanel.setVisible(false);
        graphPanel.setVisible(true);
        scatterplotPanel.setVisible(false);
        break;
    }

    setLabels();
    updateGUI();
  }
  private void onListRead(QueryListCreator queryListCreator) {

    for (int i = 0; i < _objectResultTabbedPane.getTabCount(); i++) {
      if (_objectResultTabbedPane.getComponentAt(i) == queryListCreator.getWaitPanel()) {
        _objectResultTabbedPane.removeTabAt(i);
        break;
      }
    }

    List list = queryListCreator.getList();

    if (null == list) {
      return;
    }

    ObjectResultTabControllerListener l =
        new ObjectResultTabControllerListener() {
          @Override
          public void closeTab(ObjectResultTabController toClose) {
            onCloseTab(toClose);
          }
        };

    String hqlQuery = queryListCreator.getHqlQuery();
    int maxNumResults = queryListCreator.getMaxNumResults();
    HibernateConnection con = queryListCreator.getConnection();

    ObjectResultTabController ortc =
        new ObjectResultTabController(list, maxNumResults, con, hqlQuery, _resource, l, _session);
    int titelLen = Math.min(hqlQuery.length(), 14);
    String title = hqlQuery.trim().substring(0, titelLen).replaceAll("\n", " ");
    _objectResultTabbedPane.addTab(title, ortc.getPanel());
    _objectResultTabbedPane.setSelectedComponent(ortc.getPanel());
  }
 private void onCloseTab(ObjectResultTabController toClose) {
   for (int i = 0; i < _objectResultTabbedPane.getTabCount(); i++) {
     if (_objectResultTabbedPane.getComponentAt(i) == toClose.getPanel()) {
       _objectResultTabbedPane.removeTabAt(i);
       break;
     }
   }
 }
Example #6
0
  private void clearChats() {
    // 在管理器中清除当然所有对话
    ChatManager.clearChats();

    int count = tabbedPane.getTabCount();
    for (int i = 0; i < count; i++) {
      tabbedPane.removeTabAt(0);
    }
  }
 protected void removeCurrentPage() {
   int index = tabbedPanel.getSelectedIndex();
   if (index < 0) return;
   tabbedPanel.removeTabAt(index);
   pageList.removeElementAt(index);
   updatePageCounterField(pageList.size());
   changed = true;
   if (tabbedPanel.getTabCount() <= 0) cardLayout.show(finalPanel, "FirstPanel");
   ejs.getModelEditor().getVariablesEditor().updateControlValues(false);
 }
  /**
   * Overridden to fire a property change indicating that component is removed from the tab pane.
   *
   * @see JTabbedPane#removeTabAt(int)
   */
  public void removeTabAt(int index) {
    Component c = getComponentAt(index);
    if (c instanceof ClosableTabbedPaneComponent) {
      firePropertyChange(CLOSE_TAB_PROPERTY, null, c);
    }
    super.removeTabAt(index);
    ((ClosableTabbedPaneUI) ui).resetDefault();
    int n = getTabCount();
    if (n == 0) return;

    if (index > n) setSelectedComponent(getComponentAt(n - 1));
  }
Example #9
0
  /* (non-Javadoc)
   * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
   */
  public void actionPerformed(ActionEvent e) {
    Object o = e.getSource();
    if (o instanceof JMenuItem) {
      JMenuItem sender = (JMenuItem) o;
      String name = sender.getText();
      if (name.equals("close")) {
        tabbedPane.removeTabAt(tabbedPane.getSelectedIndex());
      } else if (name.equals("save")) {
        int index = tabbedPane.getSelectedIndex();
        Component c = tabbedPane.getComponent(index);
        Point p = c.getLocation();
        Component t = tabbedPane.getComponentAt(new Point(p.x + 20, p.y + 30));
        if (t instanceof TextView) {
          TextView text = (TextView) t;
          // String code = text.getText();
          // save the code
          // saveTab(code);
        }
        if (t instanceof HTMLTextView) {
          HTMLTextView text = (HTMLTextView) t;
          fileChooser.setSelectedFile(new File(text.node.getName()));
          int returnVal = fileChooser.showSaveDialog(this);

          if (returnVal == JFileChooser.APPROVE_OPTION) {
            File f = fileChooser.getSelectedFile();

            // save the code
            String fileType =
                f.getName().substring(f.getName().lastIndexOf("."), f.getName().length());
            if (fileType.indexOf("htm") != -1) {
              // save as html
              String code = text.getText();
              saveTab(code, f);
            } else if (fileType.indexOf("java") != -1) {
              // save as java
              String code = text.getUnModyfiedContent();
              saveTab(code, f);
            } else if (text.node.fileType.indexOf(FileTypes.MANIFEST) != -1
                || text.node.fileType.indexOf(FileTypes.MANIFEST2) != -1) {
              String code = text.getUnModyfiedContent();
              saveTab(code, f);
              System.out.println("Saved manifest");
            } else {
              System.out.println("FILETYPE UNKNOWN:" + text.node.fileType);
            }
          }
        }
      } else if (name.equals("close all")) {
        tabbedPane.removeAll();
      }
    }
  }
 private void initAccess() {
   // hide repository popup if necessary
   if (!Users.doesCurrentUserHaveAccess(Users.ACCESS_CLASS_PROJECT_MANAGER)) {
     tabbedPane.removeTabAt(2);
   }
   // if user is not at least advanced data entry set the record to read only
   if (!Users.doesCurrentUserHaveAccess(Users.ACCESS_CLASS_ADVANCED_DATA_ENTRY)) {
     setFormToReadOnly();
     this.getAddNonPreferredNameButton().setVisible(false);
     this.getRemoveNonPreferredNameButton().setVisible(false);
     nameDescriptionType.setEnabled(false);
   }
 }
 public void refresh(List<PanelCollection> collections) {
   panelCollections.clear();
   panelCollections.addAll(collections);
   int tabCount = tb_collection.getTabCount();
   for (int i = 0; i < tabCount; i++) {
     tb_collection.removeTabAt(0);
   }
   for (PanelCollection panelCollection : panelCollections) {
     tb_collection.addTab(panelCollection.getCollectionName(), panelCollection);
     tb_collection.revalidate();
   }
   this.revalidate();
 }
  public void setup(PreviewUIModel previewModel) {
    propertySheet.setNodes(new Node[] {new PreviewNode(propertySheet)});
    PreviewUIController previewUIController = Lookup.getDefault().lookup(PreviewUIController.class);
    if (previewModel != null) {
      ratioSlider.setValue((int) (previewModel.getVisibilityRatio() * 100));
    }

    // Presets
    if (previewModel == null) {
      saveButton.setEnabled(false);
      labelPreset.setEnabled(false);
      presetComboBox.setEnabled(false);
      presetComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] {"---"}));
    } else {
      saveButton.setEnabled(true);
      labelPreset.setEnabled(true);
      presetComboBox.setEnabled(true);
      DefaultComboBoxModel comboBoxModel = new DefaultComboBoxModel();
      defaultPresetLimit = 0;
      for (PreviewPreset preset : previewUIController.getDefaultPresets()) {
        comboBoxModel.addElement(preset);
        defaultPresetLimit++;
      }
      PreviewPreset[] userPresets = previewUIController.getUserPresets();
      if (userPresets.length > 0) {
        comboBoxModel.addElement(NO_SELECTION);
        for (PreviewPreset preset : userPresets) {
          comboBoxModel.addElement(preset);
        }
      }
      presetComboBox.setSelectedItem(previewModel.getCurrentPreset());
      presetComboBox.setModel(comboBoxModel);
    }

    // Refresh tabs
    if (tabbedPane != null) {
      int tabCount = tabbedPane.getTabCount();
      for (int i = 1; i < tabCount; i++) {
        tabbedPane.removeTabAt(i);
      }
      for (PreviewUI pui : Lookup.getDefault().lookupAll(PreviewUI.class)) {
        pui.unsetup();
      }
      if (previewModel != null) {
        PreviewController previewController = Lookup.getDefault().lookup(PreviewController.class);
        PreviewModel pModel = previewController.getModel();
        // Add new tabs
        for (PreviewUI pui : Lookup.getDefault().lookupAll(PreviewUI.class)) {
          pui.setup(pModel);
          JPanel pluginPanel = pui.getPanel();
          if (UIUtils.isAquaLookAndFeel()) {
            pluginPanel.setBackground(UIManager.getColor("NbExplorerView.background"));
          }
          if (pui.getIcon() != null) {
            tabbedPane.addTab(pui.getPanelTitle(), pui.getIcon(), pluginPanel);
          } else {
            tabbedPane.addTab(pui.getPanelTitle(), pluginPanel);
          }
        }
      }
    }
  }
Example #13
0
  public void setPanel(PlotType plotType) {

    tabbedPane.removeAll();
    this.setVisible(true);

    // add plot-specific tab
    String tabTitle = plotType.getTranslatedKey(loc);
    tabbedPane.insertTab(tabTitle, null, new JScrollPane(mainPanel), null, 0);
    classesPanel.setVisible(false);
    histogramPanel.setVisible(false);
    scatterplotPanel.setVisible(false);
    barChartPanel.setVisible(false);
    boxPlotPanel.setVisible(false);

    rbNormalized.setVisible(false);
    ckOverlayNormal.setVisible(false);
    ckShowHistogram.setVisible(false);
    ckCumulative.setVisible(false);
    ckOverlayPolygon.setVisible(false);

    // add graph tab
    tabbedPane.addTab(loc.getMenu("Graph"), new JScrollPane(graphPanel));
    graphPanel.setVisible(true);
    showYAxisSettings = true;

    // set visibility for plot-specific panels
    switch (plotType) {
      case HISTOGRAM:
        classesPanel.setVisible(true);
        histogramPanel.setVisible(true);
        rbNormalized.setVisible(true);
        ckOverlayNormal.setVisible(true);
        ckShowHistogram.setVisible(true);
        ckCumulative.setVisible(true);
        ckOverlayPolygon.setVisible(true);

        layoutHistogramPanel();

        break;

      case BOXPLOT:
      case MULTIBOXPLOT:
        boxPlotPanel.setVisible(true);
        break;

      case BARCHART:
        barChartPanel.setVisible(true);
        layoutBarChartPanel();
        break;

      case SCATTERPLOT:
        scatterplotPanel.setVisible(true);
        break;

        // graph tab only
      case DOTPLOT:
      case NORMALQUANTILE:
      case RESIDUAL:
        tabbedPane.removeTabAt(0);
        break;

      case STEMPLOT:
        this.setVisible(false);
        break;
    }

    setLabels();
    updateGUI();
  }