JBoss Rich Faces SVN: r3486 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: afedosik
Date: 2007-10-23 07:56:58 -0400 (Tue, 23 Oct 2007)
New Revision: 3486
Modified:
trunk/docs/userguide/en/src/main/docbook/included/tree.desc.xml
trunk/docs/userguide/en/src/main/docbook/included/tree.xml
Log:
tree component description made by O Chikvina
Modified: trunk/docs/userguide/en/src/main/docbook/included/tree.desc.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/tree.desc.xml 2007-10-23 10:44:35 UTC (rev 3485)
+++ trunk/docs/userguide/en/src/main/docbook/included/tree.desc.xml 2007-10-23 11:56:58 UTC (rev 3486)
@@ -1,45 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<section>
-<sectioninfo>
-<keywordset>
-<keyword>tree</keyword>
-</keywordset>
-</sectioninfo>
-<section>
-<title>Description</title>
- <para>A component for a tree-like presentation of data. It includes built-in drag and drop
- support for its child elements.</para>
- <figure>
- <title>Expanded tree with child elements</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/tree1.gif"/>
- </imageobject>
- </mediaobject>
- </figure>
+ <sectioninfo>
+ <keywordset>
+ <keyword>tree</keyword>
+ </keywordset>
+ </sectioninfo>
+ <section>
+ <title>Description</title>
+ <para>A component for a tree-like presentation of data. It includes built-in drag and drop
+ support for its child elements.</para>
+ <figure>
+ <title>Expanded tree with child elements</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/tree1.gif"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>On the screenshot above there is an example of the tree with expanded node. This node
+ contains its own node with several leaves. Besides, it's possible to choose different
+ icons for tree nodes.</para>
</section>
<section>
- <title>Key Features</title>
+ <title>Key Features</title>
<itemizedlist>
<listitem>
<para>Highly customizable look-and-feel</para>
</listitem>
-
+ <para>This feature provides rich possibilities to change an appearance of a component to different corresponding modern styles.</para>
<listitem>
<para>Built-in drag and drop support</para>
</listitem>
-
+ <para>This feature allows changing a sequence order of nodes in a tree simply by dragging a certain node from one place to another.</para>
<listitem>
<para>Built-in Ajax processing</para>
</listitem>
-
+
<listitem>
- <para>Support of template sets for different node types</para>
+ <para>Support of a visual representation for different node types</para>
</listitem>
-
+
<listitem>
<para>Support of several root elements in a tree</para>
</listitem>
</itemizedlist>
+ </section>
</section>
-</section>
Modified: trunk/docs/userguide/en/src/main/docbook/included/tree.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/tree.xml 2007-10-23 10:44:35 UTC (rev 3485)
+++ trunk/docs/userguide/en/src/main/docbook/included/tree.xml 2007-10-23 11:56:58 UTC (rev 3486)
@@ -44,17 +44,36 @@
<section>
<title>Creating the Component with a Page Tag</title>
- <para>Here is a simple example as it could be used in a page: </para>
+ <para>There are two cases for a tree definition: without adapters and with adapters. In the
+ first case, it's necessary to define it with <emphasis>
+ <property>"value"</property>
+ </emphasis> and <emphasis>
+ <property>"var"</property>
+ </emphasis> attributes as follows: </para>
<para>
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML"><![CDATA[...
- <rich:tree>
+ <rich:tree value="#{library.data}" var="item" >
<!--Set of the Tree nodes-->
</rich:tree>
...
]]></programlisting>
+
+ <para>In the second case, it’s possible to define it without these attributes as it’s shown
+ below. </para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+
+ <programlisting role="XML"><![CDATA[...
+ <rich:tree>
+ <rich:recursiveTreeNodesAdaptor roots="#{fileSystemBean.sourceRoots}" var="item" nodes="#{item.nodes}" />
+ </rich:tree>
+...
+]]></programlisting>
</section>
<section>
<title>Creating the Component Dynamically Using Java</title>
@@ -70,18 +89,60 @@
</section>
<section>
<title>Details of Usage</title>
- <para>As it has been mentioned <link linkend="tree">above</link> the tree component allows to render any tree-like structure
+ <para>As it has been mentioned above the tree component allows rendering any tree-like structure
of data.</para>
- <para>A bean property is passed into a tree <property>"value"</property> attribute. The property
- keeps the structure of a org.richfaces.component.TreeNode type (you could have a look at this
- interface description in the <ulink
+ <para>A bean property is passed into a tree <property>"value"</property>
+ attribute. The property keeps a structure of an<ulink
url="http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..."
- >API document</ulink>). The default classes for lists building of a TreeNodeImpl type (it
- implements a TreeNode interface) for an XML structure XmlNodeData and XmlTreeDataBuilder are
- implemented in the tree component. Hence, in order to provide your own class for TreeNode,
- it's necessary only to implement this interface, i.e. the <emphasis>
- <property>"var"</property>
- </emphasis> attribute contains a name providing an access to data defined with a value. </para>
+ >org.richfaces.component.TreeNode</ulink> type.</para>
+ <para>There is a default class TreeNodeImpl which is used for treeNode interface implementation.
+ XmlTreeDataBuilder class allows transforming XML into structures of objects with XmlNodeData
+ type which could be represented by the tree component. </para>
+ <para><emphasis role="bold">
+ <property><rich:treeNode></property>
+ </emphasis> has getValue method which is available in a request scope variable with name that
+ is defined by <property>"var"</property> attribute of tree component. </para>
+
+ <para>For particular visual representation of data <emphasis role="bold">
+ <property><rich:tree></property>
+ </emphasis> selects by type one of the children treeNode components. The type is defined with
+ the <property>"nodeFace"</property> attribute that contains value of
+ <property>"type"</property> attribute for treeNode. An example of
+ definition is placed below: </para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+
+ <programlisting role="JAVA"><![CDATA[...
+ <h:form>
+ <rich:tree style="width:300px" value="#{library.data}" var="item" nodeFace="#{item.type}">
+ <rich:treeNode type="artist" iconLeaf="/images/tree/singer.gif" icon="/images/tree/singer.gif">
+ <h:outputText value="#{item.name}" />
+ </rich:treeNode>
+ <rich:treeNode type="album" iconLeaf="/images/tree/disc.gif" icon="/images/tree/disc.gif">
+ <h:outputText value="#{item.title}" />
+ </rich:treeNode>
+ <rich:treeNode type="song" iconLeaf="/images/tree/song.gif" icon="/images/tree/song.gif">
+ <h:outputText value="#{item.title}" />
+ </rich:treeNode>
+ </rich:tree>
+</h:form>
+...
+ ]]></programlisting>
+
+ <para>This is a result:
+ </para>
+
+ <figure>
+ <title>Expanded tree with child elements of different types</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/tree3.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
<para>For data output, named <property>tree</property> nodes elements are used. Each element,
for example depending on its definition, could be rendered with markup defined in one of
<property>tree</property> nodes. It's defined with the <emphasis>
@@ -91,8 +152,11 @@
<property>"nodeFace"</property>
</emphasis> attribute. In case when <emphasis>
<property>"nodeFace"</property>
- </emphasis> is undefined the first node inside the tree will be use by default (attributes <emphasis><property>"rendered</property></emphasis> and
- <emphasis><property>"type"</property></emphasis> for this node should not be defined). </para>
+ </emphasis> is undefined the first node inside the tree will be use by default (attributes <emphasis>
+ <property>"rendered</property>
+ </emphasis> and <emphasis>
+ <property>"type"</property>
+ </emphasis> for this node should not be defined). </para>
<para>
<emphasis role="bold">Example:</emphasis>
@@ -140,10 +204,9 @@
<property>"iconLeaf"</property>
</emphasis> attributes define icons for the component. Also you can define icons using facets
with the same names. If the facets are defined, the corresponding attributes are ignored and
- facets contents are used as icons. The width of a rendered facet area is 16px.
- </para>
+ facets contents are used as icons. The width of a rendered facet area is 16px. </para>
- <programlisting role="JAVA"><![CDATA[...
+ <programlisting role="JAVA"><![CDATA[...
<rich:tree ....>
...
<f:facet name="icon">
@@ -166,10 +229,10 @@
</section>
<section>
<title>Built-In Drag and Drop</title>
- <para>The tree component functionality provides a built-in support for Drag and Drop
- operations. The main usage principles are the same as for Rich Faces Drag and Drop wrapper
- components. Hence, to get additional information on the topic, read the corresponding
- chapters:<link linkend="dndParam">"rich:dndParam"</link>
+ <para>The tree component functionality provides a built-in support for Drag and Drop operations.
+ The main usage principles are the same as for Rich Faces Drag and Drop wrapper components.
+ Hence, to get additional information on the topic, read the corresponding chapters:<link
+ linkend="dndParam">"rich:dndParam"</link>
<link linkend="dragSupport">"rich:dragSupport"</link>
<link linkend="dragIndicator">"rich:dragIndicator"</link>
<link linkend="dropSupport">"rich:dropSupport"</link>
@@ -307,25 +370,25 @@
</tbody>
</tgroup>
</table>
-
+
<para>In order to redefine styles for all <emphasis role="bold">
- <property><rich:tree></property>
- </emphasis> components on a page using CSS, it's enough to create class with the
- same names and define necessary properties in them.</para>
-
+ <property><rich:tree></property>
+ </emphasis> components on a page using CSS, it's enough to create class with the same
+ names and define necessary properties in them.</para>
+
<para>To change styles of particular <emphasis role="bold">
- <property><rich:tree></property>
- </emphasis> components define your own style class in the corresponding <emphasis
- role="bold">
- <property><rich:tree></property>
- </emphasis>attribute.</para>
+ <property><rich:tree></property>
+ </emphasis> components define your own style class in the corresponding <emphasis role="bold">
+ <property><rich:tree></property>
+ </emphasis>attribute.</para>
</section>
<section>
<title>Relevant Resources Links</title>
<para>
<ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/tree.jsf?c=tree">Here</ulink>
- you can see the example of <emphasis role="bold"><property><rich:tree></property></emphasis> usage
- and sources for the given example. </para>
+ you can see the example of <emphasis role="bold">
+ <property><rich:tree></property>
+ </emphasis> usage and sources for the given example. </para>
<para>How to Expand/Collapse Tree Nodes from code, see <ulink
url="http://labs.jboss.com/wiki/ExpandCollapseTreeNodes">here</ulink>. </para>
</section>
17 years, 2 months
JBoss Rich Faces SVN: r3485 - trunk/docs/userguide/en/src/main/docbook/modules.
by richfaces-svn-commits@lists.jboss.org
Author: vkorluzhenko
Date: 2007-10-23 06:44:35 -0400 (Tue, 23 Oct 2007)
New Revision: 3485
Modified:
trunk/docs/userguide/en/src/main/docbook/modules/RFCfaq.xml
Log:
http://jira.jboss.com/jira/browse/RF-389 - added question.
Modified: trunk/docs/userguide/en/src/main/docbook/modules/RFCfaq.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/modules/RFCfaq.xml 2007-10-23 10:15:19 UTC (rev 3484)
+++ trunk/docs/userguide/en/src/main/docbook/modules/RFCfaq.xml 2007-10-23 10:44:35 UTC (rev 3485)
@@ -549,7 +549,7 @@
<title>How to load the Scriptaculous library?</title>
<para>To load the whole Scriptaculous library shipped with RichFaces use <emphasis
role="bold"><a4j:loadScript></emphasis> tag.</para>
-
+
<para>
<emphasis role="bold">Example:</emphasis>
</para>
@@ -557,23 +557,20 @@
<a4j:loadScript src="resource://scriptaculous.js" />
...
]]></programlisting>
+ <para> Thus, this command allows loading an integrated version of the library that
+ includes all existing scriptaculous files except unittest.js. </para>
+ <para> If you don't want to load the whole library, but only the particular
+ file, for example, effect.js, use the following line: </para>
<para>
- Thus, this command allows loading an integrated version of the library that includes all existing scriptaculous files except unittest.js.
- </para>
- <para>
- If you don't want to load the whole library, but only the particular file, for example, effect.js, use the following line:
- </para>
- <para>
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML"><![CDATA[...
<a4j:loadScript src="resource://scriptaculous/effect.js" />
...
]]></programlisting>
- <para>
- Remember, it does not make sense to load the particular file if you already load the whole version.
- </para>
-
+ <para> Remember, it does not make sense to load the particular file if you already
+ load the whole version. </para>
+
<para>For more information see <ulink
url="http://www.jboss.com/index.html?module=bb&op=viewtopic&t=119044"
>RichFaces Users Forum</ulink>.</para>
@@ -590,6 +587,32 @@
>core effects</ulink> in scriptaculous.</para>
</section>
+ <section>
+ <?dbhtml filename="Howtosaveeffectstatus.html"?>
+ <title>How to send an additional parameter to server working with
+ <rich:suggestionbox>?</title>
+ <para>An example is placed below:</para>
+ <programlisting role="XML"><![CDATA[...
+ <rich:suggestionbox width="200" height="200" for="test" suggestionAction="#{bean.autocomplete}" var="cap">
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Sometext"></h:outputText>
+ </f:facet>
+ <h:outputText value="#{cap.text}"></h:outputText>
+ </h:column>
+ <a4j:support event="onselect" action="#{bean.action}">
+ <f:setPropertyActionListener value="#{cap.label}" target="#{bean.property1}" />
+ </a4j:support>
+ </rich:suggestionbox>
+...
+]]></programlisting>
+ <para>In the example <property>"onselect"</property> event is used for sending selected
+ value to the server. It's also possible to pass additional fields
+ of selected object (which don't belong to <emphasis>
+ <property>"fetchvalue"</property>
+ </emphasis> attribute.)</para>
+ </section>
+
<section id="DecidingWhatToChangeOnTheServerSide">
<?dbhtml filename="DecidingWhatToChangeOnTheServerSide.html"?>
<title>What should I change on the server side?</title>
17 years, 2 months
JBoss Rich Faces SVN: r3484 - in trunk/framework: test/src/test/java/org/richfaces/component/util and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2007-10-23 06:15:19 -0400 (Tue, 23 Oct 2007)
New Revision: 3484
Modified:
trunk/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java
trunk/framework/test/src/test/java/org/richfaces/component/util/HtmlUtilTest.java
Log:
RF-1096
regex updated
Modified: trunk/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java 2007-10-23 10:03:56 UTC (rev 3483)
+++ trunk/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java 2007-10-23 10:15:19 UTC (rev 3484)
@@ -55,7 +55,7 @@
}
public static final Pattern idSelectorPattern = Pattern
- .compile("#((:|_|[a-z,A-Z])[a-z,A-Z,0-9,_,-,:]+)");
+ .compile("#((?:-[A-Za-z_-]|[A-Za-z_]|\\\\[^A-F0-9U]|\\\\[A-F0-9]{1,6}\\s?|\\\\U[0-9A-F]{2}(?:A[1-9A-F]|[B-F][0-9A-F]))(?:\\\\[A-F0-9]{1,6}\\s|[A-Za-z0-9\\\\_-]|\\\\:)*)");
public static String expandIdSelector(String selector,
UIComponent component, FacesContext context) {
@@ -63,21 +63,15 @@
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
- if (matcher.group(1).indexOf("::") == -1) {
- // make new id selector here using matcher.group(1)
+ // make new id selector here using matcher.group(1)
+ UIComponent target = component.findComponent(matcher.group(1));
- UIComponent target = component.findComponent(matcher.group(1));
-
- if (target != null) {
- matcher.appendReplacement(sb, "#"
- + target.getClientId(context).replaceAll(":", "\\\\\\\\\\\\\\\\:"));
- }
+ if (target != null) {
+ matcher.appendReplacement(sb, "#"
+ + target.getClientId(context).replaceAll(":", "\\\\\\\\\\\\\\\\:"));
}
}
matcher.appendTail(sb);
- String result = sb.toString();
- if (result.length() == 0)
- result = selector;
return sb.toString();
}
}
Modified: trunk/framework/test/src/test/java/org/richfaces/component/util/HtmlUtilTest.java
===================================================================
--- trunk/framework/test/src/test/java/org/richfaces/component/util/HtmlUtilTest.java 2007-10-23 10:03:56 UTC (rev 3483)
+++ trunk/framework/test/src/test/java/org/richfaces/component/util/HtmlUtilTest.java 2007-10-23 10:15:19 UTC (rev 3484)
@@ -71,7 +71,7 @@
}
public void testExpandIdSelector() {
- String selector = ".class_form+#:Test .class2 #_1aaaa:";
+ String selector = ".class_form+#-Test .class2 #_aaaa";
UIComponent component = new UIComponentBase() {
public String getFamily() {
@@ -79,7 +79,7 @@
return null;
}
public UIComponent findComponent(String expr) {
- if (":Test".equals(expr)) {
+ if ("-Test".equals(expr)) {
return new UIComponentBase() {
public String getClientId(FacesContext context) {
return "component1";
@@ -89,7 +89,7 @@
return null;
}
};
- } else if ("_1aaaa:".equals(expr)) {
+ } else if ("_aaaa".equals(expr)) {
return new UIComponentBase() {
public String getClientId(FacesContext context) {
return "component2";
17 years, 2 months
JBoss Rich Faces SVN: r3483 - trunk/ui/datascroller/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-10-23 06:03:56 -0400 (Tue, 23 Oct 2007)
New Revision: 3483
Modified:
trunk/ui/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java
Log:
add MethodExpression instead of MethodBinding
Modified: trunk/ui/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java
===================================================================
--- trunk/ui/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java 2007-10-23 10:02:48 UTC (rev 3482)
+++ trunk/ui/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java 2007-10-23 10:03:56 UTC (rev 3483)
@@ -27,6 +27,11 @@
import java.util.List;
import java.util.Set;
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.MethodExpression;
+import javax.el.MethodInfo;
+import javax.el.PropertyNotFoundException;
import javax.faces.FacesException;
import javax.faces.application.FacesMessage;
import javax.faces.component.UICommand;
@@ -36,9 +41,6 @@
import javax.faces.component.html.HtmlCommandLink;
import javax.faces.component.html.HtmlDataTable;
import javax.faces.component.html.HtmlForm;
-import javax.faces.context.FacesContext;
-import javax.faces.el.EvaluationException;
-import javax.faces.el.MethodBinding;
import javax.faces.el.MethodNotFoundException;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
@@ -458,16 +460,48 @@
HtmlAnchor htmlLink = (HtmlAnchor) renderedView.getHtmlElementById(command.getClientId(facesContext));
htmlLink.click();
-
- MethodBinding binding = new MethodBinding(){
- public Object invoke(FacesContext context, Object[] params) throws EvaluationException, MethodNotFoundException {
+
+ MethodExpression binding = new MethodExpression(){
+
+ public Object invoke(ELContext context, Object[] params) throws PropertyNotFoundException, MethodNotFoundException,
+ ELException {
facesContext.addMessage(scroller.getClientId(facesContext), new FacesMessage("Method invoked!"));
return "invoked";
}
- public Class getType(FacesContext context) throws MethodNotFoundException {
- return String.class;
+
+ public MethodInfo getMethodInfo(ELContext context) {
+
+ return null;
}
+
+ public boolean equals(Object obj) {
+ return (obj instanceof MethodExpression && obj.hashCode() == this.hashCode());
+ }
+
+
+ public String getExpressionString() {
+ return null;
+ }
+
+ public int hashCode() {
+ return 0;
+ }
+
+ public boolean isLiteralText() {
+ return false;
+ }
+
};
+
+// MethodBinding binding = new MethodBinding(){
+// public Object invoke(FacesContext context, Object[] params) throws EvaluationException, MethodNotFoundException {
+// facesContext.addMessage(scroller.getClientId(facesContext), new FacesMessage("Method invoked!"));
+// return "invoked";
+// }
+// public Class getType(FacesContext context) throws MethodNotFoundException {
+// return String.class;
+// }
+// };
DataScrollerEvent event = new DataScrollerEvent( ((UIComponent) scroller), "1", "2" );
this.scroller.setScrollerListener(binding);
17 years, 2 months
JBoss Rich Faces SVN: r3482 - trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-10-23 06:02:48 -0400 (Tue, 23 Oct 2007)
New Revision: 3482
Modified:
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ActionParamTag.java
Log:
"name" property is type of ValueExpression now
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ActionParamTag.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ActionParamTag.java 2007-10-23 09:57:27 UTC (rev 3481)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ActionParamTag.java 2007-10-23 10:02:48 UTC (rev 3482)
@@ -21,6 +21,7 @@
package org.ajax4jsf.taglib.html.jsp;
+import javax.el.ValueExpression;
import javax.faces.application.Application;
import javax.faces.component.ActionSource;
import javax.faces.component.UIComponent;
@@ -60,7 +61,7 @@
// UIParameter attributes
// value already implemented in UIComponentTagBase
- private String _name;
+ private ValueExpression _name;
private String _assignTo;
private String _converter;
private String _noEscape;
@@ -68,7 +69,7 @@
protected void setProperties(UIComponent component)
{
super.setProperties(component);
- setStringProperty(component, "name", _name);
+ setStringProperty(component, "name", _name.getExpressionString());
setBooleanProperty(component, "noEscape", _noEscape);
//Find parent UIComponentTag
@@ -102,7 +103,7 @@
}
- public void setName(String name)
+ public void setName(ValueExpression name)
{
_name = name;
}
17 years, 2 months
JBoss Rich Faces SVN: r3481 - in trunk/ui/datascroller/src/main: java/org/richfaces/component and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-10-23 05:57:27 -0400 (Tue, 23 Oct 2007)
New Revision: 3481
Modified:
trunk/ui/datascroller/src/main/config/component/datascroller.xml
trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
trunk/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java
Log:
fix RF-1145 (add encode params method)
Modified: trunk/ui/datascroller/src/main/config/component/datascroller.xml
===================================================================
--- trunk/ui/datascroller/src/main/config/component/datascroller.xml 2007-10-23 09:23:07 UTC (rev 3480)
+++ trunk/ui/datascroller/src/main/config/component/datascroller.xml 2007-10-23 09:57:27 UTC (rev 3481)
@@ -79,7 +79,6 @@
<property>
<name>scrollerListener</name>
- <classname>javax.faces.el.MethodBinding</classname>
<description>MethodBinding representing an action listener method that will be notified after scrolling
</description>
</property>
Modified: trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
===================================================================
--- trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java 2007-10-23 09:23:07 UTC (rev 3480)
+++ trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java 2007-10-23 09:57:27 UTC (rev 3481)
@@ -27,12 +27,12 @@
import org.richfaces.event.DataScrollerListener;
import org.richfaces.event.DataScrollerSource;
+import javax.el.MethodExpression;
import javax.faces.FacesException;
import javax.faces.component.ActionSource;
import javax.faces.component.UIComponent;
import javax.faces.component.UIData;
import javax.faces.context.FacesContext;
-import javax.faces.el.MethodBinding;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
@@ -100,16 +100,16 @@
setupReRender(context);
- MethodBinding scrollerListener = getScrollerListener();
+ MethodExpression scrollerListener = getScrollerListener();
if (scrollerListener != null) {
- scrollerListener.invoke(context, new Object[]{event});
+ scrollerListener.invoke(context.getELContext(), new Object[]{event});
}
}
}
- public abstract MethodBinding getScrollerListener();
+ public abstract MethodExpression getScrollerListener();
- public abstract void setScrollerListener(MethodBinding scrollerListener);
+ public abstract void setScrollerListener(MethodExpression scrollerListener);
public abstract void setFor(String f);
Modified: trunk/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java
===================================================================
--- trunk/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java 2007-10-23 09:23:07 UTC (rev 3480)
+++ trunk/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java 2007-10-23 09:57:27 UTC (rev 3481)
@@ -22,10 +22,14 @@
package org.richfaces.renderkit.html;
import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import javax.faces.component.UIComponent;
import javax.faces.component.UIData;
+import javax.faces.component.UIParameter;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.event.PhaseId;
@@ -248,6 +252,24 @@
return context.getExternalContext().getRequestParameterMap();
}
+ protected Map getParameters(UIComponent component){
+ Map parameters = new HashMap();
+
+ if(component instanceof UIDatascroller){
+ UIDatascroller datascroller = (UIDatascroller)component;
+ List children = datascroller.getChildren();
+ for (Iterator iterator = children.iterator(); iterator.hasNext();) {
+ UIComponent child = (UIComponent) iterator.next();
+ if(child instanceof UIParameter) {
+ UIParameter param = (UIParameter)child;
+ parameters.put(param.getName(), param.getValue());
+ }
+ }
+ }
+
+ return parameters;
+ }
+
public String getOnClick(FacesContext context, UIComponent component,
String value) {
@@ -258,6 +280,12 @@
component);
Map parameters = (Map) eventOptions.get("parameters");
parameters.put(scroller.getClientId(context), value);
+
+ Map params = getParameters(component);
+ if(!params.isEmpty()){
+ parameters.putAll(params);
+ }
+
function.addParameter(eventOptions);
StringBuffer buffer = new StringBuffer();
function.appendScript(buffer);
17 years, 2 months
JBoss Rich Faces SVN: r3480 - in trunk/ui/scrollableDataTable/src/main: java/org/richfaces/renderkit/html and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2007-10-23 05:23:07 -0400 (Tue, 23 Oct 2007)
New Revision: 3480
Modified:
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
Log:
RF-1118
Modified: trunk/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java
===================================================================
--- trunk/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java 2007-10-23 01:15:48 UTC (rev 3479)
+++ trunk/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java 2007-10-23 09:23:07 UTC (rev 3480)
@@ -382,4 +382,8 @@
}
//super.setRowIndex(index);
}
+
+ public void resetReqRowsCount() {
+ this.reqRowsCount = -1;
+ }
}
Modified: trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java
===================================================================
--- trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java 2007-10-23 01:15:48 UTC (rev 3479)
+++ trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java 2007-10-23 09:23:07 UTC (rev 3480)
@@ -574,9 +574,11 @@
Map parameters = externalContext.getRequestParameterMap();
String s_id = clientId + ":si";
+ grid.resetReqRowsCount();
if(parameters.containsKey(s_id)){
String options = (String)parameters.get(s_id);
grid.setScrollPos(options);
+ grid.setFirst(Integer.parseInt(options.split(",")[1]));
}
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-10-23 01:15:48 UTC (rev 3479)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-10-23 09:23:07 UTC (rev 3480)
@@ -83,7 +83,7 @@
this.adjustDataPosition(ypos);
},
createControl: function(template) {
-
+ this.scrollInput = $(this.gridId + ":si");
var childs = template.childNodes;
for(var i=0; i<childs.length; i++) {
if(childs[i].id == this.gridId + ":bc") {
@@ -383,6 +383,8 @@
var startRowIndx = 0;
var countToLoad = 0;
+ this.scrollInput.value = task.pos + "," + range.start + "," + range.end;
+
// if we have intersepted ranges than rearrange rows
// in other case just move rows table to first position
if(this.currRange.end < range.start
@@ -791,5 +793,20 @@
} else {
return 16;
}
+ },
+
+ restoreScrollState: function() {
+ var value = this.scrollInput.value
+ if(value !=''){
+ var values = value.split(',');
+ this.scrollBox.getElement().scrollTop = values[0];
+ this.currentPos = values[0];
+ this.currRange.start = values[1];
+ this.currRange.end = values[2];
+ this._onContentVScroll(values[0]);
+ var visibleRowPos = this.currRange.start * this.defaultRowHeight;
+ this.templFrozen.moveToY(visibleRowPos);
+ this.templNormal.moveToY(visibleRowPos);
+ }
}
});
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js 2007-10-23 01:15:48 UTC (rev 3479)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js 2007-10-23 09:23:07 UTC (rev 3480)
@@ -24,7 +24,6 @@
this.options = options;
this.client_id = this.options.client_id;
this.rows_count = $(this.client_id + "_rows_input").value;
- this.scroll_si = $(this.client_id + ":si");
this.columns_count = this.options.columnsCount;
this.splash_id = this.options.splash_id;
this.dataModel = new ClientUI.controls.grid.FakeArrayDataModel(this.rows_count, this.columns_count, this.client_id);
@@ -77,26 +76,8 @@
this.endPostProcessTime = (new Date()).getTime();
}.bind(this), 500);
-
- if(this.scroll_si.value !=''){
- var options = this.scroll_si.value.split(',');
- this.restoreScrollState(options[0],options[1],options[2]);
- }
-
- var form = this.getForm($(this.client_id));
- Event.observe(form, "submit",this.restoreScrollPos.bindAsEventListener(this));
+ this.getBody().restoreScrollState();
}
- },
-
- getForm: function(element){
- var node = element;
- if(node){
- while(node.tagName.toUpperCase() != 'FORM'){
- node = node.parentNode;
- }
- }
-
- return node;
},
onSortComplete : function(request, event, data){
@@ -167,33 +148,6 @@
this.getBody().hideColumn(index, frozen);
if(this.getFooter()) {this.getFooter().hideColumn(index, frozen);}
this.updateLayout();
- },
-
- restoreScrollState: function(scrollPos, start, end) {
-
- var body = this.getBody();
- body.scrollBox.getElement().scrollTop = scrollPos;
- body.currentPos = scrollPos;
- body.currRange.start = start;
- body.currRange.end = end;
- body._onContentVScroll(scrollPos);
- var visibleRowPos = body.currRange.start * body.defaultRowHeight;
- //setTimeout(function(){
- body.templFrozen.moveToY(visibleRowPos);
- body.templNormal.moveToY(visibleRowPos);
- //}, 500);
- },
-
- getScrollPos: function() {
- return this.getBody().currentPos;
- },
-
- restoreScrollPos: function(){
- var body = this.getBody();
- var start = body.currRange.start;
- var end = body.currRange.end;
- var index = this.getScrollPos();
- this.scroll_si.value = index + "," + start + "," + end;
}
});
17 years, 2 months
JBoss Rich Faces SVN: r3479 - trunk/cdk/generator/src/main/resources/META-INF/templates12.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-10-22 21:15:48 -0400 (Mon, 22 Oct 2007)
New Revision: 3479
Modified:
trunk/cdk/generator/src/main/resources/META-INF/templates12/taglib.vm
Log:
tags, converters, listeners taglib inclusions disabled for now
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates12/taglib.vm
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates12/taglib.vm 2007-10-23 01:15:07 UTC (rev 3478)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates12/taglib.vm 2007-10-23 01:15:48 UTC (rev 3479)
@@ -66,6 +66,7 @@
#end
#end
+#*
#foreach( $validator in ${validators})
#if($validator.tag)
<tag>
@@ -182,6 +183,6 @@
</tag>
#end
#end
+*#
-
</taglib>
17 years, 2 months
JBoss Rich Faces SVN: r3478 - in trunk/docs: userguide/en/src/main/docbook/included and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-10-22 21:15:07 -0400 (Mon, 22 Oct 2007)
New Revision: 3478
Removed:
trunk/docs/userguide/f.xsl
Modified:
trunk/docs/userguide/en/src/main/docbook/included/actionparam.xml
trunk/docs/xslt/en/src/main/xslt/f.xsl
Log:
Documentation made buildable...
Modified: trunk/docs/userguide/en/src/main/docbook/included/actionparam.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/actionparam.xml 2007-10-23 00:15:54 UTC (rev 3477)
+++ trunk/docs/userguide/en/src/main/docbook/included/actionparam.xml 2007-10-23 01:15:07 UTC (rev 3478)
@@ -86,7 +86,7 @@
<para>
<ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/actionparam.jsf?c=act...">Here</ulink>
you can see the example of <emphasis role="bold"
- ><property><a4j:actionparam></property></emphasis> usage and sources for the given example. </para>
+ ><property><a4j:actionparam></property></emphasis> usage and sources for the given example.
</para>
<para>More information can be found on the <ulink url="http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4063764"
>Ajax4jsf Users Forum</ulink>.</para>
Deleted: trunk/docs/userguide/f.xsl
===================================================================
--- trunk/docs/userguide/f.xsl 2007-10-23 00:15:54 UTC (rev 3477)
+++ trunk/docs/userguide/f.xsl 2007-10-23 01:15:07 UTC (rev 3478)
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:javaee="http://java.sun.com/JSP/TagLibraryDescriptor"
- version="1.0" exclude-result-prefixes="javaee">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
- <xsl:param name="lang" />
- <xsl:param name="title" />
- <xsl:param name="separator" />
-
- <xsl:template match="javaee:taglib | taglib">
- <xsl:variable name="excluded-tag-names">header2,header3,header4,header5,header6</xsl:variable>
-
- <xsl:for-each select="javaee:tag | tag">
-
- <!--xsl:value-of select="./name/text()" /-->
-
- <xsl:if test="not(contains($excluded-tag-names, javaee:name))">
- <xsl:call-template name="tag" />
- </xsl:if>
- <xsl:if test="not(contains($excluded-tag-names, ./name/text()))">
- <xsl:call-template name="tag" />
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="tag">
- <section role="NotInToc">
- <xsl:variable name="tag_name">
- <xsl:choose>
- <xsl:when test="javaee:name">
- <xsl:value-of select="javaee:name" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="./name/text()" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="prefix">
- <xsl:choose>
- <xsl:when test="/javaee:taglib/javaee:short-name">
- <xsl:value-of select="/javaee:taglib/javaee:short-name" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="/taglib/short-name/text()" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:attribute name="id"><xsl:value-of select="$tag_name"/></xsl:attribute>
- <title><<xsl:value-of select="concat($prefix,':', $tag_name)" />></title>
- <xsl:for-each select="document(concat($lang, $separator,'included',$separator,$tag_name, '.desc.xml'))/*">
- <xsl:copy-of select="./*"/>
- </xsl:for-each>
- <table>
- <title><xsl:value-of select="$prefix"/>:<xsl:value-of select="javaee:name"/><xsl:value-of select="name"/> attributes</title>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>Attribute Name</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <xsl:for-each select="javaee:attribute | attribute">
- <row>
- <entry>
- <xsl:value-of select="javaee:name"/>
- <xsl:value-of select="name"/>
- </entry>
- <entry>
- <xsl:value-of select="javaee:description" disable-output-escaping="yes"/>
- <xsl:value-of select="description" disable-output-escaping="yes"/>
- </entry>
- </row>
- </xsl:for-each>
- </tbody>
- </tgroup>
- </table>
- <xsl:for-each select="document(concat($lang, $separator,'included',$separator,$tag_name, '.xml'))/*">
- <xsl:copy-of select="./*"/>
- </xsl:for-each>
- </section>
- </xsl:template>
-</xsl:transform>
\ No newline at end of file
Modified: trunk/docs/xslt/en/src/main/xslt/f.xsl
===================================================================
--- trunk/docs/xslt/en/src/main/xslt/f.xsl 2007-10-23 00:15:54 UTC (rev 3477)
+++ trunk/docs/xslt/en/src/main/xslt/f.xsl 2007-10-23 01:15:07 UTC (rev 3478)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:javaee="http://java.sun.com/JSP/TagLibraryDescriptor"
+ xmlns:javaee="http://java.sun.com/xml/ns/javaee"
version="1.0" exclude-result-prefixes="javaee">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
omit-xml-declaration="yes" />
17 years, 2 months
JBoss Rich Faces SVN: r3477 - in trunk/extensions/portlet/src: test and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-10-22 20:15:54 -0400 (Mon, 22 Oct 2007)
New Revision: 3477
Added:
trunk/extensions/portlet/src/test/java/javax/
trunk/extensions/portlet/src/test/java/javax/portlet/
trunk/extensions/portlet/src/test/java/javax/portlet/faces/
trunk/extensions/portlet/src/test/java/javax/portlet/faces/GenericPortletTest.java
trunk/extensions/portlet/src/test/java/javax/portlet/faces/MockBridge.java
trunk/extensions/portlet/src/test/java/org/ajax4jsf/portlet/IteratorEnumeration.java
trunk/extensions/portlet/src/test/java/org/ajax4jsf/portlet/MockPortletConfig.java
trunk/extensions/portlet/src/test/resources/
Modified:
trunk/extensions/portlet/src/main/java/javax/portlet/faces/GenericFacesPortlet.java
trunk/extensions/portlet/src/test/java/org/ajax4jsf/portlet/AbstractAjax4jsfPortletTestCase.java
trunk/extensions/portlet/src/test/java/org/ajax4jsf/portlet/MockPortletContext.java
trunk/extensions/portlet/src/test/java/org/ajax4jsf/portlet/MockPortletRequest.java
Log:
Create jUnit tests for a GenericFacesServlet
Modified: trunk/extensions/portlet/src/main/java/javax/portlet/faces/GenericFacesPortlet.java
===================================================================
--- trunk/extensions/portlet/src/main/java/javax/portlet/faces/GenericFacesPortlet.java 2007-10-23 00:15:11 UTC (rev 3476)
+++ trunk/extensions/portlet/src/main/java/javax/portlet/faces/GenericFacesPortlet.java 2007-10-23 00:15:54 UTC (rev 3477)
@@ -42,6 +42,42 @@
super.init(config);
bridgeClassName = this.getPortletContext().getInitParameter(
BRIDGE_CLASS);
+ if (bridgeClassName == null) {
+ ClassLoader loader = getClassLoader();
+ InputStream stream = loader
+ .getResourceAsStream(BRIDGE_SERVICE_CLASSPATH);
+ if (null != stream) {
+ try {
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new InputStreamReader(
+ stream, "UTF-8"));
+ } catch (UnsupportedEncodingException e) {
+ reader = new BufferedReader(new InputStreamReader(
+ stream));
+ }
+ bridgeClassName = reader.readLine();
+ if (null != bridgeClassName) {
+ bridgeClassName.trim();
+ }
+ } catch (IOException e) {
+ // Ignore
+ } catch (SecurityException e) {
+ // Ignore
+ } finally {
+ if (null != stream) {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ // Ignore
+ }
+ }
+ }
+ }
+ }
+ if (null == bridgeClassName) {
+ bridgeClassName = DEFAULT_BRIDGE_CLASS;
+ }
String renderPolicy =
this.getPortletConfig().getInitParameter(Bridge.BRIDGE_PACKAGE_PREFIX + Bridge.RENDER_POLICY);
if (renderPolicy != null)
@@ -120,42 +156,6 @@
* @return
*/
public String getBrigeClassName() {
- if (bridgeClassName == null) {
- ClassLoader loader = getClassLoader();
- InputStream stream = loader
- .getResourceAsStream(BRIDGE_SERVICE_CLASSPATH);
- if (null != stream) {
- try {
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new InputStreamReader(
- stream, "UTF-8"));
- } catch (UnsupportedEncodingException e) {
- reader = new BufferedReader(new InputStreamReader(
- stream));
- }
- bridgeClassName = reader.readLine();
- if (null != bridgeClassName) {
- bridgeClassName.trim();
- }
- } catch (IOException e) {
- // Ignore
- } catch (SecurityException e) {
- // Ignore
- } finally {
- if (null != stream) {
- try {
- stream.close();
- } catch (IOException e) {
- // Ignore
- }
- }
- }
- }
- }
- if (null == bridgeClassName) {
- bridgeClassName = DEFAULT_BRIDGE_CLASS;
- }
return bridgeClassName;
}
Added: trunk/extensions/portlet/src/test/java/javax/portlet/faces/GenericPortletTest.java
===================================================================
--- trunk/extensions/portlet/src/test/java/javax/portlet/faces/GenericPortletTest.java (rev 0)
+++ trunk/extensions/portlet/src/test/java/javax/portlet/faces/GenericPortletTest.java 2007-10-23 00:15:54 UTC (rev 3477)
@@ -0,0 +1,346 @@
+/**
+ *
+ */
+package javax.portlet.faces;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URLClassLoader;
+
+import javax.portlet.PortletException;
+import javax.portlet.PortletMode;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.ajax4jsf.portlet.AbstractAjax4jsfPortletTestCase;
+import org.ajax4jsf.portlet.AjaxFacesPortlet;
+
+import junit.framework.TestCase;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class GenericPortletTest extends AbstractAjax4jsfPortletTestCase {
+
+ private final class GenericFacesPortletExtension extends
+ GenericFacesPortlet {
+ boolean editProcessed = false;
+ boolean viewProcessed = false;
+ boolean helpProcessed = false;
+
+ @Override
+ protected void doEdit(RenderRequest request, RenderResponse response)
+ throws PortletException, IOException {
+ editProcessed = true;
+ }
+
+ @Override
+ protected void doView(RenderRequest request, RenderResponse response)
+ throws PortletException, IOException {
+ viewProcessed = true;
+ }
+
+ @Override
+ protected void doHelp(RenderRequest request, RenderResponse response)
+ throws PortletException, IOException {
+ helpProcessed = true;
+ }
+ }
+
+ /**
+ * @param name
+ */
+ public GenericPortletTest(String name) {
+ super(name);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see junit.framework.TestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ MockBridge.actionCount = 0;
+ MockBridge.destroyCount = 0;
+ MockBridge.initCount = 0;
+ MockBridge.responseCount = 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see junit.framework.TestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Test method for {@link javax.portlet.faces.GenericFacesPortlet#destroy()}.
+ *
+ * @throws PortletException
+ * @throws IOException
+ */
+ public void testDestroy() throws PortletException, IOException {
+ setupActionRequest();
+ GenericFacesPortlet portlet = new GenericFacesPortlet();
+ portletContext.setInitParameter("javax.portlet.faces.BridgeClassName",
+ MockBridge.class.getName());
+ portlet.init(portletConfig);
+ MockBridge facesPortletBrige = (MockBridge) portlet
+ .getFacesPortletBrige();
+ assertEquals(true, facesPortletBrige.isInitialized());
+ assertEquals(1, MockBridge.initCount);
+ portlet.destroy();
+ assertEquals(1, MockBridge.destroyCount);
+ assertEquals(false, facesPortletBrige.isInitialized());
+
+ }
+
+ /**
+ * Test method for
+ * {@link javax.portlet.faces.GenericFacesPortlet#init(javax.portlet.PortletConfig)}.
+ *
+ * @throws PortletException
+ */
+ public void testInitPortletConfig() throws PortletException {
+ portletConfig.addInitParameter(
+ "javax.portlet.faces.preserveActionParams", "true");
+ portletConfig.addInitParameter("javax.portlet.faces.renderPolicy",
+ Bridge.BridgeRenderPolicy.NEVER_DELEGATE.toString());
+ portletConfig.setPortletName("foo");
+ GenericFacesPortlet portlet = new GenericFacesPortlet();
+ portlet.init(portletConfig);
+ assertEquals(AjaxFacesPortlet.class.getName(), portlet
+ .getBrigeClassName());
+ assertEquals(Boolean.TRUE, portletContext
+ .getAttribute("javax.portlet.faces.foo.preserveActionParams"));
+ assertEquals(Bridge.BridgeRenderPolicy.NEVER_DELEGATE, portletContext
+ .getAttribute("javax.portlet.faces.foo.renderPolicy"));
+ }
+
+ /**
+ * Test method for
+ * {@link javax.portlet.faces.GenericFacesPortlet#doDispatch(javax.portlet.RenderRequest, javax.portlet.RenderResponse)}.
+ * @throws PortletException
+ * @throws IOException
+ */
+ public void testDoDispatchRenderRequestRenderResponse() throws PortletException, IOException {
+ setupRenderRequest();
+ GenericFacesPortletExtension portlet = new GenericFacesPortletExtension();
+ portletContext.setInitParameter("javax.portlet.faces.BridgeClassName",
+ MockBridge.class.getName());
+ portletConfig.addInitParameter(
+ "javax.portlet.faces.defaultViewId.view", "index.jsf");
+ portlet.init(portletConfig);
+ portlet.doDispatch(renderRequest, renderResponse);
+ assertEquals(0, MockBridge.responseCount);
+ assertFalse(portlet.helpProcessed);
+ assertFalse(portlet.editProcessed);
+ assertTrue(portlet.viewProcessed);
+ }
+
+ /**
+ * Test method for
+ * {@link javax.portlet.faces.GenericFacesPortlet#doDispatch(javax.portlet.RenderRequest, javax.portlet.RenderResponse)}.
+ * @throws PortletException
+ * @throws IOException
+ */
+ public void testDoDispatchRenderRequestRenderResponseEdit() throws PortletException, IOException {
+ setupRenderRequest();
+ GenericFacesPortletExtension portlet = new GenericFacesPortletExtension();
+ portletContext.setInitParameter("javax.portlet.faces.BridgeClassName",
+ MockBridge.class.getName());
+ portletConfig.addInitParameter(
+ "javax.portlet.faces.defaultViewId.edit", "index.jsf");
+ renderRequest.mode = PortletMode.EDIT;
+ portlet.init(portletConfig);
+ portlet.doDispatch(renderRequest, renderResponse);
+ assertEquals(0, MockBridge.responseCount);
+ assertFalse(portlet.helpProcessed);
+ assertTrue(portlet.editProcessed);
+ assertFalse(portlet.viewProcessed);
+ }
+ /**
+ * Test method for
+ * {@link javax.portlet.faces.GenericFacesPortlet#doDispatch(javax.portlet.RenderRequest, javax.portlet.RenderResponse)}.
+ * @throws PortletException
+ * @throws IOException
+ */
+ public void testDoDispatchRenderRequestRenderResponseHelp() throws PortletException, IOException {
+ setupRenderRequest();
+ GenericFacesPortletExtension portlet = new GenericFacesPortletExtension();
+ portletContext.setInitParameter("javax.portlet.faces.BridgeClassName",
+ MockBridge.class.getName());
+ portletConfig.addInitParameter(
+ "javax.portlet.faces.defaultViewId.view", "index.jsf");
+ renderRequest.mode = PortletMode.HELP;
+ portlet.init(portletConfig);
+ portlet.doDispatch(renderRequest, renderResponse);
+ assertEquals(0, MockBridge.responseCount);
+ assertTrue(portlet.helpProcessed);
+ assertFalse(portlet.editProcessed);
+ assertFalse(portlet.viewProcessed);
+ }
+ /**
+ * Test method for
+ * {@link javax.portlet.faces.GenericFacesPortlet#doEdit(javax.portlet.RenderRequest, javax.portlet.RenderResponse)}.
+ * @throws IOException
+ * @throws PortletException
+ */
+ public void testDoEditRenderRequestRenderResponse() throws PortletException, IOException {
+ setupRenderRequest();
+ GenericFacesPortlet portlet = new GenericFacesPortlet();
+ portletContext.setInitParameter("javax.portlet.faces.BridgeClassName",
+ MockBridge.class.getName());
+ portletConfig.addInitParameter(
+ "javax.portlet.faces.defaultViewId.view", "index.jsf");
+ renderRequest.mode = PortletMode.EDIT;
+ portlet.init(portletConfig);
+ portlet.doDispatch(renderRequest, renderResponse);
+ assertEquals(0, MockBridge.responseCount);
+ }
+
+ /**
+ * Test method for
+ * {@link javax.portlet.faces.GenericFacesPortlet#doHelp(javax.portlet.RenderRequest, javax.portlet.RenderResponse)}.
+ */
+ public void testDoHelpRenderRequestRenderResponse() {
+ // fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for
+ * {@link javax.portlet.faces.GenericFacesPortlet#doView(javax.portlet.RenderRequest, javax.portlet.RenderResponse)}.
+ * @throws PortletException
+ * @throws IOException
+ */
+ public void testDoViewRenderRequestRenderResponse() throws PortletException, IOException {
+ setupRenderRequest();
+ GenericFacesPortlet portlet = new GenericFacesPortlet();
+ portletContext.setInitParameter("javax.portlet.faces.BridgeClassName",
+ MockBridge.class.getName());
+ portletConfig.addInitParameter(
+ "javax.portlet.faces.defaultViewId.view", "index.jsf");
+ portlet.init(portletConfig);
+ portlet.doDispatch(renderRequest, renderResponse);
+ assertEquals(1, MockBridge.responseCount);
+ }
+
+ /**
+ * Test method for
+ * {@link javax.portlet.faces.GenericFacesPortlet#processAction(javax.portlet.ActionRequest, javax.portlet.ActionResponse)}.
+ *
+ * @throws PortletException
+ * @throws IOException
+ */
+ public void testProcessActionActionRequestActionResponse()
+ throws PortletException, IOException {
+ setupActionRequest();
+ GenericFacesPortlet portlet = new GenericFacesPortlet();
+ portletContext.setInitParameter("javax.portlet.faces.BridgeClassName",
+ MockBridge.class.getName());
+ portletConfig.addInitParameter(
+ "javax.portlet.faces.defaultViewId.view", "index.jsf");
+ portlet.init(portletConfig);
+ portlet.processAction(actionRequest, actionResponse);
+ assertEquals(1, MockBridge.actionCount);
+ }
+
+ /**
+ * Test method for
+ * {@link javax.portlet.faces.GenericFacesPortlet#getBrigeClassName()}.
+ *
+ * @throws PortletException
+ */
+ public void testGetBrigeClassName() throws PortletException {
+ setupActionRequest();
+ GenericFacesPortlet portlet = new GenericFacesPortlet();
+ portletContext.setInitParameter("javax.portlet.faces.BridgeClassName",
+ MockBridge.class.getName());
+ portletContext.setInitParameter(
+ "javax.portlet.faces.defaultViewId.view", "index.jsf");
+ portlet.init(portletConfig);
+ assertEquals(MockBridge.class.getName(), portlet.getBrigeClassName());
+ }
+
+ /**
+ * Test method for
+ * {@link javax.portlet.faces.GenericFacesPortlet#getBrigeClassName()}.
+ *
+ * @throws PortletException
+ */
+ public void testGetBrigeClassName1() throws PortletException {
+ setupActionRequest();
+ GenericFacesPortlet portlet = new GenericFacesPortlet();
+ portlet.init(portletConfig);
+ assertEquals(AjaxFacesPortlet.class.getName(), portlet
+ .getBrigeClassName());
+ }
+
+ /**
+ * Test method for
+ * {@link javax.portlet.faces.GenericFacesPortlet#getBrigeClassName()}.
+ *
+ * @throws PortletException
+ */
+ public void testGetBrigeClassName2() throws PortletException {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ ClassLoader testLoader = new ClassLoader(loader) {
+ @Override
+ public InputStream getResourceAsStream(String name) {
+ if ("META-INF/services/javax.portlet.faces.Bridge".equals(name)) {
+ return new ByteArrayInputStream("foo.bar.Bridge".getBytes());
+ }
+ return super.getResourceAsStream(name);
+ }
+ };
+ try {
+ Thread.currentThread().setContextClassLoader(testLoader);
+ setupActionRequest();
+ GenericFacesPortlet portlet = new GenericFacesPortlet();
+ portlet.init(portletConfig);
+ assertEquals("foo.bar.Bridge", portlet.getBrigeClassName());
+
+ } finally {
+ Thread.currentThread().setContextClassLoader(loader);
+ }
+ }
+
+ /**
+ * Test method for
+ * {@link javax.portlet.faces.GenericFacesPortlet#getDefaultViewId(javax.portlet.PortletRequest, javax.portlet.PortletMode)}.
+ * @throws PortletException
+ */
+ public void testGetDefaultViewId() throws PortletException {
+ setupActionRequest();
+ GenericFacesPortlet portlet = new GenericFacesPortlet();
+ portletContext.setInitParameter("javax.portlet.faces.BridgeClassName",
+ MockBridge.class.getName());
+ portletConfig.addInitParameter(
+ "javax.portlet.faces.defaultViewId.view", "index.jsf");
+ portlet.init(portletConfig);
+ assertEquals("index.jsf", portlet.getDefaultViewId(actionRequest, actionRequest.getPortletMode()));
+ }
+
+ /**
+ * Test method for
+ * {@link javax.portlet.faces.GenericFacesPortlet#getFacesPortletBrige()}.
+ *
+ * @throws PortletException
+ */
+ public void testGetFacesPortletBrige() throws PortletException {
+ setupActionRequest();
+ GenericFacesPortlet portlet = new GenericFacesPortlet();
+ portletContext.setInitParameter("javax.portlet.faces.BridgeClassName",
+ MockBridge.class.getName());
+ portlet.init(portletConfig);
+ MockBridge facesPortletBrige = (MockBridge) portlet
+ .getFacesPortletBrige();
+ assertEquals(true, facesPortletBrige.isInitialized());
+ }
+
+}
Property changes on: trunk/extensions/portlet/src/test/java/javax/portlet/faces/GenericPortletTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Added: trunk/extensions/portlet/src/test/java/javax/portlet/faces/MockBridge.java
===================================================================
--- trunk/extensions/portlet/src/test/java/javax/portlet/faces/MockBridge.java (rev 0)
+++ trunk/extensions/portlet/src/test/java/javax/portlet/faces/MockBridge.java 2007-10-23 00:15:54 UTC (rev 3477)
@@ -0,0 +1,107 @@
+/**
+ *
+ */
+package javax.portlet.faces;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class MockBridge implements Bridge {
+
+ private boolean initialized = false;
+ private boolean actionProcessed = false;
+ private boolean responseProcessed = false;
+
+ static int initCount = 0;
+ static int actionCount = 0;
+ static int responseCount = 0;
+ static int destroyCount = 0;
+
+ /* (non-Javadoc)
+ * @see javax.portlet.faces.Bridge#destroy()
+ */
+ public void destroy() {
+ if(this.initialized == false){
+ throw new IllegalStateException("bridge not initialized");
+ }
+ this.initialized=false;
+ destroyCount++;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.portlet.faces.Bridge#doFacesRequest(javax.portlet.ActionRequest, javax.portlet.ActionResponse)
+ */
+ public void doFacesRequest(ActionRequest request, ActionResponse response)
+ throws BridgeException {
+ if(null == request || null == response){
+ throw new NullPointerException();
+ }
+ if(this.initialized == false){
+ throw new IllegalStateException("bridge not initialized");
+ }
+ if(null == request.getAttribute("javax.portlet.faces.defaultViewId")){
+ throw new BridgeDefaultViewNotSpecifiedException();
+ }
+ this.actionProcessed=true;
+ actionCount++;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.portlet.faces.Bridge#doFacesRequest(javax.portlet.RenderRequest, javax.portlet.RenderResponse)
+ */
+ public void doFacesRequest(RenderRequest request, RenderResponse response)
+ throws BridgeException {
+ if(null == request || null == response){
+ throw new NullPointerException();
+ }
+ if(this.initialized == false){
+ throw new IllegalStateException("bridge not initialized");
+ }
+ if(null == request.getAttribute("javax.portlet.faces.defaultViewId")){
+ throw new BridgeDefaultViewNotSpecifiedException();
+ }
+ this.responseProcessed=true;
+ responseCount++;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.portlet.faces.Bridge#init(javax.portlet.PortletConfig)
+ */
+ public void init(PortletConfig config) throws PortletException {
+ if(null == config){
+ throw new NullPointerException();
+ }
+ this.initialized=true;
+ initCount++;
+ }
+
+ /**
+ * @return the initialized
+ */
+ protected boolean isInitialized() {
+ return initialized;
+ }
+
+ /**
+ * @return the actionProcessed
+ */
+ protected boolean isActionProcessed() {
+ return actionProcessed;
+ }
+
+ /**
+ * @return the responseProcessed
+ */
+ protected boolean isResponseProcessed() {
+ return responseProcessed;
+ }
+
+}
Property changes on: trunk/extensions/portlet/src/test/java/javax/portlet/faces/MockBridge.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Modified: trunk/extensions/portlet/src/test/java/org/ajax4jsf/portlet/AbstractAjax4jsfPortletTestCase.java
===================================================================
--- trunk/extensions/portlet/src/test/java/org/ajax4jsf/portlet/AbstractAjax4jsfPortletTestCase.java 2007-10-23 00:15:11 UTC (rev 3476)
+++ trunk/extensions/portlet/src/test/java/org/ajax4jsf/portlet/AbstractAjax4jsfPortletTestCase.java 2007-10-23 00:15:54 UTC (rev 3477)
@@ -16,6 +16,7 @@
protected MockPortletContext portletContext;
protected MockRenderRequest renderRequest;
protected MockRenderResponse renderResponse;
+ protected MockPortletConfig portletConfig;
public AbstractAjax4jsfPortletTestCase(String name) {
super(name);
@@ -23,6 +24,8 @@
public void setUp() throws Exception {
super.setUp();
+ portletContext = new MockPortletContext();
+ portletConfig = new MockPortletConfig(portletContext);
}
public void tearDown() throws Exception {
@@ -32,6 +35,7 @@
renderRequest = null;
renderResponse = null;
portletContext = null;
+ portletConfig = null;
}
/**
@@ -40,7 +44,6 @@
protected void setupActionRequest() {
actionRequest = new MockActionRequest();
actionResponse = new MockActionResponse();
- portletContext = new MockPortletContext();
externalContext.setRequest(actionRequest);
externalContext.setResponse(actionResponse);
}
@@ -51,7 +54,6 @@
protected void setupRenderRequest() {
renderRequest = new MockRenderRequest();
renderResponse = new MockRenderResponse();
- portletContext = new MockPortletContext();
externalContext.setRequest(renderRequest);
externalContext.setResponse(renderResponse);
}
Added: trunk/extensions/portlet/src/test/java/org/ajax4jsf/portlet/IteratorEnumeration.java
===================================================================
--- trunk/extensions/portlet/src/test/java/org/ajax4jsf/portlet/IteratorEnumeration.java (rev 0)
+++ trunk/extensions/portlet/src/test/java/org/ajax4jsf/portlet/IteratorEnumeration.java 2007-10-23 00:15:54 UTC (rev 3477)
@@ -0,0 +1,23 @@
+/**
+ *
+ */
+package org.ajax4jsf.portlet;
+
+import java.util.Enumeration;
+import java.util.Iterator;
+
+final class IteratorEnumeration implements Enumeration {
+ private Iterator<String> iterator;
+
+ public IteratorEnumeration(Iterator<String> iterator) {
+ this.iterator=iterator;
+ }
+
+ public boolean hasMoreElements() {
+ return iterator.hasNext();
+ }
+
+ public Object nextElement() {
+ return iterator.next();
+ }
+}
\ No newline at end of file
Property changes on: trunk/extensions/portlet/src/test/java/org/ajax4jsf/portlet/IteratorEnumeration.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Added: trunk/extensions/portlet/src/test/java/org/ajax4jsf/portlet/MockPortletConfig.java
===================================================================
--- trunk/extensions/portlet/src/test/java/org/ajax4jsf/portlet/MockPortletConfig.java (rev 0)
+++ trunk/extensions/portlet/src/test/java/org/ajax4jsf/portlet/MockPortletConfig.java 2007-10-23 00:15:54 UTC (rev 3477)
@@ -0,0 +1,82 @@
+/**
+ *
+ */
+package org.ajax4jsf.portlet;
+
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletContext;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class MockPortletConfig implements PortletConfig {
+
+ private final PortletContext context;
+
+ private Map<String, String> parameters;
+
+ private String portletName="generic";
+
+
+ /* (non-Javadoc)
+ * @see javax.portlet.PortletConfig#getInitParameter(java.lang.String)
+ */
+ public String getInitParameter(String arg0) {
+
+ return parameters.get(arg0);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.portlet.PortletConfig#getInitParameterNames()
+ */
+ public Enumeration getInitParameterNames() {
+ return new IteratorEnumeration(parameters.keySet().iterator());
+ }
+
+ /* (non-Javadoc)
+ * @see javax.portlet.PortletConfig#getPortletContext()
+ */
+ public PortletContext getPortletContext() {
+ return context;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.portlet.PortletConfig#getPortletName()
+ */
+ public String getPortletName() {
+ // TODO Auto-generated method stub
+ return this.portletName;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.portlet.PortletConfig#getResourceBundle(java.util.Locale)
+ */
+ public ResourceBundle getResourceBundle(Locale arg0) {
+ return ResourceBundle.getBundle("javax.portlet.faces.bundle", arg0);
+ }
+
+ /**
+ * @param portletName the portletName to set
+ */
+ public void setPortletName(String name) {
+ this.portletName = name;
+ }
+
+ public void addInitParameter(String name, String value){
+ this.parameters.put(name, value);
+ }
+
+ public MockPortletConfig(PortletContext context) {
+ super();
+ this.context = context;
+ parameters = new HashMap<String, String>();
+ }
+
+}
Property changes on: trunk/extensions/portlet/src/test/java/org/ajax4jsf/portlet/MockPortletConfig.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Modified: trunk/extensions/portlet/src/test/java/org/ajax4jsf/portlet/MockPortletContext.java
===================================================================
--- trunk/extensions/portlet/src/test/java/org/ajax4jsf/portlet/MockPortletContext.java 2007-10-23 00:15:11 UTC (rev 3476)
+++ trunk/extensions/portlet/src/test/java/org/ajax4jsf/portlet/MockPortletContext.java 2007-10-23 00:15:54 UTC (rev 3477)
@@ -8,6 +8,8 @@
import java.net.URL;
import java.util.Collections;
import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Set;
import javax.portlet.PortletContext;
import javax.portlet.PortletRequestDispatcher;
@@ -19,38 +21,43 @@
public class MockPortletContext implements PortletContext {
public static final String PORTLET_INIT_VALUE = "portlet_init_value";
public static final String INIT_PARAMETER = "init_parameter";
+
+ private Map<String, String> initParameters;
+
+ private Map<String, Object> attributes;
+
+ public MockPortletContext() {
+ initParameters = new HashMap<String, String>();
+ initParameters.put(INIT_PARAMETER, PORTLET_INIT_VALUE);
+ attributes = new HashMap<String, Object>();
+ }
/* (non-Javadoc)
* @see javax.portlet.PortletContext#getAttribute(java.lang.String)
*/
public Object getAttribute(String arg0) {
- // TODO Auto-generated method stub
- return null;
+ return attributes.get(arg0);
}
/* (non-Javadoc)
* @see javax.portlet.PortletContext#getAttributeNames()
*/
public Enumeration getAttributeNames() {
- // TODO Auto-generated method stub
- return null;
+ return Collections.enumeration(attributes.keySet());
}
/* (non-Javadoc)
* @see javax.portlet.PortletContext#getInitParameter(java.lang.String)
*/
public String getInitParameter(String arg0) {
- if (INIT_PARAMETER.equals(arg0)) {
- return PORTLET_INIT_VALUE;
- }
- return null;
+ return initParameters.get(arg0);
}
/* (non-Javadoc)
* @see javax.portlet.PortletContext#getInitParameterNames()
*/
public Enumeration getInitParameterNames() {
- return Collections.enumeration(Collections.singleton(INIT_PARAMETER));
+ return Collections.enumeration(initParameters.keySet());
}
/* (non-Javadoc)
@@ -58,7 +65,7 @@
*/
public int getMajorVersion() {
// TODO Auto-generated method stub
- return 0;
+ return 1;
}
/* (non-Javadoc)
@@ -159,13 +166,17 @@
* @see javax.portlet.PortletContext#removeAttribute(java.lang.String)
*/
public void removeAttribute(String arg0) {
- // TODO Auto-generated method stub
+ attributes.remove(arg0);
}
/* (non-Javadoc)
* @see javax.portlet.PortletContext#setAttribute(java.lang.String, java.lang.Object)
*/
public void setAttribute(String arg0, Object arg1) {
- // TODO Auto-generated method stub
+ attributes.put(arg0, arg1);
}
+
+ public void setInitParameter(String name, String value) {
+ initParameters.put(name, value);
+ }
}
Modified: trunk/extensions/portlet/src/test/java/org/ajax4jsf/portlet/MockPortletRequest.java
===================================================================
--- trunk/extensions/portlet/src/test/java/org/ajax4jsf/portlet/MockPortletRequest.java 2007-10-23 00:15:11 UTC (rev 3476)
+++ trunk/extensions/portlet/src/test/java/org/ajax4jsf/portlet/MockPortletRequest.java 2007-10-23 00:15:54 UTC (rev 3477)
@@ -29,6 +29,9 @@
public static final String PARAMETER_VALUE1 = "value1";
public static final String PARAMETER = "parameter";
public Map parameters = new HashMap();
+ public Map attributes = new HashMap();
+ public PortletMode mode = PortletMode.VIEW;
+ public WindowState windowState = WindowState.NORMAL;
public MockPortletRequest() {
parameters.put(PARAMETER, new String[]{PARAMETER_VALUE1,PARAMETER_VALUE2});
@@ -38,7 +41,7 @@
*/
public Object getAttribute(String arg0) {
// TODO Auto-generated method stub
- return null;
+ return attributes.get(arg0);
}
/* (non-Javadoc)
@@ -46,7 +49,7 @@
*/
public Enumeration getAttributeNames() {
// TODO Auto-generated method stub
- return null;
+ return Collections.enumeration(attributes.keySet());
}
/* (non-Javadoc)
@@ -128,7 +131,7 @@
*/
public PortletMode getPortletMode() {
// TODO Auto-generated method stub
- return null;
+ return mode;
}
/* (non-Javadoc)
@@ -231,8 +234,7 @@
* @see javax.portlet.PortletRequest#getServerPort()
*/
public int getServerPort() {
- // TODO Auto-generated method stub
- return 0;
+ return 80;
}
/* (non-Javadoc)
@@ -247,8 +249,7 @@
* @see javax.portlet.PortletRequest#getWindowState()
*/
public WindowState getWindowState() {
- // TODO Auto-generated method stub
- return null;
+ return windowState;
}
/* (non-Javadoc)
@@ -295,13 +296,13 @@
* @see javax.portlet.PortletRequest#removeAttribute(java.lang.String)
*/
public void removeAttribute(String arg0) {
- // TODO Auto-generated method stub
+ attributes.remove(arg0);
}
/* (non-Javadoc)
* @see javax.portlet.PortletRequest#setAttribute(java.lang.String, java.lang.Object)
*/
public void setAttribute(String arg0, Object arg1) {
- // TODO Auto-generated method stub
+ attributes.put(arg0, arg1);
}
}
17 years, 2 months