JBoss Rich Faces SVN: r6638 - trunk/framework/api/src/main/java/org/richfaces/model.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-03-10 06:07:43 -0400 (Mon, 10 Mar 2008)
New Revision: 6638
Modified:
trunk/framework/api/src/main/java/org/richfaces/model/UploadItem.java
Log:
RF-2397
Modified: trunk/framework/api/src/main/java/org/richfaces/model/UploadItem.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/UploadItem.java 2008-03-10 09:20:41 UTC (rev 6637)
+++ trunk/framework/api/src/main/java/org/richfaces/model/UploadItem.java 2008-03-10 10:07:43 UTC (rev 6638)
@@ -32,10 +32,10 @@
this.fileName = fileName;
if (null != file) {
if (file.getClass().isAssignableFrom(File.class)) {
- this.file = (File)file;
+ this.file = (File) file;
+ } else if (file.getClass().isAssignableFrom(byte[].class)) {
+ this.bytes = (byte[]) file;
}
- }else if (file.getClass().isAssignableFrom(byte[].class)) {
- this.bytes = (byte [])file;
}
}
18 years, 1 month
JBoss Rich Faces SVN: r6637 - trunk/docs/userguide/en/src/main/resources/images.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-03-10 05:20:41 -0400 (Mon, 10 Mar 2008)
New Revision: 6637
Added:
trunk/docs/userguide/en/src/main/resources/images/progressbar_macrosubs.png
Log:
http://jira.jboss.com/jira/browse/RF-1690
Picture added
Added: trunk/docs/userguide/en/src/main/resources/images/progressbar_macrosubs.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/progressbar_macrosubs.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
18 years, 1 month
JBoss Rich Faces SVN: r6636 - trunk/docs/userguide/en/src/main/resources/images.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-03-10 05:20:00 -0400 (Mon, 10 Mar 2008)
New Revision: 6636
Added:
trunk/docs/userguide/en/src/main/resources/images/picklist_no_lbls.png
Log:
http://jira.jboss.com/jira/browse/RF-2174
Picture added
Added: trunk/docs/userguide/en/src/main/resources/images/picklist_no_lbls.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/picklist_no_lbls.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
18 years, 1 month
JBoss Rich Faces SVN: r6635 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-03-10 05:17:49 -0400 (Mon, 10 Mar 2008)
New Revision: 6635
Modified:
trunk/docs/userguide/en/src/main/docbook/included/pickList.xml
Log:
http://jira.jboss.com/jira/browse/RF-2174
Some additional info added
Modified: trunk/docs/userguide/en/src/main/docbook/included/pickList.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/pickList.xml 2008-03-10 09:17:12 UTC (rev 6634)
+++ trunk/docs/userguide/en/src/main/docbook/included/pickList.xml 2008-03-10 09:17:49 UTC (rev 6635)
@@ -165,13 +165,11 @@
</para>
<figure>
<title>Move control buttons without labels</title>
-
<mediaobject>
<imageobject>
<imagedata fileref="images/picklist_no_lbls.png"/>
</imageobject>
</mediaobject>
-
</figure>
<para>
18 years, 1 month
JBoss Rich Faces SVN: r6634 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-03-10 05:17:12 -0400 (Mon, 10 Mar 2008)
New Revision: 6634
Modified:
trunk/docs/userguide/en/src/main/docbook/included/progressBar.xml
Log:
http://jira.jboss.com/jira/browse/RF-1690
Some additional info added
Modified: trunk/docs/userguide/en/src/main/docbook/included/progressBar.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/progressBar.xml 2008-03-10 09:09:12 UTC (rev 6633)
+++ trunk/docs/userguide/en/src/main/docbook/included/progressBar.xml 2008-03-10 09:17:12 UTC (rev 6634)
@@ -85,9 +85,7 @@
</para>
<programlisting role="XML"><![CDATA[...
-<rich:progressBar value="#{bean.incValue}"
- minValue="50"
- maxValue="400"/>
+<rich:progressBar value="#{bean.incValue}" minValue="50" maxValue="400"/>
...]]> </programlisting>
<para> The <emphasis><property>"interval"</property></emphasis>attribute defines the frequency of status polling. Polling is active while the component is operational. </para>
<para>
@@ -95,7 +93,7 @@
</para>
<programlisting role="XML"><![CDATA[...
-<rich:progressBar value="#{bean.incValue}" " id="progrs" interval="900"/>
+<rich:progressBar value="#{bean.incValue}" id="progrs" interval="900"/>
...]]> </programlisting>
<para> The <emphasis><property>"parameters"</property></emphasis>attribute allows to send some
dynamical data to the component which is displayed in the informational part.
18 years, 1 month
JBoss Rich Faces SVN: r6633 - trunk/ui/fileUpload/src/main/templates/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-03-10 05:09:12 -0400 (Mon, 10 Mar 2008)
New Revision: 6633
Modified:
trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
Log:
RF-2429
Modified: trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
===================================================================
--- trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-03-09 22:16:31 UTC (rev 6632)
+++ trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-03-10 09:09:12 UTC (rev 6633)
@@ -62,6 +62,7 @@
class="hidden"
id="#{clientId}:file"
name="#{clientId}:file"
+ disabled="#{component.attributes['disabled']}"
onchange="return $('#{clientId}').component.add(this);"/>
</div>
</div>
18 years, 1 month
JBoss Rich Faces SVN: r6632 - trunk/ui/core/src/main/resources/org/richfaces/renderkit/html/css.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-03-09 18:16:31 -0400 (Sun, 09 Mar 2008)
New Revision: 6632
Modified:
trunk/ui/core/src/main/resources/org/richfaces/renderkit/html/css/extended_classes.xcss
Log:
Added skinning classes
Modified: trunk/ui/core/src/main/resources/org/richfaces/renderkit/html/css/extended_classes.xcss
===================================================================
--- trunk/ui/core/src/main/resources/org/richfaces/renderkit/html/css/extended_classes.xcss 2008-03-09 21:37:04 UTC (rev 6631)
+++ trunk/ui/core/src/main/resources/org/richfaces/renderkit/html/css/extended_classes.xcss 2008-03-09 22:16:31 UTC (rev 6632)
@@ -4,12 +4,12 @@
xmlns:u='http:/jsf.exadel.com/template/util'
xmlns="http://www.w3.org/1999/xhtml">
- <u:selector name=".rich-container input,
- .rich-container select,
- .rich-container textarea,
- .rich-container button,
- .rich-container keygen,
- .rich-container isindex">
+ <u:selector name=".rich-container input, .rich-input,
+ .rich-container select, .rich-select,
+ .rich-container textarea, .rich-textarea,
+ .rich-container button, .rich-button,
+ .rich-container keygen, .rich-keygen,
+ .rich-container isindex, .rich-isindex">
<u:style name="border-width" value="1px" />
<u:style name="border-color" skin="panelBorderColor" />
<u:style name="color" skin="controlTextColor" />
@@ -17,18 +17,19 @@
<f:verbatim>
<![CDATA[
- .rich-container *|button {
+ .rich-container *|button, .rich-button {
border-width: 1px;
background-repeat : repeat-x;
background-position : top left;
}
-
- .rich-container button[type="button"],
- .rich-container button[type="reset"],
- .rich-container button[type="submit"],
- .rich-container input[type="reset"],
- .rich-container input[type="submit"],
- .rich-container input[type="button"] {
+
+ .rich-button,
+ .rich-container button[type="button"], .rich-button-button,
+ .rich-container button[type="reset"], .rich-button-reset,
+ .rich-container button[type="submit"], .rich-button-submit,
+ .rich-container input[type="reset"], .rich-input-reset,
+ .rich-container input[type="submit"], .rich-input-submit,
+ .rich-container input[type="button"], .rich-input-button {
border-width: 1px;
background-repeat : repeat-x;
background-position : top left;
@@ -37,7 +38,7 @@
]]>
</f:verbatim>
- <u:selector name=".rich-container *|button">
+ <u:selector name=".rich-container *|button, .rich-button">
<u:style name="border-color" skin="panelBorderColor" />
<u:style name="font-size" skin="generalSizeFont" />
<u:style name="font-family" skin="generalFamilyFont" />
@@ -50,12 +51,13 @@
</u:selector>
<u:selector name="
- .rich-container button[type="button"],
- .rich-container button[type="reset"],
- .rich-container button[type="submit"],
- .rich-container input[type="reset"],
- .rich-container input[type="submit"],
- .rich-container input[type="button"]
+ .rich-button,
+ .rich-container button[type="button"], .rich-button-button,
+ .rich-container button[type="reset"], .rich-button-reset,
+ .rich-container button[type="submit"], .rich-button-submit,
+ .rich-container input[type="reset"], .rich-input-reset,
+ .rich-container input[type="submit"], .rich-input-submit,
+ .rich-container input[type="button"], .rich-input-button,
">
<u:style name="border-color" skin="panelBorderColor" />
<u:style name="font-size" skin="generalSizeFont" />
@@ -72,17 +74,18 @@
<f:verbatim>
<![CDATA[
- .rich-container *|textarea {
+ .rich-container *|textarea, .rich-textarea {
border-width: 1px;
border-style : inset;
background-repeat : no-repeat;
background-position : 1px 1px;
}
-
- .rich-container textarea[type="textarea"],
- .rich-container input[type="text"],
- .rich-container input[type="password"],
- .rich-container select {
+
+ .rich-textarea,
+ .rich-container textarea[type="textarea"], .rich-textarea-textarea,
+ .rich-container input[type="text"], .rich-input-text,
+ .rich-container input[type="password"], .rich-input-password,
+ .rich-container select, .rich-select {
border-width: 1px;
border-style : inset;
background-repeat : no-repeat;
@@ -91,7 +94,7 @@
]]>
</f:verbatim>
- <u:selector name=".rich-container *|textarea">
+ <u:selector name=".rich-container *|textarea, .rich-textarea">
<u:style name="border-color" skin="panelBorderColor" />
<u:style name="font-size" skin="generalSizeFont" />
<u:style name="font-family" skin="generalFamilyFont" />
@@ -103,11 +106,11 @@
</u:style>
</u:selector>
- <u:selector name="
- .rich-container textarea[type="textarea"],
- .rich-container input[type="text"],
- .rich-container input[type="password"],
- .rich-container select">
+ <u:selector name=".rich-textarea,
+ .rich-container textarea[type="textarea"], .rich-textarea-textarea,
+ .rich-container input[type="text"], .rich-input-text,
+ .rich-container input[type="password"], .rich-input-password,
+ .rich-container select, .rich-select">
<u:style name="border-color" skin="panelBorderColor" />
<u:style name="font-size" skin="generalSizeFont" />
<u:style name="font-family" skin="generalFamilyFont" />
18 years, 1 month
JBoss Rich Faces SVN: r6631 - in trunk: samples/datascroller-sample/src/main/webapp/pages and 6 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-03-09 17:37:04 -0400 (Sun, 09 Mar 2008)
New Revision: 6631
Added:
trunk/ui/datascroller/src/main/config/faces/
trunk/ui/datascroller/src/main/config/faces/faces-config.xml
trunk/ui/datascroller/src/main/java/org/richfaces/component/DataScrollerPhaseListener.java
trunk/ui/datascroller/src/main/java/org/richfaces/component/DataScrollerViewPhaseListener.java
Modified:
trunk/samples/datascroller-sample/src/main/java/org/richfaces/TestBean.java
trunk/samples/datascroller-sample/src/main/webapp/pages/index.jsp
trunk/ui/datascroller/src/main/config/component/datascroller.xml
trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
trunk/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java
trunk/ui/datascroller/src/main/templates/org/richfaces/htmlDatascroller.jspx
Log:
http://jira.jboss.com/jira/browse/RF-1133
Modified: trunk/samples/datascroller-sample/src/main/java/org/richfaces/TestBean.java
===================================================================
--- trunk/samples/datascroller-sample/src/main/java/org/richfaces/TestBean.java 2008-03-09 18:08:21 UTC (rev 6630)
+++ trunk/samples/datascroller-sample/src/main/java/org/richfaces/TestBean.java 2008-03-09 21:37:04 UTC (rev 6631)
@@ -220,4 +220,18 @@
public void setEventCount(int eventCount) {
this.eventCount = eventCount;
}
-}
+
+ public void addEntries() {
+ for (int i = 0; i < 5; i++) {
+ data.add(new Entry(null, data.size()));
+ }
+ }
+
+ public void removeEntries() {
+ if (data.size() >= 5) {
+ for (int i = 0; i < 5; i++) {
+ data.remove(data.size() - 1);
+ }
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/samples/datascroller-sample/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/samples/datascroller-sample/src/main/webapp/pages/index.jsp 2008-03-09 18:08:21 UTC (rev 6630)
+++ trunk/samples/datascroller-sample/src/main/webapp/pages/index.jsp 2008-03-09 21:37:04 UTC (rev 6631)
@@ -87,9 +87,13 @@
</h:panelGrid>
<h:commandLink value="apply" />
+ <br />
+ <h:commandLink value="Add Entries" action="#{testBean.addEntries}" />
+ <br />
+ <h:commandLink value="Remove Entries" action="#{testBean.removeEntries}" />
+ <br />
-
</h:form>
</f:view>
</body>
Modified: trunk/ui/datascroller/src/main/config/component/datascroller.xml
===================================================================
--- trunk/ui/datascroller/src/main/config/component/datascroller.xml 2008-03-09 18:08:21 UTC (rev 6630)
+++ trunk/ui/datascroller/src/main/config/component/datascroller.xml 2008-03-09 21:37:04 UTC (rev 6631)
@@ -75,7 +75,7 @@
<classname>boolean</classname>
<description>If "false", this component is not rendered</description>
</property>
- <property>
+ <property el="false">
<name>for</name>
<classname>java.lang.String</classname>
<description>ID of the table component whose data is scrollled
@@ -245,7 +245,6 @@
<name>actionExpression</name>
</property>
-
<property hidden="true">
<name>firstRow</name>
</property>
Added: trunk/ui/datascroller/src/main/config/faces/faces-config.xml
===================================================================
--- trunk/ui/datascroller/src/main/config/faces/faces-config.xml (rev 0)
+++ trunk/ui/datascroller/src/main/config/faces/faces-config.xml 2008-03-09 21:37:04 UTC (rev 6631)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
+ version="1.2">
+
+ <lifecycle>
+ <phase-listener>
+ org.richfaces.component.DataScrollerPhaseListener
+ </phase-listener>
+ </lifecycle>
+</faces-config>
Added: trunk/ui/datascroller/src/main/java/org/richfaces/component/DataScrollerPhaseListener.java
===================================================================
--- trunk/ui/datascroller/src/main/java/org/richfaces/component/DataScrollerPhaseListener.java (rev 0)
+++ trunk/ui/datascroller/src/main/java/org/richfaces/component/DataScrollerPhaseListener.java 2008-03-09 21:37:04 UTC (rev 6631)
@@ -0,0 +1,64 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+
+/**
+ * Created 08.03.2008
+ * @author Nick Belaevski
+ * @since 3.2
+ */
+
+public class DataScrollerPhaseListener implements PhaseListener {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3614288642745891577L;
+
+ private static final String ATTRIBUTE_NAME = DataScrollerPhaseListener.class.getName();
+
+ private PhaseListener listener = new DataScrollerViewPhaseListener();
+
+ public void afterPhase(PhaseEvent event) {
+ }
+
+ public void beforePhase(PhaseEvent event) {
+ FacesContext facesContext = event.getFacesContext();
+ UIViewRoot viewRoot = facesContext.getViewRoot();
+ if (viewRoot != null && !Boolean.TRUE.equals(
+ viewRoot.getAttributes().get(ATTRIBUTE_NAME))) {
+ viewRoot.addPhaseListener(listener);
+ viewRoot.getAttributes().put(ATTRIBUTE_NAME, Boolean.TRUE);
+ }
+ }
+
+ public PhaseId getPhaseId() {
+ return PhaseId.RENDER_RESPONSE;
+ }
+
+}
Added: trunk/ui/datascroller/src/main/java/org/richfaces/component/DataScrollerViewPhaseListener.java
===================================================================
--- trunk/ui/datascroller/src/main/java/org/richfaces/component/DataScrollerViewPhaseListener.java (rev 0)
+++ trunk/ui/datascroller/src/main/java/org/richfaces/component/DataScrollerViewPhaseListener.java 2008-03-09 21:37:04 UTC (rev 6631)
@@ -0,0 +1,82 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import java.util.Iterator;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIData;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+
+
+/**
+ * Created 08.03.2008
+ * @author Nick Belaevski
+ * @since 3.2
+ */
+
+public class DataScrollerViewPhaseListener implements PhaseListener {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3614288642745891577L;
+
+ public void afterPhase(PhaseEvent event) {
+ }
+
+ private void updateScrollers(UIComponent component) {
+ if (component.isRendered()) {
+ if (component instanceof UIDatascroller) {
+ UIDatascroller datascroller = (UIDatascroller) component;
+ datascroller.updateFirstRow();
+
+ UIData dataTable = datascroller.getDataTable();
+ if (dataTable.isRendered()) {
+ dataTable.setFirst(datascroller.getFirstRow());
+ }
+ }
+
+ Iterator<UIComponent> children = component.getFacetsAndChildren();
+ while(children.hasNext()) {
+ updateScrollers(children.next());
+ }
+ }
+ }
+
+ public void beforePhase(PhaseEvent event) {
+ FacesContext facesContext = event.getFacesContext();
+ UIViewRoot viewRoot = facesContext.getViewRoot();
+ if (viewRoot != null) {
+ updateScrollers(viewRoot);
+ }
+ }
+
+ public PhaseId getPhaseId() {
+ return PhaseId.RENDER_RESPONSE;
+ }
+
+}
Modified: trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
===================================================================
--- trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java 2008-03-09 18:08:21 UTC (rev 6630)
+++ trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java 2008-03-09 21:37:04 UTC (rev 6631)
@@ -21,11 +21,15 @@
package org.richfaces.component;
+import javax.el.ELException;
import javax.el.MethodExpression;
+import javax.el.ValueExpression;
import javax.faces.FacesException;
+import javax.faces.application.FacesMessage;
import javax.faces.component.ActionSource;
import javax.faces.component.UIComponent;
import javax.faces.component.UIData;
+import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
@@ -33,6 +37,7 @@
import org.ajax4jsf.component.AjaxActionComponent;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.RendererUtils;
+import org.richfaces.component.util.MessageUtil;
import org.richfaces.event.DataScrollerEvent;
import org.richfaces.event.DataScrollerListener;
import org.richfaces.event.DataScrollerSource;
@@ -43,8 +48,10 @@
//create event listener & event classes to define PageSwitchEvent
//public abstract class UIDatascroller extends UIComponentBase implements DataScrollerSource{
public abstract class UIDatascroller extends AjaxActionComponent
- implements DataScrollerSource, ActionSource {
+implements DataScrollerSource, ActionSource {
+ private Integer firstRow;
+
public static final String COMPONENT_TYPE = "org.richfaces.Datascroller";
public static final String COMPONENT_FAMILY = "org.richfaces.Datascroller";
@@ -68,13 +75,13 @@
public static final String NEXT_DISABLED_FACET_NAME = "next_disabled";
public static final String PREVIOUS_DISABLED_FACET_NAME
- = "previous_disabled";
+ = "previous_disabled";
public static final String FAST_FORWARD_DISABLED_FACET_NAME
- = "fastforward_disabled";
+ = "fastforward_disabled";
public static final String FAST_REWIND_DISABLED_FACET_NAME
- = "fastrewind_disabled";
+ = "fastrewind_disabled";
public void addScrollerListener(DataScrollerListener listener) {
addFacesListener(listener);
@@ -93,14 +100,14 @@
super.broadcast(event);
if (event instanceof DataScrollerEvent) {
DataScrollerEvent dataScrollerEvent = (DataScrollerEvent) event;
- setPage(dataScrollerEvent.getNewScrolVal());
+ setPage(dataScrollerEvent.getNewScrolVal(), true);
FacesContext context = FacesContext.getCurrentInstance();
AjaxRendererUtils.addRegionByName(context, this, this.getId());
AjaxRendererUtils.addRegionByName(context, this, this.getFor());
setupReRender(context);
-
+
MethodExpression scrollerListener = getScrollerListener();
if (scrollerListener != null) {
scrollerListener.invoke(context.getELContext(), new Object[]{event});
@@ -206,7 +213,7 @@
}
if (forComp == null) {
throw new IllegalArgumentException("could not find dataTable with id '"
- + forAttribute + "'");
+ + forAttribute + "'");
} else if (!(forComp instanceof UIData)) {
throw new IllegalArgumentException(
"component with id '" + forAttribute
@@ -222,20 +229,24 @@
int rows = getRows(uiData);
if (0 == rows) {
throw new FacesException("Missing 'rows' attribute on component '"
- + uiData.getId() + "'");
+ + uiData.getId() + "'");
}
+ int firstRow = getFirstRow();
+
int pageIndex;
if (rows > 0) {
//xxxx nick -> alex - suppose this.getFirst() would be better here
- pageIndex = getFirstRow(uiData) / rows + 1;
+ pageIndex = firstRow / rows + 1;
} else {
//TODO nick -> nick - is it valid if under 0?
pageIndex = 0;
}
- if (getFirstRow(uiData) % rows > 0) {
+
+ if (firstRow % rows > 0) {
pageIndex++;
}
+
return pageIndex;
}
@@ -249,6 +260,69 @@
return getPageIndex(uiData);
}
+ private void setFirstRowValue(int row) {
+ FacesContext context = getFacesContext();
+ ValueExpression ve = getValueExpression("firstRow");
+ if (ve != null) {
+ try {
+ ve.setValue(context.getELContext(), row);
+ firstRow = null;
+ } catch (ELException e) {
+ String messageStr = e.getMessage();
+ Throwable result = e.getCause();
+ while (null != result &&
+ result.getClass().isAssignableFrom(ELException.class)) {
+ messageStr = result.getMessage();
+ result = result.getCause();
+ }
+ FacesMessage message;
+ if (null == messageStr) {
+ message =
+ MessageUtil.getMessage(context, UIInput.UPDATE_MESSAGE_ID,
+ new Object[] { MessageUtil.getLabel(
+ context, this) });
+ } else {
+ message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
+ messageStr,
+ messageStr);
+ }
+ context.getExternalContext().log(message.getSummary(), result);
+ context.addMessage(getClientId(context), message);
+ context.renderResponse();
+ } catch (IllegalArgumentException e) {
+ FacesMessage message =
+ MessageUtil.getMessage(context, UIInput.UPDATE_MESSAGE_ID,
+ new Object[] { MessageUtil.getLabel(
+ context, this) });
+ context.getExternalContext().log(message.getSummary(), e);
+ context.addMessage(getClientId(context), message);
+ context.renderResponse();
+ } catch (Exception e) {
+ FacesMessage message =
+ MessageUtil.getMessage(context, UIInput.UPDATE_MESSAGE_ID,
+ new Object[] { MessageUtil.getLabel(
+ context, this) });
+ context.getExternalContext().log(message.getSummary(), e);
+ context.addMessage(getClientId(context), message);
+ context.renderResponse();
+ }
+ } else {
+ setFirstRow(row);
+ }
+ //TODO
+ }
+
+ private int getFirstRowForLastPage(int rowCount, int rows) {
+ int delta = rowCount % rows;
+ int newFirst = delta > 0 && delta < rows ? rowCount - delta : rowCount
+ - rows;
+ if (newFirst >= 0) {
+ return newFirst;
+ } else {
+ return 0;
+ }
+ }
+
/**
* Sets the page number according to the parameter recived from the
* commandLink
@@ -257,92 +331,82 @@
* "fastforward", "fastrewind"
*/
public void setPage(String facetName) {
+ setPage(facetName, false);
+ }
- UIData dataTable = getDataTable();
-
+ public void setPage(String facetName, boolean updateModel) {
// check if facet is selected
if (FIRST_FACET_NAME.equals(facetName)) {
- setFirstRow(0);
- dataTable.setFirst(0);
- } else if (PREVIOUS_FACET_NAME.equals(facetName)) {
- int previous = dataTable.getFirst() - getRows(dataTable);
- if (previous >= 0) {
- setFirstRow(previous);
- }
- } else if (NEXT_FACET_NAME.equals(facetName)) {
+ setFirstRowValue(0);
+ } else {
+ UIData dataTable = getDataTable();
+
+ int first = getFirstRow();
int rows = getRows(dataTable);
- int next = dataTable.getFirst() + rows;
- if (next < getRowCount(dataTable)) {
- setFirstRow(next);
- }
- //if (rows>0){
- // if (((next+rows)/rows)>getMaxPages()){
- // next=getMaxPages()*rows-rows;;
- // }
- //}
- } else if (FAST_FORWARD_FACET_NAME.equals(facetName)) {
- int fastStep = getFastStep();
- int rows = getRows(dataTable);
- if (fastStep <= 0) {
- fastStep = 1;
- }
- int next = dataTable.getFirst() + rows * fastStep;
- int rowcount = getRowCount(dataTable);
- if (next >= rowcount) {
- next = (rowcount - 1) - ((rowcount - 1) % rows);
- }
- //if (rows>0){
- // if (((next+rows)/rows)>getMaxPages()){
- // next=getMaxPages()*rows-rows;;
- //}
- //}
- setFirstRow(next);
- } else if (FAST_REWIND_FACET_NAME.equals(facetName)) {
- int fastStep = getFastStep();
- if (fastStep <= 0) {
- fastStep = 1;
- }
- int previous = dataTable.getFirst() - getRows(dataTable) * fastStep;
- if (previous < 0) {
- previous = 0;
- }
- setFirstRow(previous);
- } else if (LAST_FACET_NAME.equals(facetName)) {
- int rowcount = getRowCount(dataTable);
- int rows = getRows(dataTable);
- int delta = rowcount % rows;
- int first = delta > 0 && delta < rows ? rowcount - delta : rowcount
- - rows;
- if (first >= 0) {
+ int rowCount = getRowCount(dataTable);
+
+ if (PREVIOUS_FACET_NAME.equals(facetName)) {
+ int previous = first - rows;
+ if (previous >= 0) {
+ setFirstRowValue(previous);
+ }
+ } else if (NEXT_FACET_NAME.equals(facetName)) {
+ int next = first + rows;
+ if (next < rowCount) {
+ setFirstRowValue(next);
+ }
//if (rows>0){
- //if (((first+rows)/rows)>getMaxPages()){
- // first=getMaxPages()*rows-rows;
+ // if (((next+rows)/rows)>getMaxPages()){
+ // next=getMaxPages()*rows-rows;;
+ // }
//}
+ } else if (FAST_FORWARD_FACET_NAME.equals(facetName)) {
+ int fastStep = getFastStep();
+ if (fastStep <= 0) {
+ fastStep = 1;
+ }
+ int next = first + rows * fastStep;
+ if (next >= rowCount) {
+ next = (rowCount - 1) - ((rowCount - 1) % rows);
+ }
+ //if (rows>0){
+ // if (((next+rows)/rows)>getMaxPages()){
+ // next=getMaxPages()*rows-rows;;
//}
- setFirstRow(first);
- } else {
- setFirstRow(0);
+ //}
+ setFirstRowValue(next);
+ } else if (FAST_REWIND_FACET_NAME.equals(facetName)) {
+ int fastStep = getFastStep();
+ if (fastStep <= 0) {
+ fastStep = 1;
+ }
+ int previous = first - rows * fastStep;
+ if (previous < 0) {
+ previous = 0;
+ }
+ setFirstRowValue(previous);
+ } else if (LAST_FACET_NAME.equals(facetName)) {
+ setFirstRow(getFirstRowForLastPage(rowCount, rows));
}
- }
- // the paginator is selected
- else {
- int pageindex = Integer.parseInt(facetName);
- int pageCount = getPageCount(dataTable);
- if (pageindex > pageCount) {
- pageindex = pageCount;
- } else if (pageindex <= 0) {
- pageindex = 1;
+ // the paginator is selected
+ else {
+ int pageindex = Integer.parseInt(facetName);
+ int pageCount = getPageCount(rowCount, rows);
+ if (pageindex > pageCount) {
+ pageindex = pageCount;
+ } else if (pageindex <= 0) {
+ pageindex = 1;
+ }
+ setFirstRowValue(rows * (pageindex - 1));
}
- setFirstRow(getRows(dataTable) * (pageindex - 1));
+
}
}
- public int getPageCount(UIData data) {
- int rows = getRows(data);
+ public int getPageCount(int rowCount, int rows) {
int pageCount;
if (rows > 0) {
- int rowCount = getRowCount(data);
pageCount = rows <= 0 ? 1 : rowCount / rows;
if (rowCount % rows > 0) {
pageCount++;
@@ -357,6 +421,10 @@
return pageCount;
}
+ public int getPageCount(UIData data) {
+ return getPageCount(getRowCount(data), getRows(data));
+ }
+
/** @return the page count of the uidata */
public int getPageCount() {
return getPageCount(getDataTable());
@@ -417,15 +485,45 @@
return getFacet(PREVIOUS_FACET_NAME);
}
- public int getFirstRow(UIData data) {
- return data.getFirst();
+ public void updateFirstRow() {
+ UIData dataTable = getDataTable();
+ int rowCount = getRowCount(dataTable);
+ int firstRow = getFirstRow();
+
+ if (firstRow < 0) {
+ setFirstRow(0);
+ } else if (firstRow >= rowCount) {
+ setFirstRow(getFirstRowForLastPage(rowCount, getRows(dataTable)));
+ }
}
- public void setFirstRow(int rows) {
- getDataTable().setFirst(rows);
- //setControls();
+ public int getFirstRow() {
+ if (this.firstRow != null) {
+ return firstRow;
+ }
+
+ ValueExpression ve = getValueExpression("firstRow");
+ if (ve != null) {
+ try {
+ Integer firstRowObject = (Integer) ve.getValue(getFacesContext().getELContext());
+
+ if (firstRowObject != null) {
+ return firstRowObject;
+ } else {
+ return 0;
+ }
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+ } else {
+ return 0;
+ }
}
+ public void setFirstRow(int row) {
+ this.firstRow = row;
+ }
+
public String getFamily() {
return COMPONENT_FAMILY;
}
@@ -468,4 +566,20 @@
}
}
}
+
+ public Object saveState(FacesContext context) {
+ return new Object[] {
+ super.saveState(context),
+ firstRow,
+ };
+
+ }
+
+ public void restoreState(FacesContext context, Object object) {
+ Object[] state = (Object[]) object;
+
+ super.restoreState(context, state[0]);
+ firstRow = (Integer) state[1];
+ }
+
}
Modified: trunk/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java
===================================================================
--- trunk/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java 2008-03-09 18:08:21 UTC (rev 6630)
+++ trunk/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java 2008-03-09 21:37:04 UTC (rev 6631)
@@ -34,7 +34,6 @@
import javax.faces.context.ResponseWriter;
import javax.faces.event.PhaseId;
-import org.ajax4jsf.Messages;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
@@ -48,15 +47,9 @@
return UIDatascroller.class;
}
- protected boolean isRenderedOnSinglePage(UIDatascroller scroller, UIData dataTable) {
- return (scroller.getPageCount(dataTable) != 1 || scroller.isRenderIfSinglePage());
- }
-
public void doDecode(FacesContext context, UIComponent component) {
-
UIDatascroller scroller = (UIDatascroller) component;
-
- if (isRenderedOnSinglePage(scroller, scroller.getDataTable())) {
+ if (scroller.getPageCount() > 1) {
String param = (String) getParamMap(context).get(
component.getClientId(context));
if (param != null) {
Modified: trunk/ui/datascroller/src/main/templates/org/richfaces/htmlDatascroller.jspx
===================================================================
--- trunk/ui/datascroller/src/main/templates/org/richfaces/htmlDatascroller.jspx 2008-03-09 18:08:21 UTC (rev 6630)
+++ trunk/ui/datascroller/src/main/templates/org/richfaces/htmlDatascroller.jspx 2008-03-09 21:37:04 UTC (rev 6631)
@@ -26,9 +26,17 @@
<jsp:scriptlet>
<![CDATA[
javax.faces.component.UIData dataTable = component.getDataTable();
+
+ int maxPages = component.getMaxPages();
+ if (maxPages <= 1) {
+ maxPages = 1;
+ }
+
+ int pageCount = component.getPageCount(dataTable);
+
boolean singlePageRender = true;
- if (!isRenderedOnSinglePage(component, dataTable)) {
+ if (pageCount == 1 && !component.isRenderIfSinglePage()) {
singlePageRenderStyle = "; display: none";
singlePageRender = false;
}
18 years, 1 month
JBoss Rich Faces SVN: r6630 - branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-03-09 14:08:21 -0400 (Sun, 09 Mar 2008)
New Revision: 6630
Modified:
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java
Log:
Reverted changes from previous revision
Modified: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java 2008-03-08 14:32:55 UTC (rev 6629)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java 2008-03-09 18:08:21 UTC (rev 6630)
@@ -434,7 +434,7 @@
FacesMessage message = null;
if (null == messageStr) {
message =
- MessageUtil.getMessage(context, UIInput.UPDATE_MESSAGE_ID,
+ MessageUtil.getMessage(context, UIInput.CONVERSION_MESSAGE_ID,
new Object[] {MessageUtil.getLabel(context, this)});
}
else {
@@ -446,21 +446,21 @@
}
catch (FacesException e) {
FacesMessage message =
- MessageUtil.getMessage(context, UIInput.UPDATE_MESSAGE_ID,
+ MessageUtil.getMessage(context, UIInput.CONVERSION_MESSAGE_ID,
new Object[] {MessageUtil.getLabel(context, this)});
message.setSeverity(FacesMessage.SEVERITY_ERROR);
context.addMessage(getClientId(context), message);
setValid(false);
} catch (IllegalArgumentException e) {
FacesMessage message =
- MessageUtil.getMessage(context, UIInput.UPDATE_MESSAGE_ID,
+ MessageUtil.getMessage(context, UIInput.CONVERSION_MESSAGE_ID,
new Object[] {MessageUtil.getLabel(context, this)});
message.setSeverity(FacesMessage.SEVERITY_ERROR);
context.addMessage(getClientId(context), message);
setValid(false);
} catch (Exception e) {
FacesMessage message =
- MessageUtil.getMessage(context, UIInput.UPDATE_MESSAGE_ID,
+ MessageUtil.getMessage(context, UIInput.CONVERSION_MESSAGE_ID,
new Object[] {MessageUtil.getLabel(context, this)});
message.setSeverity(FacesMessage.SEVERITY_ERROR);
context.addMessage(getClientId(context), message);
18 years, 1 month
JBoss Rich Faces SVN: r6629 - branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-03-08 09:32:55 -0500 (Sat, 08 Mar 2008)
New Revision: 6629
Modified:
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java
Log:
Update model error messages changed to valid ones
Modified: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java 2008-03-08 14:31:11 UTC (rev 6628)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java 2008-03-08 14:32:55 UTC (rev 6629)
@@ -434,7 +434,7 @@
FacesMessage message = null;
if (null == messageStr) {
message =
- MessageUtil.getMessage(context, UIInput.CONVERSION_MESSAGE_ID,
+ MessageUtil.getMessage(context, UIInput.UPDATE_MESSAGE_ID,
new Object[] {MessageUtil.getLabel(context, this)});
}
else {
@@ -446,21 +446,21 @@
}
catch (FacesException e) {
FacesMessage message =
- MessageUtil.getMessage(context, UIInput.CONVERSION_MESSAGE_ID,
+ MessageUtil.getMessage(context, UIInput.UPDATE_MESSAGE_ID,
new Object[] {MessageUtil.getLabel(context, this)});
message.setSeverity(FacesMessage.SEVERITY_ERROR);
context.addMessage(getClientId(context), message);
setValid(false);
} catch (IllegalArgumentException e) {
FacesMessage message =
- MessageUtil.getMessage(context, UIInput.CONVERSION_MESSAGE_ID,
+ MessageUtil.getMessage(context, UIInput.UPDATE_MESSAGE_ID,
new Object[] {MessageUtil.getLabel(context, this)});
message.setSeverity(FacesMessage.SEVERITY_ERROR);
context.addMessage(getClientId(context), message);
setValid(false);
} catch (Exception e) {
FacesMessage message =
- MessageUtil.getMessage(context, UIInput.CONVERSION_MESSAGE_ID,
+ MessageUtil.getMessage(context, UIInput.UPDATE_MESSAGE_ID,
new Object[] {MessageUtil.getLabel(context, this)});
message.setSeverity(FacesMessage.SEVERITY_ERROR);
context.addMessage(getClientId(context), message);
18 years, 1 month