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; }
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; }
/** 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"); }
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; }
@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); }
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); } }
@Override public void insertTab(String title, Icon icon, Component component, String tip, int index) { titles.add(index, title); super.insertTab("", icon, component, tip, index); }