protected void setToolTip() {
   TileI currentTile =
       orUIManager.getGameUIManager().getGameManager().getTileManager().getTile(internalId);
   StringBuffer tt = new StringBuffer("<html>");
   tt.append("<b>Tile</b>: ").append(currentTile.getName()); // or
   // getId()
   if (currentTile.hasStations()) {
     // for (Station st : currentTile.getStations())
     int cityNumber = 0;
     // TileI has stations, but
     for (Station st : currentTile.getStations()) {
       cityNumber++; // = city.getNumber();
       tt.append("<br>  ")
           .append(st.getType())
           .append(" ")
           .append(cityNumber) // .append("/").append(st.getNumber())
           .append(": value ");
       tt.append(st.getValue());
       if (st.getBaseSlots() > 0) {
         tt.append(", ").append(st.getBaseSlots()).append(" slots");
       }
     }
   }
   tt.append("</html>");
   toolTip = tt.toString();
 }
Example #2
0
  protected String gettitle(String strFreq) {
    StringBuffer sbufTitle = new StringBuffer().append("VnmrJ  ");
    String strPath = FileUtil.openPath(FileUtil.SYS_VNMR + "/vnmrrev");
    BufferedReader reader = WFileUtil.openReadFile(strPath);
    String strLine;
    String strtype = "";
    if (reader == null) return sbufTitle.toString();

    try {
      while ((strLine = reader.readLine()) != null) {
        strtype = strLine;
      }
      strtype = strtype.trim();
      if (strtype.equals("merc")) strtype = "Mercury";
      else if (strtype.equals("mercvx")) strtype = "Mercury-Vx";
      else if (strtype.equals("mercplus")) strtype = "MERCURY plus";
      else if (strtype.equals("inova")) strtype = "INOVA";
      String strHostName = m_strHostname;
      if (strHostName == null) strHostName = "";
      sbufTitle.append("    ").append(strHostName);
      sbufTitle.append("    ").append(strtype);
      sbufTitle.append(" - ").append(strFreq);
      reader.close();
    } catch (Exception e) {
      // e.printStackTrace();
      Messages.logError(e.toString());
    }

    return sbufTitle.toString();
  }
Example #3
0
 @Override
 protected Index doInBackground() throws Exception {
   int binSize = IgvTools.LINEAR_BIN_SIZE;
   FeatureCodec codec =
       CodecFactory.getCodec(
           file.getAbsolutePath(), GenomeManager.getInstance().getCurrentGenome());
   if (codec != null) {
     try {
       Index index = IndexFactory.createLinearIndex(file, codec, binSize);
       if (index != null) {
         IgvTools.writeTribbleIndex(index, idxFile.getAbsolutePath());
       }
       return index;
     } catch (TribbleException.MalformedFeatureFile e) {
       StringBuffer buf = new StringBuffer();
       buf.append("<html>Files must be sorted by start position prior to indexing.<br>");
       buf.append(e.getMessage());
       buf.append(
           "<br><br>Note: igvtools can be used to sort the file, select \"File > Run igvtools...\".");
       MessageUtils.showMessage(buf.toString());
     }
   } else {
     throw new DataLoadException("Unknown File Type", file.getAbsolutePath());
   }
   return null;
 }
Example #4
0
  private Pattern getCurrentPattern() {
    String pattern = getFindTextField().getText();
    int flags = Pattern.DOTALL;

    if (!getRegexButton().isSelected()) {
      StringBuffer newpattern = new StringBuffer();

      // 'quote' the pattern
      for (int i = 0; i < pattern.length(); i++) {
        if ("\\[]^$&|().*+?{}".indexOf(pattern.charAt(i)) >= 0) {
          newpattern.append('\\');
        }
        newpattern.append(pattern.charAt(i));
      }
      pattern = newpattern.toString();

      // make "*" .* and "?" .
      if (getWildCardsButton().isSelected()) {
        pattern = pattern.replaceAll("\\\\\\*", ".+?");
        pattern = pattern.replaceAll("\\\\\\?", ".");
      }
    }
    if (!getCaseSensitiveCheckBox().isSelected()) {
      flags |= Pattern.CASE_INSENSITIVE;
    }
    if (getWholeWordCheckBox().isSelected()) {
      pattern = "\\b" + pattern + "\\b";
    }
    return Pattern.compile(pattern, flags);
  }
