Пример #1
0
 @Override
 public NumberFormat getNumberFormat() {
   if (super.getNumberFormat() == null) {
     NumberFormat fmt;
     if (isPercent()) {
       fmt = NumberFormat.getPercentInstance(LocaleThreadLocal.get());
     } else {
       fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
     }
     if (fmt instanceof DecimalFormat) {
       ((DecimalFormat) fmt).setMultiplier(getMultiplier());
       if (getFormat() != null) {
         ((DecimalFormat) fmt).applyPattern(getFormat());
       } else {
         fmt.setMinimumFractionDigits(getMinFractionDigits());
         fmt.setMaximumFractionDigits(getMaxFractionDigits());
         fmt.setGroupingUsed(isGroupingUsed());
       }
     } else {
       fmt.setMinimumFractionDigits(getMinFractionDigits());
       fmt.setMaximumFractionDigits(getMaxFractionDigits());
       fmt.setGroupingUsed(isGroupingUsed());
     }
     setNumberFormat(fmt);
   }
   return super.getNumberFormat();
 }
 /** Implementation of ITreeNodeFilter */
 @Override
 public boolean accept(ITreeNode node, int level) {
   String text = node.getCell().getText();
   return text == null
       || m_lowercaseFilterPattern == null
       || m_lowercaseFilterPattern
           .matcher(text.toLowerCase(LocaleThreadLocal.get()))
           .matches();
 }
Пример #3
0
  /**
   * Returns array list of strings with the following system information: - java runtime -
   * application directory - VM memory max - VM memory currently reserved - VM memory currently used
   * - OS name & version - OS Architecture - user name - user home directory - user country (OS) -
   * timezone (OS) - locale - number of available (logical) processors - client host address -
   * client host name
   *
   * @return ArrayList<String>
   */
  public static ArrayList<String> getSystemInformation() {
    Runtime rt = Runtime.getRuntime();
    ArrayList<String> result = new ArrayList<String>();

    result.add(
        System.getProperty("java.runtime.name")
            + " ("
            + System.getProperty("java.runtime.version")
            + ")");
    result.add(System.getProperty("user.dir"));

    DecimalFormat df = new DecimalFormat("0.00");
    result.add(df.format(rt.maxMemory() / 1048576f) + " MB");
    result.add(df.format(rt.totalMemory() / 1048576f) + " MB");
    result.add(df.format((rt.totalMemory() - rt.freeMemory()) / 1048576f) + " MB");
    result.add(System.getProperty("os.arch"));
    result.add(System.getProperty("os.name") + " (" + System.getProperty("os.version") + ")");
    result.add(System.getProperty("user.name"));
    result.add(System.getProperty("user.home"));
    result.add(System.getProperty("user.country"));
    result.add(System.getProperty("user.timezone"));
    result.add(
        LocaleThreadLocal.get().getDisplayLanguage()
            + " (L) / "
            + LocaleThreadLocal.get().getLanguage()
            + " (F)");

    result.add(String.valueOf(rt.availableProcessors()));

    String hostname, ip = "";
    try {
      InetAddress addr = InetAddress.getLocalHost();
      ip = addr.getHostAddress();
      hostname = addr.getHostName();
    } catch (UnknownHostException e) {
      hostname = "Unknown";
      ip = "Unknown";
    }
    result.add(ip);
    result.add(hostname);

    return result;
  }
 @Override
 protected void execChangedValue() throws ProcessingException {
   String s = StringUtility.emptyIfNull(getValue()).trim();
   if (s.length() > 0) {
     if (!s.endsWith("*")) {
       s = s + "*";
     }
     if (!s.startsWith("*")) {
       s = "*" + s;
     }
     m_lowercaseFilterPattern =
         Pattern.compile(
             StringUtility.toRegExPattern(s.toLowerCase(LocaleThreadLocal.get())));
     getSecondTreeField().getTree().addNodeFilter(this);
   } else {
     getSecondTreeField().getTree().removeNodeFilter(this);
   }
 }