Ejemplo n.º 1
0
 public void recordCurrentLayout() {
   if (tabbedPane != null) {
     tp_selectedTab = tabbedPane.getSelectedIndex();
     if (tp_selectedTab >= 0) selectedTabName = tabbedPane.getTitleAt(tp_selectedTab);
     else selectedTabName = null;
   }
 }
Ejemplo n.º 2
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.º 3
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();
 }
Ejemplo n.º 4
0
  public VTabbedToolPanel(SessionShare sshare, AppIF appIF) {
    // super( new BorderLayout() );
    this.sshare = sshare;
    this.appIF = appIF;
    this.tabbedToolPanel = new JPanel();
    this.pinPanel = this;
    this.selectedTabName = null;
    setPinObj(this.tabbedToolPanel);
    this.tabbedToolPanel.setLayout(new BorderLayout());
    this.tabbedPane = new JTabbedPane();
    panelName = "Tab Panel";
    setTitle(panelName);
    setName(panelName);

    tabbedPane.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            tabChanged();
            /**
             * ** the following was moved to tabChanged() if(tabbedPane.getTabCount() > 1 &&
             * Util.getRQPanel() != null) { int ind = tabbedPane.getSelectedIndex(); if(ind >= 0 &&
             * ind < tabbedPane.getTabCount())
             * Util.getRQPanel().updatePopup(tabbedPane.getTitleAt(ind)); } *********
             */
          }
        });

    // Add Mouse Listener for CSH
    MouseAdapter ml = new CSHMouseAdapter();
    tabbedPane.addMouseListener(ml);

    Object obj = sshare.userInfo().get("canvasnum");
    if (obj != null) {
      Dimension dim = (Dimension) obj;
      nviews = (dim.height) * (dim.width);
    } else nviews = 1;

    for (int i = 0; i < nviews; i++) tp_paneInfo[i] = new Hashtable();

    /*
    obj = sshare.userInfo().get("activeWin");
    if(obj != null) {
               vpId = ((Integer)obj).intValue();
    } else vpId = 0;
            */

    // System.out.println("VToolPanel nviews vpId "+nviews+" "+vpId);

    fillHashtable();
    Util.setVTabbedToolPanel(this);
    ParamInfo.addEditListener(this);
  }
Ejemplo n.º 5
0
  public void setCurrentLayout(int newId) {

    if (newId >= nviews) return;

    tabbedPane.removeAll();
    tabbedToolPanel.removeAll();
    String key;
    String currValue;
    JComponent obj;
    PushpinIF pobj;
    clearPushpinComp();
    for (int i = 0; i < keys.size(); i++) {
      key = (String) keys.get(i);
      currValue = (String) tp_paneInfo[newId].get(key);
      obj = (JComponent) panes.get(key);
      pobj = null;
      if (currValue.equals("yes") && obj != null) {
        if (obj instanceof PushpinIF) {
          pobj = (PushpinIF) obj;
          pobj.setAvailable(true);
          if (!pobj.isOpen()) {
            if (!pobj.isPopup()) obj = null;
          }
        }
        if (obj != null) {
          if (key.equals("Locator")) key = getLocatorName();
          tabbedPane.addTab(key, null, obj, "");
        }
        // tabbedPane.addTab(key, null, (JComponent)panes.get(key), "");
      }
    }

    if (tabbedPane.getTabCount() < 1) {
      pinPanel.setAvailable(false);
      pinPanel.setStatus("close");
      // setVisible(false);
      return;
    }

    pinPanel.setAvailable(true);
    pinPanel.setStatus("open");
    if (tabbedPane.getTabCount() == 1) {
      tabbedToolPanel.add(tabbedPane.getComponentAt(0));
      // tabbedToolPanel.add(tabbedPane);
    } else {
      tabbedToolPanel.add(tabbedPane);
    }
    setSelectedTab(tp_selectedTab, selectedTabName);

    tabbedToolPanel.validate();
    // repaint();
  }
Ejemplo n.º 6
0
 private void setSelectedTab(int id, String name) {
   if (tabbedPane == null) return;
   int selectId = id;
   if (name != null) {
     for (int k = 0; k < tabbedPane.getTabCount(); k++) {
       String tabName = tabbedPane.getTitleAt(k);
       if (name.equals(tabName)) {
         selectId = k;
         break;
       }
     }
   }
   if (selectId >= 0 && selectId < tabbedPane.getTabCount()) tabbedPane.setSelectedIndex(selectId);
 }