Example #5
0
  public Properties internalToProperties() {
    Properties props = new Properties();

    StringBuffer st = new StringBuffer();
    st.append(" ");
    for (int i = 0; i < visibleViewIds.size(); i++) {
      st.append(" " + Constants.cpNames[((Integer) visibleViewIds.elementAt(i)).intValue()]);
    }
    // System.out.println(" visibleViewIds: " + st.toString());

    props.setProperty("ndedit.visibleViewIds", st.toString());

    props.setProperty("ndedit.cutPanelSizeW", (new Integer(cutPanelSize.width).toString()));
    props.setProperty("ndedit.cutPanelSizeH", (new Integer(cutPanelSize.height).toString()));
    props.setProperty("ndedit.cutPanelWMin", (new Integer(cutPanelMinSize.width).toString()));
    props.setProperty("ndedit.cutPanelHMin", (new Integer(cutPanelMinSize.height).toString()));
    props.setProperty("ndedit.cutPanelWMax", (new Integer(cutPanelMaxSize.width).toString()));
    props.setProperty("ndedit.cutPanelHMax", (new Integer(cutPanelMaxSize.height).toString()));
    props.setProperty("ndedit.lonReference", (new Double(lonReference).toString()));
    props.setProperty("ndedit.geoDisplayFormat", (new Integer(geoDisplayFormat).toString()));
    props.setProperty("ndedit.timeDisplayFormat", (new Integer(timeDisplayFormat).toString()));
    props.setProperty("ndedit.timeAxisMode", (new Integer(timeAxisMode).toString()));
    props.setProperty("ndedit.timeAxisReference", (new Double(timeAxisReference).toString()));
    String dpa = new Boolean(displayPanelAxes).toString();
    props.setProperty("ndedit.displayPanelAxes", dpa);
    dpa = new Boolean(independentHandles).toString();
    props.setProperty("ndedit.independentHandles", dpa);
    return props;
  }
  /** Add import statements to the current tab for all of packages inside the specified jar file. */
  public void handleImportLibrary(String jarPath) {
    // make sure the user didn't hide the sketch folder
    sketch.ensureExistence();

    // import statements into the main sketch file (code[0])
    // if the current code is a .java file, insert into current
    // if (current.flavor == PDE) {
    if (mode.isDefaultExtension(sketch.getCurrentCode())) {
      sketch.setCurrentCode(0);
    }

    // could also scan the text in the file to see if each import
    // statement is already in there, but if the user has the import
    // commented out, then this will be a problem.
    String[] list = Base.packageListFromClassPath(jarPath);
    StringBuffer buffer = new StringBuffer();
    for (int i = 0; i < list.length; i++) {
      buffer.append("import ");
      buffer.append(list[i]);
      buffer.append(".*;\n");
    }
    buffer.append('\n');
    buffer.append(getText());
    setText(buffer.toString());
    setSelection(0, 0); // scroll to start
    sketch.setModified(true);
  }
 public StringBuffer saveStringBuffer() {
   StringBuffer save = new StringBuffer();
   for (java.util.Enumeration<Editor> e = pageList.elements(); e.hasMoreElements(); ) {
     Editor page = e.nextElement();
     save.append(
         "<"
             + name
             + ".Page>\n"
             + "<Type>"
             + typeOfPage(page)
             + "</Type>\n"
             + "<Name>"
             + page.getName()
             + "</Name>\n"
             + "<Active>"
             + page.isActive()
             + "</Active>\n"
             + "<"
             + contentDelim
             + ">\n");
     save.append(page.saveStringBuffer());
     save.append("</" + contentDelim + ">\n" + "</" + name + ".Page>\n");
   }
   return save;
 }
  public static String fill(
      String source,
      char fillerCharacter,
      int length,
      int aligment,
      boolean fillInclusiveEmptyString) {
    //        if (StringUtils.isEmpty(source) || length<0) {
    if (length < 0) {
      return source;
    }
    if (source == null) source = "";

    if (source.length() > length) return source.substring(0, length);
    // throw new AWBusinessException("No se puede llenar '"+source+"' pues tamaño excede "+length);
    source = source.trim();
    if (source.length() == length) return source;
    if (!fillInclusiveEmptyString && source.length() == 0) return source;

    if (source.length() > length) return source.substring(0, length);

    StringBuffer buf = new StringBuffer(length);

    if (aligment == SwingConstants.CENTER) {
      int left = (length - source.length()) / 2;
      int right = length - (source.length() + left);
      fill(buf, fillerCharacter, left);
      buf.append(source);
      fill(buf, fillerCharacter, right);
    } else {
      if (aligment == SwingConstants.LEFT) buf.append(source);
      fill(buf, fillerCharacter, length - source.length());
      if (aligment == SwingConstants.RIGHT) buf.append(source);
    }
    return buf.toString();
  }
