Source Code Cross Referenced for SubjectTableModel.java in  » Workflow-Engines » osbl-1_0 » org » osbl » client » wings » concern » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Workflow Engines » osbl 1_0 » org.osbl.client.wings.concern 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.osbl.client.wings.concern;
002:
003:        import org.concern.*;
004:        import org.osbl.client.wings.form.ObjectTableModel;
005:        import org.osbl.client.wings.form.StringEditableCellRenderer;
006:        import org.conform.BeanMeta;
007:        import org.conform.wings.ComponentFactory;
008:        import org.wings.session.SessionManager;
009:        import org.wingx.table.*;
010:
011:        import java.util.*;
012:
013:        /**
014:         * @author hengels
015:         * @version $Revision$
016:         */
017:        public class SubjectTableModel extends XTableModel implements 
018:                ObjectTableModel {
019:            private final static String[] propertyNames = new String[] {
020:                    "subjectLine", "process", "originator", "created", };
021:            private final static String[] filterColumnNames = new String[] {
022:                    "line.line", "subject.process", "subject.originator",
023:                    "subject.created", };
024:
025:            private BeanMeta beanMeta;
026:            private XTableColumnModel columnModel = new XDefaultTableColumnModel();
027:
028:            List subjects = Collections.EMPTY_LIST;
029:
030:            protected Worklist worklist;
031:            protected String assignee;
032:            private String[] processes;
033:            private int state;
034:            private String[] orders;
035:            private String[] originators;
036:            private String[] keywords;
037:
038:            public SubjectTableModel(BeanMeta beanMeta) {
039:                this .beanMeta = beanMeta;
040:                worklist = ControllerLookup.getInstance().getWorklist();
041:
042:                for (int i = 0; i < propertyNames.length; i++) {
043:                    String columnName = propertyNames[i];
044:                    columnModel.addColumn(ComponentFactory.INSTANCE
045:                            .createTableColumn(beanMeta, columnName, i));
046:                }
047:                columnModel.getColumn("process").setSortable(true);
048:                columnModel.getColumn("originator").setSortable(true);
049:                columnModel.getColumn("created").setSortable(true);
050:
051:                columnModel.getColumn("subjectLine").setFilterable(true);
052:                columnModel.getColumn("subjectLine").setFilterRenderer(
053:                        new StringEditableCellRenderer());
054:                columnModel.getColumn("process").setFilterable(true);
055:                columnModel.getColumn("process").setFilterRenderer(
056:                        new ProcessFilterRenderer());
057:                columnModel.getColumn("originator").setFilterable(true);
058:                columnModel.getColumn("originator").setFilterRenderer(
059:                        new StringEditableCellRenderer());
060:            }
061:
062:            public String[] getKeywords() {
063:                return keywords;
064:            }
065:
066:            public void setKeywords(String[] keywords) {
067:                this .keywords = keywords;
068:            }
069:
070:            public void setAssignee(String assignee) {
071:                this .assignee = assignee;
072:            }
073:
074:            public void setProcesses(String[] processes) {
075:                this .processes = processes;
076:            }
077:
078:            public String[] getOriginators() {
079:                return originators;
080:            }
081:
082:            public void setOriginators(String[] originators) {
083:                this .originators = originators;
084:            }
085:
086:            public int getState() {
087:                return state;
088:            }
089:
090:            public void setState(int state) {
091:                this .state = state;
092:            }
093:
094:            public void refresh() {
095:                if (state == Controller.STATE_DESTROYED) {
096:                    subjects = worklist.listArchivedSubjects(processes,
097:                            keywords, originators, orders(), locale(), 200);
098:                } else
099:                    subjects = worklist.listSubjects(assignees(), processes,
100:                            keywords, originators, state, orders(), locale(),
101:                            200);
102:
103:                fireTableDataChanged();
104:            }
105:
106:            private String locale() {
107:                return SessionManager.getSession().getLocale().toString();
108:            }
109:
110:            private String[] assignees() {
111:                return assignee != null ? new String[] { "*", assignee } : null;
112:            }
113:
114:            public void setFilter(int col, Object value) {
115:                super .setFilter(col, value);
116:                switch (col) {
117:                case 0:
118:                    keywords = tokenize((String) value);
119:                    break;
120:                case 1:
121:                    processes = (String[]) value;
122:                    break;
123:                case 2:
124:                    originators = tokenize((String) value);
125:                    break;
126:                }
127:            }
128:
129:            protected String[] tokenize(String string) {
130:                if (string == null)
131:                    return new String[0];
132:
133:                StringTokenizer tokens = new StringTokenizer(string, " ,");
134:                String[] strings = new String[tokens.countTokens()];
135:                for (int i = 0; tokens.hasMoreTokens(); i++)
136:                    strings[i] = tokens.nextToken();
137:
138:                return strings;
139:            }
140:
141:            public void setSort(int col, int order) {
142:                super .setSort(col, order);
143:                orders = null;
144:            }
145:
146:            private String[] orders() {
147:                if (orders == null) {
148:                    List<String> orders = new LinkedList<String>();
149:                    for (int i = 0; i < getColumnCount(); i++) {
150:                        int sort = getSort(i);
151:                        if (sort == SORT_NONE)
152:                            continue;
153:
154:                        orders.add((sort == SORT_ASCENDING ? "" : "-")
155:                                + SubjectTableModel.filterColumnNames[i]);
156:                    }
157:                    this .orders = orders.toArray(new String[orders.size()]);
158:                }
159:                return orders;
160:            }
161:
162:            public XTableColumnModel getColumnModel() {
163:                return columnModel;
164:            }
165:
166:            public int getRowCount() {
167:                return subjects.size();
168:            }
169:
170:            public int getColumnCount() {
171:                return columnModel.getColumnCount();
172:            }
173:
174:            public Object getRowId(int rowIndex) {
175:                return getRow(rowIndex).getSubjectId();
176:            }
177:
178:            public Object getValueAt(int rowIndex, int columnIndex) {
179:                Subject subject = (Subject) subjects.get(rowIndex);
180:
181:                switch (columnIndex) {
182:                case 0:
183:                    String subjectLine = subject.getSubjectLine();
184:                    if (subjectLine != null && subjectLine.length() > 60)
185:                        subjectLine = subjectLine.substring(0, 56) + " ...";
186:                    return subjectLine;
187:                case 1:
188:                    return subject.getProcess();
189:                case 2:
190:                    return subject.getOriginator();
191:                case 3:
192:                    return subject.getCreated();
193:                }
194:                return "?";
195:            }
196:
197:            public String getColumnName(int column) {
198:                return "" + columnModel.getColumn(column).getHeaderValue();
199:            }
200:
201:            public Class<?> getColumnClass(int columnIndex) {
202:                return beanMeta.getProperties()[columnIndex].getType();
203:            }
204:
205:            Subject getRow(int row) {
206:                return (Subject) subjects.get(row);
207:            }
208:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.