示例#1
0
 private void displayTool(Component comp) {
   if (tabbedPane != null && tabbedPane.getTabCount() > 1) {
     if (tabbedPane.indexOfComponent(comp) >= 0) {
       tabbedPane.setSelectedComponent(comp);
     }
   }
   if (comp instanceof PushpinObj) comp = ((PushpinObj) comp).getPinObj();
   if (comp instanceof XMLToolPanel) {
     ((XMLToolPanel) comp).updateChange();
     ((XMLToolPanel) comp).setEditMode(inEditMode);
   } else if (comp instanceof VToolPanel) ((VToolPanel) comp).updateValue();
 }
示例#2
0
  public void setViewPort(int id) {

    if (id >= nviews || id < 0) return;

    String key;
    String value;
    vpId = id;
    for (Enumeration e = tp_paneInfo[id].keys(); e.hasMoreElements(); ) {
      key = (String) e.nextElement();
      value = (String) tp_paneInfo[id].get(key);
      if (value.equals("yes")) {
        JComponent comp = (JComponent) panes.get(key);
        if (comp instanceof VToolPanel) {
          ((VToolPanel) comp).setViewPort(id);
        } else {
          if (comp instanceof PushpinIF) comp = ((PushpinIF) comp).getPinObj();
          if (comp instanceof XMLToolPanel) ((XMLToolPanel) comp).setViewPort(id);
        }
      }
    }
  }
示例#3
0
  /**
   * public void setCurrentLayout(int newId) {
   *
   * <p>if(newId >= nviews || vpId >= nviews) return;
   *
   * <p>String key; String newValue; String currValue;
   *
   * <p>for(int i=0; i<keys.size(); i++) { key = (String)keys.get(i); newValue =
   * (String)tp_paneInfo[newId].get(key); currValue = (String)tp_paneInfo[vpId].get(key); JComponent
   * obj = (JComponent)panes.get(key); if(newValue.equals("yes")) { if
   * (tabbedPane.indexOfComponent((Component)obj) < 0) tabbedPane.addTab(key, null, obj, ""); if
   * (obj instanceof PushpinIF) ((PushpinIF) obj).setAvailable(true); } else
   * if(newValue.equals("no")) { if (tabbedPane.indexOfComponent((Component)obj) >= 0)
   * tabbedPane.remove(obj); if (obj instanceof PushpinIF) ((PushpinIF) obj).setAvailable(false); }
   * }
   *
   * <p>tabbedToolPanel.removeAll(); if(tabbedPane.getTabCount() > 0) { if(tabbedPane.getTabCount()
   * == 1) { tabbedToolPanel.add(tabbedPane.getComponentAt(0)); } else if(tabbedPane.getTabCount() >
   * 1) { tabbedToolPanel.add(tabbedPane); } pinPanel.setStatus("open"); } else {
   * pinPanel.setStatus("close"); setVisible(false); } validate(); repaint(); }
   */
  public void initPanel() {

    if (panes == null || panes.size() <= 0) return;

    setCurrentLayout();
    String key;
    for (Enumeration e = panes.keys(); e.hasMoreElements(); ) {
      key = (String) e.nextElement();
      JComponent comp = (JComponent) panes.get(key);
      if (comp instanceof VToolPanel) ((VToolPanel) comp).initPanel();
      else {
        if (comp instanceof PushpinIF) comp = ((PushpinIF) comp).getPinObj();
        if (comp instanceof XMLToolPanel) ((XMLToolPanel) comp).buildPanel();
      }
      /**
       * ** if(comp instanceof XMLToolPanel) { ((XMLToolPanel)comp).buildPanel(); } else if(comp
       * instanceof VToolPanel) { ((VToolPanel)comp).initPanel(); } **
       */
    }
    if (pinPanel.isOpen()) {
      if (!pinPanel.isVisible()) pinPanel.setVisible(true);
    } else pinPanel.setVisible(false);
  }
示例#4
0
  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();
  }