Author: nbelaevski
Date: 2009-07-07 13:19:37 -0400 (Tue, 07 Jul 2009)
New Revision: 14815
Added:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequestRegistry.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/CapturingELResolver.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/GenericsIntrospectionCache.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/RowKeyConverterRule.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/component/FileUploadConstants.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ExtendedTableDataModifiableModel.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/Base2WayGradient.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/skin/ThemeImpl.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/CollectionsUtils.java
Removed:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/model/
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/image/DiffusionFilterOp.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/image/GIFEncoder.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/image/Quantize.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ExtendedDataTableModifiableModel.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ExtendedTableDataModelWrapper.java
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxChildrenRenderer.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxComponentRendererBase.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxContainerRenderer.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/HeaderResourcesRendererBase.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererBase.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/compiler/WithDefaultsRulesWrapper.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/CacheContext.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/CachedResourceContext.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ClientScript.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/CompressedScriptRenderer.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/CountingOutputWriter.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/FacesResourceContext.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/GifRenderer.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceBuilderImpl.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceLifecycle.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ServletResourceContext.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/StaticResource.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/TemplateCSSResource.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/UserResource.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/cached/CachedResourceBuilder.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/cached/DualLRUMap.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/cached/ResourceBean.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/cached/ResourceBytesDataBean.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/cached/ResourceDataBean.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/ELUtils.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/GifEncoder.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/LRUMap.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/SelectUtils.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/Zipper.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/Base64.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/BinaryDecoder.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/BinaryEncoder.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/Decoder.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/DecoderException.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/Encoder.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/EncoderException.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/URL64Codec.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/URLCodec.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/ConfigurableFilter.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/ConfigurableXMLFilter.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/FilterServletResponseWrapper.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/HtmlParser.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/ParserConfig.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/PollEventsManager.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/PushEventsCounter.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/AjaxActionsRule.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/EmptyHandler.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/UIComponentTagBase.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/tidy/TidyParser.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/AttributesImplSerializer.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/CharInfo.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/DOMSerializer.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ElemContext.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ElemDesc.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/EmptySerializer.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/EncodingInfo.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/Encodings.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ExtendedContentHandler.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ExtendedLexicalHandler.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/Method.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/NamespaceMappings.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ObjectFactory.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/OutputPropertiesFactory.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/OutputPropertyUtils.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SecuritySupport.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SecuritySupport12.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializationHandler.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/Serializer.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializerBase.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializerConstants.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializerFactory.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializerTrace.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializerTraceWriter.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToHTMLSAXHandler.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToHTMLStream.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToSAXHandler.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToStream.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToTextSAXHandler.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToTextStream.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToUnknownStream.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToXHTMLStream.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToXMLSAXHandler.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToXMLStream.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/TransformStateSetter.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/TreeWalker.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/Version.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/WriterChain.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/WriterToASCI.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/WriterToUTF8Buffered.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/XSLOutputAttributes.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/AttList.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/BoolStack.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/DOM2Helper.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/Messages.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/MsgKey.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_ca.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_cs.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_de.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_en.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_es.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_fr.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_hu.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_it.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_ja.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_ko.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_pl.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_pt_BR.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_ru.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_sv.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_tr.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_zh_CN.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_zh_TW.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/StringToIntTable.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SystemIDResolver.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/URI.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/Utils.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/WrappedRuntimeException.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/VersionBean.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/component/UISwitchablePanel.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/component/util/ComponentUtil.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/event/RenderPhaseComponentListener.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/CDL.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/Cookie.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/CookieList.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/HTTP.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/HTTPTokener.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONArray.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONCollection.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONException.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONMap.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONObject.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONStringer.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONTokener.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONWriter.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/XML.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/XMLTokener.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/DataModelCache.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ExtendedTableDataModel.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ListSequenceDataModel.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ModifiableModel.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/ArrayDataModel.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/ListDataModel.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/SimpleGridDataModel.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/JavaBeanWrapper.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/MethodBindingExpression.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/NullExpression.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/ObjectWrapperFactory.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/SimplePropertyExpression.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/ValueBindingExpression.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanComparator.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanComparator2.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanFilter.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/CompositeRenderer.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/Expression.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/MacroDefinitionJSContentHandler.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/ScriptOptions.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/TemplateEncoderRendererBase.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxArrowImage.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxArrowImageDisable.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxButtonPressGradient.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/EditIcon.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/GradientType.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SaveControlIcon.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/ReferenceMap.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/RenderPhaseComponentVisitorUtils.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/webapp/taglib/MethodBindingMethodExpressionAdaptor.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/webapp/taglib/SimpleComponentTag.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/webapp/taglib/UIComponentELTagBase.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/webapp/taglib/ValueBindingValueExpressionAdaptor.java
Log:
Reintegrated community/3.3.x into JSF 2.0 branch
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxChildrenRenderer.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxChildrenRenderer.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxChildrenRenderer.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -33,27 +33,36 @@
import org.ajax4jsf.Messages;
import org.ajax4jsf.component.AjaxChildrenEncoder;
import org.ajax4jsf.component.AjaxOutput;
+import org.ajax4jsf.context.AjaxContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* @author shura
- *
+ *
*/
-public abstract class AjaxChildrenRenderer extends AjaxComponentRendererBase implements
AjaxRenderer {
-
+public abstract class AjaxChildrenRenderer extends AjaxComponentRendererBase
+ implements AjaxRenderer {
+
public static final Log log = LogFactory.getLog(AjaxChildrenRenderer.class);
public static final String[] SPECIAL_COMPONENTS_TYPES = {
- "org.ajax4jsf.Bundle"/*UILoadBundle.COMPONENT_TYPE*/,
"org.apache.myfaces.AliasBean",
- "org.apache.myfaces.AliasBeansScope" };
+ "org.ajax4jsf.Bundle"/* UILoadBundle.COMPONENT_TYPE */,
+ "org.apache.myfaces.AliasBean",
+ "org.apache.myfaces.AliasBeansScope" };
private static final String SPECIAL_TYPES_PARAMETER =
"org.ajax4jsf.CONTROL_COMPONENTS";
-
- /* (non-Javadoc)
- * @see
org.ajax4jsf.renderkit.AjaxRenderer#encodeAjaxChildren(javax.faces.context.FacesContext,
javax.faces.component.UIComponent, java.lang.String, java.util.Set, java.util.Set)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.ajax4jsf.renderkit.AjaxRenderer#encodeAjaxChildren(javax.faces.context
+ * .FacesContext, javax.faces.component.UIComponent, java.lang.String,
+ * java.util.Set, java.util.Set)
*/
- public void encodeAjaxChildren(FacesContext context, UIComponent component, String path,
Set<String> ids, Set<String> renderedAreas) throws IOException {
+ public void encodeAjaxChildren(FacesContext context, UIComponent component,
+ String path, Set<String> ids, Set<String> renderedAreas)
+ throws IOException {
if (log.isDebugEnabled()) {
log.debug(Messages.getMessage(Messages.ENCODE_CHILD_AJAX_INFO,
path, component.getId()));
@@ -61,69 +70,102 @@
String currentPath = path;
if (component instanceof NamingContainer) {
currentPath += component.getId() + NamingContainer.SEPARATOR_CHAR;
+ // Do not check children if we have no id to render under naming
+ // container.
+ if (AjaxContext.getCurrentInstance(context).isLimitToList()
+ && noIdUnderPath(path, ids)) {
+ return;
+ }
}
- for (Iterator<UIComponent> it = component.getFacetsAndChildren(); it.hasNext();)
{
+ for (Iterator<UIComponent> it = component.getFacetsAndChildren(); it
+ .hasNext();) {
UIComponent element = (UIComponent) it.next();
- encodeAjaxComponent(context, element, currentPath, ids, renderedAreas);
+ encodeAjaxComponent(context, element, currentPath, ids,
+ renderedAreas);
}
}
- /* (non-Javadoc)
- * @see
org.ajax4jsf.renderkit.AjaxRenderer#encodeAjaxComponent(javax.faces.context.FacesContext,
javax.faces.component.UIComponent, java.lang.String, java.util.Set, java.util.Set)
+ private boolean noIdUnderPath(String path, Set<String> ids) {
+ // Do we have an any component for the rendering under that container ?
+ boolean noSuchId = true;
+ for (String id : ids) {
+ if (null != id && id.startsWith(path)) {
+ noSuchId = false;
+ break;
+ }
+ }
+ return noSuchId;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.ajax4jsf.renderkit.AjaxRenderer#encodeAjaxComponent(javax.faces.context
+ * .FacesContext, javax.faces.component.UIComponent, java.lang.String,
+ * java.util.Set, java.util.Set)
*/
- public void encodeAjaxComponent(FacesContext context, UIComponent component, String
currentPath, Set<String> ids, Set<String> renderedAreas) throws IOException {
- if (component.isRendered()) { // skip not-rendered components.
- boolean found = false;
- if (!ids.isEmpty()) {
- // list for rendering may contains absolute id ( best ),
- // component Id or client ID
- String elementId = component.getId();
- String absoluteId = currentPath + elementId;
- // String clientId = element.getClientId(context);
- if (ids.contains(absoluteId) || ids.contains(elementId)) {
- if (log.isDebugEnabled()) {
- log
- .debug(Messages.getMessage(
- Messages.RENDER_AJAX_AREA_INFO,
- absoluteId));
- }
- // renderChild(context, element);
- found = true;
- }
- }
- if (!found && component instanceof AjaxOutput) {
- if (((AjaxOutput) component).isAjaxRendered()) {
- // renderChild(context, element);
- found = true;
- }
-
- }
-
- if (!found) {
- if (component instanceof AjaxChildrenEncoder) {
- ((AjaxChildrenEncoder) component).encodeAjaxChild(
- context, currentPath, ids, renderedAreas);
- } else {
- // Special case - for control components, not produced
- // html code - such as message bundles loaders,
- // MyFaces aliases etc. we call encodeBegin/end methods
- // even if components not in rendered areas.
- boolean special = isSpecialElement(context, component);
- if (special) {
- component.encodeBegin(context);
- }
- encodeAjaxChildren(context, component, currentPath, ids,
- renderedAreas);
- if (special) {
- component.encodeEnd(context);
- }
-
- }
- } else {
- renderedAreas.add(component.getClientId(context));
- renderChild(context, component);
- }
- }
+ public void encodeAjaxComponent(FacesContext context,
+ UIComponent component, String currentPath, Set<String> ids,
+ Set<String> renderedAreas) throws IOException {
+ if (component.isRendered()) { // skip not-rendered components.
+ boolean found = false;
+ boolean limitToList = AjaxContext.getCurrentInstance(context).isLimitToList();
+ String elementId = component.getId();
+ String absoluteId = currentPath + elementId;
+ if (!ids.isEmpty()) {
+ // list for rendering may contains absolute id ( best ),
+ // component Id or client ID
+ // String clientId = element.getClientId(context);
+ if (ids.contains(absoluteId) || ids.contains(elementId)) {
+ if (log.isDebugEnabled()) {
+ log.debug(Messages.getMessage(
+ Messages.RENDER_AJAX_AREA_INFO, absoluteId));
+ }
+ // renderChild(context, element);
+ found = true;
+ }
+ }
+ //
+ if (!found && limitToList
+ && component instanceof NamingContainer
+ && noIdUnderPath(absoluteId
+ + NamingContainer.SEPARATOR_CHAR, ids)) {
+ return;
+ }
+ if (!found && !limitToList && component instanceof AjaxOutput) {
+ if (((AjaxOutput) component).isAjaxRendered()) {
+ // renderChild(context, element);
+ found = true;
+ }
+
+ }
+
+ if (!found) {
+ if (component instanceof AjaxChildrenEncoder) {
+ ((AjaxChildrenEncoder) component).encodeAjaxChild(context,
+ currentPath, ids, renderedAreas);
+ } else {
+ // Special case - for control components, not produced
+ // html code - such as message bundles loaders,
+ // MyFaces aliases etc. we call encodeBegin/end methods
+ // even if components not in rendered areas.
+ boolean special = isSpecialElement(context, component);
+ if (special) {
+ component.encodeBegin(context);
+ }
+ encodeAjaxChildren(context, component, currentPath, ids,
+ renderedAreas);
+ if (special) {
+ component.encodeEnd(context);
+ }
+
+ }
+ } else {
+ renderedAreas.add(component.getClientId(context));
+ renderChild(context, component);
+ }
+ }
}
private Set<String> _specialComponentTypes = null;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxComponentRendererBase.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxComponentRendererBase.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxComponentRendererBase.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -62,17 +62,19 @@
*/
protected InternetResource[] getScripts() {
// Lazy create
- if (scripts == null) {
- InternetResource[] additionalScripts = getAdditionalScripts();
- // Custom scripts
- if (null != additionalScripts) {
- scripts = new InternetResource[additionalScripts.length+1];
- System.arraycopy(additionalScripts,0,scripts,1,additionalScripts.length);
- } else {
- scripts = new InternetResource[1];
+ synchronized (this) {
+ if (scripts == null) {
+ InternetResource[] additionalScripts = getAdditionalScripts();
+ // Custom scripts
+ if (null != additionalScripts) {
+ scripts = new InternetResource[additionalScripts.length+1];
+ System.arraycopy(additionalScripts,0,scripts,1,additionalScripts.length);
+ } else {
+ scripts = new InternetResource[1];
+ }
+ // Ajax script
+ scripts[0] = getResource(AJAX_SCRIPT);
}
- // Ajax script
- scripts[0] = getResource(AJAX_SCRIPT);
}
return scripts;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxContainerRenderer.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxContainerRenderer.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxContainerRenderer.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -65,8 +65,7 @@
public static final String AJAX_UPDATE_HEADER = "Ajax-Update-Ids";
- static final Log log = LogFactory
- .getLog(AjaxContainerRenderer.class);
+ static final Log log = LogFactory.getLog(AjaxContainerRenderer.class);
public static final String AJAX_FLAG_HEADER = "Ajax-Response";
@@ -105,7 +104,7 @@
*/
public void encodeAjax(FacesContext context, UIComponent component)
throws IOException {
- UIComponent root ;
+ UIComponent root;
// Iterate over all childrens, render it if nessesary...
log.debug(Messages.getMessage(Messages.RENDER_CHILDREN_AJAX_INFO));
AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
@@ -114,19 +113,31 @@
if (((AjaxContainer) component).isRenderRegionOnly()) {
root = component;
} else {
- root = context.getViewRoot();
+ root = context.getViewRoot();
}
String path = AjaxRendererUtils.getAbsoluteId(root);
// if(! (component instanceof NamingContainer)){
path = path.substring(0, path
.lastIndexOf(NamingContainer.SEPARATOR_CHAR) + 1);
- encodeAjaxComponent(context, root, path, ids, renderedAreas);
+ if (isParentRendered(root)) {
+ encodeAjaxComponent(context, root, path, ids, renderedAreas);
+ }
// Write information about encoded areas after submission.
AjaxRendererUtils.encodeAreas(context, component);
}
-
-
+ public boolean isParentRendered(UIComponent target) {
+ UIComponent component = target;
+
+ while (component != null) {
+ if (!component.isRendered()) {
+ return false;
+ }
+ component = component.getParent();
+ }
+ return true;
+ }
+
/*
* always return true, since component must maintain set of rendered
* components.
@@ -140,27 +151,29 @@
/*
* (non-Javadoc)
*
- * @see org.ajax4jsf.renderkit.RendererBase#doDecode(javax.faces.context.FacesContext,
- * javax.faces.component.UIComponent)
+ * @see
+ * org.ajax4jsf.renderkit.RendererBase#doDecode(javax.faces.context.FacesContext
+ * , javax.faces.component.UIComponent)
*/
protected void doDecode(FacesContext context, UIComponent component) {
String clientId = component.getClientId(context);
- Map<String, String> paramMap =
context.getExternalContext().getRequestParameterMap();
+ Map<String, String> paramMap = context.getExternalContext()
+ .getRequestParameterMap();
if (log.isDebugEnabled()) {
log.debug(Messages.getMessage(
Messages.DECODE_AJAX_REQUEST_STATUS_INFO, clientId));
-// log.debug(Messages.getMessage(Messages.REQUEST_PARAMETERS_MAP,
-// paramMap.toString()));
+ // log.debug(Messages.getMessage(Messages.REQUEST_PARAMETERS_MAP,
+ // paramMap.toString()));
}
Object ajaxParameter = paramMap.get(AJAX_PARAMETER_NAME);
AjaxContainer ajaxContainer = (AjaxContainer) component;
if (null != ajaxParameter && ajaxParameter.equals(clientId)) {
- ajaxContainer.setSubmitted(true);
- if(ajaxContainer.isSelfRendered()){
- AjaxContext.getCurrentInstance(context).setSelfRender(true);
- }
- AjaxEvent event = new AjaxEvent(component);
- component.queueEvent(event);
+ ajaxContainer.setSubmitted(true);
+ if (ajaxContainer.isSelfRendered()) {
+ AjaxContext.getCurrentInstance(context).setSelfRender(true);
+ }
+ AjaxEvent event = new AjaxEvent(component);
+ component.queueEvent(event);
} else {
ajaxContainer.setSubmitted(false);
}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -26,8 +26,8 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedHashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
@@ -103,6 +103,11 @@
public static final String AJAX_REGIONS_ATTRIBUTE = "reRender";
+ /**
+ * @since 3.3.0
+ */
+ public static final String AJAX_PROCESS_ATTRIBUTE = "process";
+
private static final Class<?> OBJECT_ARRAY_CLASS = (new Object[0]).getClass();
public static final String VALUE_ATTR = "value";
@@ -118,10 +123,13 @@
public static final String AJAX_ABORT_ATTR = "ignoreDupResponses";
public static final String AJAX_SINGLE_PARAMETER_NAME = "ajaxSingle";
+
+ public static final String SIMILARITY_GROUPING_ID_ATTR =
"similarityGroupingId";
+ private static final RendererUtils rendererUtils = RendererUtils.getInstance();
+
/**
- * Static class - protect constructor TODO - make as subclass of chameleon
- * RendererUtils.
+ * Static class - protect constructor
*
*/
private AjaxRendererUtils() {
@@ -138,8 +146,24 @@
*/
public static StringBuffer buildOnClick(UIComponent uiComponent,
FacesContext facesContext) {
- return buildOnEvent(uiComponent, facesContext, HTML.onclick_ATTRIBUTE);
+
+ return buildOnClick(uiComponent, facesContext, false);
}
+
+ /**
+ * Build JavaScript onclick event for given component
+ *
+ * @param uiComponent -
+ * component for build event
+ * @param facesContext
+ * @param omitDefaultActionUrl - default action URL is not encoded if parameter is true
+ *
+ * @return <code>StringBuffer</code> with Javascript code
+ */
+ public static StringBuffer buildOnClick(UIComponent uiComponent,
+ FacesContext facesContext, boolean omitDefaultActionUrl) {
+ return buildOnEvent(uiComponent, facesContext, HTML.onclick_ATTRIBUTE,
omitDefaultActionUrl);
+ }
/**
* Build JavaScript event for component
@@ -149,11 +173,28 @@
* @param facesContext
* @param eventName -
* name of event
- * @return <code>StringBuffer</code> with Javascript code TODO - for
- * key-based events build list of supported keys
+ * @return <code>StringBuffer</code> with Javascript code
*/
public static StringBuffer buildOnEvent(UIComponent uiComponent,
FacesContext facesContext, String eventName) {
+
+ return buildOnEvent(uiComponent, facesContext, eventName, false);
+ }
+
+ /**
+ * Build JavaScript event for component
+ *
+ * @param uiComponent -
+ * component for build event
+ * @param facesContext
+ * @param eventName -
+ * name of event
+ * @param omitDefaultActionUrl - default action URL is not encoded if parameter is true
+ *
+ * @return <code>StringBuffer</code> with Javascript code
+ */
+ public static StringBuffer buildOnEvent(UIComponent uiComponent,
+ FacesContext facesContext, String eventName, boolean omitDefaultActionUrl) {
StringBuffer onEvent = new StringBuffer();
if (null != eventName) {
String commandOnEvent = (String) uiComponent.getAttributes().get(
@@ -175,10 +216,8 @@
// oncomplete - function for call after complete request.
// status - id of request status component.
// parameters - map of parameters name/value for append on request.
- // TODO
- // sync true/false - run script in sync mode.
// ..........
- ajaxFunction.addParameter(buildEventOptions(facesContext, uiComponent));
+ ajaxFunction.addParameter(buildEventOptions(facesContext, uiComponent,
omitDefaultActionUrl));
// appendAjaxSubmitParameters(facesContext, uiComponent, onEvent);
ajaxFunction.appendScript(onEvent);
@@ -194,16 +233,42 @@
}
+ public static Map<String, Object> buildEventOptions(FacesContext facesContext,
+ UIComponent component) {
+
+ return buildEventOptions(facesContext, component, null);
+ }
+
+ public static Map<String, Object> buildEventOptions(FacesContext facesContext,
+ UIComponent uiComponent, Map<String, Object> params) {
+
+ return buildEventOptions(facesContext, uiComponent, params, false);
+ }
+
+ public static Map<String, Object> buildEventOptions(FacesContext facesContext,
+ UIComponent component, boolean omitDefaultActionUrl) {
+
+ return buildEventOptions(facesContext, component, null, omitDefaultActionUrl);
+ }
+
/**
* @param facesContext
* @param uiComponent
* @return
*/
public static Map<String, Object> buildEventOptions(FacesContext facesContext,
- UIComponent uiComponent) {
+ UIComponent uiComponent, Map<String, Object> params, boolean
omitDefaultActionUrl) {
String clientId = uiComponent.getClientId(facesContext);
Map<String, Object> componentAttributes = uiComponent.getAttributes();
Map<String, Object> options = new HashMap<String, Object>();
+
+ UIComponent nestingContainer = (UIComponent) findAjaxContainer(
+ facesContext, uiComponent);
+ String containerClientId = nestingContainer.getClientId(facesContext);
+ if (containerClientId != null &&
!AjaxViewRoot.ROOT_ID.equals(containerClientId)) {
+ options.put("containerId", containerClientId);
+ }
+
Map<String, Object> parameters = new HashMap<String, Object>();
UIComponent targetComponent = (uiComponent instanceof
AjaxSupport)?uiComponent.getParent():uiComponent;
// UIForm form = getNestingForm(uiComponent);
@@ -232,9 +297,23 @@
controlValue = clientId;
parameters.put(controlName, controlValue);
AjaxContext ajaxContext = AjaxContext.getCurrentInstance(facesContext);
- // Setup action URL. For portlet environment, it will be different from
- // page.
- options.put("actionUrl", ajaxContext.getAjaxActionURL(facesContext));
+
+ String ajaxActionURL = ajaxContext.getAjaxActionURL(facesContext);
+ if (omitDefaultActionUrl) {
+ UIComponent form = getNestingForm(uiComponent);
+ if (form != null && !rendererUtils.isBooleanAttribute(form,
"ajaxSubmit")) {
+ if (rendererUtils.getActionUrl(facesContext).equals(ajaxActionURL)) {
+ ajaxActionURL = null;
+ }
+ }
+ }
+
+ if (ajaxActionURL != null) {
+ // Setup action URL. For portlet environment, it will be different from
+ // page.
+ options.put("actionUrl", ajaxActionURL);
+ }
+
// Add application-wide Ajax parameters
parameters.putAll(ajaxContext.getCommonAjaxParameters());
// add child parameters
@@ -254,6 +333,9 @@
escape = !actionParam.isNoEscape();
}
if (escape) {
+ if(value == null) {
+ value = "";
+ }
parameters.put(name, value);
} else {
parameters.put(name, new JSReference(value.toString()));
@@ -263,41 +345,40 @@
}
}
}
+
+ if (params != null) {
+ parameters.putAll(params);
+ }
+
if (!parameters.isEmpty()) {
options.put("parameters", parameters);
}
// parameter to render only current list of areas.
- if (isAjaxLimitToList(uiComponent)) {
- Set<? extends Object> ajaxAreas = getAjaxAreas(uiComponent);
- Set<String> areasIds = new HashSet<String>();
- if (null != ajaxAreas) {
- for (Iterator<? extends Object> iter = ajaxAreas.iterator(); iter.hasNext();)
{
- String id = (String) iter.next();
- UIComponent comp = RendererUtils.getInstance().
- findComponentFor(uiComponent, id);
- if (null != comp) {
- areasIds.add(comp.getClientId(facesContext));
- } else {
- areasIds.add(id);
- }
- }
- }
- options.put("affected", areasIds);
- }
+// if (isAjaxLimitToList(uiComponent)) {
+// Set<? extends Object> ajaxAreas = getAjaxAreas(uiComponent);
+// Set<String> areasIds = new HashSet<String>();
+// if (null != ajaxAreas) {
+// for (Iterator<? extends Object> iter = ajaxAreas.iterator(); iter.hasNext();)
{
+// String id = (String) iter.next();
+// UIComponent comp = RendererUtils.getInstance().
+// findComponentFor(uiComponent, id);
+// if (null != comp) {
+// areasIds.add(comp.getClientId(facesContext));
+// } else {
+// areasIds.add(id);
+// }
+// }
+// }
+// options.put("affected", areasIds);
+// }
String oncomplete = getAjaxOncomplete(uiComponent);
if (null != oncomplete) {
- JSFunctionDefinition function = new JSFunctionDefinition("request",
"event", "data");
- function.addToBody(oncomplete);
-
- options.put(ONCOMPLETE_ATTR_NAME, function);
+ options.put(ONCOMPLETE_ATTR_NAME, buildAjaxOncomplete(oncomplete));
}
String beforeupdate = getAjaxOnBeforeDomUpdate(uiComponent);
if (null != beforeupdate) {
- JSFunctionDefinition function = new JSFunctionDefinition("request",
"event", "data");
- function.addToBody(beforeupdate);
-
- options.put(ONBEFOREDOMUPDATE_ATTR_NAME, function);
+ options.put(ONBEFOREDOMUPDATE_ATTR_NAME, buildAjaxOnBeforeDomUpdate(beforeupdate));
}
@@ -306,12 +387,14 @@
options.put("status", status);
}
String queue = (String) componentAttributes.get(AJAX_QUEUE_ATTR);
+ String implicitQueue = null;
+
Integer requestDelay = (Integer) componentAttributes
.get(AJAX_DELAY_ATTR);
if (null != requestDelay && requestDelay.intValue() > 0) {
options.put(AJAX_DELAY_ATTR, requestDelay);
if (null == queue) {
- queue = clientId;
+ implicitQueue = clientId;
}
}
Boolean ignoreDupResponses = (Boolean) componentAttributes
@@ -319,12 +402,31 @@
if (null != ignoreDupResponses && ignoreDupResponses.booleanValue()) {
options.put(AJAX_ABORT_ATTR, JSReference.TRUE);
if (null == queue) {
- queue = clientId;
+ implicitQueue = clientId;
}
}
+
if (null != queue) {
options.put(AJAX_QUEUE_ATTR, queue);
+ } else if (implicitQueue != null) {
+ options.put("implicitEventsQueue", clientId);
}
+
+ ExternalContext externalContext = facesContext.getExternalContext();
+ String namespace = externalContext.encodeNamespace("");
+ if (namespace != null && namespace.length() != 0) {
+ options.put("namespace", namespace);
+ }
+
+ String similarityGroupingId = (String)
componentAttributes.get(SIMILARITY_GROUPING_ID_ATTR);
+ if (similarityGroupingId == null || similarityGroupingId.length() == 0) {
+ similarityGroupingId = clientId;
+ } else {
+ similarityGroupingId = externalContext.encodeNamespace(similarityGroupingId);
+ }
+
+ options.put(SIMILARITY_GROUPING_ID_ATTR, similarityGroupingId);
+
// request timeout.
Integer timeout = (Integer) componentAttributes.get("timeout");
if (null != timeout && timeout.intValue() > 0) {
@@ -344,7 +446,6 @@
* @param uiComponent
* @param facesContext
* @param functionName
- * TODO
* @return
*/
public static JSFunction buildAjaxFunction(UIComponent uiComponent,
@@ -362,24 +463,11 @@
* @param uiComponent
* @param facesContext
* @param functionName
- * TODO
* @return
*/
public static JSFunction buildAjaxFunction(UIComponent uiComponent,
FacesContext facesContext, String functionName) {
JSFunction ajaxFunction = new JSFunction(functionName);
- UIComponent nestingContainer = (UIComponent) findAjaxContainer(
- facesContext, uiComponent);
-
-
- String clientId = nestingContainer.getClientId(facesContext);
- if (clientId != null) {
- ajaxFunction.addParameter(clientId);
- } else {
- // fix for myfaces 1.2.4
- ajaxFunction.addParameter(JSReference.NULL);
- }
-
// build form name or ActionUrl for script
UIComponent nestingForm = getNestingForm(uiComponent);
if (null == nestingForm) {
@@ -478,37 +566,56 @@
}
/**
+ * Returns set of areas to be processed as a result of this component action invocation
+ *
+ * @param component
+ * @return set of IDs that should be processed as a
+ * @since 3.3.0
+ */
+ public static Set<String> getAjaxAreasToProcess(UIComponent component) {
+ Object areas;
+
+ if (component instanceof AjaxComponent) {
+ areas = ((AjaxComponent) component).getProcess();
+ } else {
+ areas = component.getAttributes().get(AjaxRendererUtils.AJAX_PROCESS_ATTRIBUTE);
+ }
+
+ return asSet(areas);
+ }
+
+ /**
* Convert parameter ( Collection, List, array, String, comma-separated
- * String ) to list of srings. TODO - when move to JDK 5, change to
- * List<String>
+ * String ) to list of srings.
*
* @param valueToSet -
* obect for convert to List.
* @return - list of strings.
*/
+ @SuppressWarnings("unchecked")
public static Set<String> asSet(Object valueToSet) {
if (null != valueToSet) {
// Simplest case - set.
if (valueToSet instanceof Set) {
- return (Set<String>) valueToSet;
+ return new LinkedHashSet<String>((Set<String>)valueToSet);
}
// Other collections.
else if (valueToSet instanceof Collection) {
- return new HashSet<String>((Collection<String>) valueToSet);
+ return new LinkedHashSet<String>((Collection<String>) valueToSet);
}
// Array
else if (OBJECT_ARRAY_CLASS.isAssignableFrom(valueToSet.getClass())) {
- return new HashSet<String>(Arrays.asList((String[]) valueToSet));
+ return new LinkedHashSet<String>(Arrays.asList((String[]) valueToSet));
}
// Tokenize string.
else if (valueToSet instanceof String) {
String areasString = (String) valueToSet;
if (areasString.indexOf(",") > 0) {
- return new HashSet<String>(Arrays.asList(areasString.trim().split(
+ return new LinkedHashSet<String>(Arrays.asList(areasString.trim().split(
"(\\s)*,(\\s)*")));
} else {
- Set<String> areasSet = new HashSet<String>(5);
+ Set<String> areasSet = new LinkedHashSet<String>(5);
areasSet.add(areasString.trim());
return areasSet;
}
@@ -517,7 +624,7 @@
}
return null;
}
-
+
/**
* Get status area Id for given component.
*
@@ -548,6 +655,20 @@
return statusId;
}
+ public static JSFunctionDefinition buildAjaxOncomplete(String body) {
+ JSFunctionDefinition function = new JSFunctionDefinition("request",
"event", "data");
+ function.addToBody(body);
+
+ return function;
+ }
+
+ public static JSFunctionDefinition buildAjaxOnBeforeDomUpdate(String body) {
+ JSFunctionDefinition function = new JSFunctionDefinition("request",
"event", "data");
+ function.addToBody(body);
+
+ return function;
+ }
+
/**
* Get function name for call on completed ajax request.
*
@@ -825,7 +946,6 @@
ResponseWriter out = context.getResponseWriter();
// DebugUtils.traceView("ViewRoot in AJAX Page encode begin");
out.startElement("html", component);
- // TODO - html attributes. lang - from current locale ?
Locale locale = context.getViewRoot().getLocale();
out.writeAttribute(HTML.lang_ATTRIBUTE, locale.toString(), "lang");
out.startElement("body", component);
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/HeaderResourcesRendererBase.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/HeaderResourcesRendererBase.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/HeaderResourcesRendererBase.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -25,12 +25,9 @@
import java.util.LinkedHashSet;
import javax.faces.component.UIComponent;
-import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import org.ajax4jsf.resource.InternetResource;
-import org.ajax4jsf.resource.InternetResourceBuilder;
-import org.ajax4jsf.webapp.BaseFilter;
/**
* Base renderer for components used JavaScripts and Styles in header. In real
@@ -133,15 +130,15 @@
/**
* @param context
* @param component
- * @param scripts
+ * @param resources
* @throws IOException
*/
protected void encodeResourcesArray(FacesContext context,
- UIComponent component, InternetResource[] scripts)
+ UIComponent component, InternetResource[] resources)
throws IOException {
- if (scripts != null) {
- for (int i = 0; i < scripts.length; i++) {
- scripts[i].encode(context, component);
+ if (resources != null) {
+ for (int i = 0; i < resources.length; i++) {
+ resources[i].encode(context, component);
}
}
}
@@ -149,21 +146,11 @@
public void encodeToHead(FacesContext context, UIComponent component, ProducerContext
pc) throws IOException {
if (pc.isProcessScripts()) {
- InternetResource[] scripts = getScripts();
- if (scripts != null) {
- for (InternetResource resource : scripts) {
- resource.encode(context, null);
- }
- }
+ encodeResourcesArray(context, component, getScripts());
}
if (pc.isProcessStyles()) {
- InternetResource[] styles = getStyles();
- if (styles != null) {
- for (InternetResource resource : styles) {
- resource.encode(context, null);
- }
- }
+ encodeResourcesArray(context, component, getStyles());
}
}
}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererBase.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererBase.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererBase.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -22,7 +22,6 @@
package org.ajax4jsf.renderkit;
import java.io.IOException;
-import java.util.Iterator;
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
@@ -254,14 +253,10 @@
* @param component
* @throws IOException
*/
- public void renderChildren(FacesContext facesContext,
- UIComponent component) throws IOException {
- if (component.getChildCount() > 0) {
- for (Iterator<UIComponent> it = component.getChildren().iterator();
it.hasNext();) {
- UIComponent child = it.next();
- renderChild(facesContext, child);
- }
- }
+ public void renderChildren(FacesContext facesContext, UIComponent component) throws
IOException {
+ for (UIComponent child : component.getChildren()) {
+ renderChild(facesContext, child);
+ }
}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -23,10 +23,14 @@
import java.awt.Dimension;
import java.io.IOException;
+import java.lang.reflect.Array;
import java.util.Arrays;
+import java.util.Collection;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
+import java.util.Set;
import javax.faces.FacesException;
import javax.faces.application.ViewHandler;
@@ -66,9 +70,12 @@
* Substitutions for components properies names and HTML attributes names.
*/
private static Map<String, String> substitutions = new HashMap<String,
String>();
+
+ private static Set<String> requiredAttributes = new HashSet<String>();
static {
substitutions.put(HTML.class_ATTRIBUTE, "styleClass");
+ requiredAttributes.add(HTML.alt_ATTRIBUTE);
Arrays.sort(HTML.PASS_THRU);
Arrays.sort(HTML.PASS_THRU_BOOLEAN);
Arrays.sort(HTML.PASS_THRU_URI);
@@ -107,6 +114,7 @@
// public static final String title_ATTRIBUTE = "title";
public static final String accesskey_ATTRIBUTE = "accesskey";
public static final String alt_ATTRIBUTE = "alt";
+ public static final String autocomplete_ATTRIBUTE = "autocomplete";
public static final String cols_ATTRIBUTE = "cols";
public static final String height_ATTRIBUTE = "height";
@@ -387,7 +395,7 @@
ResponseWriter writer, String attribute) throws IOException {
Object value = attributeValue(attribute, attributes
.get(getComponentAttributeName(attribute)));
- if (null != value && shouldRenderAttribute(value)) {
+ if (null != value && shouldRenderAttribute(attribute, value)) {
if (Arrays.binarySearch(HTML.PASS_THRU_URI, attribute) >= 0) {
String url = context.getApplication().getViewHandler()
.getResourceURL(context, value.toString());
@@ -439,7 +447,7 @@
Object property, String attributeName) throws IOException {
ResponseWriter writer = context.getResponseWriter();
Object value = component.getAttributes().get(property);
- if (shouldRenderAttribute(value)) {
+ if (shouldRenderAttribute(attributeName, value)) {
writer.writeAttribute(attributeName, value, property.toString());
}
@@ -461,7 +469,7 @@
*/
public void writeAttribute(ResponseWriter writer, String attribute,
Object value) throws IOException {
- if (shouldRenderAttribute(value)) {
+ if (shouldRenderAttribute(attribute, value)) {
writer.writeAttribute(attribute, value.toString(), attribute);
}
}
@@ -484,6 +492,17 @@
} else
return isValidProperty(attributeVal);
}
+
+ public boolean shouldRenderAttribute(String attributeName, Object attributeVal) {
+ if (!requiredAttributes.contains(attributeName)) {
+ return shouldRenderAttribute(attributeVal);
+ } else {
+ if (null == attributeVal) {
+ return false;
+ }
+ }
+ return true;
+ }
/**
* Test for valid value of property. by default, for non-setted properties
@@ -523,6 +542,149 @@
}
/**
+ * Checks if the argument passed in is empty or not.
+ * Object is empty if it is: <br />
+ * - <code>null<code><br />
+ * - zero-length string<br />
+ * - empty collection<br />
+ * - empty map<br />
+ * - zero-length array<br />
+ *
+ * @param o object to check for emptiness
+ * @since 3.3.2
+ * @return <code>true</code> if the argument is empty,
<code>false</code> otherwise
+ */
+ public boolean isEmpty(Object o) {
+ if (null == o) {
+ return true;
+ }
+ if (o instanceof String ) {
+ return (0 == ((String)o).length());
+ }
+ if (o instanceof Collection) {
+ return ((Collection<?>)o).isEmpty();
+ }
+ if (o instanceof Map) {
+ return ((Map<?, ?>)o).isEmpty();
+ }
+ if (o.getClass().isArray()) {
+ return Array.getLength(o) == 0;
+ }
+ return false;
+ }
+
+ /**
+ * Wrapper class around object value used to transform values into particular JS
objects
+ *
+ * @author Nick Belaevski
+ * @since 3.3.2
+ */
+ public static enum ScriptHashVariableWrapper {
+
+ /**
+ * No-op default wrapper
+ */
+ DEFAULT {
+
+ @Override
+ Object wrap(Object o) {
+ return o;
+ }
+
+ },
+
+ /**
+ * Event handler functions wrapper. Wraps <pre>functionCode</pre> object
into:
+ * <pre>function(event) {
+ * functionCode
+ * }</pre>
+ */
+ EVENT_HANDLER {
+
+ @Override
+ Object wrap(Object o) {
+ return new JSFunctionDefinition("event").addToBody(o);
+ }
+
+ };
+
+ /**
+ * Method that does the wrapping
+ *
+ * @param o object to wrap
+ * @return wrapped object
+ */
+ abstract Object wrap(Object o);
+ }
+
+ /**
+ * Puts value into map under specified key if the value is not empty and not default.
+ * Performs optional value wrapping.
+ *
+ * @param hash
+ * @param name
+ * @param value
+ * @param defaultValue
+ * @param wrapper
+ *
+ * @since 3.3.2
+ */
+ public void addToScriptHash(Map<String, Object> hash,
+ String name,
+ Object value,
+ String defaultValue,
+ ScriptHashVariableWrapper wrapper) {
+
+ ScriptHashVariableWrapper wrapperOrDefault = wrapper != null ? wrapper :
ScriptHashVariableWrapper.DEFAULT;
+
+ if (isValidProperty(value) && !isEmpty(value)) {
+ if (!isEmpty(defaultValue)) {
+ if (!defaultValue.equals(value.toString())) {
+ hash.put(name, wrapperOrDefault.wrap(value));
+ }
+ } else {
+ if (!(value instanceof Boolean) || ((Boolean) value).booleanValue()) {
+ hash.put(name, wrapperOrDefault.wrap(value));
+ }
+ }
+ }
+ }
+
+ /**
+ * Puts value into map under specified key if the value is not empty and not default.
+ * Performs optional value wrapping.
+ *
+ * @param hash
+ * @param name
+ * @param value
+ * @param defaultValue
+ *
+ * @since 3.3.2
+ */
+ public void addToScriptHash(Map<String, Object> hash,
+ String name,
+ Object value,
+ String defaultValue) {
+ addToScriptHash(hash, name, value, defaultValue, null);
+ }
+
+ /**
+ * Puts value into map under specified key if the value is not empty and not default.
+ * Performs optional value wrapping.
+ *
+ * @param hash
+ * @param name
+ * @param value
+ *
+ * @since 3.3.2
+ */
+ public void addToScriptHash(Map<String, Object> hash,
+ String name,
+ Object value) {
+ addToScriptHash(hash, name, value, null, null);
+ }
+
+ /**
* Convert HTML attribute name to component property name.
*
* @param key
@@ -899,7 +1061,7 @@
}
}
if (target == null) {
- if (child.getChildCount() > 0) {
+ if (child.getChildCount() > 0 || child.getFacetCount() > 0) {
target = findUIComponentBelow(child, id);
}
}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/compiler/WithDefaultsRulesWrapper.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/compiler/WithDefaultsRulesWrapper.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/renderkit/compiler/WithDefaultsRulesWrapper.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/* $Id: WithDefaultsRulesWrapper.java,v 1.1.2.1 2007/01/09 18:57:42 alexsmirnov Exp $
*
* Copyright 2003-2004 The Apache Software Foundation.
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,3 +1,24 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.request;
import java.io.ByteArrayInputStream;
@@ -17,15 +38,18 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
-import org.ajax4jsf.Filter;
import org.ajax4jsf.exception.FileUploadException;
import org.ajax4jsf.webapp.BaseXMLFilter;
+import org.richfaces.component.FileUploadConstants;
import org.richfaces.model.UploadItem;
/**
@@ -49,12 +73,25 @@
private Integer contentLength = 0;
+ private int bytesRead = 0;
+
private int read = 0;
+ //we shouldn't allow to stop until request reaches PhaseListener because of
portlets
+ private boolean canStop = false;
+
private Map<String, Param> parameters = null;
private Map<String, Object> percentMap = null;
+ private Map<String, Integer> requestSizeMap = null;
+
+ private Map<String, String> requestKeysMap = null;
+
+ private String requestKey = null;
+
+ private MultipartRequestRegistry requestRegistry;
+
private List<String> keys = new ArrayList<String>();
private enum ReadState {
@@ -274,6 +311,7 @@
}
private boolean shouldStop = false;
+ private boolean canceled;
public MultipartRequest(HttpServletRequest request,
boolean createTempFiles, int maxRequestSize, String uid) {
@@ -322,6 +360,8 @@
}
public void cancel() {
+ this.canceled = true;
+
if (parameters != null) {
Iterator<Param> it = parameters.values().iterator();
while (it.hasNext()) {
@@ -333,184 +373,340 @@
}
}
- public boolean parseRequest() {
- byte[] boundaryMarker = getBoundaryMarker(super.getContentType());
- if (boundaryMarker == null) {
- throw new FileUploadException("The request was rejected because "
- + "no multipart boundary was found");
- }
+ private byte[] boundaryMarker;
+
+ private byte[] buffer;
+
+ private ReadState readState;
+
+ private InputStream input;
+
+ private int pos = 0;
- encoding = getCharacterEncoding();
+ private int zeroReadAttempts = 20; // 20 attempts to read not-readable data
+
+ private void fillBuffer() throws IOException {
+ if (pos < read) {
+ // move the bytes that weren't read to the start of
+ // the
+ // buffer
+ int bytesNotRead = read - pos;
+
+ if (bytesNotRead != buffer.length) {
+ System.arraycopy(buffer, pos, buffer, 0,
+ bytesNotRead);
+ read = input.read(buffer, bytesNotRead,
+ buffer.length - bytesNotRead);
+
+ if (read != 0 || --zeroReadAttempts != 0) {
+ if (read > 0) {
+ bytesRead += read;
+ }
- parameters = new HashMap<String, Param>();
+ read += bytesNotRead;
+ } else {
+ //read is already zero
+ //read = 0;
+ }
+ } else {
+ read = bytesNotRead;
+ }
+ } else {
+ read = input.read(buffer);
- int loopCounter = 20; // 20 attempts to read not-readable data
+ if (read > 0) {
+ bytesRead += read;
+ }
+ }
+
+ fillProgressInfo();
+ pos = 0;
+ }
+
+ private void readNext() throws IOException {
+ Param p = readHeader();
+ readData(p);
+ }
- this.percentMap = getProgressData();
+ private void readData(Param p) throws IOException {
+ int localRead = this.read;
+
+ while (localRead > 0) {
+ for (int i = this.pos; i < localRead; i++) {
+ // If we've encountered another boundary...
+ if (checkSequence(buffer, i - boundaryMarker.length
+ - CR_LF.length, CR_LF)
+ && checkSequence(buffer, i, boundaryMarker)) {
+ // Write any data before the boundary (that
+ // hasn't
+ // already been written) to the param
+ if (pos < i - boundaryMarker.length
+ - CR_LF.length - 1) {
+ p.appendData(buffer, pos, i - pos
+ - boundaryMarker.length
+ - CR_LF.length - 1);
+ }
- try {
- byte[] buffer = new byte[BUFFER_SIZE];
- Map<String, String> headers = new HashMap<String, String>();
+ if (p instanceof ValueParam)
+ ((ValueParam) p).complete();
- ReadState readState = ReadState.BOUNDARY;
+ if (checkSequence(buffer, i + CR_LF.length,
+ CR_LF)) {
+ i += CR_LF.length;
+ pos = i + 1;
+ } else {
+ pos = i;
+ }
- InputStream input = getInputStream();
- if (!shouldStop) {
+ readState = ReadState.HEADERS;
+ break;
+ }
+ // Otherwise write whatever data we have to the
+ // param
+ else if (i > (pos + boundaryMarker.length
+ + CHUNK_SIZE + CR_LF.length)) {
+ p.appendData(buffer, pos, CHUNK_SIZE);
+ pos += CHUNK_SIZE;
- int read = input.read(buffer);
- int pos = 0;
+ }
+ }
+
+ if (ReadState.DATA.equals(readState)) {
+ fillBuffer();
+ localRead = this.read;
+ } else {
+ break;
+ }
+ }
+ }
- Param p = null;
+ private Param readHeader() throws IOException {
+ Param p = null;
- while (read > 0 && loopCounter > 0) {
- for (int i = 0; i < read; i++) {
- switch (readState) {
- case BOUNDARY: {
- if (checkSequence(buffer, i, boundaryMarker)
- && checkSequence(buffer, i + 2, CR_LF)) {
- readState = ReadState.HEADERS;
- i += 2;
- pos = i + 1;
+ Map<String, String> headers = new HashMap<String, String>();
- }
- break;
- }
- case HEADERS: {
- if (checkSequence(buffer, i, CR_LF)) {
- String param = (encoding == null) ? new String(
- buffer, pos, i - pos - 1) : new String(
- buffer, pos, i - pos - 1, encoding);
- parseParams(param, "; ", headers);
+ int localRead = this.read;
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(2048);
+
+ while (localRead > 0) {
+ for (int i = this.pos; i < localRead; i++) {
+ if (checkSequence(buffer, i, CR_LF)) {
+ baos.write(buffer, pos, i - pos - 1);
- if (checkSequence(buffer, i + CR_LF.length,
- CR_LF)) {
- readState = ReadState.DATA;
- i += CR_LF.length;
- pos = i + 1;
+ String param = (encoding == null) ?
+ new String(baos.toByteArray()) :
+ new String(baos.toByteArray(), encoding);
- String paramName = headers.get(PARAM_NAME);
- if (paramName != null) {
- if (headers.containsKey(PARAM_FILENAME)) {
- FileParam fp = new FileParam(
- paramName);
- if (createTempFiles)
- fp.createTempFile();
- fp.setContentType(headers
- .get(PARAM_CONTENT_TYPE));
- fp
- .setFilename(decodeFileName(headers
- .get(PARAM_FILENAME)));
- p = fp;
- } else {
- if (parameters
- .containsKey(paramName)) {
- p = parameters.get(paramName);
- } else {
- p = new ValueParam(paramName);
- }
- }
+ parseParams(param, "; ", headers);
- if (!parameters.containsKey(paramName)) {
- parameters.put(paramName, p);
- }
- }
+ if (checkSequence(buffer, i + CR_LF.length,
+ CR_LF)) {
+ readState = ReadState.DATA;
+ i += CR_LF.length;
+ pos = i + 1;
- headers.clear();
+ String paramName = headers.get(PARAM_NAME);
+ if (paramName != null) {
+ if (headers.containsKey(PARAM_FILENAME)) {
+ FileParam fp = new FileParam(
+ paramName);
+ if (createTempFiles)
+ fp.createTempFile();
+ fp.setContentType(headers
+ .get(PARAM_CONTENT_TYPE));
+ fp
+ .setFilename(decodeFileName(headers
+ .get(PARAM_FILENAME)));
+ p = fp;
+ } else {
+ if (parameters
+ .containsKey(paramName)) {
+ p = parameters.get(paramName);
} else {
- pos = i + 1;
+ p = new ValueParam(paramName);
}
}
- break;
+
+ if (!parameters.containsKey(paramName)) {
+ parameters.put(paramName, p);
+ }
}
- case DATA: {
- // If we've encountered another boundary...
- if (checkSequence(buffer, i - boundaryMarker.length
- - CR_LF.length, CR_LF)
- && checkSequence(buffer, i, boundaryMarker)) {
- // Write any data before the boundary (that
- // hasn't
- // already been written) to the param
- if (pos < i - boundaryMarker.length
- - CR_LF.length - 1) {
- p.appendData(buffer, pos, i - pos
- - boundaryMarker.length
- - CR_LF.length - 1);
- }
- if (p instanceof ValueParam)
- ((ValueParam) p).complete();
+ headers.clear();
+ baos.reset();
+
+ break;
+ } else {
+ pos = i + 1;
+ baos.reset();
+ }
+ }
+ }
+
+ if (ReadState.HEADERS.equals(readState)) {
+ baos.write(buffer, pos, read - pos);
+ pos = read;
+ fillBuffer();
+ localRead = this.read;
+ } else {
+ break;
+ }
+ }
+ return p;
+ }
- if (checkSequence(buffer, i + CR_LF.length,
- CR_LF)) {
- i += CR_LF.length;
- pos = i + 1;
- } else {
- pos = i;
+ boolean initialized = false;
+
+ private void initialize() throws IOException {
+ if (!initialized) {
+ initialized = true;
+
+ this.boundaryMarker = getBoundaryMarker(super.getContentType());
+ if (this.boundaryMarker == null) {
+ throw new FileUploadException("The request was rejected because "
+ + "no multipart boundary was found");
+ }
+
+ this.encoding = getCharacterEncoding();
+
+ this.parameters = new HashMap<String, Param>();
+
+ this.buffer = new byte[BUFFER_SIZE];
+
+ this.readState = ReadState.BOUNDARY;
+
+ this.input = getInputStream();
+
+ setupProgressData();
+
+ fillBuffer();
+ int localRead = this.read;
+
+ while (localRead > 0) {
+ for (int i = 0; i < localRead; i++) {
+ if (checkSequence(buffer, i, boundaryMarker)
+ && checkSequence(buffer, i + 2, CR_LF)) {
+ readState = ReadState.HEADERS;
+ i += 2;
+ pos = i + 1;
+
+ break;
+ }
+ }
+
+ if (ReadState.BOUNDARY.equals(readState)) {
+ pos = read - (boundaryMarker.length + CR_LF.length) + 1;
+ fillBuffer();
+ localRead = this.read;
+ } else {
+ break;
+ }
+ }
+
+ }
+ }
+
+ public void parseRequest() {
+ canStop = true;
+
+ setupProgressData();
+
+ try {
+ initialize();
+
+ while (read > 0) {
+ readNext();
+ }
+
+ } catch (IOException e) {
+ this.cancel();
+
+ if (!this.shouldStop) {
+ throw new FileUploadException("IO Error parsing multipart request", e);
+ }
+ }
+ }
+
+ public static MultipartRequest lookupRequest(FacesContext context, String uploadId) {
+ Map<String, Object> sessionMap = context.getExternalContext().getSessionMap();
+ Map<String, String> requestKeys = (Map<String, String>)
sessionMap.get(FileUploadConstants.REQUEST_KEYS_BEAN_NAME);
+ if (requestKeys != null) {
+ String requestKey = requestKeys.get(uploadId);
+ if (requestKey != null) {
+ MultipartRequestRegistry requestRegistry =
MultipartRequestRegistry.getInstance(context);
+ if (requestRegistry != null) {
+ MultipartRequest request = requestRegistry.getRequest(requestKey);
+ if (request != null) {
+ return request;
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ private void setupProgressData() {
+ if (percentMap == null || requestSizeMap == null || requestKeysMap == null) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ if (facesContext != null) {
+ ExternalContext externalContext = facesContext.getExternalContext();
+ if (externalContext != null) {
+ Map<String, Object> sessionMap = externalContext.getSessionMap();
+ if (sessionMap != null) {
+ String uploadId = getUploadId();
+
+ synchronized (sessionMap) {
+ if (percentMap == null) {
+ percentMap = (Map<String, Object>)
sessionMap.get(FileUploadConstants.PERCENT_BEAN_NAME);
+ if (percentMap == null) {
+ percentMap = new ConcurrentHashMap<String, Object>();
+ sessionMap.put(FileUploadConstants.PERCENT_BEAN_NAME, percentMap);
}
-
- readState = ReadState.HEADERS;
}
- // Otherwise write whatever data we have to the
- // param
- else if (i > (pos + boundaryMarker.length
- + CHUNK_SIZE + CR_LF.length)) {
- p.appendData(buffer, pos, CHUNK_SIZE);
- pos += CHUNK_SIZE;
+ if (requestSizeMap == null) {
+ requestSizeMap = (Map<String, Integer>)
sessionMap.get(FileUploadConstants.REQUEST_SIZE_BEAN_NAME);
+ if (requestSizeMap == null) {
+ requestSizeMap = new ConcurrentHashMap<String, Integer>();
+ sessionMap.put(FileUploadConstants.REQUEST_SIZE_BEAN_NAME, requestSizeMap);
+ }
}
- break;
+
+ if (requestKeysMap == null) {
+ requestKeysMap = (Map<String, String>)
sessionMap.get(FileUploadConstants.REQUEST_KEYS_BEAN_NAME);
+ if (requestKeysMap == null) {
+ requestKeysMap = new ConcurrentHashMap<String, String>();
+ sessionMap.put(FileUploadConstants.REQUEST_KEYS_BEAN_NAME, requestKeysMap);
+ }
+
+ }
}
- }
- }
+
+ percentMap.put(uploadId, Double.valueOf(0));
- if (!shouldStop) {
- if (pos < read) {
- // move the bytes that weren't read to the start of
- // the
- // buffer
- int bytesNotRead = read - pos;
- System.arraycopy(buffer, pos, buffer, 0,
- bytesNotRead);
- read = input.read(buffer, bytesNotRead,
- buffer.length - bytesNotRead);
- if (read <= 0) {
- loopCounter--;
- }
- read += bytesNotRead;
- } else {
- read = input.read(buffer);
- }
- this.read += pos;
- pos = 0;
- fillProgressInfo();
- } else {
- cancel();
- return false;
+ requestSizeMap.put(uploadId, getSize());
+
+ requestRegistry = MultipartRequestRegistry.getInstance(facesContext);
+ requestKey = requestRegistry.registerRequest(this);
+ requestKeysMap.put(uploadId, requestKey);
+
}
}
-
- return true;
- } else {
- cancel();
- return false;
}
- } catch (IOException ex) {
- throw new FileUploadException("IO Error parsing multipart request",
- ex);
}
}
- @SuppressWarnings("unchecked")
- private Map<String, Object> getProgressData() {
- percentMap = (Map<String, Object>) getSession().getAttribute(
- Filter.PERCENT_BEAN_NAME);
- return percentMap;
- }
-
private void fillProgressInfo() {
- Double percent = (Double) (100.0 * this.read / this.contentLength);
- percentMap.put(uid, percent);
- // this.percent = percent;
+ setupProgressData();
+
+ if (percentMap != null) {
+ Double percent = (Double) (100.0 * this.bytesRead / this.contentLength);
+ percentMap.put(uid, percent);
+ // this.percent = percent;
+ }
}
private byte[] getBoundaryMarker(String contentType) {
@@ -597,9 +793,28 @@
}
private Param getParam(String name) {
- if (parameters == null)
- parseRequest();
- return parameters.get(name);
+ Param param = null;
+ if (parameters != null) {
+ param = parameters.get(name);
+ }
+
+ if (param == null) {
+ if (!canceled) {
+ try {
+ initialize();
+
+ while (param == null && read > 0) {
+ readNext();
+ param = parameters.get(name);
+ }
+ } catch (IOException e) {
+ this.cancel();
+ throw new FileUploadException("IO Error parsing multipart request", e);
+ }
+ }
+ }
+
+ return param;
}
public Integer getSize() {
@@ -668,6 +883,8 @@
@Override
public String[] getParameterValues(String name) {
+ parseRequest();
+
Param p = getParam(name);
if (p != null && p instanceof ValueParam) {
ValueParam vp = (ValueParam) p;
@@ -729,11 +946,46 @@
}
public void stop() {
- shouldStop = true;
+ if (canStop) {
+ shouldStop = true;
+ }
}
+ public boolean isStopped() {
+ return this.shouldStop;
+ }
+
+ public boolean isDone() {
+ return !(this.shouldStop && (this.canceled ||
+ this.contentLength != null && this.contentLength.intValue() !=
this.bytesRead));
+ }
+
@Override
public String getContentType() {
return "application/x-www-form-urlencoded";
}
+
+ protected String getUploadId() {
+ return uid;
+ }
+
+ public void clearRequestData() {
+ String uploadId = getUploadId();
+
+ if (percentMap != null) {
+ percentMap.remove(uploadId);
+ }
+
+ if (requestSizeMap != null) {
+ requestSizeMap.remove(uploadId);
+ }
+
+ if (requestKeysMap != null) {
+ requestKeysMap.remove(uploadId);
+ }
+
+ if (requestRegistry != null) {
+ requestRegistry.removeRequest(requestKey);
+ }
+ }
}
Copied:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequestRegistry.java
(from rev 14238,
trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequestRegistry.java)
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequestRegistry.java
(rev 0)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequestRegistry.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -0,0 +1,80 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.request;
+
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.1
+ */
+
+class MultipartRequestRegistry {
+
+ private AtomicInteger atomicInteger = new AtomicInteger(0);
+
+ private String registryId = UUID.randomUUID().toString();
+
+ private Map<String, MultipartRequest> requestsMap = new
ConcurrentHashMap<String, MultipartRequest>();
+
+ private static final String REGISTRY_ATTRIBUTE_NAME =
MultipartRequestRegistry.class.getName();
+
+ private MultipartRequestRegistry() {
+
+ }
+
+ public static MultipartRequestRegistry getInstance(FacesContext context) {
+ Map<String, Object> applicationMap =
context.getExternalContext().getApplicationMap();
+ MultipartRequestRegistry requestRegistry = (MultipartRequestRegistry)
applicationMap.get(REGISTRY_ATTRIBUTE_NAME);
+ if (requestRegistry == null) {
+ synchronized (applicationMap) {
+ requestRegistry = (MultipartRequestRegistry)
applicationMap.get(REGISTRY_ATTRIBUTE_NAME);
+ if (requestRegistry == null) {
+ requestRegistry = new MultipartRequestRegistry();
+ applicationMap.put(REGISTRY_ATTRIBUTE_NAME, requestRegistry);
+ }
+ }
+ }
+
+ return requestRegistry;
+ }
+
+ public String registerRequest(MultipartRequest request) {
+ String key = registryId + ":" + atomicInteger.incrementAndGet();
+ requestsMap.put(key, request);
+
+ return key;
+ }
+
+ public void removeRequest(String key) {
+ requestsMap.remove(key);
+ }
+
+ public MultipartRequest getRequest(String key) {
+ return requestsMap.get(key);
+ }
+}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/CacheContext.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/CacheContext.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/CacheContext.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.resource;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/CachedResourceContext.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/CachedResourceContext.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/CachedResourceContext.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -25,6 +25,9 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Set;
import org.ajax4jsf.resource.ResourceContext;
import org.ajax4jsf.webapp.CacheContent;
@@ -89,7 +92,37 @@
public Object getSessionAttribute(String name) {
return this.parent.getSessionAttribute(name);
}
+
+
+ /**
+ * @param name
+ * @return
+ * @see org.ajax4jsf.resource.ResourceContext#getContextAttribute(java.lang.String)
+ */
+ public Object getContextAttribute(String name) {
+ return parent.getContextAttribute(name);
+ }
+
+ /**
+ * @param path
+ * @return
+ * @throws MalformedURLException
+ * @see org.ajax4jsf.resource.ResourceContext#getResource(java.lang.String)
+ */
+ public URL getResource(String path) throws MalformedURLException {
+ return parent.getResource(path);
+ }
+
+ /**
+ * @param path
+ * @return
+ * @see org.ajax4jsf.resource.ResourceContext#getResourcePaths(java.lang.String)
+ */
+ public Set<String> getResourcePaths(String path) {
+ return parent.getResourcePaths(path);
+ }
+
/* (non-Javadoc)
* @see org.ajax4jsf.resource.ResourceContext#setDateHeader(java.lang.String, long)
*/
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ClientScript.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ClientScript.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ClientScript.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -53,8 +53,8 @@
*/
public ClientScript() {
super();
- setRenderer(new ScriptRenderer());
InternetResourceBuilder resourceBuilder = InternetResourceBuilder.getInstance();
+ setRenderer(resourceBuilder.getScriptRenderer());
String key = this.getClass().getName();
try {
// Search already registered resource for this class.
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/CompressedScriptRenderer.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/CompressedScriptRenderer.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/CompressedScriptRenderer.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.resource;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/CountingOutputWriter.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/CountingOutputWriter.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/CountingOutputWriter.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,9 +1,23 @@
-/*
- * CountingOutputWriter.java Date created: 21.11.2007
- * Last modified by: $Author$
- * $Revision$ $Date$
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.resource;
import java.io.IOException;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/FacesResourceContext.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/FacesResourceContext.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/FacesResourceContext.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -25,6 +25,9 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Writer;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Set;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
@@ -141,7 +144,12 @@
externalContext.setResponseContentType(contentType);
}
+ @Override
+ public Object getContextAttribute(String name) {
+ return externalContext.getApplicationMap().get(name);
+ }
+
public void setContentLength(int contentLength) {
externalContext.setResponseContentLength(contentLength);
}
@@ -151,11 +159,30 @@
return externalContext.getInitParameter(name);
}
+ /**
+ * @param path
+ * @return
+ * @throws MalformedURLException
+ * @see javax.faces.context.ExternalContext#getResource(java.lang.String)
+ */
+ public URL getResource(String path) throws MalformedURLException {
+ return externalContext.getResource(path);
+ }
+
public String getServletPath() {
// TODO Auto-generated method stub
return externalContext.getRequestServletPath();
}
+ /**
+ * @param path
+ * @return
+ * @see javax.faces.context.ExternalContext#getResourcePaths(java.lang.String)
+ */
+ public Set<String> getResourcePaths(String path) {
+ return externalContext.getResourcePaths(path);
+ }
+
public void release() {
super.release();
externalContext = null;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/GifRenderer.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/GifRenderer.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/GifRenderer.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -23,10 +23,10 @@
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
-import java.io.DataOutputStream;
import java.io.IOException;
+import java.io.OutputStream;
-import org.ajax4jsf.resource.image.GIFEncoder;
+import javax.imageio.ImageIO;
/**
* @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
@@ -47,14 +47,11 @@
public void sendImage(ResourceContext context, RenderedImage image)
throws IOException {
- // ImageIO.write(image,"gif",context.getOutputStream());
- GIFEncoder encoder = new GIFEncoder();
- DataOutputStream out = new DataOutputStream(context.getOutputStream());
+ OutputStream outputStream = context.getOutputStream();
try {
- encoder.encode((BufferedImage) image, out);
- out.flush();
- out.close();
-
+ ImageIO.write(image,"gif",outputStream);
+ outputStream.flush();
+ outputStream.close();
} catch (Exception e) {
// IE can unexpected close connection
}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -370,9 +370,7 @@
*/
public void send(ResourceContext context) throws IOException {
if (log.isDebugEnabled()) {
- log
- .debug(Messages.getMessage(Messages.SEND_CONTENT_INFO,
- getKey()));
+ log.debug(Messages.getMessage(Messages.SEND_CONTENT_INFO,getKey()));
}
int total = getRenderer(context).send(this, context);
// For cacheable resources, store size.
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceBuilderImpl.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceBuilderImpl.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceBuilderImpl.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -61,10 +61,10 @@
private static final Log log = LogFactory.getLog(ResourceBuilderImpl.class);
- private static Map<String, ResourceRenderer> renderers;
- private static ResourceRenderer defaultRenderer = new MimeRenderer(null);
+ private static final ResourceRenderer defaultRenderer = new MimeRenderer(null);
+ private Map<String, ResourceRenderer> renderers;
/**
* keep resources instances . TODO - put this map to application-scope
* attribute, for support clastering environment.
@@ -78,24 +78,18 @@
private static final ResourceRenderer styleRenderer = new StyleRenderer();
static {
- renderers = new HashMap<String, ResourceRenderer>();
- // append known renderers for extentions.
- renderers.put(".gif", new GifRenderer());
- ResourceRenderer renderer = new JpegRenderer();
- renderers.put(".jpeg", renderer);
- renderers.put(".jpg", renderer);
- renderers.put(".png", new PngRenderer());
- renderers.put(".js", scriptRenderer);
- renderers.put(".css", styleRenderer);
- renderers.put(".log", new LogfileRenderer());
- renderers.put(".html", new HTMLRenderer());
- renderers.put(".xhtml", new
MimeRenderer("application/xhtml+xml"));
- renderers.put(".xml", new MimeRenderer("text/xml"));
- renderers.put(".xcss", new TemplateCSSRenderer());
- renderers.put(".swf", new
MimeRenderer("application/x-shockwave-flash"));
// renderers.put(".htc",new BehaviorRenderer());
// set in-memory caching ImageIO
- ImageIO.setUseCache(false);
+ Thread thread = Thread.currentThread();
+ ClassLoader initialTCCL = thread.getContextClassLoader();
+
+ try {
+ ClassLoader systemCL = ClassLoader.getSystemClassLoader();
+ thread.setContextClassLoader(systemCL);
+ ImageIO.setUseCache(false);
+ } finally {
+ thread.setContextClassLoader(initialTCCL);
+ }
}
@@ -111,6 +105,21 @@
public ResourceBuilderImpl() {
super();
_startTime = System.currentTimeMillis();
+ renderers = new HashMap<String, ResourceRenderer>();
+ // append known renderers for extentions.
+ renderers.put(".gif", new GifRenderer());
+ ResourceRenderer renderer = new JpegRenderer();
+ renderers.put(".jpeg", renderer);
+ renderers.put(".jpg", renderer);
+ renderers.put(".png", new PngRenderer());
+ renderers.put(".js", getScriptRenderer());
+ renderers.put(".css", getStyleRenderer());
+ renderers.put(".log", new LogfileRenderer());
+ renderers.put(".html", new HTMLRenderer());
+ renderers.put(".xhtml", new
MimeRenderer("application/xhtml+xml"));
+ renderers.put(".xml", new MimeRenderer("text/xml"));
+ renderers.put(".xcss", new TemplateCSSRenderer());
+ renderers.put(".swf", new
MimeRenderer("application/x-shockwave-flash"));
}
/**
@@ -347,8 +356,7 @@
int lastPoint = path.lastIndexOf('.');
if (lastPoint > 0) {
String ext = path.substring(lastPoint);
- ResourceRenderer resourceRenderer = (ResourceRenderer) renderers
- .get(ext);
+ ResourceRenderer resourceRenderer = getRendererByExtension(ext);
if (null != resourceRenderer) {
res.setRenderer(resourceRenderer);
} else {
@@ -365,6 +373,15 @@
}
/**
+ * @param ext
+ * @return
+ */
+ protected ResourceRenderer getRendererByExtension(String ext) {
+ return renderers
+ .get(ext);
+ }
+
+ /**
* Create resurce to send from classpath relative to base class.
*
* @param base
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceLifecycle.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceLifecycle.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceLifecycle.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -109,27 +109,25 @@
public void send(ResourceContext resourceContext, InternetResource resource)
throws IOException {
FacesContext facesContext = FacesContext.getCurrentInstance();
- PhaseListener[] phaseListeners = null;
- PhaseEvent renderViewEvent = null;
if (null != facesContext) {
Lifecycle facesLifecycle = getFacesLifecycle();
- phaseListeners = facesLifecycle.getPhaseListeners();
+ PhaseListener[] phaseListeners = facesLifecycle.getPhaseListeners();
PhaseEvent restoreViewEvent = new PhaseEvent(facesContext,
PhaseId.RESTORE_VIEW, this);
processPhaseListeners(phaseListeners, restoreViewEvent, true);
// Fix for a
http://jira.jboss.org/jira/browse/RF-1056
- if (facesContext.getResponseComplete())
+ if (facesContext.getResponseComplete()) {
return;
+ }
// fix for a
http://jira.jboss.com/jira/browse/RF-1064 .
// viewRoot can be created outside.
UIViewRoot savedViewRoot = facesContext.getViewRoot();
try {
- // create "dummy" viewRoot, to avoid problems in phase
- // listeners.
+ // create "dummy" viewRoot, to avoid problems in phase listeners.
UIViewRoot root = new UIViewRoot();
String key = resource.getKey();
- if(null != key && !key.startsWith("/")){
- key="/"+key;
+ if (null != key && !key.startsWith("/")) {
+ key = "/" + key;
}
root.setViewId(key);
root.setLocale(Locale.getDefault());
@@ -140,12 +138,11 @@
// Fix for a
http://jira.jboss.org/jira/browse/RF-1056
if (!facesContext.getResponseComplete()) {
// Invoke before render view phase listeners
- renderViewEvent = new PhaseEvent(facesContext,
+ PhaseEvent renderViewEvent = new PhaseEvent(facesContext,
PhaseId.RENDER_RESPONSE, this);
processPhaseListeners(phaseListeners, renderViewEvent, true);
sendResource(resourceContext, resource);
- processPhaseListeners(phaseListeners, renderViewEvent,
- false);
+ processPhaseListeners(phaseListeners, renderViewEvent, false);
}
} finally {
@@ -201,11 +198,8 @@
phaseListener.afterPhase(phaseEvent);
}
} catch (Exception e) {
- _log
- .debug("Exception in PhaseListener, phase :"
- + phaseEvent.getPhaseId().toString()
- + (beforePhase ? " : beforePhase"
- : " : afterPhase"), e);
+ _log.debug("Exception in PhaseListener, phase :" +
phaseEvent.getPhaseId().toString()
+ + (beforePhase ? " : beforePhase" : " : afterPhase"), e);
}
}
}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ServletResourceContext.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ServletResourceContext.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ServletResourceContext.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -25,6 +25,9 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Set;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
@@ -108,6 +111,35 @@
return request.getSession(false).getAttribute(name);
}
+ /**
+ * @param name
+ * @return
+ * @see javax.servlet.ServletContext#getAttribute(java.lang.String)
+ */
+ public Object getContextAttribute(String name) {
+ return context.getAttribute(name);
+ }
+
+ /**
+ * @param path
+ * @return
+ * @throws MalformedURLException
+ * @see javax.servlet.ServletContext#getResource(java.lang.String)
+ */
+ public URL getResource(String path) throws MalformedURLException {
+ return context.getResource(path);
+ }
+
+ /**
+ * @param path
+ * @return
+ * @see javax.servlet.ServletContext#getResourcePaths(java.lang.String)
+ */
+ @SuppressWarnings("unchecked")
+ public Set getResourcePaths(String path) {
+ return context.getResourcePaths(path);
+ }
+
public InputStream getResourceAsStream(String path) {
// TODO Auto-generated method stub
return context.getResourceAsStream(path);
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/StaticResource.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/StaticResource.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/StaticResource.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -77,13 +77,9 @@
return context.getExternalContext().encodeResourceURL(src);
}
- public void encode(FacesContext context, Object data) {
- // TODO Auto-generated method stub
- }
-
/**
* @return the path
*/
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/TemplateCSSResource.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/TemplateCSSResource.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/TemplateCSSResource.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -61,7 +61,8 @@
// remove leaded / - as need for ClassLoader.getResource call.
this.templateName =
templateName.startsWith("/")?templateName.substring(1):templateName;
// Self-register resource in system.
- _resource =
InternetResourceBuilder.getInstance().createResource(null,this.templateName);
+ InternetResourceBuilder resourceBuilder = InternetResourceBuilder.getInstance();
+ _resource = resourceBuilder.createResource(null,this.templateName);
_resource.setRenderer(templateCSSRenderer);
try {
// Attempt to compile template at init time. Due to client-side caching,
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/UserResource.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/UserResource.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/UserResource.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -32,12 +32,7 @@
import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;
-import javax.faces.el.MethodBinding;
-import javax.faces.el.ValueBinding;
-import org.ajax4jsf.resource.ResourceComponent;
-import org.ajax4jsf.resource.ResourceContext;
-
/**
* @author shura
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/cached/CachedResourceBuilder.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/cached/CachedResourceBuilder.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/cached/CachedResourceBuilder.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -24,6 +24,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
+import java.util.UUID;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
import javax.faces.FacesException;
import javax.faces.context.FacesContext;
@@ -37,165 +39,241 @@
import org.apache.commons.logging.LogFactory;
/**
- * @author shura
+ * This class is intended to generate predictable URIs for all resources handled by
RichFaces.
+ * It creates mapping between resource key/data value and generated random string of
known format
+ * for all resource requests. By default {@link UUID#toString()} is used. Mapping is
maintained by LRU map
+ * having default capacity of {@value #DEFAULT_CAPACITY} so be aware that stale entries
can be removed and
+ * application users will get errors then.
*
+ * How to use: add to application classpath
META-INF/services/org.ajax4jsf.resource.InternetResourceBuilder
+ * file with the following content
<code>org.ajax4jsf.resource.cached.CachedResourceBuilder</code>
+ *
+ * Limitations:
+ *
+ * <ol>
+ * <li>Doesn't work in clustered environments</li>
+ * <li>All resource URIs become invalid after server restart that can cause cache
issues</li>
+ * <li>
+ * Diagnostic of resource loading errors becomes somewhat harder. Variant of code where
random key
+ * is appended to resource name doesn't satisfy the requirement of no path depth
> 8 as requested
+ * by users (see <a
href="https://jira.jboss.org/jira/browse/RF-3586">RF-3586<... for more
info)
+ * </li>
+ * </ol>
+ *
+ * @author Alexander Smirnov
+ * @author Nick Belaevski
*/
public class CachedResourceBuilder extends ResourceBuilderImpl {
- private static final Log log = LogFactory
- .getLog(CachedResourceBuilder.class);
+ private static final Log log = LogFactory.getLog(CachedResourceBuilder.class);
- private static final int DEFAULT_CAPACITY = 10000;
+ protected static final int DEFAULT_CAPACITY = 10000;
- private long counter = 0;
+ private ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock();
+
+ private DualLRUMap cache;
- private DualLRUMap cache;
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.resource.ResourceBuilderImpl#decrypt(byte[])
+ */
+ protected byte[] decrypt(byte[] data) {
+ // dummy - data not send via internet.
+ return data;
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.resource.ResourceBuilderImpl#decrypt(byte[])
- */
- protected byte[] decrypt(byte[] data) {
- // dummy - data not send via internet.
- return data;
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.resource.ResourceBuilderImpl#encrypt(byte[])
+ */
+ protected byte[] encrypt(byte[] data) {
+ // dummy - data not send via internet.
+ return data;
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.resource.ResourceBuilderImpl#encrypt(byte[])
- */
- protected byte[] encrypt(byte[] data) {
- // dummy - data not send via internet.
- return data;
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.ajax4jsf.resource.ResourceBuilderImpl#getResourceDataForKey(java.lang.String)
+ */
+ public Object getResourceDataForKey(String key) {
+ ResourceBean bean = null;
+ try {
+ readWriteLock.readLock().lock();
+ bean = (ResourceBean) cache.get(key);
+ } finally {
+ readWriteLock.readLock().unlock();
+ }
- /*
- * (non-Javadoc)
- *
- * @see
org.ajax4jsf.resource.ResourceBuilderImpl#getResourceDataForKey(java.lang.String)
- */
- public Object getResourceDataForKey(String key) {
- ResourceBean bean = (ResourceBean) cache.get(key);
- if (null == bean) {
- throw new ResourceNotFoundException("Resource for key " + key
- + "not present in cache");
+ if (null == bean) {
+ throw new ResourceNotFoundException("Resource for key " + key
+ + "not present in cache");
+ }
+
+ return bean.getData();
}
- return bean.getData();
- }
- /*
- * (non-Javadoc)
- *
- * @see
org.ajax4jsf.resource.ResourceBuilderImpl#getResourceForKey(java.lang.String)
- */
- public InternetResource getResourceForKey(String key)
- throws ResourceNotFoundException {
- ResourceBean bean = (ResourceBean) cache.get(key);
- if (null == bean) {
- throw new ResourceNotFoundException("Resource for key " + key
- + "not present in cache");
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.resource.ResourceBuilderImpl#getResourceForKey(java.lang.String)
+ */
+ public InternetResource getResourceForKey(String key)
+ throws ResourceNotFoundException {
+ ResourceBean bean = null;
+ try {
+ readWriteLock.readLock().lock();
+ bean = (ResourceBean) cache.get(key);
+ } finally {
+ readWriteLock.readLock().unlock();
+ }
+
+ if (null == bean) {
+ throw new ResourceNotFoundException("Resource for key " + key
+ + "not present in cache");
+ }
+
+ return super.getResourceForKey(bean.getKey());
}
- return super.getResourceForKey(bean.getKey());
- }
- /*
- * (non-Javadoc)
- *
- * @see
org.ajax4jsf.resource.ResourceBuilderImpl#getUri(org.ajax4jsf.resource.InternetResource,
- * javax.faces.context.FacesContext, java.lang.Object)
- */
- public String getUri(InternetResource resource, FacesContext facesContext,
- Object data) {
- ResourceBean bean;
- if (null == data) {
- bean = new ResourceBean(resource.getKey());
- } else {
- if (data instanceof byte[]) {
- // Special case for simple bytes array data.
- bean = new ResourceBytesDataBean(resource.getKey(),
- (byte[]) data);
- } else {
- bean = new ResourceDataBean(resource.getKey(), data);
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.ajax4jsf.resource.ResourceBuilderImpl#getUri(org.ajax4jsf.resource.InternetResource,
+ * javax.faces.context.FacesContext, java.lang.Object)
+ */
+ public String getUri(InternetResource resource, FacesContext facesContext,
+ Object data) {
+ ResourceBean bean;
+ if (null == data) {
+ bean = new ResourceBean(resource.getKey());
+ } else {
+ if (data instanceof byte[]) {
+ // Special case for simple bytes array data.
+ bean = new ResourceBytesDataBean(resource.getKey(),
+ (byte[]) data);
+ } else {
+ bean = new ResourceDataBean(resource.getKey(), data);
+ }
+ }
+
+ String key = null;
+
+ try {
+ readWriteLock.readLock().lock();
+
+ key = (String) cache.getKey(bean);
+
+ if (key != null) {
+ // Refresh LRU
+ cache.get(key);
+ }
+ } finally {
+ readWriteLock.readLock().unlock();
+ }
+
+ if (key == null) {
+ try {
+ readWriteLock.writeLock().lock();
+
+ key = (String) cache.getKey(bean);
+ if (null == key) {
+ key = createNextKey();
+ while (cache.containsKey(key)) {
+ key = createNextKey();
+ }
+
+ cache.put(key, bean);
+ } else {
+ // Refresh LRU
+ cache.get(key);
+ }
+
+ } finally {
+ readWriteLock.writeLock().unlock();
+ }
+ }
+
+ boolean isGlobal = !resource.isSessionAware();
+
+ String resourceURL = getFacesResourceURL(facesContext, key, isGlobal);
+ if (!isGlobal) {
+ resourceURL = facesContext.getExternalContext().encodeResourceURL(
+ resourceURL);
+ }
+ if (log.isDebugEnabled()) {
+ log.debug(Messages.getMessage(Messages.BUILD_RESOURCE_URI_INFO,
+ resource.getKey(), resourceURL));
+ }
+ return resourceURL;// context.getExternalContext().encodeResourceURL(resourceURL);
}
- String key = (String) cache.getKey(bean);
- if (null == key) {
- synchronized (this) {
- counter++;
- key = bean.hashCode() + "c" + counter;
- }
- cache.put(key, bean);
- } else {
- // Refresh LRU
- cache.get(key);
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.resource.ResourceBuilderImpl#init(javax.servlet.ServletContext,
+ * java.lang.String)
+ */
+ public void init() throws FacesException {
+ super.init();
+
+ Properties properties = getProperties("cache.properties");
+ int capacity = getCapacity(properties);
+ if (capacity <= 0) {
+ capacity = DEFAULT_CAPACITY;
+ log.info("Using default capacity: " + DEFAULT_CAPACITY);
+ }
+
+ cache = new DualLRUMap(capacity);
}
+
+ /**
+ * Get properties file from classpath
+ *
+ * @param name
+ * @return
+ */
+ protected Properties getProperties(String name) {
+ Properties properties = new Properties();
+ InputStream props = URLToStreamHelper.urlToStreamSafe(CachedResourceBuilder.class
+ .getResource(name));
+ if (null != props) {
+ try {
+ properties.load(props);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ log.warn(Messages.getMessage(Messages.READING_PROPERTIES_ERROR,
+ name), e);
+ } finally {
+ try {
+ props.close();
+ } catch (IOException e) {
+ // Can be ignored
+ }
+ }
+ }
+ return properties;
+
+ }
- boolean isGlobal = !resource.isSessionAware();
-
- String resourceURL = getFacesResourceURL(facesContext, key, isGlobal);
- if (!isGlobal) {
- resourceURL = facesContext.getExternalContext().encodeResourceURL(
- resourceURL);
+ protected String createNextKey() {
+ return UUID.randomUUID().toString();
}
- if (log.isDebugEnabled()) {
- log.debug(Messages.getMessage(Messages.BUILD_RESOURCE_URI_INFO,
- resource.getKey(), resourceURL));
- }
- return resourceURL;// context.getExternalContext().encodeResourceURL(resourceURL);
- }
- /*
- * (non-Javadoc)
- *
- * @see
org.ajax4jsf.resource.ResourceBuilderImpl#init(javax.servlet.ServletContext,
- * java.lang.String)
- */
- public void init()
- throws FacesException {
- super.init();
- // Create cache manager.
- Properties properties = getProperties("cache.properties");
- int capacity = DEFAULT_CAPACITY;
- String capacityString = properties.getProperty("cache.capacity");
- if (null != capacityString) {
- try {
- capacity = Integer.parseInt(capacityString);
- } catch (NumberFormatException e) {
- log.warn("Error parsing value of parameters cache capacity, use default value
"+DEFAULT_CAPACITY, e);
- }
- }
- cache = new DualLRUMap(capacity);
- counter = getStartTime() - 1158760000000L;
- }
-
- /**
- * Get properties file from classpath
- *
- * @param name
- * @return
- */
- protected Properties getProperties(String name) {
- Properties properties = new Properties();
- InputStream props = URLToStreamHelper.urlToStreamSafe(CachedResourceBuilder.class
- .getResource(name));
- if (null != props) {
- try {
- properties.load(props);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- log.warn(Messages.getMessage(Messages.READING_PROPERTIES_ERROR,
- name), e);
- } finally {
- try {
- props.close();
- } catch (IOException e) {
- // Can be ignored
+ protected int getCapacity(Properties properties) {
+ // Create cache manager.
+ int capacity = 0;
+ String capacityString = properties.getProperty("cache.capacity");
+ if (null != capacityString) {
+ try {
+ capacity = Integer.parseInt(capacityString);
+ } catch (NumberFormatException e) {
+ log.warn("Error parsing value of parameters cache capacity", e);
+ }
}
- }
+
+ return capacity;
}
- return properties;
-
- }
}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/cached/DualLRUMap.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/cached/DualLRUMap.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/cached/DualLRUMap.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -21,58 +21,84 @@
package org.ajax4jsf.resource.cached;
+import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.Map;
+import java.util.Set;
-import org.apache.commons.collections.LRUMap;
+class DualLRUMap<K, V> extends LinkedHashMap<K, V> {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -313747679711995782L;
-class DualLRUMap extends LRUMap {
+ private Map<V, K> reverseMap;
- private Map reverseMap ;
+ private int capacity;
+
+ public DualLRUMap(int capacity) {
+ super(capacity, 0.75f, true);
- public DualLRUMap(int size) {
- super(size);
- reverseMap = new HashMap(size);
+ this.capacity = capacity;
+
+ this.reverseMap = new HashMap<V, K>(capacity, 0.75f);
}
-
- /* (non-Javadoc)
- * @see org.apache.commons.collections.LRUMap#processRemovedLRU(java.lang.Object,
java.lang.Object)
- */
- protected void processRemovedLRU(Object key, Object value) {
- synchronized (this) {
- super.processRemovedLRU(key, value);
- reverseMap.remove(value);
+
+ public V put(K key, V value) {
+ V v = super.put(key, value);
+
+ reverseMap.put(value, key);
+
+ return v;
+ };
+
+ public V remove(Object key) {
+ V value = super.remove(key);
+
+ if (value != null) {
+ reverseMap.remove(value);
}
+
+ return value;
}
+
+ public K getKey(Object value) {
+ K key = reverseMap.get(value);
- /* (non-Javadoc)
- * @see org.apache.commons.collections.LRUMap#put(java.lang.Object, java.lang.Object)
- */
- public Object put(Object key, Object value) {
- synchronized (this) {
- reverseMap.put(value, key);
- return super.put(key, value);
+ if (key != null) {
+ //update LRU
+ get(key);
}
+
+ return key;
}
- public Object getKey(Object value){
- synchronized (this) {
- Object key = reverseMap.get(value);
- if(!containsKey(key)){
- reverseMap.remove(value);
- key = null;
+ @Override
+ protected boolean removeEldestEntry(java.util.Map.Entry<K, V> eldest) {
+ boolean remove = (size() > capacity);
+
+ if (remove) {
+ reverseMap.remove(eldest.getValue());
}
- return key;
- }
+
+ return remove;
}
+
+ @Override
+ public Set<java.util.Map.Entry<K, V>> entrySet() {
+ return Collections.unmodifiableSet(super.entrySet());
+ }
- /* (non-Javadoc)
- * @see org.apache.commons.collections.LRUMap#get(java.lang.Object)
- */
- public Object get(Object key) {
- synchronized (this) {
- return super.get(key);
- }
+ @Override
+ public Set<K> keySet() {
+ return Collections.unmodifiableSet(super.keySet());
}
-
+
+ @Override
+ public Collection<V> values() {
+ return Collections.unmodifiableCollection(super.values());
+ }
}
\ No newline at end of file
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/cached/ResourceBean.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/cached/ResourceBean.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/cached/ResourceBean.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -27,8 +27,12 @@
* @author shura
*
*/
-public class ResourceBean implements Serializable {
+public class ResourceBean implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2830008963777271324L;
private String key;
/**
@@ -51,10 +55,15 @@
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
if (null != obj && obj instanceof ResourceBean) {
ResourceBean bean = (ResourceBean) obj;
return key.equals(bean.getKey()) && bean.getData() == null;
- };
+ }
+
return false;
}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/cached/ResourceBytesDataBean.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/cached/ResourceBytesDataBean.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/cached/ResourceBytesDataBean.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -29,6 +29,10 @@
*/
public class ResourceBytesDataBean extends ResourceBean {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3012554202964229624L;
private byte[] data;
ResourceBytesDataBean(String key, byte[] data){
@@ -43,11 +47,16 @@
* @see com.exadel.vcp.resource.ResourceBean#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
if (null != obj && obj instanceof ResourceBytesDataBean) {
ResourceBytesDataBean bean = (ResourceBytesDataBean) obj;
byte[] beanData = (byte[]) bean.getData();
return getKey().equals(bean.getKey()) && Arrays.equals(data, beanData);
- };
+ }
+
return false;
}
@@ -55,11 +64,10 @@
* @see com.exadel.vcp.resource.ResourceBean#hashCode()
*/
public int hashCode() {
- int hash = super.hashCode();
- for (int i = 0; i < data.length; i++) {
- hash = hash*32+data[i];
- }
- return hash;
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + Arrays.hashCode(data);
+ return result;
}
}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/cached/ResourceDataBean.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/cached/ResourceDataBean.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/cached/ResourceDataBean.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -26,8 +26,13 @@
* @author shura
*
*/
-public class ResourceDataBean extends ResourceBean{
+public class ResourceDataBean extends ResourceBean {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -6486715556040103424L;
+
private Object data;
public ResourceDataBean(String key, Object data){
@@ -39,10 +44,15 @@
* @see com.exadel.vcp.resource.ResourceBean#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
if (null != obj && obj instanceof ResourceBean) {
ResourceBean bean = (ResourceBean) obj;
return getKey().equals(bean.getKey()) && data.equals(bean.getData());
- };
+ }
+
return false;
}
@@ -57,8 +67,10 @@
* @see com.exadel.vcp.resource.ResourceBean#hashCode()
*/
public int hashCode() {
- // TODO Auto-generated method stub
- return super.hashCode()*32+data.hashCode();
+ final int prime = 31;
+ int result = super.hashCode();
+ result = result * prime + data.hashCode();
+ return result;
}
}
Deleted:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/image/DiffusionFilterOp.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/image/DiffusionFilterOp.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/image/DiffusionFilterOp.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,268 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * Helma License Notice
- *
- * The contents of this file are subject to the Helma License
- * Version 2.0 (the "License"). You may not use this file except in
- * compliance with the License. A copy of the License is available at
- *
http://adele.helma.org/download/helma/license.txt
- *
- * Copyright 1998-2003 Helma Software. All Rights Reserved.
- *
- * $RCSfile: DiffusionFilterOp.java,v $
- * $Author: alexsmirnov $
- * $Revision: 1.1.2.1 $
- * $Date: 2007/01/09 18:59:06 $
- */
-
-/*
- * Code from com.jhlabs.image.DiffusionFilter, Java Image Processing
- * Copyright (C) Jerry Huxtable 1998
- *
http://www.jhlabs.com/ip/
- *
- * Conversion to a BufferedImageOp inspired by:
- *
http://www.peter-cockerell.net:8080/java/FloydSteinberg/FloydSteinbergFil...
- *
- */
-
-package org.ajax4jsf.resource.image;
-
-import java.awt.RenderingHints;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-import java.awt.image.BufferedImage;
-import java.awt.image.BufferedImageOp;
-import java.awt.image.ColorModel;
-import java.awt.image.DataBufferByte;
-import java.awt.image.DataBufferInt;
-import java.awt.image.IndexColorModel;
-
-import org.ajax4jsf.Messages;
-
-public class DiffusionFilterOp implements BufferedImageOp {
-
- protected final static int[] diffusionMatrix = {
- 0, 0, 0,
- 0, 0, 7,
- 3, 5, 1,
- };
-
- private int[] matrix;
- private int sum;
- private boolean serpentine = true;
- private int[] colorMap;
-
- /**
- * Construct a DiffusionFilter
- */
- public DiffusionFilterOp() {
- setMatrix(diffusionMatrix);
- }
-
- /**
- * Set whether to use a serpentine pattern for return or not. This can reduce
'avalanche' artifacts in the output.
- * @param serpentine true to use serpentine pattern
- */
- public void setSerpentine(boolean serpentine) {
- this.serpentine = serpentine;
- }
-
- /**
- * Return the serpentine setting
- * @return the current setting
- */
- public boolean getSerpentine() {
- return serpentine;
- }
-
- public void setMatrix(int[] matrix) {
- this.matrix = matrix;
- sum = 0;
- for (int i = 0; i < matrix.length; i++)
- sum += matrix[i];
- }
-
- public int[] getMatrix() {
- return matrix;
- }
-
- /**
- * Do the filter operation
- *
- * @param src The source BufferedImage. Can be any type.
- * @param dst The destination image. If not null, must be of type TYPE_BYTE_INDEXED
- * @return A dithered version of src in a BufferedImage of type TYPE_BYTE_INDEXED
- */
- public BufferedImage filter(BufferedImage src, BufferedImage dst) {
-
- // If there's no dest. create one
- if (dst == null)
- dst = createCompatibleDestImage(src, null);
-
- // Otherwise check that the provided dest is an indexed image
- else if (dst.getType() != BufferedImage.TYPE_BYTE_INDEXED) {
- throw new
IllegalArgumentException(Messages.getMessage(Messages.BUFFER_TYPE_ERROR));
- }
-
- DataBufferByte dstBuffer = (DataBufferByte) dst.getRaster().getDataBuffer();
- byte dstData[] = dstBuffer.getData();
-
- // Other things to test are pixel bit strides, scanline stride and transfer type
- // Same goes for the source image
-
- IndexColorModel icm = (IndexColorModel) dst.getColorModel();
- colorMap = new int[icm.getMapSize()];
- icm.getRGBs(colorMap);
-
- int width = src.getWidth();
- int height = src.getHeight();
-
- DataBufferInt srcBuffer = (DataBufferInt) src.getRaster().getDataBuffer();
- int srcData[] = srcBuffer.getData();
-
- // This is the offset into the buffer of the current source pixel
- int index = 0;
-
- // Loop through each pixel
- for (int y = 0; y < height; y++) {
- boolean reverse = serpentine && (y & 1) == 1;
- int direction;
- if (reverse) {
- index = y * width + width - 1;
- direction = -1;
- } else {
- index = y * width;
- direction = 1;
- }
- for (int x = 0; x < width; x++) {
- int rgb1 = srcData[index];
- int a1 = (rgb1 >> 24) & 0xff;
- int r1 = (rgb1 >> 16) & 0xff;
- int g1 = (rgb1 >> 8) & 0xff;
- int b1 = rgb1 & 0xff;
-
- int idx = findIndex(r1, g1, b1, a1);
- dstData[index] = (byte) idx;
-
- int rgb2 = colorMap[idx];
- int a2 = (rgb2 >> 24) & 0xff;
- int r2 = (rgb2 >> 16) & 0xff;
- int g2 = (rgb2 >> 8) & 0xff;
- int b2 = rgb2 & 0xff;
-
- int er = r1 - r2;
- int eg = g1 - g2;
- int eb = b1 - b2;
- int ea = a1 - a2;
-
- for (int i = -1; i <= 1; i++) {
- int iy = i + y;
- if (0 <= iy && iy < height) {
- for (int j = -1; j <= 1; j++) {
- int jx = j + x;
- if (0 <= jx && jx < width) {
- int w;
- if (reverse)
- w = matrix[(i + 1) * 3 - j + 1];
- else
- w = matrix[(i + 1) * 3 + j + 1];
- if (w != 0) {
- int k = reverse ? index - j : index + j;
- rgb1 = srcData[k];
- a1 = ((rgb1 >> 24) & 0xff) + ea * w / sum;
- r1 = ((rgb1 >> 16) & 0xff) + er * w / sum;
- g1 = ((rgb1 >> 8) & 0xff) + eg * w / sum;
- b1 = (rgb1 & 0xff) + eb * w / sum;
-
- srcData[k] = ((clamp(a1) << 24) | clamp(r1)
<< 16)
- | (clamp(g1) << 8) | clamp(b1);
- }
- }
- }
- }
- }
- index += direction;
- }
- }
-
- return dst;
- }
-
- private static int clamp(int c) {
- if (c < 0)
- return 0;
- if (c > 255)
- return 255;
- return c;
- }
-
- int findIndex(int r1, int g1, int b1, int a1)
- throws ArrayIndexOutOfBoundsException {
- int idx = 0;
- long dist = Long.MAX_VALUE;
- for (int i = 0; i < colorMap.length; i++) {
- int rgb2 = colorMap[i];
- int a2 = (rgb2 >> 24) & 0xff;
- int r2 = (rgb2 >> 16) & 0xff;
- int g2 = (rgb2 >> 8) & 0xff;
- int b2 = rgb2 & 0xff;
-
- int da = a1 - a2;
- int dr = r1 - r2;
- int dg = g1 - g2;
- int db = b1 - b2;
-
- long newdist = da * da + dr * dr + dg * dg + db * db;
- if (newdist < dist) {
- idx = i;
- dist = newdist;
- }
- }
- return idx;
- }
-
- // This always returns an indexed image
- public BufferedImage createCompatibleDestImage(BufferedImage src,
- ColorModel destCM) {
- return new BufferedImage(src.getWidth(), src.getHeight(),
- BufferedImage.TYPE_BYTE_INDEXED);
- }
-
- // There are no rendering hints
- public RenderingHints getRenderingHints() {
- return null;
- }
-
- // No transformation, so return the source point
- public Point2D getPoint2D(Point2D srcPt, Point2D dstPt) {
- if (dstPt == null)
- dstPt = new Point2D.Float();
- dstPt.setLocation(srcPt.getX(), srcPt.getY());
- return dstPt;
- }
-
- // No transformation, so return the source bounds
- public Rectangle2D getBounds2D(BufferedImage src) {
- return src.getRaster().getBounds();
- }
-}
\ No newline at end of file
Deleted:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/image/GIFEncoder.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/image/GIFEncoder.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/image/GIFEncoder.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,554 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * Helma License Notice
- *
- * The contents of this file are subject to the Helma License
- * Version 2.0 (the "License"). You may not use this file except in
- * compliance with the License. A copy of the License is available at
- *
http://adele.helma.org/download/helma/license.txt
- *
- * Copyright 1998-2003 Helma Software. All Rights Reserved.
- *
- * $RCSfile: GIFEncoder.java,v $
- * $Author: alexsmirnov $
- * $Revision: 1.1.2.1 $
- * $Date: 2007/01/09 18:59:03 $
- */
-
-/*
- * The GIF encoding routines are based on the Acme libary
- *
- * The following addaptions and extensions were added by Joerg Lehni:
- *
- * - encode now directly works on BufferedImage objects, the ImageEncoder
- * and ImageConsumer oriented frameworks has been removed.
- * - Only BufferedImages with IndexColorModel are taken, so no more
- * palette optimization with IntHashtable objects are necessary. If the
- * BufferedImage is in wrong format, helma.image.Quantizie is used to
- * convert it into a index based image.
- * - This version is much less space consuming as it only takes one sample
- * row of the rastered image at a time into memory during compression.
- * - The overall time for color reduction and gif compression should
- * therefore be greatly reduced.
- *
- * Acme Disclaimer:
- *
- * Transparency handling and variable bit size courtesy of Jack Palevich.
- *
- * Copyright (C)1996,1998 by Jef Poskanzer <jef(a)acme.com>. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Visit the ACME Labs Java page for up-to-date versions of this and other
- * fine Java utilities:
http://www.acme.com/java/
- *
- * GifEncoder is adapted from ppmtogif, which is based on GIFENCOD by David
- * Rowley <mgardi(a)watdscu.waterloo.edu>. Lempel-Zim compression
- * based on "compress".
- *
- */
-
-package org.ajax4jsf.resource.image;
-
-import java.awt.image.BufferedImage;
-import java.awt.image.IndexColorModel;
-import java.awt.image.Raster;
-import java.io.DataOutput;
-import java.io.IOException;
-
-public class GIFEncoder {
- private boolean interlace = false;
-
- private int width, height;
- private Raster raster;
- // DataOutput is used for compatibility with ImageIO (see
helma.image.imageio.gif.GIFImageWriter)
- // otherwise, OutputStream would make much more sense here:
- private DataOutput out;
-
- private int curx, cury;
- private int countdown;
- private int pass;
- private int[] row;
-
- public void encode(BufferedImage bi, DataOutput out) throws IOException {
- encode(bi, out, false, null);
- }
-
- public void encode(BufferedImage bi, DataOutput out, boolean interlace,
- String comment) throws IOException {
- this.out = out;
- this.interlace = interlace;
-
- // make sure it's index colors:
- if (bi.getType() != BufferedImage.TYPE_BYTE_INDEXED)
- bi = Quantize.process(bi, 256, false, true);
-
- raster = bi.getRaster();
-
- width = bi.getWidth();
- height = bi.getHeight();
-
- int numPixels = width * height;
-
- IndexColorModel icm = (IndexColorModel) bi.getColorModel();
- int transparentIndex = icm.getTransparentPixel();
- int numColors = icm.getMapSize();
-
- // Figure out how many bits to use.
- int bitsPerPixel;
- if (numColors <= 2)
- bitsPerPixel = 1;
- else if (numColors <= 4)
- bitsPerPixel = 2;
- else if (numColors <= 16)
- bitsPerPixel = 4;
- else
- bitsPerPixel = 8;
-
- int initCodeSize;
-
- // Calculate number of bits we are expecting
- countdown = numPixels;
-
- // Indicate which pass we are on (if interlace)
- pass = 0;
-
- // The initial code size
- if (bitsPerPixel <= 1)
- initCodeSize = 2;
- else
- initCodeSize = bitsPerPixel;
-
- // Set up the current x and y position
- curx = 0;
- cury = 0;
- row = new int[width];
-
- // Write the Magic header
- writeString("GIF89a");
-
- // Write out the screen width and height
- writeWord(width);
- writeWord(height);
-
- // Indicate that there is a global colour map
- byte flags = (byte) 0x80; // Yes, there is a color map
- // OR in the resolution
- flags |= (byte) ((8 - 1) << 4);
- // Not sorted
- // OR in the Bits per Pixel
- flags |= (byte) ((bitsPerPixel - 1));
- // Write it out
- out.write(flags);
-
- // Write out the Background colour
- out.write((byte) 0);
-
- // Pixel aspect ratio - 1:1.
- //out.write((byte) 49);
- // Java's GIF reader currently has a bug, if the aspect ratio byte is
- // not zero it throws an ImageFormatException. It doesn't know that
- // 49 means a 1:1 aspect ratio. Well, whatever, zero works with all
- // the other decoders I've tried so it probably doesn't hurt.
- out.write((byte) 0);
-
- // Write out the Global Colour Map
- // Turn colors into colormap entries.
- int mapSize = 1 << bitsPerPixel;
- byte[] reds = new byte[mapSize], greens = new byte[mapSize], blues = new
byte[mapSize];
- icm.getReds(reds);
- icm.getGreens(greens);
- icm.getBlues(blues);
-
- for (int i = 0; i < mapSize; ++i) {
- out.write(reds[i]);
- out.write(greens[i]);
- out.write(blues[i]);
- }
-
- // Write out extension for transparent colour index, if necessary.
- if (transparentIndex != -1) {
- out.write((byte) '!');
- out.write((byte) 0xf9);
- out.write((byte) 4);
- out.write((byte) 1);
- out.write((byte) 0);
- out.write((byte) 0);
- out.write((byte) transparentIndex);
- out.write((byte) 0);
- }
-
- // Write an Image separator
- out.write((byte) ',');
-
- // Write the Image header
- writeWord(0); // leftOfs
- writeWord(0); // topOfs
- writeWord(width);
- writeWord(height);
-
- // Write out whether or not the image is interlaced
- if (interlace)
- out.write((byte) 0x40);
- else
- out.write((byte) 0x00);
-
- // Write out the initial code size
- out.write((byte) initCodeSize);
-
- // Go and actually compress the data
- compress(initCodeSize + 1);
-
- // Write out a Zero-length packet (to end the series)
- out.write((byte) 0);
-
- // Write out the comment
- if (comment != null && comment.length() > 0) {
- out.write((byte) 0x21);
- out.write((byte) 0xFE);
- out.write((byte) comment.length());
- writeString(comment);
- out.write((byte) 0);
- }
-
- // Write the GIF file terminator
- out.write((byte) ';');
- }
-
- // Return the next pixel from the image
- int getNextPixel() throws IOException {
- if (countdown == 0)
- return -1;
-
- --countdown;
-
- if (curx == 0)
- row = raster.getSamples(0, cury, width, 1, 0, row);
- int index = row[curx];
-
- // Bump the current X position
- ++curx;
-
- // If we are at the end of a scan line, set curx back to the beginning
- // If we are interlaced, bump the cury to the appropriate spot,
- // otherwise, just increment it.
- if (curx == width) {
- curx = 0;
-
- if (!interlace) {
- ++cury;
- } else {
- switch (pass) {
- case 0:
- cury += 8;
- if (cury >= height) {
- ++pass;
- cury = 4;
- }
- break;
-
- case 1:
- cury += 8;
- if (cury >= height) {
- ++pass;
- cury = 2;
- }
- break;
-
- case 2:
- cury += 4;
- if (cury >= height) {
- ++pass;
- cury = 1;
- }
- break;
-
- case 3:
- cury += 2;
- break;
- }
- }
- }
- return index;
- }
-
- void writeString(String str) throws IOException {
- byte[] buf = str.getBytes();
- out.write(buf);
- }
-
- // Write out a word to the GIF file
- void writeWord(int w) throws IOException {
- out.write((byte) (w & 0xff));
- out.write((byte) ((w >> 8) & 0xff));
- }
-
- // GIFCOMPR.C - GIF Image compression routines
- //
- // Lempel-Ziv compression based on 'compress'. GIF modifications by
- // David Rowley (mgardi(a)watdcsu.waterloo.edu)
-
- // General DEFINEs
-
- static final int BITS = 12;
-
- static final int HASH_SIZE = 5003; // 80% occupancy
-
- // GIF Image compression - modified 'compress'
- //
- // Based on: compress.c - File compression ala IEEE Computer, June 1984.
- //
- // By Authors: Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas)
- // Jim McKie (decvax!mcvax!jim)
- // Steve Davies (decvax!vax135!petsd!peora!srd)
- // Ken Turkowski (decvax!decwrl!turtlevax!ken)
- // James A. Woods (decvax!ihnp4!ames!jaw)
- // Joe Orost (decvax!vax135!petsd!joe)
-
- private int numBits; // number of bits/code
- private int maxBits = BITS; // user settable max # bits/code
- private int maxCode; // maximum code, given numBits
- private int maxMaxCode = 1 << BITS; // should NEVER generate this code
-
- final int getMaxCode(int numBits) {
- return (1 << numBits) - 1;
- }
-
- private int[] hashTable = new int[HASH_SIZE];
- private int[] codeTable = new int[HASH_SIZE];
-
- private int freeEntry = 0; // first unused entry
-
- // block compression parameters -- after all codes are used up,
- // and compression rate changes, start over.
- private boolean clearFlag = false;
-
- // Algorithm: use open addressing double hashing (no chaining) on the
- // prefix code / next character combination. We do a variant of Knuth's
- // algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime
- // secondary probe. Here, the modular division first probe is gives way
- // to a faster exclusive-or manipulation. Also do block compression with
- // an adaptive reset, whereby the code table is cleared when the compression
- // ratio decreases, but after the table fills. The variable-length output
- // codes are re-sized at this point, and a special CLEAR code is generated
- // for the decompressor. Late addition: construct the table according to
- // file size for noticeable speed improvement on small files. Please direct
- // questions about this implementation to ames!jaw.
-
- private int initBits;
-
- private int clearCode;
- private int EOFCode;
-
- void compress(int initBits) throws IOException {
- // Set up the globals: initBits - initial number of bits
- this.initBits = initBits;
-
- // Set up the necessary values
- clearFlag = false;
- numBits = initBits;
- maxCode = getMaxCode(numBits);
-
- clearCode = 1 << (initBits - 1);
- EOFCode = clearCode + 1;
- freeEntry = clearCode + 2;
-
- charInit();
-
- int ent = getNextPixel();
-
- int hashShift = 0;
- for (int fcode = HASH_SIZE; fcode < 65536; fcode *= 2)
- ++hashShift;
- hashShift = 8 - hashShift; // set hash code range bound
-
- clearHash(); // clear hash table
-
- output(clearCode);
-
- int c;
- outerLoop: while ((c = getNextPixel()) != -1) {
- int fcode = (c << maxBits) + ent;
- int i = (c << hashShift) ^ ent; // xor hashing
-
- if (hashTable[i] == fcode) {
- ent = codeTable[i];
- continue;
- } else if (hashTable[i] >= 0) { // non-empty slot
- int disp = HASH_SIZE - i; // secondary hash (after G. Knott)
- if (i == 0)
- disp = 1;
- do {
- if ((i -= disp) < 0)
- i += HASH_SIZE;
-
- if (hashTable[i] == fcode) {
- ent = codeTable[i];
- continue outerLoop;
- }
- } while (hashTable[i] >= 0);
- }
- output(ent);
- ent = c;
- if (freeEntry < maxMaxCode) {
- codeTable[i] = freeEntry++; // code -> hashtable
- hashTable[i] = fcode;
- } else
- clearBlock();
- }
- // Put out the final code.
- output(ent);
- output(EOFCode);
- }
-
- // output
- //
- // Output the given code.
- // Inputs:
- // code: A numBits-bit integer. If == -1, then EOF. This assumes
- // that numBits =< wordsize - 1.
- // Outputs:
- // Outputs code to the file.
- // Assumptions:
- // Chars are 8 bits long.
- // Algorithm:
- // Maintain a BITS character long buffer (so that 8 codes will
- // fit in it exactly). Use the VAX insv instruction to insert each
- // code in turn. When the buffer fills up empty it and start over.
-
- int curAccum = 0;
- int curBits = 0;
-
- int masks[] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F,
- 0x007F, 0x00FF, 0x01FF, 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF,
- 0x7FFF, 0xFFFF };
-
- void output(int code) throws IOException {
- curAccum &= masks[curBits];
-
- if (curBits > 0)
- curAccum |= (code << curBits);
- else
- curAccum = code;
-
- curBits += numBits;
-
- while (curBits >= 8) {
- charOut((byte) (curAccum & 0xff));
- curAccum >>= 8;
- curBits -= 8;
- }
-
- // If the next entry is going to be too big for the code size,
- // then increase it, if possible.
- if (freeEntry > maxCode || clearFlag) {
- if (clearFlag) {
- maxCode = getMaxCode(numBits = initBits);
- clearFlag = false;
- } else {
- ++numBits;
- if (numBits == maxBits)
- maxCode = maxMaxCode;
- else
- maxCode = getMaxCode(numBits);
- }
- }
-
- if (code == EOFCode) {
- // At EOF, write the rest of the buffer.
- while (curBits > 0) {
- charOut((byte) (curAccum & 0xff));
- curAccum >>= 8;
- curBits -= 8;
- }
-
- charFlush();
- }
- }
-
- // Clear out the hash table
-
- // table clear for block compress
- void clearBlock() throws IOException {
- clearHash();
- freeEntry = clearCode + 2;
- clearFlag = true;
-
- output(clearCode);
- }
-
- // reset code table
- void clearHash() {
- for (int i = 0; i < HASH_SIZE; ++i)
- hashTable[i] = -1;
- }
-
- // GIF Specific routines
-
- // Number of characters so far in this 'packet'
- private int a_count;
-
- // Set up the 'byte output' routine
- void charInit() {
- a_count = 0;
- }
-
- // Define the storage for the packet accumulator
- private byte[] accum = new byte[256];
-
- // Add a character to the end of the current packet, and if it is 254
- // characters, flush the packet to disk.
- void charOut(byte c) throws IOException {
- accum[a_count++] = c;
- if (a_count >= 254)
- charFlush();
- }
-
- // Flush the packet to disk, and reset the accumulator
- void charFlush() throws IOException {
- if (a_count > 0) {
- out.write(a_count);
- out.write(accum, 0, a_count);
- a_count = 0;
- }
- }
-}
\ No newline at end of file
Deleted:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/image/Quantize.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/image/Quantize.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/image/Quantize.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,840 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * Helma License Notice
- *
- * The contents of this file are subject to the Helma License
- * Version 2.0 (the "License"). You may not use this file except in
- * compliance with the License. A copy of the License is available at
- *
http://adele.helma.org/download/helma/license.txt
- *
- * Copyright 1998-2003 Helma Software. All Rights Reserved.
- *
- * $RCSfile: Quantize.java,v $
- * $Author: alexsmirnov $
- * $Revision: 1.1.2.1 $
- * $Date: 2007/01/09 18:59:05 $
- */
-
-package org.ajax4jsf.resource.image;
-
-import java.awt.image.BufferedImage;
-import java.awt.image.DataBufferByte;
-import java.awt.image.DataBufferInt;
-import java.awt.image.IndexColorModel;
-
-/*
- * @(#)Quantize.java 0.90 9/19/00 Adam Doppelt
- *
- * Modifications by Joerg Lehni:
- *
- * - Support for alpha-channels.
- * - Returns a BufferedImage of TYPE_BYTE_INDEXED with a IndexColorModel.
- * - Dithering of images through helma.image.DiffusionFilterOp by setting
- * the dither parameter to true.
- * - Support for a transparent color, which is correctly rendered by GIFEncoder.
- * All pixels with alpha < 0x80 are converted to this color when the parameter
- * alphaToBitmask is set to true.
- * - Removed the SQUARES lookup tables as multiplications of integer values
- * shouldn't take more than one clock nowadays anyhow.
- */
-
-/**
- * An efficient color quantization algorithm, adapted from the C++
- * implementation quantize.c in <a
- *
href="http://www.imagemagick.org/">ImageMagick</a>. The pixels for
- * an image are placed into an oct tree. The oct tree is reduced in
- * size, and the pixels from the original image are reassigned to the
- * nodes in the reduced tree.<p>
- *
- * Here is the copyright notice from ImageMagick:
- *
- * <pre>
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Permission is hereby granted, free of charge, to any person obtaining a %
-% copy of this software and associated documentation files ("ImageMagick"),
%
-% to deal in ImageMagick without restriction, including without limitation %
-% the rights to use, copy, modify, merge, publish, distribute, sublicense, %
-% and/or sell copies of ImageMagick, and to permit persons to whom the %
-% ImageMagick is furnished to do so, subject to the following conditions: %
-% %
-% The above copyright notice and this permission notice shall be included in %
-% all copies or substantial portions of ImageMagick. %
-% %
-% The software is provided "as is", without warranty of any kind, express or
%
-% implied, including but not limited to the warranties of merchantability, %
-% fitness for a particular purpose and noninfringement. In no event shall %
-% E. I. du Pont de Nemours and Company be liable for any claim, damages or %
-% other liability, whether in an action of contract, tort or otherwise, %
-% arising from, out of or in connection with ImageMagick or the use or other %
-% dealings in ImageMagick. %
-% %
-% Except as contained in this notice, the name of the E. I. du Pont de %
-% Nemours and Company shall not be used in advertising or otherwise to %
-% promote the sale, use or other dealings in ImageMagick without prior %
-% written authorization from the E. I. du Pont de Nemours and Company. %
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-</pre>
- *
- *
- * @version 0.90 19 Sep 2000
- * @author <a
href="http://www.gurge.com/amd/">Adam Doppelt</a>
- */
-public class Quantize {
-
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% %
-% %
-% %
-% QQQ U U AAA N N TTTTT IIIII ZZZZZ EEEEE %
-% Q Q U U A A NN N T I ZZ E %
-% Q Q U U AAAAA N N N T I ZZZ EEEEE %
-% Q QQ U U A A N NN T I ZZ E %
-% QQQQ UUU A A N N T IIIII ZZZZZ EEEEE %
-% %
-% %
-% Reduce the Number of Unique Colors in an Image %
-% %
-% %
-% Software Design %
-% John Cristy %
-% July 1992 %
-% %
-% %
-% Copyright 1998 E. I. du Pont de Nemours and Company %
-% %
-% Permission is hereby granted, free of charge, to any person obtaining a %
-% copy of this software and associated documentation files ("ImageMagick"),
%
-% to deal in ImageMagick without restriction, including without limitation %
-% the rights to use, copy, modify, merge, publish, distribute, sublicense, %
-% and/or sell copies of ImageMagick, and to permit persons to whom the %
-% ImageMagick is furnished to do so, subject to the following conditions: %
-% %
-% The above copyright notice and this permission notice shall be included in %
-% all copies or substantial portions of ImageMagick. %
-% %
-% The software is provided "as is", without warranty of any kind, express or
%
-% implied, including but not limited to the warranties of merchantability, %
-% fitness for a particular purpose and noninfringement. In no event shall %
-% E. I. du Pont de Nemours and Company be liable for any claim, damages or %
-% other liability, whether in an action of contract, tort or otherwise, %
-% arising from, out of or in connection with ImageMagick or the use or other %
-% dealings in ImageMagick. %
-% %
-% Except as contained in this notice, the name of the E. I. du Pont de %
-% Nemours and Company shall not be used in advertising or otherwise to %
-% promote the sale, use or other dealings in ImageMagick without prior %
-% written authorization from the E. I. du Pont de Nemours and Company. %
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% Realism in computer graphics typically requires using 24 bits/pixel to
-% generate an image. Yet many graphic display devices do not contain
-% the amount of memory necessary to match the spatial and color
-% resolution of the human eye. The QUANTIZE program takes a 24 bit
-% image and reduces the number of colors so it can be displayed on
-% raster device with less bits per pixel. In most instances, the
-% quantized image closely resembles the original reference image.
-%
-% A reduction of colors in an image is also desirable for image
-% transmission and real-time animation.
-%
-% Function Quantize takes a standard RGB or monochrome images and quantizes
-% them down to some fixed number of colors.
-%
-% For purposes of color allocation, an image is a set of n pixels, where
-% each pixel is a point in RGB space. RGB space is a 3-dimensional
-% vector space, and each pixel, pi, is defined by an ordered triple of
-% red, green, and blue coordinates, (ri, gi, bi).
-%
-% Each primary color component (red, green, or blue) represents an
-% intensity which varies linearly from 0 to a maximum value, cmax, which
-% corresponds to full saturation of that color. Color allocation is
-% defined over a domain consisting of the cube in RGB space with
-% opposite vertices at (0,0,0) and (cmax,cmax,cmax). QUANTIZE requires
-% cmax = 255.
-%
-% The algorithm maps this domain onto a tree in which each node
-% represents a cube within that domain. In the following discussion
-% these cubes are defined by the coordinate of two opposite vertices:
-% The vertex nearest the origin in RGB space and the vertex farthest
-% from the origin.
-%
-% The tree's root node represents the the entire domain, (0,0,0) through
-% (cmax,cmax,cmax). Each lower level in the tree is generated by
-% subdividing one node's cube into eight smaller cubes of equal size.
-% This corresponds to bisecting the parent cube with planes passing
-% through the midpoints of each edge.
-%
-% The basic algorithm operates in three phases: Classification,
-% Reduction, and Assignment. Classification builds a color
-% description tree for the image. Reduction collapses the tree until
-% the number it represents, at most, the number of colors desired in the
-% output image. Assignment defines the output image's color map and
-% sets each pixel's color by reclassification in the reduced tree.
-% Our goal is to minimize the numerical discrepancies between the original
-% colors and quantized colors (quantization error).
-%
-% Classification begins by initializing a color description tree of
-% sufficient depth to represent each possible input color in a leaf.
-% However, it is impractical to generate a fully-formed color
-% description tree in the classification phase for realistic values of
-% cmax. If colors components in the input image are quantized to k-bit
-% precision, so that cmax= 2k-1, the tree would need k levels below the
-% root node to allow representing each possible input color in a leaf.
-% This becomes prohibitive because the tree's total number of nodes is
-% 1 + sum(i=1,k,8k).
-%
-% A complete tree would require 19,173,961 nodes for k = 8, cmax = 255.
-% Therefore, to avoid building a fully populated tree, QUANTIZE: (1)
-% Initializes data structures for nodes only as they are needed; (2)
-% Chooses a maximum depth for the tree as a function of the desired
-% number of colors in the output image (currently log2(colorMap size)).
-%
-% For each pixel in the input image, classification scans downward from
-% the root of the color description tree. At each level of the tree it
-% identifies the single node which represents a cube in RGB space
-% containing the pixel's color. It updates the following data for each
-% such node:
-%
-% n1: Number of pixels whose color is contained in the RGB cube
-% which this node represents;
-%
-% n2: Number of pixels whose color is not represented in a node at
-% lower depth in the tree; initially, n2 = 0 for all nodes except
-% leaves of the tree.
-%
-% Sr, Sg, Sb: Sums of the red, green, and blue component values for
-% all pixels not classified at a lower depth. The combination of
-% these sums and n2 will ultimately characterize the mean color of a
-% set of pixels represented by this node.
-%
-% E: The distance squared in RGB space between each pixel contained
-% within a node and the nodes' center. This represents the quantization
-% error for a node.
-%
-% Reduction repeatedly prunes the tree until the number of nodes with
-% n2 > 0 is less than or equal to the maximum number of colors allowed
-% in the output image. On any given iteration over the tree, it selects
-% those nodes whose E count is minimal for pruning and merges their
-% color statistics upward. It uses a pruning threshold, Ep, to govern
-% node selection as follows:
-%
-% Ep = 0
-% while number of nodes with (n2 > 0) > required maximum number of colors
-% prune all nodes such that E <= Ep
-% Set Ep to minimum E in remaining nodes
-%
-% This has the effect of minimizing any quantization error when merging
-% two nodes together.
-%
-% When a node to be pruned has offspring, the pruning procedure invokes
-% itself recursively in order to prune the tree from the leaves upward.
-% n2, Sr, Sg, and Sb in a node being pruned are always added to the
-% corresponding data in that node's parent. This retains the pruned
-% node's color characteristics for later averaging.
-%
-% For each node, n2 pixels exist for which that node represents the
-% smallest volume in RGB space containing those pixel's colors. When n2
-% > 0 the node will uniquely define a color in the output image. At the
-% beginning of reduction, n2 = 0 for all nodes except a the leaves of
-% the tree which represent colors present in the input image.
-%
-% The other pixel count, n1, indicates the total number of colors
-% within the cubic volume which the node represents. This includes n1 -
-% n2 pixels whose colors should be defined by nodes at a lower level in
-% the tree.
-%
-% Assignment generates the output image from the pruned tree. The
-% outpu t image consists of two parts: (1) A color map, which is an
-% array of color descriptions (RGB triples) for each color present in
-% the output image; (2) A pixel array, which represents each pixel as
-% an index into the color map array.
-%
-% First, the assignment phase makes one pass over the pruned color
-% description tree to establish the image's color map. For each node
-% with n2 > 0, it divides Sr, Sg, and Sb by n2 . This produces the
-% mean color of all pixels that classify no lower than this node. Each
-% of these colors becomes an entry in the color map.
-%
-% Finally, the assignment phase reclassifies each pixel in the pruned
-% tree to identify the deepest node containing the pixel's color. The
-% pixel's value in the pixel array becomes the index of this node's mean
-% color in the color map.
-%
-% With the permission of USC Information Sciences Institute, 4676 Admiralty
-% Way, Marina del Rey, California 90292, this code was adapted from module
-% ALCOLS written by Paul Raveling.
-%
-% The names of ISI and USC are not used in advertising or publicity
-% pertaining to distribution of the software without prior specific
-% written permission from ISI.
-%
-*/
-
- final static boolean QUICK = false;
-
- final static int MAX_RGB = 255;
- final static int MAX_NODES = 266817;
- final static int MAX_TREE_DEPTH = 8;
- final static int MAX_CHILDREN = 16;
-
- /**
- * Reduce the image to the given number of colors. The pixels are reduced in
- * place.
- *
- * @return The new color palette.
- */
- public static BufferedImage process(BufferedImage source, int maxColors,
- boolean dither, boolean alphaToBitmask) {
- int type = source.getType();
- int[] pixels;
- // try to get the direct pixels of the BufferedImage
- // this works for images of type INT_RGB, INT_ARGB and INT_ARGB_PRE
- // for all others, a new array with rgb pixels is created!
- if (type == BufferedImage.TYPE_INT_RGB
- || type == BufferedImage.TYPE_INT_ARGB
- || type == BufferedImage.TYPE_INT_ARGB_PRE) {
- pixels = ((DataBufferInt) source.getRaster().getDataBuffer()).getData();
- } else {
- pixels = source.getRGB(0, 0, source.getWidth(), source.getHeight(), null, 0,
source.getWidth());
- }
- Cube cube = new Cube(source, pixels, maxColors, dither, alphaToBitmask);
- cube.classification();
- cube.reduction();
- return cube.assignment();
- }
-
- static class Cube {
- BufferedImage source;
- int[] pixels;
- int maxColors;
- byte colorMap[][];
-
- Node root;
- int depth;
-
- boolean dither;
- boolean alphaToBitmask;
- boolean addTransparency;
- // firstColor is set to 1 when when addTransparency is true!
- int firstColor = 0;
-
- // counter for the number of colors in the cube. this gets
- // recalculated often.
- int numColors;
-
- // counter for the number of nodes in the tree
- int numNodes;
-
- Cube(BufferedImage source, int[] pixels, int maxColors, boolean dither,
- boolean alphaToBitmask) {
- this.source = source;
- this.pixels = pixels;
- this.maxColors = maxColors;
- this.dither = dither;
- this.alphaToBitmask = alphaToBitmask;
-
- int i = maxColors;
- // tree_depth = log maxColors
- // 4
- for (depth = 1; i != 0; depth++) {
- i /= 4;
- }
- if (depth > 1) {
- --depth;
- }
- if (depth > MAX_TREE_DEPTH) {
- depth = MAX_TREE_DEPTH;
- } else if (depth < 2) {
- depth = 2;
- }
-
- root = new Node(this);
- }
-
- /*
- * Procedure Classification begins by initializing a color description
- * tree of sufficient depth to represent each possible input color in a
- * leaf. However, it is impractical to generate a fully-formed color
- * description tree in the classification phase for realistic values of
- * cmax. If colors components in the input image are quantized to k-bit
- * precision, so that cmax= 2k-1, the tree would need k levels below the
- * root node to allow representing each possible input color in a leaf.
- * This becomes prohibitive because the tree's total number of nodes is
- * 1 + sum(i=1,k,8k).
- *
- * A complete tree would require 19,173,961 nodes for k = 8, cmax = 255.
- * Therefore, to avoid building a fully populated tree, QUANTIZE: (1)
- * Initializes data structures for nodes only as they are needed; (2)
- * Chooses a maximum depth for the tree as a function of the desired
- * number of colors in the output image (currently log2(colorMap size)).
- *
- * For each pixel in the input image, classification scans downward from
- * the root of the color description tree. At each level of the tree it
- * identifies the single node which represents a cube in RGB space
- * containing It updates the following data for each such node:
- *
- * numPixels : Number of pixels whose color is contained in the RGB cube
- * which this node represents;
- *
- * unique : Number of pixels whose color is not represented in a node at
- * lower depth in the tree; initially, n2 = 0 for all nodes except
- * leaves of the tree.
- *
- * totalRed/green/blue : Sums of the red, green, and blue component
- * values for all pixels not classified at a lower depth. The
- * combination of these sums and n2 will ultimately characterize the
- * mean color of a set of pixels represented by this node.
- */
- void classification() {
- addTransparency = false;
- firstColor = 0;
- for (int i = 0; i < pixels.length; i++) {
- int pixel = pixels[i];
- int red = (pixel >> 16) & 0xff;
- int green = (pixel >> 8) & 0xff;
- int blue = (pixel >> 0) & 0xff;
- int alpha = (pixel >> 24) & 0xff;
- if (alphaToBitmask)
- alpha = alpha < 0x80 ? 0 : 0xff;
-
- if (alpha > 0) {
- // a hard limit on the number of nodes in the tree
- if (numNodes > MAX_NODES) {
- // System.out.println("pruning");
- root.pruneLevel();
- --depth;
- }
-
- // walk the tree to depth, increasing the
- // numPixels count for each node
- Node node = root;
- for (int level = 1; level <= depth; ++level) {
- int id = (((red > node.midRed ? 1 : 0) << 0)
- | ((green > node.midGreen ? 1 : 0) << 1)
- | ((blue > node.midBlue ? 1 : 0) << 2) | ((alpha
> node.midAlpha ? 1
- : 0) << 3));
- if (node.children[id] == null) {
- node = new Node(node, id, level);
- } else {
- node = node.children[id];
- }
- node.numPixels++;
- }
-
- ++node.unique;
- node.totalRed += red;
- node.totalGreen += green;
- node.totalBlue += blue;
- node.totalAlpha += alpha;
- } else if (!addTransparency) {
- addTransparency = true;
- numColors++;
- firstColor = 1; // start at 1 as 0 will be the transparent
- // color
- }
- }
- }
-
- /*
- * reduction repeatedly prunes the tree until the number of nodes with
- * unique > 0 is less than or equal to the maximum number of colors
- * allowed in the output image.
- *
- * When a node to be pruned has offspring, the pruning procedure invokes
- * itself recursively in order to prune the tree from the leaves upward.
- * The statistics of the node being pruned are always added to the
- * corresponding data in that node's parent. This retains the pruned
- * node's color characteristics for later averaging.
- */
- void reduction() {
- int threshold = 1;
- while (numColors > maxColors) {
- numColors = firstColor;
- threshold = root.reduce(threshold, Integer.MAX_VALUE);
- }
- }
-
- /**
- * The result of a closest color search.
- */
- static class Search {
- int distance;
- int colorIndex;
- }
-
- /*
- * Procedure assignment generates the output image from the pruned tree.
- * The output image consists of two parts: (1) A color map, which is an
- * array of color descriptions (RGB triples) for each color present in
- * the output image; (2) A pixel array, which represents each pixel as
- * an index into the color map array.
- *
- * First, the assignment phase makes one pass over the pruned color
- * description tree to establish the image's color map. For each node
- * with n2 > 0, it divides Sr, Sg, and Sb by n2. This produces the mean
- * color of all pixels that classify no lower than this node. Each of
- * these colors becomes an entry in the color map.
- *
- * Finally, the assignment phase reclassifies each pixel in the pruned
- * tree to identify the deepest node containing the pixel's color. The
- * pixel's value in the pixel array becomes the index of this node's
- * mean color in the color map.
- */
- BufferedImage assignment() {
- colorMap = new byte[4][numColors];
-
- if (addTransparency) {
- // if a transparency color is added, firstColor was set to 1,
- // so color 0 can be used for this
- colorMap[0][0] = 0;
- colorMap[1][0] = 0;
- colorMap[2][0] = 0;
- colorMap[3][0] = 0;
- }
- numColors = firstColor;
- root.mapColors();
-
- // determine bit depth for palette
- int depth;
- for (depth = 1; depth <= 8; depth++)
- if ((1 << depth) >= numColors)
- break;
-
- // create the right color model, depending on transparency settings:
- IndexColorModel icm;
- if (alphaToBitmask) {
- if (addTransparency)
- icm = new IndexColorModel(depth, numColors, colorMap[0],
- colorMap[1], colorMap[2], 0);
- else
- icm = new IndexColorModel(depth, numColors, colorMap[0],
- colorMap[1], colorMap[2]);
- } else {
- icm = new IndexColorModel(depth, numColors, colorMap[0],
- colorMap[1], colorMap[2], colorMap[3]);
- }
- // create the indexed BufferedImage:
- BufferedImage dest = new BufferedImage(source.getWidth(),
- source.getHeight(), BufferedImage.TYPE_BYTE_INDEXED, icm);
-
- boolean firstOut = true;
- if (dither)
- new DiffusionFilterOp().filter(source, dest);
- else {
- Search search = new Search();
- // convert to indexed color
- byte[] dst = ((DataBufferByte)
dest.getRaster().getDataBuffer()).getData();
-
- for (int i = 0; i < pixels.length; i++) {
- int pixel = pixels[i];
- int red = (pixel >> 16) & 0xff;
- int green = (pixel >> 8) & 0xff;
- int blue = (pixel >> 0) & 0xff;
- int alpha = (pixel >> 24) & 0xff;
-
- if (alphaToBitmask)
- alpha = alpha < 128 ? 0 : 0xff;
-
- // this is super weird: on some systems, transparent pixels are
- // not calculated correctly if the following block is taken out.
- // the bug is very strange, isn't related to the code (compiler
error?)
- // but doesn't allways happen. as soon as it does, though, it
doesn't
- // seem to want to go away.
- // This happened at various times on my two different debian systems
- // and i never found out how to really fix it. the following line
seems to
- // prevent it from happening, but i wonder wether there's a
better way
- // to fix it.
- // it looks as if the command forces alpha to take on correct
values.
- // Until now I only knew of effects like that in quantum
mechanics...
- if (i == 0) {
- String fix = "" + alpha;
- }
-
- if (alpha == 0 && addTransparency) {
- dst[i] = 0; // transparency color is at 0
- } else {
- // walk the tree to find the cube containing that color
- Node node = root;
- for (;;) {
- int id = (((red > node.midRed ? 1 : 0) << 0)
- | ((green > node.midGreen ? 1 : 0) << 1)
- | ((blue > node.midBlue ? 1 : 0) << 2) | ((alpha
> node.midAlpha ? 1
- : 0) << 3));
- if (node.children[id] == null) {
- break;
- }
- node = node.children[id];
- }
-
- if (QUICK) {
- // if QUICK is set, just use that
- // node. Strictly speaking, this isn't
- // necessarily best match.
- dst[i] = (byte) node.colorIndex;
- } else {
- // Find the closest color.
- search.distance = Integer.MAX_VALUE;
- node.parent.closestColor(red, green, blue, alpha,
- search);
- dst[i] = (byte) search.colorIndex;
- }
- }
- }
- }
- return dest;
- }
-
- /**
- * A single Node in the tree.
- */
- static class Node {
- Cube cube;
-
- // parent node
- Node parent;
-
- // children nodes
- Node children[];
- int numChildren;
-
- // our index within our parent
- int id;
- // our level within the tree
- int level;
- // our color midpoint
- int midRed;
- int midGreen;
- int midBlue;
- int midAlpha;
-
- // the pixel count for this node and all children
- int numPixels;
-
- // the pixel count for this node
- int unique;
- // the sum of all pixels contained in this node
- int totalRed;
- int totalGreen;
- int totalBlue;
- int totalAlpha;
-
- // used to build the colorMap
- int colorIndex;
-
- Node(Cube cube) {
- this.cube = cube;
- this.parent = this;
- this.children = new Node[MAX_CHILDREN];
- this.id = 0;
- this.level = 0;
-
- this.numPixels = Integer.MAX_VALUE;
-
- this.midRed = (MAX_RGB + 1) >> 1;
- this.midGreen = (MAX_RGB + 1) >> 1;
- this.midBlue = (MAX_RGB + 1) >> 1;
- this.midAlpha = (MAX_RGB + 1) >> 1;
- }
-
- Node(Node parent, int id, int level) {
- this.cube = parent.cube;
- this.parent = parent;
- this.children = new Node[MAX_CHILDREN];
- this.id = id;
- this.level = level;
-
- // add to the cube
- ++cube.numNodes;
- if (level == cube.depth) {
- ++cube.numColors;
- }
-
- // add to the parent
- ++parent.numChildren;
- parent.children[id] = this;
-
- // figure out our midpoint
- int bi = (1 << (MAX_TREE_DEPTH - level)) >> 1;
- midRed = parent.midRed + ((id & 1) > 0 ? bi : -bi);
- midGreen = parent.midGreen + ((id & 2) > 0 ? bi : -bi);
- midBlue = parent.midBlue + ((id & 4) > 0 ? bi : -bi);
- midAlpha = parent.midAlpha + ((id & 8) > 0 ? bi : -bi);
- }
-
- /**
- * Remove this children node, and make sure our parent absorbs our
- * pixel statistics.
- */
- void pruneChild() {
- --parent.numChildren;
- parent.unique += unique;
- parent.totalRed += totalRed;
- parent.totalGreen += totalGreen;
- parent.totalBlue += totalBlue;
- parent.totalAlpha += totalAlpha;
- parent.children[id] = null;
- --cube.numNodes;
- cube = null;
- parent = null;
- }
-
- /**
- * Prune the lowest layer of the tree.
- */
- void pruneLevel() {
- if (numChildren != 0) {
- for (int id = 0; id < MAX_CHILDREN; id++) {
- if (children[id] != null) {
- children[id].pruneLevel();
- }
- }
- }
- if (level == cube.depth) {
- pruneChild();
- }
- }
-
- /**
- * Remove any nodes that have fewer than threshold pixels. Also, as
- * long as we're walking the tree: - figure out the color with the
- * fewest pixels - recalculate the total number of colors in the
- * tree
- */
- int reduce(int threshold, int nextThreshold) {
- if (numChildren != 0) {
- for (int id = 0; id < MAX_CHILDREN; id++) {
- if (children[id] != null) {
- nextThreshold = children[id].reduce(threshold,
- nextThreshold);
- }
- }
- }
- if (numPixels <= threshold) {
- pruneChild();
- } else {
- if (unique != 0) {
- cube.numColors++;
- }
- if (numPixels < nextThreshold) {
- nextThreshold = numPixels;
- }
- }
- return nextThreshold;
- }
-
- /*
- * mapColors traverses the color cube tree and notes each colorMap
- * entry. A colorMap entry is any node in the color cube tree where
- * the number of unique colors is not zero.
- */
- void mapColors() {
- if (numChildren != 0) {
- for (int id = 0; id < MAX_CHILDREN; id++) {
- if (children[id] != null) {
- children[id].mapColors();
- }
- }
- }
- if (unique != 0) {
- int add = unique >> 1;
- cube.colorMap[0][cube.numColors] = (byte) ((totalRed + add) /
unique);
- cube.colorMap[1][cube.numColors] = (byte) ((totalGreen + add) /
unique);
- cube.colorMap[2][cube.numColors] = (byte) ((totalBlue + add) /
unique);
- cube.colorMap[3][cube.numColors] = (byte) ((totalAlpha + add) /
unique);
- colorIndex = cube.numColors++;
- }
- }
-
- /*
- * ClosestColor traverses the color cube tree at a particular node
- * and determines which colorMap entry best represents the input
- * color.
- */
- void closestColor(int red, int green, int blue, int alpha,
- Search search) {
- if (numChildren != 0) {
- for (int id = 0; id < MAX_CHILDREN; id++) {
- if (children[id] != null) {
- children[id].closestColor(red, green, blue, alpha,
- search);
- }
- }
- }
-
- if (unique != 0) {
- int distance = distance(
- cube.colorMap[0][colorIndex] & 0xff,
- cube.colorMap[1][colorIndex] & 0xff,
- cube.colorMap[2][colorIndex] & 0xff,
- cube.colorMap[3][colorIndex] & 0xff, red, green, blue,
- alpha);
- if (distance < search.distance) {
- search.distance = distance;
- search.colorIndex = colorIndex;
- }
- }
- }
-
- /**
- * Figure out the distance between this node and som color.
- */
- final static int distance(int r1, int g1, int b1, int a1, int r2,
- int g2, int b2, int a2) {
- int da = a1 - a2;
- int dr = r1 - r2;
- int dg = g1 - g2;
- int db = b1 - b2;
-
- return da * da + dr * dr + dg * dg + db * db;
-// return (SQUARES[r1 - r2 + MAX_RGB] +
-// SQUARES[g1 - g2 + MAX_RGB] +
-// SQUARES[b1 - b2 + MAX_RGB] +
-// SQUARES[a1 - a2 + MAX_RGB]);
- }
-
- public String toString() {
- StringBuffer buf = new StringBuffer();
- if (parent == this) {
- buf.append("root");
- } else {
- buf.append("node");
- }
- buf.append(' ');
- buf.append(level);
- buf.append(" [");
- buf.append(midRed);
- buf.append(',');
- buf.append(midGreen);
- buf.append(',');
- buf.append(midBlue);
- buf.append(',');
- buf.append(midAlpha);
- buf.append(']');
- return new String(buf);
- }
- }
- }
-}
\ No newline at end of file
Copied:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/CapturingELResolver.java
(from rev 14238,
trunk/framework/impl/src/main/java/org/ajax4jsf/util/CapturingELResolver.java)
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/CapturingELResolver.java
(rev 0)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/CapturingELResolver.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -0,0 +1,71 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.util;
+
+import javax.el.ELContext;
+import javax.el.ELResolver;
+
+import org.ajax4jsf.el.ELResolverWrapper;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+
+class CapturingELResolver extends ELResolverWrapper {
+
+ private Object base;
+
+ private Object property;
+
+ public CapturingELResolver(ELResolver resolver) {
+ super(resolver);
+ }
+
+ @Override
+ public Object getValue(ELContext context, Object base, Object property) {
+ if (base != null && property != null) {
+ this.base = base;
+ this.property = property;
+ }
+
+ return super.getValue(context, base, property);
+ }
+
+ @Override
+ public Class<?> getType(ELContext context, Object base, Object property) {
+ if (base != null && property != null) {
+ this.base = base;
+ this.property = property;
+ }
+
+ return super.getType(context, base, property);
+ }
+
+ public Object getBase() {
+ return base;
+ }
+
+ public Object getProperty() {
+ return property;
+ }
+}
Modified: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/ELUtils.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/ELUtils.java 2009-07-07
17:09:24 UTC (rev 14814)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/ELUtils.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,8 +1,46 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.util;
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.ref.SoftReference;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.el.ELContextWrapper;
+import org.ajax4jsf.util.GenericsIntrospectionCache.GenericsCacheEntry;
+
/**
* @author asmirnov
*
@@ -37,4 +75,107 @@
return false;
}
+ private static Class<?> resolveType(Type type) {
+ Class<?> result = Object.class;
+
+ if (type instanceof ParameterizedType) {
+ ParameterizedType parameterizedType = (ParameterizedType) type;
+ Type[] types = parameterizedType.getActualTypeArguments();
+ if (types != null && types.length != 0) {
+ Type actualType = types[0];
+ if (actualType instanceof Class) {
+ result = (Class<?>) actualType;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ private static BeanInfo getBeanInfo(Class<?> beanClass, GenericsCacheEntry entry)
{
+ BeanInfo beanInfo = null;
+
+ SoftReference<BeanInfo> beanInfoReference = entry.beanInfoReference;
+ if (beanInfoReference != null) {
+ beanInfo = beanInfoReference.get();
+ }
+
+ if (beanInfo == null) {
+ try {
+ beanInfo = Introspector.getBeanInfo(beanClass);
+ entry.beanInfoReference = new SoftReference<BeanInfo>(beanInfo);
+ } catch (IntrospectionException e) {
+ throw new FacesException(e.getMessage(), e);
+ }
+ }
+
+ return beanInfo;
+ }
+
+ private static Class<?> getGenericCollectionType(FacesContext context, Object
base, String propertyName) {
+ Class<?> genericPropertyClass = null;
+
+ if (base != null && propertyName != null) {
+ Class<? extends Object> beanClass = base.getClass();
+
+ //Map and ResourceBundle have special resolvers that we doesn't support
+ if (!Map.class.isAssignableFrom(beanClass) &&
!ResourceBundle.class.isAssignableFrom(beanClass)) {
+
+ GenericsIntrospectionCache introspectionCache =
GenericsIntrospectionCache.getInstance(context);
+
+ synchronized (introspectionCache) {
+ GenericsCacheEntry cacheEntry = introspectionCache.getGenericCacheEntry(beanClass);
+
+ if (cacheEntry.genericPropertiesClasses == null) {
+ cacheEntry.genericPropertiesClasses = new HashMap<String, Class<?>>();
+ } else {
+ genericPropertyClass = cacheEntry.genericPropertiesClasses.get(propertyName);
+ }
+
+ if (genericPropertyClass == null) {
+ if (!cacheEntry.genericPropertiesClasses.containsKey(propertyName)) {
+ BeanInfo beanInfo = getBeanInfo(beanClass, cacheEntry);
+
+ PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
+ for (PropertyDescriptor pd : descriptors) {
+ if (propertyName.equals(pd.getName())) {
+ Method readMethod = pd.getReadMethod();
+
+ genericPropertyClass = resolveType(readMethod.getGenericReturnType());
+ break;
+ }
+ }
+
+ cacheEntry.genericPropertiesClasses.put(propertyName, genericPropertyClass);
+ } else {
+ //property Class has been already resolved as null
+ }
+ }
+ }
+ }
+ }
+
+ return genericPropertyClass;
+ }
+
+ public static Class<?> getContainerClass(FacesContext facesContext,
ValueExpression expression) {
+ ELContext initialELContext = facesContext.getELContext();
+
+ CapturingELResolver capturingELResolver = new
CapturingELResolver(initialELContext.getELResolver());
+ Class<?> type = expression.getType(new ELContextWrapper(initialELContext,
capturingELResolver));
+
+ Class<?> containerType = type.getComponentType();
+ if (containerType == null && type != null) {
+ if (Collection.class.isAssignableFrom(type)) {
+ Object base = capturingELResolver.getBase();
+ Object property = capturingELResolver.getProperty();
+
+ if (base != null && property != null) {
+ containerType = getGenericCollectionType(facesContext, base, property.toString());
+ }
+ }
+ }
+
+ return containerType;
+ }
}
Copied:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/GenericsIntrospectionCache.java
(from rev 14238,
trunk/framework/impl/src/main/java/org/ajax4jsf/util/GenericsIntrospectionCache.java)
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/GenericsIntrospectionCache.java
(rev 0)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/GenericsIntrospectionCache.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -0,0 +1,101 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.util;
+
+import java.beans.BeanInfo;
+import java.lang.ref.Reference;
+import java.lang.ref.SoftReference;
+import java.util.Map;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.util.ReferenceMap;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+
+class GenericsIntrospectionCache {
+
+ private static final String INSTANCE_ATTRIBUTE_NAME =
GenericsIntrospectionCache.class.getName();
+
+ private static final String CACHE_SIZE_PARAMETER =
"org.richfaces.GenericsIntrospectionCacheSize";
+
+ private static final int DEFAULT_CACHE_SIZE = 256;
+
+ static final class GenericsCacheEntry {
+ SoftReference<BeanInfo> beanInfoReference;
+ Map<String, Class<?>> genericPropertiesClasses;
+ };
+
+ private Map<Class<?>, GenericsCacheEntry> genericsCache;
+
+ private static int getSize(ExternalContext externalContext) {
+ int cacheSize = DEFAULT_CACHE_SIZE;
+
+ String cacheSizeParameter = externalContext.getInitParameter(CACHE_SIZE_PARAMETER);
+ if (cacheSizeParameter != null && cacheSizeParameter.length() != 0) {
+ try {
+ cacheSize = Integer.valueOf(cacheSizeParameter);
+ } catch (NumberFormatException e) {
+ externalContext.log("Error converting " + CACHE_SIZE_PARAMETER + "
init parameter to int: " + e.getMessage(),
+ e);
+ }
+ }
+
+ return cacheSize;
+ }
+
+ private GenericsIntrospectionCache(int cacheSize) {
+ genericsCache = new ReferenceMap<Class<?>, GenericsCacheEntry>(
+ new LRUMap<Class<?>, Reference<GenericsCacheEntry>>(cacheSize));
+ }
+
+ public GenericsCacheEntry getGenericCacheEntry(Class<?> beanClass) {
+ GenericsCacheEntry cacheEntry = genericsCache.get(beanClass);
+ if (cacheEntry == null) {
+ cacheEntry = new GenericsCacheEntry();
+ genericsCache.put(beanClass, cacheEntry);
+ }
+
+ return cacheEntry;
+ }
+
+ static GenericsIntrospectionCache getInstance(FacesContext facesContext) {
+ ExternalContext externalContext = facesContext.getExternalContext();
+ Map<String, Object> applicationMap = externalContext.getApplicationMap();
+
+ GenericsIntrospectionCache instance;
+ synchronized (applicationMap) {
+ instance = (GenericsIntrospectionCache) applicationMap.get(INSTANCE_ATTRIBUTE_NAME);
+ if (instance == null) {
+ instance = new GenericsIntrospectionCache(getSize(externalContext));
+ applicationMap.put(INSTANCE_ATTRIBUTE_NAME, instance);
+ }
+ }
+
+ return instance;
+ }
+
+}
Modified: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/GifEncoder.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/GifEncoder.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/GifEncoder.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * 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.util;
import java.awt.Image;
Modified: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/LRUMap.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/LRUMap.java 2009-07-07
17:09:24 UTC (rev 14814)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/LRUMap.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.util;
Modified: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/SelectUtils.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/SelectUtils.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/SelectUtils.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -261,9 +261,9 @@
public static Converter getConverterForProperty(FacesContext facesContext, UIOutput
component, String property){
Converter converter = component.getConverter();
if(converter == null){
- ValueBinding valueBinding = component.getValueBinding(property);
- if(valueBinding != null){
- Class valueType = valueBinding.getType(facesContext);
+ ValueExpression ve = component.getValueExpression(property);
+ if(ve != null){
+ Class<?> valueType = ve.getType(facesContext.getELContext());
if(valueType == null || String.class.equals(valueType) ||
Object.class.equals(valueType)){
//No converter needed
} else {
Modified: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/Zipper.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/Zipper.java 2009-07-07
17:09:24 UTC (rev 14814)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/Zipper.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.util;
public class Zipper {
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/Base64.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/Base64.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/Base64.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/BinaryDecoder.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/BinaryDecoder.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/BinaryDecoder.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/BinaryEncoder.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/BinaryEncoder.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/BinaryEncoder.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/Decoder.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/Decoder.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/Decoder.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/DecoderException.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/DecoderException.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/DecoderException.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/Encoder.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/Encoder.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/Encoder.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/EncoderException.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/EncoderException.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/EncoderException.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/URL64Codec.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/URL64Codec.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/URL64Codec.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/URLCodec.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/URLCodec.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/util/base64/URLCodec.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,56 +1,19 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
-
* Copyright 2001-2004 The Apache Software Foundation.
-
*
-
* Licensed under the Apache License, Version 2.0 (the "License");
-
* you may not use this file except in compliance with the License.
-
* You may obtain a copy of the License at
-
*
-
*
http://www.apache.org/licenses/LICENSE-2.0
-
*
-
* Unless required by applicable law or agreed to in writing, software
-
* distributed under the License is distributed on an "AS IS" BASIS,
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-
* See the License for the specific language governing permissions and
-
* limitations under the License.
+ */
- */
-
-
-
package org.ajax4jsf.util.base64;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -52,6 +52,7 @@
import org.ajax4jsf.resource.InternetResourceService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.richfaces.component.FileUploadConstants;
/**
* Base class for request processing filters, with convert Htmp content to XML
@@ -133,25 +134,7 @@
/** Multipart request start */
public static final String MULTIPART = "multipart/";
- /** Session bean name where multipart requests map will be stored */
- public static final String REQUESTS_SESSIONS_BEAN_NAME =
"_richfaces_upload_sessions";
-
- /** Session bean name where progress bar's percent map will be stored */
- public static final String PERCENT_BEAN_NAME = "_richfaces_upload_percents";
-
/**
- * Request parameter that indicates if multipart request forced by rich file
- * upload component
- */
- public static final String UPLOAD_FILES_ID = "_richfaces_upload_uid";
-
- /** Session bean name to store max files count allowed to upload */
- public static final String UPLOADED_COUNTER =
"_richfaces_uploaded_file_counter";
-
- /** Request parameter name indicated that file was uploaded by RF component */
- public static final String FILE_UPLOAD_INDICATOR =
"_richfaces_upload_file_indicator";
-
- /**
* Request parameter that allow to send HTTP error instead of html message
*/
public static final String SEND_HTTP_ERROR = "_richfaces_send_http_error";
@@ -265,7 +248,7 @@
HttpSession session = request.getSession(false);
if (session != null) {
- Map<String, Integer> map = (Map<String, Integer>)
session.getAttribute(UPLOADED_COUNTER);
+ Map<String, Integer> map = (Map<String, Integer>)
session.getAttribute(FileUploadConstants.UPLOADED_COUNTER);
if (map != null) {
String id = idParameter;
@@ -318,6 +301,26 @@
}
+ private static final String MYFACES_FILTER_CHECKED = BaseFilter.class.getName() +
":MyFacesFilterChecked";
+
+ private static final String MYFACES_DOFILTER_CALLED =
"org.apache.myfaces.component.html.util.ExtensionFilter.doFilterCalled";
+
+ private boolean myfacesMessagePrinted = false;
+
+ private void checkMyFacesExtensionsFilter(HttpServletRequest request) {
+ if (request.getAttribute(MYFACES_FILTER_CHECKED) == null) {
+ if (request.getAttribute(MYFACES_DOFILTER_CALLED) != null) {
+ if (!this.myfacesMessagePrinted) {
+ log.warn("MyFaces Extensions Filter should be configured to execute *AFTER*
RichFaces filter. Refer to SRV.6.2.4 section of Servlets specification on how to achieve
that.");
+
+ this.myfacesMessagePrinted = true;
+ }
+ }
+
+ request.setAttribute(MYFACES_FILTER_CHECKED, Boolean.TRUE);
+ }
+ }
+
/**
* Method catches upload files request. Request parameter
* <b>org.ajax4jsf.Filter.UPLOAD_FILES_ID</b> indicates if request
@@ -335,15 +338,16 @@
HttpServletRequest httpRequest = (HttpServletRequest) request;
Map<String, String> queryParamMap =
parseQueryString(httpRequest.getQueryString());
- String uid = queryParamMap.get(UPLOAD_FILES_ID);
+ String uid = queryParamMap.get(FileUploadConstants.UPLOAD_FILES_ID);
if (uid != null) {
if (isMultipartRequest(httpRequest)) {
MultipartRequest multipartRequest = new MultipartRequest(httpRequest,
createTempFiles, maxRequestSize, uid);
- Map<String, MultipartRequest> sessionsMap = null;
- Map<String, Object> percentMap = null;
+ Object oldAttributeValue =
httpRequest.getAttribute(FileUploadConstants.FILE_UPLOAD_REQUEST_ATTRIBUTE_NAME);
+ httpRequest.setAttribute(FileUploadConstants.FILE_UPLOAD_REQUEST_ATTRIBUTE_NAME,
multipartRequest);
+
try {
if (isFileSizeRestricted(request, maxRequestSize)) {
@@ -360,64 +364,25 @@
printResponse(response, "<html
id=\"_richfaces_file_upload_forbidden\"></html>");
} else {
- HttpSession session = httpRequest.getSession();
- synchronized (session) {
- sessionsMap = (Map<String, MultipartRequest>)
session.getAttribute(REQUESTS_SESSIONS_BEAN_NAME);
- percentMap = (Map<String, Object>) session.getAttribute(PERCENT_BEAN_NAME);
- if (sessionsMap == null) {
- sessionsMap = Collections.synchronizedMap(new HashMap<String,
MultipartRequest>());
- session.setAttribute(REQUESTS_SESSIONS_BEAN_NAME, sessionsMap);
+ handleRequest(multipartRequest, multipartRequest.isFormUpload() ? response :
+ new HttpServletResponseWrapper((HttpServletResponse) response){
+ @Override
+ public void setContentType(String type) {
+ super.setContentType(BaseXMLFilter.TEXT_HTML + ";charset=UTF-8");
}
- if (percentMap == null) {
- percentMap = new HashMap<String, Object>();
- session.setAttribute(PERCENT_BEAN_NAME, percentMap);
- }
- }
+ }, chain);
- /* associate percent value with file entry uid */
- percentMap.put(uid, 0);
- sessionsMap.put(uid, multipartRequest);
-
- if (multipartRequest.parseRequest()) {
- handleRequest(multipartRequest, multipartRequest.isFormUpload() ? response :
- new HttpServletResponseWrapper(response){
- @Override
- public void setContentType(String type) {
- super.setContentType(BaseXMLFilter.TEXT_HTML + ";charset=UTF-8");
- }
- }, chain);
- } else {
+ if (!multipartRequest.isDone()) {
printResponse(response, "<html
id=\"_richfaces_file_upload_stopped\"></html>");
}
-
}
} finally {
-
- if (sessionsMap != null) {
- sessionsMap.remove(uid);
- percentMap.remove(uid);
- }
-
+ httpRequest.setAttribute(FileUploadConstants.FILE_UPLOAD_REQUEST_ATTRIBUTE_NAME,
oldAttributeValue);
+ multipartRequest.clearRequestData();
}
} else {
-
- if
("richfaces_file_upload_action_stop".equals(queryParamMap.get("action")))
{
- HttpSession session = httpRequest.getSession(false);
- if (session != null) {
- Map<String, MultipartRequest> sessions = (Map<String,
MultipartRequest>) session.getAttribute(REQUESTS_SESSIONS_BEAN_NAME);
-
- if (sessions != null) {
- MultipartRequest multipartRequest = sessions.get(uid);
- if (multipartRequest != null) {
- multipartRequest.stop();
- }
- handleRequest(request, response, chain);
- }
- }
- } else {
- handleRequest(request, response, chain);
- }
+ handleRequest(request, response, chain);
}
} else {
handleRequest(request, response, chain);
@@ -546,7 +511,7 @@
// first stage - detect/set encoding of request. Same as in
// Myfaces External Context.
setupRequestEncoding(httpServletRequest);
-
+ checkMyFacesExtensionsFilter(httpServletRequest);
processUploadsAndHandleRequest(httpServletRequest, httpServletResponse, chain);
}
} finally {
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -45,6 +45,7 @@
import org.ajax4jsf.renderkit.AjaxContainerRenderer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.w3c.dom.Node;
public abstract class BaseXMLFilter {
public static final String AJAX_EXPIRED = "Ajax-Expired";
@@ -177,8 +178,8 @@
chain.doFilter(request, servletResponseWrapper);
} catch (ServletException e) {
- log.error("Exception in the filter chain", e);
- if(handleViewExpiredOnClient && isViewExpired(e)){
+ if(handleViewExpiredOnClient && (isViewExpired(e) ||
isViewExpired(e.getRootCause())) && isAjaxRequest(request)){
+ log.debug("ViewExpiredException in the filter chain - will be handled on the
client", e);
Writer output = resetResponse(response, servletResponseWrapper, "true");
String message = Messages
.getMessage(Messages.AJAX_VIEW_EXPIRED);
@@ -195,14 +196,15 @@
response.flushBuffer();
return;
} else {
- throw e;
+ log.error("Exception in the filter chain", e);
+ throw e;
}
} finally {
request.removeAttribute(BaseFilter.RESPONSE_WRAPPER_ATTRIBUTE);
}
String viewId = (String) request
.getAttribute(AjaxViewHandler.VIEW_ID_KEY);
- Object[] headEvents = (Object[]) request
+ Node[] headEvents = (Node[]) request
.getAttribute(AjaxContext.HEAD_EVENTS_PARAMETER);
HtmlParser parser = null;
@@ -359,7 +361,7 @@
try {
// Setup scripts and styles
- parser.setHeadEvents(headEvents);
+ parser.setHeadNodes(headEvents);
// Process parsing.
long startTimeMills = System.currentTimeMillis();
servletResponseWrapper.parseContent(output, parser);
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/ConfigurableFilter.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/ConfigurableFilter.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/ConfigurableFilter.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.webapp;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/ConfigurableXMLFilter.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/ConfigurableXMLFilter.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/ConfigurableXMLFilter.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.webapp;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/FilterServletResponseWrapper.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/FilterServletResponseWrapper.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/FilterServletResponseWrapper.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/HtmlParser.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/HtmlParser.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/HtmlParser.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -26,6 +26,8 @@
import java.io.Reader;
import java.io.Writer;
+import org.w3c.dom.Node;
+
public interface HtmlParser {
public abstract void parseHtml(InputStream input, Writer output)
@@ -48,7 +50,7 @@
*/
public abstract void setMoveElements(boolean move);
- public abstract void setHeadEvents(Object[] events);
+ public abstract void setHeadNodes(Node[] events);
public abstract void setDoctype(String doctype);
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/ParserConfig.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/ParserConfig.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/ParserConfig.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.webapp;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/PollEventsManager.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/PollEventsManager.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/PollEventsManager.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.webapp;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/PushEventsCounter.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/PushEventsCounter.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/PushEventsCounter.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.webapp;
import java.io.Serializable;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -26,8 +26,6 @@
import java.io.PrintWriter;
import java.io.Reader;
import java.io.StringReader;
-import java.util.LinkedList;
-import java.util.Map;
import java.util.Properties;
import javax.servlet.ServletException;
@@ -36,9 +34,6 @@
import javax.xml.parsers.ParserConfigurationException;
import org.ajax4jsf.application.AjaxViewHandler;
-import org.ajax4jsf.context.SAXEndElementEvent;
-import org.ajax4jsf.context.SAXStartElementEvent;
-import org.ajax4jsf.context.SAXTextEvent;
import org.ajax4jsf.webapp.BaseXMLFilter;
import org.ajax4jsf.webapp.HtmlParser;
import org.ajax4jsf.xml.serializer.Method;
@@ -65,8 +60,12 @@
import org.cyberneko.html.filters.Purifier;
import org.cyberneko.html.filters.Writer;
import org.cyberneko.html.parsers.DOMFragmentParser;
+import org.w3c.dom.CharacterData;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -94,7 +93,7 @@
private DocumentFragment fragment = null;
- private Object[] headEvents;
+ private Node[] headEvents;
private String _viewState;
@@ -416,51 +415,75 @@
super.endElement(element, augs);
}
- private void insertResources(String prefix, String uri) {
- headParsed = true;
-
- if (headEvents != null && headEvents.length > 0) {
- Augmentations augs = null;
- LinkedList<QName> stack = new LinkedList<QName>();
- int depth = 0;
+ private XMLString createXMLString(String string) {
+ char[] cs = string.toCharArray();
+ return new XMLString(cs, 0, cs.length);
+ }
+
+ private void addNode(Node node, String prefix, String uri, Augmentations augs) {
+ switch (node.getNodeType()) {
+ case Node.TEXT_NODE:
+ String charData = ((CharacterData) node).getData();
+ super.characters(createXMLString(charData), augs);
+
+ break;
- for (Object event : headEvents) {
- if (event instanceof SAXStartElementEvent) {
- SAXStartElementEvent startElementEvent = (SAXStartElementEvent) event;
+ case Node.COMMENT_NODE:
+ charData = ((CharacterData) node).getData();
+ super.comment(createXMLString(charData), augs);
+
+ break;
+
+ case Node.CDATA_SECTION_NODE:
+ charData = ((CharacterData) node).getData();
+ super.startCDATA(augs);
+ super.characters(createXMLString(charData), augs);
+ super.endCDATA(augs);
- String elementName = startElementEvent.getName();
- QName element = new QName(prefix, elementName, elementName, uri);
- stack.add(element);
+ break;
- XMLAttributes attrs = new XMLAttributesImpl();
- for (Map.Entry<String, String> entry :
startElementEvent.getAttributes().entrySet()) {
-
- String name = entry.getKey();
- String value = entry.getValue();
- attrs.addAttribute(new QName(prefix, name, name, uri), "CDATA", value);
- }
+ case Node.ELEMENT_NODE:
+ QName name = new QName(prefix, node.getNodeName(), node.getNodeName(), uri);
+ XMLAttributes attrs = new XMLAttributesImpl();
+
+ NamedNodeMap attributes = node.getAttributes();
+ if (attributes != null) {
+ int l = attributes.getLength();
+
+ for (int i = 0; i < l; i++) {
+ Node attributeNode = attributes.item(i);
+ attrs.addAttribute(new QName(prefix, attributeNode.getNodeName(),
+ attributeNode.getNodeName(), uri), "CDATA",
+ attributeNode.getNodeValue());
+ }
+
+ }
- if (depth++ == 0) {
- augs = new HTMLAugmentations();
- }
+ super.startElement(name, attrs, augs);
- super.startElement(element, attrs, augs);
- } else if (event instanceof SAXTextEvent) {
- SAXTextEvent textEvent = (SAXTextEvent) event;
+ NodeList childNodes = node.getChildNodes();
+ int nodesLength = childNodes.getLength();
+ for (int i = 0; i < nodesLength; i++) {
+ addNode(childNodes.item(i), prefix, uri, augs);
+ }
+
+ super.endElement(name, augs);
+
+ break;
+
+ default:
+ throw new IllegalArgumentException("Node type " + node.getNodeType() +
" is not supported!");
+ }
+ }
+
+ private void insertResources(String prefix, String uri) {
+ headParsed = true;
+
+ if (headEvents != null && headEvents.length > 0) {
+ Augmentations augs = new HTMLAugmentations();
- char[] ch = textEvent.getText().toCharArray();
-
- super.characters(new XMLString(ch, 0, ch.length), augs);
-
- } else if (event instanceof SAXEndElementEvent) {
- super.endElement(stack.removeLast(), augs);
-
- if (--depth == 0) {
- augs = null;
- }
- } else {
- throw new IllegalArgumentException();
- }
+ for (Node node : headEvents) {
+ addNode(node, prefix, uri, augs);
}
}
}
@@ -774,7 +797,7 @@
return false;
}
- public void setHeadEvents(Object[] headEvents) {
+ public void setHeadNodes(Node[] headEvents) {
this.headEvents = headEvents;
}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/AjaxActionsRule.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/AjaxActionsRule.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/AjaxActionsRule.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -38,9 +38,9 @@
*/
public class AjaxActionsRule extends MetaRule {
- public final static Class[] ACTION_SIG = new Class[0];
+ public final static Class<?>[] ACTION_SIG = new Class[0];
- public final static Class[] ACTION_LISTENER_SIG = new Class[] { ActionEvent.class };
+ public final static Class<?>[] ACTION_LISTENER_SIG = new Class[] {
ActionEvent.class };
public final static class ActionMapper extends Metadata {
@@ -56,7 +56,23 @@
AjaxActionsRule.ACTION_SIG));
}
}
+
+ final static class ActionMapper2 extends Metadata {
+ private final TagAttribute attr;
+
+ public ActionMapper2(TagAttribute attr) {
+ this.attr = attr;
+ }
+
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((ActionSource2) instance).setActionExpression(this.attr
+ .getMethodExpression(ctx, String.class,
+ AjaxActionsRule.ACTION_SIG));
+ }
+
+ }
+
public final static class ActionListenerMapper extends Metadata {
private final TagAttribute attr;
@@ -72,7 +88,25 @@
}
}
+
+ final static class ActionListenerMapper2 extends Metadata {
+ private final TagAttribute attr;
+
+ public ActionListenerMapper2(TagAttribute attr) {
+ this.attr = attr;
+ }
+
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((ActionSource2) instance)
+ .addActionListener(new MethodExpressionActionListener(
+ this.attr.getMethodExpression(ctx, null,
+ AjaxActionsRule.ACTION_LISTENER_SIG)));
+
+ }
+
+ }
+
public final static AjaxActionsRule instance = new AjaxActionsRule();
public AjaxActionsRule() {
@@ -82,14 +116,20 @@
public Metadata applyRule(String name, TagAttribute attribute,
MetadataTarget meta) {
if (meta.isTargetInstanceOf(ActionSource.class)) {
-
-
if ("action".equals(name)) {
- return new ActionMapper(attribute);
+ if (meta.isTargetInstanceOf(ActionSource2.class)) {
+ return new ActionMapper2(attribute);
+ } else {
+ return new ActionMapper(attribute);
+ }
}
if ("actionListener".equals(name)) {
- return new ActionListenerMapper(attribute);
+ if (meta.isTargetInstanceOf(ActionSource2.class)) {
+ return new ActionListenerMapper2(attribute);
+ } else {
+ return new ActionListenerMapper(attribute);
+ }
}
}
return null;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/EmptyHandler.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/EmptyHandler.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/EmptyHandler.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.webapp.taglib;
Copied:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/RowKeyConverterRule.java
(from rev 14238,
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/RowKeyConverterRule.java)
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/RowKeyConverterRule.java
(rev 0)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/RowKeyConverterRule.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -0,0 +1,101 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.webapp.taglib;
+
+import javax.faces.convert.Converter;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
+import org.ajax4jsf.component.UIDataAdaptor;
+
+/**
+ * Apply rowKeyConverter to component
+ * @author Maksim Kaszynski
+ * @since 3.3.1
+ */
+public class RowKeyConverterRule extends MetaRule {
+
+ static final class DynamicConverterMetaData extends Metadata {
+
+ private final TagAttribute attribute;
+
+ public DynamicConverterMetaData(TagAttribute attribute) {
+ super();
+ this.attribute = attribute;
+ }
+
+ @Override
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((UIDataAdaptor) instance).setValueExpression("rowKeyConverter",
+ attribute.getValueExpression(ctx, Converter.class));
+
+ }
+ }
+
+ static final class StaticConverterMetadata extends Metadata {
+
+ private final String converterId;
+
+ public StaticConverterMetadata(String converterId) {
+ super();
+ this.converterId = converterId;
+ }
+
+ @Override
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ Converter converter = ctx.getFacesContext().getApplication()
+ .createConverter(converterId);
+ ((UIDataAdaptor) instance).setRowKeyConverter(converter);
+
+ }
+ }
+
+ public static final RowKeyConverterRule INSTANCE = new RowKeyConverterRule();
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.sun.facelets.tag.MetaRule#applyRule(java.lang.String,
+ * com.sun.facelets.tag.TagAttribute,
+ * com.sun.facelets.tag.MetadataTarget)
+ */
+ @Override
+ public Metadata applyRule(String name, TagAttribute attribute,
+ MetadataTarget meta) {
+
+ if (meta.isTargetInstanceOf(UIDataAdaptor.class)) {
+ if ("rowKeyConverter".equals(name)) {
+ if (attribute.isLiteral()) {
+ return new StaticConverterMetadata(attribute.getValue());
+ } else {
+ return new DynamicConverterMetaData(attribute);
+ }
+ }
+ }
+
+ return null;
+ }
+
+}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/UIComponentTagBase.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/UIComponentTagBase.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/UIComponentTagBase.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.webapp.taglib;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/tidy/TidyParser.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/tidy/TidyParser.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/tidy/TidyParser.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -26,15 +26,12 @@
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
-import java.util.LinkedList;
-import java.util.Map;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Properties;
import org.ajax4jsf.Messages;
import org.ajax4jsf.application.AjaxViewHandler;
-import org.ajax4jsf.context.SAXEndElementEvent;
-import org.ajax4jsf.context.SAXStartElementEvent;
-import org.ajax4jsf.context.SAXTextEvent;
import org.ajax4jsf.org.w3c.tidy.Lexer;
import org.ajax4jsf.org.w3c.tidy.Node;
import org.ajax4jsf.org.w3c.tidy.Tidy;
@@ -43,8 +40,11 @@
import org.ajax4jsf.webapp.HtmlParser;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.w3c.dom.Attr;
+import org.w3c.dom.CharacterData;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.NodeList;
/**
@@ -64,7 +64,7 @@
private String _outputEncoding;
- private Object[] headEvents;
+ private org.w3c.dom.Node[] headEvents;
private static final String[] _htmlTypes = { "text/html" };
@@ -88,6 +88,89 @@
tidy.setMessageListener(this);
}
+ private org.w3c.dom.Node importNode(Document document, org.w3c.dom.Node node, boolean
recursive) {
+
+ switch (node.getNodeType()) {
+ case org.w3c.dom.Node.ELEMENT_NODE:
+ Element element = document.createElement(node.getNodeName());
+
+ NamedNodeMap attributes = node.getAttributes();
+ if (attributes != null) {
+ int length = attributes.getLength();
+ for (int i = 0; i < length; i++) {
+ element.setAttributeNode((Attr) importNode(
+ document, attributes.item(i), recursive));
+ }
+ }
+
+ if (recursive) {
+ NodeList childNodes = node.getChildNodes();
+ if (childNodes != null) {
+ int length = childNodes.getLength();
+ for (int i = 0; i < length; i++) {
+ element.appendChild(importNode(document, childNodes.item(i), recursive));
+ }
+ }
+ }
+
+ return element;
+
+ case org.w3c.dom.Node.ATTRIBUTE_NODE:
+ Attr attr = document.createAttribute(node.getNodeName());
+ attr.setNodeValue(node.getNodeValue());
+
+ return attr;
+
+ case org.w3c.dom.Node.TEXT_NODE:
+ String charData = ((CharacterData) node).getData();
+
+ return document.createTextNode(charData);
+
+ case org.w3c.dom.Node.CDATA_SECTION_NODE:
+ charData = ((CharacterData) node).getData();
+
+ return document.createCDATASection(charData);
+ case org.w3c.dom.Node.COMMENT_NODE:
+ charData = ((CharacterData) node).getData();
+
+ return document.createComment(charData);
+ case org.w3c.dom.Node.DOCUMENT_FRAGMENT_NODE:
+ case org.w3c.dom.Node.DOCUMENT_NODE:
+ case org.w3c.dom.Node.ENTITY_NODE:
+ case org.w3c.dom.Node.ENTITY_REFERENCE_NODE:
+ case org.w3c.dom.Node.NOTATION_NODE:
+ case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
+ default:
+ throw new IllegalArgumentException("Unsupported node type: " +
node.getNodeType());
+ }
+ }
+
+ private static final class NodeVisitor {
+ private List<org.w3c.dom.Node> viewStateSpans = new
ArrayList<org.w3c.dom.Node>();
+ private org.w3c.dom.Node head = null;
+
+ private boolean isViewState(Element element) {
+ return AjaxViewHandler.STATE_MARKER_KEY.equals(element.getAttribute("id"))
&&
+ AjaxViewHandler.STATE_MARKER_KEY.equals(element.getAttribute("name"));
+ }
+
+ private void traverse(org.w3c.dom.Node node) {
+ String nodeName = node.getNodeName();
+
+ if (head == null /* first head node only */ &&
"head".equals(nodeName)) {
+ head = node;
+ } else if ("span".equals(nodeName) && isViewState((Element) node))
{
+ viewStateSpans.add(node);
+ } else {
+ org.w3c.dom.Node child = node.getFirstChild();
+ while (child != null) {
+ traverse(child);
+ child = child.getNextSibling();
+ }
+ }
+ }
+ }
+
/*
* (non-Javadoc)
*
@@ -100,59 +183,52 @@
if (null != document) {
Element documentElement = document.getDocumentElement();
if (null != documentElement) {
+ NodeVisitor nodeVisitor = new NodeVisitor();
+ nodeVisitor.traverse(documentElement);
// Replace state elements with real stored.
-
- NodeList inputs = documentElement.getElementsByTagName("span");
- for (int i = 0; i < inputs.getLength(); i++) {
- Element node = (Element) inputs.item(i);
- if (AjaxViewHandler.STATE_MARKER_KEY.equals(node
- .getAttribute("id"))
- && AjaxViewHandler.STATE_MARKER_KEY.equals(node
- .getAttribute("name"))) {
- // State marker - replace with real.
- org.w3c.dom.Node parentNode = node.getParentNode();
- if (null != _viewState) {
- parentNode.replaceChild(document
- .createCDATASection(_viewState), node);
- } else {
- // Remove marker element, but keep it content.
- if (node.hasChildNodes()) {
- org.w3c.dom.Node nextSibling = node
- .getNextSibling();
- NodeList childNodes = node.getChildNodes();
- // Copy all nodes by temporary array ( since
- // moving nodes in iteration
- // modify NodeList with side effects.
- org.w3c.dom.Node[] childArray = new org.w3c.dom.Node[childNodes
- .getLength()];
- for (int j = 0; j < childArray.length; j++) {
- childArray[j] = childNodes.item(j);
- }
- for (int j = 0; j < childArray.length; j++) {
- parentNode.insertBefore(childArray[j],
- nextSibling);
- }
+
+ List<org.w3c.dom.Node> viewStateSpans = nodeVisitor.viewStateSpans;
+ for (org.w3c.dom.Node node : viewStateSpans) {
+ // State marker - replace with real.
+ org.w3c.dom.Node parentNode = node.getParentNode();
+ if (null != _viewState) {
+ parentNode.replaceChild(document
+ .createCDATASection(_viewState), node);
+ } else {
+ // Remove marker element, but keep it content.
+ if (node.hasChildNodes()) {
+ org.w3c.dom.Node nextSibling = node
+ .getNextSibling();
+ NodeList childNodes = node.getChildNodes();
+ // Copy all nodes by temporary array ( since
+ // moving nodes in iteration
+ // modify NodeList with side effects.
+ org.w3c.dom.Node[] childArray = new org.w3c.dom.Node[childNodes
+ .getLength()];
+ for (int j = 0; j < childArray.length; j++) {
+ childArray[j] = childNodes.item(j);
}
- parentNode.removeChild(node);
+ for (int j = 0; j < childArray.length; j++) {
+ parentNode.insertBefore(childArray[j],
+ nextSibling);
+ }
}
+ parentNode.removeChild(node);
}
}
-
+
// Inserts scripts and styles to head.
if ((null != headEvents && headEvents.length > 0) || null != _viewState)
{
// find head
- org.w3c.dom.Node head = documentElement
- .getElementsByTagName("head").item(0);
+ org.w3c.dom.Node head = nodeVisitor.head;
// Insert empty if not found
if (null == head) {
head = document.createElement("head");
documentElement.insertBefore(head, documentElement
.getFirstChild());
}
- NodeList headChildren = head.getChildNodes();
- org.w3c.dom.Node child = null;
- for (int i = 0; i < headChildren.getLength(); i++) {
- child = headChildren.item(i);
+ org.w3c.dom.Node child = head.getFirstChild();
+ while (child != null) {
if (child instanceof Element) {
String nodeName = ((Element) child).getNodeName();
if (!("title".equalsIgnoreCase(nodeName) || "base"
@@ -160,40 +236,18 @@
break;
}
}
- child = null;
+
+ child = child.getNextSibling();
}
- LinkedList<Element> nodesStack = new LinkedList<Element>();
-
- for (Object event : headEvents) {
- if (event instanceof SAXStartElementEvent) {
- SAXStartElementEvent startElement = (SAXStartElementEvent) event;
-
- Element element = document.createElement(startElement.getName());
- for (Map.Entry<String, String> attributeEntry :
startElement.getAttributes().entrySet()) {
- element.setAttribute(attributeEntry.getKey(), attributeEntry.getValue());
- }
-
- if (nodesStack.isEmpty()) {
- head.insertBefore(element, child);
- } else {
- nodesStack.peek().appendChild(element);
- }
- nodesStack.addFirst(element);
-
- } else if (event instanceof SAXTextEvent) {
- SAXTextEvent textEvent = (SAXTextEvent) event;
-
- nodesStack.peek().appendChild(document.createTextNode(textEvent.getText()));
-
- } else if (event instanceof SAXEndElementEvent) {
- nodesStack.removeFirst();
- } else {
- throw new IllegalArgumentException();
+ if (headEvents != null) {
+ for (org.w3c.dom.Node node : headEvents) {
+ head.insertBefore(importNode(document, node, true), child);
}
}
}
}
+
if (null != output) {
tidy.pprint(document, output);
}
@@ -393,7 +447,7 @@
_viewState = viewState;
}
- public void setHeadEvents(Object[] headEvents) {
+ public void setHeadNodes(org.w3c.dom.Node[] headEvents) {
this.headEvents = headEvents;
}
}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/AttributesImplSerializer.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/AttributesImplSerializer.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/AttributesImplSerializer.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/CharInfo.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/CharInfo.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/CharInfo.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/DOMSerializer.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/DOMSerializer.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/DOMSerializer.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ElemContext.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ElemContext.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ElemContext.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ElemDesc.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ElemDesc.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ElemDesc.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/EmptySerializer.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/EmptySerializer.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/EmptySerializer.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/EncodingInfo.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/EncodingInfo.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/EncodingInfo.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/Encodings.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/Encodings.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/Encodings.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ExtendedContentHandler.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ExtendedContentHandler.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ExtendedContentHandler.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ExtendedLexicalHandler.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ExtendedLexicalHandler.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ExtendedLexicalHandler.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/Method.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/Method.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/Method.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/NamespaceMappings.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/NamespaceMappings.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/NamespaceMappings.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ObjectFactory.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ObjectFactory.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ObjectFactory.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/OutputPropertiesFactory.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/OutputPropertiesFactory.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/OutputPropertiesFactory.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/OutputPropertyUtils.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/OutputPropertyUtils.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/OutputPropertyUtils.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SecuritySupport.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SecuritySupport.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SecuritySupport.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2002-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SecuritySupport12.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SecuritySupport12.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SecuritySupport12.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2002-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializationHandler.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializationHandler.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializationHandler.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/Serializer.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/Serializer.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/Serializer.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializerBase.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializerBase.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializerBase.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializerConstants.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializerConstants.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializerConstants.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializerFactory.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializerFactory.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializerFactory.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializerTrace.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializerTrace.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializerTrace.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializerTraceWriter.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializerTraceWriter.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/SerializerTraceWriter.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToHTMLSAXHandler.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToHTMLSAXHandler.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToHTMLSAXHandler.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToHTMLStream.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToHTMLStream.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToHTMLStream.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToSAXHandler.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToSAXHandler.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToSAXHandler.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToStream.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToStream.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToStream.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToTextSAXHandler.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToTextSAXHandler.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToTextSAXHandler.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToTextStream.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToTextStream.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToTextStream.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToUnknownStream.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToUnknownStream.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToUnknownStream.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToXHTMLStream.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToXHTMLStream.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToXHTMLStream.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToXMLSAXHandler.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToXMLSAXHandler.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToXMLSAXHandler.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToXMLStream.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToXMLStream.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToXMLStream.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/TransformStateSetter.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/TransformStateSetter.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/TransformStateSetter.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/TreeWalker.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/TreeWalker.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/TreeWalker.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2005 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/Version.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/Version.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/Version.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2005 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/WriterChain.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/WriterChain.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/WriterChain.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/WriterToASCI.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/WriterToASCI.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/WriterToASCI.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/WriterToUTF8Buffered.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/WriterToUTF8Buffered.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/WriterToUTF8Buffered.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2005 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/XSLOutputAttributes.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/XSLOutputAttributes.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/XSLOutputAttributes.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/AttList.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/AttList.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/AttList.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/BoolStack.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/BoolStack.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/BoolStack.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/DOM2Helper.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/DOM2Helper.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/DOM2Helper.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/Messages.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/Messages.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/Messages.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/MsgKey.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/MsgKey.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/MsgKey.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_ca.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_ca.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_ca.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_cs.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_cs.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_cs.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_de.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_de.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_de.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_en.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_en.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_en.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_es.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_es.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_es.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_fr.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_fr.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_fr.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_hu.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_hu.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_hu.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_it.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_it.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_it.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_ja.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_ja.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_ja.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_ko.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_ko.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_ko.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_pl.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_pl.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_pl.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_pt_BR.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_pt_BR.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_pt_BR.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_ru.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_ru.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_ru.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_sv.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_sv.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_sv.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_tr.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_tr.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_tr.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_zh_CN.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_zh_CN.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_zh_CN.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_zh_TW.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_zh_TW.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SerializerMessages_zh_TW.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/StringToIntTable.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/StringToIntTable.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/StringToIntTable.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SystemIDResolver.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SystemIDResolver.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/SystemIDResolver.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/URI.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/URI.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/URI.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/Utils.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/Utils.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/Utils.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/WrappedRuntimeException.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/WrappedRuntimeException.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/utils/WrappedRuntimeException.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
Modified: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/VersionBean.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/VersionBean.java 2009-07-07
17:09:24 UTC (rev 14814)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/VersionBean.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.richfaces;
+package org.richfaces;
/**
* Vendor and version information for A4J project
@@ -28,13 +28,14 @@
*
*/
public class VersionBean {
+
public static final String VENDOR = "richfaces.org";
- public static final int MAJOR_VERSION = 3;
- public static final int MINOR_VERSION = 3;
+ public static final int MAJOR_VERSION = 4;
+ public static final int MINOR_VERSION = 0;
public static final String PROJECT_NAME = "Jboss Richfaces";
/**
- * Revision version, must be auto modified by CVS
+ * Revision version, must be auto modified by CVS
*/
public static final String REVISION = "0-SNAPSHOT" ;
Copied:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/component/FileUploadConstants.java
(from rev 14238,
trunk/framework/impl/src/main/java/org/richfaces/component/FileUploadConstants.java)
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/component/FileUploadConstants.java
(rev 0)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/component/FileUploadConstants.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -0,0 +1,66 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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;
+
+import org.ajax4jsf.request.MultipartRequest;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+
+public final class FileUploadConstants {
+
+ /**
+ * Request parameter that indicates if multipart request forced by rich file
+ * upload component
+ */
+ public static final String UPLOAD_FILES_ID = "_richfaces_upload_uid";
+
+ /** Session bean name to store max files count allowed to upload */
+ public static final String UPLOADED_COUNTER =
"_richfaces_uploaded_file_counter";
+
+ /** Request parameter name indicated that file was uploaded by RF component */
+ public static final String FILE_UPLOAD_INDICATOR =
"_richfaces_upload_file_indicator";
+
+ /** Session bean name where request size will be stored */
+ public static final String REQUEST_SIZE_BEAN_NAME =
"_richfaces_request_size";
+
+ /** Session bean name where progress bar's percent map will be stored */
+ public static final String PERCENT_BEAN_NAME = "_richfaces_upload_percents";
+
+ /** Session bean name where stop keys will be stored */
+ public static final String REQUEST_KEYS_BEAN_NAME =
"_richfaces_request_keys";
+
+ public static final String FILE_UPLOAD_ACTION =
"_richfaces_file_upload_action";
+
+ public static final String FILE_UPLOAD_ACTION_STOP =
"richfaces_file_upload_action_stop";
+
+ public static final String FILE_UPLOAD_ACTION_PROGRESS = "progress";
+
+ public static final String FILE_UPLOAD_REQUEST_ATTRIBUTE_NAME =
MultipartRequest.class.getName();
+
+ private FileUploadConstants() {
+ //private constructor
+ }
+
+}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/component/UISwitchablePanel.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/component/UISwitchablePanel.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/component/UISwitchablePanel.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -34,6 +34,7 @@
import javax.faces.event.PhaseId;
import javax.faces.event.ValueChangeEvent;
+import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.richfaces.event.SwitchablePanelSwitchEvent;
@@ -67,15 +68,14 @@
public String getSwitchType() {
if (this.switchType != null) {
return switchType;
- }
+ }
ValueBinding switchTypeBinding = getValueBinding("switchType");
if (switchTypeBinding != null) {
return (String) switchTypeBinding.getValue(FacesContext.getCurrentInstance());
}
- //TODO use DEFAULT_METHOD
- return SERVER_METHOD;
+ return DEFAULT_METHOD;
}
public void setSwitchType(String switchType) {
@@ -103,7 +103,7 @@
if(facesEvent instanceof ActionEvent){
//TODO invoke action listener or remove it
- if(isImmediate()){
+ if (isImmediate()) {
FacesContext facesContext = FacesContext.getCurrentInstance();
facesContext.renderResponse();
}
@@ -119,7 +119,7 @@
Object oldValue = getValue();
if ((oldValue == null && newValue != null) ||
- (oldValue != null && !oldValue.equals(newValue))) {
+ (oldValue != null && !oldValue.equals(newValue))) {
queueEvent(new ValueChangeEvent(this, oldValue, newValue));
}
@@ -134,10 +134,10 @@
setValue(newValue);
}
- if (AjaxRendererUtils.isAjaxRequest(facesContext) &&
this.getSwitchType().equals(AJAX_METHOD)) {
- AjaxRendererUtils.addRegionByName(facesContext,
- this,
- this.getId());
+ if (AjaxRendererUtils.isAjaxRequest(facesContext)
+ /* && this.getSwitchType().equals(AJAX_METHOD)*/) { // RF-7292
+
+ AjaxRendererUtils.addRegionByName(facesContext, this, this.getId());
}
}
} else /* component should throw IllegalArgumentException for unknown events - RF-30 */
{
@@ -149,7 +149,7 @@
//no processing here
}
- protected Iterator getSwitchedFacetsAndChildren() {
+ protected Iterator<UIComponent> getSwitchedFacetsAndChildren() {
return getFacetsAndChildren();
}
@@ -163,9 +163,9 @@
}
// Process all facets and children of this component
- Iterator kids = getSwitchedFacetsAndChildren();
+ Iterator<UIComponent> kids = getSwitchedFacetsAndChildren();
while (kids.hasNext()) {
- UIComponent kid = (UIComponent) kids.next();
+ UIComponent kid = kids.next();
kid.processDecodes(context);
}
@@ -174,18 +174,6 @@
if (isImmediate()) {
validate(context);
-
-// if (!isValid()) {
-// context.renderResponse();
-// }
-
- //UISwitchablePanel has a special behavior
- //it stops processing after APPLY_REQUEST_VALUES phase
- //when immediate
-//
-// set context.renderResponse() in broadcast method if component is immediate
-// and ActionEvent is occured (RF-1032)
-// context.renderResponse();
}
} catch (RuntimeException e) {
context.renderResponse();
@@ -195,30 +183,30 @@
public void processUpdates(FacesContext context) {
if (context == null) {
- throw new NullPointerException("FacesContext is null!");
- }
-
- if (!isRendered()) {
- return ;
- }
-
- Iterator kids = getSwitchedFacetsAndChildren();
- while (kids.hasNext()) {
- UIComponent kid = (UIComponent) kids.next();
- kid.processUpdates(context);
- }
-
- try {
- updateModel(context);
-
- if (!isValid()) {
- context.renderResponse();
- }
-
- } catch (RuntimeException e) {
- context.renderResponse();
- throw e;
- }
+ throw new NullPointerException("FacesContext is null!");
+ }
+
+ if (!isRendered()) {
+ return;
+ }
+
+ Iterator<UIComponent> kids = getSwitchedFacetsAndChildren();
+ while (kids.hasNext()) {
+ UIComponent kid = kids.next();
+ kid.processUpdates(context);
+ }
+
+ try {
+ updateModel(context);
+
+ if (!isValid()) {
+ context.renderResponse();
+ }
+
+ } catch (RuntimeException e) {
+ context.renderResponse();
+ throw e;
+ }
}
public void processValidators(FacesContext context) {
@@ -230,7 +218,7 @@
return ;
}
- Iterator kids = getSwitchedFacetsAndChildren();
+ Iterator<UIComponent> kids = getSwitchedFacetsAndChildren();
while (kids.hasNext()) {
UIComponent kid = (UIComponent) kids.next();
kid.processValidators(context);
@@ -244,7 +232,6 @@
context.renderResponse();
}
}
-
} catch (RuntimeException e) {
context.renderResponse();
throw e;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/component/util/ComponentUtil.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/component/util/ComponentUtil.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/component/util/ComponentUtil.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.util;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -120,4 +120,39 @@
return false;
}
+ private static boolean isEmpty(String s) {
+ return s == null || s.length() == 0;
+ }
+
+ public static String concatClasses(String... classes) {
+ StringBuilder result = new StringBuilder();
+
+ for (String className : classes) {
+ if (!isEmpty(className)) {
+ if (result.length() != 0) {
+ result.append(' ');
+ }
+
+ result.append(className.trim());
+ }
+ }
+
+ return result.toString();
+ }
+
+ public static String concatStyles(String... styles) {
+ StringBuilder result = new StringBuilder();
+
+ for (String style : styles) {
+ if (!isEmpty(style)) {
+ if (result.length() != 0) {
+ result.append(';');
+ }
+
+ result.append(style.trim());
+ }
+ }
+
+ return result.toString();
+ }
}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/event/RenderPhaseComponentListener.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/event/RenderPhaseComponentListener.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/event/RenderPhaseComponentListener.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.event;
import java.util.Collection;
Modified: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/CDL.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/CDL.java 2009-07-07
17:09:24 UTC (rev 14814)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/CDL.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * 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.json;
/*
Modified: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/Cookie.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/Cookie.java 2009-07-07
17:09:24 UTC (rev 14814)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/Cookie.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * 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.json;
/*
Modified: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/CookieList.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/CookieList.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/CookieList.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * 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.json;
/*
Modified: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/HTTP.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/HTTP.java 2009-07-07
17:09:24 UTC (rev 14814)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/HTTP.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * 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.json;
/*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/HTTPTokener.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/HTTPTokener.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/HTTPTokener.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * 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.json;
/*
Modified: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONArray.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONArray.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONArray.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * 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.json;
/*
@@ -46,6 +25,7 @@
*/
import java.io.IOException;
+import java.io.Serializable;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collection;
@@ -101,10 +81,14 @@
* @author
JSON.org
* @version 2
*/
-public class JSONArray {
+public class JSONArray implements Serializable {
-
/**
+ *
+ */
+ private static final long serialVersionUID = -5128849901663778859L;
+
+ /**
* The arrayList where the JSONArray's properties are kept.
*/
private ArrayList myArrayList;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONCollection.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONCollection.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONCollection.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -21,6 +21,7 @@
package org.richfaces.json;
+import java.io.Serializable;
import java.util.AbstractCollection;
import java.util.Iterator;
@@ -30,8 +31,13 @@
* created 15.12.2006
*
*/
-public class JSONCollection extends AbstractCollection {
+public class JSONCollection extends AbstractCollection implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 3192118108278773579L;
+
private JSONArray array;
public JSONCollection() throws JSONException {
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONException.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONException.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONException.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -27,8 +27,17 @@
* @version 2
*/
public class JSONException extends Exception {
- private Throwable cause;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2464742309018240317L;
+
+ private Throwable cause;
+ public JSONException() {
+ super();
+ }
+
/**
* Constructs a JSONException with an explanatory message.
* @param message Detail about the reason for the exception.
Modified: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONMap.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONMap.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONMap.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -21,6 +21,7 @@
package org.richfaces.json;
+import java.io.Serializable;
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.Iterator;
@@ -32,10 +33,15 @@
* created 15.12.2006
*
*/
-public class JSONMap extends AbstractMap {
+public class JSONMap extends AbstractMap implements Serializable {
- final private JSONObject jsonObject;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2898468948832273123L;
+ private JSONObject jsonObject;
+
public JSONMap() throws JSONException {
super();
Modified: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONObject.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONObject.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONObject.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * 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.json;
/*
@@ -46,6 +25,8 @@
*/
import java.io.IOException;
+import java.io.ObjectStreamException;
+import java.io.Serializable;
import java.io.Writer;
import java.lang.reflect.Field;
import java.util.Collection;
@@ -106,16 +87,30 @@
* @author
JSON.org
* @version 2
*/
-public class JSONObject {
+public class JSONObject implements Serializable {
/**
+ *
+ */
+ private static final long serialVersionUID = -3779657348977645510L;
+
+ /**
* JSONObject.NULL is equivalent to the value that JavaScript calls null,
* whilst Java's null is equivalent to the value that JavaScript calls
* undefined.
*/
- private static final class Null {
+ private static final class Null implements Serializable {
/**
+ *
+ */
+ private static final long serialVersionUID = -1155578668810010644L;
+
+ protected Null() {
+ super();
+ }
+
+ /**
* There is only intended to be a single instance of the NULL object,
* so the clone method returns itself.
* @return NULL.
@@ -143,6 +138,11 @@
public String toString() {
return "null";
}
+
+ private Object readResolve() throws ObjectStreamException {
+ return NULL;
+ }
+
}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONStringer.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONStringer.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONStringer.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * 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.json;
/*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONTokener.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONTokener.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONTokener.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * 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.json;
/*
Modified: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONWriter.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONWriter.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/JSONWriter.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * 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.json;
import java.io.IOException;
Modified: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/XML.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/XML.java 2009-07-07
17:09:24 UTC (rev 14814)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/XML.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * 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.json;
/*
Modified: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/XMLTokener.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/XMLTokener.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/json/XMLTokener.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * 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.json;
/*
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/DataModelCache.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/DataModelCache.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/DataModelCache.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.model;
Deleted:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ExtendedDataTableModifiableModel.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ExtendedDataTableModifiableModel.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ExtendedDataTableModifiableModel.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,196 +0,0 @@
-/**
- *
- */
-package org.richfaces.model;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.faces.context.FacesContext;
-import javax.faces.model.DataModelListener;
-
-import org.ajax4jsf.model.DataVisitor;
-import org.ajax4jsf.model.ExtendedDataModel;
-import org.ajax4jsf.model.Range;
-import org.ajax4jsf.model.SequenceRange;
-import org.ajax4jsf.model.SerializableDataModel;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.richfaces.model.FilterField;
-import org.richfaces.model.SortField2;
-import org.richfaces.model.impl.expressive.JavaBeanWrapper;
-import org.richfaces.model.impl.expressive.ObjectWrapperFactory;
-import org.richfaces.model.impl.expressive.WrappedBeanComparator2;
-import org.richfaces.model.impl.expressive.WrappedBeanFilter;
-
-/**
- * @author pawelgo
- *
- */
-public class ExtendedDataTableModifiableModel<T> extends ExtendedDataModel {
-
- private static final Log log =
LogFactory.getLog(ExtendedDataTableModifiableModel.class);
-
- private ExtendedDataModel delegate;
-
- private ExtendedTableDataModel<T> originalModel;
-
- private ExtendedDataModel modifiedModel;
-
- private String var;
-
- private List<FilterField> filterFields;
- private List<SortField2> sortFields;
-
- /**
- * @param originalModel
- * @param var
- * @param filterFields
- * @param sortFields
- */
- public ExtendedDataTableModifiableModel(ExtendedTableDataModel<T> originalModel,
- String var, List<FilterField> filterFields,
- List<SortField2> sortFields) {
- this.originalModel = originalModel;
- this.delegate = originalModel;
- this.var = var;
- this.filterFields = filterFields;
- this.sortFields = sortFields;
- }
-
- public void addDataModelListener(DataModelListener listener) {
- originalModel.addDataModelListener(listener);
- }
-
- public DataModelListener[] getDataModelListeners() {
- return originalModel.getDataModelListeners();
- }
-
- public int getRowCount() {
- return delegate.getRowCount();
- }
-
- public Object getRowData() {
- return delegate.getRowData();
- }
-
- public int getRowIndex() {
- return delegate.getRowIndex();
- }
-
- public Object getRowKey() {
- return delegate.getRowKey();
- }
-
- public SerializableDataModel getSerializableModel(Range range) {
- return delegate.getSerializableModel(range);
- }
-
- public Object getWrappedData() {
- return delegate.getWrappedData();
- }
-
- public boolean isRowAvailable() {
- return delegate.isRowAvailable();
- }
-
- public void removeDataModelListener(DataModelListener listener) {
- delegate.removeDataModelListener(listener);
- }
-
- public void setRowIndex(int rowIndex) {
- delegate.setRowIndex(rowIndex);
- }
-
- public void setRowKey(Object key) {
- delegate.setRowKey(key);
- }
-
- public void setWrappedData(Object data) {
- delegate.setWrappedData(data);
- }
-
- @SuppressWarnings("unchecked")
- public void walk(FacesContext context, DataVisitor visitor, Range range,
- Object argument) throws IOException {
-
- if (shouldSort() || shouldFilter()) {
- if (modifiedModel == null) {
- modifiedModel = new
ExtendedTableDataModelWrapper<T>(originalModel.getDataProvider(), (List<T>)
prepareCollection());
- }
- delegate = modifiedModel;
- } else {
- delegate = originalModel;
- }
-
- delegate.walk(context, visitor, range, argument);
- }
-
- private boolean shouldSort() {
- return sortFields != null && !sortFields.isEmpty();
- }
-
- private boolean shouldFilter() {
- return filterFields != null && !filterFields.isEmpty();
- }
-
- private List<?> prepareCollection() {
- int rowCount = originalModel.getRowCount();
- final List<Object> collection;
-
- if (rowCount > 0) {
- collection = new ArrayList<Object>(rowCount);
- } else {
- collection = new ArrayList<Object>();
- }
-
- FacesContext context = FacesContext.getCurrentInstance();
- try {
-
- originalModel.walk(context, new DataVisitor() {
- public void process(FacesContext context, Object rowKey,
- Object argument) throws IOException {
- originalModel.setRowKey(rowKey);
- if (originalModel.isRowAvailable()) {
- collection.add(originalModel.getRowData());
- }
- }
- }, new SequenceRange(0, -1),
- null);
- } catch (IOException e) {
- log.error(e.getMessage(), e);
- }
-
- List<Object> modifedcollection = collection;
-
- if (shouldFilter()) {
- List <Object> filteredCollection = new ArrayList<Object>();
- ObjectWrapperFactory wrapperFactory = new ObjectWrapperFactory(
- context, var, filterFields);
- WrappedBeanFilter wrappedBeanFilter = new WrappedBeanFilter(filterFields);
- wrapperFactory.wrapList(modifedcollection);
- for (Object object : modifedcollection) {
- if(wrappedBeanFilter.accept((JavaBeanWrapper)object)) {
- filteredCollection.add(object);
- }
- }
- modifedcollection = filteredCollection;
- wrapperFactory.unwrapList(modifedcollection);
- }
-
- if (shouldSort()) {
- ObjectWrapperFactory wrapperFactory = new ObjectWrapperFactory(
- context, var, sortFields);
- WrappedBeanComparator2 wrappedBeanComparator = new WrappedBeanComparator2(
- sortFields);
- wrapperFactory.wrapList(modifedcollection);
- Collections.sort(modifedcollection, wrappedBeanComparator);
- wrapperFactory.unwrapList(modifedcollection);
- }
- return modifedcollection;
-
- }
-
-}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ExtendedTableDataModel.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ExtendedTableDataModel.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ExtendedTableDataModel.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,9 +1,28 @@
/**
- *
- */
+* License Agreement.
+*
+* JBoss RichFaces - Ajax4jsf Component Library
+*
+* Copyright (C) 2008 CompuGROUP Holding AG
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License version 2.1 as published by the Free Software Foundation.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* 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.model;
import java.io.IOException;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -12,9 +31,9 @@
import javax.faces.context.FacesContext;
import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.model.ExtendedDataModel;
import org.ajax4jsf.model.Range;
import org.ajax4jsf.model.SequenceRange;
-import org.ajax4jsf.model.SerializableDataModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -22,115 +41,23 @@
* Data model class for table components.<br>
* Usage:
* <pre>
- * G3TableDataModel<SomeDataType> dataModel = new
G3TableDataModel<SomeDataType>(new G3DataProvider
<SomeDataType>());
+ * ExtendedTableDataModel<SomeDataType> dataModel = new
ExtendedTableDataModel<SomeDataType>(new DataProvider
<SomeDataType>());
* </pre>
* @author pawelgo
*
*/
-public class ExtendedTableDataModel<T> extends SerializableDataModel {
+public class ExtendedTableDataModel<T> extends ExtendedDataModel implements
Serializable{
-// /**
-// * Cache container for data presented in data model.
-// * It prevents load the same data many times.
-// * @author pawelgo
-// *
-// * @param <T> data type
-// */
-// private static class DataCache<T> implements Serializable {
-// private static final long serialVersionUID = 8409239905346930920L;
-// private int startRow;
-// private int endRow;
-// //private SortOrder sortOrder;
-// private List<T> loadedData;
-//
-// public DataCache(int startRow, int endRow,
-// List<T> loadedData) {
-// super();
-// this.startRow = startRow;
-// this.endRow = endRow;
-// //this.sortOrder = deepCopy(sortOrder);
-// this.loadedData = loadedData;
-// }
-//
-// /**
-// * Returns a deep copy of an object
-// */
-// @SuppressWarnings("unused")
-// private SortOrder deepCopy(SortOrder sortOrder) {
-// if (sortOrder == null)
-// return null;
-// SortOrder order = new SortOrder();
-// if (sortOrder.getFields() != null) {
-// SortField[] fields = new SortField[sortOrder.getFields().length];
-// for (int i = 0; i < sortOrder.getFields().length; i++) {
-// SortField f = sortOrder.getFields()[i];
-// fields[i] = new SortField(f.getName(), f.getIndex(), f
-// .getAscending());
-// }//for
-// order.setFields(fields);
-// }//if
-// return order;
-// }//deepCopy
-//
-// /**
-// * Returns a deep copy of an object using serialization.
-// */
-// static public Object deepCopy(Object oldObj) throws Exception {
-// ObjectOutputStream oos = null;
-// ObjectInputStream ois = null;
-// try {
-// ByteArrayOutputStream bos = new ByteArrayOutputStream();
-// oos = new ObjectOutputStream(bos);
-// // serialize and pass the object
-// oos.writeObject(oldObj);
-// oos.flush();
-// ByteArrayInputStream bin = new ByteArrayInputStream(bos
-// .toByteArray());
-// ois = new ObjectInputStream(bin);
-// // return the new object
-// return ois.readObject();
-// } catch (Exception e) {
-// if (log.isErrorEnabled())
-// log.error("Exception in ObjectCloner = " + e);
-// throw (e);
-// } finally {
-// oos.close();
-// ois.close();
-// }
-// }//deepCopy
-//
-// public boolean match(int s, int e) {
-// return s == startRow && e == endRow;
-// //&& sortOrdersMatch(sortOrder, this.sortOrder);
-// }//match
-//
-// @SuppressWarnings("unused")
-// private boolean sortOrdersMatch(SortOrder sortOrder1,
-// SortOrder sortOrder2) {
-// boolean result = sortOrder1 == sortOrder2;
-//
-// if (sortOrder1 != null && sortOrder2 != null) {
-// result = sortOrder1.equals(sortOrder2);
-// }
-//
-// return result;
-// }//sortOrdersMatch
-//
-// }//DataCache
-
private static final long serialVersionUID = 7374505108088114161L;
private static final Log log = LogFactory.getLog(ExtendedTableDataModel.class);
private DataProvider<T> dataProvider;
private Object rowKey;
- //private Map<Object,T> wrappedData = new HashMap<Object,T>();
private List<Object> wrappedKeys = null;
- private boolean detached = false;
+ //private boolean detached = false;
private Map<Object, T> wrappedData = new HashMap<Object, T>();
- //private DataCache<T> dataCache;
-
public ExtendedTableDataModel(DataProvider<T> dataProvider) {
this.dataProvider = dataProvider;
}
@@ -138,9 +65,9 @@
/* (non-Javadoc)
* @see org.ajax4jsf.model.SerializableDataModel#update()
*/
- public void update() {
- ;
- }
+// public void update() {
+// ;
+// }
/**
* This method never called from framework.
@@ -173,7 +100,7 @@
if (numberOfRows <= 0) {
numberOfRows = rowC;
}
- if (detached) { // Is this serialized model
+ if (wrappedKeys != null) { // Is this serialized model
// Here we just ignore current Rage and use whatever data was saved in serialized
model.
// Such approach uses much more getByPk() operations, instead of just one request by
range.
// Concrete case may be different from that, so you can just load data from data
provider by range.
@@ -216,17 +143,9 @@
endRow = rowCount;
throw new IllegalArgumentException("Illegal end index value: " + endRow);
}
- /*
- if (dataCache == null || !dataCache.match(startRow, endRow)) {
- if (log.isDebugEnabled())
- log.debug("load and store in cache");
- List<T> data = dataProvider.getItemsByRange(startRow, endRow);
- dataCache = new DataCache<T>(startRow, endRow, data);
- }
- return dataCache.loadedData;
- */
//load all from provider and get sublist
- return dataProvider.getItemsByRange(0, rowCount).subList(startRow, endRow);
+ return dataProvider.getItemsByRange(startRow, endRow);
+ //return dataProvider.getItemsByRange(0, rowCount).subList(startRow, endRow);
}//loadData
/**
@@ -331,15 +250,27 @@
* complicated cases we may need to transform data to actually serialized
* form.
*/
- public SerializableDataModel getSerializableModel(Range range) {
- if (wrappedKeys != null) {
- detached = true;
- // Some activity to detach persistent data from wrappedData map may be taken here.
- // In that specific case we are doing nothing.
- return this;
- } else {
- return null;
- }
+// public SerializableDataModel getSerializableModel(Range range) {
+// if (wrappedKeys != null) {
+// detached = true;
+// // Some activity to detach persistent data from wrappedData map may be taken here.
+// // In that specific case we are doing nothing.
+// return this;
+// } else {
+// return null;
+// }
+// }
+
+ /**
+ * Resets internal cached data. Call this method to reload data from data
+ * provider on first access for data.
+ */
+ public void reset(){
+ wrappedKeys = null;
+ wrappedData.clear();
+ rowCount = null;
+ rowIndex = -1;
+ rowKey = null;
}
public DataProvider<T> getDataProvider() {
Deleted:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ExtendedTableDataModelWrapper.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ExtendedTableDataModelWrapper.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ExtendedTableDataModelWrapper.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,40 +0,0 @@
-/**
- *
- */
-package org.richfaces.model;
-
-import java.util.List;
-
-/**
- * @author pawelgo
- *
- */
-public class ExtendedTableDataModelWrapper<T> extends
ExtendedTableDataModel<T> {
-
- private static final long serialVersionUID = 6932958007982793632L;
-
- protected List<T> wrappedList;
-
- /**
- *
- * @param dataProvider
- * @param wrappedList
- */
- public ExtendedTableDataModelWrapper(DataProvider<T> dataProvider, List<T>
wrappedList) {
- super(dataProvider);
- this.wrappedList = wrappedList;
- }
-
- protected List<T> loadData(int startRow, int endRow) {
- //return super.loadData(startRow, endRow);
- return wrappedList.subList(startRow, endRow);
- }
-
- public int getRowCount() {
- return wrappedList.size();
- }
-
-
-
-
-}
Copied:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ExtendedTableDataModifiableModel.java
(from rev 14238,
trunk/framework/impl/src/main/java/org/richfaces/model/ExtendedTableDataModifiableModel.java)
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ExtendedTableDataModifiableModel.java
(rev 0)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ExtendedTableDataModifiableModel.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -0,0 +1,131 @@
+/**
+* License Agreement.
+*
+* JBoss RichFaces - Ajax4jsf Component Library
+*
+* Copyright (C) 2008 CompuGROUP Holding AG
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License version 2.1 as published by the Free Software Foundation.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* 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.model;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.model.Range;
+import org.ajax4jsf.model.SequenceRange;
+
+/**
+ * @author pawelgo
+ *
+ */
+public class ExtendedTableDataModifiableModel<T> extends ModifiableModel {
+
+ //private static final Log log =
LogFactory.getLog(ExtendedTableDataModifiableModel.class);
+
+ private ExtendedTableDataModel<T> orgModel;
+ private boolean sortNeeded = true;
+ private boolean filterNeeded = true;
+
+ @SuppressWarnings("unchecked")
+ public ExtendedTableDataModifiableModel(DataProvider<T> dataProvider, String var)
{
+ super(new ExtendedTableDataModel<T>(dataProvider), var);
+ this.orgModel = (ExtendedTableDataModel<T>)this.originalModel;
+ }
+
+ public ExtendedTableDataModifiableModel(DataProvider<T> dataProvider) {
+ this(dataProvider, null);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ExtendedTableDataModifiableModel(ExtendedTableDataModel<T> dataModel,
String var) {
+ super(dataModel, var);
+ this.orgModel = dataModel;
+ }
+
+ @Override
+ public Object getRowKey() {
+ return originalModel.getRowKey();
+ }
+
+ @Override
+ public void setRowKey(Object key) {
+ originalModel.setRowKey(key);
+ }
+
+ @Override
+ public void walk(FacesContext context, DataVisitor visitor, Range range,
+ Object argument) throws IOException {
+ final SequenceRange seqRange = (SequenceRange) range;
+ int rows = seqRange.getRows();
+ int rowCount = getRowCount();
+ int currentRow = seqRange.getFirstRow();
+ if(rows > 0){
+ rows += currentRow;
+ rows = Math.min(rows, rowCount);
+ } else {
+ rows = rowCount;
+ }
+ for (; currentRow < rows; currentRow++) {
+ visitor.process(context, rowKeys.get(currentRow), argument);
+ }
+ }
+
+ /**
+ * Resets internal cached data. Call this method to reload data from data
+ * provider on first access for data.
+ */
+ public void reset(){
+ orgModel.reset();
+ rowKeys = null;
+ sortNeeded = true;
+ filterNeeded = true;
+ }
+
+ public Object getKey(T o) {
+ return orgModel.getKey(o);
+ }
+
+ public T getObjectByKey(Object key) {
+ return orgModel.getObjectByKey(key);
+ }
+
+ @Override
+ public void modify(List<FilterField> filterFields, List<SortField2>
sortFields) {
+ if (sortNeeded || filterNeeded){
+ if (var == null){
+ throw new IllegalStateException("\"var\" model attribute can not be
null.");
+ }
+ super.modify(filterFields, sortFields);
+ sortNeeded = false;
+ filterNeeded = false;
+ }
+ }
+
+ public void resetSort(){
+ sortNeeded = true;
+ }
+
+ public void resetFilter(){
+ filterNeeded = true;
+ }
+
+ public void setVar(String var){
+ this.var = var;
+ }
+}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ListSequenceDataModel.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ListSequenceDataModel.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ListSequenceDataModel.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.model;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ModifiableModel.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ModifiableModel.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/ModifiableModel.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.model;
@@ -7,6 +24,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import javax.faces.context.FacesContext;
@@ -28,15 +46,15 @@
* @author Konstantin Mishin
*
*/
-public class ModifiableModel extends ExtendedDataModel implements Modifiable{
+public class ModifiableModel extends ExtendedDataModel implements Modifiable, LocaleAware
{
- private class RowKeyWrapperFactory extends ObjectWrapperFactory {
+ protected class RowKeyWrapperFactory extends ObjectWrapperFactory {
private class ExtendedJavaBeanWrapper extends JavaBeanWrapper {
private Object key;
- public ExtendedJavaBeanWrapper(Object key, Object o, Map<String, Object> props)
{
+ public ExtendedJavaBeanWrapper(Object key, Object o, Map<Object, Object> props)
{
super(o, props);
this.key = key;
}
@@ -66,12 +84,14 @@
private static final Log log = LogFactory.getLog(ModifiableModel.class);
- private List<Object> rowKeys;
+ protected List<Object> rowKeys;
- private ExtendedDataModel originalModel;
+ protected ExtendedDataModel originalModel;
- private String var;
+ protected String var;
+ protected Locale locale = null;
+
public ModifiableModel(ExtendedDataModel originalModel, String var) {
this.originalModel = originalModel;
this.var = var;
@@ -87,9 +107,24 @@
return originalModel.getDataModelListeners();
}
+ public Locale getLocale() {
+ return locale;
+ }
+
+ public void setLocale(Locale locale) {
+ this.locale = locale;
+ }
+
@Override
public Object getRowKey() {
- return rowKeys.indexOf(originalModel.getRowKey());
+ Object originalModelKey = originalModel.getRowKey();
+ int idx = rowKeys.indexOf(originalModelKey);
+
+ if (originalModelKey != null || idx >= 0) {
+ return idx;
+ } else {
+ return null;
+ }
}
@Override
@@ -207,12 +242,13 @@
}
- private List<Object> filter(List<FilterField> filterFields) {
+ protected List<Object> filter(List<FilterField> filterFields) {
if (filterFields != null && !filterFields.isEmpty()) {
FacesContext context = FacesContext.getCurrentInstance();
List <Object> filteredCollection = new ArrayList<Object>();
ObjectWrapperFactory wrapperFactory = new RowKeyWrapperFactory(context, var,
filterFields);
- WrappedBeanFilter wrappedBeanFilter = new WrappedBeanFilter(filterFields);
+
+ WrappedBeanFilter wrappedBeanFilter = new WrappedBeanFilter(filterFields, locale);
wrapperFactory.wrapList(rowKeys);
for (Object object : rowKeys) {
if(wrappedBeanFilter.accept((JavaBeanWrapper)object)) {
@@ -225,13 +261,14 @@
return rowKeys;
}
- private void sort(List<SortField2> sortFields) {
+ protected void sort(List<SortField2> sortFields) {
if (sortFields != null && !sortFields.isEmpty()) {
FacesContext context = FacesContext.getCurrentInstance();
ObjectWrapperFactory wrapperFactory = new RowKeyWrapperFactory(
context, var, sortFields);
+
WrappedBeanComparator2 wrappedBeanComparator = new WrappedBeanComparator2(
- sortFields);
+ sortFields, locale);
wrapperFactory.wrapList(rowKeys);
Collections.sort(rowKeys, wrappedBeanComparator);
wrapperFactory.unwrapList(rowKeys);
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/ArrayDataModel.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/ArrayDataModel.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/ArrayDataModel.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.model.impl;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/ListDataModel.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/ListDataModel.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/ListDataModel.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.model.impl;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/SimpleGridDataModel.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/SimpleGridDataModel.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/SimpleGridDataModel.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.model.impl;
import java.util.Comparator;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/JavaBeanWrapper.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/JavaBeanWrapper.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/JavaBeanWrapper.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -29,18 +29,18 @@
*/
public class JavaBeanWrapper {
private Object wrappedObject;
- private Map<String, Object> properties;
+ private Map<Object, Object> properties;
- public JavaBeanWrapper(Object o, Map<String, Object> props) {
+ public JavaBeanWrapper(Object o, Map<Object, Object> props) {
wrappedObject = o;
properties = props;
}
- public Object getProperty(String expression) {
+ public Object getProperty(Object expression) {
return properties.get(expression);
}
- public Map<String, Object> getProperties() {
+ public Map<Object, Object> getProperties() {
return properties;
}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/MethodBindingExpression.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/MethodBindingExpression.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/MethodBindingExpression.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.model.impl.expressive;
import javax.el.ELContext;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/NullExpression.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/NullExpression.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/NullExpression.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.model.impl.expressive;
/**
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/ObjectWrapperFactory.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/ObjectWrapperFactory.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/ObjectWrapperFactory.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -22,6 +22,7 @@
package org.richfaces.model.impl.expressive;
import java.util.HashMap;
+import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
@@ -51,7 +52,10 @@
public Object convert(Object o);
}
+ private Object[] expressionKeys;
private Expression [] expressions;
+ private boolean isIdentityKeys = false;
+
private FacesContext context;
private String var;
private Object varValue;
@@ -68,7 +72,8 @@
SortField[] sortFields = sortOrder.getFields();
expressions = new Expression[sortFields.length];
-
+ expressionKeys = new Object[expressions.length];
+
for (int i = 0; i < sortFields.length; i++) {
final SortField field = sortFields[i];
final String name = field.getName();
@@ -85,6 +90,8 @@
expressions[i] = new SimplePropertyExpression(name, elContext, resolver);
}
+
+ expressionKeys[i] = name;
}
@@ -92,6 +99,7 @@
}
public ObjectWrapperFactory(FacesContext context, final String var, List<? extends
Field> sortOrder) {
+ this.isIdentityKeys = true;
this.context = context;
Application application = context.getApplication();
@@ -100,6 +108,7 @@
this.var = var;
expressions = new Expression[sortOrder.size()];
+ expressionKeys = new Object[expressions.length];
int i = 0;
for (Field field : sortOrder) {
@@ -125,7 +134,11 @@
} else {
throw new IllegalArgumentException();
}
- expressions[i++] = expression;
+
+ expressions[i] = expression;
+ expressionKeys[i] = elExpression;
+
+ i++;
}
}
@@ -182,11 +195,18 @@
}
public JavaBeanWrapper wrapObject(Object o) {
- Map<String, Object> props = new HashMap<String, Object>();
+ Map<Object, Object> props;
+
+ if (isIdentityKeys) {
+ props = new IdentityHashMap<Object, Object>();
+ } else {
+ props = new HashMap<Object, Object>();
+ }
+
for (int i = 0; i < expressions.length; i++) {
Expression expression = expressions[i];
- props.put(expression.getExpressionString(), expression.evaluate(o));
+ props.put(expressionKeys[i], expression.evaluate(o));
}
return new JavaBeanWrapper(o, props);
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/SimplePropertyExpression.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/SimplePropertyExpression.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/SimplePropertyExpression.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.model.impl.expressive;
import javax.el.ELContext;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/ValueBindingExpression.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/ValueBindingExpression.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/ValueBindingExpression.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.model.impl.expressive;
import java.util.Map;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanComparator.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanComparator.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanComparator.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.model.impl.expressive;
import java.util.Comparator;
@@ -44,9 +64,9 @@
if (p1 instanceof Comparable && p2 instanceof Comparable) {
result = ((Comparable<Object>) p1).compareTo(p2);
} else if (p1 == null && p2 != null) {
+ result = -1;
+ } else if (p2 == null && p1 != null) {
result = 1;
- } else if (p2 == null && p1 != null) {
- result = -1;
}
if (asc != null && !asc.booleanValue()) {
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanComparator2.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanComparator2.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanComparator2.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,12 +1,35 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.model.impl.expressive;
+import java.text.Collator;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import javax.el.Expression;
import org.richfaces.model.Ordering;
+import org.richfaces.model.SortField;
import org.richfaces.model.SortField2;
/**
@@ -18,13 +41,41 @@
*/
public final class WrappedBeanComparator2 implements Comparator<Object> {
+ private static final Comparator<String> defaultStringComparator = new
Comparator<String>() {
+
+ public int compare(String o1, String o2) {
+ return o1.compareToIgnoreCase(o2);
+ }
+
+ };
+
private final List<SortField2> sortFields;
+ private Locale currentLocale;
+
+ private Comparator<? super String> stringComparator;
+
public WrappedBeanComparator2(List<SortField2> sortFields) {
+ this(sortFields, null);
+ }
+
+ public WrappedBeanComparator2(List<SortField2> sortFields, Locale locale) {
super();
this.sortFields = sortFields;
+ this.currentLocale = locale;
}
+ private Comparator<? super String> createStringComparator() {
+ Comparator<? super String> comparator = null;
+ if (currentLocale != null) {
+ comparator = Collator.getInstance(currentLocale);
+ } else {
+ comparator = defaultStringComparator;
+ }
+
+ return comparator;
+ }
+
public int compare(Object o1, Object o2) {
return compare((JavaBeanWrapper) o1, (JavaBeanWrapper) o2);
}
@@ -36,21 +87,23 @@
for (Iterator<SortField2> iterator = sortFields.iterator(); iterator.hasNext()
&& result == 0;) {
SortField2 field = iterator.next();
Expression expression = field.getExpression();
- String prop = expression.getExpressionString();
Ordering ordering = field.getOrdering();
if (ordering != null) {
- Object p1 = w1.getProperty(prop);
- Object p2 = w2.getProperty(prop);
+ Object p1 = w1.getProperty(expression);
+ Object p2 = w2.getProperty(expression);
if (p1 == p2 && p1 instanceof Comparator) {
result = ((Comparator<Object>)p1).compare(w1.getWrappedObject(),
w2.getWrappedObject());
} else if (p1 instanceof String && p2 instanceof String) {
- result = ((String)p1).trim().compareToIgnoreCase(((String)p2).trim());
+ if (stringComparator == null) {
+ stringComparator = createStringComparator();
+ }
+ result = stringComparator.compare(((String)p1).trim(), ((String)p2).trim());
} else if (p1 instanceof Comparable && p2 instanceof Comparable) {
result = ((Comparable<Object>) p1).compareTo(p2);
} else if (p1 == null && p2 != null) {
+ result = -1;
+ } else if (p2 == null && p1 != null) {
result = 1;
- } else if (p2 == null && p1 != null) {
- result = -1;
}
if (ordering.equals(Ordering.DESCENDING)) {
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanFilter.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanFilter.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanFilter.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,9 +1,27 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.model.impl.expressive;
import java.util.List;
+import java.util.Locale;
import org.richfaces.model.ExtendedFilterField;
import org.richfaces.model.FilterField;
@@ -15,26 +33,32 @@
public class WrappedBeanFilter implements
org.richfaces.model.filter.Filter<JavaBeanWrapper>{
private final List<FilterField> filterFields;
+ private Locale currentLocale;
+
+ public WrappedBeanFilter(List<FilterField> filterFields) {
+ this(filterFields, null);
+ }
- public WrappedBeanFilter(List<FilterField> filterFields) {
+ public WrappedBeanFilter(List<FilterField> filterFields, Locale locale) {
this.filterFields = filterFields;
+ this.currentLocale = (locale != null ? locale : Locale.getDefault());
}
-
+
public boolean accept(JavaBeanWrapper wrapper) {
for (FilterField filterField : filterFields) {
if (filterField instanceof ExtendedFilterField) {
- Object property =
wrapper.getProperty(filterField.getExpression().getExpressionString());
+ Object property = wrapper.getProperty(filterField.getExpression());
String filterValue = ((ExtendedFilterField)filterField).getFilterValue();
if(filterValue != null) {
- filterValue = filterValue.trim().toUpperCase();
+ filterValue = filterValue.trim().toUpperCase(currentLocale);
if(filterValue.length() > 0) {
- if(property == null ||
!property.toString().trim().toUpperCase().startsWith(filterValue)) {
+ if(property == null ||
!property.toString().trim().toUpperCase(currentLocale).startsWith(filterValue)) {
return false;
}
}
}
} else {
- Object property =
wrapper.getProperty(filterField.getExpression().getExpressionString());
+ Object property = wrapper.getProperty(filterField.getExpression());
if(!((Boolean)property).booleanValue()) {
return false;
}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/CompositeRenderer.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/CompositeRenderer.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/CompositeRenderer.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -27,13 +27,10 @@
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import org.ajax4jsf.org.w3c.tidy.EntityTable;
import org.ajax4jsf.renderkit.AjaxChildrenRenderer;
import org.ajax4jsf.resource.InternetResource;
@@ -219,11 +216,6 @@
return (RendererContributor[]) renderers.toArray(new
RendererContributor[renderers.size()]);
}
- public void contributorDecodeCallback(UIComponent component, FacesContext context,
RendererContributor contributor,
- Object argument) {
-
- }
-
protected void addParameterEncoder(AttributeParametersEncoder encoder) {
parameterEncoders.add(encoder);
}
@@ -240,20 +232,4 @@
}
}
- protected String escapeHtmlEntities(CharSequence orig) {
- StringBuffer buff = new StringBuffer(orig);
- EntityTable defaultEntityTable = EntityTable.getDefaultEntityTable();
- Matcher matcher = Pattern.compile("\\&\\w+\\;").matcher(orig);
- int delta = 0;
- while (matcher.find()) {
- String name = matcher.group().substring(0, matcher.group().length() - 1);
- int code = defaultEntityTable.entityCode(name);
- if (0 != code) {
- String replacement = "&#" + code + ";";
- buff.replace(matcher.start() - delta, matcher.end() - delta, replacement);
- delta = delta + matcher.group().length() - replacement.length();
- }
- }
- return buff.toString();
- }
}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/Expression.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/Expression.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/Expression.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.renderkit;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/MacroDefinitionJSContentHandler.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/MacroDefinitionJSContentHandler.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/MacroDefinitionJSContentHandler.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.renderkit;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/ScriptOptions.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/ScriptOptions.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/ScriptOptions.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -19,16 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*
- * Copyright
- * Copyright (c) Exadel,Inc. 2006
- * All rights reserved.
- *
- * History
- * $Source:
/cvs/ezfaces/richfaces/common/src/main/java/org/richfaces/renderkit/ScriptOptions.java,v
$
- * $Revision: 1.1 $
- */
-
package org.richfaces.renderkit;
import java.util.HashMap;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/TemplateEncoderRendererBase.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/TemplateEncoderRendererBase.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/TemplateEncoderRendererBase.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.renderkit;
@@ -60,62 +77,66 @@
}
public void writeScriptBody(Writer writer, String string) throws IOException {
- Properties tidyProperties = new Properties();
- InputStream propertiesStream = null;
- try {
- propertiesStream = URLToStreamHelper.urlToStreamSafe(
- TidyXMLFilter.class.getResource("tidy.properties"));
- tidyProperties.load(propertiesStream);
- } finally {
- if (propertiesStream != null) {
- propertiesStream.close();
+ if (string != null) {
+ Properties tidyProperties = new Properties();
+ InputStream propertiesStream = null;
+ try {
+ propertiesStream = URLToStreamHelper.urlToStreamSafe(
+ TidyXMLFilter.class.getResource("tidy.properties"));
+ tidyProperties.load(propertiesStream);
+ } finally {
+ if (propertiesStream != null) {
+ propertiesStream.close();
+ }
}
- }
-
- TidyParser tidyParser = new TidyParser(tidyProperties);
- Document parsedHtml = tidyParser.parseHtmlByTidy(new StringReader(string), null);
-
- Element documentElement = null;
-
- if (parsedHtml != null) {
- documentElement = parsedHtml.getDocumentElement();
- }
-
- if (documentElement != null) {
- writer.write("[");
+
+ TidyParser tidyParser = new TidyParser(tidyProperties);
+ Document parsedHtml = tidyParser.parseHtmlByTidy(new StringReader(string), null);
+
+ Element documentElement = null;
- NodeList nodeList = documentElement.getChildNodes();
- Node bodyNode = nodeList.item(nodeList.getLength() - 1);
- NodeList bodyChildren = bodyNode.getChildNodes();
- int bodyChildrenLength = bodyChildren.getLength();
-
- try {
- Transformer transformer;
-
- TransformerFactory factory = getTransformerFactory();
+ if (parsedHtml != null) {
+ documentElement = parsedHtml.getDocumentElement();
+ }
+
+ if (documentElement != null) {
+ writer.write("[");
- synchronized (factory) {
- transformer = factory.newTransformer();
- }
-
- transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
- transformer.setOutputProperty(OutputKeys.METHOD, "xml");
-
- ContentHandler contentHandler = createContentHandler(writer);
- Result result = new SAXResult(contentHandler);
-
- for (int i = 0; i < bodyChildrenLength; i++) {
- if (i != 0) {
- writer.write(", ");
+ NodeList nodeList = documentElement.getChildNodes();
+ Node bodyNode = nodeList.item(nodeList.getLength() - 1);
+ NodeList bodyChildren = bodyNode.getChildNodes();
+ int bodyChildrenLength = bodyChildren.getLength();
+
+ try {
+ Transformer transformer;
+
+ TransformerFactory factory = getTransformerFactory();
+
+ synchronized (factory) {
+ transformer = factory.newTransformer();
}
- transformer.transform(new DOMSource(bodyChildren.item(i)), result);
+
+ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+ transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+
+ ContentHandler contentHandler = createContentHandler(writer);
+ Result result = new SAXResult(contentHandler);
+
+ for (int i = 0; i < bodyChildrenLength; i++) {
+ if (i != 0) {
+ writer.write(", ");
+ }
+ transformer.transform(new DOMSource(bodyChildren.item(i)), result);
+ }
+ } catch (TransformerException e) {
+ throw new IOException(e.getMessage());
}
- } catch (TransformerException e) {
- throw new IOException(e.getMessage());
+
+ writer.write("]");
+
+ } else {
+ writer.write(ScriptUtils.toScript(JSReference.NULL));
}
-
- writer.write("]");
-
} else {
writer.write(ScriptUtils.toScript(JSReference.NULL));
}
Copied:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/Base2WayGradient.java
(from rev 14238,
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/Base2WayGradient.java)
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/Base2WayGradient.java
(rev 0)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/Base2WayGradient.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -0,0 +1,218 @@
+/**
+ *
+ */
+package org.richfaces.renderkit.html;
+
+import java.awt.Dimension;
+import java.awt.GradientPaint;
+import java.awt.Graphics2D;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Rectangle2D;
+
+import org.richfaces.renderkit.html.BaseGradient;
+import org.richfaces.renderkit.html.images.GradientType;
+import org.richfaces.renderkit.html.images.GradientType.BiColor;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class Base2WayGradient extends BaseGradient {
+
+
+
+
+ /**
+ * @param horizontal
+ */
+ public Base2WayGradient(boolean horizontal) {
+ super(horizontal);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param width
+ * @param height
+ * @param horizontal
+ */
+ public Base2WayGradient(int width, int height, boolean horizontal) {
+ super(width, height, horizontal);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param width
+ * @param height
+ * @param gradientHeight
+ * @param horizontal
+ */
+ public Base2WayGradient(int width, int height, int gradientHeight,
+ boolean horizontal) {
+ super(width, height, gradientHeight, horizontal);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param width
+ * @param height
+ * @param gradientHeight
+ * @param baseColor
+ * @param gradientColor
+ * @param horizontal
+ */
+ public Base2WayGradient(int width, int height, int gradientHeight,
+ String baseColor, String gradientColor, boolean horizontal) {
+ super(width, height, gradientHeight, baseColor, gradientColor, horizontal);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param width
+ * @param height
+ * @param gradientHeight
+ * @param baseColor
+ * @param gradientColor
+ */
+ public Base2WayGradient(int width, int height, int gradientHeight,
+ String baseColor, String gradientColor) {
+ super(width, height, gradientHeight, baseColor, gradientColor);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param width
+ * @param height
+ * @param gradientHeight
+ */
+ public Base2WayGradient(int width, int height, int gradientHeight) {
+ super(width, height, gradientHeight);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param width
+ * @param height
+ * @param baseColor
+ * @param gradientColor
+ * @param horizontal
+ */
+ public Base2WayGradient(int width, int height, String baseColor,
+ String gradientColor, boolean horizontal) {
+ super(width, height, baseColor, gradientColor, horizontal);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param width
+ * @param height
+ * @param baseColor
+ * @param gradientColor
+ */
+ public Base2WayGradient(int width, int height, String baseColor,
+ String gradientColor) {
+ super(width, height, baseColor, gradientColor);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param width
+ * @param height
+ */
+ public Base2WayGradient(int width, int height) {
+ super(width, height);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param baseColor
+ * @param gradientColor
+ * @param horizontal
+ */
+ public Base2WayGradient(String baseColor, String gradientColor,
+ boolean horizontal) {
+ super(baseColor, gradientColor, horizontal);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param baseColor
+ * @param gradientColor
+ */
+ public Base2WayGradient(String baseColor, String gradientColor) {
+ super(baseColor, gradientColor);
+ // TODO Auto-generated constructor stub
+ }
+
+
+ protected void drawBackGradient(Graphics2D g2d, Rectangle2D rectangle, BiColor colors,
int height) {
+ if (colors != null) {
+ GradientPaint gragient = new GradientPaint(0,
(float)(rectangle.getHeight()-height), colors.getBottomColor(), 0, (float)
rectangle.getHeight(), colors.getTopColor());
+ g2d.setPaint(gragient);
+ g2d.fill(rectangle);
+ }
+ }
+
+
+ @Override
+ protected void paintGradient(Graphics2D g2d, Data data) {
+ Integer headerBackgroundColor = data.getHeaderBackgroundColor();
+ Integer headerGradientColor = data.getHeaderGradientColor();
+
+ if (headerBackgroundColor != null && headerGradientColor != null) {
+ BiColor biColor = new GradientType.BiColor(headerBackgroundColor,
headerGradientColor);
+
+ GradientType type = data.getGradientType();
+ BiColor firstLayer = type.getFirstLayerColors(biColor);
+ BiColor secondLayer = type.getSecondLayerColors(biColor);
+
+ Dimension dim = getDimensions(null, data);
+
+ if (isHorizontal()) {
+ //x -> y, y -> x
+ g2d.transform(new AffineTransform(0, 1, 1, 0, 0, 0));
+ dim.setSize(dim.height, dim.width);
+ }
+
+ int localGradientHeight = getGradientHeight();
+ if (localGradientHeight < 0) {
+ localGradientHeight = dim.height/2;
+ }
+
+ Rectangle2D rect = new Rectangle2D.Float(
+ 0,
+ 0,
+ dim.width,
+ localGradientHeight);
+
+ drawGradient(g2d, rect, firstLayer, localGradientHeight);
+
+ rect = new Rectangle2D.Float(
+ 0,
+ localGradientHeight,
+ dim.width,
+ dim.height);
+
+ drawBackGradient(g2d, rect, firstLayer, localGradientHeight);
+
+ int smallGradientHeight = localGradientHeight / 2;
+
+ rect = new Rectangle2D.Float(
+ 0,
+ 0,
+ dim.width,
+ smallGradientHeight);
+
+ drawGradient(g2d, rect, secondLayer, smallGradientHeight);
+
+ rect = new Rectangle2D.Float(
+ 0,
+ dim.height-smallGradientHeight,
+ dim.width,
+ dim.height);
+
+ drawBackGradient(g2d, rect, secondLayer, smallGradientHeight);
+ }
+ }
+
+
+}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -25,6 +25,7 @@
import java.awt.GradientPaint;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
+import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.io.Serializable;
@@ -50,12 +51,12 @@
*/
public class BaseGradient extends Java2Dresource {
- private int width;
- private int height;
- private int gradientHeight;
- private String baseColor;
- private String gradientColor;
- private boolean horizontal = false;
+ private final int width;
+ private final int height;
+ private final int gradientHeight;
+ private final String baseColor;
+ private final String gradientColor;
+ private final boolean horizontal;
public BaseGradient(int width, int height, int gradientHeight, String baseColor,
String gradientColor, boolean horizontal) {
super();
@@ -115,18 +116,46 @@
}
public Dimension getDimensions(FacesContext facesContext, Object data) {
- return new Dimension(width, height);
+ return new Dimension(width, height);
}
protected Dimension getDimensions(ResourceContext resourceContext) {
- return getDimensions(null, restoreData(resourceContext));
+ return new Dimension(width, height);
}
- private void drawGradient(Graphics2D g2d, Rectangle2D rectangle, BiColor colors, int
height) {
+ /**
+ * @return the gradientHeight
+ */
+ protected int getGradientHeight() {
+ return gradientHeight;
+ }
+
+ /**
+ * @return the baseColor
+ */
+ protected String getBaseColor() {
+ return baseColor;
+ }
+
+ /**
+ * @return the gradientColor
+ */
+ protected String getGradientColor() {
+ return gradientColor;
+ }
+
+ /**
+ * @return the horizontal
+ */
+ protected boolean isHorizontal() {
+ return horizontal;
+ }
+
+ protected void drawGradient(Graphics2D g2d, Shape shape, BiColor colors, int height) {
if (colors != null) {
GradientPaint gragient = new GradientPaint(0, 0, colors.getTopColor(), 0, height,
colors.getBottomColor());
g2d.setPaint(gragient);
- g2d.fill(rectangle);
+ g2d.fill(shape);
}
}
@@ -138,19 +167,28 @@
g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
g2d.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
- Data dataToStore = (Data) restoreData(resourceContext);
- if (dataToStore != null) {
- Integer headerBackgroundColor = dataToStore.getHeaderBackgroundColor();
- Integer headerGradientColor = dataToStore.getHeaderGradientColor();
+ Data data = (Data) restoreData(resourceContext);
+ if (data != null) {
+ paintGradient(g2d, data);
+ }
+ }
+ /**
+ * @param g2d
+ * @param data
+ */
+ protected void paintGradient(Graphics2D g2d, Data data) {
+ Integer headerBackgroundColor = data.getHeaderBackgroundColor();
+ Integer headerGradientColor = data.getHeaderGradientColor();
+
if (headerBackgroundColor != null && headerGradientColor != null) {
BiColor biColor = new GradientType.BiColor(headerBackgroundColor,
headerGradientColor);
- GradientType type = dataToStore.getGradientType();
+ GradientType type = data.getGradientType();
BiColor firstLayer = type.getFirstLayerColors(biColor);
BiColor secondLayer = type.getSecondLayerColors(biColor);
- Dimension dim = getDimensions(null, dataToStore);
+ Dimension dim = getDimensions(null, data);
if (horizontal) {
//x -> y, y -> x
@@ -182,7 +220,6 @@
drawGradient(g2d, rect, secondLayer, smallGradientHeight);
}
}
- }
protected void restoreData(Data data, Zipper2 zipper2) {
if (zipper2.hasMore()) {
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -25,6 +25,7 @@
import javax.faces.context.FacesContext;
+import org.ajax4jsf.resource.ResourceContext;
import org.ajax4jsf.util.HtmlDimensions;
import org.ajax4jsf.util.Zipper2;
import org.richfaces.renderkit.html.BaseGradient;
@@ -48,12 +49,22 @@
public Dimension getDimensions(FacesContext facesContext, Object data) {
Data data2 = (Data) data;
- if (data != null) {
+ if (data != null) {
return new Dimension(super.getDimensions(facesContext, data).width,
data2.getHeight());
} else {
return DIMENSION;
}
}
+
+ @Override
+ protected Dimension getDimensions(ResourceContext resourceContext) {
+ Data data = (Data) restoreData(resourceContext);
+ if (data != null) {
+ return new Dimension(super.getDimensions(resourceContext).width,
data.getHeight());
+ } else {
+ return DIMENSION;
+ }
+ }
protected final Integer getHeight(FacesContext context, String heightParamName) {
SkinFactory skinFactory = SkinFactory.getInstance();
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.renderkit.html.images;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxArrowImage.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxArrowImage.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxArrowImage.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.renderkit.html.images;
import java.awt.Color;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxArrowImageDisable.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxArrowImageDisable.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxArrowImageDisable.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.renderkit.html.images;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxButtonPressGradient.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxButtonPressGradient.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxButtonPressGradient.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.renderkit.html.images;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/EditIcon.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/EditIcon.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/EditIcon.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.renderkit.html.images;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/GradientType.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/GradientType.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/GradientType.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.renderkit.html.images;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SaveControlIcon.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SaveControlIcon.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SaveControlIcon.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.renderkit.html.images;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -24,6 +24,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.net.URL;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
@@ -198,12 +199,14 @@
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
if (contextClassLoader != null) {
try {
- Class<?> resourceClass = Class.forName(resourceName, true,
contextClassLoader);
- if (Resource.class.isAssignableFrom(resourceClass)) {
- resource = (Resource) resourceClass.newInstance();
-
- //TODO remove this?
- resource.setResourceName(resourceName);
+ //TODO resource marker extension name?
+ URL resourceMarkerUrl =
contextClassLoader.getResource(resourceName.replace('.', '/') +
".resource-marker");
+ if (resourceMarkerUrl != null) {
+ Class<?> resourceClass = Class.forName(resourceName, true,
contextClassLoader);
+ if (Resource.class.isAssignableFrom(resourceClass)) {
+ resource = (Resource) resourceClass.newInstance();
+ resource.setResourceName(resourceName);
+ }
}
} catch (ClassNotFoundException e1) {
// TODO Auto-generated catch block
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -24,7 +24,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
@@ -56,6 +55,7 @@
*/
public class SkinFactoryImpl extends SkinFactory {
+
/**
* Name of web application init parameter for current default
* {@link javax.faces.render.RenderKit } interaction. by default -
@@ -66,9 +66,11 @@
/**
* Resource Uri for properties file with default values of skin parameters.
*/
- private static final String DEFAULT_SKIN_PROPERTIES_RESOURCE =
"META-INF/skins/DEFAULT.skin.properties";
+ private static final String DEFAULT_SKIN_PATH =
"META-INF/skins/%s.skin.properties";
- private static final String DEFAULT_CONFIGURATION_RESOURCE =
"META-INF/skins/DEFAULT.configuration.properties";
+ private static final String USER_SKIN_PATH = "%s.skin.properties";
+
+ // private static final String DEFAULT_CONFIGURATION_RESOURCE =
"META-INF/skins/DEFAULT.configuration.properties";
/**
* Name of default skin . "DEFAULT" in this realisation.
*/
@@ -80,19 +82,22 @@
* user-defined.
*/
private static final String[] SKINS_PATHS = {
- "META-INF/skins/%s.skin.properties", "%s.skin.properties" };
- private static final String[] DEFAULT_SKIN_PATHS = { DEFAULT_SKIN_PROPERTIES_RESOURCE
};
+ DEFAULT_SKIN_PATH, USER_SKIN_PATH };
+ private static final String[] THEME_PATHS = {
+ "META-INF/themes/%s.theme.properties", "%s.theme.properties" };
+// private static final String[] DEFAULT_SKIN_PATHS = { DEFAULT_SKIN_PATH };
- private static final String[] CONFIGURATIONS_PATHS = {
- "META-INF/skins/%s.configuration.properties",
- "%s.configuration.properties" };
- private static final String[] DEFAULT_CONFIGURATION_PATHS = {
"META-INF/skins/DEFAULT.configuration.properties" };
+// private static final String[] CONFIGURATIONS_PATHS = {
+// "META-INF/skins/%s.configuration.properties",
+// "%s.configuration.properties" };
+// private static final String[] DEFAULT_CONFIGURATION_PATHS = {
"META-INF/skins/DEFAULT.configuration.properties" };
- private Map skins = Collections.synchronizedMap(new HashMap());
- private Map baseSkins = Collections.synchronizedMap(new HashMap());
- private Map sourceProperties = Collections.synchronizedMap(new HashMap());
+ private Map<String,Skin> skins = new HashMap<String,Skin>();
+ private Map<String,Skin> baseSkins = new HashMap<String,Skin>();
+ private Map<String,Properties> sourceProperties = new
HashMap<String,Properties>();
+ private Map<String,Theme> themes = new HashMap<String,Theme>();
- private Properties defaultSkinProperties = null;
+// private Properties defaultSkinProperties = null;
private String skinName = null;
private ValueExpression skinBinding = null;
private String baseSkinName = null;
@@ -108,25 +113,29 @@
throw new SkinNotFoundException(Messages
.getMessage(Messages.NULL_SKIN_NAME_ERROR));
}
+ Skin currentSkin = null;
// user binding return skin instance.
if (currentSkinOrName instanceof Skin) {
- return (Skin) currentSkinOrName;
- }
- String currentSkinName = currentSkinOrName.toString();
-
- Map skinsMap = (isBase ? baseSkins : skins);
- Skin currentSkin = (Skin) skinsMap.get(currentSkinName);
- // LAZY creation for skins, since, in case of EL expressions
- // for skin name, we don't can know all names of existing skins.
- if (currentSkin == null) {
- if (log.isDebugEnabled()) {
- log.debug(Messages.getMessage(Messages.CREATE_SKIN_INFO,
- currentSkinName));
+ currentSkin = (Skin) currentSkinOrName;
+ } else {
+ String currentSkinName = currentSkinOrName.toString();
+
+ Map<String, Skin> skinsMap = (isBase ? baseSkins : skins);
+ synchronized (skinsMap) {
+ currentSkin = (Skin) skinsMap.get(currentSkinName);
+ // LAZY creation for skins, since, in case of EL expressions
+ // for skin name, we don't can know all names of existing skins.
+ if (currentSkin == null) {
+ if (log.isDebugEnabled()) {
+ log.debug(Messages.getMessage(
+ Messages.CREATE_SKIN_INFO, currentSkinName));
+ }
+ currentSkin = buildSkin(facesContext, currentSkinName,
+ isBase);
+ skinsMap.put(currentSkinName, currentSkin);
+ }
}
- currentSkin = buildSkin(facesContext, currentSkinName, isBase);
- skinsMap.put(currentSkinName, currentSkin);
}
-
return currentSkin;
}
@@ -146,47 +155,14 @@
return getSkinByName(context, currentSkinOrName, true);
}
- protected Properties getDefaultSkinProperties() {
- if (defaultSkinProperties == null) {
- defaultSkinProperties = loadDefaultProperties(DEFAULT_SKIN_PROPERTIES_RESOURCE);
- }
- return defaultSkinProperties;
- }
+// protected Properties getDefaultSkinProperties() {
+// if (defaultSkinProperties == null) {
+// defaultSkinProperties = loadProperties(DEFAULT_SKIN_NAME,DEFAULT_SKIN_PATHS);
+// }
+// return defaultSkinProperties;
+// }
/**
- *
- */
- private Properties loadDefaultProperties(String path) {
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- Properties defaultProperties = new Properties();
- try {
- Enumeration properties = loader.getResources(path);
- while (properties.hasMoreElements()) {
- URL url = (URL) properties.nextElement();
- InputStream propertyStream = null;
- try {
- propertyStream = URLToStreamHelper.urlToStream(url);
- defaultProperties.load(propertyStream);
- } catch (IOException e) {
- // DO Nothing...
- log.info(Messages.getMessage(
- Messages.DEFAULT_PROPERTIES_NOT_FOUND_ERROR, path),
- e);
- continue;
- } finally {
- if (null != propertyStream) {
- propertyStream.close();
- }
- }
- }
- } catch (IOException e) {
- log.info(Messages.getMessage(
- Messages.DEFAULT_PROPERTIES_NOT_FOUND_ERROR, path), e);
- }
- return defaultProperties;
- }
-
- /**
* Calculate name for current skin. For EL init parameter store value
* binding for speed calculations.
*
@@ -238,14 +214,14 @@
} else {
skin = currentSkinName;
}
- }
- if (useBase) {
- baseSkinBinding = binding;
- baseSkinName = skin;
- } else {
- skinBinding = binding;
- skinName = skin;
+ if (useBase) {
+ baseSkinBinding = binding;
+ baseSkinName = skin;
+ } else {
+ skinBinding = binding;
+ skinName = skin;
+ }
}
// }
@@ -294,15 +270,16 @@
*/
protected Skin buildSkin(FacesContext context, String name, boolean isBase)
throws SkinNotFoundException {
-
- Map<Object, Object> skinParams = (Map<Object, Object>)
sourceProperties.get(name);
- if (skinParams == null) {
- skinParams = loadProperties(name, SKINS_PATHS);
- processProperties(context, skinParams);
- skinParams = Collections.unmodifiableMap(skinParams);
- sourceProperties.put(name, skinParams);
- }
-
+ Properties skinParams;
+ synchronized (sourceProperties) {
+ skinParams = sourceProperties.get(name);
+ if (skinParams == null) {
+ skinParams = loadProperties(name, SKINS_PATHS);
+ processProperties(context, skinParams);
+ // skinParams = Collections.unmodifiableMap(skinParams);
+ sourceProperties.put(name, skinParams);
+ }
+ }
BasicSkinImpl skinImpl;
if (DEFAULT_SKIN_NAME.equals(name)) {
skinImpl = new DefaultSkinImpl(skinParams);
@@ -323,45 +300,17 @@
* @throws FacesException
* @throws ReferenceSyntaxException
*/
- protected Map loadProperties(String name, String[] paths) throws SkinNotFoundException,
FacesException,
- ReferenceSyntaxException {
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ protected Properties loadProperties(String name, String[] paths) throws
SkinNotFoundException, FacesException {
+ ClassLoader loader = getClassLoader();
// Get properties for concrete skin.
Properties skinProperties = new Properties();
int loadedPropertiesCount = 0;
for (int i = 0; i < paths.length; i++) {
- try {
- String skinPropertiesLocation = paths[i].replaceAll("%s", name);
- Enumeration properties = loader
- .getResources(skinPropertiesLocation);
- while (properties.hasMoreElements()) {
- URL url = (URL) properties.nextElement();
- InputStream propertyStream = null;
- try {
- propertyStream = URLToStreamHelper.urlToStream(url);
- skinProperties.load(propertyStream);
- loadedPropertiesCount++;
- } catch (IOException e) {
- log.warn(Messages
- .getMessage(Messages.SKIN_PROPERTIES_IO_ERROR),
- e);
- continue;
- } finally {
- if (null != propertyStream) {
- propertyStream.close();
- }
- }
- }
- } catch (IOException e) {
- // Do nothing - we can only log error, and continue to load next
- // property.
- if (log.isInfoEnabled()) {
- log.info(Messages
- .getMessage(Messages.SKIN_PROPERTIES_IO_ERROR), e);
- }
+ String skinPropertiesLocation = paths[i].replaceAll("%s", name);
+ if(loadProperties(loader, skinProperties, skinPropertiesLocation)){
+ loadedPropertiesCount++;
}
}
- // TODO - read skin from property file in WEB-INF directory.
if (loadedPropertiesCount == 0) {
throw new SkinNotFoundException(Messages.getMessage(
Messages.SKIN_NOT_FOUND_ERROR, name));
@@ -369,4 +318,68 @@
return skinProperties;
}
+ /**
+ * @return
+ */
+ protected ClassLoader getClassLoader() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+
+ /**
+ * @param loader
+ * @param properties
+ * @param location
+ */
+ protected boolean loadProperties(ClassLoader loader, Properties properties,
+ String location) {
+ boolean loaded = false;
+ try {
+ Enumeration<URL> resources = loader
+ .getResources(location);
+ while (resources.hasMoreElements()) {
+ URL url = (URL) resources.nextElement();
+ InputStream propertyStream = null;
+ try {
+ propertyStream = URLToStreamHelper.urlToStream(url);
+ properties.load(propertyStream);
+ loaded=true;
+ } catch (IOException e) {
+ log.warn(Messages
+ .getMessage(Messages.SKIN_PROPERTIES_IO_ERROR),
+ e);
+ continue;
+ } finally {
+ if (null != propertyStream) {
+ propertyStream.close();
+ }
+ }
+ }
+ } catch (IOException e) {
+ // Do nothing - we can only log error, and continue to load next
+ // property.
+ if (log.isInfoEnabled()) {
+ log.info(Messages
+ .getMessage(Messages.SKIN_PROPERTIES_IO_ERROR), e);
+ }
+ }
+ return loaded;
+ }
+
+ @Override
+ public Theme getTheme(FacesContext facesContext, String name) {
+ Theme theme = themes.get(name);
+ if(null == theme){
+ Properties properties;
+ try {
+ properties = loadProperties(name, THEME_PATHS);
+ } catch (SkinNotFoundException e) {
+ throw new ThemeNotFoundException(Messages.getMessage(
+ Messages.THEME_NOT_FOUND_ERROR, name), e.getCause());
+ }
+ processProperties(facesContext, properties);
+ theme = new ThemeImpl(properties);
+ themes.put(name, theme);
+ }
+ return theme;
+ }
}
Copied: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/skin/ThemeImpl.java
(from rev 14238, trunk/framework/impl/src/main/java/org/richfaces/skin/ThemeImpl.java)
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/skin/ThemeImpl.java
(rev 0)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/skin/ThemeImpl.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -0,0 +1,59 @@
+/**
+ *
+ */
+package org.richfaces.skin;
+
+import java.util.Properties;
+
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class ThemeImpl implements Theme {
+
+ private final Properties themeProperties;
+
+ /**
+ * @param themeProperties
+ */
+ public ThemeImpl(Properties themeProperties) {
+ this.themeProperties = themeProperties;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.skin.Theme#getProperty(java.lang.String)
+ */
+ public Object getProperty(String name) {
+ Object property = themeProperties.get(name);
+ if (property instanceof ValueExpression) {
+ ValueExpression ve = (ValueExpression) property;
+ property = ve.getValue(FacesContext.getCurrentInstance().getELContext());
+ }
+ return property;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.skin.Theme#getRendererType()
+ */
+ public String getRendererType() {
+ return (String) getProperty("rendererType");
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.skin.Theme#getScript()
+ */
+ public String getScript() {
+ return (String) getProperty("script");
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.skin.Theme#getStyle()
+ */
+ public String getStyle() {
+ return (String) getProperty("styleSheet");
+ }
+
+}
Copied:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/CollectionsUtils.java
(from rev 14238,
trunk/framework/impl/src/main/java/org/richfaces/util/CollectionsUtils.java)
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/CollectionsUtils.java
(rev 0)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/CollectionsUtils.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -0,0 +1,67 @@
+/*
+ * $Id$
+ */
+
+
+package org.richfaces.util;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * <p class="changed_added_2_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class CollectionsUtils {
+
+ private CollectionsUtils() {
+ // this class contains static methods only.
+ }
+
+ public static <T> T[] ar(T...ts){
+ return ts;
+ }
+
+ public static <T> T[] ar(){
+ return null;
+ }
+
+ public static <T,V> ConstMap<T,V> map() {
+ return new ConstMap<T, V>();
+ }
+
+ public <T> Set<T> set(T...ts) {
+ LinkedHashSet<T> set = new LinkedHashSet<T>(ts.length);
+ for (T t : ts) {
+ set.add(t);
+ }
+ return Collections.unmodifiableSet(set);
+ }
+
+ public <T> List<T> list(T...ts) {
+ return Collections.unmodifiableList(Arrays.asList(ts));
+ }
+
+ @SuppressWarnings("serial")
+ public static class ConstMap<T,V> extends LinkedHashMap<T,V> {
+
+ public ConstMap() {
+ super(50, 1.0F);
+ }
+
+ public ConstMap<T, V> add(T key, V value) {
+ put(key, value);
+ return this;
+ }
+
+ public Map<T,V> fix() {
+ return Collections.unmodifiableMap(this);
+ }
+ }
+}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/ReferenceMap.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/ReferenceMap.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/ReferenceMap.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -37,123 +37,138 @@
public class ReferenceMap<K, V> implements Map<K, V> {
- private Map<K, ReferenceMapSoftReference<K, V>> map = new HashMap<K,
ReferenceMapSoftReference<K, V>>();
+ private Map<K, Reference<V>> map;
- private ReferenceQueue<V> queue = new ReferenceQueue<V>();
-
- private void purge() {
- Reference<? extends V> reference = null;
- while ((reference = queue.poll()) != null) {
- ReferenceMapSoftReference<?, ?> entry = (ReferenceMapSoftReference<?,
?>) reference;
- entry.clear();
- map.remove(entry.getKey());
+ private ReferenceQueue<V> queue = new ReferenceQueue<V>();
+
+ protected static class ReferenceMapSoftReference<K, V> extends
SoftReference<V> {
+ private K key;
+
+ public K getKey() {
+ return key;
+ }
+
+ public ReferenceMapSoftReference(K key, V value, ReferenceQueue<? super V> queue)
{
+ super(value, queue);
+ this.key = key;
+ }
+ }
+
+ public ReferenceMap() {
+ this(new HashMap<K, Reference<V>>());
}
- }
-
- public void clear() {
- map.clear();
- while (queue.poll() != null) {
- //release queue entries
+
+ public ReferenceMap(Map<K, Reference<V>> map) {
+ super();
+
+ this.map = map;
}
- }
-
- public boolean containsKey(Object key) {
- purge();
- return map.containsKey(key);
- }
+ private void purge() {
+ Reference<? extends V> reference = null;
+ while ((reference = queue.poll()) != null) {
+ ReferenceMapSoftReference<?, ?> entry = (ReferenceMapSoftReference<?, ?>)
reference;
+ entry.clear();
+ map.remove(entry.getKey());
+ }
+ }
- public boolean containsValue(Object value) {
- throw new UnsupportedOperationException();
- }
+ public void clear() {
+ map.clear();
+
+ Reference<? extends V> reference = null;
+ while ((reference = queue.poll()) != null) {
+ //release queue entries
+ reference.clear();
+ }
+ }
- public Set<java.util.Map.Entry<K, V>> entrySet() {
- throw new UnsupportedOperationException();
- }
+ public boolean containsKey(Object key) {
+ purge();
- public V get(Object key) {
- purge();
-
- ReferenceMapSoftReference<K,V> reference = map.get(key);
- if (reference != null) {
- return reference.get();
+ return map.containsKey(key);
}
-
- return null;
- }
- public boolean isEmpty() {
- purge();
-
- return map.isEmpty();
- }
+ public boolean containsValue(Object value) {
+ throw new UnsupportedOperationException();
+ }
- public Set<K> keySet() {
- purge();
-
- return map.keySet();
- }
+ public Set<java.util.Map.Entry<K, V>> entrySet() {
+ throw new UnsupportedOperationException();
+ }
- private V doPut(K key, V value) {
- ReferenceMapSoftReference<K,V> reference = map.put(key,
- new ReferenceMapSoftReference<K, V>(key, value, queue));
-
- if (reference != null) {
- return reference.get();
+ public V get(Object key) {
+ purge();
+
+ Reference<V> reference = map.get(key);
+ if (reference != null) {
+ return reference.get();
+ }
+
+ return null;
}
-
- return null;
- }
-
- public V put(K key, V value) {
- purge();
-
- return doPut(key, value);
- }
- public void putAll(Map<? extends K, ? extends V> t) {
- purge();
-
- for (Map.Entry<? extends K, ? extends V> entry: t.entrySet()) {
- doPut(entry.getKey(), entry.getValue());
+ public boolean isEmpty() {
+ purge();
+
+ return map.isEmpty();
}
- }
- public V remove(Object key) {
- purge();
-
- ReferenceMapSoftReference<K,V> reference = map.remove(key);
- if (reference != null) {
- return reference.get();
+ public Set<K> keySet() {
+ purge();
+
+ return map.keySet();
}
- return null;
- }
+ private V doPut(K key, V value) {
+ Reference<V> reference = map.put(key, new ReferenceMapSoftReference<K,
V>(key, value, queue));
- public int size() {
- purge();
+ if (reference != null) {
+ return reference.get();
+ }
+
+ return null;
+ }
+
+ public V put(K key, V value) {
+ purge();
+
+ V v = doPut(key, value);
- return map.size();
- }
+ purge();
+
+ return v;
+ }
- public Collection<V> values() {
- throw new UnsupportedOperationException();
- }
-}
+ public void putAll(Map<? extends K, ? extends V> t) {
+ purge();
-class ReferenceMapSoftReference<K, V> extends SoftReference<V> {
- private K key;
+ for (Map.Entry<? extends K, ? extends V> entry: t.entrySet()) {
+ doPut(entry.getKey(), entry.getValue());
+ }
+
+ purge();
+ }
- public K getKey() {
- return key;
- }
+ public V remove(Object key) {
+ purge();
- public ReferenceMapSoftReference(K key, V value) {
- this(key, value, null);
- }
+ Reference<V> reference = map.remove(key);
+ if (reference != null) {
+ return reference.get();
+ }
- public ReferenceMapSoftReference(K key, V value, ReferenceQueue<? super V>
queue) {
- super(value, queue);
- this.key = key;
- }
+ return null;
+ }
+
+ public int size() {
+ purge();
+
+ return map.size();
+ }
+
+ public Collection<V> values() {
+ throw new UnsupportedOperationException();
+ }
+
}
\ No newline at end of file
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/RenderPhaseComponentVisitorUtils.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/RenderPhaseComponentVisitorUtils.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/RenderPhaseComponentVisitorUtils.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.util;
import java.io.BufferedReader;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/webapp/taglib/MethodBindingMethodExpressionAdaptor.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/webapp/taglib/MethodBindingMethodExpressionAdaptor.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/webapp/taglib/MethodBindingMethodExpressionAdaptor.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.webapp.taglib;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/webapp/taglib/SimpleComponentTag.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/webapp/taglib/SimpleComponentTag.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/webapp/taglib/SimpleComponentTag.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.webapp.taglib;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/webapp/taglib/UIComponentELTagBase.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/webapp/taglib/UIComponentELTagBase.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/webapp/taglib/UIComponentELTagBase.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.webapp.taglib;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/webapp/taglib/ValueBindingValueExpressionAdaptor.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/webapp/taglib/ValueBindingValueExpressionAdaptor.java 2009-07-07
17:09:24 UTC (rev 14814)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/webapp/taglib/ValueBindingValueExpressionAdaptor.java 2009-07-07
17:19:37 UTC (rev 14815)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * 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.webapp.taglib;