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;
 }
Exemplo n.º 2
0
  public static void main(String[] args)
      throws BadLocationException, FileNotFoundException, UnsupportedEncodingException,
          IOException {
    m_form = new MainForm();
    m_form.setVisible(true);
    JTabbedPane j = m_form.getTabbedPane();

    if (!IO.loadFile(j)) {
      IO.setStatus("Welcome to ZeroVal.");
      SyntaxBox b = new SyntaxBox();
      b.setHighlightText("//New Tab Name\n//Press Alt + Enter to evaluate");
      j.insertTab("New Tab", null, b, "Blank Tab", 0);
    } else {
      IO.setStatus("Loaded tabs successfully.");
    }

    m_timer =
        new Timer(
            60,
            new java.awt.event.ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                try {
                  ((SyntaxBox) m_form.getTabbedPane().getSelectedComponent())
                      .getPatternHandler()
                      .renderSyntaxHighlighting();
                } catch (BadLocationException ex) {
                  Logger.getLogger(Base.class.getName()).log(Level.SEVERE, null, ex);
                }
              }
            });
    m_timer.start();
    j.insertTab("+", null, null, "Create New Tab", j.getTabCount());
  }
 protected void addPage(String _typeOfPage, String _name, String _code, boolean _enabled) {
   cardLayout.show(finalPanel, "TabbedPanel");
   _name = getUniqueName(_name);
   Editor page = createPage(_typeOfPage, _name, _code);
   page.setFont(myFont);
   page.setColor(myColor);
   int index = tabbedPanel.getSelectedIndex();
   if (index == -1) {
     pageList.addElement(page);
     if (tabbedPanel.getTabCount() == 0) {
       tabbedPanel.addTab(
           page.getName(),
           null,
           page.getComponent(),
           tooltip); // This causes an exception sometimes
     } else {
       tabbedPanel.insertTab(
           page.getName(), null, page.getComponent(), tooltip, tabbedPanel.getTabCount());
     }
     index = 0;
   } else {
     index++;
     pageList.insertElementAt(page, index);
     tabbedPanel.insertTab(page.getName(), null, page.getComponent(), tooltip, index);
   }
   tabbedPanel.setSelectedComponent(page.getComponent());
   page.setActive(_enabled);
   if (!_enabled) tabbedPanel.setTitleAt(index, page.getName() + " (D)");
   updatePageCounterField(pageList.size());
   // tabbedPanel.validate(); This hangs the computer when reading a file at start-up !!!???
   tabbedPanel.repaint();
   changed = true;
 }
Exemplo n.º 4
0
 /**
  * Adds a tab to the gui.
  *
  * @param tab tab that will be added to the gui.
  */
 public void addTab(JNotepadPPTab tab) {
   int index = tabPane.getTabCount();
   tabPane.insertTab("", null, new JScrollPane(tab.getEditor()), "", index);
   tab.getTitle().setVisible(true);
   tabPane.setTabComponentAt(index, tab.getTitle());
   setTab(index);
 }
Exemplo n.º 5
0
  @Override
  public void insertTab(String title, Icon icon, Component component, String tip, int index) {
    TabComponent tabComp;

    if (component instanceof ExternalizablePanel) {
      final ExternalizablePanel panel = (ExternalizablePanel) component;
      tabComp = getTabComponent(panel);

      // not existing ?
      if (tabComp == null) {
        // create the associated tab component
        tabComp = new TabComponent(title, icon, panel, tip, index);
        // and save it in the list to keep a reference
        tabComponents.add(tabComp);
      }

      // externalized ?
      if (panel.isExternalized()) {
        // manually set parent and exit
        panel.setParent(this);
        return;
      }
    } else tabComp = null;

    super.insertTab(title, icon, component, tip, index);

    // use custom panel for externalizable panel
    if (tabComp != null) setTabComponentAt(index, tabComp);
  }
Exemplo n.º 6
0
 /**
  * @param title the title to be displayed in this tab
  * @param icon the icon to be displayed in this tab
  * @param component The component to be displayed when this tab is clicked.
  * @param tip the tooltip to be displayed for this tab
  * @param index the position to insert this new tab
  * @see javax.swing.JTabbedPane#insertTab(java.lang.String, javax.swing.Icon, java.awt.Component,
  *     java.lang.String, int)
  */
 @Override
 public void insertTab(String title, Icon icon, Component component, String tip, int index) {
   super.insertTab(title, icon, component, tip, index);
   try {
     Method method =
         this.getClass().getMethod("setTabComponentAt", new Class[] {int.class, Component.class});
     method.invoke(this, index, new CloseTabComponent(title, this));
     component.addKeyListener(this);
     /*if (component instanceof Container) {
       Container container = (Container) component;
       for (Component child : container.getComponents()) {
         child.addKeyListener(this);
       }
     }*/
   } catch (SecurityException e) {
     // Nothing
   } catch (NoSuchMethodException e) {
     // Nothing
   } catch (IllegalArgumentException e) {
     // Nothing
   } catch (IllegalAccessException e) {
     // Nothing
   } catch (InvocationTargetException e) {
     // Nothing
   }
   setIconAt(index, new JTabbedPaneCloseIcon(this, component));
 }
