58 Vlayout vbox =
new Vlayout();
59 vbox.setVflex(
"true");
60 contacts.setVflex(
true);
62 vbox.appendChild(contacts);
63 addEventListener(Events.ON_CHANGING,
new EventListener() {
65 public void onEvent(Event event)
throws Exception {
75 contacts.addEventListener(Events.ON_SELECT,
new EventListener() {
77 public void onEvent(Event event) {
79 Events.postEvent(
new Event(Events.ON_CHANGE, ContactFinder.this));
80 ContactFinder.this.close();
84 if(Application.getApplication().isInRole(
"contact:new")) {
85 Hbox butCont =
new Hbox();
86 butCont.setSclass(
"buttonDialogContainer");
87 butCont.setHflex(
"true");
88 butCont.setPack(
"end");
89 butCont.setStyle(
"padding:10px");
90 butCont.setSpacing(
"15px");
91 Button newContact =
new Button(I_.get(
"New contact"));
92 newContact.addEventListener(Events.ON_CLICK,
new EventListener<Event>() {
94 public void onEvent(Event event) throws Exception {
95 if(fields.isEmpty()) {
96 fields.createMinimumContact();
98 ContactForm.newContact(fields, new Command() {
100 public Object execute(Context context) {
101 Contact contact = (Contact) context.get(
"contact");
102 if(contact != null) {
103 if(contacts.getCollection() == null) {
104 contacts.setCollection(new ArrayList<Contact>());
106 contacts.getCollection().add(contact);
107 contacts.updateCollection();
108 setObjectValue(contact);
115 butCont.appendChild(newContact);
116 vbox.appendChild(butCont);