18 package org.turro.financials.document;
20 import java.util.Collection;
21 import java.util.LinkedList;
22 import org.turro.command.Command;
23 import org.turro.command.Context;
24 import org.turro.elephant.db.WhereClause;
25 import org.turro.elephant.util.Messages;
26 import org.turro.financials.db.FinancialsPU;
27 import org.turro.financials.entity.DocumentDefinition;
28 import org.turro.i18n.I_;
29 import org.turro.jpa.Dao;
30 import org.turro.util.Chars;
31 import org.turro.zkoss.dialog.InputDialog;
32 import org.turro.zkoss.dialog.Listeners;
33 import org.turro.zkoss.input.GenericCombobox;
34 import org.zkoss.zk.ui.WrongValueException;
35 import org.zkoss.zk.ui.event.Event;
36 import org.zkoss.zk.ui.event.EventListener;
37 import org.zkoss.zk.ui.event.Events;
38 import org.zkoss.zk.ui.ext.AfterCompose;
49 return documentDefinition;
53 this.documentDefinition = documentDefinition;
57 public void populateList(String value, LinkedList list,
int nRows) {
60 wc.
addClause(
"select distinct concept from DocumentLine as documentLine");
61 wc.
addClause(
"where documentLine.document.documentDefinition.id = :id");
63 wc.
addLikeFields(
new String[] {
"documentLine.concept" }, value);
64 wc.
addClause(
"order by documentLine.concept");
65 list.addAll(dao.getResultList(wc, nRows));
75 if(value !=
null && value.contains(
"\n")) {
78 super.setValue(value);
84 String tmp = super.getObjectValue();
85 return tmp ==
null ? null : tmp.replaceAll(Chars.nl().regexp().toString(),
"\n");
89 return value ==
null ? null : ((String) value).replaceAll(
"\\n", Chars.nl().toString());
94 addEventListener(Events.ON_DOUBLE_CLICK,
this);
98 public void onEvent(Event event)
throws Exception {
106 this.getObjectValue(),
null, 10,
new Command() {
108 public Object execute(Context context) {
109 String value = (String) context.get(
"value");
117 public Object execute(Context context) {
void addClause(String clause)
void addLikeFields(String[] fields, String value)
void addNamedValue(String name, Object value)
Messages add(String word)
void setObjectValue(String value)
String getTextFromObject(String value)
void setDocumentDefinition(DocumentDefinition documentDefinition)
void populateList(String value, LinkedList list, int nRows)
static String formatValue(String value)
void onEvent(Event event)
DocumentDefinition getDocumentDefinition()
static String get(String msg)
static void activateListeners(Component component, String eventType, Collection< EventListener > listeners)
static Collection< EventListener > cancelListener(Component component, String eventType)