JBoss Rich Faces SVN: r14805 - branches/community/3.3.X/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: atsebro
Date: 2009-07-07 08:28:28 -0400 (Tue, 07 Jul 2009)
New Revision: 14805
Modified:
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/commandLink.xml
Log:
RF-7480: a4j:htmlCommandLink component description review
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/commandLink.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/commandLink.xml 2009-07-07 12:27:25 UTC (rev 14804)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/commandLink.xml 2009-07-07 12:28:28 UTC (rev 14805)
@@ -65,17 +65,38 @@
<para>
The <emphasis role="bold"><property><a4j:commandLink></property></emphasis> component is used in the same way as JSF <emphasis role="bold"><property><h:commandLink></property></emphasis>.
The difference is that in case of <emphasis role="bold"><property><a4j:commandLink></property></emphasis> the components to be updated should be specified.
+ In this chapter we will use the code from <link linkend="RichFacesGreeterindex">RichFaces Greeter</link> and change there <emphasis role="bold"><property><a4j:commandButton></property></emphasis> to <emphasis role="bold"><property><a4j:commandLink></property></emphasis>:
</para>
+ <programlisting role="XML"><![CDATA[...
+<a4j:commandLink value="Get greeting" reRender="greeting" />
+...]]></programlisting>
+
<para>
+ It's not necessary to add nested <emphasis role="bold"><property><a4j:support></property></emphasis> as the <emphasis role="bold"><property><a4j:commandLink></property></emphasis> has an Ajax support already built-in.
+ As a result of our changes we will get a form with "Get greeting" link instead of the button:
+ </para>
+ <figure>
+ <title>
+ The RicjFaces greeter with <emphasis role="bold"><property><a4j:commandLink></property></emphasis>
+ </title>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/commandLink_init.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>
The example <link linkend="CL_example">above</link> generates the following HTML code:
</para>
- <programlisting role="XML"><![CDATA[<a href="#" onclick="A4J.AJAX.Submit(?"request parameters"); return false;"><span>Follow this link</span></a>]]></programlisting>
+ <programlisting role="XML"><![CDATA[<a href="#" onclick="A4J.AJAX.Submit(?"request parameters"); return false;"><span>Get greeting</span></a>]]></programlisting>
<para>
If you click on the generated anchor the utility method <code>A4J.AJAX.Submit()</code> will be fired.
- It's not necessary to add nested <emphasis role="bold"><property><a4j:support></property></emphasis> as the <emphasis role="bold"><property><a4j:commandLink></property></emphasis> has an Ajax support already built-in.
+
</para>
<note>
15 years, 5 months
JBoss Rich Faces SVN: r14804 - branches/community/3.3.X/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: atsebro
Date: 2009-07-07 08:27:25 -0400 (Tue, 07 Jul 2009)
New Revision: 14804
Modified:
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/mediaOutput.xml
Log:
RF-7427: a4j:mediaOutput component description review
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/mediaOutput.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/mediaOutput.xml 2009-07-07 10:42:08 UTC (rev 14803)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/mediaOutput.xml 2009-07-07 12:27:25 UTC (rev 14804)
@@ -42,7 +42,7 @@
<para>
<emphasis role="bold">Example:</emphasis>
</para>
- <programlisting role="XML"><![CDATA[<a4j:mediaOutput element="img" cacheable="false" session="true" createContent="#{paintBean.paint}" value="#{paintData}" mimeType="image/jpeg"/>]]></programlisting>
+ <programlisting role="XML"><![CDATA[<a4j:mediaOutput element="img" cacheable="false" session="true" createContent="#{paintBean.paint}" value="#{paintData}" mimeType="image/png"/>]]></programlisting>
</section>
<section>
15 years, 5 months
JBoss Rich Faces SVN: r14803 - in branches/jsf2.0/framework/api/src: main/java/org/ajax4jsf/cache and 20 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-07 06:42:08 -0400 (Tue, 07 Jul 2009)
New Revision: 14803
Added:
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/javascript/ResponseWriterWrapper.java
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/javascript/StringBuilderWriter.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/TreeAjaxEvent.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/TreeAjaxEventType.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/CacheableSwingTreeNodeImpl.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/CacheableTreeNodeImpl.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ComplexTreeRowKey.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/LocaleAware.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SelectionMode.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/StackingTreeModelKey.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/skin/Theme.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/skin/ThemeNotFoundException.java
branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript/
branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript/ResponseWriterWrapperTest.java
branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java
branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript/StringBuilderWriterTest.java
branches/jsf2.0/framework/api/src/test/java/org/richfaces/model/ScrollableTableDataRangeSerializationTest.java
Removed:
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/model/Queue.java
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/model/QueuesManager.java
branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/framework/util/javascript/ScriptUtilsTest.java
branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript/ResponseWriterWrapperTest.java
branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java
branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript/StringBuilderWriterTest.java
Modified:
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/Messages.java
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/Cache.java
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/CacheEntry.java
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/CacheException.java
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/CacheFactory.java
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/CacheListener.java
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/CacheLoader.java
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/component/IterationStateHolder.java
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/event/PushEventListener.java
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/javascript/JSEncoder.java
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/javascript/JSLiteral.java
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/model/KeepAlive.java
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/model/SequenceRange.java
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/renderkit/AjaxRenderer.java
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/renderkit/UserResourceRenderer.java
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/renderkit/UserResourceRenderer2.java
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/resource/ResourceContext.java
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/component/Filterable.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/component/ScriptExportable.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/component/Selectable.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/component/Sortable2.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/component/TemplateComponent.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/CurrentDateChangeEvent.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/DnDEvent.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/DragEvent.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/DropEvent.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/RenderPhaseComponentVisitor.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ChangeColumnVisibilityEvent.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ChangeColumnVisibilityListener.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ColumnResizeEvent.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ColumnResizeListener.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/DragDropEvent.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/DragDropListener.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ExtTableFilterEvent.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ExtTableFilterListener.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ExtTableSortEvent.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ExtTableSortListener.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/scroll/ScrollEvent.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/sort/SortEvent2.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/sort/SortListener2.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/AbstractTreeDataModel.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/CacheableTreeDataModel.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ClassicCacheableTreeDataModel.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/DataProvider.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ExtendedFilterField.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/Field.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/FilterField.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ListRowKey.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ListShuttleDataModel.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ListShuttleRowKey.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/MapDataModel.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/Modifiable.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/Ordering.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/OrderingListDataModel.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ScrollableTableDataModel.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ScrollableTableDataRange.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SequenceDataModel.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SortField.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SortField2.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SortOrder.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/StackingTreeModelDataProvider.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/StackingTreeModelProvider.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SwingCacheableTreeDataModel.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SwingTreeNodeImpl.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/TreeDataModel.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/TreeDataModelNodeAdaptor.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/TreeModelVisualComponentProvider.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/UploadItem.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/VisualStackingTreeModel.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/filter/Filter.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/selection/Selection.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/selection/SimpleSelection.java
branches/jsf2.0/framework/api/src/main/java/org/richfaces/skin/SkinFactory.java
Log:
Reintegrated community/3.3.x into JSF 2.0 branch
Modified: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/Messages.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/Messages.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/Messages.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -22,12 +22,39 @@
package org.ajax4jsf;
import java.text.MessageFormat;
+import java.util.Collections;
+import java.util.Enumeration;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
+import java.util.MissingResourceException;
import java.util.ResourceBundle;
public class Messages {
+ /**
+ * @author asmirnov
+ *
+ */
+ public static final class EmptyResourceBundle extends ResourceBundle {
+
+ /* (non-Javadoc)
+ * @see java.util.ResourceBundle#getKeys()
+ */
+ @Override
+ public Enumeration<String> getKeys() {
+ return Collections.enumeration(Collections.<String>emptyList());
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.ResourceBundle#handleGetObject(java.lang.String)
+ */
+ @Override
+ protected Object handleGetObject(String key) {
+ return null;
+ }
+
+ }
+
private static final String BUNDLE_NAME = "org.ajax4jsf.messages";
private static Map<ClassLoader, ResourceBundle> bundles = new HashMap<ClassLoader, ResourceBundle>();
@@ -36,7 +63,19 @@
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
ResourceBundle bundle = (ResourceBundle) bundles.get(contextClassLoader);
if (bundle == null) {
- bundle = ResourceBundle.getBundle(BUNDLE_NAME, Locale.getDefault(), contextClassLoader);
+ try {
+ bundle = ResourceBundle.getBundle(BUNDLE_NAME, Locale
+ .getDefault(), contextClassLoader);
+
+ } catch (MissingResourceException e) {
+ try {
+ bundle = ResourceBundle.getBundle(BUNDLE_NAME, Locale
+ .getDefault(), Messages.class.getClassLoader());
+
+ } catch (MissingResourceException e2) {
+ bundle = new EmptyResourceBundle();
+ }
+ }
bundles.put(contextClassLoader, bundle);
}
@@ -249,6 +288,7 @@
public static final String DEFAULT_PROPERTIES_NOT_FOUND_ERROR = "DEFAULT_PROPERTIES_NOT_FOUND_ERROR";
public static final String SKIN_PROPERTIES_IO_ERROR = "SKIN_PROPERTIES_IO_ERROR";
public static final String SKIN_NOT_FOUND_ERROR = "SKIN_NOT_FOUND_ERROR";
+ public static final String THEME_NOT_FOUND_ERROR = "THEME_NOT_FOUND_ERROR";
public static final String ACESSING_SKIN_PROPERTY_AS_ARRAY_ERROR = "ACESSING_SKIN_PROPERTY_AS_ARRAY_ERROR";
public static final String ACESSING_SKIN_PROPERTY_ERROR = "ACESSING_SKIN_PROPERTY_ERROR";
public static final String SKIN_PROPERTIES_READ_ONLY_ERROR = "SKIN_PROPERTIES_READ_ONLY_ERROR";
@@ -324,7 +364,8 @@
public static final String INVALID_VALUE = "INVALID_VALUE";
public static final String DATASCROLLER_PAGE_MISSING = "DATASCROLLER_PAGE_MISSING";
public static final String DATASCROLLER_PAGES_DIFFERENT = "DATASCROLLER_PAGES_DIFFERENT";
-
+ public static final String COMPONENT_CONVERSION_ERROR = "COMPONENT_CONVERSION_ERROR";
+
public static void main(String[] args) {
String m = getMessage(INVALID_ATTRIBUTE_VALUE, "A", "B");
System.out.println(m);
Modified: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/Cache.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/Cache.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/Cache.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,3 +1,19 @@
+/*
+ * Copyright [yyyy] [name of copyright owner].
+ *
+ * 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.cache;
import java.util.Collection;
Modified: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/CacheEntry.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/CacheEntry.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/CacheEntry.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,3 +1,19 @@
+/*
+ * Copyright [yyyy] [name of copyright owner].
+ *
+ * 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.cache;
import java.util.Map;
Modified: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/CacheException.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/CacheException.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/CacheException.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,3 +1,19 @@
+/*
+ * Copyright [yyyy] [name of copyright owner].
+ *
+ * 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.cache;
Modified: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/CacheFactory.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/CacheFactory.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/CacheFactory.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,3 +1,19 @@
+/*
+ * Copyright [yyyy] [name of copyright owner].
+ *
+ * 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.cache;
import java.util.Map;
Modified: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/CacheListener.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/CacheListener.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/CacheListener.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,3 +1,19 @@
+/*
+ * Copyright [yyyy] [name of copyright owner].
+ *
+ * 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.cache;
/** Interface describing various events that can happen as elements are added to
Modified: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/CacheLoader.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/CacheLoader.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/cache/CacheLoader.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,3 +1,19 @@
+/*
+ * Copyright [yyyy] [name of copyright owner].
+ *
+ * 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.cache;
Modified: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -216,4 +216,14 @@
*/
public abstract String getFocus();
+ /**
+ *
+ */
+ public abstract void setSimilarityGroupingId(String similarityGroupingId);
+
+ /**
+ *
+ */
+ public abstract String getSimilarityGroupingId();
+
}
\ No newline at end of file
Modified: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/component/IterationStateHolder.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/component/IterationStateHolder.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/component/IterationStateHolder.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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.component;
@@ -21,8 +38,10 @@
public Object getIterationState();
/**
- * Restore component state from previsious saved value.
- * @param state request-scope component state. Details are subject for a component implementation
+ * Set component state for the next iteration. State can be either previously saved iteration state
+ * or <code>null</code> value. In the second case component should reset its state to the initial.
+ * @param state request-scope component state or <code>null</code>. Details are subject for a component
+ * implementation
*/
public void setIterationState( Object state);
Modified: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/event/PushEventListener.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/event/PushEventListener.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/event/PushEventListener.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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.event;
import java.util.EventListener;
Modified: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/javascript/JSEncoder.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/javascript/JSEncoder.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/javascript/JSEncoder.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -74,6 +74,10 @@
(c == 0x5c) || // [\]
(c == 0x03) || // [esc]
(c == ']') || // ] - to avoid conflicts in CDATA
+ (c == '<') || // - escape HTML markup characters
+ (c == '>') || // - HTML
+ (c == '&') || // - HTML
+ (c == '-') || // - HTML comments
(c < 0x20) || // See <http://www.w3.org/TR/REC-xml#charsets>
((c > 0xd7ff) && (c < 0xe000)) || (c > 0xfffd)|| (c > 0xff)) {
return (false);
Modified: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/javascript/JSLiteral.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/javascript/JSLiteral.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/javascript/JSLiteral.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,7 +1,22 @@
-/*
- * JSLiteral.java Date created: 29.01.2008
- * 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.javascript;
Copied: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/javascript/ResponseWriterWrapper.java (from rev 14799, branches/community/3.3.X/framework/api/src/main/java/org/ajax4jsf/javascript/ResponseWriterWrapper.java)
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/javascript/ResponseWriterWrapper.java (rev 0)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/javascript/ResponseWriterWrapper.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -0,0 +1,88 @@
+/**
+ * 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.javascript;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import javax.faces.context.ResponseWriter;
+
+final class ResponseWriterWrapper extends Writer {
+
+ private static final int BUFFER_SIZE = 1024;
+
+ private final ResponseWriter responseWriter;
+
+ private char[] writeBuffer;
+
+ ResponseWriterWrapper(ResponseWriter responseWriter) {
+ this.responseWriter = responseWriter;
+ }
+
+ @Override
+ public void close() throws IOException {
+ responseWriter.close();
+ }
+
+ @Override
+ public void flush() throws IOException {
+ responseWriter.flush();
+ }
+
+ @Override
+ public void write(char[] cbuf, int off, int len) throws IOException {
+ responseWriter.writeText(cbuf, off, len);
+ }
+
+ @Override
+ public void write(String str) throws IOException {
+ responseWriter.writeText(str, null);
+ }
+
+ @Override
+ public void write(String str, int off, int len) throws IOException {
+ char cbuf[];
+ if (len <= BUFFER_SIZE) {
+ if (writeBuffer == null) {
+ writeBuffer = new char[BUFFER_SIZE];
+ }
+
+ cbuf = writeBuffer;
+ } else {
+ cbuf = new char[len];
+ }
+
+ str.getChars(off, off + len, cbuf, 0);
+
+ responseWriter.writeText(cbuf, 0, len);
+ }
+
+ @Override
+ public void write(int c) throws IOException {
+ if (writeBuffer == null){
+ writeBuffer = new char[BUFFER_SIZE];
+ }
+ writeBuffer[0] = (char) c;
+
+ responseWriter.writeText(writeBuffer, 0, 1);
+ }
+}
\ No newline at end of file
Modified: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -22,13 +22,16 @@
package org.ajax4jsf.javascript;
import java.beans.PropertyDescriptor;
+import java.io.IOException;
import java.io.UnsupportedEncodingException;
+import java.io.Writer;
import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import javax.faces.FacesException;
+import javax.faces.context.ResponseWriter;
import org.apache.commons.beanutils.PropertyUtils;
@@ -46,122 +49,197 @@
}
- /**
- * Convert any Java Object to JavaScript representation ( as possible ).
- * @param obj
- * @return
- */
- public static String toScript(Object obj) {
+ private static void writeScriptToStream(Writer writer, Object obj) throws IOException {
if (null == obj) {
- return "null";
+ writer.write("null");
} else if (obj instanceof ScriptString) {
- return ((ScriptString) obj).toScript();
+ writer.write(((ScriptString) obj).toScript());
} else if (obj.getClass().isArray()) {
- StringBuilder ret = new StringBuilder("[");
+ writer.write("[");
boolean first = true;
for (int i = 0; i < Array.getLength(obj); i++) {
Object element = Array.get(obj, i);
if (!first) {
- ret.append(',');
+ writer.write(',');
}
- ret.append(toScript(element));
+ writeScriptToStream(writer, element);
first = false;
}
- return ret.append("] ").toString();
+
+ writer.write("] ");
} else if (obj instanceof Collection) {
// Collections put as JavaScript array.
-
@SuppressWarnings("unchecked")
Collection<Object> collection = (Collection<Object>) obj;
-
- StringBuilder ret = new StringBuilder("[");
+ writer.write("[");
boolean first = true;
for (Iterator<Object> iter = collection.iterator(); iter.hasNext();) {
Object element = iter.next();
if (!first) {
- ret.append(',');
+ writer.write(',');
}
- ret.append(toScript(element));
+ writeScriptToStream(writer, element);
first = false;
}
- return ret.append("] ").toString();
+ writer.write("] ");
} else if (obj instanceof Map) {
// Maps put as JavaScript hash.
@SuppressWarnings("unchecked")
Map<Object, Object> map = (Map<Object, Object>) obj;
- StringBuilder ret = new StringBuilder("{");
+ writer.write("{");
boolean first = true;
- for (Iterator<Map.Entry<Object, Object>> iter = map.entrySet().iterator(); iter.hasNext();) {
- Map.Entry<Object, Object> entry = iter.next();
+ for (Map.Entry<Object, Object> entry : map.entrySet()) {
if (!first) {
- ret.append(',');
+ writer.write(',');
}
- addEncodedString(ret, entry.getKey());
- ret.append(":");
- ret.append(toScript(entry.getValue()));
+ writeEncodedString(writer, entry.getKey());
+ writer.write(":");
+ writeScriptToStream(writer, entry.getValue());
first = false;
}
- return ret.append("} ").toString();
+ writer.write("} ");
} else if (obj instanceof Number || obj instanceof Boolean) {
// numbers and boolean put as-is, without conversion
- return obj.toString();
+ writer.write(obj.toString());
} else if (obj instanceof String) {
// all other put as encoded strings.
- StringBuilder ret = new StringBuilder();
- addEncodedString(ret, obj);
- return ret.toString();
- }
- // All other objects threaded as Java Beans.
+ writeEncodedString(writer, obj);
+ } else if (obj instanceof Enum) {
+ // all other put as encoded strings.
+ writeEncodedString(writer, obj);
+ } else if (obj.getClass().getName().startsWith("java.sql.")) {
+ writer.write("{");
+ boolean first = true;
+ for (PropertyDescriptor propertyDescriptor :
+ PropertyUtils.getPropertyDescriptors(obj)) {
+ String key = propertyDescriptor.getName();
+ if ("class".equals(key)) {
+ continue;
+ }
+ Object value = null;
+ try {
+ value = PropertyUtils.getProperty(obj, key);
+ } catch (Exception e) {
+ continue;
+ }
+
+ if (!first) {
+ writer.write(',');
+ }
+
+ writeEncodedString(writer, key);
+ writer.write(":");
+ writeScriptToStream(writer, value);
+
+ first = false;
+ }
+ writer.write("} ");
+ } else {
+ // All other objects threaded as Java Beans.
+ writer.write("{");
+
+ PropertyDescriptor[] propertyDescriptors;
+ try {
+ propertyDescriptors = PropertyUtils.getPropertyDescriptors(obj);
+ } catch (Exception e) {
+ throw new FacesException(
+ "Error in conversion Java Object to JavaScript", e);
+ }
+
+ boolean first = true;
+ for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
+ String key = propertyDescriptor.getName();
+ if ("class".equals(key)) {
+ continue;
+ }
+ if (!first) {
+ writer.write(',');
+ }
+ writeEncodedString(writer, key);
+ writer.write(":");
+
+ Object propertyValue;
+ try{
+ propertyValue = PropertyUtils.getProperty(obj, key);
+ } catch (Exception e) {
+ throw new FacesException(
+ "Error in conversion Java Object to JavaScript", e);
+ }
+
+ writeScriptToStream(writer, propertyValue);
+ first = false;
+ }
+
+ writer.write("} ");
+ }
+ }
+
+ /**
+ * Convert any Java Object to JavaScript representation ( as possible ) and write it to
+ * writer immediately
+ *
+ * @param responseWriter
+ * @param obj
+ * @throws IOException
+ */
+ public static void writeToStream(final ResponseWriter responseWriter, Object obj) throws IOException {
+ writeScriptToStream(new ResponseWriterWrapper(responseWriter), obj);
+ }
+
+ /**
+ * Convert any Java Object to JavaScript representation ( as possible ).
+ * @param obj
+ * @return
+ */
+ public static String toScript(Object obj) {
+ StringBuilder sb = new StringBuilder();
try {
- StringBuilder ret = new StringBuilder("{");
- PropertyDescriptor[] propertyDescriptors = PropertyUtils
- .getPropertyDescriptors(obj);
- boolean first = true;
- for (int i = 0; i < propertyDescriptors.length; i++) {
- PropertyDescriptor propertyDescriptor = propertyDescriptors[i];
- String key = propertyDescriptor.getName();
- if ("class".equals(key)) {
- continue;
- }
- if (!first) {
- ret.append(',');
- }
- addEncodedString(ret, key);
- ret.append(":");
- ret.append(toScript(PropertyUtils.getProperty(obj, key)));
- first = false;
- }
- return ret.append("} ").toString();
- } catch (Exception e) {
- throw new FacesException(
- "Error in conversion Java Object to JavaScript", e);
+ writeScriptToStream(new StringBuilderWriter(sb), obj);
+ } catch (IOException e) {
+ //ignore
}
+ return sb.toString();
}
+ public static void writeEncodedString(Writer w, Object obj) throws IOException {
+ w.write("'");
+ writeEncoded(w, obj);
+ w.write("'");
+ }
+
public static void addEncodedString(StringBuilder buff, Object obj) {
- buff.append("'");
- addEncoded(buff, obj);
- buff.append("'");
-
+ try {
+ writeEncodedString(new StringBuilderWriter(buff), obj);
+ } catch (IOException e) {
+ //ignore
+ }
}
- public static void addEncoded(StringBuilder buff, Object obj) {
+ public static void writeEncoded(Writer w, Object obj) throws IOException {
JSEncoder encoder = new JSEncoder();
char chars[] = obj.toString().toCharArray();
for (int i = 0; i < chars.length; i++) {
char c = chars[i];
if (!encoder.compile(c)) {
- buff.append(encoder.encode(c));
+ w.write(encoder.encode(c));
} else {
- buff.append(c);
+ w.write(c);
}
}
}
+
+ public static void addEncoded(StringBuilder buff, Object obj) {
+ try {
+ writeEncoded(new StringBuilderWriter(buff), obj);
+ } catch (IOException e) {
+ //ignore
+ }
+ }
public static String getValidJavascriptName(String s) {
Copied: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/javascript/StringBuilderWriter.java (from rev 14799, branches/community/3.3.X/framework/api/src/main/java/org/ajax4jsf/javascript/StringBuilderWriter.java)
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/javascript/StringBuilderWriter.java (rev 0)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/javascript/StringBuilderWriter.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -0,0 +1,84 @@
+/**
+ * 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.javascript;
+
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.2
+ */
+final class StringBuilderWriter extends Writer {
+
+ private StringBuilder builder;
+
+ public StringBuilderWriter(StringBuilder builder) {
+ super();
+ this.builder = builder;
+ }
+
+ /**
+ * Closing this writer doesn't have any effect
+ */
+ @Override
+ public void close() throws IOException {
+ //do nothing
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.Writer#flush()
+ */
+ @Override
+ public void flush() throws IOException {
+ //do nothing
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.Writer#write(char[], int, int)
+ */
+ @Override
+ public void write(char[] cbuf, int off, int len) throws IOException {
+ builder.append(cbuf, off, len);
+ }
+
+ @Override
+ public void write(char[] cbuf) throws IOException {
+ builder.append(cbuf);
+ }
+
+ @Override
+ public void write(String str) throws IOException {
+ builder.append(str);
+ }
+
+ @Override
+ public void write(String str, int off, int len) throws IOException {
+ builder.append(str, off, off + len);
+ }
+
+ @Override
+ public void write(int c) throws IOException {
+ builder.append((char) c);
+ }
+
+}
Modified: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/model/KeepAlive.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/model/KeepAlive.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/model/KeepAlive.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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.model;
Deleted: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/model/Queue.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/model/Queue.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/model/Queue.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,21 +0,0 @@
-/**
- *
- */
-package org.ajax4jsf.model;
-
-/**
- * @author Konstantin Mishin
- *
- */
-public interface Queue {
-
- String getName();
-
- Integer getRequestDelay();
-
- Integer getTimeout();
-
- Boolean getLimitToList();
-
- Boolean getIgnoreDupResponses();
-}
Deleted: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/model/QueuesManager.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/model/QueuesManager.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/model/QueuesManager.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,56 +0,0 @@
-package org.ajax4jsf.model;
-
-import java.util.Map;
-
-import javax.faces.context.FacesContext;
-
-/**
- * @author Konstantin Mishin
- *
- */
-public class QueuesManager {
-
- static private final String MAP_KEY_PREFIX = QueuesManager.class.getSimpleName();
-
- static public void put(Queue queue, FacesContext context) throws IllegalArgumentException{
- if (context == null) {
- context = FacesContext.getCurrentInstance();
- }
- String name = queue.getName();
- String key = MAP_KEY_PREFIX + name;
- Map<String, Object> attributes = context.getViewRoot().getAttributes();
- if (!attributes.containsKey(key)) {
- attributes.put(key, queue);
- } else {
- throw new IllegalArgumentException("Queue whis name '" + name + "' has already been used");
- }
- }
-
- static public void put(Queue queue) throws IllegalArgumentException {
- put(queue, null);
- }
-
- static public Queue get(String name, FacesContext context) {
- if (context == null) {
- context = FacesContext.getCurrentInstance();
- }
- Object object = context.getViewRoot().getAttributes().get(MAP_KEY_PREFIX + name);
- return (Queue)object;
- }
-
- static public Queue get(String name) {
- return get(name, null);
- }
-
- static public Queue remove(String name, FacesContext context) {
- if (context == null) {
- context = FacesContext.getCurrentInstance();
- }
- Object object = context.getViewRoot().getAttributes().remove(MAP_KEY_PREFIX + name);
- return (Queue)object;
- }
-
- static public Queue remove(String name) {
- return remove(name, null);
- }
-}
Modified: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/model/SequenceRange.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/model/SequenceRange.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/model/SequenceRange.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -46,6 +46,13 @@
}
/**
+ *
+ */
+ protected SequenceRange() {
+ super();
+ }
+
+ /**
* @param firstRow
* @param rows
*/
@@ -55,4 +62,12 @@
this.rows = rows;
}
+ protected void setFirstRow(int firstRow) {
+ this.firstRow = firstRow;
+ }
+
+ protected void setRows(int rows) {
+ this.rows = rows;
+ }
+
}
Modified: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/renderkit/AjaxRenderer.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/renderkit/AjaxRenderer.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/renderkit/AjaxRenderer.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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.renderkit;
import java.io.IOException;
Modified: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/renderkit/UserResourceRenderer.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/renderkit/UserResourceRenderer.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/renderkit/UserResourceRenderer.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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.renderkit;
import java.util.LinkedHashSet;
Modified: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/renderkit/UserResourceRenderer2.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/renderkit/UserResourceRenderer2.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/renderkit/UserResourceRenderer2.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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.renderkit;
import java.io.IOException;
Modified: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/resource/ResourceContext.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/resource/ResourceContext.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/resource/ResourceContext.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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;
/**
* Abstraction context class for rendering resource ( image, script, style )
@@ -90,8 +93,78 @@
*/
public abstract Object getSessionAttribute(String name);
- public abstract InputStream getResourceAsStream(String path);
+ /**
+ * Get ServletContext attribute by name.
+ * @param name
+ * @return value for attribute, or null.
+ */
+ public abstract Object getContextAttribute(String name);
+ /**
+ * <p>Return a <code>URL</code> for the application resource mapped to the
+ * specified path, if it exists; otherwise, return <code>null</code>.</p>
+ *
+ * <p><em>Servlet:</em> This must be the value returned by the
+ * <code>javax.servlet.ServletContext</code> method
+ * <code>getResource(path)</code>.</p>
+ *
+ * <p><em>Portlet:</em> This must be the value returned by the
+ * <code>javax.portlet.PortletContext</code> method
+ * <code>getResource(path)</code>.</p>
+ *
+ * @param path The path to the requested resource, which must
+ * start with a slash ("/" character
+ *
+ * @throws MalformedURLException if the specified path
+ * is not in the correct form
+ * @throws NullPointerException if <code>path</code>
+ * is <code>null</code>
+ */
+ public abstract URL getResource(String path) throws MalformedURLException;
+
+
+ /**
+ * <p>Return an <code>InputStream</code> for an application resource
+ * mapped to the specified path, if it exists; otherwise, return
+ * <code>null</code>.</p>
+ *
+ * <p><em>Servlet:</em> This must be the value returned by the
+ * <code>javax.servlet.ServletContext</code> method
+ * <code>getResourceAsStream(path)</code>.</p>
+ *
+ * <p><em>Portlet:</em> This must be the value returned by the
+ * <code>javax.portlet.PortletContext</code> method
+ * <code>getResourceAsStream(path)</code>.</p>
+ *
+ * @param path The path to the requested resource, which must
+ * start with a slash ("/" character
+ *
+ * @throws NullPointerException if <code>path</code>
+ * is <code>null</code>
+ */
+ public abstract InputStream getResourceAsStream(String path);
+
+
+ /**
+ * <p>Return the <code>Set</code> of resource paths for all application
+ * resources whose resource path starts with the specified argument.</p>
+ *
+ * <p><em>Servlet:</em> This must be the value returned by the
+ * <code>javax.servlet.ServletContext</code> method
+ * <code>getResourcePaths(path).</code></p>
+ *
+ * <p><em>Portlet:</em> This must be the value returned by the
+ * <code>javax.portlet.PortletContext</code> method
+ * <code>getResourcePaths(path).</code></p>
+ *
+ * @param path Partial path used to match resources, which must
+ * start with a slash ("/") character
+ *
+ * @throws NullPointerException if <code>path</code>
+ * is <code>null</code>
+ */
+ public abstract Set<String> getResourcePaths(String path);
+
/**
* Get request parameter for given name.
* @param data_parameter
Modified: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -69,6 +69,12 @@
}
}
+ /**
+ * Variant of {@link #urlToStream(URL)} method that doesn't throw IOException, but silently ignores them
+ *
+ * @param url
+ * @return
+ */
public static final InputStream urlToStreamSafe(URL url) {
try {
return urlToStream(url);
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/component/Filterable.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/component/Filterable.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/component/Filterable.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/component/ScriptExportable.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/component/ScriptExportable.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/component/ScriptExportable.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/component/Selectable.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/component/Selectable.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/component/Selectable.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/component/Sortable2.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/component/Sortable2.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/component/Sortable2.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/component/TemplateComponent.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/component/TemplateComponent.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/component/TemplateComponent.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/CurrentDateChangeEvent.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/CurrentDateChangeEvent.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/CurrentDateChangeEvent.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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.Date;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/DnDEvent.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/DnDEvent.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/DnDEvent.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -23,7 +23,6 @@
import javax.faces.component.UIComponent;
import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
/**
*
@@ -44,25 +43,4 @@
super(component);
}
- protected Object value;
-
- private boolean valid = true;
-
- public boolean isAppropriateListener(FacesListener listener) {
- return valid;
- }
-
- public void invalidate() {
- valid = false;
- }
-
- public boolean isValid() {
- return valid;
- }
-
- public void processListener(FacesListener listener) {
- if (!valid) {
- throw new IllegalStateException();
- }
- }
}
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/DragEvent.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/DragEvent.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/DragEvent.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -36,6 +36,7 @@
private Dropzone dropTarget;
private Object acceptedTypes;
+ private Object dropValue;
/**
*
*/
@@ -49,14 +50,13 @@
* @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
*/
public boolean isAppropriateListener(FacesListener faceslistener) {
- return super.isAppropriateListener(faceslistener) && faceslistener instanceof DragListener;
+ return faceslistener instanceof DragListener;
}
/* (non-Javadoc)
* @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
*/
public void processListener(FacesListener faceslistener) {
- super.processListener(faceslistener);
((DragListener) faceslistener).processDrag(this);
}
@@ -93,10 +93,10 @@
}
public Object getDropValue() {
- return value;
+ return dropValue;
}
public void setDropValue(Object dropValue) {
- this.value = dropValue;
+ this.dropValue = dropValue;
}
}
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/DropEvent.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/DropEvent.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/DropEvent.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -40,6 +40,7 @@
private Draggable draggableSource;
private String dragType;
+ private Object dragValue;
public DropEvent(UIComponent component) {
super(component);
@@ -49,14 +50,13 @@
* @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
*/
public boolean isAppropriateListener(FacesListener listener) {
- return super.isAppropriateListener(listener) && listener instanceof DropListener;
+ return listener instanceof DropListener;
}
/* (non-Javadoc)
* @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
*/
public void processListener(FacesListener listener) {
- super.processListener(listener);
((DropListener) listener).processDrop(this);
}
@@ -98,10 +98,10 @@
}
public Object getDragValue() {
- return value;
+ return dragValue;
}
public void setDragValue(Object dragValue) {
- this.value = dragValue;
+ this.dragValue = dragValue;
}
}
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/RenderPhaseComponentVisitor.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/RenderPhaseComponentVisitor.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/RenderPhaseComponentVisitor.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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 javax.faces.component.UIComponent;
Copied: branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/TreeAjaxEvent.java (from rev 14238, trunk/framework/api/src/main/java/org/richfaces/event/TreeAjaxEvent.java)
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/TreeAjaxEvent.java (rev 0)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/TreeAjaxEvent.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -0,0 +1,55 @@
+/**
+ * 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.event;
+
+import javax.faces.component.UIComponent;
+
+import org.ajax4jsf.event.AjaxEvent;
+
+/**
+ * Event send by tree component in case of AJAX of action (node expansion/collapsion or selection).
+ * Contains data to distinguish between different action types in order to support different re-rendering
+ * behaviors for particular actions.
+ *
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+
+public class TreeAjaxEvent extends AjaxEvent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -2410803626536767706L;
+
+ private TreeAjaxEventType eventType;
+
+ public TreeAjaxEvent(UIComponent component, TreeAjaxEventType eventType) {
+ super(component);
+
+ this.eventType = eventType;
+ }
+
+ public TreeAjaxEventType getEventType() {
+ return eventType;
+ }
+}
Copied: branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/TreeAjaxEventType.java (from rev 14238, trunk/framework/api/src/main/java/org/richfaces/event/TreeAjaxEventType.java)
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/TreeAjaxEventType.java (rev 0)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/TreeAjaxEventType.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -0,0 +1,33 @@
+/**
+ * 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.event;
+
+/**
+ * Types enumeration for possible tree actions to be used in {@link TreeAjaxEvent}
+ *
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+
+public enum TreeAjaxEventType {
+ EXPANSION, SELECTION
+}
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ChangeColumnVisibilityEvent.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ChangeColumnVisibilityEvent.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ChangeColumnVisibilityEvent.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,6 +1,24 @@
/**
- *
- */
+* 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.event.extdt;
import javax.faces.component.UIComponent;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ChangeColumnVisibilityListener.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ChangeColumnVisibilityListener.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ChangeColumnVisibilityListener.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,6 +1,24 @@
/**
- *
- */
+* 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.event.extdt;
import javax.faces.event.FacesListener;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ColumnResizeEvent.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ColumnResizeEvent.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ColumnResizeEvent.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,6 +1,24 @@
/**
- *
- */
+* 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.event.extdt;
import javax.faces.component.UIComponent;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ColumnResizeListener.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ColumnResizeListener.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ColumnResizeListener.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,6 +1,24 @@
/**
- *
- */
+* 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.event.extdt;
import javax.faces.event.FacesListener;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/DragDropEvent.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/DragDropEvent.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/DragDropEvent.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,6 +1,24 @@
/**
- *
- */
+* 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.event.extdt;
import javax.faces.component.UIComponent;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/DragDropListener.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/DragDropListener.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/DragDropListener.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,6 +1,24 @@
/**
- *
- */
+* 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.event.extdt;
import javax.faces.event.FacesListener;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ExtTableFilterEvent.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ExtTableFilterEvent.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ExtTableFilterEvent.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,6 +1,24 @@
/**
- *
- */
+* 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.event.extdt;
import javax.faces.component.UIComponent;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ExtTableFilterListener.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ExtTableFilterListener.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ExtTableFilterListener.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,6 +1,24 @@
/**
- *
- */
+* 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.event.extdt;
import javax.faces.event.FacesListener;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ExtTableSortEvent.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ExtTableSortEvent.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ExtTableSortEvent.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,6 +1,24 @@
/**
- *
- */
+* 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.event.extdt;
import javax.faces.component.UIComponent;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ExtTableSortListener.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ExtTableSortListener.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/extdt/ExtTableSortListener.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,6 +1,24 @@
/**
- *
- */
+* 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.event.extdt;
import javax.faces.event.FacesListener;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/scroll/ScrollEvent.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/scroll/ScrollEvent.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/scroll/ScrollEvent.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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.event.scroll;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/sort/SortEvent2.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/sort/SortEvent2.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/sort/SortEvent2.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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.event.sort;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/sort/SortListener2.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/sort/SortListener2.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/event/sort/SortListener2.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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.sort;
import javax.faces.event.FacesListener;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/AbstractTreeDataModel.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/AbstractTreeDataModel.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/AbstractTreeDataModel.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -162,6 +162,10 @@
return ((TreeRowKey) key).getParentKey();
}
+ public void addNode(Object parentRowKey, Object newNode, Object id) {
+ throw new UnsupportedOperationException();
+ }
+
public void addNode(Object parentRowKey, TreeNode newNode, Object id) {
throw new UnsupportedOperationException();
}
Copied: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/CacheableSwingTreeNodeImpl.java (from rev 14238, trunk/framework/api/src/main/java/org/richfaces/model/CacheableSwingTreeNodeImpl.java)
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/CacheableSwingTreeNodeImpl.java (rev 0)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/CacheableSwingTreeNodeImpl.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -0,0 +1,43 @@
+/**
+ * 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.model;
+
+/**
+ * This class provides the solution for "false leaves" issue of cacheable trees
+ *
+ * @author Nick Belaevski
+ * @since 3.3.1
+ */
+
+public class CacheableSwingTreeNodeImpl extends SwingTreeNodeImpl {
+
+ private boolean notLeaf = false;
+
+ @Override
+ public boolean isLeaf() {
+ return !this.notLeaf && super.isLeaf();
+ }
+
+ public void setNotLeaf(boolean notLeaf) {
+ this.notLeaf = notLeaf;
+ }
+}
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/CacheableTreeDataModel.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/CacheableTreeDataModel.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/CacheableTreeDataModel.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -43,11 +43,9 @@
private Log log = LogFactory.getLog(CacheableTreeDataModel.class);
- private final class Visitor implements DataVisitor, LastElementAware {
- private final DataVisitor visitor;
+ private final class CacheFillingVisitor implements DataVisitor {
- private Visitor(DataVisitor visitor) {
- this.visitor = visitor;
+ private CacheFillingVisitor() {
}
public void process(FacesContext context, Object rowKey, Object argument)
@@ -55,25 +53,8 @@
TreeRowKey treeRowKey = (TreeRowKey) rowKey;
treeDataModel.setRowKey(treeRowKey);
setDefaultNodeData(locateTreeNode(treeRowKey, true), treeDataModel.getRowData());
-
- if (visitor != null) {
- visitor.process(context, rowKey, argument);
- }
}
- public void resetLastElement() {
- if (visitor instanceof LastElementAware) {
- ((LastElementAware) visitor).resetLastElement();
-
- }
- }
-
- public void setLastElement() {
- if (visitor instanceof LastElementAware) {
- ((LastElementAware) visitor).setLastElement();
-
- }
- }
}
private final static DataVisitor NULL_VISITOR = new DataVisitor() {
@@ -110,7 +91,7 @@
public void walkModel(FacesContext context, DataVisitor visitor,
Range range, Object key, Object argument, boolean last)
throws IOException {
- treeDataModel.walkModel(context, new Visitor(visitor), range, key,
+ treeDataModel.walkModel(context, visitor, range, key,
argument, last);
}
@@ -132,11 +113,11 @@
if (treeNode != null) {
if (cachedTreeNode == null || (nodeAdaptor.isLeaf(cachedTreeNode) && !nodeAdaptor.isLeaf(treeNode))) {
//fill cache
- treeDataModel.walk(context, new Visitor(dataVisitor), range,
+ treeDataModel.walk(context, new CacheFillingVisitor(), range,
rowKey, argument, last);
- } else {
- super.walk(context, dataVisitor, range, rowKey, argument, last);
}
+
+ super.walk(context, dataVisitor, range, rowKey, argument, last);
}
}
@@ -242,4 +223,4 @@
return node;
}
-}
+}
\ No newline at end of file
Copied: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/CacheableTreeNodeImpl.java (from rev 14238, trunk/framework/api/src/main/java/org/richfaces/model/CacheableTreeNodeImpl.java)
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/CacheableTreeNodeImpl.java (rev 0)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/CacheableTreeNodeImpl.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -0,0 +1,48 @@
+/**
+ * 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.model;
+
+/**
+ * This class provides the solution for "false leaves" issue of cacheable trees
+ *
+ * @author Nick Belaevski
+ * @since 3.3.1
+ */
+
+public class CacheableTreeNodeImpl<T> extends TreeNodeImpl<T> {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -5918388225735277820L;
+
+ private boolean notLeaf = false;
+
+ @Override
+ public boolean isLeaf() {
+ return !this.notLeaf && super.isLeaf();
+ }
+
+ public void setNotLeaf(boolean notLeaf) {
+ this.notLeaf = notLeaf;
+ }
+}
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ClassicCacheableTreeDataModel.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ClassicCacheableTreeDataModel.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ClassicCacheableTreeDataModel.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -37,7 +37,7 @@
public TreeNode handleMissingNode(TreeNode parentNode,
Object pathSegment) {
- TreeNode childNode = new TreeNodeImpl();
+ TreeNodeImpl childNode = new CacheableTreeNodeImpl();
if (parentNode != null) {
parentNode.addChild(pathSegment, childNode);
@@ -55,7 +55,9 @@
@Override
protected void setDefaultNodeData(TreeNode node, Object data) {
if (node != null) {
- ((TreeNodeImpl) node).setData(data);
+ CacheableTreeNodeImpl cacheableTreeNode = (CacheableTreeNodeImpl) node;
+ cacheableTreeNode.setData(data);
+ cacheableTreeNode.setNotLeaf(!isLeaf());
}
}
Copied: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ComplexTreeRowKey.java (from rev 14238, trunk/framework/api/src/main/java/org/richfaces/model/ComplexTreeRowKey.java)
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ComplexTreeRowKey.java (rev 0)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ComplexTreeRowKey.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -0,0 +1,36 @@
+/**
+ * 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.model;
+
+/**
+ * Marks complex tree row keys containing several segments
+ *
+ * @author Nick Belaevski
+ * @since 3.3.1
+ */
+
+public interface ComplexTreeRowKey {
+
+ public int getKeySegmentsCount();
+
+ public Object getKeySegment(int i);
+}
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/DataProvider.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/DataProvider.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/DataProvider.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,16 +1,34 @@
/**
- *
- */
+* 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.Serializable;
import java.util.List;
/**
- * G3DataProvider is an interface that defines methods for manage loading data.<br>
+ * DataProvider is an interface that defines methods for manage loading data.<br>
* Usage:
* <pre>
- * G3DataProvider<SomeDataType> dataProvider = new G3DataProvider<SomeDataType>();
+ * DataProvider<SomeDataType> dataProvider = new DataProvider<SomeDataType>();
* </pre>
* @author pawelgo
*
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ExtendedFilterField.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ExtendedFilterField.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ExtendedFilterField.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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/api/src/main/java/org/richfaces/model/Field.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/Field.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/Field.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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/api/src/main/java/org/richfaces/model/FilterField.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/FilterField.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/FilterField.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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/api/src/main/java/org/richfaces/model/ListRowKey.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ListRowKey.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ListRowKey.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -97,25 +97,26 @@
}
/**
- * List constructor
- * @param list List of strings to create corresponding row key from
- */
- public ListRowKey(List<T> list) {
- super();
-
- this.path = new ArrayList<T>(list);
- }
-
- /**
* Path object constructor
* @param path first path segment
+ * @deprecated
*/
public ListRowKey(T path) {
super();
this.path = new ArrayList<T>(1);
this.path.add(path);
}
+
+ /**
+ * List constructor
+ * @param list List of strings to create corresponding row key from
+ */
+ public ListRowKey(List<T> list) {
+ super();
+ this.path = new ArrayList<T>(list);
+ }
+
public int depth() {
return path.size();
}
@@ -190,18 +191,21 @@
boolean hasNext = iterator.hasNext();
while (hasNext) {
- T segment = iterator.next();
- if (segment instanceof CompositeKey) {
- CompositeKey compositeKey = (CompositeKey) segment;
- Iterator keySegments = compositeKey.getKeySegments();
- while (keySegments.hasNext()) {
- appendSegment(result, keySegments.next().toString());
- if (keySegments.hasNext()) {
- result.append(AbstractTreeDataModel.SEPARATOR);
+ T segment = iterator.next();
+
+ if (segment instanceof ComplexTreeRowKey) {
+ ComplexTreeRowKey complexKey = (ComplexTreeRowKey) segment;
+
+ int segmentsCount = complexKey.getKeySegmentsCount();
+ for (int i = 0; i < segmentsCount; i++) {
+ appendSegment(result, complexKey.getKeySegment(i).toString());
+ if (i < segmentsCount - 1) {
+ result.append(AbstractTreeDataModel.SEPARATOR);
+ }
}
- }
+
} else {
- appendSegment(result, segment.toString());
+ appendSegment(result, segment.toString());
}
hasNext = iterator.hasNext();
@@ -243,10 +247,6 @@
return split;
}
- public static interface CompositeKey {
- public Iterator getKeySegments();
- }
-
public static void main(String[] args) {
System.out.println(Arrays.toString(fromString("test_:abc:123:a__b")));
}
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ListShuttleDataModel.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ListShuttleDataModel.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ListShuttleDataModel.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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/api/src/main/java/org/richfaces/model/ListShuttleRowKey.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ListShuttleRowKey.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ListShuttleRowKey.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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;
Copied: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/LocaleAware.java (from rev 14238, trunk/framework/api/src/main/java/org/richfaces/model/LocaleAware.java)
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/LocaleAware.java (rev 0)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/LocaleAware.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -0,0 +1,38 @@
+/**
+ * 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.model;
+
+import java.util.Locale;
+
+/**
+ * Models that are based on locale-dependent operations should implement this interface
+ *
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+
+public interface LocaleAware {
+
+ public Locale getLocale();
+
+ public void setLocale(Locale locale);
+}
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/MapDataModel.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/MapDataModel.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/MapDataModel.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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/api/src/main/java/org/richfaces/model/Modifiable.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/Modifiable.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/Modifiable.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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/api/src/main/java/org/richfaces/model/Ordering.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/Ordering.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/Ordering.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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;
/**
*
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/OrderingListDataModel.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/OrderingListDataModel.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/OrderingListDataModel.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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/api/src/main/java/org/richfaces/model/ScrollableTableDataModel.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ScrollableTableDataModel.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ScrollableTableDataModel.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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;
@@ -37,6 +54,8 @@
public static class SimpleRowKey extends Number implements Serializable{
private static final long serialVersionUID = 1L;
+
+ public static final String PREFIX = "srk";
private int i;
public SimpleRowKey(int i) {
@@ -49,7 +68,7 @@
}
public String toString() {
- return String.valueOf(i);
+ return PREFIX + String.valueOf(i);
}
public int hashCode() {
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ScrollableTableDataRange.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ScrollableTableDataRange.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/ScrollableTableDataRange.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -10,27 +10,28 @@
package org.richfaces.model;
+import java.io.IOException;
import java.io.Serializable;
-import org.ajax4jsf.model.Range;
+import org.ajax4jsf.model.SequenceRange;
/**
* Iteration range for Scrollable Grid
* @author Maksim Kaszynski
* @modified by Anton Belevich
*/
-public class ScrollableTableDataRange implements Range, Serializable{
+public class ScrollableTableDataRange extends SequenceRange implements Serializable{
private static final long serialVersionUID = -6675002421400464892L;
- private int first = 0;
- private int last = 0;
private SortOrder sortOrder;
+ public ScrollableTableDataRange() {
+ super();
+ }
+
public ScrollableTableDataRange(int first, int last, SortOrder sortOrder) {
- super();
- this.first = first;
- this.last = last;
+ super(first, last > 0 ? last - first : -1);
this.sortOrder = sortOrder;
}
@@ -38,25 +39,25 @@
* @return the bufferSize
*/
public int getLast() {
- return last;
+ return getFirstRow() + getRows();
}
/**
* @param bufferSize the bufferSize to set
*/
public void setLast(int lastRow) {
- this.last = lastRow;
+ setRows(lastRow > 0 ? lastRow - getFirstRow() : -1);
}
/**
* @return the first
*/
public int getFirst() {
- return first;
+ return getFirstRow();
}
/**
* @param first the first to set
*/
public void setFirst(int first) {
- this.first = first;
+ setFirstRow(first);
}
public SortOrder getSortOrder() {
@@ -66,27 +67,55 @@
public void setSortOrder(SortOrder sortOrder) {
this.sortOrder = sortOrder;
}
-
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + getFirstRow();
+ result = prime * result + getRows();
+ result = prime * result
+ + ((sortOrder == null) ? 0 : sortOrder.hashCode());
+ return result;
+ }
+
+ @Override
public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ScrollableTableDataRange other = (ScrollableTableDataRange) obj;
+ if (getFirstRow() != other.getFirstRow())
+ return false;
+ if (getRows() != other.getRows())
+ return false;
+ if (sortOrder == null) {
+ if (other.sortOrder != null)
+ return false;
+ } else if (!sortOrder.equals(other.sortOrder))
+ return false;
+ return true;
+ }
- if(!(obj instanceof ScrollableTableDataRange)){
- return super.equals(obj);
- }
+ private void writeObject(java.io.ObjectOutputStream out)
+ throws IOException {
- ScrollableTableDataRange ref = (ScrollableTableDataRange)obj;
-
- boolean ret = (this.first == ref.first)&&(this.last == ref.last );
-
- if(this.sortOrder != null){
- ret = ret && this.sortOrder.equals(ref.sortOrder);
- } else {
- ret = (ret && (ref.sortOrder == null));
- }
-
- return ret;
- }
-
- public int hashCode() {
- return super.hashCode();
- }
+ out.defaultWriteObject();
+
+ out.writeInt(getFirstRow());
+ out.writeInt(getRows());
+ }
+
+ private void readObject(java.io.ObjectInputStream in)
+ throws IOException, ClassNotFoundException {
+
+ in.defaultReadObject();
+
+ setFirstRow(in.readInt());
+ setRows(in.readInt());
+ }
+
}
Copied: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SelectionMode.java (from rev 14238, trunk/framework/api/src/main/java/org/richfaces/model/SelectionMode.java)
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SelectionMode.java (rev 0)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SelectionMode.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -0,0 +1,36 @@
+/**
+ * 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;
+/**
+ *
+ * @author Konstantin Mishin
+ *
+ */
+public enum SelectionMode {
+ none,
+ single,
+ multi;
+
+ public boolean isSelectionEnabled() {
+ return !equals(none);
+ }
+
+}
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SequenceDataModel.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SequenceDataModel.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SequenceDataModel.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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/api/src/main/java/org/richfaces/model/SortField.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SortField.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SortField.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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/api/src/main/java/org/richfaces/model/SortField2.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SortField2.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SortField2.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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/api/src/main/java/org/richfaces/model/SortOrder.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SortOrder.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SortOrder.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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;
import java.io.Serializable;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,17 +1,32 @@
/**
- *
+ * 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;
import java.io.IOException;
-import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import java.util.NoSuchElementException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -22,7 +37,6 @@
import org.ajax4jsf.model.Range;
import org.apache.commons.collections.Predicate;
import org.apache.commons.collections.iterators.FilterIterator;
-import org.richfaces.model.ListRowKey.CompositeKey;
import org.w3c.dom.NamedNodeMap;
/**
@@ -124,7 +138,7 @@
}
}
- protected StackingTreeModel doSetupKey(Iterator<Key> keyIterator, Iterator<StackEntry> entriesIterator, FacesContext context, Object modelKey) {
+ protected StackingTreeModel doSetupKey(Iterator<StackingTreeModelKey> keyIterator, Iterator<StackEntry> entriesIterator, FacesContext context, Object modelKey) {
if (modelKey != null) {
if (!setupModel(modelKey, context)) {
//no key is available
@@ -136,7 +150,7 @@
}
if (keyIterator != null && keyIterator.hasNext()) {
- Key key = keyIterator.next();
+ StackingTreeModelKey key = keyIterator.next();
StackingTreeModel stackingTreeModel = this.getInternalModelById(key.modelId);
Iterator<StackEntry> nextEntriesIterator = null;
Object nextModelKey = key.modelKey;
@@ -169,9 +183,9 @@
return (stackEntries.getLast()).model;
}
} else {
- Iterator<Key> keyIterator = null;
+ Iterator<StackingTreeModelKey> keyIterator = null;
if (key != null) {
- keyIterator = ((ListRowKey<Key>) key).iterator();
+ keyIterator = ((ListRowKey<StackingTreeModelKey>) key).iterator();
}
StackingTreeModel model = doSetupKey(keyIterator, stackEntries.iterator(), context, null);
@@ -194,7 +208,7 @@
private Object setupVariable(Object variable, FacesContext context) {
if (var != null) {
- Map map = context.getExternalContext().getRequestMap();
+ Map<String, Object> map = context.getExternalContext().getRequestMap();
return map.put(var, variable);
}
@@ -244,8 +258,8 @@
public boolean isLeaf() {
if (isRowAvailable()) {
StackEntry lastEntry = (StackEntry) stackEntries.getLast();
- for (Iterator iterator = lastEntry.model.getInternalModelsIterator(); iterator.hasNext();) {
- StackingTreeModel stackingTreeModel = (StackingTreeModel) iterator.next();
+ for (Iterator<StackingTreeModel> iterator = lastEntry.model.getInternalModelsIterator(); iterator.hasNext();) {
+ StackingTreeModel stackingTreeModel = iterator.next();
if (!stackingTreeModel.isEmpty()) {
return false;
@@ -274,22 +288,30 @@
TreeRange treeRange = (TreeRange) range;
if (treeRange == null || treeRange.processNode(argumentKey)) {
+ StackingTreeModel rootModel = getRoot();
+
if (argumentKey != null) {
- getRoot().setRowKey(argumentKey);
processElement(context, dataVisitor, argument, argumentKey, last);
- getRoot().setRowKey(argumentKey);
- } else {
- getRoot().setRowKey(argumentKey);
}
-
+
final ShiftingDataVisitor shiftingDataVisitor = new ShiftingDataVisitor(
new Visitor1(dataVisitor));
if (treeRange == null || treeRange.processChildren(argumentKey)) {
- Iterator iterator = this.getInternalModelsIterator();
+
+ Object savedRowKey = rootModel.getRowKey();
+ //setup key in order for nested components to initialize data models
+ rootModel.setRowKey(context, argumentKey);
+ Iterator<StackingTreeModel> iterator = this.getInternalModelsIterator();
+ rootModel.setRowKey(context, savedRowKey);
+
while (iterator.hasNext()) {
- final StackingTreeModel model = (StackingTreeModel) iterator.next();
+ final StackingTreeModel model = iterator.next();
+
+ savedRowKey = rootModel.getRowKey();
+ rootModel.setRowKey(context, argumentKey);
final ExtendedDataModel scalarModel = model.getDataModel();
+ rootModel.setRowKey(context, savedRowKey);
Argument argument2 = new Argument();
argument2.listRowKey = argumentKey;
@@ -340,28 +362,30 @@
return (StackingTreeModel) models.get(id);
}
- private Iterator getInternalModelsIterator() {
+ private Iterator<StackingTreeModel> getInternalModelsIterator() {
return new FilterIterator(getModelsIterator(), ACTIVE_MODEL_PREDICATE);
}
- public Iterator getModelsIterator() {
+ public Iterator<StackingTreeModel> getModelsIterator() {
return models.values().iterator();
}
public void walk(FacesContext context, DataVisitor dataVisitor,
Range range, Object rowKey, Object argument,
boolean last) throws IOException {
-
+ StackingTreeModel rootModel = getRoot();
+
if (rowKey != null) {
ListRowKey listRowKey = (ListRowKey) rowKey;
- StackingTreeModel treeModel = getRoot().setupKey(listRowKey, context);
+ StackingTreeModel treeModel = rootModel.setupKey(listRowKey, context);
treeModel.doWalk(context, dataVisitor, range, listRowKey, argument,
last);
} else {
- doWalk(context, dataVisitor, range, (ListRowKey) rowKey, argument, last);
+ doWalk(context, dataVisitor, range,
+ (ListRowKey) rowKey, argument, last);
}
}
@@ -385,7 +409,7 @@
throws IOException {
Argument a = (Argument) argument;
- ListRowKey listRowKey = new ListRowKey(a.listRowKey, new Key(
+ ListRowKey listRowKey = new ListRowKey(a.listRowKey, new StackingTreeModelKey(
a.model.id, rowKey));
//System.out.println(".walk() " + (theLast ? " * " : "") + listRowKey);
@@ -466,9 +490,13 @@
}
public void setRowKey(Object key) {
- setupKey(key, FacesContext.getCurrentInstance());
+ setRowKey(FacesContext.getCurrentInstance(), key);
}
+ public void setRowKey(FacesContext context, Object key) {
+ setupKey(key, context);
+ }
+
public void addStackingModel(StackingTreeModel model) {
this.models.put(model.id, model);
model.setParent(this);
@@ -507,158 +535,6 @@
return parent;
}
- /**
- * That is intended for internal use
- *
- * @author Nick Belaevski
- */
- protected static class Key implements Serializable, CompositeKey {
- /**
- *
- */
- private static final long serialVersionUID = -6821854350257816571L;
- protected Object modelKey;
- protected String modelId;
-
- public Key(String modelId, Object modelKey) {
- super();
- this.modelId = modelId;
- this.modelKey = modelKey;
- }
-
- public String toString() {
- return this.modelId + ":" + this.modelKey;
- }
-
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result
- + ((modelId == null) ? 0 : modelId.hashCode());
- result = prime * result
- + ((modelKey == null) ? 0 : modelKey.hashCode());
- return result;
- }
-
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- final Key other = (Key) obj;
- if (modelId == null) {
- if (other.modelId != null)
- return false;
- } else if (!modelId.equals(other.modelId))
- return false;
- if (modelKey == null) {
- if (other.modelKey != null)
- return false;
- } else if (!modelKey.equals(other.modelKey))
- return false;
- return true;
- }
-
- static enum IteratorState {
- INITIAL {
- @Override
- protected boolean hasNext(Key arg0) {
- return true;
- }
-
- @Override
- protected Object next(Key arg0) {
- throw new IllegalStateException();
- }
-
- @Override
- protected IteratorState nextState() {
- return ID;
- }
- },
-
- ID {
- @Override
- protected boolean hasNext(Key arg0) {
- return true;
- }
-
- @Override
- protected Object next(Key arg0) {
- return arg0.modelId;
- }
-
- @Override
- protected IteratorState nextState() {
- return KEY;
- }
- },
-
- KEY {
- @Override
- protected boolean hasNext(Key arg0) {
- return false;
- }
-
- @Override
- protected Object next(Key arg0) {
- return arg0.modelKey;
- }
-
- @Override
- protected IteratorState nextState() {
- return DONE;
- }
- },
-
- DONE {
- @Override
- protected boolean hasNext(Key arg0) {
- return false;
- }
-
- @Override
- protected Object next(Key arg0) {
- throw new NoSuchElementException();
- }
-
- @Override
- protected IteratorState nextState() {
- return DONE;
- }
- };
-
- protected abstract boolean hasNext(Key key);
-
- protected abstract Object next(Key key);
-
- protected abstract IteratorState nextState();
- };
-
- public Iterator getKeySegments() {
-
- return new Iterator<Object>() {
- IteratorState state = IteratorState.INITIAL;
-
- public boolean hasNext() {
- return state.hasNext(Key.this);
- }
-
- public Object next() {
- state = state.nextState();
- return state.next(Key.this);
- }
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- };
- }
- }
-
protected boolean isActiveData() {
return true;
}
@@ -695,7 +571,7 @@
UIComponent component, Converter converter) {
//force model leave
- setRowKey(null);
+ setRowKey(context, null);
String[] strings = ListRowKey.fromString(keyString);
int l = strings.length / 2;
@@ -713,7 +589,7 @@
return null;
}
- list.add(new Key(modelId, key));
+ list.add(new StackingTreeModelKey(modelId, key));
if (!model.setupModel(key, context) || !model.isActiveData()) {
return null;
@@ -732,4 +608,8 @@
ConvertableKeyModel convertable = (ConvertableKeyModel) getDataModel();
return convertable.getKeyAsObject(context, string, component, converter);
}
+
+ public String getId() {
+ return id;
+ }
}
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/StackingTreeModelDataProvider.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/StackingTreeModelDataProvider.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/StackingTreeModelDataProvider.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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;
Copied: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/StackingTreeModelKey.java (from rev 14238, trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModelKey.java)
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/StackingTreeModelKey.java (rev 0)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/StackingTreeModelKey.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -0,0 +1,103 @@
+/**
+ * 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;
+
+import java.io.Serializable;
+
+/**
+ * That is intended for internal use
+ *
+ * @author Nick Belaevski
+ */
+public class StackingTreeModelKey<T> implements Serializable, ComplexTreeRowKey {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -6821854350257816571L;
+ protected T modelKey;
+ protected String modelId;
+
+ public StackingTreeModelKey(String modelId, T modelKey) {
+ super();
+ this.modelId = modelId;
+ this.modelKey = modelKey;
+ }
+
+ public String toString() {
+ return this.modelId + AbstractTreeDataModel.SEPARATOR + this.modelKey;
+ }
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((modelId == null) ? 0 : modelId.hashCode());
+ result = prime * result
+ + ((modelKey == null) ? 0 : modelKey.hashCode());
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final StackingTreeModelKey other = (StackingTreeModelKey) obj;
+ if (modelId == null) {
+ if (other.modelId != null)
+ return false;
+ } else if (!modelId.equals(other.modelId))
+ return false;
+ if (modelKey == null) {
+ if (other.modelKey != null)
+ return false;
+ } else if (!modelKey.equals(other.modelKey))
+ return false;
+ return true;
+ }
+
+ public String getModelId() {
+ return modelId;
+ }
+
+ public Object getModelKey() {
+ return modelKey;
+ }
+
+ public int getKeySegmentsCount() {
+ return 2;
+ }
+
+ public Object getKeySegment(int i) {
+ switch (i) {
+ case 0:
+ return modelId;
+ case 1:
+ return modelKey;
+
+ default:
+ throw new IllegalArgumentException(String.valueOf(i));
+ }
+ }
+}
\ No newline at end of file
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/StackingTreeModelProvider.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/StackingTreeModelProvider.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/StackingTreeModelProvider.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,9 +1,28 @@
/**
- *
+ * 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;
+import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
@@ -26,20 +45,34 @@
protected abstract StackingTreeModel createStackingTreeModel();
- public StackingTreeModel getStackingModel() {
- StackingTreeModel stackingTreeModel = createStackingTreeModel();
+ private List<StackingTreeModel> createChildModelsList() {
+ List<StackingTreeModel> childModels = new ArrayList<StackingTreeModel>();
+
if (getChildCount() > 0) {
- Iterator children = getChildren().iterator();
+ Iterator<UIComponent> children = getChildren().iterator();
while (children.hasNext()) {
- UIComponent component = (UIComponent) children.next();
+ UIComponent component = children.next();
if (component instanceof StackingTreeModelProvider) {
StackingTreeModelProvider provider = (StackingTreeModelProvider) component;
-
- stackingTreeModel.addStackingModel(provider.getStackingModel());
+ childModels.add(provider.getStackingModel());
}
}
}
+ return childModels;
+ }
+
+ protected void addChildModels(StackingTreeModel model, List<StackingTreeModel> childModels) {
+ for (StackingTreeModel childModel : childModels) {
+ model.addStackingModel(childModel);
+ }
+ }
+
+ public StackingTreeModel getStackingModel() {
+ StackingTreeModel stackingTreeModel = createStackingTreeModel();
+
+ addChildModels(stackingTreeModel, createChildModelsList());
+
return stackingTreeModel;
}
}
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SwingCacheableTreeDataModel.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SwingCacheableTreeDataModel.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SwingCacheableTreeDataModel.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -39,7 +39,7 @@
public TreeNode handleMissingNode(TreeNode parent,
Object pathSegment) {
- SwingTreeNodeImpl childNode = new SwingTreeNodeImpl();
+ SwingTreeNodeImpl childNode = new CacheableSwingTreeNodeImpl();
if (parent != null) {
SwingTreeNodeImpl parentNode = (SwingTreeNodeImpl) parent;
@@ -58,8 +58,20 @@
}
@Override
+ public Object getRowData() {
+ SwingTreeNodeImpl swingTreeNodeImpl = ((SwingTreeNodeImpl) super.getRowData());
+ if (swingTreeNodeImpl != null) {
+ return swingTreeNodeImpl.getData();
+ } else {
+ return null;
+ }
+ }
+
+ @Override
protected void setDefaultNodeData(TreeNode node, Object data) {
- ((SwingTreeNodeImpl) node).setData(data);
+ CacheableSwingTreeNodeImpl cacheableTreeNode = (CacheableSwingTreeNodeImpl) node;
+ cacheableTreeNode.setData(data);
+ cacheableTreeNode.setNotLeaf(!isLeaf());
}
+}
-}
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SwingTreeNodeImpl.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SwingTreeNodeImpl.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/SwingTreeNodeImpl.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -36,7 +36,7 @@
* @author Nick Belaevski
* @since 3.2
*/
-
+@Deprecated
public class SwingTreeNodeImpl implements TreeNode {
private List<TreeNode> children = new ArrayList<TreeNode>();
@@ -93,18 +93,7 @@
* @see javax.swing.tree.TreeNode#getIndex(javax.swing.tree.TreeNode)
*/
public int getIndex(TreeNode node) {
- if (node != null) {
- int counter = 0;
- for (Iterator<TreeNode> iterator = children.iterator(); iterator.hasNext();) {
- if (node.equals(iterator.next())) {
- return counter;
- }
-
- counter++;
- }
- }
-
- return -1;
+ return children.indexOf(node);
}
/* (non-Javadoc)
@@ -144,5 +133,13 @@
public void setData(Object data) {
this.data = data;
}
+
+ public void removeChild(TreeNode node) {
+ this.children.remove(node);
+ }
+ public void removeChildByKey(Object key) {
+ this.children.remove(((Integer) key).intValue());
+ }
+
}
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/TreeDataModel.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/TreeDataModel.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/TreeDataModel.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -110,7 +110,8 @@
if (treeRange == null || treeRange.processNode(listRowKey)) {
- if (nodeAdaptor.getParent(node) != null) {
+ //root node is not processed, it is considered fake for this class of models
+ if (listRowKey != null && listRowKey.depth() > 0) {
processElement(context, dataVisitor, argument, listRowKey, last);
}
@@ -149,13 +150,7 @@
boolean isLast = nextChildNode == null;
- ListRowKey newRowKey;
- if (rowKey != null) {
- newRowKey = new ListRowKey(listRowKey, identifier);
- } else {
- newRowKey = new ListRowKey(identifier);
- }
-
+ ListRowKey newRowKey = new ListRowKey(listRowKey, identifier);
this.doWalk(context, dataVisitor, range, newRowKey, argument, isLast);
}
@@ -366,25 +361,41 @@
public Object getChildNodeId(Object childNode) {
return getNodeAdaptor().getChildNodeId((T) childNode);
}
-
+
@Override
public void addNode(Object parentRowKey, TreeNode newNode, Object id) {
- TreeNode parentNode = (parentRowKey != null) ? getTreeNode() : (TreeNode) getWrappedData();
- if (parentNode == null) {
- throw new IllegalArgumentException("Parent node required!");
- }
-
- parentNode.addChild(id, newNode);
- }
+ addNode(parentRowKey, (Object) newNode, id);
+ }
+ public void addNode(Object parentRowKey, Object newNode, Object id) {
+ Object initialRowKey = getRowKey();
+ try {
+ T parentTreeNode = locateTreeNode((TreeRowKey) parentRowKey);
+
+ if (parentTreeNode == null) {
+ throw new IllegalArgumentException("Parent node not found!");
+ }
+
+ getNodeAdaptor().appendChild(parentTreeNode, id, clazz.cast(newNode));
+ } finally {
+ setRowKey(initialRowKey);
+ }
+ }
+
@Override
public void removeNode(Object rowKey) {
- TreeNode node = getTreeNode();
- TreeNode parentNode = node.getParent();
-
- // 1. remove node from data model
- Object id = getChildNodeId(node);
- parentNode.removeChild(id);
+ Object initialRowKey = getRowKey();
+ try {
+ T treeNode = locateTreeNode((TreeRowKey) rowKey);
+
+ if (treeNode == null) {
+ throw new IllegalArgumentException("Node not fond!");
+ }
+
+ getNodeAdaptor().removeFromParent(treeNode);
+ } finally {
+ setRowKey(initialRowKey);
+ }
}
}
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/TreeDataModelNodeAdaptor.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/TreeDataModelNodeAdaptor.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/TreeDataModelNodeAdaptor.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -26,6 +26,7 @@
import java.util.Map;
import java.util.Map.Entry;
+import javax.swing.tree.MutableTreeNode;
import javax.swing.tree.TreeNode;
/**
@@ -57,6 +58,10 @@
*/
public Object getChildNodeId(T childNode);
+ public void appendChild(T parentNode, Object key, T childNode);
+
+ public void removeFromParent(T childNode);
+
/**
* Instance of {@link TreeDataModelNodeAdaptor} for {@link org.richfaces.model.TreeNode} nodes handling
*/
@@ -104,6 +109,20 @@
}
return null;
}
+
+ public void appendChild(org.richfaces.model.TreeNode parentNode,
+ Object childKey, org.richfaces.model.TreeNode childNode) {
+
+ parentNode.addChild(childKey, childNode);
+ }
+
+ public void removeFromParent(org.richfaces.model.TreeNode childNode) {
+ org.richfaces.model.TreeNode parent = childNode.getParent();
+ Object childNodeId = getChildNodeId(childNode);
+ if (childNodeId != null) {
+ parent.removeChild(childNodeId);
+ }
+ }
};
/**
@@ -202,15 +221,58 @@
public Object getChildNodeId(javax.swing.tree.TreeNode childNode) {
javax.swing.tree.TreeNode parentNode = getParent(childNode);
if (childNode != null && parentNode != null) {
- Iterator<Map.Entry<Object, TreeNode>> iter = getChildren(parentNode);
- while (iter != null && iter.hasNext()) {
- Map.Entry<Object, TreeNode> entry = iter.next();
- if (entry != null && childNode.equals(entry.getValue())) {
- return entry.getKey();
- }
- }
+ int idx = parentNode.getIndex(childNode);
+ if (idx != -1) {
+ return idx;
+ } else {
+ return null;
+ }
+ } else {
+ return null;
}
- return null;
}
+
+ @SuppressWarnings("deprecation")
+ public void appendChild(javax.swing.tree.TreeNode parentNode, Object key,
+ javax.swing.tree.TreeNode childNode) {
+
+ if (childNode instanceof MutableTreeNode) {
+ MutableTreeNode mutableChildNode = (MutableTreeNode) childNode;
+ MutableTreeNode mutableParentNode = (MutableTreeNode) parentNode;
+ int idx;
+
+ if (key != null) {
+ idx = (Integer) key;
+ } else {
+ idx = mutableParentNode.getChildCount();
+ }
+
+ mutableParentNode.insert(mutableChildNode, idx);
+ } else {
+ SwingTreeNodeImpl swingTreeNodeImpl = (SwingTreeNodeImpl) childNode;
+ SwingTreeNodeImpl parent = (SwingTreeNodeImpl) parentNode;
+
+ if (key != null) {
+ parent.addChild(key, swingTreeNodeImpl);
+ } else {
+ parent.addChild(swingTreeNodeImpl);
+ }
+
+ swingTreeNodeImpl.setParent(parent);
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ public void removeFromParent(javax.swing.tree.TreeNode node) {
+ if (node instanceof MutableTreeNode) {
+ ((MutableTreeNode) node).removeFromParent();
+ } else {
+ SwingTreeNodeImpl swingTreeNodeImpl = (SwingTreeNodeImpl) node;
+ SwingTreeNodeImpl parent = (SwingTreeNodeImpl) swingTreeNodeImpl.getParent();
+
+ parent.removeChild(swingTreeNodeImpl);
+ swingTreeNodeImpl.setParent(null);
+ }
+ }
};
}
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/TreeModelVisualComponentProvider.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/TreeModelVisualComponentProvider.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/TreeModelVisualComponentProvider.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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/api/src/main/java/org/richfaces/model/UploadItem.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/UploadItem.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/UploadItem.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,7 +1,22 @@
-/*
- * UploadItem.java Date created: 03.03.2008
- * 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.richfaces.model;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/VisualStackingTreeModel.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/VisualStackingTreeModel.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/VisualStackingTreeModel.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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/api/src/main/java/org/richfaces/model/filter/Filter.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/filter/Filter.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/filter/Filter.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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.filter;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/selection/Selection.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/selection/Selection.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/selection/Selection.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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.selection;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/selection/SimpleSelection.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/selection/SimpleSelection.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/model/selection/SimpleSelection.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -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.selection;
Modified: branches/jsf2.0/framework/api/src/main/java/org/richfaces/skin/SkinFactory.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/skin/SkinFactory.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/skin/SkinFactory.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -202,5 +202,12 @@
* @return
*/
public abstract Skin getBaseSkin(FacesContext facesContext);
+
+ /**
+ * @param facesContext
+ * @param name
+ * @return
+ */
+ public abstract Theme getTheme(FacesContext facesContext, String name);
}
Copied: branches/jsf2.0/framework/api/src/main/java/org/richfaces/skin/Theme.java (from rev 14238, trunk/framework/api/src/main/java/org/richfaces/skin/Theme.java)
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/skin/Theme.java (rev 0)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/skin/Theme.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -0,0 +1,20 @@
+/**
+ *
+ */
+package org.richfaces.skin;
+
+/**
+ * @author asmirnov
+ *
+ */
+public interface Theme {
+
+ public String getRendererType();
+
+ public String getStyle();
+
+ public String getScript();
+
+ public Object getProperty(String name);
+
+}
Copied: branches/jsf2.0/framework/api/src/main/java/org/richfaces/skin/ThemeNotFoundException.java (from rev 14238, trunk/framework/api/src/main/java/org/richfaces/skin/ThemeNotFoundException.java)
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/richfaces/skin/ThemeNotFoundException.java (rev 0)
+++ branches/jsf2.0/framework/api/src/main/java/org/richfaces/skin/ThemeNotFoundException.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -0,0 +1,49 @@
+/**
+ * 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.skin;
+
+import javax.faces.FacesException;
+
+public class ThemeNotFoundException extends FacesException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2245209384496054860L;
+
+ public ThemeNotFoundException() {
+ super();
+ }
+
+ public ThemeNotFoundException(String arg0) {
+ super(arg0);
+ }
+
+ public ThemeNotFoundException(Throwable arg0) {
+ super(arg0);
+ }
+
+ public ThemeNotFoundException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+}
Deleted: branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/framework/util/javascript/ScriptUtilsTest.java
===================================================================
--- branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/framework/util/javascript/ScriptUtilsTest.java 2009-07-06 21:18:55 UTC (rev 14802)
+++ branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/framework/util/javascript/ScriptUtilsTest.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,218 +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
- */
-
-package org.ajax4jsf.framework.util.javascript;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-import org.ajax4jsf.javascript.ScriptUtils;
-
-import junit.framework.TestCase;
-
-/**
- * @author shura
- *
- */
-public class ScriptUtilsTest extends TestCase {
-
- /**
- * @author shura
- *
- */
- public static class Bean {
-
- int _integer;
- boolean _bool;
- Object _foo;
-
- /**
- *
- */
- public Bean() {
- }
- /**
- * @param ineger
- * @param bool
- * @param foo
- */
- public Bean(int ineger, boolean bool, Object foo) {
- this._integer = ineger;
- this._bool = bool;
- this._foo = foo;
- }
- /**
- * @return the bool
- */
- public boolean isBool() {
- return this._bool;
- }
- /**
- * @param bool the bool to set
- */
- public void setBool(boolean bool) {
- this._bool = bool;
- }
- /**
- * @return the ineger
- */
- public int getInteger() {
- return this._integer;
- }
- /**
- * @param ineger the ineger to set
- */
- public void setInteger(int ineger) {
- this._integer = ineger;
- }
- /**
- * @return the foo
- */
- public Object getFoo() {
- return this._foo;
- }
- /**
- * @param foo the foo to set
- */
- public void setFoo(Object foo) {
- this._foo = foo;
- }
-
- }
-
- /**
- * @param name
- */
- public ScriptUtilsTest(String name) {
- super(name);
- }
-
- /**
- * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testStringToScript() {
- Object obj = "foo";
- assertEquals("'foo'", ScriptUtils.toScript(obj));
- }
-
- /**
- * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testArrayToScript() {
- int[] obj = {1,2,3,4,5};
- assertEquals("[1,2,3,4,5] ", ScriptUtils.toScript(obj));
- }
- /**
- * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testTwoDimentionalArrayToScript() {
- int[][] obj = {{1,2},{3,4}};
- assertEquals("[[1,2] ,[3,4] ] ", ScriptUtils.toScript(obj));
- }
-
- /**
- * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testTwoDimentionalStringArrayToScript() {
- String[][] obj = {{"one","two"},{"three","four"}};
- assertEquals("[['one','two'] ,['three','four'] ] ", ScriptUtils.toScript(obj));
- Map map = new TreeMap();
- map.put("a", obj);
- map.put("b", "c");
- assertEquals("{'a':[['one','two'] ,['three','four'] ] ,'b':'c'} ", ScriptUtils.toScript(map));
- }
- /**
- * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testListToScript() {
- List obj = new ArrayList();
- obj.add(new Integer(1));
- obj.add(new Integer(2));
- obj.add(new Integer(3));
- obj.add(new Integer(4));
- obj.add(new Integer(5));
- assertEquals("[1,2,3,4,5] ", ScriptUtils.toScript(obj));
- }
-
- /**
- * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testSetToScript() {
- Set obj = new TreeSet();
- obj.add(new Integer(1));
- obj.add(new Integer(2));
- obj.add(new Integer(3));
- obj.add(new Integer(4));
- obj.add(new Integer(5));
- assertEquals("[1,2,3,4,5] ", ScriptUtils.toScript(obj));
- }
- /**
- * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testObjectArrayToScript() {
- Bean[] obj = {new Bean(1,true,"foo"),new Bean(2,false,"bar")};
- assertEquals("[{'bool':true,'foo':'foo',\'integer\':1} ,{'bool':false,'foo':'bar','integer':2} ] ", ScriptUtils.toScript(obj));
- }
-
- /**
- * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testObjectListToScript() {
- Bean[] array = {new Bean(1,true,"foo"),new Bean(2,false,"bar")};
- List obj = Arrays.asList(array);
- assertEquals("[{'bool':true,'foo':'foo',\'integer\':1} ,{'bool':false,'foo':'bar','integer':2} ] ", ScriptUtils.toScript(obj));
- }
-
- /**
- * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testMapToScript() {
- TreeMap obj = new TreeMap();
- obj.put("a", "foo");
- obj.put("b", "bar");
- obj.put("c", "baz");
- assertEquals("{'a':'foo','b':'bar','c':'baz'} ", ScriptUtils.toScript(obj));
- }
- /**
- * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#addEncodedString(java.lang.StringBuffer, java.lang.Object)}.
- */
- public void testAddEncodedString() {
- StringBuilder buff = new StringBuilder();
- ScriptUtils.addEncodedString(buff, "foo");
- assertEquals("'foo'", buff.toString());
- }
-
- /**
- * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#addEncoded(java.lang.StringBuffer, java.lang.Object)}.
- */
- public void testAddEncoded() {
- StringBuilder buff = new StringBuilder();
- ScriptUtils.addEncoded(buff, "foo\"\'");
- assertEquals("foo\\\"\\\'", buff.toString());
- }
-
-
-}
Copied: branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript (from rev 14799, branches/community/3.3.X/framework/api/src/test/java/org/ajax4jsf/javascript)
Deleted: branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript/ResponseWriterWrapperTest.java
===================================================================
--- branches/community/3.3.X/framework/api/src/test/java/org/ajax4jsf/javascript/ResponseWriterWrapperTest.java 2009-07-06 18:29:23 UTC (rev 14799)
+++ branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript/ResponseWriterWrapperTest.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,209 +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
- */
-package org.ajax4jsf.javascript;
-
-import static org.easymock.EasyMock.aryEq;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.isNull;
-import static org.easymock.EasyMock.reportMatcher;
-import static org.easymock.classextension.EasyMock.createStrictMock;
-import static org.easymock.classextension.EasyMock.replay;
-import static org.easymock.classextension.EasyMock.verify;
-
-import java.io.Writer;
-import java.lang.reflect.Array;
-import java.util.Random;
-
-import javax.faces.context.ResponseWriter;
-
-import junit.framework.TestCase;
-
-import org.easymock.IArgumentMatcher;
-
-/**
- * @author Nick Belaevski
- * @since 3.3.2
- */
-public class ResponseWriterWrapperTest extends TestCase {
-
- private ResponseWriter mockWriter;
-
- private Writer writer;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- mockWriter = createStrictMock(ResponseWriter.class);
- writer = new ResponseWriterWrapper(mockWriter);
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
-
- this.writer = null;
- this.mockWriter = null;
- }
-
- public void testWrite1() throws Exception {
- char[] cs = new char[] {'a', 'b'};
- mockWriter.writeText(cs, 0, 2);
- replay(mockWriter);
-
- writer.write(cs);
- verify(mockWriter);
- }
-
- private static char[] expectSingleChar(final char c) {
- reportMatcher(new IArgumentMatcher() {
-
- private String failureMessage;
-
- public void appendTo(StringBuffer sb) {
- sb.append(failureMessage);
- }
-
- public boolean matches(Object o) {
- if (!(o instanceof char[])) {
- failureMessage = "Array of chars expected as argument";
- } else {
- if (Array.getLength(o) == 0) {
- failureMessage = "Array should be of non-zero length";
- } else {
- if (Array.getChar(o, 0) != c) {
- failureMessage = "["+c+"] expected as [0] char";
- }
- }
- }
-
- return failureMessage == null;
- }
-
- });
-
- return null;
- }
-
- private static char[] expectFirstChars(final char[] cs) {
- return expectFirstChars(cs, cs.length);
- }
-
- private static char[] expectFirstChars(final char[] cs, final int length) {
- reportMatcher(new IArgumentMatcher() {
-
- private String failureMessage;
-
- public void appendTo(StringBuffer sb) {
- sb.append(failureMessage);
- }
-
- public boolean matches(Object o) {
- if (!(o instanceof char[])) {
- failureMessage = "Array of chars expected as argument";
- } else {
- char[] argChars = (char[]) o;
- if (argChars.length < length) {
- failureMessage = "Array should have minimum " + length + " length, but has only: " + argChars.length;
- } else {
- for (int i = 0; i < length; i++) {
- if (argChars[i] != cs[i]) {
- failureMessage = "Char at offset [" + i + "] mismath: expected " + cs[i] + " but was " + argChars[i];
- break;
- }
- }
- }
- }
-
- return failureMessage == null;
- }
-
- });
-
- return null;
- }
-
- public void testWrite2() throws Exception {
- mockWriter.writeText(expectSingleChar((char) 0x5678), eq(0), eq(1));
- mockWriter.writeText(expectSingleChar((char) 0xBA98), eq(0), eq(1));
- replay(mockWriter);
- writer.write(0x12345678);
- writer.write(0xFECDBA98);
- verify(mockWriter);
- }
-
- public void testWrite3() throws Exception {
- mockWriter.writeText(eq("test"), (String) isNull());
- replay(mockWriter);
- writer.write("test");
- verify(mockWriter);
- }
-
- public void testWrite4() throws Exception {
- mockWriter.writeText(aryEq("abcd".toCharArray()), eq(1), eq(2));
- mockWriter.writeText(aryEq("efgh".toCharArray()), eq(0), eq(3));
- mockWriter.writeText(aryEq("ijklm".toCharArray()), eq(2), eq(3));
-
- replay(mockWriter);
- writer.write("abcd".toCharArray(), 1, 2);
- writer.write("efgh".toCharArray(), 0, 3);
- writer.write("ijklm".toCharArray(), 2, 3);
- verify(mockWriter);
- }
-
- public void testWrite5() throws Exception {
- mockWriter.writeText(expectFirstChars("string to".toCharArray()), eq(0), eq(9));
- mockWriter.writeText(expectFirstChars("one".toCharArray()), eq(0), eq(3));
-
- replay(mockWriter);
- writer.write("string to test", 0, 9);
- writer.write("short one", 6, 3);
- verify(mockWriter);
- }
-
- public void testWrite6() throws Exception {
- char[] cs = new char[4098];
- int length = cs.length - 2;
-
- for (int i = 0; i < cs.length; i++) {
- cs[i] = (char) new Random().nextInt(Character.MAX_VALUE + 1);
- }
-
- mockWriter.writeText(expectFirstChars(cs, length), eq(0), eq(length));
- replay(mockWriter);
- writer.write(String.valueOf(cs), 0, length);
- verify(mockWriter);
- }
-
- public void testFlush() throws Exception {
- mockWriter.flush();
- replay(mockWriter);
- writer.flush();
- verify(mockWriter);
- }
-
- public void testClose() throws Exception {
- mockWriter.close();
- replay(mockWriter);
- writer.close();
- verify(mockWriter);
- }
-}
Copied: branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript/ResponseWriterWrapperTest.java (from rev 14799, branches/community/3.3.X/framework/api/src/test/java/org/ajax4jsf/javascript/ResponseWriterWrapperTest.java)
===================================================================
--- branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript/ResponseWriterWrapperTest.java (rev 0)
+++ branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript/ResponseWriterWrapperTest.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -0,0 +1,209 @@
+/**
+ * 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.javascript;
+
+import static org.easymock.EasyMock.aryEq;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.isNull;
+import static org.easymock.EasyMock.reportMatcher;
+import static org.easymock.classextension.EasyMock.createStrictMock;
+import static org.easymock.classextension.EasyMock.replay;
+import static org.easymock.classextension.EasyMock.verify;
+
+import java.io.Writer;
+import java.lang.reflect.Array;
+import java.util.Random;
+
+import javax.faces.context.ResponseWriter;
+
+import junit.framework.TestCase;
+
+import org.easymock.IArgumentMatcher;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.2
+ */
+public class ResponseWriterWrapperTest extends TestCase {
+
+ private ResponseWriter mockWriter;
+
+ private Writer writer;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ mockWriter = createStrictMock(ResponseWriter.class);
+ writer = new ResponseWriterWrapper(mockWriter);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+
+ this.writer = null;
+ this.mockWriter = null;
+ }
+
+ public void testWrite1() throws Exception {
+ char[] cs = new char[] {'a', 'b'};
+ mockWriter.writeText(cs, 0, 2);
+ replay(mockWriter);
+
+ writer.write(cs);
+ verify(mockWriter);
+ }
+
+ private static char[] expectSingleChar(final char c) {
+ reportMatcher(new IArgumentMatcher() {
+
+ private String failureMessage;
+
+ public void appendTo(StringBuffer sb) {
+ sb.append(failureMessage);
+ }
+
+ public boolean matches(Object o) {
+ if (!(o instanceof char[])) {
+ failureMessage = "Array of chars expected as argument";
+ } else {
+ if (Array.getLength(o) == 0) {
+ failureMessage = "Array should be of non-zero length";
+ } else {
+ if (Array.getChar(o, 0) != c) {
+ failureMessage = "["+c+"] expected as [0] char";
+ }
+ }
+ }
+
+ return failureMessage == null;
+ }
+
+ });
+
+ return null;
+ }
+
+ private static char[] expectFirstChars(final char[] cs) {
+ return expectFirstChars(cs, cs.length);
+ }
+
+ private static char[] expectFirstChars(final char[] cs, final int length) {
+ reportMatcher(new IArgumentMatcher() {
+
+ private String failureMessage;
+
+ public void appendTo(StringBuffer sb) {
+ sb.append(failureMessage);
+ }
+
+ public boolean matches(Object o) {
+ if (!(o instanceof char[])) {
+ failureMessage = "Array of chars expected as argument";
+ } else {
+ char[] argChars = (char[]) o;
+ if (argChars.length < length) {
+ failureMessage = "Array should have minimum " + length + " length, but has only: " + argChars.length;
+ } else {
+ for (int i = 0; i < length; i++) {
+ if (argChars[i] != cs[i]) {
+ failureMessage = "Char at offset [" + i + "] mismath: expected " + cs[i] + " but was " + argChars[i];
+ break;
+ }
+ }
+ }
+ }
+
+ return failureMessage == null;
+ }
+
+ });
+
+ return null;
+ }
+
+ public void testWrite2() throws Exception {
+ mockWriter.writeText(expectSingleChar((char) 0x5678), eq(0), eq(1));
+ mockWriter.writeText(expectSingleChar((char) 0xBA98), eq(0), eq(1));
+ replay(mockWriter);
+ writer.write(0x12345678);
+ writer.write(0xFECDBA98);
+ verify(mockWriter);
+ }
+
+ public void testWrite3() throws Exception {
+ mockWriter.writeText(eq("test"), (String) isNull());
+ replay(mockWriter);
+ writer.write("test");
+ verify(mockWriter);
+ }
+
+ public void testWrite4() throws Exception {
+ mockWriter.writeText(aryEq("abcd".toCharArray()), eq(1), eq(2));
+ mockWriter.writeText(aryEq("efgh".toCharArray()), eq(0), eq(3));
+ mockWriter.writeText(aryEq("ijklm".toCharArray()), eq(2), eq(3));
+
+ replay(mockWriter);
+ writer.write("abcd".toCharArray(), 1, 2);
+ writer.write("efgh".toCharArray(), 0, 3);
+ writer.write("ijklm".toCharArray(), 2, 3);
+ verify(mockWriter);
+ }
+
+ public void testWrite5() throws Exception {
+ mockWriter.writeText(expectFirstChars("string to".toCharArray()), eq(0), eq(9));
+ mockWriter.writeText(expectFirstChars("one".toCharArray()), eq(0), eq(3));
+
+ replay(mockWriter);
+ writer.write("string to test", 0, 9);
+ writer.write("short one", 6, 3);
+ verify(mockWriter);
+ }
+
+ public void testWrite6() throws Exception {
+ char[] cs = new char[4098];
+ int length = cs.length - 2;
+
+ for (int i = 0; i < cs.length; i++) {
+ cs[i] = (char) new Random().nextInt(Character.MAX_VALUE + 1);
+ }
+
+ mockWriter.writeText(expectFirstChars(cs, length), eq(0), eq(length));
+ replay(mockWriter);
+ writer.write(String.valueOf(cs), 0, length);
+ verify(mockWriter);
+ }
+
+ public void testFlush() throws Exception {
+ mockWriter.flush();
+ replay(mockWriter);
+ writer.flush();
+ verify(mockWriter);
+ }
+
+ public void testClose() throws Exception {
+ mockWriter.close();
+ replay(mockWriter);
+ writer.close();
+ verify(mockWriter);
+ }
+}
Deleted: branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java
===================================================================
--- branches/community/3.3.X/framework/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java 2009-07-06 18:29:23 UTC (rev 14799)
+++ branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,307 +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
- */
-
-package org.ajax4jsf.javascript;
-
-import static org.easymock.EasyMock.capture;
-import static org.easymock.EasyMock.isNull;
-import static org.easymock.classextension.EasyMock.createNiceMock;
-import static org.easymock.classextension.EasyMock.replay;
-import static org.easymock.classextension.EasyMock.*;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-import javax.faces.context.ResponseWriter;
-
-import junit.framework.TestCase;
-
-import org.easymock.Capture;
-import org.easymock.CaptureType;
-
-/**
- * @author shura
- *
- */
-public class ScriptUtilsTest extends TestCase {
-
- /**
- * @author shura
- *
- */
- public static class Bean {
-
- int _integer;
- boolean _bool;
- Object _foo;
-
- public Bean() {
- }
- /**
- * @param ineger
- * @param bool
- * @param foo
- */
- public Bean(int ineger, boolean bool, Object foo) {
- this._integer = ineger;
- this._bool = bool;
- this._foo = foo;
- }
- /**
- * @return the bool
- */
- public boolean isBool() {
- return this._bool;
- }
- /**
- * @param bool the bool to set
- */
- public void setBool(boolean bool) {
- this._bool = bool;
- }
- /**
- * @return the ineger
- */
- public int getInteger() {
- return this._integer;
- }
- /**
- * @param ineger the ineger to set
- */
- public void setInteger(int ineger) {
- this._integer = ineger;
- }
- /**
- * @return the foo
- */
- public Object getFoo() {
- return this._foo;
- }
- /**
- * @param foo the foo to set
- */
- public void setFoo(Object foo) {
- this._foo = foo;
- }
- }
-
- /**
- * @param name
- */
- public ScriptUtilsTest(String name) {
- super(name);
- }
-
- /**
- * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testStringToScript() {
- Object obj = "foo";
- assertEquals("'foo'", ScriptUtils.toScript(obj));
- }
-
- /**
- * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testArrayToScript() {
- int[] obj = {1,2,3,4,5};
- assertEquals("[1,2,3,4,5] ", ScriptUtils.toScript(obj));
- }
-
- public void testSqlDate() {
- java.sql.Time obj = new java.sql.Time(1);
- assertNotNull(ScriptUtils.toScript(obj));
-
- java.sql.Date obj1 = new java.sql.Date(1);
- assertNotNull(ScriptUtils.toScript(obj1));
- }
-
- /**
- * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testTwoDimentionalArrayToScript() {
- int[][] obj = {{1,2},{3,4}};
- assertEquals("[[1,2] ,[3,4] ] ", ScriptUtils.toScript(obj));
- }
-
- /**
- * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testTwoDimentionalStringArrayToScript() {
- String[][] obj = {{"one","two"},{"three","four"}};
- assertEquals("[['one','two'] ,['three','four'] ] ", ScriptUtils.toScript(obj));
- Map<String, Object> map = new TreeMap<String, Object>();
- map.put("a", obj);
- map.put("b", "c");
- assertEquals("{'a':[['one','two'] ,['three','four'] ] ,'b':'c'} ", ScriptUtils.toScript(map));
- }
- /**
- * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testListToScript() {
- List<Integer> obj = new ArrayList<Integer>();
- obj.add(new Integer(1));
- obj.add(new Integer(2));
- obj.add(new Integer(3));
- obj.add(new Integer(4));
- obj.add(new Integer(5));
- assertEquals("[1,2,3,4,5] ", ScriptUtils.toScript(obj));
- }
-
- /**
- * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testSetToScript() {
- Set<Integer> obj = new TreeSet<Integer>();
- obj.add(new Integer(1));
- obj.add(new Integer(2));
- obj.add(new Integer(3));
- obj.add(new Integer(4));
- obj.add(new Integer(5));
- assertEquals("[1,2,3,4,5] ", ScriptUtils.toScript(obj));
- }
- /**
- * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testObjectArrayToScript() {
- Bean[] obj = {new Bean(1,true,"foo"),new Bean(2,false,"bar")};
- assertEquals("[{'bool':true,'foo':'foo',\'integer\':1} ,{'bool':false,'foo':'bar','integer':2} ] ", ScriptUtils.toScript(obj));
- }
-
- /**
- * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testObjectListToScript() {
- Bean[] array = {new Bean(1,true,"foo"),new Bean(2,false,"bar")};
- List<Bean> obj = Arrays.asList(array);
- assertEquals("[{'bool':true,'foo':'foo',\'integer\':1} ,{'bool':false,'foo':'bar','integer':2} ] ", ScriptUtils.toScript(obj));
- }
-
- /**
- * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
- */
- public void testMapToScript() {
- TreeMap<String, String> obj = new TreeMap<String, String>();
- obj.put("a", "foo");
- obj.put("b", "bar");
- obj.put("c", "baz");
- assertEquals("{'a':'foo','b':'bar','c':'baz'} ", ScriptUtils.toScript(obj));
- }
- /**
- * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#addEncodedString(java.lang.StringBuffer, java.lang.Object)}.
- */
- public void testAddEncodedString() {
- StringBuilder buff = new StringBuilder();
- ScriptUtils.addEncodedString(buff, "foo");
- assertEquals("'foo'", buff.toString());
- }
-
- /**
- * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#addEncoded(java.lang.StringBuffer, java.lang.Object)}.
- */
- public void testAddEncoded() {
- StringBuilder buff = new StringBuilder();
- ScriptUtils.addEncoded(buff, "foo\"\'");
- assertEquals("foo\\\"\\\'", buff.toString());
- }
-
- /**
- * Test method for {@link ScriptUtils#toScript(Object)}
- */
- public void testNull() throws Exception {
- assertEquals("null", ScriptUtils.toScript(null));
- }
-
- /**
- * Test method for {@link ScriptUtils#toScript(Object)}
- */
- public void testScriptString() throws Exception {
- assertEquals("alert(x<y);", ScriptUtils.toScript(new JSLiteral("alert(x<y);")));
- }
-
- private static enum TestEnum {
- A, B, C;
-
- @Override
- public String toString() {
- return "TestEnum: " + super.toString();
- }
- }
-
- /**
- * Test method for {@link ScriptUtils#toScript(Object)}
- */
- public void testEnum() throws Exception {
- assertEquals("'TestEnum: B'", ScriptUtils.toScript(TestEnum.B));
- }
-
- private void assertCaptureEquals(Capture<? extends Object> capture, String expected) {
- StringBuilder sb = new StringBuilder();
- List<? extends Object> list = capture.getValues();
- for (Object o : list) {
- assertNotNull(o);
- sb.append(o);
- }
-
- assertEquals(expected, sb.toString().trim());
- }
-
- /**
- * Test method for {@link ScriptUtils#writeToStream(javax.faces.context.ResponseWriter, Object)}
- */
- public void testWriteToStream() throws Exception {
- ResponseWriter mockWriter = createNiceMock(ResponseWriter.class);
- Capture<? extends Object> capture = new Capture<Object>(CaptureType.ALL) {
- /**
- *
- */
- private static final long serialVersionUID = -4915440411892856583L;
-
- @Override
- public void setValue(Object value) {
- if (value instanceof char[]) {
- char[] cs = (char[]) value;
- super.setValue(new String(cs, 0, 1));
- } else {
- super.setValue(value);
- }
- }
- };
-
-
- mockWriter.writeText(capture(capture), (String) isNull());
- expectLastCall().anyTimes();
- mockWriter.writeText((char[])capture(capture), eq(0), eq(1));
- expectLastCall().anyTimes();
-
- replay(mockWriter);
- ScriptUtils.writeToStream(mockWriter, Collections.singletonMap("delay", Integer.valueOf(1500)));
- verify(mockWriter);
-
- assertCaptureEquals(capture, "{'delay':1500}");
- }
-}
Copied: branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java (from rev 14799, branches/community/3.3.X/framework/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java)
===================================================================
--- branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java (rev 0)
+++ branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -0,0 +1,307 @@
+/**
+ * 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.javascript;
+
+import static org.easymock.EasyMock.capture;
+import static org.easymock.EasyMock.isNull;
+import static org.easymock.classextension.EasyMock.createNiceMock;
+import static org.easymock.classextension.EasyMock.replay;
+import static org.easymock.classextension.EasyMock.*;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import javax.faces.context.ResponseWriter;
+
+import junit.framework.TestCase;
+
+import org.easymock.Capture;
+import org.easymock.CaptureType;
+
+/**
+ * @author shura
+ *
+ */
+public class ScriptUtilsTest extends TestCase {
+
+ /**
+ * @author shura
+ *
+ */
+ public static class Bean {
+
+ int _integer;
+ boolean _bool;
+ Object _foo;
+
+ public Bean() {
+ }
+ /**
+ * @param ineger
+ * @param bool
+ * @param foo
+ */
+ public Bean(int ineger, boolean bool, Object foo) {
+ this._integer = ineger;
+ this._bool = bool;
+ this._foo = foo;
+ }
+ /**
+ * @return the bool
+ */
+ public boolean isBool() {
+ return this._bool;
+ }
+ /**
+ * @param bool the bool to set
+ */
+ public void setBool(boolean bool) {
+ this._bool = bool;
+ }
+ /**
+ * @return the ineger
+ */
+ public int getInteger() {
+ return this._integer;
+ }
+ /**
+ * @param ineger the ineger to set
+ */
+ public void setInteger(int ineger) {
+ this._integer = ineger;
+ }
+ /**
+ * @return the foo
+ */
+ public Object getFoo() {
+ return this._foo;
+ }
+ /**
+ * @param foo the foo to set
+ */
+ public void setFoo(Object foo) {
+ this._foo = foo;
+ }
+ }
+
+ /**
+ * @param name
+ */
+ public ScriptUtilsTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testStringToScript() {
+ Object obj = "foo";
+ assertEquals("'foo'", ScriptUtils.toScript(obj));
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testArrayToScript() {
+ int[] obj = {1,2,3,4,5};
+ assertEquals("[1,2,3,4,5] ", ScriptUtils.toScript(obj));
+ }
+
+ public void testSqlDate() {
+ java.sql.Time obj = new java.sql.Time(1);
+ assertNotNull(ScriptUtils.toScript(obj));
+
+ java.sql.Date obj1 = new java.sql.Date(1);
+ assertNotNull(ScriptUtils.toScript(obj1));
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testTwoDimentionalArrayToScript() {
+ int[][] obj = {{1,2},{3,4}};
+ assertEquals("[[1,2] ,[3,4] ] ", ScriptUtils.toScript(obj));
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testTwoDimentionalStringArrayToScript() {
+ String[][] obj = {{"one","two"},{"three","four"}};
+ assertEquals("[['one','two'] ,['three','four'] ] ", ScriptUtils.toScript(obj));
+ Map<String, Object> map = new TreeMap<String, Object>();
+ map.put("a", obj);
+ map.put("b", "c");
+ assertEquals("{'a':[['one','two'] ,['three','four'] ] ,'b':'c'} ", ScriptUtils.toScript(map));
+ }
+ /**
+ * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testListToScript() {
+ List<Integer> obj = new ArrayList<Integer>();
+ obj.add(new Integer(1));
+ obj.add(new Integer(2));
+ obj.add(new Integer(3));
+ obj.add(new Integer(4));
+ obj.add(new Integer(5));
+ assertEquals("[1,2,3,4,5] ", ScriptUtils.toScript(obj));
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testSetToScript() {
+ Set<Integer> obj = new TreeSet<Integer>();
+ obj.add(new Integer(1));
+ obj.add(new Integer(2));
+ obj.add(new Integer(3));
+ obj.add(new Integer(4));
+ obj.add(new Integer(5));
+ assertEquals("[1,2,3,4,5] ", ScriptUtils.toScript(obj));
+ }
+ /**
+ * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testObjectArrayToScript() {
+ Bean[] obj = {new Bean(1,true,"foo"),new Bean(2,false,"bar")};
+ assertEquals("[{'bool':true,'foo':'foo',\'integer\':1} ,{'bool':false,'foo':'bar','integer':2} ] ", ScriptUtils.toScript(obj));
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testObjectListToScript() {
+ Bean[] array = {new Bean(1,true,"foo"),new Bean(2,false,"bar")};
+ List<Bean> obj = Arrays.asList(array);
+ assertEquals("[{'bool':true,'foo':'foo',\'integer\':1} ,{'bool':false,'foo':'bar','integer':2} ] ", ScriptUtils.toScript(obj));
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testMapToScript() {
+ TreeMap<String, String> obj = new TreeMap<String, String>();
+ obj.put("a", "foo");
+ obj.put("b", "bar");
+ obj.put("c", "baz");
+ assertEquals("{'a':'foo','b':'bar','c':'baz'} ", ScriptUtils.toScript(obj));
+ }
+ /**
+ * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#addEncodedString(java.lang.StringBuffer, java.lang.Object)}.
+ */
+ public void testAddEncodedString() {
+ StringBuilder buff = new StringBuilder();
+ ScriptUtils.addEncodedString(buff, "foo");
+ assertEquals("'foo'", buff.toString());
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.javascript.ScriptUtils#addEncoded(java.lang.StringBuffer, java.lang.Object)}.
+ */
+ public void testAddEncoded() {
+ StringBuilder buff = new StringBuilder();
+ ScriptUtils.addEncoded(buff, "foo\"\'");
+ assertEquals("foo\\\"\\\'", buff.toString());
+ }
+
+ /**
+ * Test method for {@link ScriptUtils#toScript(Object)}
+ */
+ public void testNull() throws Exception {
+ assertEquals("null", ScriptUtils.toScript(null));
+ }
+
+ /**
+ * Test method for {@link ScriptUtils#toScript(Object)}
+ */
+ public void testScriptString() throws Exception {
+ assertEquals("alert(x<y);", ScriptUtils.toScript(new JSLiteral("alert(x<y);")));
+ }
+
+ private static enum TestEnum {
+ A, B, C;
+
+ @Override
+ public String toString() {
+ return "TestEnum: " + super.toString();
+ }
+ }
+
+ /**
+ * Test method for {@link ScriptUtils#toScript(Object)}
+ */
+ public void testEnum() throws Exception {
+ assertEquals("'TestEnum: B'", ScriptUtils.toScript(TestEnum.B));
+ }
+
+ private void assertCaptureEquals(Capture<? extends Object> capture, String expected) {
+ StringBuilder sb = new StringBuilder();
+ List<? extends Object> list = capture.getValues();
+ for (Object o : list) {
+ assertNotNull(o);
+ sb.append(o);
+ }
+
+ assertEquals(expected, sb.toString().trim());
+ }
+
+ /**
+ * Test method for {@link ScriptUtils#writeToStream(javax.faces.context.ResponseWriter, Object)}
+ */
+ public void testWriteToStream() throws Exception {
+ ResponseWriter mockWriter = createNiceMock(ResponseWriter.class);
+ Capture<? extends Object> capture = new Capture<Object>(CaptureType.ALL) {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -4915440411892856583L;
+
+ @Override
+ public void setValue(Object value) {
+ if (value instanceof char[]) {
+ char[] cs = (char[]) value;
+ super.setValue(new String(cs, 0, 1));
+ } else {
+ super.setValue(value);
+ }
+ }
+ };
+
+
+ mockWriter.writeText(capture(capture), (String) isNull());
+ expectLastCall().anyTimes();
+ mockWriter.writeText((char[])capture(capture), eq(0), eq(1));
+ expectLastCall().anyTimes();
+
+ replay(mockWriter);
+ ScriptUtils.writeToStream(mockWriter, Collections.singletonMap("delay", Integer.valueOf(1500)));
+ verify(mockWriter);
+
+ assertCaptureEquals(capture, "{'delay':1500}");
+ }
+}
Deleted: branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript/StringBuilderWriterTest.java
===================================================================
--- branches/community/3.3.X/framework/api/src/test/java/org/ajax4jsf/javascript/StringBuilderWriterTest.java 2009-07-06 18:29:23 UTC (rev 14799)
+++ branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript/StringBuilderWriterTest.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -1,97 +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
- */
-package org.ajax4jsf.javascript;
-
-import java.io.Writer;
-
-import junit.framework.TestCase;
-
-/**
- * @author Nick Belaevski
- * @since 3.3.2
- */
-public class StringBuilderWriterTest extends TestCase {
-
- private StringBuilder builder;
-
- private Writer writer;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- this.builder = new StringBuilder();
- this.writer = new StringBuilderWriter(this.builder);
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
-
- this.builder = null;
- this.writer = null;
- }
-
- public void testWrite() throws Exception {
- writer.write(new char[] {'a', 'b'});
- assertEquals("ab", builder.toString());
- }
-
- public void testWrite2() throws Exception {
- writer.write(0x12345678);
-
- String s = builder.toString();
- assertEquals(1, s.length());
- assertEquals(0x5678, s.charAt(0));
- }
-
- public void testWrite3() throws Exception {
- writer.write("test");
-
- assertEquals("test", builder.toString());
- }
-
- public void testWrite4() throws Exception {
- writer.write("abcd".toCharArray(), 1, 2);
- assertEquals("bc", builder.toString());
- writer.write("efgh".toCharArray(), 0, 3);
- assertEquals("bcefg", builder.toString());
- writer.write("ijkl".toCharArray(), 2, 2);
- assertEquals("bcefgkl", builder.toString());
- }
-
- public void testWrite5() throws Exception {
- writer.write("abcd", 1, 2);
- assertEquals("bc", builder.toString());
- writer.write("efgh", 0, 3);
- assertEquals("bcefg", builder.toString());
- writer.write("ijklm", 2, 3);
- assertEquals("bcefgklm", builder.toString());
- }
-
- public void testFlush() throws Exception {
- writer.flush();
- }
-
- public void testClose() throws Exception {
- writer.close();
- }
-}
Copied: branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript/StringBuilderWriterTest.java (from rev 14799, branches/community/3.3.X/framework/api/src/test/java/org/ajax4jsf/javascript/StringBuilderWriterTest.java)
===================================================================
--- branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript/StringBuilderWriterTest.java (rev 0)
+++ branches/jsf2.0/framework/api/src/test/java/org/ajax4jsf/javascript/StringBuilderWriterTest.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -0,0 +1,97 @@
+/**
+ * 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.javascript;
+
+import java.io.Writer;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.2
+ */
+public class StringBuilderWriterTest extends TestCase {
+
+ private StringBuilder builder;
+
+ private Writer writer;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ this.builder = new StringBuilder();
+ this.writer = new StringBuilderWriter(this.builder);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+
+ this.builder = null;
+ this.writer = null;
+ }
+
+ public void testWrite() throws Exception {
+ writer.write(new char[] {'a', 'b'});
+ assertEquals("ab", builder.toString());
+ }
+
+ public void testWrite2() throws Exception {
+ writer.write(0x12345678);
+
+ String s = builder.toString();
+ assertEquals(1, s.length());
+ assertEquals(0x5678, s.charAt(0));
+ }
+
+ public void testWrite3() throws Exception {
+ writer.write("test");
+
+ assertEquals("test", builder.toString());
+ }
+
+ public void testWrite4() throws Exception {
+ writer.write("abcd".toCharArray(), 1, 2);
+ assertEquals("bc", builder.toString());
+ writer.write("efgh".toCharArray(), 0, 3);
+ assertEquals("bcefg", builder.toString());
+ writer.write("ijkl".toCharArray(), 2, 2);
+ assertEquals("bcefgkl", builder.toString());
+ }
+
+ public void testWrite5() throws Exception {
+ writer.write("abcd", 1, 2);
+ assertEquals("bc", builder.toString());
+ writer.write("efgh", 0, 3);
+ assertEquals("bcefg", builder.toString());
+ writer.write("ijklm", 2, 3);
+ assertEquals("bcefgklm", builder.toString());
+ }
+
+ public void testFlush() throws Exception {
+ writer.flush();
+ }
+
+ public void testClose() throws Exception {
+ writer.close();
+ }
+}
Copied: branches/jsf2.0/framework/api/src/test/java/org/richfaces/model/ScrollableTableDataRangeSerializationTest.java (from rev 14238, trunk/framework/api/src/test/java/org/richfaces/model/ScrollableTableDataRangeSerializationTest.java)
===================================================================
--- branches/jsf2.0/framework/api/src/test/java/org/richfaces/model/ScrollableTableDataRangeSerializationTest.java (rev 0)
+++ branches/jsf2.0/framework/api/src/test/java/org/richfaces/model/ScrollableTableDataRangeSerializationTest.java 2009-07-07 10:42:08 UTC (rev 14803)
@@ -0,0 +1,59 @@
+/**
+ * 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.model;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+
+public class ScrollableTableDataRangeSerializationTest extends TestCase {
+
+ private ScrollableTableDataRange readWriteRange(ScrollableTableDataRange range) throws Exception {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(range);
+ oos.close();
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ ObjectInputStream ois = new ObjectInputStream(bais);
+
+ return (ScrollableTableDataRange) ois.readObject();
+ }
+
+ public void testSerialization() throws Exception {
+ SortOrder order = new SortOrder(new SortField[] { new SortField("xxx", true) });
+ ScrollableTableDataRange range = new ScrollableTableDataRange(10, 300, order);
+
+ ScrollableTableDataRange serializedRange = readWriteRange(range);
+
+ assertNotSame(range, serializedRange);
+ assertEquals(range, serializedRange);
+ }
+}
15 years, 5 months
JBoss Rich Faces SVN: r14802 - in cdk/trunk/plugins: generator and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2009-07-06 17:18:55 -0400 (Mon, 06 Jul 2009)
New Revision: 14802
Modified:
cdk/trunk/plugins/generator/pom.xml
cdk/trunk/plugins/maven-cdk-plugin/pom.xml
cdk/trunk/plugins/maven-javascript-plugin/pom.xml
cdk/trunk/plugins/maven-resource-dependency-plugin/pom.xml
cdk/trunk/plugins/pom.xml
Log:
fix pom.xml hierarchy
Modified: cdk/trunk/plugins/generator/pom.xml
===================================================================
--- cdk/trunk/plugins/generator/pom.xml 2009-07-06 21:07:31 UTC (rev 14801)
+++ cdk/trunk/plugins/generator/pom.xml 2009-07-06 21:18:55 UTC (rev 14802)
@@ -3,8 +3,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<parent>
- <artifactId>cdk</artifactId>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-plugins</artifactId>
<version>4.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -22,20 +22,20 @@
<target>1.6</target>
</configuration>
</plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>jaxb2-maven-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>xjc</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <packageName>org.richfaces.cdk.model</packageName> <!-- The name of your generated source package -->
- </configuration>
- </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxb2-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>xjc</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <packageName>org.richfaces.cdk.model</packageName> <!-- The name of your generated source package -->
+ </configuration>
+ </plugin>
</plugins>
</build>
<dependencies>
Modified: cdk/trunk/plugins/maven-cdk-plugin/pom.xml
===================================================================
--- cdk/trunk/plugins/maven-cdk-plugin/pom.xml 2009-07-06 21:07:31 UTC (rev 14801)
+++ cdk/trunk/plugins/maven-cdk-plugin/pom.xml 2009-07-06 21:18:55 UTC (rev 14802)
@@ -1,7 +1,8 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <artifactId>cdk</artifactId>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-plugins</artifactId>
<version>4.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -61,17 +62,25 @@
<build>
<plugins>
<plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.modello</groupId>
<artifactId>modello-maven-plugin</artifactId>
<version>1.0-alpha-18</version>
<executions>
<execution>
<goals>
- <!-- Generate the xpp3 reader code -->
+ <!-- Generate the xpp3 reader code -->
<goal>xpp3-reader</goal>
- <!-- Generate the xpp3 writer code -->
+ <!-- Generate the xpp3 writer code -->
<goal>xpp3-writer</goal>
- <!-- Generate the Java sources for the model itself -->
+ <!-- Generate the Java sources for the model itself -->
<goal>java</goal>
</goals>
</execution>
Modified: cdk/trunk/plugins/maven-javascript-plugin/pom.xml
===================================================================
--- cdk/trunk/plugins/maven-javascript-plugin/pom.xml 2009-07-06 21:07:31 UTC (rev 14801)
+++ cdk/trunk/plugins/maven-javascript-plugin/pom.xml 2009-07-06 21:18:55 UTC (rev 14802)
@@ -1,9 +1,9 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
-
<parent>
- <artifactId>cdk</artifactId>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-plugins</artifactId>
<version>4.0.0-SNAPSHOT</version>
</parent>
<groupId>org.richfaces.cdk</groupId>
Modified: cdk/trunk/plugins/maven-resource-dependency-plugin/pom.xml
===================================================================
--- cdk/trunk/plugins/maven-resource-dependency-plugin/pom.xml 2009-07-06 21:07:31 UTC (rev 14801)
+++ cdk/trunk/plugins/maven-resource-dependency-plugin/pom.xml 2009-07-06 21:18:55 UTC (rev 14802)
@@ -1,47 +1,46 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>cdk</artifactId>
- <groupId>org.richfaces</groupId>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-plugins</artifactId>
<version>4.0.0-SNAPSHOT</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.richfaces.cdk</groupId>
-
- <artifactId>maven-resource-dependency-plugin</artifactId>
- <packaging>maven-plugin</packaging>
- <version>4.0.0-SNAPSHOT</version>
- <name>maven-resource-dependency-plugin</name>
-
-
- <dependencies>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
+ <groupId>org.richfaces.cdk</groupId>
- <dependency>
- <groupId>commons-vfs</groupId>
- <artifactId>commons-vfs</artifactId>
- <version>1.0</version>
- </dependency>
+ <artifactId>maven-resource-dependency-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <version>4.0.0-SNAPSHOT</version>
+ <name>maven-resource-dependency-plugin</name>
- <dependency>
- <groupId>commons-digester</groupId>
- <artifactId>commons-digester</artifactId>
- <version>2.0</version>
- </dependency>
- <dependency>
- <groupId>org.richfaces.cdk</groupId>
- <artifactId>maven-cdk-plugin</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- </dependency>
-
- </dependencies>
+ <dependencies>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-vfs</groupId>
+ <artifactId>commons-vfs</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ <version>2.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </dependency>
+
+ </dependencies>
</project>
Modified: cdk/trunk/plugins/pom.xml
===================================================================
--- cdk/trunk/plugins/pom.xml 2009-07-06 21:07:31 UTC (rev 14801)
+++ cdk/trunk/plugins/pom.xml 2009-07-06 21:18:55 UTC (rev 14802)
@@ -18,6 +18,7 @@
<modules>
+ <module>generator</module>
<module>maven-cdk-plugin</module>
</modules>
15 years, 5 months
JBoss Rich Faces SVN: r14801 - in cdk/trunk/plugins: generator and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2009-07-06 17:07:31 -0400 (Mon, 06 Jul 2009)
New Revision: 14801
Added:
cdk/trunk/plugins/generator/
cdk/trunk/plugins/maven-cdk-plugin/
cdk/trunk/plugins/maven-javascript-plugin/
cdk/trunk/plugins/maven-resource-dependency-plugin/
Log:
maven plugins from jsf2.0 branch
Copied: cdk/trunk/plugins/generator (from rev 14774, branches/jsf2.0/cdk/generator)
Property changes on: cdk/trunk/plugins/generator
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
.settings
target
bin
Name: svn:mergeinfo
+
Copied: cdk/trunk/plugins/maven-cdk-plugin (from rev 14774, branches/jsf2.0/cdk/maven-cdk-plugin)
Property changes on: cdk/trunk/plugins/maven-cdk-plugin
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
.settings
target
Name: svn:mergeinfo
+
Copied: cdk/trunk/plugins/maven-javascript-plugin (from rev 14774, branches/jsf2.0/cdk/maven-javascript-plugin)
Property changes on: cdk/trunk/plugins/maven-javascript-plugin
___________________________________________________________________
Name: svn:ignore
+ target
.classpath
.project
.settings
Name: svn:mergeinfo
+
Copied: cdk/trunk/plugins/maven-resource-dependency-plugin (from rev 14774, branches/jsf2.0/cdk/maven-resource-dependency-plugin)
15 years, 5 months
JBoss Rich Faces SVN: r14800 - cdk/trunk/plugins.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2009-07-06 17:04:26 -0400 (Mon, 06 Jul 2009)
New Revision: 14800
Removed:
cdk/trunk/plugins/maven-cdk-plugin/
Log:
prepare migration from jsf2.0 branch
15 years, 5 months
JBoss Rich Faces SVN: r14799 - in branches/community/3.3.X/ui/combobox/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-07-06 14:29:23 -0400 (Mon, 06 Jul 2009)
New Revision: 14799
Modified:
branches/community/3.3.X/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java
branches/community/3.3.X/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
Log:
RF-6057
Modified: branches/community/3.3.X/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java
===================================================================
--- branches/community/3.3.X/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java 2009-07-06 17:47:27 UTC (rev 14798)
+++ branches/community/3.3.X/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java 2009-07-06 18:29:23 UTC (rev 14799)
@@ -95,6 +95,9 @@
List<SelectItem> selectItems = SelectUtils.getSelectItems(context, component);
for (SelectItem selectItem : selectItems) {
String convertedValue = getConvertedStringValue(context, component, selectItem.getValue());
+ if("".equals(convertedValue)) {
+ convertedValue = "\u00A0";
+ }
values.add(convertedValue);
}
}
Modified: branches/community/3.3.X/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
===================================================================
--- branches/community/3.3.X/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2009-07-06 17:47:27 UTC (rev 14798)
+++ branches/community/3.3.X/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2009-07-06 18:29:23 UTC (rev 14799)
@@ -365,6 +365,7 @@
}
var value = jQuery(this.comboList.activeItem).text();
+ value = value.replace(/\xA0/g," ").strip();
if(this.comboValue.value && (this.comboValue.value != value)) {
Richfaces.invokeEvent(this.onchange, this.combobox, "onchange", {value:value});
15 years, 5 months
JBoss Rich Faces SVN: r14798 - in branches/community/3.3.X/ui/inplaceSelect/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-07-06 13:47:27 -0400 (Mon, 06 Jul 2009)
New Revision: 14798
Modified:
branches/community/3.3.X/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
branches/community/3.3.X/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
Log:
fix RF-6057
Modified: branches/community/3.3.X/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
===================================================================
--- branches/community/3.3.X/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2009-07-06 15:37:57 UTC (rev 14797)
+++ branches/community/3.3.X/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2009-07-06 17:47:27 UTC (rev 14798)
@@ -130,7 +130,11 @@
if(writer != null) {
writer.startElement(HTML.SPAN_ELEM, component);
writer.writeAttribute(HTML.class_ATTRIBUTE, classes, null);
- writer.writeText(value, null);
+ if(value != null && value.trim().length() > 0) {
+ writer.writeText(value, null);
+ } else {
+ writer.write("\u00a0");
+ }
writer.endElement(HTML.SPAN_ELEM);
}
}
Modified: branches/community/3.3.X/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
===================================================================
--- branches/community/3.3.X/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js 2009-07-06 15:37:57 UTC (rev 14797)
+++ branches/community/3.3.X/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js 2009-07-06 17:47:27 UTC (rev 14798)
@@ -226,7 +226,11 @@
if (!item.itemValue || item.itemValue.blank()) {
item.itemValue = "";
}
-
+
+ if(item.itemLabel) {
+ item.itemLabel = item.itemLabel.replace(/\xA0/g, " ");
+ }
+
if (!item.itemLabel || item.itemLabel.blank()) {
item.itemLabel = this.attributes.defaultLabel;
}
@@ -255,7 +259,8 @@
applyTmpValue : function() {
if (this.comboList.activeItem) {
- var userLabel = this.comboList.activeItem.innerHTML.unescapeHTML();
+ var userLabel = jQuery(this.comboList.activeItem).text();
+ //var userLabel = this.comboList.activeItem.innerHTML.unescapeHTML();
this.currentItemValue = this.comboList.activeItem.value;
if(this.showValueInView) {
userLabel = this.currentItemValue;
15 years, 5 months
JBoss Rich Faces SVN: r14797 - branches/community/3.3.X/docs/userguide/en/src/main/resources/images.
by richfaces-svn-commits@lists.jboss.org
Author: atsebro
Date: 2009-07-06 11:37:57 -0400 (Mon, 06 Jul 2009)
New Revision: 14797
Added:
branches/community/3.3.X/docs/userguide/en/src/main/resources/images/commandLink_init.png
Log:
RF-7480: a4j:htmlCommandLink component description review
Added: branches/community/3.3.X/docs/userguide/en/src/main/resources/images/commandLink_init.png
===================================================================
(Binary files differ)
Property changes on: branches/community/3.3.X/docs/userguide/en/src/main/resources/images/commandLink_init.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
15 years, 5 months
JBoss Rich Faces SVN: r14796 - branches/community/3.3.X/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: atsebro
Date: 2009-07-06 09:18:29 -0400 (Mon, 06 Jul 2009)
New Revision: 14796
Modified:
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/mediaOutput.xml
Log:
RF-7427: a4j:mediaOutput component description review
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/mediaOutput.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/mediaOutput.xml 2009-07-06 13:18:08 UTC (rev 14795)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/mediaOutput.xml 2009-07-06 13:18:29 UTC (rev 14796)
@@ -163,7 +163,7 @@
Color DrawColor=new Color(0,0,0);
Font font = new Font("Serif", Font.TRUETYPE_FONT, 30);
- // Corresponding getters and setters
+ /* Corresponding getters and setters */
}]]></programlisting>
15 years, 5 months