Exemplo n.º 1
0
 @Override
 public String getShortDescription() {
   StringBuilder sb = new StringBuilder();
   sb.append("<b>");
   if (Globals.prefs.getBoolean(JabRefPreferences.GROUP_SHOW_DYNAMIC)) {
     sb.append("<i>").append(StringUtil.quoteForHTML(getName())).append("</i>");
   } else {
     sb.append(StringUtil.quoteForHTML(getName()));
   }
   sb.append("</b> - ");
   sb.append(Globals.lang("dynamic group"));
   sb.append("<b>");
   sb.append(searchField);
   sb.append("</b>");
   sb.append(Globals.lang("contains"));
   sb.append(" <b>");
   sb.append(StringUtil.quoteForHTML(searchExpression));
   sb.append("</b>)");
   switch (getHierarchicalContext()) {
     case INCLUDING:
       sb.append(", ").append(Globals.lang("includes subgroups"));
       break;
     case REFINING:
       sb.append(", ").append(Globals.lang("refines supergroup"));
       break;
     default:
       break;
   }
   return sb.toString();
 }
Exemplo n.º 2
0
  public static String getDescriptionForPreview(
      String field, String expr, boolean caseSensitive, boolean regExp) {
    String header =
        regExp
            ? Globals.lang(
                "This group contains entries whose <b>%0</b> field contains the regular expression <b>%1</b>",
                field, StringUtil.quoteForHTML(expr))
            : Globals.lang(
                "This group contains entries whose <b>%0</b> field contains the keyword <b>%1</b>",
                field, StringUtil.quoteForHTML(expr));
    String caseSensitiveText =
        caseSensitive ? Globals.lang("case sensitive") : Globals.lang("case insensitive");
    String footer =
        regExp
            ? Globals.lang("Entries cannot be manually assigned to or removed from this group.")
            : Globals.lang(
                "Additionally, entries whose <b>%0</b> field does not contain "
                    + "<b>%1</b> can be assigned manually to this group by selecting them "
                    + "then using either drag and drop or the context menu. "
                    + "This process adds the term <b>%1</b> to "
                    + "each entry's <b>%0</b> field. "
                    + "Entries can be removed manually from this group by selecting them "
                    + "then using the context menu. "
                    + "This process removes the term <b>%1</b> from "
                    + "each entry's <b>%0</b> field.",
                field, StringUtil.quoteForHTML(expr));

    return String.format("%s (%s). %s", header, caseSensitiveText, footer);
  }