Source Code Cross Referenced for WmlCard.java in  » J2EE » Sofia » com » salmonllc » wml » 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 » J2EE » Sofia » com.salmonllc.wml 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.salmonllc.wml;
002:
003:        import java.util.Vector;
004:
005:        import com.salmonllc.html.HtmlPage;
006:        import com.salmonllc.jsp.*;
007:        import com.salmonllc.sql.*;
008:        import com.salmonllc.util.MessageLog;
009:        import com.salmonllc.util.Util;
010:
011:        /**
012:         * This container represents a card in WML
013:         */
014:
015:        public class WmlCard extends JspContainer {
016:            private String _title;
017:            private String _onenterforward, _onenterbackward, _ontimer;
018:            private boolean _newcontext, _ordered = true;
019:            private DataStoreEvaluator _dsForwardEval, _dsBackwardEval,
020:                    _dsTimerEval;
021:            private String _forwardDatasource, _backwardDatasource,
022:                    _timerDatasource;
023:            private String _class;
024:            private Vector _vinputs = new Vector();
025:
026:            public void addInputComponent(WmlFormComponent wfc) {
027:                _vinputs.addElement(wfc);
028:            }
029:
030:            public WmlFormComponent[] getInputComponents() {
031:                if (_vinputs.size() == 0)
032:                    return null;
033:                WmlFormComponent[] hfca = new WmlFormComponent[_vinputs.size()];
034:                System.arraycopy(_vinputs.toArray(), 0, hfca, 0, _vinputs
035:                        .size());
036:                return hfca;
037:            }
038:
039:            /**
040:             * Use this method to get the class attribute used in the Card tag
041:             */
042:            public String getClassName() {
043:                return _class;
044:            }
045:
046:            /**
047:             * This method sets the class attribute for the card.
048:             */
049:            public void setClassName(String className) {
050:                _class = className;
051:            }
052:
053:            /**
054:             * Use this method to get the name of the ForwardDatasource
055:             */
056:            public String getForwardDatasource() {
057:                return _forwardDatasource;
058:            }
059:
060:            /**
061:             * Use this method to set the name of the ForwardDatasource
062:             */
063:            public void setForwardDatasource(String _forwardDatasource) {
064:                this ._forwardDatasource = _forwardDatasource;
065:            }
066:
067:            /**
068:             * Use this method to get the name of the TimerDatasource
069:             */
070:            public String getTimerDatasource() {
071:                return _timerDatasource;
072:            }
073:
074:            /**
075:             * Use this method to set the name of the TimerDatasource
076:             */
077:            public void setTimerDatasource(String _timerDatasource) {
078:                this ._timerDatasource = _timerDatasource;
079:            }
080:
081:            /**
082:             * Use this method to get the name of the BackwardDatasource
083:             */
084:            public String getBackwardDatasource() {
085:                return _backwardDatasource;
086:            }
087:
088:            /**
089:             * Use this method to set the name of the BackwardDatasource
090:             */
091:            public void setBackwardDatasource(String _backwardDatasource) {
092:                this ._backwardDatasource = _backwardDatasource;
093:            }
094:
095:            /**
096:             * This method sets a datastore expression that will be used to compute the Forward Href for the card.
097:             * @param ds com.salmonllc.sql.DataStoreBuffer
098:             * @param expression The expression to evaluate
099:             */
100:            public void setForwardHrefExpression(DataStoreBuffer ds,
101:                    DataStoreExpression expression) throws Exception {
102:                try {
103:                    _dsForwardEval = new DataStoreEvaluator(ds, expression);
104:                } catch (Exception e) {
105:                    MessageLog
106:                            .writeErrorMessage(
107:                                    "setHrefExpression(DataStoreBuffer ds, DataStoreExpression expression )",
108:                                    e, this );
109:                    throw e;
110:                }
111:            }
112:
113:            /**
114:             * This method sets a datastore expression that will be used to compute the Forward Href for the card.
115:             * @param ds com.salmonllc.sql.DataStoreBuffer
116:             * @param expression java.lang.String
117:             */
118:            public void setForwardHrefExpression(DataStoreBuffer ds,
119:                    String expression) throws Exception {
120:                try {
121:                    _dsForwardEval = new DataStoreEvaluator(ds, expression);
122:                } catch (Exception e) {
123:                    MessageLog
124:                            .writeErrorMessage(
125:                                    "setHrefExpression(DataStoreBuffer ds, String expression )",
126:                                    e, this );
127:                    throw e;
128:                }
129:            }
130:
131:            /**
132:             * This method sets a datastore expression that will be used to compute the Backward Href for the link.
133:             * @param ds com.salmonllc.sql.DataStoreBuffer
134:             * @param expression The expression to evaluate
135:             */
136:            public void setBackwardHrefExpression(DataStoreBuffer ds,
137:                    DataStoreExpression expression) throws Exception {
138:                try {
139:                    _dsBackwardEval = new DataStoreEvaluator(ds, expression);
140:                } catch (Exception e) {
141:                    MessageLog
142:                            .writeErrorMessage(
143:                                    "setHrefExpression(DataStoreBuffer ds, DataStoreExpression expression )",
144:                                    e, this );
145:                    throw e;
146:                }
147:            }
148:
149:            /**
150:             * This method sets a datastore expression that will be used to compute the Backward Href for the link.
151:             * @param ds com.salmonllc.sql.DataStoreBuffer
152:             * @param expression java.lang.String
153:             */
154:            public void setBackwardHrefExpression(DataStoreBuffer ds,
155:                    String expression) throws Exception {
156:                try {
157:                    _dsBackwardEval = new DataStoreEvaluator(ds, expression);
158:                } catch (Exception e) {
159:                    MessageLog
160:                            .writeErrorMessage(
161:                                    "setHrefExpression(DataStoreBuffer ds, String expression )",
162:                                    e, this );
163:                    throw e;
164:                }
165:            }
166:
167:            /**
168:             * This method sets a datastore expression that will be used to compute the Timer Href for the link.
169:             * @param ds com.salmonllc.sql.DataStoreBuffer
170:             * @param expression The expression to evaluate
171:             */
172:            public void setTimerHrefExpression(DataStoreBuffer ds,
173:                    DataStoreExpression expression) throws Exception {
174:                try {
175:                    _dsTimerEval = new DataStoreEvaluator(ds, expression);
176:                } catch (Exception e) {
177:                    MessageLog
178:                            .writeErrorMessage(
179:                                    "setHrefExpression(DataStoreBuffer ds, DataStoreExpression expression )",
180:                                    e, this );
181:                    throw e;
182:                }
183:            }
184:
185:            /**
186:             * This method sets a datastore expression that will be used to compute the Timer Href for the link.
187:             * @param ds com.salmonllc.sql.DataStoreBuffer
188:             * @param expression java.lang.String
189:             */
190:            public void setTimerHrefExpression(DataStoreBuffer ds,
191:                    String expression) throws Exception {
192:                try {
193:                    _dsTimerEval = new DataStoreEvaluator(ds, expression);
194:                } catch (Exception e) {
195:                    MessageLog
196:                            .writeErrorMessage(
197:                                    "setHrefExpression(DataStoreBuffer ds, String expression )",
198:                                    e, this );
199:                    throw e;
200:                }
201:            }
202:
203:            /**
204:             * This method gets the DataStoreEvaluator being used for Forward Href expressions.
205:             * @return DataStoreEvaluator
206:             * @see DataStoreEvaluator
207:             */
208:            public DataStoreEvaluator getForwardHrefExpression() {
209:                return _dsForwardEval;
210:            }
211:
212:            /**
213:             * This method gets the DataStoreEvaluator being used for Backward Href expressions.
214:             * @return DataStoreEvaluator
215:             * @see DataStoreEvaluator
216:             */
217:            public DataStoreEvaluator getBackwardHrefExpression() {
218:                return _dsBackwardEval;
219:            }
220:
221:            /**
222:             * This method gets the DataStoreEvaluator being used for Timer Href expressions.
223:             * @return DataStoreEvaluator
224:             * @see DataStoreEvaluator
225:             */
226:            public DataStoreEvaluator getTimerHrefExpression() {
227:                return _dsTimerEval;
228:            }
229:
230:            private DataStoreBuffer getDataStoreBuffer(String sDatasource) {
231:                String dataSource = sDatasource;
232:                String dsName = null;
233:
234:                if (dataSource == null)
235:                    return null;
236:
237:                int pos = dataSource.indexOf(":");
238:                if (pos == -1)
239:                    dsName = dataSource;
240:                else {
241:                    dsName = dataSource.substring(0, pos);
242:                }
243:
244:                DataStoreBuffer ds = ((JspController) getPage())
245:                        .getDataSource(dsName);
246:                if (ds == null)
247:                    return null;
248:
249:                if (!ds.getAutoBind())
250:                    return null;
251:                return ds;
252:            }
253:
254:            private String getDataStoreExpression(String sDatasource) {
255:                String dataSource = sDatasource;
256:
257:                if (dataSource == null)
258:                    return null;
259:
260:                int pos = dataSource.indexOf(":");
261:                if (pos == -1)
262:                    return null;
263:                else
264:                    return dataSource.substring(pos + 1);
265:
266:            }
267:
268:            /**
269:             *Does the binding for the component. This method is called by the framework and should not be called directly
270:             */
271:            public void doBinding() throws Exception {
272:                DataStoreBuffer ds = getDataStoreBuffer(getForwardDatasource());
273:                String dsExp = getDataStoreExpression(getForwardDatasource());
274:                if (ds == null)
275:                    return;
276:                setForwardHrefExpression(ds, ((JspController) getPage())
277:                        .convertExpressionOperators(dsExp));
278:                ds = getDataStoreBuffer(getBackwardDatasource());
279:                dsExp = getDataStoreExpression(getBackwardDatasource());
280:                if (ds == null)
281:                    return;
282:                setBackwardHrefExpression(ds, ((JspController) getPage())
283:                        .convertExpressionOperators(dsExp));
284:                ds = getDataStoreBuffer(getTimerDatasource());
285:                dsExp = getDataStoreExpression(getTimerDatasource());
286:                if (ds == null)
287:                    return;
288:                setTimerHrefExpression(ds, ((JspController) getPage())
289:                        .convertExpressionOperators(dsExp));
290:            }
291:
292:            /**
293:             * This method gets the Forward Href.
294:             * @return String
295:             */
296:            public String getOnEnterForwardHref() {
297:                return _onenterforward;
298:            }
299:
300:            /**
301:             * This method sets the Forward Href.
302:             * @return String
303:             */
304:            public void setOnEnterForwardHref(String _onenterforward) {
305:                this ._onenterforward = _onenterforward;
306:            }
307:
308:            /**
309:             * This method gets the Backward Href.
310:             * @return String
311:             */
312:            public String getOnEnterBackwardHref() {
313:                return _onenterbackward;
314:            }
315:
316:            /**
317:             * This method sets the Backward Href.
318:             * @return String
319:             */
320:            public void setOnEnterBackwardHref(String _onenterbackward) {
321:                this ._onenterbackward = _onenterbackward;
322:            }
323:
324:            /**
325:             * This method gets the Timer Href.
326:             * @return String
327:             */
328:            public String getOnTimerHref() {
329:                return _ontimer;
330:            }
331:
332:            /**
333:             * This method sets the Timer Href.
334:             * @return String
335:             */
336:            public void setOnTimerHref(String _ontimer) {
337:                this ._ontimer = _ontimer;
338:            }
339:
340:            /**
341:             * This method gets the value of newcontext attribute.
342:             * @return boolean
343:             */
344:            public boolean isNewContext() {
345:                return _newcontext;
346:            }
347:
348:            /**
349:             * This method sets the value of newcontext attribute.
350:             * @return boolean
351:             */
352:            public void setNewContext(boolean _newcontext) {
353:                this ._newcontext = _newcontext;
354:            }
355:
356:            /**
357:             * This method gets the value of ordered attribute.
358:             * @return boolean
359:             */
360:            public boolean isOrdered() {
361:                return _ordered;
362:            }
363:
364:            /**
365:             * This method sets the value of ordered attribute.
366:             * @return boolean
367:             */
368:            public void setOrdered(boolean _ordered) {
369:                this ._ordered = _ordered;
370:            }
371:
372:            /**
373:             * Creates a new WML Card
374:             */
375:            public WmlCard(String name, HtmlPage p) {
376:                super (name, p);
377:            }
378:
379:            /**
380:             * Returns the title of the card
381:             */
382:
383:            public String getTitle() {
384:                return _title;
385:            }
386:
387:            /**
388:             * Sets the title of the card.
389:             */
390:
391:            public void setTitle(String title) {
392:                _title = title;
393:            }
394:
395:            /**
396:             *Generates the Html for the component. This method is called by the framework and should not be called directly
397:             */
398:            public void generateHTML(TagWriter t, String card, int rowNo)
399:                    throws java.io.IOException {
400:                StringBuffer sb = new StringBuffer();
401:
402:                String sRow = "";
403:                if (rowNo >= 0)
404:                    sRow = "_" + rowNo;
405:
406:                StringBuffer hrefOEB = null;
407:                try {
408:                    if (_dsBackwardEval != null) {
409:                        if (rowNo > -1) {
410:                            _onenterbackward = _dsBackwardEval
411:                                    .evaluateRowFormat(rowNo);
412:                        } else {
413:                            _onenterbackward = _dsBackwardEval
414:                                    .evaluateRowFormat();
415:                        }
416:                    }
417:                } catch (Exception e) {
418:                }
419:                // sr 12-08-2000 was getting a null pointer exception
420:                if (!Util.isNull(_onenterbackward)) {
421:                    hrefOEB = new StringBuffer(_onenterbackward);
422:                    int hrefLength = hrefOEB.length();
423:                    for (int i = 0; i < hrefLength; i++) {
424:                        if (hrefOEB.charAt(i) == ' ') {
425:                            hrefOEB.setCharAt(i, '+');
426:                        }
427:                    }
428:                }
429:
430:                StringBuffer hrefOEF = null;
431:                try {
432:                    if (_dsForwardEval != null) {
433:                        if (rowNo > -1) {
434:                            _onenterforward = _dsForwardEval
435:                                    .evaluateRowFormat(rowNo);
436:                        } else {
437:                            _onenterforward = _dsForwardEval
438:                                    .evaluateRowFormat();
439:                        }
440:                    }
441:                } catch (Exception e) {
442:                }
443:                // sr 12-08-2000 was getting a null pointer exception
444:                if (!Util.isNull(_onenterforward)) {
445:                    hrefOEF = new StringBuffer(_onenterforward);
446:                    int hrefLength = hrefOEF.length();
447:                    for (int i = 0; i < hrefLength; i++) {
448:                        if (hrefOEF.charAt(i) == ' ') {
449:                            hrefOEF.setCharAt(i, '+');
450:                        }
451:                    }
452:                }
453:
454:                StringBuffer hrefOT = null;
455:                try {
456:                    if (_dsTimerEval != null) {
457:                        if (rowNo > -1) {
458:                            _ontimer = _dsTimerEval.evaluateRowFormat(rowNo);
459:                        } else {
460:                            _ontimer = _dsBackwardEval.evaluateRowFormat();
461:                        }
462:                    }
463:                } catch (Exception e) {
464:                }
465:                // sr 12-08-2000 was getting a null pointer exception
466:                if (!Util.isNull(_ontimer)) {
467:                    hrefOT = new StringBuffer(_ontimer);
468:                    int hrefLength = hrefOT.length();
469:                    for (int i = 0; i < hrefLength; i++) {
470:                        if (hrefOT.charAt(i) == ' ') {
471:                            hrefOT.setCharAt(i, '+');
472:                        }
473:                    }
474:                }
475:
476:                sb.append("<card");
477:                if (getName() != null)
478:                    sb.append(" id=\"" + getName() + sRow + "\"");
479:                if (_class != null)
480:                    sb.append(" class=\"" + _class + "\"");
481:                if (_title != null)
482:                    sb.append(" title=\"" + _title + "\"");
483:                if (_newcontext)
484:                    sb.append(" newcontext=\"" + _newcontext + "\"");
485:                if (!_ordered)
486:                    sb.append(" ordered=\"" + _ordered + "\"");
487:                if (_onenterbackward != null)
488:                    sb
489:                            .append(" onenterbackward=\"" + encodeURL(hrefOEB)
490:                                    + "\"");
491:                if (_onenterforward != null)
492:                    sb.append(" onenterforward=\"" + encodeURL(hrefOEF) + "\"");
493:                if (_onenterbackward != null)
494:                    sb.append(" ontimer=\"" + encodeURL(hrefOT) + "\"");
495:                sb.append(">");
496:                t.print(sb.toString(), TagWriter.TYPE_BEGIN_TAG);
497:                t.print(card, TagWriter.TYPE_CONTENT);
498:                t.print("</card>", TagWriter.TYPE_END_TAG);
499:            }
500:
501:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.