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
  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;
  }
Example #3
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());
  }
 /*
  * (non-Javadoc)
  *
  * @see
  * javax.swing.event.ChangeListener#stateChanged(javax.swing.event.ChangeEvent
  * )
  */
 @Override
 public void stateChanged(ChangeEvent e) {
   JTabbedPane tabbedPane = parent.getTabbedPane();
   if (tabbedPane.getSelectedIndex() >= 0) {
     String title = tabbedPane.getTitleAt(tabbedPane.getSelectedIndex());
     parent.setTitle(title + " - JavaEditor");
   }
 }
 /**
  * Reacts to state changes in the {@link ImViewer}.
  *
  * @see ChangeListener#stateChanged(ChangeEvent)
  */
 public void stateChanged(ChangeEvent e) {
   if (e.getSource() instanceof JTabbedPane) {
     JTabbedPane pane = (JTabbedPane) e.getSource();
     if (view.checkIfTabEnabled(pane.getSelectedIndex())) {
       if (pane.getSelectedIndex() == EditorUI.RND_INDEX)
         model.loadRenderingControl(RenderingControlLoader.LOAD);
     }
   }
 }
Example #6
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();
      }
    }
  }
  protected void setProcessMenuItemsEnabled() {

    boolean enabled =
        (tabbedPane.getSelectedIndex() == TAB_INDEX_PROCESS) && sshSession.isConnected();

    rdbtnmntmActiveProcesses.setEnabled(enabled);
    rdbtnmntmAllProcesses.setEnabled(enabled);
    rdbtnmntmMyProcesses.setEnabled(enabled);

    if ((panelProcesses != null) && panelProcesses.isRowSelected() && enabled) {

      mntmStopProcess.setEnabled(true);
      mntmContinueProcess.setEnabled(true);
      mntmEndProcess.setEnabled(true);
      mntmKillProcess.setEnabled(true);
      mntmChangePriority.setEnabled(true);

    } else {

      mntmStopProcess.setEnabled(false);
      mntmContinueProcess.setEnabled(false);
      mntmEndProcess.setEnabled(false);
      mntmKillProcess.setEnabled(false);
      mntmChangePriority.setEnabled(false);
    }
  }
Example #8
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;
 }
Example #10
0
 @Override
 public void stateChanged(ChangeEvent e) {
   // TODO Auto-generated method stub
   JTabbedPane pane = (JTabbedPane) e.getSource();
   int sel = pane.getSelectedIndex();
   jxh = getHeader(sel);
 }
Example #11
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 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;
 }
 /** Creates new form FindAndReplaceDialog */
 public FindAndReplaceDialog(java.awt.Frame parent, boolean modal, JTabbedPane tab) {
   super(parent, modal);
   initComponents();
   setLocationRelativeTo(null);
   RTextScrollPane t = (RTextScrollPane) tab.getComponentAt(tab.getSelectedIndex());
   selectedArea = (RSyntaxTextArea) t.getTextArea();
   findDocListener();
   replaceDocListener();
 }
Example #14
0
 /** Remembers the current settings in the download dialog. */
 public void rememberSettings() {
   Main.pref.put("download.tab", Integer.toString(tpDownloadAreaSelectors.getSelectedIndex()));
   Main.pref.put("download.osm", cbDownloadOsmData.isSelected());
   Main.pref.put("download.gps", cbDownloadGpxData.isSelected());
   Main.pref.put("download.newlayer", cbNewLayer.isSelected());
   if (currentBounds != null) {
     Main.pref.put("osm-download.bounds", currentBounds.encodeAsString(";"));
   }
 }
 @Override
 public void stateChanged(ChangeEvent ev) {
   Object src = ev.getSource();
   if (src instanceof JTabbedPane) {
     JTabbedPane pane = (JTabbedPane) src;
     int idx = pane.getSelectedIndex();
     _lastSelectedIndex = idx;
   }
 } // end stateChanged()
Example #16
0
 private void blink() {
   if (lblTitle.getForeground() == Color.BLACK) {
     lblTitle.setForeground(new Color(255, 130, 13));
   } else {
     lblTitle.setForeground(Color.BLACK);
   }
   if (parent.indexOfComponent(owner) == parent.getSelectedIndex()) {
     this.stopBlink();
   }
 }
 /** {@inheritDoc} */
 @Override
 protected void doLoad(final JTabbedPane component) {
   final Integer index = loadValue();
   if (index != null
       && index >= 0
       && component.getTabCount() > index
       && index != component.getSelectedIndex()) {
     component.setSelectedIndex(index);
   }
 }
Example #18
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);
 }
 /** 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);
   }
 }
 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;
 }
 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);
 }
 /** 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);
   }
 }
Example #23
0
 /** Get the TemplateField corresponding to the given DraggableIcon. */
 private TemplateField getField(DraggableIcon icon) {
   int idx = tabPane.getSelectedIndex();
   Object[] keys = icons[idx].keySet().toArray();
   for (int i = 0; i < keys.length; i++) {
     if (icons[idx].get(keys[i]).equals(icon)) {
       return (TemplateField) fields[idx].get(keys[i]);
     }
   }
   return null;
 }
