JBoss Rich Faces SVN: r16704 - root/examples-sandbox/trunk/components/tables/src/main/webapp.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-04-01 10:21:35 -0400 (Thu, 01 Apr 2010)
New Revision: 16704
Modified:
root/examples-sandbox/trunk/components/tables/src/main/webapp/extendedtable.xhtml
Log:
RF-7852 ExtendedDataTable sample
Modified: root/examples-sandbox/trunk/components/tables/src/main/webapp/extendedtable.xhtml
===================================================================
--- root/examples-sandbox/trunk/components/tables/src/main/webapp/extendedtable.xhtml 2010-04-01 14:21:26 UTC (rev 16703)
+++ root/examples-sandbox/trunk/components/tables/src/main/webapp/extendedtable.xhtml 2010-04-01 14:21:35 UTC (rev 16704)
@@ -48,6 +48,20 @@
<h:selectBooleanCheckbox value="#{dataBean.state}">
<f:ajax render="extendedDataTable" />
</h:selectBooleanCheckbox>
+ <br />
+ JS API
+ <script type="text/javascript">
+<!--
+function invokeJSAPI() {
+ eval("document.getElementById('js_api_result').value = document.getElementById('"+ document.getElementById("js_api_id_input").value + "').component."
+ + document.getElementById("js_api_function_string_input").value);
+}
+//-->
+ </script>
+ <input id="js_api_id_input" type="text" value="form1:extendedDataTable" />
+ <input id="js_api_function_string_input" type="text" value="setColumnWidth('column_name', 50)" size="60"/>
+ <input type="button" value="Run" onclick="invokeJSAPI()" />
+ <input id="js_api_result" type="text" readonly="readonly" size="60"/>
<rich:extendedDataTable id="extendedDataTable" clientRows="40" rows="100" frozenColumns="2"
value="#{dataBean.state ? dataBean.employeeList : null}" var="record" noDataLabel="There isn't data."
styleClass="extendedDataTable" rowKeyVar="rkv">
14 years, 8 months
JBoss Rich Faces SVN: r16703 - root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-04-01 10:21:26 -0400 (Thu, 01 Apr 2010)
New Revision: 16703
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js
Log:
RF-8104
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js 2010-04-01 13:42:17 UTC (rev 16702)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js 2010-04-01 14:21:26 UTC (rev 16703)
@@ -149,9 +149,9 @@
};
var beginResize = function(event) {
- var className = this.parentNode.className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "[^\w]*"))[0];
+ var id = this.parentNode.className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "([^\\W]*)"))[1];
resizeData = {
- className : className,
+ id : id,
left : jQuery(this).parent().offset().left
};
dragElement.style.height = element.offsetHeight + "px";
@@ -162,12 +162,10 @@
return false;
};
- var endResize = function(event) {
- jQuery(document).unbind("mousemove", drag);
- dragElement.style.display = "none";
- var width = Math.max(MIN_WIDTH, event.pageX - resizeData.left) + "px";
- richfaces.getCSSRule("." + resizeData.className).style.width = width;
- newWidths[resizeData.className.substr(WIDTH_CLASS_NAME_BASE.length)] = width;
+ var setColumnWidth = function(id, width) {
+ width = width + "px";
+ richfaces.getCSSRule("." + WIDTH_CLASS_NAME_BASE + id).style.width = width;
+ newWidths[id] = width;
var widthsArray = new Array();
for (var id in newWidths) {
widthsArray.push(id + ":" + newWidths[id]);
@@ -175,9 +173,16 @@
widthInput.value = widthsArray.toString();
updateLayout();
adjustResizers();
- ajaxFunction(event, ""); // Maybe, event model should be used here.
+ ajaxFunction(null, ""); // TODO Maybe, event model should be used here.
};
+ var endResize = function(event) {
+ jQuery(document).unbind("mousemove", drag);
+ dragElement.style.display = "none";
+ var width = Math.max(MIN_WIDTH, event.pageX - resizeData.left);
+ setColumnWidth(resizeData.id, width);
+ };
+
var reorder = function(event) {
jQuery(reorderElement).setPosition(event, {offset:[5,5]});
reorderElement.style.display = "block";
@@ -185,7 +190,7 @@
};
var beginReorder = function(event) {
- idOfReorderingColumn = this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "[^\w]*"))[0].substr(WIDTH_CLASS_NAME_BASE.length); //To try to do this without substr.
+ idOfReorderingColumn = this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "([^\\W]*)"))[1];
jQuery(document).bind("mousemove", reorder);
jQuery(element).children(".rich-extable-header").find(".rich-extable-header-cell").bind("mouseover", overReorder);
jQuery(document).one("mouseup", cancelReorder);
@@ -209,17 +214,17 @@
var endReorder = function(event) {
reorderMarkerElement.style.display = "";
jQuery(this).unbind("mouseout", outReorder);
- var id = this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "[^\w]*"))[0].substr(WIDTH_CLASS_NAME_BASE.length); //To try to do this without substr.
+ var id = this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "([^\\W]*)"))[1];
var colunmsOrder = "";
jQuery(element).children(".rich-extable-header").find(".rich-extable-header-cell").each(function() {
- var i = this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "[^\w]*"))[0].substr(WIDTH_CLASS_NAME_BASE.length); //To try to do this without substr.
+ var i = this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "([^\\W]*)"))[1];
if (i == id) {
colunmsOrder += idOfReorderingColumn + "," + id + ",";
} else if (i != idOfReorderingColumn) {
colunmsOrder += i + ",";
}
});
- ajaxFunction(event, colunmsOrder);
+ ajaxFunction(event, colunmsOrder); // TODO Maybe, event model should be used here.
};
var cancelReorder = function(event) {
@@ -263,6 +268,47 @@
jQuery(element).children(".rich-extable-header").find(".rich-extable-header-cell").bind("mousedown", beginReorder);
jQuery(bodyElement).bind("scroll", bodyScrollListener);
jQuery(element).bind("rich:onscrollcomplete", scrollComplete);
+
+ //JS API
+ element.component = this;
+
+ this.getColumnPosition = function(id) {
+ var position;
+ var headers = jQuery(element).children(".rich-extable-header").find(".rich-extable-header-cell");
+ for (var i = 0; i < headers.length; i++) {
+ if (id == headers.get(i).className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "([^\\W]*)"))[1]) {
+ position = i;
+ }
+ }
+ return position;
+ }
+
+ this.setColumnPosition = function(id, position) {
+ var colunmsOrder = "";
+ var before;
+ var headers = jQuery(element).children(".rich-extable-header").find(".rich-extable-header-cell");
+ for (var i = 0; i < headers.length; i++) {
+ var current = headers.get(i).className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "([^\\W]*)"))[1];
+ if (i == position) {
+ if (before) {
+ colunmsOrder += current + "," + id + ",";
+ } else {
+ colunmsOrder += id + "," + current + ",";
+ }
+ } else {
+ if (id != current) {
+ colunmsOrder += current + ",";
+ } else {
+ before = true;
+ }
+ }
+ }
+ ajaxFunction(null, colunmsOrder); // TODO Maybe, event model should be used here.
+ }
+
+ this.setColumnWidth = function(id, width) {
+ setColumnWidth(id, width);
+ }
};
}(window.RichFaces, jQuery));
14 years, 8 months
JBoss Rich Faces SVN: r16702 - branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tooltip.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-04-01 09:42:17 -0400 (Thu, 01 Apr 2010)
New Revision: 16702
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tooltip/TooltipDataTableTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tooltip/TooltipTestCase.java
Log:
two problematic tests disposed from test suite
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tooltip/TooltipDataTableTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tooltip/TooltipDataTableTestCase.java 2010-04-01 07:38:13 UTC (rev 16701)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tooltip/TooltipDataTableTestCase.java 2010-04-01 13:42:17 UTC (rev 16702)
@@ -25,7 +25,6 @@
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
import org.jboss.test.selenium.waiting.Condition;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -44,8 +43,9 @@
private final String LOC_TD_MAKE_RELATIVE_TO_ACTIVE_TOOLTIP_AREA = getLoc("TD_MAKE_RELATIVE_TO_ACTIVE_TOOLTIP_AREA");
private final String MSG_EVENT_COORDS_FOR_TABLE = getMsg("EVENT_COORDS_FOR_TABLE");
-
- @Test
+
+ // FIXME test works locally but not in Hudson, fails on line 61 -- waitForElementAppears(LOC_OUTPUT_TOOLTIP_MAKE)
+ //@Test
public void testIterateThroughTable() {
int rows = getJQueryCount(format(LOC_TD_PREFORMATTED, 0, Column.MAKE));
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tooltip/TooltipTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tooltip/TooltipTestCase.java 2010-04-01 07:38:13 UTC (rev 16701)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tooltip/TooltipTestCase.java 2010-04-01 13:42:17 UTC (rev 16702)
@@ -27,7 +27,6 @@
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
import org.jboss.test.selenium.waiting.*;
import static org.testng.Assert.*;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -114,7 +113,8 @@
* mouse out to close tooltip. Do all above three times and checks that
* tooltips requested counter is counting right.
*/
- @Test
+ // FIXME works locally but not in Hudson, fails on line 128 -- waitForTooltipChanges(tooltipsRequested, i == 0)
+ //@Test
public void testSeparateServerRequests() {
Integer tooltipsRequested = null;
14 years, 8 months
JBoss Rich Faces SVN: r16701 - root/docs/trunk/Component_Reference/en-US.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2010-04-01 03:38:13 -0400 (Thu, 01 Apr 2010)
New Revision: 16701
Modified:
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Functions.xml
Log:
Worked on rich functions
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Functions.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Functions.xml 2010-03-31 15:29:01 UTC (rev 16700)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Functions.xml 2010-04-01 07:38:13 UTC (rev 16701)
@@ -4,41 +4,55 @@
<chapter id="chap-Component_Reference-Functions">
<title>Functions</title>
<para>
- Incomplete
+ Read this chapter for details on special functions for use with particular components. Using JavaServer Faces Expression Language (<acronym>JSF</acronym> <acronym>EL</acronym>), these functions can be accessed through the <varname>data</varname> attribute of components. Refer to <xref linkend="sect-Component_Reference-Events_and_JavaScript_interactions-data" /> for details on the <varname>data</varname> attribute.
</para>
<section id="sect-Component_Reference-Functions-richclientID">
- <title><sgmltag><rich:clientID></sgmltag></title>
+ <title><function>rich:clientId</function></title>
<para>
- Incomplete
+ The <function>rich:clientId('id')</function> function returns the client identifier related to the passed component identifier (<code>'id'</code>). If the specified component identifier is not found, <literal>null</literal> is returned instead.
</para>
</section>
<section id="sect-Component_Reference-Functions-richcomponent">
- <title><sgmltag><rich:component></sgmltag></title>
+ <title><function>rich:component</function></title>
<para>
- Incomplete
+ The <function>rich:component('id')</function> function is a shortcut for the equivalent <code>#{rich:clientId('id')}.component</code> code. It returns the UIComponent instance from the client, based on the passed server-side component identifier (<code>'id'</code>). If the specified component identifier is not found, <literal>null</literal> is returned instead.
</para>
</section>
<section id="sect-Component_Reference-Functions-richelement">
- <title><sgmltag><rich:element></sgmltag></title>
+ <title><function>rich:element</function></title>
<para>
- Incomplete
+ The <function>rich:element('id')</function> function is a shortcut for the equivalent <code>document.getElementById(#{rich:clientId('id')})</code> code. It returns the element from the client, based on the passed server-side component identifier. If the specified component identifier is not found, <literal>null</literal> is returned instead.
</para>
</section>
<section id="sect-Component_Reference-Functions-richfindComponent">
- <title><sgmltag><rich:findComponent></sgmltag></title>
+ <title><function>rich:findComponent</function></title>
<para>
- Incomplete
+ The <function>rich:findComponent('id')</function> function returns the a UIComponent instance of the passed component identifier. If the specified component identifier is not found, <literal>null</literal> is returned instead.
</para>
+ <example id="exam-Component_Reference-richfindComponent-richfindComponent_example">
+ <title><function>rich:findComponent</function> example</title>
+<programlisting language="XML" role="XML"><h:inputText id="myInput">
+ <a4j:support event="onkeyup" reRender="outtext"/>
+</h:inputText>
+<h:outputText id="outtext" value="#{rich:findComponent('myInput').value}" /></programlisting>
+ </example>
</section>
<section id="sect-Component_Reference-Functions-richisUserInRole">
- <title><sgmltag><rich:isUserInRole></sgmltag></title>
+ <title><function>rich:isUserInRole</function></title>
<para>
- Incomplete
+ The <function>rich:isUserInRole(Object)</function> function checks whether the logged-in user belongs to a certain user role, such as being an administrator. User roles are defined in the <filename>web.xml</filename> settings file.
</para>
+ <example id="exam-Component_Reference-richisUserInRole-richisUserInRole_example">
+ <title><function>rich:isUserInRole</function> example</title>
+ <para>
+ The <function>rich:isUserInRole(Object)</function> function can be used in conjunction with the <varname>rendered</varname> attribute of a component to only display certain controls to authorized users.
+ </para>
+<programlisting language="XML" role="XML"><rich:editor value="#{bean.text}" rendered="#{rich:isUserInRole('admin')}" /></programlisting>
+ </example>
</section>
</chapter>
14 years, 8 months