Exemplo n.º 7
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;
  }
Exemplo n.º 8
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");
  }
Exemplo n.º 10
0
 /* WARNING: THIS METHOD WILL BE REGENERATED. */
 private javax.swing.JTabbedPane getJTabbedPane1() {
   if (ivjJTabbedPane1 == null) {
     try {
       ivjJTabbedPane1 = new javax.swing.JTabbedPane();
       ivjJTabbedPane1.setName("JTabbedPane1");
       ivjJTabbedPane1.insertTab("Specify IRA", null, getIRAComputePanel(), null, 0);
       ivjJTabbedPane1.insertTab("Display Impulse Responses", null, getIRADisplayPanel(), null, 1);
       // user code begin {1}
       // user code end
     } catch (Throwable ivjExc) {
       // user code begin {2}
       // user code end
       handleException(ivjExc);
     }
   }
   return ivjJTabbedPane1;
 }
Exemplo n.º 11
0
 /**
  * Overridden to insert the tab at the end or requests focus on the added component.
  *
  * @see JTabbedPane#insertTab(String, Icon, Component, String, int)
  */
 public void insertTab(String title, Icon icon, Component component, String tip, int index) {
   int addIndex = indexOfComponent(component);
   if (addIndex != -1) {
     setSelectedComponent(component);
     return;
   }
   super.insertTab(title, icon, component, tip, getTabCount());
   ((ClosableTabbedPaneUI) ui).resetDefault();
 }
 public static JTabbedPane createTabs(PaneTabInfo... tabs) {
   JTabbedPane pane = new JTabbedPane();
   CSS.tabbedPane(pane);
   for (int i = 0; i < tabs.length; i++) {
     PaneTabInfo tab = tabs[i];
     pane.insertTab(tab.getTitle(), null, tab.getComponent(), tab.getTip(), i);
   }
   return pane;
 }
Exemplo n.º 13
0
  @Override
  public void insertTab(String title, Icon icon, Component component, String tip, int index) {
    super.insertTab(title, icon, component, tip, index);

    if (!parentFrame.isTabCloseButtonEnabled()) return;

    MDITabTitle newComponent = new MDITabTitle(parentFrame, this, title, icon, component);
    setTabComponentAt(indexOfComponent(component), newComponent);
  }
Exemplo n.º 14
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();
  }
Exemplo n.º 15
0
  public void drawParams() {
    if (monParams.size() > 0) {
      SpringUtilities.makeCompactGrid(monPanel, monParams.size(), 2, 6, 6, 6, 6);
      SpringLayout sl = (SpringLayout) monPanel.getLayout();
      Dimension d = sl.minimumLayoutSize(monPanel);
      monPanel.setSize(d);
    }
    if (steerParams.size() > 0) {
      SpringUtilities.makeCompactGrid(steerPanel, steerParams.size(), 3, 6, 6, 6, 6);
      SpringLayout sl = (SpringLayout) steerPanel.getLayout();
      Dimension d = sl.minimumLayoutSize(steerPanel);
      steerPanel.setSize(d);
    }

    tabs.insertTab("Parameters", null, paramPanel, "", 0);
  }
Exemplo n.º 16
0
 /**
  * @param p the panel to be added
  * @param atEnd true = add the panel at the end, false = at the beginning
  */
 public void addTab(JPanel p, boolean atEnd) {
   final Icon icon;
   final String title;
   if (p instanceof AbstractArgoJPanel) {
     icon = ((AbstractArgoJPanel) p).getIcon();
     title = Translator.localize(((AbstractArgoJPanel) p).getTitle());
   } else {
     icon = null;
     title = p.getName();
   }
   if (atEnd) {
     topLevelTabbedPane.addTab(title, icon, p);
     tabPanelList.add(p);
   } else {
     topLevelTabbedPane.insertTab(title, icon, p, null, 0);
     tabPanelList.add(0, p);
   }
 }
Exemplo n.º 17
0
  public void insertChannelsPane(JSChannelsPane chnPane, int idx) {
    chnPane.addListSelectionListener(this);

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

    getChannelsPaneList().insertElementAt(chnPane, idx);
    tabbedPane.insertTab(chnPane.getTitle(), null, chnPane, null, idx);
    tabbedPane.setSelectedComponent(chnPane);
    miList.insertElementAt(new JMenuItem(new A4n.MoveChannelsTo(chnPane)), idx);

    updateTabsMenu();
  }
