01: /*
02: * JFolder, Copyright 2001-2006 Gary Steinmetz
03: *
04: * Distributable under LGPL license.
05: * See terms of license at gnu.org.
06: */
07:
08: package org.jfolder.console.base.context;
09:
10: //base classes
11: import java.io.IOException;
12:
13: //project specific classes
14: import org.jfolder.console.base.ConsolePageContext;
15: import org.jfolder.console.base.NamesForSubCpc;
16:
17: //other classes
18:
19: public class SubLimitTextConsolePageContext extends
20: BaseSubBoxConsolePageContext {
21:
22: private String text = null;
23:
24: protected SubLimitTextConsolePageContext(String inName,
25: int inColumnWidth, int inHeight, String inSideColor,
26: ConsolePageContext inCpc, String inText) {
27:
28: super (inName, inColumnWidth, inHeight, inSideColor, inCpc);
29: //
30: this .text = inText;
31: }
32:
33: public final static SubLimitTextConsolePageContext newInstance(
34: String inName, int inColumnWidth, int inHeight,
35: String inSideColor, ConsolePageContext inCpc,
36: String inText, boolean inWrap, int inPadding)
37: throws IOException {
38:
39: SubLimitTextConsolePageContext outValue = null;
40:
41: if (inCpc.isSubConsolePageContextPresent(NamesForSubCpc
42: .getSubLimitTextCpcName(inName))) {
43: //
44: Object o = inCpc.getSubConsolePageContext(NamesForSubCpc
45: .getSubLimitTextCpcName(inName));
46: outValue = (SubLimitTextConsolePageContext) o;
47: } else {
48: outValue = new SubLimitTextConsolePageContext(
49: NamesForSubCpc.getSubLimitTextCpcName(inName),
50: inColumnWidth, inHeight, inSideColor, inCpc, inText);
51: //inCpc.registerSubConsolePageContext(inName, outValue);
52: }
53: outValue.setContentWrap(inWrap);
54: outValue.setPadding(inPadding);
55:
56: outValue.copyFromParent(inCpc);
57: outValue.createConsolePage(inCpc.getWriter(), inCpc
58: .getPageSetupContext());
59:
60: return outValue;
61: }
62:
63: //
64: //
65: protected void renderContent() throws IOException {
66: simpleAndPrint(this.text);
67: }
68: }
|