示例#1
0
 public void setVisible(boolean bShow, String title) {
   if (bShow) {
     String strDir = "";
     String strFreq = "";
     String strTraynum = "";
     m_strHelpFile = getHelpFile(title);
     String strSampleName = getSampleName(title);
     String frameBounds = getFrameBounds(title);
     StringTokenizer tok = new QuotedStringTokenizer(title);
     if (tok.hasMoreTokens()) strDir = tok.nextToken();
     if (tok.hasMoreTokens()) strFreq = tok.nextToken();
     if (tok.hasMoreTokens()) strTraynum = tok.nextToken();
     else {
       try {
         Integer.parseInt(strDir);
         // if strdir is number, then strdir is empty, and the
         // strfreq is the number
         strTraynum = strFreq;
         strFreq = strDir;
         strDir = "";
       } catch (Exception e) {
       }
     }
     try {
       setTitle(gettitle(strFreq));
       m_lblSampleName.setText("3");
       boolean bVast = isVast(strTraynum);
       CardLayout layout = (CardLayout) m_pnlSampleName.getLayout();
       if (!bVast) {
         if (strSampleName == null) {
           strSampleName = getSampleName(strDir, strTraynum);
         }
         m_lblSampleName.setText(strSampleName);
         layout.show(m_pnlSampleName, OTHER);
       } else {
         m_strDir = strDir;
         setTrays();
         layout.show(m_pnlSampleName, VAST);
         m_trayTimer.start();
       }
       boolean bSample = bVast || !strSampleName.trim().equals("");
       m_pnlSampleName.setVisible(bSample);
       m_lblLogin.setForeground(getBackground());
       m_lblLogin.setVisible(false);
       m_passwordField.setText("");
       m_passwordField.setCaretPosition(0);
     } catch (Exception e) {
       Messages.writeStackTrace(e);
     }
     setBounds(frameBounds);
     ExpPanel exp = Util.getActiveView();
     if (exp != null) exp.waitLogin(true);
   }
   writePersistence();
   setVisible(bShow);
 }
示例#2
0
 /** set an attribute. */
 public void setAttribute(int attr, String c) {
   switch (attr) {
     case STATKEY:
       statkey = c;
       updateStatus(ExpPanel.getStatusValue(statkey));
       break;
     case STATPAR:
       statpar = c;
       updateStatus(ExpPanel.getStatusValue(statpar));
       break;
     case STATSET:
       statset = c;
       updateStatus(ExpPanel.getStatusValue(statset));
       break;
     default:
       super.setAttribute(attr, c);
       break;
   }
 }
示例#3
0
  public XMLToolPanel(SessionShare ss, String pname, String fname) {

    this.vnmrIf = (ButtonIF) Util.getViewArea().getDefaultExp();
    this.sshare = ss;
    this.pname = pname;
    this.fname = fname;

    pane = new ParamPanel();
    pane.setPanelFile(fname);
    pane.setPanelName(pname);
    pane.setType(ParamInfo.TOOLPANEL);
    pane.setLayoutName("toolPanels");
    pane.setAttributes(null);

    paramsLayout = new VRubberPanLayout();
    if (!Util.isImagingUser()) paramsLayout.setSquish(1.0);

    DisplayOptions.addChangeListener(this);
    ExpPanel.addStatusListener(this);
    // ExpPanel.addExpListener(this);

    setLayout(new xpPanelLayout());
  } // constructor
示例#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();
  }
示例#5
0
  protected void enterLogin() {
    char[] password = m_passwordField.getPassword();
    String strUser = (String) m_cmbUser.getSelectedItem();
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    boolean blogin = WUserUtil.isOperatorNameok(strUser, false);
    if (blogin) {
      blogin = vnmrjPassword(strUser, password);
      if (!blogin) blogin = unixPassword(strUser, password);
    }
    if (blogin) {
      m_lblLogin.setForeground(Color.black);
      m_lblLogin.setText("Login Successful");
      m_lblLogin.setVisible(true);
      // Get the Email column string for access to the operator data
      String emStr = vnmr.util.Util.getLabel("_admin_Email");
      String stremail = WUserUtil.getOperatordata(strUser, emStr);

      // Get the Panel Level column string for access to the operator data
      String plStr = vnmr.util.Util.getLabel("_admin_Panel_Level");
      String strPanel = WUserUtil.getOperatordata(strUser, plStr);

      if (stremail == null || stremail.equals("null")) stremail = "";
      try {
        Integer.parseInt(strPanel);
      } catch (Exception e) {
        strPanel = WGlobal.PANELLEVEL;
      }
      m_trayTimer.stop();
      Messages.postDebug(" Login: "******"appdir('reset','")
                .append(strUser)
                .append("','")
                .append(stremail)
                .append("',")
                .append(strPanel)
                .append(")")
                .toString());
        exp.sendToVnmr("vnmrjcmd('util', 'bgReady')\n");
      }
      setVisible(false);

      // Save the current position and size of this panel in case it
      // was changed
      Dimension size = getSize();
      width = size.width;
      height = size.height;
      position = getLocation();
      writePersistence();

      // Call the macro to update this operator's
      // ExperimentSelector_operatorName.xml file
      // from the protocols themselves.  This macro will
      // cause an update of the ES when it is finished

      // Util.getAppIF().sendToVnmr("updateExpSelector");

      // I am not sure why we need to force updates since updateExpSelector
      // should have caused an update by writing to ES_op.xml file.
      // However, it works better if we do the force update.
      // ExpSelector.setForceUpdate(true);
    } else {
      m_lblLogin.setForeground(DisplayOptions.getColor("Error"));
      // m_lblLogin.setText("<HTML>Incorrect username/password <p> Please try again </HTML>");
      m_lblLogin.setVisible(true);
    }
    setCursor(Cursor.getDefaultCursor());
  }