Example #9
0
  protected String getFeatureText() {
    String txt = "";
    try {
      txt = ((HTMLDocument) getDocument()).getText(0, getDocument().getLength()).trim();

      StringBuffer buff = new StringBuffer();
      StringTokenizer tok = new StringTokenizer(txt, "/");
      int ntok = 0;

      while (tok.hasMoreTokens()) {
        String tokTxt = "/" + tok.nextToken().trim();

        int ind = tokTxt.indexOf("=");

        if (ntok != 0 && ind > -1 && qualifier.contains(tokTxt.substring(0, ind + 1)))
          buff.append("\n" + tokTxt);
        else buff.append(tokTxt);

        ntok++;
      }

      txt = buff.toString();
    } catch (BadLocationException ble) {
      ble.printStackTrace();
    }

    return txt;
  }
Example #10
0
  public ArrayList getClassesRuns() {
    classesRuns = new ArrayList<String>();

    StringBuffer classRun = new StringBuffer();
    StringBuffer testClassRun;

    for (int run = 1; run < 3; run++) {
      for (RaceRun r : getCompletedRunsByClassTime()) {
        if (r.getRunNumber() == run) {
          testClassRun = new StringBuffer();
          testClassRun.append(r.getBoat().getBoatClass());
          testClassRun.append(":");
          testClassRun.append(run);
          testClassRun.append(":");
          testClassRun.append(r.getStatusString());

          if (testClassRun.toString().compareTo(classRun.toString()) != 0) {
            classRun = testClassRun;
            classesRuns.add(classRun.toString());
          }
        }
      }
    }
    return (classesRuns);
  }
 /**
  * Build a string representing a sequence of method calls needed to reach a particular child
  * method.
  *
  * @param allMethods previous method call sequence
  * @param newMethods names of each of the methods in callingMethods
  * @param callingMethods MethodEntry objects for each method
  * @param currentMethod current method being handled
  * @param rms contains setting determining if depth-first or breadth-first traversal has taken
  *     place.
  * @return
  */
 private String appendMN(
     String allMethods,
     String[] newMethods,
     List callingMethods,
     MethodEntry currentMethod,
     RelatedMethodsSettings rms) {
   StringBuffer result = new StringBuffer(allMethods.length() + 80);
   result.append(allMethods);
   if (rms.isDepthFirstOrdering()) {
     if (newMethods.length > 0) {
       if (result.length() > 0) result.append('.');
     }
     int index = callingMethods.indexOf(currentMethod);
     result.append(newMethods[index]);
     result.append("()");
   } else {
     if (newMethods.length > 0) {
       if (result.length() > 0) result.append('.');
       if (newMethods.length > 1) {
         result.append('[');
       }
       for (int i = 0; i < newMethods.length; i++) {
         if (i > 0) result.append(',');
         result.append(newMethods[i]);
         result.append("()");
       }
       if (newMethods.length > 1) {
         result.append(']');
       }
     }
   }
   return result.toString();
 }
 /**
  * Return the object into String.
  *
  * @param tab how many tabs (not used here
  * @return a String
  */
 public String toString(int tab) {
   // todo : rewrite tostring method
   StringBuffer buff = new StringBuffer(tabString(tab));
   buff.append("var ");
   buff.append(variable.toStringExpression());
   return buff.toString();
 }
