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


0001:        //** Copyright Statement ***************************************************
0002:        //The Salmon Open Framework for Internet Applications (SOFIA)
0003:        // Copyright (C) 1999 - 2002, Salmon LLC
0004:        //
0005:        // This program is free software; you can redistribute it and/or
0006:        // modify it under the terms of the GNU General Public License version 2
0007:        // as published by the Free Software Foundation;
0008:        // 
0009:        // This program is distributed in the hope that it will be useful,
0010:        // but WITHOUT ANY WARRANTY; without even the implied warranty of
0011:        // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012:        // GNU General Public License for more details.
0013:        // 
0014:        // You should have received a copy of the GNU General Public License
0015:        // along with this program; if not, write to the Free Software
0016:        // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
0017:        // 
0018:        // For more information please visit http://www.salmonllc.com
0019:        //** End Copyright Statement ***************************************************
0020:        package com.salmonllc.html;
0021:
0022:        /////////////////////////
0023:        //$Archive: /SOFIA/SourceCode/com/salmonllc/html/HtmlComponentFactory.java $
0024:        //$Author: Dan $
0025:        //$Revision: 26 $
0026:        //$Modtime: 6/11/03 4:39p $
0027:        /////////////////////////
0028:
0029:        import com.salmonllc.html.events.SubmitListener;
0030:        import com.salmonllc.html.events.ValueChangedListener;
0031:        import com.salmonllc.properties.Props;
0032:        import com.salmonllc.sql.DataStore;
0033:        import com.salmonllc.util.MessageLog;
0034:
0035:        /**
0036:         * This class can be used to reduce the coding involved in creating a data entry or data browsing screen. The methods in the factory will create the components and automatically bind them to columns in a DataStore, creating the DataStore in the process. Each component must then be added to the page.
0037:         * The datastore component created by the factory can be accessed via a call to the getDataStore method.
0038:         */
0039:        public class HtmlComponentFactory {
0040:            DataStore _ds;
0041:            HtmlPage _page;
0042:            SubmitListener _sl;
0043:            ValueChangedListener _vl;
0044:            String _theme;
0045:
0046:            public static String DATE_FORMAT;
0047:            public static String TIME_FORMAT;
0048:            public static String DATETIME_FORMAT;
0049:            public static String CURRENCY_FORMAT;
0050:            public static String INT_FORMAT = "########################";
0051:
0052:            /**
0053:             * Constructs a new HtmlComponent Factory for the page.
0054:             * @param p The page to create the factory for.
0055:             * @param submit The SubmitListener that will listen for submit events generated by components created in this factory. Set it to null if you don't want the components to generate submit events.
0056:             * @param value The ValueChangedListener that will listen for value changed events generated by components created in this factory. Set it to null if you don't want the components to generate value changed events.
0057:             */
0058:            public HtmlComponentFactory(HtmlPage p, SubmitListener submit,
0059:                    ValueChangedListener value) {
0060:
0061:                this (p, submit, value, null);
0062:            }
0063:
0064:            /**
0065:             * Constructs a new HtmlComponent Factory for the page.
0066:             * @param p The page to create the factory for.
0067:             * @param submit The SubmitListener that will listen for submit events generated by components created in this factory. Set it to null if you don't want the components to generate submit events.
0068:             * @param value The ValueChangedListener that will listen for value changed events generated by components created in this factory. Set it to null if you don't want the components to generate value changed events.
0069:             * @param theme The theme to use for loading properties.
0070:             */
0071:            public HtmlComponentFactory(HtmlPage p, SubmitListener submit,
0072:                    ValueChangedListener value, String theme) {
0073:
0074:                super ();
0075:                _page = p;
0076:                _sl = submit;
0077:                _vl = value;
0078:                _ds = new DataStore(p.getApplicationName());
0079:
0080:                _theme = theme;
0081:
0082:                Props pr = p.getPageProperties();
0083:
0084:                DATE_FORMAT = pr.getThemeProperty(theme, Props.DATE_FORMAT);
0085:                TIME_FORMAT = pr.getThemeProperty(theme, Props.DATE_FORMAT);
0086:                DATETIME_FORMAT = pr.getThemeProperty(theme,
0087:                        Props.DATETIME_FORMAT);
0088:                CURRENCY_FORMAT = pr.getThemeProperty(theme,
0089:                        Props.CURRENCY_FORMAT);
0090:            }
0091:
0092:            /**
0093:             * Constructs a new HtmlComponent Factory for the page.
0094:             * @param p The page to create the factory for.
0095:             * @param submit The SubmitListener that will listen for submit events generated by components created in this factory. Set it to null if you don't want the components to generate submit events.
0096:             * @param value The ValueChangedListener that will listen for value changed events generated by components created in this factory. Set it to null if you don't want the components to generate value changed events.
0097:             * @param theme The theme to use for loading properties.
0098:             * @param ds DataStore		Data store object to use, if null then create one.
0099:             */
0100:            public HtmlComponentFactory(HtmlPage p, SubmitListener submit,
0101:                    ValueChangedListener value, String theme, DataStore ds) {
0102:                super ();
0103:                _page = p;
0104:                _sl = submit;
0105:                _vl = value;
0106:                if (ds == null) {
0107:                    _ds = new DataStore(p.getApplicationName());
0108:                } else {
0109:                    _ds = ds;
0110:                }
0111:                _theme = theme;
0112:                Props pr = p.getPageProperties();
0113:                DATE_FORMAT = pr.getThemeProperty(theme, Props.DATE_FORMAT);
0114:                TIME_FORMAT = pr.getThemeProperty(theme, Props.DATE_FORMAT);
0115:                DATETIME_FORMAT = pr.getThemeProperty(theme,
0116:                        Props.DATETIME_FORMAT);
0117:                CURRENCY_FORMAT = pr.getThemeProperty(theme,
0118:                        Props.CURRENCY_FORMAT);
0119:            }
0120:
0121:            /**
0122:             * This method returns the DataStore created by creating components in the factory.
0123:             */
0124:            public DataStore getDataStore() {
0125:                return _ds;
0126:            }
0127:
0128:            /**
0129:             * This method creates a new Computed Column in the DataStore.
0130:             * @param expression The compute Expression.
0131:             * @param format The format to display the results.
0132:             * @see DataStoreEvaluator
0133:             * @see DataStore#setFormat
0134:             */
0135:            public HtmlText newComputedColumn(String expression, String format) {
0136:                return newComputedColumn("", expression, format);
0137:            }
0138:
0139:            /**
0140:             * This method creates a new Computed Column in the DataStore.
0141:             * @param expression The name of the compute Expression.
0142:             * @param expression The compute Expression.
0143:             * @param format The format to display the results.
0144:             * @see DataStoreEvaluator
0145:             * @see DataStore#setFormat
0146:             */
0147:            public HtmlText newComputedColumn(String name, String expression,
0148:                    String format) {
0149:                HtmlText computed = new HtmlText(name, "",
0150:                        HtmlText.FONT_DEFAULT, _page, _theme);
0151:                try {
0152:                    computed.setExpression(_ds, expression, format);
0153:                } catch (Exception e) {
0154:                    computed.setText(e.getMessage());
0155:                }
0156:                return computed;
0157:            }
0158:
0159:            /**
0160:             * This method will create an HtmlDataTable from a select statement.
0161:             * @param select The select statement to build the datatable from
0162:             */
0163:            public HtmlDataTable newDataTable(String select) throws Exception {
0164:                _ds.buildBuffer(select);
0165:                HtmlDataTable ret = new HtmlDataTable("", _ds, _page);
0166:                int cc = _ds.getColumnCount();
0167:                for (int i = 0; i < cc; i++) {
0168:                    String name = _ds.getColumnName(i);
0169:                    int type = _ds.getColumnDataType(i);
0170:
0171:                    String format = null;
0172:                    if (type == DataStore.DATATYPE_DATE)
0173:                        format = DATE_FORMAT;
0174:                    else if (type == DataStore.DATATYPE_DATETIME)
0175:                        format = DATETIME_FORMAT;
0176:
0177:                    HtmlText col = new HtmlText("", "", HtmlText.FONT_DEFAULT,
0178:                            _page, _theme);
0179:                    col.setExpression(_ds, name, format);
0180:                    ret.setRowComponentAt(i, col);
0181:
0182:                    StringBuffer disp = new StringBuffer(name.length());
0183:                    for (int j = 0; j < name.length(); j++) {
0184:                        char c = name.charAt(j);
0185:                        if (c == '.')
0186:                            disp.append("<BR>");
0187:                        else if (c == '_')
0188:                            disp.append(' ');
0189:                        else
0190:                            disp.append(c);
0191:                    }
0192:
0193:                    HtmlText cap = newTableCaption(disp.toString());
0194:                    cap.setFixSpecialHtmlCharacters(false);
0195:
0196:                    ret.setHeadingComponentAt(i, cap);
0197:
0198:                }
0199:                return ret;
0200:            }
0201:
0202:            /**
0203:             * This method creates a new Date Display Column.
0204:             * @param table The table that the column is in.
0205:             * @param column The data column.
0206:             * @param primaryKey True if the column is part of the primary key.
0207:             * @param format The display format for the Date Time
0208:             * @see DataStore#setFormat
0209:             */
0210:            public HtmlText newDateDisplay(String table, String column,
0211:                    boolean primaryKey) {
0212:                return newDisplayColumn(table, column, primaryKey,
0213:                        DataStore.DATATYPE_DATE, DATE_FORMAT);
0214:            }
0215:
0216:            /**
0217:             * This method creates a new Date Display Column.
0218:             * @param table The table that the column is in.
0219:             * @param column The data column.
0220:             * @param primaryKey True if the column is part of the primary key.
0221:             * @param format The display format for the Date Time.
0222:             * @see DataStore#setFormat
0223:             */
0224:            public HtmlText newDateDisplay(String table, String column,
0225:                    boolean primaryKey, String format) {
0226:                return newDisplayColumn(table, column, primaryKey,
0227:                        DataStore.DATATYPE_DATE, format);
0228:            }
0229:
0230:            /**
0231:             * This method creates a new Date Edit Column.
0232:             * @param table The table that the column is in.
0233:             * @param column The data column.
0234:             * @param primaryKey True if the column is part of the primary key.
0235:             * @param size the number of characters to display in the component.
0236:             */
0237:            public HtmlTextEdit newDateEdit(String table, String column,
0238:                    boolean primaryKey, int size) {
0239:                return newEditColumn(table, column, primaryKey, size, 25,
0240:                        DataStore.DATATYPE_DATE, DATE_FORMAT);
0241:            }
0242:
0243:            /**
0244:             * This method creates a new Date Time Display Column.
0245:             * @param table The table that the column is in.
0246:             * @param column The data column.
0247:             * @param primaryKey True if the column is part of the primary key.
0248:             * @param format The display format for the Date Time
0249:             * @see DataStore#setFormat
0250:             */
0251:            public HtmlText newDateTimeDisplay(String table, String column,
0252:                    boolean primaryKey) {
0253:                return newDisplayColumn(table, column, primaryKey,
0254:                        DataStore.DATATYPE_DATETIME, DATETIME_FORMAT);
0255:            }
0256:
0257:            /**
0258:             * This method creates a new Date Time Display Column.
0259:             * @param table The table that the column is in.
0260:             * @param column The data column.
0261:             * @param primaryKey True if the column is part of the primary key.
0262:             * @param format The display format for the Date Time.
0263:             * @see DataStore#setFormat
0264:             */
0265:            public HtmlText newDateTimeDisplay(String table, String column,
0266:                    boolean primaryKey, String format) {
0267:                return newDisplayColumn(table, column, primaryKey,
0268:                        DataStore.DATATYPE_DATETIME, format);
0269:            }
0270:
0271:            /**
0272:             * This method creates a new DateTime Text Edit Column.
0273:             * @param table The table that the column is in.
0274:             * @param column The data column.
0275:             * @param primaryKey True if the column is part of the primary key.
0276:             * @param size The number of characters to display in the component.
0277:             */
0278:
0279:            public HtmlTextEdit newDateTimeEdit(String table, String column,
0280:                    boolean primaryKey, int size) {
0281:                return newEditColumn(table, column, primaryKey, size, 25,
0282:                        DataStore.DATATYPE_DATETIME, DATETIME_FORMAT);
0283:            }
0284:
0285:            /**
0286:             * This method creates a new DateTime Text Edit Column.
0287:             * @param table The table that the column is in.
0288:             * @param column The data column.
0289:             * @param primaryKey True if the column is part of the primary key.
0290:             * @param size The number of characters to display in the component.
0291:             * @param format The display format for the date time.
0292:             * @see DataStore#setFormat
0293:             */
0294:
0295:            public HtmlTextEdit newDateTimeEdit(String table, String column,
0296:                    boolean primaryKey, int size, String format) {
0297:                return newEditColumn(table, column, primaryKey, size, 25,
0298:                        DataStore.DATATYPE_DATETIME, format);
0299:            }
0300:
0301:            /**
0302:             * This method creates a new caption for a detail screen.
0303:             * @param caption The text for the caption.
0304:             */
0305:            public HtmlText newDetailCaption(String caption) {
0306:                return new HtmlText(caption, HtmlText.FONT_COLUMN_CAPTION,
0307:                        _page, _theme);
0308:            }
0309:
0310:            /**
0311:             * This method creates a new caption for a detail screen.
0312:             * @param name The name for the caption.
0313:             * @param caption The text for the caption.
0314:             */
0315:            public HtmlText newDetailCaption(String name, String caption) {
0316:                return new HtmlText(name, caption,
0317:                        HtmlText.FONT_COLUMN_CAPTION, _page, _theme);
0318:            }
0319:
0320:            /**
0321:             * This method was created in VisualAge.
0322:             * @return com.salmonllc.html.HtmlTextEdit
0323:             * @param table java.lang.String
0324:             * @param column java.lang.String
0325:             * @param primaryKey boolean
0326:             * @param size int
0327:             * @param length int
0328:             */
0329:            private HtmlText newDisplayBucket(String bucket, int datatype,
0330:                    String format) {
0331:                HtmlText ret = new HtmlText(bucket, "", HtmlText.FONT_DEFAULT,
0332:                        _page, _theme);
0333:                _ds.addBucket(bucket, datatype);
0334:                try {
0335:                    ret.setExpression(_ds, bucket, format);
0336:                } catch (Exception e) {
0337:                }
0338:
0339:                return ret;
0340:            }
0341:
0342:            /**
0343:             * This method was created in VisualAge.
0344:             * @return com.salmonllc.html.HtmlTextEdit
0345:             * @param table java.lang.String
0346:             * @param column java.lang.String
0347:             * @param primaryKey boolean
0348:             * @param size int
0349:             * @param length int
0350:             */
0351:            private HtmlText newDisplayColumn(String table, String column,
0352:                    boolean primaryKey, int datatype, String format) {
0353:                HtmlText ret = new HtmlText(table + "_" + column, "",
0354:                        HtmlText.FONT_DEFAULT, _page, _theme);
0355:                _ds.addColumn(table, column, datatype, primaryKey, true);
0356:                try {
0357:                    ret.setExpression(_ds, table + "." + column, format);
0358:                } catch (Exception e) {
0359:                }
0360:
0361:                return ret;
0362:            }
0363:
0364:            /**
0365:             * This method creates a new Double Display Column.
0366:             * @param table The table that the column is in.
0367:             * @param column The data column.
0368:             * @param primaryKey True if the column is part of the primary key.
0369:             */
0370:            public HtmlText newDoubleDisplay(String table, String column,
0371:                    boolean primaryKey) {
0372:                return newDisplayColumn(table, column, primaryKey,
0373:                        DataStore.DATATYPE_DOUBLE, CURRENCY_FORMAT);
0374:            }
0375:
0376:            /**
0377:             * This method creates a new Double Display Column.
0378:             * @param table The table that the column is in.
0379:             * @param column The data column.
0380:             * @param primaryKey True if the column is part of the primary key.
0381:             * @param format The display format for the double.
0382:             * @see DataStore#setFormat
0383:             */
0384:            public HtmlText newDoubleDisplay(String table, String column,
0385:                    boolean primaryKey, String format) {
0386:                return newDisplayColumn(table, column, primaryKey,
0387:                        DataStore.DATATYPE_DOUBLE, format);
0388:            }
0389:
0390:            /**
0391:             * This method creates a new Double Edit Column.
0392:             * @param table The table that the column is in.
0393:             * @param column The data column.
0394:             * @param primaryKey True if the column is part of the primary key.
0395:             * @param size the number of characters to display in the component.
0396:             */
0397:
0398:            public HtmlTextEdit newDoubleEdit(String table, String column,
0399:                    boolean primaryKey, int size) {
0400:                return newEditColumn(table, column, primaryKey, size, 25,
0401:                        DataStore.DATATYPE_DOUBLE, CURRENCY_FORMAT);
0402:            }
0403:
0404:            /**
0405:             * This method creates a new Double Edit Column.
0406:             * @param table The table that the column is in.
0407:             * @param column The data column.
0408:             * @param primaryKey True if the column is part of the primary key.
0409:             * @param size the number of characters to display in the component.
0410:             * @param format The display format for the Double.
0411:             * @see DataStore#setFormat
0412:             */
0413:
0414:            public HtmlTextEdit newDoubleEdit(String table, String column,
0415:                    boolean primaryKey, int size, String format) {
0416:                return newEditColumn(table, column, primaryKey, size, 25,
0417:                        DataStore.DATATYPE_DOUBLE, format);
0418:            }
0419:
0420:            /**
0421:             * This method was created in VisualAge.
0422:             * @return com.salmonllc.html.HtmlTextEdit
0423:             * @param table java.lang.String
0424:             * @param column java.lang.String
0425:             * @param primaryKey boolean
0426:             * @param size int
0427:             * @param length int
0428:             */
0429:            private HtmlTextEdit newEditColumn(String table, String column,
0430:                    boolean primaryKey, int size, int length, int datatype,
0431:                    String format) {
0432:                HtmlTextEdit ret = new HtmlTextEdit(table + "_" + column,
0433:                        _theme, _page);
0434:                if (_vl != null)
0435:                    ret.addValueChangedListener(_vl);
0436:                ret.setSize(size);
0437:                ret.setMaxLength(length);
0438:                _ds.addColumn(table, column, datatype, primaryKey, true);
0439:                ret.setColumn(_ds, table + "." + column);
0440:                if (format != null) {
0441:                    try {
0442:                        _ds.setFormat(table + "." + column, format);
0443:                    } catch (Exception e) {
0444:                    }
0445:                }
0446:                return ret;
0447:            }
0448:
0449:            /**
0450:             * Use this method to create an e-mail (send to) link.
0451:             * @param name The name for the component.
0452:             * @param text The Text to display under the link.
0453:             * @param address The address of the person to send the mail to.
0454:             */
0455:            public HtmlLink newEmailLink(String name, String text,
0456:                    String address) {
0457:                HtmlLink l = new HtmlLink(name, "mailto:" + address, _page);
0458:                HtmlText t = new HtmlText(text, HtmlText.FONT_LINK, _page,
0459:                        _theme);
0460:                l.add(t);
0461:                return l;
0462:            }
0463:
0464:            /**
0465:             * Use this method to create an e-mail (mail to) link.
0466:             * @param name The name for the component.
0467:             * @param text The Text to display under the link.
0468:             * @param address The address of the person to send the mail to.
0469:             * @param font The Font to use (HtmlText.FONT_...).
0470:             */
0471:            public HtmlLink newEmailLink(String name, String text,
0472:                    String address, String font) {
0473:                HtmlLink l = new HtmlLink(name, "mailto:" + address, _page);
0474:                HtmlText t = new HtmlText(text, font, _page, _theme);
0475:                l.add(t);
0476:                return l;
0477:            }
0478:
0479:            /**
0480:             * This method creates a new String Display Column.
0481:             * @param table The table that the column is in.
0482:             * @param column The data column.
0483:             * @param primaryKey True if the column is part of the primary key.
0484:             * @param format The display format for the integer.
0485:             * @see DataStore#setFormat
0486:             */
0487:            public HtmlLink newEMailLink(String table, String column,
0488:                    String font, boolean primaryKey) {
0489:                HtmlText t = newStringDisplay(table, column, primaryKey);
0490:                t.setFont(font);
0491:                HtmlLink l = new HtmlLink(table + "_" + column, "", "", _page);
0492:                try {
0493:                    l.setHrefExpression(_ds, "'MailTo:'+contact.email_address");
0494:                } catch (Exception e) {
0495:                }
0496:                l.add(t);
0497:                return l;
0498:            }
0499:
0500:            public HtmlLink newEMailLink(String table, String column,
0501:                    boolean primaryKey) {
0502:                HtmlText t = newStringDisplay(table, column, primaryKey);
0503:                HtmlLink l = new HtmlLink(table + "_" + column, "", "", _page);
0504:                try {
0505:                    l.setHrefExpression(_ds, "'MailTo:'+contact.email_address");
0506:                } catch (Exception e) {
0507:                }
0508:                l.add(t);
0509:                return l;
0510:            }
0511:
0512:            /**
0513:             * This method creates a new Float Edit Column.
0514:             * @param table The table that the column is in.
0515:             * @param column The data column.
0516:             * @param primaryKey True if the column is part of the primary key.
0517:             * @param size the number of characters to display in the component.
0518:             * @param format The display format for the Float.
0519:             * @see DataStore#setFormat
0520:             */
0521:            public HtmlTextEdit newFloatEdit(String table, String column,
0522:                    boolean primaryKey, int size, String format) {
0523:                return newEditColumn(table, column, primaryKey, size, 25,
0524:                        DataStore.DATATYPE_FLOAT, format);
0525:            }
0526:
0527:            /**
0528:             * This method creates a new caption for a detail screen.
0529:             * @param caption The text for the caption.
0530:             */
0531:            public HtmlText newHighlightCaption(String name, String caption) {
0532:                return new HtmlText(name, caption, HtmlText.FONT_EMPHASIS,
0533:                        _page, _theme);
0534:            }
0535:
0536:            /**
0537:             * Constructs an HtmlLink component containing an image.
0538:             * @return HtmlLink
0539:             * @param name		The name of the link.
0540:             * @param source	The source for the image.
0541:             * @param href		The URL for the link.
0542:             * @param target	The target for the link.
0543:             * @param p			The page the link will go in.
0544:             */
0545:            public static HtmlLink newImageHyperLink(String name,
0546:                    String source, String href, String target, HtmlPage p)
0547:                    throws Exception {
0548:                HtmlLink link = new HtmlLink(name, href, target, p);
0549:                HtmlImage linkImage = new HtmlImage(name + "_image", source, p);
0550:                link.add(linkImage);
0551:                return link;
0552:            }
0553:
0554:            /**
0555:             * Use this method to create a image button link that changes it's gif or jpeg when the mouse passes over it.
0556:             * @param name The name for the component.
0557:             * @param normalImage The url of the image used when the mouse is not on the component
0558:             * @param highlightImage The url of the image used when the mouse is on the component
0559:             * @param href The link to go to when the image is clicked
0560:             * @param target The target frame to use
0561:             */
0562:            public HtmlLink newImageLink(String name, String normalImage,
0563:                    String highlightImage, String href, String target) {
0564:                HtmlLink l = new HtmlLink("", href, target, _page);
0565:                HtmlImage i = new HtmlImage(name, normalImage, _page);
0566:                if (highlightImage != null
0567:                        && !normalImage.equals(highlightImage)) {
0568:                    l.setOnMouseOver("document." + i.getFullName() + ".src='"
0569:                            + highlightImage + "';");
0570:                    l.setOnMouseOut("document." + i.getFullName() + ".src='"
0571:                            + normalImage + "';");
0572:                }
0573:
0574:                l.add(i);
0575:                return l;
0576:            }
0577:
0578:            /**
0579:             * This creates a integer bucket.
0580:             */
0581:            public HtmlText newIntegerBucket(String bucket) {
0582:                return newDisplayBucket(bucket, DataStore.DATATYPE_INT, null);
0583:            }
0584:
0585:            /**
0586:             * This creates a integer bucket.
0587:             */
0588:            public HtmlText newIntegerBucket(String bucket, String format) {
0589:                return newDisplayBucket(bucket, DataStore.DATATYPE_INT, format);
0590:            }
0591:
0592:            /**
0593:             * This method creates a new Check Box for an integer column.
0594:             * @param table The table that the column is in.
0595:             * @param column The data column.
0596:             * @param primaryKey True if the column is part of the primary key.
0597:             * @param int trueValue The value of the check box if it is checked.
0598:             * @param int falseValue The value of the check box if it is not checked.
0599:             */
0600:            public HtmlCheckBox newIntegerCheckBox(String table, String column,
0601:                    boolean primaryKey, int trueValue, int falseValue) {
0602:                String t = new Integer(trueValue).toString();
0603:                String f = new Integer(falseValue).toString();
0604:                HtmlCheckBox ret = new HtmlCheckBox(table + "_" + column,
0605:                        _theme, _page, t, f);
0606:                if (_vl != null)
0607:                    ret.addValueChangedListener(_vl);
0608:                _ds.addColumn(table, column, DataStore.DATATYPE_INT,
0609:                        primaryKey, true);
0610:                ret.setColumn(_ds, table + "." + column);
0611:                return ret;
0612:            }
0613:
0614:            /**
0615:             * This method creates a new Integer Display Column.
0616:             * @param table The table that the column is in.
0617:             * @param column The data column.
0618:             * @param primaryKey True if the column is part of the primary key.
0619:             */
0620:            public HtmlText newIntegerDisplay(String table, String column,
0621:                    boolean primaryKey) {
0622:                return newDisplayColumn(table, column, primaryKey,
0623:                        DataStore.DATATYPE_INT, null);
0624:            }
0625:
0626:            /**
0627:             * This method creates a new Integer Display Column.
0628:             * @param table The table that the column is in.
0629:             * @param column The data column.
0630:             * @param primaryKey True if the column is part of the primary key.
0631:             * @param format The display format for the integer.
0632:             * @see DataStore#setFormat
0633:             */
0634:            public HtmlText newIntegerDisplay(String table, String column,
0635:                    boolean primaryKey, String format) {
0636:                return newDisplayColumn(table, column, primaryKey,
0637:                        DataStore.DATATYPE_INT, format);
0638:            }
0639:
0640:            /**
0641:             * This method creates a new Drop Down List Box for an integer column.
0642:             * @param table The table that the column is in.
0643:             * @param column The data column.
0644:             * @param primaryKey True if the column is part of the primary key.
0645:             * @param int[] values A list of values for the column.
0646:             * @param String[] dispValues A list of corresponding display values for each of the values for the column.
0647:             */
0648:            public HtmlDropDownList newIntegerDropDownList(String table,
0649:                    String column, boolean primaryKey, int[] values,
0650:                    String[] displayValues) {
0651:                HtmlDropDownList ret = new HtmlDropDownList(table + "_"
0652:                        + column, _theme, _page);
0653:                if (_vl != null)
0654:                    ret.addValueChangedListener(_vl);
0655:                _ds.addColumn(table, column, DataStore.DATATYPE_INT,
0656:                        primaryKey, true);
0657:                ret.setColumn(_ds, table + "." + column);
0658:
0659:                for (int i = 0; i < values.length; i++) {
0660:                    String value = new Integer(values[i]).toString();
0661:                    String displayValue = "Value " + i;
0662:                    if (i < displayValues.length)
0663:                        displayValue = displayValues[i];
0664:                    ret.addOption(value, displayValue);
0665:                }
0666:                return ret;
0667:            }
0668:
0669:            /**
0670:             * This method creates a new Integer Edit Column.
0671:             * @param table The table that the column is in.
0672:             * @param column The data column.
0673:             * @param primaryKey True if the column is part of the primary key.
0674:             * @param size The number of characters to display in the component.
0675:             */
0676:            public HtmlTextEdit newIntegerEdit(String table, String column,
0677:                    boolean primaryKey, int size) {
0678:                return newEditColumn(table, column, primaryKey, size, 25,
0679:                        DataStore.DATATYPE_INT, null);
0680:            }
0681:
0682:            /**
0683:             * This method creates a new Integer Edit Column.
0684:             * @param table The table that the column is in.
0685:             * @param column The data column.
0686:             * @param primaryKey True if the column is part of the primary key.
0687:             * @param size The number of characters to display in the component.
0688:             * @param format The display format for the date time.
0689:             * @see DataStore#setFormat
0690:             */
0691:            public HtmlTextEdit newIntegerEdit(String table, String column,
0692:                    boolean primaryKey, int size, String format) {
0693:                return newEditColumn(table, column, primaryKey, size, 25,
0694:                        DataStore.DATATYPE_INT, format);
0695:            }
0696:
0697:            /**
0698:             * This method creates a new Radio Button Group an integer column.
0699:             * @param table The table that the column is in.
0700:             * @param column The data column.
0701:             * @param primaryKey True if the column is part of the primary key.
0702:             * @param int[] values A list of values for the column.
0703:             * @param String[] dispValues A list of corresponding display values for each of the values for the column.
0704:             */
0705:            public HtmlRadioButtonGroup newIntegerRadioButtonGroup(
0706:                    String table, String column, boolean primaryKey,
0707:                    int[] values, String[] displayValues) {
0708:                HtmlRadioButtonGroup ret = new HtmlRadioButtonGroup(table + "_"
0709:                        + column, _theme, _page);
0710:                if (_vl != null)
0711:                    ret.addValueChangedListener(_vl);
0712:                _ds.addColumn(table, column, DataStore.DATATYPE_INT,
0713:                        primaryKey, true);
0714:                ret.setColumn(_ds, table + "." + column);
0715:
0716:                for (int i = 0; i < values.length; i++) {
0717:                    String value = new Integer(values[i]).toString();
0718:                    String displayValue = "Value " + i;
0719:                    if (i < displayValues.length)
0720:                        displayValue = displayValues[i];
0721:                    ret.addOption(value, displayValue);
0722:                }
0723:                return ret;
0724:            }
0725:
0726:            /**
0727:             * This method creates a new Long Edit Column.
0728:             * @param table The table that the column is in.
0729:             * @param column The data column.
0730:             * @param primaryKey True if the column is part of the primary key.
0731:             * @param size The number of characters to display in the component.
0732:             * @param format The display format for the date time.
0733:             * @see DataStore#setFormat
0734:             */
0735:            public HtmlTextEdit newLongEdit(String table, String column,
0736:                    boolean primaryKey, int size, String format) {
0737:                return newEditColumn(table, column, primaryKey, size, 25,
0738:                        DataStore.DATATYPE_LONG, format);
0739:            }
0740:
0741:            /**
0742:             * This method creates a new Multi Line Edit for a string column.
0743:             * @param table The table that the column is in.
0744:             * @param column The data column.
0745:             * @param primaryKey True if the column is part of the primary key.
0746:             * @param columns The number of characters to display across in the component.
0747:             * @param rows The number of characters to display down in the component.
0748:             * @param maxLength The maximum number of characters the user can enter into the component.
0749:             */
0750:            public HtmlMultiLineTextEdit newMultiLineEdit(String table,
0751:                    String column, boolean primaryKey, int columns, int rows,
0752:                    int maxLength) {
0753:                HtmlMultiLineTextEdit ret = new HtmlMultiLineTextEdit(table
0754:                        + "_" + column, _theme, _page);
0755:                if (_vl != null)
0756:                    ret.addValueChangedListener(_vl);
0757:                ret.setColumns(columns);
0758:                ret.setRows(rows);
0759:                ret.setMaxLength(maxLength);
0760:                _ds.addColumn(table, column, DataStore.DATATYPE_STRING,
0761:                        primaryKey, true);
0762:                ret.setColumn(_ds, table + "." + column);
0763:                return ret;
0764:            }
0765:
0766:            /**
0767:             * This method creates a new Short Edit Column.
0768:             * @param table The table that the column is in.
0769:             * @param column The data column.
0770:             * @param primaryKey True if the column is part of the primary key.
0771:             * @param size The number of characters to display in the component.
0772:             * @param format The display format for the date time.
0773:             * @see DataStore#setFormat
0774:             */
0775:            public HtmlTextEdit newShortEdit(String table, String column,
0776:                    boolean primaryKey, int size, String format) {
0777:                return newEditColumn(table, column, primaryKey, size, 25,
0778:                        DataStore.DATATYPE_SHORT, format);
0779:            }
0780:
0781:            /**
0782:             * This creates a string bucket.
0783:             */
0784:            public HtmlText newStringBucket(String bucket) {
0785:                return newDisplayBucket(bucket, DataStore.DATATYPE_STRING, null);
0786:            }
0787:
0788:            /**
0789:             * This method creates a new Check Box for an String column.
0790:             * @param table The table that the column is in.
0791:             * @param column The data column.
0792:             * @param primaryKey True if the column is part of the primary key.
0793:             * @param int trueValue The value of the check box if it is checked.
0794:             * @param int falseValue The value of the check box if it is not checked.
0795:             */
0796:            public HtmlCheckBox newStringCheckBox(String table, String column,
0797:                    boolean primaryKey, String trueValue, String falseValue) {
0798:                HtmlCheckBox ret = new HtmlCheckBox(table + "_" + column,
0799:                        _theme, _page, trueValue, falseValue);
0800:                if (_vl != null)
0801:                    ret.addValueChangedListener(_vl);
0802:                _ds.addColumn(table, column, DataStore.DATATYPE_STRING,
0803:                        primaryKey, true);
0804:                ret.setColumn(_ds, table + "." + column);
0805:                return ret;
0806:            }
0807:
0808:            /**
0809:             * This method creates a new String Display Column.
0810:             * @param table The table that the column is in.
0811:             * @param column The data column.
0812:             * @param primaryKey True if the column is part of the primary key.
0813:             * @param format The display format for the integer.
0814:             * @see DataStore#setFormat
0815:             */
0816:            public HtmlText newStringDisplay(String table, String column,
0817:                    boolean primaryKey) {
0818:                return newDisplayColumn(table, column, primaryKey,
0819:                        DataStore.DATATYPE_STRING, null);
0820:            }
0821:
0822:            /**
0823:             * This method creates a new Drop Down List Box for an String column.
0824:             * @param table The table that the column is in.
0825:             * @param column The data column.
0826:             * @param primaryKey True if the column is part of the primary key.
0827:             * @param String[] values A list of values for the column.
0828:             * @param String[] dispValues A list of corresponding display values for each of the values for the column.
0829:             */
0830:            public HtmlDropDownList newStringDropDownList(String table,
0831:                    String column, boolean primaryKey, String[] values,
0832:                    String[] displayValues) {
0833:                HtmlDropDownList ret = new HtmlDropDownList(table + "_"
0834:                        + column, _theme, _page);
0835:                if (_vl != null)
0836:                    ret.addValueChangedListener(_vl);
0837:                _ds.addColumn(table, column, DataStore.DATATYPE_STRING,
0838:                        primaryKey, true);
0839:                ret.setColumn(_ds, table + "." + column);
0840:
0841:                for (int i = 0; i < values.length; i++) {
0842:                    String value = values[i];
0843:                    String displayValue = "Value " + i;
0844:                    if (i < displayValues.length)
0845:                        displayValue = displayValues[i];
0846:                    ret.addOption(value, displayValue);
0847:                }
0848:                return ret;
0849:            }
0850:
0851:            /**
0852:             * This method creates a new String Edit Column.
0853:             * @param table The table that the column is in.
0854:             * @param column The data column.
0855:             * @param primaryKey True if the column is part of the primary key.
0856:             * @param size the number of characters to display in the component.
0857:             * @param length The maximum number of characters the user can enter into the component.
0858:             */
0859:            public HtmlTextEdit newStringEdit(String table, String column,
0860:                    boolean primaryKey, int size, int length) {
0861:                return newEditColumn(table, column, primaryKey, size, length,
0862:                        DataStore.DATATYPE_STRING, null);
0863:            }
0864:
0865:            /**
0866:             * This method creates a new Radio Button Group a String column.
0867:             * @param table The table that the column is in.
0868:             * @param column The data column.
0869:             * @param primaryKey True if the column is part of the primary key.
0870:             * @param String[] values A list of values for the column.
0871:             * @param String[] dispValues A list of corresponding display values for each of the values for the column.
0872:             */
0873:            public HtmlRadioButtonGroup newStringRadioButtonGroup(String table,
0874:                    String column, boolean primaryKey, String[] values,
0875:                    String[] displayValues) {
0876:                HtmlRadioButtonGroup ret = new HtmlRadioButtonGroup(table + "_"
0877:                        + column, _theme, _page);
0878:                if (_vl != null)
0879:                    ret.addValueChangedListener(_vl);
0880:                _ds.addColumn(table, column, DataStore.DATATYPE_STRING,
0881:                        primaryKey, true);
0882:                ret.setColumn(_ds, table + "." + column);
0883:
0884:                for (int i = 0; i < values.length; i++) {
0885:                    String value = values[i];
0886:                    String displayValue = "Value " + i;
0887:                    if (i < displayValues.length)
0888:                        displayValue = displayValues[i];
0889:                    ret.addOption(value, displayValue);
0890:                }
0891:                return ret;
0892:            }
0893:
0894:            /**
0895:             * This method creates a new submit button.
0896:             * @param buttonName The name that identifies the button.
0897:             * @param displayCaption The caption to put on the button.
0898:             */
0899:            public HtmlSubmitButton newSubmitButton(String buttonName,
0900:                    String displayCaption) {
0901:                HtmlSubmitButton submit = new HtmlSubmitButton(buttonName,
0902:                        displayCaption, _theme, _page);
0903:                if (_sl != null)
0904:                    submit.addSubmitListener(_sl);
0905:                return submit;
0906:            }
0907:
0908:            /**
0909:             * This method creates a new submit image.
0910:             * @param buttonName The name that identifies the button.
0911:             * @param displayCaption The caption to put on the button.
0912:             */
0913:            public HtmlSubmitImage newSubmitImage(String buttonName,
0914:                    String displayCaption) {
0915:                HtmlSubmitImage submit = new HtmlSubmitImage(buttonName,
0916:                        displayCaption, 24, _theme, _page);
0917:                if (_sl != null)
0918:                    submit.addSubmitListener(_sl);
0919:                return submit;
0920:            }
0921:
0922:            /**
0923:             * This method creates a new submit image.
0924:             * @param buttonName The name that identifies the button.
0925:             * @param displayCaption The caption to put on the button.
0926:             * @param height The height to make the button
0927:             */
0928:            public HtmlSubmitImage newSubmitImage(String buttonName,
0929:                    String displayCaption, int height) {
0930:                HtmlSubmitImage submit = new HtmlSubmitImage(buttonName,
0931:                        displayCaption, height, _theme, _page);
0932:                if (_sl != null)
0933:                    submit.addSubmitListener(_sl);
0934:                return submit;
0935:            }
0936:
0937:            /**
0938:             * This method creates a new submit button.
0939:             * @param buttonName The name that identifies the button.
0940:             * @param displayCaption The caption to put on the button.
0941:             * @param width The width to make the button
0942:             * @param height The width to make the button
0943:             */
0944:            public HtmlSubmitImage newSubmitImage(String buttonName,
0945:                    String displayCaption, int width, int height) {
0946:                HtmlSubmitImage submit = new HtmlSubmitImage(buttonName,
0947:                        displayCaption, width, height, _theme, _page);
0948:                if (_sl != null)
0949:                    submit.addSubmitListener(_sl);
0950:                return submit;
0951:            }
0952:
0953:            /**
0954:             * This method creates a new Sum Column for the DataStore.
0955:             * @param name The name of the compute Expression.
0956:             * @param column The column to sum.
0957:             * @param format The format to display the results.
0958:             * @see DataStoreEvaluator
0959:             * @see DataStore#setFormat
0960:             */
0961:            public HtmlText newSumColumn(String name, String column,
0962:                    String format) {
0963:                HtmlText computed = new HtmlText(name, "",
0964:                        HtmlText.FONT_DEFAULT, _page, _theme);
0965:                try {
0966:                    computed.setExpression(_ds, column, HtmlText.AGGREGATE_SUM,
0967:                            format);
0968:                } catch (Exception e) {
0969:                    computed.setText(e.getMessage());
0970:                }
0971:                return computed;
0972:            }
0973:
0974:            /**
0975:             * This method creates a new caption for the heading of an HTMLDataTable.
0976:             * @param caption The text for the caption.
0977:             */
0978:            public HtmlText newTableCaption(String caption) {
0979:                return new HtmlText(caption, HtmlText.FONT_TABLE_HEADING,
0980:                        _page, _theme);
0981:            }
0982:
0983:            /**
0984:             * This method creates a new caption for the heading of an HTMLDataTable.
0985:             * @param name The name for the component.
0986:             * @param caption The text for the caption.
0987:             */
0988:            public HtmlText newTableCaption(String name, String caption) {
0989:                return new HtmlText(name, caption, HtmlText.FONT_TABLE_HEADING,
0990:                        _page, _theme);
0991:            }
0992:
0993:            /**
0994:             * Constructs an HtmlLink component containing a text caption.
0995:             * @return HtmlLink
0996:             * @param name		The name of the link.
0997:             * @param href		The URL for the link.
0998:             * @param caption	The text caption for the link.
0999:             * @param p			The page the link will go in.
1000:             */
1001:            public static HtmlLink newTextHyperLink(String name, String href,
1002:                    String caption, HtmlPage p) {
1003:                return newTextHyperLink(name, href, null, caption, p);
1004:            }
1005:
1006:            /**
1007:             * Constructs an HtmlLink component containing a text caption.
1008:             * @return HtmlLink
1009:             * @param name		The name of the link.
1010:             * @param href		The URL for the link.
1011:             * @param target	The target for the link.
1012:             * @param caption	The text caption for the link.
1013:             * @param p			The page the link will go in.
1014:             */
1015:            public static HtmlLink newTextHyperLink(String name, String href,
1016:                    String target, String caption, HtmlPage p) {
1017:                return newTextHyperLink(name, href, target, caption,
1018:                        HtmlText.FONT_LINK, p);
1019:            }
1020:
1021:            /**
1022:             * Constructs an HtmlLink component containing a text caption.
1023:             * @return HtmlLink
1024:             * @param name		The name of the link.
1025:             * @param href		The URL for the link.
1026:             * @param target	The target for the link.
1027:             * @param caption	The text caption for the link.
1028:             * @param linkFont	The Font to use for the link
1029:             * @param p			The page the link will go in.
1030:             */
1031:            public static HtmlLink newTextHyperLink(String name, String href,
1032:                    String target, String caption, String linkFont, HtmlPage p) {
1033:                HtmlLink link = new HtmlLink(name, href, target, p);
1034:                HtmlText linkText = new HtmlText(caption, linkFont, p);
1035:                link.add(linkText);
1036:                return link;
1037:            }
1038:
1039:            /**
1040:             * Constructs an HtmlLink component containing a text caption Using a small link font.
1041:             * @return HtmlLink
1042:             * @param name		The name of the link.
1043:             * @param href		The URL for the link.
1044:             * @param caption	The text caption for the link.
1045:             * @param p			The page the link will go in.
1046:             */
1047:            public static HtmlLink newTextHyperLinkSmall(String name,
1048:                    String href, String caption, HtmlPage p) {
1049:                return newTextHyperLink(name, href, null, caption,
1050:                        "SmallLinkFont", p);
1051:            }
1052:
1053:            /**
1054:             * This method creates a new Time Edit Column.
1055:             * @param table The table that the column is in.
1056:             * @param column The data column.
1057:             * @param primaryKey True if the column is part of the primary key.
1058:             * @param size the number of characters to display in the component.
1059:             */
1060:            public HtmlTextEdit newTimeEdit(String table, String column,
1061:                    boolean primaryKey, int size) {
1062:                return newEditColumn(table, column, primaryKey, size, 25,
1063:                        DataStore.DATATYPE_TIME, TIME_FORMAT);
1064:            }
1065:
1066:            /**
1067:             * This method returns an HtmlTableCellProperties object with the colspan attribute set.
1068:             */
1069:            public static HtmlTableCellProperties newColSpan(int spanSize) {
1070:                HtmlTableCellProperties span = new HtmlTableCellProperties();
1071:                span.setColumnSpan(spanSize);
1072:                return span;
1073:            }
1074:
1075:            /**
1076:             * This method returns a text component bound to a column in a table
1077:             */
1078:            public static HtmlText newDataText(DataStore ds, String table_col,
1079:                    HtmlPage p) {
1080:                return newDataText(ds, table_col, null, p);
1081:            }
1082:
1083:            /**
1084:             * This method returns a text component bound to a column in a table
1085:             */
1086:            public static HtmlText newDataText(DataStore ds, String table_col,
1087:                    String format, HtmlPage p) {
1088:                HtmlText textComp = null;
1089:                try {
1090:                    textComp = new HtmlText(table_col, "",
1091:                            HtmlText.FONT_DEFAULT_DISPLAY_DATA, p);
1092:                    if (ds != null) {
1093:                        textComp.setExpression(ds, table_col, format);
1094:                    }
1095:                } catch (Exception e) {
1096:                    MessageLog.writeErrorMessage("newDataText", e, null);
1097:                }
1098:                return textComp;
1099:            }
1100:
1101:            /**
1102:             * This method returns a table heading caption
1103:             */
1104:            public static HtmlText newHeadingCaption(String caption, HtmlPage p) {
1105:                return newHeadingCaption("", caption, p);
1106:            }
1107:
1108:            /**
1109:             * This method returns a table heading caption
1110:             */
1111:            public static HtmlText newHeadingCaption(String name,
1112:                    String caption, HtmlPage p) {
1113:                return new HtmlText(name, caption, HtmlText.FONT_TABLE_HEADING,
1114:                        p);
1115:            }
1116:
1117:            /**
1118:             * This method returns a table caption
1119:             */
1120:            public static HtmlText newTableCaption(String caption, HtmlPage p) {
1121:                return newTableCaption("", caption, p);
1122:            }
1123:
1124:            /**
1125:             * This method returns a table caption
1126:             */
1127:            public static HtmlText newTableCaption(String name, String caption,
1128:                    HtmlPage p) {
1129:                return new HtmlText(name, caption + ":",
1130:                        HtmlText.FONT_COLUMN_CAPTION, p);
1131:            }
1132:
1133:            /**
1134:             * This method returns a text field containing a fixed number of blank spaces
1135:             */
1136:            public static HtmlText newTextSpacer(int spacerSize, HtmlPage p) {
1137:                StringBuffer spacerStr = new StringBuffer();
1138:
1139:                // Create the spacer string - which consists of a series of nbsp's which will take up space but not print
1140:                for (int i = 0; i < spacerSize; i++) {
1141:                    spacerStr.append("&nbsp;");
1142:                }
1143:                HtmlText spacer = new HtmlText(spacerStr.toString(), p);
1144:                spacer.setFixSpecialHtmlCharacters(false);
1145:                return spacer;
1146:            }
1147:
1148:            /**
1149:             *	This method creates a new HTML Table, and is created on the HTML page that is passed into this method.
1150:             *	@param name java.lang.String name of the HTML Table
1151:             *	@param p HtmlPage the HTML page on which this component will be created
1152:             *	@param width int Width of the table
1153:             *	@return com.salmonllc.html.HtmlTable
1154:             */
1155:            public static HtmlTable newTable(String name, HtmlPage p, int width) {
1156:                HtmlTable table = new HtmlTable(name, p);
1157:                table.setSizeOption(HtmlTable.SIZE_PERCENT);
1158:                table.setWidth(width);
1159:                return table;
1160:            }
1161:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.