19 package org.turro.ranking;
21 import org.turro.string.Strings;
22 import org.turro.elephant.db.WhereClause;
23 import org.turro.indicator.Formulas;
24 import org.turro.indicator.Indicators;
25 import org.turro.indicator.VariablesListbox;
26 import org.turro.log.SystemLogType;
27 import org.turro.log.SystemLogger;
28 import org.turro.reflection.Instances;
29 import org.turro.reflection.Reflections;
30 import org.zkoss.zk.ui.Executions;
31 import org.zkoss.zk.ui.IdSpace;
32 import org.zkoss.zk.ui.select.Selectors;
33 import org.zkoss.zk.ui.select.annotation.Listen;
34 import org.zkoss.zk.ui.select.annotation.Wire;
35 import org.zkoss.zul.Grid;
36 import org.zkoss.zul.ListModel;
37 import org.zkoss.zul.ListModelList;
38 import org.zkoss.zul.Panel;
39 import org.zkoss.zul.Textbox;
51 private Textbox formula;
62 @Listen(
"onSelect = #ranking")
65 if(process.instanceClass().getName().equals(ranking.
getObjectValue())) {
73 @Listen(
"onSelect = #orderBy")
78 @Listen(
"onSelect = #variables")
81 formula.setValue(formula.getValue() +
" " + variables.
getObjectValue().getName());
85 @Listen(
"onClick = #execute")
95 private void updateControls() {
100 formula.setValue(
null);
101 variables.setModel(
new ListModelList());
102 orderBy.setModel(
new ListModelList());
103 result.setModel(
new ListModelList());
107 private ListModel<?> getModelFor(String rankingEntity) {
108 ListModelList list =
new ListModelList();
109 for(ProcessRanking process : Instances.cached().byAnnotation(ElephantRanking.class, ProcessRanking.class)) {
110 if(process.instanceClass().getName().equals(rankingEntity)) {
111 WhereClause wc =
new WhereClause();
112 wc.addClause(
"select r from " + process.instanceClass().getSimpleName() +
" r");
113 wc.addClause(
"where r.concept = :concept");
115 wc.addNamedValue(
"concept",
"*");
119 wc.addClause(
"order by r.ranking DESC");
120 list.addAll(process.createDao().getResultList(wc));
127 private void executeFor(String rankingEntity) {
128 for(ProcessRanking process : Instances.cached().byAnnotation(ElephantRanking.class, ProcessRanking.class)) {
129 if(process.instanceClass().getName().equals(rankingEntity)) {
130 process.startProcess();
138 Executions.createComponents(
"/WEB-INF/_zul/bs/comps/ranking/rankingControl.zul",
this,
null);
139 Selectors.wireComponents(
this,
this,
false);
140 Selectors.wireEventListeners(
this,
this);
static List< IndicatorVariable > getRankingVariables(String root)
static List< IndicatorVariable > getRankingVariablesFinal(String root)
static ISystemLogger getInstance()
void doLog(SystemLogType type, Object entity, String comment, Serializable data)