Processing...

Suggested case list:

Using timer to refresh a grid

383guest172.69.33.12125nk0uiMay 7, 2020 7:23:47 AMlink

user model to move item to another listbox

120guest162.158.193.148d0n3krApr 2, 2020 5:28:28 AMlink

Disabled list item row passed to VM-1981

296fatih123160.83.36.13025nk0uiFeb 13, 2018 4:25:44 PMlink

Disabled list item row passed to VM-1981

295fatih123160.83.36.13025nk0uiFeb 13, 2018 4:25:16 PMlink

Disabled list item row passed to VM-1981

294fatih123160.83.36.13225nk0uiFeb 13, 2018 3:30:44 PMlink

grid sample with ListModel/RowRenderer

816guest80.82.2.1312vah9ajFeb 21, 2017 11:42:21 AMlink

grid sample with ListModel/RowRenderer

809guest175.98.113.1622vah9ajJan 26, 2017 9:19:33 AMlink

grid sample with ListModel/RowRenderer

196guest79.185.142.402vah9ajApr 26, 2014 10:53:57 PMlink

grid sample with ListModel/RowRenderer

195guest79.185.142.402vah9ajApr 26, 2014 10:53:54 PMlink

grid sample with ListModel/RowRenderer

194guest79.185.142.402vah9ajApr 26, 2014 10:53:51 PMlink

grid sample with ListModel/RowRenderer

193guest79.185.142.402vah9ajApr 26, 2014 10:53:48 PMlink

grid sample with ListModel/RowRenderer

192guest79.185.142.402vah9ajApr 26, 2014 10:53:44 PMlink

grid sample with ListModel/RowRenderer

191guest79.185.142.402vah9ajApr 26, 2014 10:53:40 PMlink

Hierarchy table without using ZK PE/EE

1aaknai151.28.135.2131s871daJul 29, 2013 11:02:46 PMlink

grid sample with ListModel/RowRenderer

128aaknai151.28.135.2132vah9ajJul 29, 2013 7:20:00 PMlink

user model to move item to another listbox

1TonyQ114.25.109.94d0n3krApr 21, 2012 10:43:27 AMlink

Using timer to refresh a grid

1TonyQ220.133.44.3725nk0uiFeb 17, 2012 3:17:34 AMlink

Fire a event from child iframe

1TonyQ220.133.44.372eupjotFeb 3, 2012 5:04:52 AMlink

Textbox input restriction sample

1TonyQ72.21.245.2431b3nlr0Dec 20, 2011 10:09:10 AMlink

Test web core taglib in ZUL

1TonyQ198.203.175.175ofqkemDec 17, 2011 3:36:08 AMlink

Latest 10 Fiddles :

constraint binding textbox

3guest172.68.151.16220peldaDec 5, 2025 5:08:19 PMlink

Another new ZK fiddle

2guest172.68.151.16320peldaDec 5, 2025 5:07:51 PMlink

Another new ZK fiddle

1guest172.68.151.16220peldaDec 5, 2025 5:07:32 PMlink

Another new ZK fiddle

1peggypeng172.71.154.99364f4neDec 5, 2025 9:24:31 AMlink

tooltip example

2guest104.22.23.13rc1ntoDec 4, 2025 2:23:45 PMlink

Another new ZK fiddle

1guest172.69.134.2277t7602Dec 4, 2025 1:40:46 PMlink

Another new ZK fiddle

1peggypeng104.22.17.1802df6e3oDec 4, 2025 8:41:29 AMlink

onClose

1peggypeng172.68.87.248j8kd8aDec 3, 2025 4:10:26 AMlink

Another new ZK fiddle

1peggypeng172.69.134.2271rm7f4eNov 26, 2025 3:31:24 AMlink

ZK-5912-Suggestion

2rebeccalai104.22.20.1442qrmiiuNov 26, 2025 2:07:15 AMlink

Rick Final

2blackspider181.126.90.591tdtjovOct 8, 2019 3:11:45 PMlink

resources

