Exemple #1
0
  static String replaceUrlSymbol(JopSession session, String url) {
    Gdh gdh = session.getGdh();

    CdhrObjid webConfig = gdh.getClassList(Pwrb.cClass_WebBrowserConfig);
    if (webConfig.evenSts()) return url;

    CdhrString webName = gdh.objidToName(webConfig.objid, Cdh.mName_volumeStrict);
    if (webConfig.evenSts()) return url;

    for (int i = 0; i < 10; i++) {
      String attr = webName.str + ".URL_Symbols[" + i + "]";
      CdhrString attrValue = gdh.getObjectInfoString(attr);
      if (attrValue.evenSts()) return url;

      if (attrValue.str.equals("")) continue;

      StringTokenizer token = new StringTokenizer(attrValue.str);
      String symbol = "$" + token.nextToken();
      if (!token.hasMoreTokens()) continue;

      String value = token.nextToken();

      int idx = url.lastIndexOf(symbol);
      while (idx != -1) {
        url = url.substring(0, idx) + value + url.substring(idx + symbol.length());
        idx = url.lastIndexOf(symbol);
      }
    }
    return url;
  }
Exemple #2
0
  public void paint(Graphics g) {
    m_fm = g.getFontMetrics();

    g.setColor(getBackground());
    g.fillRect(0, 0, getWidth(), getHeight());
    getBorder().paintBorder(this, g, 0, 0, getWidth(), getHeight());

    g.setColor(getForeground());
    g.setFont(getFont());
    m_insets = getInsets();
    int x = m_insets.left;
    int y = m_insets.top + m_fm.getAscent();

    StringTokenizer st = new StringTokenizer(getText(), "\t");
    while (st.hasMoreTokens()) {
      String sNext = st.nextToken();
      g.drawString(sNext, x, y);
      x += m_fm.stringWidth(sNext);

      if (!st.hasMoreTokens()) break;
      int index = 0;
      while (x >= getTab(index)) index++;
      x = getTab(index);
    }
  }
Exemple #3
0
  // See comment in createericlist regarding HandleViewParams
  private /*synchronized*/ String HandleViewParams(
      String tempString, LinkedList tempList, StringTokenizer st) throws VisualizerLoadException {
    while (tempString.toUpperCase().startsWith("VIEW")) {
      StringTokenizer t = new StringTokenizer(tempString, " \t");
      String s1 = t.nextToken().toUpperCase();
      String s2 = t.nextToken().toUpperCase();
      String s3 = t.nextToken();

      // HERE PROCESS URL's AS YOU DID QUESTIONS

      if (s2.compareTo("ALGO") == 0) {
        add_a_pseudocode_URL(s3);
        // System.out.println("Adding to urls: "+Snaps+":"+s3);
        //                 urlList.append(Snaps+1 +":"+s3);
      } else if (s2.compareTo("DOCS") == 0) {
        add_a_documentation_URL(s3);
        // System.out.println("Adding to urls: "+Snaps+":"+s3);
        //                 if (debug) System.out.println("Adding to urlList: "+Snaps+1+":"+s3);
        //                 urlList.append(Snaps+1 +":"+s3);
      } else if (s2.compareTo("SCALE") == 0) {
        GKS.scale(Format.atof(s3.toUpperCase()), tempList, this);
      } else if (s2.compareTo("WINDOWS") == 0) {
        GKS.windows(Format.atoi(s3.toUpperCase()), tempList, this);
      } else if (s2.compareTo("JUMP") == 0) {
        GKS.jump(Format.atoi(s3.toUpperCase()), tempList, this);
      } else throw (new VisualizerLoadException(s2 + " is invalid VIEW parameter"));
      tempString = st.nextToken();
    }
    //         if (urlList.size() == 0)
    //             urlList.append("**");
    return (tempString);
  }
  private void commit() {
    String serverName = (String) server.getSelectedItem();
    if (serverName == null || serverName.equals("")) {
      vlog.error("No server name specified!");
      if (VncViewer.nViewers == 1)
        if (cc.viewer instanceof VncViewer) {
          ((VncViewer) cc.viewer).exit(1);
        }
      ret = false;
      endDialog();
    }

    // set params
    if (opts.via != null && opts.via.indexOf(':') >= 0) {
      opts.serverName = serverName;
    } else {
      opts.serverName = Hostname.getHost(serverName);
      opts.port = Hostname.getPort(serverName);
    }

    // Update the history list
    String valueStr = UserPreferences.get("ServerDialog", "history");
    String t = (valueStr == null) ? "" : valueStr;
    StringTokenizer st = new StringTokenizer(t, ",");
    StringBuffer sb = new StringBuffer().append((String) server.getSelectedItem());
    while (st.hasMoreTokens()) {
      String str = st.nextToken();
      if (!str.equals((String) server.getSelectedItem()) && !str.equals("")) {
        sb.append(',');
        sb.append(str);
      }
    }
    UserPreferences.set("ServerDialog", "history", sb.toString());
    UserPreferences.save("ServerDialog");
  }
