Пример #1
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);
  }
Пример #2
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());
      }
    }
Пример #3
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;
  }
 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;
   }
 }
Пример #5
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)
Пример #6
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);
 }
Пример #7
0
    protected void buildPanel(String strPath) {
      strPath = FileUtil.openPath(strPath);
      ArrayList aListPath = new ArrayList();
      BufferedReader reader = WFileUtil.openReadFile(strPath);
      if (reader == null) return;

      String strLine;
      try {
        while ((strLine = reader.readLine()) != null) {
          StringTokenizer strTok = new StringTokenizer(strLine, ":");
          if (strTok.countTokens() < 4) continue;

          boolean bChecksum = false;
          boolean bShow = false;

          String strDir = strTok.nextToken();
          String strChecksum = strTok.nextToken();

          if (strChecksum.equalsIgnoreCase("checksum")) bChecksum = true;

          if (bChecksum && (strDir.equals("file") || strDir.equals("dir"))) {
            String strValue = strTok.nextToken();
            String strShow = strTok.nextToken();
            if (strShow.equalsIgnoreCase("yes")) bShow = true;

            if (bShow) aListPath.add(strValue);
          }
        }

        m_cmbPath = new JComboBox(aListPath.toArray());

        JPanel pnlDisplay = new JPanel(new GridBagLayout());
        GridBagConstraints gbc =
            new GridBagConstraints(
                0,
                0,
                1,
                1,
                0.2,
                0.2,
                GridBagConstraints.NORTHWEST,
                GridBagConstraints.HORIZONTAL,
                new Insets(0, 0, 0, 0),
                0,
                0);
        pnlDisplay.add(m_cmbPath, gbc);
        gbc.gridx = 1;
        pnlDisplay.add(m_cmbChecksum, gbc);
        add(pnlDisplay, BorderLayout.NORTH);
        add(m_txaChecksum, BorderLayout.CENTER);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
Пример #8
0
 /**
  * This method is activated on the Keystrokes we are listening to in this implementation. Here it
  * listens for Copy and Paste ActionCommands. Selections comprising non-adjacent cells result in
  * invalid selection and then copy action cannot be performed. Paste is done by aligning the upper
  * left corner of the selection with the 1st element in the current selection of the JTable.
  */
 public void actionPerformed(ActionEvent e) {
   if (e.getActionCommand().compareTo("Copy") == 0) {
     StringBuffer sbf = new StringBuffer();
     // Check to ensure we have selected only a contiguous block of
     // cells
     int numcols = jTable1.getSelectedColumnCount();
     int numrows = jTable1.getSelectedRowCount();
     int[] rowsselected = jTable1.getSelectedRows();
     int[] colsselected = jTable1.getSelectedColumns();
     if (!((numrows - 1 == rowsselected[rowsselected.length - 1] - rowsselected[0]
             && numrows == rowsselected.length)
         && (numcols - 1 == colsselected[colsselected.length - 1] - colsselected[0]
             && numcols == colsselected.length))) {
       JOptionPane.showMessageDialog(
           null, "Invalid Copy Selection", "Invalid Copy Selection", JOptionPane.ERROR_MESSAGE);
       return;
     }
     for (int i = 0; i < numrows; i++) {
       for (int j = 0; j < numcols; j++) {
         sbf.append(jTable1.getValueAt(rowsselected[i], colsselected[j]));
         if (j < numcols - 1) sbf.append("\t");
       }
       sbf.append("\n");
     }
     stsel = new StringSelection(sbf.toString());
     system = Toolkit.getDefaultToolkit().getSystemClipboard();
     system.setContents(stsel, stsel);
   }
   if (e.getActionCommand().compareTo("Paste") == 0) {
     System.out.println("Trying to Paste");
     int startRow = (jTable1.getSelectedRows())[0];
     int startCol = (jTable1.getSelectedColumns())[0];
     try {
       String trstring =
           (String) (system.getContents(this).getTransferData(DataFlavor.stringFlavor));
       System.out.println("String is:" + trstring);
       StringTokenizer st1 = new StringTokenizer(trstring, "\n");
       for (int i = 0; st1.hasMoreTokens(); i++) {
         rowstring = st1.nextToken();
         StringTokenizer st2 = new StringTokenizer(rowstring, "\t");
         for (int j = 0; st2.hasMoreTokens(); j++) {
           value = (String) st2.nextToken();
           if (startRow + i < jTable1.getRowCount() && startCol + j < jTable1.getColumnCount())
             jTable1.setValueAt(value, startRow + i, startCol + j);
           System.out.println(
               "Putting " + value + "at row = " + startRow + i + "column = " + startCol + j);
         }
       }
     } catch (Exception ex) {
       ex.printStackTrace();
     }
   }
 }
Пример #9
0
  private void mostrar(String str) {
    StringTokenizer st = new StringTokenizer(str, "_");

    clave = st.nextToken();
    nombre = st.nextToken();
    marca = st.nextToken();
    existencia = st.nextToken();
    precio = st.nextToken();

    tfClave.setText(clave);
    tfNombre.setText(nombre);
    tfMarca.setText(marca);
    tfExistencia.setText(existencia);
    tfPrecio.setText(precio);
  }
Пример #10
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");
   }
 }
Пример #11
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);
    }
  }
Пример #12
0
  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");
  }
Пример #13
0
 /** 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();
 }
Пример #14
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());
 }
Пример #16
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;
 }
Пример #17
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();
           }
         }
       });
 }
Пример #18
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;
 }
Пример #19
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;
 }
Пример #20
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;
 }
Пример #21
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;
    }
  }
Пример #22
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());
  }
 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()]);
 }
Пример #24
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;
 }
Пример #25
0
      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;
      }
Пример #26
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();
    }
  }
Пример #27
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;
        }
      }
    }
  }
Пример #28
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");
    }
  }
Пример #29
0
    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();
    }
Пример #30
0
      /**
       * 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;
      }