19 package org.turro.zul.describeit;
21 import java.util.Date;
22 import java.util.List;
23 import java.util.logging.Level;
24 import java.util.logging.Logger;
25 import org.turro.auth.Authentication;
26 import org.turro.composer.EntityPathComposer;
27 import org.turro.contacts.Contact;
28 import org.turro.contacts.DescribeIt;
29 import org.turro.contacts.db.ContactsPU;
30 import org.turro.describeit.DescribeItUtil;
31 import org.turro.elephant.context.ElephantContext;
32 import org.turro.i18n.I_;
33 import org.turro.jpa.Dao;
34 import org.turro.parser.wiki.WikiCompiler;
35 import org.turro.zkoss.dialog.PreviewHtml;
36 import org.turro.zkoss.text.WikiEditor;
37 import org.zkoss.lang.Strings;
38 import org.zkoss.zk.ui.Component;
39 import org.zkoss.zk.ui.event.EventListener;
40 import org.zkoss.zk.ui.event.Events;
41 import org.zkoss.zk.ui.event.InputEvent;
42 import org.zkoss.zk.ui.select.annotation.Listen;
43 import org.zkoss.zk.ui.select.annotation.Wire;
44 import org.zkoss.zul.Tab;
45 import org.zkoss.zul.Tabbox;
46 import org.zkoss.zul.Tabpanel;
54 private List<DescribeIt> list;
55 private int currentIndex = 0;
58 private Tabbox dieditors;
60 @Listen(
"onClick = #preview")
64 }
catch (InterruptedException ex) {
69 @Listen(
"onClick = #save")
73 if(!Strings.isBlank(di.
getBody())) {
74 di = dao.saveObject(di);
75 list.set(currentIndex, di);
76 Tabpanel tp = (Tabpanel) dieditors.getTabpanels().getChildren().get(currentIndex);
77 tp.getChildren().clear();
78 tp.appendChild(createWiki(di));
79 }
else if(di.
getId() !=
null) {
86 super.doAfterCompose(comp);
88 if(list ==
null || list.isEmpty()) {
101 dieditors.getTabs().appendChild(
new Tab(label));
102 Tabpanel tp =
new Tabpanel();
103 tp.appendChild(createWiki(di));
104 dieditors.getTabpanels().appendChild(tp);
110 wiki.setWidth(
"100%");
111 wiki.setHeight(
"100%");
116 wiki.addEventListener(Events.ON_CHANGE,
new EventListener<InputEvent>() {
118 public void onEvent(InputEvent event) throws Exception {
119 describeIt.setWiki(event.getValue());
120 describeIt.setBody(WikiCompiler.source(describeIt.getWiki()).html());
static IContact getIContact()
static Collection< DescribeIt > descriptions(Object entity)
static final String DEFAULT_ID
static String logMsg(String msg)
static String get(String msg)
void deleteObject(Object obj)
static void preview(String html)
void setReadonly(boolean value)
void setImageFolder(String folder)
void setValue(String value)
void setFileFolder(String folder)
void doAfterCompose(Component comp)