JBoss Rich Faces SVN: r9984 - trunk/sandbox/ui/extendedDataTable/design.
by richfaces-svn-commits@lists.jboss.org
Author: piotr.buda
Date: 2008-08-08 03:11:27 -0400 (Fri, 08 Aug 2008)
New Revision: 9984
Modified:
trunk/sandbox/ui/extendedDataTable/design/FuncSpec - Extended Data Table Component.doc
Log:
Functional specification update
Modified: trunk/sandbox/ui/extendedDataTable/design/FuncSpec - Extended Data Table Component.doc
===================================================================
(Binary files differ)
16 years, 5 months
JBoss Rich Faces SVN: r9983 - trunk/framework/impl/src/main/java/org/ajax4jsf/context.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-08-07 20:59:54 -0400 (Thu, 07 Aug 2008)
New Revision: 9983
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java
Log:
https://jira.jboss.org/jira/browse/RF-4116
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java 2008-08-08 00:07:25 UTC (rev 9982)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java 2008-08-08 00:59:54 UTC (rev 9983)
@@ -484,8 +484,16 @@
ResponseWriter writer = context.getResponseWriter();
try {
StringWriter stringWriter = new StringWriter();
- context.setResponseWriter(oldResponseWriter.cloneWithWriter(stringWriter));
+ if (oldResponseWriter != null) {
+ context.setResponseWriter(oldResponseWriter.cloneWithWriter(stringWriter));
+ } else {
+ context.setResponseWriter(this.renderKit.createResponseWriter(
+ stringWriter, "text/html",
+ "US-ASCII"));
+ }
+
+
EXTENDED_SKINNING_ON_RESOURCE.encode(context, null);
stringWriter.flush();
@@ -496,7 +504,9 @@
"on the page together with the following code: \n" + stringWriter.getBuffer().toString() +
"\nfor extended level of skinning to work.");
} finally {
- context.setResponseWriter(writer);
+ if (writer != null) {
+ context.setResponseWriter(writer);
+ }
}
applicationMap.put(EXTENDED_SKINNING_ON_NO_SCRIPTS_INFO_KEY, Boolean.TRUE);
@@ -517,7 +527,9 @@
} catch (IOException e) {
throw new FacesException(e.getLocalizedMessage(), e);
} finally {
- context.setResponseWriter(oldResponseWriter);
+ if (oldResponseWriter != null) {
+ context.setResponseWriter(oldResponseWriter);
+ }
}
}
}
16 years, 5 months
JBoss Rich Faces SVN: r9982 - trunk/framework/impl/src/main/java/org/ajax4jsf/application.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-08-07 20:07:25 -0400 (Thu, 07 Aug 2008)
New Revision: 9982
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java
Log:
https://jira.jboss.org/jira/browse/RF-4108
https://jira.jboss.org/jira/browse/RF-4115
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java 2008-08-07 18:52:59 UTC (rev 9981)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java 2008-08-08 00:07:25 UTC (rev 9982)
@@ -26,6 +26,7 @@
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
import java.io.StringWriter;
import java.lang.reflect.Constructor;
import java.util.HashMap;
@@ -303,7 +304,14 @@
if (ContextInitParameters.isSerializeServerState(context)) {
ObjectInputStream ois = null;
try {
- ois = new ObjectInputStream(new ByteArrayInputStream((byte[]) state));
+ ois = new ObjectInputStream(new ByteArrayInputStream((byte[]) state)) {
+ @Override
+ protected Class<?> resolveClass(ObjectStreamClass desc)
+ throws IOException, ClassNotFoundException {
+ return Class.forName(desc.getName(), true,
+ Thread.currentThread().getContextClassLoader());
+ }
+ };
return ois.readObject();
} catch (Exception e) {
throw new FacesException(e);
@@ -385,14 +393,21 @@
if (isSavingStateInClient(context)) {
serializedView = (Object[]) responseStateManager.getState(context,
viewId);
+
+ if (null != serializedView) {
+ treeStructure = (TreeStructureNode) serializedView[0];
+ state = (Object[]) serializedView[1];
+ }
} else {
serializedView = restoreStateFromSession(context, viewId,
renderKitId);
+
+ if (null != serializedView) {
+ treeStructure = (TreeStructureNode) serializedView[0];
+ state = (Object[]) handleRestoreState(context, serializedView[1]);
+ }
}
- if (null != serializedView) {
- treeStructure = (TreeStructureNode) serializedView[0];
- state = (Object[]) handleRestoreState(context, serializedView[1]);
- }
+
if (null != treeStructure) {
viewRoot = (UIViewRoot) treeStructure.restore(componentLoader);
if (null != viewRoot && null != state) {
16 years, 5 months
JBoss Rich Faces SVN: r9981 - in trunk/test-applications/seleniumTest/src: test/java/org/richfaces and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-08-07 14:52:59 -0400 (Thu, 07 Aug 2008)
New Revision: 9981
Modified:
trunk/test-applications/seleniumTest/src/main/webapp/pages/columns/columnsTest.xhtml
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxRepeatTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/ColumnsTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/DataTableTest.java
Log:
columns test completed
Modified: trunk/test-applications/seleniumTest/src/main/webapp/pages/columns/columnsTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java 2008-08-07 18:43:48 UTC (rev 9980)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java 2008-08-07 18:52:59 UTC (rev 9981)
@@ -386,17 +386,17 @@
/**
* Asserts DOM node text equals to text defined
- *
- * @param id -
- * DOM element id
+ *
+ * @param locator -
+ * locator an element locator
* @param value -
* text defined
*/
- public void AssertTextEquals(String id, String value) {
- String _v = getTextById(id);
+ public void AssertTextEquals(String locator, String value) {
+ String _v = selenium.getText(locator);
Assert.assertEquals(_v, value);
}
-
+
/**
* Asserts DOM node text equals to text defined
*
@@ -813,12 +813,8 @@
* @param tableId id of table to be checked
*/
public void assertRowsCount(int i, String tableId) {
- StringBuffer script = new StringBuffer("$('");
- script.append(tableId);
- script.append("').rows.length");
-
- String count = runScript(script.toString());
- Assert.assertEquals(count, String.valueOf(i));
+ int count = selenium.getXpathCount("//table[@id='" + tableId + "']/tbody/tr").intValue();
+ Assert.assertEquals(count, i);
}
/**
Modified: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxRepeatTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxRepeatTest.java 2008-08-07 18:43:48 UTC (rev 9980)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxRepeatTest.java 2008-08-07 18:52:59 UTC (rev 9981)
@@ -260,11 +260,6 @@
clickCommandAndWait(buttonId);
}
- private void assertRowsCount(int i, String tableId) {
- int count = selenium.getXpathCount("//table[@id='" + tableId + "']/tbody/tr").intValue();
- Assert.assertEquals(count, i);
- }
-
private void assertInputValue(int row, String inputId, String value) {
String fullInputId = getFullTableElementId(row, inputId);
String elementValue = getValueById(fullInputId);
Modified: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/ColumnsTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/ColumnsTest.java 2008-08-07 18:43:48 UTC (rev 9980)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/ColumnsTest.java 2008-08-07 18:52:59 UTC (rev 9981)
@@ -6,11 +6,94 @@
public class ColumnsTest extends SeleniumTestBase {
+ private static final String DATA_TABLE = "table";
+
+ private static final String APPLY_BUTTON = "apply";
+
+ private static final String RESET_BUTTON = "reset";
+
+ private static final String CTRL_FORM = "_controls";
+
+ private static final String ROWS_COUNT_CTRL = "rows";
+
+ private static final String COLUMNS_COUNT_CTRL = "rows";
+
+ private static final String BEGIN_ROW = "begin";
+
+ private static final String END_ROW = "end";
+
@Test
- public void testColumnsComponent(Template template) {
+ public void testColumnsComponentLayout(Template template) {
renderPage(template);
+ writeStatus("Testing columns component layout");
+
+ String parentId = getParentId() + "_form:";
+ String tableId = parentId + DATA_TABLE;
+
+ writeStatus("Check columns count equals to 3 ");
+ assertColumnsCount(3, tableId);
+
+ writeStatus("Check rows count equals to 20 ");
+ assertRowsCount(20, tableId);
+
+ writeStatus("Check columns headers");
+
+ AssertTextEquals("xpath=//table[@id='" + tableId + "']/tHead/tr[1]/th[1]", "header0");
+ AssertTextEquals("xpath=//table[@id='" + tableId + "']/tHead/tr[1]/th[2]", "header1");
+ AssertTextEquals("xpath=//table[@id='" + tableId + "']/tHead/tr[1]/th[3]", "header2");
+
+ writeStatus("Check columns footers");
+
+ AssertTextEquals("xpath=//table[@id='" + tableId + "']/tFoot/tr[1]/td[1]", "footer0");
+ AssertTextEquals("xpath=//table[@id='" + tableId + "']/tFoot/tr[1]/td[2]", "footer1");
+ AssertTextEquals("xpath=//table[@id='" + tableId + "']/tFoot/tr[1]/td[3]", "footer2");
+
}
+ @Test
+ public void testColumnsComponentCoreAttributes(Template template) {
+ renderPage(template);
+
+ writeStatus("Testing columns component core attributes");
+
+ String parentId = getParentId() + "_form:";
+ String tableId = parentId + DATA_TABLE;
+
+ writeStatus("Set columns count == 5, rows count == 10");
+ adjustTableParams(10, 5, 0, 10);
+
+ writeStatus("Check columns count equals to 5 ");
+ assertColumnsCount(5, tableId);
+ writeStatus("Check rows count equals to 10 ");
+ assertRowsCount(10, tableId);
+
+ writeStatus("Set begin column == 2, end column == 2, rows count = 2");
+ adjustTableParams(2, 5, 2, 2);
+
+ writeStatus("Only one column has to be rendered");
+ assertColumnsCount(1, tableId);
+ assertRowsCount(2, tableId);
+
+ writeStatus("Set end column == 0. there have to be no rows and no columns in the table");
+ adjustTableParams(10, 5, 10, 0);
+ assertRowsCount(0, tableId);
+
+ reset();
+ }
+
+ private void adjustTableParams(int rows, int columns, int begin, int end) {
+ String ctrlForm = getParentId() + CTRL_FORM;
+ type(ctrlForm + ":rows", String.valueOf(rows));
+ type(ctrlForm + ":columns", String.valueOf(columns));
+ type(ctrlForm + ":begin", String.valueOf(begin));
+ type(ctrlForm + ":end", String.valueOf(end));
+ clickAjaxCommandAndWait(ctrlForm + ":apply");
+ }
+
+ private void reset() {
+ clickAjaxCommandAndWait(getParentId() + CTRL_FORM + ":reset");
+ }
+
@Override
public String getTestUrl() {
return "pages/columns/columnsTest.xhtml";
Modified: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/DataTableTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/DataTableTest.java 2008-08-07 18:43:48 UTC (rev 9980)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/DataTableTest.java 2008-08-07 18:52:59 UTC (rev 9981)
@@ -23,8 +23,8 @@
writeStatus("Check columns count equals to 3 ");
assertColumnsCount(3, dataTableId);
- writeStatus("Check rows count equals to 22 ");
- assertRowsCount(22, dataTableId);
+ writeStatus("Check rows count equals to 20 ");
+ assertRowsCount(20, dataTableId);
String columnsId = getColumnId(dataTableId, 0);
@@ -90,8 +90,8 @@
writeStatus("Check columns count equals to 5 ");
assertColumnsCount(5, dataTableId);
- writeStatus("Check rows count equals to 12 ");
- assertRowsCount(12, dataTableId);
+ writeStatus("Check rows count equals to 10 ");
+ assertRowsCount(10, dataTableId);
columnsId = getColumnId(dataTableId, 0);
@@ -137,7 +137,7 @@
changeColumnCount(getParentId(),2, 5, 2, 2);
assertColumnsCount(1, dataTableId);
- assertRowsCount(4, dataTableId);
+ assertRowsCount(2, dataTableId);
changeColumnCount(getParentId(), 10, 5, 10, 0);
assertRowsCount(0, dataTableId);
16 years, 5 months
JBoss Rich Faces SVN: r9980 - trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-08-07 14:43:48 -0400 (Thu, 07 Aug 2008)
New Revision: 9980
Modified:
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
Log:
https://jira.jboss.org/jira/browse/RF-3639
Modified: trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
--- trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2008-08-07 17:26:56 UTC (rev 9979)
+++ trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2008-08-07 18:43:48 UTC (rev 9980)
@@ -266,7 +266,10 @@
},
showDropDownLayer: function (layerId, parentId, e, delay){
this.clearPopUpTO();
- this.showTimeOutFlag = setTimeout(new RichFaces.Menu.DelayedDropDown(layerId, parentId, e).show, delay);
+ var menu = new RichFaces.Menu.DelayedDropDown(layerId, parentId, e);
+ if (menu.show) {
+ this.showTimeOutFlag = setTimeout(menu.show, delay);
+ }
},
showPopUpLayer: function (layer, e){
this.shutdown();
@@ -443,14 +446,22 @@
}
//bugs RF-2102, RF-2119, RF-3639
- if (Event.element(e).tagName.toLowerCase() == "a") {
- return;
- }
+ var node = (e.target || e.srcElement);
+ var isLabel = false;
+ while (node && node.id != elementId.id) {
+ if (node.className == 'dr-label-text-decor rich-label-text-decor') {//TODO: replace magic
+ isLabel = true;
+ }
+ node = node.parentNode;
+ }
+
+ if (!isLabel) return;
+
this.event = e;
this.element = $(elementId) || Event.element(e);
this.layer = $(layer);
Event.stop(e);
-
+
this.listPositions = function(jp, dir) {
var poss = new Array(new Array(2,1,4),new Array(1,2,3),new Array(4,3,2),new Array(3,4,1));
var list = new Array();
@@ -1320,7 +1331,7 @@
}
if(!this.options.disabled) {
RichFaces.Menu.Items.onmouseout(this);
- }
+ }
},
getElement: function() {
return $(this.id);
16 years, 5 months
JBoss Rich Faces SVN: r9979 - in trunk/ui/hotKey/src: main/resources/org/richfaces/renderkit/html/scripts and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-08-07 13:26:56 -0400 (Thu, 07 Aug 2008)
New Revision: 9979
Modified:
trunk/ui/hotKey/src/main/config/component/hotKey.xml
trunk/ui/hotKey/src/main/resources/org/richfaces/renderkit/html/scripts/jquery.hotkeys.js
trunk/ui/hotKey/src/main/templates/org/richfaces/htmlHotKey.jspx
trunk/ui/hotKey/src/test/java/org/richfaces/component/HotKeyComponentTest.java
Log:
https://jira.jboss.org/jira/browse/RF-4021
Modified: trunk/ui/hotKey/src/main/config/component/hotKey.xml
===================================================================
--- trunk/ui/hotKey/src/main/config/component/hotKey.xml 2008-08-07 17:04:14 UTC (rev 9978)
+++ trunk/ui/hotKey/src/main/config/component/hotKey.xml 2008-08-07 17:26:56 UTC (rev 9979)
@@ -86,5 +86,10 @@
</description>
<defaultvalue>""</defaultvalue>
</property>
+ <property>
+ <name>disableInInputTypes</name>
+ <classname>java.lang.String</classname>
+ <defaultvalue>""</defaultvalue>
+ </property>
</component>
</components>
Modified: trunk/ui/hotKey/src/main/resources/org/richfaces/renderkit/html/scripts/jquery.hotkeys.js
===================================================================
--- trunk/ui/hotKey/src/main/resources/org/richfaces/renderkit/html/scripts/jquery.hotkeys.js 2008-08-07 17:04:14 UTC (rev 9978)
+++ trunk/ui/hotKey/src/main/resources/org/richfaces/renderkit/html/scripts/jquery.hotkeys.js 2008-08-07 17:26:56 UTC (rev 9979)
@@ -57,13 +57,15 @@
return node[this._uniqueIDExpando];
};
+ this.buttonInputTypes = /^(submit|button|reset)$/i;
+
this.add = function(combi, options, callback) {
if (jQuery.isFunction(options)){
callback = options;
options = {};
}
var opt = {},
- defaults = {type: 'keydown', propagate: false, disableInInput: false, target: jQuery('html')[0], checkParent: true},
+ defaults = {type: 'keydown', propagate: false, disableInInput: false, disableInInputTypes: 'all', target: jQuery('html')[0], checkParent: true},
that = this;
opt = jQuery.extend( opt , defaults, options || {} );
combi = combi.toLowerCase();
@@ -77,8 +79,30 @@
if(opt['disableInInput']) { // Disable shortcut keys in Input, Textarea fields
var target = jQuery(element);
- if( target.is("input") || target.is("textarea")){
- return;
+ var types = opt['disableInInputTypes'];
+
+ if (target.is("input")) {
+ if ('all' == types) {
+ return;
+ } else {
+ if (that.buttonInputTypes.test(target.attr('type'))) {
+ if ('buttons' == types) {
+ return;
+ }
+ } else {
+ if ('inputs' == types) {
+ return;
+ }
+ }
+ }
+ } else if (target.is("textarea")) {
+ if ('inputs' == types || 'all' == types) {
+ return;
+ }
+ } else if (target.is("button")) {
+ if ('buttons' == types || 'all' == types) {
+ return;
+ }
}
}
var code = event.which,
Modified: trunk/ui/hotKey/src/main/templates/org/richfaces/htmlHotKey.jspx
===================================================================
--- trunk/ui/hotKey/src/main/templates/org/richfaces/htmlHotKey.jspx 2008-08-07 17:04:14 UTC (rev 9978)
+++ trunk/ui/hotKey/src/main/templates/org/richfaces/htmlHotKey.jspx 2008-08-07 17:26:56 UTC (rev 9979)
@@ -60,6 +60,22 @@
options.append(disableInInput);
}
+ String disableInInputTypes = (String) attributes.get("disableInInputTypes");
+ if (disableInInputTypes != null && disableInInputTypes.length() > 0) {
+ if (Boolean.TRUE.equals(disableInInput)) {
+ options.append(",disableInInputTypes:");
+ options.append('\'');
+ options.append(getUtils().escapeJavaScript(disableInInputTypes));
+ options.append('\'');
+ } else {
+ context.getExternalContext().log(
+ "Attribute disableInInputTypes='" + disableInInputTypes +
+ "' will be ignored for component '" +
+ org.richfaces.component.util.MessageUtil.getLabel(context, component) +
+ "', because value of disableInInput attribute is not 'true'");
+ }
+ }
+
Boolean checkParent = (Boolean) attributes.get("checkParent");
if (checkParent != null) {
options.append(",checkParent:");
Modified: trunk/ui/hotKey/src/test/java/org/richfaces/component/HotKeyComponentTest.java
===================================================================
--- trunk/ui/hotKey/src/test/java/org/richfaces/component/HotKeyComponentTest.java 2008-08-07 17:04:14 UTC (rev 9978)
+++ trunk/ui/hotKey/src/test/java/org/richfaces/component/HotKeyComponentTest.java 2008-08-07 17:26:56 UTC (rev 9979)
@@ -154,6 +154,7 @@
attributes.put("type", "keypress");
attributes.put("propagate", Boolean.TRUE);
attributes.put("disableInInput", Boolean.FALSE);
+ attributes.put("disableInInputTypes", "all");
attributes.put("checkParent", Boolean.TRUE);
String scriptBody = processScriptBody();
@@ -166,10 +167,11 @@
attributes.put("type", "onkeyup");
attributes.put("propagate", Boolean.FALSE);
attributes.put("disableInInput", Boolean.TRUE);
+ attributes.put("disableInInputTypes", "texts");
attributes.put("checkParent", Boolean.FALSE);
String scriptBody = processScriptBody();
- assertEquals("'myForm:hKey','','',{timing:'onload',type:'keyup',propagate:false,disableInInput:true,checkParent:false},function(event){}", scriptBody);
+ assertEquals("'myForm:hKey','','',{timing:'onload',type:'keyup',propagate:false,disableInInput:true,disableInInputTypes:'texts',checkParent:false},function(event){}", scriptBody);
}
public void testHandler() throws Exception {
16 years, 5 months
JBoss Rich Faces SVN: r9978 - trunk/ui/panelbar/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-08-07 13:04:14 -0400 (Thu, 07 Aug 2008)
New Revision: 9978
Modified:
trunk/ui/panelbar/src/main/resources/org/richfaces/renderkit/html/scripts/panelbar.js
Log:
https://jira.jboss.org/jira/browse/RF-3526
Modified: trunk/ui/panelbar/src/main/resources/org/richfaces/renderkit/html/scripts/panelbar.js
===================================================================
--- trunk/ui/panelbar/src/main/resources/org/richfaces/renderkit/html/scripts/panelbar.js 2008-08-07 15:23:29 UTC (rev 9977)
+++ trunk/ui/panelbar/src/main/resources/org/richfaces/renderkit/html/scripts/panelbar.js 2008-08-07 17:04:14 UTC (rev 9978)
@@ -7,8 +7,8 @@
initialize: function(panelId, options) {
- this.FF = (RichFaces.navigatorType() == RichFaces.FF)?true:false;
- this.isIE = ((navigator.userAgent.toLowerCase().indexOf("msie")!=-1) || (navigator.userAgent.toLowerCase().indexOf("explorer")!=-1))?true:false;
+// this.FF = (RichFaces.navigatorType() == RichFaces.FF)?true:false;
+// this.isIE = ((navigator.userAgent.toLowerCase().indexOf("msie")!=-1) || (navigator.userAgent.toLowerCase().indexOf("explorer")!=-1))?true:false;
this.panel=$(panelId); //+"_p"
if (!this.panel) {
@@ -78,9 +78,13 @@
var h=0;
this.hclient=0;
for(var i=0; i<this.slides.length; i++) {
+ if (Richfaces.browser.isIE6) {
+ // https://jira.jboss.org/jira/browse/RF-3526
+ var processItem = this.slides[i].item;
+ h+= (processItem.offsetHeight -(this.getBorderTB(processItem) + this.getPaddingTB(processItem)));
+ } else {
h+=this.slides[i].item.offsetHeight;
-
-
+ }
}
this.hclient=h;
this.contentHight = this.panel.clientHeight-h;
@@ -89,6 +93,18 @@
return this.contentHight;
},
+ getBorderTB: function(el){
+ var top = parseInt(Element.getStyle(el, "border-top-width", 10));
+ var bottom = parseInt(Element.getStyle(el, "border-bottom-width", 10));
+ return (top + bottom);
+ },
+
+ getPaddingTB: function(el){
+ var top = parseInt(Element.getStyle(el, "padding-top-", 10));
+ var bottom = parseInt(Element.getStyle(el, "padding-bottom", 10));
+ return (top + bottom);
+ },
+
showSlide: function(slide) {
if (this.current) this.current.hideContent();
16 years, 5 months
JBoss Rich Faces SVN: r9977 - in trunk/docs/userguide/en/src/main/docbook: modules and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: smukhina
Date: 2008-08-07 11:23:29 -0400 (Thu, 07 Aug 2008)
New Revision: 9977
Modified:
trunk/docs/userguide/en/src/main/docbook/included/hotKey.xml
trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml
Log:
https://jira.jboss.org/jira/browse/RF-3984
language is checked
Modified: trunk/docs/userguide/en/src/main/docbook/included/hotKey.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/hotKey.xml 2008-08-07 15:22:45 UTC (rev 9976)
+++ trunk/docs/userguide/en/src/main/docbook/included/hotKey.xml 2008-08-07 15:23:29 UTC (rev 9977)
@@ -190,7 +190,7 @@
add(selector, key, handler)
</entry>
<entry>
- Adds the hotkey(from key param) for elements targeted by selector. Assigns handler function to the key
+ Adds the hotkey(from key param) for elements targeted by selector. it assigns a handler function to the key
</entry>
</row>
<row>
Modified: trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml 2008-08-07 15:22:45 UTC (rev 9976)
+++ trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml 2008-08-07 15:23:29 UTC (rev 9977)
@@ -4488,12 +4488,12 @@
</mediaobject>
</figure>
<para>
- <property>RichFaces State API</property> allows easily define some set of states for the pages and any properties for this states.
+ <property>RichFaces State API</property> allows easily to define some set of states for the pages and any properties for this states.
</para>
<para>
- Actually States is a <property>map</property> where the entry key is name of the State and the value is a State map.
- Concrete State map has entries with some names as keys and any objects as values that are used after the state activation.
- So, in the State map you could define any values, method bindings, or just some simple state varialbes (constants)
+ Actually States is a <property>map</property> where the entry key is a name of the State and the value is a State map.
+ Particular State map has entries with some names as keys and any objects as values that are used after the state activation.
+ Thus, in the State map you could define any values, method bindings, or just some simple state variables (constants)
which have different values for every State.
</para>
<figure>
@@ -4511,12 +4511,12 @@
The <property>RichFaces State API</property> implements states change as the standard JSF navigation.
Action component just returns outcome and the RichFaces State API
<property>extension for the JSF navigation handler</property>
- checks if this outcome registered as a <property>state change outcome</property>.
- If the <property>state change outcome</property> is found corresponding state is activated.
+ checks whether this outcome is registered as a <property>state change outcome</property> or not.
+ If the <property>state change outcome</property> is found the corresponding state is activated.
Otherwise the standard navigation handling is called.
</para>
<para>
- In order to use <property>RichFaces State API</property> you should perform next steps:
+ In order to use <property>RichFaces State API</property> you should follow the next steps:
</para>
<itemizedlist>
<listitem>
16 years, 5 months
JBoss Rich Faces SVN: r9976 - in trunk/samples/tree-demo/src/main: java/org/richfaces/rf3899 and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-08-07 11:22:45 -0400 (Thu, 07 Aug 2008)
New Revision: 9976
Added:
trunk/samples/tree-demo/src/main/java/org/richfaces/rf3899/
trunk/samples/tree-demo/src/main/java/org/richfaces/rf3899/Bean.java
trunk/samples/tree-demo/src/main/webapp/images/rf-3899.png
trunk/samples/tree-demo/src/main/webapp/pages/rf-3899.jsp
Modified:
trunk/samples/tree-demo/src/main/webapp/WEB-INF/faces-config.xml
Log:
https://jira.jboss.org/jira/browse/RF-3899
Added: trunk/samples/tree-demo/src/main/java/org/richfaces/rf3899/Bean.java
===================================================================
--- trunk/samples/tree-demo/src/main/java/org/richfaces/rf3899/Bean.java (rev 0)
+++ trunk/samples/tree-demo/src/main/java/org/richfaces/rf3899/Bean.java 2008-08-07 15:22:45 UTC (rev 9976)
@@ -0,0 +1,58 @@
+/**
+ * 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.rf3899;
+
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.richfaces.component.UITree;
+
+/**
+ */
+
+public class Bean {
+
+ private static final String KEY_NAME = Bean.class.getName();
+ private int requestCounter = -1;
+
+ private int getRequestNumber() {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Map<String, Object> map = context.getExternalContext().getRequestMap();
+ if (map.get(KEY_NAME) == null) {
+ map.put(KEY_NAME, Boolean.TRUE);
+ return ++requestCounter;
+ } else {
+ return requestCounter;
+ }
+ }
+
+ public Boolean adviseNodeOpened(UITree tree) {
+ int num = getRequestNumber();
+
+ if (num < 1) {
+ return Boolean.FALSE;
+ } else {
+ return Boolean.TRUE;
+ }
+ }
+}
Modified: trunk/samples/tree-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/samples/tree-demo/src/main/webapp/WEB-INF/faces-config.xml 2008-08-07 15:22:38 UTC (rev 9975)
+++ trunk/samples/tree-demo/src/main/webapp/WEB-INF/faces-config.xml 2008-08-07 15:22:45 UTC (rev 9976)
@@ -23,5 +23,11 @@
<managed-bean-name>skinBean</managed-bean-name>
<managed-bean-class>org.richfaces.SkinBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
+ <managed-bean>
+ <managed-bean-name>rf3899</managed-bean-name>
+ <managed-bean-class>org.richfaces.rf3899.Bean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>
Added: trunk/samples/tree-demo/src/main/webapp/images/rf-3899.png
===================================================================
(Binary files differ)
Property changes on: trunk/samples/tree-demo/src/main/webapp/images/rf-3899.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/tree-demo/src/main/webapp/pages/rf-3899.jsp
===================================================================
--- trunk/samples/tree-demo/src/main/webapp/pages/rf-3899.jsp (rev 0)
+++ trunk/samples/tree-demo/src/main/webapp/pages/rf-3899.jsp 2008-08-07 15:22:45 UTC (rev 9976)
@@ -0,0 +1,40 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
+<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/tree" prefix="rich"%>
+<html>
+ <head>
+ <title></title>
+ </head>
+ <body>
+ <f:view>
+ Try to expand any node. The whole tree should be expanded.
+
+ <h:panelGroup layout="block" id="imageHidden" style="padding: 10px; border: 1px solid navy;">
+ <h:outputLink value="#" onclick="Element.show('imageShown'); Element.hide('imageHidden'); return false;">
+ Click here to see the wrong variant
+ </h:outputLink>
+ </h:panelGroup>
+ <h:panelGroup layout="block" id="imageShown" style="padding: 10px; border: 1px solid navy; display: none;">
+ <h:graphicImage value="../images/rf-3899.png" /><br />
+ <h:outputLink value="#" onclick="Element.hide('imageShown'); Element.show('imageHidden'); return false;">
+ Hide
+ </h:outputLink>
+ </h:panelGroup>
+
+
+ <a4j:outputPanel ajaxRendered="true">
+ <h:messages />
+ </a4j:outputPanel>
+
+ <h:form>
+ <rich:tree value="#{bean.data}" switchType="server" immediate="true" adviseNodeOpened="#{rf3899.adviseNodeOpened}"></rich:tree>
+ </h:form>
+
+ <a4j:status startText="...start..." />
+
+ <a4j:log hotkey="O" />
+
+ </f:view>
+ </body>
+</html>
16 years, 5 months
JBoss Rich Faces SVN: r9975 - in trunk/ui/tree/src: main/java/org/richfaces/component/state and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-08-07 11:22:38 -0400 (Thu, 07 Aug 2008)
New Revision: 9975
Modified:
trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java
trunk/ui/tree/src/main/java/org/richfaces/component/state/TreeState.java
trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
trunk/ui/tree/src/test/java/org/richfaces/component/TreeComponentTest.java
Log:
https://jira.jboss.org/jira/browse/RF-3899
Modified: trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java 2008-08-07 15:20:19 UTC (rev 9974)
+++ trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java 2008-08-07 15:22:38 UTC (rev 9975)
@@ -365,12 +365,10 @@
super.resetDataModel();
TreeState state = (TreeState) getComponentState();
- // transfer nodes delayed to open to rendering queue
- state.transferQueuedNodes();
// re-set stopInCollapsed to handle AJAX switch type change
state.setStopInCollapsed(isStopInCollapsed());
}
-
+
public void walk(FacesContext faces, DataVisitor visitor)
throws IOException {
@@ -1176,6 +1174,11 @@
public Object getParentRowKey(Object rowKey) {
return ((AbstractTreeDataModel) getExtendedDataModel()).getParentRowKey(rowKey);
}
+
+ public void transferQueuedNode() {
+ TreeState treeState = (TreeState) getComponentState();
+ treeState.transferQueuedNodes((TreeRowKey) getRowKey());
+ }
}
Modified: trunk/ui/tree/src/main/java/org/richfaces/component/state/TreeState.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/component/state/TreeState.java 2008-08-07 15:20:19 UTC (rev 9974)
+++ trunk/ui/tree/src/main/java/org/richfaces/component/state/TreeState.java 2008-08-07 15:22:38 UTC (rev 9975)
@@ -23,11 +23,12 @@
import java.io.IOException;
import java.io.Serializable;
-import java.util.ArrayList;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.List;
+import java.util.Map;
import java.util.Set;
+import java.util.Map.Entry;
import javax.faces.application.FacesMessage;
import javax.faces.component.StateHolder;
@@ -53,63 +54,36 @@
*/
private static final long serialVersionUID = 9083705369340888171L;
- private final class Visitor implements DataVisitor {
- private TreeRowKey key;
+ enum NodeState {
+ EXPANDED, COLLAPSED;
+ }
+
+ private class ExpansionVisitor implements DataVisitor {
private UITree tree;
- public Visitor(TreeRowKey key, UITree tree) {
+ public ExpansionVisitor(UITree tree) {
super();
- this.key = key;
+
this.tree = tree;
}
public void process(FacesContext context, Object rowKey, Object argument)
throws IOException {
tree.setRowKey(context, rowKey);
- if (tree.isRowAvailable()) {
- TreeRowKey nextKey = (TreeRowKey) rowKey;
-
- if (!tree.isLeaf() && nextKey != null) {
- if (key == null || nextKey.isSubKey(key)
- || nextKey.equals(key)) {
- if (tree.isImmediate()) {
- queuedExpandedNodes.add(nextKey);
- } else {
- expandedNodes.add(nextKey);
- }
- queuedCollapsedNodes.remove(nextKey);
- }
- }
- } else {
- FacesMessage message = new FacesMessage("Row key: " + rowKey
- + " isn't available!");
- message.setSeverity(FacesMessage.SEVERITY_ERROR);
-
- context.addMessage(tree.getBaseClientId(context), message);
+ if (!tree.isLeaf()) {
+ addQueuedState((TreeRowKey) rowKey, NodeState.EXPANDED);
}
}
- }
-
- private final static TreeRange RANGE_UNCONSTRAINED = new TreeRange() {
- public boolean processChildren(TreeRowKey rowKey) {
- return true;
- }
-
- public boolean processNode(TreeRowKey rowKey) {
- return true;
- }
};
-
+
private boolean stopInCollapsed = false;
private TreeRowKey selectedNode = null;
- private Set expandedNodes = new HashSet();
+ private Set<TreeRowKey> expandedNodes = new HashSet<TreeRowKey>();
- private Set queuedExpandedNodes = new HashSet();
+ private Map<TreeRowKey, NodeState> queuedNodeStates = new HashMap<TreeRowKey, NodeState>();
- private Set queuedCollapsedNodes = new HashSet();
-
public TreeState() {
super();
}
@@ -124,8 +98,8 @@
return true;
}
- return expandedNodes.contains(rowKey)
- || queuedExpandedNodes.contains(rowKey);
+ return expandedNodes.contains(rowKey) ||
+ NodeState.EXPANDED.equals(queuedNodeStates.get(rowKey));
}
public boolean isSelected(TreeRowKey rowKey) {
@@ -142,13 +116,7 @@
private boolean _transient;
- private transient TreeRange treeRange = null;
-
public Range getRange() {
- if (treeRange != null) {
- return treeRange;
- }
-
if (stopInCollapsed) {
return new TreeRange() {
@@ -165,7 +133,7 @@
}
};
} else {
- return RANGE_UNCONSTRAINED;
+ return TreeRange.RANGE_UNCONSTRAINED;
}
}
@@ -176,21 +144,19 @@
public void restoreState(FacesContext context, Object state) {
Object[] _state = (Object[]) state;
expandedNodes = (Set) _state[0];
- _transient = ((Boolean) _state[1]).booleanValue();
- stopInCollapsed = ((Boolean) _state[2]).booleanValue();
- selectedNode = (TreeRowKey) _state[3];
- queuedExpandedNodes = (Set) _state[4];
- queuedCollapsedNodes = (Set) _state[5];
+ queuedNodeStates = (Map) _state[1];
+ _transient = ((Boolean) _state[2]).booleanValue();
+ stopInCollapsed = ((Boolean) _state[3]).booleanValue();
+ selectedNode = (TreeRowKey) _state[4];
}
public Object saveState(FacesContext context) {
- Object[] state = new Object[6];
+ Object[] state = new Object[5];
state[0] = expandedNodes;
- state[1] = new Boolean(_transient);
- state[2] = new Boolean(stopInCollapsed);
- state[3] = selectedNode;
- state[4] = queuedExpandedNodes;
- state[5] = queuedCollapsedNodes;
+ state[1] = queuedNodeStates;
+ state[2] = Boolean.valueOf(_transient);
+ state[3] = Boolean.valueOf(stopInCollapsed);
+ state[4] = selectedNode;
return state;
}
@@ -206,96 +172,101 @@
this.stopInCollapsed = stopInCollapsed;
}
- private void visitNodes(UITree tree, TreeRange treeRange, TreeRowKey rootKey)
- throws IOException {
- try {
- this.treeRange = treeRange;
- Object oldKey = tree.getRowKey();
-
- tree.walkModel(FacesContext.getCurrentInstance(), new Visitor(
- rootKey, tree), treeRange, rootKey, null);
- tree.setRowKey(oldKey);
- } finally {
- this.treeRange = null;
- }
- }
-
public void expandAll(UITree tree) throws IOException {
- queuedCollapsedNodes.clear();
- // SubTreeChildrenAppender infoAppender = null;
- //
- // if (storedPersister != null) {
- // storedPersister.reset();
- // infoAppender = storedPersister.getAppender(null);
- // }
-
- visitNodes(tree, RANGE_UNCONSTRAINED, null);
+ queuedNodeStates = new HashMap<TreeRowKey, NodeState>();
+
+ tree.walk(FacesContext.getCurrentInstance(),
+ new ExpansionVisitor(tree), TreeRange.RANGE_UNCONSTRAINED, null, null);
}
public void collapseAll(UITree tree) throws IOException {
- expandedNodes.clear();
- queuedExpandedNodes.clear();
- // RequestUtils.setStoredPersister(tree.getBaseClientId(context),
- // context, null);
+ queuedNodeStates = new HashMap<TreeRowKey, NodeState>();
+
+ for (TreeRowKey key : expandedNodes) {
+ addQueuedState(key, NodeState.COLLAPSED);
+ }
}
- public void collapseNode(UITree tree, TreeRowKey rowKey) throws IOException {
- expandedNodes.remove(rowKey);
- queuedExpandedNodes.remove(rowKey);
- queuedCollapsedNodes.add(rowKey);
- // TreePersister storedPersister =
- // RequestUtils.getStoredPersister(tree.getBaseClientId(context),
- // context);
- // if (storedPersister != null) {
- // storedPersister.removeNode(rowKey);
- // }
+ public void addQueuedState(TreeRowKey rowKey, NodeState state) {
+ if (NodeState.EXPANDED.equals(state)) {
+ if (!expandedNodes.contains(rowKey)) {
+ queuedNodeStates.put(rowKey, NodeState.EXPANDED);
+ }
+ } else {
+ queuedNodeStates.put(rowKey, NodeState.COLLAPSED);
+ }
}
- public void expandNode(UITree tree, final TreeRowKey rowKey) throws IOException {
- // SubTreeChildrenAppender infoAppender;
- // if (storedPersister != null) {
- // infoAppender = storedPersister.getAppender(rowKey);
- // } else {
- // infoAppender = null;
- // }
-
- TreeRange range;
- // it's enough to traverse only subkeys of the node
- // we're opening
- range = new TreeRange() {
- public boolean processChildren(TreeRowKey nextKey) {
- return true;
+ public void collapseNode(UITree tree, TreeRowKey rowKey) throws IOException {
+ addQueuedState(rowKey, NodeState.COLLAPSED);
+ }
+
+ public void expandNode(UITree tree, TreeRowKey rowKey) throws IOException {
+ Object oldRowKey = tree.getRowKey();
+
+ tree.setRowKey(rowKey);
+
+ if (tree.isRowAvailable()) {
+ if (!tree.isLeaf()) {
+ TreeRowKey key = rowKey;
+
+ while (key != null && key.depth() != 0) {
+ addQueuedState(key, NodeState.EXPANDED);
+ key = (TreeRowKey) tree.getParentRowKey(key);
+ };
+
+ } else {
+ //TODO debug log
}
+ } else {
+ FacesMessage message = new FacesMessage("Row key: " + rowKey
+ + " isn't available!");
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
- public boolean processNode(TreeRowKey nextKey) {
- return (rowKey == null && nextKey == null)
- || nextKey.equals(rowKey)
- || nextKey.isSubKey(rowKey);
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ context.addMessage(tree.getBaseClientId(context), message);
+ }
+
+ tree.setRowKey(oldRowKey);
+ }
+
+ private void transferState(TreeRowKey key, NodeState state) {
+ if (state != null) {
+ if (NodeState.EXPANDED.equals(state)) {
+ expandedNodes.add(key);
+ } else {
+ expandedNodes.remove(key);
}
-
- };
- visitNodes(tree, range, rowKey);
-
+ }
}
+
+ public void transferQueuedNodes(TreeRowKey rootKey) {
+ Iterator<Entry<TreeRowKey, NodeState>> itr = queuedNodeStates.entrySet().iterator();
+ while (itr.hasNext()) {
+ Entry<TreeRowKey, NodeState> entry = itr.next();
+ TreeRowKey rowKey = entry.getKey();
+
+ if (rootKey == null || rootKey.depth() == 0 || rootKey.isSubKey(rowKey)) {
+ transferState(rowKey, entry.getValue());
+
+ itr.remove();
+ }
+ }
- public void transferQueuedNodes() {
- expandedNodes.addAll(queuedExpandedNodes);
- queuedExpandedNodes.clear();
- expandedNodes.removeAll(queuedCollapsedNodes);
- queuedCollapsedNodes.clear();
+ if (queuedNodeStates.isEmpty()) {
+ queuedNodeStates = new HashMap<TreeRowKey, NodeState>();
+ }
}
+
+ public void makeExpanded(TreeRowKey key) {
+ queuedNodeStates.remove(key);
+ expandedNodes.add(key);
+ }
- private List<TreeRowKey> getAllSubKeys(Set nodes, TreeRowKey parent) {
- List<TreeRowKey> keys = new ArrayList<TreeRowKey>();
- Iterator<TreeRowKey> iter = nodes.iterator();
- while (iter != null && iter.hasNext()) {
- TreeRowKey key = iter.next();
- if (key != null && (parent.isSubKey(key) || parent.equals(key))) {
- keys.add(key);
- }
- }
-
- return keys;
+ public void makeCollapsed(TreeRowKey key) {
+ queuedNodeStates.remove(key);
+ expandedNodes.remove(key);
}
public TreeState getSubState(TreeRowKey rowKey) {
@@ -306,24 +277,28 @@
// FIXME: whether it is needed?
subTreeState._transient = _transient;
- List<TreeRowKey> nodes = getAllSubKeys(this.expandedNodes, rowKey);
- Iterator<TreeRowKey> iter = nodes != null ? nodes.iterator() : null;
- while (iter != null && iter.hasNext()) {
- subTreeState.expandedNodes.add(iter.next().getSubKey(rowKey.depth() - 1));
+ int subKeyDepth = rowKey.depth() - 1;
+
+ for (Iterator<TreeRowKey> iter = this.expandedNodes.iterator(); iter.hasNext(); ) {
+ TreeRowKey nextKey = iter.next();
+ if (nextKey != null && rowKey.isSubKey(nextKey)) {
+ subTreeState.expandedNodes.add(nextKey.getSubKey(subKeyDepth));
+ }
}
- nodes = getAllSubKeys(this.queuedExpandedNodes, rowKey);
- iter = nodes != null ? nodes.iterator() : null;
- while (iter != null && iter.hasNext()) {
- subTreeState.queuedExpandedNodes.add(iter.next().getSubKey(rowKey.depth() - 1));
- }
+ for (Iterator<Entry<TreeRowKey, NodeState>> iter = this.queuedNodeStates.entrySet().iterator();
+ iter.hasNext(); ) {
- nodes = getAllSubKeys(this.queuedCollapsedNodes, rowKey);
- iter = nodes != null ? nodes.iterator() : null;
- while (iter != null && iter.hasNext()) {
- subTreeState.queuedCollapsedNodes.add(iter.next().getSubKey(rowKey.depth() - 1));
+ Entry<TreeRowKey, NodeState> entry = iter.next();
+
+ TreeRowKey nextKey = entry.getKey();
+
+ if (nextKey != null && rowKey.isSubKey(nextKey)) {
+ subTreeState.queuedNodeStates.put(nextKey.getSubKey(subKeyDepth),
+ entry.getValue());
+ }
}
-
+
return subTreeState;
}
@@ -333,29 +308,26 @@
}
if (rowKey.getPath().equals("null")) { // root node
- this.expandedNodes.clear();
- this.queuedCollapsedNodes.clear();
- this.queuedExpandedNodes.clear();
- } else {
- // collect nodes to clean up
- List<TreeRowKey> nodes = getAllSubKeys(this.expandedNodes, rowKey);
- Iterator<TreeRowKey> iter = nodes != null ? nodes.iterator() : null;
- while (iter != null && iter.hasNext()) {
- this.expandedNodes.remove(iter.next());
- }
-
- nodes = getAllSubKeys(this.queuedExpandedNodes, rowKey);
- iter = nodes != null ? nodes.iterator() : null;
- while (iter != null && iter.hasNext()) {
- this.queuedExpandedNodes.remove(iter.next());
- }
-
- nodes = getAllSubKeys(this.queuedCollapsedNodes, rowKey);
- iter = nodes != null ? nodes.iterator() : null;
- while (iter != null && iter.hasNext()) {
- this.queuedCollapsedNodes.remove(iter.next());
- }
- }
+ this.expandedNodes.clear();
+ this.queuedNodeStates = new HashMap<TreeRowKey, NodeState>();
+ } else {
+ // collect nodes to clean up
+ for (Iterator<TreeRowKey> itr = this.expandedNodes.iterator(); itr.hasNext(); ) {
+ TreeRowKey nextKey = itr.next();
+ if (nextKey != null && rowKey.isSubKey(nextKey)) {
+ itr.remove();
+ }
+ }
+
+ for (Iterator<Entry<TreeRowKey, NodeState>> itr =
+ this.queuedNodeStates.entrySet().iterator(); itr.hasNext(); ) {
+
+ TreeRowKey nextKey = itr.next().getKey();
+ if (nextKey != null && rowKey.isSubKey(nextKey)) {
+ itr.remove();
+ }
+ }
+ }
}
public void mergeSubState(TreeRowKey rowKey, TreeState subState) {
@@ -363,28 +335,26 @@
while (iter != null && iter.hasNext()) {
TreeRowKey key = iter.next().getSubKey(1);
if (key.depth() > 0) {
- expandedNodes.add(new ListRowKey((ListRowKey)rowKey, (ListRowKey)key));
+ expandedNodes.add(new ListRowKey((ListRowKey)rowKey, (ListRowKey)key));
} else if (!expandedNodes.contains(rowKey)) {
- expandedNodes.add(rowKey);
+ expandedNodes.add(rowKey);
}
}
- iter = subState.queuedExpandedNodes.iterator();
- while (iter != null && iter.hasNext()) {
- TreeRowKey key = iter.next().getSubKey(1);
+
+ Iterator<Entry<TreeRowKey, NodeState>> sItr = subState.queuedNodeStates.entrySet().iterator();
+ while (sItr.hasNext()) {
+ Entry<TreeRowKey, NodeState> entry = sItr.next();
+ TreeRowKey key = entry.getKey().getSubKey(1);
+
+ TreeRowKey newKey;
+
if (key.depth() > 0) {
- queuedExpandedNodes.add(new ListRowKey((ListRowKey)rowKey, (ListRowKey)key));
- } else if (!queuedExpandedNodes.contains(rowKey)) {
- queuedExpandedNodes.add(rowKey);
+ newKey = new ListRowKey((ListRowKey)rowKey, (ListRowKey)key);
+ } else {
+ newKey = rowKey;
}
+
+ addQueuedState(newKey, entry.getValue());
}
- iter = subState.queuedCollapsedNodes.iterator();
- while (iter != null && iter.hasNext()) {
- TreeRowKey key = iter.next().getSubKey(1);
- if (key.depth() > 0) {
- queuedCollapsedNodes.add(new ListRowKey((ListRowKey)rowKey, (ListRowKey)key));
- } else if (!queuedCollapsedNodes.contains(rowKey)) {
- queuedCollapsedNodes.add(rowKey);
- }
- }
}
}
Modified: trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2008-08-07 15:20:19 UTC (rev 9974)
+++ trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2008-08-07 15:22:38 UTC (rev 9975)
@@ -238,10 +238,12 @@
public void process(FacesContext context, Object rowKey, Object argument)
throws IOException {
- processAdvisors(context, (TreeRowKey)rowKey);
+ TreeRowKey<?> treeRowKey = (TreeRowKey<?>) rowKey;
- navigator.followRowKey(context, (TreeRowKey) rowKey);
+ processAdvisors(context, treeRowKey);
+ navigator.followRowKey(context, treeRowKey);
+
Context c = flag.getContext();
if (c != null) {
c.setHasChildren(false);
@@ -300,7 +302,7 @@
}
public void processAdvisors(FacesContext context, TreeRowKey rowKey) throws IOException {
- TreeState componentState = (TreeState) tree.getComponentState();
+ TreeState state = (TreeState) tree.getComponentState();
TreeStateAdvisor stateAdvisor = (TreeStateAdvisor)tree.getStateAdvisor();
if (null == stateAdvisor) {
@@ -329,26 +331,22 @@
Boolean adviseOpened = stateAdvisor.adviseNodeOpened(tree);
if (null != adviseOpened) {
if (adviseOpened.booleanValue()) {
- if (!componentState.isExpanded(rowKey)) {
- componentState.expandNode(tree, rowKey);
- }
+ state.makeExpanded(rowKey);
+ } else {
+ state.makeCollapsed(rowKey);
}
- else {
- if (componentState.isExpanded(rowKey)) {
- componentState.collapseNode(tree, rowKey);
- }
- }
}
+
Boolean adviseSelected = stateAdvisor.adviseNodeSelected(tree);
if (null != adviseSelected) {
if (adviseSelected.booleanValue()) {
- if (!componentState.isSelected(rowKey)) {
- componentState.setSelected(rowKey);
+ if (!state.isSelected(rowKey)) {
+ state.setSelected(rowKey);
}
}
else {
- if (componentState.isSelected(rowKey)) {
- componentState.setSelected(null);
+ if (state.isSelected(rowKey)) {
+ state.setSelected(null);
}
}
}
@@ -592,10 +590,6 @@
try {
input.captureOrigValue();
- if (key != null) {
- droppedDownToLevelFlag.setContext(null);
- }
-
input.setRowKey(context, key);
RendererDataModelEventNavigator levelNavigator = new RendererDataModelEventNavigator(input, rowKey, context,
@@ -626,6 +620,9 @@
};
+ input.transferQueuedNode();
+
+ //TODO should render if current node not in range?
input.walk(context, new DataVisitorWithLastElement(droppedDownToLevelFlag, input,
levelNavigator, key), treeRange, key, null);
Modified: trunk/ui/tree/src/test/java/org/richfaces/component/TreeComponentTest.java
===================================================================
--- trunk/ui/tree/src/test/java/org/richfaces/component/TreeComponentTest.java 2008-08-07 15:20:19 UTC (rev 9974)
+++ trunk/ui/tree/src/test/java/org/richfaces/component/TreeComponentTest.java 2008-08-07 15:22:38 UTC (rev 9975)
@@ -969,7 +969,8 @@
try {
state.expandAll(tree);
} catch (Exception e) {
- System.out.println("testManipulateState expandAll failed");
+ System.out.println("testManipulateState expandAll failed");
+ fail();
}
tree.setRowKey(rowKey);
16 years, 5 months