Пример #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
 private void setCompUpdatable() {
   for (int i = 0; i < objList.size(); i++) {
     JComponent obj = (JComponent) objList.get(i);
     if (obj != null) {
       if (obj instanceof XMLToolPanel) ((XMLToolPanel) obj).valueChanged();
     }
   }
 }
Пример #3
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);
        }
      }
    }
  }
Пример #4
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);
  }
Пример #5
0
    public void startElement(String uri, String localName, String qName, Attributes attr) {
      // System.out.println("Start of Element '"+qName+"'");
      // int numOfAttr = attr.getLength();
      // System.out.println("   Number of Attributes is "+numOfAttr);
      // for (int i=0; i<numOfAttr; i++) {
      // System.out.println("   with attr["+i+"]='"+attr.getValue(i)+"'");
      // }
      if (!qName.equals("tool")) return;

      boolean bScroll = true;
      PushpinIF pObj = null;
      lastName = attr.getValue("name");
      String helplink = attr.getValue("helplink");
      Constructor c = (Constructor) getTool(lastName);
      Object[] vargs;
      String toolFile;
      if (lastName.equals("XMLToolPanel")) {
        lastName = attr.getValue("label");
        lastName = Util.getLabelString(lastName);
        String scroll = attr.getValue("scrollbar");
        if (scroll != null) {
          if (scroll.equalsIgnoreCase("no")) bScroll = false;
        }
        vargs = new Object[3];
        vargs[0] = sshare;
        vargs[1] = lastName;
        toolFile = attr.getValue("file");
        vargs[2] = toolFile;
        String f = "LAYOUT" + File.separator + "toolPanels" + File.separator + toolFile;
        toolFile = FileUtil.openPath(f);
        if (toolFile == null) return;

      } else {
        vargs = new Object[1];
        vargs[0] = sshare;
      }
      if (c != null) {
        try {
          lastComp = (JComponent) c.newInstance(vargs);
          if (lastComp instanceof VToolPanel) {
            toolList.add(lastComp);
            pObj = (PushpinIF) lastComp;
          }
          objList.add(lastComp);
        } catch (Exception e) {
          lastComp = new JLabel(lastName);
        }
      } else {
        lastComp = new JLabel(lastName);
      }

      String vps = attr.getValue("viewport");

      if (lastComp != null && (lastComp instanceof XMLToolPanel))
        ((XMLToolPanel) lastComp).setScrollAble(bScroll);
      if (pObj == null) {
        PushpinObj nObj = new PushpinObj(lastComp, pinPanel);
        pObj = nObj;
        pObj.setTitle(lastName);
        pObj.showPushPin(true);
        pObj.showTitle(true);
        pObj.setTabOnTop(true);
      }
      pObj.setName(lastName);
      addTabComp(pObj);
      pObj.setContainer(pinPanel);
      pObj.setSuperContainer(pinPanel);
      panes.put(lastName, pObj);
      // panes.put(lastName, lastComp);
      keys.add(lastName);
      vpInfo.add(vps);
    }