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.studio;
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.tagging.ConceptTagPreferences;
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.console.base.context.SubMessageHolderConsolePageContext;
028: import org.jfolder.services.workflow.WorkflowServiceCaller;
029: import org.jfolder.services.workflow.WorkflowServiceCallerFactory;
030:
031: //other classes
032:
033: public class ConsoleMacroContext extends ConsolePageContext {
034:
035: private final static String BUTTON__EXPORT = "BUTTON__EXPORT";
036: private final static String BUTTON__CANCEL = "BUTTON__CANCEL";
037: private final static String BUTTON__REFRESH = "BUTTON__REFRESH";
038:
039: //private ConsoleMacroContext(ConsolePageSession inCps) {
040: // super(inCps);
041: //}
042:
043: private ConsoleMacroContext(ConsolePageSession inCps) {
044:
045: super (inCps);
046: ConceptTagPreferences localCtp = inCps
047: .getCurrentApplicationRootHolder().getPreferences();
048: //setTreeState(ConsolePageParameters.BRANCH_SEPARATOR
049: // + localCtp.getRootHandle()
050: // + ConsolePageParameters.BRANCH_SEPARATOR);
051: setTreeState(localCtp.getRootHandle());
052: setHighlightHandle(localCtp.getRootHandle());
053: }
054:
055: public final static ConsoleMacroContext newInstance(
056: ConsolePageSession inCps) {
057:
058: ConsoleMacroContext outValue = null;
059:
060: if (inCps.isConsolePageContextPresent(NamesForParentCpc
061: .getConsoleMacroCpcName(inCps))) {
062: //
063: Object o = inCps.getConsolePageContext(NamesForParentCpc
064: .getConsoleMacroCpcName(inCps));
065: outValue = (ConsoleMacroContext) o;
066: } else {
067: outValue = new ConsoleMacroContext(inCps);
068: ConceptTagPreferences localCtp = inCps
069: .getCurrentApplicationRootHolder().getPreferences();
070: String rootHandle = localCtp.getRootHandle();
071: outValue.setDefaultHighlightHandle(rootHandle);
072: inCps.registerConsolePageContext(NamesForParentCpc
073: .getConsoleMacroCpcName(inCps), outValue);
074: }
075:
076: return outValue;
077: }
078:
079: //public final static ConsoleMacroContext newInstance(
080: // ConsolePageSession inCps) {
081: //
082: // ConsoleMacroContext outValue = null;
083: //
084: // outValue = new ConsoleMacroContext(inCps);
085: //
086: // return outValue;
087: //}
088:
089: public String getFromPage() {
090: //
091: //
092: return ConsolePageParameters.SERVLET_MACRO_STUDIO;
093: }
094:
095: public String getHandleExtension() {
096: return NULL_HANDLE;
097: }
098:
099: //ConsoleScreenHelper
100: protected void renderConsolePage() throws IOException {
101:
102: startCommonPage();
103:
104: ConsolePageSession cs = getConsolePageSession();
105:
106: //
107: startEnclosingTableAndRowAndCell(alignCenter(null));
108: startAndEndStretchTableAndRowAndCell("<hr/>");
109: //
110: startAndEndSimpleTableAndRowAndCell(2, "Macro Studio",
111: getFontStyle(20, ARIAL, BLACK));
112:
113: //
114: SubMessageHolderConsolePageContext
115: .renderMessagesIfPresent(this );
116: //
117: startAndEndStretchTableAndRowAndCell("<hr/>");
118: //
119: SubmitActionContext sacExport = SubmitActionContext
120: .newInstance(this );
121: sacExport.addAction(ConsoleParameterContext.FIRST_INPUT,
122: singleQuotes(SubmitActionParameters.EXPORT));
123: //
124: SubmitActionContext sacCancel = SubmitActionContext
125: .newInstance(this );
126: sacCancel.addAction(ConsoleParameterContext.FIRST_INPUT,
127: singleQuotes(SubmitActionParameters.RETURN));
128: sacCancel.setGoToPage(ConsolePageParameters.SERVLET_CONSOLE);
129: //
130: SubmitActionContext sacRefresh = SubmitActionContext
131: .newInstance(this );
132: sacRefresh.addAction(ConsoleParameterContext.FIRST_INPUT,
133: singleQuotes(SubmitActionParameters.REFRESH));
134: //
135: //startEnclosingTableAndRowAndCell(alignCenter(null));
136: startTable(4);
137: startRow();
138: startCell(4);
139: //
140: //
141: int localColWidth = (getColumnWidth() * 4) / 3;
142: simpleAndPrint("<table align=\"center\">");
143: simpleAndPrint("<tr>");
144: simpleAndPrint("<td width=\"" + localColWidth
145: + "\" align=\"center\">");
146: createButton(BUTTON__EXPORT, "Export", 75,
147: submitActionCall(sacExport), null, null, null, null);
148: simpleAndPrint("</td>");
149: //endCell();
150: //startCell(1);
151: simpleAndPrint("<td width=\"" + localColWidth
152: + "\" align=\"center\">");
153: createButton(BUTTON__CANCEL, "Cancel", 75,
154: submitActionCall(sacCancel), null, null, null, null);
155: simpleAndPrint("</td>");
156: //endCell();
157: //startCell(1);
158: simpleAndPrint("<td width=\"" + localColWidth
159: + "\" align=\"center\">");
160: createButton(BUTTON__REFRESH, "Refresh", 75,
161: submitActionCall(sacRefresh), null, null, null, null);
162: simpleAndPrint("</td>");
163: simpleAndPrint("</tr>");
164: simpleAndPrint("</table>");
165: //
166: //
167: endCell();
168: endRow();
169: endTable();
170: //
171: startAndEndStretchTableAndRowAndCell("<hr/>");
172: //
173: ConsoleMacroUpDownContext.newInstance(this , "temp", "other");
174: //
175: endEnclosingTableAndRowAndCell();
176:
177: endCommonPage();
178: }
179:
180: }
|