Example #13
0
  void applyDirectives() {
    findRemoveDirectives(true);

    StringBuffer buffer = new StringBuffer();
    String head = "", toe = "; \n";

    if (crispBox.isSelected()) buffer.append(head + "crisp=true" + toe);
    if (!fontField.getText().trim().equals(""))
      buffer.append(head + "font=\"" + fontField.getText().trim() + "\"" + toe);
    if (globalKeyEventsBox.isSelected()) buffer.append(head + "globalKeyEvents=true" + toe);
    if (pauseOnBlurBox.isSelected()) buffer.append(head + "pauseOnBlur=true" + toe);
    if (!preloadField.getText().trim().equals(""))
      buffer.append(head + "preload=\"" + preloadField.getText().trim() + "\"" + toe);
    /*if ( transparentBox.isSelected() )
    buffer.append( head + "transparent=true" + toe );*/

    Sketch sketch = editor.getSketch();
    SketchCode code = sketch.getCode(0); // first tab
    if (buffer.length() > 0) {
      code.setProgram("/* @pjs " + buffer.toString() + " */\n\n" + code.getProgram());
      if (sketch.getCurrentCode() == code) // update textarea if on first tab
      {
        editor.setText(sketch.getCurrentCode().getProgram());
        editor.setSelection(0, 0);
      }

      sketch.setModified(false);
      sketch.setModified(true);
    }
  }
Example #14
0
  /**
   * Get the Lincese text from a text file specified in the PropertyBox.
   *
   * @return String - License text.
   */
  public String getLicenseText() {
    StringBuffer textBuffer = new StringBuffer();
    try {
      String fileName = RuntimeProperties.GPL_EN_LICENSE_FILE_NAME;
      if (cbLang != null
          && cbLang.getSelectedItem() != null
          && cbLang.getSelectedItem().toString().equalsIgnoreCase("Eesti")) {
        fileName = RuntimeProperties.GPL_EE_LICENSE_FILE_NAME;
      }

      InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName);

      if (is == null) return "";

      BufferedReader in = new BufferedReader(new InputStreamReader(is));
      String str;
      while ((str = in.readLine()) != null) {
        textBuffer.append(str);
        textBuffer.append("\n");
      }
      in.close();
    } catch (IOException e) {
      logger.error(null, e);
    }
    return textBuffer.toString();
  } // getLicenseText
 private void traverseToLeaves(
     final PackageDependenciesNode treeNode,
     final StringBuffer denyRules,
     final StringBuffer allowRules) {
   final Enumeration enumeration = treeNode.breadthFirstEnumeration();
   while (enumeration.hasMoreElements()) {
     PsiElement childPsiElement =
         ((PackageDependenciesNode) enumeration.nextElement()).getPsiElement();
     if (myIllegalDependencies.containsKey(childPsiElement)) {
       final Map<DependencyRule, Set<PsiFile>> illegalDeps =
           myIllegalDependencies.get(childPsiElement);
       for (final DependencyRule rule : illegalDeps.keySet()) {
         if (rule.isDenyRule()) {
           if (denyRules.indexOf(rule.getDisplayText()) == -1) {
             denyRules.append(rule.getDisplayText());
             denyRules.append("\n");
           }
         } else {
           if (allowRules.indexOf(rule.getDisplayText()) == -1) {
             allowRules.append(rule.getDisplayText());
             allowRules.append("\n");
           }
         }
       }
     }
   }
 }
Example #16
0
  // Sucecion de Fibonacci
  static void suce() {
    int numero, a = 1, b = 0, c;
    StringBuffer sb = new StringBuffer();
    String s1 =
        JOptionPane.showInputDialog("Ingrese el numero hasta el que desea ver la sucesion : ");
    numero = Integer.parseInt(s1);
    while (a < numero) {
      a += b;
      sb.append(a + " , ");
      b += a;
      sb.append(b + " , ");
    }

    JOptionPane.showMessageDialog(null, "Fibonacci = " + sb);

    int numero2 =
        JOptionPane.showOptionDialog(
            null,
            "Seleccione",
            "Escoja",
            JOptionPane.YES_NO_CANCEL_OPTION,
            JOptionPane.QUESTION_MESSAGE,
            null,
            new Object[] {"Opcion 1", "Opcion 2", "Opcion 3"},
            "Opcion 3");
  }
  public static void main(String[] args) {

    StringBuffer result = new StringBuffer("<html><body><h1>Fibonacci Sequence</h1><ol>");

    long f1 = 0;
    long f2 = 1;

    for (int i = 0; i < 50; i++) {
      result.append("<li>");
      result.append(f1);
      long temp = f2;
      f2 = f1 + f2;
      f1 = temp;
    }

    result.append("</ol></body></html>");

    JEditorPane jep = new JEditorPane("text/html", result.toString());
    jep.setEditable(false);

    //  new FibonocciRectangles().execute();
    JScrollPane scrollPane = new JScrollPane(jep);
    JFrame f = new JFrame("Fibonacci Sequence");
    f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    f.setContentPane(scrollPane);
    f.setSize(512, 342);
    EventQueue.invokeLater(new FrameShower(f));
  }
    /* (non-Javadoc)
     * @see org.jdesktop.swingworker.SwingWorker#doInBackground()
     */
    @Override
    protected Void doInBackground() throws Exception {

      if (errorInfo != null) {
        Throwable t = errorInfo.getErrorException();
        String osMessage =
            "An error occurred on "
                + System.getProperty("os.name")
                + " version "
                + System.getProperty("os.version");
        StringBuffer message = new StringBuffer();
        message.append("System Info : ").append(osMessage).append(NEW_LINE_CHAR);
        message.append("Message : ").append(t.toString()).append(NEW_LINE_CHAR);
        message.append("Level : ").append(errorInfo.getErrorLevel()).append(NEW_LINE_CHAR);
        message.append("Stack Trace : ").append(NEW_LINE_CHAR);
        message.append(stackTraceToString(t));

        // copy error message to system clipboard
        StringSelection stringSelection = new StringSelection(message.toString());
        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
        clipboard.setContents(stringSelection, null);

        // open errorReportingURL
        OpenBrowserAction openBrowserAction = new OpenBrowserAction(errorReportingURL);
        openBrowserAction.actionPerformed(null);
      }

      return null;
    }