Exemple #5
0
    protected void buildPanel(String strPath) {
      BufferedReader reader = WFileUtil.openReadFile(strPath);
      String strLine;

      if (reader == null) return;

      try {
        while ((strLine = reader.readLine()) != null) {
          if (strLine.startsWith("#") || strLine.startsWith("%") || strLine.startsWith("@"))
            continue;

          StringTokenizer sTokLine = new StringTokenizer(strLine, ":");

          // first token is the label e.g. Password Length
          if (sTokLine.hasMoreTokens()) {
            createLabel(sTokLine.nextToken(), this);
          }

          // second token is the value
          String strValue = sTokLine.hasMoreTokens() ? sTokLine.nextToken() : "";
          if (strValue.equalsIgnoreCase("yes") || strValue.equalsIgnoreCase("no"))
            createChkBox(strValue, this);
          else createTxf(strValue, this);
        }
      } catch (Exception e) {
        Messages.writeStackTrace(e);
        // e.printStackTrace();
        Messages.postDebug(e.toString());
      }
    }
 public void createColorArray() {
   color = new Color[colorString.length];
   for (int i = 0; i < colorString.length; i++) {
     StringTokenizer st = new StringTokenizer(colorString[i], " ");
     Color c = new Color(rgb(st.nextToken()), rgb(st.nextToken()), rgb(st.nextToken()));
     color[i] = c;
   }
 }
Exemple #7
0
  // createericlist with a String signature is used to process a String
  // containing a sequence of GAIGS structures
  // createericlist creates the list of graphics primitives for these snapshot(s).
  // After creating these lists, that are then appended to l, the list of snapshots,
  // Also must return the number of snapshots loaded from the string
  public /*synchronized*/ int createericlist(String structString) {
    int numsnaps = 0;
    if (debug) System.out.println("In create eric " + structString);
    StringTokenizer st = new StringTokenizer(structString, "\r\n");
    while (st.hasMoreTokens()) {
      numsnaps++; // ??
      String tempString;
      LinkedList tempList = new LinkedList();
      StructureType strct;
      tempString = st.nextToken();
      try {
        boolean headers = true;
        while (headers) {
          headers = false;
          if (tempString.toUpperCase().startsWith("VIEW")) {
            tempString = HandleViewParams(tempString, tempList, st);
            headers = true;
          }
          if (tempString.toUpperCase().startsWith("FIBQUESTION ")
              || tempString.toUpperCase().startsWith("MCQUESTION ")
              || tempString.toUpperCase().startsWith("MSQUESTION ")
              || tempString.toUpperCase().startsWith("TFQUESTION ")) {
            tempString = add_a_question(tempString, st);
            headers = true;
          }
        }

        if (tempString.toUpperCase().equals("STARTQUESTIONS")) {
          numsnaps--; // questions don't count as snapshots
          readQuestions(st);
          break;
        }
        // After returning from HandleViewParams, tempString should now contain
        // the line with the structure type and possible additional text height info
        StringTokenizer structLine = new StringTokenizer(tempString, " \t");
        String structType = structLine.nextToken();
        if (debug) System.out.println("About to assign structure" + structType);
        strct = assignStructureType(structType);
        strct.loadTextHeights(structLine, tempList, this);
        strct.loadLinesPerNodeInfo(st, tempList, this);

        strct.loadTitle(st, tempList, this);
        strct.loadStructure(st, tempList, this);
        strct.calcDimsAndStartPts(tempList, this);
        strct.drawTitle(tempList, this);
        strct.drawStructure(tempList, this);
      } catch (VisualizerLoadException e) {
        System.out.println(e.toString());
      }
      //             // You've just created a snapshot.  Need to insure that "**" is appended
      //             // to the URLList for this snapshot IF no VIEW ALGO line was parsed in the
      //             // string for the snapshot.  This could probably best be done in the
      //             // HandleViewParams method
      list_of_snapshots.append(tempList);
      Snaps++;
    }
    return (numsnaps);
  } // createericlist(string)
