@Override public void addDeviceView(DeviceView deviceView) { Component comp = deviceView.asUIComponent(); if (tabbedPane.indexOfComponent(comp) != -1) { tabbedPane.setSelectedIndex(tabbedPane.indexOfComponent(comp)); } else { tabs.put(deviceView, comp); tabbedPane.addTab(deviceView.getTitle(), comp); tabbedPane.setSelectedComponent(comp); } }
@Override public boolean switchDeviceView(Device device) { for (DeviceView deviceView : tabs.keySet()) { if (deviceView.getDevice().equals(device)) { Component comp = tabs.get(deviceView); tabbedPane.setSelectedIndex(tabbedPane.indexOfComponent(comp)); return true; } } return false; } }
static synchronized void connectionEstablished(EnhancedDebugger debugger) { getInstance().tabbedPane.setIconAt( getInstance().tabbedPane.indexOfComponent(debugger.tabbedPane), connectionActiveIcon); }
/** * Notification that the connection was properly closed. * * @param debugger the debugger whose connection was properly closed. */ static synchronized void connectionClosed(EnhancedDebugger debugger) { getInstance().tabbedPane.setIconAt( getInstance().tabbedPane.indexOfComponent(debugger.tabbedPane), connectionClosedIcon); }
/** * Shows the new debugger in the debug window. * * @param debugger the new debugger to show */ private void showNewDebugger(EnhancedDebugger debugger) { if (frame == null) { createDebug(); } debugger.tabbedPane.setName("XMPPConnection_" + tabbedPane.getComponentCount()); tabbedPane.add(debugger.tabbedPane, tabbedPane.getComponentCount() - 1); tabbedPane.setIconAt(tabbedPane.indexOfComponent(debugger.tabbedPane), connectionCreatedIcon); frame.setTitle( "Smack Debug Window -- Total connections: " + (tabbedPane.getComponentCount() - 1)); // Keep the added debugger for later access debuggers.add(debugger); }
/** * Notification that the connection was closed due to an exception. * * @param debugger the debugger whose connection was closed due to an exception. * @param e the exception. */ static synchronized void connectionClosedOnError(EnhancedDebugger debugger, Exception e) { int index = getInstance().tabbedPane.indexOfComponent(debugger.tabbedPane); getInstance().tabbedPane.setToolTipTextAt( index, "XMPPConnection closed due to the exception: " + e.getMessage()); getInstance().tabbedPane.setIconAt( index, connectionClosedOnErrorIcon); }
/** * Notification that a user has logged in to the server. A new title will be set * to the tab of the given debugger. * * @param debugger the debugger whose connection logged in to the server * @param user the user@host/resource that has just logged in */ static synchronized void userHasLogged(EnhancedDebugger debugger, String user) { int index = getInstance().tabbedPane.indexOfComponent(debugger.tabbedPane); getInstance().tabbedPane.setTitleAt( index, user); getInstance().tabbedPane.setIconAt( index, connectionActiveIcon); }
/** Setter for help URL. * @param helpURL help URL */ public void setHelpURL(URL helpURL) { if (htmlBrowser == null) { return; } if (helpURL != null) { if (!helpURL.equals(htmlBrowser.getDocumentURL())) { htmlBrowser.setURL(helpURL); } if (tabbedPane != null) { tabbedPane.setEnabledAt(tabbedPane.indexOfComponent(htmlBrowser), true); } } else if (tabbedPane != null) { tabbedPane.setSelectedComponent(contentPanel); tabbedPane.setEnabledAt(tabbedPane.indexOfComponent(htmlBrowser), false); } }
@Override protected boolean contains (JComponent comp) { return soleComponent == comp || tabbedPane.indexOfComponent(comp) != -1; }
/** * Sets the given component as selected in the JTabbedPane. * * @param c */ public void setSelectedComponent(Component c) { if (tabs.indexOfComponent(c) != -1) { tabs.setSelectedComponent(c); } }
public void setForegroundForComponent(Component comp, Color foreground) { int index = tabs.indexOfComponent(comp); if (index != -1) { tabs.setForegroundAt(index,foreground); } }
synchronized public void gcTraceRenamed(GCTrace gcTrace) { T panel = map.get(gcTrace); assert panel != null; int index = tabbedPane.indexOfComponent(panel); String name = gcTrace.getName(); tabbedPane.setTitleAt(index, name); }
public void setTitleForComponent(Component comp, String title, String tooltip) { int index = tabs.indexOfComponent(comp); if (index != -1) { tabs.setTitleAt(index, title); tabs.setToolTipTextAt(index, tooltip); } }
/** * Report the index in stubsPane of the provided stub. * * @param stub the stub of interest * @return the stub index in stubsPane */ public Integer getIndex (SheetStub stub) { return stubsPane.indexOfComponent(stub.getAssembly().getComponent()); }
public int indexOfComponent(Component component) { for (Component comp : pane.getComponents()) { if (comp instanceof SparkTab) { SparkTab tab = (SparkTab) comp; if (tab.getComponent() == component) return pane.indexOfComponent(tab); } } return -1; }
public void highlight(IMChatConsole console) { int i = tabbedChat.indexOfComponent(console); if (i >= 0 && tabbedChat instanceof ClosableTabHost) { ((ClosableTabHost) tabbedChat).bling(i, console.getName()); } }
@Override public void actionPerformed(ActionEvent e) { SourceFilePanel filePanel = new SourceFilePanel(plugin); tabbedPanel.addTab("", filePanel); int indexOfPanel = tabbedPanel.indexOfComponent(filePanel); tabbedPanel.setTabComponentAt(indexOfPanel, filePanel.getTabLabel()); tabbedPanel.setSelectedIndex(indexOfPanel); } }
private void addCloseButton(Component component) { super.setTabComponentAt( super.indexOfComponent(component), new ButtonTabComponent(this) ); } }
void removeChat(ChatPanel chatPanel) { int index = chats.indexOfComponent(chatPanel); assert index>=0: "Component not found in CloseButtonTabbedPane " + chatPanel; open.remove(chatPanel.getName()); chats.remove(chatPanel); if (chats.getSelectedIndex()==chats.getTabCount()-1 && chats.getTabCount()>1) { chats.setSelectedIndex(chats.getSelectedIndex()-1); } chatPanel.leave(); validate(); storeOpenChats(); }
public void close(SparkTab sparktab) { int closeTabNumber = pane.indexOfComponent(sparktab); pane.removeTabAt(closeTabNumber); fireTabRemoved(sparktab, sparktab.getComponent(), closeTabNumber); if (pane.getTabCount() == 0) { allTabsClosed(); } }