18 package org.turro.contacts.zul.contact;
20 import org.turro.auth.Authentication;
21 import org.turro.contacts.Connector;
22 import org.turro.contacts.Contact;
23 import org.turro.elephant.context.Application;
24 import org.turro.elephant.util.Messages;
25 import org.turro.i18n.I_;
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.Grid;
30 import org.zkoss.zul.Hbox;
31 import org.zkoss.zul.Image;
32 import org.zkoss.zul.Row;
33 import org.zkoss.zul.Rows;
34 import org.zkoss.zul.Separator;
35 import org.zkoss.zul.Textbox;
36 import org.zkoss.zul.Toolbar;
37 import org.zkoss.zul.Toolbarbutton;
47 private Toolbar toolbar;
48 private Toolbarbutton addButton;
56 this.contact = contact;
57 rows.getChildren().clear();
65 toolbar =
new Toolbar();
66 getParent().appendChild(toolbar);
73 final Row row =
new Row();
75 rows.appendChild(row);
77 Hbox hbox =
new Hbox();
78 row.appendChild(hbox);
82 name.addEventListener(Events.ON_CHANGE,
new EventListener() {
84 public void onEvent(Event event)
throws Exception {
88 hbox.appendChild(name);
91 hbox.appendChild(
new Separator(
"vertical"));
92 Image img =
new Image(
"/_zul/images/edit-delete.png");
93 img.setStyle(
"cursor:pointer");
94 img.addEventListener(Events.ON_CLICK,
new EventListener() {
96 public void onEvent(Event event)
throws Exception {
104 hbox.appendChild(img);
107 final Textbox value =
new Textbox();
108 value.setWidth(
"500px");
109 value.setText(c.getValue());
110 value.addEventListener(Events.ON_CHANGE,
new EventListener() {
112 public void onEvent(Event event)
throws Exception {
113 c.setValue(value.getText());
116 row.appendChild(value);
121 private void addToolbarButtons() {
122 addButton =
new Toolbarbutton(
124 "/_zul/images/new.png"
126 addButton.addEventListener(Events.ON_CLICK,
new EventListener() {
129 public void onEvent(Event event)
throws Exception {
138 toolbar.appendChild(addButton);
static IContact getIContact()
boolean isInRole(String role)
static Application getApplication()
static Messages confirmDeletion()
static String get(String msg)