19 package org.turro.financials.relation;
21 import org.turro.command.Command;
22 import org.turro.command.Context;
23 import org.turro.financials.document.logic.DocumentWrapper;
24 import org.turro.financials.entity.Document;
25 import org.turro.financials.entity.DocumentDefinition;
26 import org.zkoss.zk.ui.event.Event;
27 import org.zkoss.zk.ui.event.EventListener;
28 import org.zkoss.zk.ui.event.Events;
29 import org.zkoss.zul.Hlayout;
30 import org.zkoss.zul.Label;
31 import org.zkoss.zul.Toolbarbutton;
32 import org.zkoss.zul.Vbox;
44 this.documentDefinition = documentDefinition;
46 setSclass(
"docDefCol");
47 setStyle(
"border-right: solid 1px #bbb;padding: 5px;width: 180px;height: 300px;");
52 return documentDefinition;
59 private void updateColumn() {
60 getChildren().clear();
61 Hlayout hbox =
new Hlayout();
63 hbox.setSclass(
"captionBox");
64 hbox.setSpacing(
"5px");
66 hbox.appendChild(
new Label(documentDefinition.
getName()));
68 Toolbarbutton addButton =
new Toolbarbutton(
null,
"/_zul/images/list-add.png");
69 addButton.addEventListener(Events.ON_CLICK,
new EventListener() {
71 public void onEvent(Event event)
throws Exception {
75 public Object execute(Context context) {
80 }
else if(mode.equals(DocumentRelationMode.RELATE_TO_DESCENDANTS)) {
81 new DocumentWrapper(
getDocument()).relateDescendants(documentDefinition,
new Command() {
83 public Object execute(Context context) {
91 hbox.appendChild(addButton);
93 hbox.appendChild(
new Toolbarbutton(
null,
"/_zul/images/empty_img.png"));
97 private void notifyChange() {
98 ((RelationshipViewer) getParent()).notifyChange();
void relateAncestors(final DocumentDefinition documentDefinition, final Command command)
RelationshipColumn(DocumentDefinition documentDefinition, DocumentRelationMode mode)
DocumentRelationMode getMode()
DocumentDefinition getDocumentDefinition()