Example #24
0
  /**
   * Reacts to a change in the selected tab by calling refresh() for TabToDoTarget's & setTarget on
   * a TabModelTarget or TabFigTarget instance.
   *
   * <p>Called when the user selects a new tab, by clicking or otherwise.
   *
   * <p>{@inheritDoc}
   */
  public void stateChanged(ChangeEvent e) {
    LOG.log(Level.FINE, "DetailsPane state changed");
    Component sel = topLevelTabbedPane.getSelectedComponent();

    // update the previously selected tab
    if (lastNonNullTab >= 0) {
      JPanel tab = tabPanelList.get(lastNonNullTab);
      if (tab instanceof TargetListener) {
        // not visible any more - so remove as listener
        removeTargetListener((TargetListener) tab);
      }
    }
    Object target = TargetManager.getInstance().getSingleTarget();

    if (!(sel instanceof TabToDoTarget) && !(sel instanceof TabProps)) {
      // TODO: Bob says - tabs that listen for target changes
      // should register themselves not expect DetailsPane to
      // listen and pass on the event. Otherwise these tabs
      // always rely on DetailsPane. TabToDoTarget and TabProps
      // currently listen directly.

      // The other tabs need to be updated depending on the selection.
      if (sel instanceof TabTarget) {
        ((TabTarget) sel).setTarget(target);
      } else if (sel instanceof TargetListener) {
        removeTargetListener((TargetListener) sel);
        addTargetListener((TargetListener) sel);
        // Newly selected tab may have stale target info, so generate
        // a new set target event for it to refresh it
        ((TargetListener) sel)
            .targetSet(
                new TargetEvent(
                    this, TargetEvent.TARGET_SET, new Object[] {}, new Object[] {target}));
      }
    }

    if (target != null
        && Model.getFacade().isAUMLElement(target)
        && topLevelTabbedPane.getSelectedIndex() > 0) {
      lastNonNullTab = topLevelTabbedPane.getSelectedIndex();
    }
  }
  // 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);
    }
  }
Example #26
0
  public TextCompoundEdit(JTextComponent editor, JTextFieldUndoListener listener) {

    this.editor = editor;
    this.listener = listener;

    EditorView editorView =
        ((CayenneModelerFrame) Application.getInstance().getFrameController().getView()).getView();

    treePath = editorView.getProjectTreeView().getSelectionPath();

    DefaultMutableTreeNode newPath = (DefaultMutableTreeNode) treePath.getLastPathComponent();

    targetObject = newPath.getUserObject();

    if (targetObject instanceof ObjEntity) {
      tabbedPane = editorView.getObjDetailView();
    }

    if (targetObject instanceof DbEntity) {
      tabbedPane = editorView.getDbDetailView();
    }

    if (targetObject instanceof Embeddable) {
      tabbedPane = editorView.getEmbeddableView();
    }

    if (targetObject instanceof SQLTemplate) {
      tabbedPane = editorView.getSqlTemplateView();

      if (tabbedPane != null) {
        selectedItem = ((SQLTemplateTabbedView) tabbedPane).getScriptsTab().getSelectedIndex();
      }
    }

    if (targetObject instanceof EJBQLQuery) {
      tabbedPane = editorView.getEjbqlQueryView();
    }

    if (targetObject instanceof DataNodeDescriptor) {
      tabbedPane = editorView.getDataNodeView();
    }

    if (targetObject instanceof DataMap) {
      tabbedPane = editorView.getDataMapView();
    }

    if (targetObject instanceof DataChannelDescriptor) {
      tabbedPane = editorView.getDataDomainView();
    }

    if (tabbedPane != null) {
      selectedTabIndex = tabbedPane.getSelectedIndex();
    }
  }
  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);
  }
Example #28
0
 /*
  * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
  */
 public void mouseClicked(MouseEvent me) {
   int tab = results.getSelectedIndex();
   if (tab != -1) {
     Rectangle tabBounds = results.getBoundsAt(tab);
     if (!tabBounds.contains(me.getX(), me.getY())) {
       return;
     }
     if (tab >= 1 && me.getClickCount() >= 2) {
       myDoubleClick(tab - 1); // help tab is 0
     }
   }
 }
Example #29
0
  protected void updateBackImage(MouseEvent arg0) {

    Tab tabee = tabAccess.get(tab.getSelectedIndex());

    if (tabee.getIndex() == 0) {
      (backJB).setEnabled(false);
      (backJB).setIcon(new ImageIcon(iconDir + "back2.png"));
    } else {
      (backJB).setEnabled(true);
      (backJB).setIcon(new ImageIcon(iconDir + "back3.png"));
    }
  }
Example #30
0
  protected void updateforwardImage() {

    Tab tabee = tabAccess.get(tab.getSelectedIndex());

    if (tabee.getIndex() == tabee.size() - 1) {
      (forwardJB).setEnabled(false);
      (forwardJB).setIcon(new ImageIcon(iconDir + "forward2.png"));
    } else {
      (forwardJB).setEnabled(true);
      (forwardJB).setIcon(new ImageIcon(iconDir + "forward3.png"));
    }
  }