JBoss Rich Faces SVN: r399 - trunk/richfaces/inputnumber-spinner/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: pkotikov
Date: 2007-04-13 08:26:52 -0400 (Fri, 13 Apr 2007)
New Revision: 399
Modified:
trunk/richfaces/inputnumber-spinner/src/test/java/org/richfaces/component/InputNumberSpinnerComponentTest.java
Log:
Tests updated.
Modified: trunk/richfaces/inputnumber-spinner/src/test/java/org/richfaces/component/InputNumberSpinnerComponentTest.java
===================================================================
--- trunk/richfaces/inputnumber-spinner/src/test/java/org/richfaces/component/InputNumberSpinnerComponentTest.java 2007-04-13 12:26:45 UTC (rev 398)
+++ trunk/richfaces/inputnumber-spinner/src/test/java/org/richfaces/component/InputNumberSpinnerComponentTest.java 2007-04-13 12:26:52 UTC (rev 399)
@@ -31,7 +31,6 @@
import javax.faces.component.UICommand;
import javax.faces.component.UIComponent;
import javax.faces.component.UIForm;
-import javax.faces.component.UIInput;
import javax.faces.component.UIViewRoot;
import javax.faces.component.html.HtmlCommandLink;
import javax.faces.component.html.HtmlForm;
@@ -39,10 +38,13 @@
import javax.faces.el.EvaluationException;
import javax.faces.el.PropertyNotFoundException;
import javax.faces.el.ValueBinding;
+import javax.servlet.http.HttpServletResponse;
import org.ajax4jsf.framework.resource.InternetResource;
import org.ajax4jsf.framework.resource.InternetResourceBuilder;
import org.ajax4jsf.framework.resource.Java2Dresource;
+import org.ajax4jsf.framework.resource.ResourceBuilderImpl;
+import org.ajax4jsf.framework.util.image.ImageInfo;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
import org.apache.commons.lang.StringUtils;
import org.richfaces.renderkit.html.images.background.SpinnerButtonGradient;
@@ -51,6 +53,7 @@
import org.richfaces.renderkit.html.images.buttons.SpinnerButtonUp;
import com.gargoylesoftware.htmlunit.KeyValuePair;
+import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlInput;
@@ -170,6 +173,36 @@
assertTrue( imageDim.getWidth() == 14 && imageDim.getHeight() == 7);
}
+ public void testRenderImages() throws Exception {
+ renderView();
+ InternetResourceBuilder builder = ResourceBuilderImpl.getInstance();
+ InternetResource resource = builder.getResource("org/richfaces/renderkit/html/css/spinner.xcss");
+ assertNotNull(resource);
+ String uri = "http:" + resource.getUri(facesContext, null);
+ Page page = webClient.getPage(uri);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+
+ String[] resources = new String[] {
+ SpinnerButtonGradient.class.getName(),
+ SpinnerFieldGradient.class.getName(),
+ SpinnerButtonDown.class.getName(),
+ SpinnerButtonUp.class.getName()
+ };
+
+ for (int i = 0; i < resources.length; i++) {
+ resource = builder.getResource(resources[i]);
+ assertNotNull(resource);
+ uri = "http:" + resource.getUri(facesContext, null);
+ page = webClient.getPage(uri);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+ ImageInfo info = new ImageInfo();
+ info.setInput(page.getWebResponse().getContentAsStream());
+ //image recognizable?
+ assertTrue(info.check());
+ assertEquals(ImageInfo.FORMAT_GIF, info.getFormat());
+ }
+ }
+
public void testRenderStyle() throws Exception {
HtmlPage page = renderView();
assertNotNull(page);
19 years
JBoss Rich Faces SVN: r398 - trunk/richfaces/inputnumber-slider/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: pkotikov
Date: 2007-04-13 08:26:45 -0400 (Fri, 13 Apr 2007)
New Revision: 398
Modified:
trunk/richfaces/inputnumber-slider/src/test/java/org/richfaces/component/InputNumberSliderComponentTest.java
Log:
Tests updated.
Modified: trunk/richfaces/inputnumber-slider/src/test/java/org/richfaces/component/InputNumberSliderComponentTest.java
===================================================================
--- trunk/richfaces/inputnumber-slider/src/test/java/org/richfaces/component/InputNumberSliderComponentTest.java 2007-04-13 12:08:52 UTC (rev 397)
+++ trunk/richfaces/inputnumber-slider/src/test/java/org/richfaces/component/InputNumberSliderComponentTest.java 2007-04-13 12:26:45 UTC (rev 398)
@@ -37,11 +37,13 @@
import javax.faces.el.EvaluationException;
import javax.faces.el.PropertyNotFoundException;
import javax.faces.el.ValueBinding;
+import javax.servlet.http.HttpServletResponse;
import org.ajax4jsf.framework.resource.InternetResource;
import org.ajax4jsf.framework.resource.InternetResourceBuilder;
import org.ajax4jsf.framework.resource.Java2Dresource;
-import org.ajax4jsf.framework.resource.ResourceContext;
+import org.ajax4jsf.framework.resource.ResourceBuilderImpl;
+import org.ajax4jsf.framework.util.image.ImageInfo;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
import org.apache.commons.lang.StringUtils;
import org.richfaces.renderkit.html.images.SliderArrowImage;
@@ -50,6 +52,7 @@
import org.richfaces.renderkit.html.images.SliderTrackGradient;
import com.gargoylesoftware.htmlunit.KeyValuePair;
+import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.html.DomNode;
import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
@@ -200,7 +203,37 @@
imageDim = ((Java2Dresource)image).getDimensions(facesContext, null);
assertTrue( imageDim.getWidth() == 7 && imageDim.getHeight() == 8);
}
+
+ public void testRenderImages() throws Exception {
+ renderView();
+ InternetResourceBuilder builder = ResourceBuilderImpl.getInstance();
+ InternetResource resource = builder.getResource("org/richfaces/renderkit/html/css/slider.xcss");
+ assertNotNull(resource);
+ String uri = "http:" + resource.getUri(facesContext, null);
+ Page page = webClient.getPage(uri);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+ String[] resources = new String[] {
+ SliderArrowImage.class.getName(),
+ SliderArrowSelectedImage.class.getName(),
+ SliderFieldGradient.class.getName(),
+ SliderTrackGradient.class.getName()
+ };
+
+ for (int i = 0; i < resources.length; i++) {
+ resource = builder.getResource(resources[i]);
+ assertNotNull(resource);
+ uri = "http:" + resource.getUri(facesContext, null);
+ page = webClient.getPage(uri);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+ ImageInfo info = new ImageInfo();
+ info.setInput(page.getWebResponse().getContentAsStream());
+ //image recognizable?
+ assertTrue(info.check());
+ assertEquals(ImageInfo.FORMAT_GIF, info.getFormat());
+ }
+ }
+
public void testUpdate() throws Exception {
//tests if component handles value bindings correctly
HtmlPage renderedView = renderView();
19 years
JBoss Rich Faces SVN: r397 - trunk/richfaces/tabPanel/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-04-13 08:08:52 -0400 (Fri, 13 Apr 2007)
New Revision: 397
Added:
trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/UITabPanelTest.java
Modified:
trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/TabPanelComponentTest.java
trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/UITabTest.java
Log:
test updated
Modified: trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/TabPanelComponentTest.java
===================================================================
--- trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/TabPanelComponentTest.java 2007-04-13 11:50:11 UTC (rev 396)
+++ trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/TabPanelComponentTest.java 2007-04-13 12:08:52 UTC (rev 397)
@@ -21,17 +21,20 @@
package org.richfaces.component;
+import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlScript;
+import org.ajax4jsf.framework.resource.InternetResource;
+import org.ajax4jsf.framework.resource.InternetResourceBuilder;
+import org.ajax4jsf.framework.resource.ResourceBuilderImpl;
+import org.ajax4jsf.framework.util.image.ImageInfo;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
import org.apache.commons.lang.StringUtils;
-import org.richfaces.component.html.HtmlTab;
-import org.richfaces.component.html.HtmlTabPanel;
-import org.richfaces.renderkit.TabPanelRendererBase;
import javax.faces.component.UIForm;
import javax.faces.component.html.HtmlForm;
+import javax.servlet.http.HttpServletResponse;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -76,15 +79,15 @@
form.setId("form");
facesContext.getViewRoot().getChildren().add(form);
- tabPanel = (UITabPanel)application.createComponent("org.richfaces.TabPanel");
+ tabPanel = (UITabPanel) application.createComponent("org.richfaces.TabPanel");
tabPanel.setId("tabPanel");
form.getChildren().add(tabPanel);
- tab1 = (UITab)application.createComponent("org.richfaces.Tab");
+ tab1 = (UITab) application.createComponent("org.richfaces.Tab");
tab1.setId("tab1");
tabPanel.getChildren().add(tab1);
- tab2 = (UITab)application.createComponent("org.richfaces.Tab");
+ tab2 = (UITab) application.createComponent("org.richfaces.Tab");
tab2.setId("tab2");
tab2.setActive(false);
tabPanel.getChildren().add(tab2);
@@ -194,7 +197,8 @@
if (StringUtils.isNotBlank(srcAttr)) {
boolean found = false;
- for (Iterator srcIt = javaScripts.iterator(); srcIt.hasNext();) {
+ for (Iterator srcIt = javaScripts.iterator(); srcIt.hasNext();)
+ {
String src = (String) srcIt.next();
found = srcAttr.contains(src);
@@ -207,4 +211,36 @@
}
}
}
+
+ public void testRenderImages() throws Exception {
+ HtmlPage view = renderView();
+ assertNotNull(view);
+ System.out.println(view.asXml());
+
+ InternetResourceBuilder builder = ResourceBuilderImpl.getInstance();
+ InternetResource resource = builder.getResource("org/richfaces/renderkit/html/css/tabPanel.xcss");
+ assertNotNull(resource);
+ String uri = "http:" + resource.getUri(facesContext, null);
+ Page page = webClient.getPage(uri);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+
+ String[] resources = new String[]{
+ "org.richfaces.renderkit.images.TabGradientA",
+ "org.richfaces.renderkit.images.TabGradientB",
+ "org.richfaces.renderkit.images.TabStripeImage"
+ };
+
+ for (int i = 0; i < resources.length; i++) {
+ resource = builder.getResource(resources[i]);
+ assertNotNull(resource);
+ uri = "http:" + resource.getUri(facesContext, null);
+ page = webClient.getPage(uri);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+ ImageInfo info = new ImageInfo();
+ info.setInput(page.getWebResponse().getContentAsStream());
+ //image recognizable?
+ assertTrue(info.check());
+ assertEquals(ImageInfo.FORMAT_GIF, info.getFormat());
+ }
+ }
}
Added: trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/UITabPanelTest.java
===================================================================
--- trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/UITabPanelTest.java (rev 0)
+++ trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/UITabPanelTest.java 2007-04-13 12:08:52 UTC (rev 397)
@@ -0,0 +1,120 @@
+package org.richfaces.component;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlOutputText;
+import java.util.Iterator;
+
+/**
+ * Unit test for UITabPanel.
+ */
+public class UITabPanelTest extends AbstractAjax4JsfTestCase {
+
+ private UITabPanel tabPanel;
+ private UITab tab1;
+ private UITab tab2;
+ private UITab tab3;
+ private UIComponent form;
+ private UIOutput out1;
+ private UIOutput out2;
+ private UIOutput out3;
+
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public UITabPanelTest(String testName) {
+ super(testName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ tabPanel = (UITabPanel) application.createComponent("org.richfaces.TabPanel");
+ form.getChildren().add(tabPanel);
+
+ tab1 = (UITab) application.createComponent("org.richfaces.Tab");
+ tab1.setId("Tab1_ID");
+ tab1.setName("Tab1");
+ out1 = (UIOutput) application.createComponent(HtmlOutputText.COMPONENT_TYPE);
+ out1.setValue("output1");
+ tab1.getChildren().add(out1);
+ tabPanel.getChildren().add(tab1);
+
+ tab2 = (UITab) application.createComponent("org.richfaces.Tab");
+ tab2.setId("Tab2_ID");
+ tab2.setName("Tab2");
+ out2 = (UIOutput) application.createComponent(HtmlOutputText.COMPONENT_TYPE);
+ out2.setValue("output2");
+ tab2.getChildren().add(out2);
+ tabPanel.getChildren().add(tab2);
+
+ tab3 = (UITab) application.createComponent("org.richfaces.Tab");
+ tab3.setId("Tab3_ID");
+ tab3.setName("Tab3");
+ out3 = (UIOutput) application.createComponent(HtmlOutputText.COMPONENT_TYPE);
+ out3.setValue("output3");
+ tab3.getChildren().add(out3);
+ tabPanel.getChildren().add(tab3);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ tabPanel = null;
+ tab1 = null;
+ tab2 = null;
+ tab3 = null;
+ form = null;
+ out1 = null;
+ out2 = null;
+ out3 = null;
+ }
+
+ public void testConvertSwitchValue() throws Exception {
+ assertEquals("switchValue",
+ tabPanel.convertSwitchValue(tab1, "switchValue"));
+ assertEquals("Tab1", tabPanel.convertSwitchValue(tab1, null));
+
+ try {
+ assertEquals("Tab1", tabPanel.convertSwitchValue(tabPanel, null));
+ assertTrue(false);
+ } catch(ClassCastException ex) {
+ }
+ }
+
+ public void testGetSwitchedFacetsAndChildren1() throws Exception {
+ tab1.setSwitchType(UISwitchablePanel.SERVER_METHOD);
+ tab2.setSwitchType(UISwitchablePanel.SERVER_METHOD);
+ tab3.setSwitchType(UISwitchablePanel.SERVER_METHOD);
+
+ tabPanel.setRenderedValue(tab3.getName());
+
+ Iterator it = tabPanel.getSwitchedFacetsAndChildren();
+ assertEquals(tab3.getId(), ((UITab)it.next()).getId());
+ }
+
+ public void testGetSwitchedFacetsAndChildren2() throws Exception {
+ tab1.setSwitchType(UISwitchablePanel.CLIENT_METHOD);
+ tab2.setSwitchType(UISwitchablePanel.CLIENT_METHOD);
+ tab3.setSwitchType(UISwitchablePanel.CLIENT_METHOD);
+
+ Iterator it = tabPanel.getSwitchedFacetsAndChildren();
+ assertEquals(tab1.getId(), ((UITab)it.next()).getId());
+ assertEquals(tab2.getId(), ((UITab)it.next()).getId());
+ assertEquals(tab3.getId(), ((UITab)it.next()).getId());
+ }
+}
Modified: trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/UITabTest.java
===================================================================
--- trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/UITabTest.java 2007-04-13 11:50:11 UTC (rev 396)
+++ trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/UITabTest.java 2007-04-13 12:08:52 UTC (rev 397)
@@ -22,18 +22,19 @@
package org.richfaces.component;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.richfaces.component.html.HtmlTabPanel;
-import org.richfaces.component.html.HtmlTab;
import javax.faces.component.UIForm;
import javax.faces.component.html.HtmlForm;
+import javax.faces.context.FacesContext;
+import javax.faces.render.Renderer;
/**
- * Unit test for UITabTest.
+ * Unit test for UITab.
*/
public class UITabTest extends AbstractAjax4JsfTestCase {
private UITab tab;
+ private UITab tab2;
private UITabPanel tabPanel;
private UIForm form;
@@ -52,11 +53,13 @@
public void setUp() throws Exception {
super.setUp();
- tab = (UITab)application.createComponent("org.richfaces.Tab");
+ tab = (UITab) application.createComponent("org.richfaces.Tab");
tab.setId("tab");
- tabPanel = (UITabPanel)application.createComponent("org.richfaces.TabPanel");
+ tab2 = (UITab) application.createComponent("org.richfaces.Tab");
+ tabPanel = (UITabPanel) application.createComponent("org.richfaces.TabPanel");
+
form = new HtmlForm();
}
@@ -66,6 +69,7 @@
public void tearDown() throws Exception {
super.tearDown();
tab = null;
+ tab2 = null;
tabPanel = null;
form = null;
}
@@ -85,7 +89,157 @@
try {
tab.getPane();
assertTrue(false);
- } catch(Exception ex) {
+ } catch (Exception ex) {
}
}
+
+ public void testEncodeTab() throws Exception {
+ try {
+ tab.encodeTab(null, false);
+ assertTrue(false);
+ } catch (NullPointerException ex) {
+ }
+
+ try {
+ FakeUITab fakeTab = new FakeUITab();
+ fakeTab.setRendered(false);
+ fakeTab.encodeTab(facesContext, false);
+ } catch (NullPointerException ex) {
+ assertTrue(false);
+ }
+ }
+
+ public void testSaveRestore() throws Exception {
+ tab.setSwitchType("switchType");
+ assertEquals("switchType", tab.getSwitchType());
+
+ Object state = tab.saveState(facesContext);
+ tab2.restoreState(facesContext, state);
+ assertEquals("switchType", tab2.getSwitchType());
+ }
+
+ class FakeUITab extends UITab {
+ protected Renderer getRenderer(FacesContext context) {
+ throw new NullPointerException("Never executed");
+ }
+
+ public Object getValue() {
+ return null;
+ }
+
+ public void setValue(Object newvalue) {
+ }
+
+ public Object getName() {
+ return null;
+ }
+
+ public void setName(Object newvalue) {
+ }
+
+ public boolean isDisabled() {
+ return false;
+ }
+
+ public void setDisabled(boolean disabled) {
+ }
+
+ public String getLabel() {
+ return null;
+ }
+
+ public void setLabel(String newvalue) {
+ }
+
+ public String getLabelWidth() {
+ return null;
+ }
+
+ public void setLabelWidth(String newvalue) {
+ }
+
+ public String getTitle() {
+ return null;
+ }
+
+ public void setTitle(String newvalue) {
+ }
+
+ public void setReRender(Object targetId) {
+ }
+
+ public Object getReRender() {
+ return null;
+ }
+
+ public void setStatus(String status) {
+ }
+
+ public String getStatus() {
+ return null;
+ }
+
+ public void setOncomplete(String oncomplete) {
+ }
+
+ public String getOncomplete() {
+ return null;
+ }
+
+ public void setData(Object data) {
+ }
+
+ public Object getData() {
+ return null;
+ }
+
+ public void setLimitToList(boolean submitForm) {
+ }
+
+ public boolean isLimitToList() {
+ return false;
+ }
+
+ public void setAjaxSingle(boolean single) {
+ }
+
+ public boolean isAjaxSingle() {
+ return false;
+ }
+
+ public boolean isBypassUpdates() {
+ return false;
+ }
+
+ public void setBypassUpdates(boolean bypass) {
+ }
+
+ public String getEventsQueue() {
+ return null;
+ }
+
+ public void setIgnoreDupResponses(boolean newvalue) {
+ }
+
+ public boolean isIgnoreDupResponses() {
+ return false;
+ }
+
+ public void setEventsQueue(String newvalue) {
+ }
+
+ public int getRequestDelay() {
+ return 0;
+ }
+
+ public void setRequestDelay(int newvalue) {
+ }
+
+ public int getTimeout() {
+ return 0;
+ }
+
+ public void setTimeout(int timeout) {
+ }
+ }
}
19 years
JBoss Rich Faces SVN: r396 - trunk/richfaces/inputnumber-spinner/src/main/templates.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2007-04-13 07:50:11 -0400 (Fri, 13 Apr 2007)
New Revision: 396
Modified:
trunk/richfaces/inputnumber-spinner/src/main/templates/inputNumberSpinner.jspx
Log:
onfocus and onblur attributes added to text input.
Modified: trunk/richfaces/inputnumber-spinner/src/main/templates/inputNumberSpinner.jspx
===================================================================
--- trunk/richfaces/inputnumber-spinner/src/main/templates/inputNumberSpinner.jspx 2007-04-13 11:42:11 UTC (rev 395)
+++ trunk/richfaces/inputnumber-spinner/src/main/templates/inputNumberSpinner.jspx 2007-04-13 11:50:11 UTC (rev 396)
@@ -24,7 +24,17 @@
<tbody>
<tr>
<td width="1%" class="dr-spnr-e rich-spinner-input-container" id="#{clientId}Edit">
- <input onchange="#{component.attributes['onchange']}" onselect="#{component.attributes['onselect']}" type="text" accesskey="#{component.attributes['accesskey']}" size="#{component.attributes['inputSize']}" name="#{clientId}" class="dr-spnr-i rich-spinner-input #{component.attributes['inputClass']}" style="#{component.attributes['inputStyle']}" value="#{this:getInputValue(context, component)}"/>
+ <input onchange="#{component.attributes['onchange']}"
+ onselect="#{component.attributes['onselect']}"
+ onfocus="#{component.attributes['onfocus']}"
+ onblur="#{component.attributes['onblur']}"
+ type="text"
+ accesskey="#{component.attributes['accesskey']}"
+ size="#{component.attributes['inputSize']}"
+ name="#{clientId}"
+ class="dr-spnr-i rich-spinner-input #{component.attributes['inputClass']}"
+ style="#{component.attributes['inputStyle']}"
+ value="#{this:getInputValue(context, component)}" />
</td>
<td id="#{clientId}For" class="dr-spnr-b" width="1%">
<table id="#{clientId}Buttons" border="0" cellspacing="0" cellpadding="0">
19 years
JBoss Rich Faces SVN: r395 - trunk/richfaces/inputnumber-slider/src/main/templates.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2007-04-13 07:42:11 -0400 (Fri, 13 Apr 2007)
New Revision: 395
Modified:
trunk/richfaces/inputnumber-slider/src/main/templates/inputNumberSlider.jspx
Log:
onfocus and onblur attributes added to text input.
Modified: trunk/richfaces/inputnumber-slider/src/main/templates/inputNumberSlider.jspx
===================================================================
--- trunk/richfaces/inputnumber-slider/src/main/templates/inputNumberSlider.jspx 2007-04-13 10:59:04 UTC (rev 394)
+++ trunk/richfaces/inputnumber-slider/src/main/templates/inputNumberSlider.jspx 2007-04-13 11:42:11 UTC (rev 395)
@@ -66,7 +66,9 @@
style="#{component.attributes['inputStyle']} #{color}"
readonly="#{inputReadOnly}"
disabled="#{disabled}"
- onselect="#{component.attributes['onselect']}"
+ onselect="#{component.attributes['onselect']}"
+ onfocus="#{component.attributes['onfocus']}"
+ onblur="#{component.attributes['onblur']}"
accesskey="#{component.attributes['accesskey']}"
size="#{component.attributes['inputSize']}"
maxlength="#{component.attributes['maxlength']}"
19 years
JBoss Rich Faces SVN: r394 - trunk/richfaces/tree/src/main/templates.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2007-04-13 06:59:04 -0400 (Fri, 13 Apr 2007)
New Revision: 394
Modified:
trunk/richfaces/tree/src/main/templates/htmlTreeNode.jspx
Log:
Add alt="" to the images in the template.
Modified: trunk/richfaces/tree/src/main/templates/htmlTreeNode.jspx
===================================================================
--- trunk/richfaces/tree/src/main/templates/htmlTreeNode.jspx 2007-04-12 22:54:31 UTC (rev 393)
+++ trunk/richfaces/tree/src/main/templates/htmlTreeNode.jspx 2007-04-13 10:59:04 UTC (rev 394)
@@ -40,7 +40,7 @@
<![CDATA[
if (component.getUITree().isLeaf()) {
]]>
- </jsp:scriptlet> <img id="#{clientId}:handle:img" src="#{spacer}"/> <jsp:scriptlet>
+ </jsp:scriptlet> <img id="#{clientId}:handle:img" src="#{spacer}" alt="" /> <jsp:scriptlet>
<![CDATA[
} else {
]]>
@@ -48,14 +48,14 @@
onclick="#{this:getToggleScript(context, component)} return false;"> <jsp:scriptlet>
<![CDATA[if (component.getUITree().isExpanded()) {]]>
</jsp:scriptlet> <img border="0" id="#{clientId}:handle:img:collapsed"
- src="#{collapsed}" class="dr-tree-pointer-cursor" style="display: none;" />
+ src="#{collapsed}" class="dr-tree-pointer-cursor" style="display: none;" alt="" />
<img border="0" id="#{clientId}:handle:img:expanded" src="#{expanded}"
- class="dr-tree-pointer-cursor" /> <jsp:scriptlet>
+ class="dr-tree-pointer-cursor" alt="" /> <jsp:scriptlet>
<![CDATA[} else {]]>
</jsp:scriptlet> <img border="0" id="#{clientId}:handle:img:collapsed"
- src="#{collapsed}" class="dr-tree-pointer-cursor" /> <img border="0"
+ src="#{collapsed}" class="dr-tree-pointer-cursor" alt="" /> <img border="0"
id="#{clientId}:handle:img:expanded" src="#{expanded}"
- class="dr-tree-pointer-cursor" style="display: none;" /> <jsp:scriptlet>
+ class="dr-tree-pointer-cursor" style="display: none;" alt="" /> <jsp:scriptlet>
<![CDATA[}]]>
</jsp:scriptlet> </a> <jsp:scriptlet>
<![CDATA[
@@ -75,13 +75,13 @@
if (component.getUITree().isLeaf()) {
]]>
</jsp:scriptlet>
- <img src="#{leaf}" />
+ <img src="#{leaf}" alt="" />
<jsp:scriptlet>
<![CDATA[
} else {
]]>
</jsp:scriptlet>
- <img src="#{folder}" />
+ <img src="#{folder}" alt="" />
<jsp:scriptlet>
<![CDATA[
}
19 years
JBoss Rich Faces SVN: r393 - trunk/richfaces/common/src/test/java/org/richfaces/json.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-12 18:54:31 -0400 (Thu, 12 Apr 2007)
New Revision: 393
Modified:
trunk/richfaces/common/src/test/java/org/richfaces/json/JsonTest.java
Log:
JsonTest.java Java 5 syntax corrected
Modified: trunk/richfaces/common/src/test/java/org/richfaces/json/JsonTest.java
===================================================================
--- trunk/richfaces/common/src/test/java/org/richfaces/json/JsonTest.java 2007-04-12 20:06:46 UTC (rev 392)
+++ trunk/richfaces/common/src/test/java/org/richfaces/json/JsonTest.java 2007-04-12 22:54:31 UTC (rev 393)
@@ -46,12 +46,12 @@
public void testMap() throws Exception {
JSONMap map = new JSONMap("{text: 12, moreData: { key: value, key1: 23.04 }}");
- assertEquals(12, map.get("text"));
+ assertEquals(12, ((Integer) map.get("text")).intValue());
assertEquals(2, map.size());
Map innerMap = (Map) map.get("moreData");
assertEquals("value", innerMap.get("key"));
- assertEquals(23.04, innerMap.get("key1"));
+ assertEquals(23.04, ((Double) innerMap.get("key1")).doubleValue(), 0);
assertEquals(2, innerMap.size());
}
@@ -69,7 +69,7 @@
assertTrue(iterator.hasNext());
assertEquals("value", innerMap.get("key"));
- assertEquals(23.04, innerMap.get("key1"));
+ assertEquals(23.04, ((Double) innerMap.get("key1")).doubleValue(), 0);
assertEquals(2, innerMap.size());
Collection innerCollection = (Collection) iterator.next();
@@ -77,11 +77,11 @@
Iterator innerIterator = innerCollection.iterator();
assertTrue(innerIterator.hasNext());
- assertEquals(1, innerIterator.next());
+ assertEquals(1, ((Integer) innerIterator.next()).intValue());
assertTrue(innerIterator.hasNext());
assertEquals("a", innerIterator.next());
assertTrue(innerIterator.hasNext());
- assertEquals(3, innerIterator.next());
+ assertEquals(3, ((Integer) innerIterator.next()).intValue());
assertFalse(innerIterator.hasNext());
assertFalse(iterator.hasNext());
19 years
JBoss Rich Faces SVN: r392 - in trunk/richfaces/common/src: main/java/org/richfaces/json and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-12 16:06:46 -0400 (Thu, 12 Apr 2007)
New Revision: 392
Added:
trunk/richfaces/common/src/test/java/org/richfaces/component/UIRangedNumberInputTest.java
trunk/richfaces/common/src/test/java/org/richfaces/json/
trunk/richfaces/common/src/test/java/org/richfaces/json/JsonTest.java
Modified:
trunk/richfaces/common/src/main/java/org/richfaces/component/UIRangedNumberInput.java
trunk/richfaces/common/src/main/java/org/richfaces/json/JSONCollection.java
trunk/richfaces/common/src/main/java/org/richfaces/json/JSONMap.java
trunk/richfaces/common/src/test/java/org/richfaces/renderkit/InputRendererBaseTest.java
Log:
Tests for common
Modified: trunk/richfaces/common/src/main/java/org/richfaces/component/UIRangedNumberInput.java
===================================================================
--- trunk/richfaces/common/src/main/java/org/richfaces/component/UIRangedNumberInput.java 2007-04-12 19:03:45 UTC (rev 391)
+++ trunk/richfaces/common/src/main/java/org/richfaces/component/UIRangedNumberInput.java 2007-04-12 20:06:46 UTC (rev 392)
@@ -33,15 +33,7 @@
*
*/
public abstract class UIRangedNumberInput extends UIInput {
- private static final double DEFAULT_MIN = 0;
- private static final double DEFAULT_MAX = 100;
- private Number normValue;
-
- public UIRangedNumberInput() {
- super();
- }
-
public abstract String getMaxValue();
public abstract void setMaxValue(String value);
Modified: trunk/richfaces/common/src/main/java/org/richfaces/json/JSONCollection.java
===================================================================
--- trunk/richfaces/common/src/main/java/org/richfaces/json/JSONCollection.java 2007-04-12 19:03:45 UTC (rev 391)
+++ trunk/richfaces/common/src/main/java/org/richfaces/json/JSONCollection.java 2007-04-12 20:06:46 UTC (rev 392)
@@ -77,17 +77,9 @@
};
}
-
+
public int size() {
return array.length();
}
- public static void main(String[] args) throws JSONException {
- JSONCollection collection = new JSONCollection("['string', [1, 2, 3]]");
- Object[] objects = collection.toArray();
- for (int i = 0; i < objects.length; i++) {
- System.out.print(i + "=> ");
- System.out.println(objects[i]);
- }
- }
}
Modified: trunk/richfaces/common/src/main/java/org/richfaces/json/JSONMap.java
===================================================================
--- trunk/richfaces/common/src/main/java/org/richfaces/json/JSONMap.java 2007-04-12 19:03:45 UTC (rev 391)
+++ trunk/richfaces/common/src/main/java/org/richfaces/json/JSONMap.java 2007-04-12 20:06:46 UTC (rev 392)
@@ -129,15 +129,15 @@
return jsonObject.toString(indentFactor);
}
- public static void main(String[] args) throws Exception {
- String json = "{ test1: 'test string', test2: [15, 45, 28], test3: { innerMap1: { prop1: '1', prop2: true }, innerProp1: [12, 2] } }";
- JSONMap map = new JSONMap(json);
- System.out.println(map.get("test1"));
- System.out.println("next >>>>>>>>");
- System.out.println(map.get("test2"));
- System.out.println("next >>>>>>>>");
- System.out.println(map.get("test3"));
- }
+// public static void main(String[] args) throws Exception {
+// String json = "{ test1: 'test string', test2: [15, 45, 28], test3: { innerMap1: { prop1: '1', prop2: true }, innerProp1: [12, 2] } }";
+// JSONMap map = new JSONMap(json);
+// System.out.println(map.get("test1"));
+// System.out.println("next >>>>>>>>");
+// System.out.println(map.get("test2"));
+// System.out.println("next >>>>>>>>");
+// System.out.println(map.get("test3"));
+// }
}
Added: trunk/richfaces/common/src/test/java/org/richfaces/component/UIRangedNumberInputTest.java
===================================================================
--- trunk/richfaces/common/src/test/java/org/richfaces/component/UIRangedNumberInputTest.java (rev 0)
+++ trunk/richfaces/common/src/test/java/org/richfaces/component/UIRangedNumberInputTest.java 2007-04-12 20:06:46 UTC (rev 392)
@@ -0,0 +1,120 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+public class UIRangedNumberInputTest extends AbstractAjax4JsfTestCase {
+
+ private UIRangedNumberInput input;
+
+ public UIRangedNumberInputTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ input = new UIRangedNumberInput() {
+ private String minValue;
+ private String maxValue;
+
+ public String getMinValue() {
+ return minValue;
+ }
+ public void setMinValue(String minValue) {
+ this.minValue = minValue;
+ }
+ public String getMaxValue() {
+ return maxValue;
+ }
+ public void setMaxValue(String maxValue) {
+ this.maxValue = maxValue;
+ }
+ };
+
+ input.setMaxValue("100");
+ input.setMinValue("0");
+ input.setValid(true);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ this.input = null;
+ }
+
+ private void checkValid() {
+ assertTrue(input.isValid());
+ assertFalse(facesContext.getMessages().hasNext());
+ }
+
+ private void checkInvalid() {
+ assertFalse(input.isValid());
+ assertTrue(facesContext.getMessages().hasNext());
+ }
+
+ public void testValidateValueFacesContextObject() {
+ checkValid();
+ input.validateValue(facesContext, new Double(23.45));
+ checkValid();
+ }
+
+ public void testValidateNullValue() throws Exception {
+ checkValid();
+ input.validateValue(facesContext, null);
+ checkValid();
+ }
+
+ public void testValidateMinValue() throws Exception {
+ checkValid();
+ input.validateValue(facesContext, new Double(-23.45));
+ checkInvalid();
+ }
+
+ public void testValidateMaxValue() throws Exception {
+ checkValid();
+ input.validateValue(facesContext, new Double(223.45));
+ checkInvalid();
+ }
+
+
+ public void testValidateMinNullMinValue() throws Exception {
+ input.setMinValue(null);
+ checkValid();
+ input.validateValue(facesContext, new Double(-23.45));
+ checkInvalid();
+ }
+
+ public void testValidateMaxNullMaxValue() throws Exception {
+ input.setMaxValue(null);
+ checkValid();
+ input.validateValue(facesContext, new Double(223.45));
+ checkInvalid();
+ }
+
+ public void testValidateIllegalValue() throws Exception {
+ checkValid();
+ input.validateValue(facesContext, "string");
+ checkInvalid();
+ }
+}
Added: trunk/richfaces/common/src/test/java/org/richfaces/json/JsonTest.java
===================================================================
--- trunk/richfaces/common/src/test/java/org/richfaces/json/JsonTest.java (rev 0)
+++ trunk/richfaces/common/src/test/java/org/richfaces/json/JsonTest.java 2007-04-12 20:06:46 UTC (rev 392)
@@ -0,0 +1,115 @@
+/**
+ *
+ */
+package org.richfaces.json;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Nick Belaevski - nbelaevski(a)exadel.com
+ * created 12.04.2007
+ *
+ */
+public class JsonTest extends TestCase {
+
+ /**
+ * @param name
+ */
+ public JsonTest(String name) {
+ super(name);
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Test method for {@link org.richfaces.json.Test#main(java.lang.String[])}.
+ */
+ public void testMain() {
+ Test.main(null);
+ }
+
+ public void testMap() throws Exception {
+ JSONMap map = new JSONMap("{text: 12, moreData: { key: value, key1: 23.04 }}");
+ assertEquals(12, map.get("text"));
+ assertEquals(2, map.size());
+
+ Map innerMap = (Map) map.get("moreData");
+ assertEquals("value", innerMap.get("key"));
+ assertEquals(23.04, innerMap.get("key1"));
+ assertEquals(2, innerMap.size());
+ }
+
+ public void testCollection() throws Exception {
+ JSONCollection collection = new JSONCollection("[text, { key: value, key1: 23.04 }, [1, a, 3]]");
+ assertEquals(3, collection.size());
+
+ Iterator iterator = collection.iterator();
+ assertTrue(iterator.hasNext());
+
+ assertEquals("text", iterator.next());
+ assertTrue(iterator.hasNext());
+
+ Map innerMap = (Map) iterator.next();
+ assertTrue(iterator.hasNext());
+
+ assertEquals("value", innerMap.get("key"));
+ assertEquals(23.04, innerMap.get("key1"));
+ assertEquals(2, innerMap.size());
+
+ Collection innerCollection = (Collection) iterator.next();
+ assertEquals(3, innerCollection.size());
+ Iterator innerIterator = innerCollection.iterator();
+
+ assertTrue(innerIterator.hasNext());
+ assertEquals(1, innerIterator.next());
+ assertTrue(innerIterator.hasNext());
+ assertEquals("a", innerIterator.next());
+ assertTrue(innerIterator.hasNext());
+ assertEquals(3, innerIterator.next());
+ assertFalse(innerIterator.hasNext());
+
+ assertFalse(iterator.hasNext());
+ }
+
+ public void testNewCollection() throws Exception {
+ JSONCollection collection = new JSONCollection();
+ assertTrue(collection.isEmpty());
+ }
+
+ public void testNewMap() throws Exception {
+ JSONMap map = new JSONMap();
+ assertTrue(map.isEmpty());
+ }
+
+ public void testMapGetString() throws Exception {
+ JSONMap map = new JSONMap("{key: {innerKey: value, moreKey: {deepKey: aaa}}}");
+
+ String[] split = map.getString().split("\n");
+ assertTrue(split[1].startsWith("\"innerKey"));
+ assertTrue(split[2].startsWith("\"moreKey"));
+
+ split = map.getString(3).split("\n");
+ assertTrue(split[1].startsWith(" \"innerKey"));
+ assertTrue(split[2].startsWith(" \"moreKey"));
+
+ split = map.getString(8).split("\n");
+ assertTrue(split[1].startsWith(" \"innerKey"));
+ assertTrue(split[2].startsWith(" \"moreKey"));
+ }
+}
Modified: trunk/richfaces/common/src/test/java/org/richfaces/renderkit/InputRendererBaseTest.java
===================================================================
--- trunk/richfaces/common/src/test/java/org/richfaces/renderkit/InputRendererBaseTest.java 2007-04-12 19:03:45 UTC (rev 391)
+++ trunk/richfaces/common/src/test/java/org/richfaces/renderkit/InputRendererBaseTest.java 2007-04-12 20:06:46 UTC (rev 392)
@@ -68,6 +68,8 @@
*/
public void tearDown() throws Exception {
super.tearDown();
+
+ this.input = null;
}
public void testDoDecode() throws Exception {
19 years
JBoss Rich Faces SVN: r391 - trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2007-04-12 15:03:45 -0400 (Thu, 12 Apr 2007)
New Revision: 391
Modified:
trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js
Log:
Make selection visually changed on mousedown, but be submitted on mouseup like in Windows Explorer.
Modified: trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js
===================================================================
--- trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js 2007-04-12 18:50:29 UTC (rev 390)
+++ trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js 2007-04-12 19:03:45 UTC (rev 391)
@@ -196,11 +196,7 @@
}
this.tree.input.value = this.id;
this.tree.selectionManager.activeItem = this;
-
- if (e) {
- this.fireSelectEvent();
- }
-
+
if (this.tree.options.onSelection) this.tree.options.onSelection(this.id);
this.tree.showNode(this.elements.text.parentNode);
@@ -278,6 +274,10 @@
},
stopListenDrag: function(e) {
+ if (e) {
+ this.fireSelectEvent();
+ }
+
this.dragStarted = false;
Event.stopObserving(this.elements.icon, "mousemove", this.listenDragBound);
19 years
JBoss Rich Faces SVN: r390 - trunk/richfaces/dataTable/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-12 14:50:29 -0400 (Thu, 12 Apr 2007)
New Revision: 390
Modified:
trunk/richfaces/dataTable/src/main/java/org/richfaces/component/UIDataTable.java
Log:
commons-collections bug workaround
Modified: trunk/richfaces/dataTable/src/main/java/org/richfaces/component/UIDataTable.java
===================================================================
--- trunk/richfaces/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2007-04-12 16:41:26 UTC (rev 389)
+++ trunk/richfaces/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2007-04-12 18:50:29 UTC (rev 390)
@@ -93,6 +93,10 @@
}
}
+
+ //commons-collections 2.x bug workaround
+ dataChildren.hasNext();
+
return dataChildren;
}
@@ -103,8 +107,7 @@
*/
public Iterator fixedChildren() {
// Iterate over facets, non-column childrens and column's facets.
- IteratorChain fixedChildren = new IteratorChain(getFacets().values()
- .iterator());
+ IteratorChain fixedChildren = new IteratorChain(getFacets().values().iterator());
fixedChildren.addIterator(new FilterIterator(getChildren().iterator(),
isNotColumn));
// Append all columns facets.
@@ -116,6 +119,10 @@
}
}
+
+ //commons-collections 2.x bug workaround
+ fixedChildren.hasNext();
+
return fixedChildren;
}
19 years