Ejemplo n.º 1
0
 public HtmlColor getFontHtmlColor(FontParam param, String stereotype) {
   String value = null;
   if (stereotype != null) {
     checkStereotype(stereotype);
     value = getValue(param.name() + "fontcolor" + stereotype);
   }
   if (value == null || HtmlColor.isValid(value) == false) {
     value = getValue(param.name() + "fontcolor");
   }
   if (value == null || HtmlColor.isValid(value) == false) {
     value = getValue("defaultfontcolor");
   }
   if (value == null || HtmlColor.isValid(value) == false) {
     value = param.getDefaultColor();
   }
   return HtmlColor.getColorIfValid(value);
 }
Ejemplo n.º 2
0
 private int getFontSize(FontParam param, String stereotype) {
   if (stereotype != null) {
     checkStereotype(stereotype);
     final String value2 = getValue(param.name() + "fontsize" + stereotype);
     if (value2 != null && value2.matches("\\d+")) {
       return Integer.parseInt(value2);
     }
   }
   String value = getValue(param.name() + "fontsize");
   if (value == null || value.matches("\\d+") == false) {
     value = getValue("defaultfontsize");
   }
   if (value == null || value.matches("\\d+") == false) {
     return param.getDefaultSize(this);
   }
   return Integer.parseInt(value);
 }
Ejemplo n.º 3
0
 private String getFontFamily(FontParam param, String stereotype) {
   if (stereotype != null) {
     checkStereotype(stereotype);
     final String value2 = getValue(param.name() + "fontname" + stereotype);
     if (value2 != null) {
       return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(value2);
     }
   }
   // Times, Helvetica, Courier or Symbol
   String value = getValue(param.name() + "fontname");
   if (value != null) {
     return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(value);
   }
   if (param != FontParam.CIRCLED_CHARACTER) {
     value = getValue("defaultfontname");
     if (value != null) {
       return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(value);
     }
   }
   return param.getDefaultFamily();
 }
Ejemplo n.º 4
0
 public static Collection<String> getPossibleValues() {
   final Set<String> result = new TreeSet<String>();
   result.add("Monochrome");
   // result.add("BackgroundColor");
   result.add("CircledCharacterRadius");
   result.add("ClassAttributeIconSize");
   result.add("DefaultFontName");
   result.add("DefaultFontStyle");
   result.add("DefaultFontSize");
   result.add("DefaultFontColor");
   for (FontParam p : EnumSet.allOf(FontParam.class)) {
     final String h = humanName(p.name());
     result.add(h + "FontStyle");
     result.add(h + "FontName");
     result.add(h + "FontSize");
     result.add(h + "FontColor");
   }
   for (ColorParam p : EnumSet.allOf(ColorParam.class)) {
     final String h = capitalize(p.name());
     result.add(h + "Color");
   }
   return Collections.unmodifiableSet(result);
 }
Ejemplo n.º 5
0
 private int getFontStyle(FontParam param, String stereotype) {
   String value = null;
   if (stereotype != null) {
     checkStereotype(stereotype);
     value = getValue(param.name() + "fontstyle" + stereotype);
   }
   if (value == null) {
     value = getValue(param.name() + "fontstyle");
   }
   if (value == null) {
     value = getValue("defaultfontstyle");
   }
   if (value == null) {
     return param.getDefaultFontStyle(this);
   }
   int result = Font.PLAIN;
   if (value.toLowerCase().contains("bold")) {
     result = result | Font.BOLD;
   }
   if (value.toLowerCase().contains("italic")) {
     result = result | Font.ITALIC;
   }
   return result;
 }