001: /*
002: * JFolder, Copyright 2001-2006 Gary Steinmetz
003: *
004: * Distributable under LGPL license.
005: * See terms of license at gnu.org.
006: */
007:
008: package org.jfolder.console.web.admin.database.access;
009:
010: //base classes
011: import java.io.IOException;
012: import java.util.ArrayList;
013: import java.util.HashMap;
014: import java.util.Iterator;
015:
016: //project specific classes
017: import org.jfolder.common.UnexpectedSystemException;
018: import org.jfolder.common.utils.misc.MiscHelper;
019: import org.jfolder.common.utils.xml.XMLHelper;
020: import org.jfolder.common.web.template.ConsoleParameterContext;
021: import org.jfolder.common.web.template.SubmitActionContext;
022: import org.jfolder.common.web.template.SubmitActionParameters;
023: import org.jfolder.console.base.ConsolePageContext;
024: import org.jfolder.console.base.ConsolePageParameters;
025: import org.jfolder.console.base.ConsolePageSession;
026: import org.jfolder.console.base.NamesForParentCpc;
027: import org.jfolder.services.config.ApplicationStoreSet;
028: import org.jfolder.services.config.ConfigService;
029: import org.jfolder.services.config.ConfigServiceCallerFactory;
030:
031: //other classes
032:
033: public class AdminDatabaseAccessContext extends ConsolePageContext {
034:
035: //
036: private final static String BUTTON__GO_BACK = "BUTTON__GO_BACK";
037: private final static String BUTTON__EXEC_STAT = "BUTTON__EXEC_STAT";
038: private final static String BUTTON__META_DATA = "BUTTON__META_DATA";
039: //
040: private final static String FILE_UPLOAD__BINARY = "FILE_UPLOAD__BINARY";
041:
042: //
043: private final static int LABEL_FONT = 14;
044:
045: //
046: private final static String TOGGLE_LINK_PART__CUSTOM_DB_ACCESS_AREA = "CUSTOM_DB_ACCESS_AREA";
047:
048: //
049: //private final static String DRIVER = "DRIVER";
050: private final static String DATABASE = "DATABASE";
051: private final static String DRIVER_CLASS = "DRIVER_CLASS";
052: private final static String CONNECTION_STRING = "CONNECTION_STRING";
053: private final static String BREAK_MULTI = "BREAK_MULTI";
054: private final static String ROW_LIMIT = "ROW_LIMIT";
055: private final static String STATEMENT = "STATEMENT";
056: private final static String DB_USERNAME = "DB_USERNAME";
057: private final static String DB_PASSWORD = "DB_PASSWORD";
058: //
059: private final static String TOG_CAL__RESULTS = "TOG_CAL__RESULTS";
060:
061: //
062: private String topCustomDbAccessAreaId = null;
063: private String topDatabaseId = null;
064: private String topDriverId = null;
065: private String topUrlId = null;
066: private String topUsernameId = null;
067: private String topPasswordId = null;
068: private String topMultiBreakId = null;
069: private String topRowLimitId = null;
070: private String topStatementId = null;
071: //
072: private String driver = null;
073: private String url = null;
074: private String username = null;
075: private String password = null;
076: private String multiBreak = null;
077: private String rowLimit = null;
078: private String statement = null;
079: //
080: private HashMap driverList = null;
081:
082: //
083: private void setIds(String inCustomDbAccessAreaId,
084: String inDatabaseId, String inDriverId, String inUrlId,
085: String inUsernameId, String inPasswordId,
086: String inMultiBreakId, String inRowLimitId,
087: String inStatementId) {
088: //
089: this .topCustomDbAccessAreaId = inCustomDbAccessAreaId;
090: this .topDatabaseId = inDatabaseId;
091: this .topDriverId = inDriverId;
092: this .topUrlId = inUrlId;
093: this .topUsernameId = inUsernameId;
094: this .topPasswordId = inPasswordId;
095: this .topMultiBreakId = inMultiBreakId;
096: this .topRowLimitId = inRowLimitId;
097: this .topStatementId = inStatementId;
098: }
099:
100: //
101: private AdminDatabaseAccessContext(ConsolePageSession inCps,
102: String inDriver, String inUrl, String inUsername,
103: String inPassword, String inMultiBreak, String inRowLimit,
104: String inStatement) {
105:
106: super (inCps);
107: //
108: this .driver = inDriver;
109: this .url = inUrl;
110: this .username = inUsername;
111: this .password = inPassword;
112: this .multiBreak = inMultiBreak;
113: this .rowLimit = inRowLimit;
114: this .statement = inStatement;
115: //
116: this .driverList = new HashMap();
117: //
118: this .driverList.put("Specify Below Using -> ODBC",
119: new String[] { "sun.jdbc.odbc.JdbcOdbcDriver",
120: "jdbc:odbc:<alias>" });
121: //
122: this .driverList
123: .put(
124: "Specify Below Using -> MSSQL",
125: new String[] {
126: "com.microsoft.jdbc.sqlserver.SQLServerDriver",
127: "jdbc:microsoft:sqlserver://<server_name>:<1433>" });
128: //
129: this .driverList.put("Specify Below Using -> Sybase",
130: new String[] { "com.sybase.jdbc2.jdbc.SybDriver",
131: "jdbc:sybase:Tds:<host>:<port>/<DBNAME>" });
132: //
133: this .driverList
134: .put(
135: "Specify Below Using -> Oracle Thin",
136: new String[] {
137: "oracle.jdbc.driver.OracleDriver",
138: "jdbc:oracle:thin:@<server>[:<1521>]:<database_name>" });
139: //
140: this .driverList
141: .put(
142: "Specify Below Using -> Oracle OCI",
143: new String[] {
144: "oracle.jdbc.driver.OracleDriver",
145: "jdbc:oracle:oci:@<hostname>:<port>:<database_sid>" });
146: //
147: this .driverList.put("Specify Below Using -> Hypersonic",
148: new String[] { "org.hsqldb.jdbcDriver",
149: "jdbc:hsqldb:hsql://<server>[:<1476>]" });
150: //
151: this .driverList
152: .put("Specify Below Using -> DB2", new String[] {
153: "COM.ibm.db2.jdbc.app.DB2Driver",
154: "jdbc:db2:<dbname>" });
155: //
156: this .driverList
157: .put(
158: "Specify Below Using -> PostGreSQL",
159: new String[] { "org.postgresql.Driver",
160: "jdbc:postgresql:[<//host>[:<5432>/]]<database>" });
161: //
162: }
163:
164: public final static AdminDatabaseAccessContext newInstance(
165: ConsolePageSession inCps, String inDriver, String inUrl,
166: String inUsername, String inPassword, String inMultiBreak,
167: String inRowLimit, String inStatement) {
168: //
169: AdminDatabaseAccessContext outValue = null;
170:
171: if (inCps.isConsolePageContextPresent(NamesForParentCpc
172: .getDatabaseAccessCpcName(inCps))) {
173: //
174: Object o = inCps.getConsolePageContext(NamesForParentCpc
175: .getDatabaseAccessCpcName(inCps));
176: outValue = (AdminDatabaseAccessContext) o;
177: } else {
178: outValue = new AdminDatabaseAccessContext(inCps, inDriver,
179: inUrl, inUsername, inPassword, inMultiBreak,
180: inRowLimit, inStatement);
181: //
182: inCps.registerConsolePageContext(NamesForParentCpc
183: .getDatabaseAccessCpcName(inCps), outValue);
184: }
185:
186: return outValue;
187: }
188:
189: public String getFromPage() {
190: return ConsolePageParameters.SERVLET_DATABASE_ACCESS;
191: }
192:
193: public String getHandle() {
194: return NULL_HANDLE;
195: }
196:
197: public String getHandleExtension() {
198: throw new UnexpectedSystemException(
199: "This function should not be called in this class");
200: }
201:
202: protected void renderConsolePage() throws IOException {
203:
204: ConsolePageSession localCps = getConsolePageSession();
205: int columnWidth = getColumnWidth();
206:
207: startCommonPage();
208:
209: //startEnclosingTableAndRowAndCell(alignCenter(null));
210:
211: addDefaultTreeBranch(localCps.getToggleLink());
212: startEnclosingTableAndRowAndCell(alignCenter(null), localCps
213: .getToggleLink());
214: //
215: startAndEndStretchTableAndRowAndCell("<hr/>");
216: startTable(3);
217: startRow();
218: startAndEndCell(2, "Database Access", getFontStyle(20, ARIAL,
219: BLACK));
220: startCell(1, alignCenter(null));
221: //
222: SubmitActionContext sacGoBack = SubmitActionContext
223: .newInstance(this );
224: sacGoBack.setGoToPage(ConsolePageParameters.SERVLET_CONSOLE);
225: sacGoBack.addAction(ConsoleParameterContext.FIRST_INPUT,
226: singleQuotes(SubmitActionParameters.RETURN));
227: sacGoBack.addAction(ConsoleParameterContext.SECOND_INPUT,
228: singleQuotes(SubmitActionParameters.DATABASE_ACCESS));
229: createButton(BUTTON__GO_BACK, "Go Back", 150,
230: submitActionCall(sacGoBack), null, null, null, null);
231: //
232: endCell();
233: endRow();
234: endTable();
235:
236: startAndEndStretchTableAndRowAndCell("<hr/>");
237:
238: //
239: HashMap databaseStyles = getFontStyle(9, COURIER, BLACK);
240: databaseStyles.put("width", (2 * columnWidth) + "");
241: //
242: startTable(3);
243: startRow();
244: startCell(1, getFontStyle(LABEL_FONT, ARIAL, BLACK));
245: simpleAndPrint("Select Database");
246: endCell();
247: startCell(2, alignCenter(null));
248:
249: ArrayList databaseLabels = new ArrayList();
250: ArrayList databaseValues = new ArrayList();
251: //ArrayList databaseOnSelect = new ArrayList();
252: //
253: //
254: ConfigService cs = ConfigServiceCallerFactory
255: .getConfigService();
256: ApplicationStoreSet ass = ApplicationStoreSet.newInstance(cs);
257: for (int i = 0; i < ass.getDataSourceCount(); i++) {
258: //
259: String nextDisplayName = ass.getDisplayName(i);
260: databaseLabels.add(nextDisplayName);
261: //
262: String nextActualName = ass.getActualName(i);
263: databaseValues.add(nextActualName);
264: //
265: //String nextReferenceHandle = ass.getReferenceHandle(i);
266: //databaseValues.add(nextReferenceHandle);
267: }
268: //
269: //
270: //databaseLabels.add("------------");
271: //databaseValues.add("");
272: //databaseOnSelect.add(null);
273: //
274: //Iterator driverIter = this.driverList.keySet().iterator();
275: //while (driverIter.hasNext()) {
276: // String driverName = (String)driverIter.next();
277: // String nextValueSet[] = (String[])this.driverList.get(driverName);
278: // String nextOnSelect =
279: // "getPageComponent('" + this.topDriverId
280: // + "').value = '" + nextValueSet[0] + "';"
281: // + " getPageComponent('" + this.topUrlId
282: // + "').value = '" + nextValueSet[1] + "';"
283: // + " this.value = '';"
284: // + " openSection('" + this.topCustomDbAccessAreaId + "')";
285: // //
286: // databaseLabels.add(driverName);
287: // databaseValues.add("//");
288: // databaseOnSelect.add(nextOnSelect);
289: //}
290: //
291: String databaseDropDown = createDropDownBox(DATABASE,
292: databaseLabels, databaseValues, null, databaseStyles,
293: 0, null,
294: //"eval(this.value)");
295: null, null);
296: String localDatabaseId = localCps.getPreviousToggleLink();
297: simpleAndPrint(databaseDropDown);
298:
299: endCell();
300: endRow();
301: endTable();
302:
303: //
304: localCps
305: .pushToggleLink(TOGGLE_LINK_PART__CUSTOM_DB_ACCESS_AREA);
306: startAutoTogglingTableAndRowAndCell();
307: String localCustomDbAccessAreaId = localCps.getToggleLink();
308: //
309: //
310: //
311: //
312: //
313: //
314: //
315: //
316: //
317: //
318: //setLeftMargin(1);
319: startAndEndStretchTableAndRowAndCell("<hr/>");
320: //setLeftMargin(0);
321:
322: //
323: HashMap driverClassStyles = getFontStyle(9, COURIER, BLACK);
324: driverClassStyles.put("width", (2 * columnWidth) + "");
325: //
326: startTable(3);
327: startRow();
328: startCell(1, getFontStyle(LABEL_FONT, ARIAL, BLACK));
329: simpleAndPrint("Driver Class");
330: endCell();
331: startCell(2, alignCenter(null));
332: simpleAndPrint(createTextBox(DRIVER_CLASS, this .driver, null,
333: driverClassStyles, null, null, null));
334: String localDriverClassId = localCps.getPreviousToggleLink();
335: endCell();
336: endRow();
337: endTable();
338:
339: setLeftMargin(1);
340: startAndEndStretchTableAndRowAndCell("<hr/>");
341: setLeftMargin(0);
342:
343: //
344: HashMap connStringStyles = getFontStyle(9, COURIER, BLACK);
345: connStringStyles.put("width", (2 * columnWidth) + "");
346: //
347: startTable(3);
348: startRow();
349: startCell(1, getFontStyle(LABEL_FONT, ARIAL, BLACK));
350: simpleAndPrint("Connection String");
351: endCell();
352: startCell(2, alignCenter(null));
353: simpleAndPrint(createTextBox(CONNECTION_STRING, this .url, null,
354: connStringStyles, null, null, null));
355: String localConnectionStringId = localCps
356: .getPreviousToggleLink();
357: endCell();
358: endRow();
359: endTable();
360:
361: setLeftMargin(1);
362: startAndEndStretchTableAndRowAndCell("<hr/>");
363: setLeftMargin(0);
364:
365: //
366: HashMap userStyles = getFontStyle(9, COURIER, BLACK);
367: userStyles.put("width", (2 * columnWidth) + "");
368: //
369: startTable(3);
370: startRow();
371: startCell(1, getFontStyle(LABEL_FONT, ARIAL, BLACK));
372: simpleAndPrint("User");
373: endCell();
374: startCell(2, alignCenter(null));
375: simpleAndPrint(createTextBox(DB_USERNAME, this .username, null,
376: userStyles, null, null, null));
377: String localDbUsernameId = localCps.getPreviousToggleLink();
378: endCell();
379: endRow();
380: endTable();
381:
382: setLeftMargin(1);
383: startAndEndStretchTableAndRowAndCell("<hr/>");
384: setLeftMargin(0);
385:
386: //
387: HashMap passStyles = getFontStyle(9, COURIER, BLACK);
388: passStyles.put("width", (2 * columnWidth) + "");
389: //
390: startTable(3);
391: startRow();
392: startCell(1, getFontStyle(LABEL_FONT, ARIAL, BLACK));
393: simpleAndPrint("Password");
394: endCell();
395: startCell(2, alignCenter(null));
396: simpleAndPrint(createTextBox(DB_PASSWORD, this .password, null,
397: passStyles, null, null, null));
398: String localDbPasswordId = localCps.getPreviousToggleLink();
399: endCell();
400: endRow();
401: endTable();
402: //
403: //
404: endEnclosingTableAndRowAndCell();
405: localCps.popToggleLink();
406:
407: //
408: //
409: //
410: //
411: //
412: //
413: //
414: //
415: //
416: //
417: //setLeftMargin(1);
418: startAndEndStretchTableAndRowAndCell("<hr/>");
419: //setLeftMargin(0);
420:
421: //
422: int breakMultiSelectedIndex = 0;
423: if (this .multiBreak.equals(SubmitActionParameters.TRUE)) {
424: breakMultiSelectedIndex = 0;
425: } else {
426: breakMultiSelectedIndex = 1;
427: }
428: //
429: HashMap breakMultiStyles = getFontStyle(9, COURIER, BLACK);
430: breakMultiStyles.put("width", (2 * columnWidth) + "");
431: //
432: ArrayList breakMultiLabels = new ArrayList();
433: breakMultiLabels.add("Break multiple statements by semicolon");
434: breakMultiLabels.add("Process entire statement block as one");
435: //
436: ArrayList breakMultiValues = new ArrayList();
437: breakMultiValues.add(SubmitActionParameters.TRUE);
438: breakMultiValues.add(SubmitActionParameters.FALSE);
439: //
440: startTable(3);
441: startRow();
442: startCell(1, getFontStyle(LABEL_FONT, ARIAL, BLACK));
443: simpleAndPrint("Statements");
444: endCell();
445: startCell(2, alignCenter(null));
446:
447: String breakMultiDropDown = createDropDownBox(BREAK_MULTI,
448: breakMultiLabels, breakMultiValues, null,
449: breakMultiStyles, breakMultiSelectedIndex, null, null,
450: null);
451: String localBreakMultiId = localCps.getPreviousToggleLink();
452:
453: simpleAndPrint(breakMultiDropDown);
454:
455: endCell();
456: endRow();
457: endTable();
458:
459: setLeftMargin(1);
460: startAndEndStretchTableAndRowAndCell("<hr/>");
461: setLeftMargin(0);
462:
463: //
464: HashMap selectLimitStyles = getFontStyle(9, COURIER, BLACK);
465: //
466: startTable(3);
467: startRow();
468: startCell(1, getFontStyle(16, ARIAL, BLACK));
469: simpleAndPrint(XMLHelper.NBSP_XML);
470: endCell();
471: startCell(2, getFontStyle(9, COURIER, BLACK));
472: String rowLimitText = createTextBox(ROW_LIMIT, this .rowLimit,
473: null, selectLimitStyles, new Integer(3), null, null);
474: String localRowLimitId = localCps.getPreviousToggleLink();
475: simpleAndPrint("Limit select results to " + rowLimitText
476: + " rows");
477: endCell();
478: endRow();
479: endTable();
480:
481: startAndEndStretchTableAndRowAndCell("<hr/>");
482:
483: //
484: HashMap statementStyles = getFontStyle(9, COURIER, BLACK);
485: statementStyles.put("width", (3 * columnWidth) + "");
486: //
487: startTable(3);
488: startRow();
489: startCell(3, alignCenter(null));
490: simpleAndPrint(createTextArea(STATEMENT, this .statement, null,
491: statementStyles, new Integer(10), null, null));
492: String localStatementId = localCps.getPreviousToggleLink();
493: endCell();
494: endRow();
495: endTable();
496: //
497: //
498: //
499: createHorizontalRow(1);
500: //
501: //
502: //
503: String binaryFileUpload = createFileUpload(FILE_UPLOAD__BINARY,
504: new Integer(20));
505: String binaryFileId = localCps.getPreviousToggleLink();
506: //
507: //
508: startTable(3);
509: startRow();
510: startAndEndCell(1, "Upload Parameter", getFontStyle(LABEL_FONT,
511: ARIAL, BLACK));
512: startAndEndCell(2, binaryFileUpload);
513: endRow();
514: endTable();
515:
516: startAndEndStretchTableAndRowAndCell("<hr/>");
517:
518: startTable(3);
519: startRow();
520: startAndEndCell(1, XMLHelper.NBSP_XML);
521: startCell(1);
522: //
523: SubmitActionContext sacExecute = SubmitActionContext
524: .newInstance(this );
525: //
526: sacExecute.addAction(ConsoleParameterContext.FIRST_INPUT,
527: singleQuotes(SubmitActionParameters.EXECUTE));
528: sacExecute.addAction(ConsoleParameterContext.SECOND_INPUT,
529: singleQuotes(SubmitActionParameters.STATEMENT));
530: //
531: //sacExecute.addParameter(
532: // sacExecute.FIRST_INPUT,
533: // "getPageComponent('"
534: // + this.topDriverId + "').value");
535: //sacExecute.addParameter(
536: // sacExecute.SECOND_INPUT,
537: // "getPageComponent('"
538: // + this.topUrlId + "').value");
539: //sacExecute.addParameter(
540: // sacExecute.THIRD_INPUT,
541: // "getPageComponent('"
542: // + this.topUsernameId + "').value");
543: //sacExecute.addParameter(
544: // sacExecute.FOURTH_INPUT,
545: // "getPageComponent('"
546: // + this.topPasswordId + "').value");
547: sacExecute.addParameter(ConsoleParameterContext.FIRST_INPUT,
548: "getPageComponent('" + this .topDatabaseId + "').value");
549: sacExecute.addParameter(ConsoleParameterContext.SECOND_INPUT,
550: "getPageComponent('" + this .topMultiBreakId
551: + "').value");
552: sacExecute.addParameter(ConsoleParameterContext.THIRD_INPUT,
553: "getPageComponent('" + this .topRowLimitId + "').value");
554: sacExecute
555: .addParameter(ConsoleParameterContext.FOURTH_INPUT,
556: "getPageComponent('" + this .topStatementId
557: + "').value");
558: sacExecute.addParameter(ConsoleParameterContext.FIFTH_INPUT,
559: singleQuotes(binaryFileId));
560: createButton(BUTTON__EXEC_STAT, "Execute Statement", 150,
561: submitActionCall(sacExecute), null, null, null, null);
562: //
563: endCell();
564: startCell(1);
565: //
566: SubmitActionContext sacMeta = SubmitActionContext
567: .newInstance(this );
568: //
569: sacMeta.addAction(ConsoleParameterContext.FIRST_INPUT,
570: singleQuotes(SubmitActionParameters.EXECUTE));
571: sacMeta.addAction(ConsoleParameterContext.SECOND_INPUT,
572: singleQuotes(SubmitActionParameters.META_DATA));
573: //
574: //sacMeta.addParameter(
575: // sacMeta.FIRST_INPUT,
576: // "getPageComponent('"
577: // + this.topDriverId + "').value");
578: //sacMeta.addParameter(
579: // sacMeta.SECOND_INPUT,
580: // "getPageComponent('"
581: // + this.topUrlId + "').value");
582: //sacMeta.addParameter(
583: // sacMeta.THIRD_INPUT,
584: // "getPageComponent('"
585: // + this.topUsernameId + "').value");
586: //sacMeta.addParameter(
587: // sacMeta.FOURTH_INPUT,
588: // "getPageComponent('"
589: // + this.topPasswordId + "').value");
590: sacMeta.addParameter(ConsoleParameterContext.FIRST_INPUT,
591: "getPageComponent('" + this .topDatabaseId + "').value");
592: sacMeta.addParameter(ConsoleParameterContext.SECOND_INPUT,
593: "getPageComponent('" + this .topMultiBreakId
594: + "').value");
595: sacMeta.addParameter(ConsoleParameterContext.THIRD_INPUT,
596: "getPageComponent('" + this .topRowLimitId + "').value");
597: sacMeta
598: .addParameter(ConsoleParameterContext.FOURTH_INPUT,
599: "getPageComponent('" + this .topStatementId
600: + "').value");
601: createButton(BUTTON__META_DATA, "Get Meta Data", 150,
602: submitActionCall(sacMeta), null, null, null, null);
603: //
604: endCell();
605: endRow();
606: endTable();
607:
608: startAndEndStretchTableAndRowAndCell("<hr/>");
609:
610: ArrayList darTop = getConsolePageSession()
611: .getDataAccessResults();
612:
613: if (darTop.size() > 0) {
614: startTable(3);
615: startRow();
616: startCell(1, getFontStyle(LABEL_FONT, ARIAL, BLACK));
617: simpleAndPrint("Results");
618: endCell();
619: startCell(2);
620: simpleAndPrint(XMLHelper.NBSP_XML);
621: endCell();
622: endRow();
623: endTable();
624:
625: startAndEndStretchTableAndRowAndCell("<hr/>");
626:
627: for (int i = 0; i < darTop.size(); i++) {
628:
629: localCps.pushToggleLink(i + "");
630:
631: ArrayList dar = (ArrayList) darTop.get(i);
632:
633: String nextHeader = (String) dar.get(0);
634: ArrayList nextColumns = null;
635: //int nextColumnCount = 1;
636: if (dar.size() >= 2) {
637: nextColumns = (ArrayList) dar.get(1);
638: //nextColumnCount = nextColumns.size();
639: }
640:
641: //
642: String nextHeaderHtml = XMLHelper
643: .fromStringToHTML(nextHeader);
644: nextHeaderHtml = nextHeaderHtml.replaceAll("\n",
645: "<br/>");
646: //
647: HashMap headerStyles = getFontStyle(14, ARIAL, BLUE);
648: headerStyles.put("font-style", "italic");
649: //
650: startTable(3);
651: startRow();
652: startAndEndCell(3, getToggleLinkWithTargetId(
653: TOG_CAL__RESULTS, nextHeaderHtml, localCps
654: .getToggleLink()), headerStyles);
655: endRow();
656: endTable();
657: //startAndEndStretchTableAndRowAndCell(nextHeader);
658:
659: //startAndEndStretchTableAndRowAndCell("<hr/>");
660:
661: startEnclosingTableAndRowAndCell(localCps
662: .getToggleLink());
663: startTable(3);
664: if (nextColumns != null) {
665:
666: HashMap divStyles = new HashMap();
667: divStyles.put("overflow", "scroll");
668: divStyles.put("width", "" + 3 * (getColumnWidth()));
669: divStyles.put("height", "" + (getColumnWidth()));
670: divStyles.put("border-width", "" + 1);
671: divStyles.put("border-color", "#000000");
672: divStyles.put("border-style", "solid");
673: //
674: HashMap divAttrs = new HashMap();
675: divAttrs.put("style", XMLHelper
676: .fromStylesToAttr(divStyles));
677: //
678: HashMap tableStyles = new HashMap();
679: //
680: HashMap tableAttrs = new HashMap();
681: tableAttrs.put("style", XMLHelper
682: .fromStylesToAttr(tableStyles));
683: //
684: startRow();
685: startCell(3);
686: printAndIndent("<div "
687: + XMLHelper.convertAttrs(divAttrs)
688: + "><table "
689: + XMLHelper.convertAttrs(tableAttrs) + ">");
690:
691: printAndIndent("<tr>");
692: for (int j = 0; j < nextColumns.size(); j++) {
693: String nextCon = (String) nextColumns.get(j);
694: if (nextCon != null) {
695: nextCon = MiscHelper.fixString(nextCon, 20);
696: nextCon = XMLHelper
697: .fromStringToHTML(nextCon);
698: nextCon = nextCon.replaceAll("\n", "<br/>");
699: }
700:
701: simpleAndPrint("<td>" + nextCon + "</td>");
702: }
703: revertAndPrint("</tr>");
704:
705: for (int j = 2; j < dar.size(); j++) {
706: ArrayList nextDar = (ArrayList) dar.get(j);
707: printAndIndent("<tr>");
708: for (int k = 0; k < nextColumns.size(); k++) {
709: String nextCon = (String) nextDar.get(k);
710: if (nextCon != null) {
711: nextCon = nextCon.trim();
712: nextCon = MiscHelper.fixString(nextCon,
713: 20);
714: nextCon = XMLHelper
715: .fromStringToHTML(nextCon);
716: nextCon = nextCon.replaceAll("\n",
717: "<br/>");
718: }
719:
720: simpleAndPrint("<td>" + nextCon + "</td>");
721: }
722: revertAndPrint("</tr>");
723: }
724:
725: revertAndPrint("</table></div>");
726: endCell();
727: endRow();
728:
729: }
730:
731: endTable();
732: endEnclosingTableAndRowAndCell();
733:
734: startAndEndStretchTableAndRowAndCell("<hr/>");
735: //
736: localCps.popToggleLink();
737: }
738: }
739:
740: endEnclosingTableAndRowAndCell();
741:
742: endCommonPage();
743:
744: if (isMetaMode()) {
745: setIds(localCustomDbAccessAreaId, localDatabaseId,
746: localDriverClassId, localConnectionStringId,
747: localDbUsernameId, localDbPasswordId,
748: localBreakMultiId, localRowLimitId,
749: localStatementId);
750: }
751: }
752:
753: }
|