Source Code Cross Referenced for TaglibDeclareMacroGroupWebPageTag.java in  » Workflow-Engines » JFolder » org » jfolder » web » page » v1 » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Workflow Engines » JFolder » org.jfolder.web.page.v1 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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.web.page.v1;
009:
010:        //base classes
011:        import java.util.HashMap;
012:
013:        //project specific classes
014:        import org.jfolder.common.StandardDataTypes;
015:        import org.jfolder.common.files.WebPageTagMacro;
016:        import org.jfolder.common.files.WebPageTagMacroGroup;
017:        import org.jfolder.common.files.WebPageTagMacroHelper;
018:        import org.jfolder.common.function.BaseWebPageTag;
019:        import org.jfolder.common.function.WebPageTagInstanceViewContext;
020:        import org.jfolder.common.function.WebPageTagInstanceViewContextInfo;
021:        import org.jfolder.common.function.WebPageTagInstanceViewContextSubHtmlInfo;
022:        import org.jfolder.common.tagging.AppraiseConceptTagContext;
023:        import org.jfolder.common.tagging.ConceptTag;
024:        import org.jfolder.common.tagging.ConceptTagCharacteristic;
025:        import org.jfolder.common.tagging.ConceptTagCharacteristicHolder;
026:        import org.jfolder.common.tagging.ConceptTagConstraint;
027:        import org.jfolder.common.tagging.ConceptTagConstraintHolder;
028:        import org.jfolder.common.tagging.ConceptTagFlagsHelper;
029:        import org.jfolder.common.tagging.ConceptTagHelper;
030:        import org.jfolder.common.tagging.DetermineClassConceptTagContext;
031:        import org.jfolder.common.tagging.DetermineValueAndClassConceptTagContext;
032:        import org.jfolder.common.tagging.DetermineValueAndClassConceptTagException;
033:        import org.jfolder.common.tagging.DynamicConceptTagConstraintContext;
034:        import org.jfolder.common.tagging.InitializeConceptTagContext;
035:        import org.jfolder.common.tagging.ReturnableConceptTag;
036:        import org.jfolder.common.tagging.SelectionCriteriaForReturnableConceptTag;
037:        import org.jfolder.common.tagging.StudioConceptTagCreParInfoContext;
038:        import org.jfolder.common.tagging.StudioConceptTagInstanceInfoContext;
039:        import org.jfolder.common.tagging.StudioConceptTagTypeInfoContext;
040:        import org.jfolder.common.tagging.ValueAndClassForConceptTag;
041:        import org.jfolder.common.utils.xml.XMLHelper;
042:
043:        //other classes
044:
045:        public class TaglibDeclareMacroGroupWebPageTag extends BaseWebPageTag
046:                implements  WebPageTagMacroGroup {
047:
048:            //characteristics
049:            private ConceptTagCharacteristic macroCtchar = null;
050:
051:            //macro details
052:            public final static String MACRO_CTCON = "macro";
053:            private final static String MACRO_TITLE = "Macros";
054:            private final static String MACRO_SHORT_DESCRIPTION = "Macro declarations";
055:
056:            //
057:            public int getValidAndInvalidSignatureLength() {
058:
059:                int outValue = 0;
060:
061:                outValue = this .macroCtchar.getValueLength();
062:
063:                return outValue;
064:            }
065:
066:            //
067:            public WebPageTagMacro getMacro(int inIndex) {
068:                //
069:                WebPageTagMacro outValue = null;
070:
071:                ConceptTagCharacteristicHolder ctcharh = this .macroCtchar
072:                        .getValueAsHolder(inIndex, null);
073:                //
074:                ConceptTag ct = ctcharh.getConceptTag();
075:                //
076:                outValue = ((WebPageTagMacro) ct);
077:
078:                return outValue;
079:            }
080:
081:            public boolean isSignatureValid(int inIndex) {
082:
083:                boolean outValue = false;
084:
085:                if (inIndex < this .macroCtchar.getValueLength()) {
086:                    if (this .macroCtchar.isHolderWithConceptTag(inIndex, null)) {
087:                        //
088:                        ConceptTagCharacteristicHolder ctcharh = this .macroCtchar
089:                                .getValueAsHolder(inIndex, null);
090:                        ConceptTag ct = ((ConceptTag) ctcharh.getConceptTag());
091:                        //
092:                        if (ct instanceof  WebPageTagMacro) {
093:                            //
094:                            WebPageTagMacro wptm = ((WebPageTagMacro) ct);
095:                            //
096:                            if (wptm.isSignatureValid()) {
097:                                //
098:                                outValue = true;
099:                                ////tentative true
100:                                //
101:                                //String wptmResultType = wptm.getResultType();
102:                            } else {
103:                                outValue = false;
104:                            }
105:                        } else {
106:                            outValue = false;
107:                        }
108:                    } else {
109:                        outValue = false;
110:                    }
111:                } else {
112:                    outValue = false;
113:                }
114:
115:                return outValue;
116:            }
117:
118:            //
119:            public boolean isSignatureValidAndUnique(int inIndex) {
120:
121:                boolean outValue = false;
122:
123:                if (isSignatureValid(inIndex)) {
124:                    //
125:                    outValue = true;//tentative true
126:                    //
127:                    WebPageTagMacro wptm = getMacro(inIndex);
128:                    //
129:                    String wptmName = wptm.getName();
130:                    String wptmParameterTypes[] = wptm.getParameterTypes();
131:                    //
132:                    for (int i = 0; i < inIndex; i++) {
133:                        //
134:                        if (isSignatureValid(i)) {
135:                            //
136:                            outValue &= (!isSignatureMatch(i, wptmName,
137:                                    wptmParameterTypes));
138:                        }
139:                    }
140:                }
141:
142:                return outValue;
143:            }
144:
145:            //
146:            public boolean isSignatureMatch(int inIndex, String inName,
147:                    String inParameterTypes[]) {
148:                //
149:                boolean outValue = false;
150:
151:                if (isSignatureValid(inIndex)) {
152:                    //
153:                    WebPageTagMacro wptm = getMacro(inIndex);
154:                    //
155:                    outValue = wptm.isSignatureMatch(inName, inParameterTypes);
156:                }
157:
158:                return outValue;
159:            }
160:
161:            //
162:            public void initialize(InitializeConceptTagContext inIctc) {
163:
164:                //
165:                ConceptTagConstraintHolder rootCtconh = ConceptTagConstraintHolder
166:                        .newInstance(inIctc);
167:
168:                //constrain "macro"
169:                ConceptTagConstraint macroCtcon = ConceptTagConstraint
170:                        .newInstance(MACRO_CTCON, rootCtconh);
171:                //
172:                macroCtcon.setMinimumLength(0);
173:                macroCtcon.setLengthUnbounded(true);
174:                //
175:                macroCtcon.setTitle(MACRO_TITLE);
176:                macroCtcon.setShortDescription(MACRO_SHORT_DESCRIPTION);
177:                //
178:                //StaticConceptTagConstraintContext addendSctcc =
179:                //    StaticConceptTagConstraintContext.newInstance(addendCtcon);
180:                //addendSctcc.setRegularExpression(CommonExpressions.DECIMAL);
181:                //
182:                //
183:                DynamicConceptTagConstraintContext macroDctcc = DynamicConceptTagConstraintContext
184:                        .newInstance(macroCtcon);
185:                //    macroCtcon.getDynamicConstraintContext();
186:                //
187:                Class macroClasses[] = new Class[1];
188:                macroClasses[0] = TaglibDeclareMacroWebPageTag.class;
189:                macroDctcc.getValidator().allowOnlyTheseClasses(macroClasses,
190:                        "Only Macro tags are allowed here");
191:                //
192:                //macroDctcc.addDefaultValue(TaglibDeclareMacroWebPageTag.class);
193:
194:                //
195:                //CommonV1WebPageTagHelper.prepUndefConForGenUse(rootCtconh);
196:                ////constrain undefined
197:                //ConceptTagConstraint unconstrainedCtcon =
198:                //    rootCtconh.getUndefinedConstraint();
199:                //unconstrainedCtcon.setMaximumLength(1);
200:                ////
201:                //DynamicConceptTagConstraintContext unconstrainedDctcc =
202:                //    unconstrainedCtcon.getDynamicConstraintContext();
203:                ////
204:                //Class unconstrainedClasses[] = new Class[1];
205:                //unconstrainedClasses[0] = TaglibDeclareMacroWebPageTag.class;
206:                //unconstrainedDctcc.getValidator().allowOnlyTheseClasses(
207:                //    unconstrainedClasses, "Only Macro tags are allowed here");
208:                ////
209:                //unconstrainedDctcc.addDefaultValue(
210:                //    TaglibDeclareMacroWebPageTag.class);
211:
212:                //
213:                inIctc.initialize();
214:
215:                //
216:                this .macroCtchar = macroCtcon.getCharacteristic();
217:            }
218:
219:            public void appraise(AppraiseConceptTagContext inActc) {
220:
221:                if (inActc instanceof  StudioConceptTagInstanceInfoContext) {
222:
223:                    StudioConceptTagInstanceInfoContext sctiic = (StudioConceptTagInstanceInfoContext) inActc;
224:
225:                    sctiic.setInstanceTitle("Declare Macro Set");
226:                    sctiic.setInstanceDescription("Declare Macro Set");
227:                } else if (inActc instanceof  StudioConceptTagTypeInfoContext) {
228:
229:                    StudioConceptTagTypeInfoContext scttic = (StudioConceptTagTypeInfoContext) inActc;
230:
231:                    scttic.setTypeTitle("Declare Macro Set");
232:                    scttic.setTypeDescription("Declare Macro Set");
233:                } else if (inActc instanceof  WebPageTagInstanceViewContext) {
234:
235:                    WebPageTagInstanceViewContext wptivc = (WebPageTagInstanceViewContext) inActc;
236:
237:                    //
238:                    WebPageTagInstanceViewContextInfo info = wptivc
239:                            .getInfoAsHtml();
240:
241:                    //
242:                    HashMap attrs = new HashMap();
243:                    //
244:                    attrs.put("width", "100%");
245:                    //attrs.put("border", "1");
246:                    //attrs.put("cellspacing", "0");
247:                    //attrs.put("cellpadding", "0");
248:                    //
249:                    info.declareMouseOutBorderAsBlack();
250:                    info.declareMouseOutBorderAsTwoPixel();
251:                    info.declareMouseOutBorderAsSolid();
252:                    //
253:                    WebPageTagInstanceViewContextInfo
254:                            .getMousePointerActions(attrs);
255:                    //
256:                    //
257:                    //
258:                    info
259:                            .setHtmlContent(WebPageTagInstanceViewContextSubHtmlInfo
260:                                    .newInstance("table", attrs));
261:                    WebPageTagInstanceViewContextInfo subMacroGroupInfo = info
262:                            .createHtmlInfo();
263:                    subMacroGroupInfo
264:                            .setHtmlContent(
265:                                    "<tr><td align=\"center\" style=\"border: 1px dotted gray\">",
266:                                    "Macro Group</td></tr>", true);
267:                    //info.setStartContent(
268:                    //    "<table " + XMLHelper.convertAttrs(attrs) + " onclick=\"",
269:                    //    "\"><tr><td align=\"center\">Macro Group</td></tr>");
270:                    //
271:                    if (this .macroCtchar.getValueLength() > 0) {
272:                        for (int i = 0; i < this .macroCtchar.getValueLength(); i++) {
273:                            WebPageTagInstanceViewContextInfo nextRowInfo = info
274:                                    .createHtmlInfo();
275:                            nextRowInfo.setHtmlContent("<tr><td>",
276:                                    "</td></tr>", true);
277:                            //
278:                            WebPageTagInstanceViewContext.displayView(
279:                                    this .macroCtchar, nextRowInfo, wptivc, i,
280:                                    i + 1);
281:                            //
282:                            //nextRowInfo.setEndContent("</td></tr>");
283:                        }
284:                    } else {
285:                        //
286:                        //
287:                        //
288:                        WebPageTagInstanceViewContextInfo nextRowInfo = info
289:                                .createHtmlInfo();
290:                        //
291:                        HashMap nextRowAttrs = new HashMap();
292:                        HashMap nextCellAttrs = new HashMap();
293:                        //
294:                        nextRowInfo
295:                                .setHtmlContent(WebPageTagInstanceViewContextSubHtmlInfo
296:                                        .newInstance("tr", nextRowAttrs));
297:                        //
298:                        //
299:                        //
300:                        WebPageTagInstanceViewContextInfo nextCellInfo = nextRowInfo
301:                                .createHtmlInfo(MACRO_CTCON);
302:                        //
303:                        nextCellInfo
304:                                .setHtmlContent(WebPageTagInstanceViewContextSubHtmlInfo
305:                                        .newInstance("td", nextCellAttrs));
306:                        //
307:                        //
308:                        //
309:                        WebPageTagInstanceViewContextInfo nextCellContentInfo = nextCellInfo
310:                                .createHtmlInfo();
311:                        //
312:                        nextCellContentInfo.setHtmlContent(
313:                                "(No Macro Declared - Click Here To Create)",
314:                                true);
315:                        //
316:                        //WebPageTagInstanceViewContextInfo nextCellInfo =
317:                        //    nextRowInfo.createHtmlInfo();
318:                        //nextRowInfo.setHtmlContent(
319:                        //    "<tr><td align=\"center\">(No Macros Declared)</td></tr>",
320:                        //    true);
321:                    }
322:                    //titleInfo.setStartContent(
323:                    //    "<table width=\"100%\"><tr align=\"center\">"
324:                    //        + "<td align=\"center\">Title - ");
325:                    //WebPageTagInstanceViewContext.displayView(
326:                    //    this.titleCtchar, titleInfo, wptivc);
327:                    //info.setEndContent("</table>");
328:
329:                    //
330:                    //
331:                    //
332:                } else if (inActc instanceof  SelectionCriteriaForReturnableConceptTag) {
333:
334:                    SelectionCriteriaForReturnableConceptTag scfrct = (SelectionCriteriaForReturnableConceptTag) inActc;
335:
336:                    scfrct.canReturnNothing();
337:                    scfrct.declareFormatAsHtml();
338:
339:                    ConceptTagFlagsHelper.assertCanBeDirectChildOfRoot(scfrct);
340:
341:                    //ConceptTagFlagsHelper.setConceptTagAsUndeployable(scfrct);
342:                } else if (inActc instanceof  StudioConceptTagCreParInfoContext) {
343:
344:                    StudioConceptTagCreParInfoContext scpc = (StudioConceptTagCreParInfoContext) inActc;
345:                }
346:            }
347:
348:            //
349:            public void determineClass(DetermineClassConceptTagContext inDcctc) {
350:
351:                inDcctc.setDetermineClass(StandardDataTypes.getNothingClass());
352:            }
353:
354:            //
355:            //
356:            //
357:            public void determineValueAndClass(
358:                    DetermineValueAndClassConceptTagContext inDvacctc) {
359:
360:                try {
361:                    //
362:                    String macroHandle = ConceptTagFlagsHelper
363:                            .getMacroCallHandle(inDvacctc);
364:                    ValueAndClassForConceptTag vacs[] = ConceptTagFlagsHelper
365:                            .getMacroCallVacs(inDvacctc);
366:                    //
367:                    WebPageTagMacro signatureMacro = WebPageTagMacroHelper
368:                            .getMacroFromString(macroHandle);
369:                    //
370:                    WebPageTagMacro targetMacro = null;
371:                    for (int i = 0; i < getValidAndInvalidSignatureLength(); i++) {
372:                        if (isSignatureMatch(i, signatureMacro.getName(),
373:                                signatureMacro.getParameterTypes())) {
374:                            //
375:                            targetMacro = getMacro(i);
376:                            break;
377:                        }
378:                    }
379:                    if (targetMacro == null) {
380:                        throw new DetermineValueAndClassConceptTagException(
381:                                "Macro with handle '" + macroHandle
382:                                        + "' not found");
383:                    }
384:                    //
385:                    ReturnableConceptTag rct = ((ReturnableConceptTag) targetMacro);
386:                    //
387:                    ValueAndClassForConceptTag resultVac = ConceptTagHelper
388:                            .getDetermineValueAndClass(rct, inDvacctc);
389:                    //wptmg.executeMacro(macro, vac, inDvacctc);
390:                    //inherit return value and determine vacs
391:                    ConceptTagFlagsHelper
392:                            .emptyVacResIntoParentVacRes(inDvacctc);
393:                    //ConceptTagFlagsHelper.addVacToParDetVacRes(
394:                    //    inDvacctc, nextVac);
395:                    inDvacctc.setDetermineValueAndClass(resultVac);
396:                } catch (DetermineValueAndClassConceptTagException dvaccte) {
397:                    inDvacctc.setDetermineException(dvaccte);
398:                }
399:                //catch (IOException ioe) {
400:                //    inDvacctc.setDetermineException(ioe);
401:                //}
402:                //catch (ParserConfigurationException pce) {
403:                //    inDvacctc.setDetermineException(pce);
404:                //}
405:                //catch (SAXException saxe) {
406:                //    inDvacctc.setDetermineException(saxe);
407:                //}
408:            }
409:
410:            //
411:            //
412:            //
413:            public Object createUninitializedSelf() {
414:                return new TaglibDeclareMacroGroupWebPageTag();
415:            }
416:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.