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;
 }
Ejemplo n.º 2
0
  public void updateConnectionStatus(boolean connected) {
    if (connected == true) {
      headerPanel.setLogoutText();
      loginMenuItem.setText("Logout");
    } else {
      headerPanel.setLoginText();
      loginMenuItem.setText("Login...");
    }
    mainCommandPanel.updateConnectionStatus(connected);
    propertiePanel.updateConnectionStatus(connected);
    cmdConsole.updateConnectionStatus(connected);
    Iterator iterator = plugins.iterator();
    PluginPanel updatePluginPanel = null;
    while (iterator.hasNext()) {
      updatePluginPanel = (PluginPanel) iterator.next();
      updatePluginPanel.updateConnectionStatus(connected);
    }

    if (connected == true) {
      int selected = tabbedPane.getSelectedIndex();
      if (selected >= 2) {
        ((PluginPanel) pluginPanelMap.get("" + selected)).activated();
      }
    }
  }
 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;
 }
 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);
 }
 private void renameCurrentPage(String _name) {
   int index = tabbedPanel.getSelectedIndex();
   if (index < 0) return;
   _name = getUniqueName(_name); // Gonzalo 070128
   tabbedPanel.setTitleAt(index, _name);
   Editor page = pageList.get(index);
   page.setName(_name);
   if (!page.isActive()) tabbedPanel.setTitleAt(index, page.getName() + " (D)");
   changed = true;
 }
  private QueryResultPanel getSelectedTab(@NotNull Content content) {
    //        Component[] comps = (content.getComponent()).getComponents();
    //        JTabbedPane tabbedPane = (JTabbedPane) comps[1];
    JTabbedPane tabbedPane = getTabComponent(content);
    int index = tabbedPane.getSelectedIndex();
    if (index == -1) {
      return null;
    }

    return (QueryResultPanel) tabbedPane.getComponentAt(index);
  }
 private void copyPage() {
   int index = tabbedPanel.getSelectedIndex();
   if (index < 0) return;
   Editor page = pageList.get(index);
   if (page == null) return;
   addPage(
       typeOfPage(page),
       this.getUniqueName(page.getName()),
       page.saveStringBuffer().toString(),
       true);
   changed = true;
 }
 ContributionTab getActiveTab() {
   switch (tabbedPane.getSelectedIndex()) {
     case 0:
       return librariesContributionTab;
     case 1:
       return modesContributionTab;
     case 2:
       return toolsContributionTab;
     case 3:
       return examplesContributionTab;
     default:
       return updatesContributionTab;
   }
 }
 private void toggleCurrentPage() {
   int index = tabbedPanel.getSelectedIndex();
   if (index < 0) return;
   Editor page = pageList.get(index);
   if (page.isActive()) {
     page.setActive(false);
     tabbedPanel.setTitleAt(index, page.getName() + " (D)");
   } else {
     page.setActive(true);
     tabbedPanel.setTitleAt(index, page.getName());
   }
   changed = true;
   ejs.getModelEditor().getVariablesEditor().updateControlValues(false);
 }
Ejemplo n.º 10
0
  protected WMSPanel addNewPanel(final JTabbedPane tabPane) {
    final WMSPanel wmsPanel = new WMSPanel(null); // the null indicates not to register the panel
    wmsPanel.initialize(this.controller);
    wmsPanel.getJPanel().putClientProperty("WMS_PANEL", wmsPanel);
    tabPane.putClientProperty(wmsPanel.getURLString(), wmsPanel);

    tabPane.addTab("New Server", wmsPanel.getJPanel());
    tabPane.setSelectedIndex(tabPane.getTabCount() - 1);
    tabPane.setToolTipTextAt(tabbedPane.getSelectedIndex(), "Server WMS Contents");

    wmsPanel.addPropertyChangeListener(
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals("NewServer")) {
              String serverLocation = (String) evt.getNewValue();

              if (WWUtil.isEmpty(serverLocation)) return;
              //
              //                    // Check to see if it's already open.
              //                    for (int i = 0; i < tabbedPane.getTabCount(); i++)
              //                    {
              //                        JPanel jp = (JPanel) tabbedPane.getTabComponentAt(i);
              //                        if (jp != null)
              //                        {
              //                            WMSPanel wp = (WMSPanel)
              // jp.getClientProperty("WMS_PANEL");
              //                            if (wp != null &&
              // wp.getURLString().equalsIgnoreCase(serverLocation))
              //                            {
              //                                tabbedPane.setSelectedIndex(i); // make it the
              // visible one
              //                                return;
              //                            }
              //                        }
              //                    }

              try {

                addNewPanel(tabPane).contactWMSServer(serverLocation);
              } catch (URISyntaxException e) {
                e.printStackTrace(); // TODO
              }
            }
          }
        });

    return wmsPanel;
  }
  /*
   *	Tab has changed. Focus on saved component for the given tab.
   *  When there is no saved component, focus on the first component.
   */
  public void stateChanged(ChangeEvent e) {
    Component key = tabbedPane.getComponentAt(tabbedPane.getSelectedIndex());

    if (key == null) return;

    Component value = tabFocus.get(key);

    //  First time selecting this tab or focus policy is RESET_FOCUS

    if (value == null) {
      key.transferFocus();
      tabFocus.put(key, value);
    } else //  Use the saved component for focusing
    {
      value.requestFocusInWindow();
    }
  }
