Author: Alex.Kolonitsky
Date: 2009-11-01 11:51:11 -0500 (Sun, 01 Nov 2009)
New Revision: 15798
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/Messages.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/application/ViewHandlerWrapper.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/application/package-info.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/cache/Cache.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/cache/CacheFactory.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/cache/package-info.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxChildrenEncoder.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxClientBehavior.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxContainer.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxContainerBase.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxDataEncoder.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxOutput.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxSupport.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/IterationStateHolder.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/JavaScriptParameter.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/package-info.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/context/AjaxContext.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/context/ViewIdHolder.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/context/package-info.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxActionEvent.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxEvent.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxListener.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxRenderEvent.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxRenderListener.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxSource.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/event/PushEventListener.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/event/package-info.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/AjaxSubmitFunction.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSBind.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSEncoder.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSFunction.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSFunctionDefinition.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSLiteral.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSObject.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSReference.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/PropertyUtils.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/ResponseWriterWrapper.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/ScriptString.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/ScriptStringBase.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/StringBuilderWriter.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/package-info.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/DataComponentState.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/DataVisitResult.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/DataVisitor.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/ExtendedDataModel.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/KeepAlive.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/Range.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/RepeatState.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/SequenceDataModel.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/SequenceRange.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/SerializableDataModel.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/package-info.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/package-info.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/AjaxRenderer.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/package-info.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/InternetResource.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/ResourceComponent.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/ResourceComponent2.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/ResourceContext.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/ResourceNotFoundException.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/ResourceRenderer.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/package-info.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/util/package-info.java
root/framework/trunk/api/src/main/java/org/richfaces/component/TemplateComponent.java
root/framework/trunk/api/src/main/java/org/richfaces/component/package-info.java
root/framework/trunk/api/src/main/java/org/richfaces/event/package-info.java
root/framework/trunk/api/src/main/java/org/richfaces/log/RichfacesLogger.java
root/framework/trunk/api/src/main/java/org/richfaces/model/UploadItem.java
root/framework/trunk/api/src/main/java/org/richfaces/resource/VersionedResource.java
root/framework/trunk/api/src/main/java/org/richfaces/skin/Skin.java
root/framework/trunk/api/src/main/java/org/richfaces/skin/SkinConfiguration.java
root/framework/trunk/api/src/main/java/org/richfaces/skin/SkinFactory.java
root/framework/trunk/api/src/main/java/org/richfaces/skin/SkinNotFoundException.java
root/framework/trunk/api/src/main/java/org/richfaces/skin/Theme.java
root/framework/trunk/api/src/main/java/org/richfaces/skin/ThemeNotFoundException.java
root/framework/trunk/api/src/main/java/org/richfaces/skin/package-info.java
root/framework/trunk/api/src/test/java/org/ajax4jsf/javascript/ResponseWriterWrapperTest.java
root/framework/trunk/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java
root/framework/trunk/api/src/test/java/org/ajax4jsf/javascript/StringBuilderWriterTest.java
Log:
Code style policy
https://jira.jboss.org/jira/browse/RFPL-195
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/Messages.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/Messages.java 2009-11-01 16:34:11
UTC (rev 15797)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/Messages.java 2009-11-01 16:51:11
UTC (rev 15798)
@@ -19,9 +19,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf;
import java.text.MessageFormat;
+
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
@@ -30,345 +33,356 @@
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-public class Messages {
- /**
- * @author asmirnov
- *
- */
- public static final class EmptyResourceBundle extends ResourceBundle {
+public final class Messages {
+ public static final String ACESSING_SKIN_PROPERTY_AS_ARRAY_ERROR =
"ACESSING_SKIN_PROPERTY_AS_ARRAY_ERROR";
+ public static final String ACESSING_SKIN_PROPERTY_ERROR =
"ACESSING_SKIN_PROPERTY_ERROR";
+ public static final String ADD_AJAX_AREA = "ADD_AJAX_AREA";
+ public static final String ADD_AJAX_AREAS = "ADD_AJAX_AREAS";
+ public static final String AJAX_RESPONSE_NOT_RENDERED_INFO =
"AJAX_RESPONSE_NOT_RENDERED_INFO";
+ public static final String AJAX_STATUS_COMPONENT_NOT_FOWND_WARNING =
"AJAX_STATUS_COMPONENT_NOT_FOWND_WARNING";
+ public static final String AJAX_SUPPORT_REQUEST_PARAMETER_INFO =
"AJAX_SUPPORT_REQUEST_PARAMETER_INFO";
+ public static final String AJAX_VIEW_EXPIRED = "AJAX_VIEW_EXPIRED";
+ public static final String ALTERNATE_HANDLER_CONSTRUCTOR_WARNING =
"ALTERNATE_HANDLER_CONSTRUCTOR_WARNING";
+ public static final String APPENDING_AJAX_REGION_TO_NON_AJAX_CONTAINER_WARNING =
+ "APPENDING_AJAX_REGION_TO_NON_AJAX_CONTAINER_WARNING";
+ public static final String ARGUMENT_IS_NOT_AJAX_REGION_ERROR =
"ARGUMENT_IS_NOT_AJAX_REGION_ERROR";
+ public static final String BREAKPOINTS_UNSUPPORTED_ERROR =
"BREAKPOINTS_UNSUPPORTED_ERROR";
+ public static final String BREAKPOINTS_UNSUPPORTED_ERROR_2 =
"BREAKPOINTS_UNSUPPORTED_ERROR_2";
+ public static final String BREAKPOINTS_UNSUPPORTED_ERROR_3 =
"BREAKPOINTS_UNSUPPORTED_ERROR_3";
+ public static final String BREAKPOINTS_UNSUPPORTED_INSIDE_ATTRIBUTE_ERROR =
+ "BREAKPOINTS_UNSUPPORTED_INSIDE_ATTRIBUTE_ERROR";
+ public static final String BREAKPOINT_NOT_REGISTERED_ERROR =
"BREAKPOINT_NOT_REGISTERED_ERROR";
+ public static final String BUFFER_TYPE_ERROR = "BUFFER_TYPE_ERROR";
+ public static final String BUILD_ONCLICK_INFO = "BUILD_ONCLICK_INFO";
+ public static final String BUILD_RESOURCE_INFO = "BUILD_RESOURCE_INFO";
+ public static final String BUILD_RESOURCE_URI_INFO =
"BUILD_RESOURCE_URI_INFO";
+ public static final String BUNDLE_MAP_NO_PUT_VALUE =
"BUNDLE_MAP_NO_PUT_VALUE";
+ public static final String BUNDLE_MAP_NO_REMOVE_VALUE =
"BUNDLE_MAP_NO_REMOVE_VALUE";
+ private static final String BUNDLE_NAME = "org.ajax4jsf.messages";
+ public static final String CALCULATE_COMPONENT_ID_INFO =
"CALCULATE_COMPONENT_ID_INFO";
+ public static final String CALLED_SET_PARENT = "CALLED_SET_PARENT";
+ public static final String CANNOT_WRITE_RASTERS = "CANNOT_WRITE_RASTERS";
+ public static final String CHILDREN_ENCODING_COMPONENT_INFO =
"CHILDREN_ENCODING_COMPONENT_INFO";
+ public static final String CHILD_NOT_ALLOWED_ERROR =
"CHILD_NOT_ALLOWED_ERROR";
+ public static final String COMMAND_LINK_NOT_IN_FORM_WARNING =
"COMMAND_LINK_NOT_IN_FORM_WARNING";
+ public static final String COMMAND_LINK_SUBMIT_INFO =
"COMMAND_LINK_SUBMIT_INFO";
+ public static final String COMMENT_SAX_EXCEPTION =
"COMMENT_SAX_EXCEPTION";
+ public static final String COMPONENT_CLASS_ERROR =
"COMPONENT_CLASS_ERROR";
+ public static final String COMPONENT_CONVERSION_ERROR =
"COMPONENT_CONVERSION_ERROR";
+ public static final String COMPONENT_NOT_FOUND = "COMPONENT_NOT_FOUND";
+ public static final String COMPONENT_NULL_ERROR = "COMPONENT_NULL_ERROR";
+ public static final String COMPONENT_NULL_ERROR_2 =
"COMPONENT_NULL_ERROR_2";
+ public static final String COMPONENT_TREE_NOT_CREATED =
"COMPONENT_TREE_NOT_CREATED";
+ public static final String CONFIG_INITIALIZATION_ERROR =
"CONFIG_INITIALIZATION_ERROR";
+ public static final String CONFIG_INITIALIZATION_ERROR_2 =
"CONFIG_INITIALIZATION_ERROR_2";
+ public static final String CONTENT_NOT_FOUND_ERROR =
"CONTENT_NOT_FOUND_ERROR";
+ public static final String CONTENT_TYPE_ENCODING =
"CONTENT_TYPE_ENCODING";
+ public static final String CONTENT_TYPE_NO_ENCODING =
"CONTENT_TYPE_NO_ENCODING";
+ public static final String CONTEXT_NULL_ERROR = "CONTEXT_NULL_ERROR";
+ public static final String CONVERTING_NON_VALUE_HOLDER_COMPONENT_ERROR =
+ "CONVERTING_NON_VALUE_HOLDER_COMPONENT_ERROR";
+ public static final String COULD_NOT_LOAD_RESOURCE_BUNDLE =
"COULD_NOT_LOAD_RESOURCE_BUNDLE";
+ public static final String CREATE_AJAX_AREAS_SET_TO_RENDER =
"CREATE_AJAX_AREAS_SET_TO_RENDER";
+ public static final String CREATE_ALTERNATE_HANDLER =
"CREATE_ALTERNATE_HANDLER";
+ public static final String CREATE_JAVASCRIPT_EVENT =
"CREATE_JAVASCRIPT_EVENT";
+ public static final String CREATE_JTIDY_INFO = "CREATE_JTIDY_INFO";
+ public static final String CREATE_SKIN_INFO = "CREATE_SKIN_INFO";
+ public static final String CREATE_STREAM_INFO = "CREATE_STREAM_INFO";
+ public static final String CREATE_WRITER_INFO = "CREATE_WRITER_INFO";
+ public static final String CREATING_IMAGE_GENERATOR_ERROR =
"CREATING_IMAGE_GENERATOR_ERROR";
+ public static final String CREATING_SKIN_FACTORY_ERROR =
"CREATING_SKIN_FACTORY_ERROR";
+ public static final String DATASCROLLER_PAGES_DIFFERENT =
"DATASCROLLER_PAGES_DIFFERENT";
+ public static final String DATASCROLLER_PAGE_MISSING =
"DATASCROLLER_PAGE_MISSING";
+ public static final String DATA_CLASS_NOT_FOUND_ERROR =
"DATA_CLASS_NOT_FOUND_ERROR";
+ public static final String DECODE_AJAX_REQUEST_STATUS_INFO =
"DECODE_AJAX_REQUEST_STATUS_INFO";
+ public static final String DECODE_COLOR_PARAMETER_ERROR =
"DECODE_COLOR_PARAMETER_ERROR";
+ public static final String DECODE_PARAMETER_ERROR =
"DECODE_PARAMETER_ERROR";
+ public static final String DEFAULT_PROPERTIES_NOT_FOUND_ERROR =
"DEFAULT_PROPERTIES_NOT_FOUND_ERROR";
+ public static final String DEFAULT_RENDER_KIT_INFO =
"DEFAULT_RENDER_KIT_INFO";
+ public static final String DELEGATE_AJAX_PROCESSING_INFO =
"DELEGATE_AJAX_PROCESSING_INFO";
+ public static final String DESERIALIZE_DATA_INPUT_ERROR =
"DESERIALIZE_DATA_INPUT_ERROR";
+ public static final String DETECTING_ENCODING_DISABLED_ERROR =
"DETECTING_ENCODING_DISABLED_ERROR";
+ public static final String DETECT_NEW_COMPONENT = "DETECT_NEW_COMPONENT";
+ public static final String DOM_METHOD_NOT_SUPPORTED =
"DOM_METHOD_NOT_SUPPORTED";
+ public static final String ENCODE_BEGIN_HTML_INFO =
"ENCODE_BEGIN_HTML_INFO";
+ public static final String ENCODE_CHILD_AJAX_INFO =
"ENCODE_CHILD_AJAX_INFO";
+ public static final String ENCODE_COMPILED_TEMPLATE_INFO =
"ENCODE_COMPILED_TEMPLATE_INFO";
+ public static final String ENCODE_COMPILED_TEMPLATE_INFO2 =
"ENCODE_COMPILED_TEMPLATE_INFO2";
+ public static final String ENCODE_END_HTML_INFO = "ENCODE_END_HTML_INFO";
+ public static final String ENCODE_HTML_INFO = "ENCODE_HTML_INFO";
+ public static final String ENCODE_HTML_INFO_2 = "ENCODE_HTML_INFO_2";
+ public static final String ENCODING_TEMPLATE_TERMINATED_INFO =
"ENCODING_TEMPLATE_TERMINATED_INFO";
+ public static final String END_DOCUMENT_SAX_EXCEPTION =
"END_DOCUMENT_SAX_EXCEPTION";
+ public static final String END_ELEMENT_SAX_EXCEPTION =
"END_ELEMENT_SAX_EXCEPTION";
+ public static final String ENTER_BEFORE_RENDER_VIEW_PHASE =
"ENTER_BEFORE_RENDER_VIEW_PHASE";
+ public static final String ERROR_ON_PAGE = "ERROR_ON_PAGE";
+ public static final String EVENT_IS_READ_ONLY = "EVENT_IS_READ_ONLY";
+ public static final String EVENT_MUST_BE_LITERAL =
"EVENT_MUST_BE_LITERAL";
+ public static final String FACES_CONTEXT_HAS_NOT_EXTERNAL =
"FACES_CONTEXT_HAS_NOT_EXTERNAL";
+ public static final String FACES_CONTEXT_HAS_NOT_RESPONSE =
"FACES_CONTEXT_HAS_NOT_RESPONSE";
+ public static final String FACES_CONTEXT_NOT_CREATED =
"FACES_CONTEXT_NOT_CREATED";
+ public static final String FACET_TAG_MANY_CHILDREN_ERROR =
"FACET_TAG_MANY_CHILDREN_ERROR";
+ public static final String FIELD_READING_ERROR = "FIELD_READING_ERROR";
+ public static final String FILTER_NOT_CONFIGURED_ERROR =
"FILTER_NOT_CONFIGURED_ERROR";
+ public static final String FILTER_NOT_FOUND_ERROR =
"FILTER_NOT_FOUND_ERROR";
+ public static final String FILTER_NO_XML_CHAIN = "FILTER_NO_XML_CHAIN";
+ public static final String FILTER_NO_XML_CHAIN_2 =
"FILTER_NO_XML_CHAIN_2";
+ public static final String FILTER_START_INFO = "FILTER_START_INFO";
+ public static final String FILTER_STOP_INFO = "FILTER_STOP_INFO";
+ public static final String FILTER_XML_OUTPUT = "FILTER_XML_OUTPUT";
+ public static final String FINISH_COMPILE_TEMPLATE_INFO =
"FINISH_COMPILE_TEMPLATE_INFO";
+ public static final String FINISH_ENCODING_COMPONENT_INFO =
"FINISH_ENCODING_COMPONENT_INFO";
+ public static final String FLUSH_BUFFERED_STREAM_ERROR =
"FLUSH_BUFFERED_STREAM_ERROR";
+ public static final String FOR_TARGETS_NO_AJAX_CONTAINER =
"FOR_TARGETS_NO_AJAX_CONTAINER";
+ public static final String GET_CONTENT_FROM_CACHE_INFO =
"GET_CONTENT_FROM_CACHE_INFO";
+ public static final String GET_DEFAULT_RENDER_KIT_ERROR =
"GET_DEFAULT_RENDER_KIT_ERROR";
+ public static final String GET_RESOURCE_AS_STREAM_ERROR =
"GET_RESOURCE_AS_STREAM_ERROR";
+ public static final String GRABBER_ERROR = "GRABBER_ERROR";
+ public static final String ILLEGAL_METHOD_STATE = "ILLEGAL_METHOD_STATE";
+ public static final String IMAGE_ERROR = "IMAGE_ERROR";
+ public static final String IMAGE_GENERATOR_CLASS_NOT_FOUND =
"IMAGE_GENERATOR_CLASS_NOT_FOUND";
+ public static final String IMAGE_NOT_BUFFERED_ERROR =
"IMAGE_NOT_BUFFERED_ERROR";
+ public static final String INSTANTIATE_CLASS_ERROR =
"INSTANTIATE_CLASS_ERROR";
+ public static final String INSTANTIATE_LISTENER_ERROR =
"INSTANTIATE_LISTENER_ERROR";
+ public static final String INSTANTIATE_RESOURCE_ERROR =
"INSTANTIATE_RESOURCE_ERROR";
+ public static final String INVALID_ACTION_LISTENER =
"INVALID_ACTION_LISTENER";
+ public static final String INVALID_ATTRIBUTE_VALUE =
"INVALID_ATTRIBUTE_VALUE";
+ public static final String INVALID_COMMENT_INDEX =
"INVALID_COMMENT_INDEX";
+ public static final String INVALID_EXPRESSION = "INVALID_EXPRESSION";
+ public static final String INVALID_RADIUS = "INVALID_RADIUS";
+ public static final String INVALID_VALIDATION_EXPRESSION =
"INVALID_VALIDATION_EXPRESSION";
+ public static final String INVALID_VALUE = "INVALID_VALUE";
+ public static final String INVALID_VALUE_CHANGE_LISTENER =
"INVALID_VALUE_CHANGE_LISTENER";
+ public static final String INVOKE_AJAX_REGION_LISTENER =
"INVOKE_AJAX_REGION_LISTENER";
+ public static final String INVOKE_RENDERER_METHOD_ERROR =
"INVOKE_RENDERER_METHOD_ERROR";
+ public static final String JTIDY_PARSING_ERROR = "JTIDY_PARSING_ERROR";
+ public static final String LIFECYCLE_ERROR = "LIFECYCLE_ERROR";
+ public static final String LIFECYCLE_ERROR_AT_PHASE =
"LIFECYCLE_ERROR_AT_PHASE";
+ public static final String LOADING_IMAGE_ERROR = "LOADING_IMAGE_ERROR";
+ public static final String MARK_AS_RENDERED_INFO =
"MARK_AS_RENDERED_INFO";
+ public static final String MESSAGE_PARSING_INFO = "MESSAGE_PARSING_INFO";
+ public static final String METHOD_CALL_ERROR_1 = "METHOD_CALL_ERROR_1";
+ public static final String METHOD_CALL_ERROR_1A = "METHOD_CALL_ERROR_1a";
+ public static final String METHOD_CALL_ERROR_2 = "METHOD_CALL_ERROR_2";
+ public static final String METHOD_CALL_ERROR_2A = "METHOD_CALL_ERROR_2a";
+ public static final String METHOD_CALL_ERROR_2B = "METHOD_CALL_ERROR_2b";
+ public static final String METHOD_CALL_ERROR_3 = "METHOD_CALL_ERROR_3";
+ public static final String METHOD_CALL_ERROR_3A = "METHOD_CALL_ERROR_3a";
+ public static final String METHOD_CALL_ERROR_4 = "METHOD_CALL_ERROR_4";
+ public static final String METHOD_CALL_ERROR_4A = "METHOD_CALL_ERROR_4a";
+ public static final String METHOD_CALL_ERROR_4B = "METHOD_CALL_ERROR_4b";
+ public static final String METHOD_CALL_ERROR_5 = "METHOD_CALL_ERROR_5";
+ public static final String METHOD_CALL_ERROR_5A = "METHOD_CALL_ERROR_5a";
+ public static final String METHOD_CALL_ERROR_6 = "METHOD_CALL_ERROR_6";
+ public static final String METHOD_CALL_ERROR_6A = "METHOD_CALL_ERROR_6a";
+ public static final String METHOD_CALL_ERROR_6B = "METHOD_CALL_ERROR_6b";
+ public static final String METHOD_NOT_IMPLEMENTED =
"METHOD_NOT_IMPLEMENTED";
+ public static final String METHOD_NOT_SUPPORTED = "METHOD_NOT_SUPPORTED";
+ public static final String MUST_BE_EXPRESSION_ERROR =
"MUST_BE_EXPRESSION_ERROR";
+ public static final String MUST_BE_LITERAL_ERROR =
"MUST_BE_LITERAL_ERROR";
+ public static final String NAMED_ITEM_NOT_FOUND_ERROR =
"NAMED_ITEM_NOT_FOUND_ERROR";
+ public static final String NAMESPACE_NOT_RECOGNIZED_ERROR =
"NAMESPACE_NOT_RECOGNIZED_ERROR";
+ public static final String NAME_MUST_BE_LITERAL = "NAME_MUST_BE_LITERAL";
+ public static final String NOT_AJAX_CONTAINER_ERROR =
"NOT_AJAX_CONTAINER_ERROR";
+ public static final String NOT_DATA_OUTPUT_ERROR =
"NOT_DATA_OUTPUT_ERROR";
+ public static final String NOT_INDEXED_IMAGE_ERROR =
"NOT_INDEXED_IMAGE_ERROR";
+ public static final String NOT_INSTANCE_OF_ERROR =
"NOT_INSTANCE_OF_ERROR";
+ public static final String NOT_PARENT_AJAX_COMPONENT_ERROR =
"NOT_PARENT_AJAX_COMPONENT_ERROR";
+ public static final String NOT_PARENT_AJAX_CONTAINER_ERROR =
"NOT_PARENT_AJAX_CONTAINER_ERROR";
+ public static final String NO_ACTION_SOURCE2_ERROR =
"NO_ACTION_SOURCE2_ERROR";
+ public static final String NO_ACTION_SOURCE_ERROR =
"NO_ACTION_SOURCE_ERROR";
+ public static final String NO_BYTE_ARRAY_ERROR = "NO_BYTE_ARRAY_ERROR";
+ public static final String NO_CHILD_ALLOWED = "NO_CHILD_ALLOWED";
+ public static final String NO_CONVERTER_FOUND_ERROR =
"NO_CONVERTER_FOUND_ERROR";
+ public static final String NO_CONVERTER_REGISTERED =
"NO_CONVERTER_REGISTERED";
+ public static final String NO_DATA_ADAPTOR = "NO_DATA_ADAPTOR";
+ public static final String NO_EDITABLE_VALUE_HOLDER_ERROR =
"NO_EDITABLE_VALUE_HOLDER_ERROR";
+ public static final String NO_FACET_NAME_ATTRIBUTE =
"NO_FACET_NAME_ATTRIBUTE";
+ public static final String NO_INPUT_STREAM_ERROR =
"NO_INPUT_STREAM_ERROR";
+ public static final String NO_NAME_ATTRIBUTE_ERROR =
"NO_NAME_ATTRIBUTE_ERROR";
+ public static final String NO_PREFIX_OR_SUFFIX_IN_FILTER_MAPPING_ERROR =
+ "NO_PREFIX_OR_SUFFIX_IN_FILTER_MAPPING_ERROR";
+ public static final String NO_RESOURCE_EXISTS_ERROR =
"NO_RESOURCE_EXISTS_ERROR";
+ public static final String NO_RESOURCE_REGISTERED_ERROR =
"NO_RESOURCE_REGISTERED_ERROR";
+ public static final String NO_RESOURCE_REGISTERED_ERROR_2 =
"NO_RESOURCE_REGISTERED_ERROR_2";
+ public static final String NO_STREAM_POSSIBLE_ERROR =
"NO_STREAM_POSSIBLE_ERROR";
+ public static final String NO_UI_COMPONENT_TAG_ANCESTOR_ERROR =
"NO_UI_COMPONENT_TAG_ANCESTOR_ERROR";
+ public static final String NO_VALUE_HOLDER_ERROR =
"NO_VALUE_HOLDER_ERROR";
+ public static final String NO_VALUE_REFERENCE_ERROR =
"NO_VALUE_REFERENCE_ERROR";
+ public static final String NO_VALUE_REFERENCE_ERROR_2 =
"NO_VALUE_REFERENCE_ERROR_2";
+ public static final String NO_WRITER_CALLED_INFO =
"NO_WRITER_CALLED_INFO";
+ public static final String NO_WRITER_POSSIBLE_ERROR =
"NO_WRITER_POSSIBLE_ERROR";
+ public static final String NULL_ATTRIBUTE_ERROR = "NULL_ATTRIBUTE_ERROR";
+ public static final String NULL_COLOR_PARAMETER_ERROR =
"NULL_COLOR_PARAMETER_ERROR";
+ public static final String NULL_COLOR_PARAMETER_ERROR_2 =
"NULL_COLOR_PARAMETER_ERROR_2";
+ public static final String NULL_EVENT_SUBMITTED_ERROR =
"NULL_EVENT_SUBMITTED_ERROR";
+ public static final String NULL_FILTER_NAME_WARNING =
"NULL_FILTER_NAME_WARNING";
+ public static final String NULL_OUTPUT_ERROR = "NULL_OUTPUT_ERROR";
+ public static final String NULL_SKIN_NAME_ERROR = "NULL_SKIN_NAME_ERROR";
+ public static final String NULL_TYPE_ATTRIBUTE_ERROR =
"NULL_TYPE_ATTRIBUTE_ERROR";
+ public static final String OBTAIN_RESPONSE_SET_HEADER_ERROR =
"OBTAIN_RESPONSE_SET_HEADER_ERROR";
+ public static final String OPEN_CLOSE_TAGS_DO_NOT_MATCH_ERROR =
"OPEN_CLOSE_TAGS_DO_NOT_MATCH_ERROR";
+ public static final String PARSER_NOT_INSTANTIATED_ERROR =
"PARSER_NOT_INSTANTIATED_ERROR";
+ public static final String PARSE_XML_DOCUMENT_INFO =
"PARSE_XML_DOCUMENT_INFO";
+ public static final String PARSING_IF_MODIFIED_SINCE_WARNING =
"PARSING_IF_MODIFIED_SINCE_WARNING";
+ public static final String PARSING_TEMPLATE_ERROR =
"PARSING_TEMPLATE_ERROR";
+ public static final String PARSING_TEMPLATE_ERROR_2 =
"PARSING_TEMPLATE_ERROR_2";
+ public static final String PARSING_TEMPLATE_ERROR_2A =
"PARSING_TEMPLATE_ERROR_2a";
+ public static final String PARSING_TEMPLATE_ERROR_A =
"PARSING_TEMPLATE_ERROR_a";
+ public static final String PARSING_TIME_INFO = "PARSING_TIME_INFO";
+ public static final String PARSING_WEB_XML_IO_ERROR =
"PARSING_WEB_XML_IO_ERROR";
+ public static final String PARSING_WEB_XML_SAX_ERROR =
"PARSING_WEB_XML_SAX_ERROR";
+ public static final String PROCESS_AJAX_EVENTS_INFO =
"PROCESS_AJAX_EVENTS_INFO";
+ public static final String QUERY_STRING_BUILDING_ERROR =
"QUERY_STRING_BUILDING_ERROR";
+ public static final String READING_PROPERTIES_ERROR =
"READING_PROPERTIES_ERROR";
+ public static final String READING_TIDY_PROPERTIES_ERROR =
"READING_TIDY_PROPERTIES_ERROR";
+ public static final String READ_ONLY_NODE_ERROR = "READ_ONLY_NODE_ERROR";
+ public static final String RENDERER_METHOD_NOT_SET_ERROR =
"RENDERER_METHOD_NOT_SET_ERROR";
+ public static final String RENDERING_AJAX_REGION_ERROR =
"RENDERING_AJAX_REGION_ERROR";
+ public static final String RENDER_AJAX_AREA_INFO =
"RENDER_AJAX_AREA_INFO";
+ public static final String RENDER_AJAX_REQUEST = "RENDER_AJAX_REQUEST";
+ public static final String RENDER_CHILDREN_AJAX_INFO =
"RENDER_CHILDREN_AJAX_INFO";
+ public static final String RENDER_CHILDREN_NON_AJAX_INFO =
"RENDER_CHILDREN_NON_AJAX_INFO";
+ public static final String REQUEST_CHAMELEON_RENDER_KIT_INFO =
"REQUEST_CHAMELEON_RENDER_KIT_INFO";
+ public static final String REQUEST_PARAMETERS_MAP =
"REQUEST_PARAMETERS_MAP";
+ public static final String RESTORE_AJAX_COMPONENT_STATE =
"RESTORE_AJAX_COMPONENT_STATE";
+ public static final String RESTORE_DATA_FROM_RESOURCE_URI_INFO =
"RESTORE_DATA_FROM_RESOURCE_URI_INFO";
+ public static final String SAVE_AJAX_COMPONENT_STATE =
"SAVE_AJAX_COMPONENT_STATE";
+ public static final String SEND_CONTENT_INFO = "SEND_CONTENT_INFO";
+ public static final String SEND_EVENT_TO_AJAX_LISTENER =
"SEND_EVENT_TO_AJAX_LISTENER";
+ public static final String SEND_IMAGE_ERROR = "SEND_IMAGE_ERROR";
+ public static final String SEND_IMAGE_ERROR_2 = "SEND_IMAGE_ERROR_2";
+ public static final String SEND_RESOURCE_ERROR = "SEND_RESOURCE_ERROR";
+ public static final String SEND_RESOURCE_ERROR_2 =
"SEND_RESOURCE_ERROR_2";
+ public static final String SET_AJAX_LISTENER = "SET_AJAX_LISTENER";
+ public static final String SET_AJAX_REQUEST = "SET_AJAX_REQUEST";
+ public static final String SET_MYFACES_SEQUENCE_INFO =
"SET_MYFACES_SEQUENCE_INFO";
+ public static final String SET_RENDER_KIT_ID_INFO =
"SET_RENDER_KIT_ID_INFO";
+ public static final String SET_RESPONSE_HEADERS_INFO =
"SET_RESPONSE_HEADERS_INFO";
+ public static final String SET_SKIN_FACTORY_INFO =
"SET_SKIN_FACTORY_INFO";
+ public static final String SET_VALUE_BINDING_FOR_EVENT =
"SET_VALUE_BINDING_FOR_EVENT";
+ public static final String SKIN_CYCLIC_REFERENCE =
"SKIN_CYCLIC_REFERENCE";
+ public static final String SKIN_ILLEGAL_REFERENCE =
"SKIN_ILLEGAL_REFERENCE";
+ public static final String SKIN_NOT_FOUND_ERROR = "SKIN_NOT_FOUND_ERROR";
+ public static final String SKIN_PROPERTIES_IO_ERROR =
"SKIN_PROPERTIES_IO_ERROR";
+ public static final String SKIN_PROPERTIES_READ_ONLY_ERROR =
"SKIN_PROPERTIES_READ_ONLY_ERROR";
+ public static final String SKIP_ENCODE_BEGIN_HTML_INFO =
"SKIP_ENCODE_BEGIN_HTML_INFO";
+ public static final String SKIP_ENCODE_BEGIN_HTML_INFO_2 =
"SKIP_ENCODE_BEGIN_HTML_INFO_2";
+ public static final String SKIP_ENCODE_END_HTML_INFO =
"SKIP_ENCODE_END_HTML_INFO";
+ public static final String SKIP_ENCODE_END_HTML_INFO_2 =
"SKIP_ENCODE_END_HTML_INFO_2";
+ public static final String SKIP_ENCODING_HTML_INFO =
"SKIP_ENCODING_HTML_INFO";
+ public static final String START_COMPILE_TEMPLATE_INFO =
"START_COMPILE_TEMPLATE_INFO";
+ public static final String START_DECODING_COMPONENT_INFO =
"START_DECODING_COMPONENT_INFO";
+ public static final String START_DOCUMENT_SAX_EXCEPTION =
"START_DOCUMENT_SAX_EXCEPTION";
+ public static final String START_ELEMENT_SAX_EXCEPTION =
"START_ELEMENT_SAX_EXCEPTION";
+ public static final String START_ENCODING_COMPONENT_INFO =
"START_ENCODING_COMPONENT_INFO";
+ public static final String STATIC_RESOURCE_NOT_FOUND_ERROR =
"STATIC_RESOURCE_NOT_FOUND_ERROR";
+ public static final String STREAM_CORRUPTED_ERROR =
"STREAM_CORRUPTED_ERROR";
+ public static final String STRING_CONVERSION_ERROR =
"STRING_CONVERSION_ERROR";
+ public static final String STYLE_ATTRIBUTE_ERROR =
"STYLE_ATTRIBUTE_ERROR";
+ public static final String SUBMITTED_AJAX_REQUEST =
"SUBMITTED_AJAX_REQUEST";
+ public static final String TEMPLATE_IO_ERROR = "TEMPLATE_IO_ERROR";
+ public static final String TEMPLATE_IO_ERROR_A = "TEMPLATE_IO_ERROR_a";
+ public static final String TEMPLATE_NOT_COMPILED_ERROR =
"TEMPLATE_NOT_COMPILED_ERROR";
+ public static final String TEXT_SAX_EXCEPTION = "TEXT_SAX_EXCEPTION";
+ public static final String THEME_NOT_FOUND_ERROR =
"THEME_NOT_FOUND_ERROR";
+ public static final String TOOMANY_COLORS_ERROR = "TOOMANY_COLORS_ERROR";
+ public static final String UNNAMED_PARAMETER_ERROR =
"UNNAMED_PARAMETER_ERROR";
+ public static final String UNSUPPORTED_ENCODING_ERROR =
"UNSUPPORTED_ENCODING_ERROR";
+ public static final String UNSUPPORTED_ENCODING_WARNING =
"UNSUPPORTED_ENCODING_WARNING";
+ public static final String UNSUPPORTED_ENCODING_WARNING_2 =
"UNSUPPORTED_ENCODING_WARNING_2";
+ public static final String UNSUPPORTED_INPUT_SOURCE_ERROR =
"UNSUPPORTED_INPUT_SOURCE_ERROR";
+ public static final String UTF_CONVERSION_ERROR = "UTF_CONVERSION_ERROR";
+ public static final String VALUE_BINDING_TYPE_ERROR =
"VALUE_BINDING_TYPE_ERROR";
+ public static final String VARIABLE_SUBSTITUTION_ERROR =
"VARIABLE_SUBSTITUTION_ERROR";
+ public static final String VARIABLE_SUBSTITUTION_WARNING =
"VARIABLE_SUBSTITUTION_WARNING";
+ public static final String VAR_MUST_BE_LITERAL = "VAR_MUST_BE_LITERAL";
+ public static final String VIEW_HANDLER_INSTANTIATION_ERROR =
"VIEW_HANDLER_INSTANTIATION_ERROR";
+ public static final String WRAPPED_RULES_NULL_ERROR =
"WRAPPED_RULES_NULL_ERROR";
+ private static Map<ClassLoader, ResourceBundle> bundles = new
HashMap<ClassLoader, ResourceBundle>();
- /* (non-Javadoc)
- * @see java.util.ResourceBundle#getKeys()
- */
- @Override
- public Enumeration<String> getKeys() {
- return Collections.enumeration(Collections.<String>emptyList());
- }
+ private Messages() {}
- /* (non-Javadoc)
- * @see java.util.ResourceBundle#handleGetObject(java.lang.String)
- */
- @Override
- protected Object handleGetObject(String key) {
- return null;
- }
+ private static synchronized ResourceBundle getBundle() {
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ ResourceBundle bundle = bundles.get(contextClassLoader);
- }
+ if (bundle == null) {
+ try {
+ bundle = ResourceBundle.getBundle(BUNDLE_NAME, Locale.getDefault(),
contextClassLoader);
+ } catch (MissingResourceException e) {
+ try {
+ bundle = ResourceBundle.getBundle(BUNDLE_NAME, Locale.getDefault(),
+ Messages.class.getClassLoader());
+ } catch (MissingResourceException e2) {
+ bundle = new EmptyResourceBundle();
+ }
+ }
- private static final String BUNDLE_NAME = "org.ajax4jsf.messages";
-
- private static Map<ClassLoader, ResourceBundle> bundles = new
HashMap<ClassLoader, ResourceBundle>();
-
- private static synchronized ResourceBundle getBundle() {
- ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
- ResourceBundle bundle = (ResourceBundle) bundles.get(contextClassLoader);
- if (bundle == null) {
- try {
- bundle = ResourceBundle.getBundle(BUNDLE_NAME, Locale
- .getDefault(), contextClassLoader);
+ bundles.put(contextClassLoader, bundle);
+ }
- } catch (MissingResourceException e) {
- try {
- bundle = ResourceBundle.getBundle(BUNDLE_NAME, Locale
- .getDefault(), Messages.class.getClassLoader());
+ return bundle;
+ }
- } catch (MissingResourceException e2) {
- bundle = new EmptyResourceBundle();
- }
- }
- bundles.put(contextClassLoader, bundle);
- }
+ public static String getMessage(String name) {
+ String value = getBundle().getString(name);
- return bundle;
- }
-
- public static final String getMessage(String name) {
- String value = getBundle().getString(name);
- return value == null ? "%" + name + "%" : value;
- }
-
- public static final String getMessage(String name, Object param) {
- String pattern = getBundle().getString(name);
- if(pattern == null) return "%" + name + "%";
- return MessageFormat.format(pattern, new Object[]{param});
- }
-
- public static final String getMessage(String name, Object param1, Object param2) {
- String pattern = getBundle().getString(name);
- if(pattern == null) return "%" + name + "%";
- return MessageFormat.format(pattern, new Object[]{param1, param2});
- }
-
- public static final String getMessage(String name, Object[] params) {
- String pattern = getBundle().getString(name);
- if(pattern == null) return "%" + name + "%";
- return MessageFormat.format(pattern, params);
- }
-
- public static final String BUNDLE_MAP_NO_PUT_VALUE =
"BUNDLE_MAP_NO_PUT_VALUE";
- public static final String BUNDLE_MAP_NO_REMOVE_VALUE =
"BUNDLE_MAP_NO_REMOVE_VALUE";
- public static final String NO_CONVERTER_REGISTERED =
"NO_CONVERTER_REGISTERED";
- public static final String FOR_TARGETS_NO_AJAX_CONTAINER =
"FOR_TARGETS_NO_AJAX_CONTAINER";
- public static final String VAR_MUST_BE_LITERAL = "VAR_MUST_BE_LITERAL";
- public static final String EVENT_MUST_BE_LITERAL = "EVENT_MUST_BE_LITERAL";
- public static final String CREATE_JAVASCRIPT_EVENT =
"CREATE_JAVASCRIPT_EVENT";
- public static final String CALLED_SET_PARENT = "CALLED_SET_PARENT";
- public static final String DETECT_NEW_COMPONENT = "DETECT_NEW_COMPONENT";
- public static final String SET_VALUE_BINDING_FOR_EVENT =
"SET_VALUE_BINDING_FOR_EVENT";
- public static final String COULD_NOT_LOAD_RESOURCE_BUNDLE =
"COULD_NOT_LOAD_RESOURCE_BUNDLE";
- public static final String FACES_CONTEXT_NOT_CREATED =
"FACES_CONTEXT_NOT_CREATED";
- public static final String FACES_CONTEXT_HAS_NOT_EXTERNAL =
"FACES_CONTEXT_HAS_NOT_EXTERNAL";
- public static final String FACES_CONTEXT_HAS_NOT_RESPONSE =
"FACES_CONTEXT_HAS_NOT_RESPONSE";
- public static final String CREATE_ALTERNATE_HANDLER =
"CREATE_ALTERNATE_HANDLER";
- public static final String ALTERNATE_HANDLER_CONSTRUCTOR_WARNING =
"ALTERNATE_HANDLER_CONSTRUCTOR_WARNING";
- public static final String VIEW_HANDLER_INSTANTIATION_ERROR =
"VIEW_HANDLER_INSTANTIATION_ERROR";
- public static final String ERROR_ON_PAGE = "ERROR_ON_PAGE";
- public static final String LIFECYCLE_ERROR = "LIFECYCLE_ERROR";
- public static final String LIFECYCLE_ERROR_AT_PHASE =
"LIFECYCLE_ERROR_AT_PHASE";
- public static final String COMPONENT_TREE_NOT_CREATED =
"COMPONENT_TREE_NOT_CREATED";
- public static final String SET_AJAX_LISTENER = "SET_AJAX_LISTENER";
- public static final String ADD_AJAX_AREA = "ADD_AJAX_AREA";
- public static final String ADD_AJAX_AREAS = "ADD_AJAX_AREAS";
- public static final String SET_AJAX_REQUEST = "SET_AJAX_REQUEST";
- public static final String SUBMITTED_AJAX_REQUEST = "SUBMITTED_AJAX_REQUEST";
- public static final String SEND_EVENT_TO_AJAX_LISTENER =
"SEND_EVENT_TO_AJAX_LISTENER";
- public static final String RENDER_AJAX_REQUEST = "RENDER_AJAX_REQUEST";
- public static final String RENDERING_AJAX_REGION_ERROR =
"RENDERING_AJAX_REGION_ERROR";
- public static final String RESTORE_AJAX_COMPONENT_STATE =
"RESTORE_AJAX_COMPONENT_STATE";
- public static final String SAVE_AJAX_COMPONENT_STATE =
"SAVE_AJAX_COMPONENT_STATE";
- public static final String CREATE_AJAX_AREAS_SET_TO_RENDER =
"CREATE_AJAX_AREAS_SET_TO_RENDER";
- public static final String ARGUMENT_IS_NOT_AJAX_REGION_ERROR =
"ARGUMENT_IS_NOT_AJAX_REGION_ERROR";
- public static final String NULL_EVENT_SUBMITTED_ERROR =
"NULL_EVENT_SUBMITTED_ERROR";
- public static final String CONTENT_TYPE_ENCODING = "CONTENT_TYPE_ENCODING";
- public static final String CONTENT_TYPE_NO_ENCODING =
"CONTENT_TYPE_NO_ENCODING";
- public static final String FILTER_START_INFO = "FILTER_START_INFO";
- public static final String FILTER_XML_OUTPUT = "FILTER_XML_OUTPUT";
- public static final String FILTER_NO_XML_CHAIN = "FILTER_NO_XML_CHAIN";
- public static final String FILTER_NO_XML_CHAIN_2 = "FILTER_NO_XML_CHAIN_2";
- public static final String FILTER_STOP_INFO = "FILTER_STOP_INFO";
- public static final String PARSER_NOT_INSTANTIATED_ERROR =
"PARSER_NOT_INSTANTIATED_ERROR";
- public static final String PARSING_TIME_INFO = "PARSING_TIME_INFO";
- public static final String JTIDY_PARSING_ERROR = "JTIDY_PARSING_ERROR";
- public static final String COMPONENT_NOT_FOUND = "COMPONENT_NOT_FOUND";
- public static final String EVENT_IS_READ_ONLY = "EVENT_IS_READ_ONLY";
- public static final String FLUSH_BUFFERED_STREAM_ERROR =
"FLUSH_BUFFERED_STREAM_ERROR";
- public static final String UNSUPPORTED_ENCODING_WARNING =
"UNSUPPORTED_ENCODING_WARNING";
- public static final String UNSUPPORTED_ENCODING_WARNING_2 =
"UNSUPPORTED_ENCODING_WARNING_2";
- public static final String NO_WRITER_CALLED_INFO = "NO_WRITER_CALLED_INFO";
- public static final String PARSE_XML_DOCUMENT_INFO =
"PARSE_XML_DOCUMENT_INFO";
- public static final String NO_WRITER_POSSIBLE_ERROR =
"NO_WRITER_POSSIBLE_ERROR";
- public static final String CREATE_WRITER_INFO = "CREATE_WRITER_INFO";
- public static final String NO_STREAM_POSSIBLE_ERROR =
"NO_STREAM_POSSIBLE_ERROR";
- public static final String CREATE_STREAM_INFO = "CREATE_STREAM_INFO";
- public static final String OPEN_CLOSE_TAGS_DO_NOT_MATCH_ERROR =
"OPEN_CLOSE_TAGS_DO_NOT_MATCH_ERROR";
- public static final String VARIABLE_SUBSTITUTION_WARNING =
"VARIABLE_SUBSTITUTION_WARNING";
- public static final String START_DOCUMENT_SAX_EXCEPTION =
"START_DOCUMENT_SAX_EXCEPTION";
- public static final String COMMENT_SAX_EXCEPTION = "COMMENT_SAX_EXCEPTION";
- public static final String END_ELEMENT_SAX_EXCEPTION =
"END_ELEMENT_SAX_EXCEPTION";
- public static final String END_DOCUMENT_SAX_EXCEPTION =
"END_DOCUMENT_SAX_EXCEPTION";
- public static final String START_ELEMENT_SAX_EXCEPTION =
"START_ELEMENT_SAX_EXCEPTION";
- public static final String TEXT_SAX_EXCEPTION = "TEXT_SAX_EXCEPTION";
- public static final String MESSAGE_PARSING_INFO = "MESSAGE_PARSING_INFO";
- public static final String CREATE_JTIDY_INFO = "CREATE_JTIDY_INFO";
- public static final String READING_TIDY_PROPERTIES_ERROR =
"READING_TIDY_PROPERTIES_ERROR";
- public static final String ILLEGAL_METHOD_STATE = "ILLEGAL_METHOD_STATE";
- public static final String WRAPPED_RULES_NULL_ERROR =
"WRAPPED_RULES_NULL_ERROR";
- public static final String NO_NAME_ATTRIBUTE_ERROR =
"NO_NAME_ATTRIBUTE_ERROR";
- public static final String ENCODE_COMPILED_TEMPLATE_INFO =
"ENCODE_COMPILED_TEMPLATE_INFO";
- public static final String ENCODING_TEMPLATE_TERMINATED_INFO =
"ENCODING_TEMPLATE_TERMINATED_INFO";
- public static final String ENCODE_COMPILED_TEMPLATE_INFO2 =
"ENCODE_COMPILED_TEMPLATE_INFO2";
- public static final String CONVERTING_NON_VALUE_HOLDER_COMPONENT_ERROR =
"CONVERTING_NON_VALUE_HOLDER_COMPONENT_ERROR";
- public static final String COMPONENT_CLASS_ERROR = "COMPONENT_CLASS_ERROR";
- public static final String CONTEXT_NULL_ERROR = "CONTEXT_NULL_ERROR";
- public static final String COMPONENT_NULL_ERROR = "COMPONENT_NULL_ERROR";
- public static final String START_DECODING_COMPONENT_INFO =
"START_DECODING_COMPONENT_INFO";
- public static final String START_ENCODING_COMPONENT_INFO =
"START_ENCODING_COMPONENT_INFO";
- public static final String CHILDREN_ENCODING_COMPONENT_INFO =
"CHILDREN_ENCODING_COMPONENT_INFO";
- public static final String FINISH_ENCODING_COMPONENT_INFO =
"FINISH_ENCODING_COMPONENT_INFO";
- public static final String NAMESPACE_NOT_RECOGNIZED_ERROR =
"NAMESPACE_NOT_RECOGNIZED_ERROR";
- public static final String RENDERER_METHOD_NOT_SET_ERROR =
"RENDERER_METHOD_NOT_SET_ERROR";
- public static final String METHOD_CALL_ERROR_1 = "METHOD_CALL_ERROR_1";
- public static final String METHOD_CALL_ERROR_2 = "METHOD_CALL_ERROR_2";
- public static final String METHOD_CALL_ERROR_3 = "METHOD_CALL_ERROR_3";
- public static final String METHOD_CALL_ERROR_4 = "METHOD_CALL_ERROR_4";
- public static final String METHOD_CALL_ERROR_5 = "METHOD_CALL_ERROR_5";
- public static final String METHOD_CALL_ERROR_6 = "METHOD_CALL_ERROR_6";
- public static final String METHOD_CALL_ERROR_1a = "METHOD_CALL_ERROR_1a";
- public static final String METHOD_CALL_ERROR_2a = "METHOD_CALL_ERROR_2a";
- public static final String METHOD_CALL_ERROR_3a = "METHOD_CALL_ERROR_3a";
- public static final String METHOD_CALL_ERROR_4a = "METHOD_CALL_ERROR_4a";
- public static final String METHOD_CALL_ERROR_5a = "METHOD_CALL_ERROR_5a";
- public static final String METHOD_CALL_ERROR_6a = "METHOD_CALL_ERROR_6a";
- public static final String PARSING_TEMPLATE_ERROR = "PARSING_TEMPLATE_ERROR";
- public static final String TEMPLATE_IO_ERROR = "TEMPLATE_IO_ERROR";
- public static final String PARSING_TEMPLATE_ERROR_2 =
"PARSING_TEMPLATE_ERROR_2";
- public static final String START_COMPILE_TEMPLATE_INFO =
"START_COMPILE_TEMPLATE_INFO";
- public static final String PARSING_TEMPLATE_ERROR_a =
"PARSING_TEMPLATE_ERROR_a";
- public static final String TEMPLATE_IO_ERROR_a = "TEMPLATE_IO_ERROR_a";
- public static final String PARSING_TEMPLATE_ERROR_2a =
"PARSING_TEMPLATE_ERROR_2a";
- public static final String FINISH_COMPILE_TEMPLATE_INFO =
"FINISH_COMPILE_TEMPLATE_INFO";
- public static final String TEMPLATE_NOT_COMPILED_ERROR =
"TEMPLATE_NOT_COMPILED_ERROR";
- public static final String NO_CHILD_ALLOWED = "NO_CHILD_ALLOWED";
- public static final String NO_FACET_NAME_ATTRIBUTE =
"NO_FACET_NAME_ATTRIBUTE";
- public static final String BREAKPOINTS_UNSUPPORTED_ERROR =
"BREAKPOINTS_UNSUPPORTED_ERROR";
- public static final String BREAKPOINT_NOT_REGISTERED_ERROR =
"BREAKPOINT_NOT_REGISTERED_ERROR";
- public static final String CHILD_NOT_ALLOWED_ERROR =
"CHILD_NOT_ALLOWED_ERROR";
- public static final String INVOKE_RENDERER_METHOD_ERROR =
"INVOKE_RENDERER_METHOD_ERROR";
- public static final String METHOD_CALL_ERROR_2b = "METHOD_CALL_ERROR_2b";
- public static final String METHOD_CALL_ERROR_4b = "METHOD_CALL_ERROR_4b";
- public static final String METHOD_CALL_ERROR_6b = "METHOD_CALL_ERROR_6b";
- public static final String STYLE_ATTRIBUTE_ERROR = "STYLE_ATTRIBUTE_ERROR";
- public static final String BREAKPOINTS_UNSUPPORTED_ERROR_2 =
"BREAKPOINTS_UNSUPPORTED_ERROR_2";
- public static final String BREAKPOINTS_UNSUPPORTED_ERROR_3 =
"BREAKPOINTS_UNSUPPORTED_ERROR_3";
- public static final String REQUEST_CHAMELEON_RENDER_KIT_INFO =
"REQUEST_CHAMELEON_RENDER_KIT_INFO";
- public static final String GET_DEFAULT_RENDER_KIT_ERROR =
"GET_DEFAULT_RENDER_KIT_ERROR";
- public static final String DEFAULT_RENDER_KIT_INFO =
"DEFAULT_RENDER_KIT_INFO";
- public static final String AJAX_RESPONSE_NOT_RENDERED_INFO =
"AJAX_RESPONSE_NOT_RENDERED_INFO";
- public static final String ENTER_BEFORE_RENDER_VIEW_PHASE =
"ENTER_BEFORE_RENDER_VIEW_PHASE";
- public static final String SET_RENDER_KIT_ID_INFO = "SET_RENDER_KIT_ID_INFO";
- public static final String PROCESS_AJAX_EVENTS_INFO =
"PROCESS_AJAX_EVENTS_INFO";
- public static final String DELEGATE_AJAX_PROCESSING_INFO =
"DELEGATE_AJAX_PROCESSING_INFO";
- public static final String BREAKPOINTS_UNSUPPORTED_INSIDE_ATTRIBUTE_ERROR =
"BREAKPOINTS_UNSUPPORTED_INSIDE_ATTRIBUTE_ERROR";
- public static final String BUILD_ONCLICK_INFO = "BUILD_ONCLICK_INFO";
- public static final String UNNAMED_PARAMETER_ERROR =
"UNNAMED_PARAMETER_ERROR";
- public static final String AJAX_STATUS_COMPONENT_NOT_FOWND_WARNING =
"AJAX_STATUS_COMPONENT_NOT_FOWND_WARNING";
- public static final String COMPONENT_NULL_ERROR_2 = "COMPONENT_NULL_ERROR_2";
- public static final String CALCULATE_COMPONENT_ID_INFO =
"CALCULATE_COMPONENT_ID_INFO";
- public static final String DETECTING_ENCODING_DISABLED_ERROR =
"DETECTING_ENCODING_DISABLED_ERROR";
- public static final String OBTAIN_RESPONSE_SET_HEADER_ERROR =
"OBTAIN_RESPONSE_SET_HEADER_ERROR";
- public static final String INVOKE_AJAX_REGION_LISTENER =
"INVOKE_AJAX_REGION_LISTENER";
- public static final String APPENDING_AJAX_REGION_TO_NON_AJAX_CONTAINER_WARNING =
"APPENDING_AJAX_REGION_TO_NON_AJAX_CONTAINER_WARNING";
- public static final String RENDER_CHILDREN_NON_AJAX_INFO =
"RENDER_CHILDREN_NON_AJAX_INFO";
- public static final String RENDER_CHILDREN_AJAX_INFO =
"RENDER_CHILDREN_AJAX_INFO";
- public static final String ENCODE_CHILD_AJAX_INFO = "ENCODE_CHILD_AJAX_INFO";
- public static final String RENDER_AJAX_AREA_INFO = "RENDER_AJAX_AREA_INFO";
- public static final String DECODE_AJAX_REQUEST_STATUS_INFO =
"DECODE_AJAX_REQUEST_STATUS_INFO";
- public static final String REQUEST_PARAMETERS_MAP = "REQUEST_PARAMETERS_MAP";
- public static final String SET_MYFACES_SEQUENCE_INFO =
"SET_MYFACES_SEQUENCE_INFO";
- public static final String SKIP_ENCODING_HTML_INFO =
"SKIP_ENCODING_HTML_INFO";
- public static final String SKIP_ENCODE_BEGIN_HTML_INFO =
"SKIP_ENCODE_BEGIN_HTML_INFO";
- public static final String SKIP_ENCODE_END_HTML_INFO =
"SKIP_ENCODE_END_HTML_INFO";
- public static final String QUERY_STRING_BUILDING_ERROR =
"QUERY_STRING_BUILDING_ERROR";
- public static final String BUILD_RESOURCE_URI_INFO =
"BUILD_RESOURCE_URI_INFO";
- public static final String RESTORE_DATA_FROM_RESOURCE_URI_INFO =
"RESTORE_DATA_FROM_RESOURCE_URI_INFO";
- public static final String STREAM_CORRUPTED_ERROR = "STREAM_CORRUPTED_ERROR";
- public static final String DESERIALIZE_DATA_INPUT_ERROR =
"DESERIALIZE_DATA_INPUT_ERROR";
- public static final String DATA_CLASS_NOT_FOUND_ERROR =
"DATA_CLASS_NOT_FOUND_ERROR";
- public static final String METHOD_NOT_IMPLEMENTED = "METHOD_NOT_IMPLEMENTED";
- public static final String ENCODE_HTML_INFO = "ENCODE_HTML_INFO";
- public static final String ENCODE_HTML_INFO_2 = "ENCODE_HTML_INFO_2";
- public static final String ENCODE_BEGIN_HTML_INFO = "ENCODE_BEGIN_HTML_INFO";
- public static final String ENCODE_END_HTML_INFO = "ENCODE_END_HTML_INFO";
- public static final String SEND_CONTENT_INFO = "SEND_CONTENT_INFO";
- public static final String NO_INPUT_STREAM_ERROR = "NO_INPUT_STREAM_ERROR";
- public static final String SET_RESPONSE_HEADERS_INFO =
"SET_RESPONSE_HEADERS_INFO";
- public static final String BUILD_RESOURCE_INFO = "BUILD_RESOURCE_INFO";
- public static final String NO_RESOURCE_REGISTERED_ERROR =
"NO_RESOURCE_REGISTERED_ERROR";
- public static final String NO_RESOURCE_REGISTERED_ERROR_2 =
"NO_RESOURCE_REGISTERED_ERROR_2";
- public static final String NO_RESOURCE_EXISTS_ERROR =
"NO_RESOURCE_EXISTS_ERROR";
- public static final String INSTANTIATE_RESOURCE_ERROR =
"INSTANTIATE_RESOURCE_ERROR";
- public static final String INSTANTIATE_CLASS_ERROR =
"INSTANTIATE_CLASS_ERROR";
- public static final String STATIC_RESOURCE_NOT_FOUND_ERROR =
"STATIC_RESOURCE_NOT_FOUND_ERROR";
- public static final String PARSING_IF_MODIFIED_SINCE_WARNING =
"PARSING_IF_MODIFIED_SINCE_WARNING";
- public static final String GET_CONTENT_FROM_CACHE_INFO =
"GET_CONTENT_FROM_CACHE_INFO";
- public static final String CONTENT_NOT_FOUND_ERROR =
"CONTENT_NOT_FOUND_ERROR";
- public static final String SEND_RESOURCE_ERROR = "SEND_RESOURCE_ERROR";
- public static final String SEND_RESOURCE_ERROR_2 = "SEND_RESOURCE_ERROR_2";
- public static final String READING_PROPERTIES_ERROR =
"READING_PROPERTIES_ERROR";
- public static final String SEND_IMAGE_ERROR = "SEND_IMAGE_ERROR";
- public static final String SEND_IMAGE_ERROR_2 = "SEND_IMAGE_ERROR_2";
- public static final String SKIP_ENCODE_BEGIN_HTML_INFO_2 =
"SKIP_ENCODE_BEGIN_HTML_INFO_2";
- public static final String MARK_AS_RENDERED_INFO = "MARK_AS_RENDERED_INFO";
- public static final String SKIP_ENCODE_END_HTML_INFO_2 =
"SKIP_ENCODE_END_HTML_INFO_2";
- public static final String VARIABLE_SUBSTITUTION_ERROR =
"VARIABLE_SUBSTITUTION_ERROR";
- public static final String SET_SKIN_FACTORY_INFO = "SET_SKIN_FACTORY_INFO";
- public static final String CREATING_SKIN_FACTORY_ERROR =
"CREATING_SKIN_FACTORY_ERROR";
- public static final String NULL_SKIN_NAME_ERROR = "NULL_SKIN_NAME_ERROR";
- public static final String CREATE_SKIN_INFO = "CREATE_SKIN_INFO";
- public static final String DEFAULT_PROPERTIES_NOT_FOUND_ERROR =
"DEFAULT_PROPERTIES_NOT_FOUND_ERROR";
- public static final String SKIN_PROPERTIES_IO_ERROR =
"SKIN_PROPERTIES_IO_ERROR";
- public static final String SKIN_NOT_FOUND_ERROR = "SKIN_NOT_FOUND_ERROR";
- public static final String THEME_NOT_FOUND_ERROR = "THEME_NOT_FOUND_ERROR";
- public static final String ACESSING_SKIN_PROPERTY_AS_ARRAY_ERROR =
"ACESSING_SKIN_PROPERTY_AS_ARRAY_ERROR";
- public static final String ACESSING_SKIN_PROPERTY_ERROR =
"ACESSING_SKIN_PROPERTY_ERROR";
- public static final String SKIN_PROPERTIES_READ_ONLY_ERROR =
"SKIN_PROPERTIES_READ_ONLY_ERROR";
- public static final String NO_DATA_ADAPTOR = "NO_DATA_ADAPTOR";
- public static final String NO_VALUE_HOLDER_ERROR = "NO_VALUE_HOLDER_ERROR";
- public static final String NO_EDITABLE_VALUE_HOLDER_ERROR =
"NO_EDITABLE_VALUE_HOLDER_ERROR";
- public static final String INVALID_VALIDATION_EXPRESSION =
"INVALID_VALIDATION_EXPRESSION";
- public static final String NO_ACTION_SOURCE_ERROR = "NO_ACTION_SOURCE_ERROR";
- public static final String NO_ACTION_SOURCE2_ERROR =
"NO_ACTION_SOURCE2_ERROR";
- public static final String INVALID_ACTION_LISTENER =
"INVALID_ACTION_LISTENER";
- public static final String INVALID_VALUE_CHANGE_LISTENER =
"INVALID_VALUE_CHANGE_LISTENER";
- public static final String NO_VALUE_REFERENCE_ERROR =
"NO_VALUE_REFERENCE_ERROR";
- public static final String NO_BYTE_ARRAY_ERROR = "NO_BYTE_ARRAY_ERROR";
- public static final String BUFFER_TYPE_ERROR = "BUFFER_TYPE_ERROR";
- public static final String IMAGE_ERROR = "IMAGE_ERROR";
- public static final String CANNOT_WRITE_RASTERS = "CANNOT_WRITE_RASTERS";
- public static final String NULL_OUTPUT_ERROR = "NULL_OUTPUT_ERROR";
- public static final String IMAGE_NOT_BUFFERED_ERROR =
"IMAGE_NOT_BUFFERED_ERROR";
- public static final String NOT_DATA_OUTPUT_ERROR = "NOT_DATA_OUTPUT_ERROR";
- public static final String NULL_COLOR_PARAMETER_ERROR =
"NULL_COLOR_PARAMETER_ERROR";
- public static final String DECODE_COLOR_PARAMETER_ERROR =
"DECODE_COLOR_PARAMETER_ERROR";
- public static final String NULL_COLOR_PARAMETER_ERROR_2 =
"NULL_COLOR_PARAMETER_ERROR_2";
- public static final String DECODE_PARAMETER_ERROR = "DECODE_PARAMETER_ERROR";
- public static final String IMAGE_GENERATOR_CLASS_NOT_FOUND =
"IMAGE_GENERATOR_CLASS_NOT_FOUND";
- public static final String CREATING_IMAGE_GENERATOR_ERROR =
"CREATING_IMAGE_GENERATOR_ERROR";
- public static final String INVALID_COMMENT_INDEX = "INVALID_COMMENT_INDEX";
- public static final String LOADING_IMAGE_ERROR = "LOADING_IMAGE_ERROR";
- public static final String NOT_INDEXED_IMAGE_ERROR =
"NOT_INDEXED_IMAGE_ERROR";
- public static final String INVALID_RADIUS = "INVALID_RADIUS";
- public static final String INVALID_ATTRIBUTE_VALUE =
"INVALID_ATTRIBUTE_VALUE";
- public static final String VALUE_BINDING_TYPE_ERROR =
"VALUE_BINDING_TYPE_ERROR";
- public static final String NO_CONVERTER_FOUND_ERROR =
"NO_CONVERTER_FOUND_ERROR";
- public static final String GRABBER_ERROR = "GRABBER_ERROR";
- public static final String TOOMANY_COLORS_ERROR = "TOOMANY_COLORS_ERROR";
- public static final String GET_RESOURCE_AS_STREAM_ERROR =
"GET_RESOURCE_AS_STREAM_ERROR";
- public static final String PARSING_WEB_XML_IO_ERROR =
"PARSING_WEB_XML_IO_ERROR";
- public static final String PARSING_WEB_XML_SAX_ERROR =
"PARSING_WEB_XML_SAX_ERROR";
- public static final String NULL_FILTER_NAME_WARNING =
"NULL_FILTER_NAME_WARNING";
- public static final String FILTER_NOT_FOUND_ERROR = "FILTER_NOT_FOUND_ERROR";
- public static final String FILTER_NOT_CONFIGURED_ERROR =
"FILTER_NOT_CONFIGURED_ERROR";
- public static final String NO_PREFIX_OR_SUFFIX_IN_FILTER_MAPPING_ERROR =
"NO_PREFIX_OR_SUFFIX_IN_FILTER_MAPPING_ERROR";
- public static final String CONFIG_INITIALIZATION_ERROR =
"CONFIG_INITIALIZATION_ERROR";
- public static final String FIELD_READING_ERROR = "FIELD_READING_ERROR";
- public static final String CONFIG_INITIALIZATION_ERROR_2 =
"CONFIG_INITIALIZATION_ERROR_2";
- public static final String DOM_METHOD_NOT_SUPPORTED =
"DOM_METHOD_NOT_SUPPORTED";
- public static final String METHOD_NOT_SUPPORTED = "METHOD_NOT_SUPPORTED";
- public static final String NAMED_ITEM_NOT_FOUND_ERROR =
"NAMED_ITEM_NOT_FOUND_ERROR";
- public static final String AJAX_SUPPORT_REQUEST_PARAMETER_INFO =
"AJAX_SUPPORT_REQUEST_PARAMETER_INFO";
- public static final String COMMAND_LINK_SUBMIT_INFO =
"COMMAND_LINK_SUBMIT_INFO";
- public static final String COMMAND_LINK_NOT_IN_FORM_WARNING =
"COMMAND_LINK_NOT_IN_FORM_WARNING";
- public static final String MUST_BE_EXPRESSION_ERROR =
"MUST_BE_EXPRESSION_ERROR";
- public static final String NOT_PARENT_AJAX_CONTAINER_ERROR =
"NOT_PARENT_AJAX_CONTAINER_ERROR";
- public static final String MUST_BE_LITERAL_ERROR = "MUST_BE_LITERAL_ERROR";
- public static final String FACET_TAG_MANY_CHILDREN_ERROR =
"FACET_TAG_MANY_CHILDREN_ERROR";
- public static final String NO_UI_COMPONENT_TAG_ANCESTOR_ERROR =
"NO_UI_COMPONENT_TAG_ANCESTOR_ERROR";
- public static final String NO_VALUE_REFERENCE_ERROR_2 =
"NO_VALUE_REFERENCE_ERROR_2";
- public static final String NULL_TYPE_ATTRIBUTE_ERROR =
"NULL_TYPE_ATTRIBUTE_ERROR";
- public static final String NULL_ATTRIBUTE_ERROR = "NULL_ATTRIBUTE_ERROR";
- public static final String AJAX_VIEW_EXPIRED = "AJAX_VIEW_EXPIRED";
- public static final String SKIN_CYCLIC_REFERENCE = "SKIN_CYCLIC_REFERENCE";
- public static final String SKIN_ILLEGAL_REFERENCE = "SKIN_ILLEGAL_REFERENCE";
- public static final String NAME_MUST_BE_LITERAL = "NAME_MUST_BE_LITERAL";
- public static final String INSTANTIATE_LISTENER_ERROR =
"INSTANTIATE_LISTENER_ERROR";
- public static final String NOT_AJAX_CONTAINER_ERROR =
"NOT_AJAX_CONTAINER_ERROR";
- public static final String INVALID_EXPRESSION = "INVALID_EXPRESSION";
- public static final String NOT_INSTANCE_OF_ERROR = "NOT_INSTANCE_OF_ERROR";
- public static final String UNSUPPORTED_ENCODING_ERROR =
"UNSUPPORTED_ENCODING_ERROR";
- public static final String UNSUPPORTED_INPUT_SOURCE_ERROR =
"UNSUPPORTED_INPUT_SOURCE_ERROR";
- public static final String STRING_CONVERSION_ERROR =
"STRING_CONVERSION_ERROR";
- public static final String UTF_CONVERSION_ERROR = "UTF_CONVERSION_ERROR";
- public static final String READ_ONLY_NODE_ERROR = "READ_ONLY_NODE_ERROR";
- public static final String NOT_PARENT_AJAX_COMPONENT_ERROR =
"NOT_PARENT_AJAX_COMPONENT_ERROR";
- public static final String INVALID_VALUE = "INVALID_VALUE";
- public static final String DATASCROLLER_PAGE_MISSING =
"DATASCROLLER_PAGE_MISSING";
- public static final String DATASCROLLER_PAGES_DIFFERENT =
"DATASCROLLER_PAGES_DIFFERENT";
- public static final String COMPONENT_CONVERSION_ERROR =
"COMPONENT_CONVERSION_ERROR";
+ return value == null ? "%" + name + "%" : value;
+ }
- public static void main(String[] args) {
- String m = getMessage(INVALID_ATTRIBUTE_VALUE, "A", "B");
- System.out.println(m);
- }
-
+ public static String getMessage(String name, Object param) {
+ String pattern = getBundle().getString(name);
+
+ if (pattern == null) {
+ return "%" + name + "%";
+ }
+
+ return MessageFormat.format(pattern, new Object[] {param});
+ }
+
+ public static String getMessage(String name, Object param1, Object param2) {
+ String pattern = getBundle().getString(name);
+
+ if (pattern == null) {
+ return "%" + name + "%";
+ }
+
+ return MessageFormat.format(pattern, new Object[] {param1, param2});
+ }
+
+ public static String getMessage(String name, Object[] params) {
+ String pattern = getBundle().getString(name);
+
+ if (pattern == null) {
+ return "%" + name + "%";
+ }
+
+ return MessageFormat.format(pattern, params);
+ }
+
+ /**
+ * @author asmirnov
+ *
+ */
+ public static final class EmptyResourceBundle extends ResourceBundle {
+
+ /*
+ * (non-Javadoc)
+ * @see java.util.ResourceBundle#getKeys()
+ */
+ @Override
+ public Enumeration<String> getKeys() {
+ return Collections.enumeration(Collections.<String>emptyList());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.util.ResourceBundle#handleGetObject(java.lang.String)
+ */
+ @Override
+ protected Object handleGetObject(String key) {
+ return null;
+ }
+ }
}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/application/ViewHandlerWrapper.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/application/ViewHandlerWrapper.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/application/ViewHandlerWrapper.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,10 +19,14 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.application;
import java.io.IOException;
+
import java.lang.reflect.Constructor;
+
import java.util.Locale;
import javax.faces.FacesException;
@@ -31,7 +35,9 @@
import javax.faces.context.FacesContext;
import org.ajax4jsf.Messages;
+
import org.richfaces.log.RichfacesLogger;
+
import org.slf4j.Logger;
/**
@@ -41,133 +47,150 @@
* @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:57:12 $
*
*/
+
//TODO remove
public class ViewHandlerWrapper extends ViewHandler {
- private static final String HANDLERS = "org.ajax4jsf.VIEW_HANDLERS";
-
- private static final Logger _log = RichfacesLogger.APPLICATION.getLogger();
+ private static final String HANDLERS = "org.ajax4jsf.VIEW_HANDLERS";
+ private static final Logger LOG = RichfacesLogger.APPLICATION.getLogger();
- /**
- * Wrapped ViewHandler
- */
- protected ViewHandler _handler;
-
- /**
- * @param handler - to wrap.
- */
- public ViewHandlerWrapper(ViewHandler handler) {
- _handler = handler;
- }
+ /**
+ * Wrapped ViewHandler
+ */
+ protected ViewHandler handler;
- /* (non-Javadoc)
- * @see
javax.faces.application.ViewHandler#calculateLocale(javax.faces.context.FacesContext)
- */
- public Locale calculateLocale(FacesContext context) {
- return _handler.calculateLocale(context);
- }
+ /**
+ * @param handler - to wrap.
+ */
+ public ViewHandlerWrapper(ViewHandler handler) {
+ this.handler = handler;
+ }
- /* (non-Javadoc)
- * @see
javax.faces.application.ViewHandler#calculateRenderKitId(javax.faces.context.FacesContext)
- */
- public String calculateRenderKitId(FacesContext context) {
- return _handler.calculateRenderKitId(context);
- }
+ /*
+ * (non-Javadoc)
+ * @see
javax.faces.application.ViewHandler#calculateLocale(javax.faces.context.FacesContext)
+ */
+ public Locale calculateLocale(FacesContext context) {
+ return handler.calculateLocale(context);
+ }
- /* (non-Javadoc)
- * @see javax.faces.application.ViewHandler#createView(javax.faces.context.FacesContext,
java.lang.String)
- */
- public UIViewRoot createView(FacesContext context, String viewId) {
- return _handler.createView(context, viewId);
- }
+ /*
+ * (non-Javadoc)
+ * @see
javax.faces.application.ViewHandler#calculateRenderKitId(javax.faces.context.FacesContext)
+ */
+ public String calculateRenderKitId(FacesContext context) {
+ return handler.calculateRenderKitId(context);
+ }
- /* (non-Javadoc)
- * @see
javax.faces.application.ViewHandler#getActionURL(javax.faces.context.FacesContext,
java.lang.String)
- */
- public String getActionURL(FacesContext context, String url) {
- return _handler.getActionURL(context, url);
- }
+ /*
+ * (non-Javadoc)
+ * @see
javax.faces.application.ViewHandler#createView(javax.faces.context.FacesContext,
java.lang.String)
+ */
+ public UIViewRoot createView(FacesContext context, String viewId) {
+ return handler.createView(context, viewId);
+ }
- /* (non-Javadoc)
- * @see
javax.faces.application.ViewHandler#getResourceURL(javax.faces.context.FacesContext,
java.lang.String)
- */
- public String getResourceURL(FacesContext context, String url) {
- return _handler.getResourceURL(context, url);
- }
+ /*
+ * (non-Javadoc)
+ * @see
javax.faces.application.ViewHandler#getActionURL(javax.faces.context.FacesContext,
java.lang.String)
+ */
+ public String getActionURL(FacesContext context, String url) {
+ return handler.getActionURL(context, url);
+ }
- /* (non-Javadoc)
- * @see javax.faces.application.ViewHandler#renderView(javax.faces.context.FacesContext,
javax.faces.component.UIViewRoot)
- */
- public void renderView(FacesContext context, UIViewRoot root) throws IOException,
FacesException {
- _handler.renderView(context, root);
- }
+ /*
+ * (non-Javadoc)
+ * @see
javax.faces.application.ViewHandler#getResourceURL(javax.faces.context.FacesContext,
java.lang.String)
+ */
+ public String getResourceURL(FacesContext context, String url) {
+ return handler.getResourceURL(context, url);
+ }
- /* (non-Javadoc)
- * @see
javax.faces.application.ViewHandler#restoreView(javax.faces.context.FacesContext,
java.lang.String)
- */
- public UIViewRoot restoreView(FacesContext context, String viewId) {
- return _handler.restoreView(context, viewId);
- }
+ /*
+ * (non-Javadoc)
+ * @see
javax.faces.application.ViewHandler#renderView(javax.faces.context.FacesContext,
+ * javax.faces.component.UIViewRoot)
+ */
+ public void renderView(FacesContext context, UIViewRoot root) throws IOException,
FacesException {
+ handler.renderView(context, root);
+ }
- /* (non-Javadoc)
- * @see
javax.faces.application.ViewHandler#writeState(javax.faces.context.FacesContext)
- */
- public void writeState(FacesContext context) throws IOException {
- _handler.writeState(context);
- }
+ /*
+ * (non-Javadoc)
+ * @see
javax.faces.application.ViewHandler#restoreView(javax.faces.context.FacesContext,
java.lang.String)
+ */
+ public UIViewRoot restoreView(FacesContext context, String viewId) {
+ return handler.restoreView(context, viewId);
+ }
- /**
- * @return Returns the handler.
- */
- protected ViewHandler getHandler() {
- return _handler;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.application.ViewHandler#initView(javax.faces.context.FacesContext)
- */
- public void initView(FacesContext context) throws FacesException {
- _handler.initView(context);
- }
-
- public String calculateCharacterEncoding(FacesContext context) {
- // TODO Auto-generated method stub
- return _handler.calculateCharacterEncoding(context);
- }
- /**
- * <p>Fill view-handlers chain for alternate handlers.</p>
- * <p><em>NOTE:</em> Calls to this method should be synchronized
externally since 3.3.0 version</p>
- *
- * @param context
- */
- public void fillChain( FacesContext context){
- String handlers = context.getExternalContext().getInitParameter(HANDLERS);
- if(null != handlers){
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- String[] classes = handlers.split(",");
- for (int i = 0; i < classes.length; i++) {
- String handlerClass = classes[i];
- if (_log.isDebugEnabled()) {
- _log.debug(Messages.getMessage(Messages.CREATE_ALTERNATE_HANDLER, handlerClass));
- }
- try {
- Class<?> clazz = classLoader.loadClass(handlerClass);
- try {
- Constructor<?> constructor = clazz
- .getConstructor(new Class[] { ViewHandler.class });
- _handler = (ViewHandler) constructor
- .newInstance(new Object[] { _handler });
- } catch (NoSuchMethodException e) {
- // No constructor with parent class - create simple instance
- if (_log.isWarnEnabled()) {
- _log.warn(Messages.getMessage(Messages.ALTERNATE_HANDLER_CONSTRUCTOR_WARNING));
- }
- _handler = (ViewHandler) clazz.newInstance();
- }
- } catch (Exception e) {
- _log.error(Messages.getMessage(Messages.VIEW_HANDLER_INSTANTIATION_ERROR), e);
- }
- }
- }
- }
+ /*
+ * (non-Javadoc)
+ * @see
javax.faces.application.ViewHandler#writeState(javax.faces.context.FacesContext)
+ */
+ public void writeState(FacesContext context) throws IOException {
+ handler.writeState(context);
+ }
+ /**
+ * @return Returns the handler.
+ */
+ protected ViewHandler getHandler() {
+ return handler;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
javax.faces.application.ViewHandler#initView(javax.faces.context.FacesContext)
+ */
+ public void initView(FacesContext context) throws FacesException {
+ handler.initView(context);
+ }
+
+ public String calculateCharacterEncoding(FacesContext context) {
+
+ // TODO Auto-generated method stub
+ return handler.calculateCharacterEncoding(context);
+ }
+
+ /**
+ * <p>Fill view-handlers chain for alternate handlers.</p>
+ * <p><em>NOTE:</em> Calls to this method should be synchronized
externally since 3.3.0 version</p>
+ *
+ * @param context
+ */
+ public void fillChain(FacesContext context) {
+ String handlers = context.getExternalContext().getInitParameter(HANDLERS);
+
+ if (null != handlers) {
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ String[] classes = handlers.split(",");
+
+ for (int i = 0; i < classes.length; i++) {
+ String handlerClass = classes[i];
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(Messages.getMessage(Messages.CREATE_ALTERNATE_HANDLER,
handlerClass));
+ }
+
+ try {
+ Class<?> clazz = classLoader.loadClass(handlerClass);
+
+ try {
+ Constructor<?> constructor = clazz.getConstructor(new
Class[] {ViewHandler.class});
+
+ handler = (ViewHandler) constructor.newInstance(new Object[]
{handler});
+ } catch (NoSuchMethodException e) {
+
+ // No constructor with parent class - create simple instance
+ if (LOG.isWarnEnabled()) {
+
LOG.warn(Messages.getMessage(Messages.ALTERNATE_HANDLER_CONSTRUCTOR_WARNING));
+ }
+
+ handler = (ViewHandler) clazz.newInstance();
+ }
+ } catch (Exception e) {
+
LOG.error(Messages.getMessage(Messages.VIEW_HANDLER_INSTANTIATION_ERROR), e);
+ }
+ }
+ }
+ }
}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/application/package-info.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/application/package-info.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/application/package-info.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -1,3 +1,4 @@
+
/**
* Classes required to support application-level logic
*/
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/cache/Cache.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/cache/Cache.java 2009-11-01
16:34:11 UTC (rev 15797)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/cache/Cache.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,18 +19,18 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.cache;
import java.util.Date;
-
public interface Cache {
+ public Object get(Object key);
- public Object get(Object key);
-
- public void put(Object key, Object value, Date expired);
+ public void put(Object key, Object value, Date expired);
- public void start();
-
- public void stop();
+ public void start();
+
+ public void stop();
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/cache/CacheFactory.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/cache/CacheFactory.java 2009-11-01
16:34:11 UTC (rev 15797)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/cache/CacheFactory.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.cache;
import java.util.Map;
@@ -28,8 +30,8 @@
* Service provider should implement CacheFactory to provide
* the functionality to create a new implementation specific Cache object.
*/
-public interface CacheFactory
-{
+public interface CacheFactory {
+
/**
* creates a new implementation specific Cache object using the env parameters.
* @param env implementation specific environment parameters passed to the
@@ -40,6 +42,4 @@
* @throws CacheException if any error occurs.
*/
public Cache createCache(Map<?, ?> env);
-
-
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/cache/package-info.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/cache/package-info.java 2009-11-01
16:34:11 UTC (rev 15797)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/cache/package-info.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -1,3 +1,4 @@
+
/**
* Cache APIs
*/
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxChildrenEncoder.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxChildrenEncoder.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxChildrenEncoder.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,9 +19,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.component;
import java.io.IOException;
+
import java.util.Set;
import javax.faces.context.FacesContext;
@@ -39,7 +42,7 @@
* or, if list is empty, compotents is submitted form - render it.
* TODO - Instead of calculate full path for every component, build current Path
* for componet and send as parameter.
- *
+ *
* @param context -
* current context
* @param component -
@@ -48,8 +51,6 @@
* list of Id to render.
* @throws IOException
*/
- public void encodeAjaxChild(FacesContext context,
- String path,Set<String> ids,Set<String> renderedAreas) throws
IOException ;
-
-
+ public void encodeAjaxChild(FacesContext context, String path, Set<String> ids,
Set<String> renderedAreas)
+ throws IOException;
}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxClientBehavior.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxClientBehavior.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxClientBehavior.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -6,57 +6,55 @@
/**
* @author Anton Belevich
- * interface for our ajax behaviors
+ * interface for our ajax behaviors
*
*/
public interface AjaxClientBehavior extends ClientBehavior {
-
- public boolean isLimitRender();
-
- public void setLimitRender(boolean limitRender);
-
- public void setExecute(Collection<String> execute);
-
- public Collection<String> getExecute();
-
- public void setRender(Collection<String> render);
-
- public Collection<String> getRender();
-
- public boolean isDisabled();
-
- public void setDisabled(boolean disabled);
-
- public void setQueueId(String queueId);
-
- public String getQueueId();
-
- public void setStatus(String statusId);
-
- public String getStatus();
-
- public String getSimilarityGroupingId();
-
- public void setSimilarityGroupingId(String similarityGroupingId);
-
- public String getOnevent();
-
- public void setOnevent(String onevent);
-
- public String getOnerror();
-
- public void setOnerror(String onerror);
-
- public String getOncomplete();
-
- public void setOncomplete(String oncomplete);
-
- public String getOnbegin();
-
- public void setOnbegin(String onbegin);
-
- public String getOnbeforedomupdate();
-
- public void setOnbeforedomupdate(String onbeforedomupdate);
-
+ public boolean isLimitRender();
+
+ public void setLimitRender(boolean limitRender);
+
+ public void setExecute(Collection<String> execute);
+
+ public Collection<String> getExecute();
+
+ public void setRender(Collection<String> render);
+
+ public Collection<String> getRender();
+
+ public boolean isDisabled();
+
+ public void setDisabled(boolean disabled);
+
+ public void setQueueId(String queueId);
+
+ public String getQueueId();
+
+ public void setStatus(String statusId);
+
+ public String getStatus();
+
+ public String getSimilarityGroupingId();
+
+ public void setSimilarityGroupingId(String similarityGroupingId);
+
+ public String getOnevent();
+
+ public void setOnevent(String onevent);
+
+ public String getOnerror();
+
+ public void setOnerror(String onerror);
+
+ public String getOncomplete();
+
+ public void setOncomplete(String oncomplete);
+
+ public String getOnbegin();
+
+ public void setOnbegin(String onbegin);
+
+ public String getOnbeforedomupdate();
+
+ public void setOnbeforedomupdate(String onbeforedomupdate);
}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,9 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.ajax4jsf.component;
+package org.ajax4jsf.component;
+
/**
* Base Interface for Ajax-enabled acting components.
* TODO - extend <code>ActionSource</code>???
@@ -29,10 +30,8 @@
* @version $Revision: 1.1.2.2 $ $Date: 2007/01/23 20:01:01 $
*
*/
-public interface AjaxComponent
-{
-
- public static final String AJAX_COMPONETT_PARAMETER =
AjaxComponent.class.getName()+".parameter";
+public interface AjaxComponent {
+ public static final String AJAX_COMPONETT_PARAMETER = AjaxComponent.class.getName() +
".parameter";
/**
* setter method for property
@@ -47,7 +46,7 @@
/**
* setter method for property
- * @param new value of String, <code>Collection</code> or array of
component's Id , processed at the phases 2-5
+ * @param new value of String, <code>Collection</code> or array of
component's Id , processed at the phases 2-5
* in the case of Ajax request by parent component. to set
*/
public abstract void setProcess(Object targetId);
@@ -61,12 +60,13 @@
* setter method for property
* @param new value of ajaxType of control component - link or input to set
*/
-// public abstract void setAjaxType(String ajaxType);
+// public abstract void setAjaxType(String ajaxType);
+
/**
* @return value or result of valueBinding of ajaxType of control component - link or
input
*/
-// public abstract String getAjaxType();
+// public abstract String getAjaxType();
/**
* setter method for property
@@ -75,7 +75,7 @@
public abstract void setStatus(String status);
/**
- * @return value or result of valueBinding of Id ( in format of
UIComponent.findComponent() call ) of request status indicator
+ * @return value or result of valueBinding of Id ( in format of
UIComponent.findComponent() call ) of request status indicator
*/
public abstract String getStatus();
@@ -89,7 +89,7 @@
* @return value or result of valueBinding of Name of JavaScript function, called on
complete Ajax request
*/
public abstract String getOncomplete();
-
+
/**
* @return value or result of valueBinding of Name of JavaScript function, called
before updating DOM
*/
@@ -100,9 +100,9 @@
* @param new value of Name of JavaScript function, called before updating DOM to
set
*/
public abstract void setOnbeforedomupdate(String beforeUpdate);
-
+
public abstract String getOnbegin();
-
+
public abstract void setOnbegin(String onbegin);
/**
@@ -137,7 +137,7 @@
* @return value or result of valueBinding of Submit ( or not ) full form on Ajax
action.
*/
public abstract boolean isAjaxSingle();
-
+
/**
* Getter for bypassUpdates bean property. Indicate that component must invoke
listeners after Process Validators phase
* and force render response after it - since no values of components will be
updated. Can be used to perform validation of client input
@@ -145,87 +145,84 @@
* @return true if component must force render after validation phase.
*/
public abstract boolean isBypassUpdates();
-
+
/**
* Setter for bypassUpdates bean property.
* @param bypass true if component must force render after validation phase.
*/
public abstract void setBypassUpdates(boolean bypass);
-
+
/**
- * Getter for property name of events queue on client side - for avoid to send requests
too frequnly ( on key events, for example ), implementation will be generated by
- * componnents-generator
- * @return property value
- */
- public abstract String getEventsQueue();
+ * Getter for property name of events queue on client side - for avoid to send
requests too frequnly ( on key events, for example ), implementation will be generated by
+ * componnents-generator
+ * @return property value
+ */
+ public abstract String getEventsQueue();
- /**
- * Setter for flag indicated aborting unfinished ajax requests in queue.
- * @param newvalue - new property value. If true, unfinished request in queue will be
aborted on new events.
- */
- public abstract void setIgnoreDupResponses(boolean newvalue);
-
-
/**
- * Getter for property flag indicated aborting unfinished ajax requests in queue.
- * componnents-generator
- * @return property value
- */
- public abstract boolean isIgnoreDupResponses();
+ * Setter for flag indicated aborting unfinished ajax requests in queue.
+ * @param newvalue - new property value. If true, unfinished request in queue will be
aborted on new events.
+ */
+ public abstract void setIgnoreDupResponses(boolean newvalue);
- /**
- * Setter for property name of events queue on client side - for avoid to send requests
too frequnly ( on key events, for example ), implementation will be generated by
- * componnents-generator
- * @param newvalue - new property value
- */
- public abstract void setEventsQueue(String newvalue);
-
- /**
- * Getter for property Delay ( in ms. ) for send ajax request on JavaScript event. In
conjunction with events queue can reduce number of requests on keyboard or mouse move
events., implementation will be generated by
- * componnents-generator
- * @return property value
- */
- public abstract int getRequestDelay();
+ /**
+ * Getter for property flag indicated aborting unfinished ajax requests in queue.
+ * componnents-generator
+ * @return property value
+ */
+ public abstract boolean isIgnoreDupResponses();
- /**
- * Setter for property Delay ( in ms. ) for send ajax request on JavaScript event. In
conjunction with events queue can reduce number of requests on keyboard or mouse move
events., implementation will be generated by
- * componnents-generator
- * @param newvalue - new property value
- */
- public abstract void setRequestDelay(int newvalue);
-
- /**
- * Getter for request timeout
- * @return timeout in ms.
- */
- public abstract int getTimeout();
-
- /**
- * Setter for request timeout
- * @param timeout new value in ms.
- */
- public abstract void setTimeout(int timeout);
-
-
- /**
- * Setter for a 'focus' bean property - id of component( or of DOM element ), to
set focus after AJAX request.
- * @param focus
- */
- public abstract void setFocus(String focus);
-
- /**
- * @return
- */
- public abstract String getFocus();
+ /**
+ * Setter for property name of events queue on client side - for avoid to send
requests too frequnly ( on key events, for example ), implementation will be generated by
+ * componnents-generator
+ * @param newvalue - new property value
+ */
+ public abstract void setEventsQueue(String newvalue);
- /**
- *
- */
- public abstract void setSimilarityGroupingId(String similarityGroupingId);
+ /**
+ * Getter for property Delay ( in ms. ) for send ajax request on JavaScript event. In
conjunction with events queue can reduce number of requests on keyboard or mouse move
events., implementation will be generated by
+ * componnents-generator
+ * @return property value
+ */
+ public abstract int getRequestDelay();
- /**
- *
- */
- public abstract String getSimilarityGroupingId();
+ /**
+ * Setter for property Delay ( in ms. ) for send ajax request on JavaScript event. In
conjunction with events queue can reduce number of requests on keyboard or mouse move
events., implementation will be generated by
+ * componnents-generator
+ * @param newvalue - new property value
+ */
+ public abstract void setRequestDelay(int newvalue);
-}
\ No newline at end of file
+ /**
+ * Getter for request timeout
+ * @return timeout in ms.
+ */
+ public abstract int getTimeout();
+
+ /**
+ * Setter for request timeout
+ * @param timeout new value in ms.
+ */
+ public abstract void setTimeout(int timeout);
+
+ /**
+ * Setter for a 'focus' bean property - id of component( or of DOM element ),
to set focus after AJAX request.
+ * @param focus
+ */
+ public abstract void setFocus(String focus);
+
+ /**
+ * @return
+ */
+ public abstract String getFocus();
+
+ /**
+ *
+ */
+ public abstract void setSimilarityGroupingId(String similarityGroupingId);
+
+ /**
+ *
+ */
+ public abstract String getSimilarityGroupingId();
+}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxContainer.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxContainer.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxContainer.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.component;
import java.io.IOException;
@@ -27,30 +29,26 @@
import org.ajax4jsf.event.AjaxSource;
-
/**
* Extend Ajax-enabled region to support event listeners on Ajax requests.
* @author shura (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:57:39 $
- *
+ *
*/
-public interface AjaxContainer extends AjaxContainerBase, AjaxSource
-{
+public interface AjaxContainer extends AjaxContainerBase, AjaxSource {
/**
* Is ajax container must re-render all output from page or only it's children ?
* @return true if all ajax-enabled to re-render araes on page must be checked for
output.
*/
public abstract boolean isRenderRegionOnly();
-
+
public abstract void setRenderRegionOnly(boolean reRenderPage);
- /**
- * Encode AJAX response from this container ( call encode methods for selected
components only )
- * @param context
- * @throws IOException
- */
- public void encodeAjax(FacesContext context) throws IOException ;
-
-
-}
\ No newline at end of file
+ /**
+ * Encode AJAX response from this container ( call encode methods for selected
components only )
+ * @param context
+ * @throws IOException
+ */
+ public void encodeAjax(FacesContext context) throws IOException;
+}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxContainerBase.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxContainerBase.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxContainerBase.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,67 +19,69 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.component;
import javax.el.MethodExpression;
/**
- * Base interface for controller component, managed AJAX Requests.
+ * Base interface for controller component, managed AJAX Requests.
* Component, implemented this interface, must always return
<code>true</code> for
* <code>javax.faces.component.UIComponent#getRendersChildren()</code>
method.
* in common, set of components, rendered of current request, maintain by it.
- * TODO - add capabilites for components, rendered in
<code>PhaseListener</code>
+ * TODO - add capabilites for components, rendered in
<code>PhaseListener</code>
* @author shura (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.2 $ $Date: 2007/02/06 16:23:20 $
*
*/
public interface AjaxContainerBase {
+
/**
* getter for AjaxListener method. Same as for <code>ActionSource</code>
- *
+ *
* @see javax.faces.component.ActionSource#getActionListener()
*/
public MethodExpression getAjaxListener();
/**
* setter for AjaxListener <code>MethodBinding</code>
- * in case on AjaxRequest, component must call this method in
+ * in case on AjaxRequest, component must call this method in
* <code>PhaseId.APPLY_REQUEST_VALUES</code> or
* <code>PhaseId.INVOKE_APPLICATION</code> phases, depend on immediate
flag.
- *
+ *
* @see
javax.faces.component.ActionSource#setActionListener(javax.faces.el.MethodBinding)
*/
- public void setAjaxListener(MethodExpression AjaxListener);
+ public void setAjaxListener(MethodExpression ajaxListener);
/**
* getter for flag immediate call Listener's on PhaseId.APPLY_REQUEST_VALUES
phase.
- *
+ *
* @see javax.faces.component.ActionSource#isImmediate()
*/
public boolean isImmediate();
/**
* getter for render method flag of subview. If true, on AJAX-request component
render it children
- * after {@link com.sun.faces.lifecycle.Phase.INVOKE_APPLICATION }
+ * after {@link com.sun.faces.lifecycle.Phase.INVOKE_APPLICATION }
* @return value of selfRendered flag
*/
public boolean isSelfRendered();
-
+
/**
* setter for self-render flag.
* @param selfRendered
*/
public void setSelfRendered(boolean selfRendered);
+
/**
* setter for immediate flag.
- *
+ *
* @see javax.faces.component.ActionSource#setImmediate(boolean)
*/
public void setImmediate(boolean immediate);
public boolean isSubmitted();
-
+
public void setSubmitted(boolean submitted);
-
-
}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxDataEncoder.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxDataEncoder.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxDataEncoder.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,25 +19,24 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.component;
import java.util.Set;
-import org.ajax4jsf.model.ExtendedDataModel;
-
/**
* Interface for iterable component, allowed for render given set of rows in ajax
response.
* @author shura
*
*/
public interface AjaxDataEncoder extends AjaxChildrenEncoder {
-
- /**
- * @return Set for values of {@link ExtendedDataModel} keys, encoded in ajax response by
this component.
- */
- public Set<Object> getAjaxKeys();
-
- public void setAjaxKeys(Set<Object> ajaxKeys);
-
+ /**
+ * @return Set for values of {@link org.ajax4jsf.model.ExtendedDataModel} keys,
encoded in ajax response by
+ * this component.
+ */
+ public Set<Object> getAjaxKeys();
+
+ public void setAjaxKeys(Set<Object> ajaxKeys);
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxOutput.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxOutput.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxOutput.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.component;
/**
@@ -29,27 +31,28 @@
*
*/
public interface AjaxOutput {
- /**
- * getter for ajax-rendered flag property.
- * @return
- */
- public boolean isAjaxRendered();
- /**
- * Setter for ajax rendered property.
- * @param ajaxRendered
- */
- public void setAjaxRendered(boolean ajaxRendered);
-
- /**
- * getter for ajax-rendered flag property.
- * @return
- */
- public boolean isKeepTransient();
- /**
- * Setter for ajax rendered property.
- * @param ajaxRendered
- */
- public void setKeepTransient(boolean ajaxRendered);
-
-
+
+ /**
+ * getter for ajax-rendered flag property.
+ * @return
+ */
+ public boolean isAjaxRendered();
+
+ /**
+ * Setter for ajax rendered property.
+ * @param ajaxRendered
+ */
+ public void setAjaxRendered(boolean ajaxRendered);
+
+ /**
+ * getter for ajax-rendered flag property.
+ * @return
+ */
+ public boolean isKeepTransient();
+
+ /**
+ * Setter for ajax rendered property.
+ * @param ajaxRendered
+ */
+ public void setKeepTransient(boolean ajaxRendered);
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxSupport.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxSupport.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxSupport.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.component;
import javax.faces.component.UIComponent;
@@ -30,13 +32,14 @@
* @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:57:34 $
*
*/
-public interface AjaxSupport {
+public interface AjaxSupport {
/**
* @return JavaScript eventString. Rebuild on every call, since
* can be in loop ( as in dataTable ) with different parameters.
*/
public String getEventString();
+
/**
* setter method for property
* @param new value of Name of event property of parent component for build
JavaScript AJAX.Submit call to set
@@ -48,40 +51,38 @@
*/
public abstract String getEvent();
+ /**
+ * Name of JavaScript function, called before submit Ajax request
+ * description
+ *
+ * @parameter
+ * @return the acceptClass
+ */
+ public abstract String getOnsubmit();
- /**
- * Name of JavaScript function, called before submit Ajax request
- * description
- *
- * @parameter
- * @return the acceptClass
- */
- public abstract String getOnsubmit();
+ /**
+ * @param newOnsubmit
+ * the value to set
+ */
+ public abstract void setOnsubmit(String newOnsubmit);
- /**
- * @param newOnsubmit
- * the value to set
- */
- public abstract void setOnsubmit(String newOnsubmit);
+ /**
+ * Getter for property If true, disable default action for target event ( encode
'return false' to JavaScript ), implementation will be generated by
+ * componnents-generator
+ * @return property value
+ */
+ public abstract boolean isDisableDefault();
+ /**
+ * Setter for property If true, disable default action for target event ( encode
'return false' to JavaScript ), implementation will be generated by
+ * componnents-generator
+ * @param newvalue - new property value
+ */
+ public abstract void setDisableDefault(boolean newvalue);
/**
- * Getter for property If true, disable default action for target event ( encode
'return false' to JavaScript ), implementation will be generated by
- * componnents-generator
- * @return property value
- */
- public abstract boolean isDisableDefault();
-
- /**
- * Setter for property If true, disable default action for target event ( encode
'return false' to JavaScript ), implementation will be generated by
- * componnents-generator
- * @param newvalue - new property value
- */
- public abstract void setDisableDefault(boolean newvalue);
-
- /**
- * Set property for JavaScrept event generated by this component.
- * @param parent
- */
- public void setParentProperties(UIComponent parent);
+ * Set property for JavaScrept event generated by this component.
+ * @param parent
+ */
+ public void setParentProperties(UIComponent parent);
}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/IterationStateHolder.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/IterationStateHolder.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/IterationStateHolder.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -18,31 +18,32 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
+
package org.ajax4jsf.component;
-import javax.faces.component.EditableValueHolder;
-import javax.faces.component.UIData;
-
/**
- * In the original {@link UIData} component, only state for a {@link EditableValueHolder}
component saved for an iteration.
+ * In the original {@link javax.faces.component.UIData} component, only state for a
+ * {@link javax.faces.component.EditableValueHolder} component saved for an iteration.
* In the Richfaces, we also save state for a components implemented this interface.
+ *
* @author asmirnov
*
*/
public interface IterationStateHolder {
-
- /**
- * Get component state for a current iteration.
- * @return request-scope component state. Details are subject for a component
implementation
- */
- public Object getIterationState();
-
- /**
- * Set component state for the next iteration. State can be either previously saved
iteration state
- * or <code>null</code> value. In the second case component should reset its
state to the initial.
- * @param state request-scope component state or <code>null</code>. Details
are subject for a component
- * implementation
- */
- public void setIterationState( Object state);
-
+
+ /**
+ * Get component state for a current iteration.
+ * @return request-scope component state. Details are subject for a component
implementation
+ */
+ public Object getIterationState();
+
+ /**
+ * Set component state for the next iteration. State can be either previously saved
iteration state
+ * or <code>null</code> value. In the second case component should reset
its state to the initial.
+ * @param state request-scope component state or <code>null</code>.
Details are subject for a component
+ * implementation
+ */
+ public void setIterationState(Object state);
}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/JavaScriptParameter.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/JavaScriptParameter.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/JavaScriptParameter.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.component;
/**
@@ -29,9 +31,7 @@
*
*/
public interface JavaScriptParameter {
+ public void setNoEscape(boolean noEscape);
- public void setNoEscape(boolean noEscape);
-
- public boolean isNoEscape();
-
-}
\ No newline at end of file
+ public boolean isNoEscape();
+}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/component/package-info.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/package-info.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/package-info.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -1,3 +1,4 @@
+
/**
* Base APIs of AJAX-enabled components
*/
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/context/AjaxContext.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/context/AjaxContext.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/context/AjaxContext.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -18,12 +18,16 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
+
package org.ajax4jsf.context;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -35,190 +39,192 @@
import org.ajax4jsf.resource.util.URLToStreamHelper;
public abstract class AjaxContext {
-
- private boolean limitToList;
- public static final String RESPONSE_DATA_KEY = "_ajax:data";
- static final String SERVICE_RESOURCE = "META-INF/services/"
- + AjaxContext.class.getName();
- private static final String DEFAULT_CONTEXT_CLASS =
"org.ajax4jsf.context.AjaxContextImpl";
+ /**
+ * Key for keep request state information in request-scope attributes.
+ */
+ public static final String AJAX_CONTEXT_KEY = "ajaxContext";
+ private static final String DEFAULT_CONTEXT_CLASS =
"org.ajax4jsf.context.AjaxContextImpl";
+ public static final String RESPONSE_DATA_KEY = "_ajax:data";
+ static final String SERVICE_RESOURCE = "META-INF/services/" +
AjaxContext.class.getName();
+ private static Map<ClassLoader, Class<? extends AjaxContext>>
ajaxContextClasses =
+ new HashMap<ClassLoader, Class<? extends AjaxContext>>();
+ private boolean limitToList;
- /**
- * Key for keep request state information in request-scope attributes.
- */
- public static final String AJAX_CONTEXT_KEY = "ajaxContext";
+ protected AjaxContext() {}
- public abstract Map<String, Object> getCommonAjaxParameters();
+ public abstract Map<String, Object> getCommonAjaxParameters();
- public abstract String getAjaxActionURL(FacesContext context);
+ public abstract String getAjaxActionURL(FacesContext context);
- public abstract void setResponseData(Object responseData);
+ public abstract void setResponseData(Object responseData);
- public abstract Object getResponseData();
+ public abstract Object getResponseData();
- public abstract void setOncomplete(Object oncompleteFunction);
+ public abstract void setOncomplete(Object oncompleteFunction);
- public abstract Object getOncomplete();
+ public abstract Object getOncomplete();
- public abstract void setViewIdHolder(ViewIdHolder viewIdHolder);
+ public abstract void setViewIdHolder(ViewIdHolder viewIdHolder);
- public abstract ViewIdHolder getViewIdHolder();
+ public abstract ViewIdHolder getViewIdHolder();
- public abstract boolean removeRenderedArea(String id);
+ public abstract boolean removeRenderedArea(String id);
- public abstract void addRenderedArea(String id);
+ public abstract void addRenderedArea(String id);
- public abstract Set<String> getAjaxRenderedAreas();
+ public abstract Set<String> getAjaxRenderedAreas();
- public abstract void addComponentToAjaxRender(UIComponent base, String id);
+ public abstract void addComponentToAjaxRender(UIComponent base, String id);
- public abstract void addComponentToAjaxRender(UIComponent component);
+ public abstract void addComponentToAjaxRender(UIComponent component);
- public abstract void addRegionsFromComponent(UIComponent component);
+ public abstract void addRegionsFromComponent(UIComponent component);
- /**
- * @param component
- * @since 3.3.0
- */
- public abstract void addAreasToProcessFromComponent(FacesContext context, UIComponent
component);
-
- public abstract Set<String> getAjaxAreasToRender();
+ /**
+ * @param component
+ * @since 3.3.0
+ */
+ public abstract void addAreasToProcessFromComponent(FacesContext context, UIComponent
component);
- public abstract Set<String> getAjaxAreasToProcess();
-
- public boolean isAjaxRequest(FacesContext facesContext) {
- return isAjaxRequest();
- }
+ public abstract Set<String> getAjaxAreasToRender();
- public abstract boolean isAjaxRequest();
+ public abstract Set<String> getAjaxAreasToProcess();
- public abstract void encodeAjaxEnd(FacesContext context) throws IOException;
+ public boolean isAjaxRequest(FacesContext facesContext) {
+ return isAjaxRequest();
+ }
- public abstract void encodeAjaxBegin(FacesContext context) throws IOException;
+ public abstract boolean isAjaxRequest();
- public abstract void renderAjax(FacesContext context);
+ public abstract void encodeAjaxEnd(FacesContext context) throws IOException;
- public abstract void decode(FacesContext context);
+ public abstract void encodeAjaxBegin(FacesContext context) throws IOException;
- public abstract void release();
+ public abstract void renderAjax(FacesContext context);
- public abstract Map<String, Object> getResponseDataMap();
+ public abstract void decode(FacesContext context);
- public abstract void setAjaxRequest(boolean b);
+ public abstract void release();
- public abstract boolean isSelfRender();
+ public abstract Map<String, Object> getResponseDataMap();
- public abstract void setSelfRender(boolean b);
+ public abstract void setAjaxRequest(boolean b);
- public abstract String getSubmittedRegionClientId();
+ public abstract boolean isSelfRender();
- public abstract void saveViewState(FacesContext context) throws IOException;
+ public abstract void setSelfRender(boolean b);
- public abstract void setAjaxSingleClientId(String ajaxSingleClientId);
+ public abstract String getSubmittedRegionClientId();
- public abstract String getAjaxSingleClientId();
+ public abstract void saveViewState(FacesContext context) throws IOException;
- public abstract void setAjaxAreasToProcess(Set<String> ajaxAreasToProcess);
+ public abstract void setAjaxSingleClientId(String ajaxSingleClientId);
- public abstract void setSubmittedRegionClientId(String submittedClientId);
-
+ public abstract String getAjaxSingleClientId();
- public boolean isLimitToList() {
- return limitToList;
- }
+ public abstract void setAjaxAreasToProcess(Set<String> ajaxAreasToProcess);
- public void setLimitToList(boolean limitToList) {
- this.limitToList = limitToList;
- }
+ public abstract void setSubmittedRegionClientId(String submittedClientId);
- /**
- * Get instance of current AJAX Context. Instance get by
- * variable {@link AjaxContext#AJAX_CONTEXT_KEY}
- *
- * @return memento instance for current request
- */
- public static AjaxContext getCurrentInstance() {
- FacesContext context = FacesContext.getCurrentInstance();
- return getCurrentInstance(context);
- }
+ public boolean isLimitToList() {
+ return limitToList;
+ }
- private static Map<ClassLoader, Class<? extends AjaxContext>>
ajaxContextClasses = new HashMap<ClassLoader, Class<? extends
AjaxContext>>();
+ public void setLimitToList(boolean limitToList) {
+ this.limitToList = limitToList;
+ }
- /**
- * Get instance of current AJAX Context. Instance get by
- * variable {@link AjaxContext#AJAX_CONTEXT_KEY}
- *
- * @param context
- * current FacesContext
- * @return instance of AjaxContext.
- */
- public static AjaxContext getCurrentInstance(FacesContext context) {
- if (null == context) {
- throw new NullPointerException("FacesContext is null");
- }
- Map<String, Object> requestMap = context.getExternalContext()
- .getRequestMap();
- AjaxContext ajaxContext = (AjaxContext) requestMap
- .get(AJAX_CONTEXT_KEY);
- if (null == ajaxContext) {
- ClassLoader contextClassLoader = Thread.currentThread()
- .getContextClassLoader();
- if(null == contextClassLoader) {
- contextClassLoader = AjaxContext.class.getClassLoader();
- }
- Class<? extends AjaxContext> clazz;
- synchronized (ajaxContextClasses) {
- clazz = ajaxContextClasses.get(contextClassLoader);
- if (null == clazz) {
- String factoryClassName = DEFAULT_CONTEXT_CLASS;
- // Pluggable factories.
- InputStream input = null; // loader.getResourceAsStream(SERVICE_RESOURCE);
- input = URLToStreamHelper.urlToStreamSafe(contextClassLoader
- .getResource(SERVICE_RESOURCE));
- // have services file.
- if (input != null) {
- try {
- BufferedReader reader = new BufferedReader(
- new InputStreamReader(input));
- factoryClassName = reader.readLine();
+ /**
+ * Get instance of current AJAX Context. Instance get by
+ * variable {@link AjaxContext#AJAX_CONTEXT_KEY}
+ *
+ * @return memento instance for current request
+ */
+ public static AjaxContext getCurrentInstance() {
+ FacesContext context = FacesContext.getCurrentInstance();
- } catch (Exception e) {
- throw new FacesException(
- "Error to create AjaxContext Instance", e);
- } finally {
- try {
- input.close();
- } catch (IOException e) {
- // Ignore
- }
- }
- }
- try {
- clazz = Class.forName(factoryClassName, false,
contextClassLoader).asSubclass(AjaxContext.class);
- } catch (ClassNotFoundException e) {
- throw new FacesException(
- "AjaxContext implementation class "
- + factoryClassName + " not found ", e);
- }
- ajaxContextClasses.put(contextClassLoader, clazz);
- }
- }
- try {
- ajaxContext = clazz.newInstance();
- ajaxContext.decode(context);
- } catch (InstantiationException e) {
- throw new FacesException(
- "Error to create AjaxContext Instance", e);
- } catch (IllegalAccessException e) {
- throw new FacesException(
- "No access to AjaxContext constructor", e);
- }
- requestMap.put(AJAX_CONTEXT_KEY, ajaxContext);
- }
- return ajaxContext;
- }
+ return getCurrentInstance(context);
+ }
- public AjaxContext() {
- }
-
-}
\ No newline at end of file
+ /**
+ * Get instance of current AJAX Context. Instance get by
+ * variable {@link AjaxContext#AJAX_CONTEXT_KEY}
+ *
+ * @param context
+ * current FacesContext
+ * @return instance of AjaxContext.
+ */
+ public static AjaxContext getCurrentInstance(FacesContext context) {
+ if (null == context) {
+ throw new NullPointerException("FacesContext is null");
+ }
+
+ Map<String, Object> requestMap =
context.getExternalContext().getRequestMap();
+ AjaxContext ajaxContext = (AjaxContext) requestMap.get(AJAX_CONTEXT_KEY);
+
+ if (null == ajaxContext) {
+ ClassLoader contextClassLoader =
Thread.currentThread().getContextClassLoader();
+
+ if (null == contextClassLoader) {
+ contextClassLoader = AjaxContext.class.getClassLoader();
+ }
+
+ Class<? extends AjaxContext> clazz;
+
+ synchronized (ajaxContextClasses) {
+ clazz = ajaxContextClasses.get(contextClassLoader);
+
+ if (null == clazz) {
+ String factoryClassName = DEFAULT_CONTEXT_CLASS;
+
+ // Pluggable factories.
+ InputStream input = null; //
loader.getResourceAsStream(SERVICE_RESOURCE);
+
+ input =
URLToStreamHelper.urlToStreamSafe(contextClassLoader.getResource(SERVICE_RESOURCE));
+
+ // have services file.
+ if (input != null) {
+ try {
+ BufferedReader reader = new BufferedReader(new
InputStreamReader(input));
+
+ factoryClassName = reader.readLine();
+ } catch (Exception e) {
+ throw new FacesException("Error to create AjaxContext
Instance", e);
+ } finally {
+ try {
+ input.close();
+ } catch (IOException e) {
+
+ // Ignore
+ }
+ }
+ }
+
+ try {
+ clazz = Class.forName(factoryClassName, false,
+
contextClassLoader).asSubclass(AjaxContext.class);
+ } catch (ClassNotFoundException e) {
+ throw new FacesException("AjaxContext implementation class
" + factoryClassName
+ + " not found ", e);
+ }
+
+ ajaxContextClasses.put(contextClassLoader, clazz);
+ }
+ }
+
+ try {
+ ajaxContext = clazz.newInstance();
+ ajaxContext.decode(context);
+ } catch (InstantiationException e) {
+ throw new FacesException("Error to create AjaxContext
Instance", e);
+ } catch (IllegalAccessException e) {
+ throw new FacesException("No access to AjaxContext
constructor", e);
+ }
+
+ requestMap.put(AJAX_CONTEXT_KEY, ajaxContext);
+ }
+
+ return ajaxContext;
+ }
+}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/context/ViewIdHolder.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/context/ViewIdHolder.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/context/ViewIdHolder.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.context;
/**
@@ -27,11 +29,9 @@
*
*/
public interface ViewIdHolder {
-
- public boolean skipNavigation(String ViewId);
-
- public String getViewId();
-
- public void setViewId(String newViewId);
+ public boolean skipNavigation(String viewId);
+ public String getViewId();
+
+ public void setViewId(String newViewId);
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/context/package-info.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/context/package-info.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/context/package-info.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -1,3 +1,4 @@
+
/**
* Classes and interfaces that defines contextual request information
*/
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxActionEvent.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxActionEvent.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxActionEvent.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.event;
import javax.faces.component.UIComponent;
@@ -31,18 +33,17 @@
*/
public class AjaxActionEvent extends ActionEvent {
-
- /**
- *
- */
- private static final long serialVersionUID = -5406101936114574903L;
+ /**
+ *
+ */
+ private static final long serialVersionUID = -5406101936114574903L;
- /**
- * @param component
- */
- public AjaxActionEvent(UIComponent component) {
- super(component);
- // TODO Auto-generated constructor stub
- }
+ /**
+ * @param component
+ */
+ public AjaxActionEvent(UIComponent component) {
+ super(component);
+ // TODO Auto-generated constructor stub
+ }
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxEvent.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxEvent.java 2009-11-01
16:34:11 UTC (rev 15797)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxEvent.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.event;
import javax.faces.component.UIComponent;
@@ -29,14 +31,14 @@
/**
* @author shura (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:57:33 $
- *
+ *
* Event for send by <code>AjaxContainer</code> in case of Ajax Request.
- * Used for build set of id's to render at current request, perform special render
etc.
+ * Used for build set of id's to render at current request, perform special render
etc.
*/
public class AjaxEvent extends FacesEvent {
/**
- *
+ *
*/
private static final long serialVersionUID = -5624716710738446159L;
@@ -50,20 +52,21 @@
/*
* (non-Javadoc)
- *
+ *
* @see
javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
*/
+ @Override
public boolean isAppropriateListener(FacesListener listener) {
- return (listener instanceof AjaxListener);
+ return listener instanceof AjaxListener;
}
/*
* (non-Javadoc)
- *
+ *
* @see
javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
*/
+ @Override
public void processListener(FacesListener listener) {
((AjaxListener) listener).processAjax(this);
}
-
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxListener.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxListener.java 2009-11-01
16:34:11 UTC (rev 15797)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxListener.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.event;
import javax.faces.event.FacesListener;
@@ -29,12 +31,10 @@
* @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:57:36 $
*/
public interface AjaxListener extends FacesListener {
+ public static final Class<?>[] AJAX_LISTENER_ARGS = {AjaxEvent.class};
- public static final Class<?>[] AJAX_LISTENER_ARGS = { AjaxEvent.class };
-
/**
* @param event - to process
*/
void processAjax(AjaxEvent event);
-
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxRenderEvent.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxRenderEvent.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxRenderEvent.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.event;
import javax.faces.component.UIComponent;
@@ -32,28 +34,27 @@
*/
public class AjaxRenderEvent extends FacesEvent {
- /**
- *
- */
- private static final long serialVersionUID = 5877851431032645762L;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 5877851431032645762L;
- /**
- * @param component
- */
- public AjaxRenderEvent(UIComponent component) {
- super(component);
- }
+ /**
+ * @param component
+ */
+ public AjaxRenderEvent(UIComponent component) {
+ super(component);
+ }
- public boolean isAppropriateListener(FacesListener listener) {
- return listener instanceof AjaxRenderListener;
- }
+ public boolean isAppropriateListener(FacesListener listener) {
+ return listener instanceof AjaxRenderListener;
+ }
- public void processListener(FacesListener listener) {
- if (listener instanceof AjaxRenderListener) {
- AjaxRenderListener renderListener = (AjaxRenderListener) listener;
- renderListener.processAjaxRender(this);
- }
-
- }
+ public void processListener(FacesListener listener) {
+ if (listener instanceof AjaxRenderListener) {
+ AjaxRenderListener renderListener = (AjaxRenderListener) listener;
+ renderListener.processAjaxRender(this);
+ }
+ }
}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxRenderListener.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxRenderListener.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxRenderListener.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.event;
import javax.faces.event.FacesListener;
@@ -28,7 +30,5 @@
*
*/
public interface AjaxRenderListener extends FacesListener {
-
- public void processAjaxRender(AjaxRenderEvent event);
-
+ public void processAjaxRender(AjaxRenderEvent event);
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxSource.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxSource.java 2009-11-01
16:34:11 UTC (rev 15797)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/event/AjaxSource.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.event;
/**
@@ -27,16 +29,17 @@
*
*/
public interface AjaxSource {
- /**
+
+ /**
* same as for ActionSource, but for AjaxListener
- *
+ *
* @see
javax.faces.component.ActionSource#addActionListener(javax.faces.event.ActionListener)
*/
public void addAjaxListener(AjaxListener listener);
/**
* same as for ActionSource, but for AjaxListener
- *
+ *
* @see javax.faces.component.ActionSource#getActionListeners()
*/
public AjaxListener[] getAjaxListeners();
@@ -46,6 +49,4 @@
* @see
javax.faces.component.ActionSource#removeActionListener(javax.faces.event.ActionListener)
*/
public void removeAjaxListener(AjaxListener listener);
-
-
}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/event/PushEventListener.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/event/PushEventListener.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/event/PushEventListener.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -18,13 +18,14 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
+
package org.ajax4jsf.event;
import java.util.EventListener;
import java.util.EventObject;
public interface PushEventListener extends EventListener {
-
public void onEvent(EventObject event);
-
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/event/package-info.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/event/package-info.java 2009-11-01
16:34:11 UTC (rev 15797)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/event/package-info.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -1,3 +1,4 @@
+
/**
* Interfaces and classes of events and listeners of basic AJAX components
*/
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/AjaxSubmitFunction.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/AjaxSubmitFunction.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/AjaxSubmitFunction.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.javascript;
import java.util.HashMap;
@@ -31,68 +33,68 @@
*
*/
public class AjaxSubmitFunction extends JSFunction {
-
- /**
- * Name Javasript function for submit AJAX request
- */
- public static final String AJAX_FUNCTION_NAME = "A4J.AJAX.Submit";
- /**
- * Attribute for keep clientId of status component
- */
- public static final String STATUS_ATTR_NAME = "status";
+ /**
+ * Name Javasript function for submit AJAX request
+ */
+ public static final String AJAX_FUNCTION_NAME = "A4J.AJAX.Submit";
- /**
- * Attribute for keep JavaScript funtion name for call after complete
- * request.
- */
- public static final String ONCOMPLETE_ATTR_NAME = "oncomplete";
+ // private static Log log = LogFactory.getLog(AjaxSubmitFunction.class);
+ public static final String AJAX_REGIONS_ATTRIBUTE = "reRender";
- /**
- * Attribute to keep
- */
- public static final String LIMITRENDER_ATTR_NAME = "limitRender";
+ /**
+ * Attribute to keep
+ */
+ public static final String LIMITRENDER_ATTR_NAME = "limitRender";
- //private static Log log = LogFactory.getLog(AjaxSubmitFunction.class);
+ /**
+ * Attribute for keep JavaScript funtion name for call after complete
+ * request.
+ */
+ public static final String ONCOMPLETE_ATTR_NAME = "oncomplete";
- public static final String AJAX_REGIONS_ATTRIBUTE = "reRender";
+ /**
+ * Attribute for keep clientId of status component
+ */
+ public static final String STATUS_ATTR_NAME = "status";
+ private Map<String, Object> options = new HashMap<String, Object>();
+ private Map<String, String> requestParameters = new HashMap<String,
String>();
- //private static final Class<?> OBJECT_ARRAY_CLASS = (new Object[0]).getClass();
+ // private static final Class<?> OBJECT_ARRAY_CLASS = (new
Object[0]).getClass();
+ private UIComponent component;
- private UIComponent component;
-
- private Map<String, Object> options = new HashMap<String, Object>();
-
- private Map<String, String> requestParameters = new HashMap<String,
String>();
+ /**
+ *
+ */
+ public AjaxSubmitFunction(UIComponent component) {
+ this(component, AJAX_FUNCTION_NAME);
+ }
- /**
- *
- */
- public AjaxSubmitFunction(UIComponent component) {
- this(component,AJAX_FUNCTION_NAME);
- }
- /**
- * @param name
- */
- public AjaxSubmitFunction(UIComponent component,String name) {
- super(name);
- this.component = component;
- // Fill parameters and options values.
- }
- /**
- * @return the options
- */
- public Map<String, Object> getOptions() {
- return this.options;
- }
- /**
- * @return the requestParameters
- */
- public Map<String, String> getRequestParameters() {
- return this.requestParameters;
- }
+ /**
+ * @param name
+ */
+ public AjaxSubmitFunction(UIComponent component, String name) {
+ super(name);
+ this.component = component;
- public UIComponent getComponent() {
- return component;
- }
+ // Fill parameters and options values.
+ }
+
+ /**
+ * @return the options
+ */
+ public Map<String, Object> getOptions() {
+ return this.options;
+ }
+
+ /**
+ * @return the requestParameters
+ */
+ public Map<String, String> getRequestParameters() {
+ return this.requestParameters;
+ }
+
+ public UIComponent getComponent() {
+ return component;
+ }
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSBind.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSBind.java 2009-11-01
16:34:11 UTC (rev 15797)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSBind.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.javascript;
/**
@@ -26,41 +28,37 @@
* @author Nick Belaevski
* @since 3.2.2
*/
-
public class JSBind extends ScriptStringBase {
+ private JSFunction function;
+ private String[] vars;
- private JSFunction function;
-
- private String[] vars;
-
- public JSBind(JSFunction function, String... vars) {
- super();
- this.function = function;
- this.vars = vars;
- }
+ public JSBind(JSFunction function, String... vars) {
+ super();
+ this.function = function;
+ this.vars = vars;
+ }
- public void appendScript(StringBuffer functionString) {
- functionString.append("function () {");
- functionString.append("var vars = {");
- boolean isFirst = true;
- for (String var : vars) {
- if (isFirst) {
- isFirst = false;
- } else {
- functionString.append(',');
- }
+ public void appendScript(StringBuffer functionString) {
+ functionString.append("function () {");
+ functionString.append("var vars = {");
- functionString.append(var);
- functionString.append(':');
- functionString.append(var);
- }
-
- functionString.append("};");
+ boolean isFirst = true;
- functionString.append("return function() { with (vars) {");
- functionString.append(function.toScript());
- functionString.append("}}}()");
-
- }
+ for (String var : vars) {
+ if (isFirst) {
+ isFirst = false;
+ } else {
+ functionString.append(',');
+ }
+ functionString.append(var);
+ functionString.append(':');
+ functionString.append(var);
+ }
+
+ functionString.append("};");
+ functionString.append("return function() { with (vars) {");
+ functionString.append(function.toScript());
+ functionString.append("}}}()");
+ }
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSEncoder.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSEncoder.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSEncoder.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.javascript;
/**
@@ -26,31 +28,23 @@
* Encode chars as JavaScript sequences
*/
public class JSEncoder {
- //private char APOSTROPHE[] = { '\\', '\'' };
- private static final char ENCODE_HEX[] = "0123456789ABCDEF".toCharArray();
+ // private char APOSTROPHE[] = { '\\', '\'' };
+ private static final char[] ENCODE_HEX = "0123456789ABCDEF".toCharArray();
+ private static final char[] ENCODE_APOS = "\\'".toCharArray();
+ private static final char[] ENCODE_QUOT = "\\\"".toCharArray();
+ private static final char[] ENCODE_LF = "\\n".toCharArray();
+ private static final char[] ENCODE_FF = "\\f".toCharArray();
+ private static final char[] ENCODE_CR = "\\r".toCharArray();
+ private static final char[] ENCODE_TAB = "\\t".toCharArray();
+ private static final char[] ENCODE_BS = "\\\\".toCharArray();
- private static final char ENCODE_APOS[] = "\\'".toCharArray();
+ // private static final char ENCODE_ESC[] = "\\e".toCharArray();
- private static final char ENCODE_QUOT[] = "\\\"".toCharArray();
-
- private static final char ENCODE_CR[] = "\\r".toCharArray();
-
- private static final char ENCODE_LF[] = "\\n".toCharArray();
-
- private static final char ENCODE_FF[] = "\\f".toCharArray();
-
- private static final char ENCODE_TAB[] = "\\t".toCharArray();
-
- private static final char ENCODE_BS[] = "\\\\".toCharArray();
-
- //private static final char ENCODE_ESC[] = "\\e".toCharArray();
-
/**
* Create a new instance of this <code>XMLEncoder</code>.
*/
- public JSEncoder() {
- }
+ public JSEncoder() {}
/**
* Return true or false wether this encoding can encode the specified
@@ -61,29 +55,28 @@
* <nobr>#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]</nobr>
* </code>
* </p>
- *
+ *
* @see <a
href="http://www.w3.org/TR/REC-xml#charsets">W3C XML 1.0
</a>
*/
public boolean compile(char c) {
-
if ((c == 0x09) || // [\t]
(c == 0x0a) || // [\n]
- (c == 0x0d) || // [\r](c == 0x22) || // ["]
- (c == 0x22) || // ["]
- (c == 0x27) || // [']
- (c == 0x5c) || // [\]
- (c == 0x03) || // [esc]
- (c == ']') || // ] - to avoid conflicts in CDATA
- (c == '<') || // - escape HTML markup characters
- (c == '>') || // - HTML
- (c == '&') || // - HTML
- (c == '-') || // - HTML comments
- (c < 0x20) || // See <
http://www.w3.org/TR/REC-xml#charsets>
- ((c > 0xd7ff) && (c < 0xe000)) || (c > 0xfffd)|| (c >
0xff)) {
- return (false);
+ (c == 0x0d) || // [\r](c == 0x22) || // ["]
+ (c == 0x22) || // ["]
+ (c == 0x27) || // [']
+ (c == 0x5c) || // [\]
+ (c == 0x03) || // [esc]
+ (c == ']') || // ] - to avoid conflicts
in CDATA
+ (c == '<') || // - escape HTML markup
characters
+ (c == '>') || // - HTML
+ (c == '&') || // - HTML
+ (c == '-') || // - HTML comments
+ (c < 0x20) || // See
<
http://www.w3.org/TR/REC-xml#charsets>
+ ((c > 0xd7ff) && (c < 0xe000)) ||
(c > 0xfffd) || (c > 0xff)) {
+ return false;
}
- return (true);
+ return true;
}
/**
@@ -92,32 +85,41 @@
*/
public char[] encode(char c) {
switch (c) {
- case 0x03:
- return (ENCODE_FF); // (>) [>]
- case 0x09:
- return (ENCODE_TAB); // (>) [>]
- case 0x0a:
- return (ENCODE_LF); // (>) [>]
- case 0x0d:
- return (ENCODE_CR); // (>) [>]
- case 0x22:
- return (ENCODE_QUOT); // (") ["]
- case 0x27:
- return (ENCODE_APOS); // (') [']
- case 0x5c:
- return (ENCODE_BS); // (<) [<]
- default: {
- if (c > 0xff) {
- char ret[] = { '\\', 'u', ENCODE_HEX[c >> 0xc &
0xf],
- ENCODE_HEX[c >> 0x8 & 0xf], ENCODE_HEX[c >> 0x4
& 0xf],
- ENCODE_HEX[c & 0xf] };
- return (ret);
+ case 0x03 :
+ return ENCODE_FF; // (>) [>]
+
+ case 0x09 :
+ return ENCODE_TAB; // (>) [>]
+
+ case 0x0a :
+ return ENCODE_LF; // (>) [>]
+
+ case 0x0d :
+ return ENCODE_CR; // (>) [>]
+
+ case 0x22 :
+ return ENCODE_QUOT; // (") ["]
+
+ case 0x27 :
+ return ENCODE_APOS; // (') [']
+
+ case 0x5c :
+ return ENCODE_BS; // (<) [<]
+
+ default : {
+ if (c > 0xff) {
+ char[] ret = {
+ '\\', 'u', ENCODE_HEX[c >> 0xc & 0xf],
ENCODE_HEX[c >> 0x8 & 0xf], ENCODE_HEX[c >> 0x4 & 0xf],
+ ENCODE_HEX[c & 0xf]
+ };
+
+ return ret;
+ }
+
+ char[] ret = {'\\', 'x', ENCODE_HEX[c >> 0x4 &
0xf], ENCODE_HEX[c & 0xf]};
+
+ return ret;
}
- char ret[] = { '\\', 'x', ENCODE_HEX[c >> 0x4 &
0xf],
- ENCODE_HEX[c & 0xf] };
- return (ret);
}
- }
}
-
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSFunction.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSFunction.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSFunction.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.javascript;
import java.util.ArrayList;
@@ -29,55 +31,58 @@
/**
* @author shura (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.3 $ $Date: 2007/02/06 16:23:26 $
- *
+ *
*/
public class JSFunction extends ScriptStringBase implements ScriptString {
+ private List<Object> parameters = new ArrayList<Object>();
+ private String name;
- private String name;
+ /**
+ * @param name
+ * @param parameters
+ */
+ public JSFunction(String name, Object... parameters) {
+ this.name = name;
+ this.parameters.addAll(Arrays.asList(parameters));
+ }
- private List<Object> parameters = new ArrayList<Object>();
+ public JSFunction addParameter(Object parameter) {
+ getParameters().add(parameter);
- /**
- * @param name
- * @param parameters
- */
- public JSFunction(String name, Object ... parameters) {
- this.name = name;
- this.parameters.addAll(Arrays.asList(parameters));
- }
+ return this;
+ }
+ public void appendScript(StringBuffer functionString) {
+ functionString.append(name).append('(');
- public JSFunction addParameter(Object parameter) {
- getParameters().add(parameter);
- return this;
- }
+ boolean first = true;
+ List<?> parameters = getParameters();
- public void appendScript(StringBuffer functionString) {
- functionString.append(name).append('(');
- boolean first = true;
- List<?> parameters = getParameters();
- if (null != parameters) {
- for (Iterator<?> param = parameters.iterator(); param.hasNext();) {
- Object element = param.next();
- if (!first) {
- functionString.append(',');
- }
- if (null != element) {
- functionString.append(ScriptUtils.toScript(element));
- } else {
- functionString.append("null");
- }
- first = false;
- }
+ if (null != parameters) {
+ for (Iterator<?> param = parameters.iterator(); param.hasNext(); ) {
+ Object element = param.next();
- }
- functionString.append(")");
- }
+ if (!first) {
+ functionString.append(',');
+ }
- /**
- * @return the parameters
- */
- public List<Object> getParameters() {
- return this.parameters;
- }
+ if (null != element) {
+ functionString.append(ScriptUtils.toScript(element));
+ } else {
+ functionString.append("null");
+ }
+
+ first = false;
+ }
+ }
+
+ functionString.append(")");
+ }
+
+ /**
+ * @return the parameters
+ */
+ public List<Object> getParameters() {
+ return this.parameters;
+ }
}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSFunctionDefinition.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSFunctionDefinition.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSFunctionDefinition.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.javascript;
import java.util.ArrayList;
@@ -31,69 +33,69 @@
* @version $Revision: 1.1.2.2 $ $Date: 2007/01/24 13:22:31 $
*
*/
-public class JSFunctionDefinition extends ScriptStringBase implements ScriptString
-{
-
-
-
+public class JSFunctionDefinition extends ScriptStringBase implements ScriptString {
private List<Object> parameters = new ArrayList<Object>();
-
private StringBuffer body = new StringBuffer();
-
- private String name ;
+ private String name;
/**
* Construct {@link JSFunctionDefinition} with arbitrary list of params
* @param params
*/
- public JSFunctionDefinition(Object ... params) {
- parameters.addAll(Arrays.asList(params));
- }
-
- public void addParameter(Object param) {
- parameters.add(param);
- }
-
- public JSFunctionDefinition addToBody(Object body)
- {
+ public JSFunctionDefinition(Object... params) {
+ parameters.addAll(Arrays.asList(params));
+ }
+
+ public void addParameter(Object param) {
+ parameters.add(param);
+ }
+
+ public JSFunctionDefinition addToBody(Object body) {
this.body.append(body);
+
return this;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see
org.ajax4jsf.components.renderkit.scriptutils.ScriptString#appendScript(java.lang.StringBuffer)
*/
- public void appendScript(StringBuffer functionString)
- {
- functionString.append("function");
- if(null != name){
- functionString.append(" ").append(name);
- }
- functionString.append("(");
+ public void appendScript(StringBuffer functionString) {
+ functionString.append("function");
+
+ if (null != name) {
+ functionString.append(" ").append(name);
+ }
+
+ functionString.append("(");
+
boolean first = true;
- for (Iterator<Object> param = parameters.iterator(); param.hasNext();)
- {
- Object element = param.next();
- if(!first){
+
+ for (Iterator<Object> param = parameters.iterator(); param.hasNext(); ) {
+ Object element = param.next();
+
+ if (!first) {
functionString.append(',');
}
+
functionString.append(element.toString());
first = false;
}
+
functionString.append("){").append(body).append("}");
}
- /**
- * @return the name
- */
- public String getName() {
- return this.name;
- }
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return this.name;
+ }
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSLiteral.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSLiteral.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSLiteral.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.javascript;
/**
@@ -27,31 +29,17 @@
*
*/
public class JSLiteral extends ScriptStringBase {
-
- /** Javascript literal text */
- private String literal;
-
- private static final class ImmutableJSLiteral extends JSLiteral {
-
- public ImmutableJSLiteral(String literal) {
- super(literal);
- }
-
- @Override
- public void setLiteral(String literal) {
- throw new UnsupportedOperationException();
- }
- };
-
public static final JSLiteral EMPTY_HASH = new ImmutableJSLiteral("{}");
-
public static final JSLiteral EMPTY_LIST = new ImmutableJSLiteral("[]");
+ /** Javascript literal text */
+ private String literal;
+
/**
* Default constructor
*/
public JSLiteral() {
- super();
+ super();
}
/**
@@ -59,16 +47,16 @@
* @param literal
*/
public JSLiteral(String literal) {
- super();
- this.literal = literal;
+ super();
+ this.literal = literal;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see org.ajax4jsf.javascript.ScriptString#appendScript(java.lang.StringBuffer)
*/
public void appendScript(StringBuffer jsString) {
- jsString.append(literal);
-
+ jsString.append(literal);
}
/**
@@ -85,4 +73,14 @@
this.literal = literal;
}
+ private static final class ImmutableJSLiteral extends JSLiteral {
+ public ImmutableJSLiteral(String literal) {
+ super(literal);
+ }
+
+ @Override
+ public void setLiteral(String literal) {
+ throw new UnsupportedOperationException();
+ }
+ }
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSObject.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSObject.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSObject.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,31 +19,29 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.ajax4jsf.javascript;
+package org.ajax4jsf.javascript;
+
/**
* @author shura (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:30 $
*
*/
-public class JSObject extends JSFunction
-{
+public class JSObject extends JSFunction {
/**
* @param name
* @param parameter
*/
- public JSObject(String name, Object ... parameters)
- {
+ public JSObject(String name, Object... parameters) {
super(name, parameters);
+
// TODO Auto-generated constructor stub
}
- public void appendScript(StringBuffer functionString)
- {
+ public void appendScript(StringBuffer functionString) {
functionString.append("new ");
super.appendScript(functionString);
}
-
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSReference.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSReference.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/JSReference.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.javascript;
/**
@@ -28,44 +30,43 @@
*
*/
public class JSReference extends ScriptStringBase {
-
- public static final JSReference EVENT = new JSReference("event");
- public static final JSReference THIS = new JSReference("this");
+ public static final JSReference EVENT = new JSReference("event");
+ public static final JSReference THIS = new JSReference("this");
+ public static final JSReference TRUE = new JSReference("true");
+ public static final JSReference NULL = new JSReference("null");
+ public static final JSReference FALSE = new JSReference("false");
+ private Object index = null;
+ private String name;
- public static final JSReference TRUE = new JSReference("true");
- public static final JSReference FALSE = new JSReference("false");
- public static final JSReference NULL = new JSReference("null");
+ /**
+ * @param name
+ */
+ public JSReference(String name) {
- private String name;
- private Object index=null;
-
- /**
- * @param name
- */
- public JSReference(String name) {
- // TODO Auto-generated constructor stub
- this.name = name;
- }
+ // TODO Auto-generated constructor stub
+ this.name = name;
+ }
- /**
- * @param name
- * @param index
- */
- public JSReference(String name, Object index) {
- // TODO Auto-generated constructor stub
- this.name = name;
- this.index = index;
- }
+ /**
+ * @param name
+ * @param index
+ */
+ public JSReference(String name, Object index) {
- /* (non-Javadoc)
- * @see org.ajax4jsf.javascript.ScriptString#appendScript(java.lang.StringBuffer)
- */
- public void appendScript(StringBuffer functionString) {
- functionString.append(name);
- if (null != index) {
- functionString.append("[").append(ScriptUtils.toScript(index)).append("]");
- }
+ // TODO Auto-generated constructor stub
+ this.name = name;
+ this.index = index;
+ }
- }
+ /*
+ * (non-Javadoc)
+ * @see org.ajax4jsf.javascript.ScriptString#appendScript(java.lang.StringBuffer)
+ */
+ public void appendScript(StringBuffer functionString) {
+ functionString.append(name);
+ if (null != index) {
+
functionString.append("[").append(ScriptUtils.toScript(index)).append("]");
+ }
+ }
}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/PropertyUtils.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/PropertyUtils.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/PropertyUtils.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,17 +19,23 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
+
+
+
package org.ajax4jsf.javascript;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
+
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+
import java.text.MessageFormat;
import org.richfaces.log.RichfacesLogger;
+
import org.slf4j.Logger;
/**
@@ -37,56 +43,58 @@
* @since 4.0
*/
final class PropertyUtils {
+ private static final PropertyDescriptor[] EMPTY_DESCRIPTORS_ARRAY = new
PropertyDescriptor[0];
+ private static final Logger LOGGER = RichfacesLogger.APPLICATION.getLogger();
- private static final PropertyDescriptor[] EMPTY_DESCRIPTORS_ARRAY = new
PropertyDescriptor[0];
-
- private static final Logger LOGGER = RichfacesLogger.APPLICATION.getLogger();
-
- private PropertyUtils() {
- //private constructor of pure utility methods class
- }
-
- public static PropertyDescriptor[] getPropertyDescriptors(Object bean) {
- if (bean == null) {
- throw new IllegalArgumentException("argument is null");
- }
-
- PropertyDescriptor[] descriptors = null;
- try {
- //TODO - cache introspection info?
- BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass());
- descriptors = beanInfo.getPropertyDescriptors();
- } catch (IntrospectionException e) {
- LOGGER.error(e.getMessage(), e);
- }
-
- if (descriptors == null) {
- descriptors = EMPTY_DESCRIPTORS_ARRAY;
- }
-
- return descriptors;
- }
-
- public static Object readPropertyValue(Object bean, PropertyDescriptor descriptor)
throws Exception {
- Method readMethod = descriptor.getReadMethod();
- if (readMethod == null) {
- throw new NoSuchMethodException(MessageFormat.format("Read method for property
''{0}'' not found",
- descriptor.getName()));
- }
-
- try {
- return readMethod.invoke(bean);
- } catch (InvocationTargetException e) {
- Throwable cause = e.getCause();
- if (cause instanceof Exception) {
- throw (Exception) cause;
- } else if (cause instanceof Error) {
- throw (Error) cause;
- } else {
- throw e;
- }
- }
- }
-
+ private PropertyUtils() {
+ // private constructor of pure utility methods class
+ }
+
+ public static PropertyDescriptor[] getPropertyDescriptors(Object bean) {
+ if (bean == null) {
+ throw new IllegalArgumentException("argument is null");
+ }
+
+ PropertyDescriptor[] descriptors = null;
+
+ try {
+
+ // TODO - cache introspection info?
+ BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass());
+
+ descriptors = beanInfo.getPropertyDescriptors();
+ } catch (IntrospectionException e) {
+ LOGGER.error(e.getMessage(), e);
+ }
+
+ if (descriptors == null) {
+ descriptors = EMPTY_DESCRIPTORS_ARRAY;
+ }
+
+ return descriptors;
+ }
+
+ public static Object readPropertyValue(Object bean, PropertyDescriptor descriptor)
throws Exception {
+ Method readMethod = descriptor.getReadMethod();
+
+ if (readMethod == null) {
+ throw new NoSuchMethodException(MessageFormat.format("Read method for
property ''{0}'' not found",
+ descriptor.getName()));
+ }
+
+ try {
+ return readMethod.invoke(bean);
+ } catch (InvocationTargetException e) {
+ Throwable cause = e.getCause();
+
+ if (cause instanceof Exception) {
+ throw(Exception) cause;
+ } else if (cause instanceof Error) {
+ throw(Error) cause;
+ } else {
+ throw e;
+ }
+ }
+ }
}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/ResponseWriterWrapper.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/ResponseWriterWrapper.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/ResponseWriterWrapper.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.javascript;
import java.io.IOException;
@@ -27,62 +29,59 @@
import javax.faces.context.ResponseWriter;
final class ResponseWriterWrapper extends Writer {
+ private static final int BUFFER_SIZE = 1024;
+ private final ResponseWriter responseWriter;
+ private char[] writeBuffer;
- private static final int BUFFER_SIZE = 1024;
+ ResponseWriterWrapper(ResponseWriter responseWriter) {
+ this.responseWriter = responseWriter;
+ }
- private final ResponseWriter responseWriter;
+ @Override
+ public void close() throws IOException {
+ responseWriter.close();
+ }
- private char[] writeBuffer;
+ @Override
+ public void flush() throws IOException {
+ responseWriter.flush();
+ }
- ResponseWriterWrapper(ResponseWriter responseWriter) {
- this.responseWriter = responseWriter;
- }
+ @Override
+ public void write(char[] cbuf, int off, int len) throws IOException {
+ responseWriter.writeText(cbuf, off, len);
+ }
- @Override
- public void close() throws IOException {
- responseWriter.close();
- }
+ @Override
+ public void write(String str) throws IOException {
+ responseWriter.writeText(str, null);
+ }
- @Override
- public void flush() throws IOException {
- responseWriter.flush();
- }
+ @Override
+ public void write(String str, int off, int len) throws IOException {
+ char[] cbuf;
- @Override
- public void write(char[] cbuf, int off, int len) throws IOException {
- responseWriter.writeText(cbuf, off, len);
- }
+ if (len <= BUFFER_SIZE) {
+ if (writeBuffer == null) {
+ writeBuffer = new char[BUFFER_SIZE];
+ }
- @Override
- public void write(String str) throws IOException {
- responseWriter.writeText(str, null);
- }
+ cbuf = writeBuffer;
+ } else {
+ cbuf = new char[len];
+ }
- @Override
- public void write(String str, int off, int len) throws IOException {
- char cbuf[];
- if (len <= BUFFER_SIZE) {
- if (writeBuffer == null) {
- writeBuffer = new char[BUFFER_SIZE];
- }
-
- cbuf = writeBuffer;
- } else {
- cbuf = new char[len];
- }
+ str.getChars(off, off + len, cbuf, 0);
+ responseWriter.writeText(cbuf, 0, len);
+ }
- str.getChars(off, off + len, cbuf, 0);
-
- responseWriter.writeText(cbuf, 0, len);
- }
+ @Override
+ public void write(int c) throws IOException {
+ if (writeBuffer == null) {
+ writeBuffer = new char[BUFFER_SIZE];
+ }
- @Override
- public void write(int c) throws IOException {
- if (writeBuffer == null){
- writeBuffer = new char[BUFFER_SIZE];
- }
- writeBuffer[0] = (char) c;
-
- responseWriter.writeText(writeBuffer, 0, 1);
- }
-}
\ No newline at end of file
+ writeBuffer[0] = (char) c;
+ responseWriter.writeText(writeBuffer, 0, 1);
+ }
+}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/ScriptString.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/ScriptString.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/ScriptString.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,26 +19,26 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.javascript;
-
/**
* @author shura (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:32 $
*
*/
-public interface ScriptString
-{
+public interface ScriptString {
/**
* Return object content as JavaScript String.
* @return
*/
- public abstract String toScript();
+ public abstract String toScript();
/**
* Append JavaScript code to @link StringBuffer
* @param functionString
*/
public void appendScript(StringBuffer functionString);
-}
\ No newline at end of file
+}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/ScriptStringBase.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/ScriptStringBase.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/ScriptStringBase.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.javascript;
/**
@@ -26,25 +28,20 @@
* @version $Revision: 1.1.2.2 $ $Date: 2007/01/26 10:38:52 $
*
*/
-public abstract class ScriptStringBase implements ScriptString
-{
-
-
-
-
-
- public String toScript()
- {
+public abstract class ScriptStringBase implements ScriptString {
+ public String toScript() {
StringBuffer functionString = new StringBuffer();
+
appendScript(functionString);
+
return functionString.toString();
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString() {
- return toScript();
+ return toScript();
}
-
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,13 +19,18 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.javascript;
import java.beans.PropertyDescriptor;
+
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
+
import java.lang.reflect.Array;
+
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
@@ -36,236 +41,268 @@
/**
* @author shura (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.3 $ $Date: 2007/01/24 13:22:31 $
- *
*/
-public class ScriptUtils {
+public final class ScriptUtils {
- /**
- * This is utility class, don't instantiate.
- */
- private ScriptUtils() {
- }
+ /**
+ * This is utility class, don't instantiate.
+ */
+ private ScriptUtils() {}
- private static void writeScriptToStream(Writer writer, Object obj) throws IOException {
- if (null == obj) {
- writer.write("null");
- } else if (obj instanceof ScriptString) {
- writer.write(((ScriptString) obj).toScript());
- } else if (obj.getClass().isArray()) {
- writer.write("[");
- boolean first = true;
- for (int i = 0; i < Array.getLength(obj); i++) {
- Object element = Array.get(obj, i);
- if (!first) {
- writer.write(',');
- }
- writeScriptToStream(writer, element);
- first = false;
- }
-
- writer.write("] ");
- } else if (obj instanceof Collection<?>) {
- // Collections put as JavaScript array.
-
- @SuppressWarnings("unchecked")
- Collection<Object> collection = (Collection<Object>) obj;
-
- writer.write("[");
- boolean first = true;
- for (Iterator<Object> iter = collection.iterator(); iter.hasNext();) {
- Object element = iter.next();
- if (!first) {
- writer.write(',');
- }
- writeScriptToStream(writer, element);
- first = false;
- }
- writer.write("] ");
- } else if (obj instanceof Map<?, ?>) {
-
- // Maps put as JavaScript hash.
- @SuppressWarnings("unchecked")
- Map<Object, Object> map = (Map<Object, Object>) obj;
+ private static void writeScriptToStream(Writer writer, Object obj) throws IOException
{
+ if (null == obj) {
+ writer.write("null");
+ } else if (obj instanceof ScriptString) {
+ writer.write(((ScriptString) obj).toScript());
+ } else if (obj.getClass().isArray()) {
+ writer.write("[");
- writer.write("{");
- boolean first = true;
- for (Map.Entry<Object, Object> entry : map.entrySet()) {
- if (!first) {
- writer.write(',');
- }
-
- writeEncodedString(writer, entry.getKey());
- writer.write(":");
- writeScriptToStream(writer, entry.getValue());
- first = false;
- }
- writer.write("} ");
- } else if (obj instanceof Number || obj instanceof Boolean) {
- // numbers and boolean put as-is, without conversion
- writer.write(obj.toString());
- } else if (obj instanceof String) {
- // all other put as encoded strings.
- writeEncodedString(writer, obj);
+ boolean first = true;
+
+ for (int i = 0; i < Array.getLength(obj); i++) {
+ Object element = Array.get(obj, i);
+
+ if (!first) {
+ writer.write(',');
+ }
+
+ writeScriptToStream(writer, element);
+ first = false;
+ }
+
+ writer.write("] ");
+ } else if (obj instanceof Collection<?>) {
+
+ // Collections put as JavaScript array.
+ @SuppressWarnings("unchecked") Collection<Object> collection
= (Collection<Object>) obj;
+
+ writer.write("[");
+
+ boolean first = true;
+
+ for (Iterator<Object> iter = collection.iterator(); iter.hasNext(); )
{
+ Object element = iter.next();
+
+ if (!first) {
+ writer.write(',');
+ }
+
+ writeScriptToStream(writer, element);
+ first = false;
+ }
+
+ writer.write("] ");
+ } else if (obj instanceof Map<?, ?>) {
+
+ // Maps put as JavaScript hash.
+ @SuppressWarnings("unchecked") Map<Object, Object> map =
(Map<Object, Object>) obj;
+
+ writer.write("{");
+
+ boolean first = true;
+
+ for (Map.Entry<Object, Object> entry : map.entrySet()) {
+ if (!first) {
+ writer.write(',');
+ }
+
+ writeEncodedString(writer, entry.getKey());
+ writer.write(":");
+ writeScriptToStream(writer, entry.getValue());
+ first = false;
+ }
+
+ writer.write("} ");
+ } else if (obj instanceof Number || obj instanceof Boolean) {
+
+ // numbers and boolean put as-is, without conversion
+ writer.write(obj.toString());
+ } else if (obj instanceof String) {
+
+ // all other put as encoded strings.
+ writeEncodedString(writer, obj);
} else if (obj instanceof Enum<?>) {
+
// all other put as encoded strings.
writeEncodedString(writer, obj);
} else {
- // All other objects threaded as Java Beans.
+
+ // All other objects threaded as Java Beans.
writer.write("{");
PropertyDescriptor[] propertyDescriptors;
+
try {
propertyDescriptors = PropertyUtils.getPropertyDescriptors(obj);
} catch (Exception e) {
- throw new FacesException(
- "Error in conversion Java Object to JavaScript", e);
+ throw new FacesException("Error in conversion Java Object to
JavaScript", e);
}
boolean ignorePropertyReadException =
obj.getClass().getName().startsWith("java.sql.");
boolean first = true;
-
+
for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
String key = propertyDescriptor.getName();
+
if ("class".equals(key)) {
continue;
}
Object propertyValue;
- try{
- propertyValue = PropertyUtils.readPropertyValue(obj,
propertyDescriptor);
+
+ try {
+ propertyValue = PropertyUtils.readPropertyValue(obj,
propertyDescriptor);
} catch (Exception e) {
- if (!ignorePropertyReadException) {
- throw new FacesException(
- "Error in conversion Java Object to
JavaScript", e);
- } else {
- continue;
- }
+ if (!ignorePropertyReadException) {
+ throw new FacesException("Error in conversion Java Object to
JavaScript", e);
+ } else {
+ continue;
+ }
}
if (!first) {
writer.write(',');
}
+
writeEncodedString(writer, key);
writer.write(":");
- writeScriptToStream(writer, propertyValue);
+ writeScriptToStream(writer, propertyValue);
first = false;
}
writer.write("} ");
}
- }
-
- /**
- * Convert any Java Object to JavaScript representation ( as possible ) and write it to
- * writer immediately
- *
- * @param responseWriter
- * @param obj
- * @throws IOException
- */
- public static void writeToStream(final ResponseWriter responseWriter, Object obj) throws
IOException {
- writeScriptToStream(new ResponseWriterWrapper(responseWriter), obj);
- }
-
- /**
- * Convert any Java Object to JavaScript representation ( as possible ).
- * @param obj
- * @return
- */
- public static String toScript(Object obj) {
- StringBuilder sb = new StringBuilder();
- try {
- writeScriptToStream(new StringBuilderWriter(sb), obj);
- } catch (IOException e) {
- //ignore
- }
- return sb.toString();
- }
+ }
- public static void writeEncodedString(Writer w, Object obj) throws IOException {
- w.write("'");
- writeEncoded(w, obj);
- w.write("'");
- }
-
- public static void addEncodedString(StringBuilder buff, Object obj) {
- try {
- writeEncodedString(new StringBuilderWriter(buff), obj);
- } catch (IOException e) {
- //ignore
- }
- }
+ /**
+ * Convert any Java Object to JavaScript representation ( as possible ) and write it
to
+ * writer immediately
+ *
+ * @param responseWriter
+ * @param obj
+ * @throws IOException
+ */
+ public static void writeToStream(final ResponseWriter responseWriter, Object obj)
throws IOException {
+ writeScriptToStream(new ResponseWriterWrapper(responseWriter), obj);
+ }
- public static void writeEncoded(Writer w, Object obj) throws IOException {
- JSEncoder encoder = new JSEncoder();
- char chars[] = obj.toString().toCharArray();
- for (int i = 0; i < chars.length; i++) {
- char c = chars[i];
- if (!encoder.compile(c)) {
- w.write(encoder.encode(c));
- } else {
- w.write(c);
- }
- }
- }
-
- public static void addEncoded(StringBuilder buff, Object obj) {
- try {
- writeEncoded(new StringBuilderWriter(buff), obj);
- } catch (IOException e) {
- //ignore
- }
- }
+ /**
+ * Convert any Java Object to JavaScript representation ( as possible ).
+ *
+ * @param obj
+ * @return
+ */
+ public static String toScript(Object obj) {
+ StringBuilder sb = new StringBuilder();
- public static String getValidJavascriptName(String s) {
-
- StringBuffer buf = null;
- for (int i = 0, len = s.length(); i < len; i++) {
- char c = s.charAt(i);
-
- if (Character.isLetterOrDigit(c)||c=='_' ) {
- // allowed char
- if (buf != null)
- buf.append(c);
- } else {
- if (buf == null) {
- buf = new StringBuffer(s.length() + 10);
- buf.append(s.substring(0, i));
- }
-
- buf.append('_');
- if (c < 16) {
- // pad single hex digit values with '0' on the left
- buf.append('0');
- }
-
- if (c < 128) {
- // first 128 chars match their byte representation in UTF-8
- buf.append(Integer.toHexString(c).toUpperCase());
- } else {
- byte[] bytes;
- try {
- bytes = Character.toString(c).getBytes("UTF-8");
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
- }
-
- for (int j = 0; j < bytes.length; j++) {
- int intVal = bytes[j];
- if (intVal < 0) {
- // intVal will be >= 128
- intVal = 256 + intVal;
- } else if (intVal < 16) {
- // pad single hex digit values with '0' on the left
- buf.append('0');
- }
- buf.append(Integer.toHexString(intVal).toUpperCase());
- }
- }
- }
-
- }
-
- return buf == null ? s : buf.toString();
- }
+ try {
+ writeScriptToStream(new StringBuilderWriter(sb), obj);
+ } catch (IOException e) {
+
+ // ignore
+ }
+
+ return sb.toString();
+ }
+
+ public static void writeEncodedString(Writer w, Object obj) throws IOException {
+ w.write("'");
+ writeEncoded(w, obj);
+ w.write("'");
+ }
+
+ public static void addEncodedString(StringBuilder buff, Object obj) {
+ try {
+ writeEncodedString(new StringBuilderWriter(buff), obj);
+ } catch (IOException e) {
+
+ // ignore
+ }
+ }
+
+ public static void writeEncoded(Writer w, Object obj) throws IOException {
+ JSEncoder encoder = new JSEncoder();
+ char[] chars = obj.toString().toCharArray();
+
+ for (int i = 0; i < chars.length; i++) {
+ char c = chars[i];
+
+ if (!encoder.compile(c)) {
+ w.write(encoder.encode(c));
+ } else {
+ w.write(c);
+ }
+ }
+ }
+
+ public static void addEncoded(StringBuilder buff, Object obj) {
+ try {
+ writeEncoded(new StringBuilderWriter(buff), obj);
+ } catch (IOException e) {
+
+ // ignore
+ }
+ }
+
+ public static String getValidJavascriptName(String s) {
+ StringBuffer buf = null;
+ final int len = s.length();
+
+ for (int i = 0; i < len; i++) {
+ char c = s.charAt(i);
+
+ if (Character.isLetterOrDigit(c) || c == '_') {
+
+ // allowed char
+ if (buf != null) {
+ buf.append(c);
+ }
+ } else {
+ if (buf == null) {
+ buf = new StringBuffer(s.length() + 10);
+ buf.append(s.substring(0, i));
+ }
+
+ buf.append('_');
+
+ if (c < 16) {
+
+ // pad single hex digit values with '0' on the left
+ buf.append('0');
+ }
+
+ if (c < 128) {
+
+ // first 128 chars match their byte representation in UTF-8
+ buf.append(Integer.toHexString(c).toUpperCase());
+ } else {
+ byte[] bytes;
+
+ try {
+ bytes = Character.toString(c).getBytes("UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ }
+
+ for (int j = 0; j < bytes.length; j++) {
+ int intVal = bytes[j];
+
+ if (intVal < 0) {
+
+ // intVal will be >= 128
+ intVal = 256 + intVal;
+ } else if (intVal < 16) {
+
+ // pad single hex digit values with '0' on the left
+ buf.append('0');
+ }
+
+ buf.append(Integer.toHexString(intVal).toUpperCase());
+ }
+ }
+ }
+ }
+
+ return buf == null ? s : buf.toString();
+ }
}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/StringBuilderWriter.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/StringBuilderWriter.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/StringBuilderWriter.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.javascript;
import java.io.IOException;
@@ -29,56 +31,58 @@
* @since 3.3.2
*/
final class StringBuilderWriter extends Writer {
+ private StringBuilder builder;
- private StringBuilder builder;
-
- public StringBuilderWriter(StringBuilder builder) {
- super();
- this.builder = builder;
- }
+ public StringBuilderWriter(StringBuilder builder) {
+ super();
+ this.builder = builder;
+ }
- /**
- * Closing this writer doesn't have any effect
- */
- @Override
- public void close() throws IOException {
- //do nothing
- }
+ /**
+ * Closing this writer doesn't have any effect
+ */
+ @Override
+ public void close() throws IOException {
- /* (non-Javadoc)
- * @see java.io.Writer#flush()
- */
- @Override
- public void flush() throws IOException {
- //do nothing
- }
+ // do nothing
+ }
- /* (non-Javadoc)
- * @see java.io.Writer#write(char[], int, int)
- */
- @Override
- public void write(char[] cbuf, int off, int len) throws IOException {
- builder.append(cbuf, off, len);
- }
+ /*
+ * (non-Javadoc)
+ * @see java.io.Writer#flush()
+ */
+ @Override
+ public void flush() throws IOException {
- @Override
- public void write(char[] cbuf) throws IOException {
- builder.append(cbuf);
- }
-
- @Override
- public void write(String str) throws IOException {
- builder.append(str);
- }
-
- @Override
- public void write(String str, int off, int len) throws IOException {
- builder.append(str, off, off + len);
- }
-
- @Override
- public void write(int c) throws IOException {
- builder.append((char) c);
- }
-
+ // do nothing
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.Writer#write(char[], int, int)
+ */
+ @Override
+ public void write(char[] cbuf, int off, int len) throws IOException {
+ builder.append(cbuf, off, len);
+ }
+
+ @Override
+ public void write(char[] cbuf) throws IOException {
+ builder.append(cbuf);
+ }
+
+ @Override
+ public void write(String str) throws IOException {
+ builder.append(str);
+ }
+
+ @Override
+ public void write(String str, int off, int len) throws IOException {
+ builder.append(str, off, off + len);
+ }
+
+ @Override
+ public void write(int c) throws IOException {
+ builder.append((char) c);
+ }
}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/package-info.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/package-info.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/javascript/package-info.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -1,3 +1,4 @@
+
/**
* Classes and interfaces that ease creation of client-side Javascript code
*/
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/DataComponentState.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/DataComponentState.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/DataComponentState.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,23 +19,24 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.model;
-
/**
* Interface for classes keeped current iterable component state, as :
* active data objects range
* sorting order
* tree nodes expanded state
- *
+ *
* @author shura
*
*/
-public interface DataComponentState {
+public interface DataComponentState {
- /**
- * Build used data objects range for iteration.
- * @return
- */
- public abstract Range getRange();
+ /**
+ * Build used data objects range for iteration.
+ * @return
+ */
+ public abstract Range getRange();
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/model/DataVisitResult.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/DataVisitResult.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/DataVisitResult.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,13 +19,13 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
+
+
+
package org.ajax4jsf.model;
/**
* @author Nick Belaevski
- *
+ *
*/
-public enum DataVisitResult {
-
- CONTINUE, STOP;
-}
+public enum DataVisitResult {CONTINUE, STOP}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/model/DataVisitor.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/model/DataVisitor.java 2009-11-01
16:34:11 UTC (rev 15797)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/model/DataVisitor.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.model;
import javax.faces.context.FacesContext;
@@ -29,14 +31,13 @@
*
*/
public interface DataVisitor {
-
- /**
- * This method called back ( as visitor ) from {@link
ExtendedDataModel#walk(FacesContext, DataVisitor, Range)} for
- * each row.
- * @param context current JSF context.
- * @param rowKey current row key of DataModel
- * @param argument Implementation-specific argument
- */
- public DataVisitResult process(FacesContext context,Object rowKey, Object argument);
+ /**
+ * This method called back ( as visitor ) from {@link
ExtendedDataModel#walk(FacesContext, DataVisitor, Range)} for
+ * each row.
+ * @param context current JSF context.
+ * @param rowKey current row key of DataModel
+ * @param argument Implementation-specific argument
+ */
+ public DataVisitResult process(FacesContext context, Object rowKey, Object
argument);
}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/ExtendedDataModel.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/ExtendedDataModel.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/ExtendedDataModel.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,11 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.model;
-import java.io.IOException;
-import java.io.Serializable;
-
import javax.faces.context.FacesContext;
import javax.faces.model.DataModel;
@@ -34,50 +33,52 @@
*
*/
public abstract class ExtendedDataModel<E> extends DataModel<E> {
-
- /**
- * <p>Instead of simple <code>int</code> for current state selection,
this model can use any object for
- * select current data. Implementation depend on model, with any restrictions
:</p>
- * <ol>
- * <li> key must be {@link Serializable}.</li>
- * <li>{@link Object#toString()} method must return representation compatible with
{@link javax.faces.component.UIComponent#getClientId(javax.faces.context.FacesContext)},
- * as far as this string will be appended to clientId of iterator component.</li>
- * </ol>
- * @param key key for select current data, or null for clear selection.
- */
- public abstract void setRowKey(Object key);
-
- /**
- * @return key for selected data or <code>null</code>
- */
- public abstract Object getRowKey();
-
- /**
- * Iteration component can support save data for use at decoding/validation/update
phases to avoid unnessesary calls to original models,
- * for example - to avoid requests to database until all data is validated.
- * @return
- */
- public SerializableDataModel getSerializableModel(Range range){
- // By default, model not serializable.
- return null;
- }
-
-
- /**
- * Iterate over model by "visitor" pattern, for given range
- * @param context current JSF context.
- * @param visitor instance of {@link DataVisitor}, for process each row.
- * @param range Implementation-specific range of data keys.
- * @param argument Implementation-specific argument
- * @throws IOException
- */
- public abstract void walk(FacesContext context,DataVisitor visitor,Range range, Object
argument);
-
- /**
- * Create Iterator on all row keys for given range.
- * @param range - Implementation-specific range of data keys.
- * @return
- */
-// public abstract Iterator dataIterator(Range range);
+ /**
+ * <p>Instead of simple <code>int</code> for current state
selection, this model can use any object for
+ * select current data. Implementation depend on model, with any restrictions
:</p>
+ * <ol>
+ * <li> key must be {@link java.io.Serializable}.</li>
+ * <li>{@link Object#toString()} method must return representation compatible
with
+ * {@link
javax.faces.component.UIComponent#getClientId(javax.faces.context.FacesContext)},
+ * as far as this string will be appended to clientId of iterator
component.</li>
+ * </ol>
+ * @param key key for select current data, or null for clear selection.
+ */
+ public abstract void setRowKey(Object key);
+
+ /**
+ * @return key for selected data or <code>null</code>
+ */
+ public abstract Object getRowKey();
+
+ /**
+ * Iteration component can support save data for use at decoding/validation/update
phases to avoid
+ * unnessesary calls to original models,
+ * for example - to avoid requests to database until all data is validated.
+ * @return
+ */
+ public SerializableDataModel getSerializableModel(Range range) {
+
+ // By default, model not serializable.
+ return null;
+ }
+
+ /**
+ * Iterate over model by "visitor" pattern, for given range
+ * @param context current JSF context.
+ * @param visitor instance of {@link DataVisitor}, for process each row.
+ * @param range Implementation-specific range of data keys.
+ * @param argument Implementation-specific argument
+ * @throws java.io.IOException
+ */
+ public abstract void walk(FacesContext context, DataVisitor visitor, Range range,
Object argument);
+
+ /**
+ * Create Iterator on all row keys for given range.
+ * @param range - Implementation-specific range of data keys.
+ * @return
+ */
+
+// public abstract Iterator dataIterator(Range range);
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/model/KeepAlive.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/model/KeepAlive.java 2009-11-01
16:34:11 UTC (rev 15797)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/model/KeepAlive.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -18,6 +18,9 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
+
package org.ajax4jsf.model;
import java.lang.annotation.Documented;
@@ -36,11 +39,11 @@
@Documented
public @interface KeepAlive {
- /**
- * Boolean attribute indicating whether kept beans are accessible for all requests or
AJAX-only.
- *
- * @return
- * @since 3.2.2
- */
- boolean ajaxOnly() default false;
+ /**
+ * Boolean attribute indicating whether kept beans are accessible for all requests or
AJAX-only.
+ *
+ * @return
+ * @since 3.2.2
+ */
+ boolean ajaxOnly() default false;
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/model/Range.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/model/Range.java 2009-11-01
16:34:11 UTC (rev 15797)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/model/Range.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.model;
/**
@@ -28,6 +30,4 @@
* @author shura
*
*/
-public interface Range {
-
-}
+public interface Range {}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/model/RepeatState.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/model/RepeatState.java 2009-11-01
16:34:11 UTC (rev 15797)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/model/RepeatState.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,21 +19,20 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.ajax4jsf.model;
+package org.ajax4jsf.model;
+
/**
* @author shura
*
*/
public abstract class RepeatState implements DataComponentState {
+ public abstract int getFirst();
- public abstract int getFirst();
-
- public abstract int getRows();
-
- public Range getRange() {
- return new SequenceRange(getFirst(), getRows());
- }
+ public abstract int getRows();
+ public Range getRange() {
+ return new SequenceRange(getFirst(), getRows());
+ }
}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/SequenceDataModel.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/SequenceDataModel.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/SequenceDataModel.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.model;
import javax.faces.context.FacesContext;
@@ -29,179 +31,198 @@
*
*/
public class SequenceDataModel extends ExtendedDataModel {
-
- private DataModel wrappedModel;
+ private DataModel wrappedModel;
- /**
- * @param wrapped
- */
- public SequenceDataModel(DataModel wrapped) {
- super();
- this.wrappedModel = wrapped;
- }
+ /**
+ * @param wrapped
+ */
+ public SequenceDataModel(DataModel wrapped) {
+ super();
+ this.wrappedModel = wrapped;
+ }
- /* (non-Javadoc)
- * @see
org.ajax4jsf.ajax.repeat.ExtendedDataModel#dataIterator(org.ajax4jsf.ajax.repeat.Range)
- */
-/* public Iterator dataIterator(Range range) {
- final SequenceRange seqRange = (SequenceRange) range;
- int rows = seqRange.getRows();
- int rowCount = wrapped.getRowCount();
- final int firstRow = seqRange.getFirstRow();
- if(rows > 0){
- rows += firstRow;
- if(rowCount >=0){
- rows = Math.min(rows, rowCount);
- }
- } else if(rowCount >=0 ){
- rows = rowCount;
- }
- final int maxRow = rows;
- return new Iterator(){
-
- int rowIndex = firstRow;
+ /*
+ * (non-Javadoc)
+ * @see
org.ajax4jsf.ajax.repeat.ExtendedDataModel#dataIterator(org.ajax4jsf.ajax.repeat.Range)
+ */
- public boolean hasNext() {
- // TODO Auto-generated method stub
- return maxRow < 0 || rowIndex < maxRow;
- }
+/* public Iterator dataIterator(Range range) {
+ final SequenceRange seqRange = (SequenceRange) range;
+ int rows = seqRange.getRows();
+ int rowCount = wrapped.getRowCount();
+ final int firstRow = seqRange.getFirstRow();
+ if(rows > 0){
+ rows += firstRow;
+ if(rowCount >=0){
+ rows = Math.min(rows, rowCount);
+ }
+ } else if(rowCount >=0 ){
+ rows = rowCount;
+ }
+ final int maxRow = rows;
+ return new Iterator(){
- public Object next() {
- // TODO Auto-generated method stub
- return new Integer(rowIndex++);
- }
+ int rowIndex = firstRow;
- public void remove() {
- throw new IllegalStateException();
- }
-
- };
- }
-*/
- public void walk(FacesContext context, DataVisitor visitor, Range range, Object
argument) {
- final SequenceRange seqRange = (SequenceRange) range;
- int rows = seqRange.getRows();
- int rowCount = wrappedModel.getRowCount();
- int currentRow = seqRange.getFirstRow();
- if(rows > 0){
- rows += currentRow;
- if(rowCount >=0){
- rows = Math.min(rows, rowCount);
- }
- } else if(rowCount >=0 ){
- rows = rowCount;
- } else {
- rows = -1;
- }
-
- DataVisitResult visitResult = null;
-
- while (rows < 0 || currentRow < rows) {
- wrappedModel.setRowIndex(currentRow);
- if (wrappedModel.isRowAvailable()) {
- visitResult = visitor.process(context, new Integer(currentRow), argument);
-
- if (DataVisitResult.STOP.equals(visitResult)) {
- break;
- }
- } else {
- break;
- }
- currentRow++;
- }
-
- }
+ public boolean hasNext() {
+ // TODO Auto-generated method stub
+ return maxRow < 0 || rowIndex < maxRow;
+ }
- /* (non-Javadoc)
- * @see org.ajax4jsf.ajax.repeat.ExtendedDataModel#getRowKey()
- */
- public Object getRowKey() {
- int index = wrappedModel.getRowIndex();
- if(index<0){
- return null;
- }
- return new Integer(index);
- }
+ public Object next() {
+ // TODO Auto-generated method stub
+ return new Integer(rowIndex++);
+ }
+ public void remove() {
+ throw new IllegalStateException();
+ }
- /* (non-Javadoc)
- * @see org.ajax4jsf.ajax.repeat.ExtendedDataModel#setRowKey(java.lang.Object)
- */
- public void setRowKey(Object key) {
- if(null == key){
- wrappedModel.setRowIndex(-1);
- } else {
- Integer index = (Integer) key;
- wrappedModel.setRowIndex(index.intValue());
- }
- }
+ };
+ }
+*/
+ public void walk(FacesContext context, DataVisitor visitor, Range range, Object
argument) {
+ final SequenceRange seqRange = (SequenceRange) range;
+ int rows = seqRange.getRows();
+ int rowCount = wrappedModel.getRowCount();
+ int currentRow = seqRange.getFirstRow();
- /* (non-Javadoc)
- * @see javax.faces.model.DataModel#getRowCount()
- */
- public int getRowCount() {
- // TODO Auto-generated method stub
- return wrappedModel.getRowCount();
- }
+ if (rows > 0) {
+ rows += currentRow;
- /* (non-Javadoc)
- * @see javax.faces.model.DataModel#getRowData()
- */
- public Object getRowData() {
- // TODO Auto-generated method stub
- return wrappedModel.getRowData();
- }
+ if (rowCount >= 0) {
+ rows = Math.min(rows, rowCount);
+ }
+ } else if (rowCount >= 0) {
+ rows = rowCount;
+ } else {
+ rows = -1;
+ }
- /* (non-Javadoc)
- * @see javax.faces.model.DataModel#getRowIndex()
- */
- public int getRowIndex() {
- // TODO Auto-generated method stub
- return wrappedModel.getRowIndex();
- }
+ DataVisitResult visitResult = null;
- /* (non-Javadoc)
- * @see javax.faces.model.DataModel#getWrappedData()
- */
- public Object getWrappedData() {
- // TODO Auto-generated method stub
- return wrappedModel.getWrappedData();
- }
+ while (rows < 0 || currentRow < rows) {
+ wrappedModel.setRowIndex(currentRow);
- /* (non-Javadoc)
- * @see javax.faces.model.DataModel#isRowAvailable()
- */
- public boolean isRowAvailable() {
- // TODO Auto-generated method stub
- return wrappedModel.isRowAvailable();
- }
+ if (wrappedModel.isRowAvailable()) {
+ visitResult = visitor.process(context, new Integer(currentRow),
argument);
- /* (non-Javadoc)
- * @see javax.faces.model.DataModel#setRowIndex(int)
- */
- public void setRowIndex(int rowIndex) {
- wrappedModel.setRowIndex(rowIndex);
- }
+ if (DataVisitResult.STOP.equals(visitResult)) {
+ break;
+ }
+ } else {
+ break;
+ }
- /* (non-Javadoc)
- * @see javax.faces.model.DataModel#setWrappedData(java.lang.Object)
- */
- public void setWrappedData(Object data) {
- wrappedModel.setWrappedData(data);
- }
+ currentRow++;
+ }
+ }
- /**
- * @return the wrappedModel
- */
- protected DataModel getWrappedModel() {
- return this.wrappedModel;
- }
+ /*
+ * (non-Javadoc)
+ * @see org.ajax4jsf.ajax.repeat.ExtendedDataModel#getRowKey()
+ */
+ public Object getRowKey() {
+ int index = wrappedModel.getRowIndex();
- /**
- * @param wrappedModel the wrappedModel to set
- */
- protected void setWrappedModel(DataModel wrappedModel) {
- this.wrappedModel = wrappedModel;
- }
+ if (index < 0) {
+ return null;
+ }
+ return new Integer(index);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.ajax4jsf.ajax.repeat.ExtendedDataModel#setRowKey(java.lang.Object)
+ */
+ public void setRowKey(Object key) {
+ if (null == key) {
+ wrappedModel.setRowIndex(-1);
+ } else {
+ Integer index = (Integer) key;
+
+ wrappedModel.setRowIndex(index.intValue());
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see javax.faces.model.DataModel#getRowCount()
+ */
+ public int getRowCount() {
+
+ // TODO Auto-generated method stub
+ return wrappedModel.getRowCount();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see javax.faces.model.DataModel#getRowData()
+ */
+ public Object getRowData() {
+
+ // TODO Auto-generated method stub
+ return wrappedModel.getRowData();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see javax.faces.model.DataModel#getRowIndex()
+ */
+ public int getRowIndex() {
+
+ // TODO Auto-generated method stub
+ return wrappedModel.getRowIndex();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see javax.faces.model.DataModel#getWrappedData()
+ */
+ public Object getWrappedData() {
+
+ // TODO Auto-generated method stub
+ return wrappedModel.getWrappedData();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see javax.faces.model.DataModel#isRowAvailable()
+ */
+ public boolean isRowAvailable() {
+
+ // TODO Auto-generated method stub
+ return wrappedModel.isRowAvailable();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see javax.faces.model.DataModel#setRowIndex(int)
+ */
+ public void setRowIndex(int rowIndex) {
+ wrappedModel.setRowIndex(rowIndex);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see javax.faces.model.DataModel#setWrappedData(java.lang.Object)
+ */
+ public void setWrappedData(Object data) {
+ wrappedModel.setWrappedData(data);
+ }
+
+ /**
+ * @return the wrappedModel
+ */
+ protected DataModel getWrappedModel() {
+ return this.wrappedModel;
+ }
+
+ /**
+ * @param wrappedModel the wrappedModel to set
+ */
+ protected void setWrappedModel(DataModel wrappedModel) {
+ this.wrappedModel = wrappedModel;
+ }
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/model/SequenceRange.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/SequenceRange.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/SequenceRange.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.model;
/**
@@ -26,48 +28,45 @@
*
*/
public class SequenceRange implements Range {
-
- private int firstRow = 0;
-
- private int rows = -1;
+ private int firstRow = 0;
+ private int rows = -1;
- /**
- * @return the firstRow
- */
- public int getFirstRow() {
- return firstRow;
- }
+ /**
+ *
+ */
+ protected SequenceRange() {
+ super();
+ }
- /**
- * @return the rows
- */
- public int getRows() {
- return rows;
- }
+ /**
+ * @param firstRow
+ * @param rows
+ */
+ public SequenceRange(int firstRow, int rows) {
+ super();
+ this.firstRow = firstRow;
+ this.rows = rows;
+ }
- /**
- *
- */
- protected SequenceRange() {
- super();
- }
-
- /**
- * @param firstRow
- * @param rows
- */
- public SequenceRange(int firstRow, int rows) {
- super();
- this.firstRow = firstRow;
- this.rows = rows;
- }
+ /**
+ * @return the firstRow
+ */
+ public int getFirstRow() {
+ return firstRow;
+ }
- protected void setFirstRow(int firstRow) {
- this.firstRow = firstRow;
- }
+ /**
+ * @return the rows
+ */
+ public int getRows() {
+ return rows;
+ }
- protected void setRows(int rows) {
- this.rows = rows;
- }
+ protected void setFirstRow(int firstRow) {
+ this.firstRow = firstRow;
+ }
+ protected void setRows(int rows) {
+ this.rows = rows;
+ }
}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/SerializableDataModel.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/SerializableDataModel.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/SerializableDataModel.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,22 +19,24 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.model;
import java.io.Serializable;
/**
* Serializable version of {@link ExtendedDataModel}, for save lightweight version of
data
- *
+ *
* @author shura
*
*/
@SuppressWarnings("serial")
public abstract class SerializableDataModel extends ExtendedDataModel implements
Serializable {
- /**
- * Method called after update all model values. For example, developer can update
- * database with new values of modified rows.
- */
- public abstract void update();
+ /**
+ * Method called after update all model values. For example, developer can update
+ * database with new values of modified rows.
+ */
+ public abstract void update();
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/model/package-info.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/model/package-info.java 2009-11-01
16:34:11 UTC (rev 15797)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/model/package-info.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -1,3 +1,4 @@
+
/**
* Various model objects APIs. Contains a set of extended data models classes
*/
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/package-info.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/package-info.java 2009-11-01
16:34:11 UTC (rev 15797)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/package-info.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -1,3 +1,4 @@
+
/**
* Base package for AJAX classes
*/
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/AjaxRenderer.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/AjaxRenderer.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/AjaxRenderer.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -18,9 +18,13 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
+
package org.ajax4jsf.renderkit;
import java.io.IOException;
+
import java.util.Set;
import javax.faces.component.UIComponent;
@@ -28,33 +32,31 @@
public interface AjaxRenderer {
- /**
- * Iterate over all childs of components. If component id contains in list ,
- * or, if list is empty, compotents is submitted form - render it. TODO -
- * Instead of calculate full path for every component, build current Path
- * for componet and send as parameter.
- *
- * @param context -
- * current context
- * @param component -
- * curent faces component.
- * @param ids -
- * list of Id to render.
- * @throws IOException
- */
- public void encodeAjaxChildren(FacesContext context, UIComponent component,
- String path, Set<String> ids, Set<String> renderedAreas) throws
IOException;
+ /**
+ * Iterate over all childs of components. If component id contains in list ,
+ * or, if list is empty, compotents is submitted form - render it. TODO -
+ * Instead of calculate full path for every component, build current Path
+ * for componet and send as parameter.
+ *
+ * @param context -
+ * current context
+ * @param component -
+ * curent faces component.
+ * @param ids -
+ * list of Id to render.
+ * @throws IOException
+ */
+ public void encodeAjaxChildren(FacesContext context, UIComponent component, String
path, Set<String> ids,
+ Set<String> renderedAreas) throws IOException;
- /**
- * @param context
- * @param component
- * @param currentPath
- * @param ids
- * @param renderedAreas
- * @throws IOException
- */
- public void encodeAjaxComponent(FacesContext context,
- UIComponent component, String currentPath, Set<String> ids,
- Set<String> renderedAreas) throws IOException;
-
-}
\ No newline at end of file
+ /**
+ * @param context
+ * @param component
+ * @param currentPath
+ * @param ids
+ * @param renderedAreas
+ * @throws IOException
+ */
+ public void encodeAjaxComponent(FacesContext context, UIComponent component, String
currentPath, Set<String> ids,
+ Set<String> renderedAreas) throws IOException;
+}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/package-info.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/package-info.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/package-info.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -1,3 +1,4 @@
+
/**
* Classes and interface participating in component rendering process
*/
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/InternetResource.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/InternetResource.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/InternetResource.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,10 +19,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.resource;
import java.io.IOException;
import java.io.InputStream;
+
import java.util.Date;
import java.util.Map;
@@ -33,163 +36,156 @@
* All instances must work in two phases - render page ( application set HTML code and
attributes to reference resource )
* and in concrete request to resource body.
* For best performance, preffer to realise it as "lightweght" pattern.
- *
+ *
* @author asmirnov(a)exadel.com (latest modification by $Author: nick_belaevski $)
* @version $Revision: 1.1.2.2 $ $Date: 2007/01/11 16:52:15 $
*
*/
public interface InternetResource {
+ public static final String CODEC_ATTR = "org.ajax4jsf.resource.CODEC";
+ public static final String DATA_SEPARATOR = "/DATA/";
+ public static final String DEFAULT_EXPITE_PARAMETER =
"org.ajax4jsf.DEFAULT_EXPIRE";
+ public static final int DEFAULT_TTL = 60 * 60 * 24; // 1 day
+ public static final String ENCODE_PASS_PARAMETER =
"org.ajax4jsf.ENCRYPT_PASSWORD";
+ public static final String ENCODE_URI_PARAMETER =
"org.ajax4jsf.ENCRYPT_RESOURCE_DATA";
+ public static final String RESOURCE_PROTOCOL = "resource";
+ public static final String RESOURCE_URI_PREFIX = "resource://";
+ public static final int RESOURCE_URI_PREFIX_LENGTH = RESOURCE_URI_PREFIX.length();
+ public static final long DEFAULT_EXPIRE = 1000L * DEFAULT_TTL; // 1 day
- public static final String ENCODE_URI_PARAMETER =
"org.ajax4jsf.ENCRYPT_RESOURCE_DATA";
- public static final String ENCODE_PASS_PARAMETER =
"org.ajax4jsf.ENCRYPT_PASSWORD";
- public static final String CODEC_ATTR = "org.ajax4jsf.resource.CODEC";
-
- public static final String RESOURCE_PROTOCOL = "resource";
- public static final String RESOURCE_URI_PREFIX = "resource://";
- public static final int RESOURCE_URI_PREFIX_LENGTH = RESOURCE_URI_PREFIX.length();
- public static final String DATA_SEPARATOR = "/DATA/";
+ /**
+ * @param resourceContext current {@link ResourceContext}
+ * @return Returns the contentLength.
+ */
+ public int getContentLength(ResourceContext resourceContext);
- static public final int DEFAULT_TTL = 60 * 60 * 24;// 1 day
- static public final long DEFAULT_EXPIRE = 1000L * DEFAULT_TTL;// 1 day
+ /**
+ * @param resourceContext current {@link ResourceContext}
+ * @return Returns the expired.
+ */
+ public long getExpired(ResourceContext resourceContext);
- public static final String DEFAULT_EXPITE_PARAMETER =
"org.ajax4jsf.DEFAULT_EXPIRE";
- /**
- * @param resourceContext current {@link ResourceContext}
- * @return Returns the contentLength.
- */
- public int getContentLength(ResourceContext resourceContext);
+ /**
+ * @param resourceContext current {@link ResourceContext}
+ * @return Returns the lastModified.
+ */
+ public Date getLastModified(ResourceContext resourceContext);
- /**
- * @param resourceContext current {@link ResourceContext}
- * @return Returns the expired.
- */
- public long getExpired(ResourceContext resourceContext);
+ /**
+ * @param resourceContext current {@link ResourceContext}
+ * @return Returns the cacheable.
+ */
+ public boolean isCacheable(ResourceContext resourceContext);
- /**
- * @param resourceContext current {@link ResourceContext}
- * @return Returns the lastModified.
- */
- public Date getLastModified(ResourceContext resourceContext);
+ /**
+ * @param resourceContext current {@link ResourceContext}
+ * @return Returns the mimeType.
+ */
+ public String getContentType(ResourceContext resourceContext);
- /**
- * @param resourceContext current {@link ResourceContext}
- * @return Returns the cacheable.
- */
- public boolean isCacheable(ResourceContext resourceContext);
+ /**
+ * @param context TODO
+ * @return input stream with resource
+ */
+ public InputStream getResourceAsStream(ResourceContext context);
- /**
- * @param resourceContext current {@link ResourceContext}
- * @return Returns the mimeType.
- */
- public String getContentType(ResourceContext resourceContext);
+ /**
+ * @return string with URI for get resource from page.
+ */
+ public String getUri(FacesContext context, Object data);
- /**
- * @param context TODO
- * @return input stream with resource
- */
- public InputStream getResourceAsStream(ResourceContext context);
-
- /**
- * @return string with URI for get resource from page.
- */
- public String getUri(FacesContext context, Object data);
+ /**
+ * Encode resource as Markup .
+ * @param context
+ * @param data
+ * @throws IOException
+ */
+ public void encode(FacesContext context, Object data) throws IOException;
+ /**
+ * Encode resource as Markup with custom attributes .
+ * @param context
+ * @param data
+ * @param attributes
+ * @throws IOException
+ */
+ public void encode(FacesContext context, Object data, Map<String, Object>
attributes) throws IOException;
-
- /**
- * Encode resource as Markup .
- * @param context
- * @param data
- * @throws IOException
- */
- public void encode(FacesContext context, Object data) throws IOException;
+ /**
+ * Encode start tag, attributes and body ( for inline script or style )
+ * @param context
+ * @param component
+ * @param attrs
+ * @throws IOException
+ */
+ public void encodeBegin(FacesContext context, Object component, Map<String,
Object> attrs) throws IOException;
- /**
- * Encode resource as Markup with custom attributes .
- * @param context
- * @param data
- * @param attributes
- * @throws IOException
- */
- public void encode(FacesContext context, Object data, Map<String, Object>
attributes) throws IOException;
+ /**
+ * Encode closed tag.
+ * @param context
+ * @param component
+ * @throws IOException
+ */
+ public void encodeEnd(FacesContext context, Object component) throws IOException;
- /**
- * Encode start tag, attributes and body ( for inline script or style )
- * @param context
- * @param component
- * @param attrs
- * @throws IOException
- */
- public void encodeBegin(FacesContext context, Object component, Map<String,
Object> attrs) throws IOException;
+ /**
+ * Send incapsulated resource to client by {@link ResourceContext} .
+ * @param context
+ */
+ public void send(ResourceContext context) throws IOException;
- /**
- * Encode closed tag.
- * @param context
- * @param component
- * @throws IOException
- */
- public void encodeEnd(FacesContext context, Object component) throws IOException;
+ /**
+ * Set response headers based on resource properties ( mime type etc )
+ * TODO - send via {@link FacesContext } ???
+ * @param response
+ */
+ public void sendHeaders(ResourceContext response);
- /**
- * Send incapsulated resource to client by {@link ResourceContext} .
- * @param context
- */
- public void send(ResourceContext context) throws IOException;
+ /**
+ * Custom properties for resource ( image size etc. )
+ * @param key
+ * @return property value, or null if not set.
+ */
+ public Object getProperty(Object key);
- /**
- * Set response headers based on resource properties ( mime type etc )
- * TODO - send via {@link FacesContext } ???
- * @param response
- */
- public void sendHeaders(ResourceContext response);
-
- /**
- * Custom properties for resource ( image size etc. )
- * @param key
- * @return property value, or null if not set.
- */
- public Object getProperty(Object key);
-
- /**
- * Set new value for custom property.
- * @param key
- * @param value
- */
- void setProperty(Object key,Object value);
+ /**
+ * Set new value for custom property.
+ * @param key
+ * @param value
+ */
+ void setProperty(Object key, Object value);
+ /**
+ * Set concrete renderer ( for brige pattern ). In renderer, incapsulate encoding
functions,
+ * content type, resource encoding.
+ * @param renderer
+ */
+ public void setRenderer(ResourceRenderer renderer);
- /**
- * Set concrete renderer ( for brige pattern ). In renderer, incapsulate encoding
functions,
- * content type, resource encoding.
- * @param renderer
- */
- public void setRenderer(ResourceRenderer renderer);
-
- /**
- * @return true, if resource must be rendered in faces request cicle.
- */
- public boolean requireFacesContext();
+ /**
+ * @return true, if resource must be rendered in faces request cicle.
+ */
+ public boolean requireFacesContext();
- /**
- * Flag for check session-dependencies for resource. In application-wide case,
- * resource URL not prepared by
context.getExternalContext().encodeResourceURL(resourceURL)
- * and used application-wide cache for store.
- * @return
- */
- public boolean isSessionAware();
-
- void setKey(String key);
-
- String getKey();
+ /**
+ * Flag for check session-dependencies for resource. In application-wide case,
+ * resource URL not prepared by
context.getExternalContext().encodeResourceURL(resourceURL)
+ * and used application-wide cache for store.
+ * @return
+ */
+ public boolean isSessionAware();
- public abstract ResourceRenderer getRenderer(ResourceContext resourceContext);
+ void setKey(String key);
- public abstract void setSessionAware(boolean sessionAware);
+ String getKey();
- public abstract void setCacheable(boolean cacheable);
+ public abstract ResourceRenderer getRenderer(ResourceContext resourceContext);
- public abstract void setLastModified(Date lastModified);
+ public abstract void setSessionAware(boolean sessionAware);
- public abstract void setExpired(long expired);
+ public abstract void setCacheable(boolean cacheable);
-}
\ No newline at end of file
+ public abstract void setLastModified(Date lastModified);
+
+ public abstract void setExpired(long expired);
+}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/ResourceComponent.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/ResourceComponent.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/ResourceComponent.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.resource;
import java.util.Date;
@@ -31,97 +33,94 @@
*
*/
public interface ResourceComponent {
-
- /**
- * Get Mime-type for target .
- * @return
- */
- public abstract String getMimeType();
- /**
- * Set Mime-type for target .
- * @param newvalue
- */
- public abstract void setMimeType(String newvalue);
-
+ /**
+ * Get Mime-type for target .
+ * @return
+ */
+ public abstract String getMimeType();
- /**
- * Get Last modified date for target .
- * @return
- */
- @Deprecated
- public abstract Date getLastModified();
+ /**
+ * Set Mime-type for target .
+ * @param newvalue
+ */
+ public abstract void setMimeType(String newvalue);
- /**
- * Set Last modified for target .
- * @param newvalue
- */
- @Deprecated
- public abstract void setLastModified(Date newvalue);
-
-
- /**
- * Get Expiration time for target .
- * @return
- */
- @Deprecated
- public abstract Date getExpires();
+ /**
+ * Get Last modified date for target .
+ * @return
+ */
+ @Deprecated
+ public abstract Date getLastModified();
- /**
- * Set Expiration time for target .
- * @param newvalue
- */
- @Deprecated
- public abstract void setExpires(Date newvalue);
-
-
- /**
- * Get caching flag for resource.
- * @return
- */
- public abstract boolean isCacheable();
+ /**
+ * Set Last modified for target .
+ * @param newvalue
+ */
+ @Deprecated
+ public abstract void setLastModified(Date newvalue);
- /**
- * Set caching flag for resource.
- * @param newvalue
- */
- public abstract void setCacheable(boolean newvalue);
-
- /**
- * Get session-avare flag for resource.
- * @return true if resource depend of client session. If false, no JSESSIONID encoded in
URI
- */
- @Deprecated
- public abstract boolean isSession();
+ /**
+ * Get Expiration time for target .
+ * @return
+ */
+ @Deprecated
+ public abstract Date getExpires();
- /**
- * Set session-avare flag for resource.
- * @param newvalue
- */
- @Deprecated
- public abstract void setSession(boolean newvalue);
-
- /**
- * Get Data object, encoded in uri and passed to "send" method for generate
resource content.
- * @return
- */
- public abstract Object getValue();
+ /**
+ * Set Expiration time for target .
+ * @param newvalue
+ */
+ @Deprecated
+ public abstract void setExpires(Date newvalue);
- /**
- * Set Data object, encoded in uri and passed to "send" method for generate
resource content.
- * @param newvalue
- */
- public abstract void setValue(Object newvalue);
-
- /**
- * Get El binding to method in user bean to send resource. Method will called with two
parameters - restored data object and servlet output stream.
- * @return
- */
- public abstract MethodBinding getCreateContent();
+ /**
+ * Get caching flag for resource.
+ * @return
+ */
+ public abstract boolean isCacheable();
- /**
- * Set El binding to method in user bean to send resource. Method will called with two
parameters - restored data object and servlet output stream.
- * @param newvalue
- */
- public abstract void setCreateContent(MethodBinding newvalue);
+ /**
+ * Set caching flag for resource.
+ * @param newvalue
+ */
+ public abstract void setCacheable(boolean newvalue);
+
+ /**
+ * Get session-avare flag for resource.
+ * @return true if resource depend of client session. If false, no JSESSIONID encoded
in URI
+ */
+ @Deprecated
+ public abstract boolean isSession();
+
+ /**
+ * Set session-avare flag for resource.
+ * @param newvalue
+ */
+ @Deprecated
+ public abstract void setSession(boolean newvalue);
+
+ /**
+ * Get Data object, encoded in uri and passed to "send" method for generate
resource content.
+ * @return
+ */
+ public abstract Object getValue();
+
+ /**
+ * Set Data object, encoded in uri and passed to "send" method for generate
resource content.
+ * @param newvalue
+ */
+ public abstract void setValue(Object newvalue);
+
+ /**
+ * Get El binding to method in user bean to send resource. Method will called with
two parameters - restored data object and servlet output stream.
+ * @return
+ */
+ public abstract MethodBinding getCreateContent();
+
+ /**
+ * Set El binding to method in user bean to send resource. Method will called with
two parameters - restored data object and servlet output stream.
+ * @param newvalue
+ */
+ public abstract void setCreateContent(MethodBinding newvalue);
}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/ResourceComponent2.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/ResourceComponent2.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/ResourceComponent2.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.resource;
import javax.el.MethodExpression;
@@ -26,17 +28,17 @@
/**
* Interface for the ResourceComponent introduced after refactoring
* to support MethodExpression. Old interface is left for the
- * compatibility.
- *
+ * compatibility.
+ *
* @author Vladislav Baranov
*/
public interface ResourceComponent2 extends ResourceComponent {
-
+
/**
* Get MethodExpression to method in user bean to send resource. Method will
* called with two parameters - restored data object and servlet output
* stream.
- *
+ *
* @return MethodExpression
*/
public abstract MethodExpression getCreateContentExpression();
@@ -45,9 +47,8 @@
* Set MethodExpression to method in user bean to send resource. Method will
* called with two parameters - restored data object and servlet output
* stream.
- *
+ *
* @param newvalue - new MethodExpression value
*/
public abstract void setCreateContentExpression(MethodExpression newvalue);
-
}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/ResourceContext.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/ResourceContext.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/ResourceContext.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,14 +19,18 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.resource;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Writer;
+
import java.net.MalformedURLException;
import java.net.URL;
+
import java.util.Set;
/**
@@ -36,71 +40,72 @@
* @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:56:57 $
*
*/
-public abstract class ResourceContext {
-
- private boolean cacheEnabled = false;
- private Object resourceData;
- // response headers
- /**
- * Delegate to {@link javax.servlet.ServletResponse} setHeader
- * @param name name of header
- * @param value new value
- */
- public abstract void setHeader(String name, String value);
-
- /**
- * Delegate to {@link javax.servlet.ServletResponse} setHeader
- * @param name name of header
- * @param value new value
- */
- public abstract void setIntHeader(String name, int value);
+public abstract class ResourceContext {
+ private boolean cacheEnabled = false;
+ private Object resourceData;
- /**
- * Delegate to {@link javax.servlet.ServletResponse} setHeader
- * @param name name of header
- * @param value new value
- */
- public abstract void setDateHeader(String name, long value);
-
- /**
- * @return
- * @throws IOException
- */
- public abstract OutputStream getOutputStream() throws IOException;
-
- /**
- * @return
- */
- @Deprecated
- public abstract String getQueryString();
-
- /**
- * @return
- */
- @Deprecated
- public abstract String getPathInfo();
-
- /**
- * @return
- */
- @Deprecated
- public abstract String getServletPath();
-
- /**
- * Get session attribute for given name. session not created
- * @param name attribute name
- * @return value for attribute, or null.
- */
- public abstract Object getSessionAttribute(String name);
+ // response headers
- /**
- * Get ServletContext attribute by name.
- * @param name
- * @return value for attribute, or null.
- */
- public abstract Object getContextAttribute(String name);
+ /**
+ * Delegate to {@link javax.servlet.ServletResponse} setHeader
+ * @param name name of header
+ * @param value new value
+ */
+ public abstract void setHeader(String name, String value);
/**
+ * Delegate to {@link javax.servlet.ServletResponse} setHeader
+ * @param name name of header
+ * @param value new value
+ */
+ public abstract void setIntHeader(String name, int value);
+
+ /**
+ * Delegate to {@link javax.servlet.ServletResponse} setHeader
+ * @param name name of header
+ * @param value new value
+ */
+ public abstract void setDateHeader(String name, long value);
+
+ /**
+ * @return
+ * @throws IOException
+ */
+ public abstract OutputStream getOutputStream() throws IOException;
+
+ /**
+ * @return
+ */
+ @Deprecated
+ public abstract String getQueryString();
+
+ /**
+ * @return
+ */
+ @Deprecated
+ public abstract String getPathInfo();
+
+ /**
+ * @return
+ */
+ @Deprecated
+ public abstract String getServletPath();
+
+ /**
+ * Get session attribute for given name. session not created
+ * @param name attribute name
+ * @return value for attribute, or null.
+ */
+ public abstract Object getSessionAttribute(String name);
+
+ /**
+ * Get ServletContext attribute by name.
+ * @param name
+ * @return value for attribute, or null.
+ */
+ public abstract Object getContextAttribute(String name);
+
+ /**
* <p>Return a <code>URL</code> for the application resource mapped
to the
* specified path, if it exists; otherwise, return
<code>null</code>.</p>
*
@@ -122,7 +127,6 @@
*/
public abstract URL getResource(String path) throws MalformedURLException;
-
/**
* <p>Return an <code>InputStream</code> for an application
resource
* mapped to the specified path, if it exists; otherwise, return
@@ -144,7 +148,6 @@
*/
public abstract InputStream getResourceAsStream(String path);
-
/**
* <p>Return the <code>Set</code> of resource paths for all
application
* resources whose resource path starts with the specified argument.</p>
@@ -165,64 +168,62 @@
*/
public abstract Set<String> getResourcePaths(String path);
- /**
- * Get request parameter for given name.
- * @param data_parameter
- * @return
- */
- public abstract String getRequestParameter(String data_parameter);
+ /**
+ * Get request parameter for given name.
+ * @param dataParameter
+ * @return
+ */
+ public abstract String getRequestParameter(String dataParameter);
- /**
- * @return Returns the cacheEnabled.
- */
- public boolean isCacheEnabled() {
- return this.cacheEnabled;
- }
+ /**
+ * @return Returns the cacheEnabled.
+ */
+ public boolean isCacheEnabled() {
+ return this.cacheEnabled;
+ }
- /**
- * @param cacheEnabled The cacheEnabled to set.
- */
- public void setCacheEnabled(boolean cacheEnabled) {
- this.cacheEnabled = cacheEnabled;
- }
+ /**
+ * @param cacheEnabled The cacheEnabled to set.
+ */
+ public void setCacheEnabled(boolean cacheEnabled) {
+ this.cacheEnabled = cacheEnabled;
+ }
- /**
- * get output writer for send response.
- * @return
- */
- //TODO method signature changed
- public abstract Writer getWriter() throws IOException;
+ /**
+ * get output writer for send response.
+ * @return
+ */
- /**
- * Setup response content type as {@see
javax.servlet.ServletResponse#setContentType(java.lang.String)}
- * @param contentType
- */
- public abstract void setContentType(String contentType);
-
- /**
- * Setup response content length as {@see
javax.servlet.ServletResponse#setContentLength(int)}
- * @param contentLength
- */
- public abstract void setContentLength(int contentLength);
-
- public abstract String getInitParameter(String name);
+ // TODO method signature changed
+ public abstract Writer getWriter() throws IOException;
- public Object getResourceData() {
- // TODO Auto-generated method stub
- return resourceData;
- }
+ /**
+ * Setup response content type as {@see
javax.servlet.ServletResponse#setContentType(java.lang.String)}
+ * @param contentType
+ */
+ public abstract void setContentType(String contentType);
- public void setResourceData(Object data) {
- resourceData = data;
-
- }
-
- /**
- * Release any data used by this context.
- * Close buffers used by cached context, release FacesContext, if exist.
- */
- public void release() {
-
- }
-
+ /**
+ * Setup response content length as {@see
javax.servlet.ServletResponse#setContentLength(int)}
+ * @param contentLength
+ */
+ public abstract void setContentLength(int contentLength);
+
+ public abstract String getInitParameter(String name);
+
+ public Object getResourceData() {
+
+ // TODO Auto-generated method stub
+ return resourceData;
+ }
+
+ public void setResourceData(Object data) {
+ resourceData = data;
+ }
+
+ /**
+ * Release any data used by this context.
+ * Close buffers used by cached context, release FacesContext, if exist.
+ */
+ public void release() {}
}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/ResourceNotFoundException.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/ResourceNotFoundException.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/ResourceNotFoundException.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.resource;
import javax.faces.FacesException;
@@ -31,42 +33,45 @@
*/
public class ResourceNotFoundException extends FacesException {
- /**
- *
- */
- private static final long serialVersionUID = -3263301605684963184L;
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3263301605684963184L;
- /**
- *
- */
- public ResourceNotFoundException() {
- super();
- // TODO Auto-generated constructor stub
- }
+ /**
+ *
+ */
+ public ResourceNotFoundException() {
+ super();
- /**
- * @param arg0
- */
- public ResourceNotFoundException(String arg0) {
- super(arg0);
- // TODO Auto-generated constructor stub
- }
+ // TODO Auto-generated constructor stub
+ }
- /**
- * @param arg0
- */
- public ResourceNotFoundException(Throwable arg0) {
- super(arg0);
- // TODO Auto-generated constructor stub
- }
+ /**
+ * @param arg0
+ */
+ public ResourceNotFoundException(String arg0) {
+ super(arg0);
- /**
- * @param arg0
- * @param arg1
- */
- public ResourceNotFoundException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- // TODO Auto-generated constructor stub
- }
+ // TODO Auto-generated constructor stub
+ }
+ /**
+ * @param arg0
+ */
+ public ResourceNotFoundException(Throwable arg0) {
+ super(arg0);
+
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param arg0
+ * @param arg1
+ */
+ public ResourceNotFoundException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+
+ // TODO Auto-generated constructor stub
+ }
}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/ResourceRenderer.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/ResourceRenderer.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/ResourceRenderer.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,9 +19,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.resource;
import java.io.IOException;
+
import java.util.Map;
import javax.faces.context.FacesContext;
@@ -33,50 +36,51 @@
*
*/
public interface ResourceRenderer {
-
- /**
- * @return content type ( image/jpeg , text/javascript etc. ) for given type.
- */
- String getContentType();
- /**
- * Encode concrete HTML element for resource.
- * @param context
- * @param data
- * @throws IOException
- */
- void encode(InternetResource resource, FacesContext context, Object data) throws
IOException;
+ /**
+ * @return content type ( image/jpeg , text/javascript etc. ) for given type.
+ */
+ String getContentType();
- /**
- * Encode concrete HTML element for resource.
- * @param context
- * @param data
- * @throws IOException
- */
- void encode(InternetResource resource, FacesContext context, Object data, Map<String,
Object> attributes) throws IOException;
+ /**
+ * Encode concrete HTML element for resource.
+ * @param context
+ * @param data
+ * @throws IOException
+ */
+ void encode(InternetResource resource, FacesContext context, Object data) throws
IOException;
- void encodeBegin(InternetResource base, FacesContext context, Object data,
Map<String, Object> attributes) throws IOException;
+ /**
+ * Encode concrete HTML element for resource.
+ * @param context
+ * @param data
+ * @throws IOException
+ */
+ void encode(InternetResource resource, FacesContext context, Object data,
Map<String, Object> attributes)
+ throws IOException;
- void encodeEnd(InternetResource base, FacesContext context, Object data) throws
IOException;
-
- /**
- * @return true, if resource must be rendered in faces request cicle.
- */
- public boolean requireFacesContext();
+ void encodeBegin(InternetResource base, FacesContext context, Object data,
Map<String, Object> attributes)
+ throws IOException;
- /**
- * Send incapsulated resource to client by {@link ResourceContext} .
- * Perform any conversions, nessesary for this resources ( template interpretations,
JavaScript conversions etc )
- * @param context
- * @return TODO
- */
- public int send(InternetResource base,ResourceContext context) throws IOException;
+ void encodeEnd(InternetResource base, FacesContext context, Object data) throws
IOException;
- /**
- * Get data to build URI for given resource. Can be any Serialisable object,
- * @param base TODO
- * @return data for Store in URI/ Cache key.
- */
- public Object getData(InternetResource base, FacesContext context, Object data);
+ /**
+ * @return true, if resource must be rendered in faces request cicle.
+ */
+ public boolean requireFacesContext();
+ /**
+ * Send incapsulated resource to client by {@link ResourceContext} .
+ * Perform any conversions, nessesary for this resources ( template interpretations,
JavaScript conversions etc )
+ * @param context
+ * @return TODO
+ */
+ public int send(InternetResource base, ResourceContext context) throws IOException;
+
+ /**
+ * Get data to build URI for given resource. Can be any Serialisable object,
+ * @param base TODO
+ * @return data for Store in URI/ Cache key.
+ */
+ public Object getData(InternetResource base, FacesContext context, Object data);
}
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/package-info.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/package-info.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/package-info.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -1,3 +1,4 @@
+
/**
* Resources-handling functionality
*/
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,70 +19,73 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.resource.util;
import java.io.IOException;
import java.io.InputStream;
+
import java.net.URL;
import java.net.URLConnection;
import org.richfaces.log.RichfacesLogger;
+
import org.slf4j.Logger;
/**
* Utility class to solve JAR locking issue using {@link
URLConnection#setUseCaches(boolean)} method.
* Contains one utility method that gets {@link InputStream} from {@link URL} with
caching disabled.
- *
+ *
* Created 07.02.2008
* @author Nick Belaevski
* @since 3.2
*/
-
public final class URLToStreamHelper {
+ private static final Logger LOG = RichfacesLogger.UTIL.getLogger();
- private static final Logger log = RichfacesLogger.UTIL.getLogger();
-
- private URLToStreamHelper() {
- super();
- }
-
- /**
- * Returns {@link InputStream} corresponding to argument {@link URL}
- * but with caching disabled
- *
- * @param url {@link URL} of the resource
- * @return {@link InputStream} instance or <code>null</code>
- * @throws IOException
- */
- public static final InputStream urlToStream(URL url) throws IOException {
- if (url != null) {
- URLConnection connection = url.openConnection();
- try {
- connection.setUseCaches(false);
- } catch (IllegalArgumentException e) {
- log.error(e.getLocalizedMessage(), e);
- }
+ private URLToStreamHelper() {
+ super();
+ }
- return connection.getInputStream();
- } else {
- return null;
- }
- }
-
- /**
- * Variant of {@link #urlToStream(URL)} method that doesn't throw IOException, but
silently ignores them
- *
- * @param url
- * @return
- */
- public static final InputStream urlToStreamSafe(URL url) {
- try {
- return urlToStream(url);
- } catch (IOException e) {
- // do nothing
- }
-
- return null;
- }
+ /**
+ * Returns {@link InputStream} corresponding to argument {@link URL}
+ * but with caching disabled
+ *
+ * @param url {@link URL} of the resource
+ * @return {@link InputStream} instance or <code>null</code>
+ * @throws IOException
+ */
+ public static InputStream urlToStream(URL url) throws IOException {
+ if (url != null) {
+ URLConnection connection = url.openConnection();
+ try {
+ connection.setUseCaches(false);
+ } catch (IllegalArgumentException e) {
+ LOG.error(e.getLocalizedMessage(), e);
+ }
+
+ return connection.getInputStream();
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Variant of {@link #urlToStream(URL)} method that doesn't throw IOException,
but silently ignores them
+ *
+ * @param url
+ * @return
+ */
+ public static InputStream urlToStreamSafe(URL url) {
+ try {
+ return urlToStream(url);
+ } catch (IOException e) {
+
+ // do nothing
+ }
+
+ return null;
+ }
}
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/util/package-info.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/util/package-info.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/resource/util/package-info.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -1,3 +1,4 @@
+
/**
* Helper classes for various purposes of resources handling
*/
Modified:
root/framework/trunk/api/src/main/java/org/richfaces/component/TemplateComponent.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/richfaces/component/TemplateComponent.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/richfaces/component/TemplateComponent.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -18,6 +18,9 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
+
package org.richfaces.component;
/**
@@ -27,9 +30,9 @@
*
*/
public interface TemplateComponent {
- public static final String TEMPLATE_CLIENT_ID = "{componentId}";
-
- public void startTemplateEncode();
-
- public void endTemplateEncode();
+ public static final String TEMPLATE_CLIENT_ID = "{componentId}";
+
+ public void startTemplateEncode();
+
+ public void endTemplateEncode();
}
Modified:
root/framework/trunk/api/src/main/java/org/richfaces/component/package-info.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/richfaces/component/package-info.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/richfaces/component/package-info.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -1,3 +1,4 @@
+
/**
* Base RichFaces components interfaces and classes
*/
Modified: root/framework/trunk/api/src/main/java/org/richfaces/event/package-info.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/richfaces/event/package-info.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/richfaces/event/package-info.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -1,3 +1,4 @@
+
/**
* Interfaces and classes of events and listeners of RichFaces components
*/
Modified: root/framework/trunk/api/src/main/java/org/richfaces/log/RichfacesLogger.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/richfaces/log/RichfacesLogger.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/richfaces/log/RichfacesLogger.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -3,45 +3,26 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
/**
* @author Anton Belevich
*
*/
public enum RichfacesLogger {
-
- RESOURCE("Resource"),
-
- RENDERKIT("Renderkit"),
-
- CONFIG("Config"),
-
- CONNECTION("Connection"),
-
- APPLICATION("Application"),
-
- CACHE("Cache"),
-
- CONTEXT("Context"),
-
- COMPONENTS("Components"),
-
- WEBAPP("Webapp"),
-
- UTIL("Util");
-
- private static final String LOGGER_NAME_PREFIX = "org.richfaces.log.";
-
- private String loggerName;
-
- private RichfacesLogger(String loggerName) {
- this.loggerName = LOGGER_NAME_PREFIX + loggerName;
- }
-
- public String getLoggerName() {
- return loggerName;
- }
+ RESOURCE("Resource"), RENDERKIT("Renderkit"),
CONFIG("Config"), CONNECTION("Connection"),
+ APPLICATION("Application"),
+ CACHE("Cache"), CONTEXT("Context"),
COMPONENTS("Components"), WEBAPP("Webapp"), UTIL("Util");
+ private static final String LOGGER_NAME_PREFIX = "org.richfaces.log.";
+ private String loggerName;
+
+ private RichfacesLogger(String loggerName) {
+ this.loggerName = LOGGER_NAME_PREFIX + loggerName;
+ }
+
+ public String getLoggerName() {
+ return loggerName;
+ }
+
public Logger getLogger() {
return LoggerFactory.getLogger(loggerName);
}
Modified: root/framework/trunk/api/src/main/java/org/richfaces/model/UploadItem.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/model/UploadItem.java 2009-11-01
16:34:11 UTC (rev 15797)
+++ root/framework/trunk/api/src/main/java/org/richfaces/model/UploadItem.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.richfaces.model;
import java.io.File;
@@ -26,61 +28,64 @@
/**
* Class provides object holder for file uploaded.
- * Instance of this type will be returned by UploadEvent after appropriate listener
called after uploading has been completed.
+ * Instance of this type will be returned by UploadEvent after appropriate listener
called after uploading has been
+ * completed.
+ *
* @author "Andrey Markavtsov"
*
*/
-public class UploadItem implements Serializable{
-
+public class UploadItem implements Serializable {
+
/**
- * Serial id
- */
- private static final long serialVersionUID = -111723029745124147L;
+ * Serial id
+ */
+ private static final long serialVersionUID = -111723029745124147L;
- /** Users file name */
- private String fileName;
-
+ /** File byte content */
+ private byte[] bytes;
+
/** Content type */
private String contentType;
-
+
/** java.io.File instance */
private File file;
-
- /** File byte content */
- private byte [] bytes;
-
+
+ /** Users file name */
+ private String fileName;
+
/** File size */
private int fileSize;
-
+
/**
* Constructor for the UploadItem
*/
public UploadItem(String fileName, int fileSize, String contentType, Object file) {
- this.fileName = fileName;
- this.contentType = contentType;
- this.fileSize = fileSize;
- if (null != file) {
- if (file.getClass().isAssignableFrom(File.class)) {
- this.file = (File) file;
- } else if (file.getClass().isAssignableFrom(byte[].class)) {
- this.bytes = (byte[]) file;
- }
- }
+ this.fileName = fileName;
+ this.contentType = contentType;
+ this.fileSize = fileSize;
+
+ if (null != file) {
+ if (file.getClass().isAssignableFrom(File.class)) {
+ this.file = (File) file;
+ } else if (file.getClass().isAssignableFrom(byte[].class)) {
+ this.bytes = (byte[]) file;
+ }
+ }
}
-
+
/**
* Return true if file is holding as java.io.File type.
* If true getFile method should be invoked to get file uploaded.
* In another case getData method should be invoked to get file's bytes.
* @return
*/
- public boolean isTempFile () {
- return (null != file);
+ public boolean isTempFile() {
+ return null != file;
}
/**
* This method should called only in case of TRUE value returned by {@link
#isTempFile()} method.
- * Otherwise null value will be returned by this method.
+ * Otherwise null value will be returned by this method.
* @return the file
*/
public File getFile() {
@@ -89,9 +94,9 @@
/**
* This method should called only in case of FALSE value returned by {@link
#isTempFile()} method.
- * Otherwise null value will be returned by this method.
+ * Otherwise null value will be returned by this method.
* @return the bytes
- * @throws Exception
+ * @throws Exception
*/
public byte[] getData() {
return bytes;
@@ -104,19 +109,17 @@
return fileName;
}
- /**
- * @return the contentType
- */
- public String getContentType() {
- return contentType;
- }
+ /**
+ * @return the contentType
+ */
+ public String getContentType() {
+ return contentType;
+ }
- /**
- * @return the fileSize
- */
- public int getFileSize() {
- return fileSize;
- }
-
-
+ /**
+ * @return the fileSize
+ */
+ public int getFileSize() {
+ return fileSize;
+ }
}
Modified:
root/framework/trunk/api/src/main/java/org/richfaces/resource/VersionedResource.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/richfaces/resource/VersionedResource.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/richfaces/resource/VersionedResource.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.richfaces.resource;
/**
@@ -26,7 +28,5 @@
* @since 4.0
*/
public interface VersionedResource {
-
- public String getVersion();
-
+ public String getVersion();
}
Modified: root/framework/trunk/api/src/main/java/org/richfaces/skin/Skin.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/skin/Skin.java 2009-11-01
16:34:11 UTC (rev 15797)
+++ root/framework/trunk/api/src/main/java/org/richfaces/skin/Skin.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,325 +19,319 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.richfaces.skin;
import javax.faces.context.FacesContext;
/**
* Main interface for configurable parameters.
- *
+ *
* @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:59:43 $
- *
+ *
*/
public interface Skin {
- // parameters names constants
-// parameters names constants
-
- /**
- * used for define url with general CSS file for current skin.
- */
- public static final String generalStyleSheet = "generalStyleSheet";
+ /**
+ * Style of the text displaying on the active (selected) tabs.Default value normal.
+ */
+ public static final String ACTIVETAB_STYLE_FONT = "activetabStyleFont";
- /**
- * used for define url with extended CSS file for current skin.
- */
- public static final String extendedStyleSheet = "extendedStyleSheet";
+ /**
+ * Depth of the text displaying on the active (selected) tabs.Default value bold.
+ */
+ public static final String ACTIVETAB_WEIGHT_FONT = "activetabWeightFont";
+ public static final String ADDITIONAL_BACKGROUND_COLOR =
"additionalBackgroundColor";
+ public static final String BASE_SKIN = "baseSkin";
- /**
- * used for defining a header background color in the panel, a tabpanel active tab
- * background color, a bar background color for ddmenu, tables background color,
- * buttons background color. Default value #1D7DB3.
- */
- public static final String headerBackgroundColor = "headerBackgroundColor";
+ /**
+ * Font name for displaying buttons titles. Default value Arial, Verdana.
+ */
+ public static final String BUTTON_FAMILY_FONT = "buttonFamilyFont";
- /**
- * used for defining color of the titles of the top level of the menu, the panel header
- * color, the table header color, color of the title of the active tab in the tabpanel,
- * color of the title on the buttons. Default value #FFFFFF.
- */
- public static final String headTextColor = "headTextColor";
+ /**
+ * Rounding-off radius of the buttons corners. Default value 13px.
+ *
+ */
+ public static final String BUTTON_RADIUS_CORNER = "buttonRadiusCorner";
- /**
- * used for defining the background color of the bar under the header in the panel and
- * the tabpanel, color of the border for the top level of the ddmenu, background
- * highlight color of the selected item in the dropdown list boxes of the ddmenu,
- * background color of the footer in the tables, color of the text for the inactive and
- * disabled tab in the tabpanel, color of the border of the buttons. Default value
- * #BFD7E4.
- */
- public static final String selectBackgroundColor = "selectBackgroundColor";
+ /**
+ * Font size for displaying buttons titles. Default value 11px.
+ */
+ public static final String BUTTON_SIZE_FONT = "buttonSizeFont";
- /**
- * used for defining the background color of the basic area of the panel and tabpanels,
- * background color of the dropdown list boxes of ddmenu. Default value #BFD7E4.
- */
- public static final String generalBackgroundColor = "generalBackgroundColor";
+ /**
+ * Style of the text displaying on the button. Default value normal.
+ *
+ */
+ public static final String BUTTON_STYLE_FONT = "buttonStyleFont";
- /**
- * used for defining color of the basic text, color of the text in the dropdown list
- * boxes of ddmenu, color of the right and top borders for the controls like text,
- * textArea, secret. Default value #000000.
- */
- public static final String generalTextColor = "generalTextColor";
+ /**
+ * Depth of the text displaying on the button. Default value bold.
+ */
+ public static final String BUTTON_WEIGHT_FONT = "buttonWeightFont";
+ public static final String CONTROL_BACKGROUND_COLOR =
"controlBackgroundColor";
- /**
- * used for defining shadow background color of the panels, color of the bottom and
right
- * borders for the dropdown list box in ddmenu. Default value #AFB1B2.
- */
- public static final String shadowBackgroundColor = "shadowBackgroundColor";
+ /**
+ * Responsible for the borders color of the radiobutton and checkbox and color of
light
+ * part of the fields and text area border. Default value #B0B0B0.
+ */
+ public static final String CONTROL_BORDER_COLOR = "controlBorderColor";
- /**
- * used for defining the seamlessness of the tip shadow. Default value 2.
- */
- public static final String shadowOpacity = "shadowOpacity";
+ /**
+ * Style of the text displaying on the disabled tabs.Default value normal.
+ */
+ public static final String DISABLED_TAB_STYLE_FONT =
"disabledTabStyleFont";
- /**
- * used for defining tables border color, color of the bottom and left controls like
- * text, textArea, secret, color of the top and left borders for the dropdown list box
in
- * the ddmenu. Default value #CCCCCC.
- */
- public static final String tableBorderColor = "tableBorderColor";
+ /**
+ * Depth of the text displaying on the disabled tabs.Default value normal.
+ */
+ public static final String DISABLED_TAB_WEIGHT_FONT =
"disabledTabWeightFont";
- /**
- * used for defining tables and controls background color. Default value #FFFFFF.
- */
- public static final String tableBackgroundColor = "tableBackgroundColor";
+ /**
+ * used for define url with extended CSS file for current skin.
+ */
+ public static final String EXTENDED_STYLE_SHEET = "extendedStyleSheet";
- /**
- * Font size for the displaying panels headers and top level of the ddmenu. Default
- * value 12px.
- */
- public static final String headerSizeFont = "headerSizeFont";
+ /**
+ * used for defining the background color of the basic area of the panel and
tabpanels,
+ * background color of the dropdown list boxes of ddmenu. Default value #BFD7E4.
+ */
+ public static final String GENERAL_BACKGROUND_COLOR =
"generalBackgroundColor";
- /**
- * Font name for the displaying panels headers and top level of the ddmenu.Default
value
- * Arial, Verdana.
- */
- public static final String headerFamilyFont = "headerFamilyFont";
+ /**
+ *
+ */
+ public static final String GENERAL_LINK_COLOR = "generalLinkColor";
+ public static final String GENERAL_SIZE_FONT = "generalSizeFont";
- /**
- * Font size for displaying tab titles. Default value 11px.
- */
- public static final String tabSizeFont = "tabSizeFont";
+ // parameters names constants
+// parameters names constants
- /**
- * Font name for displaying tab titles. Default value Arial, Verdana.
- *
- */
- public static final String tabFamilyFont = "tabFamilyFont";
+ /**
+ * used for define url with general CSS file for current skin.
+ */
+ public static final String GENERAL_STYLE_SHEET = "generalStyleSheet";
- /**
- * Rounding-off radius of the tabs corners. Default value 5px.
- */
- public static final String tabRadiusCorner = "tabRadiusCorner";
+ /**
+ * used for defining color of the basic text, color of the text in the dropdown list
+ * boxes of ddmenu, color of the right and top borders for the controls like text,
+ * textArea, secret. Default value #000000.
+ */
+ public static final String GENERAL_TEXT_COLOR = "generalTextColor";
+ public static final String GRADIENT_TYPE = "gradientType";
- /**
- * Font size for displaying buttons titles. Default value 11px.
- */
- public static final String buttonSizeFont = "buttonSizeFont";
+ /**
+ * used for defining a header background color in the panel, a tabpanel active tab
+ * background color, a bar background color for ddmenu, tables background color,
+ * buttons background color. Default value #1D7DB3.
+ */
+ public static final String HEADER_BACKGROUND_COLOR =
"headerBackgroundColor";
- /**
- * Font name for displaying buttons titles. Default value Arial, Verdana.
- */
- public static final String buttonFamilyFont = "buttonFamilyFont";
+ /**
+ * Font name for the displaying panels headers and top level of the ddmenu.Default
value
+ * Arial, Verdana.
+ */
+ public static final String HEADER_FAMILY_FONT = "headerFamilyFont";
+ public static final String HEADER_GRADIENT_COLOR = "headerGradientColor";
- /**
- * Rounding-off radius of the buttons corners. Default value 13px.
- *
- */
- public static final String buttonRadiusCorner = "buttonRadiusCorner";
+ /**
+ * Font size for the displaying panels headers and top level of the ddmenu. Default
+ * value 12px.
+ */
+ public static final String HEADER_SIZE_FONT = "headerSizeFont";
- /**
- * Rounding-off radius of the panels corners. Default value 5px.
- */
- public static final String panelRadiusCorner = "panelRadiusCorner";
+ /**
+ * used for defining color of the titles of the top level of the menu, the panel
header
+ * color, the table header color, color of the title of the active tab in the
tabpanel,
+ * color of the title on the buttons. Default value #FFFFFF.
+ */
+ public static final String HEAD_TEXT_COLOR = "headTextColor";
- /**
- * Style of the text displaying on the button. Default value normal.
- *
- */
- public static final String buttonStyleFont = "buttonStyleFont";
+ /**
+ * Parameter responsible for 3D Look of panels and buttons.
+ */
+ public static final String INTERFACE_LEVEL_3D = "interfaceLevel3D";
+ public static final String LOAD_STYLE_SHEETS = "loadStyleSheets";
- /**
- * Depth of the text displaying on the button. Default value bold.
- */
- public static final String buttonWeightFont = "buttonWeightFont";
+ /**
+ *
+ */
+ public static final String OVER_ALL_BACKGROUND = "overAllBackground";
- /**
- * Style of the text displaying on the active (selected) tabs.Default value normal.
- */
- public static final String activetabStyleFont = "activetabStyleFont";
+ /**
+ * Rounding-off radius of the panels corners. Default value 5px.
+ */
+ public static final String PANEL_RADIUS_CORNER = "panelRadiusCorner";
+ public static final String PANEL_TEXT_COLOR = "panelTextColor";
- /**
- * Depth of the text displaying on the active (selected) tabs.Default value bold.
- */
- public static final String activetabWeightFont = "activetabWeightFont";
+ /**
+ * defines the layout of the tabs in the panel. Possible values Top. Left. Bottom,
Right.
+ * Default value ???.
+ */
+ public static final String PREFERABLE_TAB_POSITION =
"preferableTabPosition";
- /**
- * Style of of the text displaying on the inactive (unselected) tabs. Default value
- * normal.
- */
- public static final String tabStyleFont = "tabStyleFont";
+ /**
+ * text aligning in the tabs with the fixed tab length (hight). Values Left,
Center,Right
+ * for the horizontal oriented tabs, values Top, center, Bottom - for vertical
oriented
+ * tabs. Default value center.
+ */
+ public static final String PREFERABLE_TAB_TEXT_DIRECTION =
"preferableTabTextDirection";
- /**
- * Depth of the text displaying on the inactive (unselected) tabs.Default value normal.
- */
- public static final String tabWeightFont = "tabWeightFont";
+ /**
+ * defines the variant of text writing. Values - Hor (horisontal position), Vert
+ * (vertical position - letters are arranged into column), VertCW (vertical
+ * position with text rotation anticlockwise). Default value Hor.
+ */
+ public static final String PREFERABLE_TAB_TEXT_ORIENTATION =
"preferableTabTextOrientation";
- /**
- * Style of the text displaying on the disabled tabs.Default value normal.
- */
- public static final String disabledTabStyleFont = "disabledTabStyleFont";
+ /**
+ * used for defining the background color of the bar under the header in the panel
and
+ * the tabpanel, color of the border for the top level of the ddmenu, background
+ * highlight color of the selected item in the dropdown list boxes of the ddmenu,
+ * background color of the footer in the tables, color of the text for the inactive
and
+ * disabled tab in the tabpanel, color of the border of the buttons. Default value
+ * #BFD7E4.
+ */
+ public static final String SELECT_BACKGROUND_COLOR =
"selectBackgroundColor";
- /**
- * Depth of the text displaying on the disabled tabs.Default value normal.
- */
- public static final String disabledTabWeightFont = "disabledTabWeightFont";
-
- /**
- * Color for selected checkbox or selectOneRadio.
- */
- public static final String selectControlColor = "selectControlColor";
-
- /**
- * Responsible for the borders color of the radiobutton and checkbox and color of light
- * part of the fields and text area border. Default value #B0B0B0.
- */
- public static final String controlBorderColor = "controlBorderColor";
+ /**
+ * Color for selected checkbox or selectOneRadio.
+ */
+ public static final String SELECT_CONTROL_COLOR = "selectControlColor";
- /**
- * Parameter responsible for 3D Look of panels and buttons.
- */
-
- public static final String interfaceLevel3D = "interfaceLevel3D";
+ /**
+ * used for defining shadow background color of the panels, color of the bottom and
right
+ * borders for the dropdown list box in ddmenu. Default value #AFB1B2.
+ */
+ public static final String SHADOW_BACKGROUND_COLOR =
"shadowBackgroundColor";
- /**
- * defines the layout of the tabs in the panel. Possible values Top. Left. Bottom,
Right.
- * Default value ???.
- */
- public static final String preferableTabPosition = "preferableTabPosition";
-
- /**
- * defines the variant of text writing. Values - Hor (horisontal position), Vert
- * (vertical position - letters are arranged into column), VertCW (vertical
- * position with text rotation anticlockwise). Default value Hor.
- */
- public static final String preferableTabTextOrientation =
"preferableTabTextOrientation";
- /**
- * text aligning in the tabs with the fixed tab length (hight). Values Left,
Center,Right
- * for the horizontal oriented tabs, values Top, center, Bottom - for vertical oriented
- * tabs. Default value center.
- */
-
+ /**
+ * used for defining the seamlessness of the tip shadow. Default value 2.
+ */
+ public static final String SHADOW_OPACITY = "shadowOpacity";
- public static final String preferableTabTextDirection =
"preferableTabTextDirection";
+ /**
+ * used for defining tables and controls background color. Default value #FFFFFF.
+ */
+ public static final String TABLE_BACKGROUND_COLOR =
"tableBackgroundColor";
-
- /**
- *
- */
- public static final String overAllBackground = "overAllBackground";
- /**
- *
- */
- public static final String generalLinkColor = "generalLinkColor";
+ /**
+ * used for defining tables border color, color of the bottom and left controls
like
+ * text, textArea, secret, color of the top and left borders for the dropdown list
box in
+ * the ddmenu. Default value #CCCCCC.
+ */
+ public static final String TABLE_BORDER_COLOR = "tableBorderColor";
- public static final String panelTextColor = "panelTextColor";
+ /**
+ * Font name for displaying tab titles. Default value Arial, Verdana.
+ *
+ */
+ public static final String TAB_FAMILY_FONT = "tabFamilyFont";
- public static final String headerGradientColor = "headerGradientColor";
+ /**
+ * Rounding-off radius of the tabs corners. Default value 5px.
+ */
+ public static final String TAB_RADIUS_CORNER = "tabRadiusCorner";
- public static final String additionalBackgroundColor =
"additionalBackgroundColor";
-
- public static final String controlBackgroundColor = "controlBackgroundColor";
-
- public static final String generalSizeFont = "generalSizeFont";
-
- public static final String loadStyleSheets = "loadStyleSheets";
+ /**
+ * Font size for displaying tab titles. Default value 11px.
+ */
+ public static final String TAB_SIZE_FONT = "tabSizeFont";
- public static final String gradientType = "gradientType";
-
- public static final String baseSkin = "baseSkin";
+ /**
+ * Style of of the text displaying on the inactive (unselected) tabs. Default value
+ * normal.
+ */
+ public static final String TAB_STYLE_FONT = "tabStyleFont";
- // Preferable parameters
- /**
- * Preferable parameters names for skin ( in common, for Preferable.Name
- * parameter will PreferableName )
- *
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:59:43 $
- *
- */
+ /**
+ * Depth of the text displaying on the inactive (unselected) tabs.Default value
normal.
+ */
+ public static final String TAB_WEIGHT_FONT = "tabWeightFont";
- public interface Preferable {
- /**
- *
- */
- public static final String dataSizeFont = "preferableDataSizeFont";
+ /**
+ * Get Rener Kit name for this skin.
+ *
+ * @param context -
+ * {@link FacesContext } for current request. need for
+ * {@link javax.faces.el.ValueBinding} evaluation.
+ * @return RenderKitId for this skin, or <code>null</code> for default.
+ */
+ public String getRenderKitId(FacesContext context);
- /**
- *
- */
- public static final String dataFamilyFont = "preferableDataFamilyFont";
+ /**
+ * Get value for configuration parameter. If parameter set as EL-expression,
+ * calculate it value.
+ *
+ * @param context -
+ * {@link FacesContext } for current request.
+ * @param name
+ * name of paremeter.
+ * @return value of parameter in config, or null
+ */
+ public Object getParameter(FacesContext context, String name);
- /**
- *
- */
- public static final String panelBodyPadding = "preferablePanelBodyPadding";
+ /**
+ * Get value for configuration parameter. If parameter set as EL-expression,
+ * calculate it value.
+ *
+ * @param context -
+ * {@link FacesContext } for current request.
+ * @param name
+ * name of paremeter.
+ * @param defaultValue - default value if parameter not present in Skin
+ * @return value of parameter in config, or null
+ */
+ public Object getParameter(FacesContext context, String name, Object defaultValue);
- /**
- *
- */
- public static final String headerWeightFont = "preferableHeaderWeightFont";
+ /**
+ * @param name
+ * @return
+ */
+ public boolean containsProperty(String name);
- }
+ /**
+ * Calculate unique ( as possible ) code to identity this skin instance. Used for
generate hash key
+ * in skin-depended resources
+ *
+ * @param context
+ * @return
+ */
+ public int hashCode(FacesContext context);
- /**
- * Get Rener Kit name for this skin.
- *
- * @param context -
- * {@link FacesContext } for current request. need for
- * {@link javax.faces.el.ValueBinding} evaluation.
- * @return RenderKitId for this skin, or <code>null</code> for default.
- */
- public String getRenderKitId(FacesContext context);
+ // Preferable parameters
- /**
- * Get value for configuration parameter. If parameter set as EL-expression,
- * calculate it value.
- *
- * @param context -
- * {@link FacesContext } for current request.
- * @param name
- * name of paremeter.
- * @return value of parameter in config, or null
- */
- public Object getParameter(FacesContext context, String name);
-
- /**
- * Get value for configuration parameter. If parameter set as EL-expression,
- * calculate it value.
- *
- * @param context -
- * {@link FacesContext } for current request.
- * @param name
- * name of paremeter.
- * @param defaultValue - default value if parameter not present in Skin
- * @return value of parameter in config, or null
- */
- public Object getParameter(FacesContext context, String name, Object defaultValue);
+ /**
+ * Preferable parameters names for skin ( in common, for Preferable.Name
+ * parameter will PreferableName )
+ *
+ * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:59:43 $
+ *
+ */
+ public interface Preferable {
- /**
- * @param name
- * @return
- */
- public boolean containsProperty(String name);
-
- /**
- * Calculate unique ( as possible ) code to identity this skin instance. Used for
generate hash key in skin-depended resources
- * @param context
- * @return
- */
- public int hashCode(FacesContext context);
-}
\ No newline at end of file
+ /**
+ *
+ */
+ public static final String DATA_FAMILY_FONT =
"preferableDataFamilyFont";
+
+ /**
+ *
+ */
+ public static final String DATA_SIZE_FONT = "preferableDataSizeFont";
+
+ /**
+ *
+ */
+ public static final String HEADER_WEIGHT_FONT =
"preferableHeaderWeightFont";
+
+ /**
+ *
+ */
+ public static final String PANEL_BODY_PADDING =
"preferablePanelBodyPadding";
+ }
+}
Modified:
root/framework/trunk/api/src/main/java/org/richfaces/skin/SkinConfiguration.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/richfaces/skin/SkinConfiguration.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/richfaces/skin/SkinConfiguration.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.richfaces.skin;
import javax.faces.context.FacesContext;
@@ -34,37 +36,37 @@
*/
public interface SkinConfiguration {
- /**
- * Get value for configuration parameter. If parameter set as EL-expression,
- * calculate it value.
- *
- * @param context -
- * {@link FacesContext } for current request.
- * @param name
- * name of paremeter.
- * @return value of parameter in config, or null
- */
- public Object getParameter(FacesContext context, String name);
-
- /**
- * Get value for skin parameter, for build extensible ( mandatory/fine tuning ) with
three-stage checks :
- * <ul>
- * <li>first, check value for parameter with given name. If value not null, return
it</li>
- * <li>second, got parameter value from skin by skinName key. If not null, return
it.</li>
- * <li>if both above parameters is null, return default value.</li>
- * </ul>
- * @param context - Current JSF context.
- * @param name - name of parameter.
- * @param skinName - name of according ( default ) parameter i Skin for same purpose.
may be <code>null</code>.
- * @param defaultValue - default parameter value.
- * @return - value of parameter.
- */
- public Object getParameter(FacesContext context, String name,String skinName, Object
defaultValue);
- /**
- * Test for present parameter for given name.
- * @param name of parameter to test
- * @return true if parameter present in configuration.
- */
- public boolean containsParameter(String name);
+ /**
+ * Get value for configuration parameter. If parameter set as EL-expression,
+ * calculate it value.
+ *
+ * @param context -
+ * {@link FacesContext } for current request.
+ * @param name
+ * name of paremeter.
+ * @return value of parameter in config, or null
+ */
+ public Object getParameter(FacesContext context, String name);
+ /**
+ * Get value for skin parameter, for build extensible ( mandatory/fine tuning ) with
three-stage checks :
+ * <ul>
+ * <li>first, check value for parameter with given name. If value not null,
return it</li>
+ * <li>second, got parameter value from skin by skinName key. If not null,
return it.</li>
+ * <li>if both above parameters is null, return default value.</li>
+ * </ul>
+ * @param context - Current JSF context.
+ * @param name - name of parameter.
+ * @param skinName - name of according ( default ) parameter i Skin for same purpose.
may be <code>null</code>.
+ * @param defaultValue - default parameter value.
+ * @return - value of parameter.
+ */
+ public Object getParameter(FacesContext context, String name, String skinName, Object
defaultValue);
+
+ /**
+ * Test for present parameter for given name.
+ * @param name of parameter to test
+ * @return true if parameter present in configuration.
+ */
+ public boolean containsParameter(String name);
}
Modified: root/framework/trunk/api/src/main/java/org/richfaces/skin/SkinFactory.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/skin/SkinFactory.java 2009-11-01
16:34:11 UTC (rev 15797)
+++ root/framework/trunk/api/src/main/java/org/richfaces/skin/SkinFactory.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,14 +19,18 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.richfaces.skin;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
+
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -36,177 +40,186 @@
import org.ajax4jsf.Messages;
import org.ajax4jsf.resource.util.URLToStreamHelper;
+
import org.richfaces.log.RichfacesLogger;
+
import org.slf4j.Logger;
/**
* Base factory class ( implement Singleton design pattern ). Produce self
* instance to build current skin configuration. At present, realised as lazy
* creation factory. TODO - select point to initialize.
- *
+ *
* @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:59:43 $
- *
+ *
*/
public abstract class SkinFactory {
+ public static final String BASE_SKIN_PARAMETER =
"org.richfaces.BASE_SKIN";
- /**
- * static instance variable.
- */
- private static Map<ClassLoader, SkinFactory> instances =
- Collections.synchronizedMap(new HashMap<ClassLoader, SkinFactory>());
+ /**
+ * Full class name of default implementation of the SkinFactory class
+ */
+ public static final String DEFAULT_SKIN_FACTORY_IMPL_CLASS =
"org.richfaces.skin.SkinFactoryImpl";
- private static final Logger log = RichfacesLogger.APPLICATION.getLogger();
+ /**
+ * Name of web application init parameter for current skin . Can be simple
+ * String for non-modified name, or EL-expression for calculate current
+ * skin. If EL evaluated to <code>String</code> - used as skin name, if
to
+ * instance of {@link Skin } - used this instance. by default -
+ * "org.exadel.chameleon.SKIN"
+ */
+ public static final String SKIN_PARAMETER = "org.richfaces.SKIN";
- public static void reset() {
- instances = Collections.synchronizedMap(new HashMap<ClassLoader,
SkinFactory>());
- }
+ /**
+ * Resource Uri for file with name of class for application-wide SkinFactory same as
SPI definitions for
+ * common Java SAX, Jsf etc. factories
+ */
+ public static final String SERVICE_RESOURCE = "META-INF/services/" +
SkinFactory.class.getName();
- /**
- * Initialize skin factory. TODO - make call from init() method of any
- * servlet or custom faces element method ??? If exist resource
- * META-INF/services/org.richfaces.skin.SkinFactory , create
- * instance of class by name from first line of this file. If such class
- * have constructor with {@link SkinFactory} parameter, instantiate it with
- * instance of default factory ( as usual in JSF ). If any error occurs in
- * instantiate custom factory, return default.
- */
- public static final SkinFactory getInstance() {
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- SkinFactory instance = (SkinFactory) instances.get(loader);
- if (instance == null) {
- // Pluggable factories.
- InputStream input = null; // loader.getResourceAsStream(SERVICE_RESOURCE);
- input = URLToStreamHelper.urlToStreamSafe(
- loader.getResource(SERVICE_RESOURCE));
- // have services file.
- if (input != null) {
- try {
- BufferedReader reader = new BufferedReader(
- new InputStreamReader(input));
- String factoryClassName = reader.readLine();
- if (log.isDebugEnabled()) {
- log.debug(Messages.getMessage(
- Messages.SET_SKIN_FACTORY_INFO,
- factoryClassName));
- }
- instance = instantiateSkinFactory(factoryClassName, loader);
- } catch (Exception e) {
- log
- .warn(
- Messages
- .getMessage(Messages.CREATING_SKIN_FACTORY_ERROR),
- e);
- } finally {
- try {
- input.close();
- } catch (IOException e) {
- // can be ignored
- }
+ /**
+ * static instance variable.
+ */
+ private static Map<ClassLoader, SkinFactory> instances =
Collections.synchronizedMap(new HashMap<ClassLoader,
+ SkinFactory>());
+ private static final Logger LOG = RichfacesLogger.APPLICATION.getLogger();
- }
- }
- if (instance == null) {
- // instantiate default implementation of SkinFactory -
org.richfaces.skin.SkinFactoryImpl,
- // placed in the richfaces-impl.jar
- instance = instantiateSkinFactory(DEFAULT_SKIN_FACTORY_IMPL_CLASS, loader);
- }
- instances.put(loader, instance);
- }
+// public abstract SkinConfiguration getSkinConfiguration(FacesContext context);
+ public static void reset() {
+ instances = Collections.synchronizedMap(new HashMap<ClassLoader,
SkinFactory>());
+ }
- return instance;
- }
-
- /**
- * Create new instance of class with given name with the help of given
<code>ClassLoader</code>.
- * Instantiated class should extend <code>SkinFactory</code> base class.
- * @param factoryClassName - class name of SkinFactory
- * @param classLoader - class loader
- * @return - instantiated <code>SkinFactory</code>
- * @throws FacesException - FacesException is thrown when instantiation fails;
- * causing exception is wrapped into
<code>FacesException</code>
- */
- private static SkinFactory instantiateSkinFactory(String factoryClassName, ClassLoader
classLoader) throws FacesException {
- SkinFactory instance = null;
- try {
- Class<?> clazz = Class.forName(factoryClassName, false, classLoader);
- try {
- // try construct factory chain.
- Constructor<?> factoryConstructor = clazz.getConstructor(new Class[] {
SkinFactory.class });
- instance = (SkinFactory) factoryConstructor.newInstance(new Object[] { instance
});
- } catch (NoSuchMethodException e) {
- // no chain constructor - attempt default.
- instance = (SkinFactory) clazz.newInstance();
- }
- } catch (InvocationTargetException ite) {
- log.error(Messages.getMessage(Messages.CREATING_SKIN_FACTORY_ERROR), ite);
- throw new FacesException("Exception when creating instance of [" +
SkinFactory.class.getName() + "]", ite);
- } catch (InstantiationException ie) {
- log.error(Messages.getMessage(Messages.CREATING_SKIN_FACTORY_ERROR), ie);
- throw new FacesException("Exception when creating instance of [" +
SkinFactory.class.getName() + "]", ie);
- } catch (IllegalAccessException iae) {
- log.error(Messages.getMessage(Messages.CREATING_SKIN_FACTORY_ERROR), iae);
- throw new FacesException("Exception when creating instance of [" +
SkinFactory.class.getName() + "]", iae);
- } catch (ClassNotFoundException cnfe) {
- log.error(Messages.getMessage(Messages.CREATING_SKIN_FACTORY_ERROR), cnfe);
- throw new FacesException("Exception when creating instance of [" +
SkinFactory.class.getName() + "]", cnfe);
- }
+ /**
+ * Initialize skin factory. TODO - make call from init() method of any
+ * servlet or custom faces element method ??? If exist resource
+ * META-INF/services/org.richfaces.skin.SkinFactory , create
+ * instance of class by name from first line of this file. If such class
+ * have constructor with {@link SkinFactory} parameter, instantiate it with
+ * instance of default factory ( as usual in JSF ). If any error occurs in
+ * instantiate custom factory, return default.
+ */
+ public static final SkinFactory getInstance() {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ SkinFactory instance = (SkinFactory) instances.get(loader);
- return instance;
- }
+ if (instance == null) {
- /**
- * Get default {@link Skin} implementation.
- *
- * @param context
- * @return
- */
- public abstract Skin getDefaultSkin(FacesContext context);
-
- /**
- * Get current {@link Skin} implementation.
- * @param context
- * @return
- */
- public abstract Skin getSkin(FacesContext context);
-
-// public abstract SkinConfiguration getSkinConfiguration(FacesContext context);
-
-
-
- /**
- * Resource Uri for file with name of class for application-wide SkinFactory same as SPI
definitions for common Java SAX, Jsf etc. factories
- */
- public static final String SERVICE_RESOURCE = "META-INF/services/" +
SkinFactory.class.getName();
+ // Pluggable factories.
+ InputStream input = null; // loader.getResourceAsStream(SERVICE_RESOURCE);
- /**
- * Name of web application init parameter for current skin . Can be simple
- * String for non-modified name, or EL-expression for calculate current
- * skin. If EL evaluated to <code>String</code> - used as skin name, if to
- * instance of {@link Skin } - used this instance. by default -
- * "org.exadel.chameleon.SKIN"
- */
- public static final String SKIN_PARAMETER = "org.richfaces.SKIN";
+ input =
URLToStreamHelper.urlToStreamSafe(loader.getResource(SERVICE_RESOURCE));
- public static final String BASE_SKIN_PARAMETER = "org.richfaces.BASE_SKIN";
-
- /**
- * Full class name of default implementation of the SkinFactory class
- */
- public static final String DEFAULT_SKIN_FACTORY_IMPL_CLASS =
"org.richfaces.skin.SkinFactoryImpl";
+ // have services file.
+ if (input != null) {
+ try {
+ BufferedReader reader = new BufferedReader(new
InputStreamReader(input));
+ String factoryClassName = reader.readLine();
- /**
- * Get base {@link Skin} implementation
- * @param facesContext
- * @return
- */
- public abstract Skin getBaseSkin(FacesContext facesContext);
-
- /**
- * @param facesContext
- * @param name
- * @return
- */
- public abstract Theme getTheme(FacesContext facesContext, String name);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(Messages.getMessage(Messages.SET_SKIN_FACTORY_INFO,
factoryClassName));
+ }
+ instance = instantiateSkinFactory(factoryClassName, loader);
+ } catch (Exception e) {
+ LOG.warn(Messages.getMessage(Messages.CREATING_SKIN_FACTORY_ERROR),
e);
+ } finally {
+ try {
+ input.close();
+ } catch (IOException e) {
+
+ // can be ignored
+ }
+ }
+ }
+
+ if (instance == null) {
+
+ // instantiate default implementation of SkinFactory -
org.richfaces.skin.SkinFactoryImpl,
+ // placed in the richfaces-impl.jar
+ instance = instantiateSkinFactory(DEFAULT_SKIN_FACTORY_IMPL_CLASS,
loader);
+ }
+
+ instances.put(loader, instance);
+ }
+
+ return instance;
+ }
+
+ /**
+ * Create new instance of class with given name with the help of given
<code>ClassLoader</code>.
+ * Instantiated class should extend <code>SkinFactory</code> base class.
+ * @param factoryClassName - class name of SkinFactory
+ * @param classLoader - class loader
+ * @return - instantiated <code>SkinFactory</code>
+ * @throws FacesException - FacesException is thrown when instantiation fails;
+ * causing exception is wrapped into
<code>FacesException</code>
+ */
+ private static SkinFactory instantiateSkinFactory(String factoryClassName,
ClassLoader classLoader)
+ throws FacesException {
+
+ SkinFactory instance = null;
+
+ try {
+ Class<?> clazz = Class.forName(factoryClassName, false, classLoader);
+
+ try {
+
+ // try construct factory chain.
+ Constructor<?> factoryConstructor = clazz.getConstructor(new
Class[] {SkinFactory.class});
+
+ instance = (SkinFactory) factoryConstructor.newInstance(new Object[]
{instance});
+ } catch (NoSuchMethodException e) {
+
+ // no chain constructor - attempt default.
+ instance = (SkinFactory) clazz.newInstance();
+ }
+ } catch (InvocationTargetException ite) {
+ LOG.error(Messages.getMessage(Messages.CREATING_SKIN_FACTORY_ERROR), ite);
+
+ throw new FacesException("Exception when creating instance of [" +
SkinFactory.class.getName() + "]", ite);
+ } catch (InstantiationException ie) {
+ LOG.error(Messages.getMessage(Messages.CREATING_SKIN_FACTORY_ERROR), ie);
+
+ throw new FacesException("Exception when creating instance of [" +
SkinFactory.class.getName() + "]", ie);
+ } catch (IllegalAccessException iae) {
+ LOG.error(Messages.getMessage(Messages.CREATING_SKIN_FACTORY_ERROR), iae);
+
+ throw new FacesException("Exception when creating instance of [" +
SkinFactory.class.getName() + "]", iae);
+ } catch (ClassNotFoundException cnfe) {
+ LOG.error(Messages.getMessage(Messages.CREATING_SKIN_FACTORY_ERROR), cnfe);
+
+ throw new FacesException("Exception when creating instance of [" +
SkinFactory.class.getName() + "]", cnfe);
+ }
+
+ return instance;
+ }
+
+ /**
+ * Get default {@link Skin} implementation.
+ *
+ * @param context
+ * @return
+ */
+ public abstract Skin getDefaultSkin(FacesContext context);
+
+ /**
+ * Get current {@link Skin} implementation.
+ * @param context
+ * @return
+ */
+ public abstract Skin getSkin(FacesContext context);
+
+ /**
+ * Get base {@link Skin} implementation
+ * @param facesContext
+ * @return
+ */
+ public abstract Skin getBaseSkin(FacesContext facesContext);
+
+ /**
+ * @param facesContext
+ * @param name
+ * @return
+ */
+ public abstract Theme getTheme(FacesContext facesContext, String name);
}
Modified:
root/framework/trunk/api/src/main/java/org/richfaces/skin/SkinNotFoundException.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/richfaces/skin/SkinNotFoundException.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/richfaces/skin/SkinNotFoundException.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,35 +19,40 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.richfaces.skin;
import javax.faces.FacesException;
public class SkinNotFoundException extends FacesException {
- /**
- *
- */
- private static final long serialVersionUID = -2498031536712930735L;
+ /**
+ *
+ */
+ private static final long serialVersionUID = -2498031536712930735L;
- public SkinNotFoundException() {
- super();
- // TODO Auto-generated constructor stub
- }
+ public SkinNotFoundException() {
+ super();
- public SkinNotFoundException(String arg0) {
- super(arg0);
- // TODO Auto-generated constructor stub
- }
+ // TODO Auto-generated constructor stub
+ }
- public SkinNotFoundException(Throwable arg0) {
- super(arg0);
- // TODO Auto-generated constructor stub
- }
+ public SkinNotFoundException(String arg0) {
+ super(arg0);
- public SkinNotFoundException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- // TODO Auto-generated constructor stub
- }
+ // TODO Auto-generated constructor stub
+ }
+ public SkinNotFoundException(Throwable arg0) {
+ super(arg0);
+
+ // TODO Auto-generated constructor stub
+ }
+
+ public SkinNotFoundException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+
+ // TODO Auto-generated constructor stub
+ }
}
Modified: root/framework/trunk/api/src/main/java/org/richfaces/skin/Theme.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/skin/Theme.java 2009-11-01
16:34:11 UTC (rev 15797)
+++ root/framework/trunk/api/src/main/java/org/richfaces/skin/Theme.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -1,5 +1,6 @@
+
/**
- *
+ *
*/
package org.richfaces.skin;
@@ -8,13 +9,11 @@
*
*/
public interface Theme {
-
- public String getRendererType();
-
- public String getStyle();
-
- public String getScript();
-
- public Object getProperty(String name);
+ public String getRendererType();
+ public String getStyle();
+
+ public String getScript();
+
+ public Object getProperty(String name);
}
Modified:
root/framework/trunk/api/src/main/java/org/richfaces/skin/ThemeNotFoundException.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/richfaces/skin/ThemeNotFoundException.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/main/java/org/richfaces/skin/ThemeNotFoundException.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,31 +19,32 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.richfaces.skin;
import javax.faces.FacesException;
public class ThemeNotFoundException extends FacesException {
- /**
- *
- */
- private static final long serialVersionUID = 2245209384496054860L;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2245209384496054860L;
- public ThemeNotFoundException() {
- super();
- }
+ public ThemeNotFoundException() {
+ super();
+ }
- public ThemeNotFoundException(String arg0) {
- super(arg0);
- }
+ public ThemeNotFoundException(String arg0) {
+ super(arg0);
+ }
- public ThemeNotFoundException(Throwable arg0) {
- super(arg0);
- }
+ public ThemeNotFoundException(Throwable arg0) {
+ super(arg0);
+ }
- public ThemeNotFoundException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
-
+ public ThemeNotFoundException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
}
Modified: root/framework/trunk/api/src/main/java/org/richfaces/skin/package-info.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/skin/package-info.java 2009-11-01
16:34:11 UTC (rev 15797)
+++ root/framework/trunk/api/src/main/java/org/richfaces/skin/package-info.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -1,3 +1,4 @@
+
/**
* Skin functionality APIs
*/
Modified:
root/framework/trunk/api/src/test/java/org/ajax4jsf/javascript/ResponseWriterWrapperTest.java
===================================================================
---
root/framework/trunk/api/src/test/java/org/ajax4jsf/javascript/ResponseWriterWrapperTest.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/test/java/org/ajax4jsf/javascript/ResponseWriterWrapperTest.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -18,6 +18,9 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
+
package org.ajax4jsf.javascript;
import static org.easymock.EasyMock.aryEq;
@@ -29,7 +32,9 @@
import static org.easymock.classextension.EasyMock.verify;
import java.io.Writer;
+
import java.lang.reflect.Array;
+
import java.util.Random;
import javax.faces.context.ResponseWriter;
@@ -43,167 +48,157 @@
* @since 3.3.2
*/
public class ResponseWriterWrapperTest extends TestCase {
+ private ResponseWriter mockWriter;
+ private Writer writer;
- private ResponseWriter mockWriter;
-
- private Writer writer;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- mockWriter = createStrictMock(ResponseWriter.class);
- writer = new ResponseWriterWrapper(mockWriter);
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mockWriter = createStrictMock(ResponseWriter.class);
+ writer = new ResponseWriterWrapper(mockWriter);
+ }
- this.writer = null;
- this.mockWriter = null;
- }
-
- public void testWrite1() throws Exception {
- char[] cs = new char[] {'a', 'b'};
- mockWriter.writeText(cs, 0, 2);
- replay(mockWriter);
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ this.writer = null;
+ this.mockWriter = null;
+ }
- writer.write(cs);
- verify(mockWriter);
- }
-
- private static char[] expectSingleChar(final char c) {
- reportMatcher(new IArgumentMatcher() {
+ public void testWrite1() throws Exception {
+ char[] cs = new char[] {'a', 'b'};
- private String failureMessage;
-
- public void appendTo(StringBuffer sb) {
- sb.append(failureMessage);
- }
+ mockWriter.writeText(cs, 0, 2);
+ replay(mockWriter);
+ writer.write(cs);
+ verify(mockWriter);
+ }
- public boolean matches(Object o) {
- if (!(o instanceof char[])) {
- failureMessage = "Array of chars expected as argument";
- } else {
- if (Array.getLength(o) == 0) {
- failureMessage = "Array should be of non-zero length";
- } else {
- if (Array.getChar(o, 0) != c) {
- failureMessage = "["+c+"] expected as [0] char";
- }
- }
- }
-
- return failureMessage == null;
- }
-
- });
-
- return null;
- }
-
- private static char[] expectFirstChars(final char[] cs) {
- return expectFirstChars(cs, cs.length);
- }
+ private static char[] expectSingleChar(final char c) {
+ reportMatcher(new IArgumentMatcher() {
+ private String failureMessage;
+ public void appendTo(StringBuffer sb) {
+ sb.append(failureMessage);
+ }
+ public boolean matches(Object o) {
+ if (!(o instanceof char[])) {
+ failureMessage = "Array of chars expected as argument";
+ } else {
+ if (Array.getLength(o) == 0) {
+ failureMessage = "Array should be of non-zero length";
+ } else {
+ if (Array.getChar(o, 0) != c) {
+ failureMessage = "[" + c + "] expected as [0]
char";
+ }
+ }
+ }
- private static char[] expectFirstChars(final char[] cs, final int length) {
- reportMatcher(new IArgumentMatcher() {
+ return failureMessage == null;
+ }
+ });
- private String failureMessage;
-
- public void appendTo(StringBuffer sb) {
- sb.append(failureMessage);
- }
+ return null;
+ }
- public boolean matches(Object o) {
- if (!(o instanceof char[])) {
- failureMessage = "Array of chars expected as argument";
- } else {
- char[] argChars = (char[]) o;
- if (argChars.length < length) {
- failureMessage = "Array should have minimum " + length + " length,
but has only: " + argChars.length;
- } else {
- for (int i = 0; i < length; i++) {
- if (argChars[i] != cs[i]) {
- failureMessage = "Char at offset [" + i + "] mismath: expected
" + cs[i] + " but was " + argChars[i];
- break;
- }
- }
- }
- }
-
- return failureMessage == null;
- }
-
- });
-
- return null;
- }
-
- public void testWrite2() throws Exception {
- mockWriter.writeText(expectSingleChar((char) 0x5678), eq(0), eq(1));
- mockWriter.writeText(expectSingleChar((char) 0xBA98), eq(0), eq(1));
- replay(mockWriter);
- writer.write(0x12345678);
- writer.write(0xFECDBA98);
- verify(mockWriter);
- }
-
- public void testWrite3() throws Exception {
- mockWriter.writeText(eq("test"), (String) isNull());
- replay(mockWriter);
- writer.write("test");
- verify(mockWriter);
- }
-
- public void testWrite4() throws Exception {
- mockWriter.writeText(aryEq("abcd".toCharArray()), eq(1), eq(2));
- mockWriter.writeText(aryEq("efgh".toCharArray()), eq(0), eq(3));
- mockWriter.writeText(aryEq("ijklm".toCharArray()), eq(2), eq(3));
+ private static char[] expectFirstChars(final char[] cs) {
+ return expectFirstChars(cs, cs.length);
+ }
- replay(mockWriter);
- writer.write("abcd".toCharArray(), 1, 2);
- writer.write("efgh".toCharArray(), 0, 3);
- writer.write("ijklm".toCharArray(), 2, 3);
- verify(mockWriter);
- }
-
- public void testWrite5() throws Exception {
- mockWriter.writeText(expectFirstChars("string to".toCharArray()), eq(0),
eq(9));
- mockWriter.writeText(expectFirstChars("one".toCharArray()), eq(0), eq(3));
-
- replay(mockWriter);
- writer.write("string to test", 0, 9);
- writer.write("short one", 6, 3);
- verify(mockWriter);
- }
-
- public void testWrite6() throws Exception {
- char[] cs = new char[4098];
- int length = cs.length - 2;
+ private static char[] expectFirstChars(final char[] cs, final int length) {
+ reportMatcher(new IArgumentMatcher() {
+ private String failureMessage;
+ public void appendTo(StringBuffer sb) {
+ sb.append(failureMessage);
+ }
+ public boolean matches(Object o) {
+ if (!(o instanceof char[])) {
+ failureMessage = "Array of chars expected as argument";
+ } else {
+ char[] argChars = (char[]) o;
- for (int i = 0; i < cs.length; i++) {
- cs[i] = (char) new Random().nextInt(Character.MAX_VALUE + 1);
- }
-
- mockWriter.writeText(expectFirstChars(cs, length), eq(0), eq(length));
- replay(mockWriter);
- writer.write(String.valueOf(cs), 0, length);
- verify(mockWriter);
- }
-
- public void testFlush() throws Exception {
- mockWriter.flush();
- replay(mockWriter);
- writer.flush();
- verify(mockWriter);
- }
+ if (argChars.length < length) {
+ failureMessage = "Array should have minimum " + length
+ " length, but has only: "
+ + argChars.length;
+ } else {
+ for (int i = 0; i < length; i++) {
+ if (argChars[i] != cs[i]) {
+ failureMessage = "Char at offset [" + i +
"] mismath: expected " + cs[i] + " but was "
+ + argChars[i];
- public void testClose() throws Exception {
- mockWriter.close();
- replay(mockWriter);
- writer.close();
- verify(mockWriter);
- }
+ break;
+ }
+ }
+ }
+ }
+
+ return failureMessage == null;
+ }
+ });
+
+ return null;
+ }
+
+ public void testWrite2() throws Exception {
+ mockWriter.writeText(expectSingleChar((char) 0x5678), eq(0), eq(1));
+ mockWriter.writeText(expectSingleChar((char) 0xBA98), eq(0), eq(1));
+ replay(mockWriter);
+ writer.write(0x12345678);
+ writer.write(0xFECDBA98);
+ verify(mockWriter);
+ }
+
+ public void testWrite3() throws Exception {
+ mockWriter.writeText(eq("test"), (String) isNull());
+ replay(mockWriter);
+ writer.write("test");
+ verify(mockWriter);
+ }
+
+ public void testWrite4() throws Exception {
+ mockWriter.writeText(aryEq("abcd".toCharArray()), eq(1), eq(2));
+ mockWriter.writeText(aryEq("efgh".toCharArray()), eq(0), eq(3));
+ mockWriter.writeText(aryEq("ijklm".toCharArray()), eq(2), eq(3));
+ replay(mockWriter);
+ writer.write("abcd".toCharArray(), 1, 2);
+ writer.write("efgh".toCharArray(), 0, 3);
+ writer.write("ijklm".toCharArray(), 2, 3);
+ verify(mockWriter);
+ }
+
+ public void testWrite5() throws Exception {
+ mockWriter.writeText(expectFirstChars("string to".toCharArray()),
eq(0), eq(9));
+ mockWriter.writeText(expectFirstChars("one".toCharArray()), eq(0),
eq(3));
+ replay(mockWriter);
+ writer.write("string to test", 0, 9);
+ writer.write("short one", 6, 3);
+ verify(mockWriter);
+ }
+
+ public void testWrite6() throws Exception {
+ char[] cs = new char[4098];
+ int length = cs.length - 2;
+
+ for (int i = 0; i < cs.length; i++) {
+ cs[i] = (char) new Random().nextInt(Character.MAX_VALUE + 1);
+ }
+
+ mockWriter.writeText(expectFirstChars(cs, length), eq(0), eq(length));
+ replay(mockWriter);
+ writer.write(String.valueOf(cs), 0, length);
+ verify(mockWriter);
+ }
+
+ public void testFlush() throws Exception {
+ mockWriter.flush();
+ replay(mockWriter);
+ writer.flush();
+ verify(mockWriter);
+ }
+
+ public void testClose() throws Exception {
+ mockWriter.close();
+ replay(mockWriter);
+ writer.close();
+ verify(mockWriter);
+ }
}
Modified:
root/framework/trunk/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java
===================================================================
---
root/framework/trunk/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -19,11 +19,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
package org.ajax4jsf.javascript;
import static org.easymock.EasyMock.capture;
import static org.easymock.EasyMock.isNull;
-import static org.easymock.classextension.EasyMock.createNiceMock;
import static org.easymock.classextension.EasyMock.replay;
import static org.easymock.classextension.EasyMock.*;
@@ -45,271 +46,297 @@
/**
* @author shura
- *
*/
public class ScriptUtilsTest extends TestCase {
- /**
- * @author shura
- *
- */
- public static class Bean {
-
- int _integer;
- boolean _bool;
- Object _foo;
-
- public Bean() {
- }
- /**
- * @param ineger
- * @param bool
- * @param foo
- */
- public Bean(int ineger, boolean bool, Object foo) {
- this._integer = ineger;
- this._bool = bool;
- this._foo = foo;
- }
- /**
- * @return the bool
- */
- public boolean isBool() {
- return this._bool;
- }
- /**
- * @param bool the bool to set
- */
- public void setBool(boolean bool) {
- this._bool = bool;
- }
- /**
- * @return the ineger
- */
- public int getInteger() {
- return this._integer;
- }
- /**
- * @param ineger the ineger to set
- */
- public void setInteger(int ineger) {
- this._integer = ineger;
- }
- /**
- * @return the foo
- */
- public Object getFoo() {
- return this._foo;
- }
- /**
- * @param foo the foo to set
- */
- public void setFoo(Object foo) {
- this._foo = foo;
- }
- }
+ /**
+ * @param name
+ */
+ public ScriptUtilsTest(String name) {
+ super(name);
+ }
- /**
- * @param name
- */
- public ScriptUtilsTest(String name) {
- super(name);
- }
+ private static enum TestEnum {
+ A, B, C;
- /**
- * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testStringToScript() {
- Object obj = "foo";
- assertEquals("'foo'", ScriptUtils.toScript(obj));
- }
+ @Override
+ public String toString() {
+ return "TestEnum: " + super.toString();
+ }
+ }
- /**
- * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testArrayToScript() {
- int[] obj = {1,2,3,4,5};
- assertEquals("[1,2,3,4,5] ", ScriptUtils.toScript(obj));
- }
+ /**
+ * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testStringToScript() {
+ Object obj = "foo";
- public void testSqlDate() {
- java.sql.Time obj = new java.sql.Time(1);
- String timeString = ScriptUtils.toScript(obj);
- timeString = ScriptUtils.toScript(obj);
- timeString = ScriptUtils.toScript(obj);
- timeString = ScriptUtils.toScript(obj);
- timeString = ScriptUtils.toScript(obj);
- assertNotNull(timeString);
- assertFalse(timeString.contains("year"));
-
- java.sql.Date obj1 = new java.sql.Date(1);
- String dateString = ScriptUtils.toScript(obj1);
- assertNotNull(dateString);
- assertFalse(dateString.contains("seconds"));
- }
-
- /**
- * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testTwoDimentionalArrayToScript() {
- int[][] obj = {{1,2},{3,4}};
- assertEquals("[[1,2] ,[3,4] ] ", ScriptUtils.toScript(obj));
- }
+ assertEquals("'foo'", ScriptUtils.toScript(obj));
+ }
- /**
- * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testTwoDimentionalStringArrayToScript() {
- String[][] obj =
{{"one","two"},{"three","four"}};
- assertEquals("[['one','two'] ,['three','four'] ]
", ScriptUtils.toScript(obj));
- Map<String, Object> map = new TreeMap<String, Object>();
- map.put("a", obj);
- map.put("b", "c");
- assertEquals("{'a':[['one','two']
,['three','four'] ] ,'b':'c'} ",
ScriptUtils.toScript(map));
- }
- /**
- * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testListToScript() {
- List<Integer> obj = new ArrayList<Integer>();
- obj.add(new Integer(1));
- obj.add(new Integer(2));
- obj.add(new Integer(3));
- obj.add(new Integer(4));
- obj.add(new Integer(5));
- assertEquals("[1,2,3,4,5] ", ScriptUtils.toScript(obj));
- }
+ /**
+ * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testArrayToScript() {
+ int[] obj = {1, 2, 3, 4, 5};
- /**
- * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testSetToScript() {
- Set<Integer> obj = new TreeSet<Integer>();
- obj.add(new Integer(1));
- obj.add(new Integer(2));
- obj.add(new Integer(3));
- obj.add(new Integer(4));
- obj.add(new Integer(5));
- assertEquals("[1,2,3,4,5] ", ScriptUtils.toScript(obj));
- }
- /**
- * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testObjectArrayToScript() {
- Bean[] obj = {new Bean(1,true,"foo"),new Bean(2,false,"bar")};
- assertEquals("[{'bool':true,'foo':'foo',\'integer\':1}
,{'bool':false,'foo':'bar','integer':2} ] ",
ScriptUtils.toScript(obj));
- }
+ assertEquals("[1,2,3,4,5] ", ScriptUtils.toScript(obj));
+ }
- /**
- * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testObjectListToScript() {
- Bean[] array = {new Bean(1,true,"foo"),new Bean(2,false,"bar")};
- List<Bean> obj = Arrays.asList(array);
- assertEquals("[{'bool':true,'foo':'foo',\'integer\':1}
,{'bool':false,'foo':'bar','integer':2} ] ",
ScriptUtils.toScript(obj));
- }
-
- /**
- * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testMapToScript() {
- TreeMap<String, String> obj = new TreeMap<String, String>();
- obj.put("a", "foo");
- obj.put("b", "bar");
- obj.put("c", "baz");
- assertEquals("{'a':'foo','b':'bar','c':'baz'}
", ScriptUtils.toScript(obj));
- }
- /**
- * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#addEncodedString(java.lang.StringBuffer,
java.lang.Object)}.
- */
- public void testAddEncodedString() {
- StringBuilder buff = new StringBuilder();
- ScriptUtils.addEncodedString(buff, "foo");
- assertEquals("'foo'", buff.toString());
- }
+ public void testSqlDate() {
+ java.sql.Time obj = new java.sql.Time(1);
+ String timeString = ScriptUtils.toScript(obj);
- /**
- * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#addEncoded(java.lang.StringBuffer,
java.lang.Object)}.
- */
- public void testAddEncoded() {
- StringBuilder buff = new StringBuilder();
- ScriptUtils.addEncoded(buff, "foo\"\'");
- assertEquals("foo\\\"\\\'", buff.toString());
- }
+ timeString = ScriptUtils.toScript(obj);
+ timeString = ScriptUtils.toScript(obj);
+ timeString = ScriptUtils.toScript(obj);
+ timeString = ScriptUtils.toScript(obj);
+ assertNotNull(timeString);
+ assertFalse(timeString.contains("year"));
- /**
- * Test method for {@link ScriptUtils#toScript(Object)}
- */
- public void testNull() throws Exception {
- assertEquals("null", ScriptUtils.toScript(null));
- }
-
- /**
- * Test method for {@link ScriptUtils#toScript(Object)}
- */
- public void testScriptString() throws Exception {
- assertEquals("alert(x<y);", ScriptUtils.toScript(new
JSLiteral("alert(x<y);")));
- }
-
- private static enum TestEnum {
- A, B, C;
-
- @Override
- public String toString() {
- return "TestEnum: " + super.toString();
- }
- }
-
- /**
- * Test method for {@link ScriptUtils#toScript(Object)}
- */
- public void testEnum() throws Exception {
- assertEquals("'TestEnum: B'", ScriptUtils.toScript(TestEnum.B));
- }
-
- private void assertCaptureEquals(Capture<? extends Object> capture, String
expected) {
- StringBuilder sb = new StringBuilder();
- List<? extends Object> list = capture.getValues();
- for (Object o : list) {
- assertNotNull(o);
- sb.append(o);
- }
-
- assertEquals(expected, sb.toString().trim());
- }
-
- /**
- * Test method for {@link ScriptUtils#writeToStream(javax.faces.context.ResponseWriter,
Object)}
- */
- public void testWriteToStream() throws Exception {
- ResponseWriter mockWriter = createNiceMock(ResponseWriter.class);
- Capture<? extends Object> capture = new Capture<Object>(CaptureType.ALL) {
- /**
- *
- */
- private static final long serialVersionUID = -4915440411892856583L;
+ java.sql.Date obj1 = new java.sql.Date(1);
+ String dateString = ScriptUtils.toScript(obj1);
- @Override
- public void setValue(Object value) {
- if (value instanceof char[]) {
- char[] cs = (char[]) value;
- super.setValue(new String(cs, 0, 1));
- } else {
- super.setValue(value);
- }
- }
- };
-
-
- mockWriter.writeText(capture(capture), (String) isNull());
- expectLastCall().anyTimes();
- mockWriter.writeText((char[])capture(capture), eq(0), eq(1));
- expectLastCall().anyTimes();
-
- replay(mockWriter);
- ScriptUtils.writeToStream(mockWriter, Collections.singletonMap("delay",
Integer.valueOf(1500)));
- verify(mockWriter);
-
- assertCaptureEquals(capture, "{'delay':1500}");
- }
+ assertNotNull(dateString);
+ assertFalse(dateString.contains("seconds"));
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testTwoDimentionalArrayToScript() {
+ int[][] obj = {
+ {1, 2}, {3, 4}
+ };
+
+ assertEquals("[[1,2] ,[3,4] ] ", ScriptUtils.toScript(obj));
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testTwoDimentionalStringArrayToScript() {
+ String[][] obj = {
+ {"one", "two"}, {"three", "four"}
+ };
+
+ assertEquals("[['one','two']
,['three','four'] ] ", ScriptUtils.toScript(obj));
+
+ Map<String, Object> map = new TreeMap<String, Object>();
+
+ map.put("a", obj);
+ map.put("b", "c");
+ assertEquals("{'a':[['one','two']
,['three','four'] ] ,'b':'c'} ",
ScriptUtils.toScript(map));
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testListToScript() {
+ List<Integer> obj = new ArrayList<Integer>();
+
+ obj.add(new Integer(1));
+ obj.add(new Integer(2));
+ obj.add(new Integer(3));
+ obj.add(new Integer(4));
+ obj.add(new Integer(5));
+ assertEquals("[1,2,3,4,5] ", ScriptUtils.toScript(obj));
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testSetToScript() {
+ Set<Integer> obj = new TreeSet<Integer>();
+
+ obj.add(new Integer(1));
+ obj.add(new Integer(2));
+ obj.add(new Integer(3));
+ obj.add(new Integer(4));
+ obj.add(new Integer(5));
+ assertEquals("[1,2,3,4,5] ", ScriptUtils.toScript(obj));
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testObjectArrayToScript() {
+ Bean[] obj = {new Bean(1, true, "foo"), new Bean(2, false,
"bar")};
+
+
assertEquals("[{'bool':true,'foo':'foo',\'integer\':1}
,{'bool':false,'foo':'bar','integer':2} ] ",
+ ScriptUtils.toScript(obj));
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testObjectListToScript() {
+ Bean[] array = {new Bean(1, true, "foo"), new Bean(2, false,
"bar")};
+ List<Bean> obj = Arrays.asList(array);
+
+
assertEquals("[{'bool':true,'foo':'foo',\'integer\':1}
,{'bool':false,'foo':'bar','integer':2} ] ",
+ ScriptUtils.toScript(obj));
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testMapToScript() {
+ TreeMap<String, String> obj = new TreeMap<String, String>();
+
+ obj.put("a", "foo");
+ obj.put("b", "bar");
+ obj.put("c", "baz");
+
assertEquals("{'a':'foo','b':'bar','c':'baz'}
", ScriptUtils.toScript(obj));
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#addEncodedString(java.lang.StringBuffer,
java.lang.Object)}.
+ */
+ public void testAddEncodedString() {
+ StringBuilder buff = new StringBuilder();
+
+ ScriptUtils.addEncodedString(buff, "foo");
+ assertEquals("'foo'", buff.toString());
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#addEncoded(java.lang.StringBuffer,
java.lang.Object)}.
+ */
+ public void testAddEncoded() {
+ StringBuilder buff = new StringBuilder();
+
+ ScriptUtils.addEncoded(buff, "foo\"\'");
+ assertEquals("foo\\\"\\\'", buff.toString());
+ }
+
+ /**
+ * Test method for {@link ScriptUtils#toScript(Object)}
+ */
+ public void testNull() throws Exception {
+ assertEquals("null", ScriptUtils.toScript(null));
+ }
+
+ /**
+ * Test method for {@link ScriptUtils#toScript(Object)}
+ */
+ public void testScriptString() throws Exception {
+ assertEquals("alert(x<y);", ScriptUtils.toScript(new
JSLiteral("alert(x<y);")));
+ }
+
+ /**
+ * Test method for {@link ScriptUtils#toScript(Object)}
+ */
+ public void testEnum() throws Exception {
+ assertEquals("'TestEnum: B'",
ScriptUtils.toScript(TestEnum.B));
+ }
+
+ private void assertCaptureEquals(Capture<? extends Object> capture, String
expected) {
+ StringBuilder sb = new StringBuilder();
+ List<? extends Object> list = capture.getValues();
+
+ for (Object o : list) {
+ assertNotNull(o);
+ sb.append(o);
+ }
+
+ assertEquals(expected, sb.toString().trim());
+ }
+
+ /**
+ * Test method for {@link
ScriptUtils#writeToStream(javax.faces.context.ResponseWriter, Object)}
+ */
+ public void testWriteToStream() throws Exception {
+ ResponseWriter mockWriter = createNiceMock(ResponseWriter.class);
+ Capture<? extends Object> capture = new
Capture<Object>(CaptureType.ALL) {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -4915440411892856583L;
+ @Override
+ public void setValue(Object value) {
+ if (value instanceof char[]) {
+ char[] cs = (char[]) value;
+
+ super.setValue(new String(cs, 0, 1));
+ } else {
+ super.setValue(value);
+ }
+ }
+ };
+
+ mockWriter.writeText(capture(capture), (String) isNull());
+ expectLastCall().anyTimes();
+ mockWriter.writeText((char[]) capture(capture), eq(0), eq(1));
+ expectLastCall().anyTimes();
+ replay(mockWriter);
+ ScriptUtils.writeToStream(mockWriter, Collections.singletonMap("delay",
Integer.valueOf(1500)));
+ verify(mockWriter);
+ assertCaptureEquals(capture, "{'delay':1500}");
+ }
+
+ /**
+ * @author shura
+ */
+ public static class Bean {
+ private boolean bool;
+ private Object foo;
+ private int integer;
+
+ public Bean() {}
+
+ /**
+ * @param ineger
+ * @param bool
+ * @param foo
+ */
+ public Bean(int ineger, boolean bool, Object foo) {
+ this.integer = ineger;
+ this.bool = bool;
+ this.foo = foo;
+ }
+
+ /**
+ * @return the bool
+ */
+ public boolean isBool() {
+ return this.bool;
+ }
+
+ /**
+ * @param bool the bool to set
+ */
+ public void setBool(boolean bool) {
+ this.bool = bool;
+ }
+
+ /**
+ * @return the ineger
+ */
+ public int getInteger() {
+ return this.integer;
+ }
+
+ /**
+ * @param ineger the ineger to set
+ */
+ public void setInteger(int ineger) {
+ this.integer = ineger;
+ }
+
+ /**
+ * @return the foo
+ */
+ public Object getFoo() {
+ return this.foo;
+ }
+
+ /**
+ * @param foo the foo to set
+ */
+ public void setFoo(Object foo) {
+ this.foo = foo;
+ }
+ }
}
Modified:
root/framework/trunk/api/src/test/java/org/ajax4jsf/javascript/StringBuilderWriterTest.java
===================================================================
---
root/framework/trunk/api/src/test/java/org/ajax4jsf/javascript/StringBuilderWriterTest.java 2009-11-01
16:34:11 UTC (rev 15797)
+++
root/framework/trunk/api/src/test/java/org/ajax4jsf/javascript/StringBuilderWriterTest.java 2009-11-01
16:51:11 UTC (rev 15798)
@@ -18,6 +18,9 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+
+
package org.ajax4jsf.javascript;
import java.io.Writer;
@@ -29,69 +32,65 @@
* @since 3.3.2
*/
public class StringBuilderWriterTest extends TestCase {
+ private StringBuilder builder;
+ private Writer writer;
- private StringBuilder builder;
-
- private Writer writer;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.builder = new StringBuilder();
+ this.writer = new StringBuilderWriter(this.builder);
+ }
- this.builder = new StringBuilder();
- this.writer = new StringBuilderWriter(this.builder);
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ this.builder = null;
+ this.writer = null;
+ }
- this.builder = null;
- this.writer = null;
- }
-
- public void testWrite() throws Exception {
- writer.write(new char[] {'a', 'b'});
- assertEquals("ab", builder.toString());
- }
+ public void testWrite() throws Exception {
+ writer.write(new char[] {'a', 'b'});
+ assertEquals("ab", builder.toString());
+ }
- public void testWrite2() throws Exception {
- writer.write(0x12345678);
-
- String s = builder.toString();
- assertEquals(1, s.length());
- assertEquals(0x5678, s.charAt(0));
- }
-
- public void testWrite3() throws Exception {
- writer.write("test");
-
- assertEquals("test", builder.toString());
- }
-
- public void testWrite4() throws Exception {
- writer.write("abcd".toCharArray(), 1, 2);
- assertEquals("bc", builder.toString());
- writer.write("efgh".toCharArray(), 0, 3);
- assertEquals("bcefg", builder.toString());
- writer.write("ijkl".toCharArray(), 2, 2);
- assertEquals("bcefgkl", builder.toString());
- }
-
- public void testWrite5() throws Exception {
- writer.write("abcd", 1, 2);
- assertEquals("bc", builder.toString());
- writer.write("efgh", 0, 3);
- assertEquals("bcefg", builder.toString());
- writer.write("ijklm", 2, 3);
- assertEquals("bcefgklm", builder.toString());
- }
-
- public void testFlush() throws Exception {
- writer.flush();
- }
-
- public void testClose() throws Exception {
- writer.close();
- }
+ public void testWrite2() throws Exception {
+ writer.write(0x12345678);
+
+ String s = builder.toString();
+
+ assertEquals(1, s.length());
+ assertEquals(0x5678, s.charAt(0));
+ }
+
+ public void testWrite3() throws Exception {
+ writer.write("test");
+ assertEquals("test", builder.toString());
+ }
+
+ public void testWrite4() throws Exception {
+ writer.write("abcd".toCharArray(), 1, 2);
+ assertEquals("bc", builder.toString());
+ writer.write("efgh".toCharArray(), 0, 3);
+ assertEquals("bcefg", builder.toString());
+ writer.write("ijkl".toCharArray(), 2, 2);
+ assertEquals("bcefgkl", builder.toString());
+ }
+
+ public void testWrite5() throws Exception {
+ writer.write("abcd", 1, 2);
+ assertEquals("bc", builder.toString());
+ writer.write("efgh", 0, 3);
+ assertEquals("bcefg", builder.toString());
+ writer.write("ijklm", 2, 3);
+ assertEquals("bcefgklm", builder.toString());
+ }
+
+ public void testFlush() throws Exception {
+ writer.flush();
+ }
+
+ public void testClose() throws Exception {
+ writer.close();
+ }
}