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); }
private void newLabel(String s) { StringTokenizer tkn = new StringTokenizer(s, "\n"); num_lines = tkn.countTokens(); lines = new String[num_lines]; line_widths = new int[num_lines]; for (int i = 0; i < num_lines; i++) { lines[i] = tkn.nextToken(); } }
/** * Gets the keyword telling where to place the login frame. * The "title" is a series of tokens of the form: * <pre> * autodir h1freq traymax [help:path] [nextloc:loc] [frameBounds:keyword] * <pre> * @param title The "title" passed in. * @return The frame location keyword. */ private String getFrameBounds(String title) { String bounds = null; StringTokenizer tok = new QuotedStringTokenizer(title); while (tok.hasMoreTokens()) { String strValue = tok.nextToken(); if (strValue.startsWith("frameBounds:")) { bounds = strValue.substring(12); } } return bounds; }
/** * Get the "next sample" string from the given "title". * The "title" is a series of tokens of the form: * <pre> * autodir h1freq traymax [help:path] [nextloc:loc] [frameBounds:keyword] * <pre> * @param title The "title" passed in. * @return The next available sample location, or null. */ protected String getSampleName(String title) { String name = null; StringTokenizer tok = new QuotedStringTokenizer(title); while (tok.hasMoreTokens()) { String strValue = tok.nextToken(); if (strValue.startsWith("nextloc:")) { name = strValue.substring(8); } } return name; }
/** * Set the helpfile string from the given "title". * The "title" is a series of tokens of the form: * <pre> * autodir h1freq traymax [help:path] [nextloc:loc] * <pre> * @param title The "title" passed in. * @return The path to the help file, or null. */ protected String getHelpFile(String title) { StringTokenizer tok = new QuotedStringTokenizer(title); String path = null; while (tok.hasMoreTokens()) { String strValue = tok.nextToken(); if (strValue.startsWith("help:")) { path = strValue.substring(5); } } return path; }