Ejemplo n.º 1
0
  public void switchLayout(int newId, boolean bLayout) {

    if (layoutId == newId) return;
    if (newId >= nviews) updateVpInfo(newId + 1);

    if (bSwitching) {
      return;
    }

    bSwitching = true;
    int oldId = layoutId;
    vpId = newId;
    layoutId = newId;

    recordCurrentLayout();
    VpLayoutInfo vInfo = Util.getViewArea().getLayoutInfo(oldId);
    if (vInfo != null) { // save current layout info
      vInfo.tp_selectedTab = tp_selectedTab;
      vInfo.setVerticalTabName(selectedTabName);
      // copyCurrentLayout(vInfo);
    }

    vInfo = Util.getViewArea().getLayoutInfo(newId);

    putHsLayout(oldId);
    if (bLayout) getHsLayout(vpId);

    for (int i = 0; i < toolList.size(); i++)
      ((VToolPanel) toolList.get(i)).switchLayout(newId, bLayout);

    if (bLayout) setCurrentLayout();
    /*
    if(comparePanelLayout(oldId, newId)) {
    setCurrentLayout();
           }
           if ((vInfo != null) && vInfo.bAvailable &&
    compareCurrentLayout(vInfo)) {
                  setCurrentLayout(vInfo);
           }

    for(int i=0; i< toolList.size(); i++)
        ((VToolPanel) toolList.get(i)).switchLayout(newId);
           */

    // setViewPort(newId);

    if (bLayout) setCurrentLayout(vInfo);

    updateValue();

    if (bLayout) {
      if (pinPanel.isOpen()) {
        if (!pinPanel.isVisible()) pinPanel.setVisible(true);
      } else pinPanel.setVisible(false);
    }
    validate();
    repaint();

    bSwitching = false;
  }
Ejemplo n.º 2
0
  public boolean openTool(String name, boolean bOpen, boolean bShowOnly) {
    if (!bOpen) return closeTool(name);

    JComponent obj = searchTool(name);
    if (obj == null) return false;
    if (obj instanceof VToolPanel) {
      if (!((VToolPanel) obj).openTool(name, bOpen, bShowOnly)) return false;
    } else {
      if (obj instanceof PushpinIF) {
        PushpinIF pobj = (PushpinIF) obj;
        if (bShowOnly) {
          if (!pobj.isClose()) return false; // no change
        }
        pobj.setStatus("open");
      }
    }
    recordCurrentLayout();
    bChangeTool = true;
    setCurrentLayout();
    if (!pinPanel.isOpen()) {
      pinPanel.setVisible(false);
      bChangeTool = false;
      return false;
    }
    if (!bShowOnly) displayTool((Component) obj);
    bChangeTool = false;
    if (!pinPanel.isVisible()) pinPanel.setVisible(true);
    if (bShowOnly) setSelectedTab(tp_selectedTab, selectedTabName);
    validate();
    repaint();

    return true;
  }
Ejemplo n.º 3
0
 public boolean popdnTool(String name) {
   JComponent obj = searchTool(name);
   if (obj == null) return false;
   if (obj instanceof VToolPanel) {
     if (!((VToolPanel) obj).popdnTool(name)) return false;
   } else {
     if (obj instanceof PushpinIF) {
       PushpinIF pobj = (PushpinIF) obj;
       pobj.pinPopup(false);
     }
     boolean bContain = containTool(obj);
     if (!bContain) return false;
   }
   bChangeTool = true;
   setCurrentLayout();
   if (previous_selectedTab >= 1 && tabbedPane != null) {
     if (tabbedPane.getTabCount() > previous_selectedTab)
       tabbedPane.setSelectedIndex(previous_selectedTab);
   }
   VnmrjIF vif = Util.getVjIF();
   if (vif != null) vif.raiseToolPanel(false);
   if (!pinPanel.isOpen()) pinPanel.setVisible(false);
   bChangeTool = false;
   updateSelectedObj();
   repaint();
   return true;
 }
Ejemplo n.º 4
0
 public boolean popupTool(String name) {
   JComponent obj = searchTool(name);
   if (obj == null) return false;
   if (obj instanceof VToolPanel) {
     if (!((VToolPanel) obj).popupTool(name)) return false;
   } else {
     if (obj instanceof PushpinIF) {
       PushpinIF pobj = (PushpinIF) obj;
       if (!pobj.isOpen()) pobj.pinPopup(true);
     }
   }
   bChangeTool = true;
   setCurrentLayout();
   if (!pinPanel.isOpen()) {
     pinPanel.setVisible(false);
     bChangeTool = false;
     return false;
   }
   displayTool((Component) obj);
   VnmrjIF vif = Util.getVjIF();
   if (vif != null) vif.raiseToolPanel(true);
   bChangeTool = false;
   validate();
   repaint();
   return true;
 }
Ejemplo n.º 5
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);
  }
Ejemplo n.º 6
0
  public boolean hideTool(String name) {
    JComponent obj = searchTool(name);
    if (obj == null) return false;
    if (obj instanceof VToolPanel) {
      if (!((VToolPanel) obj).hideTool(name)) return false;
    } else {
      if (obj instanceof PushpinIF) {
        PushpinIF pobj = (PushpinIF) obj;
        pobj.setStatus("hide");
      }
    }
    setCurrentLayout();
    if (!pinPanel.isOpen()) {
      pinPanel.setVisible(false);
    }

    validate();
    repaint();

    return true;
  }