PageRenderTime 24ms CodeModel.GetById 21ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/alaspatial/src/main/webapp/logs.zul

http://alageospatialportal.googlecode.com/
Unknown | 75 lines | 66 code | 9 blank | 0 comment | 0 complexity | e5b26f327f28bac5baf5ac6809c7bec5 MD5 | raw file
 1<?xml version="1.0" encoding="UTF-8"?>
 2
 3<zk xmlns="http://www.zkoss.org/2005/zul">
 4    <window id="win" apply="org.ala.spatial.web.zk.LogsZK"
 5title="Spatial Portal Log Analyser" width="100%" border="normal">
 6
 7        <vbox>
 8            <label id="lblMessage" value="" />
 9            <button id="refresh" label="Refresh" />
10        </vbox>
11
12        <zscript>
13         class MyRowComparator implements Comparator {
14            private boolean _asc;
15            private int _columnIndex;
16
17             public MyRowComparator(boolean asc, int columnIndex) {
18                _asc = asc;
19                _columnIndex = columnIndex;
20             }
21             public int compare(Object o1, Object o2) {
22                 String[] s1 = (String[])o1;
23                 String[] s2 = (String[])o2;
24                 
25                 int v;
26                 if (_columnIndex > 0) {
27                    v = s1[_columnIndex].compareTo(s2[_columnIndex]);
28                 } else {
29                    try {
30                        java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");
31                        Date d1 = sdf.parse(s1[_columnIndex]);
32                        Date d2 = sdf.parse(s2[_columnIndex]);
33                        v = d1.compareTo(d2); 
34                    } catch (Exception e) {
35                        e.printStackTrace(System.out);
36                    }
37                 }
38
39                 return _asc ? v: -v;
40             }
41         }
42         Comparator ascdt = new MyRowComparator(true, 0);
43         Comparator dscdt = new MyRowComparator(false, 0);
44         Comparator ascty = new MyRowComparator(true, 5);
45         Comparator dscty = new MyRowComparator(false, 5);
46         Comparator ascsp = new MyRowComparator(true, 6);
47         Comparator dscsp = new MyRowComparator(false, 6);
48         Comparator ascmt = new MyRowComparator(true, 8);
49         Comparator dscmt = new MyRowComparator(false, 8);
50        </zscript>
51
52        <grid id="grid" mold="paging">
53            <columns menupopup="auto" sizable="true" >
54                <column style="width:5%" sortAscending="${ascdt}" sortDescending="${dscdt}" label="Date Time"/>
55                <column style="width:5%" label="IP"/>
56                <column style="width:5%" visible="false" label="Email"/>
57                <column style="width:5%" visible="false" label="Process ID"/>
58                <column style="width:5%" label="Session ID"/>
59                <column style="width:5%" sortAscending="${ascty}" sortDescending="${dscty}" label="Type"/>
60                <column style="width:5%" sortAscending="${ascsp}" sortDescending="${dscsp}" label="Species"/>
61                <column style="width:5%" label="Layers"/>
62                <column style="width:5%" sortAscending="${ascmt}" sortDescending="${dscmt}" label="Method"/>
63                <column style="width:10%" visible="false" label="Params"/>
64                <column style="width:10%" label="Download"/>
65                <column label="Message"/>
66            </columns>
67            <rows>
68                <row>
69                </row>
70            </rows>
71        </grid>
72
73    </window>
74
75</zk>