Source Code Cross Referenced for NewStiqPageResponder.java in  » Testing » StoryTestIQ » fitnesse » responders » refactoring » 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 » Testing » StoryTestIQ » fitnesse.responders.refactoring 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // Copyright (C) 2003,2004,2005 by Object Mentor, Inc. All rights reserved.
002:        // Released under the terms of the GNU General Public License version 2 or later.
003:        package fitnesse.responders.refactoring;
004:
005:        import java.util.*;
006:
007:        import fitnesse.*;
008:        import fitnesse.responders.SecureResponder;
009:        import fitnesse.util.CollectionsUtil;
010:        import fitnesse.wikitext.widgets.ContentsTreeWidget;
011:        import fitnesse.authentication.*;
012:        import fitnesse.html.*;
013:        import fitnesse.http.*;
014:
015:        /** Create a new page.
016:         */
017:        public class NewStiqPageResponder implements  SecureResponder {
018:
019:            public static final String RESPONDER_KEY = "newStiqPage";
020:            public static final String STIQ_PAGE_NAME_INPUT_NAME = "stiqPageName";
021:            public static final String STIQ_PAGE_TYPE_SELECT_NAME = "newStiqPageType";
022:
023:            // FIXME: this cries out to be put in an enumeration.
024:            public static final String STIQ_PAGE_TYPE_TEST = "Test";
025:            public static final String STIQ_PAGE_TYPE_TEST_SUITE = "Test Suite";
026:            public static final String STIQ_PAGE_TYPE_COMPONENT = "Component";
027:            public static final String STIQ_PAGE_TYPE_COMPONENT_SUITE = "Component Suite";
028:            public static final String STIQ_PAGE_TYPE_CONTAINER = "Container";
029:            public static final String STIQ_PAGE_TYPE_TAG_SUITE = "Tag Suite";
030:
031:            public static final Map TEST_TYPES_ICONS = Collections
032:                    .unmodifiableMap(CollectionsUtil.createMap(new Object[] {
033:                            STIQ_PAGE_TYPE_TEST,
034:                            ContentsTreeWidget.STIQ_TEST_IMAGE,
035:                            STIQ_PAGE_TYPE_TEST_SUITE,
036:                            ContentsTreeWidget.STIQ_SUITE_IMAGE,
037:                            STIQ_PAGE_TYPE_COMPONENT,
038:                            ContentsTreeWidget.STIQ_COMPONENT_IMAGE,
039:                            STIQ_PAGE_TYPE_COMPONENT_SUITE,
040:                            ContentsTreeWidget.STIQ_SUITE_IMAGE,
041:                            STIQ_PAGE_TYPE_CONTAINER,
042:                            ContentsTreeWidget.STIQ_CONTAINER_IMAGE,
043:                            STIQ_PAGE_TYPE_TAG_SUITE,
044:                            ContentsTreeWidget.STIQ_SUITE_IMAGE, }));
045:
046:            public static final List STIQ_PAGE_TYPES = Collections
047:                    .unmodifiableList(CollectionsUtil
048:                            .createList(new Object[] { STIQ_PAGE_TYPE_TEST,
049:                                    STIQ_PAGE_TYPE_TEST_SUITE,
050:                                    STIQ_PAGE_TYPE_COMPONENT,
051:                                    STIQ_PAGE_TYPE_COMPONENT_SUITE,
052:                                    STIQ_PAGE_TYPE_CONTAINER,
053:                                    STIQ_PAGE_TYPE_TAG_SUITE, }));
054:
055:            private String resource;
056:
057:            public Response makeResponse(FitNesseContext context,
058:                    Request request) throws Exception {
059:                resource = request.getResource();
060:                SimpleResponse response = new SimpleResponse();
061:                response.setContent(html(context));
062:                return response;
063:            }
064:
065:            public String html(FitNesseContext context) throws Exception {
066:                HtmlPage html = context.htmlPageFactory.newPage();
067:                html.title.use("New STIQ Page in " + resource);
068:                html.header.use(HtmlUtil.makeBreadCrumbsWithPageType(resource,
069:                        "New STIQ Page"));
070:                html.main.use(mainContent());
071:                return html.html();
072:            }
073:
074:            private HtmlTag mainContent() throws Exception {
075:                TagGroup group = new TagGroup();
076:                group.add(createPageForm());
077:                return group;
078:            }
079:
080:            private HtmlTag makeHeaderTag(String content) throws Exception {
081:                return new HtmlTag("h3", content);
082:            }
083:
084:            private HtmlTag createPageForm() throws Exception {
085:                TagGroup group = new TagGroup();
086:                group.add(makeHeaderTag("New Page:"));
087:                group.add("A child page will be created.");
088:                group.add(makeCreatePageForm());
089:                return group;
090:            }
091:
092:            private HtmlTag makeCreatePageForm() throws Exception {
093:                HtmlTag form = HtmlUtil.makeFormTag("get", resource);
094:                form.add(HtmlUtil.makeInputTag("hidden", "responder",
095:                        "createStiqPage"));
096:                form.add(HtmlUtil.P);
097:                form.add(" Name: ");
098:                form.add(HtmlUtil.makeInputTag("text",
099:                        STIQ_PAGE_NAME_INPUT_NAME, ""));
100:                form.add(HtmlUtil.BR);
101:
102:                for (int i = 0, len = STIQ_PAGE_TYPES.size(); i < len; ++i) {
103:                    String testType = (String) STIQ_PAGE_TYPES.get(i);
104:                    form.add(HtmlUtil.P);
105:                    HtmlTag button = HtmlUtil.makeRadioTag(
106:                            STIQ_PAGE_TYPE_SELECT_NAME, testType, i == 0);
107:                    button.setAddNewlineAfter(false);
108:                    form.add(button + "&nbsp;");
109:
110:                    HtmlTag img = new HtmlTag("img");
111:                    img.addAttribute("src", (String) TEST_TYPES_ICONS
112:                            .get(testType));
113:                    img.addAttribute("alt", testType);
114:                    img.addAttribute("width", String
115:                            .valueOf(ContentsTreeWidget.STIQ_ICON_WIDTH));
116:                    img.addAttribute("height", String
117:                            .valueOf(ContentsTreeWidget.STIQ_ICON_HEIGHT));
118:                    form.add(img);
119:
120:                    form.add(testType + "\n");
121:                }
122:
123:                form.add(HtmlUtil.P);
124:                form.add(HtmlUtil.makeInputTag("submit", "create",
125:                        "Create Page"));
126:                return form;
127:            }
128:
129:            public SecureOperation getSecureOperation() {
130:                return new AlwaysSecureOperation();
131:            }
132:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.