protected String gettitle(String strFreq) { StringBuffer sbufTitle = new StringBuffer().append("VnmrJ "); String strPath = FileUtil.openPath(FileUtil.SYS_VNMR + "/vnmrrev"); BufferedReader reader = WFileUtil.openReadFile(strPath); String strLine; String strtype = ""; if (reader == null) return sbufTitle.toString(); try { while ((strLine = reader.readLine()) != null) { strtype = strLine; } strtype = strtype.trim(); if (strtype.equals("merc")) strtype = "Mercury"; else if (strtype.equals("mercvx")) strtype = "Mercury-Vx"; else if (strtype.equals("mercplus")) strtype = "MERCURY plus"; else if (strtype.equals("inova")) strtype = "INOVA"; String strHostName = m_strHostname; if (strHostName == null) strHostName = ""; sbufTitle.append(" ").append(strHostName); sbufTitle.append(" ").append(strtype); sbufTitle.append(" - ").append(strFreq); reader.close(); } catch (Exception e) { // e.printStackTrace(); Messages.logError(e.toString()); } return sbufTitle.toString(); }
public void fill() { int i; boolean bSameFile = true; File fd = null; VToolPanel toolPanel = null; String toolPanelFile = FileUtil.openPath("INTERFACE/TabbedToolPanel.xml"); if (toolPanelFile != null) fd = new File(toolPanelFile); if (fd != null && fd.exists()) { bSameFile = false; if (buildFile != null && buildFile.equals(toolPanelFile)) { if (fd.lastModified() == dateOfbuildFile) // same file bSameFile = true; } } if (bSameFile) { for (i = 0; i < objList.size(); i++) { JComponent obj = (JComponent) objList.get(i); if (obj != null) { if (obj instanceof VToolPanel) toolPanel = (VToolPanel) obj; else { if (obj instanceof StatusListenerIF) ExpPanel.addStatusListener((StatusListenerIF) obj); else if (obj instanceof ExpListenerIF) ExpPanel.addExpListener((ExpListenerIF) obj); } } } if (toolPanel != null) toolPanel.fill(); return; } for (i = 0; i < objList.size(); i++) { for (i = 0; i < objList.size(); i++) { JComponent obj = (JComponent) objList.get(i); if (obj != null) { if (obj instanceof VToolPanel) toolPanel = (VToolPanel) obj; } } } if (toolPanel != null) toolPanel.clearAll(); buildFile = toolPanelFile; if (fd != null) dateOfbuildFile = fd.lastModified(); clearPanel(); try { SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setValidating(false); // set to true if we get DOCTYPE spf.setNamespaceAware(false); // set to true with referencing SAXParser parser = spf.newSAXParser(); if (toolPanelFile == null) { /* get VToolPanel only */ String key = "Locator"; PushpinIF pObj; Constructor c = (Constructor) getTool(key); Object[] vargs = new Object[1]; vargs[0] = sshare; if (c != null) { JComponent comp = (JComponent) c.newInstance(vargs); if (comp instanceof VToolPanel) { toolList.add(comp); } tabbedToolPanel.add(comp); objList.add(comp); if (!(comp instanceof PushpinIF)) { pObj = new PushpinObj(comp, pinPanel); // pObj.setTitle("Tool Panel"); pObj.showPushPin(false); pObj.showTitle(false); // pObj.alwaysShowTab(true); } else pObj = (PushpinIF) comp; pObj.setContainer(pinPanel); pObj.setSuperContainer(pinPanel); addTabComp(pObj); panes.put(key, pObj); // panes.put(key,comp); keys.add(key); vpInfo.add("all"); for (i = 0; i < nviews; i++) tp_paneInfo[i].put(key, "yes"); } } else { parser.parse(new File(toolPanelFile), new MySaxHandler()); } } catch (ParserConfigurationException pce) { System.out.println("The underlying parser does not support the " + "requested feature(s)."); } catch (FactoryConfigurationError fce) { System.out.println("Error occurred obtaining SAX Parser Factory."); } catch (Exception e) { e.printStackTrace(); } for (i = 0; i < toolList.size(); i++) ((VToolPanel) toolList.get(i)).fill(); }