Maintain log :
- 2011/9/23 Upgrade to 1.2.2.2 , finetune some minor defect and page description;
- 2011/8/22 Upgrade to 1.2.2.1 , add the "user view" and rating component.
User view is to show all posts of specific user;
- 2011/8/22 Upgrade to 1.2.2 , finetune the UI , using pushState to get better UX/performance in FF/Chrome, add author field for each case.
- 2011/8/04 Upgrade to 1.2.1 , add widget and some data API ,bug fixs.
- 2011/7/20 Upgrade to 1.2 , upgrading Code Mirror and fix some issue.
- 2011/7/13 Domain name server get wrong resolved ip , so the run buttion is temporary not working. Fixed.
- 2011/6/28 Upgrade to 1.1.1 fine tune UI, add tag cloud
- 2011/6/27 Upgrade to 1.1.0 Add Tag and download
- 2011/6/18 Upgrade to 1.0.0
- 2011/6/17 Version 1.0.0 Update UI
- 2011/6/12 Version 0.9.1 fixed db not saving case after server restart issue.
- 2011/6/11 Version 0.9.0 update project skeleton and add more features.
- 2011/6/05 Version 0.8.0 prototyping and experimental version
Suggested case list:
user model to move item to another listbox
1TonyQ114.25.109.94d0n3krApr 21, 2012 10:43:27 AMlinkUsing timer to refresh a grid
1TonyQ220.133.44.3725nk0uiFeb 17, 2012 3:17:34 AMlinkupdate the textbox value and fire a onChange event (Client)
2TonyQ220.133.44.37qdorurFeb 12, 2012 11:56:25 PMlinkFire a event from child iframe
1TonyQ220.133.44.372eupjotFeb 3, 2012 5:04:52 AMlinkTextbox input restriction sample
1TonyQ72.21.245.2431b3nlr0Dec 20, 2011 10:09:10 AMlinkTest web core taglib in ZUL
1TonyQ198.203.175.175ofqkemDec 17, 2011 3:36:08 AMlinkidentify firefox or not in server side
1TonyQ198.203.175.1751nv2qreDec 10, 2011 4:25:04 AMlinkZK addThis integration
1TonyQ198.203.175.1751apl96jNov 5, 2011 4:12:50 AMlinkTrigger onChange for textbox in client manually.
1TonyQ198.203.175.1751tmsvs1Sep 22, 2011 5:23:43 AMlinkmodify selected status of listbox after compose
1guest61.224.42.2033486viqSep 18, 2011 12:26:53 PMlinkckeditor startup with source mode
1benbai61.216.4.1961lvlb1lSep 11, 2011 1:56:30 PMlinkapply style to all textbox in css
1TonyQ198.203.175.1751l8b5kkSep 10, 2011 12:55:52 AMlinkRequire user to enter uppercase chars only in textbox
1TonyQ198.203.175.1751cl18ghSep 9, 2011 12:58:13 AMlinkThe last position that the mouse was clicked
3sunflower60.175.249.16539o3m78Sep 8, 2011 10:08:32 PMlinkHow to invoke server side onClick event with XHTML component
1TonyQ198.203.175.17511spe5sSep 7, 2011 8:01:56 AMlinkClient event - onFocus/onBlur
1TonyQ198.203.175.1752met717Sep 1, 2011 6:13:24 AMlinkDatabinding with TypeConverter sample
1TonyQ198.203.175.1751t0gtrkAug 31, 2011 12:47:46 AMlinkgrid sample with ListModel/RowRenderer
5guest198.203.175.1752vah9ajAug 31, 2011 12:27:35 AMlinkMultiple drag - finetune
3TonyQ198.203.175.175393nlq1Aug 30, 2011 6:49:05 AMlinkA window doModal reusing example - composer way
5TonyQ12.208.243.66126pn69Aug 28, 2011 12:04:14 PMlinkLatest 10 Fiddles :
Textbox input restriction sample
2guest193.134.161.673p27td3Jun 20, 2013 9:11:49 AMlinkTextbox input restriction sample
1guest193.134.161.673p27td3Jun 20, 2013 9:11:32 AMlinkCombobox with template
5andyms67.213.218.723a6asivJun 20, 2013 8:15:21 AMlinkzAu data issue
4guest88.119.198.5714uk8svJun 20, 2013 8:15:13 AMlinkCombobox with template
4andyms67.213.218.723a6asivJun 20, 2013 8:09:16 AMlinkCombobox with template
3andyms67.213.218.723a6asivJun 20, 2013 8:08:37 AMlinkSimple MVC with include
22guest202.131.103.1862ld3ad9Jun 20, 2013 7:26:56 AMlinkSimple MVC with include
21guest202.131.103.1862ld3ad9Jun 20, 2013 7:26:05 AMlinkSimple MVC with include
20guest202.131.103.1862ld3ad9Jun 20, 2013 7:23:36 AMlinkSimple MVC with include
19guest202.131.103.1862ld3ad9Jun 20, 2013 7:21:35 AMlinkgrid with hierarcy
7guest213.57.218.342j23enhApr 23, 2012 6:13:42 PMlinkresources
index.zulzul
<zk>
<zscript>
import java.util.*;
import java.text.*;
Random random = new Random(20);
String[] stocks = {"Csco", "Goog", "Yhoo", "Msft", "Orcl"};
String[] color = {"red", "blue", "yellow", "green", "gray"};
NumberFormat nf = NumberFormat.getInstance();
Locale locale = Locale.ENGLISH;
SimpleDateFormat df = new SimpleDateFormat("MMMM", locale);
String[] months = new String[12];
java.util.Calendar cal = java.util.Calendar.getInstance(locale);
cal.clear();
for (int j = 0; j < 12; ++j) {
cal.set(java.util.Calendar.MONTH, j);
months[j] = df.format(cal.getTime());
}
String nextPrice() {
nf.setMaximumFractionDigits( 2 );
return nf.format(Math.random() * 50 + 40);
}
</zscript>
<grid>
<columns>
<column width="40px" />
<column label="Stock Name"/>
<column label="Date"/>
<column label="Open" align="center" sort="auto"/>
<column label="High" align="center" sort="auto"/>
<column label="Low" align="center" sort="auto"/>
<column label="Close" align="center" sort="auto"/>
<column label="volume" align="center" sort="auto"/>
</columns>
<rows>
<row forEach="${stocks}">
<detail open="false" fulfill="onOpen=season.zul"/>
<label value="${stocks[forEachStatus.index]}"/>
<label value="31-Aug-09"/>
<label style="color:red;" onCreate='self.value = nextPrice()'/>
<label onCreate='self.value = nextPrice()'/>
<label style="color:red;" onCreate='self.value = nextPrice()'/>
<label onCreate='self.value = nextPrice()'/>
<label onCreate='self.value = random.nextInt(65536)+ ""'/>
</row>
</rows>
</grid>
</zk>
season.zulzul<zk>
<grid model="${hGrid$composer.getSeasonModel()}" sclass="inner-grid">
<columns>
<column width="40px" />
<column label="User"/>
<column label="Field"/>
<column label="Value/>
</columns>
<template name="model">
<row value="${forEachStatus.index}">
<label value="Q${forEachStatus.index+1}" />
<label value="${each[0]}" />
<label value="${each[1]}" />
<label value="${each[2]}" />
</row>
</template>
</grid>
</zk>Model.javajavapackage demo.grid.hierarchy;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.select.SelectorComposer;
import org.zkoss.zul.Chart;
import org.zkoss.zul.Footer;
import org.zkoss.zul.Grid;
import org.zkoss.zul.Label;
import org.zkoss.zul.ListModel;
import org.zkoss.zul.ListModelList;
import org.zkoss.zul.Row;
import org.zkoss.zul.Rows;
import org.zkoss.zul.SimpleCategoryModel;
public class HierarchyController extends SelectorComposer<Component> {
/**
*
*/
private static final long serialVersionUID = -3325569917490393900L;
private final SimpleDateFormat monthFormat = new SimpleDateFormat("MMMM");
private final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MMM-yyyy");
private static NumberFormat nf = NumberFormat.getInstance();
private static String[] months = new String[12];
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
Grid hierarchyGrid = (Grid) comp;
// Stock model
int base = 32768;
String today = simpleDateFormat.format(new Date());
List<String[]> stocks = new ArrayList<String[]>();
stocks.add(new String[] { "Csco", today, nextPrice(), nextPrice(), nextPrice(), nextPrice(), nextVolume(base) });
stocks.add(new String[] { "Goog", today, nextPrice(), nextPrice(), nextPrice(), nextPrice(), nextVolume(base) });
stocks.add(new String[] { "Yhoo", today, nextPrice(), nextPrice(), nextPrice(), nextPrice(), nextVolume(base) });
stocks.add(new String[] { "Msft", today, nextPrice(), nextPrice(), nextPrice(), nextPrice(), nextVolume(base) });
stocks.add(new String[] { "Orcl", today, nextPrice(), nextPrice(), nextPrice(), nextPrice(), nextVolume(base) });
stocks.add(new String[] { "Amaz", today, nextPrice(), nextPrice(), nextPrice(), nextPrice(), nextVolume(base) });
stocks.add(new String[] { "Facb", today, nextPrice(), nextPrice(), nextPrice(), nextPrice(), nextVolume(base) });
hierarchyGrid.setModel(new ListModelList<String[]>(stocks));
// Months data
Calendar cal = Calendar.getInstance();
cal.clear();
for (int j = 0; j < 12; ++j) {
cal.set(Calendar.MONTH, j);
months[j] = monthFormat.format(cal.getTime());
}
}
public ListModel<String[]> getMonthModel(Integer seasonIndex) {
List<String[]> months = new ArrayList<String[]>();
months.add(new String[] { getMonthName(seasonIndex * 3), nextPrice(), nextPrice(), nextVolume(327680) });
months.add(new String[] { getMonthName(seasonIndex * 3 + 1), nextPrice(), nextPrice(), nextVolume(327680) });
months.add(new String[] { getMonthName(seasonIndex * 3 + 2), nextPrice(), nextPrice(), nextVolume(327680) });
return new ListModelList<String[]>(months);
}
public ListModel<String[]> getSeasonModel() {
List<String[]> seasons = new ArrayList<String[]>();
seasons.add(new String[] { nextPrice(), nextPrice(), nextVolume(655360) });
seasons.add(new String[] { nextPrice(), nextPrice(), nextVolume(655360) });
seasons.add(new String[] { nextPrice(), nextPrice(), nextVolume(655360) });
seasons.add(new String[] { nextPrice(), nextPrice(), nextVolume(655360) });
return new ListModelList<String[]>(seasons);
}
// For Season Footer
public String getAverage(Footer f, boolean isFloat) {
Rows rows = f.getGrid().getRows();
int idx = f.getParent().getChildren().indexOf(f);
float total = 0;
for (Iterator<Component> it = rows.getChildren().iterator(); it.hasNext();) {
total += Float.parseFloat(((Label) ((Row) it.next()).getChildren().get(idx)).getValue());
}
DecimalFormat df = (DecimalFormat) NumberFormat.getInstance(org.zkoss.util.Locales.getCurrent());
total /= rows.getChildren().size();
if (isFloat)
df.applyPattern("##.00");
return df.format(total);
}
// For Season statistic chart
public void createChart(Chart chart) {
SimpleCategoryModel cateModel = new SimpleCategoryModel();
Grid monthgrid = (Grid) chart.getPreviousSibling();
String stockName = ((Row) ((Row) monthgrid.getParent().getParent()).getGrid().getParent().getParent())
.getValue();
for (Iterator<Component> it = monthgrid.getRows().getChildren().iterator(); it.hasNext();) {
Row row = (Row) it.next();
cateModel.setValue(stockName, ((Label) row.getChildren().get(0)).getValue(),
new Double(Double.parseDouble(((Label) row.getChildren().get(3)).getValue())));
}
chart.setModel(cateModel);
chart.setBgColor("#fafafa");
}
private String nextPrice() {
nf.setMaximumFractionDigits(2);
return nf.format(Math.random() * 50 + 40);
}
private String nextVolume(int base) {
return (int) (Math.random() * base + 65536) + "";
}
private String getMonthName(int index) {
return months[index];
}
}