Exemple #8
0
 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();
   }
 }
 {
   StringBuffer sb = new StringBuffer();
   StringTokenizer st = new StringTokenizer(cfg.REQPARAM_CONTACT_LIST_LOGIN_IDS, ",");
   while (st.hasMoreTokens()) {
     sb.append(st.nextToken());
     if (st.hasMoreTokens()) sb.append("\n");
   }
   contactList.setText(sb.toString());
 }
Exemple #10
0
 private String subString(String s, String m, String d) {
   String r = "";
   StringTokenizer tok = new StringTokenizer(s, " \t\':+-*/\"/()=,\0", true);
   while (tok.hasMoreTokens()) {
     String t = tok.nextToken();
     if (t.equals(m)) r += d;
     else r += t;
   }
   return r;
 }
Exemple #11
0
 protected void createButtons(JPanel panel) {
   panel.add(new Filler(24, 20));
   JComboBox drawingChoice = new JComboBox();
   drawingChoice.addItem(fgUntitled);
   String param = getParameter("DRAWINGS");
   if (param == null) {
     param = "";
   }
   StringTokenizer st = new StringTokenizer(param);
   while (st.hasMoreTokens()) {
     drawingChoice.addItem(st.nextToken());
   }
   if (drawingChoice.getItemCount() > 1) {
     panel.add(drawingChoice);
   } else {
     panel.add(new JLabel(fgUntitled));
   }
   drawingChoice.addItemListener(
       new ItemListener() {
         public void itemStateChanged(ItemEvent e) {
           if (e.getStateChange() == ItemEvent.SELECTED) {
             loadDrawing((String) e.getItem());
           }
         }
       });
   panel.add(new Filler(6, 20));
   JButton button;
   button = new CommandButton(new DeleteCommand("Delete", this));
   panel.add(button);
   button = new CommandButton(new DuplicateCommand("Duplicate", this));
   panel.add(button);
   button = new CommandButton(new GroupCommand("Group", this));
   panel.add(button);
   button = new CommandButton(new UngroupCommand("Ungroup", this));
   panel.add(button);
   button = new JButton("Help");
   button.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent event) {
           showHelp();
         }
       });
   panel.add(button);
   fUpdateButton = new JButton("Simple Update");
   fUpdateButton.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent event) {
           if (fSimpleUpdate) {
             setBufferedDisplayUpdate();
           } else {
             setSimpleDisplayUpdate();
           }
         }
       });
 }
Exemple #12
0
 /**
  * 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;
 }
Exemple #13
0
  public final String readCommand(byte[] b)
      throws IOException, InterruptedException, MessagingNetworkException {
    InputStream is = getInputStream();
    synchronized (is) {
      long abortTime =
          System.currentTimeMillis() + 1000 * MSNMessagingNetwork.REQPARAM_SOCKET_TIMEOUT_SECONDS;
      int ofs = 0;
      boolean d = false;
      for (; ; ) {
        if (Thread.currentThread().isInterrupted()) throw new InterruptedIOException();
        int by = is.read();
        if (by == -1) throw new IOException("unexpected EOF");
        if (by == 10 && d) break;
        d = (by == 13);
        if (ofs < b.length) {
          b[ofs++] = (byte) by;
        }
        if (System.currentTimeMillis() > abortTime) throw new IOException("connection timed out");
        /*
        if (len >= buffer.length)
        {
          ...
          return ...;
        }
        int pos = findCRLF();
        if (pos != -1) break;
        fill(is, abortTime);
        */
      }
      if (b[ofs - 1] == 13) --ofs;

      String line = new String(b, 0, ofs, "ASCII");

      if (StringUtil.startsWith(line, "MSG")) {
        StringTokenizer st = new StringTokenizer(line);
        String len_s = null;
        while (st.hasMoreTokens()) {
          len_s = st.nextToken();
        }
        if (len_s == null) throw new AssertException("len_s is null");
        int len;
        try {
          len = Integer.parseInt(len_s);
        } catch (NumberFormatException ex) {
          ServerConnection.throwProtocolViolated("MSG length must be int");
          len = 0;
        }
        String msg = readMSG(len);
        line = line + "\r\n" + msg;
      }
      if (Defines.DEBUG && CAT.isDebugEnabled()) CAT.debug("S: " + line);
      return line;
    }
  }