Example #19
0
  /** Capture an image for all ViewManagers */
  public void captureAll() {
    List vms = getViewManagers();

    String filename = FileManager.getWriteFile(FileManager.FILTER_IMAGE, FileManager.SUFFIX_JPG);
    if (filename == null) {
      return;
    }
    String root = IOUtil.stripExtension(filename);
    String ext = IOUtil.getFileExtension(filename);

    StringBuffer sb = new StringBuffer("<html>");
    sb.append("Since there were multiple images they were written out as:<ul>");
    for (int i = 0; i < vms.size(); i++) {
      ViewManager vm = (ViewManager) vms.get(i);
      String name = vm.getName();
      if ((name == null) || (name.trim().length() == 0)) {
        name = "" + (i + 1);
      }
      if (vms.size() != 1) {
        filename = root + name + ext;
      }

      sb.append("<li> " + filename);
      vm.writeImage(filename);
    }
    sb.append("</ul></html>");
    if (vms.size() > 1) {
      GuiUtils.showDialog("Captured Images", GuiUtils.inset(new JLabel(sb.toString()), 5));
    }
  }
    /**
     * Create a Transferable to use as the source for a data transfer.
     *
     * @param c The component holding the data to be transfered. This argument is provided to enable
     *     sharing of TransferHandlers by multiple components.
     * @return The representation of the data to be transfered.
     */
    protected Transferable createTransferable(JComponent c) {
      Object[] values = null;
      if (c instanceof JList) {
        values = ((JList) c).getSelectedValues();
      } else if (c instanceof JTable) {
        JTable table = (JTable) c;
        int[] rows = table.getSelectedRows();
        if (rows != null) {
          values = new Object[rows.length];
          for (int i = 0; i < rows.length; i++) {
            values[i] = table.getValueAt(rows[i], 0);
          }
        }
      }
      if (values == null || values.length == 0) {
        return null;
      }

      StringBuffer plainBuf = new StringBuffer();
      StringBuffer htmlBuf = new StringBuffer();

      htmlBuf.append("<html>\n<body>\n<ul>\n");

      for (Object obj : values) {
        String val = ((obj == null) ? "" : obj.toString());
        plainBuf.append(val + "\n");
        htmlBuf.append("  <li>" + val + "\n");
      }

      // remove the last newline
      plainBuf.deleteCharAt(plainBuf.length() - 1);
      htmlBuf.append("</ul>\n</body>\n</html>");

      return new FileTransferable(plainBuf.toString(), htmlBuf.toString(), values);
    }