Exemplo n.º 18
0
  protected void setUpSRSFrame(URL url, String search) throws IOException {
    if (BigPane.srsFrame == null) {
      BigPane.setUpSRSFrame((2 * desktop.getHeight()) / 3, desktop);
      Border loweredbevel = BorderFactory.createLoweredBevelBorder();
      Border raisedbevel = BorderFactory.createRaisedBevelBorder();
      Border compound = BorderFactory.createCompoundBorder(raisedbevel, loweredbevel);

      JTextField statusField = new JTextField();
      statusField.setBorder(compound);
      statusField.setEditable(false);
      BigPane.srsFrame.getContentPane().add(statusField, BorderLayout.SOUTH);
    }

    Annotation edPane = new Annotation(url);
    JScrollPane jsp = new JScrollPane(edPane);
    JTabbedPane jtab = (JTabbedPane) BigPane.srsFrame.getContentPane().getComponent(0);
    jtab.insertTab(search, null, jsp, null, 0);
    BigPane.srsFrame.setVisible(true);
  }
  private void addResultsTab(ResultTab tab, IResultTab resultTabToReplace) {
    if (null == resultTabToReplace && null == _stickyTab) {
      _tabbedExecutionsPanel.addTab(tab.getTitle(), null, tab, tab.getViewableSqlString());
      checkResultTabLimit();
    } else {
      if (null != resultTabToReplace && _session.getProperties().getKeepTableLayoutOnRerun()) {
        TableState sortableTableState = resultTabToReplace.getResultSortableTableState();
        if (null != sortableTableState) {
          tab.applyResultSortableTableState(sortableTableState);
        }
      }

      int indexToReplace = -1;
      ImageIcon tabIcon = null;

      // Either resultTabToReplace or _stickyTab must be not null here
      if (null != resultTabToReplace && _stickyTab != resultTabToReplace) {
        indexToReplace = getIndexOfTab(resultTabToReplace);
      } else {
        indexToReplace = getIndexOfTab(_stickyTab);
        if (-1 == indexToReplace) {
          // sticky tab was closed
          _stickyTab = null;
        } else {
          tabIcon = getStickyIcon();
          _stickyTab = tab;
        }
      }

      if (-1 == indexToReplace) {
        // Just add the tab
        addResultsTab(tab, null);
        return;
      }

      closeTabAt(indexToReplace);
      _tabbedExecutionsPanel.insertTab(
          tab.getTitle(), tabIcon, tab, tab.getViewableSqlString(), indexToReplace);
    }
  }
Exemplo n.º 20
0
 @Override
 public void insertTab(String title, Icon icon, Component component, String tip, int index) {
   titles.add(index, title);
   super.insertTab("", icon, component, tip, index);
 }
Exemplo n.º 21
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();
  }
Exemplo n.º 22
0
 public void insertTab(String title, Icon icon, Component component, String tooltip, int index) {
   super.insertTab(title, icon, component, tooltip, index);
   setTitleAt(index, title);
   setSelectedIndex(index);
 }
  public JComponent getComponent() {
    if (myPanel != null) {
      return myPanel;
    }
    myPanel = new JPanel(new BorderLayout());
    mySchemaPage = new SchemaComponent();
    myDataPage = new DataComponent(this, 1000);

    myComponent = new JTabbedPane();

    mySchemaPage.getComponent().putClientProperty(this, mySchemaPage);
    myDataPage.getComponent().putClientProperty(this, myDataPage);

    myComponent.insertTab(
        mySchemaPage.getTitle(), null, mySchemaPage.getComponent(), mySchemaPage.getTip(), 0);
    myComponent.insertTab(
        myDataPage.getTitle(), null, myDataPage.getComponent(), myDataPage.getTip(), 1);

    myInactivatedPages.add(mySchemaPage);
    myInactivatedPages.add(myDataPage);

    myComponent.addChangeListener(this);

    myPanel.add(myComponent, BorderLayout.CENTER);

    JPanel bottomPanel = new JPanel(new BorderLayout());
    final JLabel status =
        new JLabel(
            "<html><body><p>Powered by SQLJet v"
                + SqlJetVersion.getVersionString()
                + "<br>&copy; 2009-2013, TMate Software, <a href=\"http://sqljet.com/\">http://sqljet.com/</a></p></body></html>");
    status.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    status.addMouseListener(
        new MouseAdapter() {

          @Override
          public void mouseClicked(MouseEvent e) {
            DBBrowserUtil.browse("http://sqljet.com/");
          }

          @Override
          public void mouseEntered(MouseEvent e) {
            Cursor hand = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
            status.setCursor(hand);
          }

          @Override
          public void mouseExited(MouseEvent e) {
            Cursor normal = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
            status.setCursor(normal);
          }
        });
    bottomPanel.add(status, BorderLayout.WEST);
    myProgress = new JProgressBar();
    myProgress.setBorder(BorderFactory.createEmptyBorder(4, 16, 4, 4));
    myProgress.setStringPainted(true);
    bottomPanel.add(myProgress, BorderLayout.CENTER);
    myPanel.add(bottomPanel, BorderLayout.SOUTH);

    myProgress.setVisible(false);

    return myPanel;
  }