Exemple #14
0
 /**
  * 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;
 }
Exemple #15
0
 /**
  * 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;
 }
Exemple #16
0
  /**
   * List results by date
   *
   * @param reslist result list
   * @param ldisp
   */
  private void listByDateRun(ResultList reslist, boolean ldisp) {
    StringTokenizer tokenizer = new StringTokenizer((String) reslist.get("list"), "\n");

    Vector vdata = new Vector();
    while (tokenizer.hasMoreTokens()) {
      String data = convertToPretty(tokenizer.nextToken());
      if (datasets.contains(data) || ldisp) vdata.add(data);
    }
    datasets.removeAllElements();

    Enumeration en = vdata.elements();
    while (en.hasMoreElements()) datasets.addElement(en.nextElement());
  }
Exemple #17
0
 private /*synchronized*/ String add_a_question(String tmpStr, StringTokenizer st)
     throws VisualizerLoadException {
   try {
     StringTokenizer tokzer = new StringTokenizer(tmpStr);
     String idTok = tokzer.nextToken();
     idTok = tokzer.nextToken(); // what we really want is the id
     //             FIBQuestion q = new FIBQuestion(idTok);
     //             qTable.put(idTok, q);                   //add map id -> q
     GaigsAV.qCtlTable.put(new Integer(Snaps), idTok); // add map snap -> q (assumes <= 1 q/snap)
     if (debug) System.out.println("Adding question for snap " + Snaps);
     return st.nextToken();
   } catch (Exception e) {
     throw new VisualizerLoadException("Aieee... bad SHO file");
   }
 }
 String[] getContactList() {
   java.util.List cl = new java.util.LinkedList();
   StringTokenizer st = new StringTokenizer(contactList.getText());
   StringBuffer sb = new StringBuffer();
   StringBuffer dbg = new StringBuffer("test applet contactlist: ");
   while (st.hasMoreTokens()) {
     String loginId = st.nextToken().trim();
     if (loginId.length() == 0) continue;
     dbg.append("'" + loginId + "' ");
     cl.add(loginId);
     sb.append(loginId).append('\n');
   }
   CAT.info(dbg.toString());
   contactList.setText(sb.toString());
   return (String[]) cl.toArray(new String[cl.size()]);
 }
      MyNode findNode(String fqn) {
        MyNode curr, n;
        StringTokenizer tok;
        String child_name;

        if (fqn == null) return null;
        curr = this;
        tok = new StringTokenizer(fqn, ReplicatedTreeView.SEP);

        while (tok.hasMoreTokens()) {
          child_name = tok.nextToken();
          n = curr.findChild(child_name);
          if (n == null) return null;
          curr = n;
        }
        return curr;
      }
 /** Update state from Infostat. */
 public void updateStatus(String msg) {
   // Messages.postDebug("VLcStatusChart.updateStatus(" + msg + ")");/*CMP*/
   if (msg == null) {
     return;
   }
   StringTokenizer tok = new StringTokenizer(msg);
   if (tok.hasMoreTokens()) {
     String key = tok.nextToken();
     String val = "";
     if (tok.hasMoreTokens()) {
       val = tok.nextToken("").trim(); // Get remainder of msg
     }
     if (key.equals(statkey)) {
       if (val != null && !val.equals("-")) {
         valstr = val;
         setState(state);
       }
       /*System.out.println("Chart: statkey=" + statkey
       + ", val=" + val);/*CMP*/
     }
     if (key.equals(statpar)) {
       if (val != null && !val.equals("-")) {
         /*System.out.println("Chart statpar=" + statpar
         + ", value=" + value);/*CMP*/
         setState(state);
       }
     }
     if (key.equals(statset)) {
       if (val != null && !val.equals("-")) {
         setval = val;
         try {
           String num = val.substring(0, val.indexOf(' '));
           setStatusValue(Double.parseDouble(num));
         } catch (NumberFormatException nfe) {
           Messages.postDebug("VLcStatusChart.updateStatus(): " + "Non-numeric value: " + msg);
         } catch (StringIndexOutOfBoundsException sioobe) {
           setStatusValue(0); // No value found
         }
         /*System.out.println("Chart statset=" + statset
         + ", setval=" + setval);/*CMP*/
         setState(state);
       }
     }
   }
   repaint();
 }