Ejemplo n.º 7
0
  public void saveUiLayout() {

    for (int i = 0; i < toolList.size(); i++) ((VToolPanel) toolList.get(i)).saveUiLayout();

    Hashtable hs = sshare.userInfo();
    /*
    if (hs == null || tabbedPane == null || tabbedPane.getTabCount() <= 0)
        return;
     */
    if (hs == null || tabbedPane == null) return;
    if (tabbedPane.getTabCount() > 0) {
      Integer hashValue = new Integer(tabbedPane.getSelectedIndex());
      hs.put("tabbedToolPanel", hashValue);
    }
    putHsLayout(vpId);
  }
Ejemplo n.º 8
0
  public int getOpenCount() {
    int num = tabbedToolPanel.getComponentCount();
    if (num != 1) return num;
    Component comp = tabbedToolPanel.getComponent(0);
    if (comp instanceof JTabbedPane) {
      JTabbedPane tp = (JTabbedPane) comp;
      num = tp.getTabCount();
      if (num != 1) return num;
      comp = tp.getComponentAt(0);
    }
    if (comp instanceof VToolPanel) num = ((VToolPanel) comp).getOpenCount();
    else if (comp instanceof PushpinIF) {
      if (!((PushpinIF) comp).isOpen()) num = 0;
    }

    return num;
  }
Ejemplo n.º 9
0
  private Component getSelectedObj() {
    if (tabbedToolPanel.getComponentCount() < 1) return null;
    Component comp = tabbedToolPanel.getComponent(0);
    if (comp instanceof JTabbedPane) {
      JTabbedPane tp = (JTabbedPane) comp;
      if (tp.getTabCount() == 1) {
        comp = tp.getComponentAt(0);
      } else if (tp.getTabCount() > 1) {
        comp = tp.getSelectedComponent();
      }
    }
    if (comp instanceof VToolPanel) return comp;

    if (!(comp instanceof XMLToolPanel)) {
      if (comp instanceof PushpinIF) comp = ((PushpinIF) comp).getPinObj();
    }
    return comp;
  }
Ejemplo n.º 10
0
 private void tabChanged() {
   if (bChangeTool) return;
   int index = -1;
   previous_selectedTab = 0;
   if (tabbedPane.getTabCount() > 1) {
     index = tabbedPane.getSelectedIndex();
     Component comp = tabbedPane.getSelectedComponent();
     if (comp != null && (comp instanceof PushpinIF)) {
       PushpinIF pobj = (PushpinIF) comp;
       if (!pobj.isPopup()) previous_selectedTab = index;
     }
   }
   updateSelectedObj();
   if (index >= 0) {
     if (Util.getRQPanel() != null) {
       Util.getRQPanel().updatePopup(tabbedPane.getTitleAt(index));
     }
   }
 }
Ejemplo n.º 11
0
 private void clearPanel() {
   tabbedPane.removeAll();
   tabbedToolPanel.removeAll();
   panes.clear();
   keys.clear();
   vpInfo.clear();
   toolList.clear();
   objList.clear();
   removeAllPushpinComp();
   for (int i = 0; i < nviews; i++) tp_paneInfo[i].clear();
 }
Ejemplo n.º 12
0
  private boolean containTool(JComponent obj) {
    int k, num;

    if (obj == null) return false;
    Component src = (Component) obj;
    Component comp;
    if (tabbedPane != null) {
      num = tabbedPane.getTabCount();
      for (k = 0; k < num; k++) {
        comp = tabbedPane.getComponentAt(k);
        if (src == comp) return true;
      }
    }
    if (tabbedToolPanel != null) {
      num = tabbedToolPanel.getComponentCount();
      for (k = 0; k < num; k++) {
        comp = tabbedToolPanel.getComponent(k);
        if (src == comp) return true;
      }
    }
    return false;
  }
Ejemplo n.º 13
0
  public void initUiLayout() {

    getHsLayout(vpId);
    for (int i = 0; i < toolList.size(); i++) ((VToolPanel) toolList.get(i)).initUiLayout();

    initPanel();
    updatePinTabs();

    Hashtable hs = sshare.userInfo();
    if (hs == null || tabbedPane == null || tabbedPane.getTabCount() <= 0) return;
    Object obj = hs.get("tabbedToolPanel");
    if (obj == null) return;
    int indx = ((Integer) obj).intValue();
    if (indx < 0) return;
    // if(indx >= 0 && indx < tabbedPane.getTabCount())
    // tabbedPane.setSelectedIndex(indx);
    setSelectedTab(tp_selectedTab, null);
  }