Ejemplo n.º 12
0
  public void stateChanged(ChangeEvent ce) {
    Object ob = ce.getSource();
    Class<?> cl = ob.getClass();

    if (Debug) {
      System.out.println("MyChangeListener: got stateChanged: Object: " + ob.toString() + "\n");
      System.out.println("MyChangeListener: got stateChanged: Class: " + cl.getName() + "\n");
    }

    if (cl.getName().equals("javax.swing.JTabbedPane")) {
      if (pane == ce.getSource()) {
        int index = pane.getSelectedIndex();
        mLook.stateChanged(index);
      } else {
        System.out.println("The source does NOT equal pane\n");
      }
    }
  }
  public void showFrame(Editor editor, ContributionType contributionType) {
    this.editor = editor;

    // Calculating index to switch to the required tab
    int index = getIndex(contributionType);
    if (dialog == null) {
      makeFrame(editor);
      // done before as downloadAndUpdateContributionListing()
      // requires the current selected tab
      tabbedPane.setSelectedIndex(index);
      downloadAndUpdateContributionListing(editor.getBase());
      if (index != 4) {
        Component selected = tabbedPane.getTabComponentAt(tabbedPane.getSelectedIndex());
        selected.setBackground(new Color(0xe0fffd));
        selected.setForeground(Color.BLACK);
      } else {
        updateTabPanel.setBackground(new Color(0xe0fffd));
        updateTabLabel.setForeground(Color.BLACK);
      }
    }
    tabbedPane.setSelectedIndex(index);
    dialog.setVisible(true);
  }
  /*
   *  Track focus changes and update the current focus component
   *  for the current tab
   */
  public void propertyChange(PropertyChangeEvent e) {
    //  No need to track focus change

    if (exceptions == null && focusPolicy == RESET_FOCUS) return;

    //  Check for exceptions to the focus policy exist

    Component key = tabbedPane.getComponentAt(tabbedPane.getSelectedIndex());

    if (exceptions != null) {
      if (focusPolicy == RESET_FOCUS && !exceptions.contains(key)) return;

      if (focusPolicy == RETAIN_FOCUS && exceptions.contains(key)) return;
    }

    // Track focus changes for the tab

    Component value = (Component) e.getNewValue();

    if (value != null && SwingUtilities.isDescendingFrom(value, key)) {

      tabFocus.put(key, value);
    }
  }
Ejemplo n.º 15
0
 public int getSelectedTab() {
   return tabbedPane.getSelectedIndex();
 }
Ejemplo n.º 16
0
 public void testViewChanged() {
   TestRunView view = (TestRunView) fTestRunViews.elementAt(fTestViewTab.getSelectedIndex());
   view.activate();
 }
Ejemplo n.º 17
0
 void printfTabPane_stateChanged(ChangeEvent e) {
   updateEditableTemplate(selectedPane);
   selectedPane = printfTabPane.getSelectedIndex();
   updatePane(selectedPane);
 }
Ejemplo n.º 18
0
 /**
  * Return the ParamDefaultsTable which is currently being shown in the tabbed pane
  *
  * @return The current ParamDefaultsTable
  */
 public ParamDefaultsTable getCurrentTable() {
   int index = tableTabbedPane.getSelectedIndex();
   return (ParamDefaultsTable) myTables.get(index);
 }
 private String getCurrentPageName() {
   int index = tabbedPanel.getSelectedIndex();
   if (index < 0) return "";
   return pageList.get(index).getName();
 }