Exemple #21
0
 public Object stringToValue(String text) throws ParseException {
   StringTokenizer tokenizer = new StringTokenizer(text, ".");
   byte[] a = new byte[4];
   for (int i = 0; i < 4; i++) {
     int b = 0;
     if (!tokenizer.hasMoreTokens()) throw new ParseException("Too few bytes", 0);
     try {
       b = Integer.parseInt(tokenizer.nextToken());
     } catch (NumberFormatException e) {
       throw new ParseException("Not an integer", 0);
     }
     if (b < 0 || b >= 256) throw new ParseException("Byte out of range", 0);
     a[i] = (byte) b;
   }
   if (tokenizer.hasMoreTokens()) throw new ParseException("Too many bytes", 0);
   return a;
 }
Exemple #22
0
  /** Set the matching descriptors. */
  private void setMatchingFileNames() {
    StringTokenizer st = new StringTokenizer(matchingTF.getText(), ",");

    int numTokens = st.countTokens();

    if (numTokens == 0) {
      descriptors = new String[1];
      descriptors[0] = "*";
      return;
    }

    descriptors = new String[numTokens];

    int i = 0;
    while (st.hasMoreElements()) {
      descriptors[i++] = st.nextToken().trim();
    }
  }
Exemple #23
0
  protected void loadJarFiles(AppletClassLoader loader) throws IOException, InterruptedException {
    // Load the archives if present.
    // REMIND - this probably should be done in a separate thread,
    // or at least the additional archives (epll).
    String jarFiles = getJarFiles();

    if (jarFiles != null) {
      StringTokenizer st = new StringTokenizer(jarFiles, ",", false);
      while (st.hasMoreTokens()) {
        String tok = st.nextToken().trim();
        try {
          loader.addJar(tok);
        } catch (IllegalArgumentException e) {
          // bad archive name
          continue;
        }
      }
    }
  }
Exemple #24
0
  // This method loads the map from a text file. It reads the numbers from the file and assigns them
  // to the grid array.
  public void loadMap() {
    try {
      // Creates necessary objects and variables
      BufferedReader br = new BufferedReader(new FileReader(map + ".txt"));
      StringTokenizer st;
      String s;

      // Loops to go through every number in the file
      for (int i = 0; i < 11; i++) {
        // Uses the string tokenizer to get numbers that are seperated by a space
        st = new StringTokenizer(br.readLine(), " ");
        for (int j = 0; j < 11; j++) {
          // Assigns the value in the file to grid[i][j]
          grid[i][j] = Integer.parseInt(st.nextToken());
        }
      }
    } catch (Exception e) {
      System.out.println("Map not fount");
    }
  }
      /**
       * Adds a new node to the view. Intermediary nodes will be created if they don't yet exist.
       * Returns the first node that was created or null if node already existed
       */
      public MyNode add(String fqn) {
        MyNode curr, n, ret = null;
        StringTokenizer tok;
        String child_name;

        if (fqn == null) return null;
        curr = this;
        tok = new StringTokenizer(fqn, ReplicatedTreeView.SEP);

        while (tok.hasMoreTokens()) {
          child_name = tok.nextToken();
          n = curr.findChild(child_name);
          if (n == null) {
            n = new MyNode(child_name);
            if (ret == null) ret = n;
            curr.add(n);
          }
          curr = n;
        }
        return ret;
      }
    AboutPanel() {
      setFont(UIManager.getFont("Label.font"));
      fm = getFontMetrics(getFont());

      setForeground(new Color(96, 96, 96));
      image = new ImageIcon(getClass().getResource("/org/gjt/sp/jedit/icons/about.png"));

      setBorder(new MatteBorder(1, 1, 1, 1, Color.gray));

      text = new Vector(50);
      StringTokenizer st = new StringTokenizer(jEdit.getProperty("about.text"), "\n");
      while (st.hasMoreTokens()) {
        String line = st.nextToken();
        text.addElement(line);
        maxWidth = Math.max(maxWidth, fm.stringWidth(line) + 10);
      }

      scrollPosition = -250;

      thread = new AnimationThread();
    }
