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.common.web.template;
009:
010: //base classes
011: import java.io.IOException;
012: import java.util.ArrayList;
013:
014: //project specific classes
015: import org.jfolder.common.utils.misc.MiscHelper;
016: import org.jfolder.common.utils.web.ParameterSet;
017:
018: //other classes
019:
020: public class SubmitActionContext extends BaseActionContext {
021:
022: private final static String FORM_NAME = "document."
023: + ConsoleTemplateParameters.ACTION_FORM + ".";
024: //
025: private final static String CONSOLE_ACTION_PREFIX = "CONSOLE_ACTION_";
026: //
027: public final static String TARGET_TOP = "_top";
028: public final static String TARGET_BLANK = "_blank";
029:
030: //console parameters
031: public final static String GO_TO_PAGE = "CONSOLE_GO_TO_PAGE";
032: public final static String FROM_PAGE = "CONSOLE_FROM_PAGE";
033: public final static String FROM_HANDLE = "CONSOLE_FROM_HANDLE";
034: public final static String ALIAS_FROM_HANDLE = "CONSOLE_FROM_ALIAS_HANDLE";
035: //
036: public final static String RECORDER = "CONSOLE_RECORDER";
037: private final static String PLAYBACK = "CONSOLE_PLAYBACK";
038: //
039: private final static String SEQUENCE_NUMBER = "CONSOLE_SEQUENCE_NUMBER";
040: public final static String TREE_STATE = "CONSOLE_TREE_STATE";
041: public final static String ORIG_TREE_STATE = "CONSOLE_ORIG_TREE_STATE";
042: //
043: private final static String COMMON_STEMS = "CONSOLE_COMMON_STEMS";
044: //
045: public final static String SUB_SECTION_POSITION = "CONSOLE_SUB_SECTION_POSITION";
046: //
047: public final static String NULL_HANDLE = ConsoleTemplateContext.NULL_HANDLE;
048: //
049: private String goToPage = null;
050: private String fromPage = null;
051: private String fromHandle = null;
052: private String aliasFromHandle = null;
053: //
054: private String recorder = null;
055: private String playback = null;
056: //
057: private String consoleTreeState = null;
058: private String consoleOrigTreeState = null;
059: private String consoleSequenceCode = null;
060: //
061: private String target = null;
062: private String sourceFrame = null;
063: private String confirm = null;
064: //
065: private String commonStems = null;
066: //
067: private String subSectionPosition = null;
068: //
069: private boolean allParametersFound = false;
070: private boolean allActionsFound = false;
071: //
072: private String crpcReplaceParameters = null;
073: //
074: private CreationResultParameterContext crpc = null;
075:
076: //
077: //
078: public final static String getSubSectionPositionOfForm() {
079: return (FORM_NAME + SUB_SECTION_POSITION);
080: }
081:
082: //
083: //
084: private SubmitActionContext(String inFromPage, String inHandle,
085: String inAliasFromHandle) {
086:
087: super ();
088:
089: //
090: initializePageInterface(inFromPage, inHandle, inAliasFromHandle);
091: //
092: this .crpcReplaceParameters = (new Boolean(false)).toString();
093: //
094: this .allParametersFound = true;
095: this .allActionsFound = true;
096: }
097:
098: public void initializePageInterface(
099: ConsoleTemplateFunctionsContext inCpc) {
100:
101: initializePageInterface(inCpc.getFromPage(), inCpc.getHandle(),
102: inCpc.getAliasHandle());
103: }
104:
105: private void initializePageInterface(String inFromPage,
106: String inHandle, String inAliasFromHandle) {
107: //
108: this .goToPage = inFromPage;
109: this .fromPage = inFromPage;
110: if (inHandle != null) {
111: this .fromHandle = inHandle;
112: } else {
113: this .fromHandle = NULL_HANDLE;
114: }
115: if (inAliasFromHandle != null) {
116: this .aliasFromHandle = inAliasFromHandle;
117: } else {
118: this .aliasFromHandle = NULL_HANDLE;
119: }
120: }
121:
122: //
123: public int hashCode() {
124:
125: int outValue = 0;
126:
127: outValue += MiscHelper.hashCodeOrZero(this .goToPage);
128: outValue += MiscHelper.hashCodeOrZero(this .fromPage);
129: outValue += MiscHelper.hashCodeOrZero(this .fromHandle);
130: outValue += MiscHelper.hashCodeOrZero(this .aliasFromHandle);
131: outValue += MiscHelper.hashCodeOrZero(this .recorder);
132: outValue += MiscHelper.hashCodeOrZero(this .playback);
133: outValue += MiscHelper.hashCodeOrZero(this .consoleTreeState);
134: outValue += MiscHelper
135: .hashCodeOrZero(this .consoleOrigTreeState);
136: outValue += MiscHelper.hashCodeOrZero(this .consoleSequenceCode);
137: outValue += MiscHelper.hashCodeOrZero(this .target);
138: outValue += MiscHelper.hashCodeOrZero(this .sourceFrame);
139: outValue += MiscHelper.hashCodeOrZero(this .confirm);
140: outValue += MiscHelper.hashCodeOrZero(this .commonStems);
141: outValue += MiscHelper.hashCodeOrZero(this .subSectionPosition);
142: //this.allParametersFound
143: //this.allActionsFound
144: outValue += MiscHelper
145: .hashCodeOrZero(this .crpcReplaceParameters);
146: outValue += MiscHelper.hashCodeOrZero(this .crpc);
147: //
148: outValue += super .hashCode();
149:
150: return outValue;
151: }
152:
153: public boolean equals(Object inObj) {
154:
155: boolean outValue = true;
156:
157: if (inObj instanceof SubmitActionContext) {
158: SubmitActionContext nextSac = ((SubmitActionContext) inObj);
159: outValue &= MiscHelper.equalsOrNull(this .goToPage,
160: nextSac.goToPage);
161: outValue &= MiscHelper.equalsOrNull(this .fromPage,
162: nextSac.fromPage);
163: outValue &= MiscHelper.equalsOrNull(this .fromHandle,
164: nextSac.fromHandle);
165: outValue &= MiscHelper.equalsOrNull(this .aliasFromHandle,
166: nextSac.aliasFromHandle);
167: outValue &= MiscHelper.equalsOrNull(this .recorder,
168: nextSac.recorder);
169: outValue &= MiscHelper.equalsOrNull(this .playback,
170: nextSac.playback);
171: outValue &= MiscHelper.equalsOrNull(this .consoleTreeState,
172: nextSac.consoleTreeState);
173: outValue &= MiscHelper.equalsOrNull(
174: this .consoleOrigTreeState,
175: nextSac.consoleOrigTreeState);
176: outValue &= MiscHelper.equalsOrNull(
177: this .consoleSequenceCode,
178: nextSac.consoleSequenceCode);
179: outValue &= MiscHelper.equalsOrNull(this .target,
180: nextSac.target);
181: outValue &= MiscHelper.equalsOrNull(this .sourceFrame,
182: nextSac.sourceFrame);
183: outValue &= MiscHelper.equalsOrNull(this .confirm,
184: nextSac.confirm);
185: outValue &= MiscHelper.equalsOrNull(this .commonStems,
186: nextSac.commonStems);
187: outValue &= MiscHelper
188: .equalsOrNull(this .subSectionPosition,
189: nextSac.subSectionPosition);
190: //
191: outValue &= (this .allParametersFound == nextSac.allParametersFound);
192: outValue &= (this .allActionsFound == nextSac.allActionsFound);
193: //
194: outValue &= MiscHelper.equalsOrNull(
195: this .crpcReplaceParameters,
196: nextSac.crpcReplaceParameters);
197: outValue &= MiscHelper
198: .equalsOrNull(this .crpc, nextSac.crpc);
199: //
200: outValue &= super .equals(nextSac);
201: } else {
202: outValue &= false;
203: }
204:
205: return outValue;
206: }
207:
208: public boolean isValid() {
209: return (super .isValid()
210: //
211: && this .goToPage != null
212: && this .fromPage != null
213: //
214: && this .fromHandle != null
215: && this .aliasFromHandle != null
216: //
217: && this .recorder != null
218: && this .playback != null
219: //
220: && this .consoleTreeState != null
221: && this .consoleOrigTreeState != null
222: && this .consoleSequenceCode != null
223: //
224: && this .allParametersFound && this .allActionsFound
225: //
226: && (this .crpc == null || this .crpc.isValid())
227: && this .crpcReplaceParameters != null
228: //
229: && this .commonStems != null);
230: }
231:
232: public String getSequenceCode() {
233: return this .consoleSequenceCode;
234: }
235:
236: public String getFromHandle() {
237: return this .fromHandle;
238: }
239:
240: public String getAliasFromHandle() {
241: return this .aliasFromHandle;
242: }
243:
244: public String getRecorder() {
245: return this .recorder;
246: }
247:
248: public String getPlayback() {
249: return this .playback;
250: }
251:
252: public String getTreeState() {
253: return this .consoleTreeState;
254: }
255:
256: public String getOrigTreeState() {
257: return this .consoleOrigTreeState;
258: }
259:
260: public String[] getCommonStems() {
261: return PageSetupContext.getCommonStems(this .commonStems);
262: }
263:
264: private boolean isCrpcReplace() {
265:
266: boolean outValue = false;
267:
268: if (this .crpcReplaceParameters != null) {
269: outValue = (new Boolean(this .crpcReplaceParameters))
270: .booleanValue();
271: }
272:
273: return outValue;
274: }
275:
276: public CreationResultParameterContext getCreationResultParameterContext() {
277: return this .crpc;
278: }
279:
280: ////////////////////
281: public final String getParameter(Integer inIndex) {
282:
283: String outValue = null;
284:
285: if (!isCrpcReplace()) {
286: outValue = super .getParameter(inIndex);
287: } else {
288: outValue = this .crpc.getParameter(inIndex);
289: }
290:
291: return outValue;
292: }
293:
294: public final static SubmitActionContext newInstance(
295: ConsoleTemplateFunctionsContext inCpc) {
296:
297: return SubmitActionContext.newInstance(inCpc.getFromPage(),
298: inCpc.getHandle(), inCpc.getAliasHandle());
299: }
300:
301: public final static SubmitActionContext newInstance(
302: String inFromPage, String inHandle, String inHandleAlias) {
303:
304: return new SubmitActionContext(inFromPage, inHandle,
305: inHandleAlias);
306: }
307:
308: public final static SubmitActionContext newInstance(
309: ParameterSet inPs) {
310:
311: SubmitActionContext outValue = new SubmitActionContext(null,
312: null, null);
313:
314: outValue.goToPage = inPs.getParameter(GO_TO_PAGE);
315: outValue.fromPage = inPs.getParameter(FROM_PAGE);
316: outValue.fromHandle = inPs.getParameter(FROM_HANDLE);
317: outValue.aliasFromHandle = inPs.getParameter(ALIAS_FROM_HANDLE);
318: //
319: outValue.recorder = inPs.getParameter(RECORDER);
320: outValue.playback = inPs.getParameter(PLAYBACK);
321: //
322: outValue.consoleSequenceCode = inPs
323: .getParameter(SEQUENCE_NUMBER);
324: outValue.consoleTreeState = inPs.getParameter(TREE_STATE);
325: outValue.consoleOrigTreeState = inPs
326: .getParameter(ORIG_TREE_STATE);
327: //
328: outValue.commonStems = inPs.getParameter(COMMON_STEMS);
329: //
330: outValue.subSectionPosition = inPs
331: .getParameter(SUB_SECTION_POSITION);
332: //
333: //------------------------------------// super class variables
334: //
335: ArrayList indexes = ConsoleParameterHolder.getIndexes();
336: for (int i = 0; i < indexes.size(); i++) {
337: Integer nextIndex = ((Integer) indexes.get(i));
338: String nextParameter = CONSOLE_ACTION_PREFIX + nextIndex;
339: if (inPs.isParameterString(nextParameter)) {
340: outValue.addAction(nextIndex, inPs
341: .getParameter(nextParameter));
342: } else {
343: outValue.allActionsFound = false;
344: outValue.addAction(nextIndex, "");
345: }
346: }
347: //outValue.setFirstAction(inPs.getParameter(FIRST_ACTION));
348: //outValue.setSecondAction(inPs.getParameter(SECOND_ACTION));
349: //outValue.setThirdAction(inPs.getParameter(THIRD_ACTION));
350: //
351: for (int i = 0; i < indexes.size(); i++) {
352: Integer nextIndex = ((Integer) indexes.get(i));
353: String nextParameter = CONSOLE_PARAMETER_PREFIX + nextIndex;
354: if (inPs.isParameterString(nextParameter)) {
355: outValue.addParameter(nextIndex, inPs
356: .getParameter(nextParameter));
357: } else {
358: outValue.allParametersFound = false;
359: outValue.addParameter(nextIndex, "");
360: }
361: }
362: outValue.crpcReplaceParameters = inPs
363: .getParameter(CreationParameterContext.CONSOLE_CREATION_REPLACE_PARAMETERS);
364: //
365: //
366: outValue.crpc = CreationResultParameterContext
367: .newInstance(inPs);
368: //
369: //
370: //outValue.setFirstParameter(inPs.getParameter(FIRST_PARAMETER));
371: //outValue.setSecondParameter(inPs.getParameter(SECOND_PARAMETER));
372: //outValue.setThirdParameter(inPs.getParameter(THIRD_PARAMETER));
373: //outValue.setFourthParameter(inPs.getParameter(FOURTH_PARAMETER));
374: //outValue.setFifthParameter(inPs.getParameter(FIFTH_PARAMETER));
375: //outValue.setSixthParameter(inPs.getParameter(SIXTH_PARAMETER));
376: //outValue.setSeventhParameter(inPs.getParameter(SEVENTH_PARAMETER));
377: //outValue.setEighthParameter(inPs.getParameter(EIGHTH_PARAMETER));
378: //outValue.setNinthParameter(inPs.getParameter(NINTH_PARAMETER));
379: //outValue.setTenthParameter(inPs.getParameter(TENTH_PARAMETER));
380:
381: return outValue;
382: }
383:
384: public final static void submitActionFunction(
385: ConsoleTemplateFunctionsContext inCpc) throws IOException {
386:
387: final String FORM_NAME = "document."
388: + ConsoleTemplateParameters.ACTION_FORM + ".";
389:
390: if (!inCpc.isMetaMode()) {
391: //
392: ArrayList indexes = ConsoleParameterHolder.getIndexes();
393: //
394: inCpc.printAndIndent("function submitAction(");
395: inCpc.simpleAndPrint("inGoToPage,");
396: //
397: for (int i = 0; i < indexes.size(); i++) {
398: inCpc.simpleAndPrint("inAction" + indexes.get(i) + ",");
399: }
400: //inCpc.simpleAndPrint("inFirstAction, inSecondAction,");
401: //inCpc.simpleAndPrint("inThirdAction,");
402: //
403: for (int i = 0; i < indexes.size(); i++) {
404: inCpc.simpleAndPrint("inParameter" + indexes.get(i)
405: + ",");
406: }
407: //inCpc.simpleAndPrint("inFirstParameter,");
408: //inCpc.simpleAndPrint("inSecondParameter, inThirdParameter,");
409: //inCpc.simpleAndPrint("inFourthParameter, inFifthParameter,");
410: //inCpc.simpleAndPrint("inSixthParameter, inSeventhParameter,");
411: //inCpc.simpleAndPrint("inEighthParameter, inNinthParameter,");
412: //inCpc.simpleAndPrint("inTenthParameter,");
413: //
414: inCpc.simpleAndPrint("inTarget, inConfirm) {");
415: //
416: inCpc.simpleAndPrint("");
417: inCpc.simpleAndPrint("var outValue = true;");
418: inCpc.simpleAndPrint("");
419: //RecordActionContext rac = RecordActionContext.newInstance(inCpc);
420: //rac.setAction("inAction");
421: //rac.setSubAction("inSubAction");
422: //rac.setSubSecondAction("inSubSecondAction");
423: //rac.setFirstParameter("inFirstParameter");
424: //rac.setSecondParameter("inSecondParameter");
425: //rac.setThirdParameter("inThirdParameter");
426: //rac.setFourthParameter("inFourthParameter");
427: //rac.setFifthParameter("inFifthParameter");
428: //rac.setSixthParameter("inSixthParameter");
429: //rac.setSeventhParameter("inSeventhParameter");
430: //rac.setEighthParameter("inEighthParameter");
431: //rac.setNinthParameter("inNinthParameter");
432: //rac.setTenthParameter("inTenthParameter");
433: //inCpc.simpleAndPrint(rac.recordActionCall());
434: //inCpc.simpleAndPrint("");
435: //
436: inCpc
437: .printAndIndent("if (inConfirm == null || confirm(inConfirm)) {");
438: //
439: RecordActionContext submitActionRac = RecordActionContext
440: .newInstance(inCpc);
441: //
442: for (int i = 0; i < indexes.size(); i++) {
443: Integer nextIndex = ((Integer) indexes.get(i));
444: submitActionRac.addAction(nextIndex, "inAction"
445: + nextIndex);
446: }
447: for (int i = 0; i < indexes.size(); i++) {
448: Integer nextIndex = ((Integer) indexes.get(i));
449: submitActionRac.addParameter(nextIndex, "inParameter"
450: + nextIndex);
451: }
452: //
453: //submitActionRac.setFirstAction("inFirstAction");
454: //submitActionRac.setSecondAction("inSecondAction");
455: //submitActionRac.setThirdAction("inThirdAction");
456: //
457: //submitActionRac.setFirstParameter("inFirstParameter");
458: //submitActionRac.setSecondParameter("inSecondParameter");
459: //submitActionRac.setThirdParameter("inThirdParameter");
460: //submitActionRac.setFourthParameter("inFourthParameter");
461: //submitActionRac.setFifthParameter("inFifthParameter");
462: //submitActionRac.setSixthParameter("inSixthParameter");
463: //submitActionRac.setSeventhParameter("inSeventhParameter");
464: //submitActionRac.setEighthParameter("inEighthParameter");
465: //submitActionRac.setNinthParameter("inNinthParameter");
466: //submitActionRac.setTenthParameter("inTenthParameter");
467: inCpc.simpleAndPrint(submitActionRac.recordActionCall());
468: inCpc.simpleAndPrint("");
469: //
470: //
471: inCpc.simpleAndPrint(FORM_NAME + GO_TO_PAGE
472: + ".value = inGoToPage;");
473: //
474: for (int i = 0; i < indexes.size(); i++) {
475: Integer nextIndex = ((Integer) indexes.get(i));
476: inCpc.simpleAndPrint(FORM_NAME + CONSOLE_ACTION_PREFIX
477: + nextIndex + ".value = inAction" + nextIndex
478: + ";");
479: }
480: //inCpc.simpleAndPrint(
481: // FORM_NAME + FIRST_ACTION + ".value = inFirstAction;");
482: //inCpc.simpleAndPrint(
483: // FORM_NAME + SECOND_ACTION + ".value = inSecondAction;");
484: //inCpc.simpleAndPrint(
485: // FORM_NAME + THIRD_ACTION + ".value = inThirdAction;");
486: //
487: for (int i = 0; i < indexes.size(); i++) {
488: Integer nextIndex = ((Integer) indexes.get(i));
489: inCpc.simpleAndPrint(FORM_NAME
490: + CONSOLE_PARAMETER_PREFIX + nextIndex
491: + ".value = inParameter" + nextIndex + ";");
492: }
493: //inCpc.simpleAndPrint(
494: // FORM_NAME + FIRST_PARAMETER + ".value = inFirstParameter;");
495: //inCpc.simpleAndPrint(
496: // FORM_NAME + SECOND_PARAMETER + ".value = inSecondParameter;");
497: //inCpc.simpleAndPrint(
498: // FORM_NAME + THIRD_PARAMETER + ".value = inThirdParameter;");
499: //inCpc.simpleAndPrint(
500: // FORM_NAME + FOURTH_PARAMETER + ".value = inFourthParameter;");
501: //inCpc.simpleAndPrint(
502: // FORM_NAME + FIFTH_PARAMETER + ".value = inFifthParameter;");
503: //inCpc.simpleAndPrint(
504: // FORM_NAME + SIXTH_PARAMETER + ".value = inSixthParameter;");
505: //inCpc.simpleAndPrint(
506: // FORM_NAME + SEVENTH_PARAMETER
507: // + ".value = inSeventhParameter;");
508: //inCpc.simpleAndPrint(
509: // FORM_NAME + EIGHTH_PARAMETER + ".value = inEighthParameter;");
510: //inCpc.simpleAndPrint(
511: // FORM_NAME + NINTH_PARAMETER + ".value = inNinthParameter;");
512: //inCpc.simpleAndPrint(
513: // FORM_NAME + TENTH_PARAMETER + ".value = inTenthParameter;");
514: //
515: inCpc.simpleAndPrint(FORM_NAME + "action = inGoToPage;");
516: inCpc.printAndIndent("if (inTarget != null) {");
517: inCpc.simpleAndPrint(FORM_NAME + "target = inTarget;");
518: inCpc.revertAndPrint("}");
519: inCpc.printAndIndent("else {");
520: inCpc.simpleAndPrint(FORM_NAME + "target = '_self';");
521: inCpc.revertAndPrint("}");
522: inCpc.simpleAndPrint("preparationBeforeSubmit();");
523: inCpc.simpleAndPrint(FORM_NAME + "submit();");
524: //
525: inCpc.revertAndPrint("}");
526: //
527: inCpc.simpleAndPrint("return outValue;");
528: inCpc.revertAndPrint("}");
529: }
530:
531: }
532:
533: public final static void formParameters(
534: ConsoleTemplateFunctionsContext inCpc, String inTreeState,
535: String inSequenceCode, PageSetupContext inPsc)
536: throws IOException {
537:
538: //
539: inCpc.simpleAndPrint(inputHidden(GO_TO_PAGE));
540: inCpc
541: .simpleAndPrint(inputHidden(FROM_PAGE, inCpc
542: .getFromPage()));
543: String handle = inCpc.getHandle();
544: if (handle != null) {
545: inCpc.simpleAndPrint(inputHidden(FROM_HANDLE, handle));
546: } else {
547: inCpc.simpleAndPrint(inputHidden(FROM_HANDLE,
548: SubmitActionContext.NULL_HANDLE));
549: }
550: String aliasHandle = inCpc.getAliasHandle();
551: if (aliasHandle != null) {
552: inCpc.simpleAndPrint(inputHidden(ALIAS_FROM_HANDLE,
553: aliasHandle));
554: } else {
555: inCpc.simpleAndPrint(inputHidden(ALIAS_FROM_HANDLE,
556: SubmitActionContext.NULL_HANDLE));
557: }
558: //
559: inCpc.simpleAndPrint(inputHidden(RECORDER));
560: inCpc.simpleAndPrint(inputHidden(PLAYBACK));
561: //
562: ArrayList indexes = ConsoleParameterHolder.getIndexes();
563: //
564: for (int i = 0; i < indexes.size(); i++) {
565: Integer nextIndex = ((Integer) indexes.get(i));
566: inCpc.simpleAndPrint(inputHidden(CONSOLE_ACTION_PREFIX
567: + nextIndex));
568: }
569: //inCpc.simpleAndPrint(inputHidden(FIRST_ACTION));
570: //inCpc.simpleAndPrint(inputHidden(SECOND_ACTION));
571: //inCpc.simpleAndPrint(inputHidden(THIRD_ACTION));
572: //
573: for (int i = 0; i < indexes.size(); i++) {
574: Integer nextIndex = ((Integer) indexes.get(i));
575: inCpc.simpleAndPrint(inputHidden(CONSOLE_PARAMETER_PREFIX
576: + nextIndex));
577: }
578: //inCpc.simpleAndPrint(inputHidden(FIRST_PARAMETER));
579: //inCpc.simpleAndPrint(inputHidden(SECOND_PARAMETER));
580: //inCpc.simpleAndPrint(inputHidden(THIRD_PARAMETER));
581: //inCpc.simpleAndPrint(inputHidden(FOURTH_PARAMETER));
582: //inCpc.simpleAndPrint(inputHidden(FIFTH_PARAMETER));
583: //inCpc.simpleAndPrint(inputHidden(SIXTH_PARAMETER));
584: //inCpc.simpleAndPrint(inputHidden(SEVENTH_PARAMETER));
585: //inCpc.simpleAndPrint(inputHidden(EIGHTH_PARAMETER));
586: //inCpc.simpleAndPrint(inputHidden(NINTH_PARAMETER));
587: //inCpc.simpleAndPrint(inputHidden(TENTH_PARAMETER));
588: //
589: inCpc.simpleAndPrint(inputHidden(SEQUENCE_NUMBER,
590: inSequenceCode + ""));
591: inCpc.simpleAndPrint(inputHidden(TREE_STATE, inTreeState));
592: inCpc.simpleAndPrint(inputHidden(ORIG_TREE_STATE, inTreeState));
593: //
594: inCpc.simpleAndPrint(inputHidden(COMMON_STEMS, inPsc
595: .getCommonStemsAsValue()));
596: //
597: inCpc.simpleAndPrint(inputHidden(SUB_SECTION_POSITION));
598: //
599: //
600: inCpc
601: .simpleAndPrint(inputHidden(
602: CreationParameterContext.CONSOLE_CREATION_PARAMETER_COUNT,
603: "0"));
604: for (int i = 0; i < CreationParameterContext.MAX_CREATION_PARAMS; i++) {
605: //
606: inCpc
607: .simpleAndPrint(inputHidden(CreationParameterContext.CONSOLE_CREATION_PARAMETER_TYPE_PREFIX
608: + i));
609: }
610: inCpc
611: .simpleAndPrint(inputHidden(
612: CreationParameterContext.CONSOLE_CREATION_REPLACE_PARAMETERS,
613: (new Boolean(false)).toString()));
614: }
615:
616: private final static String inputHidden(String inName) {
617: return inputHidden(inName, "");
618: }
619:
620: private final static String inputHidden(String inName,
621: String inValue) {
622: return ("<input type=\"HIDDEN\" name=\"" + inName
623: + "\" value=\"" + inValue + "\"/>");
624: }
625:
626: protected String submitActionCall() {
627: return submitActionCall(true, true);
628: }
629:
630: public String submitActionCall(boolean inIncludeSemiColon) {
631: return submitActionCall(inIncludeSemiColon, true);
632: }
633:
634: public String submitActionCall(boolean inIncludeSemiColon,
635: boolean inUseQuotes) {
636:
637: StringBuffer outValue = new StringBuffer();
638:
639: if (this .sourceFrame != null) {
640: outValue.append("top." + this .sourceFrame + ".");
641: }
642: outValue.append("submitAction(");
643: outValue.append(ConsoleTemplateContext.singleQuotes(
644: formatParameter(this .goToPage), inUseQuotes));
645: outValue.append(", ");
646: //
647: ArrayList indexes = ConsoleParameterHolder.getIndexes();
648: //
649: for (int i = 0; i < indexes.size(); i++) {
650: Integer nextIndex = ((Integer) indexes.get(i));
651: outValue.append(formatParameter(getAction(nextIndex)));
652: outValue.append(", ");
653: }
654: //outValue.append(formatParameter(getFirstAction()));
655: //outValue.append(", ");
656: //outValue.append(formatParameter(getSecondAction()));
657: //outValue.append(", ");
658: //outValue.append(formatParameter(getThirdAction()));
659: //outValue.append(", ");
660: //
661: for (int i = 0; i < indexes.size(); i++) {
662: Integer nextIndex = ((Integer) indexes.get(i));
663: outValue.append(formatParameter(getParameter(nextIndex)));
664: if (i < (indexes.size() - 1)) {
665: outValue.append(", ");
666: }
667: }
668: //outValue.append(formatParameter(getFirstParameter()));
669: //outValue.append(", ");
670: //outValue.append(formatParameter(getSecondParameter()));
671: //outValue.append(", ");
672: //outValue.append(formatParameter(getThirdParameter()));
673: //outValue.append(", ");
674: //outValue.append(formatParameter(getFourthParameter()));
675: //outValue.append(", ");
676: //outValue.append(formatParameter(getFifthParameter()));
677: //outValue.append(", ");
678: //outValue.append(formatParameter(getSixthParameter()));
679: //outValue.append(", ");
680: //outValue.append(formatParameter(getSeventhParameter()));
681: //outValue.append(", ");
682: //outValue.append(formatParameter(getEighthParameter()));
683: //outValue.append(", ");
684: //outValue.append(formatParameter(getNinthParameter()));
685: //outValue.append(", ");
686: //outValue.append(formatParameter(getTenthParameter()));
687: if (this .target != null) {
688: outValue.append(", ");
689: outValue.append(ConsoleTemplateContext.singleQuotes(
690: this .target, inUseQuotes));
691: } else {
692: outValue.append(", null");
693: }
694: if (this .confirm != null) {
695: outValue.append(", ");
696: outValue.append(this .confirm);
697: } else {
698: outValue.append(", null");
699: }
700: //
701: if (inIncludeSemiColon) {
702: outValue.append(");");
703: } else {
704: outValue.append(")");
705: }
706:
707: return outValue.toString();
708: }
709:
710: public void setGoToPage(String inGoToPage) {
711: this .goToPage = inGoToPage;
712: }
713:
714: public void setTarget(String inTarget) {
715: this .target = inTarget;
716: }
717:
718: public void setSourceFrame(String inSourceFrame) {
719: this .sourceFrame = inSourceFrame;
720: }
721:
722: public void setConfirm(String inConfirm) {
723: this.confirm = inConfirm;
724: }
725:
726: }
|