Author: nbelaevski
Date: 2010-11-10 08:17:12 -0500 (Wed, 10 Nov 2010)
New Revision: 20010
Modified:
sandbox/trunk/ui/notify/bom/pom.xml
sandbox/trunk/ui/notify/demo/pom.xml
sandbox/trunk/ui/notify/ui/pom.xml
sandbox/trunk/ui/notify/ui/src/main/java/org/richfaces/renderkit/html/NotifyMessagesRenderer.java
sandbox/trunk/ui/notify/ui/src/main/java/org/richfaces/renderkit/html/NotifyRenderer.java
sandbox/trunk/ui/notify/ui/src/main/java/org/richfaces/renderkit/html/NotifyStackRenderer.java
sandbox/trunk/ui/schedule/bom/pom.xml
sandbox/trunk/ui/schedule/demo/pom.xml
sandbox/trunk/ui/schedule/ui/pom.xml
sandbox/trunk/ui/schedule/ui/src/main/java/org/richfaces/component/AbstractSchedule.java
sandbox/trunk/ui/schedule/ui/src/main/java/org/richfaces/component/AbstractScheduleItem.java
sandbox/trunk/ui/schedule/ui/src/main/java/org/richfaces/renderkit/ScheduleRendererBase.java
sandbox/trunk/ui/schedule/ui/src/main/java/org/richfaces/renderkit/html/scripts/ScheduleMessages.java
sandbox/trunk/ui/schedule/ui/src/main/resources/META-INF/resources/richfaces.schedule.js
sandbox/trunk/ui/schedule/ui/src/main/templates/org/richfaces/schedule.template.xml
Log:
Sandbox components updated for new/refactored API
Modified: sandbox/trunk/ui/notify/bom/pom.xml
===================================================================
--- sandbox/trunk/ui/notify/bom/pom.xml 2010-11-10 11:29:26 UTC (rev 20009)
+++ sandbox/trunk/ui/notify/bom/pom.xml 2010-11-10 13:17:12 UTC (rev 20010)
@@ -39,15 +39,15 @@
<packaging>pom</packaging>
<properties>
-
<org.richfaces.core.version>4.0.0-SNAPSHOT</org.richfaces.core.version>
+ <org.richfaces.version>4.0.0-SNAPSHOT</org.richfaces.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>org.richfaces.ui.core</groupId>
- <artifactId>richfaces-ui-core-bom</artifactId>
- <version>${org.richfaces.core.version}</version>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-bom</artifactId>
+ <version>${org.richfaces.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Modified: sandbox/trunk/ui/notify/demo/pom.xml
===================================================================
--- sandbox/trunk/ui/notify/demo/pom.xml 2010-11-10 11:29:26 UTC (rev 20009)
+++ sandbox/trunk/ui/notify/demo/pom.xml 2010-11-10 13:17:12 UTC (rev 20010)
@@ -61,14 +61,6 @@
<artifactId>${jsf2.impl.artifactid}</artifactId>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
</dependencies>
</project>
Modified: sandbox/trunk/ui/notify/ui/pom.xml
===================================================================
--- sandbox/trunk/ui/notify/ui/pom.xml 2010-11-10 11:29:26 UTC (rev 20009)
+++ sandbox/trunk/ui/notify/ui/pom.xml 2010-11-10 13:17:12 UTC (rev 20010)
@@ -86,11 +86,6 @@
<!-- tests -->
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.jboss.test-jsf</groupId>
<artifactId>jsf-test-stage</artifactId>
<scope>test</scope>
Modified:
sandbox/trunk/ui/notify/ui/src/main/java/org/richfaces/renderkit/html/NotifyMessagesRenderer.java
===================================================================
---
sandbox/trunk/ui/notify/ui/src/main/java/org/richfaces/renderkit/html/NotifyMessagesRenderer.java 2010-11-10
11:29:26 UTC (rev 20009)
+++
sandbox/trunk/ui/notify/ui/src/main/java/org/richfaces/renderkit/html/NotifyMessagesRenderer.java 2010-11-10
13:17:12 UTC (rev 20010)
@@ -22,19 +22,20 @@
package org.richfaces.renderkit.html;
-import org.ajax4jsf.renderkit.RendererUtils;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.component.AbstractNotify;
-import org.richfaces.component.AbstractNotifyMessages;
+import java.io.IOException;
+import java.util.Iterator;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import java.io.IOException;
-import java.util.Iterator;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractNotify;
+import org.richfaces.component.AbstractNotifyMessages;
+import org.richfaces.renderkit.HtmlConstants;
+import org.richfaces.renderkit.util.RendererUtils;
+
@JsfRenderer(family = AbstractNotifyMessages.COMPONENT_FAMILY, type =
NotifyMessagesRenderer.RENDERER_TYPE)
public class NotifyMessagesRenderer extends NotifyRenderer {
@@ -44,8 +45,8 @@
public void encodeEnd(FacesContext context, UIComponent component) throws IOException
{
AbstractNotifyMessages messagesComponent = (AbstractNotifyMessages) component;
ResponseWriter writer = context.getResponseWriter();
- writer.startElement(HTML.DIV_ELEM, null);
- writer.writeAttribute(HTML.ID_ATTRIBUTE,
RendererUtils.getInstance().clientId(context, component), "type");
+ writer.startElement(HtmlConstants.DIV_ELEM, null);
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE,
RendererUtils.getInstance().clientId(context, component), "type");
Integer delay = messagesComponent.getDelay();
if (delay == null) {
delay = 0;
@@ -98,6 +99,6 @@
delay += interval;
msg.rendered();
}
- writer.endElement(HTML.DIV_ELEM);
+ writer.endElement(HtmlConstants.DIV_ELEM);
}
}
Modified:
sandbox/trunk/ui/notify/ui/src/main/java/org/richfaces/renderkit/html/NotifyRenderer.java
===================================================================
---
sandbox/trunk/ui/notify/ui/src/main/java/org/richfaces/renderkit/html/NotifyRenderer.java 2010-11-10
11:29:26 UTC (rev 20009)
+++
sandbox/trunk/ui/notify/ui/src/main/java/org/richfaces/renderkit/html/NotifyRenderer.java 2010-11-10
13:17:12 UTC (rev 20010)
@@ -22,24 +22,25 @@
package org.richfaces.renderkit.html;
-import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.renderkit.AjaxComponentRendererBase;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.component.AbstractNotify;
-import org.richfaces.component.AbstractNotifyStack;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
+import org.ajax4jsf.javascript.JSFunction;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractNotify;
+import org.richfaces.component.AbstractNotifyStack;
+import org.richfaces.renderkit.AjaxComponentRendererBase;
+import org.richfaces.renderkit.HtmlConstants;
+
@JsfRenderer(family = AbstractNotify.COMPONENT_FAMILY, type =
NotifyRenderer.RENDERER_TYPE)
@ResourceDependencies({
@ResourceDependency(library = "javax.faces", name = "jsf.js"),
@@ -77,14 +78,14 @@
return;
}
ResponseWriter writer = context.getResponseWriter();
- writer.startElement(HTML.DIV_ELEM, null);
- writer.writeAttribute(HTML.ID_ATTRIBUTE, getUtils().clientId(context, component),
"type");
- writer.startElement(HTML.SCRIPT_ELEM, null);
- writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript",
"type");
+ writer.startElement(HtmlConstants.DIV_ELEM, null);
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, getUtils().clientId(context,
component), "type");
+ writer.startElement(HtmlConstants.SCRIPT_ELEM, null);
+ writer.writeAttribute(HtmlConstants.TYPE_ATTR, "text/javascript",
"type");
writer.writeText(new JSFunction("RichFaces.Notify", getOptions(context,
(AbstractNotify) component)), null);
writer.writeText(";", null);
- writer.endElement(HTML.SCRIPT_ELEM);
- writer.endElement(HTML.DIV_ELEM);
+ writer.endElement(HtmlConstants.SCRIPT_ELEM);
+ writer.endElement(HtmlConstants.DIV_ELEM);
}
protected Map<String, Object> getOptions(FacesContext context, AbstractNotify
notify) throws IOException {
Modified:
sandbox/trunk/ui/notify/ui/src/main/java/org/richfaces/renderkit/html/NotifyStackRenderer.java
===================================================================
---
sandbox/trunk/ui/notify/ui/src/main/java/org/richfaces/renderkit/html/NotifyStackRenderer.java 2010-11-10
11:29:26 UTC (rev 20009)
+++
sandbox/trunk/ui/notify/ui/src/main/java/org/richfaces/renderkit/html/NotifyStackRenderer.java 2010-11-10
13:17:12 UTC (rev 20010)
@@ -22,22 +22,23 @@
package org.richfaces.renderkit.html;
-import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.renderkit.RendererUtils;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.component.AbstractNotifyStack;
-import org.richfaces.renderkit.AjaxComponentRendererBase;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
+import org.ajax4jsf.javascript.JSFunction;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractNotifyStack;
+import org.richfaces.renderkit.AjaxComponentRendererBase;
+import org.richfaces.renderkit.HtmlConstants;
+import org.richfaces.renderkit.util.RendererUtils;
+
@JsfRenderer(family = AbstractNotifyStack.COMPONENT_FAMILY, type =
NotifyStackRenderer.RENDERER_TYPE)
@ResourceDependencies({
@ResourceDependency(name = "jquery.js", target = "head"),
@@ -54,12 +55,12 @@
return;
}
ResponseWriter writer = context.getResponseWriter();
- writer.startElement(HTML.SCRIPT_ELEM, null);
+ writer.startElement(HtmlConstants.SCRIPT_ELEM, null);
writer.writeText(new JSFunction("RichFaces.NotifyStack.register",
RendererUtils.getInstance().clientId(context, component),
getOptions((AbstractNotifyStack) component)
), null);
- writer.endElement(HTML.SCRIPT_ELEM);
+ writer.endElement(HtmlConstants.SCRIPT_ELEM);
}
protected Map<String, Object> getOptions(AbstractNotifyStack stack) throws
IOException {
Modified: sandbox/trunk/ui/schedule/bom/pom.xml
===================================================================
--- sandbox/trunk/ui/schedule/bom/pom.xml 2010-11-10 11:29:26 UTC (rev 20009)
+++ sandbox/trunk/ui/schedule/bom/pom.xml 2010-11-10 13:17:12 UTC (rev 20010)
@@ -36,15 +36,15 @@
<packaging>pom</packaging>
<properties>
-
<org.richfaces.core.version>4.0.0-SNAPSHOT</org.richfaces.core.version>
+ <org.richfaces.version>4.0.0-SNAPSHOT</org.richfaces.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>org.richfaces.ui.core</groupId>
- <artifactId>richfaces-ui-core-bom</artifactId>
- <version>${org.richfaces.core.version}</version>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-bom</artifactId>
+ <version>${org.richfaces.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Modified: sandbox/trunk/ui/schedule/demo/pom.xml
===================================================================
--- sandbox/trunk/ui/schedule/demo/pom.xml 2010-11-10 11:29:26 UTC (rev 20009)
+++ sandbox/trunk/ui/schedule/demo/pom.xml 2010-11-10 13:17:12 UTC (rev 20010)
@@ -52,7 +52,7 @@
</dependency>
<dependency>
<groupId>org.richfaces.ui.misc</groupId>
- <artifactId>functions-ui</artifactId>
+ <artifactId>richfaces-ui-misc-ui</artifactId>
</dependency>
<dependency>
<groupId>org.richfaces.ui.notify</groupId>
@@ -69,14 +69,6 @@
<artifactId>${jsf2.impl.artifactid}</artifactId>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
</dependencies>
</project>
Modified: sandbox/trunk/ui/schedule/ui/pom.xml
===================================================================
--- sandbox/trunk/ui/schedule/ui/pom.xml 2010-11-10 11:29:26 UTC (rev 20009)
+++ sandbox/trunk/ui/schedule/ui/pom.xml 2010-11-10 13:17:12 UTC (rev 20010)
@@ -89,12 +89,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <!-- todo api? -->
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.jboss.test-jsf</groupId>
<artifactId>jsf-test-stage</artifactId>
<scope>test</scope>
Modified:
sandbox/trunk/ui/schedule/ui/src/main/java/org/richfaces/component/AbstractSchedule.java
===================================================================
---
sandbox/trunk/ui/schedule/ui/src/main/java/org/richfaces/component/AbstractSchedule.java 2010-11-10
11:29:26 UTC (rev 20009)
+++
sandbox/trunk/ui/schedule/ui/src/main/java/org/richfaces/component/AbstractSchedule.java 2010-11-10
13:17:12 UTC (rev 20010)
@@ -21,22 +21,18 @@
*/
package org.richfaces.component;
-import org.ajax4jsf.component.AjaxComponent;
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.event.AjaxEvent;
-import org.ajax4jsf.model.DataVisitResult;
-import org.ajax4jsf.model.DataVisitor;
-import org.ajax4jsf.model.ExtendedDataModel;
-import org.richfaces.cdk.annotations.Attribute;
-import org.richfaces.cdk.annotations.Description;
-import org.richfaces.cdk.annotations.EventName;
-import org.richfaces.cdk.annotations.JsfComponent;
-import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.cdk.annotations.Signature;
-import org.richfaces.cdk.annotations.Tag;
-import org.richfaces.cdk.annotations.TagType;
-import org.richfaces.component.event.*;
-import org.richfaces.component.model.DateRange;
+import java.io.IOException;
+import java.sql.ResultSet;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
import javax.el.ELContext;
import javax.el.MethodExpression;
@@ -53,19 +49,37 @@
import javax.faces.model.ResultSetDataModel;
import javax.faces.model.ScalarDataModel;
import javax.servlet.jsp.jstl.sql.Result;
-import java.io.IOException;
-import java.sql.ResultSet;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
+import org.ajax4jsf.component.AjaxComponent;
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.model.DataVisitResult;
+import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.model.ExtendedDataModel;
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.Description;
+import org.richfaces.cdk.annotations.EventName;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Signature;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.cdk.annotations.TagType;
+import org.richfaces.component.event.ScheduleDateRangeChangeEvent;
+import org.richfaces.component.event.ScheduleDateRangeChangeListener;
+import org.richfaces.component.event.ScheduleDateRangeSelectEvent;
+import org.richfaces.component.event.ScheduleDateRangeSelectListener;
+import org.richfaces.component.event.ScheduleDateSelectEvent;
+import org.richfaces.component.event.ScheduleDateSelectListener;
+import org.richfaces.component.event.ScheduleItemMoveEvent;
+import org.richfaces.component.event.ScheduleItemMoveListener;
+import org.richfaces.component.event.ScheduleItemResizeEvent;
+import org.richfaces.component.event.ScheduleItemResizeListener;
+import org.richfaces.component.event.ScheduleItemSelectEvent;
+import org.richfaces.component.event.ScheduleItemSelectListener;
+import org.richfaces.component.event.ScheduleListenerEventsProducer;
+import org.richfaces.component.event.ScheduleViewChangeEvent;
+import org.richfaces.component.event.ScheduleViewChangeListener;
+import org.richfaces.component.model.DateRange;
+
/**
* Base class for generation of UISchedule component.
*
@@ -138,9 +152,9 @@
public abstract void setDate(Date date);
- @Attribute(defaultValue = DEFAULT_SWITCH_TYPE,
+ @Attribute(defaultValue = "SwitchType." + DEFAULT_SWITCH_TYPE,
suggestedValue = SWITCH_TYPE_AJAX + "," + SWITCH_TYPE_SERVER +
"," + SWITCH_TYPE_CLIENT)
- public abstract String getSwitchType();
+ public abstract SwitchType getSwitchType();
@Attribute(defaultValue = DEFAULT_VIEW,
suggestedValue = VIEW_MONTH
@@ -322,6 +336,13 @@
@Attribute
public abstract String getWidgetVar();
+ private void setResponseData(Object data) {
+ FacesContext facesContext = getFacesContext();
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(facesContext);
+
+ ajaxContext.getResponseComponentDataMap().put(getClientId(facesContext), data);
+ }
+
/**
* React on various events.
* Vetoable events are first broadcasted to listeners bound via EL to
@@ -346,7 +367,6 @@
public void broadcast(FacesEvent event) throws AbortProcessingException {
if (event instanceof ScheduleDateRangeChangeEvent) {
super.broadcast(event);
- new AjaxEvent(this).queue();
ScheduleDateRangeChangeEvent calendarAjaxEvent =
(ScheduleDateRangeChangeEvent) event;
FacesContext facesContext = getFacesContext();
MethodExpression expression = getDateRangeChangeListener();
@@ -354,7 +374,7 @@
expression.invoke(facesContext.getELContext(), new Object[]{event});
}
try {
- setData(getScheduleData(calendarAjaxEvent.getStartDate(),
calendarAjaxEvent.getEndDate()));
+ setResponseData(getScheduleData(calendarAjaxEvent.getStartDate(),
calendarAjaxEvent.getEndDate()));
} catch (IOException ex) {
getFacesContext().getExternalContext().log("Cannot get schedule
data", ex);
}
@@ -366,9 +386,8 @@
Object result = expression.invoke(facesContext.getELContext(), new
Object[]{event});
allow = (Boolean) result;
}
- setData(allow);
+ setResponseData(allow);
super.broadcast(event);
- new AjaxEvent(this).queue();
} else if (event instanceof ScheduleItemResizeEvent) {
FacesContext facesContext = getFacesContext();
MethodExpression expression = getItemResizeListener();
@@ -377,12 +396,10 @@
Object result = expression.invoke(facesContext.getELContext(), new
Object[]{event});
allow = ((Boolean) result);
}
- setData(allow);
+ setResponseData(allow);
super.broadcast(event);
- new AjaxEvent(this).queue();
} else if (event instanceof ScheduleItemSelectEvent) {
super.broadcast(event);
- new AjaxEvent(this).queue();
FacesContext facesContext = getFacesContext();
MethodExpression expression = getItemSelectListener();
if (expression != null) {
@@ -390,7 +407,6 @@
}
} else if (event instanceof ScheduleViewChangeEvent) {
super.broadcast(event);
- new AjaxEvent(this).queue();
FacesContext facesContext = getFacesContext();
MethodExpression expression = getViewChangeListener();
if (expression != null) {
@@ -398,7 +414,6 @@
}
} else if (event instanceof ScheduleDateSelectEvent) {
super.broadcast(event);
- new AjaxEvent(this).queue();
FacesContext facesContext = getFacesContext();
MethodExpression expression = getDateSelectListener();
if (expression != null) {
@@ -406,37 +421,36 @@
}
} else if (event instanceof ScheduleDateRangeSelectEvent) {
super.broadcast(event);
- new AjaxEvent(this).queue();
FacesContext facesContext = getFacesContext();
MethodExpression expression = getDateRangeSelectListener();
if (expression != null) {
expression.invoke(facesContext.getELContext(), new Object[]{event});
}
- } else if (event instanceof AjaxEvent) {
- FacesContext context = getFacesContext();
- // complete re-Render fields. AjaxEvent deliver before render
- // response.
- AjaxContext.getCurrentInstance(context).addRegionsFromComponent(this);
- // Put data for send in response
- Object data = getData();
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- if (null != data) {
- ajaxContext.setResponseData(data);
- }
- String focus = getFocus();
- if (null != focus) {
- // search for component in tree.
- // XXX - use more pourful search, as in h:outputLabel
- // component.
-// UIComponent focusComponent = RendererUtils.getInstance().
-// findComponentFor(this, focus);
-// if (null != focusComponent) {
-// focus = focusComponent.getClientId(context);
-// }
-// TODO put focus data here
-// ajaxContext.getResponseDataMap().put(AjaxActionComponent.FOCUS_DATA_ID,
focus);
- }
- ajaxContext.setOncomplete(getOncomplete());
+// } else if (event instanceof AjaxEvent) {
+// FacesContext context = getFacesContext();
+// // complete re-Render fields. AjaxEvent deliver before render
+// // response.
+// AjaxContext.getCurrentInstance(context).addRegionsFromComponent(this);
+// // Put data for send in response
+// Object data = getData();
+// AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+// if (null != data) {
+// ajaxContext.setResponseData(data);
+// }
+// String focus = getFocus();
+// if (null != focus) {
+// // search for component in tree.
+// // XXX - use more pourful search, as in h:outputLabel
+// // component.
+//// UIComponent focusComponent = RendererUtils.getInstance().
+//// findComponentFor(this, focus);
+//// if (null != focusComponent) {
+//// focus = focusComponent.getClientId(context);
+//// }
+//// TODO put focus data here
+////
ajaxContext.getResponseDataMap().put(AjaxActionComponent.FOCUS_DATA_ID, focus);
+// }
+// ajaxContext.setOncomplete(getOncomplete());
} else {
super.broadcast(event);
}
Modified:
sandbox/trunk/ui/schedule/ui/src/main/java/org/richfaces/component/AbstractScheduleItem.java
===================================================================
---
sandbox/trunk/ui/schedule/ui/src/main/java/org/richfaces/component/AbstractScheduleItem.java 2010-11-10
11:29:26 UTC (rev 20009)
+++
sandbox/trunk/ui/schedule/ui/src/main/java/org/richfaces/component/AbstractScheduleItem.java 2010-11-10
13:17:12 UTC (rev 20010)
@@ -21,14 +21,15 @@
*/
package org.richfaces.component;
+import java.util.Date;
+
+import javax.faces.component.UIComponentBase;
+
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.annotations.TagType;
-import javax.faces.component.UIComponentBase;
-import java.util.Date;
-
@JsfComponent(tag = @Tag(name = "scheduleItem", type = TagType.Facelets))
public abstract class AbstractScheduleItem extends UIComponentBase {
@@ -58,7 +59,7 @@
@Attribute
public abstract String getUrl();
- @Attribute
+ @Attribute(defaultValue = "false")
public abstract Boolean isEditable();
public abstract Object getData();
Modified:
sandbox/trunk/ui/schedule/ui/src/main/java/org/richfaces/renderkit/ScheduleRendererBase.java
===================================================================
---
sandbox/trunk/ui/schedule/ui/src/main/java/org/richfaces/renderkit/ScheduleRendererBase.java 2010-11-10
11:29:26 UTC (rev 20009)
+++
sandbox/trunk/ui/schedule/ui/src/main/java/org/richfaces/renderkit/ScheduleRendererBase.java 2010-11-10
13:17:12 UTC (rev 20010)
@@ -1,12 +1,25 @@
package org.richfaces.renderkit;
+import java.io.IOException;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.faces.FacesException;
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UINamingContainer;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.JSObject;
import org.ajax4jsf.javascript.JSReference;
-import org.ajax4jsf.renderkit.AjaxEventOptions;
-import org.ajax4jsf.renderkit.AjaxRendererUtils;
-import org.ajax4jsf.renderkit.RendererUtils;
import org.richfaces.component.AbstractSchedule;
import org.richfaces.component.AbstractScheduleAgendaDayView;
import org.richfaces.component.AbstractScheduleAgendaWeekView;
@@ -14,6 +27,7 @@
import org.richfaces.component.AbstractScheduleBasicWeekView;
import org.richfaces.component.AbstractScheduleMonthView;
import org.richfaces.component.ScheduleCommonViewAttributes;
+import org.richfaces.component.SwitchType;
import org.richfaces.component.event.ScheduleDateRangeChangeEvent;
import org.richfaces.component.event.ScheduleDateRangeSelectEvent;
import org.richfaces.component.event.ScheduleDateSelectEvent;
@@ -21,22 +35,9 @@
import org.richfaces.component.event.ScheduleItemResizeEvent;
import org.richfaces.component.event.ScheduleItemSelectEvent;
import org.richfaces.component.event.ScheduleViewChangeEvent;
+import org.richfaces.renderkit.util.AjaxRendererUtils;
+import org.richfaces.renderkit.util.RendererUtils;
-import javax.faces.FacesException;
-import javax.faces.application.ResourceDependencies;
-import javax.faces.application.ResourceDependency;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UINamingContainer;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import java.io.IOException;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
@ResourceDependencies({
@ResourceDependency(library = "javax.faces", name = "jsf.js"),
@ResourceDependency(name = "jquery.js", target = "head"),
@@ -365,13 +366,13 @@
}
protected boolean isAjaxMode(AbstractSchedule component) {
- String mode = component.getSwitchType();
- return AbstractSchedule.SWITCH_TYPE_AJAX.equals(mode) ||
"".equals(mode) || null == mode;
+ SwitchType mode = component.getSwitchType();
+ return SwitchType.ajax.equals(mode) || null == mode;
}
protected boolean isClientMode(AbstractSchedule component) {
- String mode = component.getSwitchType();
- return AbstractSchedule.SWITCH_TYPE_CLIENT.equals(mode);
+ SwitchType mode = component.getSwitchType();
+ return SwitchType.client.equals(mode);
}
private void addOptionHash(String attribute, UIComponent source, Map<String,
Object> options) {
Modified:
sandbox/trunk/ui/schedule/ui/src/main/java/org/richfaces/renderkit/html/scripts/ScheduleMessages.java
===================================================================
---
sandbox/trunk/ui/schedule/ui/src/main/java/org/richfaces/renderkit/html/scripts/ScheduleMessages.java 2010-11-10
11:29:26 UTC (rev 20009)
+++
sandbox/trunk/ui/schedule/ui/src/main/java/org/richfaces/renderkit/html/scripts/ScheduleMessages.java 2010-11-10
13:17:12 UTC (rev 20010)
@@ -1,13 +1,5 @@
package org.richfaces.renderkit.html.scripts;
-import org.ajax4jsf.renderkit.RendererUtils;
-import org.richfaces.resource.AbstractCacheableResource;
-import org.richfaces.resource.DynamicResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.faces.application.Application;
-import javax.faces.context.FacesContext;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -17,15 +9,24 @@
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import javax.faces.application.Application;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.log.LogFactory;
+import org.richfaces.log.Logger;
+import org.richfaces.renderkit.HtmlConstants;
+import org.richfaces.resource.AbstractCacheableResource;
+import org.richfaces.resource.DynamicResource;
+
@DynamicResource
public class ScheduleMessages extends AbstractCacheableResource {
public static final String BUNDLE_NAME =
"org.richfaces.component.UIScheduleMessages";
private static final String MESSAGE_KEY_BASE =
"org.richfaces.component.UISchedule.";
- private static final Logger LOG = LoggerFactory.getLogger(ScheduleMessages.class);
+ private static final Logger LOG = LogFactory.getLogger(ScheduleMessages.class);
public ScheduleMessages() {
- setContentType(RendererUtils.HTML.JAVASCRIPT_TYPE);
+ setContentType(HtmlConstants.JAVASCRIPT_TYPE);
}
@Override
Modified:
sandbox/trunk/ui/schedule/ui/src/main/resources/META-INF/resources/richfaces.schedule.js
===================================================================
---
sandbox/trunk/ui/schedule/ui/src/main/resources/META-INF/resources/richfaces.schedule.js 2010-11-10
11:29:26 UTC (rev 20009)
+++
sandbox/trunk/ui/schedule/ui/src/main/resources/META-INF/resources/richfaces.schedule.js 2010-11-10
13:17:12 UTC (rev 20010)
@@ -4,8 +4,7 @@
var _this = this;
this.scheduleNode = document.getElementById(id);
- this.scheduleNode.richfaces = {};
- this.scheduleNode.richfaces.component = this;
+ this.scheduleNode[RichFaces.RICH_CONTAINER] = {component: this};
if (!this.scheduleNode) {
throw "No element with id '" + id + "' found.";
}
@@ -24,6 +23,10 @@
/**
* Utility functions.
*/
+ var getResponseData = function(event) {
+ return event.componentData[id];
+ }
+
// ---
/**
* Converts javascript date into integer that can be used as param
@@ -90,7 +93,8 @@
formatDateParam(startDate),
formatDateParam(endDate),
null, null, null,
- function(event, data) {
+ function(event) {
+ var data = getResponseData(event);
if (data != undefined) {
callback(data);
}
@@ -169,7 +173,9 @@
null,
null,
dayDelta, minuteDelta, allDay,
- function(event, decision) {
+ function(event) {
+ var decision = getResponseData(event);
+
var vetoed = false;
if (decision != undefined && decision !== true) {
revertFunc();
@@ -249,7 +255,8 @@
null,
null,
dayDelta, minuteDelta, null,
- function(event, decision) {
+ function(event) {
+ var decision = getResponseData(event);
var vetoed = false;
if (decision != undefined && decision !== true) {
revertFunc();
@@ -319,7 +326,9 @@
null,
itemSelectEventName,
item.id,
- null, null, null, null, null, function(event, data) {
+ null, null, null, null, null, function(event) {
+ var data = getResponseData(event);
+
if (options.onitemselect != null) {
RichFaces.Schedule.eval("(function(){" +
options.onitemselect + "})()", {
'item':item,
@@ -354,7 +363,8 @@
submitEventFunction(event,
null,
dateSelectEventName,
- null, formatDateParam(date), null, null, null, allDay,
function(event, data) {
+ null, formatDateParam(date), null, null, null, allDay,
function(event) {
+ var data = getResponseData(event);
if (options.ondateselect != null) {
RichFaces.Schedule.eval("(function(){" +
options.ondateselect + "})()", {
'date':date,
@@ -383,7 +393,8 @@
submitEventFunction({},
view.name,
viewChangeEventName,
- null, null, null, null, null, null, function(event, data) {
+ null, null, null, null, null, null, function(event) {
+ var data = getResponseData(event);
if (options.onviewchange != null) {
RichFaces.Schedule.eval("(function(){" +
options.onviewchange + "})()", {
'view':view,
@@ -433,7 +444,8 @@
null,
dateRangeSelectEventName,
null, formatDateParam(startDate), formatDateParam(endDate), null,
null, allDay,
- function(event, data) {
+ function(event) {
+ var data = getResponseData(event);
_this.refetchItems();
if (options.ondaterangeselect != null) {
RichFaces.Schedule.eval("(function(){" +
options.ondaterangeselect + "})()", {
Modified:
sandbox/trunk/ui/schedule/ui/src/main/templates/org/richfaces/schedule.template.xml
===================================================================
---
sandbox/trunk/ui/schedule/ui/src/main/templates/org/richfaces/schedule.template.xml 2010-11-10
11:29:26 UTC (rev 20009)
+++
sandbox/trunk/ui/schedule/ui/src/main/templates/org/richfaces/schedule.template.xml 2010-11-10
13:17:12 UTC (rev 20010)
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
-<cdk:root
xmlns="http://richfaces.org/cdk/xhtml-el"
+<cdk:root
xmlns="http://jboss.org/schema/richfaces/cdk/xhtml-el"
xmlns:h="http://java.sun.com/jsf/html"
-
xmlns:cdk="http://richfaces.org/cdk/core"
-
xmlns:c="http://richfaces.org/cdk/jstl/core"
-
xmlns:cc="http://richfaces.org/cdk/jsf/composite"
+
xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core"
+
xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core"
+
xmlns:cc="http://jboss.org/schema/richfaces/cdk/jsf/composite"
xmlns:javaee="http://java.sun.com/xml/ns/javaee">
<cc:interface>
@@ -17,7 +17,7 @@
<cc:implementation>
<cdk:call
-
expression="org.richfaces.component.util.FormUtil.throwEnclFormReqExceptionIfNeed(facesContext,
component);"/>
+
expression="org.richfaces.renderkit.util.FormUtil.throwEnclFormReqExceptionIfNeed(facesContext,
component);"/>
<div id="#{clientId}" class="rich-schedule
#{component.attributes['styleClass']}"/>
<script type="text/javascript">
<cdk:call
expression="writeInitFunction(facesContext,component);"/>