JBoss Rich Faces SVN: r7278 - in trunk/ui/modal-panel/src/main: java/org/richfaces/component and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2008-03-26 15:58:30 -0400 (Wed, 26 Mar 2008)
New Revision: 7278
Modified:
trunk/ui/modal-panel/src/main/config/component/modalPanel.xml
trunk/ui/modal-panel/src/main/java/org/richfaces/component/UIModalPanel.java
trunk/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java
trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx
Log:
http://jira.jboss.com/jira/browse/RF-2464
Modified: trunk/ui/modal-panel/src/main/config/component/modalPanel.xml
===================================================================
--- trunk/ui/modal-panel/src/main/config/component/modalPanel.xml 2008-03-26 19:45:31 UTC (rev 7277)
+++ trunk/ui/modal-panel/src/main/config/component/modalPanel.xml 2008-03-26 19:58:30 UTC (rev 7278)
@@ -166,7 +166,7 @@
<defaultvalue>false</defaultvalue>
</property>
- <property el="true">
+ <property>
<name>visualOptions</name>
<classname>java.lang.Object</classname>
<description>Defines options that were specified on the client side</description>
Modified: trunk/ui/modal-panel/src/main/java/org/richfaces/component/UIModalPanel.java
===================================================================
--- trunk/ui/modal-panel/src/main/java/org/richfaces/component/UIModalPanel.java 2008-03-26 19:45:31 UTC (rev 7277)
+++ trunk/ui/modal-panel/src/main/java/org/richfaces/component/UIModalPanel.java 2008-03-26 19:58:30 UTC (rev 7278)
@@ -46,7 +46,7 @@
public static final String COMPONENT_FAMILY = "org.richfaces.ModalPanel";
- private Map<String, String> visualOptions;
+ private Map<String, Object> visualOptions;
/**
* Shadow depth.
@@ -146,7 +146,7 @@
}
if (null == this.visualOptions) {
- this.visualOptions = new HashMap<String, String>();
+ this.visualOptions = new HashMap<String, Object>();
}
return this.visualOptions;
}
@@ -185,18 +185,18 @@
}
}
- protected Map<String, String> prepareVisualOptions(Object value) {
+ protected Map<String, Object> prepareVisualOptions(Object value) {
if (null == value) {
- return new HashMap<String, String>();
+ return new HashMap<String, Object>();
} else if (value instanceof Map) {
- return (Map<String, String>) value;
+ return (Map<String, Object>) value;
} else if (value instanceof String) {
String s = (String) value;
if (!s.startsWith("{")) {
s = "{" + s + "}";
}
try {
- return new HashMap<String, String>(new JSONMap(s));
+ return new HashMap<String, Object>(new JSONMap(s));
} catch (JSONException e) {
throw new FacesException(e);
}
Modified: trunk/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java
===================================================================
--- trunk/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java 2008-03-26 19:45:31 UTC (rev 7277)
+++ trunk/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java 2008-03-26 19:58:30 UTC (rev 7278)
@@ -29,6 +29,7 @@
import javax.faces.component.UIComponent;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.ComponentVariables;
@@ -69,7 +70,7 @@
if (null != clnId) {
panel.setShowWhenRendered(new Boolean((String) clnId).booleanValue());
- Map<String, String> visualOptions = (Map<String, String>) panel.getVisualOptions();
+ Map<String, Object> visualOptions = (Map<String, Object>) panel.getVisualOptions();
Iterator<Entry<String, String>> it = rqMap.entrySet().iterator();
while ( it.hasNext()) {
Map.Entry<String, String> entry = it.next();
@@ -144,12 +145,11 @@
StringBuffer result = new StringBuffer();
if (panel.isKeepVisualState() || panel.isShowWhenRendered()) {
- result.append("Event.observe(window, \"load\", function() {");
result.append("Richfaces.showModalPanel('" + panel.getClientId(context) + "', {");
- Iterator<Map.Entry<String, String>> it = ((Map<String, String>) panel.getVisualOptions()).entrySet().iterator();
+ Iterator<Map.Entry<String, Object>> it = ((Map<String, Object>) panel.getVisualOptions()).entrySet().iterator();
while (it.hasNext()) {
- Map.Entry<String, String> entry = it.next();
+ Map.Entry<String, Object> entry = it.next();
result.append(entry.getKey() + ": '" + entry.getValue() + "'");
if (it.hasNext()) {
@@ -157,7 +157,7 @@
}
}
- result.append("});}.bind());");
+ result.append("});");
}
return result.toString();
}
@@ -166,4 +166,24 @@
RendererUtils.writeEventHandlerFunction(context, component, eventName);
}
+ public void writeVisualOptions(FacesContext context, UIModalPanel panel)
+ throws IOException {
+ StringBuffer result = new StringBuffer();
+ ResponseWriter writer = context.getResponseWriter();
+
+ Iterator<Map.Entry<String, Object>> it = ((Map<String, Object>) panel.getVisualOptions()).entrySet().iterator();
+ if (it.hasNext()) {
+ result.append(",\n");
+ }
+ while (it.hasNext()) {
+ Map.Entry<String, Object> entry = it.next();
+
+ result.append(entry.getKey() + ": '" + entry.getValue() + "'");
+ if (it.hasNext()) {
+ result.append(",\n");
+ }
+ }
+
+ writer.writeText(result, null);
+ }
}
Modified: trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx
===================================================================
--- trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx 2008-03-26 19:45:31 UTC (rev 7277)
+++ trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx 2008-03-26 19:58:30 UTC (rev 7278)
@@ -183,7 +183,9 @@
showWhenRendered: #{component.showWhenRendered},
selectBehavior: "#{component.tridentIVEngineSelectBehavior}",
- autosized: #{component.autosized}
+ autosized: #{component.autosized}
+
+ <f:call name="writeVisualOptions" />
});
</script>
</div>
16 years, 9 months
JBoss Rich Faces SVN: r7277 - in trunk/ui/inplaceInput/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-03-26 15:45:31 -0400 (Wed, 26 Mar 2008)
New Revision: 7277
Modified:
trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js
trunk/ui/inplaceInput/src/main/templates/inplaceinput.jspx
Log:
RF-2685, 2656
Modified: trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js
===================================================================
--- trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js 2008-03-26 19:45:25 UTC (rev 7276)
+++ trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js 2008-03-26 19:45:31 UTC (rev 7277)
@@ -143,7 +143,7 @@
tmpValueKeyDownHandler : function(e) {
switch (e.keyCode) {
case Event.KEY_ESC :
- this.cancel();
+ this.cancel(e, this.valueKeeper.value);
break;
case Event.KEY_RETURN :
Event.stop(e);
@@ -166,7 +166,7 @@
},
cancelHandler : function(e) {
- this.cancel(e);
+ this.cancel(e, this.valueKeeper.value);
Event.stop(e);
},
@@ -259,9 +259,10 @@
this.currentState = newState;
},
- cancel : function() {
+ cancel : function(e, value) {
this.endEditableState();
- this.tempValueKeeper.value = this.valueKeeper.value;
+ this.tempValueKeeper.value = value;
+ this.currentText = value;
if (this.tempValueKeeper.value == "") {
this.setDefaultText();
}
Modified: trunk/ui/inplaceInput/src/main/templates/inplaceinput.jspx
===================================================================
--- trunk/ui/inplaceInput/src/main/templates/inplaceinput.jspx 2008-03-26 19:45:25 UTC (rev 7276)
+++ trunk/ui/inplaceInput/src/main/templates/inplaceinput.jspx 2008-03-26 19:45:31 UTC (rev 7277)
@@ -14,7 +14,7 @@
<h:styles>css/inplaceinput.xcss</h:styles>
<h:scripts>
new org.ajax4jsf.javascript.PrototypeScript(),
- scripts/inplaceinput.js
+ scripts/inplaceinput.js,
scripts/utils.js
</h:scripts>
<f:resource var="saveIcon" name="org.richfaces.renderkit.html.images.SaveControlIcon"/>
16 years, 9 months
JBoss Rich Faces SVN: r7276 - trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-03-26 15:45:25 -0400 (Wed, 26 Mar 2008)
New Revision: 7276
Modified:
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
Log:
RF-2685, 2656
Modified: trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
===================================================================
--- trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js 2008-03-26 18:42:33 UTC (rev 7275)
+++ trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js 2008-03-26 19:45:25 UTC (rev 7276)
@@ -70,8 +70,11 @@
if (!this.comboList.isList || this.clickOnBar) {
this.comboList.hideWithDelay();
}
- if (this.attributes.showControls) {
+
+ if (!this.attributes.showControls) {
this.saveValue();
+ } else {
+ this.applyTmpValue();
}
this.comboList.isList = false;
/*this.comboList.hideWithDelay();*/
@@ -128,16 +131,19 @@
},
saveValue : function($super) {
+ this.applyTmpValue();
+ if (!this.comboList.isList || this.clickOnBar) {
+ this.save(this.currentItemValue, this.tempValueKeeper.value);
+ }
+ },
+
+ applyTmpValue : function() {
if (this.comboList.activeItem) {
var userLabel = this.comboList.activeItem.innerHTML;
this.currentItemValue = this.comboList.activeItem.value;
this.tempValueKeeper.value = userLabel;
this.comboList.selectedItem = this.comboList.activeItem;
- //this.clickOnField = false;
}
- if (!this.comboList.isList || this.clickOnBar) {
- this.save(this.currentItemValue, this.tempValueKeeper.value);
- }
},
deleteViewArtifacts : function () {
@@ -149,5 +155,25 @@
getCurrentText : function() {
return this.inplaceInput.childNodes[6];
+ },
+
+ getLabelItem : function(value) {
+ var length = this.comboList.getItems().length;
+ for (var i = 0; i < length; i++) {
+ var item = this.comboList.getItems()[i];
+ if (item.value == value) {
+ return item;
+ }
+ }
+ },
+
+ cancel : function($super, e) {
+ var item = this.getLabelItem(this.valueKeeper.value);
+ if (this.comboList.selectedItem) {
+ this.comboList.doNormalItem(this.comboList.selectedItem);
+ }
+ this.comboList.doSelectItem(item);
+ $super(e, item.innerHTML);
}
+
});
16 years, 9 months
JBoss Rich Faces SVN: r7275 - in trunk/samples/richfaces-demo/src/main/webapp/richfaces: dragSupport/examples and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-03-26 14:42:33 -0400 (Wed, 26 Mar 2008)
New Revision: 7275
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/dragSupport/examples/dnd.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/dragSupport/usage.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/toolTip/examples/tooltipUsage.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/toolTip/usage.xhtml
Log:
Demo site: drag-n-drop, tooltip demos layout correction
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/dragSupport/examples/dnd.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/dragSupport/examples/dnd.xhtml 2008-03-26 18:39:26 UTC (rev 7274)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/dragSupport/examples/dnd.xhtml 2008-03-26 18:42:33 UTC (rev 7275)
@@ -15,6 +15,12 @@
.dropTargetPanel {
width: 90%;
}
+
+ .footerClass {
+ text-align: center;
+ padding-top: 5px;
+ }
+
</style>
<rich:dragIndicator id="indicator" />
@@ -28,7 +34,7 @@
<h:outputText value="Source List" />
</f:facet>
<h:dataTable id="src" columns="1" value="#{dndBean.frameworks}"
- var="fm" >
+ var="fm" footerClass="footerClass">
<h:column>
<a4j:outputPanel style="width:100px;border:1px solid gray;padding:2px"
@@ -40,7 +46,9 @@
<h:outputText value="#{fm.name}"></h:outputText>
</a4j:outputPanel>
</h:column>
-
+ <f:facet name="footer">
+ <a4j:commandButton action="#{dndBean.reset}" value="Start Over" reRender="src,phptable,cftable,dnettable"/>
+ </f:facet>
</h:dataTable>
</rich:panel>
@@ -91,16 +99,9 @@
<h:outputText value="#{fm.name}"></h:outputText>
</h:column>
</h:dataTable>
-
-
</rich:panel>
+ </h:panelGrid>
-
-
-
- </h:panelGrid>
- <a4j:commandButton action="#{dndBean.reset}" value="Start Over"
- reRender="src,phptable,cftable,dnettable" />
</h:form>
<a4j:outputPanel ajaxRendered="true">
<h:messages></h:messages>
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/dragSupport/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/dragSupport/usage.xhtml 2008-03-26 18:39:26 UTC (rev 7274)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/dragSupport/usage.xhtml 2008-03-26 18:42:33 UTC (rev 7275)
@@ -41,16 +41,15 @@
Drag one and drag over the headers of three panels. If the draggable framework is suitable for a certain
framework family, it will be accepted. Otherwise, the drag indicator shows the "reject" icon.</p>
- <div class="sample-container">
+ <fieldset class="demo_fieldset">
+ <legend class="demo_legend">Drag-n-Drop example</legend>
+ <div class="sample-container">
<ui:include src="/richfaces/dragSupport/examples/dnd.xhtml"/>
<ui:include src="/templates/include/sourceview.xhtml">
<ui:param name="sourcepath" value="/richfaces/dragSupport/examples/dnd.xhtml"/>
- <ui:param name="openlabel" value="View Page Source" />
- </ui:include>
-
- </div>
-
-
+ </ui:include>
+ </div>
+ </fieldset>
</ui:define>
</ui:composition>
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/toolTip/examples/tooltipUsage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/toolTip/examples/tooltipUsage.xhtml 2008-03-26 18:39:26 UTC (rev 7274)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/toolTip/examples/tooltipUsage.xhtml 2008-03-26 18:42:33 UTC (rev 7275)
@@ -13,10 +13,12 @@
}
.tooltip-text {
width:350px;
- height:65px;
+ height:80px;
cursor:arrow;
border-width:2px;
text-align:center;
+ display: table-cell;
+ vertical-align: middle;
}
.tooltipData {
font-weight: bold;
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/toolTip/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/toolTip/usage.xhtml 2008-03-26 18:39:26 UTC (rev 7274)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/toolTip/usage.xhtml 2008-03-26 18:42:33 UTC (rev 7275)
@@ -19,15 +19,16 @@
<li>Parameters can be passed to the server during an ajax request</li>
<li>Tooltip <b>look is fully customizable</b> using both - Richfaces skins and CSS style classes</li>
</ul>
-
- <div class="sample-container" >
-
- <ui:include src="/richfaces/toolTip/examples/tooltipUsage.xhtml"/>
- <ui:include src="/templates/include/sourceview.xhtml">
- <ui:param name="sourcepath" value="/richfaces/toolTip/examples/tooltipUsage.xhtml"/>
- </ui:include>
-
- </div>
+
+ <fieldset class="demo_fieldset">
+ <legend class="demo_legend">ToolTip example</legend>
+ <div class="sample-container" >
+ <ui:include src="/richfaces/toolTip/examples/tooltipUsage.xhtml"/>
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath" value="/richfaces/toolTip/examples/tooltipUsage.xhtml"/>
+ </ui:include>
+ </div>
+ </fieldset>
</ui:define>
</ui:composition>
16 years, 9 months
JBoss Rich Faces SVN: r7274 - trunk/test-applications/jsp/src/main/webapp/InputNumberSlider.
by richfaces-svn-commits@lists.jboss.org
Author: ayanul
Date: 2008-03-26 14:39:26 -0400 (Wed, 26 Mar 2008)
New Revision: 7274
Modified:
trunk/test-applications/jsp/src/main/webapp/InputNumberSlider/InputNumberSlider.jsp
Log:
-remove onkey*
Modified: trunk/test-applications/jsp/src/main/webapp/InputNumberSlider/InputNumberSlider.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/InputNumberSlider/InputNumberSlider.jsp 2008-03-26 17:42:39 UTC (rev 7273)
+++ trunk/test-applications/jsp/src/main/webapp/InputNumberSlider/InputNumberSlider.jsp 2008-03-26 18:39:26 UTC (rev 7274)
@@ -16,7 +16,7 @@
barClass="#{style.barClass}" tipClass="#{style.barClass}" inputClass="#{style.inputClass}"
handleClass="#{style.handleStyle}" styleClass="#{style.tipStyle}"
maxlength="#{inputNumberSlider.maxlength}"
- onblur="#{event.onblur}" onchange="#{event.onchange}" onclick="#{event.onclick}" ondblclick="#{event.ondblclick}" onerror="#{event.onerror}" onfocus="#{event.onfocus}" onkeydown="#{event.onkeydown}" onkeypress="#{event.onkeypress}" onkeyup="#{event.onkeyup}" onmousedown="#{event.onmousedown}" onmousemove="#{event.onmousemove}" onmouseout="#{event.onmouseout}" onmouseover="#{event.onmouseover}" onmouseup="#{event.onmouseup}" onselect="#{event.onselect}" onslide="#{event.onslide}">
+ onblur="#{event.onblur}" onchange="#{event.onchange}" onclick="#{event.onclick}" ondblclick="#{event.ondblclick}" onerror="#{event.onerror}" onfocus="#{event.onfocus}" onmousedown="#{event.onmousedown}" onmousemove="#{event.onmousemove}" onmouseout="#{event.onmouseout}" onmouseover="#{event.onmouseover}" onmouseup="#{event.onmouseup}" onselect="#{event.onselect}" onslide="#{event.onslide}">
</rich:inputNumberSlider>
<h:panelGroup>
<a4j:commandButton value="valueChangeListener (show)" reRender="valueCLID" />
16 years, 9 months
JBoss Rich Faces SVN: r7273 - in trunk/samples/richfaces-demo/src/main: java/org/richfaces/demo/filteringFeature and 6 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2008-03-26 13:42:39 -0400 (Wed, 26 Mar 2008)
New Revision: 7273
Added:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/filteringFeature/
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/filteringFeature/FilteringBean.java
trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/examples/FilteringBean.java
Modified:
trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/examples/externalFiltering.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/examples/simpleFiltering.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/externalFilteringUsage.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/filteringUsage.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/inplaceInput/examples/controlsCustomization.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/sortingFeature/sortingUsage.xhtml
Log:
filtering example finished
Added: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/filteringFeature/FilteringBean.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/filteringFeature/FilteringBean.java (rev 0)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/filteringFeature/FilteringBean.java 2008-03-26 17:42:39 UTC (rev 7273)
@@ -0,0 +1,59 @@
+package org.richfaces.demo.filteringFeature;
+
+import java.util.ArrayList;
+
+import javax.faces.model.SelectItem;
+
+import org.richfaces.demo.capitals.Capital;
+
+/**
+ * @author Ilya Shaikovsky
+ *
+ */
+public class FilteringBean {
+
+ private String filterZone = "5";
+ private String filterValue="";
+ private ArrayList<SelectItem> filterZones = new ArrayList<SelectItem>();
+
+ public boolean filterStates(Object current) {
+ Capital currentCapital = (Capital)current;
+ if (filterValue.length()==0) {
+ return true;
+ }
+ if (currentCapital.getState().toLowerCase().startsWith(filterValue.toLowerCase())) {
+ return true;
+ }else {
+ return false;
+ }
+ }
+
+ public FilteringBean() {
+ for (int i = 5; i < 11; i++) {
+ SelectItem select = new SelectItem();
+ select.setLabel("-" + i);
+ select.setValue(i);
+ filterZones.add(select);
+ }
+ }
+
+ public String getFilterValue() {
+ return filterValue;
+ }
+
+ public void setFilterValue(String filterValue) {
+ this.filterValue = filterValue;
+ }
+
+ public String getFilterZone() {
+ return filterZone;
+ }
+
+ public void setFilterZone(String filterZone) {
+ this.filterZone = filterZone;
+ }
+
+ public ArrayList<SelectItem> getFilterZones() {
+ return filterZones;
+ }
+}
Modified: trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml 2008-03-26 17:27:27 UTC (rev 7272)
+++ trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml 2008-03-26 17:42:39 UTC (rev 7273)
@@ -303,6 +303,11 @@
<managed-bean-class>org.richfaces.datatablescroller.SortingBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>filteringBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.demo.filteringFeature.FilteringBean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
<navigation-rule>
<from-view-id>/richfaces/include/examples/wstep1.xhtml</from-view-id>
<navigation-case>
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/examples/FilteringBean.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/examples/FilteringBean.java (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/examples/FilteringBean.java 2008-03-26 17:42:39 UTC (rev 7273)
@@ -0,0 +1,59 @@
+package org.richfaces.demo.filteringFeature;
+
+import java.util.ArrayList;
+
+import javax.faces.model.SelectItem;
+
+import org.richfaces.demo.capitals.Capital;
+
+/**
+ * @author Ilya Shaikovsky
+ *
+ */
+public class FilteringBean {
+
+ private String filterZone = "5";
+ private String filterValue="";
+ private ArrayList<SelectItem> filterZones = new ArrayList<SelectItem>();
+
+ public boolean filterStates(Object current) {
+ Capital currentCapital = (Capital)current;
+ if (filterValue.length()==0) {
+ return true;
+ }
+ if (currentCapital.getState().toLowerCase().startsWith(filterValue.toLowerCase())) {
+ return true;
+ }else {
+ return false;
+ }
+ }
+
+ public FilteringBean() {
+ for (int i = 5; i < 11; i++) {
+ SelectItem select = new SelectItem();
+ select.setLabel("-" + i);
+ select.setValue(i);
+ filterZones.add(select);
+ }
+ }
+
+ public String getFilterValue() {
+ return filterValue;
+ }
+
+ public void setFilterValue(String filterValue) {
+ this.filterValue = filterValue;
+ }
+
+ public String getFilterZone() {
+ return filterZone;
+ }
+
+ public void setFilterZone(String filterZone) {
+ this.filterZone = filterZone;
+ }
+
+ public ArrayList<SelectItem> getFilterZones() {
+ return filterZones;
+ }
+}
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/examples/externalFiltering.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/examples/externalFiltering.xhtml 2008-03-26 17:27:27 UTC (rev 7272)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/examples/externalFiltering.xhtml 2008-03-26 17:42:39 UTC (rev 7273)
@@ -1,25 +1,43 @@
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://richfaces.org/rich">
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:fn="http://java.sun.com/jsp/jstl/functions">
<h:form>
- <rich:dataTable value="#{capitalsBean.capitals}" var="cap" width="500px">
+ <rich:dataTable value="#{capitalsBean.capitals}" var="cap" id="table">
<f:facet name="header">
- <h:outputText value="Filtering Example"/>
+ <rich:columnGroup>
+ <rich:column colspan="2">
+ <h:outputText value="Filtering Example" />
+ </rich:column>
+ <rich:column breakBefore="true">
+ <h:outputText value="State Name" />
+ </rich:column>
+ <rich:column>
+ <h:outputText value="State Time Zone" />
+ </rich:column>
+ </rich:columnGroup>
</f:facet>
- <rich:column>
+ <rich:column filterMethod="#{filteringBean.filterStates}">
<f:facet name="header">
- <h:graphicImage value="/images/ico_DataTable.gif"></h:graphicImage>
+ <h:inputText value="#{filteringBean.filterValue}" id="input">
+ <a4j:support event="onkeyup" reRender="table"
+ ignoreDupResponses="true" requestDelay="700" focus="input" />
+ </h:inputText>
</f:facet>
- <h:graphicImage value="#{cap.stateFlag}"/>
+ <h:outputText value="#{cap.state}" />
</rich:column>
- <rich:column filterBy="#{cap.state}" filterDefaultLabel="click to filter">
- <h:outputText value="#{cap.state}"></h:outputText>
- </rich:column>
- <rich:column filterBy="#{cap.name}" filterDefaultLabel="click to filter">
- <h:outputText value="#{cap.name}"/>
+ <rich:column
+ filterExpression="#{fn:containsIgnoreCase(cap.timeZone, filteringBean.filterZone)}">
+ <f:facet name="header">
+ <h:selectOneMenu value="#{filteringBean.filterZone}">
+ <f:selectItems value="#{filteringBean.filterZones}" />
+ <a4j:support event="onchange" reRender="table" />
+ </h:selectOneMenu>
+ </f:facet>
+ <h:outputText value="#{cap.timeZone}" />
</rich:column>
</rich:dataTable>
</h:form>
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/examples/simpleFiltering.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/examples/simpleFiltering.xhtml 2008-03-26 17:27:27 UTC (rev 7272)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/examples/simpleFiltering.xhtml 2008-03-26 17:42:39 UTC (rev 7273)
@@ -5,35 +5,29 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:form>
- <style>
- .rich-inplace-view{
- color:gray;
- border-bottom-color:gray;
- }
- .body{
- background-color:red !important;
- }
- </style>
- <input type="text" value="123" style="background : transparent; border : 0"/>
- <rich:dataTable value="#{capitalsBean.capitals}" var="cap" width="500px" rows="15">
+ <rich:dataTable value="#{capitalsBean.capitals}" var="cap">
<f:facet name="header">
- <h:outputText value="Filtering Example"/>
+ <rich:columnGroup>
+ <rich:column colspan="2" >
+ <h:outputText value="Filtering Example"/>
+ </rich:column>
+ <rich:column breakBefore="true">
+ <h:outputText value="State Name"/>
+ </rich:column>
+ <rich:column>
+ <h:outputText value="State Capital"/>
+ </rich:column>
+ </rich:columnGroup>
</f:facet>
- <rich:column filterBy="#{cap.state}" filterDefaultLabel="click to filter">
+ <rich:column filterBy="#{cap.state}" filterEvent="onkeyup">
+ <f:facet name="header">
+ <h:outputText value=" " title="Hack due to bug. Shuold be remoevd till release"></h:outputText>
+ </f:facet>
<h:outputText value="#{cap.state}"/>
</rich:column>
- <rich:column filterBy="#{cap.name}" filterDefaultLabel="click to filter">
+ <rich:column filterBy="#{cap.name}" filterEvent="onkeyup">
<h:outputText value="#{cap.name}"/>
</rich:column>
- <rich:column>
- <f:facet name="header">
- <h:outputText value="State time zone:"/>
- </f:facet>
- <h:outputText value="#{cap.timeZone}"/>
- </rich:column>
- <f:facet name="footer">
- <rich:datascroller renderIfSinglePage="false"/>
- </f:facet>
</rich:dataTable>
</h:form>
</ui:composition>
\ No newline at end of file
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/externalFilteringUsage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/externalFilteringUsage.xhtml 2008-03-26 17:27:27 UTC (rev 7272)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/externalFilteringUsage.xhtml 2008-03-26 17:42:39 UTC (rev 7273)
@@ -8,15 +8,37 @@
<ui:define name="sample">
<p>
- SHORT DESCRIPTION
+ In order to use <b>Filtering Feature</b> of <b>rich:dataTable</b> with some custom filtering
+ functions and controls one should use next available attributes on columns:
</p>
-
+ <ul>
+ <li>
+ <b>filterExpression</b> - Attribute which allows to define expression
+ evaluated to boolean value. This expression should check if the object
+ satisfies filtering condition.
+ </li>
+ <li>
+ <b>filterMethod</b> - Attribute which should be defined with method binding.
+ This method should accept on Object parameter and return bioolean value.
+ So, this method also should be used to check if the object satisfies
+ filtering condition.
+ </li>
+ </ul>
+ <p>
+ In next simple example we use <b>filterMethod</b> and <b>filterExpression</b> for the first
+ and second columns filtering correspondingly.
+ </p>
<div class="sample-container" >
<ui:include src="/richfaces/filteringFeature/examples/externalFiltering.xhtml"/>
<ui:include src="/templates/include/sourceview.xhtml">
<ui:param name="sourcepath" value="/richfaces/filteringFeature/examples/externalFiltering.xhtml"/>
</ui:include>
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath" value="/richfaces/filteringFeature/examples/FilteringBean.java"/>
+ <ui:param name="openlabel" value="View FilteringBean.java Source" />
+ <ui:param name="sourcetype" value="java" />
+ </ui:include>
</div>
<p>
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/filteringUsage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/filteringUsage.xhtml 2008-03-26 17:27:27 UTC (rev 7272)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/filteringUsage.xhtml 2008-03-26 17:42:39 UTC (rev 7273)
@@ -6,22 +6,53 @@
xmlns:rich="http://richfaces.org/rich">
<ui:composition template="/templates/component-sample.xhtml">
<ui:define name="sample">
-
+ <style>
+ .top{
+ vertical-align:top;
+ }
+ </style>
+ <p><b>
+ Rich Data Table</b> has columns <b>filtering feature</b> built-in. Simplest way to add filtering
+ capability is to define <b>filterBy </b>attribute at column you need to be filterable.
+ </p>
<p>
- SHORT DESCRIPTION
+ In this attribute you should define iterable object property which should be
+ used when filetring performed.
</p>
-
- <div class="sample-container" >
+ <p>
+ In this example you could see that two first columns filtered after corresponding
+ input changed.
+ </p>
+ <h:panelGrid columns="2" columnClasses="top">
+ <div class="sample-container" jsfc="h:panelGroup">
<ui:include src="/richfaces/filteringFeature/examples/simpleFiltering.xhtml"/>
<ui:include src="/templates/include/sourceview.xhtml">
<ui:param name="sourcepath" value="/richfaces/filteringFeature/examples/simpleFiltering.xhtml"/>
</ui:include>
</div>
-
- <p>
- DESCRIPTION
- </p>
+ <h:panelGroup>
+ <fieldset>
+ <legend><b>Details of usage</b></legend>
+ <p>
+ In order to get or change current filtering value <b>filterValue </b>attribute
+ provided. It should be defined with initial filtering value on the page
+ or as value binding to get/change it on server.
+ </p>
+ <p>
+ This is built-in feature. It uses "<b>startsWith</b>" function to make filtering.
+ </p>
+ <p>
+ If <b>filterBy </b>attribute set - column will render default inputs with
+ default filtering behaviour
+ </p>
+ <p>
+ In order to change default filtering behaviour - another definition used.
+ An example shown at second tab("External Filtering")
+ </p>
+ </fieldset>
+ </h:panelGroup>
+ </h:panelGrid>
</ui:define>
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature.xhtml 2008-03-26 17:27:27 UTC (rev 7272)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature.xhtml 2008-03-26 17:42:39 UTC (rev 7273)
@@ -11,9 +11,9 @@
<rich:tab label="Built-In Filtering Usage">
<ui:include src="/richfaces/filteringFeature/filteringUsage.xhtml"/>
</rich:tab>
- <ui:include src="/templates/include/tagInfo.xhtml">
- <ui:param name="path" value="rich/filtering"/>
- </ui:include>
+ <rich:tab label="External Filtering Usage">
+ <ui:include src="/richfaces/filteringFeature/externalFilteringUsage.xhtml"/>
+ </rich:tab>
</rich:tabPanel>
</ui:define>
</ui:composition>
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/inplaceInput/examples/controlsCustomization.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/inplaceInput/examples/controlsCustomization.xhtml 2008-03-26 17:27:27 UTC (rev 7272)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/inplaceInput/examples/controlsCustomization.xhtml 2008-03-26 17:42:39 UTC (rev 7273)
@@ -17,5 +17,4 @@
</rich:inplaceInput>
- <rich:spacer width="100%" height="40px" />
</ui:composition>
\ No newline at end of file
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/sortingFeature/sortingUsage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/sortingFeature/sortingUsage.xhtml 2008-03-26 17:27:27 UTC (rev 7272)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/sortingFeature/sortingUsage.xhtml 2008-03-26 17:42:39 UTC (rev 7273)
@@ -9,7 +9,7 @@
<p><b>
Rich Data Table</b> has columns <b>sorting feature</b> built-in. Simplest way to add sorting
- capability is to define <b>sortBy </b>attribute at column you need to be sorted.
+ capability is to define <b>sortBy </b>attribute at column you need to be sortable.
</p>
<p>
In this attribute you should define iterable object property which should be
16 years, 9 months
JBoss Rich Faces SVN: r7272 - trunk/ui/dataTable/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-03-26 13:27:27 -0400 (Wed, 26 Mar 2008)
New Revision: 7272
Modified:
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
Log:
RF-2779
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-03-26 17:20:05 UTC (rev 7271)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-03-26 17:27:27 UTC (rev 7272)
@@ -590,7 +590,7 @@
org.richfaces.component.UIColumn col =
(org.richfaces.component.UIColumn) column;
if (sortableColumn) {
- String imageUrl;
+ String imageUrl = null;
if (Ordering.ASCENDING.equals(col.getSortOrder())) {
if (null != col.getSortIconAscending()) {
imageUrl = col.getSortIconAscending();
@@ -603,7 +603,7 @@
} else {
imageUrl = getResource(TriangleIconDown.class.getName()).getUri(context, null);
}
- } else {
+ } else if (col.isSelfSorted()) {
if (null != col.getSortIcon()) {
imageUrl = col.getSortIcon();
} else {
@@ -611,13 +611,18 @@
}
}
- writer.startElement(HTML.IMG_ELEMENT, column);
- writer.writeAttribute(HTML.src_ATTRIBUTE, imageUrl, null);
- writer.writeAttribute(HTML.width_ATTRIBUTE, "15", null);
- writer.writeAttribute(HTML.height_ATTRIBUTE, "15", null);
- writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-table-header-sort-img", null);
- writer.endElement(HTML.IMG_ELEMENT);
-
+ if (imageUrl != null) {
+ writer.startElement(HTML.IMG_ELEMENT, column);
+ writer.writeAttribute(HTML.src_ATTRIBUTE, imageUrl,
+ null);
+ writer.writeAttribute(HTML.width_ATTRIBUTE, "15", null);
+ writer
+ .writeAttribute(HTML.height_ATTRIBUTE, "15",
+ null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE,
+ "dr-table-header-sort-img", null);
+ writer.endElement(HTML.IMG_ELEMENT);
+ }
writer.endElement(HTML.SPAN_ELEM);
}
16 years, 9 months
JBoss Rich Faces SVN: r7271 - trunk/ui/dataTable/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-03-26 13:20:05 -0400 (Wed, 26 Mar 2008)
New Revision: 7271
Modified:
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
Log:
RF-2778
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-03-26 17:17:27 UTC (rev 7270)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-03-26 17:20:05 UTC (rev 7271)
@@ -331,12 +331,14 @@
public boolean evaluate(Object input) {
UIComponent component = (UIComponent) input;
// accept only columns with corresponding facets.
- if (component instanceof Column || component instanceof UIColumn) {
- return component.isRendered()&&(component.getFacet(name) != null);
+ boolean ret = component.isRendered()&&(component.getFacet(name) != null);
+ if (!ret && component instanceof Column) {
+ Column column = (Column)component;
+ ret = column.isSelfSorted() || (column.getFilterMethod() == null
+ && component.getValueExpression("filterExpression") == null
+ && component.getValueExpression("filterBy") != null);
}
- else{
- return false;
- }
+ return ret;
}});
}
16 years, 9 months
JBoss Rich Faces SVN: r7270 - trunk/docs/faq/en/src/main/docbook/module.
by richfaces-svn-commits@lists.jboss.org
Author: vsukhov
Date: 2008-03-26 13:17:27 -0400 (Wed, 26 Mar 2008)
New Revision: 7270
Modified:
trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml
Log:
http://jira.jboss.com/jira/browse/RF-2720 I've added some info about JS Scripts Conflict into the FAQ.
Modified: trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml
===================================================================
--- trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml 2008-03-26 17:10:49 UTC (rev 7269)
+++ trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml 2008-03-26 17:17:27 UTC (rev 7270)
@@ -2263,4 +2263,14 @@
</web-app>
]]></programlisting>
</section>
+ <section>
+ <?dbhtml filename="WhydoesJSScriptsconflict.html"?>
+ <title>Why does J scripts conflict?</title>
+ <para>Richfaces 3.1.3 uses 1.6.0 version of prototype.js script instead of 1.5.1
+ that's been used for earlier versions. There are 2 prototype versions included
+ (the first included implicitly as a dependency of toggle panel components and
+ the second one included explicitly as a link). Versions conflict is the cause of the problem.</para>
+ <para>The solution of this problem is in upgrading jQuery.js to 1.2.3 version and prototype.js to 1.6.0.2 version.
+ </para>
+ </section>
</chapter>
16 years, 9 months
JBoss Rich Faces SVN: r7269 - in trunk: ui/calendar/src/test/java/org/richfaces/component and 9 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2008-03-26 13:10:49 -0400 (Wed, 26 Mar 2008)
New Revision: 7269
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/HeaderResourcesRendererBase.java
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
trunk/ui/calendar/src/test/java/org/richfaces/component/CalendarComponentTest.java
trunk/ui/listShuttle/src/test/java/org/richfaces/component/ListShuttleComponentTest.java
trunk/ui/listShuttle/src/test/java/org/richfaces/renderkit/ListShuttleRenderingTest.java
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererDelegate.java
trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuGroupComponentTest.java
trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java
trunk/ui/menu-components/src/test/java/org/richfaces/renderkit/html/MenuItemRendererBaseTest.java
trunk/ui/message/src/test/java/org/richfaces/renderer/RichMessagesRendererTest.java
trunk/ui/orderingList/src/test/java/org/richfaces/renderkit/OrderingListRenderingTest.java
trunk/ui/tabPanel/src/main/java/org/richfaces/renderkit/TabPanelRendererBase.java
trunk/ui/tabPanel/src/main/templates/tabPanel.jspx
Log:
http://jira.jboss.com/jira/browse/RF-2726
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/HeaderResourcesRendererBase.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/HeaderResourcesRendererBase.java 2008-03-26 17:09:56 UTC (rev 7268)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/HeaderResourcesRendererBase.java 2008-03-26 17:10:49 UTC (rev 7269)
@@ -119,7 +119,7 @@
// Filter not used - encode scripts and CSS before component.
ExternalContext externalContext = context.getExternalContext();
String scriptStrategy = externalContext
- .getInitParameter(InternetResourceBuilder.LOAD_STYLE_STRATEGY_PARAM);
+ .getInitParameter(InternetResourceBuilder.LOAD_SCRIPT_STRATEGY_PARAM);
if (null == scriptStrategy || !InternetResourceBuilder.LOAD_NONE.equals(scriptStrategy)) {
encodeResourcesArray(context, component, getScripts());
}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2008-03-26 17:09:56 UTC (rev 7268)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2008-03-26 17:10:49 UTC (rev 7269)
@@ -239,6 +239,7 @@
public static final String SPAN_ELEM = "span";
public static final String DIV_ELEM = "div";
public static final String SCRIPT_ELEM = "script";
+ public static final String LINK_ELEMENT = "link";
public static final String STYLE_CLASS_ATTR = "styleClass";
public static final String DISABLED_ATTR = "disabled";
public static final String TYPE_ATTR = "type";
@@ -264,12 +265,16 @@
public static final String HTML_ELEMENT = "html";
public static final String HEAD_ELEMENT = "head";
public static final String BODY_ELEMENT = "body";
+ public static final String TABLE_ELEMENT = "table";
public static final String TR_ELEMENT = "tr";
public static final String CAPTION_ELEMENT = "caption";
public static final String TBOBY_ELEMENT = "tbody";
public static final String THEAD_ELEMENT = "thead";
public static final String TFOOT_ELEMENT = "tfoot";
public static final String IMG_ELEMENT = "img";
+
+ public static final String DT_ELEMENT = "dt";
+ public static final String DL_ELEMENT = "dl";
}
/**
Modified: trunk/ui/calendar/src/test/java/org/richfaces/component/CalendarComponentTest.java
===================================================================
--- trunk/ui/calendar/src/test/java/org/richfaces/component/CalendarComponentTest.java 2008-03-26 17:09:56 UTC (rev 7268)
+++ trunk/ui/calendar/src/test/java/org/richfaces/component/CalendarComponentTest.java 2008-03-26 17:10:49 UTC (rev 7269)
@@ -15,13 +15,13 @@
import javax.faces.component.UIComponent;
import javax.faces.component.html.HtmlForm;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
import org.apache.commons.lang.StringUtils;
import com.gargoylesoftware.htmlunit.ElementNotFoundException;
import com.gargoylesoftware.htmlunit.html.HtmlButton;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlImage;
import com.gargoylesoftware.htmlunit.html.HtmlInput;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlScript;
@@ -73,11 +73,8 @@
.createComponent(UICalendar.COMPONENT_TYPE);
calendar.setLocale(Locale.UK);
calendar.setDatePattern("d/MM/yyyy");
- calendar.setTimeZone(TimeZone.getTimeZone("GMT+10:00"));
- /*
- * String[] strarr = TimeZone.getAvailableIDs(); for(int i=0; i <
- * strarr.length; i++){ System.out.println(strarr[i]); }
- */
+ calendar.setTimeZone(TimeZone.getTimeZone("GMT-4:00"));
+
calendar.setButtonLabel("PopUp");
// XXX test popup false
// XXX test CurrentDate = null
@@ -176,7 +173,6 @@
HtmlPage page = renderView();
assertNotNull(page);
- //System.out.println(page.asXml());
HtmlElement htmlSpan = page.getHtmlElementById(calendar.getClientId(facesContext)+"Popup");
assertNotNull(htmlSpan);
@@ -199,7 +195,7 @@
HtmlElement htmlCalendar1Span = page.getHtmlElementById(calendar1
.getClientId(facesContext)+"Popup");
assertNotNull(htmlCalendar1Span);
- assertEquals("display: none", htmlCalendar1Span.getAttributeValue("style"));
+ assertEquals("display: none", htmlCalendar1Span.getAttributeValue(HTML.style_ATTRIBUTE));
try {
HtmlInput htmlCalendarInput1 = (HtmlInput) page
@@ -223,7 +219,6 @@
} catch (ElementNotFoundException e) {
assertNotNull(e);
}
- //System.out.println(page.asXml());
}
public void testCalendarDecode() throws Exception {
@@ -241,24 +236,23 @@
public void testCalendarStyles() throws Exception {
HtmlPage page = renderView();
assertNotNull(page);
- //System.out.println(page.asXml());
- List links = page.getDocumentElement().getHtmlElementsByTagName("link");
+
+ List links = page.getDocumentHtmlElement().getHtmlElementsByTagName(HTML.LINK_ELEMENT);
assertEquals(1, links.size());
HtmlElement link = (HtmlElement) links.get(0);
- assertTrue(link.getAttributeValue("href").contains("css/calendar.xcss"));
+ assertTrue(link.getAttributeValue(HTML.HREF_ATTR).contains("css/calendar.xcss"));
}
public void testCalendarScrits() throws Exception {
HtmlPage page = renderView();
assertNotNull(page);
- List scripts = page.getDocumentElement().getHtmlElementsByTagName(
- "script");
- for (Iterator it = scripts.iterator(); it.hasNext();) {
- HtmlScript item = (HtmlScript) it.next();
+ List<HtmlScript> scripts = page.getDocumentHtmlElement().getHtmlElementsByTagName(HTML.SCRIPT_ELEM);
+ for (Iterator<HtmlScript> it = scripts.iterator(); it.hasNext();) {
+ HtmlScript item = it.next();
String srcAttr = item.getSrcAttribute();
- if (item.getFirstChild() != null) {
- String scriptBodyString = item.getFirstChild().toString();
+ if (item.getFirstDomChild() != null) {
+ String scriptBodyString = item.getFirstDomChild().toString();
if (scriptBodyString.contains("new Calendar")&&scriptBodyString.contains("form:calendar")) {
assertTrue(scriptBodyString.contains("datePattern"));
@@ -276,8 +270,8 @@
if (StringUtils.isNotBlank(srcAttr)) {
boolean found = false;
- for (Iterator srcIt = javaScripts.iterator(); srcIt.hasNext();) {
- String src = (String) srcIt.next();
+ for (Iterator<String> srcIt = javaScripts.iterator(); srcIt.hasNext();) {
+ String src = srcIt.next();
found = srcAttr.contains(src);
if (found) {
break;
@@ -289,11 +283,9 @@
}
public void testCalendarTime() throws Exception{
-
- Date time = (Date) calendar2.getValue();
Calendar calendarObject = Calendar.getInstance();
calendarObject.set(2001, Calendar.SEPTEMBER, 11, 13, 36);
- assertEquals(calendarObject.getTime(), calendar2.getSubmittedValue());
+ assertEquals(0, calendarObject.getTime().compareTo((Date)calendar2.getSubmittedValue()));
}
Modified: trunk/ui/listShuttle/src/test/java/org/richfaces/component/ListShuttleComponentTest.java
===================================================================
--- trunk/ui/listShuttle/src/test/java/org/richfaces/component/ListShuttleComponentTest.java 2008-03-26 17:09:56 UTC (rev 7268)
+++ trunk/ui/listShuttle/src/test/java/org/richfaces/component/ListShuttleComponentTest.java 2008-03-26 17:10:49 UTC (rev 7269)
@@ -112,11 +112,6 @@
* @throws Exception
*/
public void testDecode() throws Exception {
- HtmlPage view = renderView();
- assertNotNull(view);
-
- HtmlAnchor anchor = (HtmlAnchor)view.getDocumentElement().getHtmlElementById(command.getClientId(facesContext));
- anchor.click();
externalContext.addRequestParameterMap(listShuttle.getClientId(facesContext), "sa1:2");
externalContext.addRequestParameterMap(listShuttle.getClientId(facesContext), "0:1");
externalContext.addRequestParameterMap(listShuttle.getClientId(facesContext), ":");
Modified: trunk/ui/listShuttle/src/test/java/org/richfaces/renderkit/ListShuttleRenderingTest.java
===================================================================
--- trunk/ui/listShuttle/src/test/java/org/richfaces/renderkit/ListShuttleRenderingTest.java 2008-03-26 17:09:56 UTC (rev 7268)
+++ trunk/ui/listShuttle/src/test/java/org/richfaces/renderkit/ListShuttleRenderingTest.java 2008-03-26 17:10:49 UTC (rev 7269)
@@ -33,6 +33,7 @@
import javax.faces.component.html.HtmlOutputText;
import javax.servlet.http.HttpServletResponse;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.resource.InternetResource;
import org.ajax4jsf.resource.InternetResourceBuilder;
import org.ajax4jsf.resource.ResourceBuilderImpl;
@@ -51,14 +52,14 @@
private UIListShuttle listShuttle = null;
private UIForm form = null;
- private List items = null;
+ private List<SimpleItem> items = null;
private HtmlOutputText output1 = null;
private HtmlOutputText output2 = null;
private UIColumn column1 = null;
private UIColumn column2 = null;
- private static final Set javaScripts = new HashSet();
- private static final Set imageClasses = new HashSet();
+ private static final Set<String> javaScripts = new HashSet<String>();
+ private static final Set<String> imageClasses = new HashSet<String>();
static {
javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
@@ -114,7 +115,7 @@
listShuttle.setId("listShuttle");
listShuttle.setVar("item");
- items = new ArrayList();
+ items = new ArrayList<SimpleItem>();
items.add(new SimpleItem("Michael", 2000));
items.add(new SimpleItem("John", 500));
items.add(new SimpleItem("George", 4000));
@@ -159,46 +160,49 @@
HtmlElement table = view.getHtmlElementById(listShuttle.getClientId(facesContext));
assertNotNull(table);
- assertEquals("table", table.getNodeName());
+ assertEquals(HTML.TABLE_ELEMENT, table.getNodeName());
- HtmlElement tbody = (HtmlElement) table.getFirstChild();
+ HtmlElement tbody = (HtmlElement) table.getFirstDomChild();
assertNotNull(tbody);
- assertEquals("tbody", tbody.getTagName());
+ assertEquals(HTML.TBOBY_ELEMENT, tbody.getTagName());
- HtmlElement tr = (HtmlElement) tbody.getFirstChild();
+ HtmlElement tr = (HtmlElement) tbody.getFirstDomChild();
assertNotNull(tr);
- String style = tr.getAttributeValue("style");
+ String style = tr.getAttributeValue(HTML.style_ATTRIBUTE);
assertNotNull(style);
assertTrue(style.contains("display: none;"));
- assertEquals("tr", tr.getTagName());
+ assertEquals(HTML.TR_ELEMENT, tr.getTagName());
- tr = (HtmlElement) tr.getNextSibling();
+ tr = (HtmlElement) tr.getNextDomSibling();
assertNotNull(tr);
- assertNull(tr.getNextSibling());
+ assertNull(tr.getNextDomSibling());
int childCount = 0;
- for (Iterator it = tr.getChildIterator(); it.hasNext();) {
- HtmlElement td = (HtmlElement) it.next();
+ for (Iterator<HtmlElement> it = tr.getChildIterator(); it.hasNext();) {
+ HtmlElement td = it.next();
assertNotNull(td);
- assertEquals("td", td.getTagName());
+ assertEquals(HTML.td_ELEM, td.getTagName());
childCount++;
}
assertEquals(4, childCount);
HtmlElement hidden1 = view.getHtmlElementById(listShuttle.getClientId(facesContext) + "focusKeeper");
assertNotNull(hidden1);
- assertEquals("input", hidden1.getNodeName());
- assertEquals("button", hidden1.getAttributeValue("type"));
- hidden1.getAttributeValue("style").contains("left: -32767px");
+ assertEquals(HTML.INPUT_ELEM, hidden1.getNodeName());
+ assertEquals(HTML.BUTTON, hidden1.getAttributeValue(HTML.TYPE_ATTR));
+ hidden1.getAttributeValue(HTML.style_ATTRIBUTE).contains("left: -32767px");
- List inputs = view.getDocumentElement().getHtmlElementsByAttribute("input", "id", listShuttle.getClientId(facesContext) + "focusKeeper");
+ List<HtmlElement> inputs = view.getDocumentHtmlElement().
+ getHtmlElementsByAttribute(HTML.INPUT_ELEM, HTML.id_ATTRIBUTE, listShuttle.getClientId(facesContext) + "focusKeeper");
assertNotNull(inputs);
assertEquals(1, inputs.size());
- inputs = view.getDocumentElement().getHtmlElementsByAttribute("input", "id", listShuttle.getClientId(facesContext) + "tlFocusKeeper");
+ inputs = view.getDocumentHtmlElement().
+ getHtmlElementsByAttribute(HTML.INPUT_ELEM, HTML.id_ATTRIBUTE, listShuttle.getClientId(facesContext) + "tlFocusKeeper");
assertNotNull(inputs);
assertEquals(1, inputs.size());
- inputs = view.getDocumentElement().getHtmlElementsByAttribute("input", "name", listShuttle.getClientId(facesContext));
+ inputs = view.getDocumentHtmlElement().
+ getHtmlElementsByAttribute(HTML.INPUT_ELEM, HTML.NAME_ATTRIBUTE, listShuttle.getClientId(facesContext));
assertNotNull(inputs);
assertEquals(4, inputs.size());
}
@@ -211,15 +215,15 @@
public void testRenderScript() throws Exception {
HtmlPage view = renderView();
assertNotNull(view);
- List scripts = view.getDocumentElement().getHtmlElementsByTagName("script");
+ List<HtmlScript> scripts = view.getDocumentHtmlElement().getHtmlElementsByTagName(HTML.SCRIPT_ELEM);
int foundCount = 0;
- for (Iterator it = scripts.iterator(); it.hasNext();) {
- HtmlScript item = (HtmlScript) it.next();
+ for (Iterator<HtmlScript> it = scripts.iterator(); it.hasNext();) {
+ HtmlScript item = it.next();
String srcAttr = item.getSrcAttribute();
if (StringUtils.isNotBlank(srcAttr)) {
boolean found = false;
- for (Iterator srcIt = javaScripts.iterator(); srcIt.hasNext();) {
+ for (Iterator<String> srcIt = javaScripts.iterator(); srcIt.hasNext();) {
String src = (String) srcIt.next();
found = srcAttr.contains(src);
@@ -249,13 +253,13 @@
public void testRenderStyle() throws Exception {
HtmlPage view = renderView();
assertNotNull(view);
- List links = view.getDocumentElement().getHtmlElementsByTagName("link");
+ List<HtmlElement> links = view.getDocumentElement().getHtmlElementsByTagName(HTML.LINK_ELEMENT);
assertNotNull(links);
assertEquals(1, links.size());
- HtmlElement link = (HtmlElement) links.get(0);
- assertTrue(link.getAttributeValue("href").contains("css/listShuttle.xcss"));
+ HtmlElement link = links.get(0);
+ assertTrue(link.getAttributeValue(HTML.HREF_ATTR).contains("css/listShuttle.xcss"));
- String uri = "http:" + link.getAttributeValue("href");
+ String uri = "http:" + link.getAttributeValue(HTML.HREF_ATTR);
Page page = webClient.getPage(uri);
assertNotNull(page);
assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
@@ -270,15 +274,15 @@
HtmlPage view = renderView();
assertNotNull(view);
- List images = view.getDocumentElement().getHtmlElementsByTagName("img");
+ List<HtmlElement> images = view.getDocumentHtmlElement().getHtmlElementsByTagName(HTML.IMG_ELEMENT);
assertNotNull(images);
int foundImages = 0;
- for (Iterator it = images.iterator(); it.hasNext(); ) {
- HtmlElement img = (HtmlElement) it.next();
+ for (Iterator<HtmlElement> it = images.iterator(); it.hasNext(); ) {
+ HtmlElement img = it.next();
assertNotNull(img);
- String uri = "http:" + img.getAttributeValue("src");
+ String uri = "http:" + img.getAttributeValue(HTML.src_ATTRIBUTE);
Page page = webClient.getPage(uri);
assertNotNull(page);
assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
@@ -288,26 +292,23 @@
}
foundImages++;
- HtmlElement element = (HtmlElement) img.getParentNode();
+ HtmlElement element = (HtmlElement) img.getParentDomNode();
assertNotNull(element);
- assertEquals("div", element.getNodeName());
+ assertEquals(HTML.DIV_ELEM, element.getNodeName());
- element = (HtmlElement) element.getParentNode();
+ element = (HtmlElement) element.getParentDomNode();
assertNotNull(element);
- assertEquals("a", element.getNodeName());
- element = (HtmlElement) element.getParentNode();
- assertNotNull(element);
- if ("a".equalsIgnoreCase(element.getNodeName())) {
- element = (HtmlElement) element.getParentNode();
+ if (HTML.a_ELEMENT.equalsIgnoreCase(element.getNodeName())) {
+ element = (HtmlElement) element.getParentDomNode();
assertNotNull(element);
}
- assertEquals("div", element.getNodeName());
+ assertEquals(HTML.DIV_ELEM, element.getNodeName());
- element = (HtmlElement) element.getParentNode();
+ element = (HtmlElement) element.getParentDomNode();
assertNotNull(element);
- assertEquals("div", element.getNodeName());
- String clazz = element.getAttributeValue("class");
+ assertEquals(HTML.DIV_ELEM, element.getNodeName());
+ String clazz = element.getAttributeValue(HTML.class_ATTRIBUTE);
assertNotNull(clazz);
assertTrue(clazz.contains("rich-shuttle-control"));
}
@@ -325,8 +326,8 @@
InternetResourceBuilder builder = ResourceBuilderImpl.getInstance();
- for (Iterator it = imageClasses.iterator(); it.hasNext(); ) {
- String clazz = (String) it.next();
+ for (Iterator<String> it = imageClasses.iterator(); it.hasNext(); ) {
+ String clazz = it.next();
builder.createResource(null, clazz);
InternetResource resource = builder.getResource(clazz);
assertNotNull(resource);
@@ -354,33 +355,33 @@
HtmlElement div = view.getHtmlElementById(listShuttle.getClientId(facesContext) + "contentBox");
assertNotNull(div);
- assertEquals("div", div.getNodeName());
+ assertEquals(HTML.DIV_ELEM, div.getNodeName());
- HtmlElement table = (HtmlElement)div.getFirstChild();
+ HtmlElement table = (HtmlElement)div.getFirstDomChild();
assertNotNull(table);
- assertEquals("table", table.getNodeName());
+ assertEquals(HTML.TABLE_ELEMENT, table.getNodeName());
- HtmlElement tbody = (HtmlElement)table.getFirstChild();
+ HtmlElement tbody = (HtmlElement)table.getFirstDomChild();
assertNotNull(tbody);
- assertEquals("tbody", tbody.getNodeName());
+ assertEquals(HTML.TBOBY_ELEMENT, tbody.getNodeName());
int rowsCount = 0;
- for (Iterator it = tbody.getChildIterator(); it.hasNext(); ) {
- HtmlElement tr = (HtmlElement)it.next();
+ for (Iterator<HtmlElement> it = tbody.getChildIterator(); it.hasNext(); ) {
+ HtmlElement tr = it.next();
assertNotNull(tr);
- assertEquals("tr", tr.getNodeName());
+ assertEquals(HTML.TR_ELEMENT, tr.getNodeName());
- String clazz = tr.getAttributeValue("class");
+ String clazz = tr.getAttributeValue(HTML.class_ATTRIBUTE);
assertNotNull(clazz);
assertTrue(clazz.contains("rich-shuttle-source-row"));
int cellsCount = 0;
- for (Iterator it2 = tr.getChildIterator(); it2.hasNext(); ) {
- HtmlElement td = (HtmlElement)it2.next();
+ for (Iterator<HtmlElement> it2 = tr.getChildIterator(); it2.hasNext(); ) {
+ HtmlElement td = it2.next();
assertNotNull(td);
- assertEquals("td", td.getNodeName());
+ assertEquals(HTML.td_ELEM, td.getNodeName());
- String clazz2 = td.getAttributeValue("class");
+ String clazz2 = td.getAttributeValue(HTML.class_ATTRIBUTE);
assertNotNull(clazz2);
assertTrue(clazz2.contains("rich-shuttle-source-cell"));
Modified: trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererDelegate.java
===================================================================
--- trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererDelegate.java 2008-03-26 17:09:56 UTC (rev 7268)
+++ trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererDelegate.java 2008-03-26 17:10:49 UTC (rev 7269)
@@ -40,7 +40,7 @@
Object selectItemClass = parentMenu.getAttributes().get("selectItemClass");
Object selectClass = menuItem.getAttributes().get("selectClass");
Object styleClass = menuItem.getAttributes().get("styleClass");
- Object style = parentMenu.getAttributes().get("style");
+ Object style = menuItem.getAttributes().get("style");
Object labelClass = (String)menuItem.getAttributes().get("labelClass");
Object disabledLabelClass = (String)menuItem.getAttributes().get("labelClass");
Object selectedLabelClass = (String)menuItem.getAttributes().get("labelClass");
Modified: trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuGroupComponentTest.java
===================================================================
--- trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuGroupComponentTest.java 2008-03-26 17:09:56 UTC (rev 7268)
+++ trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuGroupComponentTest.java 2008-03-26 17:10:49 UTC (rev 7269)
@@ -32,6 +32,7 @@
import javax.faces.component.html.HtmlOutputText;
import javax.servlet.http.HttpServletResponse;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.resource.InternetResource;
import org.ajax4jsf.resource.InternetResourceBuilder;
import org.ajax4jsf.resource.ResourceBuilderImpl;
@@ -114,10 +115,10 @@
public void testMenuGroupRender() throws Exception {
HtmlPage page = renderView();
assertNotNull(page);
- // System.out.println(page.asXml());
+
HtmlElement div = page.getHtmlElementById(menuGroup.getClientId(facesContext));
assertNotNull(div);
- assertEquals("div", div.getNodeName());
+ assertEquals(HTML.DIV_ELEM, div.getNodeName());
}
@@ -129,13 +130,12 @@
menuGroup.getFacets().clear();
menuGroup.getAttributes().put("icon", "menuGroupIcon");
HtmlPage page = renderView();
- // System.out.println(page.asXml());
+
assertNotNull(page);
- HtmlElement span = page.getHtmlElementById("ref"
- + menuGroup.getClientId(facesContext) + ":icon");
+ HtmlElement span = page.getHtmlElementById(menuGroup.getClientId(facesContext) + ":icon");
assertNotNull(span);
- assertEquals("span", span.getNodeName());
- List images = span.getHtmlElementsByTagName("img");
+ assertEquals(HTML.SPAN_ELEM, span.getNodeName());
+ List<HtmlElement> images = span.getHtmlElementsByTagName(HTML.IMG_ELEMENT);
assertNotNull(images);
assertEquals(1, images.size());
}
@@ -147,13 +147,12 @@
menuGroup.setDisabled(true);
menuGroup.getAttributes().put("iconDisabled", "menuGroupIcon");
HtmlPage page = renderView();
- // System.out.println(page.asXml());
+
assertNotNull(page);
- HtmlElement span = page.getHtmlElementById("ref"
- + menuGroup.getClientId(facesContext) + ":icon");
- assertEquals("span", span.getNodeName());
+ HtmlElement span = page.getHtmlElementById(menuGroup.getClientId(facesContext) + ":icon");
+ assertEquals(HTML.SPAN_ELEM, span.getNodeName());
assertNotNull(span);
- List images = span.getHtmlElementsByTagName("img");
+ List<HtmlElement> images = span.getHtmlElementsByTagName(HTML.IMG_ELEMENT);
assertNotNull(images);
assertEquals(1, images.size());
}
@@ -165,10 +164,9 @@
menuGroup.getFacets().put("icon", facet);
HtmlPage page = renderView();
assertNotNull(page);
- // System.out.println(page.asXml());
- HtmlElement span = page.getHtmlElementById("ref"
- + menuGroup.getClientId(facesContext) + ":icon");
- assertEquals("span", span.getNodeName());
+
+ HtmlElement span = page.getHtmlElementById(menuGroup.getClientId(facesContext) + ":icon");
+ assertEquals(HTML.SPAN_ELEM, span.getNodeName());
assertNotNull(span);
}
@@ -179,10 +177,9 @@
menuGroup.getFacets().put("iconDisabled", facet);
HtmlPage page = renderView();
assertNotNull(page);
- // System.out.println(page.asXml());
- HtmlElement span = page.getHtmlElementById("ref"
- + menuGroup.getClientId(facesContext) + ":icon");
- assertEquals("span", span.getNodeName());
+
+ HtmlElement span = page.getHtmlElementById(menuGroup.getClientId(facesContext) + ":icon");
+ assertEquals(HTML.SPAN_ELEM, span.getNodeName());
assertNotNull(span);
}
@@ -190,22 +187,20 @@
menuGroup.setDisabled(true);
HtmlPage page = renderView();
assertNotNull(page);
- // System.out.println(page.asXml());
- HtmlElement span = page.getHtmlElementById("ref"
- + menuGroup.getClientId(facesContext) + ":icon");
+
+ HtmlElement span = page.getHtmlElementById(menuGroup.getClientId(facesContext) + ":icon");
assertNotNull(span);
- assertEquals("span", span.getNodeName());
- String classAttr = span.getAttributeValue("class");
- assertTrue(classAttr
- .contains("dr-menu-icon rich-menu-item-icon-disabled"));
+ assertEquals(HTML.SPAN_ELEM, span.getNodeName());
+ String classAttr = span.getAttributeValue(HTML.class_ATTRIBUTE);
- HtmlElement div = page.getHtmlElementById("ref"
- + menuGroup.getClientId(facesContext));
+ HtmlElement div = page.getHtmlElementById(menuGroup.getClientId(facesContext));
assertNotNull(div);
- assertEquals("div", div.getNodeName());
- classAttr = div.getAttributeValue("class");
- assertTrue(classAttr
- .contains("dr-menu-item dr-menu-item-disabled rich-menu-group-disabled rich-menu-group"));
+ assertEquals(HTML.DIV_ELEM, div.getNodeName());
+ classAttr = div.getAttributeValue(HTML.class_ATTRIBUTE);
+ assertTrue(classAttr.contains("dr-menu-item"));
+ assertTrue(classAttr.contains("dr-menu-item-disabled"));
+ assertTrue(classAttr.contains("rich-menu-group-disabled"));
+ assertTrue(classAttr.contains("rich-menu-group"));
}
@@ -214,48 +209,47 @@
menuGroup.getAttributes().put("iconClass", "iconClass");
HtmlPage page = renderView();
assertNotNull(page);
- // System.out.println(page.asXml());
- HtmlElement anchor = page.getHtmlElementById("ref"
- + menuGroup.getClientId(facesContext) + ":anchor");
+
+ HtmlElement anchor = page.getHtmlElementById(menuGroup.getClientId(facesContext) + ":anchor");
assertNotNull(anchor);
- assertEquals("span", anchor.getNodeName());
- String classAttr = anchor.getAttributeValue("class");
+ assertEquals(HTML.SPAN_ELEM, anchor.getNodeName());
+ String classAttr = anchor.getAttributeValue(HTML.class_ATTRIBUTE);
assertTrue(classAttr.contains("rich-menu-item-label"));
- HtmlElement span = page.getHtmlElementById("ref"
- + menuGroup.getClientId(facesContext) + ":icon");
+ HtmlElement span = page.getHtmlElementById(menuGroup.getClientId(facesContext) + ":icon");
assertNotNull(span);
- assertEquals("span", span.getNodeName());
- classAttr = span.getAttributeValue("class");
- assertTrue(classAttr.contains("dr-menu-icon rich-menu-item-icon"));
+ assertEquals(HTML.SPAN_ELEM, span.getNodeName());
+ classAttr = span.getAttributeValue(HTML.class_ATTRIBUTE);
+ assertTrue(classAttr.contains("dr-menu-icon"));
+ assertTrue(classAttr.contains("rich-menu-item-icon"));
assertTrue(classAttr.contains((String) menuGroup.getAttributes().get(
"iconClass")));
- HtmlElement div = page.getHtmlElementById("ref"
- + menuGroup.getClientId(facesContext));
+ HtmlElement div = page.getHtmlElementById(menuGroup.getClientId(facesContext));
assertNotNull(div);
- assertEquals("div", div.getNodeName());
- classAttr = div.getAttributeValue("class");
+ assertEquals(HTML.DIV_ELEM, div.getNodeName());
+ classAttr = div.getAttributeValue(HTML.class_ATTRIBUTE);
assertTrue(classAttr
.contains("dr-menu-item dr-menu-item-enabled rich-menu-group"));
- div = page.getHtmlElementById("ref"
- + menuGroup.getClientId(facesContext) + ":folder");
+ div = page.getHtmlElementById(menuGroup.getClientId(facesContext) + ":folder");
assertNotNull(div);
- assertEquals("div", div.getNodeName());
- classAttr = div.getAttributeValue("class");
- assertTrue(classAttr.contains("dr-menu-node dr-menu-node-icon rich-menu-item-folder"));
+ assertEquals(HTML.DIV_ELEM, div.getNodeName());
+ classAttr = div.getAttributeValue(HTML.class_ATTRIBUTE);
+ assertTrue(classAttr.contains("dr-menu-node"));
+ assertTrue(classAttr.contains("dr-menu-node-icon"));
+ assertTrue(classAttr.contains("rich-menu-item-folder"));
}
public void testRenderStyle() throws Exception {
HtmlPage page = renderView();
assertNotNull(page);
- List links = page.getDocumentElement().getHtmlElementsByTagName("link");
- // Assert.assertEquals(1, links.size());
+ List<HtmlElement> links = page.getDocumentHtmlElement().getHtmlElementsByTagName(HTML.LINK_ELEMENT);
+
assertNotNull(links);
- HtmlElement link = (HtmlElement) links.get(0);
- assertTrue(link.getAttributeValue("href").contains(
+ HtmlElement link = links.get(0);
+ assertTrue(link.getAttributeValue(HTML.HREF_ATTR).contains(
"menucomponents.xcss"));
}
Modified: trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java
===================================================================
--- trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java 2008-03-26 17:09:56 UTC (rev 7268)
+++ trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java 2008-03-26 17:10:49 UTC (rev 7269)
@@ -34,6 +34,7 @@
import javax.servlet.http.HttpServletResponse;
import org.ajax4jsf.event.EventsQueue;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.resource.InternetResource;
import org.ajax4jsf.resource.InternetResourceBuilder;
import org.ajax4jsf.resource.ResourceBuilderImpl;
@@ -123,11 +124,11 @@
menuItem.setSubmitMode(MenuComponent.MODE_NONE);
HtmlPage page = renderView();
assertNotNull(page);
- // System.out.println(page.asXml());
+
HtmlElement div = page.getHtmlElementById(menuItem
.getClientId(facesContext));
assertNotNull(div);
- assertEquals("div", div.getNodeName());
+ assertEquals(HTML.DIV_ELEM, div.getNodeName());
}
/**
@@ -139,11 +140,11 @@
menuItem.getFacets().put("icon", text);
HtmlPage page = renderView();
assertNotNull(page);
- // System.out.println(page.asXml());
+
HtmlElement span = page.getHtmlElementById(menuItem
.getClientId(facesContext)
+ ":icon");
- assertEquals("span", span.getNodeName());
+ assertEquals(HTML.SPAN_ELEM, span.getNodeName());
assertNotNull(span);
}
@@ -156,11 +157,11 @@
menuItem.getFacets().put("iconDisabled", text);
HtmlPage page = renderView();
assertNotNull(page);
- // System.out.println(page.asXml());
+
HtmlElement span = page.getHtmlElementById(menuItem
.getClientId(facesContext)
+ ":icon");
- assertEquals("span", span.getNodeName());
+ assertEquals(HTML.SPAN_ELEM, span.getNodeName());
assertNotNull(span);
}
@@ -172,31 +173,36 @@
menuItem.getAttributes().put("iconDisabled", "menuItemIconDisabled");
HtmlPage page = renderView();
assertNotNull(page);
- // System.out.println(page.asXml());
+
HtmlElement span = page.getHtmlElementById(menuItem
.getClientId(facesContext)
+ ":anchor");
assertNotNull(span);
- assertEquals("span", span.getNodeName());
- String classAttr = span.getAttributeValue("class");
- assertTrue(classAttr
- .contains("rich-menu-item-label rich-menu-item-label-disabled"));
+ assertEquals(HTML.SPAN_ELEM, span.getNodeName());
+ String classAttr = span.getAttributeValue(HTML.class_ATTRIBUTE);
+ assertTrue(classAttr.contains("rich-menu-item-label"));
+ assertTrue(classAttr.contains("rich-menu-item-label-disabled"));
span = page.getHtmlElementById(menuItem.getClientId(facesContext)
+ ":icon");
assertNotNull(span);
- assertEquals("span", span.getNodeName());
- classAttr = span.getAttributeValue("class");
- assertTrue(classAttr
- .contains("dr-menu-icon rich-menu-item-icon dr-menu-icon-disabled rich-menu-item-icon-disabled"));
+ assertEquals(HTML.SPAN_ELEM, span.getNodeName());
+ classAttr = span.getAttributeValue(HTML.class_ATTRIBUTE);
+ assertTrue(classAttr.contains("dr-menu-icon"));
+ assertTrue(classAttr.contains("rich-menu-item-icon"));
+ assertTrue(classAttr.contains("dr-menu-icon-disabled"));
+ assertTrue(classAttr.contains("rich-menu-item-icon-disabled"));
HtmlElement div = page.getHtmlElementById(menuItem
.getClientId(facesContext));
assertNotNull(div);
- assertEquals("div", div.getNodeName());
- classAttr = div.getAttributeValue("class");
- assertTrue(classAttr
- .contains("dr-menu-item dr-menu-item-disabled rich-menu-item rich-menu-item-disabled"));
+ assertEquals(HTML.DIV_ELEM, div.getNodeName());
+ classAttr = div.getAttributeValue(HTML.class_ATTRIBUTE);
+ assertTrue(classAttr.contains("dr-menu-item"));
+ assertTrue(classAttr.contains("dr-menu-item-disabled"));
+ assertTrue(classAttr.contains("rich-menu-item"));
+ assertTrue(classAttr.contains("rich-menu-item-disabled"));
+
classAttr = div.getAttributeValue("onmouseout");
assertEquals(0, classAttr.length());
classAttr = div.getAttributeValue("onmouseover");
@@ -214,36 +220,39 @@
menuItem.getAttributes().put("selectStyle", "menuItemSelectStyle");
HtmlPage page = renderView();
assertNotNull(page);
- // System.out.println(page.asXml());
+
HtmlElement anchor = page.getHtmlElementById(menuItem
.getClientId(facesContext)
+ ":anchor");
assertNotNull(anchor);
- assertEquals("span", anchor.getNodeName());
- String classAttr = anchor.getAttributeValue("class");
+ assertEquals(HTML.SPAN_ELEM, anchor.getNodeName());
+ String classAttr = anchor.getAttributeValue(HTML.class_ATTRIBUTE);
assertTrue(classAttr.contains("rich-menu-item-label"));
HtmlElement span = page.getHtmlElementById(menuItem
.getClientId(facesContext)
+ ":icon");
assertNotNull(span);
- assertEquals("span", span.getNodeName());
- classAttr = span.getAttributeValue("class");
- assertTrue(classAttr.contains("dr-menu-icon rich-menu-item-icon"));
- assertTrue(classAttr.contains((String) menuItem.getAttributes().get(
- "iconClass")));
+ assertEquals(HTML.SPAN_ELEM, span.getNodeName());
+ classAttr = span.getAttributeValue(HTML.class_ATTRIBUTE);
+ assertTrue(classAttr.contains("dr-menu-icon"));
+ assertTrue(classAttr.contains("rich-menu-item-icon"));
+
+ assertTrue(classAttr.contains((String) menuItem.getAttributes().get("iconClass")));
- HtmlElement div = page.getHtmlElementById(menuItem
- .getClientId(facesContext));
+ HtmlElement div = page.getHtmlElementById(menuItem.getClientId(facesContext));
assertNotNull(div);
- assertEquals("div", div.getNodeName());
- classAttr = div.getAttributeValue("class");
- assertTrue(classAttr
- .contains("dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled"));
- classAttr = div.getAttributeValue("onclick");
- assertNotNull(classAttr);
- assertTrue(classAttr.length() > 0);
- classAttr = div.getAttributeValue("onmouseover");
+ assertEquals(HTML.DIV_ELEM, div.getNodeName());
+ classAttr = div.getAttributeValue(HTML.class_ATTRIBUTE);
+ assertTrue(classAttr.contains("dr-menu-item"));
+ assertTrue(classAttr.contains("dr-menu-item-enabled"));
+ assertTrue(classAttr.contains("rich-menu-item"));
+ assertTrue(classAttr.contains("rich-menu-item-enabled"));
+
+ String onclickAttr = div.getAttributeValue(HTML.onclick_ATTRIBUTE);
+ assertNotNull(onclickAttr);
+ assertTrue(onclickAttr.length() > 0);
+ classAttr = div.getAttributeValue(HTML.onmouseover_ATTRIBUTE);
assertTrue(classAttr.contains("menuItemSelectStyle"));
}
@@ -255,14 +264,13 @@
menuItem.getAttributes().put("style", "menuItemStyle");
HtmlPage page = renderView();
assertNotNull(page);
- //System.out.println(page.asXml());
- HtmlElement div = page.getHtmlElementById(menuItem
- .getClientId(facesContext));
+
+ HtmlElement div = page.getHtmlElementById(menuItem.getClientId(facesContext));
assertNotNull(div);
- String classAttr = div.getAttributeValue("onclick");
- assertTrue(classAttr.contains("AJAX"));
- classAttr = div.getAttributeValue("style");
- assertTrue(classAttr.contains("menuItemStyle"));
+ String onclickAttr = div.getAttributeValue(HTML.onclick_ATTRIBUTE);
+ assertTrue(onclickAttr.contains("AJAX"));
+ String styleAttr = div.getAttributeValue(HTML.style_ATTRIBUTE);
+ assertTrue(styleAttr.contains("menuItemStyle"));
}
/**
@@ -272,11 +280,10 @@
menuItem.setSubmitMode(MenuComponent.MODE_NONE);
HtmlPage page = renderView();
assertNotNull(page);
- // System.out.println(page.asXml());
- HtmlElement div = page.getHtmlElementById(menuItem
- .getClientId(facesContext));
+
+ HtmlElement div = page.getHtmlElementById(menuItem.getClientId(facesContext));
assertNotNull(div);
- String classAttr = div.getAttributeValue("onclick");
+ String classAttr = div.getAttributeValue(HTML.onclick_ATTRIBUTE);
assertNotNull(classAttr);
assertTrue(classAttr.length() > 0);
}
@@ -287,12 +294,11 @@
public void testRenderStyle() throws Exception {
HtmlPage page = renderView();
assertNotNull(page);
- List links = page.getDocumentElement().getHtmlElementsByTagName("link");
- // assertEquals(1, links.size());
+ List<HtmlElement> links = page.getDocumentHtmlElement().getHtmlElementsByTagName(HTML.LINK_ELEMENT);
+
assertNotNull(links);
- HtmlElement link = (HtmlElement) links.get(0);
- assertTrue(link.getAttributeValue("href").contains(
- "menucomponents.xcss"));
+ HtmlElement link = links.get(0);
+ assertTrue(link.getAttributeValue(HTML.HREF_ATTR).contains("menucomponents.xcss"));
}
/**
Modified: trunk/ui/menu-components/src/test/java/org/richfaces/renderkit/html/MenuItemRendererBaseTest.java
===================================================================
--- trunk/ui/menu-components/src/test/java/org/richfaces/renderkit/html/MenuItemRendererBaseTest.java 2008-03-26 17:09:56 UTC (rev 7268)
+++ trunk/ui/menu-components/src/test/java/org/richfaces/renderkit/html/MenuItemRendererBaseTest.java 2008-03-26 17:10:49 UTC (rev 7269)
@@ -111,9 +111,10 @@
public void testProcessInlineStylesMethod() throws Exception {
String style = "some style";
String selectStyle = "some select style";
- String result = renderer.processInlineStyles(facesContext, menuItem,
- true);
- assertEquals(result, "");
+ String result = renderer.processInlineStyles(facesContext, menuItem,true);
+
+ assertNotNull(result);
+ assertTrue(result.startsWith("$('menuItem').style.cssText="));
menuItem.getAttributes().put("selectStyle", selectStyle);
result = renderer.processInlineStyles(facesContext, menuItem, false);
Modified: trunk/ui/message/src/test/java/org/richfaces/renderer/RichMessagesRendererTest.java
===================================================================
--- trunk/ui/message/src/test/java/org/richfaces/renderer/RichMessagesRendererTest.java 2008-03-26 17:09:56 UTC (rev 7268)
+++ trunk/ui/message/src/test/java/org/richfaces/renderer/RichMessagesRendererTest.java 2008-03-26 17:10:49 UTC (rev 7269)
@@ -10,6 +10,7 @@
import javax.faces.component.html.HtmlInputText;
import javax.faces.component.html.HtmlOutputText;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
import org.richfaces.component.html.HtmlRichMessages;
@@ -40,27 +41,6 @@
super(name);
}
- public void testRenderStyle() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
- List<HtmlElement> links = page.getDocumentElement().getHtmlElementsByTagName("link");
- assertNotNull(links);
- boolean found = false;
- for (HtmlElement link : links) {
- if (link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/msgs.css")) {
- found = true;
- break;
- }
- }
- assertTrue(found);
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
- messages1 = null;
- messages2 = null;
- }
-
public void setUp() throws Exception {
super.setUp();
@@ -142,6 +122,8 @@
messages2.getFacets().put("fatalMarker", output3);
messages2.getFacets().put("infoMarker", output4);
+ messages1.setTitle("TITLE2");
+
FacesMessage facesMessage = new FacesMessage();
facesMessage.setDetail("TEST detail");
@@ -173,6 +155,27 @@
}
+ public void tearDown() throws Exception {
+ super.tearDown();
+ messages1 = null;
+ messages2 = null;
+ }
+
+ public void testRenderStyle() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ List<HtmlElement> links = page.getDocumentHtmlElement().getHtmlElementsByTagName(HTML.LINK_ELEMENT);
+ assertNotNull(links);
+ boolean found = false;
+ for (HtmlElement link : links) {
+ if (link.getAttributeValue(HTML.HREF_ATTR).contains("org/richfaces/renderkit/html/css/msgs.css")) {
+ found = true;
+ break;
+ }
+ }
+ assertTrue(found);
+ }
+
public void testRendererMessage() throws Exception{
HtmlPage page = renderView();
assertNotNull(page);
@@ -183,95 +186,81 @@
assertNotNull(table);
assertNotNull(dl);
- assertEquals(table.getNodeName().toLowerCase(), "table");
- assertEquals(dl.getNodeName().toLowerCase(), "dl");
+ assertEquals(HTML.TABLE_ELEMENT, table.getNodeName());
+ assertEquals(HTML.DL_ELEMENT, dl.getNodeName());
- String classAttr = table.getAttributeValue("class");
+ String classAttr = table.getAttributeValue(HTML.class_ATTRIBUTE);
assertTrue(classAttr.contains("rich-message"));
- classAttr = dl.getAttributeValue("class");
+ classAttr = dl.getAttributeValue(HTML.class_ATTRIBUTE);
assertTrue(classAttr.contains("rich-message"));
// test rendering component mockup for list layout
- Iterator dtIter= dl.getChildElementsIterator();
+ Iterator<HtmlElement> dtIter= dl.getChildElementsIterator();
for (; dtIter.hasNext();) {
- HtmlElement dt = (HtmlElement) dtIter.next();
+ HtmlElement dt = dtIter.next();
assertNotNull(dt);
- assertEquals(dt.getNodeName().toLowerCase(), "dt");
- classAttr = dt.getAttributeValue("class");
+ assertEquals(dt.getNodeName().toLowerCase(), HTML.DT_ELEMENT);
+ classAttr = dt.getAttributeValue(HTML.class_ATTRIBUTE);
assertTrue(classAttr.contains("errorClass")||classAttr.contains("fatalClass")
||classAttr.contains("warnClass") ||classAttr.contains("infoClass"));
- Iterator spanIter= dt.getChildElementsIterator();
+ Iterator<HtmlElement> spanIter= dt.getChildElementsIterator();
for (; spanIter.hasNext();) {
- HtmlElement span = (HtmlElement) dtIter.next();
+ HtmlElement span = (HtmlElement) spanIter.next();
assertNotNull(span);
- assertEquals(dt.getNodeName().toLowerCase(), "span");
+ assertEquals(HTML.SPAN_ELEM, span.getNodeName());
- classAttr = dt.getAttributeValue("class");
+ classAttr = span.getAttributeValue(HTML.class_ATTRIBUTE);
- assertTrue(classAttr.contains("rich-messages-label") || classAttr.contains("rich-massages-marker"));
+ assertTrue(classAttr.contains("rich-messages-label") || classAttr.contains("rich-messages-marker"));
assertTrue(classAttr.contains("errorLabelClass") || classAttr.contains("infoLabelClass")
|| classAttr.contains("fatalLabelClass") || classAttr.contains("warnLabelClass")
|| classAttr.contains("errorMarkerClass") || classAttr.contains("fatalMarkerClass")
|| classAttr.contains("infoMarkerClass") || classAttr.contains("warnMarkerClass"));
-
- String title = dt.getAttributeValue("title");
-
- assertEquals("TITLTE", title);
}
}
// test rendering component mockup for table layout
- HtmlElement tbody = (HtmlElement)table.getFirstChild();
+ HtmlElement tbody = (HtmlElement)table.getFirstDomChild();
assertNotNull(tbody);
assertEquals(tbody.getNodeName().toLowerCase(), "tbody");
- Iterator trIter = tbody.getChildIterator();
+ Iterator<HtmlElement> trIter = tbody.getChildIterator();
for (;trIter.hasNext();) {
- HtmlElement tr = (HtmlElement) trIter.next();
+ HtmlElement tr = trIter.next();
assertNotNull(tr);
- assertEquals(tr.getNodeName().toLowerCase(), "tr");
+ assertEquals(tr.getNodeName().toLowerCase(), HTML.TR_ELEMENT);
- classAttr = tr.getAttributeValue("class");
-
- assertTrue(classAttr.contains("errorClass")||classAttr.contains("fatalClass")
- ||classAttr.contains("warnClass") ||classAttr.contains("infoClass"));
-
- Iterator tdIter = tr.getChildIterator();
+ Iterator<HtmlElement> tdIter = tr.getChildIterator();
for (;tdIter.hasNext();) {
- HtmlElement td = (HtmlElement)tdIter.next();
+ HtmlElement td = tdIter.next();
assertNotNull(td);
- assertEquals(td.getNodeName().toLowerCase(), "td");
+ assertEquals(td.getNodeName().toLowerCase(), HTML.td_ELEM);
- if(td.getAttributeValue("class")!= null){
- classAttr = td.getAttributeValue("class");
+ if(td.getAttributeValue(HTML.class_ATTRIBUTE)!= null){
+ classAttr = td.getAttributeValue(HTML.class_ATTRIBUTE);
- assertTrue(classAttr.contains("rich-messages-marker"));
- assertTrue(classAttr.contains("errorMarkerClass") || classAttr.contains("fatalMarkerClass")
- || classAttr.contains("infoMarkerClass") || classAttr.contains("warnMarkerClass"));
+ assertTrue(classAttr.contains("errorClass")||classAttr.contains("fatalClass")
+ ||classAttr.contains("warnClass") ||classAttr.contains("infoClass"));
}
- HtmlElement elem = (HtmlElement)td.getFirstChild();
+ HtmlElement elem = (HtmlElement)td.getFirstDomChild();
assertNotNull(elem);
- if(elem.getNodeName().equals("span")){
- classAttr = tr.getAttributeValue("class");
+ if(elem.getNodeName().equals(HTML.SPAN_ELEM)){
+ classAttr = tr.getAttributeValue(HTML.class_ATTRIBUTE);
- assertTrue(classAttr.contains("rich-messages-label"));
- assertTrue(classAttr.contains("errorLabelClass") || classAttr.contains("infoLabelClass")
- || classAttr.contains("fatalLabelClass") || classAttr.contains("warnLabelClass"));
-
- String title = elem.getAttributeValue("title");
- assertEquals("TITLTE", title);
+ String title = elem.getAttributeValue(HTML.title_ATTRIBUTE);
+ assertEquals("TITLE2", title);
}
}
}
Modified: trunk/ui/orderingList/src/test/java/org/richfaces/renderkit/OrderingListRenderingTest.java
===================================================================
--- trunk/ui/orderingList/src/test/java/org/richfaces/renderkit/OrderingListRenderingTest.java 2008-03-26 17:09:56 UTC (rev 7268)
+++ trunk/ui/orderingList/src/test/java/org/richfaces/renderkit/OrderingListRenderingTest.java 2008-03-26 17:10:49 UTC (rev 7269)
@@ -33,6 +33,7 @@
import javax.faces.component.html.HtmlOutputText;
import javax.servlet.http.HttpServletResponse;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.resource.InternetResource;
import org.ajax4jsf.resource.InternetResourceBuilder;
import org.ajax4jsf.resource.ResourceBuilderImpl;
@@ -51,8 +52,8 @@
*
*/
public class OrderingListRenderingTest extends AbstractAjax4JsfTestCase {
- private static Set javaScripts = new HashSet();
- private static Set imageClasses = new HashSet();
+ private static Set<String> javaScripts = new HashSet<String>();
+ private static Set<String> imageClasses = new HashSet<String>();
static {
javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
@@ -90,7 +91,7 @@
private UIForm form = null;
private UIOrderingList orderingList = null;
- private List items = null;
+ private List<SimpleItem> items = null;
private HtmlOutputText output1 = null;
private HtmlOutputText output2 = null;
private UIColumn column1 = null;
@@ -115,7 +116,7 @@
caption.setValue("caption");
orderingList.getFacets().put("caption", caption);
- items = new ArrayList();
+ items = new ArrayList<SimpleItem>();
items.add(new SimpleItem("Michael", 2000));
items.add(new SimpleItem("John", 500));
items.add(new SimpleItem("George", 4000));
@@ -157,16 +158,16 @@
public void testRenderScript() throws Exception {
HtmlPage page = renderView();
assertNotNull(page);
- List scripts = page.getDocumentElement().getHtmlElementsByTagName("script");
+ List<HtmlScript> scripts = page.getDocumentHtmlElement().getHtmlElementsByTagName(HTML.SCRIPT_ELEM);
int foundCount = 0;
- for (Iterator it = scripts.iterator(); it.hasNext();) {
- HtmlScript item = (HtmlScript) it.next();
+ for (Iterator<HtmlScript> it = scripts.iterator(); it.hasNext();) {
+ HtmlScript item = it.next();
String srcAttr = item.getSrcAttribute();
if (StringUtils.isNotBlank(srcAttr)) {
boolean found = false;
- for (Iterator srcIt = javaScripts.iterator(); srcIt.hasNext();) {
- String src = (String) srcIt.next();
+ for (Iterator<String> srcIt = javaScripts.iterator(); srcIt.hasNext();) {
+ String src = srcIt.next();
found = srcAttr.contains(src);
if (found) {
@@ -192,8 +193,8 @@
InternetResourceBuilder builder = ResourceBuilderImpl.getInstance();
- for (Iterator it = imageClasses.iterator(); it.hasNext(); ) {
- String clazz = (String) it.next();
+ for (Iterator<String> it = imageClasses.iterator(); it.hasNext(); ) {
+ String clazz = it.next();
builder.createResource(null, clazz);
InternetResource resource = builder.getResource(clazz);
assertNotNull(resource);
@@ -218,13 +219,13 @@
public void testRenderStyle() throws Exception {
HtmlPage view = renderView();
assertNotNull(view);
- List links = view.getDocumentElement().getHtmlElementsByTagName("link");
+ List<HtmlElement> links = view.getDocumentHtmlElement().getHtmlElementsByTagName(HTML.LINK_ELEMENT);
assertNotNull(links);
assertEquals(1, links.size());
- HtmlElement link = (HtmlElement) links.get(0);
- assertTrue(link.getAttributeValue("href").contains("css/orderingList.xcss"));
+ HtmlElement link = links.get(0);
+ assertTrue(link.getAttributeValue(HTML.HREF_ATTR).contains("css/orderingList.xcss"));
- String uri = "http:" + link.getAttributeValue("href");
+ String uri = "http:" + link.getAttributeValue(HTML.HREF_ATTR);
Page page = webClient.getPage(uri);
assertNotNull(page);
assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
@@ -238,17 +239,16 @@
public void testRenderControls() throws Exception {
HtmlPage view = renderView();
assertNotNull(view);
- System.out.println(view.asXml());
- List images = view.getDocumentElement().getHtmlElementsByTagName("img");
+ List<HtmlElement> images = view.getDocumentHtmlElement().getHtmlElementsByTagName(HTML.IMG_ELEMENT);
assertNotNull(images);
int generatedCount = 0;
- for (Iterator it = images.iterator(); it.hasNext(); ) {
- HtmlElement img = (HtmlElement) it.next();
+ for (Iterator<HtmlElement> it = images.iterator(); it.hasNext(); ) {
+ HtmlElement img = it.next();
assertNotNull(img);
- String uri = "http:" + img.getAttributeValue("src");
+ String uri = "http:" + img.getAttributeValue(HTML.src_ATTRIBUTE);
Page page = webClient.getPage(uri);
assertNotNull(page);
assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
@@ -258,36 +258,36 @@
}
generatedCount++;
- HtmlElement element = (HtmlElement) img.getParentNode();
+ HtmlElement element = (HtmlElement) img.getParentDomNode();
assertNotNull(element);
- assertEquals("div", element.getNodeName());
- String clazz = element.getAttributeValue("class");
+ assertEquals(HTML.DIV_ELEM, element.getNodeName());
+ String clazz = element.getAttributeValue(HTML.class_ATTRIBUTE);
assertNotNull(clazz);
assertTrue("rich-ordering-list-button-content".equals(clazz));
- element = (HtmlElement) element.getParentNode();
+ element = (HtmlElement) element.getParentDomNode();
assertNotNull(element);
- assertEquals("a", element.getNodeName());
- String href = element.getAttributeValue("href");
- assertNotNull(href);
+ if (HTML.a_ELEMENT.equalsIgnoreCase(element.getNodeName())) {
+ element = (HtmlElement) element.getParentDomNode();
+ assertNotNull(element);
+ }
- element = (HtmlElement) element.getParentNode();
+ assertEquals(HTML.DIV_ELEM, element.getNodeName());
+
+ element = (HtmlElement) element.getParentDomNode();
assertNotNull(element);
- if ("a".equalsIgnoreCase(element.getNodeName())) {
- element = (HtmlElement) element.getParentNode();
- assertNotNull(element);
- }
- assertEquals("div", element.getNodeName());
- clazz = element.getAttributeValue("class");
+
+ assertEquals(HTML.DIV_ELEM, element.getNodeName());
+ clazz = element.getAttributeValue(HTML.class_ATTRIBUTE);
assertNotNull(clazz);
- assertTrue(clazz.startsWith("rich-ordering-list-button"));
+ assertTrue(clazz.contains("rich-ordering-control-"));
- element = (HtmlElement) element.getParentNode();
+ element = (HtmlElement) element.getParentDomNode();
assertNotNull(element);
- assertEquals("div", element.getNodeName());
- clazz = element.getAttributeValue("class");
+ assertEquals(HTML.DIV_ELEM, element.getNodeName());
+ clazz = element.getAttributeValue(HTML.class_ATTRIBUTE);
assertNotNull(clazz);
- assertTrue(clazz.contains("rich-ordering-control"));
+ assertTrue(clazz.contains("rich-ordering-list-button-layout"));
}
assertEquals(8, generatedCount);
}
@@ -303,33 +303,33 @@
HtmlElement div = view.getHtmlElementById(orderingList.getClientId(facesContext) + "contentBox");
assertNotNull(div);
- assertEquals("div", div.getNodeName());
+ assertEquals(HTML.DIV_ELEM, div.getNodeName());
- HtmlElement table = (HtmlElement)div.getFirstChild();
+ HtmlElement table = (HtmlElement)div.getFirstDomChild();
assertNotNull(table);
- assertEquals("table", table.getNodeName());
+ assertEquals(HTML.TABLE_ELEMENT, table.getNodeName());
- HtmlElement tbody = (HtmlElement)table.getFirstChild();
+ HtmlElement tbody = (HtmlElement)table.getFirstDomChild();
assertNotNull(tbody);
- assertEquals("tbody", tbody.getNodeName());
+ assertEquals(HTML.TBOBY_ELEMENT, tbody.getNodeName());
int rowsCount = 0;
- for (Iterator it = tbody.getChildIterator(); it.hasNext(); ) {
- HtmlElement tr = (HtmlElement)it.next();
+ for (Iterator<HtmlElement> it = tbody.getChildIterator(); it.hasNext(); ) {
+ HtmlElement tr = it.next();
assertNotNull(tr);
- assertEquals("tr", tr.getNodeName());
+ assertEquals(HTML.TR_ELEMENT, tr.getNodeName());
- String clazz = tr.getAttributeValue("class");
+ String clazz = tr.getAttributeValue(HTML.class_ATTRIBUTE);
assertNotNull(clazz);
assertTrue(clazz.contains("rich-ordering-list-row"));
int cellsCount = 0;
- for (Iterator it2 = tr.getChildIterator(); it2.hasNext(); ) {
- HtmlElement td = (HtmlElement)it2.next();
+ for (Iterator<HtmlElement> it2 = tr.getChildIterator(); it2.hasNext(); ) {
+ HtmlElement td = it2.next();
assertNotNull(td);
- assertEquals("td", td.getNodeName());
+ assertEquals(HTML.td_ELEM, td.getNodeName());
- String clazz2 = td.getAttributeValue("class");
+ String clazz2 = td.getAttributeValue(HTML.class_ATTRIBUTE);
assertNotNull(clazz2);
assertTrue(clazz2.contains("rich-ordering-list-cell"));
@@ -353,21 +353,22 @@
HtmlElement div = view.getHtmlElementById(orderingList.getClientId(facesContext));
assertNotNull(div);
- assertEquals("div", div.getNodeName());
+ assertEquals(HTML.DIV_ELEM, div.getNodeName());
HtmlElement hidden1 = view.getHtmlElementById(orderingList.getClientId(facesContext) + "focusKeeper");
assertNotNull(hidden1);
- assertEquals("input", hidden1.getNodeName());
- assertEquals("button", hidden1.getAttributeValue("type"));
- hidden1.getAttributeValue("style").contains("left: -32767px");
+ assertEquals(HTML.INPUT_ELEM, hidden1.getNodeName());
+ assertEquals(HTML.BUTTON, hidden1.getAttributeValue(HTML.TYPE_ATTR));
+ hidden1.getAttributeValue(HTML.style_ATTRIBUTE).contains("left: -32767px");
- List hiddens = view.getDocumentElement().getHtmlElementsByAttribute("input", "name", orderingList.getClientId(facesContext));
+ List<HtmlElement> hiddens = view.getDocumentHtmlElement()
+ .getHtmlElementsByAttribute(HTML.INPUT_ELEM, HTML.NAME_ATTRIBUTE, orderingList.getClientId(facesContext));
assertNotNull(hiddens);
assertEquals(ROWS_COUNT, hiddens.size());
- for (Iterator it = hiddens.iterator(); it.hasNext(); ) {
- HtmlElement hidden2 = (HtmlElement) it.next();
- assertEquals("input", hidden2.getNodeName());
- assertEquals("hidden", hidden2.getAttributeValue("type"));
+ for (Iterator<HtmlElement> it = hiddens.iterator(); it.hasNext(); ) {
+ HtmlElement hidden2 = it.next();
+ assertEquals(HTML.INPUT_ELEM, hidden2.getNodeName());
+ assertEquals(HTML.INPUT_TYPE_HIDDEN, hidden2.getAttributeValue(HTML.TYPE_ATTR));
}
}
Modified: trunk/ui/tabPanel/src/main/java/org/richfaces/renderkit/TabPanelRendererBase.java
===================================================================
--- trunk/ui/tabPanel/src/main/java/org/richfaces/renderkit/TabPanelRendererBase.java 2008-03-26 17:09:56 UTC (rev 7268)
+++ trunk/ui/tabPanel/src/main/java/org/richfaces/renderkit/TabPanelRendererBase.java 2008-03-26 17:10:49 UTC (rev 7269)
@@ -291,6 +291,7 @@
protected void preEncodeBegin(FacesContext context, UIComponent component) throws IOException {
+ super.preEncodeBegin(context, component);
if(component instanceof UITabPanel){
UITabPanel tabPanel = (UITabPanel)component;
ComponentVariables componentVariables = ComponentsVariableResolver.getVariables(this, tabPanel);
Modified: trunk/ui/tabPanel/src/main/templates/tabPanel.jspx
===================================================================
--- trunk/ui/tabPanel/src/main/templates/tabPanel.jspx 2008-03-26 17:09:56 UTC (rev 7268)
+++ trunk/ui/tabPanel/src/main/templates/tabPanel.jspx 2008-03-26 17:10:49 UTC (rev 7269)
@@ -66,9 +66,6 @@
<f:call name="utils.encodeEndFormIfNessesary" />
</td>
</tr>
- <!-- tr>
- <td class="dr-bottom-line" width="100%"><img src="#{spacer}" width="1" height="1" alt="" border="0"/></td>
- </tr-->
<tr>
<vcp:body>
<f:call name="renderChildren" />
16 years, 9 months