protected void deleteCurrentPanel() { JComponent tabPane = (JComponent) tabbedPane.getSelectedComponent(); if (tabPane == null) return; WMSPanel wmsPanel = (WMSPanel) tabPane.getClientProperty(Constants.FEATURE_OWNER_PROPERTY); if (tabbedPane.getTabCount() > 2) // actually remove the tab only if there is more than one (plus the "+" tab) tabbedPane.remove(tabPane); else tabbedPane.setTitleAt(1, "New Server"); if (wmsPanel != null) wmsPanel.clearPanel(); }
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; }
public void updateLanguage() { ////////////////////////////////////////////////////////////// mdic = MonitorDictionary.getChildDictionary("ThreadManager"); MonitorDictionary.applyButton(btnKick, "Kick"); MonitorDictionary.applyButton(btnRefresh, "Refresh"); MonitorDictionary.applyButton(btnSend, "Send"); tblUser.setColumnNameEx(mdic.getString("LoginName"), 1); tblUser.setColumnNameEx(mdic.getString("LoginTime"), 2); tblUser.setColumnNameEx(mdic.getString("Host"), 3); ////////////////////////////////////////////////////////////// MonitorDictionary.applyButton(mnuSelectAll, "jmenu.Edit.SelectAll"); MonitorDictionary.applyButton(mnuClearAll, "jmenu.Edit.ClearAll"); MonitorDictionary.applyButton(mnuClearSelected, "jmenu.Edit.ClearSelected"); ////////////////////////////////////////////////////////////// MonitorDictionary.applyButton(mnuSystem, "jmenu.System"); MonitorDictionary.applyButton(mnuSystem_ChangePassword, "jmenu.System.ChangePassword"); MonitorDictionary.applyButton(mnuSystem_StopServer, "jmenu.System.Shutdown"); MonitorDictionary.applyButton(mnuSystem_EnableThreads, "jmenu.System.ThreadManager"); MonitorDictionary.applyButton(mnuHelp, "jmenu.Help"); MonitorDictionary.applyButton(mnuHelp_About, "jmenu.Help.About"); ////////////////////////////////////////////////////////////// MonitorDictionary.applyButton(mnuUI, "jmenu.UI"); ////////////////////////////////////////////////////////////// if (isOpen()) { lblStatus.setText( " " + MonitorDictionary.getString("LoggedUser") + ": " + channel.getUserName()); MonitorDictionary.applyButton(mnuSystem_Login, "jmenu.System.Logout"); mnuSystem_ChangePassword.setEnabled(true); mnuSystem_StopServer.setEnabled(true); mnuSystem_EnableThreads.setEnabled(true); } else { lblStatus.setText(""); MonitorDictionary.applyButton(mnuSystem_Login, "jmenu.System.Login"); mnuSystem_ChangePassword.setEnabled(false); mnuSystem_StopServer.setEnabled(false); mnuSystem_EnableThreads.setEnabled(false); } ////////////////////////////////////////////////////////////// for (int iIndex = 0; iIndex < pnlThread.getTabCount(); iIndex++) ((PanelThreadMonitor) pnlThread.getComponentAt(iIndex)).updateLanguage(); }