JBoss Rich Faces SVN: r7690 - in trunk/test-applications/seleniumTest/src/test: java and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-04-09 07:34:34 -0400 (Wed, 09 Apr 2008)
New Revision: 7690
Added:
trunk/test-applications/seleniumTest/src/test/java/
trunk/test-applications/seleniumTest/src/test/java/org/
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandsTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumExampleTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java
Removed:
trunk/test-applications/seleniumTest/src/test/org/
Log:
Added: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandsTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandsTest.java (rev 0)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandsTest.java 2008-04-09 11:34:34 UTC (rev 7690)
@@ -0,0 +1,89 @@
+package org.richfaces;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Test;
+
+public class AjaxCommandsTest extends SeleniumTestBase {
+
+ public AjaxCommandsTest() {
+ super("http", "localhost", "8080");
+ }
+
+ @Test
+ public void testAjaxCommandsComponents() throws Exception {
+ selenium.open("http://localhost:8080/seleniumTest/faces/pages/ajaxCommands.xhtml");
+ selenium.waitForPageToLoad("5000");
+
+ assertEquals("1", getValueById("fff:text"));
+ assertTrue(isVisibleById("_viewRoot:status.stop"));
+
+ String date = getTextById("fff:date");
+
+ // the click on command button [ ajaxSingle = false ]
+ clickById("fff:b1");
+ selenium.waitForCondition(
+ "selenium.browserbot.getCurrentWindow().done==true", "1000");
+ assertEquals("3", getValueById("fff:text"));
+ assertFalse(getTextById("fff:date").equals(date));
+
+ // the click on command button [ ajaxSingle = false ]
+ clickById("fff:b1");
+ selenium.waitForCondition(
+ "selenium.browserbot.getCurrentWindow().done==true", "1000");
+ assertEquals("5", getValueById("fff:text"));
+ assertFalse(getTextById("fff:date").equals(date));
+
+ // the click on command link [ ajaxSingle = true ]
+ clickById("fff:l1");
+ selenium.waitForCondition(
+ "selenium.browserbot.getCurrentWindow().done==true", "1000");
+ assertEquals("2", getValueById("fff:text"));
+ assertFalse(getTextById("fff:date").equals(date));
+
+ // the click on command link [ ajaxSingle = true ]
+ clickById("fff:l1");
+ selenium.waitForCondition(
+ "selenium.browserbot.getCurrentWindow().done==true", "1000");
+ assertEquals("2", getValueById("fff:text"));
+ assertFalse(getTextById("fff:date").equals(date));
+
+ // the click on command button [ ajaxSingle = true ]
+ clickById("fff:b2");
+ assertTrue("".equals(getTextById("_form:param")));
+ assertEquals("2", getValueById("fff:text"));
+ delay(2000);
+ assertEquals("3", getValueById("fff:text"));
+ assertFalse(getTextById("fff:date").equals(date));
+
+ // the click on command button [ ajaxSingle = true ]
+ clickById("fff:b2");
+ assertEquals("3", getValueById("fff:text"));
+ delay(2000);
+ assertEquals("3", getValueById("fff:text"));
+ assertFalse(getTextById("fff:date").equals(date));
+
+ // the click on command link [ ajaxSingle = false ]
+ clickById("fff:l2");
+ assertTrue("actionParameter1"
+ .equals(getTextById("_form:param")));
+ assertEquals("3", getValueById("fff:text"));
+ delay(2000);
+ assertEquals("6", getValueById("fff:text"));
+ assertFalse(getTextById("fff:date").equals(date));
+ assertTrue("actionParameter2"
+ .equals(getTextById("_form:param")));
+
+ // the click on command link [ ajaxSingle = false ]
+ clickById("fff:l2");
+ assertEquals("6", getValueById("fff:text"));
+ delay(2000);
+ assertEquals("9", getValueById("fff:text"));
+ assertFalse(getTextById("fff:date").equals(date));
+ assertTrue("actionParameter2"
+ .equals(getTextById("_form:param")));
+ }
+
+}
Added: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumExampleTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumExampleTest.java (rev 0)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumExampleTest.java 2008-04-09 11:34:34 UTC (rev 7690)
@@ -0,0 +1,62 @@
+/**
+ *
+ */
+package org.richfaces;
+
+/**
+ * @author asmirnov
+ *
+ */
+import static org.testng.Assert.*;
+
+import org.testng.Assert;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+import com.thoughtworks.selenium.DefaultSelenium;
+
+public class SeleniumExampleTest
+
+{
+ private DefaultSelenium selenium;
+
+ protected DefaultSelenium createSeleniumClient(String url, String browser){
+ return new DefaultSelenium("localhost", 4444,
+ browser, url);
+ }
+ @BeforeTest
+ @Parameters({ "browser" })
+ public void startSelenium(String browser){
+ selenium = createSeleniumClient("http://localhost:8080/", browser);
+ selenium.start();
+ }
+
+ @Test(enabled=false)
+ public void testSomethingSimple() throws Exception {
+ selenium.open("http://localhost:8080/seleniumTest/faces/test.xhtml");
+ selenium.waitForPageToLoad("5000");
+
+ //
+ System.out.println("body [" + selenium.getHtmlSource() + "]");
+ //
+ // selenium.getEval("window.done=false;A4J.AJAX.AddListener(new
+ // A4J.AJAX.Listener(function(){window.done=true}))");
+ selenium.click("id=fff:lnk");
+ selenium.waitForCondition(
+ "selenium.browserbot.getCurrentWindow().done==true", "3000");
+ System.out.println("ajax body [" + selenium.getHtmlSource() + "]");
+ assertEquals("testOk", selenium.getText("id=fff:out"));
+
+ // Test help link
+ }
+ /**
+ *
+ */
+ @AfterTest
+ public void stopSelenium() {
+ selenium.stop();
+ selenium = null;
+ }
+}
\ No newline at end of file
Added: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java (rev 0)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java 2008-04-09 11:34:34 UTC (rev 7690)
@@ -0,0 +1,110 @@
+package org.richfaces;
+
+import org.ajax4jsf.renderkit.RendererUtils;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+
+import com.thoughtworks.selenium.DefaultSelenium;
+
+public class SeleniumTestBase {
+
+ private static final String equalCh = "=";
+
+ private static final String idSearch = RendererUtils.HTML.id_ATTRIBUTE + equalCh;
+
+ protected DefaultSelenium selenium;
+
+ private String host;
+
+ private String port;
+
+ private String protocol;
+
+ public SeleniumTestBase() {
+ // Default constructor
+ }
+
+ public SeleniumTestBase(String protocol, String host, String port) {
+ this.host = host;
+ this.port = port;
+ this.protocol = protocol;
+ }
+
+ /**
+ * @param url
+ * @param browser
+ * @return
+ */
+ public DefaultSelenium createSeleniumClient(String url, String browser) {
+ return new DefaultSelenium(host, 4444, browser, url);
+ }
+
+ /**
+ * This method are invoking before selenium tests started
+ */
+ @BeforeTest
+ @Parameters( { "browser" })
+ public void startSelenium(String browser) {
+ System.out.println("___________>>>>>>>>>>>>." + protocol + "://" + host + ":" + port);
+ selenium = createSeleniumClient(protocol + "://" + host + ":" + port, browser);
+ selenium.start();
+ }
+
+ /**
+ * This method are invoking after selenium tests completed
+ */
+ @AfterTest
+ public void stopSelenium() {
+ selenium.stop();
+ selenium = null;
+ }
+
+
+ /**
+ * Returns element's text
+ * @param id - DOM element id
+ * @return
+ */
+ public String getTextById(String id) {
+ return selenium.getText(idSearch + id);
+ }
+
+ /**
+ * Returns element's value
+ * @param id - DOM element id
+ * @return
+ */
+ public String getValueById(String id) {
+ return selenium.getValue(idSearch + id);
+ }
+
+ /**
+ * Clicks on element
+ * @param id - DOM element id
+ * @return
+ */
+ public void clickById(String id) {
+ selenium.click(idSearch + id);
+ }
+
+
+ /**
+ * Return true if element is visible
+ * @param id - DOM element id
+ * @return
+ */
+ public boolean isVisibleById(String id) {
+ return selenium.isVisible(idSearch + id);
+ }
+
+ /**
+ * Creates delay
+ * @param miliSeconds
+ * @throws InterruptedException
+ */
+ public void delay (int miliSeconds) throws InterruptedException {
+ Thread.sleep(miliSeconds);
+ }
+
+}
16 years, 9 months
JBoss Rich Faces SVN: r7689 - trunk/test-applications/seleniumTest.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-04-09 06:52:36 -0400 (Wed, 09 Apr 2008)
New Revision: 7689
Modified:
trunk/test-applications/seleniumTest/pom.xml
Log:
changed version from 5.7 to 5.1
Modified: trunk/test-applications/seleniumTest/pom.xml
===================================================================
--- trunk/test-applications/seleniumTest/pom.xml 2008-04-09 10:52:03 UTC (rev 7688)
+++ trunk/test-applications/seleniumTest/pom.xml 2008-04-09 10:52:36 UTC (rev 7689)
@@ -160,7 +160,7 @@
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
- <version>5.7</version>
+ <version>5.1</version>
<scope>test</scope>
<classifier>jdk15</classifier>
</dependency>
16 years, 9 months
JBoss Rich Faces SVN: r7688 - in trunk/test-applications/seleniumTest/src: main/webapp and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-04-09 06:52:03 -0400 (Wed, 09 Apr 2008)
New Revision: 7688
Added:
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/A4JCommandTestBean.java
trunk/test-applications/seleniumTest/src/main/webapp/pages/
trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommands.xhtml
trunk/test-applications/seleniumTest/src/test/org/
trunk/test-applications/seleniumTest/src/test/org/richfaces/
Removed:
trunk/test-applications/seleniumTest/src/test/java/
Modified:
trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml
trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/web.xml
Log:
Added: trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/A4JCommandTestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/A4JCommandTestBean.java (rev 0)
+++ trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/A4JCommandTestBean.java 2008-04-09 10:52:03 UTC (rev 7688)
@@ -0,0 +1,56 @@
+package org.ajax4jsf;
+
+import java.util.Date;
+
+import javax.faces.event.ActionEvent;
+
+public class A4JCommandTestBean {
+
+ private Integer text = 1;
+
+ private String param;
+
+
+ public void actionListener(ActionEvent event) {
+ this.text++;
+ }
+
+ public String action () {
+ this.text++;
+ return null;
+ }
+
+ public String getDate() {
+ return String.valueOf(new Date().getTime());
+ }
+
+ /**
+ * @return the text
+ */
+ public Integer getText() {
+ return text;
+ }
+
+ /**
+ * @param text the text to set
+ */
+ public void setText(Integer text) {
+ text++;
+ this.text = text;
+ }
+
+ /**
+ * @return the param
+ */
+ public String getParam() {
+ return param;
+ }
+
+ /**
+ * @param param the param to set
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+}
Modified: trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia 2008-04-09 10:29:33 UTC (rev 7687)
+++ trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia 2008-04-09 10:52:03 UTC (rev 7688)
@@ -1,2 +1,2 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<PROCESS ENTITY="JSFProcess"/>
+<?xml version="1.0" encoding="UTF-8"?>
+<PROCESS ENTITY="JSFProcess"/>
Modified: trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml 2008-04-09 10:29:33 UTC (rev 7687)
+++ trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml 2008-04-09 10:52:03 UTC (rev 7688)
@@ -18,6 +18,13 @@
<property-class>java.lang.String</property-class>
<null-value />
</managed-property>
+ </managed-bean>
+
+
+ <managed-bean>
+ <managed-bean-name>commandBean</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.A4JCommandTestBean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
</managed-bean>
</faces-config>
\ No newline at end of file
Modified: trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/web.xml 2008-04-09 10:29:33 UTC (rev 7687)
+++ trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/web.xml 2008-04-09 10:52:03 UTC (rev 7688)
@@ -37,14 +37,14 @@
<param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
<param-value>false</param-value>
</context-param>
- <context-param>
+ <!-- context-param>
<param-name>org.ajax4jsf.xmlparser.ORDER</param-name>
<param-value>NONE,TIDY,NEKO</param-value>
</context-param>
<context-param>
<param-name>org.ajax4jsf.xmlparser.TIDY</param-name>
<param-value>
- /pages/repeater.xhtml,/pages/tabs.xhtml
+ /pages/*
</param-value>
</context-param>
<context-param>
@@ -52,7 +52,7 @@
<param-value>
/pages/layout.xhtml
</param-value>
- </context-param>
+ </context-param-->
<!--
<context-param>
<param-name>org.ajax4jsf.SKIN</param-name>
Added: trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommands.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommands.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommands.xhtml 2008-04-09 10:52:03 UTC (rev 7688)
@@ -0,0 +1,52 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+ <head><title>test</title></head>
+ <body>
+ <a4j:status startText="Ajax in progress..." stopText="Ajax completed" id="status"></a4j:status>
+ <h:form id="fff">
+ <a4j:commandButton
+ actionListener="#{commandBean.actionListener}"
+ reRender="date,text"
+ value="Button1"
+ id="b1" />
+ <a4j:commandLink
+ actionListener="#{commandBean.actionListener}"
+ ajaxSingle="true"
+ reRender="date,text"
+ value="Link1"
+ id="l1"></a4j:commandLink> <br/>
+ <h:inputText value="#{commandBean.text}" id="text" style="width: 100px"/>
+ <h:panelGrid id="panel">
+ <a4j:commandButton
+ requestDelay="1000"
+ actionListener="#{commandBean.actionListener}"
+ reRender="date,text,param"
+ ajaxSingle="true"
+ value="Button2"
+ action="#{commandBean.action}"
+ id="b2">
+ <a4j:actionparam name="param" value="actionParameter1" assignTo="#{commandBean.param}" />
+ </a4j:commandButton>
+ <a4j:commandLink
+ requestDelay="1000"
+ actionListener="#{commandBean.actionListener}"
+ action="#{commandBean.action}"
+ reRender="date,text,param"
+ value="Link2"
+ id="l2">
+ <a4j:actionparam name="param" value="actionParameter2" assignTo="#{commandBean.param}" />
+ </a4j:commandLink> <br/>
+ </h:panelGrid>
+ <h:outputText value="#{commandBean.date}" id="date"/>
+ </h:form>
+ <h:form id="_form">
+ <h:outputText value="#{commandBean.param}" id="param"></h:outputText>
+ </h:form>
+ <script type="text/javascript">
+ window.done=false;A4J.AJAX.AddListener(new A4J.AJAX.Listener(function(){window.done=true}));
+ </script>
+ </body>
+</html>
\ No newline at end of file
16 years, 9 months
JBoss Rich Faces SVN: r7687 - trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2008-04-09 06:29:33 -0400 (Wed, 09 Apr 2008)
New Revision: 7687
Modified:
trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
Log:
Remove unnecessary condition in script.
Modified: trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
===================================================================
--- trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js 2008-04-09 10:28:10 UTC (rev 7686)
+++ trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js 2008-04-09 10:29:33 UTC (rev 7687)
@@ -273,7 +273,7 @@
}
} else {
if (ModalPanel.activePanels.length > 0) {
- if (this.selectBehavior && "hide" == this.selectBehavior) {
+ if ("hide" == this.selectBehavior) {
if (!elt._mdwHiddenSet) {
elt._mdwHidden = elt.style.visibility;
elt._mdwHiddenSet = true;
16 years, 9 months
JBoss Rich Faces SVN: r7686 - trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-04-09 06:28:10 -0400 (Wed, 09 Apr 2008)
New Revision: 7686
Modified:
trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js
Log:
http://jira.jboss.com/jira/browse/RF-2680
Modified: trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js
===================================================================
--- trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js 2008-04-09 09:03:49 UTC (rev 7685)
+++ trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js 2008-04-09 10:28:10 UTC (rev 7686)
@@ -120,16 +120,14 @@
}
}
- if (this.events.oneditactivation) {
- this.inplaceInput.fire("rich:oneditactivation", {oldValue : this.valueKeeper.value, value : this.tempValueKeeper.value});
- }
- var textSize = this.inplaceInput.offsetWidth;
+ if (this.invokeEvent(this.events.oneditactivation, this.inplaceInput, "rich:oneditactivation", {oldValue : this.valueKeeper.value, value : this.tempValueKeeper.value})) {
+ var textSize = this.inplaceInput.offsetWidth;
- this.startEditableState(textSize);
- //this.endViewState();
+ this.startEditableState(textSize);
- if (this.events.oneditactivated) {
- this.inplaceInput.fire("rich:oneditactivated", {oldValue : this.valueKeeper.value, value : this.tempValueKeeper.value});
+ if (this.events.oneditactivated) {
+ this.inplaceInput.fire("rich:oneditactivated", {oldValue : this.valueKeeper.value, value : this.tempValueKeeper.value});
+ }
}
}
},
@@ -293,52 +291,75 @@
saveValue : function(userValue, currentText) {
var value = this.valueKeeper.value;
- if (this.events.onviewactivation) {
- this.inplaceInput.fire("rich:onviewactivation", {oldValue : this.valueKeeper.value, value : this.tempValueKeeper.value});
- }
- this.endEditableState();
- if (userValue == "") {
- this.setDefaultText();
- this.valueKeeper.value = "";
- //this.startViewState();
- } else {
- if (currentText == "") {
- this.setDefaultText();
- } else {
- this.currentText = currentText;
- }
- this.valueKeeper.value = userValue;
- }
- if (userValue != this.value) {
- this.startChangedState();
- } else {
- this.startViewState();
- }
- /*if (userValue != this.value) {
+ if (this.invokeEvent(this.events.onviewactivation, this.inplaceInput, "rich:onviewactivation", {oldValue : this.valueKeeper.value, value : this.tempValueKeeper.value})) {
+ this.endEditableState();
if (userValue == "") {
this.setDefaultText();
this.valueKeeper.value = "";
- //this.startViewState();
+ //this.startViewState();
} else {
- this.currentText = userValue;
+ if (currentText == "") {
+ this.setDefaultText();
+ } else {
+ this.currentText = currentText;
+ }
this.valueKeeper.value = userValue;
}
- this.startChangedState();
- } else {
- if (userValue == "") {
- this.setDefaultText();
- this.valueKeeper.value = "";
+ if (userValue != this.value) {
+ this.startChangedState();
} else {
- this.currentText = userValue;
- this.valueKeeper.value = userValue;
+ this.startViewState();
}
- this.startViewState();
- } */
- if (this.events.onviewactivated) {
- this.inplaceInput.fire("rich:onviewactivated", {oldValue : this.valueKeeper.value, value : this.tempValueKeeper.value});
+ /*if (userValue != this.value) {
+ if (userValue == "") {
+ this.setDefaultText();
+ this.valueKeeper.value = "";
+ //this.startViewState();
+ } else {
+ this.currentText = userValue;
+ this.valueKeeper.value = userValue;
+ }
+ this.startChangedState();
+ } else {
+ if (userValue == "") {
+ this.setDefaultText();
+ this.valueKeeper.value = "";
+ } else {
+ this.currentText = userValue;
+ this.valueKeeper.value = userValue;
+ }
+ this.startViewState();
+ } */
+ if (this.events.onviewactivated) {
+ this.inplaceInput.fire("rich:onviewactivated", {oldValue : this.valueKeeper.value, value : this.tempValueKeeper.value});
+ }
}
},
+ invokeEvent : function(eventFunc, element, eventName, memo) {
+ var result = false;
+ if (eventFunc) {
+ element = $(element);
+ if (element == document && document.createEvent && !element.dispatchEvent)
+ element = document.documentElement;
+
+ var event;
+ if (document.createEvent) {
+ event = document.createEvent("HTMLEvents");
+ event.initEvent("dataavailable", true, true);
+ } else {
+ event = document.createEventObject();
+ event.eventType = "ondataavailable";
+ }
+
+ event.eventName = eventName;
+ event.memo = memo || { };
+
+ var result = eventFunc.call(event);
+ }
+ return result;
+ },
+
setDefaultText : function() {
this.currentText = this.attributes.defaultLabel;
},
@@ -440,7 +461,6 @@
}
}
}
-
};
Richfaces.InplaceInput.STATES = [0, 1, 2];// 0 - view, 1- editable, 2 - changed
16 years, 9 months
JBoss Rich Faces SVN: r7685 - branches/3.1.x/samples/tree-demo/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: vbaranov
Date: 2008-04-09 05:03:49 -0400 (Wed, 09 Apr 2008)
New Revision: 7685
Modified:
branches/3.1.x/samples/tree-demo/src/main/webapp/pages/index2.jsp
Log:
Test for http://jira.jboss.com/jira/browse/RF-3004
Modified: branches/3.1.x/samples/tree-demo/src/main/webapp/pages/index2.jsp
===================================================================
--- branches/3.1.x/samples/tree-demo/src/main/webapp/pages/index2.jsp 2008-04-09 09:03:29 UTC (rev 7684)
+++ branches/3.1.x/samples/tree-demo/src/main/webapp/pages/index2.jsp 2008-04-09 09:03:49 UTC (rev 7685)
@@ -21,16 +21,22 @@
<rich:tree switchType="client" style="width:300px"
- value="#{pathwayBean.pathwayTree}" var="item"
+ value="#{pathwayBean.pathwayTree}" var="item" ajaxSubmitSelection="true" treeNodeVar="treeNode"
nodeFace="#{item.type}">
<rich:treeNode type="library">
<h:outputText value="#{item.type}"/>
+ <h:outputText value="_" />
+ <h:outputText value="#{treeNode.data.type}" />
</rich:treeNode>
<rich:treeNode type="pathway">
<h:outputText value="#{item.name}"/>
+ <h:outputText value="-" />
+ <h:outputText value="#{treeNode.data.name}" />
</rich:treeNode>
<rich:treeNode type="organism">
<h:outputText value="#{item.name}"/>
+ <h:outputText value="+" />
+ <h:outputText value="#{treeNode.data.name}" />
</rich:treeNode>
</rich:tree>
16 years, 9 months
JBoss Rich Faces SVN: r7684 - in branches/3.1.x/ui/tree/src/main: java/org/richfaces/component and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: vbaranov
Date: 2008-04-09 05:03:29 -0400 (Wed, 09 Apr 2008)
New Revision: 7684
Modified:
branches/3.1.x/ui/tree/src/main/config/component/tree.xml
branches/3.1.x/ui/tree/src/main/java/org/richfaces/component/UITree.java
Log:
http://jira.jboss.com/jira/browse/RF-3004
Modified: branches/3.1.x/ui/tree/src/main/config/component/tree.xml
===================================================================
--- branches/3.1.x/ui/tree/src/main/config/component/tree.xml 2008-04-09 00:25:30 UTC (rev 7683)
+++ branches/3.1.x/ui/tree/src/main/config/component/tree.xml 2008-04-09 09:03:29 UTC (rev 7684)
@@ -66,8 +66,15 @@
<name>rowKeyVar</name>
<classname>java.lang.String</classname>
<description>The attribute provides access to a row key in a Request scope</description>
- </property>
+ </property>
<property>
+ <name>treeNodeVar</name>
+ <classname>java.lang.String</classname>
+ <description>
+ The attribute provides access to a TreeNode instance in a Request scope
+ </description>
+ </property>
+ <property>
<name>componentState</name>
<classname>org.ajax4jsf.model.DataComponentState</classname>
<description>It defines EL-binding for a component state for saving or redefinition</description>
Modified: branches/3.1.x/ui/tree/src/main/java/org/richfaces/component/UITree.java
===================================================================
--- branches/3.1.x/ui/tree/src/main/java/org/richfaces/component/UITree.java 2008-04-09 00:25:30 UTC (rev 7683)
+++ branches/3.1.x/ui/tree/src/main/java/org/richfaces/component/UITree.java 2008-04-09 09:03:29 UTC (rev 7684)
@@ -22,9 +22,7 @@
package org.richfaces.component;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import javax.faces.application.Application;
@@ -37,6 +35,7 @@
import javax.faces.event.FacesEvent;
import javax.faces.event.FacesListener;
import javax.faces.event.PhaseId;
+import javax.faces.model.DataModel;
import org.ajax4jsf.component.AjaxComponent;
import org.ajax4jsf.component.UIDataAdaptor;
@@ -65,7 +64,6 @@
import org.richfaces.event.NodeSelectedListener;
import org.richfaces.event.TreeListenerEventsProducer;
import org.richfaces.model.AbstractTreeDataModel;
-import org.richfaces.model.ListRowKey;
import org.richfaces.model.StackingTreeModel;
import org.richfaces.model.StackingTreeModelProvider;
import org.richfaces.model.TreeDataModel;
@@ -108,6 +106,18 @@
public final static String DEFAULT_HIGHLIGHTED_CSS_CLASS = "dr-tree-i-hl";
private UITreeNode defaultFacet;
+
+ /**
+ * Name of EL variable for the tree node. This reference is needed to
+ * let this parent class know about the attributes defined in the
+ * subclass
+ */
+ private String _treeNodeVar;
+
+ /**
+ * Stored state of "treeNodeVar" attribute
+ */
+ private Object treeNodeVarOrigValue = null;
public UITree() {
super();
@@ -119,11 +129,29 @@
public boolean getRendersChildren() {
return true;
}
+
+ /**
+ * Get name of EL variable for the tree node.
+ *
+ * @return the varState
+ */
+ public String getTreeNodeVar() {
+ return _treeNodeVar;
+ }
/**
- * Lazily creates default node representation that is used if there is no
- * {@link UITreeNode} child for that nodeFace
+ * Set the name of EL variable
*
+ * @param treeNodeVar the varStatus to set
+ */
+ public void setTreeNodeVar(String treeNodeVar) {
+ this._treeNodeVar = treeNodeVar;
+ }
+
+ /**
+ * Lazily creates default node representation that is used if there is
+ * no {@link UITreeNode} child for that nodeFace
+ *
* @return created or existing node representation component
*/
protected UITreeNode getOrCreateDefaultFacet() {
@@ -274,6 +302,35 @@
return getOrCreateDefaultFacet();
}
+ /**
+ * Setup EL variable for different iteration. Value of row tree node is
+ * put into request scope attributes with name "treeNodeVar" bean
+ * property. All other attributes are processed in parent
+ * <code>UIDataAdaptor</code> class
+ *
+ * @param faces - current faces context
+ * @param localModel - reference to data model
+ * @param rowSelected - boolean flag indicating whether the row is selected
+ */
+ protected void setupVariable(FacesContext faces, DataModel localModel, boolean rowSelected) {
+ super.setupVariable(faces, localModel, rowSelected);
+ // get the map storing the request scope
+ // attributes
+ Map attrs = faces.getExternalContext().getRequestMap();
+
+ String treeNodeVar = getTreeNodeVar();
+ if (rowSelected) {
+ // Current row tree node.
+ if (treeNodeVar != null) {
+ attrs.put(treeNodeVar, getTreeNode());
+ }
+ } else {
+ if (treeNodeVar != null) {
+ attrs.remove(treeNodeVar);
+ }
+ }
+ }
+
/*
* (non-Javadoc)
*
@@ -508,7 +565,56 @@
public boolean hasAjaxSubmitSelection() {
return isAjaxSubmitSelection();
}
+
+ /**
+ * Save current state of data variable. Overrides the implementation in
+ * the base class for the case the base implementation will be changed.
+ */
+ public void captureOrigValue() {
+ this.captureOrigValue(FacesContext.getCurrentInstance());
+ }
+ /**
+ * Save current state of data variable.
+ *
+ * @param faces current faces context
+ */
+ public void captureOrigValue(FacesContext faces) {
+ super.captureOrigValue(faces);
+ String treeNodeVar = getTreeNodeVar();
+ if (treeNodeVar != null) {
+ Map attrs = faces.getExternalContext().getRequestMap();
+ this.treeNodeVarOrigValue = attrs.get(treeNodeVar);
+ }
+ }
+
+ /**
+ * Restore value of data variable after processing phase. Overrides the
+ * implementation in the base class for the case the base implementation
+ * will be changed.
+ */
+ public void restoreOrigValue() {
+ this.restoreOrigValue(FacesContext.getCurrentInstance());
+ }
+
+ /**
+ * Restore value of data variable after processing phase.
+ *
+ * @param faces current faces context
+ */
+ public void restoreOrigValue(FacesContext faces) {
+ super.restoreOrigValue(faces);
+ String treeNodeVar = getTreeNodeVar();
+ if (treeNodeVar != null) {
+ Map attrs = faces.getExternalContext().getRequestMap();
+ if (this.treeNodeVarOrigValue != null) {
+ attrs.put(treeNodeVar, this.treeNodeVarOrigValue);
+ } else {
+ attrs.remove(treeNodeVar);
+ }
+ }
+ }
+
private ExtendedDataModel createDataModel(boolean allowCached) {
Object value = this.getValue();
if (value != null) {
@@ -521,7 +627,7 @@
return treeDataModel;
} else {
- //TODO implement request caching
+ // TODO implement request caching
StackingTreeModel stackingTreeModel = new VisualStackingTreeModel(null);
if (getChildCount() > 0) {
Iterator children = getChildren().iterator();
@@ -785,9 +891,10 @@
public Object saveState(FacesContext faces) {
- Object[] state = new Object[2];
+ Object[] state = new Object[3];
state[0] = super.saveState(faces);
state[1] = saveAttachedState(faces, defaultFacet);
+ state[2] = getTreeNodeVar();
return state;
}
@@ -802,6 +909,7 @@
defaultFacet.getChildren().add(createDefaultNodeFaceOutput(faces));
defaultFacet.setParent(this);
}
+ setTreeNodeVar((String) state[2]);
}
public String getResolvedDragIndicator(FacesContext facesContext) {
16 years, 9 months
JBoss Rich Faces SVN: r7683 - trunk/samples/richfaces-demo.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2008-04-08 20:25:30 -0400 (Tue, 08 Apr 2008)
New Revision: 7683
Modified:
trunk/samples/richfaces-demo/pom.xml
Log:
Fix demo app dependencies
Modified: trunk/samples/richfaces-demo/pom.xml
===================================================================
--- trunk/samples/richfaces-demo/pom.xml 2008-04-08 19:47:23 UTC (rev 7682)
+++ trunk/samples/richfaces-demo/pom.xml 2008-04-09 00:25:30 UTC (rev 7683)
@@ -3,7 +3,7 @@
<groupId>org.richfaces.samples</groupId>
<artifactId>richfaces-demo</artifactId>
<packaging>war</packaging>
- <version>3.2.0.GA</version>
+ <version>3.2.1-SNAPSHOT</version>
<name>richfaces-demo Maven Webapp</name>
<repositories>
@@ -221,12 +221,12 @@
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
- <version>1.2_04-p02</version>
+ <version>1.2_07</version>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-impl</artifactId>
- <version>1.2_04-p02</version>
+ <version>1.2_07</version>
<scope>runtime</scope>
</dependency>
</dependencies>
@@ -236,7 +236,7 @@
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-ui</artifactId>
- <version>3.2.0.GA</version>
+ <version>3.2.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.uwyn</groupId>
16 years, 9 months
JBoss Rich Faces SVN: r7682 - in branches/3.1.x/framework: impl/src/main/java/org/ajax4jsf/context and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-04-08 15:47:23 -0400 (Tue, 08 Apr 2008)
New Revision: 7682
Modified:
branches/3.1.x/framework/api/src/main/java/org/ajax4jsf/context/AjaxContext.java
branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java
branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java
branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java
branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/webapp/HtmlParser.java
branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java
branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/webapp/tidy/TidyParser.java
Log:
http://jira.jboss.com/jira/browse/RF-1627
http://jira.jboss.com/jira/browse/RF-3002
Modified: branches/3.1.x/framework/api/src/main/java/org/ajax4jsf/context/AjaxContext.java
===================================================================
--- branches/3.1.x/framework/api/src/main/java/org/ajax4jsf/context/AjaxContext.java 2008-04-08 19:45:38 UTC (rev 7681)
+++ branches/3.1.x/framework/api/src/main/java/org/ajax4jsf/context/AjaxContext.java 2008-04-08 19:47:23 UTC (rev 7682)
@@ -79,6 +79,7 @@
public static final String SCRIPTS_PARAMETER = "org.ajax4jsf.framework.HEADER_SCRIPTS";
public static final String STYLES_PARAMETER = "org.ajax4jsf.framework.HEADER_STYLES";
+ public static final String USER_STYLES_PARAMETER = "org.ajax4jsf.framework.HEADER_USER_STYLES";
public static final String RESPONSE_DATA_KEY = "_ajax:data";
private static final String SERVICE_RESOURCE = "META-INF/services/"
+ AjaxContext.class.getName();
Modified: branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
===================================================================
--- branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2008-04-08 19:45:38 UTC (rev 7681)
+++ branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2008-04-08 19:47:23 UTC (rev 7682)
@@ -409,6 +409,7 @@
}
requestMap.put(SCRIPTS_PARAMETER, scripts);
}
+
Set styles = viewResources.getStyles();
if (styles.size() > 0) {
if (log.isDebugEnabled()) {
@@ -422,6 +423,20 @@
}
requestMap.put(STYLES_PARAMETER, styles);
}
+
+ Set usersStyles = viewResources.getUserStyles();
+ if (usersStyles.size() > 0) {
+ if (log.isDebugEnabled()) {
+ StringBuffer buff = new StringBuffer(
+ "User styles for insert into head : \n");
+ for (Iterator iter = usersStyles.iterator(); iter.hasNext();) {
+ String style = (String) iter.next();
+ buff.append(style).append("\n");
+ }
+ log.debug(buff.toString());
+ }
+ requestMap.put(USER_STYLES_PARAMETER, usersStyles);
+ }
// Mark as processed.
requestMap.put(RESOURCES_PROCESSED, Boolean.TRUE);
// Save viewId for a parser selection
Modified: branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java
===================================================================
--- branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java 2008-04-08 19:45:38 UTC (rev 7681)
+++ branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java 2008-04-08 19:47:23 UTC (rev 7682)
@@ -39,7 +39,7 @@
renderKit = rkFactory.getRenderKit(context, context
.getViewRoot().getRenderKitId());
processHeadResources(context, root);
- styles.addAll(userStyles);
+ //styles.addAll(userStyles);
scripts.addAll(userScripts);
}
@@ -156,6 +156,13 @@
return styles;
}
+ /**
+ * @return user styles
+ */
+ public Set getUserStyles() {
+ return userStyles;
+ }
+
public void addScript(String scriptUrl) {
scripts.add(scriptUrl);
}
Modified: branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java
===================================================================
--- branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java 2008-04-08 19:45:38 UTC (rev 7681)
+++ branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java 2008-04-08 19:47:23 UTC (rev 7682)
@@ -50,6 +50,8 @@
private Set styles;
+ private Set userStyles;
+
private String encoding;
private String doctype;
@@ -62,7 +64,7 @@
boolean haveHtml = false;
boolean haveHead = false;
boolean closingElement = false;
- if (null != scripts || null != styles) {
+ if (null != scripts || null != styles || null != userStyles) {
ParsingStateManager stateManager = ParsingStateManager
.getInstance();
ParserState state = stateManager.getInitialState();
@@ -174,11 +176,21 @@
if (null != styles) {
for (Iterator iter = styles.iterator(); iter.hasNext();) {
String style = (String) iter.next();
- out.write("<link rel='stylesheet' type='text/css' href='");
+ out.write("<link rel='stylesheet' class='" + COMPONENT_RESOURCE_LINK_CLASS + "'" +
+ " type='text/css' href='");
out.write(style);
out.write("' />");
}
}
+ if (null != userStyles) {
+ for (Iterator iter = userStyles.iterator(); iter.hasNext();) {
+ String style = (String) iter.next();
+ out.write("<link rel='stylesheet' class='" + USER_RESOURCE_LINK_CLASS + "'" +
+ " type='text/css' href='");
+ out.write(style);
+ out.write("' />");
+ }
+ }
if (null != scripts) {
for (Iterator iter = scripts.iterator(); iter.hasNext();) {
String script = (String) iter.next();
@@ -223,6 +235,21 @@
this.styles = styles;
}
+ /**
+ * @return Returns the user styles.
+ */
+ public Set getUserStyles() {
+ return userStyles;
+ }
+
+ /**
+ * @param styles
+ * The user styles to set.
+ */
+ public void setUserStyles(Set userStyles) {
+ this.userStyles = userStyles;
+ }
+
public void parseHtml(InputStream input, Writer output) throws IOException {
parse(new InputStreamReader(input, encoding), output);
Modified: branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java
===================================================================
--- branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java 2008-04-08 19:45:38 UTC (rev 7681)
+++ branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java 2008-04-08 19:47:23 UTC (rev 7682)
@@ -291,6 +291,8 @@
.getAttribute(AjaxContext.SCRIPTS_PARAMETER));
parser.setStyles((Set) request
.getAttribute(AjaxContext.STYLES_PARAMETER));
+ parser.setUserStyles((Set) request
+ .getAttribute(AjaxContext.USER_STYLES_PARAMETER));
// Process parsing.
long startTimeMills = System.currentTimeMillis();
servletResponseWrapper.parseContent(output, parser);
Modified: branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/webapp/HtmlParser.java
===================================================================
--- branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/webapp/HtmlParser.java 2008-04-08 19:45:38 UTC (rev 7681)
+++ branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/webapp/HtmlParser.java 2008-04-08 19:47:23 UTC (rev 7682)
@@ -59,6 +59,11 @@
*/
public abstract void setStyles(Set styles);
+ /**
+ * @param styles The user styles to set
+ */
+ public abstract void setUserStyles(Set styles);
+
public abstract void setDoctype(String doctype);
/**
@@ -68,4 +73,7 @@
public abstract boolean setMime(String mimeType);
+ public static final String COMPONENT_RESOURCE_LINK_CLASS = "component";
+
+ public static final String USER_RESOURCE_LINK_CLASS = "user";
}
\ No newline at end of file
Modified: branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java
===================================================================
--- branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java 2008-04-08 19:45:38 UTC (rev 7681)
+++ branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java 2008-04-08 19:47:23 UTC (rev 7682)
@@ -94,6 +94,8 @@
private Set _styles;
+ private Set _userStyles;
+
private String _viewState;
private String _encoding;
@@ -163,6 +165,7 @@
public void reset() {
_scripts = null;
_styles = null;
+ _userStyles = null;
_viewState = null;
_parser.reset();
_serializer.reset();
@@ -289,6 +292,10 @@
}
+ public void setUserStyles(Set styles) {
+ _userStyles = styles;
+ }
+
/*
* (non-Javadoc)
*
@@ -421,23 +428,37 @@
super.endElement(element, augs);
}
+ private void insertStyle(String style, String className) {
+ QName element = new QName(null, "link", "link", null);
+ XMLAttributes attrs = new XMLAttributesImpl();
+ attrs.addAttribute(new QName(null, "href", "href", null),
+ "CDATA", style);
+ attrs.addAttribute(new QName(null, "type", "type", null),
+ "CDATA", "text/css");
+ attrs.addAttribute(new QName(null, "rel", "rel", null),
+ "CDATA", "stylesheet");
+ attrs.addAttribute(new QName(null, "class", "class", null),
+ "CDATA", className);
+ Augmentations augs = new HTMLAugmentations();
+ super.emptyElement(element, attrs, augs);
+ }
+
private void insertResources() {
headParsed = true;
if (null != _styles) {
for (Iterator iter = _styles.iterator(); iter.hasNext();) {
String style = (String) iter.next();
- QName element = new QName(null, "link", "link", null);
- XMLAttributes attrs = new XMLAttributesImpl();
- attrs.addAttribute(new QName(null, "href", "href", null),
- "CDATA", style);
- attrs.addAttribute(new QName(null, "type", "type", null),
- "CDATA", "text/css");
- attrs.addAttribute(new QName(null, "rel", "rel", null),
- "CDATA", "stylesheet");
- Augmentations augs = new HTMLAugmentations();
- super.emptyElement(element, attrs, augs);
+ insertStyle(style, COMPONENT_RESOURCE_LINK_CLASS);
}
}
+
+ if (null != _userStyles) {
+ for (Iterator iter = _userStyles.iterator(); iter.hasNext();) {
+ String style = (String) iter.next();
+ insertStyle(style, USER_RESOURCE_LINK_CLASS);
+ }
+ }
+
if (null != _scripts) {
for (Iterator iter = _scripts.iterator(); iter.hasNext();) {
String script = (String) iter.next();
Modified: branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/webapp/tidy/TidyParser.java
===================================================================
--- branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/webapp/tidy/TidyParser.java 2008-04-08 19:45:38 UTC (rev 7681)
+++ branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/webapp/tidy/TidyParser.java 2008-04-08 19:47:23 UTC (rev 7682)
@@ -59,6 +59,8 @@
private Set _styles;
+ private Set _userStyles;
+
private String _viewState;
private String _encoding;
@@ -138,7 +140,7 @@
}
// Inserts scripts and styles to head.
- if (null != _scripts || null != _styles || null != _viewState) {
+ if (null != _scripts || null != _styles || null != _userStyles || null != _viewState) {
// find head
org.w3c.dom.Node head = documentElement
.getElementsByTagName("head").item(0);
@@ -168,9 +170,21 @@
style.setAttribute("type", "text/css");
style.setAttribute("rel", "stylesheet");
style.setAttribute("href", url);
+ style.setAttribute("class", COMPONENT_RESOURCE_LINK_CLASS);
head.insertBefore(style, child);
}
}
+ if (null != _userStyles) {
+ for (Iterator iter = _userStyles.iterator(); iter.hasNext();) {
+ String url = (String) iter.next();
+ Element style = document.createElement("link");
+ style.setAttribute("type", "text/css");
+ style.setAttribute("rel", "stylesheet");
+ style.setAttribute("href", url);
+ style.setAttribute("class", USER_RESOURCE_LINK_CLASS);
+ head.insertBefore(style, child);
+ }
+ }
// Scripts
if (null != _scripts) {
for (Iterator iter = _scripts.iterator(); iter
@@ -385,6 +399,10 @@
public void setStyles(Set styles) {
this._styles = styles;
}
+
+ public void setUserStyles(Set styles) {
+ this._userStyles = styles;
+ }
/*
* (non-Javadoc)
16 years, 9 months
JBoss Rich Faces SVN: r7681 - in trunk/ui/calendar/src/main: java/org/richfaces/component and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2008-04-08 15:45:38 -0400 (Tue, 08 Apr 2008)
New Revision: 7681
Modified:
trunk/ui/calendar/src/main/config/component/calendar.xml
trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
Log:
Calendar: optimize code for locale-depended attributes.
Modified: trunk/ui/calendar/src/main/config/component/calendar.xml
===================================================================
--- trunk/ui/calendar/src/main/config/component/calendar.xml 2008-04-08 17:55:41 UTC (rev 7680)
+++ trunk/ui/calendar/src/main/config/component/calendar.xml 2008-04-08 19:45:38 UTC (rev 7681)
@@ -571,6 +571,7 @@
<name>firstWeekDay</name>
<classname>int</classname>
<description>Gets what the first day of the week is; e.g., SUNDAY in the U.S., MONDAY in France.</description>
+ <defaultvalue>getDefaultFirstWeekDay()</defaultvalue>
</property>
<property>
<name>minDaysInFirstWeek</name>
@@ -581,6 +582,7 @@
day of the first month of a year, this method returns 1. If the
minimal days required must be a full week, this method returns 7.
</description>
+ <defaultvalue>getDefaultMinDaysInFirstWeek()</defaultvalue>
</property>
</component>
Modified: trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
===================================================================
--- trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2008-04-08 17:55:41 UTC (rev 7680)
+++ trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2008-04-08 19:45:38 UTC (rev 7681)
@@ -77,12 +77,6 @@
private final static Log log = LogFactory.getLog(UICalendar.class);
- private int firstWeekDay;
- private boolean firstWeekDaySet = false;
-
- private int minDaysInFirstWeek;
- private boolean minDaysInFirstWeekSet = false;
-
public abstract Object getLocale();
public abstract void setLocale(Object locale);
@@ -211,7 +205,14 @@
public abstract boolean isShowApplyButton();
public abstract void setShowApplyButton(boolean showApplyButton);
+
+ public abstract int getFirstWeekDay();
+ public abstract void setFirstWeekDay(int firstWeekDay);
+ public abstract int getMinDaysInFirstWeek();
+ public abstract void setMinDaysInFirstWeek(int minDaysInFirstWeek);
+
+
// TODO onclick add users onclick
// currentDate processing -------------------------------------------------
@@ -623,86 +624,12 @@
}
}
- public int getFirstWeekDay() {
- if (this.firstWeekDaySet) {
- return this.firstWeekDay;
- } else {
- Calendar cal = getCalendar();
- int defaultValue = cal.getFirstDayOfWeek() - cal.getActualMinimum(Calendar.DAY_OF_WEEK);
-
- ValueExpression ve = getValueExpression("firstWeekDay");
- if (ve != null) {
- Integer value = null;
-
- try {
- value = (Integer) ve.getValue(getFacesContext().getELContext());
- } catch (ELException e) {
- throw new FacesException(e);
- }
-
- if (null == value) {
- return defaultValue;
- }
-
- return value.intValue();
- } else {
- return defaultValue;
- }
- }
+ protected int getDefaultFirstWeekDay() {
+ Calendar cal = getCalendar();
+ return cal.getFirstDayOfWeek() - cal.getActualMinimum(Calendar.DAY_OF_WEEK);
}
-
- public void setFirstWeekDay(int firstWeekDay) {
- this.firstWeekDay = firstWeekDay;
- this.firstWeekDaySet = true;
- }
-
- public int getMinDaysInFirstWeek() {
- if (this.minDaysInFirstWeekSet) {
- return this.minDaysInFirstWeek;
- } else {
- Calendar cal = getCalendar();
- int defaultValue = cal.getMinimalDaysInFirstWeek();
-
- ValueExpression ve = getValueExpression("minDaysInFirstWeek");
- if (ve != null) {
- Integer value = null;
-
- try {
- value = (Integer) ve.getValue(getFacesContext().getELContext());
- } catch (ELException e) {
- throw new FacesException(e);
- }
-
- if (null == value) {
- return defaultValue;
- }
-
- return value.intValue();
- } else {
- return defaultValue;
- }
- }
- }
-
- public void setMinDaysInFirstWeek(int minDaysInFirstWeek) {
- this.minDaysInFirstWeek = minDaysInFirstWeek;
- this.minDaysInFirstWeekSet = true;
- }
- public Object saveState(FacesContext context) {
- Object[] state = new Object[3];
- state[0] = super.saveState(context);
- state[1] = new Integer(this.firstWeekDay);
- state[2] = new Integer(this.minDaysInFirstWeek);
-
- return state;
+ protected int getDefaultMinDaysInFirstWeek() {
+ return getCalendar().getMinimalDaysInFirstWeek();
}
-
- public void restoreState(FacesContext context, Object state) {
- Object[] _state = (Object[]) state;
- super.restoreState(context, _state[0]);
- this.firstWeekDay = ((Integer)_state[1]).intValue();
- this.minDaysInFirstWeek = ((Integer)_state[2]).intValue();
- }
-
}
16 years, 9 months