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.develop.workflow.template;
009:
010: //base classes
011: import java.io.IOException;
012: import java.util.HashMap;
013:
014: //project specific classes
015: import org.jfolder.common.UnexpectedSystemException;
016: import org.jfolder.common.tagging.ConceptTagPreferences;
017: import org.jfolder.common.utils.xml.XMLHelper;
018: import org.jfolder.common.web.template.SubmitActionContext;
019: import org.jfolder.common.web.template.SubmitActionParameters;
020: import org.jfolder.console.base.BaseStudioFrameServlet;
021: import org.jfolder.console.base.ConsolePageContext;
022: import org.jfolder.console.base.ConsolePageParameters;
023: import org.jfolder.console.base.ConsoleSession;
024:
025: //other classes
026:
027: public class DevelopWorkflowTemplateContext extends ConsolePageContext {
028:
029: private String appName = null;
030:
031: //private String pageName = null;
032:
033: private DevelopWorkflowTemplateContext(ConsoleSession inCs) {
034:
035: super (inCs);
036: this .appName = inCs.getOpenApplication();
037: //this.pageName = inCs.getOpenWebPage();
038: ConceptTagPreferences ctp = inCs.getRootHolder()
039: .getPreferences();
040: setTreeState(ConsolePageParameters.BRANCH_SEPARATOR
041: + ctp.getRootHandle()
042: + ConsolePageParameters.BRANCH_SEPARATOR);
043: inCs.setCurrentHighlightHandle(ctp.getRootHandle());
044: //MiscHelper.println("new WebStudioFrameContext");
045: //reset value if user just come from another studio environment
046: //getConsoleSession().setTreeState();
047: //getConsoleSession().setTreeState(getTreeState());
048:
049: }
050:
051: public final static DevelopWorkflowTemplateContext newInstance(
052: ConsoleSession inCs) {
053:
054: DevelopWorkflowTemplateContext outValue = null;
055:
056: //String handle = ConsolePageParameters.SERVLET_WEB_STUDIO_FRAME
057: // + HANDLE_SEPARATOR
058: // + DevelopWorkflowTemplateContext.commonHandleExtension(
059: // inCs.getOpenApplication());
060:
061: //MiscHelper.println("isConsolePageContextPresent = "
062: // + inCs.isConsolePageContextPresent(handle));
063:
064: //if (inCs.isConsolePageContextPresent(handle)) {
065: // Object o = inCs.getConsolePageContext(handle);
066: // outValue = (DevelopWorkflowTemplateContext)o;
067: //}
068: //else {
069: outValue = new DevelopWorkflowTemplateContext(inCs);
070: //}
071:
072: return outValue;
073: }
074:
075: public String getFromPage() {
076: return ConsolePageParameters.SERVLET_DEVELOP_WORKFLOW_TEMPLATE;
077: }
078:
079: public String getHandleExtension() {
080: return DevelopWorkflowTemplateContext
081: .commonHandleExtension(this .appName);
082: }
083:
084: public String getAliasHandle() {
085: return DevelopWorkflowTemplateContext
086: .commonAliasHandle(this .appName);
087: }
088:
089: protected final static String commonHandleExtension(String inAppName) {
090: return (inAppName);
091: }
092:
093: protected final static String commonAliasHandle(String inAppName) {
094: return (ConsolePageParameters.SERVLET_DEVELOP_WORKFLOW_TEMPLATE
095: + HANDLE_SEPARATOR + inAppName);
096: }
097:
098: public void setTreeState(String inTreeState) {
099: super .setTreeState(inTreeState);
100: getConsoleSession().setTreeState(inTreeState);
101: }
102:
103: protected void renderConsolePage() throws IOException {
104:
105: startCommonPage();
106: //
107: startEnclosingTableAndRowAndCell(alignCenter(null));
108: //
109: startAndEndStretchTableAndRowAndCell("<hr/>");
110: startTable(4);
111: startRow();
112: startAndEndCell(4, "Welcome to the Workflow Template Studio");
113: endRow();
114: endTable();
115: //
116: startAndEndStretchTableAndRowAndCell("<hr/>");
117: //
118: SubmitActionContext sacSave = SubmitActionContext
119: .newInstance(this );
120: sacSave.setAction(singleQuotes(SubmitActionParameters.SAVE));
121: SubmitActionContext sacCancel = SubmitActionContext
122: .newInstance(this );
123: SubmitActionContext sacRefresh = SubmitActionContext
124: .newInstance(this );
125: sacRefresh
126: .setAction(singleQuotes(SubmitActionParameters.REFRESH));
127: //
128: startTable(3);
129: startRow();
130: startCell(1);
131: createButton("Save", 75, sacSave.submitActionCall(), null,
132: null, null, null);
133: endCell();
134: startCell(1);
135: createButton("Cancel", 75, sacCancel.submitActionCall(), null,
136: null, null, null);
137: endCell();
138: startCell(1);
139: createButton("Refresh", 75, sacRefresh.submitActionCall(),
140: null, null, null, null);
141: endCell();
142: endRow();
143: endTable();
144: //
145: //startAndEndStretchTableAndRowAndCell("<hr/>");
146: //
147: //startTable(4);
148: //startRow();
149: //startCell(4);
150: //simpleAndPrint("Graph Buttons");
151: //endCell();
152: //endRow();
153: //endTable();
154: //
155: startAndEndStretchTableAndRowAndCell("<hr/>");
156: //
157: DevelopWorkflowTemplateUpDownContext.newInstance(this ,
158: "up-down");
159:
160: //startAndEndStretchTableAndRowAndCell("<hr/>");
161: //
162: endEnclosingTableAndRowAndCell();
163: //
164:
165: //
166: endCommonPage();
167: }
168: }
|