Exemple #27
0
  /**
   * Creates the components based on the information in each line.
   *
   * @param sTokLine the tokens in a line.
   *     <p>The file is of the following format: auditDir:/vnmr/part11/auditTrails:system
   *     part11Dir:/vnmr/part11/data:system part11Dir:/vnmr/part11/data:system
   *     file:standard:cmdHistory:yes file:standard:fid:yes file:standard:procpar:yes
   *     file:standard:conpar:yes
   *     <p>Based on this format, the line is parsed as follows: 1) if the line starts with the
   *     keyword 'file', then it skips over the first two tokens in the line which are 'file' and
   *     'standard', and the third token in the line is the label of the item, and the fourth token
   *     in the line corresponds to the value of the checkbox. 2) if the line doesnot start with the
   *     keyword 'file', then the second and the fourth tokens are skipped, first token in the line
   *     is the label of the item, and the third token is the value of the textfield.
   */
  protected void createJComps(StringTokenizer sTokLine) {
    boolean bFile = false;
    boolean bMode = false;
    JComponent compValue = null;
    boolean bDir = false;

    for (int i = 0; sTokLine.hasMoreTokens(); i++) {
      String strTok = sTokLine.nextToken();
      if (i == 0) {
        bFile = strTok.equalsIgnoreCase("file") ? true : false;
        bMode = strTok.equalsIgnoreCase("dataType") ? true : false;
        bDir = false;
        if (strTok.equalsIgnoreCase("dir")) bDir = true;

        // Case 2, create a label for the first token.
        if (!bFile && !bDir) createLabel(strTok, m_pnlDisplay);
      } else {
        // Case 1 => file:standard:conpar:yes
        if (bFile) {
          // skip over the first tokenwhich is the keyword 'file'
          if (i == 1) continue;
          // else check for checkbox value.
          else if (strTok.equalsIgnoreCase("yes") || strTok.equalsIgnoreCase("no"))
            compValue = createChkBox(strTok, m_pnlDisplay);
          // else create a label.
          else createLabel(strTok, m_pnlDisplay);
        }
        // Case 2 => part11Dir:/vnmr/part11/data:system Or dataType:Non-FDA
        else if (!bDir) {
          if (i == 1) {
            // create a combobox
            if (bMode) compValue = createCombo(strTok, m_pnlDisplay);
            // create a textfield and sets it's value.
            else compValue = createTxf(strTok, m_pnlDisplay);
          }
        }
      }
    }
    m_aListComp.add(compValue);
  }
Exemple #28
0
  public /*synchronized*/ Color colorSet(String values) {
    String temp;
    int x;
    Color c = Color.black;

    StringTokenizer st = new StringTokenizer(values);
    x = Format.atoi(st.nextToken());
    if (x == 1) c = Color.black;
    else if (x == 2) c = Color.blue;
    else if (x == 6) c = Color.cyan;
    else if (x == 13) c = Color.darkGray;
    else if (x == 11) c = Color.gray;
    else if (x == 3) c = Color.green;
    else if (x == 9) c = Color.lightGray;
    else if (x == 5) c = Color.magenta;
    else if (x == 10) c = Color.orange;
    else if (x == 12) c = Color.pink;
    else if (x == 4) c = Color.red;
    else if (x == 8) c = Color.white;
    else if (x == 7) c = Color.yellow;
    else if (x < 0) c = new Color(-x);
    return c;
  }
Exemple #29
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);
 }
Exemple #30
0
  private /*synchronized*/ void readQuestions(StringTokenizer st) throws VisualizerLoadException {
    String tmpStr =
        "STARTQUESTIONS\n"; // When CG's QuestionFactory parses from a string, it looks for
    // a line with STARTQUESTIONS -- hence we add it artificially here
    try { // Build the string for the QuestionFactory
      while (st.hasMoreTokens()) {
        tmpStr += st.nextToken() + "\n";
      }
    } catch (Exception e) {
      e.printStackTrace();
      throw new VisualizerLoadException("Ooof!  bad question format");
    }

    try {
      // System.out.println(tmpStr);
      // Problem -- must make this be line oriented
      GaigsAV.questionCollection = QuestionFactory.parseScript(tmpStr);
    } catch (QuestionParseException e) {
      e.printStackTrace();
      System.out.println("Error parsing questions.");
      throw new VisualizerLoadException("Ooof!  bad question format");
      // throw new IOException();
    }
  } // readQuestions(st)