You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(16) |
Sep
(10) |
Oct
(1) |
Nov
(2) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(148) |
Feb
(80) |
Mar
(41) |
Apr
(85) |
May
(247) |
Jun
(345) |
Jul
(237) |
Aug
(241) |
Sep
(439) |
Oct
(321) |
Nov
(413) |
Dec
(302) |
2004 |
Jan
(143) |
Feb
(147) |
Mar
(200) |
Apr
(107) |
May
(15) |
Jun
(36) |
Jul
(11) |
Aug
(1) |
Sep
(36) |
Oct
|
Nov
(6) |
Dec
|
2005 |
Jan
|
Feb
|
Mar
|
Apr
(115) |
May
(74) |
Jun
(215) |
Jul
(82) |
Aug
(47) |
Sep
(32) |
Oct
(8) |
Nov
(70) |
Dec
(24) |
2006 |
Jan
|
Feb
(1) |
Mar
(4) |
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <jm...@us...> - 2005-07-11 07:16:59
|
Update of /cvsroot/struts/dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14553 Added Files: StrutsDialogs.ipr StrutsDialogs.iws pieces.txt Log Message: --- NEW FILE: StrutsDialogs.ipr --- <?xml version="1.0" encoding="UTF-8"?> <project version="3" relativePaths="false"> <component name="ProjectRootManager" version="2"> <jdk name="java version "1.4.2_02"" /> <projectPath> <root type="composite"> <root type="simple" url="file://$PROJECT_DIR$" /> <root type="simple" url="file://P:/Tomcat4-1-31/work/Standalone/localhost/sd" /> <root type="simple" url="file://C:/strutsapps/struts-site/src" /> </root> </projectPath> <sourcePath> <root type="composite"> <root type="simple" url="file://$PROJECT_DIR$/src" /> <root type="jdk" rootType="sourcePath" name="java version "1.4.2_02"" /> <root type="simple" url="file://P:/Tomcat4-1-31/work/Standalone/localhost/sd" /> <root type="simple" url="file://C:/strutsapps/struts-site/src" /> </root> </sourcePath> <classPath> <root type="composite"> <root type="output" /> <root type="jdk" rootType="classPath" name="java version "1.4.2_02"" /> <root type="simple" url="jar://$PROJECT_DIR$/war/WEB-INF/lib/commons-logging.jar!/" /> <root type="simple" url="jar://C:/j2eesdk/lib/j2ee.jar!/" /> <root type="simple" url="jar://$PROJECT_DIR$/war/WEB-INF/lib/struts.jar!/" /> <root type="simple" url="jar://P:/Tomcat4-1-31/server/lib/tomcat-coyote.jar!/" /> <root type="simple" url="jar://P:/Tomcat4-1-31/common/lib/jasper-runtime.jar!/" /> </root> </classPath> <excludePath> <root type="composite"> <root type="excludedOutput" /> </root> </excludePath> <javadocPath> <root type="composite"> <root type="jdk" rootType="javadocPath" name="java version "1.4.2_02"" /> <root type="simple" url="file://C:/j2sdk1.4.2_02/docs/api" /> </root> </javadocPath> <assert_keyword enabled="no" /> <exclude_output enabled="yes" /> </component> <component name="CompilerConfiguration"> <option name="DEFAULT_COMPILER" value="Javac" /> <option name="SYNCHRONIZE_OUTPUT_DIRECTORY" value="false" /> <option name="DEFAULT_OUTPUT_PATH" /> <option name="OUTPUT_MODE" value="single" /> <resourceExtensions> <entry name=".+\.(properties|xml|html)" /> <entry name=".+\.(gif|png|jpeg|jpg)" /> </resourceExtensions> </component> <component name="JavacSettings"> <option name="DEBUGGING_INFO" value="true" /> <option name="GENERATE_NO_WARNINGS" value="false" /> <option name="DEPRECATION" value="true" /> <option name="ADDITIONAL_OPTIONS_STRING" value="" /> <option name="MAXIMUM_HEAP_SIZE" value="128" /> </component> <component name="JikesSettings"> <option name="JIKES_PATH" value="" /> <option name="DEBUGGING_INFO" value="true" /> <option name="DEPRECATION" value="true" /> <option name="GENERATE_NO_WARNINGS" value="false" /> <option name="GENERATE_MAKE_FILE_DEPENDENCIES" value="false" /> <option name="DO_FULL_DEPENDENCE_CHECK" value="false" /> <option name="IS_EMACS_ERRORS_MODE" value="true" /> <option name="ADDITIONAL_OPTIONS_STRING" value="" /> </component> <component name="AntConfiguration"> <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" /> <option name="FILTER_TARGETS" value="false" /> </component> <component name="JavadocGenerationManager"> <option name="OUTPUT_DIRECTORY" /> <option name="OPTION_SCOPE" value="protected" /> <option name="OPTION_HIERARCHY" value="true" /> <option name="OPTION_NAVIGATOR" value="true" /> <option name="OPTION_INDEX" value="true" /> <option name="OPTION_SEPARATE_INDEX" value="true" /> <option name="OPTION_DOCUMENT_TAG_USE" value="false" /> <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" /> <option name="OPTION_DOCUMENT_TAG_VERSION" value="false" /> <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" /> <option name="OPTION_DEPRECATED_LIST" value="true" /> <option name="OTHER_OPTIONS" value="" /> <option name="HEAP_SIZE" /> <option name="OPEN_IN_BROWSER" value="true" /> </component> <component name="WebManager"> <option enabled="false" /> </component> <component name="WebRootContainer" /> <component name="EjbManager" enabled="false" /> <component name="JUnitProjectSettings"> <option name="TEST_RUNNER" value="UI" /> </component> <component name="EntryPointsManager"> <entry_points /> </component> <component name="EjbActionsConfiguration"> <option name="NEW_MESSAGE_BEAN_LAST_PACKAGE" value="" /> <option name="NEW_ENTITY_BEAN_LAST_PACKAGE" value="" /> <option name="NEW_SESSION_BEAN_LAST_PACKAGE" value="" /> </component> <component name="CodeStyleManager"> <option name="USE_DEFAULT_CODE_STYLE_SCHEME" value="true" /> <option name="CODE_STYLE_SCHEME" value="" /> </component> <component name="ExportToHTMLSettings"> <option name="PRINT_LINE_NUMBERS" value="false" /> <option name="OPEN_IN_BROWSER" value="false" /> <option name="OUTPUT_DIRECTORY" /> </component> </project> --- NEW FILE: StrutsDialogs.iws --- <?xml version="1.0" encoding="UTF-8"?> <project version="3" relativePaths="false"> <component name="FileEditorManager"> <history> <source-position-entry url="file://$PROJECT_DIR$/src/net/sf/dialogs/actions/DialogAction.java" line="433" column="25" vertical-scroll-proportion="0.7387964" horizontal-scroll-proportion="0.23777173" /> <source-position-entry url="file://$PROJECT_DIR$/src/net/sf/collab/MyForwardAction.java" line="26" column="0" vertical-scroll-proportion="0.42444152" horizontal-scroll-proportion="0.0" /> <source-position-entry url="file://$PROJECT_DIR$/src/net/sf/dialogs/samples/crudaction/CRUDFormSample.java" line="37" column="39" vertical-scroll-proportion="0.5808147" horizontal-scroll-proportion="0.3709239" /> <source-position-entry url="file://$PROJECT_DIR$/src/net/sf/dialogs/actions/crud/CRUDForm.java" line="64" column="37" vertical-scroll-proportion="0.8173456" horizontal-scroll-proportion="0.3519022" /> <source-position-entry url="file://$PROJECT_DIR$/src/net/sf/dialogs/actions/crud/ICRUDForm.java" line="41" column="31" vertical-scroll-proportion="0.36793694" horizontal-scroll-proportion="0.29483697" /> <source-position-entry url="file://$PROJECT_DIR$/war/WEB-INF/web.xml" line="28" column="17" vertical-scroll-proportion="0.62549275" horizontal-scroll-proportion="0.16168478" /> <source-position-entry url="file://$PROJECT_DIR$/src/net/sf/collab/TabControlActionInput.java" line="36" column="0" vertical-scroll-proportion="0.6478318" horizontal-scroll-proportion="0.0" /> <source-position-entry url="file://$PROJECT_DIR$/src/net/sf/collab/TabControlActionView.java" line="31" column="0" vertical-scroll-proportion="0.5224072" horizontal-scroll-proportion="0.0" /> <source-position-entry url="file://$PROJECT_DIR$/src/net/sf/collab/MasterPageAction.java" line="40" column="0" vertical-scroll-proportion="0.8169014" horizontal-scroll-proportion="0.0"> <folding> <element signature="imports" expanded="true" /> </folding> </source-position-entry> <source-position-entry url="file://$PROJECT_DIR$/war/WEB-INF/struts-config.xml" line="231" column="26" vertical-scroll-proportion="0.19846351" horizontal-scroll-proportion="0.2133646" /> <source-position-entry url="file://$PROJECT_DIR$/src/net/sf/collab/TabControlAction.java" line="40" column="49" vertical-scroll-proportion="0.58514726" horizontal-scroll-proportion="0.4021102"> <folding> <element signature="imports" expanded="true" /> </folding> </source-position-entry> <source-position-entry url="file://$PROJECT_DIR$/war/tabs.jsp" line="15" column="43" vertical-scroll-proportion="0.31882203" horizontal-scroll-proportion="0.35287222" /> <source-position-entry url="file://$PROJECT_DIR$/war/crudaction-list.jsp" line="35" column="7" vertical-scroll-proportion="0.51379764" horizontal-scroll-proportion="0.057444315" /> <source-position-entry url="file://$PROJECT_DIR$/src/net/sf/dialogs/samples/crudaction/CRUDListActionSample.java" line="19" column="28" vertical-scroll-proportion="0.15637319" horizontal-scroll-proportion="0.22977726" /> <source-position-entry url="file://$PROJECT_DIR$/war/mainpage.jsp" line="11" column="14" vertical-scroll-proportion="0.2457293" horizontal-scroll-proportion="0.11488863" /> <source-position-entry url="file://$PROJECT_DIR$/war/crudaction-lite-list.jsp" line="3" column="0" vertical-scroll-proportion="-0.5755585" horizontal-scroll-proportion="0.0" /> <source-position-entry url="file://C:/strutsapps/struts-site/src/documentation/content/xdocs/strutsdialogs/dialogaction.xml" line="0" column="0" vertical-scroll-proportion="0.0" horizontal-scroll-proportion="0.0" /> <source-position-entry url="file://C:/strutsapps/struts-site/src/documentation/content/xdocs/strutsdialogs/crudaction.xml" line="14" column="95" vertical-scroll-proportion="0.31274638" horizontal-scroll-proportion="0.7796014" /> <source-position-entry url="file://C:/strutsapps/struts-site/src/documentation/content/xdocs/strutsdialogs/dialogaction-logincomponentsample.xml" line="20" column="0" vertical-scroll-proportion="0.44678056" horizontal-scroll-proportion="0.0" /> <source-position-entry url="file://C:/strutsapps/struts-site/src/documentation/content/xdocs/strutsdialogs/index.xml" line="95" column="8" vertical-scroll-proportion="0.5611038" horizontal-scroll-proportion="0.06565064" /> <source-position-entry url="file://$PROJECT_DIR$/src/net/sf/dialogs/actions/wizard/IWizardManager.java" line="26" column="17" vertical-scroll-proportion="0.35742444" horizontal-scroll-proportion="0.13950762" /> <source-position-entry url="file://$PROJECT_DIR$/src/net/sf/dialogs/actions/wizard/WizardAction.java" line="78" column="0" vertical-scroll-proportion="-1.6911958" horizontal-scroll-proportion="0.0" /> <source-position-entry url="file://$PROJECT_DIR$/src/net/sf/dialogs/actions/wizard/WizardConstants.java" line="56" column="0" vertical-scroll-proportion="0.892247" horizontal-scroll-proportion="0.0" /> <source-position-entry url="file://$PROJECT_DIR$/src/net/sf/dialogs/actions/wizard/WizardForm.java" line="33" column="33" vertical-scroll-proportion="-1.8291721" horizontal-scroll-proportion="0.2708089" /> <source-position-entry url="file://C:/strutsapps/struts-site/src/documentation/content/xdocs/strutsdialogs/wizardaction.xml" line="13" column="7" vertical-scroll-proportion="0.28383705" horizontal-scroll-proportion="0.057444315" /> </history> <open-files> <source-position-entry url="file://$PROJECT_DIR$/war/crudaction-lite-list.jsp" line="3" column="0" vertical-scroll-proportion="-0.5755585" horizontal-scroll-proportion="0.0" /> <source-position-entry url="file://C:/strutsapps/struts-site/src/documentation/content/xdocs/strutsdialogs/index.xml" line="95" column="8" vertical-scroll-proportion="0.5611038" horizontal-scroll-proportion="0.06565064" /> <source-position-entry url="file://C:/strutsapps/struts-site/src/documentation/content/xdocs/strutsdialogs/dialogaction.xml" line="0" column="0" vertical-scroll-proportion="0.0" horizontal-scroll-proportion="0.0" /> <source-position-entry url="file://C:/strutsapps/struts-site/src/documentation/content/xdocs/strutsdialogs/wizardaction.xml" line="13" column="7" vertical-scroll-proportion="0.28383705" horizontal-scroll-proportion="0.057444315" selected="true" /> <source-position-entry url="file://$PROJECT_DIR$/src/net/sf/dialogs/actions/wizard/WizardForm.java" line="33" column="33" vertical-scroll-proportion="-1.8291721" horizontal-scroll-proportion="0.2708089" /> <source-position-entry url="file://$PROJECT_DIR$/src/net/sf/dialogs/actions/wizard/IWizardManager.java" line="26" column="17" vertical-scroll-proportion="0.35742444" horizontal-scroll-proportion="0.13950762" /> <source-position-entry url="file://C:/strutsapps/struts-site/src/documentation/content/xdocs/strutsdialogs/dialogaction-logincomponentsample.xml" line="20" column="0" vertical-scroll-proportion="0.44678056" horizontal-scroll-proportion="0.0" /> <source-position-entry url="file://C:/strutsapps/struts-site/src/documentation/content/xdocs/strutsdialogs/crudaction.xml" line="14" column="95" vertical-scroll-proportion="0.31274638" horizontal-scroll-proportion="0.7796014" /> <source-position-entry url="file://$PROJECT_DIR$/src/net/sf/dialogs/actions/wizard/WizardAction.java" line="78" column="0" vertical-scroll-proportion="-1.6911958" horizontal-scroll-proportion="0.0" /> <source-position-entry url="file://$PROJECT_DIR$/src/net/sf/dialogs/actions/wizard/WizardConstants.java" line="56" column="0" vertical-scroll-proportion="0.892247" horizontal-scroll-proportion="0.0" /> </open-files> </component> <component name="ToolWindowManager"> <frame x="-4" y="-4" width="1288" height="975" extended-state="0" /> <editor active="true" /> <layout> <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="1" /> <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="2" /> <window_info id="Hierarchy" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.24839228" order="3" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="7" /> <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="sliding" type="sliding" visible="false" weight="0.4" order="0" /> <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.2570281" order="0" /> <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.4" order="3" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.24738955" order="1" /> <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25730994" order="1" /> <window_info id="Messages" active="false" anchor="bottom" auto_hide="true" internal_type="sliding" type="sliding" visible="false" weight="0.33" order="8" /> <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.4" order="6" /> <window_info id="Web" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="2" /> <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="5" /> <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="0" /> <window_info id="EJB" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="4" /> </layout> </component> <component name="Debugger"> <line_breakpoints /> <exception_breakpoints> <breakpoint_any> <option name="NOTIFY_CAUGHT" value="true" /> <option name="NOTIFY_UNCAUGHT" value="true" /> <option name="ENABLED" value="false" /> <option name="SUSPEND_VM" value="true" /> <option name="COUNT_FILTER_ENABLED" value="false" /> <option name="COUNT_FILTER" value="0" /> <option name="CONDITION_ENABLED" value="false" /> <option name="CONDITION" /> <option name="LOG_ENABLED" value="false" /> <option name="LOG_EXPRESSION_ENABLED" value="false" /> <option name="LOG_MESSAGE" /> <option name="CLASS_FILTERS_ENABLED" value="false" /> <option name="INVERSE_CLASS_FILLTERS" value="false" /> <option name="SUSPEND_POLICY" value="SuspendAll" /> </breakpoint_any> </exception_breakpoints> <field_breakpoints /> <method_breakpoints /> </component> <component name="DebuggerManager" /> <component name="DebuggerSettings"> <option name="TRACING_FILTERS_ENABLED" value="true" /> <option name="TOSTRING_CLASSES_ENABLED" value="false" /> <option name="VALUE_LOOKUP_DELAY" value="700" /> <option name="DEBUGGER_TRANSPORT" value="0" /> <option name="FORCE_CLASSIC_VM" value="true" /> <option name="HIDE_DEBUGGER_ON_PROCESS_TERMINATION" value="false" /> <option name="SKIP_SYNTHETIC_METHODS" value="true" /> <option name="SKIP_CONSTRUCTORS" value="false" /> <option name="STEP_THREAD_SUSPEND_POLICY" value="SuspendThread" /> <option name="EVALUATION_TIMEOUT" value="1000" /> <default_breakpoint_settings> <option name="NOTIFY_CAUGHT" value="true" /> <option name="NOTIFY_UNCAUGHT" value="true" /> <option name="WATCH_MODIFICATION" value="true" /> <option name="WATCH_ACCESS" value="true" /> <option name="WATCH_ENTRY" value="true" /> <option name="WATCH_EXIT" value="true" /> <option name="ENABLED" value="true" /> <option name="SUSPEND_VM" value="true" /> <option name="COUNT_FILTER_ENABLED" value="false" /> <option name="COUNT_FILTER" value="0" /> <option name="CONDITION_ENABLED" value="false" /> <option name="CONDITION" /> <option name="LOG_ENABLED" value="false" /> <option name="LOG_EXPRESSION_ENABLED" value="false" /> <option name="LOG_MESSAGE" /> <option name="CLASS_FILTERS_ENABLED" value="false" /> <option name="INVERSE_CLASS_FILLTERS" value="false" /> <option name="SUSPEND_POLICY" value="SuspendAll" /> </default_breakpoint_settings> <filter> <option name="PATTERN" value="com.sun.*" /> <option name="ENABLED" value="true" /> </filter> <filter> <option name="PATTERN" value="java.*" /> <option name="ENABLED" value="true" /> </filter> <filter> <option name="PATTERN" value="javax.*" /> <option name="ENABLED" value="true" /> </filter> <filter> <option name="PATTERN" value="org.omg.*" /> <option name="ENABLED" value="true" /> </filter> <filter> <option name="PATTERN" value="sun.*" /> <option name="ENABLED" value="true" /> </filter> <filter> <option name="PATTERN" value="junit.*" /> <option name="ENABLED" value="true" /> </filter> </component> <component name="CompilerWorkspaceConfiguration"> <option name="COMPILE_IN_BACKGROUND" value="false" /> <option name="AUTO_SHOW_ERRORS_IN_EDITOR" value="true" /> </component> <component name="ErrorTreeViewConfiguration"> <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" /> <option name="HIDE_WARNINGS" value="false" /> </component> <component name="DaemonCodeAnalyzer"> <disable_hints /> </component> <component name="StructureViewFactory"> <option name="SORT_MODE" value="0" /> <option name="GROUP_OVERRIDINGS" value="true" /> <option name="GROUP_IMPLEMENTINGS" value="false" /> <option name="AUTOSCROLL_MODE" value="true" /> <option name="SHOW_METHODS" value="true" /> <option name="SHOW_FIELDS" value="true" /> <option name="AUTOSCROLL_FROM_SOURCE" value="false" /> <option name="GROUP_GETTERS_AND_SETTERS" value="true" /> </component> <component name="CvsConfiguration"> <Checkout> <option name="DATE_TAG" value="" /> <option name="REVISION_TAG" value="" /> <option name="PRUNE_EMPTY_DIRS" value="true" /> <option name="RESET_STICKY_TAGS" value="false" /> <option name="NON_RECURSIVE" value="false" /> <option name="CREATE_WORKING_DIR" value="" /> <option name="ADDITIONAL_OPTIONS" value="" /> </Checkout> <Update> <option name="DATE_TAG" value="" /> <option name="REVISION_TAG" value="" /> <option name="PRUNE_EMPTY_DIRS" value="true" /> <option name="RESET_STICKY_TAGS" value="false" /> <option name="NON_RECURSIVE" value="false" /> <option name="CREATE_MISSING_DIRECTORIES" value="true" /> <option name="DONT_CHANGE_FILES" value="false" /> <option name="QUIET_MODE" value="false" /> <option name="ADDITIONAL_OPTIONS" value="" /> </Update> <Commit> <option name="NON_RECURSIVE" value="false" /> <option name="REVISION_TAG" value="" /> <option name="LOG_MESSAGE" value="" /> <option name="ADDITIONAL_OPTIONS" value="" /> </Commit> <Diff> <option name="REVISION_TAG" value="HEAD" /> <option name="DATE_TAG" value="" /> <option name="IGNORE_WHITESPACE" value="false" /> </Diff> <Add> <option name="ADD_AS_BINARY" value="false" /> <option name="LOG_MESSAGE" value="" /> </Add> <Status> <option name="NON_RECURSIVE" value="false" /> <option name="INCLUDE_TAGS" value="false" /> </Status> <Edit> <option name="NON_RECURSIVE" value="false" /> <option name="FORCE_RECURSIVE" value="false" /> <option name="EDIT" value="false" /> <option name="UNEDIT" value="false" /> <option name="COMMIT" value="false" /> <option name="ALL" value="true" /> <option name="NONE" value="false" /> </Edit> <Remove> <option name="NON_RECURSIVE" value="false" /> <option name="FORCE_RECURSIVE" value="false" /> <option name="DELETE_FILE" value="false" /> </Remove> <Log> <option name="DEFAULT_BRANCH" value="false" /> <option name="NON_RECURSIVE" value="false" /> <option name="QUIET_MODE" value="true" /> <option name="ADDITIONAL_OPTIONS" value="" /> </Log> <Editors> <option name="NON_RECURSIVE" value="false" /> <option name="FORCE_RECURSIVE" value="false" /> </Editors> <option name="CLIENT_PATH" value="" /> <option name="EXTERNAL_DIFF_PATH" /> <option name="USE_EXTERNAL_DIFF" value="false" /> <option name="WORKING_FILES_READONLY" value="false" /> <option name="COMPRESSION_LEVEL" value="0" /> <option name="ADDITIONAL_OPTIONS" value="" /> <option name="BINARY_FILES_EXTENSIONS" /> <option name="REUSE_LAST_LOG_MESSAGE" value="false" /> <option name="PUT_FOCUS_INTO_LOG_MESSAGE" value="false" /> <option name="SHOW_UPDATE_OPTIONS" value="true" /> <option name="SHOW_COMMIT_OPTIONS" value="true" /> <option name="SHOW_DIFF_OPTIONS" value="true" /> <option name="SHOW_ADD_OPTIONS" value="true" /> <option name="SHOW_STATUS_OPTIONS" value="true" /> <option name="SHOW_EDIT_OPTIONS" value="true" /> <option name="SHOW_UNEDIT_OPTIONS" value="true" /> <option name="SHOW_REMOVE_OPTIONS" value="true" /> <option name="SHOW_LOG_OPTIONS" value="true" /> <option name="SHOW_EDITORS_OPTIONS" value="true" /> <option name="HIDE_UNKNOWN_FILES" value="false" /> <option name="HIDE_MISSING_FILES" value="false" /> <option name="HIDE_UP_TO_DATE_FILES" value="false" /> </component> <component name="CvsVcs"> <expanded_paths /> </component> <component name="ProjectViewSettings"> <navigator currentView="ProjectPane" flattenPackages="false" showMembers="false" showStructure="true" autoscrollToSource="false" splitterProportion="0.7222222" /> <view id="ProjectPane"> <expanded_node type="directory" url="file://C:/strutsapps/struts-site/src/documentation/content/xdocs" /> <expanded_node type="directory" url="file://$PROJECT_DIR$/src/net/sf/dialogs/actions/wizard" /> <expanded_node type="directory" url="file://$PROJECT_DIR$/src" /> <expanded_node type="directory" url="file://C:/strutsapps/struts-site/src/documentation/content" /> <expanded_node type="directory" url="file://$PROJECT_DIR$/src/net/sf/dialogs/actions" /> <expanded_node type="directory" url="file://C:/strutsapps/struts-site/src/documentation" /> <expanded_node type="directory" url="file://$PROJECT_DIR$" /> <expanded_node type="directory" url="file://$PROJECT_DIR$/src/net" /> <expanded_node type="directory" url="file://C:/strutsapps/struts-site/src/documentation/content/xdocs/strutsdialogs" /> <expanded_node type="directory" url="file://C:/strutsapps/struts-site/src" /> <expanded_node type="directory" url="file://$PROJECT_DIR$/src/net/sf/dialogs" /> <expanded_node type="directory" url="file://$PROJECT_DIR$/src/net/sf" /> </view> <view id="SourcepathPane" /> <view id="ClasspathPane" /> </component> <component name="RunManager"> <option name="SHOW_SETTINGS_BEFORE_RUNNING" value="true" /> <option name="COMPILE_BEFORE_RUNNING" value="true" /> <activeType name="Application" /> <configuration name="<template>" type="Application" default="true" selected="false"> <option name="MAIN_CLASS_NAME" /> <option name="VM_PARAMETERS" /> <option name="PROGRAM_PARAMETERS" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> </configuration> <configuration name="<template>" type="Applet" default="true" selected="false"> <option name="MAIN_CLASS_NAME" /> <option name="HTML_FILE_NAME" /> <option name="HTML_USED" value="false" /> <option name="WIDTH" value="400" /> <option name="HEIGHT" value="300" /> <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" /> <option name="VM_PARAMETERS" /> </configuration> <configuration name="<template>" type="JUnit" default="true" selected="false"> <option name="PACKAGE_NAME" /> <option name="MAIN_CLASS_NAME" /> <option name="METHOD_NAME" /> <option name="TEST_OBJECT" /> <option name="VM_PARAMETERS" /> <option name="PARAMETERS" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> </configuration> <configuration name="<template>" type="Remote" default="true" selected="false"> <option name="USE_SOCKET_TRANSPORT" value="true" /> <option name="SERVER_MODE" value="false" /> <option name="SHMEM_ADDRESS" value="javadebug" /> <option name="HOST" value="localhost" /> <option name="PORT" value="5005" /> </configuration> <configuration name="<template>" type="WebApp" default="true" selected="false"> <WebServerIntegration name="" /> <Host>localhost</Host> <Port>5050</Port> <LaunchServer>false</LaunchServer> </configuration> </component> <component name="BookmarkManager" /> <component name="Commander"> <leftPanel view="Project" /> <rightPanel view="Project" /> <splitter proportion="0.5" /> </component> <component name="PropertiesComponent"> <property name="MemberChooser.copyJavadoc" value="false" /> <property name="GoToClass.includeLibraries" value="false" /> <property name="MemberChooser.showClasses" value="true" /> <property name="MemberChooser.sorted" value="false" /> <property name="GoToFile.includeJavaFiles" value="false" /> <property name="GoToClass.toSaveIncludeLibraries" value="false" /> </component> <component name="SelectInManager" /> <component name="VssConfiguration"> <CheckoutOptions> <option name="COMMENT" value="" /> <option name="DO_NOT_GET_LATEST_VERSION" value="false" /> <option name="REPLACE_WRITABLE" value="false" /> <option name="RECURSIVE" value="false" /> </CheckoutOptions> <CheckinOptions> <option name="COMMENT" value="" /> <option name="KEEP_CHECKED_OUT" value="false" /> <option name="RECURSIVE" value="false" /> </CheckinOptions> <AddOptions> <option name="COMMENT" value="" /> <option name="STORE_ONLY_LATEST_VERSION" value="false" /> <option name="CHECK_OUT_IMMEDIATELY" value="false" /> <option name="FILE_TYPE" value="0" /> </AddOptions> <UndocheckoutOptions> <option name="MAKE_WRITABLE" value="false" /> <option name="REPLACE_LOCAL_COPY" value="0" /> <option name="RECURSIVE" value="false" /> </UndocheckoutOptions> <DiffOptions> <option name="IGNORE_WHITE_SPACE" value="false" /> <option name="IGNORE_CASE" value="false" /> </DiffOptions> <GetOptions> <option name="REPLACE_WRITABLE" value="0" /> <option name="MAKE_WRITABLE" value="false" /> <option name="RECURSIVE" value="false" /> </GetOptions> <option name="CLIENT_PATH" value="" /> <option name="SRCSAFEINI_PATH" value="" /> <option name="USER_NAME" value="" /> <option name="PWD" value="" /> <option name="SHOW_CHECKOUT_OPTIONS" value="true" /> <option name="SHOW_CHECKIN_OPTIONS" value="true" /> <option name="SHOW_ADD_OPTIONS" value="true" /> <option name="SHOW_UNDOCHECKOUT_OPTIONS" value="true" /> <option name="SHOW_DIFF_OPTIONS" value="true" /> <option name="SHOW_GET_OPTIONS" value="true" /> <option name="USE_EXTERNAL_DIFF" value="false" /> <option name="EXTERNAL_DIFF_PATH" value="" /> <option name="REUSE_LAST_COMMENT" value="false" /> <option name="PUT_FOCUS_INTO_COMMENT" value="false" /> </component> <component name="HierarchyBrowserManager"> <option name="SHOW_PACKAGES" value="false" /> <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" /> <option name="SORT_ALPHABETICALLY" value="false" /> </component> <component name="WebViewSettings"> <webview flattenPackages="false" showMembers="false" autoscrollToSource="false" /> </component> <component name="EjbViewSettings"> <EjbView showMembers="false" autoscrollToSource="false" /> </component> <component name="LvcsConfiguration"> <option name="LOCAL_VCS_ENABLED" value="true" /> <option name="LOCAL_VCS_PURGING_PERIOD" value="864000000" /> <option name="ADD_LABEL_ON_PROJECT_OPEN" value="true" /> <option name="ADD_LABEL_ON_PROJECT_COMPILATION" value="true" /> <option name="ADD_LABEL_ON_FILE_PACKAGE_COMPILATION" value="true" /> <option name="ADD_LABEL_ON_PROJECT_MAKE" value="true" /> <option name="ADD_LABEL_ON_RUNNING" value="true" /> <option name="ADD_LABEL_ON_DEBUGGING" value="true" /> <option name="ADD_LABEL_ON_UNIT_TEST" value="true" /> <option name="MARK_EXTERNAL_CHANGES_AS_UP_TO_DATE" value="true" /> </component> <component name="InspectionManager"> <option name="AUTOSCROLL_TO_SOURCE" value="false" /> <option name="SPLITTER_PROPORTION" value="0.5" /> <inspection_tool class="Unused declaration" enabled="false"> <option name="ADD_MAINS_TO_ENTRIES" value="true" /> <option name="ADD_JUNIT_TO_ENTRIES" value="true" /> <option name="ADD_EJB_TO_ENTRIES" value="true" /> <option name="ADD_APPLET_TO_ENTRIES" value="true" /> <option name="ADD_SERVLET_TO_ENTRIES" value="true" /> <option name="ADD_NONJAVA_TO_ENTRIES" value="true" /> </inspection_tool> <inspection_tool class="Declaration access can be weaker" enabled="false"> <option name="SUGGEST_PACKAGE_LOCAL_FOR_MEMBERS" value="true" /> <option name="SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES" value="true" /> <option name="SUGGEST_PRIVATE_FOR_INNERS" value="false" /> </inspection_tool> <inspection_tool class="Declaration can have static modifier" enabled="false" /> <inspection_tool class="Declaration can have final modifier" enabled="false"> <option name="REPORT_CLASSES" value="true" /> <option name="REPORT_METHODS" value="true" /> <option name="REPORT_FIELDS" value="true" /> </inspection_tool> <inspection_tool class="Unused method parameters" enabled="false" /> <inspection_tool class="Actual method parameter is the same constant" enabled="false" /> <inspection_tool class="Unused method return value" enabled="false" /> <inspection_tool class="Method returns the same value" enabled="false" /> <inspection_tool class="Empty method" enabled="false" /> <inspection_tool class="Redundant throws clause" enabled="false" /> <inspection_tool class="Constant conditions & exceptions" enabled="false" /> <inspection_tool class="Unused assignment" enabled="false" /> <inspection_tool class="Redundant type cast" enabled="false" /> <inspection_tool class="Local variable or parameter can be final" enabled="false"> <option name="REPORT_VARIABLES" value="true" /> <option name="REPORT_PARAMETERS" value="true" /> </inspection_tool> <inspection_tool class="Declaration has javadoc problems" enabled="false"> <option name="TOP_LEVEL_CLASS_OPTIONS"> <value> <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="public" /> <option name="REQUIRED_TAGS" value="" /> </value> </option> <option name="INNER_CLASS_OPTIONS"> <value> <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="protected" /> <option name="REQUIRED_TAGS" value="" /> </value> </option> <option name="METHOD_OPTIONS"> <value> <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="protected" /> <option name="REQUIRED_TAGS" value="@return@param@throws or @exception" /> </value> </option> <option name="FIELD_OPTIONS"> <value> <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="protected" /> <option name="REQUIRED_TAGS" value="" /> </value> </option> </inspection_tool> <inspection_tool class="Deprecated API usage" enabled="false" /> <inspection_tool class="equals() and hashCode() not paired" enabled="false" /> </component> <component name="TodoView" selected-index="0"> <todo-panel id="selected-file"> <are-packages-shown value="false" /> <flatten-packages value="false" /> <is-autoscroll-to-source value="true" /> </todo-panel> <todo-panel id="all"> <are-packages-shown value="true" /> <flatten-packages value="false" /> <is-autoscroll-to-source value="true" /> </todo-panel> </component> <component name="VcsManagerConfiguration"> <option name="ACTIVE_VCS_NAME" value="" /> </component> <component name="StarteamConfiguration"> <option name="SERVER" value="" /> <option name="PORT" value="49201" /> <option name="USER" value="" /> <option name="PASSWORD" value="" /> <option name="PROJECT" value="" /> <option name="VIEW" value="" /> <option name="ALTERNATIVE_WORKING_PATH" value="" /> </component> </project> --- NEW FILE: pieces.txt --- <noindex> <div class="tabs" id="toptabs"> <table cellspacing=0 cellpadding=4 border=0> <tbody> <tr> <% if ("mypages".equals(session.getAttribute("SECTION"))) { %><th><% } else {%><td><% } %> <!-- Master page is site/main, while request should go to site/tabcontrolinput, so go one level up --> <a href="../tabcontrolinput?section=mypages">My pages</a> <% if ("mypages".equals(session.getAttribute("SECTION"))) { %></th><% } else {%></td><% } %> <% if ("projects".equals(session.getAttribute("SECTION"))) { %><th><% } else {%><td><% } %> <a href="../tabcontrolinput?section=projects">Projects</a> <% if ("projects".equals(session.getAttribute("SECTION"))) { %></th><% } else {%></td><% } %> <% if ("news".equals(session.getAttribute("SECTION"))) { %><th><% } else {%><td><% } %> <a href="../tabcontrolinput?section=news">News</a> <% if ("news".equals(session.getAttribute("SECTION"))) { %></th><% } else {%></td><% } %> </tr> </tbody> </table> </div> </noindex> === <!-- <c:if test="${sectionName[0] == SECTION}"> <th><a href="../tabcontrolinput?section=<c:out value="${sectionName[0]}"/>"><c:out value="${sectionName[1]}"/></a></th> </c:if> <c:if test="${sectionName[0] != SECTION}"> <td><a href="../tabcontrolinput?section=<c:out value="${sectionName[0]}"/>"><c:out value="${sectionName[1]}"/></a></td> </c:if> --> <action path="/tabcontrolinput" type = "net.sf.collab.TabControlActionInput"> <forward name = "MAINPAGE" path="main" redirect="true"/> <forward name = "MAINPAGE_MYPAGES" path="main/mypages" redirect="true"/> <forward name = "MAINPAGE_PROJECTS" path="main/projects" redirect="true" /> <forward name = "MAINPAGE_NEWS" path="main/news" redirect="true"/> </action> <action path="/tabcontrolview" type = "net.sf.collab.TabControlActionView"> <forward name = "TABS" path="/tabs.jsp"/> </action> |
Update of /cvsroot/struts/dialogs/war In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/war Modified Files: allsamples.html crudaction-list.jsp index.htm wizard-signupconfirm.jsp wizard-signupdetails.jsp wizard-signupstart.jsp wizard-userpage.jsp Log Message: Index: allsamples.html =================================================================== RCS file: /cvsroot/struts/dialogs/war/allsamples.html,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** allsamples.html 11 Jul 2005 06:49:05 -0000 1.6 --- allsamples.html 11 Jul 2005 07:13:05 -0000 1.7 *************** *** 48,55 **** <a href="logincontrol.html">Embedded login Control</a><br> ! <h2>CRUDAction</h2> <a href="cruditemlist.do">Item list, CRUD operations</a><br> <h2>WizardAction</h2> --- 48,59 ---- <a href="logincontrol.html">Embedded login Control</a><br> ! <h2>CRUDAction (with setup list action)</h2> <a href="cruditemlist.do">Item list, CRUD operations</a><br> + <h2>CRUDAction (all-in-one web island)</h2> + + <a href="crudactionlite.do">Item list and CRUD operations in one action</a><br> + <h2>WizardAction</h2> Index: crudaction-list.jsp =================================================================== RCS file: /cvsroot/struts/dialogs/war/crudaction-list.jsp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** crudaction-list.jsp 21 Jun 2005 18:44:15 -0000 1.2 --- crudaction-list.jsp 11 Jul 2005 07:13:05 -0000 1.3 *************** *** 36,40 **** <!-- Show item list --> ! <logic:iterate id="item" name="crud-item-list" type="net.sf.dialogs.samples.crudaction.business.BusinessObj"> <html:form action="/crudaction.do"> <tr> --- 36,40 ---- <!-- Show item list --> ! <logic:iterate id="item" name="crud-item-list" type="net.jspcontrols.dialogs.samples.crudaction.business.BusinessObj"> <html:form action="/crudaction.do"> <tr> Index: index.htm =================================================================== RCS file: /cvsroot/struts/dialogs/war/index.htm,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** index.htm 11 Jul 2005 06:49:05 -0000 1.3 --- index.htm 11 Jul 2005 07:13:05 -0000 1.4 *************** *** 48,55 **** <a href="logincontrol.html">Embedded login Control</a><br> ! <h2>CRUDAction</h2> <a href="cruditemlist.do">Item list, CRUD operations</a><br> <h2>WizardAction</h2> --- 48,59 ---- <a href="logincontrol.html">Embedded login Control</a><br> ! <h2>CRUDAction (with setup list action)</h2> <a href="cruditemlist.do">Item list, CRUD operations</a><br> + <h2>CRUDAction (all-in-one web island)</h2> + + <a href="crudactionlite.do">Item list and CRUD operations in one action</a><br> + <h2>WizardAction</h2> Index: wizard-signupconfirm.jsp =================================================================== RCS file: /cvsroot/struts/dialogs/war/wizard-signupconfirm.jsp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wizard-signupconfirm.jsp 11 Jul 2005 06:49:05 -0000 1.2 --- wizard-signupconfirm.jsp 11 Jul 2005 07:13:05 -0000 1.3 *************** *** 25,29 **** <!-- Show item and allow to modify it using a FORM --> <html:form action="/wizardaction.do"> ! <table border="1" width="300"> <tr> <td colspan="2" align="left" bgcolor="99FF66"> New user signup: Confirmation</td> --- 25,29 ---- <!-- Show item and allow to modify it using a FORM --> <html:form action="/wizardaction.do"> ! <table border="1" width="400"> <tr> <td colspan="2" align="left" bgcolor="99FF66"> New user signup: Confirmation</td> Index: wizard-signupdetails.jsp =================================================================== RCS file: /cvsroot/struts/dialogs/war/wizard-signupdetails.jsp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wizard-signupdetails.jsp 11 Jul 2005 06:49:05 -0000 1.2 --- wizard-signupdetails.jsp 11 Jul 2005 07:13:05 -0000 1.3 *************** *** 26,30 **** <html:form action="/wizardaction.do"> ! <table border="1" width="300"> <tr> <td colspan="2" align="left" bgcolor="99FF66"> New user signup: Security question</td> --- 26,30 ---- <html:form action="/wizardaction.do"> ! <table border="1" width="400"> <tr> <td colspan="2" align="left" bgcolor="99FF66"> New user signup: Security question</td> Index: wizard-signupstart.jsp =================================================================== RCS file: /cvsroot/struts/dialogs/war/wizard-signupstart.jsp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wizard-signupstart.jsp 11 Jul 2005 06:49:05 -0000 1.2 --- wizard-signupstart.jsp 11 Jul 2005 07:13:05 -0000 1.3 *************** *** 24,28 **** <html:form action="/wizardaction.do"> ! <table border="1" width="300"> <tr> <td colspan="2" align="left" bgcolor="99FF66"> New user signup: Identification</td> --- 24,28 ---- <html:form action="/wizardaction.do"> ! <table border="1" width="400"> <tr> <td colspan="2" align="left" bgcolor="99FF66"> New user signup: Identification</td> Index: wizard-userpage.jsp =================================================================== RCS file: /cvsroot/struts/dialogs/war/wizard-userpage.jsp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wizard-userpage.jsp 24 Jun 2005 07:09:38 -0000 1.1 --- wizard-userpage.jsp 11 Jul 2005 07:13:05 -0000 1.2 *************** *** 23,27 **** <!-- Show boilerplate user page --> ! <table border="1" width="300"> <tr> <td align="left" bgcolor="#FFCC66">Welcome, <%= session.getAttribute("login.username") %>!</td> --- 23,27 ---- <!-- Show boilerplate user page --> ! <table border="1" width="400"> <tr> <td align="left" bgcolor="#FFCC66">Welcome, <%= session.getAttribute("login.username") %>!</td> |
From: <jm...@us...> - 2005-07-11 07:13:44
|
Update of /cvsroot/struts/dialogs/war/WEB-INF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/war/WEB-INF Modified Files: struts-config.xml Log Message: Index: struts-config.xml =================================================================== RCS file: /cvsroot/struts/dialogs/war/WEB-INF/struts-config.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** struts-config.xml 11 Jul 2005 06:49:04 -0000 1.8 --- struts-config.xml 11 Jul 2005 07:13:04 -0000 1.9 *************** *** 11,17 **** corresponding form bean. This is a dummy dynabean for such cases. --> <form-bean name="dummyForm" type="org.apache.struts.action.DynaActionForm"/> ! <form-bean name="dialogloginform" type="net.sf.dialogs.samples.dialogloginaction.DialogLoginForm"/> ! <form-bean name="crudform" type="net.sf.dialogs.samples.crudaction.CRUDFormSample"/> ! <form-bean name="wizardform" type="net.sf.dialogs.samples.wizardaction.wizardsimple.SimpleSignupForm"/> </form-beans> --- 11,17 ---- corresponding form bean. This is a dummy dynabean for such cases. --> <form-bean name="dummyForm" type="org.apache.struts.action.DynaActionForm"/> ! <form-bean name="dialogloginform" type="net.jspcontrols.dialogs.samples.dialogloginaction.DialogLoginForm"/> ! <form-bean name="crudform" type="net.jspcontrols.dialogs.samples.crudaction.CRUDFormSample"/> ! <form-bean name="wizardform" type="net.jspcontrols.dialogs.samples.wizardaction.wizardsimple.SimpleSignupForm"/> </form-beans> *************** *** 23,27 **** <action path="/selectaction" ! type = "net.sf.dialogs.samples.selectaction.SelectActionTest" name = "dummyForm" scope = "request" --- 23,27 ---- <action path="/selectaction" ! type = "net.jspcontrols.dialogs.samples.selectaction.SelectActionTest" name = "dummyForm" scope = "request" *************** *** 39,43 **** <action path="/dialogloginaction" ! type = "net.sf.dialogs.samples.dialogloginaction.DialogLoginAction" name = "dialogloginform" scope = "session" --- 39,43 ---- <action path="/dialogloginaction" ! type = "net.jspcontrols.dialogs.samples.dialogloginaction.DialogLoginAction" name = "dialogloginform" scope = "session" *************** *** 57,61 **** <action path="/dialogloginactioncontrol" ! type = "net.sf.dialogs.samples.dialogloginaction.DialogLoginActionControl" name = "dialogloginform" scope = "session" --- 57,61 ---- <action path="/dialogloginactioncontrol" ! type = "net.jspcontrols.dialogs.samples.dialogloginaction.DialogLoginActionControl" name = "dialogloginform" scope = "session" *************** *** 78,82 **** <!-- CRUD action helper: item list --> <action path="/cruditemlist" ! type = "net.sf.dialogs.samples.crudaction.ItemListActionSample" name = "dummyForm"> <forward name = "showlist" path="/crudaction-list.jsp"/> --- 78,82 ---- <!-- CRUD action helper: item list --> <action path="/cruditemlist" ! type = "net.jspcontrols.dialogs.samples.crudaction.ItemListActionSample" name = "dummyForm"> <forward name = "showlist" path="/crudaction-list.jsp"/> *************** *** 85,89 **** <!-- CRUD action --> <action path="/crudaction" ! type = "net.sf.dialogs.actions.crud.CRUDAction" name = "crudform" scope = "session" --- 85,89 ---- <!-- CRUD action --> <action path="/crudaction" ! type = "net.jspcontrols.dialogs.actions.crud.CRUDAction" name = "crudform" scope = "session" *************** *** 130,134 **** <!-- CRUD action --> <action path="/crudactionlite" ! type = "net.sf.dialogs.samples.crudaction.CRUDActionSample" name = "crudform" scope = "session" --- 130,134 ---- <!-- CRUD action --> <action path="/crudactionlite" ! type = "net.jspcontrols.dialogs.samples.crudaction.CRUDActionSample" name = "crudform" scope = "session" *************** *** 170,174 **** <action path="/wizardaction" ! type = "net.sf.dialogs.samples.wizardaction.wizardsimple.SimpleSignupAction" name = "wizardform" scope = "session" --- 170,174 ---- <action path="/wizardaction" ! type = "net.jspcontrols.dialogs.samples.wizardaction.wizardsimple.SimpleSignupAction" name = "wizardform" scope = "session" *************** *** 201,205 **** <action path="/embeddedmasterpage-resin" forward="/embedded-masterpage-resin.jsp"/> <action path="/embeddedchild-resin" ! type = "net.sf.dialogs.samples.childaction.EmbeddedActionResin" name = "dialogloginform" scope = "session" --- 201,205 ---- <action path="/embeddedmasterpage-resin" forward="/embedded-masterpage-resin.jsp"/> <action path="/embeddedchild-resin" ! type = "net.jspcontrols.dialogs.samples.childaction.EmbeddedActionResin" name = "dialogloginform" scope = "session" *************** *** 221,225 **** <action path="/embeddedmasterpage-tomcat" forward="/embedded-masterpage-tomcat.jsp"/> <action path="/embeddedchild-tomcat" ! type = "net.sf.dialogs.samples.childaction.EmbeddedActionTomcat" name = "dialogloginform" scope = "session" --- 221,225 ---- <action path="/embeddedmasterpage-tomcat" forward="/embedded-masterpage-tomcat.jsp"/> <action path="/embeddedchild-tomcat" ! type = "net.jspcontrols.dialogs.samples.childaction.EmbeddedActionTomcat" name = "dialogloginform" scope = "session" *************** *** 233,237 **** <action path="/tabcontrol" ! type = "net.sf.collab.TabControlAction"> <!-- Reload phase: base path, appended with sublevels --> <forward name = "MAINPAGE" path="main" redirect="true"/> --- 233,237 ---- <action path="/tabcontrol" ! type = "net.jspcontrols.collab.TabControlAction"> <!-- Reload phase: base path, appended with sublevels --> <forward name = "MAINPAGE" path="main" redirect="true"/> *************** *** 242,246 **** <action path="/main" ! type = "net.sf.collab.MasterPageAction"> <forward name = "FORWARD" path="main/" redirect="true"/> </action> --- 242,246 ---- <action path="/main" ! type = "net.jspcontrols.collab.MasterPageAction"> <forward name = "FORWARD" path="main/" redirect="true"/> </action> |
From: <jm...@us...> - 2005-07-11 07:13:42
|
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/wizard/impl/doc-files In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/jspcontrols/wizard/impl/doc-files Added Files: ewstatemachine.gif Log Message: --- NEW FILE: ewstatemachine.gif --- (This appears to be a binary file; contents omitted.) |
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/wizard/intf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/jspcontrols/wizard/intf Added Files: IWizard.java IWizardListener.java IWizardStep.java IWizardTransition.java package.html Log Message: --- NEW FILE: IWizard.java --- /* * Copyright 2004-2005 Michael Jouravlev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.wizard.intf; import java.util.Map; /** * This interface defines an Easy Wizard controller. The wizard controller * contains references to wizard steps and transitions, and allows to * move from one step to another. * * @version 0.5 * @author Michael Jouravlev */ public interface IWizard { /************************************************************************** * Where are we and where did we come from **************************************************************************/ /** * Locates the initial step of this wizard. * @return the initial step of this wizard */ public IWizardStep getSourceStep(); /** * Locates the current step of this wizard. * @return the current step of this wizard */ public IWizardStep getCurrentStep(); /** * Locates a step by its name. Step name is used by clients * of wizard controller, for example by Dialog Manager to refer * to a corresponding view. * @param name step name * @return the first step found traversing forward from the initial step, * having passed name; or null if the step not found. */ public IWizardStep getStepByName(String name); /** * Returns a mapping name for a wizard panel. Usually wizard step name * is used as mapping name. * @return mapping name for a wizard view, usually path to JSP page */ String getCurrentStepName(); /** * Returns errors for current wizard state. * @return error messages for current wizard state */ Map getWizardErrors(); /** * Attempts to move to the next step. If it is not possible, stays on the * current step. * <p> * Easy Wizard does not blindly choose a transition based on input command * or event. Instead, it iterates over all transitions defined for current * step, validates them, and chooses th one which is valid. If several * transitions happen to be valid, the first one is chosen. * @return true if was able to move to a next step, false otherwise * @see IWizardStep#addOutgoingTransition(IWizardTransition) */ public boolean forward(); /** * Attempts to move to the previous step. If the previous step does not * exist or the current step is the initial step of the wizard, stays * on the current step. Transition is not validated while traversing back. * @return true if was able to move to a previous step, false otherwise */ public boolean back(); /** * Returns wizard completion status. This method is redundant, * but is defined to hide Wizard instance from WizardAction. * @return true is wizard was successfully completed and disposed; * false if wizard is still active or has not been initialized yet. */ boolean isCompleted(); /** * Clean wizard errors. Just in case. Usually Wizard Manager * cleans errors if needed. */ void clearWizardErrors(); /** * Resets certain wizard fields, like booleans. Called with every user * input. The primary reason for this method is older frameworks like * Struts, which use default HTTP handling of boolean properties, and * do not notifiy a property when it is cleared. */ void wizardReset(); /** * Adds a listener for state change event. */ void addListener(IWizardListener listener); /** * Removes a listener for state change event. */ void removeListener(IWizardListener listener); /** * Removes all wizard listeners for state change event. */ void removeAllListeners(); } --- NEW FILE: IWizardListener.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.wizard.intf; /** * Listens to state change events. Usually is called from Wizard Manager. * * @version 0.5 * @author Michael Jouravlev */ public interface IWizardListener { public int STEP_REGULAR = 1; public int STEP_LAST = 2; /** * Performs action when wizard is about to change the step during * the forward transition. * * @param event WizardEvent.STEP_REGULAR if about to leave "middle" step, * WizardEvent.STEP_LAST if about to leave the final wizard * step, effectively finishing the wizard. * @return true if it is ok to move to the next step, false if step * cannot be changed. */ boolean onTransition(int event); } --- NEW FILE: IWizardStep.java --- /* * Copyright 2004-2005 Michael Jouravlev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.wizard.intf; /** * Represents a state of a wizard Finite State Machine (FSM). * <br/><br/> * A base state contains common navigation methods, a concrete state also * contains setters/getters for domain data, relevant to this state. * * @version 0.5 * @author Michael Jouravlev */ public interface IWizardStep { /** * Returns array of outgoing transitions for this state. The transitions * are weighed according to the order in which they were added to this * state. * * @return array of outgoing transitions */ IWizardTransition[] getOutgoingTransitions(); /** * Selects a transition which will be used to move forward from * from this state. * <p> * All outgoing transitions are validated in the order of their weight. * The first valid transition is chosen. * * @return a valid outgoing edge or null if no valid edges found */ IWizardTransition getOutgoingTransition(); /** * Returns the incoming transition, was used to get to this state. * * @return incoming transition */ IWizardTransition getIncomingTransition(); /** * Sets the incoming transition. Used during forward traversal * to mark the way through the wizard. The incoming transition * is used for backward traversal. * * @param value incoming transition */ void setIncomingTransition(IWizardTransition value); /** * Adds an outgoing transition. Order in which transitions are added * to a state, defines their weight (or rank). Transition added to * a state first, has the highest weight. Transitions are validated * during forward traversal in order of their weight, and the first * valid transition is chosen for state change. * * @param value outgoing transition */ void addOutgoingTransition(IWizardTransition value); /** * Returns true if this state has been marked as checkpoint. This means * that a wizard cannot return back from this state. * * @return true if this state is a checkpoint */ boolean isCheckpoint(); /** * Returns the name of this state. Each state must have a unique name.. * * @return state name */ String getStateName(); /** * Returns the wizard, which contains this state as part * of the wizard sequence. * * @return wizard which owns this node */ IWizard getWizard(); /** * Verifies that this state is included in the path to the current state. * * @return true if this state is present in the actual path to the current * state, but is not a current state itself; false otherwise. */ boolean isStateInPath(); /** * Instructs the state to clear all its boolean properties. * Usually called before the properties are about to be set. * <br><br> * The reason for this method is that browsers/HTTP do not notify * server about cleared checkboxes or radiobuttons. So, these values * should be cleared before they are set with client values. * <br><br> * This method is not used in JSF. */ void resetBooleans(); } --- NEW FILE: IWizardTransition.java --- /** * Copyright 2004-2005 Michael Jouravlev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.wizard.intf; /** * Represents a state transition. In Easy Wizard a transition is an object, it * can refer to its source and target states, and can validate itself. When * wizard controller moves from one state to another, it iterates through * transitions of current state, and validates each of them in order of their * weight. The first valid transition is used to change the state. * * @version 0.5 * @author Michael Jouravlev */ public interface IWizardTransition { /** * Returns human-readable name of the transition, or null if not set. * <br><br> * The name is not needed for wizard navigation and thus is optional. * Nevertheless, names are highly recommended because they allow to * find a transition by name, and also may provide mapping name * for UI layer. * * @return transition name or null if name is not set */ public String getName(); /** * Returns source of this state, cannot be null. Each transition refers * to its source and target states. * * @return source of this transition */ public IWizardStep getSource(); /** * Sets source state for this transition * @param value source state for this transition */ public void setSource(IWizardStep value); /** * Returns target state of this transition, cannot be null. Each transition * refers to its source and target states. * * @return target state of this transition */ public IWizardStep getTarget(); /** * Validates this transition. Usually checks the domain accounts, which * is referenced from the source state of this transition. * <br><br> * Outgoing transitions are validated in order of their weight, * when state is about to change. The first valid transition is chosen * for traversal. * * @return true if this transition is valid */ public boolean validate(); /** * Returns wizard controller object, which owns this state * @return wizard which owns this state */ IWizard getWizard(); } --- NEW FILE: package.html --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html> <head> <title>net.jspcontrols.wizard.intf package</title> <!-- Copyright 2004-2005 Michael Jouravlev. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> </head> <body> Provides interfaces for wizard components, like state, transition and wizard controller. <p>Easy Wizard is designed as a specific type of FSM. <p><b>Instead of calculating the transition based on current state and command, Easy Wizard iterates over all transitions defined for current state and validates them.</b> This is possible, because transitions in Easy Wizard are objects, not just string identifiers. If a transition considers itself valid, then FSM moves from its current state to the state identified by chosed transition.</p> <!-- Last updated: Sat, Mar 26 2005 --> </body> </html> |
From: <jm...@us...> - 2005-07-11 07:13:42
|
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/wizard/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/jspcontrols/wizard/impl Added Files: Wizard.java WizardStep.java WizardTransition.java package.html Log Message: --- NEW FILE: Wizard.java --- /* * Copyright 2004-2005 Michael Jouravlev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.wizard.impl; import net.jspcontrols.wizard.intf.IWizard; import net.jspcontrols.wizard.intf.IWizardStep; import net.jspcontrols.wizard.intf.IWizardTransition; import net.jspcontrols.wizard.intf.IWizardListener; import java.util.Map; import java.util.HashMap; import java.util.Iterator; /** * This class containts base implementation of wizard controller and handles * wizard traversal. The wizard controller contains references to wizard states * and transitions, and allows to move from one state to another. * <br><br> * The UI specifics like reporting of error messages should be handled by * descendant classes. * * @version 0.5 * @author Michael Jouravlev */ public class Wizard implements IWizard { /************************************************************************** * Error messages **************************************************************************/ /** * Error list. Key is either string message or ID of a message in * a property file. Value is a string array of values, or null if there * are no arguments. * <p> * Errors are initialized in backing bean when a wizard object is created. * Reference to existing error object must be passed * to this wizard controller from backing bean. */ protected Map errors = new HashMap(); /** * Standard implementation returns a dummy map for error messages in * case the concrete implementation generates messages externally and * does not provide message placeholder. * <p> * Concrete implementation must provide a valid reference to message map, * if it wants to return messages from Rule Engine. * * @return message placeholder map */ public Map getWizardErrors() {return errors;} /** * Returns true if wizard has been successfully completed. Wizard * is usually completes on its last step, after business accounts is updated. * Completed status is retained by the wizard until wizard instance * is disposed. * * @return true if wizard has been successfully completed and is ready * to be disposed. */ public boolean isCompleted() {return currentState == null;} /************************************************************************** * IWizard implementation **************************************************************************/ /** * The intial state of this wizard. A wizard has only one initial state. */ protected IWizardStep sourceState; /** * Returns source state of this wizard. A wizard has only one initial state. * @return source state of this wizard */ public IWizardStep getSourceStep() {return sourceState;} /** * Current state of this wizard. */ protected IWizardStep currentState; /** * Returns current state of this wizard; on wizard startup is the same as * source state. * @return current state of this wizard */ public IWizardStep getCurrentStep() {return currentState;} /** * Locates a state in this wizard by its name * * @param name state name * @return the first state starting from source, * which name is equal to the needed name, or null * if the state not found. */ public IWizardStep getStepByName(String name) { IWizardStep sourceNode = getSourceStep(); if (sourceNode == null) return null; if (sourceNode.getStateName().equals(name)) return sourceNode; return findNode(sourceNode, name); } /** * Tries to move to the next state. If cannot move, keeps current state. */ public boolean forward() { clearWizardErrors(); /* * Find outgoing transition, returns null if current state * is the last state */ IWizardTransition outgoingTransition = currentState.getOutgoingTransition(); /* * Process final node, it may set "completed" status */ if (isLastStep()) { boolean canLeave = canLeave(IWizardListener.STEP_LAST); if (canLeave) { currentState = null; } return canLeave; /* * Not last step and about to move forward */ } else if (outgoingTransition != null) { /* * Find next state */ IWizardStep nextState = outgoingTransition.getTarget(); if (nextState == null) return false; /* * Cannot move forward */ if (!canLeave(IWizardListener.STEP_REGULAR)) { return false; } /* * Moving forward: set incoming transition for next state * unless next state is not a checkpoint */ nextState.setIncomingTransition(currentState.isCheckpoint() ? null : outgoingTransition); /* * Move to the next node */ currentState = nextState; return true; /* * Wizard stayed on the same step */ } else { return false; } } /** * Tries to move to the previous state. Stays on the current state * if traversal back is impossible either because this state is * the initial wizard state or was marked as checkpoint. */ public boolean back() { /* * Find the incoming transition for the current state */ IWizardTransition incomingTransition = currentState.getIncomingTransition(); /* * Traverse back if incoming transition exists */ if (incomingTransition != null) { currentState = incomingTransition.getSource(); clearWizardErrors(); return true; } return false; } /** * Verifies is current wizard step a last step. * @return true if current wizard step a last step */ protected boolean isLastStep() { IWizardTransition[] transitions = currentState.getOutgoingTransitions(); return transitions == null || transitions.length == 0; } /** * Executed after the forward transition is chosen, but before the state * is changed. Verifies with listening application, is it allowed to * perform a state change * @param event event that is occurring now, like moving to next step * @return true if all listeners allow to move to the next step */ protected boolean canLeave(int event) { boolean canLeave = true; Iterator lisIte = getListeners().values().iterator(); while(lisIte.hasNext()) { IWizardListener wizardListener = (IWizardListener) lisIte.next(); canLeave &= wizardListener.onTransition(event); } return canLeave; } /** * Returns a name which is used to display proper wizard panel. * @return mapping name for a wizard view, usually path to JSP page */ public String getCurrentStepName() { return getCurrentStep().getStateName(); } /** * Listeners, checking for state transition */ protected Map listeners = new HashMap(); /** * Adds a listener for state change event. */ public void addListener(IWizardListener listener) { synchronized(listeners) { listeners.put(listener.getClass().getName(), listener); } } /** * Removes a listener for state change event. */ public void removeListener(IWizardListener listener) { synchronized(listeners) { Iterator lisIte = listeners.values().iterator(); while(lisIte.hasNext()) { IWizardListener wizardListener = (IWizardListener) lisIte.next(); if (wizardListener == listener) { lisIte.remove(); } } } } /** * Removes all wizard listeners for state change event. */ public void removeAllListeners() { synchronized(listeners) { listeners.clear(); } } /** * Returns all current listeners for wizard event */ public Map getListeners() { return listeners; } /************************************************************************** * Helper methods **************************************************************************/ /** * Finds a state by its name. Need to pass staring state as an argument * because of the recursive calls. Starting state parameter allows * to search from any state. * <p> * Important: starting state itself is not checked * * @param state the state where to start search, this state itself is not * verified and must be checked outside this method * @param name the name of the state to look for * @return the state with the needed name, or null if state not found */ public static IWizardStep findNode(IWizardStep state, String name) { if (state == null || name == null) return null; IWizardTransition[] transitions = state.getOutgoingTransitions(); if (transitions != null) { for (int i = 0; i < transitions.length; i++) { IWizardStep probedState = transitions[i].getTarget(); IWizardStep resultState = name.equals(probedState.getStateName()) ? probedState : findNode(probedState, name); if (resultState != null) return resultState; } } return null; } /************************************************************************** * Implementing IWizardManager **************************************************************************/ /** * Clear wizard errors. Does nothing here (need to implement). * Backing bean will clear errors when needed. */ public void clearWizardErrors() { Map errors = getWizardErrors(); if (errors != null && errors.size() > 0) { errors.clear(); } } public void wizardReset() { // clearWizardErrors(); getCurrentStep().resetBooleans(); } } --- NEW FILE: WizardStep.java --- /* * Copyright 2004-2005 Michael Jouravlev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.wizard.impl; import net.jspcontrols.wizard.intf.*; import java.util.ArrayList; import java.util.Map; import java.util.Iterator; /** * Represents a state of a wizard Finite State Machine (FSM). Contains * common navigation methods. Derived concrete state should also * contain setters/getters for domain data, relevant to this state. * * @version 0.5 * @author Michael Jouravlev */ public abstract class WizardStep implements IWizardStep { /************************************************************************** * IWizardStep implementation **************************************************************************/ /** * Checkpoint flag. If set, then wizard cannot return back from this state. */ private boolean checkpoint; /** * Returns true if this state is marked as checkpoint * @return true if this state is marked as checkpoint */ public boolean isCheckpoint() {return checkpoint;} /** * Sets this state as checkpoint. This should be done before wizard is * traversed back from this state. * * @param checkpoint true if this state should be marked as checkpoint */ public void setCheckpoint(boolean checkpoint) { this.checkpoint = checkpoint; } /** * The name of this state */ protected String stateName; /** * Returns the state name * @return state name */ public String getStateName() {return stateName;} /** * Master wizard object; this reference can be used to access * common data defined in the wizard object itself. */ protected IWizard wizard; /** * Returns master wizard object * @return master wizard object */ public IWizard getWizard() {return wizard;} /** * Incoming transition. */ protected IWizardTransition incomingTransition; /** * Returns incoming transition for this state, used during * actual wizard traversal * @return incoming transition for this node */ public IWizardTransition getIncomingTransition() {return incomingTransition;} /** * Sets incoming transition, used by wizard controller. Defined as public * because it belongs to the IWizardStep interface. * @param value incoming transition */ public void setIncomingTransition(IWizardTransition value) { incomingTransition = value; } /** * In this version outgoing trasitions are implemented as array list * for easy adding of new transitions. */ private ArrayList outgoingTransitions = new ArrayList(); /** * Returns array of outgoing transitions in the same order in which they were * added by addOutgoingTransition() method. * * @return array of outbound transitions, the transition with the most * weight is returned first. */ public IWizardTransition[] getOutgoingTransitions() { return (IWizardTransition[]) outgoingTransitions.toArray(new IWizardTransition[0]); } /** * Adds an outgoing transition. Transitions must be added in the order of * their weight, the edge with highest weight must be added first. * <br><br> * Future versions may support dynamic adjustment of weight, this version * does not support it. * * @param value outgoing transition */ public void addOutgoingTransition(IWizardTransition value) { /* * Add a transition as outgoing, and set this state as the source state * for the transition. Transition objects are not shared between states. */ outgoingTransitions.add(value); value.setSource(this); } /** * Returns a transition which will be chosen if a "next" command is selected * for this node. * <br><br> * All outbound transitions are validated in the order they were added * to this state. The first valid transition is chosen. * * @return a first valid outgoing transition or null if no valid * transitions found */ public IWizardTransition getOutgoingTransition() { IWizardTransition[] edges = this.getOutgoingTransitions(); for (int i=0; i < edges.length; i++) { if (edges[i].validate()) { return edges[i]; } } return null; } /** * Verifies that this state is included in the path to the current state * (the current state is past this state). * * @return true if this state is found in the actual path from the * initial state to the current state; false otherwise. */ public boolean isStateInPath() { return ( this == wizard.getCurrentStep() || checkTraverseBack(wizard.getCurrentStep(), this) ); } /************************************************************************** * Helpers and constructor **************************************************************************/ /** * Verifies if a state is included in the path to the current state * * @param startState the state where to start backward traversal * @param searchState the state which we are looking for in the * travseral path * @return true if searchNode is found in the actual path while traversing * back from startNode; false otherwise. */ public static boolean checkTraverseBack(IWizardStep startState, IWizardStep searchState) { IWizardTransition incomingEdge = startState.getIncomingTransition(); if (incomingEdge == null) return false; IWizardStep srcState = incomingEdge.getSource(); return srcState == searchState ? true : checkTraverseBack(srcState, searchState); } /** * Constructs the state, sets a name and stores a reference * to the owner wizard object. * * @param owner owner wizard object, cannot be null * @param name name of this state, cannot be null, must be unique within * the wizard */ public WizardStep(IWizard owner, String name) { this.wizard = owner; this.stateName = name; } } --- NEW FILE: WizardTransition.java --- /* * Copyright 2004-2005 Michael Jouravlev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.wizard.impl; import net.jspcontrols.wizard.intf.IWizard; import net.jspcontrols.wizard.intf.IWizardStep; import net.jspcontrols.wizard.intf.IWizardTransition; /** * Represents a state transition. In Easy Wizard a transition is an object, it * can refer to its source and target states, and can validate itself. When * wizard controller moves from one state to another, it iterates through * transitions of current state, and validates each of them in order of their * weight. The first valid transition is used to change the state. * * @version 0.5 * @author Michael Jouravlev */ public abstract class WizardTransition implements IWizardTransition { /** * Owner wizard object, reference used to access common business fields */ protected IWizard wizard; /** * Returns owner wizard object * @return owner wizard object */ public IWizard getWizard() {return wizard;} /** * Human-readable name of this transition, or null if not set. * Contrary to the state name, the transition name is optional. */ protected String name; /** * Returns transition name * @return transition name */ public String getName() {return name;} /** * Source node of this edge, never null. */ protected IWizardStep source; /** * Returns source state for this transition * @return source state for this transition */ public IWizardStep getSource() {return source;} /** * Sets source state for this transition; used by wizard controller * @param value source state for this transition */ public void setSource(IWizardStep value) {source = value;} /** * Target state for this transition, never null. */ protected IWizardStep target; /** * Returns target state of this transition * @return target state of this transition */ public IWizardStep getTarget() {return target;} /** * Constructs an transition. Source state will be set automatically after * this transition is added as outgoing to a state. * * @param owner owner wizard object * @param name transition name * @param target transition target */ public WizardTransition(IWizard owner, String name, IWizardStep target) { this.wizard = owner; this.name = name; this.target = target; } } --- NEW FILE: package.html --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html> <head> <title>net.jspcontrols.wizard.impl package</title> <!-- Copyright 2004-2005 Michael Jouravlev. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> </head> <body> Provides implementations of core wizard components: like state, transition and wizard controller. <h3>Easy Wizard state machine</h3> <img border="0" src="doc-files/ewstatemachine.gif" width="440" height="190"> <p>Easy Wizard is designed as a specific type of FSM. <li>It does not allow cycles <li>State transition are ranked</p> <p>The important concept of weight is borrowed from graph theory. Transitions in Easy Wizard are weighted, or ranked. Weight allows to set an order of transitions. That is, to set the preference of some transitions over others.</p> <p><b>Instead of calculating the transition based on current state and command, Easy Wizard iterates over all transitions defined for current state and validates them.</b> This is possible, because transitions in Easy Wizard are objects, not just string identifiers. If a transition considers itself valid, then FSM moves from its current state to the state identified by chosed transition.</p> <p>What about the data and domain model? Here comes another feature of Easy Wizard: its states refer to domain data (or directly store the needed data). <b>Each state refers only to the data that it can modify</b>. Thus, it is very easy to update data which is relevant to current state of FSM.</p> <p>What if domain model cannot be updated? The answer is simple: <b>Easy Wizard does not move from the current state, until at least one valid outgoing transition is availaible</b>. Transitions can validate any conditions they need, and most often they check the validity of input data and the validity of domain model. So, if domain model cannot be updated, then flow engine cannot move forward either. This is how flow engine is synchronized with domain model.</p> <!-- Last updated: Sat, Mar 26 2005 --> </body> </html> |
From: <jm...@us...> - 2005-07-11 07:13:42
|
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/wizard/intf/doc-files In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/jspcontrols/wizard/intf/doc-files Added Files: ewstatemachine.gif Log Message: --- NEW FILE: ewstatemachine.gif --- (This appears to be a binary file; contents omitted.) |
Update of /cvsroot/struts/dialogs/src/net/sf/dialogs/samples/childaction In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/sf/dialogs/samples/childaction Removed Files: EmbeddedAction.java EmbeddedActionResin.java EmbeddedActionTomcat.java embedded_0002dchild_0002dlogin_jsp.java embedded_0002dchild_0002dlogout_jsp.java Log Message: --- EmbeddedAction.java DELETED --- --- EmbeddedActionResin.java DELETED --- --- EmbeddedActionTomcat.java DELETED --- --- embedded_0002dchild_0002dlogin_jsp.java DELETED --- --- embedded_0002dchild_0002dlogout_jsp.java DELETED --- |
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/dialogs/samples/wizardaction/rules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/jspcontrols/dialogs/samples/wizardaction/rules Added Files: SignupWizard.java StepConfirm.java StepDetails.java StepSignup.java Log Message: --- NEW FILE: SignupWizard.java --- /* * Copyright 2004-2005 Michael Jouravlev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.samples.wizardaction.rules; import net.jspcontrols.wizard.impl.Wizard; import net.jspcontrols.wizard.intf.IWizardStep; import net.jspcontrols.wizard.intf.IWizardTransition; import net.jspcontrols.wizard.impl.WizardTransition; import java.util.Map; /** * This class defines a simple signup wizard. The wizard has three steps * with the second step being optional. * <p> * The first step asks a new user for a login name and a password he would * like to use. Also the first step asks if a user wants to supply additional * information about himself. If yes, the second step is made available, it * allows to input the favorite book and the favorite movie of the user. * The third step simply shows user's selections. * <p> * This class stores some UI-related information like error messages, but * efforts were made to design it agnostic of particular web framework. * * @author Michael Jouravlev */ public class SignupWizard extends Wizard { /************************************************************************** * New User Signup wizard nodes **************************************************************************/ /** * The first step accepts and stores new user name and password. * It also allows for a client to choose to provide additional personal * information. */ final StepSignup stepSignup; /** * Returns first node of Signup wizard: the Signup node * @return the Signup node */ public StepSignup getStepSignup() {return stepSignup;} /** * Details step stores favorite book and movie name. These * values are not required if this step is not selected in the signup * node (not quite how UI-agnostic validation should work, but this * is a demo for a wizard, not for MVC concepts). */ final StepDetails stepDetails; /** * Returns second node of Signup wizard: the Personalization node * @return the Personalization node */ public StepDetails getStepDetails() {return stepDetails;} /** * Confirmation step displays user information and stores it in * application domain accounts. After this step the wizard can be * disposed. */ final IWizardStep stepConfirm; /** * Returns third node of Signup wizard: the Confirmation node * @return the Confirmation node */ public IWizardStep getStepConfirm() {return stepConfirm;} /************************************************************************** * Wizard constructor **************************************************************************/ /** * Constructs a signup wizard. */ public SignupWizard (Map errors) { /** * Wizard controller can either use built-in error message map, * or use an external one. */ if (errors != null) { this.errors = errors; } /******** * Nodes ********/ /* * Nodes do not need to be exposed or to have a separate * identifier. But to use wizard accounts data as javabean properties * in the UI, it is easier to define getters and setters for * references to nodes, instead of looking up nodes by name. */ stepSignup = new StepSignup(this, "Signup Node"); stepDetails = new StepDetails(this, "Details Node"); stepConfirm = new StepConfirm(this, "Confirmation Node"); /* * Starting off the Signup node */ sourceState = stepSignup; /* * Set the current node to source node */ currentState = sourceState; /******** * Edges ********/ /* * Path from identification node to personalization node. * Will be chosen if name and password are valid and a user * elected to enter personal information. */ stepSignup.addOutgoingTransition( new WizardTransition(this, "Signup To Detail", stepDetails) { public boolean validate() { return stepSignup.getPersonalize() && stepSignup.validateNameAndPassword(); } } ); /* * Path from identification node to confirmation node. Will be chosen * if name and password are valid and a user did not elect to enter * personal information. */ stepSignup.addOutgoingTransition( new WizardTransition(this, "Signup To Confirmation", stepConfirm) { public boolean validate() { return stepSignup.validateNameAndPassword(); } } ); /* * Path from personalization node to confirmation node * Will be chosen if both book and movie are non null values. */ stepDetails.addOutgoingTransition( new WizardTransition(this, "Detail To Confirmation", stepConfirm) { public boolean validate() { if ( stepDetails.getSecurityAnswerId() > -1 && stepDetails.getSecurityAnswer() != null && stepDetails.getSecurityAnswer().trim().length() > 0) { return true; } else { wizard.getWizardErrors().put( "loginsignupcontrol.nosecurityinfo", null); return false; } } } ); } /** * This is a simple test of this wizard. The wizard itself does not need * UI interaction. * * @param args command-line params, unused */ public static void main(String[] args) { /* * Create wizard controller */ SignupWizard wiz = new SignupWizard(null); /* * Traverse wizard and display all edges */ System.out.println("Traversing the signup wizard"); wiz.traverse(wiz.getSourceStep()); /* * User name and password not set, try to move forward. * Should stay on the Signup Node */ IWizardStep curNode = null; boolean flag = false; do { System.out.println("\nGo forward"); wiz.forward(); curNode = wiz.getCurrentStep(); System.out.println("Current node: " + curNode.getStateName()); if (curNode instanceof StepSignup) { StepSignup nodeSignup = (StepSignup) wiz.getCurrentStep(); nodeSignup.setName("sysdba"); nodeSignup.setPassword("masterkey"); nodeSignup.setPersonalize(true); } else if (curNode instanceof StepDetails) { StepDetails nodePersonal = (StepDetails) wiz.getCurrentStep(); /* * First time do not enter book and movie, enter on second pass */ if (flag) { nodePersonal.setSecurityAnswerId(1); nodePersonal.setSecurityAnswer("Moscow"); } else { flag = !flag; } } } while (!"Confirmation Node".equals(curNode.getStateName())); do { System.out.println("\nGo back"); wiz.back(); curNode = wiz.getCurrentStep(); System.out.println("Current node: " + curNode.getStateName()); } while (!"Signup Node".equals(curNode.getStateName())); curNode = wiz.getStepByName("Non-existing node"); if (curNode != null) { System.out.println("\nFound node: " + curNode.getStateName()); } else { System.out.println("\nNot Found node: " + "Non-existing node"); } curNode = wiz.getStepByName("Details Node"); if (curNode != null) { System.out.println("Found node: " + curNode.getStateName()); } else { System.out.println("Not Found node: " + "Details node"); } curNode = wiz.getStepByName("Signup Node"); if (curNode != null) { System.out.println("Found node: " + curNode.getStateName()); } else { System.out.println("Not Found node: " + "Signup node"); } } /** * Traverses the wizard from the beginning to the end. Used for testing. * @param node node from which to start traversal */ public static void traverse(IWizardStep node) { IWizardTransition[] srcEdges = node.getOutgoingTransitions(); if (srcEdges == null || srcEdges.length ==0) { } else { for (int i = 0; i < srcEdges.length; i++) { System.out.println( "Edge Name: " + srcEdges[i].getName() + "\n\tSource node: " + srcEdges[i].getSource().getStateName() + "\n\tTarget node: " + srcEdges[i].getTarget().getStateName()); traverse(srcEdges[i].getTarget()); if (srcEdges[i].getSource() != node) { System.out.println("Edge " + srcEdges[i].getName() + " is incorrect"); } } } } } --- NEW FILE: StepConfirm.java --- /* * Copyright 2004-2005 Michael Jouravlev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.samples.wizardaction.rules; import net.jspcontrols.wizard.impl.WizardStep; import net.jspcontrols.dialogs.samples.wizardaction.accounts.UserAccounts; import net.jspcontrols.dialogs.samples.wizardaction.rules.SignupWizard; import java.util.Map; /** * Confirmation node of Signup wizard. Being the last node of the wizard, * it submits wizard data to user accounts storage. * * @version 0.1 * @author Michael Jouravlev */ public class StepConfirm extends WizardStep { /** * Creates Confirmation node * * @param value owner wizard object, used to reference wizard-wide * objects like error messages * @param name name of this node. Used to locate node by name, and * as mapping for JSP page */ public StepConfirm(SignupWizard value, String name) { super(value, name); } /** * Instructs the node to clear boolean values. Usually called * before the properties are about to be updated. */ public void resetBooleans() { /* no-op */ } } --- NEW FILE: StepDetails.java --- /* * Copyright 2004-2005 Michael Jouravlev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.samples.wizardaction.rules; import net.jspcontrols.wizard.impl.WizardStep; import net.jspcontrols.dialogs.samples.wizardaction.rules.SignupWizard; /** * Personalization node of Signup wizard. This is the second and optional node * of the wizard, allows a user to provide additional information like * favorite book and favorite movie * * @version 0.1 * @author Michael Jouravlev */ public class StepDetails extends WizardStep { /************************************************************************** * Business properties: favorite book and movie **************************************************************************/ private String[] securityQuestions = new String[] { "What is your favorite color?", "What is your home city?", "What is your pet's name?", "Who was your childhood hero?" }; public String[] getSecurityQuestions() {return securityQuestions;} /** * Returns security question as string */ public String getSecurityQuestion() { return isStateInPath() && securityAnswerId > -1 ? securityQuestions[securityAnswerId] : null; } /** * Id of security question, this is stored in database */ private int securityAnswerId = -1; /** * Returns id of security question */ public int getSecurityAnswerId() {return securityAnswerId;} /** * Sets security answer id * @param securityAnswerId security answer id */ public void setSecurityAnswerId(int securityAnswerId) { this.securityAnswerId = securityAnswerId; } /** * Additional user info: favorite book */ private String securityAnswer; /** * Returns user favorite book as part of personalization information, * only if the Personalization node is included in the actual path * of the wizard. * * @return favorite book */ public String getSecurityAnswer() {return isStateInPath() ? securityAnswer : null;} /** * Sets the favorite book as part of personalization information. * This method is not to be called by client. * * @param securityAnswer favorite user book */ public void setSecurityAnswer(String securityAnswer) {this.securityAnswer = securityAnswer;} /************************************************************************** * Constructor **************************************************************************/ /** * Creates Personalization node * * @param value owner wizard object, used to reference wizard-wide * objects, like error messages * @param name name of this node */ public StepDetails(SignupWizard value, String name) { super(value, name); } /** * Instructs the node to clear boolean values. Usually called * before the properties are about to be updated. */ public void resetBooleans() { /* no-op */ } } --- NEW FILE: StepSignup.java --- /* * Copyright 2004-2005 Michael Jouravlev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.samples.wizardaction.rules; import net.jspcontrols.wizard.impl.WizardStep; import net.jspcontrols.dialogs.samples.wizardaction.rules.SignupWizard; /** * Identification node of Signup wizard, the first node of the wizard. * it allows to enter name and password of a new user, and also to choose * an option to provide additional information (the information itself would * be provided on the second step: Personalization) * * @version 0.1 * @author Michael Jouravlev */ public class StepSignup extends WizardStep { /************************************************************************** * Business properties: name and password **************************************************************************/ /** * User name */ private String name; /** * Returns user name stored in the wizard * @return user name */ public String getName() {return name;} /** * Sets user name in the wizard * @param name user name to set in the wizard */ public void setName(String name) {this.name = name;} /** * User password */ private String password; /** * Returns user password stored in the wizard as cleartext. It is * up to the UI layer how to display it. */ public String getPassword() {return password;} /** * Sets user password in the wizard * @param password user password to set in the wizard */ public void setPassword(String password) { this.password = password; } /** * Repeated user password */ private String confirmPassword; /** * Returns repeated user password */ public String getConfirmPassword() {return confirmPassword;} /** * Sets repeated user password in the wizard * @param confirmPassword user password to set in the wizard */ public void setConfirmPassword(String confirmPassword) { this.confirmPassword = confirmPassword; } /************************************************************************** * Wizard flow control property **************************************************************************/ /** * Flag that user wants to supply additional information about himself */ private boolean personalize; /** * Returns true if personalization flag is set. This flag is used * to determine if wizard should display Personalization step. * @return true if a user selected to provide additional information * about himself. */ public boolean getPersonalize() {return personalize;} /** * Sets personalization flag. * @param personalize true if user wants to provide additional * information about himself. */ public void setPersonalize(boolean personalize) {this.personalize = personalize;} /************************************************************************** * Common validation method, called from outgoing edges **************************************************************************/ /** * Validates name and password. Validation is normally performed * in an outgoing edge, but this common functionality is used by * both outgoing edges. * * @return true if name and password conform to basic * name/password requirements */ public boolean validateNameAndPassword() { boolean valid = true; /* * User name should have length of at least three characters. * * We can also verify that login already exists, but this wizard * does it only when wizard is about to be finished, so if a user * cancels it in the middle, the persistent storage is not called. * * Notice typecast to SignupWizard, which defines getErrors() * method. */ if ( name == null || name.length() < 3 ) { valid = false; getWizard().getWizardErrors().put( "loginsignupcontrol.usernametooshort", new String[] {name} ); } /* * User password should have length of at least five characters */ if ( password == null || password.length() < 5 ) { valid = false; getWizard().getWizardErrors().put( "loginsignupcontrol.passwordtooshort", null ); /* * Repeated password should be equal to password */ } else if ( !password.equals(confirmPassword) ) { valid = false; getWizard().getWizardErrors().put( "loginsignupcontrol.passwordnotequal", null ); } return valid; } /************************************************************************** * Constructor **************************************************************************/ /** * Creates Signup node * * @param value owner wizard object, used to reference wizard-wide * objects like error messages * @param name name of this node */ public StepSignup(SignupWizard value, String name) { super(value, name); } /** * Instructs the node to clear boolean values. Usually called * before the properties are about to be updated. */ public void resetBooleans() { setPersonalize(false); } } |
From: <jm...@us...> - 2005-07-11 07:13:26
|
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/dialogs/samples/wizardaction/wizardsimple In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/jspcontrols/dialogs/samples/wizardaction/wizardsimple Added Files: SimpleSignupAction.java SimpleSignupForm.java Log Message: --- NEW FILE: SimpleSignupAction.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.samples.wizardaction.wizardsimple; import net.jspcontrols.dialogs.actions.wizard.WizardAction; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * A concrete wizard action class. Does nothing more than a regular * WizardAction, but setting response as non-cachable. * * @author Michael Jouravlev */ public class SimpleSignupAction extends WizardAction { /** * Returns an <code>ActionForward</code> instance describing the View * for current dialog state, usually a forward to a JSP page. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * * @exception Exception if an exception occurs * @return ActionForward instance describing the View for dialog state */ public ActionForward getDialogView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { setNoCache(response); return super.getDialogView(mapping, form, request, response); } } --- NEW FILE: SimpleSignupForm.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.samples.wizardaction.wizardsimple; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import org.apache.struts.util.LabelValueBean; import net.jspcontrols.wizard.intf.IWizard; import net.jspcontrols.wizard.intf.IWizardListener; import net.jspcontrols.dialogs.actions.wizard.IWizardManager; import net.jspcontrols.dialogs.actions.wizard.WizardConstants; import net.jspcontrols.dialogs.samples.wizardaction.rules.SignupWizard; import net.jspcontrols.dialogs.samples.wizardaction.accounts.UserAccounts; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import java.util.Map; import java.util.HashMap; import java.util.ArrayList; /** * Wizard Manager for New User Signup wizard. For simplicity, this action form * does not use base WizardForm. Uses standard WizardAction as dispatching action. * * @author Michael Jouravlev */ public class SimpleSignupForm extends ActionForm implements IWizardManager, IWizardListener { /************************************************************************** * Wizard Controller **************************************************************************/ /** * Aggregated wizard ontroller; must be set prior to populate phase */ private IWizard wizard; /** * Returns aggregated wizard controller, typecast to concrete type. * Used to access properties of this from JSP page. */ public SignupWizard getSignupWizard() { return (SignupWizard) wizard; } /** * Returns aggregated wizard controller as generic wizard. This method * is not used in this simple action form, it comes handy when * base WizardForm class is utilized. */ public IWizard getWizard() { return wizard; } /** * Returns errors accumulated by wizard during processing of input data. */ public Map getWizardErrors() { return wizard != null ? wizard.getWizardErrors() : new HashMap(); } /************************************************************************** * Session object is used as login storage and to access user accounts **************************************************************************/ /** * This demo uses session to store login info and to access user accounts. */ HttpSession session; /** * Returns current session. Used to access user accounts. */ public HttpSession getSession() { return session; } /************************************************************************** * Wizard Navigation **************************************************************************/ /** * Cancels wizard. * @return string mapping describing the after-cancel View */ public String wizardCancel() { disposeWizard(); return WizardConstants.MAPPING_ON_CANCEL; } /** * Tries to go one step back. Wizard does not allow to move past first * step. * @return string mapping describing the after-back View. * If successfully moved one step back, MAPPING_ON_BACK_SUCCESS * is returned. Otherwise, MAPPING_ON_BACK_FAILURE is returned. * @see WizardConstants#MAPPING_ON_BACK_SUCCESS * @see WizardConstants#MAPPING_ON_BACK_FAILURE */ public String wizardBack() { return wizard != null && wizard.back() ? WizardConstants.MAPPING_ON_BACK_SUCCESS : WizardConstants.MAPPING_ON_BACK_FAILURE; } /** * Tries to go one step forward. * @return string mapping describing the after-forward View * If successfully moved one step forward, and wizard is not finished * yet, MAPPING_ON_NEXT_SUCCESS is returned. If wizard was finished, * MAPPING_ON_DONE is returned. Otherwise, MAPPING_ON_NEXT_FAILURE * is returned. * @see WizardConstants#MAPPING_ON_NEXT_SUCCESS * @see WizardConstants#MAPPING_ON_NEXT_FAILURE * @see WizardConstants#MAPPING_ON_DONE */ public String wizardNext() { if (wizard != null && wizard.forward()) { if (wizard.isCompleted()) { disposeWizard(); return WizardConstants.MAPPING_ON_DONE; } else { return WizardConstants.MAPPING_ON_NEXT_SUCCESS; } } return WizardConstants.MAPPING_ON_NEXT_FAILURE; } /** * Disposes wizard and performs housekeeping tasks like removing messages, * event listeneres and other objects created by wizard. */ public void disposeWizard() { // Cleanup wizard if (wizard != null) { wizard.removeAllListeners(); wizard = null; } // Remove combobox values session.removeAttribute("simple-signup-questions"); } /** * Returns true if wizard was completed or was never instantiated; * after wizard completes, it should not be accessed anymore. */ public boolean isCompleted() { return wizard != null ? wizard.isCompleted() : true; } /** * Returns string mapping of the wizard page, corresponding to * current wizard state. By convention, uses the name of wizard step. * Always use unique names for wizard steps. */ public String getWizardView() { return wizard != null ? wizard.getCurrentStepName() : null; } /************************************************************************** * Implementing IWizardListener **************************************************************************/ /** * Fires event when wizard is about to move forward from current step. * * @param event IWizardListener.STEP_REGULAR if about to leave "middle" step, * IWizardListener.STEP_LAST if about to leave the final wizard * step, effectively finishing the wizard. * @return true if it is allowed to move to the next step, false if step * must not be changed. * @see IWizardListener#STEP_REGULAR * @see IWizardListener#STEP_LAST */ public boolean onTransition(int event) { // Not finishing wizard ==> not interested if (event != IWizardListener.STEP_LAST) return true; // Wizard is about to complete ==> store new user account if (UserAccounts.addUser( session, getSignupWizard().getStepSignup().getName(), getSignupWizard().getStepSignup().getPassword(), getSignupWizard().getStepDetails().getSecurityAnswerId(), getSignupWizard().getStepDetails().getSecurityAnswer(), true) ) return true; // Account was not stored ==> generate error, do not dispose wizard getWizardErrors().put("loginsignupcontrol.loginexists", new String[] {getSignupWizard().getStepSignup().getName()}); return false; } /************************************************************************** * ActionForm methods **************************************************************************/ /** * Resets action form. This method is called each time request is received. * Initialize wizard here if needed, and clear checkboxes. * * @param mapping The ActionMapping used to select this instance * @param request The HTTP request we are processing */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); // This form must have session scope to store CRUD data if (!"session".equalsIgnoreCase(mapping.getScope())) { throw new IllegalStateException("Action " + mapping.getPath() + "should have session scope"); } // Session is used to store login name session = request.getSession(); // This wizard is not a control, it does not have stub pages. // So, initialize wizard each time user navigates to this action // and wizard controller does not exist yet. if (wizard == null) { // Create new Wizard Controller instance; // Use internal to Rule Engine object for error messages. wizard = new SignupWizard(null); // Use this action form as wizard event listener; // it stores account info in the account database when // wizard is about to finish. wizard.addListener(this); // Build combobox data fro wizard array data; // rule engine does not deal with types specific to Struts, // it returns a simple string array. ArrayList questions = new ArrayList(); String[] wizardQuestions = getSignupWizard().getStepDetails().getSecurityQuestions(); for (int i = 0; i < wizardQuestions.length; i++) { questions.add(new LabelValueBean(wizardQuestions[i], Integer.toString(i))); } // This is a combobox object for security question on second step. session.setAttribute( "simple-signup-questions", questions ); } // Important: clear checkboxes for POST requests only! if ("POST".equalsIgnoreCase(request.getMethod())) { wizard.wizardReset(); } } } |
From: <jm...@us...> - 2005-07-11 07:13:25
|
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/dialogs/samples/wizardaction/wizardsubclassed In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/jspcontrols/dialogs/samples/wizardaction/wizardsubclassed Added Files: SubclassedSignupForm.java Log Message: --- NEW FILE: SubclassedSignupForm.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.samples.wizardaction.wizardsubclassed; import org.apache.struts.action.ActionMapping; import org.apache.struts.util.LabelValueBean; import net.jspcontrols.wizard.intf.IWizardListener; import net.jspcontrols.dialogs.samples.wizardaction.rules.SignupWizard; import net.jspcontrols.dialogs.samples.wizardaction.accounts.UserAccounts; import net.jspcontrols.dialogs.actions.wizard.WizardForm; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import java.util.ArrayList; /** * Wizard Manager for New User Signup wizard. Very compact, because uses * base WizardForm class. Uses standard WizardAction as dispatching action. * * @author Michael Jouravlev */ public class SubclassedSignupForm extends WizardForm implements IWizardListener { /************************************************************************** * Wizard Controller **************************************************************************/ /** * Returns aggregated wizard controller, typecast to concrete type. * Used to access properties of this from JSP page. */ public SignupWizard getSignupWizard() { return (SignupWizard) wizard; } /************************************************************************** * Session object is used as login storage and to access user accounts **************************************************************************/ /** * This demo uses session to store login info and to access user accounts. */ HttpSession session; /** * Returns current session. Used to access user accounts. */ public HttpSession getSession() { return session; } /************************************************************************** * Wizard lifecycle **************************************************************************/ /** * Disposes wizard and performs housekeeping tasks like removing messages, * event listeneres and other objects created by wizard. */ public void disposeWizard() { // Cleanup wizard super.disposeWizard(); // Remove combobox values session.removeAttribute("simple-signup-questions"); } /************************************************************************** * Implementing IWizardListener **************************************************************************/ /** * Fires event when wizard is about to move forward from current step. * * @param event IWizardListener.STEP_REGULAR if about to leave "middle" step, * IWizardListener.STEP_LAST if about to leave the final wizard * step, effectively finishing the wizard. * @return true if it is allowed to move to the next step, false if step * must not be changed. * @see IWizardListener#STEP_REGULAR * @see IWizardListener#STEP_LAST */ public boolean onTransition(int event) { // Not finishing wizard ==> not interested if (event != IWizardListener.STEP_LAST) return true; // Wizard is about to complete ==> store new user account if (UserAccounts.addUser( session, getSignupWizard().getStepSignup().getName(), getSignupWizard().getStepSignup().getPassword(), getSignupWizard().getStepDetails().getSecurityAnswerId(), getSignupWizard().getStepDetails().getSecurityAnswer(), true) ) return true; // Account was not stored ==> generate error, do not dispose wizard getWizardErrors().put("loginsignupcontrol.loginexists", new String[] {getSignupWizard().getStepSignup().getName()}); return false; } /************************************************************************** * ActionForm methods **************************************************************************/ /** * Resets action form. This method is called each time request is received. * Initialize wizard here if needed, and clear checkboxes. * * @param mapping The ActionMapping used to select this instance * @param request The HTTP request we are processing */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); // Session is used to store login name session = request.getSession(); // This wizard is not a control, it does not have stub pages. // So, initialize wizard each time user navigates to this action // and wizard controller does not exist yet. if (wizard == null) { // Create new Wizard Controller instance; // Use internal to Rule Engine object for error messages. wizard = new SignupWizard(null); // Use this action form as wizard event listener; // it stores account info in the account database when // wizard is about to finish. wizard.addListener(this); // Build combobox data fro wizard array data; // rule engine does not deal with types specific to Struts, // it returns a simple string array. ArrayList questions = new ArrayList(); String[] wizardQuestions = getSignupWizard().getStepDetails().getSecurityQuestions(); for (int i = 0; i < wizardQuestions.length; i++) { questions.add(new LabelValueBean(wizardQuestions[i], Integer.toString(i))); } // This is a combobox object for security question on second step. session.setAttribute( "simple-signup-questions", questions ); } } } |
From: <jm...@us...> - 2005-07-11 07:13:24
|
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/dialogs/samples/wizardaction/accounts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/jspcontrols/dialogs/samples/wizardaction/accounts Added Files: UserAccounts.java Log Message: --- NEW FILE: UserAccounts.java --- /* * Copyright 2004-2005 Michael Jouravlev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.samples.wizardaction.accounts; import javax.servlet.http.HttpSession; import javax.servlet.ServletContext; import java.util.ArrayList; import java.util.Iterator; /** * This class manages user login, logout, and validation. It also stores * user accounts in the servlet context (this is just a demo). * * @author Michael Jouravlev */ public class UserAccounts { /** * Maximum number of user accounts */ public static final int MAX_ACCOUNTS = 1000; /** * Key to store user accounts in the servlet context */ private static final String USERACCOUNT_KEY = "login.useraccounts"; /** * Key to store user login name in the session */ private static final String LOGIN_KEY = "login.username"; /** * Check if login name/password combination is registered. * * @param loginInfo existing user accounts, in real application would be * loaded from database. * @param name user name to check * @param pwd user password to check * @param newSignup true if registering new account, in this case * password do not need to be validated against * existing user account. * * @return true if name exists and password matches existing password * (if checking existing account); false otherwise. */ static private boolean findUserName(ArrayList loginInfo, String name, String pwd, boolean newSignup) { // TODO: Use map instead of arraylist boolean pwdOK = false; if (loginInfo != null && loginInfo.size() > 0) { Iterator itLogin = loginInfo.iterator(); while (itLogin.hasNext()) { String[] nameAndPwd = (String[]) itLogin.next(); /* * For new signup password must simply exist, for login * password must match the password in existing account. */ pwdOK = newSignup ? pwd != null : pwd != null && pwd.equals(nameAndPwd[1]); if (name != null && name.equals(nameAndPwd[0]) && pwdOK) { return true; } } } return false; } static public boolean checkNameOnSignup(HttpSession session, String name, String password) { // Login information is stored in servlet context ServletContext context = session.getServletContext(); ArrayList globalLoginInfo = getLoginInfo(context); // User is already defined return !findUserName(globalLoginInfo, name, password, true); } /** * Adds a new user and returns error status * * @param session used to obtain servlet context where this demo * stores user accounts * @param name new user name * @param password user's password * @param securityAnswerId user's favorite book * @param securityAnswer user's favorite movie * * @return true if added successfully, false otherwise */ synchronized static public boolean addUser(HttpSession session, String name, String password, int securityAnswerId, String securityAnswer, boolean keepLoggedIn) { String strAnswerId = Integer.toString(securityAnswerId); // Storing login information as array in the login map String[] newLogin = new String[] {name, password, strAnswerId, securityAnswer}; // Login information is stored in servlet context ServletContext context = session.getServletContext(); ArrayList globalLoginInfo = getLoginInfo(context); // User is already defined if (findUserName(globalLoginInfo, name, password, true)) { return false; } // Store login name/password for a new user globalLoginInfo.add(newLogin); context.setAttribute(USERACCOUNT_KEY, globalLoginInfo); // Set user name in the session, effectively logging the user in. // User page scriptlet checks this session attribute before // displaying user home page. if (keepLoggedIn) { session.setAttribute(LOGIN_KEY, name); } return true; } private static ArrayList getLoginInfo(ServletContext context) { ArrayList globalLoginInfo = (ArrayList) context.getAttribute(USERACCOUNT_KEY); /* * If no user accounts defined, create a new one. Also, clear all * accounts from the servlet context when too much users registered */ if (globalLoginInfo == null || globalLoginInfo.size() > MAX_ACCOUNTS) { globalLoginInfo = new ArrayList(); } return globalLoginInfo; } /** * Tries to log the user in * * @param session session object where user login is stored * @param name user name * @param password user password * * @return true if logged in successfully, false otherwise */ synchronized public static boolean login(HttpSession session, String name, String password) { /* * Clear any previous login information in the session, * so if login is unsuccessful, a user would be logged out. */ session.removeAttribute(LOGIN_KEY); /* * Load existing name/password combinations from storage */ ArrayList globalLoginInfo = (ArrayList) session.getServletContext().getAttribute( USERACCOUNT_KEY ); /* * Search for defined name/password. If found, set * user name in the session, effectively logging the user in. */ if (findUserName(globalLoginInfo, name, password, false)) { session.setAttribute(LOGIN_KEY, name); return true; } else { return false; } } /** * Logs the user out * @param session session object where user login is stored */ synchronized public static void logout(HttpSession session) { session.removeAttribute(LOGIN_KEY); } /** * Returns the name of currently logged in user * @return the name of current user */ synchronized public static String currentUser(HttpSession session) { return (String) session.getAttribute(LOGIN_KEY); } } |
From: <jm...@us...> - 2005-07-11 07:13:24
|
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/dialogs/samples/selectaction In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/jspcontrols/dialogs/samples/selectaction Added Files: SelectActionTest.java Log Message: --- NEW FILE: SelectActionTest.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.samples.selectaction; import net.jspcontrols.dialogs.actions.SelectAction; import javax.servlet.ServletException; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletRequest; import java.util.Map; import java.util.HashMap; import java.io.IOException; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForward; /** * Example of DispathQueryAction usage */ public class SelectActionTest extends SelectAction { // Define button -> method mapping protected Map getKeyMethodMap() { Map map = new HashMap(); map.put("app-submit-button-add", "add"); map.put("app-submit-button-delete", "delete"); map.put("app-submit-button-login", "login"); return map; } // Handler of Add button public ActionForward add(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { return mapping.findForward("addpage"); } // Handler of Delete button public ActionForward delete(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { return mapping.findForward("deletepage"); } // Handler of Login button public ActionForward login(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { return mapping.findForward("loginpage"); } // Handler of standard Cancel button public ActionForward cancelled(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { return mapping.findForward("cancelpage"); } // Handler of unknown button public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { return mapping.findForward("unspecifiedpage"); } } |
From: <jm...@us...> - 2005-07-11 07:13:24
|
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/dialogs/samples/crudaction/business In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/jspcontrols/dialogs/samples/crudaction/business Added Files: BusinessObj.java Log Message: --- NEW FILE: BusinessObj.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.samples.crudaction.business; /** * A simple bean, represinting a Business Object. For simplicity, * no business rules are defined. This is just a struct. * * @author Michael Jouravlev */ public class BusinessObj { /* * Business Object ID, a primary key */ private String itemId; public String getItemId() {return itemId;} public void setItemId(String itemId) {this.itemId = itemId;} /* * Business object value, must be short integer */ private String stringValue; public String getStringValue() {return stringValue;} public void setStringValue(String value) {this.stringValue = value;} /* * Business object status, can be "New" or "Stored". */ private int intValue; public int getIntValue() {return intValue;} public void setIntValue(int intValue) {this.intValue = intValue;} /** * Creates new Business Object with random 4-digit ID */ public BusinessObj() { itemId = (new Integer((new Double((Math.random() * 100000))).intValue())).toString(); this.stringValue = "Item #" + itemId; this.intValue = (new Double((Math.random() * 100000))).intValue(); } /** * Creates new Business Object with a certain ID but * with random value. Used to create default items. * * @param id Business Object ID */ public BusinessObj(String id) { this.itemId = id; this.stringValue = "-default-"; this.intValue = (new Double((Math.random() * 100000))).intValue(); } /** * Creates new Business Object with particular ID, value and status * * @param id Business Object ID * @param strValue Business Object value * @param intValue Business Object status */ public BusinessObj(String id, String strValue, int intValue) { this.itemId = id; this.stringValue = strValue; this.intValue = intValue; } /** * Creates a full copy of another Business Object * * @param item Source Business Object */ public BusinessObj(BusinessObj item) { this.itemId = item.itemId; this.stringValue = item.stringValue; this.intValue = item.intValue; } } |
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/dialogs/samples/dialogloginaction In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/jspcontrols/dialogs/samples/dialogloginaction Added Files: DialogLoginAction.java DialogLoginActionControl.java DialogLoginForm.java Log Message: --- NEW FILE: DialogLoginAction.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.samples.dialogloginaction; import net.jspcontrols.dialogs.actions.DialogAction; import net.jspcontrols.dialogs.actions.DialogConstants; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMessages; import org.apache.struts.Globals; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.util.Map; import java.util.HashMap; /** * Sample login action, which uses DialogAction for POST/REDIRECT/GET, * and for displaying error messages. */ public class DialogLoginAction extends DialogAction { /** * Returns the initialization key, or initialization key prefix if * several init keys are possible. Must start with the same prefix as * dialog buttons. */ protected String getInitKey() { return "DIALOG-EVENT-INIT"; } /** * Maps submit button names to methods */ protected Map getKeyMethodMap() { Map map = new HashMap(); // Standard init event map.put(getInitKey(), "init"); // Submit event map.put("DIALOG-EVENT-LOGIN", "login"); return map; } /** * Initializes dialog */ public ActionForward init ( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DialogLoginForm inputForm = (DialogLoginForm) form; inputForm.setName(null); inputForm.setPassword(null); request.getSession().removeAttribute("login.username"); return mapping.findForward(DialogConstants.DIALOG_RELOAD_KEY); } /** * Process login attempt (POST) */ public ActionForward login ( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Validate user name and password, can do it right here in action as well ActionMessages errors = form.validate(mapping, request); // Errors found, stick them into session and redirect to the dialog View if (errors != null) { HttpSession session = request.getSession(); saveDialogErrors(request.getSession(), errors); return mapping.findForward(DialogConstants.DIALOG_RELOAD_KEY); // Login OK, go to (preferably, redirect to) user's page } else { DialogLoginForm inputForm = (DialogLoginForm) form; request.getSession().setAttribute("login.username", inputForm.getName()); return mapping.findForward("userhome"); } } public ActionForward getDialogView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Mark response as non-cachable setNoCache(response); // Use default view mapping: "DIALOG-VIEW" return super.getDialogView(mapping, form, request, response); } } --- NEW FILE: DialogLoginActionControl.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.samples.dialogloginaction; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.util.Map; /** * A simple login control */ public class DialogLoginActionControl extends DialogLoginAction { // Mapping submit button names to methods protected Map getKeyMethodMap() { Map map = super.getKeyMethodMap(); map.put("DIALOG-EVENT-LOGOUT", "logout"); return map; } /** * Overrides login method, always reloads the control instead of navigating * to user page on success. */ public ActionForward login ( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Try to log in super.login(mapping, form, request, response); // Reload login control. Action will show page corresponding // to current state, either user info, or login page with errors. return null; } /** * Logs a user out and reloads this login control */ public ActionForward logout (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DialogLoginForm inputForm = (DialogLoginForm) form; // Clean password in the input/output form bean inputForm.setPassword(null); // Remove login name from session, effectively logging out request.getSession().removeAttribute("login.username"); // Reload login control return null; } public ActionForward getDialogView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Mark response as non-cachable setNoCache(response); // Display page, corresponding to login state. HttpSession session = request.getSession(); if (session.getAttribute("login.username") == null) { return mapping.findForward("notloggedin"); } else { return mapping.findForward("loggedin"); } } } --- NEW FILE: DialogLoginForm.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.samples.dialogloginaction; import org.apache.struts.action.*; import javax.servlet.http.HttpServletRequest; /** * Simple login form */ public class DialogLoginForm extends ActionForm { private String name; public String getName() {return name;} public void setName(String name) {this.name = name;} private String password; public String getPassword() {return password;} public void setPassword(String password) {this.password = password;} // Generate the error messages in the same manner as usual, // but do not forget to turn "validate" property of the action mapping off. public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { if (!"guest".equalsIgnoreCase(name) || !"guest".equalsIgnoreCase(password)) { ActionErrors errors = new ActionErrors(); errors.add("ERROR", new ActionMessage("login.badpassword")); return errors; } else { return null; } } } |
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/dialogs/actions/wizard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/jspcontrols/dialogs/actions/wizard Added Files: IWizardManager.java WizardAction.java WizardConstants.java WizardForm.java Log Message: --- NEW FILE: IWizardManager.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.actions.wizard; import java.util.Map; /** * Wizard Manager interface. Used by web framework to manipulate wizard * rule engine. * * @author Michael Jouravlev */ public interface IWizardManager { /** * Returns errors accumulated by wizard during processing of input data. */ Map getWizardErrors(); /** * Cancels wizard. * @return string mapping describing the after-cancel View */ String wizardCancel(); /** * Tries to go one step back. Wizard does not allow to move past first * step. * @return string mapping describing the after-back View. * If successfully moved one step back, MAPPING_ON_BACK_SUCCESS * is returned. Otherwise, MAPPING_ON_BACK_FAILURE is returned. * @see WizardConstants#MAPPING_ON_BACK_SUCCESS * @see WizardConstants#MAPPING_ON_BACK_FAILURE */ String wizardBack(); /** * Tries to go one step forward. * @return string mapping describing the after-forward View * If successfully moved one step forward, and wizard is not finished * yet, MAPPING_ON_NEXT_SUCCESS is returned. If wizard was finished, * MAPPING_ON_DONE is returned. Otherwise, MAPPING_ON_NEXT_FAILURE * is returned. * @see WizardConstants#MAPPING_ON_NEXT_SUCCESS * @see WizardConstants#MAPPING_ON_NEXT_FAILURE * @see WizardConstants#MAPPING_ON_DONE */ String wizardNext(); /** * Disposes wizard and performs housekeeping tasks like removing messages, * event listeneres and other objects created by wizard. */ void disposeWizard(); /** * Returns true if wizard was completed or was never instantiated; * after wizard completes, it should not be accessed anymore. */ boolean isCompleted(); /** * Returns string mapping of the wizard page, corresponding to * current wizard state. By convention, uses the name of wizard step. * Always use unique names for wizard steps. */ String getWizardView(); } --- NEW FILE: WizardAction.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.actions.wizard; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Map; import java.util.HashMap; import java.util.Iterator; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMessages; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionMessage; import org.apache.struts.Globals; import net.jspcontrols.dialogs.actions.DialogAction; /** * Basic wizard action. Implements back, forward and cancel method handlers. * Works in pair with action form, implementing IWizardManager interface. * * @author Michael Jouravlev */ public class WizardAction extends DialogAction { /************************************************************************** * Input events **************************************************************************/ /** * Returns the initialization key or initialization prefix. * Must start with the same prefix as dialog buttons. For example, * if dialog buttons start with "DIALOG-EVENT", then "DIALOG-EVENT-INIT" * is a good name for initilization key, while "DIALOG-INIT" is not. */ protected String getInitKey() { return "DIALOG-EVENT-INIT"; } /** * Maps submit button names to handler methods; also maps initialization * keys to initialization methods. Events, external to CRUDAction, * are considered initializing events, and therefore must start with * initialization prefix. For example, if initialization prefix * starts with "DIALOG-EVENT-INIT", then "DIALOG-EVENT-INIT-CREATE" * is a good key for "Create new business object" event, while * "DIALOG-EVENT-CREATE" is not. * <p> * If you do not want to use all CRUD handlers, and want to protect * yourself from calling unneeded handler, you can subclass this class, * and override this method. Then you define only mappings that you need. * @see WizardAction#getInitKey */ protected Map getKeyMethodMap() { Map map = new HashMap(); // Cancel viewing or editing of current item map.put("DIALOG-EVENT-CANCEL", "onCancel"); // Persist changes of current item map.put("DIALOG-EVENT-BACK", "onBack"); // Close preview mode of existing item map.put("DIALOG-EVENT-NEXT", "onNext"); return map; } /************************************************************************** * Wizard navigation methods **************************************************************************/ /** * Handles "Cancel" button on wizard panel. Commonly, ActionForward object * returned by this handler redirects outside the wizard. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * * @exception java.lang.Exception if an exception occurs * @return ActionForward object, describing where to go next */ public ActionForward onCancel(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Cancel wizard and move to after-cancel location return mapping.findForward(((IWizardManager)form).wizardCancel()); } /** * Handles "Back" button on wizard panel. ActionForward object * returned by this handler must redirect back to the wizard. * This allows to display a View corresponding to current wizard state. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * * @exception java.lang.Exception if an exception occurs * @return ActionForward object, redirecting back to the wizard */ public ActionForward onBack(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Try to go back one step, and move to actual location return mapping.findForward(((IWizardManager)form).wizardBack()); } /** * Handles "Back" button on wizard panel. ActionForward object * returned by this handler must redirect back to the wizard. * This allows to display a View corresponding to current wizard state. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * * @exception java.lang.Exception if an exception occurs * @return ActionForward object, redirecting back to the wizard */ public ActionForward onNext(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Try to go forward one step, and move to corresponding location return mapping.findForward(((IWizardManager)form).wizardNext()); } /** * Returns an <code>ActionForward</code> instance describing the View * for current dialog state, usually a forward to a JSP page. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * * @exception java.lang.Exception if an exception occurs * @return ActionForward instance describing the View for dialog state */ public ActionForward getDialogView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // CRUDAction works with form beans, implementing ICRUDForm IWizardManager wizardForm = (IWizardManager) form; // Store errors in the request for standard processing Map errors = wizardForm.getWizardErrors(); ActionMessages messages = getStrutsErrors(errors); request.setAttribute(Globals.ERROR_KEY, messages); // Show appropriate page String strMapping = wizardForm.getWizardView(); return mapping.findForward(strMapping); } /************************************************************************** * Helper methods **************************************************************************/ /** * Pulls errors found during wizard transition from wizard into * Struts error object. * * @param uiErrors map of errors, where key is an error message, * and value is error parameters as string array * @return errors in Struts format */ public static ActionErrors getStrutsErrors(Map uiErrors) { if (uiErrors == null || uiErrors.isEmpty()) return null; Iterator errIterator = uiErrors.keySet().iterator(); ActionErrors actionErrors = new ActionErrors(); while (errIterator.hasNext()) { String errKey = (String) errIterator.next(); String[] errMessage = (String[]) uiErrors.get(errKey); actionErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(errKey, errMessage)); } return actionErrors; } } --- NEW FILE: WizardConstants.java --- /* * Copyright 2004-2005 Michael Jouravlev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.actions.wizard; /** * Wizard constants, used by WizardAction and IWizardManager. * * @author Michael Jouravlev */ public interface WizardConstants { /************************************************************************** * First phase mappings: where to go after input data processed *************************************************************************/ /** * Canceled wizard */ String MAPPING_ON_CANCEL = "ON-CANCEL"; /** * Finished wizard. Same as MAPPING_ON_NEXT_SUCCESS, but wizard * reached its last step and was disposed. * @see WizardConstants#MAPPING_ON_NEXT_SUCCESS */ String MAPPING_ON_DONE = "ON-DONE"; /** * Successfully moved one step back */ String MAPPING_ON_BACK_SUCCESS = "ON-BACK-SUCCESS"; /** * Failed to move one step back */ String MAPPING_ON_BACK_FAILURE = "ON-BACK-FAILURE"; /** * Successfully moved one step forward, but not finished * @see WizardConstants#MAPPING_ON_DONE */ String MAPPING_ON_NEXT_SUCCESS = "ON-NEXT-SUCCESS"; /** * Failed to move to next step */ String MAPPING_ON_NEXT_FAILURE = "ON-NEXT-FAILURE"; } --- NEW FILE: WizardForm.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.actions.wizard; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import net.jspcontrols.wizard.intf.IWizard; import net.jspcontrols.dialogs.actions.wizard.IWizardManager; import net.jspcontrols.dialogs.actions.wizard.WizardConstants; import javax.servlet.http.HttpServletRequest; import java.util.Map; import java.util.HashMap; /** * Base wizard form. Custom wizard implementation can either (1) extend * basic ActionForm class and implement IWizardManager interface, * or (2) extend this predefined wizard form. */ public class WizardForm extends ActionForm implements IWizardManager { /************************************************************************** * Wizard Controller **************************************************************************/ /** * Wizard controller; must be set prior to populate phase */ protected IWizard wizard; /** * Returns errors accumulated by wizard during processing of input data. */ public Map getWizardErrors() { return wizard != null ? wizard.getWizardErrors() : new HashMap(); } /************************************************************************** * Wizard Navigation **************************************************************************/ /** * Cancels wizard. * @return string mapping describing the after-cancel View */ public String wizardCancel() { disposeWizard(); return WizardConstants.MAPPING_ON_CANCEL; } /** * Tries to go one step back. Wizard does not allow to move past first * step. * @return string mapping describing the after-back View. * If successfully moved one step back, MAPPING_ON_BACK_SUCCESS * is returned. Otherwise, MAPPING_ON_BACK_FAILURE is returned. * @see net.jspcontrols.dialogs.actions.wizard.WizardConstants#MAPPING_ON_BACK_SUCCESS * @see net.jspcontrols.dialogs.actions.wizard.WizardConstants#MAPPING_ON_BACK_FAILURE */ public String wizardBack() { return wizard != null && wizard.back() ? WizardConstants.MAPPING_ON_BACK_SUCCESS : WizardConstants.MAPPING_ON_BACK_FAILURE; } /** * Tries to go one step forward. * @return string mapping describing the after-forward View * If successfully moved one step forward, and wizard is not finished * yet, MAPPING_ON_NEXT_SUCCESS is returned. If wizard was finished, * MAPPING_ON_DONE is returned. Otherwise, MAPPING_ON_NEXT_FAILURE * is returned. * @see net.jspcontrols.dialogs.actions.wizard.WizardConstants#MAPPING_ON_NEXT_SUCCESS * @see net.jspcontrols.dialogs.actions.wizard.WizardConstants#MAPPING_ON_NEXT_FAILURE * @see net.jspcontrols.dialogs.actions.wizard.WizardConstants#MAPPING_ON_DONE */ public String wizardNext() { if (wizard != null && wizard.forward()) { if (wizard.isCompleted()) { disposeWizard(); return WizardConstants.MAPPING_ON_DONE; } else { return WizardConstants.MAPPING_ON_NEXT_SUCCESS; } } return WizardConstants.MAPPING_ON_NEXT_FAILURE; } /** * Disposes wizard and performs housekeeping tasks like removing messages, * event listeneres and other objects created by wizard. */ public void disposeWizard() { // Cleanup wizard if (wizard != null) { wizard.removeAllListeners(); wizard = null; } } /** * Returns true if wizard was completed or was never instantiated; * after wizard completes, it should not be accessed anymore. */ public boolean isCompleted() { return wizard != null ? wizard.isCompleted() : true; } /** * Returns string mapping of the wizard page, corresponding to * current wizard state. By convention, uses the name of wizard step. * Always use unique names for wizard steps. */ public String getWizardView() { return wizard != null ? wizard.getCurrentStepName() : null; } /************************************************************************** * ActionForm methods **************************************************************************/ /** * Resets action form. This method is called each time request is received. * Initialize wizard here if needed, and clear checkboxes. * * @param mapping The ActionMapping used to select this instance * @param request The HTTP request we are processing */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); // This form must have session scope to store CRUD data if (!"session".equalsIgnoreCase(mapping.getScope())) { throw new IllegalStateException("Action " + mapping.getPath() + "should have session scope"); } // Important: clear checkboxes for POST requests only! if (wizard != null && "POST".equalsIgnoreCase(request.getMethod())) { wizard.wizardReset(); } } } |
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/dialogs/samples/crudaction In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/jspcontrols/dialogs/samples/crudaction Added Files: CRUDActionSample.java CRUDFormSample.java CRUDListActionSample.java ItemListActionSample.java Log Message: --- NEW FILE: CRUDActionSample.java --- package net.jspcontrols.dialogs.samples.crudaction; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import net.jspcontrols.dialogs.actions.crud.CRUDAction; import net.jspcontrols.dialogs.actions.crud.ICRUDForm; import net.jspcontrols.dialogs.samples.crudaction.business.BusinessObj; import java.util.ArrayList; /** * Created by IntelliJ IDEA. * User: Mikus * Date: Jun 28, 2005 * Time: 7:58:45 AM * To change this template use Options | File Templates. */ public class CRUDActionSample extends CRUDAction { /** * Returns an <code>ActionForward</code> instance describing the View * for current dialog state, usually a forward to a JSP page. * <p> * If you want to use the default implementation, define the View * under "DIALOG-VIEW" name in <forward> element of your action * mapping. * <p> * To use different mapping name, define the view in <forward> * element of your action mapping, and override this method to return * ActionForward object for your mapping name. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * * @exception java.lang.Exception if an exception occurs * @return ActionForward instance describing the View for dialog state */ public ActionForward getDialogView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Mark response as non-cachable setNoCache(response); // Return mapping corresponding to business object state return super.getDialogView(mapping, form, request, response); } } --- NEW FILE: CRUDFormSample.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.samples.crudaction; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; import net.jspcontrols.dialogs.actions.crud.ICRUDForm; import net.jspcontrols.dialogs.actions.crud.CRUDForm; import net.jspcontrols.dialogs.samples.crudaction.business.BusinessObj; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import java.util.ArrayList; import java.util.Iterator; /** * Example of CRUDAction an ICRUDForm usage. The data from this form bean * is stored to a simple business object with two values: stingvalue and numvalue. * * @author Michael Jouravlev */ public class CRUDFormSample extends CRUDForm implements ICRUDForm { /** * Key to store item list in the session */ public static final String CRUD_LIST_KEY = "crud-item-list"; /* * Page header: "New Item", "Edit Item" or "View Item". * Used on the JSP to reflect current UI mod. No setter for this property. */ private String itemHeader; public String getItemHeader() {return itemHeader;} /* * Item ID aka Primary Key; each business object is identified by a key. * Getter is used on JSP page, setter is used to to identify an existing * item, which must be edited. */ private String itemId; public String getItemId() {return itemId;} public void setItemId(String itemId) {this.itemId = itemId;} /************************************************************************** * Business data: every property of business object is exposed explicitly. **************************************************************************/ /* * Simple string value, must not be null. */ private String stringValue; public String getStringValue() {return stringValue;} public void setStringValue(String stringValue) {this.stringValue = stringValue;} /* * Simple integer value, must be over 150. */ private String intValue; public String getIntValue() {return intValue;} public void setIntValue(String intValue) {this.intValue = intValue;} /************************************************************************** * Data lifecycle **************************************************************************/ /** * Generates and returns ID for new item. * @return stringified ID, hopefully unique */ String createUnuqueId() { return (new Integer((new Double((Math.random() * 100000))). intValue())).toString(); } /** * Creates new item. This particular implementation generates item ID * (that is, database PK) right at the moment when item is generated. * <p> * Another approach is to generate item ID when item is actually * stored. In this case you would probably need a status field. * You would generate ID for items with "new" status. Items loaded * from database would have "existing" status. * @return non-empty ActionMessages object if could not create item. */ public ActionMessages crudCreate() { // Initialize new item itemId = createUnuqueId(); intValue = null; stringValue = null; itemHeader = "New Item"; // New item is ready to be edited changeCrudUIMode(ICRUDForm.CRUD_UI_MODE_EDITABLE); // No errors creating new item return null; } /** * Duplicates new business data from existing object. * @return non-empty ActionMessages object if could not duplicate item. */ public ActionMessages crudDuplicate() { return initLoadedItem(true, "New Item", ICRUDForm.CRUD_UI_MODE_EDITABLE); } /** * Loads business data from persistence layer into the action form or * into nested property of action form, and switches to edit mode. * @return non-empty ActionMessages object if could not load business item. */ public ActionMessages crudLoadForUpdate() { return initLoadedItem(false, "Edit Item", ICRUDForm.CRUD_UI_MODE_EDITABLE); } /** * Load business data from persistence layer into the action form or * into nested property of action form, and switches to view mode. * @return non-empty ActionMessages object if could not load business item. */ public ActionMessages crudLoadForPreview() { return initLoadedItem(false, "View Item", ICRUDForm.CRUD_UI_MODE_READONLY); } /** * Deletes business data from underlying persistent layer * @return non-empty ActionMessages object if could not delete item. */ public ActionMessages crudDelete() { // Find and delete item if found BusinessObj item = findOrDeleteItem(this.itemId, true); if (item != null) { // Deactivate CRUDAction view changeCrudUIMode(ICRUDForm.CRUD_UI_MODE_INACTIVE); // No errors loading an item return null; } else { ActionErrors errors = new ActionErrors(); errors.add("ERROR", new ActionMessage("crudData.itemnotfound", this.itemId)); return errors; } } /** * Cancels process of updating existing or new item. * @return always null */ public ActionMessages crudCancel() { // New item is ready to be edited changeCrudUIMode(ICRUDForm.CRUD_UI_MODE_INACTIVE); // No errors loading an item return null; } /** * Closes preview from of existing item. * @return always null */ public ActionMessages crudClose() { // New item is ready to be edited changeCrudUIMode(ICRUDForm.CRUD_UI_MODE_INACTIVE); // No errors loading an item return null; } /** * Stores business data in the persistence layer. * <p> * When new item is created, this particular implementation generates * item ID right away. * <p> * Another approach is to generate item ID when it is actually * stored. In this case you would need something like status field. * You would generate ID for items with "new" status. Items loaded * from database would have "existing" status. * @return non-empty ActionMessages object if could not store business data. */ public ActionMessages crudStore() { ActionErrors errors = new ActionErrors(); // Try to persist item if (ICRUDForm.CRUD_UI_MODE_EDITABLE.equals(getCrudUIMode())) { // Test business rules: fail persist if num value is too low if (Integer.parseInt(intValue) < 150) { // Keep UI mode, which is CRUD_UI_MODE_EDIT, no need to change // changeCrudUIMode(ICRUDForm.CRUD_UI_MODE_EDIT); errors.add("ERROR", new ActionMessage("crudData.storevaluetoolow")); return errors; // Persisting } else { int tempIntValue = 0; try { tempIntValue = Integer.parseInt(intValue); } catch (NumberFormatException e) { errors.add("ERROR", new ActionMessage("crudData.numbernotint")); return errors; } BusinessObj item = findOrDeleteItem(this.itemId, false); if (item != null) { item.setStringValue(this.stringValue); item.setIntValue(tempIntValue); } else { ArrayList items = (ArrayList) session.getAttribute(CRUD_LIST_KEY); item = new BusinessObj(itemId, stringValue, tempIntValue); items.add(item); } // New item is ready to be edited changeCrudUIMode(ICRUDForm.CRUD_UI_MODE_INACTIVE); // No errors storing item return null; } } else { errors.add("ERROR", new ActionMessage("crudData.badmode")); return errors; } } /************************************************************************** * Helpers **************************************************************************/ /** * Finds item in the "persistent storage", that is, in the list of items. * @param id id of item to look for * @return non-null item if found, or null if item not found */ private BusinessObj findOrDeleteItem(String id, boolean delete) { ArrayList items = null; if (session != null && (items = (ArrayList) session.getAttribute(CRUD_LIST_KEY)) != null) { Iterator itemIte = items.listIterator(); while(itemIte.hasNext()) { BusinessObj item = (BusinessObj) itemIte.next(); if (item.getItemId().equals(id)) { if (delete) { itemIte.remove(); // This is a lame way to signal that item was found and // deleted. Cannot return reference to deleted object. return new BusinessObj(); } else { return item; } } } } return null; } /** * Loads item from storage (in this example from the session object) * @return non-empty ActionMessages object if could not load item. */ private ActionMessages loadItem() { ActionErrors errors = new ActionErrors(); try { BusinessObj item = findOrDeleteItem(this.itemId, false); if (item != null) { intValue = Integer.toString(item.getIntValue()); stringValue = item.getStringValue(); return null; } else { errors.add("ERROR", new ActionMessage("crudData.itemnotfound", this.itemId)); return errors; } } catch (Throwable e) { errors.add("ERROR", new ActionMessage("crudData.internalstorageerror")); return errors; } } /** * Initialized loaded item for duplicate, edit and preview modes. * @param initId if true, generate new item ID * @param title page title to use, like "View item" or "Edit item" * @param successState which state to switch to if item loaded successfully * @return non-empty ActionMessages object if could not load business item. */ private ActionMessages initLoadedItem(boolean initId, String title, String successState) { // Load existing item. Use item id which is already set in the form. ActionMessages errors = loadItem(); // Loaded successfully if (errors == null || errors.isEmpty()) { if (initId) { // Create new item ID, used for duplicating itemId = createUnuqueId(); } // Set up header for view JSP page itemHeader = title; // New item is ready to be edited or viewed changeCrudUIMode(successState); // No errors loading an item return null; // Could not load } else { // Deactivate CRUDAction view changeCrudUIMode(ICRUDForm.CRUD_UI_MODE_INACTIVE); // Report errors to CRUDAction return errors; } } /************************************************************************** * Reset and Validate **************************************************************************/ /** * Session stores list of business objects in this demo */ private HttpSession session; /** * Resets action form. Clear checkboxes here. This method is called before * form fields are populated, so here you can check request type, scope * and other action form parameters. * * @param mapping The ActionMapping used to select this instance * @param request The HTTP request we are processing */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); // Store session to access business objects this.session = request.getSession(); } /** * Validates input data. This method should be called manually from * action class to ensure, that (1) fields are not validated during * rendering phase, and to ensure that (2) action class handlers are called * even if input data is invalid. * @param actionMapping * @param httpServletRequest * @return */ public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest httpServletRequest) { ActionErrors errors = new ActionErrors(); if (stringValue == null || stringValue.length() == 0) { errors.add("ERROR", new ActionMessage("crudData.stringisnull")); } try { Integer.parseInt(intValue); } catch (NumberFormatException e) { errors.add("ERROR", new ActionMessage("crudData.numbernotint")); } return errors; } } --- NEW FILE: CRUDListActionSample.java --- package net.jspcontrols.dialogs.samples.crudaction; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import net.jspcontrols.dialogs.actions.crud.CRUDAction; import net.jspcontrols.dialogs.actions.crud.ICRUDForm; import net.jspcontrols.dialogs.samples.crudaction.business.BusinessObj; import java.util.ArrayList; /** * Created by IntelliJ IDEA. * User: Mikus * Date: Jun 28, 2005 * Time: 7:58:45 AM * To change this template use Options | File Templates. */ public class CRUDListActionSample extends CRUDAction { public void prepareItemList(HttpServletRequest request) { // Verify that item list exists in session HttpSession session = request.getSession(); synchronized(session) { ArrayList items = (ArrayList) session.getAttribute(CRUDFormSample.CRUD_LIST_KEY); // Create test sample of three items if (items == null) { items = new ArrayList(); items.add(new BusinessObj()); items.add(new BusinessObj()); items.add(new BusinessObj()); session.setAttribute(CRUDFormSample.CRUD_LIST_KEY, items); } } } /** * Returns an <code>ActionForward</code> instance describing the View * for current dialog state, usually a forward to a JSP page. * <p> * If you want to use the default implementation, define the View * under "DIALOG-VIEW" name in <forward> element of your action * mapping. * <p> * To use different mapping name, define the view in <forward> * element of your action mapping, and override this method to return * ActionForward object for your mapping name. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * * @exception Exception if an exception occurs * @return ActionForward instance describing the View for dialog state */ public ActionForward getDialogView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Mark response as non-cachable setNoCache(response); // Obtain current BO mode ICRUDForm crudForm = (ICRUDForm) form; String uiMode = crudForm.getCrudUIMode(); // There are no active items, so show item list if (ICRUDForm.CRUD_UI_MODE_INACTIVE.equals(uiMode)) { prepareItemList(request); } // Display a page corresponding to current item state return mapping.findForward(uiMode); } } --- NEW FILE: ItemListActionSample.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.samples.crudaction; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import net.jspcontrols.dialogs.samples.crudaction.business.BusinessObj; /** * This class builds list of business items. This is a helper to show * CRUDAction in work. * * @author Michael Jouravlev */ public class ItemListActionSample extends Action { /** * Prepare and show item list. Each item can be operated by CRUDAction. */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Verify that item list exists in session HttpSession session = request.getSession(); ArrayList items = (ArrayList) session.getAttribute(CRUDFormSample.CRUD_LIST_KEY); // Create default item list of three items if (items == null) { items = new ArrayList(); items.add(new BusinessObj()); items.add(new BusinessObj()); items.add(new BusinessObj()); session.setAttribute(CRUDFormSample.CRUD_LIST_KEY, items); } // Modify response header to make page non-cachable. response.setHeader("Pragma", "No-cache"); response.setHeader("Cache-Control", "no-cache,no-store,max-age=0"); response.setDateHeader("Expires", 1); // Show item list in crudaction-list.jsp return mapping.findForward("showlist"); } } |
From: <jm...@us...> - 2005-07-11 07:13:23
|
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/dialogs/samples/childaction In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/jspcontrols/dialogs/samples/childaction Added Files: EmbeddedAction.java EmbeddedActionResin.java EmbeddedActionTomcat.java embedded_0002dchild_0002dlogin_jsp.java embedded_0002dchild_0002dlogout_jsp.java Log Message: --- NEW FILE: EmbeddedAction.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.samples.childaction; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMessages; import org.apache.jasper.runtime.HttpJspBase; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.util.Map; import java.util.HashMap; import net.jspcontrols.dialogs.actions.DialogConstants; import net.jspcontrols.dialogs.actions.DialogAction; import net.jspcontrols.dialogs.samples.dialogloginaction.DialogLoginForm; /** * <p>This is a parent class for two concrete child controls: one is fully * JSP-compliant and works in Tomcat, another uses features above JSP spec, * implemented, for example, in Resin or Jetty.</p> * * <p>This is a login control with two states and two corresponding pages: * "logged in" and "not logged in".</p> * * @author Michael Jouravlev */ public class EmbeddedAction extends DialogAction { /** * Maps submit button names to methods */ protected Map getKeyMethodMap() { Map map = new HashMap(); // Submit events map.put("DIALOG-EVENT-LOGIN", "login"); map.put("DIALOG-EVENT-LOGOUT", "logout"); return map; } /** * Process login attempt (POST) and reloads the master page */ public ActionForward login ( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Validate user name and password, can do it right here in action as well ActionMessages errors = form.validate(mapping, request); // Errors found, stick them into session if (errors != null) { HttpSession session = request.getSession(); saveDialogErrors(session, errors); // Login OK, set username in the session } else { DialogLoginForm inputForm = (DialogLoginForm) form; request.getSession().setAttribute("login.username", inputForm.getName()); } // Reload master page, see mapping in struts_config.xml return mapping.findForward(DialogConstants.DIALOG_RELOAD_KEY); } /** * Logs a user out and reloads the master page */ public ActionForward logout (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DialogLoginForm inputForm = (DialogLoginForm) form; // Clean password in the input/output form bean inputForm.setPassword(null); // Remove login name from session, effectively logging out request.getSession().removeAttribute("login.username"); // Reload master page, see mapping in struts_config.xml return mapping.findForward(DialogConstants.DIALOG_RELOAD_KEY); } } --- NEW FILE: EmbeddedActionResin.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.samples.childaction; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * <p>This is a login control uses features above JSP spec, implemented, * for example, in Resin or Jetty. The control has two states and two * corresponding pages: "logged in" and "not logged in".</p> * * @author Michael Jouravlev */ public class EmbeddedActionResin extends EmbeddedAction { /** * <p>Renders child control in a way, which is not compliant with JSP spec * up to 2.4. Therefore, this render method does not work on Tomcat. * JSP specification, version 2.4, section 8.4 reads: * "Before the forward method of the RequestDispatcher interface * returns, the response content must be sent and committed, * and closed by the servlet container."</p> * * <p>The above means, that when child component of master JSP page * (this action class) forwards to its own little JSP page to render * itself, Tomcat closes response, and the rest of master page * is not rendered. This should be addressed in future JSP spec.</p> * * <p>The code works fine in Resin, but does not work in Tomcat * without a patch. Patch is available, but was not thoroughly tested.</p> * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * @return action mapping to a page, corresponding to current control * state: "notlogggedin" or "loggedin". */ public ActionForward getDialogView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Mark component as non-cachable setNoCache(response); // Display page, corresponding to login state. HttpSession session = request.getSession(); if (session.getAttribute("login.username") == null) { return mapping.findForward("notloggedin"); } else { return mapping.findForward("loggedin"); } } } --- NEW FILE: EmbeddedActionTomcat.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.samples.childaction; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMessages; import org.apache.jasper.runtime.HttpJspBase; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.util.Map; import java.util.HashMap; import net.jspcontrols.dialogs.actions.DialogConstants; import net.jspcontrols.dialogs.actions.DialogAction; import net.jspcontrols.dialogs.samples.dialogloginaction.DialogLoginForm; /** * <p>This is a login control which is fully JSP-compliant and works in * Tomcat. The control has two states and two corresponding pages: * "logged in" and "not logged in".</p> * * @author Michael Jouravlev */ public class EmbeddedActionTomcat extends EmbeddedAction { /** * <p>Renders child control in a way, which is compliant with JSP spec. * JSP specification, version 2.4, section 8.4 reads: * "Before the forward method of the RequestDispatcher interface * returns, the response content must be sent and committed, * and closed by the servlet container."</p> * * <p>The above means, that included action form should not forward * to JSP page for rendering, instead it must render page itself.</p> * * <p>The code works fine in any JSP container.</p> * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * @return action mapping to a page, corresponding to current control * state: "notlogggedin" or "loggedin". */ public ActionForward getDialogView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Mark component as non-cachable setNoCache(response); // Use code that was generated by Jasper from JSP pages. // Invoke it directly to avoid forwarding and premature closure // of response object. // While this is not the best way to develop JSP controls, it works. // Hopefully JSP spec will be fixed to allow forwarding from // included component. HttpSession session = request.getSession(); HttpJspBase resultPage = null; if (session.getAttribute("login.username") == null) { resultPage = new embedded_0002dchild_0002dlogin_jsp(); } else { resultPage = new embedded_0002dchild_0002dlogout_jsp(); } resultPage.init(this.getServlet().getServletConfig()); resultPage._jspService(request, response); resultPage.destroy(); return null; } } --- NEW FILE: embedded_0002dchild_0002dlogin_jsp.java --- /* * Struts Dialogs, Child control sample. * This file was generated by Apache Jasper. */ package net.jspcontrols.dialogs.samples.childaction; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import org.apache.jasper.runtime.*; public class embedded_0002dchild_0002dlogin_jsp extends HttpJspBase { private static java.util.Vector _jspx_includes; private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_html_form_action; private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_logic_messagesPresent; private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_html_messages_id; private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_bean_write_name_nobody; private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_html_text_tabindex_size_property_name_nobody; private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_html_image_value_src_property_nobody; public embedded_0002dchild_0002dlogin_jsp() { _jspx_tagPool_html_form_action = new org.apache.jasper.runtime.TagHandlerPool(); _jspx_tagPool_logic_messagesPresent = new org.apache.jasper.runtime.TagHandlerPool(); _jspx_tagPool_html_messages_id = new org.apache.jasper.runtime.TagHandlerPool(); _jspx_tagPool_bean_write_name_nobody = new org.apache.jasper.runtime.TagHandlerPool(); _jspx_tagPool_html_text_tabindex_size_property_name_nobody = new org.apache.jasper.runtime.TagHandlerPool(); _jspx_tagPool_html_image_value_src_property_nobody = new org.apache.jasper.runtime.TagHandlerPool(); } public java.util.List getIncludes() { return _jspx_includes; } public void _jspDestroy() { _jspx_tagPool_html_form_action.release(); _jspx_tagPool_logic_messagesPresent.release(); _jspx_tagPool_html_messages_id.release(); _jspx_tagPool_bean_write_name_nobody.release(); _jspx_tagPool_html_text_tabindex_size_property_name_nobody.release(); _jspx_tagPool_html_image_value_src_property_nobody.release(); } public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { JspFactory _jspxFactory = null; javax.servlet.jsp.PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType("text/html;charset=UTF-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("<!--\r\n Struts Dialogs, Login Control example\r\n Author: Michael Jouravlev, 2004-2005\r\n\r\n This is \"Login Page\" view for login child control\r\n-->\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n\r\n"); out.write("<table width=100% border=0 celpadding=0 cellspacing=2>\r\n "); /* ---- html:form ---- */ org.apache.struts.taglib.html.FormTag _jspx_th_html_form_0 = (org.apache.struts.taglib.html.FormTag) _jspx_tagPool_html_form_action.get(org.apache.struts.taglib.html.FormTag.class); _jspx_th_html_form_0.setPageContext(pageContext); _jspx_th_html_form_0.setParent(null); _jspx_th_html_form_0.setAction("/embeddedchild-tomcat.do"); int _jspx_eval_html_form_0 = _jspx_th_html_form_0.doStartTag(); if (_jspx_eval_html_form_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { do { out.write("\r\n "); out.write("<!-- Standard Struts error handling -->\r\n "); /* ---- logic:messagesPresent ---- */ org.apache.struts.taglib.logic.MessagesPresentTag _jspx_th_logic_messagesPresent_0 = (org.apache.struts.taglib.logic.MessagesPresentTag) _jspx_tagPool_logic_messagesPresent.get(org.apache.struts.taglib.logic.MessagesPresentTag.class); _jspx_th_logic_messagesPresent_0.setPageContext(pageContext); _jspx_th_logic_messagesPresent_0.setParent(_jspx_th_html_form_0); int _jspx_eval_logic_messagesPresent_0 = _jspx_th_logic_messagesPresent_0.doStartTag(); if (_jspx_eval_logic_messagesPresent_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { do { out.write("\r\n "); out.write("<tr>\r\n "); out.write("<td colspan=\"2\" align=\"left\" bgcolor=\"#FF9966\">\r\n "); /* ---- html:messages ---- */ org.apache.struts.taglib.html.MessagesTag _jspx_th_html_messages_0 = (org.apache.struts.taglib.html.MessagesTag) _jspx_tagPool_html_messages_id.get(org.apache.struts.taglib.html.MessagesTag.class); _jspx_th_html_messages_0.setPageContext(pageContext); _jspx_th_html_messages_0.setParent(_jspx_th_logic_messagesPresent_0); _jspx_th_html_messages_0.setId("error"); int _jspx_eval_html_messages_0 = _jspx_th_html_messages_0.doStartTag(); if (_jspx_eval_html_messages_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { java.lang.String error = null; if (_jspx_eval_html_messages_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { javax.servlet.jsp.tagext.BodyContent _bc = pageContext.pushBody(); out = _bc; _jspx_th_html_messages_0.setBodyContent(_bc); _jspx_th_html_messages_0.doInitBody(); } error = (java.lang.String) pageContext.findAttribute("error"); do { out.write("\r\n "); if (_jspx_meth_bean_write_0(_jspx_th_html_messages_0, pageContext)) return; out.write("\r\n "); int evalDoAfterBody = _jspx_th_html_messages_0.doAfterBody(); error = (java.lang.String) pageContext.findAttribute("error"); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_html_messages_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) out = pageContext.popBody(); } if (_jspx_th_html_messages_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; _jspx_tagPool_html_messages_id.reuse(_jspx_th_html_messages_0); out.write("\r\n "); out.write("</td>\r\n "); out.write("</tr>\r\n "); int evalDoAfterBody = _jspx_th_logic_messagesPresent_0.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); } if (_jspx_th_logic_messagesPresent_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; _jspx_tagPool_logic_messagesPresent.reuse(_jspx_th_logic_messagesPresent_0); out.write("\r\n "); out.write("<tr>\r\n "); out.write("<td align=\"left\">User name:"); out.write("</td>\r\n "); out.write("<td align=\"left\">\r\n "); if (_jspx_meth_html_text_0(_jspx_th_html_form_0, pageContext)) return; out.write("\r\n "); out.write("</td>\r\n "); out.write("</tr>\r\n "); out.write("<tr>\r\n "); out.write("<td align=\"left\">User pasword:"); out.write("</td>\r\n "); out.write("<td align=\"left\">\r\n "); if (_jspx_meth_html_text_1(_jspx_th_html_form_0, pageContext)) return; out.write("\r\n "); out.write("</td>\r\n "); out.write("</tr>\r\n "); out.write("<tr>\r\n "); out.write("<td align=\"left\">Use \"guest\"/\"guest\""); out.write("</td>\r\n "); out.write("<td colspan=\"2\" align=\"left\">\r\n "); if (_jspx_meth_html_image_0(_jspx_th_html_form_0, pageContext)) return; out.write("\r\n "); out.write("</td>\r\n "); out.write("</tr>\r\n "); int evalDoAfterBody = _jspx_th_html_form_0.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); } if (_jspx_th_html_form_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; _jspx_tagPool_html_form_action.reuse(_jspx_th_html_form_0); out.write("\r\n"); out.write("</table>\r\n"); } catch (Throwable t) { out = _jspx_out; if (out != null && out.getBufferSize() != 0) out.clearBuffer(); if (pageContext != null) pageContext.handlePageException(t); } finally { if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext); } } private boolean _jspx_meth_bean_write_0(javax.servlet.jsp.tagext.Tag _jspx_th_html_messages_0, javax.servlet.jsp.PageContext pageContext) throws Throwable { JspWriter out = pageContext.getOut(); /* ---- bean:write ---- */ org.apache.struts.taglib.bean.WriteTag _jspx_th_bean_write_0 = (org.apache.struts.taglib.bean.WriteTag) _jspx_tagPool_bean_write_name_nobody.get(org.apache.struts.taglib.bean.WriteTag.class); _jspx_th_bean_write_0.setPageContext(pageContext); _jspx_th_bean_write_0.setParent(_jspx_th_html_messages_0); _jspx_th_bean_write_0.setName("error"); int _jspx_eval_bean_write_0 = _jspx_th_bean_write_0.doStartTag(); if (_jspx_th_bean_write_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return true; _jspx_tagPool_bean_write_name_nobody.reuse(_jspx_th_bean_write_0); return false; } private boolean _jspx_meth_html_text_0(javax.servlet.jsp.tagext.Tag _jspx_th_html_form_0, javax.servlet.jsp.PageContext pageContext) throws Throwable { JspWriter out = pageContext.getOut(); /* ---- html:text ---- */ org.apache.struts.taglib.html.TextTag _jspx_th_html_text_0 = (org.apache.struts.taglib.html.TextTag) _jspx_tagPool_html_text_tabindex_size_property_name_nobody.get(org.apache.struts.taglib.html.TextTag.class); _jspx_th_html_text_0.setPageContext(pageContext); _jspx_th_html_text_0.setParent(_jspx_th_html_form_0); _jspx_th_html_text_0.setName("dialogloginform"); _jspx_th_html_text_0.setProperty("name"); _jspx_th_html_text_0.setSize("15"); _jspx_th_html_text_0.setTabindex("1"); int _jspx_eval_html_text_0 = _jspx_th_html_text_0.doStartTag(); if (_jspx_th_html_text_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return true; _jspx_tagPool_html_text_tabindex_size_property_name_nobody.reuse(_jspx_th_html_text_0); return false; } private boolean _jspx_meth_html_text_1(javax.servlet.jsp.tagext.Tag _jspx_th_html_form_0, javax.servlet.jsp.PageContext pageContext) throws Throwable { JspWriter out = pageContext.getOut(); /* ---- html:text ---- */ org.apache.struts.taglib.html.TextTag _jspx_th_html_text_1 = (org.apache.struts.taglib.html.TextTag) _jspx_tagPool_html_text_tabindex_size_property_name_nobody.get(org.apache.struts.taglib.html.TextTag.class); _jspx_th_html_text_1.setPageContext(pageContext); _jspx_th_html_text_1.setParent(_jspx_th_html_form_0); _jspx_th_html_text_1.setName("dialogloginform"); _jspx_th_html_text_1.setProperty("password"); _jspx_th_html_text_1.setSize("15"); _jspx_th_html_text_1.setTabindex("2"); int _jspx_eval_html_text_1 = _jspx_th_html_text_1.doStartTag(); if (_jspx_th_html_text_1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return true; _jspx_tagPool_html_text_tabindex_size_property_name_nobody.reuse(_jspx_th_html_text_1); return false; } private boolean _jspx_meth_html_image_0(javax.servlet.jsp.tagext.Tag _jspx_th_html_form_0, javax.servlet.jsp.PageContext pageContext) throws Throwable { JspWriter out = pageContext.getOut(); /* ---- html:image ---- */ org.apache.struts.taglib.html.ImageTag _jspx_th_html_image_0 = (org.apache.struts.taglib.html.ImageTag) _jspx_tagPool_html_image_value_src_property_nobody.get(org.apache.struts.taglib.html.ImageTag.class); _jspx_th_html_image_0.setPageContext(pageContext); _jspx_th_html_image_0.setParent(_jspx_th_html_form_0); _jspx_th_html_image_0.setValue("Log In"); _jspx_th_html_image_0.setProperty("DIALOG-EVENT-LOGIN"); _jspx_th_html_image_0.setSrc("embedded-images/index_19_login.gif"); int _jspx_eval_html_image_0 = _jspx_th_html_image_0.doStartTag(); if (_jspx_th_html_image_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return true; _jspx_tagPool_html_image_value_src_property_nobody.reuse(_jspx_th_html_image_0); return false; } } --- NEW FILE: embedded_0002dchild_0002dlogout_jsp.java --- /* * Struts Dialogs, Child control sample. * This file was generated by Apache Jasper. */ package net.jspcontrols.dialogs.samples.childaction; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import org.apache.jasper.runtime.*; public class embedded_0002dchild_0002dlogout_jsp extends HttpJspBase { private static java.util.Vector _jspx_includes; private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_html_form_action; private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_logic_messagesPresent; private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_html_messages_id; private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_bean_write_name_nobody; private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_html_image_value_src_property_nobody; public embedded_0002dchild_0002dlogout_jsp() { _jspx_tagPool_html_form_action = new org.apache.jasper.runtime.TagHandlerPool(); _jspx_tagPool_logic_messagesPresent = new org.apache.jasper.runtime.TagHandlerPool(); _jspx_tagPool_html_messages_id = new org.apache.jasper.runtime.TagHandlerPool(); _jspx_tagPool_bean_write_name_nobody = new org.apache.jasper.runtime.TagHandlerPool(); _jspx_tagPool_html_image_value_src_property_nobody = new org.apache.jasper.runtime.TagHandlerPool(); } public java.util.List getIncludes() { return _jspx_includes; } public void _jspDestroy() { _jspx_tagPool_html_form_action.release(); _jspx_tagPool_logic_messagesPresent.release(); _jspx_tagPool_html_messages_id.release(); _jspx_tagPool_bean_write_name_nobody.release(); _jspx_tagPool_html_image_value_src_property_nobody.release(); } public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { JspFactory _jspxFactory = null; javax.servlet.jsp.PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType("text/html;charset=UTF-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("<!--\r\n Struts Dialogs, Login Control example\r\n Author: Michael Jouravlev, 2004-2005\r\n\r\n This is \"Current User Info\" view for login child control\r\n-->\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n\r\n"); out.write("<table width=100% border=0 celpadding=0 cellspacing=2>\r\n "); /* ---- html:form ---- */ org.apache.struts.taglib.html.FormTag _jspx_th_html_form_0 = (org.apache.struts.taglib.html.FormTag) _jspx_tagPool_html_form_action.get(org.apache.struts.taglib.html.FormTag.class); _jspx_th_html_form_0.setPageContext(pageContext); _jspx_th_html_form_0.setParent(null); _jspx_th_html_form_0.setAction("/embeddedchild-tomcat.do"); int _jspx_eval_html_form_0 = _jspx_th_html_form_0.doStartTag(); if (_jspx_eval_html_form_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { do { out.write("\r\n "); out.write("<!-- Standard Struts error handling -->\r\n "); /* ---- logic:messagesPresent ---- */ org.apache.struts.taglib.logic.MessagesPresentTag _jspx_th_logic_messagesPresent_0 = (org.apache.struts.taglib.logic.MessagesPresentTag) _jspx_tagPool_logic_messagesPresent.get(org.apache.struts.taglib.logic.MessagesPresentTag.class); _jspx_th_logic_messagesPresent_0.setPageContext(pageContext); _jspx_th_logic_messagesPresent_0.setParent(_jspx_th_html_form_0); int _jspx_eval_logic_messagesPresent_0 = _jspx_th_logic_messagesPresent_0.doStartTag(); if (_jspx_eval_logic_messagesPresent_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { do { out.write("\r\n "); out.write("<tr>\r\n "); out.write("<td align=\"left\" bgcolor=\"#FF9966\">\r\n "); /* ---- html:messages ---- */ org.apache.struts.taglib.html.MessagesTag _jspx_th_html_messages_0 = (org.apache.struts.taglib.html.MessagesTag) _jspx_tagPool_html_messages_id.get(org.apache.struts.taglib.html.MessagesTag.class); _jspx_th_html_messages_0.setPageContext(pageContext); _jspx_th_html_messages_0.setParent(_jspx_th_logic_messagesPresent_0); _jspx_th_html_messages_0.setId("error"); int _jspx_eval_html_messages_0 = _jspx_th_html_messages_0.doStartTag(); if (_jspx_eval_html_messages_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { java.lang.String error = null; if (_jspx_eval_html_messages_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { javax.servlet.jsp.tagext.BodyContent _bc = pageContext.pushBody(); out = _bc; _jspx_th_html_messages_0.setBodyContent(_bc); _jspx_th_html_messages_0.doInitBody(); } error = (java.lang.String) pageContext.findAttribute("error"); do { out.write("\r\n "); if (_jspx_meth_bean_write_0(_jspx_th_html_messages_0, pageContext)) return; out.write("\r\n "); int evalDoAfterBody = _jspx_th_html_messages_0.doAfterBody(); error = (java.lang.String) pageContext.findAttribute("error"); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_html_messages_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) out = pageContext.popBody(); } if (_jspx_th_html_messages_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; _jspx_tagPool_html_messages_id.reuse(_jspx_th_html_messages_0); out.write("\r\n "); out.write("</td>\r\n "); out.write("</tr>\r\n "); int evalDoAfterBody = _jspx_th_logic_messagesPresent_0.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); } if (_jspx_th_logic_messagesPresent_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; _jspx_tagPool_logic_messagesPresent.reuse(_jspx_th_logic_messagesPresent_0); out.write("\r\n "); out.write("<tr>\r\n "); out.write("<td align=\"left\" width=\"50%\">Welcome, "); out.print( session.getAttribute("login.username") ); out.write("</td>\r\n "); out.write("</tr>\r\n "); out.write("<tr>\r\n "); out.write("<td align=\"left\"> "); out.write("</td>\r\n "); out.write("</tr>\r\n "); out.write("<tr>\r\n "); out.write("<td colspan=\"2\" align=\"left\">\r\n "); if (_jspx_meth_html_image_0(_jspx_th_html_form_0, pageContext)) return; out.write("\r\n "); out.write("</td>\r\n "); out.write("</tr>\r\n "); int evalDoAfterBody = _jspx_th_html_form_0.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); } if (_jspx_th_html_form_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; _jspx_tagPool_html_form_action.reuse(_jspx_th_html_form_0); out.write("\r\n"); out.write("</table>\r\n"); } catch (Throwable t) { out = _jspx_out; if (out != null && out.getBufferSize() != 0) out.clearBuffer(); if (pageContext != null) pageContext.handlePageException(t); } finally { if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext); } } private boolean _jspx_meth_bean_write_0(javax.servlet.jsp.tagext.Tag _jspx_th_html_messages_0, javax.servlet.jsp.PageContext pageContext) throws Throwable { JspWriter out = pageContext.getOut(); /* ---- bean:write ---- */ org.apache.struts.taglib.bean.WriteTag _jspx_th_bean_write_0 = (org.apache.struts.taglib.bean.WriteTag) _jspx_tagPool_bean_write_name_nobody.get(org.apache.struts.taglib.bean.WriteTag.class); _jspx_th_bean_write_0.setPageContext(pageContext); _jspx_th_bean_write_0.setParent(_jspx_th_html_messages_0); _jspx_th_bean_write_0.setName("error"); int _jspx_eval_bean_write_0 = _jspx_th_bean_write_0.doStartTag(); if (_jspx_th_bean_write_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return true; _jspx_tagPool_bean_write_name_nobody.reuse(_jspx_th_bean_write_0); return false; } private boolean _jspx_meth_html_image_0(javax.servlet.jsp.tagext.Tag _jspx_th_html_form_0, javax.servlet.jsp.PageContext pageContext) throws Throwable { JspWriter out = pageContext.getOut(); /* ---- html:image ---- */ org.apache.struts.taglib.html.ImageTag _jspx_th_html_image_0 = (org.apache.struts.taglib.html.ImageTag) _jspx_tagPool_html_image_value_src_property_nobody.get(org.apache.struts.taglib.html.ImageTag.class); _jspx_th_html_image_0.setPageContext(pageContext); _jspx_th_html_image_0.setParent(_jspx_th_html_form_0); _jspx_th_html_image_0.setValue("Log In"); _jspx_th_html_image_0.setProperty("DIALOG-EVENT-LOGOUT"); _jspx_th_html_image_0.setSrc("embedded-images/index_19_logout.gif"); int _jspx_eval_html_image_0 = _jspx_th_html_image_0.doStartTag(); if (_jspx_th_html_image_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return true; _jspx_tagPool_html_image_value_src_property_nobody.reuse(_jspx_th_html_image_0); return false; } } |
From: <jm...@us...> - 2005-07-11 07:13:21
|
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/dialogs/actions/doc-files In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/jspcontrols/dialogs/actions/doc-files Added Files: inputaction.gif selectaction.gif Log Message: --- NEW FILE: inputaction.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: selectaction.gif --- (This appears to be a binary file; contents omitted.) |
From: <jm...@us...> - 2005-07-11 07:13:21
|
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/dialogs/actions/crud In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/jspcontrols/dialogs/actions/crud Added Files: CRUDAction.java CRUDConstants.java CRUDForm.java ICRUDForm.java Log Message: --- NEW FILE: CRUDAction.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.actions.crud; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMessages; import org.apache.struts.Globals; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.util.Map; import java.util.HashMap; import net.jspcontrols.dialogs.actions.DialogAction; /** * CRUDAction facilitates the processing of the common use case * of an interactive application: <strong>cr</strong>eation, * <strong>u</strong>pdate and <strong>d</strong>eletion of a * <em>business object</em> (BO). Business object is also called * <i>item</i></p> * * <p><code>CRUDAction</code> has the following features:</p> * <ul> * <li>Handler methods for CRUD events</li> * <li>States and state transitions for BO</li> * <li>Mappings for result pages</li> * </ul> * * <p>These features are ihnerited from DialogAction:</p> * <ul> * <li>Event-based input handling</li> * <li>Two-phase I/O processing (POST-redirect-GET)</li> * <li>Buffering and removal of error messages</li> * <li>Safe use of Reload browser button</li> * <li>Improved protection from double submits</li> * <li>Cleaner browser page history</li> * </ul> * * <p>CRUDAction has a notion of <em>current item</em>. It is an existing * item, which is being viewed or edited, or a new item, which just has been * created and is being filled out. In other words, current item is the item * we currently working with.</p> * * <p>If current item does not exist, <code>CRUDAction</code> is switched * to <code>inactive</code> state. It is possible to switch to one of two * active states, by doing one of the following:</p> * <ul> * <li>Create new item from scratch and start populating its properties.</li> * <li>Create new item duplicating its data from existing one, and change * some of its properties.</li> * <li>Edit existing item, updating some or all of its properties.</li> * <li>View existing item in read-only mode.</li> * <li>Delete existing item.</li> * </ul> * * <p>After we created a new item or started to edit an existing one, * CRUDAction switches to one of the active states: <code>editable</code> * or <code>readonly</code>. <code>Editable</code> state permits to update * item data. <code>Readonly</code> state is used for preview mode and may * help to optimize item caching.</p> * * <p>CRUDAction must be paired with a form bean, implementing ICRUDForm, * to deliver its full power. See sample code for an example of how * a concrete CRUDAction can be implemented</p> * * @author Michael Jouravlev */ public class CRUDAction extends DialogAction { /** * Returns the initialization key or initialization prefix. * Must start with the same prefix as dialog buttons. For example, * if dialog buttons start with "DIALOG-EVENT", then "DIALOG-EVENT-INIT" * is a good name for initilization key, while "DIALOG-INIT" is not. */ protected String getInitKey() { return "DIALOG-EVENT-INIT"; } /** * Maps submit button names to handler methods; also maps initialization * keys to initialization methods. Events, external to CRUDAction, * are considered initializing events, and therefore must start with * initialization prefix. For example, if initialization prefix * starts with "DIALOG-EVENT-INIT", then "DIALOG-EVENT-INIT-CREATE" * is a good key for "Create new business object" event, while * "DIALOG-EVENT-CREATE" is not. * <p> * If you do not want to use all CRUD handlers, and want to protect * yourself from calling unneeded handler, you can subclass this class, * and override this method. Then you define only mappings that you need. * @see CRUDAction#getInitKey */ protected Map getKeyMethodMap() { Map map = new HashMap(); // // Events external to CRUDaction; initialize business data // // Create new item map.put(getInitKey()+"-CREATE", "onCreate"); // Create new item from existing one map.put(getInitKey()+"-DUPLICATE", "onDuplicate"); // Update existing item map.put(getInitKey()+"-UPDATE", "onEdit"); // View existing item map.put(getInitKey()+"-VIEW", "onPreview"); // // Events, which are triggered within CRUDAction for current item // // Delete current item map.put("DIALOG-EVENT-DELETE", "onDelete"); // Cancel viewing or editing of current item map.put("DIALOG-EVENT-CANCEL", "onCancel"); // Persist changes of current item map.put("DIALOG-EVENT-SAVE", "onSave"); // Close preview mode of existing item map.put("DIALOG-EVENT-CLOSE", "onClose"); return map; } /************************************************************************** * Input phase handlers *************************************************************************/ /** * Creates new item. Calls associated action form to create new * business object and to initialize action form fields. In case of * error, messages are saved in the session and removed automatically * during render phase. * @return ActionForward object, identifying the target location. * Possible values are: CRUDConstants.MAPPING_ON_CREATE_SUCCESS if * new business object was created successfully, or * CRUDConstants.MAPPING_ON_CREATE_FAILURE if failed to create * new business object. * @see CRUDConstants#MAPPING_ON_CREATE_SUCCESS * @see CRUDConstants#MAPPING_ON_CREATE_FAILURE */ public ActionForward onCreate (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Create new business object (item) ICRUDForm crudForm = (ICRUDForm) form; ActionMessages messages = crudForm.crudCreate(); // Successfully created new object and initialized action form if ((messages == null) || messages.isEmpty()) { // Need to handle this "forward" object in struts-config.xml return mapping.findForward(CRUDConstants.MAPPING_ON_CREATE_SUCCESS); // On error save messages into session. Struts 1.2.6+ has // a special method for it; but this code saves errors directly // to session for compatibility with older Struts versions. } else { HttpSession session = request.getSession(); session.setAttribute(Globals.ERROR_KEY, messages); // Need to handle this "forward" object in struts-config.xml return mapping.findForward(CRUDConstants.MAPPING_ON_CREATE_FAILURE); } } /** * Creates new item based on existing item. Calls associated action form * to create new business object and to initialize action form fields, * using existing business data. In case of error, messages are saved * in the session and removed automatically during render phase. * @return ActionForward object, identifying the target location. * Possible values are: CRUDConstants.MAPPING_ON_DUPLICATE_SUCCESS * if new business object was created successfully, or * CRUDConstants.MAPPING_ON_DUPLICATE_FAILURE if failed to create * new business object. * @see CRUDConstants#MAPPING_ON_DUPLICATE_SUCCESS * @see CRUDConstants#MAPPING_ON_DUPLICATE_FAILURE */ public ActionForward onDuplicate (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ICRUDForm crudForm = (ICRUDForm) form; ActionMessages messages = crudForm.crudDuplicate(); if ((messages == null) || messages.isEmpty()) { return mapping.findForward(CRUDConstants.MAPPING_ON_DUPLICATE_SUCCESS); } else { HttpSession session = request.getSession(); session.setAttribute(Globals.ERROR_KEY, messages); return mapping.findForward(CRUDConstants.MAPPING_ON_DUPLICATE_FAILURE); } } /** * Updates existing item. Calls associated action form to load existing * business object from persistence layer. In case of error, messages * are saved in the session and removed automatically during render phase. * @return ActionForward object, identifying the target location. * Possible values are: CRUDConstants.MAPPING_ON_EDIT_SUCCESS * if existing business object was successfully prepared for * editing, or CRUDConstants.MAPPING_ON_LOAD_FAILURE if failed * to load existing business object from persistence layer. * @see CRUDConstants#MAPPING_ON_EDIT_SUCCESS * @see CRUDConstants#MAPPING_ON_LOAD_FAILURE */ public ActionForward onEdit (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ICRUDForm crudForm = (ICRUDForm) form; ActionMessages messages = crudForm.crudLoadForUpdate(); if ((messages == null) || messages.isEmpty()) { return mapping.findForward(CRUDConstants.MAPPING_ON_EDIT_SUCCESS); } else { HttpSession session = request.getSession(); session.setAttribute(Globals.ERROR_KEY, messages); return mapping.findForward(CRUDConstants.MAPPING_ON_LOAD_FAILURE); } } /** * Previews existing item. Calls associated action form to load existing * business object from persistence layer. In case of error, messages * are saved in the session and removed automatically during render phase. * @return ActionForward object, identifying the target location. * Possible values are: CRUDConstants.MAPPING_ON_NOEDIT_SUCCESS * if existing business object was successfully prepared for * viewing, or CRUDConstants.MAPPING_ON_LOAD_FAILURE if failed * to load existing business object from persistence layer. * @see CRUDConstants#MAPPING_ON_PREVIEW_SUCCESS * @see CRUDConstants#MAPPING_ON_LOAD_FAILURE */ public ActionForward onPreview (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ICRUDForm crudForm = (ICRUDForm) form; ActionMessages messages = crudForm.crudLoadForPreview(); if ((messages == null) || messages.isEmpty()) { return mapping.findForward(CRUDConstants.MAPPING_ON_PREVIEW_SUCCESS); } else { HttpSession session = request.getSession(); session.setAttribute(Globals.ERROR_KEY, messages); return mapping.findForward(CRUDConstants.MAPPING_ON_LOAD_FAILURE); } } /** * Deletes existing item. This is the only event which can be triggered * from all three CRUD modes: Inactive, Edit and Noedit. This method calls * associated action form to perform actual removal of business object * from persistence layer. In case of error, messages are saved in * the session and removed automatically during render phase. * @return ActionForward object, identifying the target location. * Possible values are: CRUDConstants.MAPPING_ON_DELETE_SUCCESS * if existing business object was successfully deleted, * or CRUDConstants.MAPPING_ON_DELETE_FAILURE if failed * to delete existing business object from persistence layer. * @see CRUDConstants#MAPPING_ON_DELETE_SUCCESS * @see CRUDConstants#MAPPING_ON_DELETE_FAILURE */ public ActionForward onDelete (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ICRUDForm crudForm = (ICRUDForm) form; ActionMessages messages = crudForm.crudDelete(); if ((messages == null) || messages.isEmpty()) { return mapping.findForward(CRUDConstants.MAPPING_ON_DELETE_SUCCESS); } else { HttpSession session = request.getSession(); session.setAttribute(Globals.ERROR_KEY, messages); return mapping.findForward(CRUDConstants.MAPPING_ON_DELETE_FAILURE); } } /** * Cancels filling it new item, or editing existing item without saving it. * This method calls associated action form to perform needed cleanup. * No messages are generated for this event. * @return ActionForward object, identifying the target location. * Created using CRUDConstants.MAPPING_ON_CANCEL mapping. * @see CRUDConstants#MAPPING_ON_CANCEL */ public ActionForward onCancel (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ICRUDForm crudForm = (ICRUDForm) form; crudForm.crudCancel(); return mapping.findForward(CRUDConstants.MAPPING_ON_CANCEL); } /** * Closes business item preview page. This method calls associated * action form to perform needed cleanup. No messages are generated * for this event. * @return ActionForward object, identifying the target location. * Created using CRUDConstants.MAPPING_ON_CLOSE mapping. * @see CRUDConstants#MAPPING_ON_CLOSE */ public ActionForward onClose (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ICRUDForm crudForm = (ICRUDForm) form; crudForm.crudClose(); return mapping.findForward(CRUDConstants.MAPPING_ON_CLOSE); } /** * Event handler for Save button, persists form data. Called during * input phase of two-phase I/O process. * <p> * Internally, this method calls two methods on associated form bean: * standard <code>validate</code> method to check input data, * and <code>crudStore</code> method to persist input data if it is valid. * <p> * Both form bean methods should return non-empty ActionMessages object * to signal that either validation or persisting was unsuccessful. * <p> * Since this method handles POST requests, the outcome mappings * for this method should use redirection to avoid double submit * situations and POSTDATA messages. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * @return an <code>ActionForward</code> instance describing where and how * control should be handed over, or <code>null</code> to reload * the same action using GET request. * @exception java.lang.Exception if an exception occurs */ public ActionForward onSave (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Every event handler must clean old error messages HttpSession session = request.getSession(); ICRUDForm crudForm = (ICRUDForm) form; // Validate input data ActionMessages messages = form.validate(mapping, request); // Input data is not valid if (messages != null && messages.size() > 0) { session.setAttribute(Globals.ERROR_KEY, messages); return mapping.findForward(CRUDConstants.MAPPING_ON_INVALID_DATA); // Input data is valid } else { // Try to persist form data ActionMessages storeMessages = crudForm.crudStore(); // Could not persist form data if (storeMessages != null && storeMessages.size() > 0) { session.setAttribute(Globals.ERROR_KEY, storeMessages); return mapping.findForward(CRUDConstants.MAPPING_ON_STORE_FAILURE); // Successfully persisted } else { return mapping.findForward(CRUDConstants.MAPPING_ON_STORE_SUCCESS); } } } /************************************************************************** * Rendering phase handler *************************************************************************/ /** * Returns an <code>ActionForward</code> instance describing the View * for current dialog state, usually a forward to a JSP page. * <p> * If you want to use the default implementation, define the View * under "DIALOG-VIEW" name in <forward> element of your action * mapping. * <p> * To use different mapping name, define the view in <forward> * element of your action mapping, and override this method to return * ActionForward object for your mapping name. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * * @exception java.lang.Exception if an exception occurs * @return ActionForward instance describing the View for dialog state */ public ActionForward getDialogView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // CRUDAction works with form beans, implementing ICRUDForm ICRUDForm crudForm = (ICRUDForm) form; String uiMode = crudForm.getCrudUIMode(); return mapping.findForward(uiMode); } } --- NEW FILE: CRUDConstants.java --- /* * Copyright 2004-2005 Michael Jouravlev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.actions.crud; /** * CRUD action constants, used in Struts Dialogs package. * * @author Michael Jouravlev */ public interface CRUDConstants { /************************************************************************** * First phase mappings: where to go after input data processed *************************************************************************/ /** * Successfully created empty BO (usually redirect to self for editing) */ String MAPPING_ON_CREATE_SUCCESS = "ON-CREATE-SUCCESS"; /** * Failed to create empty BO (redirect to error page) */ String MAPPING_ON_CREATE_FAILURE = "ON-CREATE-FAILURE"; /** * Successfully duplicated BO (usually redirect to self for editing) */ String MAPPING_ON_DUPLICATE_SUCCESS = "ON-DUPLICATE-SUCCESS"; /** * Failed to duplicate existing BO (redirect to error page) */ String MAPPING_ON_DUPLICATE_FAILURE = "ON-DUPLICATE-FAILURE"; /** * Successfully loaded existing BO and prepared for preview (usually redirect to self for viewing) */ String MAPPING_ON_PREVIEW_SUCCESS = "ON-PREVIEW"; /** * Successfully loaded existing BO and prepared for editing (usually redirect to self for editing) */ String MAPPING_ON_EDIT_SUCCESS = "ON-EDIT"; /** * Failed to load existing BO for preview or editing (redirect to error page) */ String MAPPING_ON_LOAD_FAILURE = "ON-LOAD-FAILURE"; /** * Successfully deleted existing BO (usually redirect to BO list or success page) */ String MAPPING_ON_DELETE_SUCCESS = "ON-DELETE-SUCCESS"; /** * Failed to delete existing BO (redirect to error page) */ String MAPPING_ON_DELETE_FAILURE = "ON-DELETE-FAILURE"; /** * Canceled editing existing BO or new BO */ String MAPPING_ON_CANCEL = "ON-CANCEL"; /** * Closed preview of existing BO */ String MAPPING_ON_CLOSE = "ON-CLOSE"; /** * Successfully stored new BO or changes to existing BO */ String MAPPING_ON_STORE_SUCCESS = "ON-STORE-SUCCESS"; /** * Failed to store new BO or changes to existing BO */ String MAPPING_ON_STORE_FAILURE = "ON-STORE-FAILURE"; /** * Input data is invalid (when form bean's validate() returns errors) */ String MAPPING_ON_INVALID_DATA = "ON-INVALID-DATA"; } --- NEW FILE: CRUDForm.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.actions.crud; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import javax.servlet.http.HttpServletRequest; /** * Base action form, paired to CRUDAction. You can subclass this form, * or copy and paste its fields and methods, if you subclassing another * form class. * * @author Michael Jouravlev */ public abstract class CRUDForm extends ActionForm implements ICRUDForm { /************************************************************************** * Standard fields and methods for every ICRUDForm implementation **************************************************************************/ /** * UI Mode */ private String uiMode; /** * Returns current UT mode * @see ICRUDForm#CRUD_UI_MODE_INACTIVE * @see ICRUDForm#CRUD_UI_MODE_EDITABLE * @see ICRUDForm#CRUD_UI_MODE_READONLY */ public String getCrudUIMode() {return uiMode;} /** * Sets current UT mode, used by business logic code. * @see ICRUDForm#CRUD_UI_MODE_INACTIVE * @see ICRUDForm#CRUD_UI_MODE_EDITABLE * @see ICRUDForm#CRUD_UI_MODE_READONLY */ public void changeCrudUIMode(String mode) { this.uiMode = mode; } /** * Constructs CRUD form. UI Mode must be set to CRUD_UI_MODE_INACTIVE, * because no actual data is created or loaded yet. */ public CRUDForm() { uiMode = ICRUDForm.CRUD_UI_MODE_INACTIVE; } /** * Resets action form. Clear checkboxes here. This method is called before * form fields are populated, so here you can check request type, scope * and other action form parameters. * * @param mapping The ActionMapping used to select this instance * @param request The HTTP request we are processing */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); // This form must have session scope to store CRUD data if (!"session".equalsIgnoreCase(mapping.getScope())) { throw new IllegalStateException("Action " + mapping.getPath() + "should have session scope"); } } } --- NEW FILE: ICRUDForm.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.actions.crud; import org.apache.struts.action.ActionMessages; /** * this interface must be implemented by an action form, which handles CRUD events. * * @author Michael Jouravlev */ public interface ICRUDForm { /************************************************************************** * View Mode **************************************************************************/ /** * Default UI mode: no business data loaded. Operations allowed * in this mode: * <ul> * <li>Create New Item (create -> CRUD_UI_MODE_EDIT mode) * <li>Create Item From (Duplicate -> CRUD_UI_MODE_EDIT mode) * <li>Update Item (load -> CRUD_UI_MODE_EDIT mode) * <li>View Item (load -> CRUD_UI_MODE_NOEDIT mode) * </ul> */ public static final String CRUD_UI_MODE_INACTIVE = "CRUD-UI-MODE-INACTIVE"; /** * Editing UI mode: business data must have been already created * or loaded. Corresponding JSP should allow to change and save data. * Operations allowed in this mode: * <ul> * <li>Delete (delete -> CRUD-ON-DELETE-SUCCESS/CRUD-ON-DELETE-ERROR) * <li>Cancel (cancel -> CRUD-ON-CANCEL) * <li>Save (store -> CRUD-ON-STORE-SUCCESS/CRUD-ON-STORE-ERROR) * </ul> */ public static final String CRUD_UI_MODE_EDITABLE = "CRUD-UI-MODE-EDITABLE"; /** * View-only UI mode: business data must have been already created * or loaded. Corresponding JSP should not allow to change and save data. * Operations allowed in this mode: * <ul> * <li>Delete (delete -> CRUD-ON-DELETE-SUCCESS/CRUD-ON-DELETE-ERROR) * <li>Close (close -> CRUD-ON-CLOSE) * </ul> */ public static final String CRUD_UI_MODE_READONLY = "CRUD-UI-MODE-READONLY"; /** * Sets UI mode. Default mode is CRUD_VIEW_MODE_INACTIVE. In this mode * action form either does not contain data, or data is undefined state. * Thus, editing, viewing, and storing form data is prohibited. * <p> * Once new data is loaded from persistent storage, or created, mode * should be changed to either CRUD_VIEW_MODE_EDIT or CRUD_VIEW_MODE_NOEDIT * which allow to view/edit/delete/save the data. * <p> * After data is saved or edit mode is canceled, view mode should be * chaged back to CRUD_VIEW_MODE_INACTIVE to prevent responding to a browser * with a stale page, or accepting data from a stale page. * * @param mode UI mode for this action form * @see ICRUDForm#CRUD_UI_MODE_INACTIVE * @see ICRUDForm#CRUD_UI_MODE_EDITABLE * @see ICRUDForm#CRUD_UI_MODE_READONLY */ void changeCrudUIMode(String mode); /** * Returns current UI mode for this action form. * @see ICRUDForm#CRUD_UI_MODE_INACTIVE * @see ICRUDForm#CRUD_UI_MODE_EDITABLE * @see ICRUDForm#CRUD_UI_MODE_READONLY */ String getCrudUIMode(); /************************************************************************** * Business Object event handling **************************************************************************/ /** * Creates new business data * @return non-empty ActionMessages object if could not create item. */ ActionMessages crudCreate(); /** * Duplicates new business data from existing object * @return non-empty ActionMessages object if could not duplicate item. */ ActionMessages crudDuplicate(); /** * Load business data from persistence layer into the action form or * into nested property of action form, and switches to edit mode. * @return non-empty ActionMessages object if could not load business item. */ ActionMessages crudLoadForUpdate(); /** * Load business data from persistence layer into the action form or * into nested property of action form, and switches to view mode. * @return non-empty ActionMessages object if could not load business item. */ ActionMessages crudLoadForPreview(); /** * Deletes business data from underlying persistent layer * @return non-empty ActionMessages object if could not delete item. */ ActionMessages crudDelete(); /** * Cancels process of updating existing or new item. This method usually * returns null. * @return non-empty ActionMessages object if could not cancel update process. */ ActionMessages crudCancel(); /** * Closes preview from of existing item. This method usually returns null. * @return non-empty ActionMessages object if could not close view. */ ActionMessages crudClose(); /** * Stores business data in the persistence layer. * @return non-empty ActionMessages object if could not store business data. */ ActionMessages crudStore(); } |
From: <jm...@us...> - 2005-07-11 07:13:19
|
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/dialogs/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/jspcontrols/dialogs/actions Added Files: DialogAction.java DialogConstants.java SelectAction.java package.html Log Message: --- NEW FILE: DialogAction.java --- /* * Copyright 2004-2005 Michael Jouravlev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.actions; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMessages; import org.apache.struts.Globals; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.util.Enumeration; /** * <p>An abstract <strong>Action</strong> that provides basic dialog functions, * like accepting input data, dispatching submit event to a method, generating * and storing error messages and rendering a view. DialogAction allows to * create robust user inteface and provides simple event-based programming accounts.</p> * * <p>DialogAction incorporates several innovative design decisions not previously * used in Struts. Some of them are already implemented in other frameworks, * like Ruby on Rails or JSF. Other features are unique to DialogAction.</p> * * <p><strong>Input/Output Separation</strong></p> * * <p>The cornerstone concept of DialogAction is <i>separation of input and output * processes</i>. It solves several issues, related to HTML form input, * like double submit problem, annoying POSTDATA messages, bad usability * when Reload, Back and Forward buttons are used.</p> * * <p>DialogAction defines three different modes of operation:</p> * <ul> * <li><i>action initialization</i> prepares action for use with new set of data; * <li><i>user input process</i> accepts input data, updates domain accounts, * generates error messages; * <li><i>view rendering process</i> generates a result page. * </ul> * * <p>HTTP specification recommends to use POST request method for server state * modification, and GET method for requests with no side effects. Therefore, * input and output processes in DialogAction are cleanly separated * by request method:</p> * <ul> * <li>Browser sends input data to <nop>DialogAction using POST request. * <li>Web application redirects browser to the location of result page. * <li>Browser loads result page using GET request. * Because this pattern includes redirection, it can also be called as * "Redirect-After-Post" or "Post/Redirect/Get". * </ul> * * <img border="0" align="center" src="doc-files/inputaction.gif" width="500" height="540"> * * <p>It must be understood, that redirection is an inherent part of this pattern. * Redirection allows to split one solid "POST input data, respond * with result page" process into two processes, which are completely * independent from server standpoint.</p> * * <p>Separation of input and output improves usability and user experience:</p> * <ul> * <li>Any page can be reloaded without resending input information to the server. * <li>As a consequence, an application does not have to cope with double submits. * <li>Another consequence is that a user does not see "Do you want to resend * POSTDATA?" message. * <li>Using Back and Forward buttons is safe, because only result pages * are browsed. * <li>If an action has several views corresponding to different application * states, every view is displayed in response to exactly the same * GET request. From browser's point of view the action always returns * the same page. This simple trick allows creating <i>web controls</i>. * Even better, some popular browsers like Internet Explorer or * Mozilla/Firefox do not add every result page to browser session history * if pages originate from the same location. * </ul> * * <p><strong>Event Handlers and View Renderer</strong></p> * * <p>Event handlers have the same signature, as execute method, and * process POST events, usually from submit buttons of HTML form. * An initialization event is one exception from this rule, and can be * processed as either POST or GET request. Initialization event has * a default key, DIALOG-EVENT-INIT.</p> * * <p>After input event is processed, DialogAction redirects to itself and * receives GET request from a browser. The same GET request is sent by * the browser when a user reloads a page. In both cases, GET request * is processed by <code>getView</code> method, which renders an output page.</p> * * <p>"Rendering" is probably a too strong word to what <code>getView</code> * method actually does. It simply chooses a mapping name of a JSP page * corresponding to current dialog state, and returns this mapping to Struts * in the same fashion as a regular action.</p> * * <p>If a dialog action has only one page to render, then default * <code>getView</code> implementation, which returns DIALOG-EVENT-VIEW key, * is sufficient. The only thing you need to do is to define * a <code>forward</code> element in the struts-config.xml file, * which maps view key to a JSP page. * * <p>If a dialog action can render different pages depending on application * state, it is called a <i>web control</i>. In this case <code>getView</code> * method should be overriden, and a proper mapping should be returned.</p> * * <p><strong>Default keys and mappings</strong></p> * * <p>DialogAction uses several predefined keys and mappings, to correlate * HTML buttons to handler methods, and to select result pages. These mappings * are defined in DialogConstants class:</p> * * <p>String DIALOG-VIEW-KEY = "DIALOG-VIEW";<br> * This is a default view mapping, mandatory if a dialog action has only * one page to render. If dialog can render different pages depending * on application state, use action-specific mappings. * * <p>String DIALOG-RELOAD-KEY = "DIALOG-RELOAD";<br> * This is a default reload mapping, optional. Can be omitted if * a dialog action redirects to itself for view processing, which is * a default behavior. It is possible to split input and output * processing between two separate actions, in this case use this mapping * to set the "view action" name.</p> * * <p>String DIALOG-EVENT-KEY = "DIALOG-EVENT";<br> * This is a default prefix for dialog events.</p> * * <p>String DIALOG-EVENT-INIT = "DIALOG-EVENT-INIT";<br> * This is a default name of initialization parameter.</p> * * <p><strong>Usage</strong></p> * * <p>DialogAction is supposed to be used for HTML forms, which are submitted * using POST request method. When the form is submitted, DialogAction * dispatches submit event to a handler method. For this to happed, * automatic validation must be turned off. The hander should validate * input data explicitly, and perform accounts update.</p> * * <p>In case of error, the handler should save errors in the session * and redirect to the same action, this is called <i>action reloading</i>. * Would not this cause infinite loop? No, because request for data submission * has POST type, while redirected request for action reloading has GET type. * DialogAction processes requests differently, depending on their type. * Action reloading can be performed automatically, see the example.</p> * * <p>If no errors detected, control is usually handed over to another action. * Redirection is a preferred way to hand over the control to prevent double * submit issues.</p> * * <p>When a user refreshes a page, action treats the request in the same way * as for action reloading, and displays an appropriate view with current * form bean values. This implies that application state must be stored * on server with session or higher scope.</p> * * <p>A special initializing request parameter must be used to initialize * and reset <nop>DialogAction. This is necessary, because there is * no other way to distinguish linking to DialogAction from other page, * explicit refreshing of page corresponding to an action, or action reloading. * Action data will not be cleared by simply navigating to DialogAction, * instead current values will be shown.</p> * * <p><strong>Notes</strong></p> * <ul> * <li>DialogAction extends SelectAction, refer to SelectAction API * for description on how to define handler methods, and how * to name buttons on HTML page. * <li>Make sure that you turned "validate" property off in your * action mapping in struts-config.xml file. Errors must be processed * explicitly in the action class, but you can use any action form you like, * as well as standard <code>validate</code> method of action form. * <li>Make sure that your action form uses session scope to retain form * values between requests. If you are strongly against storing * application state on the server, this action class is not for you. * </ul> * * @see net.jspcontrols.dialogs.actions.SelectAction * @see net.jspcontrols.dialogs.actions.DialogConstants * @version 1.2 * * @author Michael Jouravlev */ public abstract class DialogAction extends SelectAction { /** * Returns the initialization key, or initialization key prefix if * several init keys are possible. Must start with the same prefix as * dialog buttons. */ protected String getInitKey() { return "DIALOG-EVENT-INIT"; } /** * Cleans messages stored in the session. Subclasses can override * this method if error messages are stored differently, or under * different key. * @param request the HTTP request we are processing */ protected void clearMessages(HttpServletRequest request) { HttpSession session = request.getSession(); if (session != null) { session.removeAttribute(Globals.ERROR_KEY); session.removeAttribute(Globals.MESSAGE_KEY); } } /** * Saves dialog errors in the session under Globals.ERROR_KEY key. * @param session HttpSession object * @param errors error messages, accumulated while processing input * @since 1.2 */ protected void saveDialogErrors(HttpSession session, ActionMessages errors) { session.setAttribute(Globals.ERROR_KEY, errors); } /** * Marks response as non-cachable. Should be called before page content * is written to response. * @param response The HTTP response we are creating * @since 1.2 */ protected void setNoCache(HttpServletResponse response) { response.setHeader("Pragma", "No-cache"); response.setHeader("Cache-Control", "no-cache,no-store,max-age=0"); response.setDateHeader("Expires", 1); } /** * Returns suffix, used for action mapping. Default suffix is ".do" * Needed to properly setup location for dialog reloading. */ protected String getActionSuffix() { return ".do"; } /** * Returns true if request is considered "input" request. By convention * dialog input is sent via POST, result page is loaded via GET. * @param request The HTTP request we are processing */ protected boolean isInput(HttpServletRequest request) { return "POST".equalsIgnoreCase(request.getMethod()); } /** * Returns true if request is considered "init" request. DialogAction * uses a special request parameter to initialize action, because it * is impossible to distinguish a page refresh from navigating to an * action via a link, both use GET request method. * <p> * Initialization parameter must be defined in a concrete subclass. * @param request The HTTP request we are processing */ protected boolean isInit(HttpServletRequest request) { String initKey = getInitKey(); // Flag that dialog is initialized with explicit init parameter, // either with POST or with GET request. boolean isInit = false; // Find request parameter, starting with initKey Enumeration reqEn = request.getParameterNames(); while(reqEn.hasMoreElements()) { String reqName = (String) reqEn.nextElement(); if (reqName.startsWith(initKey)) { isInit = true; break; } } return isInit; } /** * Returns true, if GET request contains session ID both in cookie and * in the URL itself. This combination identifies the first request after * session has been established, with browser which supports cookies. * <p> * DialogAction tries to keep GET requests clean to encourage browser * to keep its page history from growing. When DialogAction detects * bogus request, it redirects to itself to ensure clean URL. This time * it will be clean, because session ID will be contained in cookie only. * @param request The HTTP request we are processing */ protected boolean isBogusGET(HttpServletRequest request) { // Note: on Tomcat 4-1-31 when session ID is present in both URL // an in cookie, isRequestedSessionIdFromURL() returns false, // while isRequestedSessionIdFromCookie() returns true. // Is it a bug or is required by spec? return request.isRequestedSessionIdFromURL() && request.isRequestedSessionIdFromCookie(); } /** * Returns the method name, given a prefix and a request object. * This is a helper method, which should not normally be redefined * by a subclass. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * @param parameter The <code>ActionMapping</code> parameter's name * Contains prefix of submit button names, or several prefixes * separated by comma or semicolon. * * @return The handler method name. */ protected String getMethodName(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, String parameter) throws Exception { // If event prefix is not provided in action mapping parameter, // use default dialog prefix if (parameter == null || parameter.length() == 0) { parameter = DialogConstants.DIALOG_EVENT_KEY; } return super.getMethodName(mapping, form, request, response, parameter); } /** * Process the specified HTTP request, and create the corresponding HTTP * response (or forward to another web component that will create it). * Return an <code>ActionForward</code> instance describing where and how * control should be forwarded, or <code>null</code> if the response has * already been completed. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * * @exception java.lang.Exception if an exception occurs */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Is this an input process with POST? boolean isInput = isInput(request); // Is this initialization? Can be GET or POST. boolean isInit = isInput ? false : isInit(request); // Is this a bogus GET? Can be a first GET, containing JSESSIONID boolean isBogus = isInput || isInit ? false : isBogusGET(request); // Data input via POST: clean messages, dispatch to handler if (isInput || isInit || isBogus) { // Clear error messages before updating the accounts or on init. clearMessages(request); // If current request is bogus, actionForward will stay null, // and action will redirect to itself, thus cleaning up request. ActionForward actionForward = null; // Dispatch submit event if (!isBogus) { actionForward = super.execute(mapping, form, request, response); } // If mapping with DialogConstants.DIALOG_RELOAD_KEY is not defined, // build ActionForward object and redirect to self. Works if // actions use default ".do" suffix. if (actionForward == null) { // Appending ".do" suffix to redirect to itself String mappingPath = mapping.getPath(); if (!mappingPath.endsWith(getActionSuffix())) { mappingPath += getActionSuffix(); } // Action redirect return new ActionForward(DialogConstants.DIALOG_RELOAD_KEY, mappingPath, true /* REDIRECT */); // Has proper redirecting location } else if ( actionForward.getRedirect()) { return actionForward; // Patch location to use redirection } else { // MUST redirect on reload // to avoid recursive requests by switching from POST to GET return new ActionForward(actionForward.getName(), actionForward.getPath(), true /* REDIRECT */); } // View is requested via GET: do not clean anything, show dialog page } else { return getDialogView(mapping, form, request, response); } } /** * Returns an <code>ActionForward</code> instance describing the View * for current dialog state, usually a forward to a JSP page. * <p> * If you want to use the default implementation, define the View * under "DIALOG-VIEW" name in <forward> element of your action * mapping. * <p> * To use different mapping name, define the view in <forward> * element of your action mapping, and override this method to return * ActionForward object for your mapping name. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * * @exception java.lang.Exception if an exception occurs * @return ActionForward instance describing the View for dialog state */ public ActionForward getDialogView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { return mapping.findForward(DialogConstants.DIALOG_VIEW_KEY); } } --- NEW FILE: DialogConstants.java --- /* * Copyright 2004-2005 Michael Jouravlev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.actions; /** * Dialog constants, used in Struts Dialogs package. * * @author Michael Jouravlev */ public interface DialogConstants { /** * Default prefix for dialog events, like submit button names. */ String DIALOG_EVENT_KEY = "DIALOG-EVENT"; /** * The default View mapping for dialog. A dialog may have one or several * Views and view mappings. * <p> * If the dialog has only one view mapping, and you want to use default * view mapping name, define the View path using "DIALOG-VIEW" name * in <forward> element of your action mapping. */ String DIALOG_VIEW_KEY = "DIALOG-VIEW"; /** * The default reload mapping for dialog. A dialog redirects to reload * location. * <p> * If the dialog redirects to itself (default), then reload mapping can * be omitted in the action mapping. */ String DIALOG_RELOAD_KEY = "DIALOG-RELOAD"; /** * The default name of the action mapping "forward" element, describing * the location where the dialog should directed after a user canceled it. * <p> * If you want to use default cancel mapping name, define the cancel path * using "DIALOGCANCEL" name in <forward> element of your action mapping. */ String DIALOG_CANCEL_KEY = "DIALOG-CANCEL"; /** * The default name of the action mapping "forward" element, describing * the location where the dialog should directed after it completes. * <p> * If you want to use default done mapping name, define the path * using "DIALOGDONE" name in <forward> element of your action mapping. */ String DIALOG_DONE_KEY = "DIALOG-DONE"; } --- NEW FILE: SelectAction.java --- /* * Copyright 2004-2005 Michael Jouravlev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.actions; import org.apache.struts.actions.DispatchAction; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForward; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.ServletException; import java.util.Map; import java.util.Enumeration; import java.util.StringTokenizer; /** * <p>An abstract <strong>Action</strong> that dispatches * an HTTP form submission event to a handler method.</p> * * <p>The purpose of this class is processing submission of HTML forms. * Unlike <nop>DispatchAction and <nop>LookupDispatchAction, which correlate * <code>value</code> attribute of <code>submit</code> form element with * handler method, this class uses <code>name</code> attribute. * Using <code>name</code> attribute allows to display a user-friendly caption * on a submit button. Also, it is possible to change button caption without * rebuilding the application.</p> * * <p>The subclass must define a map, which correlates submit button names * with method names, and handler methods themselves. Each method must have * the same signature as <code>execute</code> method. Subclass should not * redefine <code>execute</code> method.</p> * * <img border="0" align="center" src="doc-files/selectaction.gif" width="485" height="540"> * * <p>Using <code>name</code> attribute has a flip side: * during reset/populate/validate process, Struts assigns request values * to corresponding properties of a form bean. Thus, button keys must be named * differently from other request attributes. Also, the dispatch action * must recognize situation when no submit buttons were activated.</p> * * <p>Therefore, all submit buttons use a prefix in their name. * The prefix is specified by <code>parameter</code> property * of the <nop>ActionMapping. Make sure that you do not use periods * in the prefix and in actual button names, or Struts will try to search * and set the nested property and most likely will throw exception.</p> * * <p><strong>Example of Usage</strong></p> * * <p>The action should be configured in <code>struts‑config.xml</code> * file like this:</p> * <pre> * <action path="/test" * type="org.example.MyAction" * scope="request" * parameter="<b>myapp-submit</b>"/> * </pre> * <p>where: * <ul> * <li><code>org.example.MyAction</code> extends <code>SelectAction</code>; * <li><code>parameter</code> contains prefix of your choice for all * submit buttons on an HTML form. * </ul> * </p> * <p> * The names of submit elements should start from the aforementioned prefix, * for example: * </p> * <pre> * <form action="http://myhost/myapp/test.do" method="post"> * <input type="submit" name="<b>myapp-submit</b>-button-add" value="Add button"/> * <input type="submit" name="<b>myapp-submit</b>-button-delete" value="Fancy Delete button"/> * </form> * </pre> * <p>The subclass of <nop>SelectAction class must implement * <code>getKeyMethodMap</code> method, which defines mapping from button names * to method handlers, like this:</p> * <pre> * protected Map getKeyMethodMap() { * Map map = new HashMap(); * map.put("myapp-submit-button-add", "add"); * map.put("myapp-submit-button-delete", "delete"); * return map; * } * </pre> * <p>The subclass also must implement the methods themselves. For example:</p> * <pre> * public ActionForward add(ActionMapping mapping, * ActionForm form, * HttpServletRequest request, * HttpServletResponse response) * throws IOException, ServletException { * // do add * return mapping.findForward("success"); * } * * public ActionForward delete(ActionMapping mapping, * ActionForm form, * HttpServletRequest request, * HttpServletResponse response) * throws IOException, ServletException { * // do delete * return mapping.findForward("success"); * }</pre> * <p> * <strong>Notes</strong> * <ul> * <li>Subclass should not redefine <code>execute</code> method. * <li>If duplicate values exist for the keys returned by * <code>getKeyMethodMap</code>, the first one will be returned. * If no corresponding key is found then an exception will be thrown. * <li>Cancel button must be handled by implementing standard * <code>cancelled</code> method. * <li>According to HTML specification, at most one submit element is sent * from browser to the server when form is submitted. If form is submitted * without explicitly clicking a button, the result depends on a browser. * Either no buttons are submitted, or the first button defined on the form * is submitted. You need to override <code>unspecified</code> method * to handle default submits. * </ul> * </p> * * @author Michael Jouravlev */ public abstract class SelectAction extends DispatchAction { /** * Request-key-to-method-name map */ protected Map keyMethodMap = null; /** * Builds a request param / method name map. Called only once for * each instance of this class. This is a helper method, which * should not normally be redefined by a subclass. */ synchronized protected void buildLookupMap() throws ServletException { // key/method map is not yet initialized if (this.keyMethodMap == null) { Map keyMethodMap = getKeyMethodMap(); if (keyMethodMap != null) { this.keyMethodMap = getKeyMethodMap(); } else { // key/method map is not defined in a subclass // // Uncomment this, if this action is included in // official Struts bundle; make sure that // LocationStrings.properties contains // dispatch.keyMethodMap.isnull key // String message = messages.getMessage( // "dispatch.keyMethodMap.isnull", this.clazz.getName()); // Delete this if action is included in Struts bundle String message = "Dispatch action " + this.clazz.getName() + " returned null key/method map from getKeyMethodMap method"; throw new ServletException(message); } } } /** * Returns the method name, given a prefix and a request object. * This is a helper method, which should not normally be redefined * by a subclass. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * @param parameter The <code>ActionMapping</code> parameter's name * Contains prefix of submit button names, or several prefixes * separated by comma or semicolon. * * @return The handler method name. */ protected String getMethodName(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, String parameter) throws Exception { // Find request parameter, starting with prefix. For example, // "myapp-submit-button-add" parameter fits "myapp-submit" prefix . String keyName = null; Enumeration reqEn = request.getParameterNames(); outmost: while(reqEn.hasMoreElements()) { String reqName = (String) reqEn.nextElement(); StringTokenizer params = new StringTokenizer(parameter, ",; "); while (params.hasMoreTokens()) { String buttonPrefix = params.nextToken(); if (reqName.startsWith(buttonPrefix)) { keyName = reqName; // If using image button, strip coordinates int imageButtonXPos = keyName.indexOf(".x"); if (imageButtonXPos > 0) { keyName = keyName.substring(0, imageButtonXPos); } else { int imageButtonYPos = keyName.indexOf(".y"); if (imageButtonYPos > 0) { keyName = keyName.substring(0, imageButtonYPos); } } // For image button there can be two or even three parameters: // MSIE: name.x=xcoord&name.y=ycoord // Firefox: name.x=xcoord&name.y=ycoord&name=value // // We will use only one parameter. Also notice, that MSIE // does not pass value of image button. This is another // good reason for using "name" attribute for dispatching. break outmost; } } } // If button is not be recognized, method will return null. // DispatchAction will call "unspecified" method. String methodName = null; // Button recognized if (keyName != null) { // Build param name to method map if it is not built yet buildLookupMap(); // Pull out a method name for request parameter Object mappedObj = keyMethodMap.get(keyName); if (mappedObj == null || !(mappedObj instanceof String)) { // Uncomment this, if this action is included in // official Struts bundle; make sure that // LocationStrings.properties contains // dispatch.keyMethodMap.notstring key // String message = messages.getMessage( // "dispatch.keyMethodMap.notstring", // mapping.getPath(), keyName); // Delete this if action is included in Struts bundle String message = "Dispatch action " + mapping.getPath() + " returned null or non-string method name" + " for request key " + keyName; throw new ServletException(message); } methodName = (String) mappedObj; return methodName; } return methodName; } /** * Method which is dispatched to when corresponding handler method * is not found for an activated submit button. Subclass should * override this method if it wish to provide default behavior different * than throwing a ServletException. */ protected ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String message = messages.getMessage( "dispatch.method", this.clazz.getName(), "unspecified"); log.error(message); throw new ServletException(message); } /** * Provides the mapping from the <code>name</code> attribute of * a submit button to method name. For example: * <br><pre> * protected Map getKeyMethodMap() { * Map map = new HashMap(); * map.put("myapp-submit-button-add", "add"); * map.put("myapp-submit-button-delete", "delete"); * return map; * }</pre> * This method is must be implemented in a subclass. * * @return Map, containing association between submit button name and * a handler method. Map keys must start from a prefix, * defined in <code>parameter</code> property of the action mapping. Map * values must contain names of handler methods. Each handler method must * have the same signature as <code>execute</code> method. */ protected abstract Map getKeyMethodMap(); } --- NEW FILE: package.html --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html> <head> <title>net.jspcontrols.dialogs.actions package</title> <!-- Copyright 2004-2005 Michael Jouravlev. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> </head> <body> Provides actions to support dialogs and wizards. <!-- Last updated: Tue, June 07 2005 --> </body> </html> |
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/collab In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/jspcontrols/collab Added Files: MasterPageAction.java MyForwardAction.java TabControlAction.java TabControlActionInput.java TabControlActionView.java Log Message: --- NEW FILE: MasterPageAction.java --- package net.jspcontrols.collab; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import javax.servlet.ServletContext; import java.util.Map; import java.util.HashMap; /** * */ public class MasterPageAction extends Action { static int[] monitor = new int[1]; public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { HttpSession session = httpServletRequest.getSession(); ServletContext srvCnt = session.getServletContext(); // TODO: Initialize from file, database or web.xml synchronized(monitor) { String[][] availableSections = (String[][]) srvCnt.getAttribute("availableSections"); // if (availableSections == null) { availableSections = new String[][] { {"mypages", "My Pages"}, {"projects", "Projects"}, {"news", "News"} }; srvCnt.setAttribute("availableSections", availableSections); session.setAttribute("section", availableSections[availableSections.length-1][0]); // } } return actionMapping.findForward("FORWARD"); } } --- NEW FILE: MyForwardAction.java --- package net.jspcontrols.collab; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * Created by IntelliJ IDEA. * User: mjouravlev * Date: Jul 7, 2005 * Time: 7:05:14 PM * To change this template use Options | File Templates. */ public class MyForwardAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { return mapping.findForward("FORWARD"); } } --- NEW FILE: TabControlAction.java --- package net.jspcontrols.collab; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * Created by IntelliJ IDEA. * User: Mikus * Date: Jul 8, 2005 * Time: 12:52:36 AM * To change this template use Options | File Templates. */ public class TabControlAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession session = request.getSession(); if (request.getParameter("section") != null) { String section = request.getParameter("section"); if (section == null) { // section = "news"; section = ""; } session.setAttribute("section", section); // Redirect to main page, append first sublevel ActionForward actionForward = mapping.findForward("MAINPAGE"); String actionPath = actionForward.getPath(); actionPath += "/" + section + "/dummy"; ActionForward actionRedirect = new ActionForward(actionForward.getName(), actionPath, true /* REDIRECT */ ); return actionRedirect; // Render phase: show all available tabs } else { return mapping.findForward("TABS"); } } } --- NEW FILE: TabControlActionInput.java --- package net.jspcontrols.collab; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.struts.action.Action; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** */ public class TabControlActionInput extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession session = request.getSession(); String section = request.getParameter("section"); if (section == null) { section = "HOME"; } session.setAttribute("SECTION", section); // Redirect to main page if ("mypages".equals(section)) return mapping.findForward("MAINPAGE_MYPAGES"); else if ("projects".equals(section)) return mapping.findForward("MAINPAGE_PROJECTS"); else /*if ("news".equals(section))*/ return mapping.findForward("MAINPAGE_NEWS"); // return mapping.findForward("MAINPAGE"); } } --- NEW FILE: TabControlActionView.java --- package net.jspcontrols.collab; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * */ public class TabControlActionView extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession session = request.getSession(); String section = (String) session.getAttribute("SECTION"); if (section == null) { section = "HOME"; session.setAttribute("SECTION", section); } // Render tabs according to current section return mapping.findForward("TABS"); } } |
From: <jm...@us...> - 2005-07-11 07:02:11
|
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/wizard/intf/doc-files In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8662/doc-files Log Message: Directory /cvsroot/struts/dialogs/src/net/jspcontrols/wizard/intf/doc-files added to the repository |
From: <jm...@us...> - 2005-07-11 07:01:55
|
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/wizard/impl/doc-files In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8530/doc-files Log Message: Directory /cvsroot/struts/dialogs/src/net/jspcontrols/wizard/impl/doc-files added to the repository |
From: <jm...@us...> - 2005-07-11 07:01:46
|
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/wizard/intf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8414/intf Log Message: Directory /cvsroot/struts/dialogs/src/net/jspcontrols/wizard/intf added to the repository |