use of com.ramussoft.core.attribute.simple.HTMLPage in project ramus by Vitaliy-Yakovchuk.
the class Out method print.
@SuppressWarnings("unchecked")
@Override
public void print(Object object) {
if (object == null)
return;
if (object instanceof Number) {
print(numberFormat.format(object));
return;
}
if (object instanceof Date) {
print(dateFormat.format(object));
return;
}
if (object instanceof List) {
List list = (List) object;
boolean first = true;
for (Object obj : list) {
if (first)
first = false;
else
print("; ");
print(obj);
}
return;
}
if (object instanceof HTMLPage) {
try {
printHTMLPage((HTMLPage) object);
} catch (IOException e) {
e.printStackTrace();
}
return;
}
if (object instanceof Source) {
try {
printHTMLPage((Source) object);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return;
}
if (object instanceof Object[]) {
Object[] objects = (Object[]) object;
boolean first = true;
for (Object object2 : objects) {
if (first)
first = false;
else
print("; ");
print(object2);
}
} else
super.print(object);
}
use of com.ramussoft.core.attribute.simple.HTMLPage in project ramus by Vitaliy-Yakovchuk.
the class HTMLEditPanel method getValue.
@Override
public Object getValue() {
String text = jTextPane.getText();
if (emptyValue.equals(text)) {
if ((page == null) || (page.isEmpty()))
return null;
return page;
}
HTMLPage p;
try {
p = new HTMLPage(text.getBytes("UTF8"), (page != null) ? page.getPath() : null);
return p;
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null;
}
use of com.ramussoft.core.attribute.simple.HTMLPage in project ramus by Vitaliy-Yakovchuk.
the class HTMLEditPanel method createHtmlEditor.
private void createHtmlEditor() {
if (page == null) {
String text = jTextPane.getText();
try {
page = new HTMLPage(text.getBytes("UTF8"), (page != null) ? page.getPath() : null);
((Journaled) engine).startUserTransaction();
engine.setAttribute(element, attribute, page);
((Journaled) engine).commitUserTransaction();
HTMLPage page = (HTMLPage) engine.getAttribute(element, attribute);
page.setEmpty(true);
setValue(page);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
if (openEditor()) {
updateEditing();
}
}
Aggregations