Example #21
0
  private void updateFields() {
    deLongNameValueLabel.setText(tempDE.getLongName());
    deIdValueLabel.setText(ConventionUtil.publicIdVersion(tempDE));
    if (tempDE.getContext() != null) deContextNameValueLabel.setText(tempDE.getContext().getName());
    else deContextNameValueLabel.setText("");

    if (tempDE.getValueDomain() != null)
      vdLongNameValueLabel.setText(tempDE.getValueDomain().getLongName());
    else vdLongNameValueLabel.setText("");

    if (prefs.getShowConceptCodeNameSummary()) {
      List<gov.nih.nci.ncicb.cadsr.domain.Concept> concepts =
          cadsrModule.getConcepts(tempDE.getDataElementConcept().getProperty());
      if (concepts != null && concepts.size() > 0) {
        StringBuffer conceptCodeSummary = new StringBuffer();
        StringBuffer conceptNameSummary = new StringBuffer();
        for (Concept con : concepts) {
          conceptCodeSummary.append(con.getPreferredName());
          conceptCodeSummary.append(" ");
          conceptNameSummary.append(con.getLongName());
          conceptNameSummary.append(" ");
        }
        conceptCodeSummaryValue.setText(conceptCodeSummary.toString());
        conceptNameSummaryValue.setText(conceptNameSummary.toString());
      }
    }
    enableCDELinks();
  }
Example #22
0
 /**
  * A utility method to make a name=value part of the adde request string
  *
  * @param buf The buffer to append to
  * @param name The property name
  * @param value The value
  */
 protected void appendKeyValue(StringBuffer buf, String name, String value) {
   if ((buf.length() == 0) || (buf.charAt(buf.length() - 1) != '?')) {
     buf.append("&");
   }
   buf.append(name);
   buf.append("=");
   buf.append(value);
 }
Example #23
0
 public String getName() {
   StringBuffer buf = new StringBuffer();
   buf.append("(");
   if (getLeftComponent() != null) buf.append(getLeftComponent().getName());
   buf.append("/");
   if (getRightComponent() != null) buf.append(getRightComponent().getName());
   buf.append(")");
   return buf.toString();
 }
 void saveModifiersToRegistry(Set<String> codeTexts) {
   StringBuffer value = new StringBuffer();
   for (String each : codeTexts) {
     if (value.length() > 0) {
       value.append(" ");
     }
     value.append(each);
   }
   myModifiersValue.setValue(value.toString());
 }
 /**
  * cleanStringMWS.
  *
  * @return a {@link java.lang.String} object.
  * @param in a {@link java.lang.String} object.
  */
 public static String cleanStringMWS(String in) {
   StringBuffer out = new StringBuffer();
   char c;
   for (int i = 0; i < in.length(); i++) {
     c = in.charAt(i);
     if (c == '"' || c == '/') out.append("");
     else out.append(c);
   }
   return out.toString();
 }
  /**
   * Return file contents as a string.
   *
   * @return File contents as a string.
   *     <p>Each line of the data file is separated by the platform line separator character in the
   *     returned string.
   */
  public String toString() {
    StringBuffer sb = new StringBuffer(32768);

    for (int i = 0; i < textFileLines.length; i++) {
      sb.append(textFileLines[i]);
      sb.append(Env.LINE_SEPARATOR);
    }

    return sb.toString();
  }
 private String bigIntToHexString(BigInteger bi) {
   StringBuffer buf = new StringBuffer();
   buf.append("0x");
   String val = bi.toString(16);
   for (int i = 0; i < ((2 * addressSize) - val.length()); i++) {
     buf.append('0');
   }
   buf.append(val);
   return buf.toString();
 }
Example #28
0
  public String getSelectedRobotsAsString() {
    StringBuffer sb = new StringBuffer();

    for (int i = 0; i < selectedRobots.size(); i++) {
      if (i != 0) {
        sb.append(',');
      }
      sb.append(selectedRobots.get(i).getItem().getUniqueFullClassNameWithVersion());
    }
    return sb.toString();
  }
 void setTextFromTile(TileI tile) {
   StringBuffer text = new StringBuffer();
   if (Util.hasValue(tile.getExternalId())) {
     text.append("<HTML><BODY>" + tile.getExternalId());
     if (tile.countFreeTiles() != -1) {
       text.append("<BR> (" + tile.countFreeTiles() + ")");
     }
     text.append("</BODY></HTML>");
   }
   this.setText(text.toString());
 }
 private String safe(String src) {
   StringBuffer sb = new StringBuffer();
   for (int i = 0; i < src.length(); i++) {
     char c = src.charAt(i);
     if (c >= 32 && c < 128) {
       sb.append(c);
     } else {
       sb.append("<" + (int) c + ">");
     }
   }
   return sb.toString();
 }