JBoss Rich Faces SVN: r12643 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages/listShuttle and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2009-02-12 11:06:24 -0500 (Thu, 12 Feb 2009)
New Revision: 12643
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ListShuttleBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/listShuttle/listShuttleTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ListShuttleTest.java
Log:
RF-4711
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ListShuttleBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ListShuttleBean.java 2009-02-12 15:06:19 UTC (rev 12642)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ListShuttleBean.java 2009-02-12 16:06:24 UTC (rev 12643)
@@ -53,7 +53,8 @@
private boolean valueChangeListener;
private boolean attrValidator;
private boolean tagValidator;
-
+ private Boolean renderControlFacet;
+
public ListShuttleBean() {
init();
}
@@ -79,6 +80,7 @@
freeItems.add(item);
}
controlsVisible = true;
+ renderControlFacet = false;
}
public void hide(ActionEvent event) {
@@ -238,4 +240,12 @@
public boolean isTagValidator() {
return tagValidator;
}
+
+ public void setRenderControlFacet(Boolean renderControlFacet) {
+ this.renderControlFacet = renderControlFacet;
+ }
+
+ public Boolean getRenderControlFacet() {
+ return renderControlFacet;
+ }
}
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/listShuttle/listShuttleTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ListShuttleTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ListShuttleTest.java 2009-02-12 15:06:19 UTC (rev 12642)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ListShuttleTest.java 2009-02-12 16:06:24 UTC (rev 12643)
@@ -100,6 +100,8 @@
String tagValidatorId;
+ String renderControlFacet;
+
private void init(Template template) {
renderPage(template, initMethod);
parentId = getParentId() + "_form:";
@@ -132,6 +134,7 @@
immediateId = attrFormId + ":immediateId";
attrValidatorId = attrFormId + ":attrValidatorId";
tagValidatorId = attrFormId + ":tagValidatorId";
+ renderControlFacet = attrFormId + ":renderControlFacet";
}
/**
@@ -163,18 +166,33 @@
@Test
public void testControlFacets(Template template) {
init(template);
- String orderingListId = getParentId() + "testControlFacets";
- Assert.assertTrue(selenium.isElementPresent(orderingListId + ":topControlFacet"));
- Assert.assertTrue(selenium.isElementPresent(orderingListId + ":topControlDisabledFacet"));
- Assert.assertTrue(selenium.isElementPresent(orderingListId + ":bottomControlFacet"));
- Assert.assertTrue(selenium.isElementPresent(orderingListId + ":bottomControlDisabledFacet"));
- Assert.assertTrue(selenium.isElementPresent(orderingListId + ":upControlFacet"));
- Assert.assertTrue(selenium.isElementPresent(orderingListId + ":upControlDisabledFacet"));
- Assert.assertTrue(selenium.isElementPresent(orderingListId + ":downControlFacet"));
- Assert.assertTrue(selenium.isElementPresent(orderingListId + ":downControlDisabledFacet"));
- _checkVisibility(false);
+ clickAjaxCommandAndWait(renderControlFacet);
+ _selectItem(parentId + "ls:1");
+ _checkControlFacet("copyAll", true);
+ _checkControlFacet("copy", true);
+ _checkControlFacet("removeAll", false);
+ _checkControlFacet("remove", false);
+ _checkControlFacet("top", false);
+ _checkControlFacet("bottom", false);
+ _checkControlFacet("up", false);
+ _checkControlFacet("down", false);
+ selenium.click(lsId + ":copyAllControlFacet");
+ _selectItem(parentId + "ls:1");
+ _checkControlFacet("copyAll", false);
+ _checkControlFacet("copy", false);
+ _checkControlFacet("removeAll", true);
+ _checkControlFacet("remove", true);
+ _checkControlFacet("top", true);
+ _checkControlFacet("bottom", true);
+ _checkControlFacet("up", true);
+ _checkControlFacet("down", true);
}
+ private void _checkControlFacet(String facet, boolean enabled) {
+ Assert.assertEquals(selenium.isVisible(lsId + ":" + facet + "ControlFacet"), enabled);
+ Assert.assertEquals(selenium.isVisible(lsId + ":" + facet + "ControlDisabledFacet"), !enabled);
+ }
+
/**
* check internationalization
*/
15 years, 3 months
JBoss Rich Faces SVN: r12642 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/WEB-INF and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2009-02-12 10:06:19 -0500 (Thu, 12 Feb 2009)
New Revision: 12642
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ComboBoxTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/comboBox/comboBoxTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComboBoxTest.java
Log:
RF-6064
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ComboBoxTestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ComboBoxTestBean.java 2009-02-12 14:27:41 UTC (rev 12641)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ComboBoxTestBean.java 2009-02-12 15:06:19 UTC (rev 12642)
@@ -24,10 +24,15 @@
import java.util.Arrays;
import java.util.List;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
-public class ComboBoxTestBean {
+public class ComboBoxTestBean implements Validator{
private String value;
private String trace;
@@ -83,4 +88,18 @@
public void valueChangeListener(ValueChangeEvent event) {
trace = "changed";
}
+
+ public void validate(FacesContext context, UIComponent component,
+ Object value) throws ValidatorException {
+ if ("11".equals(value)) {
+ throw new ValidatorException(new FacesMessage("Value mustn't be equal 11."));
+ }
+ }
+
+ public void validate2(FacesContext context, UIComponent component,
+ Object value) throws ValidatorException {
+ if ("44".equals(value)) {
+ throw new ValidatorException(new FacesMessage("Value mustn't be equal 44."));
+ }
+ }
}
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2009-02-12 14:27:41 UTC (rev 12641)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2009-02-12 15:06:19 UTC (rev 12642)
@@ -51,6 +51,11 @@
<validator-class>org.ajax4jsf.autotest.bean.AutoTestDefaultValidator</validator-class>
</validator>
+ <validator>
+ <validator-id>comboBoxValidator</validator-id>
+ <validator-class>org.ajax4jsf.bean.ComboBoxTestBean</validator-class>
+ </validator>
+
<managed-bean>
<managed-bean-name>configurator</managed-bean-name>
<managed-bean-class>org.ajax4jsf.bean.Configurator</managed-bean-class>
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/comboBox/comboBoxTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComboBoxTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComboBoxTest.java 2009-02-12 14:27:41 UTC (rev 12641)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComboBoxTest.java 2009-02-12 15:06:19 UTC (rev 12642)
@@ -43,6 +43,8 @@
private String trace;
+ private String message;
+
private void init(Template template) {
renderPage(null, template, "#{comboBean.init}");
//String attrForm = getParentId() + "attrForm";
@@ -53,6 +55,7 @@
submit = mainForm + ":submit";
value = getParentId() + "value";
trace = getParentId() + "trace";
+ message = getParentId() + "message";
}
@Test
@@ -140,12 +143,32 @@
selenium.click(comboboxButton);
selenium.mouseMove("xpath=id('" + list + "')/span[2]");
selenium.click("xpath=id('" + list + "')/span[2]");
- //selenium.fireEvent("xpath=id('" + list + "')/span[3]", "click");
clickAjaxCommandAndWait(submit);
Assert.assertEquals(selenium.getText(value), "22");
Assert.assertEquals(selenium.getText(trace), "changed");
}
+ /**
+ * Check component validation.
+ * Specific validator defined in "validator" attribute
+ * should be triggered either as the ones defined using nested validator tags
+ */
+ @Test
+ public void testValidators(Template template) {
+ init(template);
+ Assert.assertEquals(selenium.getText(message), "");
+ selenium.click(comboboxButton);
+ selenium.mouseMove("xpath=id('" + list + "')/span[1]");
+ selenium.click("xpath=id('" + list + "')/span[1]");
+ clickAjaxCommandAndWait(submit);
+ Assert.assertEquals(selenium.getText(message), "Value mustn't be equal 11.");
+ selenium.click(comboboxButton);
+ selenium.mouseMove("xpath=id('" + list + "')/span[4]");
+ selenium.click("xpath=id('" + list + "')/span[4]");
+ clickAjaxCommandAndWait(submit);
+ Assert.assertEquals(selenium.getText(message), "Value mustn't be equal 44.");
+ }
+
public String getTestUrl() {
return "pages/comboBox/comboBoxTest.xhtml";
}
15 years, 3 months
JBoss Rich Faces SVN: r12641 - in trunk: test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2009-02-12 09:27:41 -0500 (Thu, 12 Feb 2009)
New Revision: 12641
Modified:
trunk/framework/impl/src/main/java/org/richfaces/component/UISwitchablePanel.java
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/RichPanelTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/togglePanel/togglePanelTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TogglePanelTest.java
trunk/ui/togglePanel/src/main/java/org/richfaces/component/UITogglePanel.java
trunk/ui/togglePanel/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java
trunk/ui/togglePanel/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
Log:
TogglePanel: state facets are not switched inside data table
https://jira.jboss.org/jira/browse/RF-5828
Modified: trunk/framework/impl/src/main/java/org/richfaces/component/UISwitchablePanel.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/component/UISwitchablePanel.java 2009-02-12 14:11:26 UTC (rev 12640)
+++ trunk/framework/impl/src/main/java/org/richfaces/component/UISwitchablePanel.java 2009-02-12 14:27:41 UTC (rev 12641)
@@ -67,15 +67,14 @@
public String getSwitchType() {
if (this.switchType != null) {
return switchType;
- }
+ }
ValueBinding switchTypeBinding = getValueBinding("switchType");
if (switchTypeBinding != null) {
return (String) switchTypeBinding.getValue(FacesContext.getCurrentInstance());
}
- //TODO use DEFAULT_METHOD
- return SERVER_METHOD;
+ return DEFAULT_METHOD;
}
public void setSwitchType(String switchType) {
@@ -103,7 +102,7 @@
if(facesEvent instanceof ActionEvent){
//TODO invoke action listener or remove it
- if(isImmediate()){
+ if (isImmediate()) {
FacesContext facesContext = FacesContext.getCurrentInstance();
facesContext.renderResponse();
}
@@ -119,7 +118,7 @@
Object oldValue = getValue();
if ((oldValue == null && newValue != null) ||
- (oldValue != null && !oldValue.equals(newValue))) {
+ (oldValue != null && !oldValue.equals(newValue))) {
queueEvent(new ValueChangeEvent(this, oldValue, newValue));
}
@@ -135,9 +134,7 @@
}
if (AjaxRendererUtils.isAjaxRequest(facesContext) && this.getSwitchType().equals(AJAX_METHOD)) {
- AjaxRendererUtils.addRegionByName(facesContext,
- this,
- this.getId());
+ AjaxRendererUtils.addRegionByName(facesContext, this, this.getId());
}
}
} else /* component should throw IllegalArgumentException for unknown events - RF-30 */ {
@@ -149,7 +146,7 @@
//no processing here
}
- protected Iterator getSwitchedFacetsAndChildren() {
+ protected Iterator<UIComponent> getSwitchedFacetsAndChildren() {
return getFacetsAndChildren();
}
@@ -163,9 +160,9 @@
}
// Process all facets and children of this component
- Iterator kids = getSwitchedFacetsAndChildren();
+ Iterator<UIComponent> kids = getSwitchedFacetsAndChildren();
while (kids.hasNext()) {
- UIComponent kid = (UIComponent) kids.next();
+ UIComponent kid = kids.next();
kid.processDecodes(context);
}
@@ -174,18 +171,6 @@
if (isImmediate()) {
validate(context);
-
-// if (!isValid()) {
-// context.renderResponse();
-// }
-
- //UISwitchablePanel has a special behavior
- //it stops processing after APPLY_REQUEST_VALUES phase
- //when immediate
-//
-// set context.renderResponse() in broadcast method if component is immediate
-// and ActionEvent is occured (RF-1032)
-// context.renderResponse();
}
} catch (RuntimeException e) {
context.renderResponse();
@@ -195,30 +180,30 @@
public void processUpdates(FacesContext context) {
if (context == null) {
- throw new NullPointerException("FacesContext is null!");
- }
-
- if (!isRendered()) {
- return ;
- }
-
- Iterator kids = getSwitchedFacetsAndChildren();
- while (kids.hasNext()) {
- UIComponent kid = (UIComponent) kids.next();
- kid.processUpdates(context);
- }
-
- try {
- updateModel(context);
-
- if (!isValid()) {
- context.renderResponse();
- }
-
- } catch (RuntimeException e) {
- context.renderResponse();
- throw e;
- }
+ throw new NullPointerException("FacesContext is null!");
+ }
+
+ if (!isRendered()) {
+ return;
+ }
+
+ Iterator<UIComponent> kids = getSwitchedFacetsAndChildren();
+ while (kids.hasNext()) {
+ UIComponent kid = kids.next();
+ kid.processUpdates(context);
+ }
+
+ try {
+ updateModel(context);
+
+ if (!isValid()) {
+ context.renderResponse();
+ }
+
+ } catch (RuntimeException e) {
+ context.renderResponse();
+ throw e;
+ }
}
public void processValidators(FacesContext context) {
@@ -230,7 +215,7 @@
return ;
}
- Iterator kids = getSwitchedFacetsAndChildren();
+ Iterator<UIComponent> kids = getSwitchedFacetsAndChildren();
while (kids.hasNext()) {
UIComponent kid = (UIComponent) kids.next();
kid.processValidators(context);
@@ -244,7 +229,6 @@
context.renderResponse();
}
}
-
} catch (RuntimeException e) {
context.renderResponse();
throw e;
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/RichPanelTestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/RichPanelTestBean.java 2009-02-12 14:11:26 UTC (rev 12640)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/RichPanelTestBean.java 2009-02-12 14:27:41 UTC (rev 12641)
@@ -24,6 +24,9 @@
import java.util.HashMap;
import java.util.Map;
+import javax.faces.application.FacesMessage;
+import javax.faces.application.FacesMessage.Severity;
+import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
public class RichPanelTestBean {
@@ -193,6 +196,8 @@
}
public void actionListener(ActionEvent event) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "a", "b"));
this.value = event.getComponent().getId();
}
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/togglePanel/togglePanelTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TogglePanelTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TogglePanelTest.java 2009-02-12 14:11:26 UTC (rev 12640)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TogglePanelTest.java 2009-02-12 14:27:41 UTC (rev 12641)
@@ -32,7 +32,6 @@
public void testTogglePanelComponentAjaxMode(Template template) {
renderPage(template, RESET_METHOD);
- //FIXME: https://jira.jboss.org/jira/browse/RF-5828
String parentId = getParentId() + "_form:";
String inputId = parentId + "_value";
@@ -46,6 +45,7 @@
String twoFacet = parentId + "ajax_state_two";
writeStatus("Check ajax mode");
+
writeStatus("Click on ajax controlNext");
clickAjaxCommandAndWait(controlNext);
AssertValueEquals(inputId, "ajax_next");
@@ -72,7 +72,6 @@
public void testTogglePanelComponentServerMode(Template template) {
renderPage(template, RESET_METHOD);
- //FIXME: https://jira.jboss.org/jira/browse/RF-5828
String parentId = getParentId() + "_form:";
String inputId = parentId + "_value";
Modified: trunk/ui/togglePanel/src/main/java/org/richfaces/component/UITogglePanel.java
===================================================================
--- trunk/ui/togglePanel/src/main/java/org/richfaces/component/UITogglePanel.java 2009-02-12 14:11:26 UTC (rev 12640)
+++ trunk/ui/togglePanel/src/main/java/org/richfaces/component/UITogglePanel.java 2009-02-12 14:27:41 UTC (rev 12641)
@@ -54,13 +54,13 @@
public abstract String getSwitchType();
public abstract void setSwitchType(String switchType);
- public Object convertSwitchValue(UIComponent component, Object object) {
- if (component instanceof UIToggleControl) {
- UIToggleControl toggleControl = (UIToggleControl) component;
+ public Object convertSwitchValue(UIComponent toggleControlComponent, Object object) {
+ if (toggleControlComponent instanceof UIToggleControl) {
+ UIToggleControl toggleControl = (UIToggleControl) toggleControlComponent;
String stateName = toggleControl.getSwitchToState();
- List stateOrderList = getStateOrderList();
+ List<String> stateOrderList = getStateOrderList();
if (stateName != null) {
return stateName;
@@ -75,21 +75,19 @@
} else {
return stateOrderList.get(++currentIdx);
}
- }
- else{
+ } else {
return stateOrderList.get(0);
}
-
}
} else {
- return super.convertSwitchValue(component, object);
+ return super.convertSwitchValue(toggleControlComponent, object);
}
}
- public List getStateOrderList() {
- List list = new ArrayList();
+ public List<String> getStateOrderList() {
+ List<String> list = new ArrayList<String>();
String order = getStateOrder();
- if(order!=null) {
+ if (order != null) {
StringTokenizer st = new StringTokenizer(order, ";,", false);
while(st.hasMoreTokens()) {
String name = st.nextToken().trim();
Modified: trunk/ui/togglePanel/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java
===================================================================
--- trunk/ui/togglePanel/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java 2009-02-12 14:11:26 UTC (rev 12640)
+++ trunk/ui/togglePanel/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java 2009-02-12 14:27:41 UTC (rev 12641)
@@ -24,6 +24,7 @@
*/
package org.richfaces.renderkit.html;
+import java.io.IOException;
import java.util.Map;
import javax.faces.component.UIComponent;
@@ -35,11 +36,9 @@
import org.ajax4jsf.event.AjaxEvent;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
-import org.ajax4jsf.renderkit.RendererUtils;
import org.richfaces.component.UIToggleControl;
import org.richfaces.component.UITogglePanel;
import org.richfaces.event.SwitchablePanelSwitchEvent;
-import java.io.IOException;
/**
* @author igels
@@ -53,7 +52,7 @@
/* (non-Javadoc)
* @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
*/
- protected Class getComponentClass() {
+ protected Class<? extends UIComponent> getComponentClass() {
return UIToggleControl.class;
}
@@ -69,9 +68,9 @@
public void doDecode(FacesContext context, UIComponent component) {
super.doDecode(context, component);
ExternalContext exCtx = context.getExternalContext();
- Map rqMap = exCtx.getRequestParameterMap();
+ Map<String, String> rqMap = exCtx.getRequestParameterMap();
Object clnId = rqMap.get(component.getClientId(context));
- if(clnId!=null) {
+ if (clnId != null) {
// enqueue event here for this component or for component with Id
// taken fro forId attribute
UIToggleControl control = (UIToggleControl)component;
@@ -80,17 +79,10 @@
new SwitchablePanelSwitchEvent(panel, null, control).queue();
-// ToggleEvent event = new ToggleEvent(panel, control.getSwitchToState());
-// if (control.isImmediate()) {
-// event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
-// } else {
-// event.setPhaseId(PhaseId.INVOKE_APPLICATION);
-// }
-// event.queue();
-
if(UITogglePanel.AJAX_METHOD.equals(panel.getSwitchType())) {
new AjaxEvent(component).queue();
}
+
ActionEvent actionEvent = new ActionEvent(component);
component.queueEvent(actionEvent);
}
Modified: trunk/ui/togglePanel/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
===================================================================
--- trunk/ui/togglePanel/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2009-02-12 14:11:26 UTC (rev 12640)
+++ trunk/ui/togglePanel/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2009-02-12 14:27:41 UTC (rev 12641)
@@ -32,7 +32,6 @@
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
-import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
@@ -49,19 +48,18 @@
/* (non-Javadoc)
* @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
*/
- protected Class getComponentClass() {
+ protected Class<? extends UIComponent> getComponentClass() {
return UITogglePanel.class;
}
public void doDecode(FacesContext context, UIComponent component) {
super.doDecode(context, component);
- ExternalContext exCtx = context.getExternalContext();
- Map rqMap = exCtx.getRequestParameterMap();
+ Map<String, String> rqMap = context.getExternalContext().getRequestParameterMap();
Object clnId = rqMap.get(component.getClientId(context));
UITogglePanel panel = (UITogglePanel)component;
- if (clnId!=null) {
+ if (clnId != null) {
if (UITogglePanel.CLIENT_METHOD.equals(panel.getSwitchType())) {
- new SwitchablePanelSwitchEvent(panel, (String) clnId, null).queue();
+ new SwitchablePanelSwitchEvent(panel, clnId, null).queue();
}
}
}
@@ -79,11 +77,11 @@
//xxx by nick - denis - do not catch exception, rethrow them
public void handleFacets(FacesContext context, UITogglePanel component) throws IOException {
UITogglePanel panel = (UITogglePanel)component;
- List stateOrderList = component.getStateOrderList();
+ List<String> stateOrderList = component.getStateOrderList();
String state = (String) component.getValue();
if (state == null) {
String initialState = component.getInitialState();
- if(initialState != null) {
+ if (initialState != null) {
state = initialState;
} else {
if (!stateOrderList.isEmpty()) {
@@ -91,18 +89,18 @@
} else {
throw new FacesException("The \"initialState\" attribute of the togglePanel component should be set if \"stateOrder\" attribute is empty!");
}
- }
+ }
}
ResponseWriter out = context.getResponseWriter();
String switchType = panel.getSwitchType();
- if(UITogglePanel.CLIENT_METHOD.equals(switchType)) {
+ if (UITogglePanel.CLIENT_METHOD.equals(switchType)) {
// Client
String panelId = panel.getClientId(context);
StringBuffer divIds = new StringBuffer();
boolean first = true;
- for (Iterator iterator = stateOrderList.iterator(); iterator.hasNext();) {
+ for (Iterator<String> iterator = stateOrderList.iterator(); iterator.hasNext();) {
String stateName = (String) iterator.next();
UIComponent child = getFacet(component, stateName);
@@ -132,7 +130,9 @@
out.endElement("input");
out.endElement("div");
- String script = MessageFormat.format(CLIENT_SCRIPT, new Object[]{panelId, divIds.toString(), state});
+
+ String script = MessageFormat.format(CLIENT_SCRIPT,
+ panelId, divIds.toString(), state);
out.write(script);
// } else if(UITogglePanel.AJAX_METHOD.equals(switchType)) {
15 years, 3 months
JBoss Rich Faces SVN: r12640 - trunk/sandbox/samples/maven-rd-plugin-sample.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-02-12 09:11:26 -0500 (Thu, 12 Feb 2009)
New Revision: 12640
Modified:
trunk/sandbox/samples/maven-rd-plugin-sample/pom.xml
Log:
use RD plugin from main build
Modified: trunk/sandbox/samples/maven-rd-plugin-sample/pom.xml
===================================================================
--- trunk/sandbox/samples/maven-rd-plugin-sample/pom.xml 2009-02-12 14:10:49 UTC (rev 12639)
+++ trunk/sandbox/samples/maven-rd-plugin-sample/pom.xml 2009-02-12 14:11:26 UTC (rev 12640)
@@ -22,34 +22,34 @@
</plugin>
<plugin>
<artifactId>maven-resource-dependency-plugin</artifactId>
- <groupId>org.richfaces.cdk.sandbox</groupId>
+ <groupId>org.richfaces.cdk</groupId>
<version>3.3.1-SNAPSHOT</version>
- <configuration>
+ <configuration>
<webSourceDirectory>${basedir}/src/main/webapp</webSourceDirectory>
-
+
<beforeScriptIncludes>
- <beforeScriptInclude>foo/scripts/before.js</beforeScriptInclude>
- <beforeScriptInclude>scripts/test/test.js</beforeScriptInclude>
+ <beforeScriptInclude>foo/scripts/before.js</beforeScriptInclude>
+ <beforeScriptInclude>scripts/test/test.js</beforeScriptInclude>
</beforeScriptIncludes>
-
+
<afterScriptIncludes>
<afterScriptInclude>foo/scripts/after.js</afterScriptInclude>
- </afterScriptIncludes>
-
- <beforeStyleIncludes>
- <beforeStyleInclude>foo/styles/before.xcss</beforeStyleInclude>
- <beforeStyleInclude>foo/styles/before.css</beforeStyleInclude>
- </beforeStyleIncludes>
-
- <afterStyleIncludes>
- <afterStyleInclude>foo/styles/after.xcss</afterStyleInclude>
- <afterStyleInclude>foo/styles/after.css</afterStyleInclude>
- </afterStyleIncludes>
-
- <namespaceExcludes>
- <namespaceExclude>http://richfaces.org/a4j</namespaceExclude>
- </namespaceExcludes>
+ </afterScriptIncludes>
+ <beforeStyleIncludes>
+ <beforeStyleInclude>foo/styles/before.xcss</beforeStyleInclude>
+ <beforeStyleInclude>foo/styles/before.css</beforeStyleInclude>
+ </beforeStyleIncludes>
+
+ <afterStyleIncludes>
+ <afterStyleInclude>foo/styles/after.xcss</afterStyleInclude>
+ <afterStyleInclude>foo/styles/after.css</afterStyleInclude>
+ </afterStyleIncludes>
+
+ <namespaceExcludes>
+ <namespaceExclude>http://richfaces.org/a4j</namespaceExclude>
+ </namespaceExcludes>
+
</configuration>
<executions>
<execution>
15 years, 3 months
JBoss Rich Faces SVN: r12639 - trunk/cdk/maven-resource-dependency-plugin.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-02-12 09:10:49 -0500 (Thu, 12 Feb 2009)
New Revision: 12639
Modified:
trunk/cdk/maven-resource-dependency-plugin/pom.xml
Log:
remove useless dependencies
Modified: trunk/cdk/maven-resource-dependency-plugin/pom.xml
===================================================================
--- trunk/cdk/maven-resource-dependency-plugin/pom.xml 2009-02-12 13:41:14 UTC (rev 12638)
+++ trunk/cdk/maven-resource-dependency-plugin/pom.xml 2009-02-12 14:10:49 UTC (rev 12639)
@@ -17,100 +17,30 @@
<dependencies>
-
+
<dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>2.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-project</artifactId>
- <version>2.0.4</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-plugin-testing-harness</artifactId>
- <version>1.0-beta-1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
- <dependency>
+
+ <dependency>
<groupId>commons-vfs</groupId>
<artifactId>commons-vfs</artifactId>
<version>1.0</version>
</dependency>
- <dependency>
- <groupId>commons-net</groupId>
- <artifactId>commons-net</artifactId>
- <version>1.4.1</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>3.1</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>jdom</groupId>
- <artifactId>jdom</artifactId>
- <version>1.0</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>2.0.2</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>com.jcraft</groupId>
- <artifactId>jsch</artifactId>
- <version>0.1.23</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- <version>1.0.b2</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>oro</groupId>
- <artifactId>oro</artifactId>
- <version>2.0.8</version>
- <optional>true</optional>
- </dependency>
- <dependency>
+
+ <dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
<version>2.0</version>
</dependency>
+
<dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- <version>1.8.0</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-velocity</artifactId>
- <version>1.1.2</version>
- </dependency>
- <dependency>
- <groupId>org.richfaces.cdk</groupId>
- <artifactId>maven-cdk-plugin</artifactId>
- <version>3.3.1-SNAPSHOT</version>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <version>3.3.1-SNAPSHOT</version>
</dependency>
</dependencies>
15 years, 3 months
JBoss Rich Faces SVN: r12638 - in trunk/samples/pickList-sample/src/main: webapp/WEB-INF and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-02-12 08:41:14 -0500 (Thu, 12 Feb 2009)
New Revision: 12638
Added:
trunk/samples/pickList-sample/src/main/java/org/richfaces/Animal.java
trunk/samples/pickList-sample/src/main/java/org/richfaces/CustomConverter.java
Modified:
trunk/samples/pickList-sample/src/main/java/org/richfaces/Bean.java
trunk/samples/pickList-sample/src/main/webapp/WEB-INF/faces-config.xml
trunk/samples/pickList-sample/src/main/webapp/pages/index.jsp
Log:
extend demo
Added: trunk/samples/pickList-sample/src/main/java/org/richfaces/Animal.java
===================================================================
--- trunk/samples/pickList-sample/src/main/java/org/richfaces/Animal.java (rev 0)
+++ trunk/samples/pickList-sample/src/main/java/org/richfaces/Animal.java 2009-02-12 13:41:14 UTC (rev 12638)
@@ -0,0 +1,17 @@
+package org.richfaces;
+
+public class Animal {
+
+ String name;
+
+ public Animal(String name) {
+ this.name = name;
+ }
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Modified: trunk/samples/pickList-sample/src/main/java/org/richfaces/Bean.java
===================================================================
--- trunk/samples/pickList-sample/src/main/java/org/richfaces/Bean.java 2009-02-12 13:38:38 UTC (rev 12637)
+++ trunk/samples/pickList-sample/src/main/java/org/richfaces/Bean.java 2009-02-12 13:41:14 UTC (rev 12638)
@@ -1,15 +1,17 @@
package org.richfaces;
import java.util.ArrayList;
-import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
+import javax.faces.model.SelectItemGroup;
public class Bean {
-private ArrayList<SelectItem> testList = new ArrayList<SelectItem>();
+ private List <SelectItem> testList = new ArrayList<SelectItem>();
private String selectedInfo;
private String targetListWidth="140px";
@@ -20,17 +22,56 @@
private String removeLabel = null;
private String removeAllLabel = null;
-// private String [] values = new String[]{"polecat","suricate"};
- private List <String> listValues = new ArrayList<String>();
+ private List <Animal> listValues = new ArrayList<Animal>();
+
+// private List <String> listValues = new ArrayList<String>();
+
+// private Animal[] arrayValues = new Animal[7];
+
+ private Map <String,Animal> store = new HashMap<String,Animal>();
+
public Bean() {
- testList.add(new SelectItem("polecat", "polecat"));
- testList.add(new SelectItem("suricate", "suricate"));
- testList.add(new SelectItem("marshotter", "marshotter"));
+
+// testList.add(new SelectItem("polecat"));
+// testList.add(new SelectItem("suricate"));
+// testList.add(new SelectItem("marshotter"));
+// testList.add(new SelectItem("dog"));
+// testList.add(new SelectItem("cat"));
+// testList.add(new SelectItem("bear"));
+// testList.add(new SelectItem("wolf"));
+//
+// listValues.add("polecat");
+
+
+ store.put("polecat", new Animal("polecat"));
+ store.put("suricate", new Animal("suricate"));
+ store.put("marshotter", new Animal("marshotter"));
+ store.put("dog", new Animal("dog"));
+ store.put("cat", new Animal("cat"));
+ store.put("bear", new Animal("bear"));
+ store.put("wolf", new Animal("wolf"));
+
+ testList.add(new SelectItem(store.get("polecat"),"polecat"));
+ testList.add(new SelectItem(store.get("suricate"), "suricate"));
+ testList.add(new SelectItem(store.get("marshotter"), "marshotter"));
+ testList.add(new SelectItem(store.get("dog"), "dog"));
+ testList.add(new SelectItem(store.get("cat"), "cat"));
- listValues.add("polecat");
- listValues.add("suricate");
+ SelectItem [] items = new SelectItem[2];
+ items[0] = new SelectItem(store.get("bear"), "bear");
+ items[1] = new SelectItem(store.get("wolf"), "wolf");
+ SelectItemGroup group = new SelectItemGroup();
+ group.setSelectItems(items);
+ testList.add(group);
+
+ listValues.add(store.get("suricate"));
+ listValues.add(store.get("marshotter"));
+//
+// arrayValues[0] = store.get("suricate");
+// arrayValues[1] = store.get("marshotter");
+
}
public void selectionChanged(ValueChangeEvent evt) {
@@ -40,8 +81,8 @@
if (newValue instanceof List) {
List list = (List)newValue;
selectedValues = list.toArray();
- } else if (newValue instanceof String[] ) {
- selectedValues = (String[]) evt.getNewValue();
+ } else if (newValue instanceof Object[] ) {
+ selectedValues = (Object[]) evt.getNewValue();
}
if (selectedValues.length == 0) {
@@ -52,13 +93,14 @@
if (i > 0) {
sb.append(", ");
}
+
sb.append(selectedValues[i]);
}
selectedInfo = sb.toString();
}
}
- public ArrayList getTestList() {
+ public List <SelectItem> getTestList() {
return testList;
}
@@ -90,7 +132,7 @@
this.listsHeight = listsHeight;
}
- public void setTestList(ArrayList testList) {
+ public void setTestList(List <SelectItem> testList) {
this.testList = testList;
}
//
@@ -134,11 +176,11 @@
this.removeAllLabel = removeAllLabel;
}
- public List <String> getListValues() {
+ public List <Animal> getListValues() {
return listValues;
}
- public void setListValues(List<String> listValues) {
+ public void setListValues(List<Animal> listValues) {
this.listValues = listValues;
}
@@ -146,4 +188,30 @@
this.selectedInfo = selectedInfo;
}
+ public Map<String, Animal> getStore() {
+ return store;
+ }
+
+ public void setStore(Map<String, Animal> store) {
+ this.store = store;
+ }
+
+// public List<String> getListValues() {
+// return listValues;
+// }
+//
+// public void setListValues(List<String> listValues) {
+// this.listValues = listValues;
+// }
+
+
+
+// public Animal[] getArrayValues() {
+// return arrayValues;
+// }
+//
+// public void setArrayValues(Animal[] arrayValues) {
+// this.arrayValues = arrayValues;
+// }
+
}
\ No newline at end of file
Added: trunk/samples/pickList-sample/src/main/java/org/richfaces/CustomConverter.java
===================================================================
--- trunk/samples/pickList-sample/src/main/java/org/richfaces/CustomConverter.java (rev 0)
+++ trunk/samples/pickList-sample/src/main/java/org/richfaces/CustomConverter.java 2009-02-12 13:41:14 UTC (rev 12638)
@@ -0,0 +1,22 @@
+package org.richfaces;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+
+public class CustomConverter implements Converter {
+
+ public Object getAsObject(FacesContext context, UIComponent component, String value) {
+ Bean bean = (Bean)context.getExternalContext().getSessionMap().get("pickBean");
+ return bean.getStore().get(value);
+ }
+
+ public String getAsString(FacesContext context, UIComponent component, Object value) {
+ if(value != null) {
+ return ((Animal)value).getName();
+ } else {
+ return "";
+ }
+ }
+
+}
Modified: trunk/samples/pickList-sample/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/samples/pickList-sample/src/main/webapp/WEB-INF/faces-config.xml 2009-02-12 13:38:38 UTC (rev 12637)
+++ trunk/samples/pickList-sample/src/main/webapp/WEB-INF/faces-config.xml 2009-02-12 13:41:14 UTC (rev 12638)
@@ -12,12 +12,11 @@
<managed-bean-class>org.richfaces.SkinBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
- <application>
- <locale-config>
- <default-locale>en</default-locale>
- <supported-locale>ru</supported-locale>
- </locale-config>
- <message-bundle>localization</message-bundle>
- </application>
-
+
+ <converter>
+ <converter-for-class>org.richfaces.Animal</converter-for-class>
+ <!-- <converter-id>converterId</converter-id> -->
+ <converter-class>org.richfaces.CustomConverter</converter-class>
+ </converter>
+
</faces-config>
Modified: trunk/samples/pickList-sample/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/samples/pickList-sample/src/main/webapp/pages/index.jsp 2009-02-12 13:38:38 UTC (rev 12637)
+++ trunk/samples/pickList-sample/src/main/webapp/pages/index.jsp 2009-02-12 13:41:14 UTC (rev 12638)
@@ -59,13 +59,12 @@
removeControlLabel = "#{pickBean.removeLabel}"
removeAllControlLabel ="#{pickBean.removeAllLabel}"
value="#{pickBean.listValues}"
- onlistchange="return false;"
- showButtonsLabel="true">
- <f:selectItem itemValue="cat" itemLabel="cat"/>
- <f:selectItem itemValue="dog" itemLabel="dog"/>
+ showButtonsLabel="true"
+ >
<f:selectItems value="#{pickBean.testList}"/>
- </pickList:pickList>
+ </pickList:pickList>
+
<h:commandButton value="Submit" action="none"/>
</h:form>
<h:outputText value="#{pickBean.selectedInfo}"/>
15 years, 3 months
JBoss Rich Faces SVN: r12637 - in trunk/ui/pickList/src/main/java/org/richfaces: component and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-02-12 08:38:38 -0500 (Thu, 12 Feb 2009)
New Revision: 12637
Removed:
trunk/ui/pickList/src/main/java/org/richfaces/utils/
Modified:
trunk/ui/pickList/src/main/java/org/richfaces/component/UIPickList.java
trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListControlsHelper.java
trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
Log:
https://jira.jboss.org/jira/browse/RF-6137, https://jira.jboss.org/jira/browse/RF-6136
Modified: trunk/ui/pickList/src/main/java/org/richfaces/component/UIPickList.java
===================================================================
--- trunk/ui/pickList/src/main/java/org/richfaces/component/UIPickList.java 2009-02-12 13:14:38 UTC (rev 12636)
+++ trunk/ui/pickList/src/main/java/org/richfaces/component/UIPickList.java 2009-02-12 13:38:38 UTC (rev 12637)
@@ -20,25 +20,18 @@
*/
package org.richfaces.component;
+import javax.el.ValueExpression;
+import javax.faces.application.Application;
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
import javax.faces.component.UISelectMany;
import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
-public abstract class UIPickList extends UISelectMany{
- private String listClass;
- private String controlClass;
- private String moveControlsVerticalAlign;
+import org.ajax4jsf.util.ELUtils;
+
+public abstract class UIPickList extends UISelectMany {
- public abstract String getMoveControlsVerticalAlign();
- public abstract void setMoveControlsVerticalAlign(String moveControlsVerticalAlign);
-
- public abstract int getSize();
- public abstract void setSize(int size);
-
- public abstract boolean isDisabled();
- public abstract void setDisabled(boolean disabled);
-
/**
* Get base clietntId of this component ( withowt iteration part )
*
@@ -70,6 +63,59 @@
return (_baseClientId);
}
+
+
+ @Override
+ public Converter getConverter() {
+
+ Converter converter = super.getConverter();
+ if(converter == null) {
+ converter = getConverterForValue(FacesContext.getCurrentInstance());
+ }
+
+ return converter;
+ }
+
+ private Converter getConverterForType(FacesContext context, Class <?> type) {
+
+ if (!Object.class.equals(type) && type != null) {
+ Application application = context.getApplication();
+ return application.createConverter(type);
+ }
+
+ return null;
+ }
+
+ private static final Converter noOpConverter = new Converter() {
+
+ public Object getAsObject(FacesContext context, UIComponent component,
+ String value) {
+ return value;
+ }
+
+ public String getAsString(FacesContext context, UIComponent component,
+ Object value) {
+ return (String) value;
+ }
+
+ };
+
+ public Converter getConverterForValue(FacesContext context) {
+ Converter converter = null;
+ ValueExpression expression = this.getValueExpression("value");
+
+ if (expression != null) {
+ Class<?> containerClass = ELUtils.getContainerClass(context, expression);
+
+ converter = getConverterForType(context, containerClass);
+ if (converter == null && String.class.equals(containerClass)) {
+ converter = noOpConverter;
+ }
+ }
+
+ return converter;
+ }
+
private String _baseClientId = null;
public abstract String getControlClass();
@@ -78,4 +124,13 @@
public abstract String getListClass();
public abstract void setListClass(String listClass);
+ public abstract String getMoveControlsVerticalAlign();
+ public abstract void setMoveControlsVerticalAlign(String moveControlsVerticalAlign);
+
+ public abstract int getSize();
+ public abstract void setSize(int size);
+
+ public abstract boolean isDisabled();
+ public abstract void setDisabled(boolean disabled);
+
}
Modified: trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListControlsHelper.java
===================================================================
--- trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListControlsHelper.java 2009-02-12 13:14:38 UTC (rev 12636)
+++ trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListControlsHelper.java 2009-02-12 13:38:38 UTC (rev 12637)
@@ -40,13 +40,21 @@
public class PickListControlsHelper extends ListShuttleControlsHelper {
private static final String REMOVE_ALL_TITLE = "removeAllTitle";
+
private static final String REMOVE_TITLE = "removeTitle";
+
private static final String COPY_TITLE = "copyTitle";
+
private static final String COPY_ALL_TITLE = "copyAllTitle";
- public final static String BUNDLE_COPY_ALL_LABEL = "RICH_PICK_LIST_COPY_ALL_LABEL";
- public final static String BUNDLE_COPY_LABEL = "RICH_PICK_LIST_COPY_LABEL";
- public final static String BUNDLE_REMOVE_ALL_LABEL = "RICH_PICK_LIST_REMOVE_ALL_LABEL";
- public final static String BUNDLE_REMOVE_LABEL = "RICH_PICK_LIST_REMOVE_LABEL";
+
+ public static final String BUNDLE_COPY_ALL_LABEL = "RICH_PICK_LIST_COPY_ALL_LABEL";
+
+ public static final String BUNDLE_COPY_LABEL = "RICH_PICK_LIST_COPY_LABEL";
+
+ public static final String BUNDLE_REMOVE_ALL_LABEL = "RICH_PICK_LIST_REMOVE_ALL_LABEL";
+
+ public static final String BUNDLE_REMOVE_LABEL = "RICH_PICK_LIST_REMOVE_LABEL";
+
private final static String FACET_COPY_ALL = "copyAllControl";
private final static String FACET_REMOVE_ALL = "removeAllControl";
Modified: trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
===================================================================
--- trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java 2009-02-12 13:14:38 UTC (rev 12636)
+++ trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java 2009-02-12 13:38:38 UTC (rev 12637)
@@ -21,9 +21,9 @@
package org.richfaces.renderkit;
import java.io.IOException;
+import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
@@ -34,8 +34,6 @@
import javax.faces.component.EditableValueHolder;
import javax.faces.component.UIComponent;
-import javax.faces.component.UISelectMany;
-import javax.faces.component.UISelectOne;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
@@ -52,478 +50,661 @@
import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.util.SelectUtils;
-import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.richfaces.component.UIPickList;
import org.richfaces.component.util.HtmlUtil;
-import org.richfaces.utils.PickListUtils;
public class PickListRenderer extends HeaderResourcesRendererBase {
- private static final String HIDDEN_SUFFIX = "valueKeeper";
- private static Log logger = LogFactory.getLog(PickListRenderer.class);
- protected static final OrderingComponentRendererBase.ControlsHelper[] SHUTTLE_HELPERS = PickListControlsHelper.HELPERS;
- protected final static String SHOW_LABELS_ATTRIBUTE_NAME = "showButtonsLabel";
+ private static Log logger = LogFactory.getLog(PickListRenderer.class);
+
+ private static final String HIDDEN_SUFFIX = "valueKeeper";
+
private static final String MESSAGE_BUNDLE_NAME = PickListRenderer.class.getPackage().getName() + ".pickList";
+
+ private static final String SHOW_LABELS_ATTRIBUTE_NAME = "showButtonsLabel";
+
+ private static final OrderingComponentRendererBase.ControlsHelper[] SHUTTLE_HELPERS = PickListControlsHelper.HELPERS;
+
private boolean isSelectedList;
+
private boolean isAvailableList;
+
+
+ protected List<SelectItem> selectItemsForSelectedList(FacesContext facesContext, UIComponent uiComponent, List<SelectItem> selectItemList, List<Object> lookupList) {
+
+ List<SelectItem> selectItemForSelectedValues = new ArrayList<SelectItem>();
+
+ for (Object lookupItem: lookupList) {
+
+ for (SelectItem selectItem: selectItemList) {
+
+ if(selectItem instanceof SelectItemGroup) {
- protected List<SelectItem> selectItemsForSelectedList(FacesContext facesContext, UIComponent uiComponent, List<SelectItem> selectItemList,
- Converter converter, List<SelectItem> lookupList) {
- List<SelectItem> selectItemForSelectedValues = new ArrayList<SelectItem>();
+ SelectItem[] items = ((SelectItemGroup) selectItem).getSelectItems();
+ for (int j = 0; j < items.length; j++) {
+ if(lookupItem.equals(items[j].getValue())) {
+ selectItemForSelectedValues.add(items[j]);
+ }
+ }
+
+ } else {
+
+ if (lookupItem.equals(selectItem.getValue())) {
+ selectItemForSelectedValues.add(selectItem);
+ }
+
+ }
+
+ }
+
+ }
+
+ return selectItemForSelectedValues;
+ }
+
+ protected List<Object> getValuesList(UIPickList pickList) {
+
+ List <Object> valuesList = new ArrayList<Object>();
+
+ Object value = pickList.getValue();
- for (Iterator<SelectItem> i2 = lookupList.iterator(); i2.hasNext();) {
- Object value = i2.next();
- for (Iterator<SelectItem> i = selectItemList.iterator(); i.hasNext();) {
- SelectItem selectItem = i.next();
- String itemStrValue = PickListUtils.getConvertedStringValue(facesContext, uiComponent, converter, selectItem.getValue());
- if (value.equals(itemStrValue)) {
- selectItemForSelectedValues.add(selectItem);
+ if(null == value || "".equals(value)) {
+ return valuesList;
+ }
+
+ if(value.getClass().isArray()) {
+ int len = Array.getLength(value);
+
+ for (int i = 0; i < len; i++) {
+
+ Object localValue = Array.get(value, i);
+ if(localValue != null) {
+ valuesList.add(localValue);
+ }
+
+ }
+
+ return valuesList;
+ } else if(value instanceof List) {
+ List <?> list = (List<?>) value;
+
+ for (Object item: list) {
+ valuesList.add(item);
+ }
+
+ return valuesList;
+
+ } else {
+ throw new IllegalArgumentException("Error: value of UIPickList component is not of type Array or List");
}
- }
- }
- return selectItemForSelectedValues;
+
}
- protected List selectItemsForAvailableList(FacesContext facesContext, UIComponent uiComponent, List<SelectItem> selectItemList,
- List<SelectItem> selectItemsForSelectedList, Converter converter) {
- Collection collection = CollectionUtils.subtract(selectItemList, selectItemsForSelectedList);
- return new ArrayList<SelectItem>(collection);
+ protected List <SelectItem> selectItemsForAvailableList(FacesContext facesContext, UIComponent uiComponent, List<SelectItem> selectItemList,
+ List<SelectItem> selectItemsForSelectedList) {
+
+ List <SelectItem> processItems = new ArrayList<SelectItem>();
+
+ for(SelectItem item: selectItemList) {
+
+ if(item instanceof SelectItemGroup) {
+
+ SelectItem items[] = ((SelectItemGroup)item).getSelectItems();
+ for (int i = 0; i < items.length; i++) {
+ processItems.add(items[i]);
+ }
+
+ } else {
+ processItems.add(item);
+ }
+
+ }
+
+ for (SelectItem selectItem: selectItemsForSelectedList) {
+ processItems.remove(selectItem);
+ }
+
+ return processItems;
+
}
- protected List getSelectItemsList(FacesContext context, UIComponent component) {
- return SelectUtils.getSelectItems(context, component);
+ protected List <SelectItem> getSelectItemsList(FacesContext context, UIComponent component) {
+ return SelectUtils.getSelectItems(context, component);
}
public PickListRenderer() {
- super();
+ super();
}
public void decode(FacesContext context, UIComponent component) {
- UIPickList picklist = (UIPickList) component;
- if (!(picklist instanceof EditableValueHolder)) {
- throw new IllegalArgumentException("Component " + picklist.getClientId(context) + " is not an EditableValueHolder");
- }
+ UIPickList picklist = (UIPickList) component;
+ if (!(picklist instanceof EditableValueHolder)) {
+ throw new IllegalArgumentException("Component " + picklist.getClientId(context) + " is not an EditableValueHolder");
+ }
+
+ String hiddenClientId = picklist.getClientId(context) + HIDDEN_SUFFIX;
+ Map <String, String[]> paramValuesMap = context.getExternalContext().getRequestParameterValuesMap();
+
+ if (picklist.isDisabled()) {
+ return;
+ }
+
+ if (paramValuesMap.containsKey(hiddenClientId)) {
+
+ String[] valuesInline = (String[]) paramValuesMap.get(hiddenClientId);
- String hiddenClientId = picklist.getClientId(context) + HIDDEN_SUFFIX;
- Map paramValuesMap = context.getExternalContext().getRequestParameterValuesMap();
-
- if (picklist.isDisabled()) {
- return;
- }
-
- if (paramValuesMap.containsKey(hiddenClientId)) {
- String[] valuesInline = (String[]) paramValuesMap.get(hiddenClientId);
- if (valuesInline[0].trim().equals("")) {
- ((EditableValueHolder) picklist).setSubmittedValue(new String[] {});
- } else {
- String[] reqValues = valuesInline[0].split(",");
- ((EditableValueHolder) picklist).setSubmittedValue(reqValues);
- }
- } else {
- ((EditableValueHolder) picklist).setSubmittedValue(new String[] {});
- }
+ if (valuesInline[0].trim().equals("")) {
+
+ ((EditableValueHolder) picklist).setSubmittedValue(new String[] {});
+
+ } else {
+ String[] reqValues = valuesInline[0].split(",");
+ ((EditableValueHolder) picklist).setSubmittedValue(reqValues);
+ }
+
+ } else {
+ ((EditableValueHolder) picklist).setSubmittedValue(new String[] {});
+ }
+
}
private static boolean isTrue(Object obj) {
- if (!(obj instanceof Boolean)) {
- return false;
- }
- return ((Boolean) obj).booleanValue();
+
+ if (!(obj instanceof Boolean)) {
+ return false;
+ }
+
+ return ((Boolean) obj).booleanValue();
+
}
@Override
public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException {
-
- if ((component instanceof UISelectMany) && (submittedValue instanceof String[])) {
- return SelectUtils.getConvertedUISelectManyValue(context, (UISelectMany) component, (String[]) submittedValue);
- } else if ((component instanceof UISelectOne) && (submittedValue instanceof String)) {
- return SelectUtils.getConvertedUIInputValue(context, (UISelectOne) component, (String) submittedValue);
- } else {
- throw new ConverterException("Unsupported component class " + component.getClass().getName());
- }
-
+
+ Object convertedValue = null;
+
+ if(component instanceof UIPickList) {
+ UIPickList pickList = (UIPickList)component;
+ convertedValue = SelectUtils.getConvertedUISelectManyValue(context, pickList, (String[]) submittedValue);
+ }
+
+ return convertedValue;
}
+
+ private void encodeRows(FacesContext context, UIPickList pickList, boolean source) throws IOException {
+
+ List <SelectItem> selectItemsList = SelectUtils.getSelectItems(context, pickList);
- private void encodeRows(FacesContext context, UIComponent component, boolean source) throws IOException {
- List selectItemsList = SelectUtils.getSelectItems(context, component);
-
- Converter converter = PickListUtils.findUISelectManyConverterFailsafe(context, component);
- List lookupList = PickListUtils.getValuesList(component, context, converter);
- List selectItemsForSelectedValues = selectItemsForSelectedList(context, component, selectItemsList, converter, lookupList);
- List selectItemsForAvailableList = selectItemsForAvailableList(context, component, selectItemsList, selectItemsForSelectedValues, converter);
- isSelectedList = !selectItemsForSelectedValues.isEmpty();
- isAvailableList = !selectItemsForAvailableList.isEmpty();
-
- List selectItemList = null;
- if (source) {
- selectItemList = selectItemsForAvailableList;
- } else {
- selectItemList = selectItemsForSelectedValues;
- }
-
- int i = 0;
- for (Iterator it = selectItemList.iterator(); it.hasNext();) {
- i++;
- SelectItem selectItem = (SelectItem) it.next();
- if (selectItem instanceof SelectItemGroup) {
- SelectItem[] items = ((SelectItemGroup) selectItem).getSelectItems();
- for (int j = 0; j < items.length; j++) {
- encodeItem(context, component, converter, items[i], source, "group:" + Integer.toString(j));
+ Converter converter = pickList.getConverter();
+
+ List <Object> values = getValuesList(pickList); // PickListUtils.getValuesList(context, pickList, converter);
+
+ List <SelectItem> selectItemsForSelectedValues = selectItemsForSelectedList(context, pickList, selectItemsList, values);
+ List <SelectItem> selectItemsForAvailableList = selectItemsForAvailableList(context, pickList, selectItemsList, selectItemsForSelectedValues);
+
+ isSelectedList = !selectItemsForSelectedValues.isEmpty();
+ isAvailableList = !selectItemsForAvailableList.isEmpty();
+
+ List <SelectItem> selectItemList = null;
+
+ if (source) {
+ selectItemList = selectItemsForAvailableList;
+ } else {
+ selectItemList = selectItemsForSelectedValues;
}
- } else {
- encodeItem(context, component, converter, selectItem, source, Integer.toString(i));
- }
- }
+
+ if(selectItemList != null) {
+
+ SelectItem [] itemsList = selectItemList.toArray(new SelectItem[selectItemList.size()]);
+
+ for (int i = 0; i < itemsList.length; i++) {
+
+ SelectItem selectItem = itemsList[i];
+
+ if (selectItem instanceof SelectItemGroup) {
+
+ SelectItem[] items = ((SelectItemGroup) selectItem).getSelectItems();
+ for (int j = 0; j < items.length; j++) {
+ encodeItem(context, pickList, converter, items[j], source, "group:" + j);
+ }
+
+ } else {
+
+ encodeItem(context, pickList, converter, selectItem, source, Integer.toString(i));
+
+ }
+
+ }
+
+ }
+
}
public void encodeItem(FacesContext context, UIComponent component, Converter converter, SelectItem selectItem, boolean source, String suff)
throws IOException {
- ResponseWriter writer = context.getResponseWriter();
- writer.startElement(HTML.TR_ELEMENT, component);
- String clientId = component.getClientId(context);
- if (source) {
- clientId += ":source:";
- }
- String id = clientId + ":" + suff;
- writer.writeAttribute("id", id, null);
+ ResponseWriter writer = context.getResponseWriter();
+ writer.startElement(HTML.TR_ELEMENT, component);
+
+ String clientId = component.getClientId(context);
+
+ if (source) {
+ clientId += ":source:";
+ }
+
+ String id = clientId + ":" + suff;
+
+ writer.writeAttribute("id", id, null);
- StringBuffer rowClassName = new StringBuffer();
- StringBuffer cellClassName = new StringBuffer();
- if (source) {
- rowClassName.append("rich-picklist-source-row");
- cellClassName.append("rich-picklist-source-cell");
- } else {
- rowClassName.append("rich-picklist-target-row");
- cellClassName.append("rich-picklist-target-cell");
- }
+ StringBuffer rowClassName = new StringBuffer();
+ StringBuffer cellClassName = new StringBuffer();
- writer.writeAttribute("class", rowClassName.toString(), null);
- writer.startElement(HTML.td_ELEM, component);
- Object width = component.getAttributes().get("width");
- writer.writeAttribute(HTML.class_ATTRIBUTE, cellClassName, null);
+ if (source) {
+
+ rowClassName.append("rich-picklist-source-row");
+ cellClassName.append("rich-picklist-source-cell");
+
+ } else {
+
+ rowClassName.append("rich-picklist-target-row");
+ cellClassName.append("rich-picklist-target-cell");
+
+ }
- if (width != null) {
- writer.writeAttribute("style", "width: " + HtmlUtil.qualifySize(width.toString()), null);
- }
+ writer.writeAttribute("class", rowClassName.toString(), null);
+ writer.startElement(HTML.td_ELEM, component);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, cellClassName, null);
+
+ Object width = component.getAttributes().get("width");
+ if (width != null) {
+ writer.writeAttribute("style", "width: " + HtmlUtil.qualifySize(width.toString()), null);
+ }
- encodeSpacer(context, component, writer);
+ encodeSpacer(context, component, writer);
- boolean escape = isTrue(component.getAttributes().get("escape"));
- if (escape) {
- writer.writeText(selectItem.getLabel(), null);
- } else {
- writer.write(selectItem.getLabel());
- }
+ boolean escape = isTrue(component.getAttributes().get("escape"));
+ if (escape) {
+ writer.writeText(selectItem.getLabel(), null);
+ } else {
+ writer.write(selectItem.getLabel());
+ }
+
+ String itemValue = converter != null ? converter.getAsString(context, component, selectItem.getValue()) : "";
+
+ encodeItemValue(context, component, writer, id, itemValue);
+
+ writer.endElement(HTML.td_ELEM);
+ writer.endElement(HTML.TR_ELEMENT);
- String itemValue = PickListUtils.getConvertedStringValue(context, component, converter, selectItem.getValue());
- encodeItemValue(context, component, writer, id, itemValue);
- writer.endElement(HTML.td_ELEM);
- writer.endElement(HTML.TR_ELEMENT);
-
}
- public void encodeTargetRows(FacesContext context, UIComponent component) throws IOException {
- encodeRows(context, component, false);
+ public void encodeTargetRows(FacesContext context, UIPickList pickList) throws IOException {
+ encodeRows(context, pickList, false);
}
- public void encodeSourceRows(FacesContext context, UIComponent component) throws IOException {
- encodeRows(context, component, true);
+ public void encodeSourceRows(FacesContext context, UIPickList pickList) throws IOException {
+ encodeRows(context, pickList, true);
}
private void encodeItemValue(FacesContext context, UIComponent component, ResponseWriter writer, String id, String itemValue) throws IOException { //rowKey = i
- writer.startElement(HTML.INPUT_ELEM, component);
- writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
- writer.writeAttribute(HTML.NAME_ATTRIBUTE, id, null);
+ writer.startElement(HTML.INPUT_ELEM, component);
+ writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
+ writer.writeAttribute(HTML.NAME_ATTRIBUTE, id, null);
- StringBuffer value = new StringBuffer();
+ StringBuffer value = new StringBuffer();
- value.append(itemValue);
- writer.writeAttribute(HTML.value_ATTRIBUTE, value.toString(), null);
- writer.writeAttribute(HTML.id_ATTRIBUTE, id + "StateInput", null);
- writer.endElement(HTML.INPUT_ELEM);
+ value.append(itemValue);
+
+ writer.writeAttribute(HTML.value_ATTRIBUTE, value.toString(), null);
+ writer.writeAttribute(HTML.id_ATTRIBUTE, id + "StateInput", null);
+ writer.endElement(HTML.INPUT_ELEM);
+
}
protected void encodeSpacer(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException {
- writer.startElement(HTML.IMG_ELEMENT, component);
- writer.writeAttribute(HTML.src_ATTRIBUTE, getResource("/org/richfaces/renderkit/html/images/spacer.gif").getUri(context, null), null);
- writer.writeAttribute(HTML.alt_ATTRIBUTE, " ", null);
- writer.writeAttribute(HTML.style_ATTRIBUTE, "width:1px;height:1px;", null);
- writer.endElement(HTML.IMG_ELEMENT);
+ writer.startElement(HTML.IMG_ELEMENT, component);
+
+ writer.writeAttribute(HTML.src_ATTRIBUTE, getResource("/org/richfaces/renderkit/html/images/spacer.gif").getUri(context, null), null);
+ writer.writeAttribute(HTML.alt_ATTRIBUTE, " ", null);
+ writer.writeAttribute(HTML.style_ATTRIBUTE, "width:1px;height:1px;", null);
+
+ writer.endElement(HTML.IMG_ELEMENT);
}
- public void encodeHiddenField(FacesContext context, UIComponent component) throws IOException {
- ResponseWriter writer = context.getResponseWriter();
- Converter converter = PickListUtils.findUISelectManyConverterFailsafe(context, component);
- List lookupList = PickListUtils.getValuesList(component, context, converter);
- encodeHiddenField(context, component, lookupList, writer);
+ public void encodeHiddenField(FacesContext context, UIPickList pickList) throws IOException {
+
+ Converter converter = pickList.getConverter();
+ List <String> lookupList = new ArrayList<String>();
+
+ if(converter != null) {
+ List <Object> values = getValuesList(pickList);
+ for(Object value: values) {
+ lookupList.add(converter.getAsString(context, pickList, value));
+ }
+ }
+
+ encodeHiddenField(context, pickList, lookupList);
+
}
- private void encodeHiddenField(FacesContext context, UIComponent component, List lookupList, ResponseWriter writer) throws IOException {
- String hiddenFieldCliendId = component.getClientId(context) + HIDDEN_SUFFIX;
- writer.startElement(HTML.INPUT_ELEM, component);
- writer.writeAttribute(HTML.TYPE_ATTR, "hidden", "type");
- writer.writeAttribute(HTML.id_ATTRIBUTE, hiddenFieldCliendId, "id");
- writer.writeAttribute("name", hiddenFieldCliendId, null);
- StringBuffer sb = new StringBuffer();
- int n = 0;
+ private void encodeHiddenField(FacesContext context, UIComponent component, List <String> lookupList) throws IOException {
- for (Iterator i = lookupList.iterator(); i.hasNext();) {
- if (n > 0) {
- sb.append(",");
- }
- String value = (String) i.next();
- sb.append(value);
- n++;
- }
+ String hiddenFieldCliendId = component.getClientId(context) + HIDDEN_SUFFIX;
+
+ ResponseWriter writer = context.getResponseWriter();
- writer.writeAttribute(HTML.value_ATTRIBUTE, sb.toString(), null);
- writer.endElement(HTML.INPUT_ELEM);
+ writer.startElement(HTML.INPUT_ELEM, component);
+ writer.writeAttribute(HTML.TYPE_ATTR, "hidden", "type");
+ writer.writeAttribute(HTML.id_ATTRIBUTE, hiddenFieldCliendId, "id");
+ writer.writeAttribute("name", hiddenFieldCliendId, null);
+
+ StringBuffer sb = new StringBuffer();
+
+ int n = 0;
+
+ for (Iterator <String> i = lookupList.iterator(); i.hasNext();) {
+
+ if (n > 0) {
+ sb.append(",");
+ }
+
+ String value = i.next();
+ sb.append(value);
+ n++;
+
+ }
+
+ writer.writeAttribute(HTML.value_ATTRIBUTE, sb.toString(), null);
+ writer.endElement(HTML.INPUT_ELEM);
+
}
protected Class<? extends UIComponent> getComponentClass() {
- return UIPickList.class;
+ return UIPickList.class;
}
public String getAsEventHandler(FacesContext context, UIComponent component, String attributeName) {
- String event = (String) component.getAttributes().get(attributeName);
- ScriptString result = JSReference.NULL;
+
+ String event = (String) component.getAttributes().get(attributeName);
+ ScriptString result = JSReference.NULL;
- if (event != null) {
- event = event.trim();
- if (event.length() != 0) {
- JSFunctionDefinition function = new JSFunctionDefinition();
- function.addParameter("event");
- function.addToBody(event);
- result = function;
- }
- }
+ if (event != null) {
+
+ event = event.trim();
+
+ if (event.length() != 0) {
+
+ JSFunctionDefinition function = new JSFunctionDefinition();
+ function.addParameter("event");
+ function.addToBody(event);
+
+ result = function;
+ }
+
+ }
- return ScriptUtils.toScript(result);
+ return ScriptUtils.toScript(result);
+
}
public String getColumnClassesAsJSArray(FacesContext context, UIComponent component) {
- return ScriptUtils.toScript(getClassesAsList(context, component, "columnClasses"));
+ return ScriptUtils.toScript(getClassesAsList(context, component, "columnClasses"));
}
public String getRowClassesAsJSArray(FacesContext context, UIComponent component) {
- return ScriptUtils.toScript(getClassesAsList(context, component, "rowClasses"));
+ return ScriptUtils.toScript(getClassesAsList(context, component, "rowClasses"));
}
- protected List getClassesAsList(FacesContext context, UIComponent component, String attr) {
- String value = (String) ((UIComponent) component).getAttributes().get(attr);
- if (value != null && (value.length() != 0)) {
- return Arrays.asList(value.split(","));
- }
- return null;
+ protected List <String> getClassesAsList(FacesContext context, UIComponent component, String attr) {
+ String value = (String) ((UIComponent) component).getAttributes().get(attr);
+
+ if (value != null && (value.length() != 0)) {
+ return Arrays.asList(value.split(","));
+ }
+
+ return null;
}
public void encodePickListControlsFacets(FacesContext context, UIComponent component) throws IOException {
- String clientId = component.getClientId(context);
- ResponseWriter writer = context.getResponseWriter();
- boolean enable = false;
+ String clientId = component.getClientId(context);
+ boolean enable = false;
+
+ ResponseWriter writer = context.getResponseWriter();
+
- for (int i = 0; i < SHUTTLE_HELPERS.length; i++) {
- OrderingComponentRendererBase.ControlsHelper helper = SHUTTLE_HELPERS[i];
- boolean isDisabled = helper.getButtonStyleClass().equals(PickListControlsHelper.DISABLED_STYLE_PREF);
- if (helper.getBundlePropertyName().equals(PickListControlsHelper.BUNDLE_REMOVE_ALL_LABEL)) {
- enable = isSelectedList;
- if(enable != isDisabled) {
- enable = true;
- } else {
- enable = false;
- }
- } else if (helper.getBundlePropertyName().equals(PickListControlsHelper.BUNDLE_COPY_ALL_LABEL)) {
- enable = isAvailableList;
- if(enable != isDisabled) {
- enable = true;
- } else {
- enable = false;
- }
- } else {
- if (helper.getButtonStyleClass().equals(PickListControlsHelper.DISABLED_STYLE_PREF)) {
- enable = true;
- } else {
- enable = false;
- }
- }
- encodeControlFacet(context, component, SHUTTLE_HELPERS[i], clientId, writer, enable, "rich-list-picklist-button", " rich-picklist-control");
- }
+ for (int i = 0; i < SHUTTLE_HELPERS.length; i++) {
+
+ OrderingComponentRendererBase.ControlsHelper helper = SHUTTLE_HELPERS[i];
+
+ boolean isDisabled = helper.getButtonStyleClass().equals(PickListControlsHelper.DISABLED_STYLE_PREF);
+
+ if (helper.getBundlePropertyName().equals(PickListControlsHelper.BUNDLE_REMOVE_ALL_LABEL)) {
+
+ enable = isSelectedList;
+ enable = enable != isDisabled ? true : false;
+
+ } else if (helper.getBundlePropertyName().equals(PickListControlsHelper.BUNDLE_COPY_ALL_LABEL)) {
+
+ enable = isAvailableList;
+ enable = enable != isDisabled ? true : false;
+
+ } else {
+
+ if (helper.getButtonStyleClass().equals(PickListControlsHelper.DISABLED_STYLE_PREF)) {
+ enable = true;
+ } else {
+ enable = false;
+ }
+
+ }
+
+ encodeControlFacet(context, component, SHUTTLE_HELPERS[i], clientId, writer, enable, "rich-list-picklist-button", " rich-picklist-control");
+ }
+
}
protected void encodeControlFacet(FacesContext context, UIComponent component, OrderingComponentRendererBase.ControlsHelper helper, String clientId,
- ResponseWriter writer, boolean enabled, String baseStyle, String baseControlStyle) throws IOException {
- renderDefaultControl(context, component, writer, helper, clientId, enabled, baseStyle, baseControlStyle);
+ ResponseWriter writer, boolean enabled, String baseStyle, String baseControlStyle) throws IOException {
+
+ renderDefaultControl(context, component, writer, helper, clientId, enabled, baseStyle, baseControlStyle);
+
}
protected ClassLoader getCurrentLoader(Object fallbackClass) {
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- if (loader == null) {
+
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+
+ if (loader == null) {
loader = fallbackClass.getClass().getClassLoader();
}
+
return loader;
+
}
protected String findLocalisedLabel(FacesContext context, String propertyId, String bundleName) {
- String label = null;
- Locale locale = null;
- String userBundleName = null;
- ResourceBundle bundle = null;
+ String label = null;
+ Locale locale = null;
+ String userBundleName = null;
+ ResourceBundle bundle = null;
- UIViewRoot viewRoot = context.getViewRoot();
- if ( viewRoot != null) {
- locale = viewRoot.getLocale();
- } else {
- locale = Locale.getDefault();
- }
+ UIViewRoot viewRoot = context.getViewRoot();
+ if ( viewRoot != null) {
+ locale = viewRoot.getLocale();
+ } else {
+ locale = Locale.getDefault();
+ }
- if(locale != null) {
- try {
- if( null != (userBundleName = context.getApplication().getMessageBundle())) {
- bundle = ResourceBundle.getBundle(userBundleName,locale, getCurrentLoader(userBundleName));
- if (bundle != null) {
- label = bundle.getString(propertyId);
- }
- }
- } catch (MissingResourceException e) {
- if (logger.isDebugEnabled()) {
- logger.debug("Can't find bundle properties file " + userBundleName + " " + locale.getLanguage() + " " + locale.getCountry()) ;
- }
- }
+ if(locale != null) {
+
+ try {
+
+ if( null != (userBundleName = context.getApplication().getMessageBundle())) {
+ bundle = ResourceBundle.getBundle(userBundleName,locale, getCurrentLoader(userBundleName));
+
+ if (bundle != null) {
+ label = bundle.getString(propertyId);
+ }
+ }
+
+ } catch (MissingResourceException e) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Can't find bundle properties file " + userBundleName + " " + locale.getLanguage() + " " + locale.getCountry()) ;
+ }
+
+ }
+
if(label == null && bundleName != null) {
- try {
- bundle = ResourceBundle.getBundle(bundleName ,locale, getCurrentLoader(bundleName));
- if (bundle != null) {
- label = bundle.getString(propertyId);
- }
- } catch (MissingResourceException e) {
- if (logger.isDebugEnabled()) {
- logger.debug("Can't find bundle properties file " + bundleName + " " + locale.getLanguage() + " " + locale.getCountry()) ;
+
+ try {
+
+ bundle = ResourceBundle.getBundle(bundleName ,locale, getCurrentLoader(bundleName));
+ if (bundle != null) {
+ label = bundle.getString(propertyId);
}
-
- }
- }
- }
+
+ } catch (MissingResourceException e) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Can't find bundle properties file " + bundleName + " " + locale.getLanguage() + " " + locale.getCountry()) ;
+ }
+
+ }
+ }
+
+ }
- return label;
+ return label;
}
protected void renderDefaultControl(FacesContext context, UIComponent component, ResponseWriter writer,
- OrderingComponentRendererBase.ControlsHelper helper, String clientId, boolean enabled, String baseStyle,
- String baseControlStyle) throws IOException {
- UIComponent facet = component.getFacet(getAltAttribbute(helper));
- boolean useFacet = (facet != null && facet.isRendered());
+ OrderingComponentRendererBase.ControlsHelper helper, String clientId, boolean enabled, String baseStyle,
+ String baseControlStyle) throws IOException {
+
+ UIComponent facet = component.getFacet(getAltAttribbute(helper));
+
+ boolean useFacet = (facet != null && facet.isRendered());
- String customEvent = null;
- Map attributes = component.getAttributes();
+ String customEvent = null;
+
+ Map<String,Object> attributes = component.getAttributes();
- if (helper.customEvent != null) {
- customEvent = (String) attributes.get(helper.customEvent);
- }
+ if (helper.customEvent != null) {
+ customEvent = (String) attributes.get(helper.customEvent);
+ }
- String styleFromAttribute = (String) attributes.get(helper.styleFromAttribute);
- String baseStyleLight = baseStyle.concat("-light");
- String baseStylePress = baseStyle.concat("-press");
- String currentStyle = baseControlStyle + helper.getStyleClassName();
+ String styleFromAttribute = (String) attributes.get(helper.styleFromAttribute);
+ String baseStyleLight = baseStyle.concat("-light");
+ String baseStylePress = baseStyle.concat("-press");
+ String currentStyle = baseControlStyle + helper.getStyleClassName();
- if (styleFromAttribute != null) {
- currentStyle = styleFromAttribute.concat(currentStyle);
- }
+ if (styleFromAttribute != null) {
+ currentStyle = styleFromAttribute.concat(currentStyle);
+ }
+
+ String controlId = clientId + helper.getIdSuffix();
+ writer.startElement(HTML.DIV_ELEM, component);
+ writer.writeAttribute(HTML.id_ATTRIBUTE, controlId, null); // FIXME:
+ writer.writeAttribute(HTML.class_ATTRIBUTE, currentStyle, null);
+
+ String style = enabled ? "display:block;" : "display:none;";
+
+ writer.writeAttribute(HTML.style_ATTRIBUTE, style, null);
- writer.startElement(HTML.DIV_ELEM, component);
- String controlId = clientId + helper.getIdSuffix();
- writer.writeAttribute(HTML.id_ATTRIBUTE, controlId, null); // FIXME:
- writer.writeAttribute(HTML.class_ATTRIBUTE, currentStyle, null);
- String style = null;
+ if (!useFacet) {
+
+ writer.startElement(HTML.DIV_ELEM, component);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + helper.getButtonStyleClass(), null);
- if (enabled) {
- style = "display:block;";
- } else {
- style = "display:none;";
- }
+ if (helper.enable) {
+ writer.writeAttribute(HTML.onmouseover_ATTRIBUTE, "this.className='" + baseStyleLight + "'", null);
+ writer.writeAttribute(HTML.onmousedown_ATTRIBUTE, "this.className='" + baseStylePress + "'", null);
+ writer.writeAttribute(HTML.onmouseup_ATTRIBUTE, "this.className='" + baseStyle + "'", null);
+ writer.writeAttribute(HTML.onmouseout_ATTRIBUTE, "this.className='" + baseStyle + "'", null);
+ }
- writer.writeAttribute(HTML.style_ATTRIBUTE, style, null);
+ if (!helper.enable) {
+ //writer.writeAttribute(HTML.DISABLED_ATTR, "disabled", null);
+ //writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + "-a-disabled", null);
+ //writer.startElement(HTML.a_ELEMENT, component);
+ } else {
+ writer.startElement(HTML.a_ELEMENT, component);
+ writer.writeAttribute(HTML.id_ATTRIBUTE, controlId + "link", null); // FIXME:
+ writer.writeAttribute(HTML.onclick_ATTRIBUTE, "return false;", null);
+
+ writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + "-selection", null);
+ writer.writeAttribute(HTML.onblur_ATTRIBUTE, "Richfaces.Control.onblur(this);", null);
+ writer.writeAttribute(HTML.onfocus_ATTRIBUTE, "Richfaces.Control.onfocus(this);", null);
+ }
- if (!useFacet) {
- writer.startElement(HTML.DIV_ELEM, component);
- writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + helper.getButtonStyleClass(), null);
+ writer.startElement(HTML.DIV_ELEM, component);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + "-content", null);
+ }
- if (helper.enable) {
- writer.writeAttribute(HTML.onmouseover_ATTRIBUTE, "this.className='" + baseStyleLight + "'", null);
- writer.writeAttribute(HTML.onmousedown_ATTRIBUTE, "this.className='" + baseStylePress + "'", null);
- writer.writeAttribute(HTML.onmouseup_ATTRIBUTE, "this.className='" + baseStyle + "'", null);
- writer.writeAttribute(HTML.onmouseout_ATTRIBUTE, "this.className='" + baseStyle + "'", null);
- }
+ if (customEvent != null) {
+ writer.writeAttribute(HTML.onclick_ATTRIBUTE, customEvent, null);
+ }
- if (!helper.enable) {
- //writer.writeAttribute(HTML.DISABLED_ATTR, "disabled", null);
- //writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + "-a-disabled", null);
- //writer.startElement(HTML.a_ELEMENT, component);
- } else {
- writer.startElement(HTML.a_ELEMENT, component);
- writer.writeAttribute(HTML.id_ATTRIBUTE, controlId + "link", null); // FIXME:
- writer.writeAttribute(HTML.onclick_ATTRIBUTE, "return false;", null);
+ if (useFacet) {
+ renderChild(context, facet);
+ } else {
- writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + "-selection", null);
- writer.writeAttribute(HTML.onblur_ATTRIBUTE, "Richfaces.Control.onblur(this);", null);
- writer.writeAttribute(HTML.onfocus_ATTRIBUTE, "Richfaces.Control.onfocus(this);", null);
- }
+ writer.startElement(HTML.IMG_ELEMENT, component);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "rich-picklist-control-img", null);
+ writer.writeAttribute(HTML.alt_ATTRIBUTE, component.getAttributes().get(helper.getTitle()), null);
+ writer.writeAttribute(HTML.src_ATTRIBUTE, getResource(helper.getImageURI()).getUri(context, null), null);
+ writer.endElement(HTML.IMG_ELEMENT);
- writer.startElement(HTML.DIV_ELEM, component);
- writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + "-content", null);
- }
+ if (getUtils().isBooleanAttribute(component, SHOW_LABELS_ATTRIBUTE_NAME)) {
+ String label = (String) attributes.get(helper.getLabelAttributeName());
+ if (label == null || label.equals("")) {
+ label = findLocalisedLabel(context, helper.getBundlePropertyName(), MESSAGE_BUNDLE_NAME);
+ }
- if (customEvent != null) {
- writer.writeAttribute(HTML.onclick_ATTRIBUTE, customEvent, null);
- }
-
- if (useFacet) {
- renderChild(context, facet);
- } else {
- writer.startElement(HTML.IMG_ELEMENT, component);
- writer.writeAttribute(HTML.class_ATTRIBUTE, "rich-picklist-control-img", null);
- writer.writeAttribute(HTML.alt_ATTRIBUTE, component.getAttributes().get(helper.getTitle()), null);
- writer.writeAttribute(HTML.src_ATTRIBUTE, getResource(helper.getImageURI()).getUri(context, null), null);
- writer.endElement(HTML.IMG_ELEMENT);
-
- if (getUtils().isBooleanAttribute(component, SHOW_LABELS_ATTRIBUTE_NAME)) {
- String label = (String) attributes.get(helper.getLabelAttributeName());
- if (label == null || label.equals("")) {
- label = findLocalisedLabel(context, helper.getBundlePropertyName(), MESSAGE_BUNDLE_NAME);
+ if (label == null || label.equals("")) {
+ label = helper.getDefaultText();
+ }
+
+ writer.write(label);
+ }
}
- if (label == null || label.equals("")) {
- label = helper.getDefaultText();
+ if (!useFacet) {
+ writer.endElement(HTML.DIV_ELEM);
+
+ if (helper.enable) {
+ writer.endElement(HTML.a_ELEMENT);
+ }
+
+ writer.endElement(HTML.DIV_ELEM);
}
- writer.write(label);
- }
+
+ writer.endElement(HTML.DIV_ELEM);
}
- if (!useFacet) {
- writer.endElement(HTML.DIV_ELEM);
- if (helper.enable) {
- writer.endElement(HTML.a_ELEMENT);
- }
- writer.endElement(HTML.DIV_ELEM);
- }
- writer.endElement(HTML.DIV_ELEM);
- }
-
private String getAltAttribbute(
OrderingComponentRendererBase.ControlsHelper helper) {
+
return helper.getFacetName() != null ? helper.getFacetName() : " ";
+
}
public void reRenderScript(FacesContext context, UIComponent component) throws IOException {
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- Set <String> areas = ajaxContext.getAjaxRenderedAreas();
- String clientId = component.getClientId(context);
- if (ajaxContext.isAjaxRequest() && areas.contains(clientId)){
- areas.add(clientId + "script");
+
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+
+ Set <String> areas = ajaxContext.getAjaxRenderedAreas();
+ String clientId = component.getClientId(context);
+
+ if (ajaxContext.isAjaxRequest() && areas.contains(clientId)){
+ areas.add(clientId + "script");
}
+
}
+
}
15 years, 3 months
JBoss Rich Faces SVN: r12636 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages/comboBox and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2009-02-12 08:14:38 -0500 (Thu, 12 Feb 2009)
New Revision: 12636
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ComboBoxTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/comboBox/comboBoxTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComboBoxTest.java
Log:
RF-6062 RF-6063
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ComboBoxTestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ComboBoxTestBean.java 2009-02-12 11:01:27 UTC (rev 12635)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ComboBoxTestBean.java 2009-02-12 13:14:38 UTC (rev 12636)
@@ -24,10 +24,14 @@
import java.util.Arrays;
import java.util.List;
+import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
public class ComboBoxTestBean {
+ private String value;
+ private String trace;
+
private List<SelectItem> treeItems;
private List<String> treeNames;
@@ -39,6 +43,11 @@
}
}
+ public void init() {
+ value = null;
+ trace = null;
+ }
+
/**
* Gets value of treeItems field.
* @return value of treeItems field
@@ -55,4 +64,23 @@
return treeNames;
}
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setTrace(String trace) {
+ this.trace = trace;
+ }
+
+ public String getTrace() {
+ return trace;
+ }
+
+ public void valueChangeListener(ValueChangeEvent event) {
+ trace = "changed";
+ }
}
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/comboBox/comboBoxTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComboBoxTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComboBoxTest.java 2009-02-12 11:01:27 UTC (rev 12635)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComboBoxTest.java 2009-02-12 13:14:38 UTC (rev 12636)
@@ -20,13 +20,41 @@
*/
package org.richfaces.testng;
+import java.util.HashMap;
+import java.util.Map;
+
import org.ajax4jsf.template.Template;
+import org.richfaces.AutoTester;
import org.richfaces.SeleniumTestBase;
import org.testng.Assert;
import org.testng.annotations.Test;
public class ComboBoxTest extends SeleniumTestBase {
+
+ private String comboBox;
+ private String comboboxButton;
+
+ private String list;
+
+ private String submit;
+
+ private String value;
+
+ private String trace;
+
+ private void init(Template template) {
+ renderPage(null, template, "#{comboBean.init}");
+ //String attrForm = getParentId() + "attrForm";
+ String mainForm = getParentId() + "_form";
+ comboBox = mainForm + ":comboBox";
+ comboboxButton = comboBox + "comboboxButton";
+ list = comboBox + "list";
+ submit = mainForm + ":submit";
+ value = getParentId() + "value";
+ trace = getParentId() + "trace";
+ }
+
@Test
public void testComboBoxComponent(Template template) {
renderPage(template);
@@ -84,8 +112,47 @@
AssertValueEquals(suggestionValuesCBId + "comboboxValue", "Maple");
}
+ /**
+ * Check that comboBox component present on the page.
+ * Styles & events attributes work as should.
+ */
+ @Test
+ public void testStandardAttributes(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, null);
+ Map<String, String> styleAttributes = new HashMap<String, String>();
+ styleAttributes.put("width", "100%");
+ styleAttributes.put("color", "yellow");
+ autoTester.testStyleAndClasses(new String[]{"noname"}, styleAttributes);
+ autoTester.testHTMLEvents();
+ }
+
+ /**
+ * Check that valueChangeListener triggered
+ * when user select new value from popup.
+ * Selected value should be correctly applied.
+ */
+ @Test
+ public void testValueAndListener(Template template) {
+ init(template);
+ Assert.assertEquals(selenium.getText(value), "");
+ Assert.assertEquals(selenium.getText(trace), "");
+ selenium.click(comboboxButton);
+ selenium.mouseMove("xpath=id('" + list + "')/span[2]");
+ selenium.click("xpath=id('" + list + "')/span[2]");
+ //selenium.fireEvent("xpath=id('" + list + "')/span[3]", "click");
+ clickAjaxCommandAndWait(submit);
+ Assert.assertEquals(selenium.getText(value), "22");
+ Assert.assertEquals(selenium.getText(trace), "changed");
+ }
+
public String getTestUrl() {
return "pages/comboBox/comboBoxTest.xhtml";
}
+
+ @Override
+ public String getAutoTestUrl() {
+ return "pages/comboBox/comboBoxAutoTest.xhtml";
+ }
}
\ No newline at end of file
15 years, 3 months
JBoss Rich Faces SVN: r12635 - trunk/docs/userguide.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2009-02-12 06:01:27 -0500 (Thu, 12 Feb 2009)
New Revision: 12635
Modified:
trunk/docs/userguide/pom.xml
Log:
https://jira.jboss.org/jira/browse/RF-4643 - spellChecker improvement
Modified: trunk/docs/userguide/pom.xml
===================================================================
--- trunk/docs/userguide/pom.xml 2009-02-11 20:41:56 UTC (rev 12634)
+++ trunk/docs/userguide/pom.xml 2009-02-12 11:01:27 UTC (rev 12635)
@@ -821,7 +821,7 @@
</sourceDocumentName>
<formats>
- <!--format>
+ <format>
<formatName>pdf</formatName>
<stylesheetResource>
classpath:/xslt/org/jboss/pdf.xsl
@@ -832,7 +832,7 @@
<imagePathSettingRequired>
true
</imagePathSettingRequired>
- </format-->
+ </format>
<format>
<formatName>html</formatName>
<stylesheetResource>
@@ -847,7 +847,7 @@
</imagePathSettingRequired>
</format>
- <!--format>
+ <format>
<formatName>html_single</formatName>
<stylesheetResource>
${xsl_html_single}
@@ -861,7 +861,7 @@
<finalName>
index.html
</finalName>
- </format-->
+ </format>
</formats>
<xincludeSupported>true</xincludeSupported>
<options>
15 years, 3 months
JBoss Rich Faces SVN: r12634 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces/testng and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2009-02-11 15:41:56 -0500 (Wed, 11 Feb 2009)
New Revision: 12634
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataFilterSlider/dataFilterSliderAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataFilterSliderTest.java
Log:
DataFilterSlider test extended
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataFilterSlider/dataFilterSliderAutoTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataFilterSliderTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataFilterSliderTest.java 2009-02-11 20:30:56 UTC (rev 12633)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataFilterSliderTest.java 2009-02-11 20:41:56 UTC (rev 12634)
@@ -152,6 +152,30 @@
autoTester.testExtrenalValidationFailure();
}
+ @Test
+ public void testOncomplete(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESET_METHOD);
+ writeStatus("Test oncomplete attribute");
+ tester.testOncomplete();
+ }
+
+ @Test
+ public void testLimitToListAttribute(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESET_METHOD);
+ writeStatus("Test component with limitToList = true skips ajaxRendered areas update");
+ tester.testLimitToList();
+ }
+
+ @Test
+ public void testBypassUpdatesAttribute(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESET_METHOD);
+ writeStatus("Test component with bypassUpdates = true skips update model values phase");
+ tester.testBypassUpdate();
+ }
+
private void clickSlider(int position) {
String trackId = getParentId() + FORM_ID + DATA_FLT_SLIDER_TRACK;
int w = selenium.getElementWidth(trackId).intValue();
15 years, 3 months