in CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/style/TypeSystemStyle.java [430:481]
public String saveTypeSystemStyle (String fileName)
{
List<TypeStyle> typeStyles = getCurrentTypeStyleList ();
StringBuffer buf = new StringBuffer();
buf.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n");
buf.append("<styleMap>\n");
for (int i=0; i<typeStyles.size(); ++i) {
TypeStyle style = (TypeStyle) typeStyles.get(i);
if (style.fgColor == null) {
continue;
}
buf.append(" <rule>\n");
buf.append(" <pattern>");
buf.append(style.getTypeName());
buf.append("</pattern>\n");
buf.append(" <label>");
buf.append(getShortName(style.getTypeLabel()));
buf.append("</label>\n");
buf.append(" <style>");
buf.append("color:#" + toHexString(style.fgColor.getRGB())
+ ";background:#" + toHexString(style.bgColor.getRGB())
+ ";checked:" + Boolean.toString(style.isChecked())
+ ";hidden:" + Boolean.toString(style.isHidden()) + ";");
buf.append("</style>\n");
buf.append(" </rule>\n");
}
buf.append("</styleMap>\n");
FileWriter out = null;
try {
out = new FileWriter (fileName);
out.write(buf.toString());
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return buf.toString();
}