index.zulzul<zk> <window title="Rick Final" border="normal" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('controller.grafico')"> <div apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('model.mComboBox')"> <hbox> <vlayout> <separator/> <label value="Tipo de Productos" /> <combobox id="cmbTp" width="150px" model="@load(vm.names)" selectedItem="@bind(vm.iname)" onChange='grafico1.setSrc("./grafico1.zul?test="+cmbTp.value); grafico3.setSrc("./grafico3.zul?test="+cmbTp.value)' value='27'> </combobox> </vlayout> </hbox> </div> <include id="grafico1" src="./grafico1.zul?test=${cmbTp.value}" visible="@load(vm.verVentana1)"/> </zk> grafico1.zulzul<zk> <window> <window apply="controller.ChartComposer"> <label value="Grafico para: " /> <label id="test" value="${param.test}" /> <charts id="chart" type="line" title="Ganancias de vendedores por tipo de Producto (2018)" /> </window> </window> </zk> ChartComposer.javajavaimport org.zkoss.zk.ui.*; import org.zkoss.zk.ui.event.*; import org.zkoss.zk.ui.util.*; import org.zkoss.zk.ui.ext.*; import org.zkoss.zk.au.*; import org.zkoss.zk.au.out.*; import org.zkoss.zul.*; public class ChartComposer extends GenericForwardComposer{ @Wire Label test; @Wire Charts chart; public void doAfterCompose(Window comp) throws Exception { super.doAfterCompose(comp); // Create a predefined implementation category model CategoryModel model = new DefaultCategoryModel(); Generador gen = new Generador(); String MES[] = {"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"}; int valor; if (test.getValue().equals("todos")) { valor = -1; }else { valor = Integer.parseInt(test.getValue()); } ArrayList<Vendedor> lv = gen.generar(valor); for(int i = 0 ; i<lv.size(); i++) { for (int j = 0 ; j < lv.get(i).getVm().size(); j++) { model.setValue(lv.get(i).getName(), MES [j] , lv.get(i).getVm().get(j).intValue() ); } } // Set value to the model // model.setValue("Tokyo", "Spring", new Integer(1000)); // model.setValue("Tokyo", "Summer", new Integer(20)); // model.setValue("Tokyo", "Fall", new Integer(16)); // model.setValue("Tokyo", "Winter", new Integer(-2)); // model.setValue("New York", "Spring", new Integer(6)); // model.setValue("New York", "Summer", new Integer(12)); // model.setValue("New York", "Fall", new Integer(10)); // model.setValue("New York", "Winter", new Integer(2)); // Set model to the chart chart.setModel(model); } } Generador.javajavaimport org.zkoss.zk.ui.*; import org.zkoss.zk.ui.event.*; import org.zkoss.zk.ui.util.*; import org.zkoss.zk.ui.ext.*; import org.zkoss.zk.au.*; import org.zkoss.zk.au.out.*; import org.zkoss.zul.*; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.text.ParseException; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; import java.util.HashSet; import java.util.Set; import java.util.TimeZone; public class Generador extends GenericForwardComposer{ public ArrayList<Vendedor> generar(int tp) throws NumberFormatException, ParseException, IOException{ LeerCsv lc = new LeerCsv(); //ArrayList<Dato> datos = lc.leer("webapps/upa/WEB-INF/ventas2.csv", true); ArrayList<Dato> datos = lc.leerUrl(true); ArrayList<Vendedor> vendedores = new ArrayList<Vendedor>(); ArrayList<Double> lr = new ArrayList<Double>(); ArrayList<Double> ln = new ArrayList<Double>(); ArrayList<Double> lo = new ArrayList<Double>(); //System.out.println(datos.get(0).getDolar()); double [] v = new double [3]; //int tp = 45; Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("America/Asuncion")); for (int i = 1; i<datos.size();i++) { if (tp != -1) { if (datos.get(i).getTipoproducto() == tp) { cal.setTime(datos.get(i).getFecha()); if (cal.get(Calendar.YEAR)==2018) { switch (datos.get(i).getIdvendedor()) { case "R":{ if (lr.size() <= cal.get(Calendar.MONTH)) { vendedores.add(new Vendedor("R")); lr.add(datos.get(i).getGanancia()); }else { lr.set(cal.get(Calendar.MONTH), lr.get(cal.get(Calendar.MONTH))+datos.get(i).getGanancia()); } break; } case "N":{ if (ln.size() <= cal.get(Calendar.MONTH)) { vendedores.add(new Vendedor("N")); ln.add(datos.get(i).getGanancia()); }else { ln.set(cal.get(Calendar.MONTH), ln.get(cal.get(Calendar.MONTH))+datos.get(i).getGanancia()); } break; } case "O":{ if (lo.size() <= cal.get(Calendar.MONTH)) { vendedores.add(new Vendedor("O")); lo.add(datos.get(i).getGanancia()); }else { lo.set(cal.get(Calendar.MONTH), lo.get(cal.get(Calendar.MONTH))+datos.get(i).getGanancia()); } break; } } } } }else { cal.setTime(datos.get(i).getFecha()); if (cal.get(Calendar.YEAR)==2018) { switch (datos.get(i).getIdvendedor()) { case "R":{ if (lr.size() <= cal.get(Calendar.MONTH)) { vendedores.add(new Vendedor("R")); lr.add(datos.get(i).getGanancia()); }else { lr.set(cal.get(Calendar.MONTH), lr.get(cal.get(Calendar.MONTH))+datos.get(i).getGanancia()); } break; } case "N":{ if (ln.size() <= cal.get(Calendar.MONTH)) { vendedores.add(new Vendedor("N")); ln.add(datos.get(i).getGanancia()); }else { ln.set(cal.get(Calendar.MONTH), ln.get(cal.get(Calendar.MONTH))+datos.get(i).getGanancia()); } break; } case "O":{ if (lo.size() <= cal.get(Calendar.MONTH)) { vendedores.add(new Vendedor("O")); lo.add(datos.get(i).getGanancia()); }else { lo.set(cal.get(Calendar.MONTH), lo.get(cal.get(Calendar.MONTH))+datos.get(i).getGanancia()); } break; } } } } } for (int i = 0 ; i< vendedores.size() ; i++) { switch(vendedores.get(i).getName()) { case("R"):{ vendedores.get(i).setVm(lr); break; } case("N"):{ vendedores.get(i).setVm(ln); break; } case("O"):{ vendedores.get(i).setVm(lo); break; } } } //System.out.println(vendedores.get(0).getVm().get(0)); return vendedores; } public ArrayList<String> generarTipos() throws NumberFormatException, ParseException, IOException{ LeerCsv lc = new LeerCsv(); ArrayList<Dato> datos = lc.leerUrl(true); //ArrayList<Dato> datos = lc.leer("webapps/upa/WEB-INF/ventas2.csv", true); ArrayList<Integer> tipos = new ArrayList<Integer>(); for (int i = 1; i<datos.size(); i++) { tipos.add(datos.get(i).getTipoproducto()); } Set<Integer> hs = new HashSet<>(); hs.addAll(tipos); tipos.clear(); tipos.addAll(hs); Collections.sort(tipos); ArrayList<String>tipos2= new ArrayList<String>(); for (int i = 0 ; i< tipos.size();i++) { tipos2.add(String.valueOf(tipos.get(i))); } return tipos2; } }LeerCsv.javajavaimport org.zkoss.zk.ui.*; import org.zkoss.zk.ui.event.*; import org.zkoss.zk.ui.util.*; import org.zkoss.zk.ui.ext.*; import org.zkoss.zk.au.*; import org.zkoss.zk.au.out.*; import org.zkoss.zul.*; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import java.text.ParseException; import java.util.ArrayList; import javax.net.ssl.HttpsURLConnection; public class LeerCsv extends GenericForwardComposer{ public ArrayList<Dato> leer(String csvFile, boolean cabecera) throws NumberFormatException, ParseException{ //String csvFile = "archivo.csv"; BufferedReader br = null; String line = ""; ArrayList<Dato> datos = new ArrayList<Dato>(); String cvsSplitBy = "," ; try { br = new BufferedReader(new FileReader(csvFile)); if (cabecera) { br.readLine(); } while ((line = br.readLine()) != null) { String[] v = line.split(cvsSplitBy); //System.out.println(v[9]); if (v[9].contentEquals("")) { v[9]="0"; } datos.add(new Dato(v[0], Integer.parseInt(v[1]) ,Double.parseDouble(v[2]) ,v[3] ,Double.parseDouble(v[4]) ,Integer.parseInt(v[5]) ,v[6] ,Integer.parseInt(v[7]) ,Double.parseDouble(v[8]) ,Integer.parseInt(v[9]) ,v[10])); } } catch (FileNotFoundException e2) { e2.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } return datos; } public ArrayList<Dato> leerUrl(boolean cabecera) throws IOException, NumberFormatException, ParseException{ URL url = new URL ("https://www.doxa.com.py/pg1/ventas2.txt"); HttpsURLConnection yc = (HttpsURLConnection) url.openConnection(); BufferedReader br = null; String line = ""; ArrayList<Dato> datos = new ArrayList<Dato>(); String cvsSplitBy = "," ; try { br = new BufferedReader( new InputStreamReader(yc.getInputStream())); if (cabecera) { br.readLine(); } while ((line = br.readLine()) != null) { String[] v = line.split(cvsSplitBy); System.out.println(v[9]); if (v[9].contentEquals("")) { v[9]="0"; } datos.add(new Dato(v[0], Integer.parseInt(v[1]) ,Double.parseDouble(v[2]) ,v[3] ,Double.parseDouble(v[4]) ,Integer.parseInt(v[5]) ,v[6] ,Integer.parseInt(v[7]) ,Double.parseDouble(v[8]) ,Integer.parseInt(v[9]) ,v[10])); } } catch (FileNotFoundException e2) { e2.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } return datos; } } Dato.javajavaimport org.zkoss.zk.ui.*; import org.zkoss.zk.ui.event.*; import org.zkoss.zk.ui.util.*; import org.zkoss.zk.ui.ext.*; import org.zkoss.zk.au.*; import org.zkoss.zk.au.out.*; import org.zkoss.zul.*; import java.util.Date; import java.text.ParseException; import java.text.SimpleDateFormat; public class Dato extends GenericForwardComposer{ private Date fecha; private int importe; private Double ganancia; private String condicion; private double dolar; private int idempresa; private String idvendedor; private int idproducto; private double cantidadproducto; private int tipoproducto; private String categoria; //String date = simpleDateFormat.format(new Date()); public Dato(String fecha, int importe, double ganancia, String condicion, double dolar, int idempresa, String idvendedor, int idproducto, double cantidadproducto, int tipoproducto, String categoria) throws ParseException { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(fecha); this.fecha = new SimpleDateFormat("yyyy-MM-dd").parse(fecha); this.importe = importe; this.ganancia = ganancia; this.condicion = condicion; this.dolar = dolar; this.idempresa = idempresa; this.idvendedor = idvendedor; this.idproducto = idproducto; this.cantidadproducto = cantidadproducto; this.tipoproducto = tipoproducto; this.categoria = categoria; } public Date getFecha() { return fecha; } public void setFecha(Date fecha) { this.fecha = fecha; } public int getImporte() { return importe; } public void setImporte(int importe) { this.importe = importe; } public double getGanancia() { return ganancia; } public void setGanancia(double ganancia) { this.ganancia = ganancia; } public String getCondicion() { return condicion; } public void setCondicion(String condicion) { this.condicion = condicion; } public double getDolar() { return dolar; } public void setDolar(double dolar) { this.dolar = dolar; } public int getIdempresa() { return idempresa; } public void setIdempresa(int idempresa) { this.idempresa = idempresa; } public String getIdvendedor() { return idvendedor; } public void setIdvendedor(String idvendedor) { this.idvendedor = idvendedor; } public int getIdproducto() { return idproducto; } public void setIdproducto(int idproducto) { this.idproducto = idproducto; } public double getCantidadproducto() { return cantidadproducto; } public void setCantidadproducto(double cantidadproducto) { this.cantidadproducto = cantidadproducto; } public int getTipoproducto() { return tipoproducto; } public void setTipoproducto(int tipoproducto) { this.tipoproducto = tipoproducto; } public String getCategoria() { return categoria; } public void setCategoria(String categoria) { this.categoria = categoria; } } Vendedor.javajavaimport org.zkoss.zk.ui.*; import org.zkoss.zk.ui.event.*; import org.zkoss.zk.ui.util.*; import org.zkoss.zk.ui.ext.*; import org.zkoss.zk.au.*; import org.zkoss.zk.au.out.*; import org.zkoss.zul.*; import org.zkoss.chart.Charts; import java.util.ArrayList; public class Vendedor extends GenericForwardComposer{ private String name; private ArrayList<Double> vm; public Vendedor(String name) { this.name = name; this.vm = new ArrayList<Double>(); } public String getName() { return name; } public void setName(String name) { this.name = name; } public ArrayList<Double> getVm() { return vm; } public void setVm(ArrayList<Double> vm) { this.vm = vm; } }