public synchronized void toggleCurrentSQLResultTabSticky() {
    if (null != _stickyTab) {
      if (_stickyTab.equals(_tabbedExecutionsPanel.getSelectedComponent())) {
        // Sticky is turned off. Just remove sticky and return.
        _stickyTab = null;
        _tabbedExecutionsPanel.setIconAt(_tabbedExecutionsPanel.getSelectedIndex(), null);
        return;

      } else {
        // remove old sticky tab
        int indexOfStickyTab = getIndexOfTab(_stickyTab);
        if (-1 != indexOfStickyTab) {
          _tabbedExecutionsPanel.setIconAt(indexOfStickyTab, null);
        }
        _stickyTab = null;
      }
    }

    if (false == _tabbedExecutionsPanel.getSelectedComponent() instanceof IResultTab) {
      // i18n[SQLResultExecuterPanel.nonStickyPanel=Cannot make a cancel panel sticky]
      String msg = s_stringMgr.getString("SQLResultExecuterPanel.nonStickyPanel");
      JOptionPane.showMessageDialog(_session.getApplication().getMainFrame(), msg);
      return;
    }

    _stickyTab = (IResultTab) _tabbedExecutionsPanel.getSelectedComponent();
    int selectedIndex = _tabbedExecutionsPanel.getSelectedIndex();

    ImageIcon icon = getStickyIcon();

    _tabbedExecutionsPanel.setIconAt(selectedIndex, icon);
  }
Example #2
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();
      }
    }
  }
Example #3
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();
      }
    }
  }
 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;
 }
 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;
 }
Example #6
0
 public void recordCurrentLayout() {
   if (tabbedPane != null) {
     tp_selectedTab = tabbedPane.getSelectedIndex();
     if (tp_selectedTab >= 0) selectedTabName = tabbedPane.getTitleAt(tp_selectedTab);
     else selectedTabName = null;
   }
 }
 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;
 }
 /** Display the next tab in the SQL results. */
 public void gotoNextResultsTab() {
   final int tabCount = _tabbedExecutionsPanel.getTabCount();
   if (tabCount > 1) {
     int nextTabIdx = _tabbedExecutionsPanel.getSelectedIndex() + 1;
     if (nextTabIdx >= tabCount) {
       nextTabIdx = 0;
     }
     _tabbedExecutionsPanel.setSelectedIndex(nextTabIdx);
   }
 }
 /** Display the previous tab in the SQL results. */
 public void gotoPreviousResultsTab() {
   final int tabCount = _tabbedExecutionsPanel.getTabCount();
   if (tabCount > 1) {
     int prevTabIdx = _tabbedExecutionsPanel.getSelectedIndex() - 1;
     if (prevTabIdx < 0) {
       prevTabIdx = tabCount - 1;
     }
     _tabbedExecutionsPanel.setSelectedIndex(prevTabIdx);
   }
 }
 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);
 }
Example #11
0
 public Component getComponentBefore(Container cont, Component comp) {
   if (comp == tabbedPane) {
     String tabTitle = tabbedPane.getTitleAt(tabbedPane.getSelectedIndex());
     Component prev = tabBefore.get(tabTitle);
     if (prev != null) return prev;
   }
   Component prev = before.get(comp);
   if (prev != null) return prev;
   return defaultPolicy.getComponentBefore(cont, comp);
 }
  // Tab listener
  public void stateChanged(ChangeEvent e) {

    int curTab = partTabbedPane.getSelectedIndex();
    if (curTab == 0) {
      System.out.println("part gen state changed : display = true");
      particleSizeInputPanel.setVisibleDisplayFrame(true);
    } else {
      System.out.println("part gen state changed : display = false");
      particleLocGenPanel.setVisibleDisplayFrame(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;
 }
 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);
 }
 ContributionTab getActiveTab() {
   switch (tabbedPane.getSelectedIndex()) {
     case 0:
       return librariesContributionTab;
     case 1:
       return modesContributionTab;
     case 2:
       return toolsContributionTab;
     case 3:
       return examplesContributionTab;
     default:
       return updatesContributionTab;
   }
 }
Example #17
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;
  }
Example #18
0
  public void saveUiLayout() {

    for (int i = 0; i < toolList.size(); i++) ((VToolPanel) toolList.get(i)).saveUiLayout();

    Hashtable hs = sshare.userInfo();
    /*
    if (hs == null || tabbedPane == null || tabbedPane.getTabCount() <= 0)
        return;
     */
    if (hs == null || tabbedPane == null) return;
    if (tabbedPane.getTabCount() > 0) {
      Integer hashValue = new Integer(tabbedPane.getSelectedIndex());
      hs.put("tabbedToolPanel", hashValue);
    }
    putHsLayout(vpId);
  }
  /*
   *	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();
    }
  }
Example #20
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");
      }
    }
  }
Example #21
0
 private void tabChanged() {
   if (bChangeTool) return;
   int index = -1;
   previous_selectedTab = 0;
   if (tabbedPane.getTabCount() > 1) {
     index = tabbedPane.getSelectedIndex();
     Component comp = tabbedPane.getSelectedComponent();
     if (comp != null && (comp instanceof PushpinIF)) {
       PushpinIF pobj = (PushpinIF) comp;
       if (!pobj.isPopup()) previous_selectedTab = index;
     }
   }
   updateSelectedObj();
   if (index >= 0) {
     if (Util.getRQPanel() != null) {
       Util.getRQPanel().updatePopup(tabbedPane.getTitleAt(index));
     }
   }
 }
  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);
    }
  }
Example #24
0
 public int getSelectedTab() {
   return tabbedPane.getSelectedIndex();
 }
Example #25
0
 public void testViewChanged() {
   TestRunView view = (TestRunView) fTestRunViews.elementAt(fTestViewTab.getSelectedIndex());
   view.activate();
 }
Example #26
0
 void printfTabPane_stateChanged(ChangeEvent e) {
   updateEditableTemplate(selectedPane);
   selectedPane = printfTabPane.getSelectedIndex();
   updatePane(selectedPane);
 }
Example #27
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);
 }
Example #28
0
 void save(XmlNode node) {
   layerControls.save(node);
   invertRegionSwitch.save(node);
   colorControls.save(node);
   node.setAttribute(TabIndexTag, Integer.toString(tabPane.getSelectedIndex()));
 }
 private String getCurrentPageName() {
   int index = tabbedPanel.getSelectedIndex();
   if (index < 0) return "";
   return pageList.get(index).getName();
 }