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.macro.generator;
009:
010: //base classes
011: import java.io.IOException;
012: import java.util.ArrayList;
013: import java.util.HashMap;
014:
015: //project specific classes
016: import org.jfolder.common.tagging.ConceptRollupTag;
017: import org.jfolder.common.utils.misc.MiscHelper;
018: import org.jfolder.common.utils.xml.XMLHelper;
019: import org.jfolder.common.web.template.ConsoleParameterContext;
020: import org.jfolder.common.web.template.SubmitActionContext;
021: import org.jfolder.common.web.template.SubmitActionParameters;
022: import org.jfolder.console.base.ConsolePageContext;
023: import org.jfolder.console.base.ConsolePageParameters;
024: import org.jfolder.console.base.ConsolePageSession;
025: import org.jfolder.services.workflow.WorkflowServiceCaller;
026: import org.jfolder.services.workflow.WorkflowServiceCallerFactory;
027:
028: //other classes
029:
030: public class AutoApplicationGeneratorContext extends ConsolePageContext {
031:
032: //
033: protected final static int MAXIMUM_SQL_SCRIPTS = 40;
034: //
035: //
036: private final static String BUTTON__GO_BACK = "BUTTON__GO_BACK";
037: private final static String BUTTON__CREATE = "BUTTON__CREATE";
038: //
039: protected final static String FILE_UPLOAD__APP_NAME = "FILE_UPLOAD__APP_NAME";
040: //
041: protected final static String FILE_UPLOAD__SCRIPT_PREFIX = "FILE_UPLOAD__SCRIPT_PREFIX_";
042: protected final static String TEXT_AREA__SCRIPT_PREFIX = "TEXT_AREA__SCRIPT_PREFIX_";
043:
044: //
045:
046: private AutoApplicationGeneratorContext(ConsolePageSession inCps) {
047: super (inCps);
048: }
049:
050: public final static AutoApplicationGeneratorContext newInstance(
051: ConsolePageSession inCps) {
052:
053: AutoApplicationGeneratorContext outValue = null;
054:
055: outValue = new AutoApplicationGeneratorContext(inCps);
056:
057: return outValue;
058: }
059:
060: public String getFromPage() {
061: //
062: //
063: return ConsolePageParameters.SERVLET_AUTO_APPLICATION_GENERATOR;
064: }
065:
066: public String getHandleExtension() {
067: return NULL_HANDLE;
068: }
069:
070: //ConsoleScreenHelper
071: protected void renderConsolePage() throws IOException {
072:
073: ConsolePageSession localCps = getConsolePageSession();
074:
075: //
076: //
077: SubmitActionContext sacGoBack = SubmitActionContext
078: .newInstance(this );
079: sacGoBack.setGoToPage(ConsolePageParameters.SERVLET_CONSOLE);
080: sacGoBack.addAction(ConsoleParameterContext.FIRST_INPUT,
081: singleQuotes(SubmitActionParameters.RETURN));
082: sacGoBack
083: .addAction(
084: ConsoleParameterContext.SECOND_INPUT,
085: singleQuotes(SubmitActionParameters.AUTO_APPLICATION_GENERATOR));
086: //
087: //
088: SubmitActionContext sacCreate = SubmitActionContext
089: .newInstance(this );
090: //sacGoBack.setGoToPage(ConsolePageParameters.SERVLET_CONSOLE);
091: sacCreate.addAction(ConsoleParameterContext.FIRST_INPUT,
092: singleQuotes(SubmitActionParameters.CREATE));
093: //sacGoBack.addAction(
094: // ConsoleParameterContext.SECOND_INPUT,
095: // singleQuotes(SubmitActionParameters.AUTO_APPLICATION_GENERATOR));
096: //
097: //
098: //
099: //
100: //
101: //
102: //
103: //
104: startCommonPage();
105: //
106: startEnclosingTableAndRowAndCell(alignCenter(null));
107: //
108: //
109: //
110: //
111: //
112: //
113: //
114: //
115: startAndEndStretchTableAndRowAndCell("<hr/>");
116: //
117: //
118: startTable(3);
119: startRow();
120: startAndEndCell(2, "Auto Application Generator", getFontStyle(
121: 20, ARIAL, BLACK));
122: startCell(1, alignCenter(null));
123: //
124: createButton(BUTTON__GO_BACK, "Go Back", 150,
125: submitActionCall(sacGoBack), null, null, null, null);
126: //
127: endCell();
128: endRow();
129: endTable();
130: //
131: //
132: startAndEndStretchTableAndRowAndCell("<hr/>");
133: //
134: startTable(3);
135: startRow();
136: startAndEndCell(1, "Application",
137: getFontStyle(20, ARIAL, BLACK));
138: startCell(2, alignCenter(null));
139: //
140: String applicationFileUpload = createFileUpload(
141: FILE_UPLOAD__APP_NAME, null);
142: simpleAndPrint(applicationFileUpload);
143: //
144: endCell();
145: endRow();
146: endTable();
147: //
148: startAndEndStretchTableAndRowAndCell("<hr/>");
149: //
150: //
151: startTable(3);
152: for (int i = 0; i < MAXIMUM_SQL_SCRIPTS; i++) {
153: //
154: //////////////////////
155: //
156: //if (i > 0) {
157: //
158: //
159: startRow();
160: //
161: startAndEndCell(1, padNbsp(1));
162: //
163: startAndEndCell(2, createHorizontalRow(2, null));
164: //
165: endRow();
166: //}
167: //
168: //
169: //////////////////////
170: //
171: startRow();
172: //
173: if (i == 0) {
174: startAndEndCell(1, "SQL Scripts", getFontStyle(20,
175: ARIAL, BLACK));
176: } else {
177: startAndEndCell(1, padNbsp(1));
178: }
179: //
180: //
181: HashMap scriptTextAreaStyles = new HashMap();
182: scriptTextAreaStyles.put("width",
183: (2 * getColumnWidth() - 120) + "px");
184: //
185: String scriptTextArea = createTextArea(
186: TEXT_AREA__SCRIPT_PREFIX + i, "", null,
187: scriptTextAreaStyles, null, null, null);
188: startAndEndCell(2, scriptTextArea, alignCenter(null));
189: //
190: endRow();
191: //
192: //
193: //////////////////////
194: startRow();
195: //
196: startAndEndCell(1, padNbsp(1));
197: //
198: startAndEndCell(2, createHorizontalRow(1, null),
199: alignCenter(null));
200: //
201: endRow();
202: //
203: //
204: //////////////////////
205: //
206: //
207: startRow();
208: //
209: startAndEndCell(1, padNbsp(1));
210: //
211: String scriptFileUpload = createFileUpload(
212: FILE_UPLOAD__SCRIPT_PREFIX + i, null);
213: startAndEndCell(2, scriptFileUpload, alignCenter(null));
214: //
215: //
216: endRow();
217: //
218: }
219: endTable();
220: //
221: //
222: //
223: startAndEndStretchTableAndRowAndCell("<hr/>");
224: //
225: startTable(3);
226: startRow();
227: startCell(3, alignCenter(null));
228: //
229: createButton(BUTTON__CREATE, "Create Application", 300,
230: submitActionCall(sacCreate), null, null, null, null);
231: //
232: endCell();
233: endRow();
234: endTable();
235: //
236: startAndEndStretchTableAndRowAndCell("<hr/>");
237: //
238: //
239: //
240: //
241: //
242: endEnclosingTableAndRowAndCell();
243: //
244: endCommonPage();
245: }
246:
247: }
|