Author: nbelaevski
Date: 2009-08-18 05:40:41 -0400 (Tue, 18 Aug 2009)
New Revision: 15191
Added:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxCommandButton.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxCommandLink.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxFunction.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxLog.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxOutputPanel.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIMediaOutput.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIPush.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlAjaxFunction.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlMediaOutput.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlOutputPanel.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlPush.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/AjaxCommandRendererBase.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/AjaxComponentRendererBase.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/AjaxFunctionRendererBase.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/CommandRendererBase.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxCommandButtonRendererBase.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxFunctionRenderer1.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxOutputPanelRenderer.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxPushRenderer.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/MediaOutputRenderer.java
root/ui/trunk/components/core/src/main/java/org/richfaces/taglib/
root/ui/trunk/components/core/src/main/java/org/richfaces/taglib/html/
root/ui/trunk/components/core/src/main/java/org/richfaces/taglib/html/facelets/
root/ui/trunk/components/core/src/main/java/org/richfaces/taglib/html/facelets/MediaOutputHandler.java
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/button.template.xml
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/function.template.xml
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/link.template.xml
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/log.template.xml
Removed:
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxFunction.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxOutputPanel.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIMediaOutput.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPush.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/AjaxCommandRendererBase.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/LoadResourceRendererBase.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFunctionRenderer.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxOutputPanelRenderer.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/MediaOutputRenderer.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/resource/MediaOutputResource.java
root/ui/trunk/components/core/src/main/java/org/richfaces/taglib/html/facelets/AjaxPushHandler.java
root/ui/trunk/components/core/src/main/resources/META-INF/a4j.taglib.xml
root/ui/trunk/components/core/src/main/resources/META-INF/faces-config.xml
Log:
Big A1 components check-in
Deleted:
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxFunction.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxFunction.java 2009-08-18
09:24:53 UTC (rev 15190)
+++
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxFunction.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -1,37 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.component;
-
-
-/**
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.2 $ $Date: 2007/01/23 20:01:04 $
- *
- */
-public abstract class UIAjaxFunction extends AjaxActionComponent {
-
- public static final String COMPONENT_TYPE="org.ajax4jsf.Function";
-
- public abstract String getName();
-
- public abstract void setName(String name);
-}
Deleted:
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxOutputPanel.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxOutputPanel.java 2009-08-18
09:24:53 UTC (rev 15190)
+++
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxOutputPanel.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -1,42 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.component;
-
-import javax.faces.component.UIPanel;
-
-
-/**
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:26 $
- *
- */
-public abstract class UIAjaxOutputPanel extends UIPanel implements AjaxOutput {
-
- public static final String COMPONENT_TYPE = "org.ajax4jsf.OutputPanel";
- /**
- * @return
- */
- public abstract String getLayout();
-
- public abstract void setLayout(String layout);
-
-}
Deleted:
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIMediaOutput.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIMediaOutput.java 2009-08-18
09:24:53 UTC (rev 15190)
+++
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIMediaOutput.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -1,109 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.component;
-
-import javax.el.MethodExpression;
-
-import javax.faces.component.UIOutput;
-import javax.faces.el.MethodBinding;
-
-import org.ajax4jsf.resource.ResourceComponent2;
-import org.richfaces.webapp.taglib.MethodBindingMethodExpressionAdaptor;
-import org.richfaces.webapp.taglib.MethodExpressionMethodBindingAdaptor;
-
-
-/**
- * @author shura
- *
- */
-public abstract class UIMediaOutput extends UIOutput implements ResourceComponent2 {
-
- public static final String COMPONENT_TYPE = "org.ajax4jsf.MMedia";
-
- /**
- * Get URI attribute for resource ( src for images, href for links etc ).
- * @return
- */
- public abstract String getUriAttribute();
-
- /**
- * Set URI attribute for resource ( src for images, href for links etc ).
- * @param newvalue
- */
- public abstract void setUriAttribute(String newvalue);
-
- /**
- * Get Element name for rendering ( imj , a , object, applet ).
- * @return
- */
- public abstract String getElement();
-
- /**
- * Set Element name for rendering ( imj , a , object, applet ).
- * @param newvalue
- */
- public abstract void setElement(String newvalue);
-
- /**
- * Get EL binding to method in user bean to send resource. Method will
- * called with two parameters - restored data object and servlet output
- * stream.
- *
- * @return MethodBinding to createContent
- */
- public MethodBinding getCreateContent() {
- MethodBinding result = null;
- MethodExpression me = getCreateContentExpression();
-
- if (me != null) {
- // if the MethodExpression is an instance of our private
- // wrapper class.
- if (me.getClass().equals(MethodExpressionMethodBindingAdaptor.class)) {
- result = ((MethodExpressionMethodBindingAdaptor) me).getBinding();
- } else {
- // otherwise, this is a real MethodExpression. Wrap it
- // in a MethodBinding.
- result = new MethodBindingMethodExpressionAdaptor(me);
- }
- }
-
- return result;
- }
-
- /**
- * Set EL binding to method in user bean to send resource. Method will
- * called with two parameters - restored data object and servlet output
- * stream.
- *
- * @param newvalue - new value of createContent method binding
- */
- public void setCreateContent(MethodBinding newvalue) {
- MethodExpressionMethodBindingAdaptor adapter;
- if (newvalue != null) {
- adapter = new MethodExpressionMethodBindingAdaptor(newvalue);
- setCreateContentExpression(adapter);
- } else {
- setCreateContentExpression(null);
- }
- }
-
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPush.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPush.java 2009-08-18
09:24:53 UTC (rev 15190)
+++
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPush.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -1,113 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.component;
-
-import java.io.IOException;
-
-import javax.el.MethodExpression;
-import javax.faces.component.NamingContainer;
-import javax.faces.context.FacesContext;
-import javax.servlet.http.HttpSession;
-
-import org.ajax4jsf.webapp.PollEventsManager;
-import org.ajax4jsf.webapp.PushEventsCounter;
-
-/**
- * Component for periodically call AJAX events on server ( poll actions )
- * @author shura
- *
- */
-public abstract class UIPush extends AjaxActionComponent {
-
- public static final String COMPONENT_TYPE="org.ajax4jsf.Push";
-
-
- public static final String ON_DATA_AVAILABLE = "ondataavailable";
-
-
- private transient boolean _submitted = false;
-
- /**
- * @return the submitted
- */
- public boolean isSubmitted() {
- return _submitted;
- }
-
- public void encodeBegin(FacesContext context) throws IOException {
- MethodExpression producer = getEventProducer();
- // Subscribe events producer to push status listener.
- if(null != producer){
- producer.invoke(context.getELContext(), new Object[]{getListener(context)});
- }
- super.encodeBegin(context);
- }
-
- private PushEventsCounter getListener(FacesContext context){
- PollEventsManager eventsManeger = (PollEventsManager)
context.getExternalContext().getApplicationMap().get(PollEventsManager.EVENTS_MANAGER_KEY);
- return eventsManeger.getListener(getListenerId(context));
- }
-
- public String getListenerId(FacesContext context){
- Object session = context.getExternalContext().getSession(false);
- StringBuffer id = new StringBuffer();
- if(null != session && session instanceof HttpSession){
- HttpSession httpSession = (HttpSession) session;
- id.append(httpSession.getId());
- }
- id.append(context.getViewRoot().getViewId());
- id.append(NamingContainer.SEPARATOR_CHAR);
- id.append(getClientId(context));
- return id.toString();
- }
- /**
- * @param submitted the submitted to set
- */
- public void setSubmitted(boolean submitted) {
- _submitted = submitted;
- }
-
- public abstract MethodExpression getEventProducer();
-
- public abstract void setEventProducer(MethodExpression producer);
- /**
- * @return time in mc for polling interval.
- */
- public abstract int getInterval();
-
- /**
- * @param interval time in mc for polling interval.
- */
- public abstract void setInterval(int interval);
-
- public abstract boolean isEnabled();
-
- public abstract void setEnabled(boolean enable);
-
- protected void setupReRender(FacesContext facesContext) {
- super.setupReRender(facesContext);
-// AjaxContext.getCurrentInstance(facesContext).addComponentToAjaxRender(this);
- //getListener(facesContext).processed();
- }
-
-
-}
Deleted:
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/AjaxCommandRendererBase.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/AjaxCommandRendererBase.java 2009-08-18
09:24:53 UTC (rev 15190)
+++
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/AjaxCommandRendererBase.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -1,138 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.renderkit;
-
-import java.io.IOException;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.ValueHolder;
-import javax.faces.component.html.HtmlCommandButton;
-import javax.faces.context.FacesContext;
-import javax.faces.event.ActionEvent;
-
-import org.ajax4jsf.component.AjaxComponent;
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.event.AjaxEvent;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.3 $ $Date: 2007/02/12 17:46:53 $
- *
- */
-public abstract class AjaxCommandRendererBase extends AjaxComponentRendererBase {
-
- private static final Log _log = LogFactory
- .getLog(AjaxCommandRendererBase.class);
-
- protected void doDecode(FacesContext facesContext, UIComponent uiComponent) {
-
- // super.decode must not be called, because value is handled here
- if (isSubmitted(facesContext, uiComponent)) {
- ActionEvent event;
- event = new ActionEvent(uiComponent);
- uiComponent.queueEvent(event);
- uiComponent.queueEvent(new AjaxEvent(uiComponent));
- // Check areas for processing
- if (uiComponent instanceof AjaxComponent) {
- AjaxComponent ajaxComponent = (AjaxComponent) uiComponent;
- Set<String> toProcess = AjaxRendererUtils.asSet(ajaxComponent
- .getProcess());
- if (null != toProcess) {
- Set<String> componentIdsToProcess = new LinkedHashSet<String>();
- for (String componentId : toProcess) {
- UIComponent component = getUtils().findComponentFor(uiComponent, componentId);
- if(null != component){
- componentIdsToProcess.add(component.getClientId(facesContext));
- } else {
- componentIdsToProcess.add(componentId);
- }
- }
- AjaxContext.getCurrentInstance(facesContext).setAjaxAreasToProcess(componentIdsToProcess);
- }
- }
- }
- }
-
- public String getOnClick(FacesContext context, UIComponent component) {
- StringBuffer onClick;
- if (!getUtils().isBooleanAttribute(component, "disabled")) {
- onClick = AjaxRendererUtils.buildOnClick(component, context, true);
- if (!"reset".equals(component.getAttributes().get("type"))) {
- onClick.append(";return false;");
- }
- } else {
- onClick = new StringBuffer("return false;");
- }
- return onClick.toString();
- }
-
- public void encodeChildren(FacesContext context, UIComponent component)
- throws IOException {
- renderChildren(context, component);
- }
-
- public Object getValue(UIComponent uiComponent) {
- if (uiComponent instanceof ValueHolder) {
- return ((ValueHolder) uiComponent).getValue();
- }
- return uiComponent.getAttributes().get("value");
- }
-
- public String getType(UIComponent uiComponent) {
- String type;
- if (uiComponent instanceof HtmlCommandButton) {
- type = ((HtmlCommandButton) uiComponent).getType();
- } else {
- type = (String) uiComponent.getAttributes().get("type");
- }
- if (type == null) {
- type = "button";
- }
- return type;
- }
-
- protected boolean isSubmitted(FacesContext facesContext,
- UIComponent uiComponent) {
- // Componet accept only ajax requests.
- if (!AjaxContext.getCurrentInstance(facesContext).isAjaxRequest()) {
- return false;
- }
- if (getUtils().isBooleanAttribute(uiComponent, "disabled")) {
- return false;
- }
- String clientId = uiComponent.getClientId(facesContext);
- Map<String, String> paramMap = facesContext.getExternalContext()
- .getRequestParameterMap();
- Object value = paramMap.get(clientId);
- boolean submitted = null != value;
- if (submitted && _log.isDebugEnabled()) {
- _log.debug("Decode submit of the Ajax component " + clientId);
- }
- return submitted;
- }
-
-}
Deleted:
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java 2009-08-18
09:24:53 UTC (rev 15190)
+++
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -1,111 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.renderkit;
-
-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.context.FacesContext;
-import javax.faces.event.ActionEvent;
-
-import org.ajax4jsf.component.UIAjaxFunction;
-import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.javascript.JSFunctionDefinition;
-
-/**
- * @author shura
- *
- */
-@ResourceDependencies(value = {
- @ResourceDependency(library = "javax.faces", name = "jsf.js"),
- @ResourceDependency(name = "jquery.js"),
- @ResourceDependency(name = "richfaces.js")
- })
-public class AjaxFunctionRendererBase extends AjaxCommandRendererBase {
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
- */
- protected Class<? extends UIComponent> getComponentClass() {
- return UIAjaxFunction.class;
- }
-
- public String getFunction(FacesContext context, UIAjaxFunction component) {
- String functionName = component.getName();
- if (functionName == null) {
- throw new FacesException("Value of 'name' attribute of a4j:jsFunction
component is null!");
- }
-
- StringBuffer script = new StringBuffer(functionName).append("=");
- JSFunctionDefinition func = new JSFunctionDefinition();
- //func.setName(component.getName());
- // Create AJAX Submit function.
- JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(
- component, context, "RichFaces.ajax");
- Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context,
component);
- ajaxFunction.addParameter(options);
-
-// Map<String, Object> parameters = (Map<String, Object>)
options.get("parameters");
-// if (null == parameters) {
-// parameters = new HashMap<String, Object>();
-// options.put("parameters", parameters);
-// }
-// ajaxFunction.addParameter(JSReference.NULL);
-// ajaxFunction.addParameter(options);
-// // Fill parameters.
-// for (Iterator<UIComponent> it = component.getChildren().iterator();
it.hasNext();) {
-// UIComponent child = it.next();
-// if (child instanceof UIParameter) {
-// UIParameter parameter = ((UIParameter) child);
-// String name = parameter.getName();
-// func.addParameter(name);
-// // Put parameter name to AJAX.Submit parameter, with default value.
-// JSReference reference = new JSReference(name);
-// if (null != parameter.getValue()) {
-// reference = new JSReference(name + "||"
-// + ScriptUtils.toScript(parameters.get(name)));
-//
-// }
-// // Replace parameter value to reference.
-// parameters.put(name, reference);
-// }
-// }
- func.addToBody(ajaxFunction.toScript());
- func.appendScript(script);
- return script.toString();
- }
-
- @Override
- protected void doDecode(FacesContext facesContext, UIComponent uiComponent) {
- Map<String, String> requestParameterMap =
facesContext.getExternalContext().getRequestParameterMap();
- String clientId = uiComponent.getClientId(facesContext);
-
- if (requestParameterMap.get(clientId) != null) {
- new ActionEvent(uiComponent).queue();
- }
- }
-}
Deleted:
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/LoadResourceRendererBase.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/LoadResourceRendererBase.java 2009-08-18
09:24:53 UTC (rev 15190)
+++
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/LoadResourceRendererBase.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -1,97 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.renderkit;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.faces.FacesException;
-import javax.faces.application.Resource;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIOutput;
-import javax.faces.context.FacesContext;
-import javax.faces.render.Renderer;
-
-import org.ajax4jsf.component.UIResource;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.ajax4jsf.resource.InternetResource;
-import org.ajax4jsf.resource.URIInternetResource;
-
-/**
- * @author shura
- *
- */
-public class LoadResourceRendererBase extends RendererBase {
-
- private static final String
SCRIPT_COMPONENT_FAMILY="org.ajax4jsf.LoadScript";
- private static final String STYLE_COMPONENT_FAMILY="org.ajax4jsf.LoadStyle";
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
- */
- protected Class<? extends UIComponent> getComponentClass() {
- return UIResource.class;
- }
-
- public void encodeToHead(FacesContext context, UIComponent component) throws IOException
{
-// UIResource resource = (UIResource) component;
-// Object src = resource.getSrc();
-// if(null == src) {
-// throw new FacesException("Source for resource is null for component
"+resource.getClientId(context));
-// }
-//
-// String family = resource.getFamily();
-// Renderer renderer = null;
-// InternetResource internetResource = null;
-// Map<String, Object> attributes = Collections.emptyMap();
-//
-// if (SCRIPT_COMPONENT_FAMILY.equals(family)) {
-// renderer = context.getRenderKit().getRenderer(UIOutput.COMPONENT_FAMILY,
"javax.faces.resource.Script");
-// } else if (STYLE_COMPONENT_FAMILY.equals(family)) {
-// renderer = context.getRenderKit().getRenderer(UIOutput.COMPONENT_FAMILY,
"javax.faces.resource.Stylesheet");
-//
-// String media = (String) resource.getAttributes().get(HTML.media_ATTRIBUTE);
-// if (media != null && media.length() != 0) {
-// attributes = new HashMap<String, Object>();
-// attributes.put(HTML.media_ATTRIBUTE, media);
-// }
-// }
-//
-// if (src instanceof Resource) {
-// internetResource = (InternetResource) src;
-// } else {
-// if(resource.isRendered()){
-// String uri = context.getApplication().getViewHandler().
-// getResourceURL(context, src.toString());
-// uri = context.getExternalContext().encodeResourceURL(uri);
-// internetResource = new URIInternetResource(uri);
-// }
-// }
-//
-// if (internetResource != null) {
-// renderer.encode(internetResource, context, null, attributes);
-// }
- }
-
-}
Deleted:
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFunctionRenderer.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFunctionRenderer.java 2009-08-18
09:24:53 UTC (rev 15190)
+++
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFunctionRenderer.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -1,53 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.renderkit.html;
-
-import java.io.IOException;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.component.UIAjaxFunction;
-import org.ajax4jsf.renderkit.AjaxFunctionRendererBase;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-
-/**
- * @author Nick Belaevski
- *
- */
-public class AjaxFunctionRenderer extends AjaxFunctionRendererBase {
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.renderkit.RendererBase#encodeEnd(javax.faces.context.FacesContext,
javax.faces.component.UIComponent)
- */
- @Override
- public void encodeEnd(FacesContext context, UIComponent component)
- throws IOException {
- super.encodeEnd(context, component);
- ResponseWriter writer = context.getResponseWriter();
- writer.startElement(HTML.SCRIPT_ELEM, component);
- writer.writeAttribute(HTML.id_ATTRIBUTE, component.getClientId(context),
"id");
- writer.writeText(getFunction(context, (UIAjaxFunction) component), null);
- writer.endElement(HTML.SCRIPT_ELEM);
- }
-}
Deleted:
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxOutputPanelRenderer.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxOutputPanelRenderer.java 2009-08-18
09:24:53 UTC (rev 15190)
+++
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxOutputPanelRenderer.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -1,144 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.renderkit.html;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.component.UIAjaxOutputPanel;
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.renderkit.RendererBase;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-
-
-/**
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:27 $
- *
- */
-public class AjaxOutputPanelRenderer extends RendererBase {
-
- private final String[] STYLE_ATTRIBUTES = new
String[]{"style","class"};
-
- /* (non-Javadoc)
- * @see javax.faces.render.Renderer#encodeChildren(javax.faces.context.FacesContext,
javax.faces.component.UIComponent)
- */
- public void encodeChildren(FacesContext context, UIComponent component) throws
IOException {
- //
- UIAjaxOutputPanel panel = (UIAjaxOutputPanel) component;
- if ("none".equals(panel.getLayout())) {
- if (component.getChildCount() > 0) {
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- boolean ajaxRequest = ajaxContext.isAjaxRequest();
- Set<String> ajaxRenderedAreas = ajaxContext.getAjaxRenderedAreas();
- for (UIComponent child : component.getChildren()) {
- String childId = child.getClientId(context);
- if (child.isRendered()) {
- renderChild(context, child);
- } else {
- // Render "dummy" span.
- ResponseWriter out = context.getResponseWriter();
- out.startElement(HTML.SPAN_ELEM,child);
- out.writeAttribute(HTML.id_ATTRIBUTE,childId,HTML.id_ATTRIBUTE);
- out.writeAttribute(HTML.style_ATTRIBUTE,"display:
none;","style");
- out.endElement(HTML.SPAN_ELEM);
- }
- // register child as rendered
- if(ajaxRequest && null != ajaxRenderedAreas) {
- ajaxRenderedAreas.add(childId);
- }
- }
- }
-
- } else {
- renderChildren(context,component);
- }
- }
-
- /* (non-Javadoc)
- * @see javax.faces.render.Renderer#getRendersChildren()
- */
- public boolean getRendersChildren() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
- */
- protected Class<? extends UIComponent> getComponentClass() {
- return UIAjaxOutputPanel.class;
- }
-
- /* (non-Javadoc)
- * @see
org.ajax4jsf.renderkit.RendererBase#doEncodeBegin(javax.faces.context.ResponseWriter,
javax.faces.context.FacesContext, javax.faces.component.UIComponent)
- */
- protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException {
- UIAjaxOutputPanel panel = (UIAjaxOutputPanel) component;
- if (!"none".equals(panel.getLayout())) {
- writer.startElement(getTag(panel), panel);
- getUtils().encodeId(context, component);
- getUtils().encodePassThru(context, component);
- getUtils().encodeAttributesFromArray(context,component,STYLE_ATTRIBUTES);
- }
- }
-
- /**
- * @param panel
- * @return
- */
- private String getTag(UIAjaxOutputPanel panel) {
- return "block".equals(panel.getLayout())?HTML.DIV_ELEM:HTML.SPAN_ELEM;
- }
-
- /* (non-Javadoc)
- * @see
org.ajax4jsf.renderkit.RendererBase#doEncodeEnd(javax.faces.context.ResponseWriter,
javax.faces.context.FacesContext, javax.faces.component.UIComponent)
- */
- protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException {
- UIAjaxOutputPanel panel = (UIAjaxOutputPanel) component;
- if (!"none".equals(panel.getLayout())) {
- writer.endElement(getTag(panel));
- }
- if (panel.isKeepTransient()) {
- markNoTransient(component);
- }
- }
-
- /**
- * Set "transient" flag to false for component and all its children (
recursive ).
- * @param component
- */
- private void markNoTransient(UIComponent component) {
- for (Iterator<UIComponent> iter = component.getFacetsAndChildren();
iter.hasNext();) {
- UIComponent element = iter.next();
- markNoTransient(element);
- element.setTransient(false);
- }
-
- }
-
-
-}
Deleted:
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java 2009-08-18
09:24:53 UTC (rev 15190)
+++
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -1,128 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.renderkit.html;
-
-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.component.behavior.ClientBehavior;
-import javax.faces.component.behavior.ClientBehaviorContext;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.component.UIPush;
-import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.javascript.JSFunctionDefinition;
-import org.ajax4jsf.renderkit.RendererBase;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-
-/**
- * @author shura
- *
- */
-@ResourceDependencies(value = {
- @ResourceDependency(library = "javax.faces", name = "jsf.js"),
- @ResourceDependency(name = "jquery.js"),
- @ResourceDependency(name = "richfaces.js")
-})
-public class AjaxPushRenderer extends RendererBase {
-
- public static final String PUSH_INTERVAL_PARAMETER =
"A4J.AJAX.Push.INTERVAL";
-
- public static final String PUSH_WAIT_PARAMETER = "A4J.AJAX.Push.WAIT";
-
- @Deprecated
- public static final String PUSH_URL_PARAMETER = "A4J.AJAX.Push.URL";
-
- public static final int DEFAULT_PUSH_INTERVAL = 1000;
-
- public static final int DEFAULT_PUSH_WAIT = Integer.MIN_VALUE;
-
- private static final String AJAX_PUSH_FUNCTION = "A4J.AJAX.Push";
-
- /* (non-Javadoc)
- * @see
org.ajax4jsf.renderkit.RendererBase#doEncodeEnd(javax.faces.context.ResponseWriter,
javax.faces.context.FacesContext, javax.faces.component.UIComponent)
- */
- protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException {
- UIPush push = (UIPush) component;
- writer.startElement(HTML.SPAN_ELEM, component);
- writer.writeAttribute(HTML.style_ATTRIBUTE, "display:none;", null);
- getUtils().encodeId(context, component);
-
- //TODO - ?
- getUtils().encodeBeginFormIfNessesary(context, component);
- // pushing script.
- writer.startElement(HTML.SCRIPT_ELEM, component);
- writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
- StringBuffer script = new StringBuffer("\n");
- if (push.isEnabled()) {
- JSFunction function = new JSFunction("RichFaces.startPush");
- // Set dummy form id, if nessesary.
- Map<String, Object> options = new HashMap<String, Object>();
-
- int interval = push.getInterval();
- if (!getUtils().shouldRenderAttribute(interval)) {
- String intervalInitParameter =
context.getExternalContext().getInitParameter(PUSH_INTERVAL_PARAMETER);
- if(null != intervalInitParameter){
- interval = Integer.parseInt(intervalInitParameter);
- } else {
- interval = DEFAULT_PUSH_INTERVAL;
- }
- }
-
- options.put("interval", new Integer(interval));
- options.put("pushId", push.getListenerId(context));
- ClientBehaviorContext behaviorContext =
ClientBehaviorContext.createClientBehaviorContext(context, push,
push.getDefaultEventName(), push.getClientId(context), null);
- ClientBehavior clientBehavior =
push.getClientBehaviors().get(push.getDefaultEventName()).get(0);
- options.put(UIPush.ON_DATA_AVAILABLE, new
JSFunctionDefinition("event").addToBody(clientBehavior.getScript(behaviorContext)));
- function.addParameter(options);
- script.append(function.toScript());
- } else {
- script.append("RichFaces.stopPush('").append(push.getListenerId(context)).append("')");
- }
- script.append(";\n");
- writer.writeText(script.toString(),null);
- writer.endElement(HTML.SCRIPT_ELEM);
- getUtils().encodeEndFormIfNessesary(context, component);
- writer.endElement(HTML.SPAN_ELEM);
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
- */
- protected Class<? extends UIComponent> getComponentClass() {
- // only push component is allowed.
- return UIPush.class;
- }
-
-// protected boolean isSubmitted(FacesContext facesContext, UIComponent uiComponent) {
-// boolean submitted = super.isSubmitted(facesContext, uiComponent);
-// UIPush push = (UIPush) uiComponent;
-// push.setSubmitted(submitted);
-// return submitted;
-// }
-
-}
Deleted:
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/MediaOutputRenderer.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/MediaOutputRenderer.java 2009-08-18
09:24:53 UTC (rev 15190)
+++
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/MediaOutputRenderer.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -1,134 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.renderkit.html;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIParameter;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.component.UIMediaOutput;
-import org.ajax4jsf.renderkit.RendererBase;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.ajax4jsf.resource.InternetResource;
-import org.richfaces.resource.InternetResourceBuilder;
-
-/**
- * @author shura
- *
- */
-public class MediaOutputRenderer extends RendererBase {
-
- public static final String RENDERER_TYPE = "org.ajax4jsf.MMediaRenderer";
-
- /**
- * Associationd between element name and uri attributes
- */
- private static final Map uriAttributes;
-
- static {
- uriAttributes = new HashMap();
- uriAttributes.put("a","href");
- uriAttributes.put("img","src");
- uriAttributes.put("object","data");
- uriAttributes.put("link","href");
- }
-
-
- /* (non-Javadoc)
- * @see
org.ajax4jsf.renderkit.RendererBase#doEncodeEnd(javax.faces.context.ResponseWriter,
javax.faces.context.FacesContext, javax.faces.component.UIComponent)
- */
- protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException {
- UIMediaOutput mmedia = (UIMediaOutput) component;
- String element = mmedia.getElement();
- if(null == element){
- throw new
FacesException(Messages.getMessage(Messages.NULL_ATTRIBUTE_ERROR,"element",component.getClientId(context)));
- }
- writer.endElement(element);
- }
-
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
- */
- protected Class getComponentClass() {
- // TODO Auto-generated method stub
- return UIMediaOutput.class;
- }
-
-
- /* (non-Javadoc)
- * @see
org.ajax4jsf.renderkit.RendererBase#doEncodeBegin(javax.faces.context.ResponseWriter,
javax.faces.context.FacesContext, javax.faces.component.UIComponent)
- */
- protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException {
- UIMediaOutput mmedia = (UIMediaOutput) component;
- String element = mmedia.getElement();
- if(null == element){
- throw new
FacesException(Messages.getMessage(Messages.NULL_ATTRIBUTE_ERROR,"element",component.getClientId(context)));
- }
- String uriAttribute = mmedia.getUriAttribute();
- // Check for pre-defined attributes
- if(null == uriAttribute){
- uriAttribute = (String) uriAttributes.get(element);
- if(null == uriAttribute){
- throw new
FacesException(Messages.getMessage(Messages.NULL_ATTRIBUTE_ERROR,"uriAttribute",component.getClientId(context)));
- }
- }
- writer.startElement(element,mmedia);
- getUtils().encodeId(context,component);
- InternetResourceBuilder internetResourceBuilder =
InternetResourceBuilder.getInstance();
- InternetResource resource =
internetResourceBuilder.createUserResource(mmedia.isCacheable(),mmedia.isSession(),mmedia.getMimeType());
- StringBuffer uri = new StringBuffer(resource.getUri(context,mmedia));
- // Append parameters to resource Uri
- boolean haveQestion = uri.indexOf("?")>=0;
- Iterator kids = component.getChildren().iterator();
- while (kids.hasNext()) {
- UIComponent kid = (UIComponent) kids.next();
-
- if (kid instanceof UIParameter) {
- UIParameter uiParam = (UIParameter) kid;
- String name = uiParam.getName();
- Object value = uiParam.getValue();
- if(null != value){
- if(haveQestion){
- uri.append('&');
- } else {
- uri.append('?');
- haveQestion = true;
- }
- uri.append(name).append('=').append(value.toString());
- }
- }
- }
- writer.writeURIAttribute(uriAttribute,uri,"uri");
- getUtils().encodeAttributesFromArray(context,component,HTML.PASS_THRU_STYLES);
- getUtils().encodePassThru(context,mmedia);
- }
-
-}
Added:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxCommandButton.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxCommandButton.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxCommandButton.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,39 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import javax.faces.component.UIComponentBase;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class UIAjaxCommandButton extends UIComponentBase {
+
+ public static final String COMPONENT_FAMILY =
"org.richfaces.AjaxCommandButton";
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+}
Added:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxCommandLink.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxCommandLink.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxCommandLink.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,39 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import javax.faces.component.UIComponentBase;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class UIAjaxCommandLink extends UIComponentBase {
+
+ public static final String COMPONENT_FAMILY =
"org.richfaces.AjaxCommandLink";
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+}
Added:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxFunction.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxFunction.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxFunction.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,38 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import org.ajax4jsf.component.AjaxActionComponent;
+
+/**
+ * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.2 $ $Date: 2007/01/23 20:01:04 $
+ *
+ */
+public abstract class UIAjaxFunction extends AjaxActionComponent {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.Function";
+
+ public abstract String getName();
+
+ public abstract void setName(String name);
+}
Added: root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxLog.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxLog.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxLog.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,43 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import javax.faces.component.UIComponentBase;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class UIAjaxLog extends UIComponentBase {
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.AjaxLog";
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public boolean isPopup() {
+ //FIXME: common stuff goes here
+ return false;
+ }
+}
Copied:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxOutputPanel.java
(from rev 15164,
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIAjaxOutputPanel.java)
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxOutputPanel.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxOutputPanel.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,65 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import javax.faces.component.UIPanel;
+
+import org.ajax4jsf.component.AjaxOutput;
+
+
+/**
+ * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:26 $
+ *
+ */
+public class UIAjaxOutputPanel extends UIPanel implements AjaxOutput {
+
+ public static final String COMPONENT_TYPE =
"org.richfaces.AjaxOutputPanel";
+
+ private static enum PropertyKeys {
+ ajaxRendered,
+ keepTransient
+ };
+
+ public UIAjaxOutputPanel() {
+ super();
+ setRendererType("org.richfaces.OutputPanelRenderer");
+ }
+
+ public boolean isAjaxRendered() {
+ return Boolean.valueOf(getStateHelper().eval(PropertyKeys.ajaxRendered,
Boolean.FALSE).
+ toString());
+ }
+
+ public boolean isKeepTransient() {
+ return Boolean.valueOf(getStateHelper().eval(PropertyKeys.keepTransient,
Boolean.FALSE).
+ toString());
+ }
+
+ public void setAjaxRendered(boolean ajaxRendered) {
+ getStateHelper().put(PropertyKeys.ajaxRendered, ajaxRendered);
+ }
+
+ public void setKeepTransient(boolean keepTransient) {
+ getStateHelper().put(PropertyKeys.keepTransient, keepTransient);
+ }
+}
Copied:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIMediaOutput.java
(from rev 15175,
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIMediaOutput.java)
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIMediaOutput.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIMediaOutput.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,120 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import javax.el.MethodExpression;
+import javax.faces.application.Resource;
+import javax.faces.application.ResourceHandler;
+import javax.faces.component.UIOutput;
+import javax.faces.context.FacesContext;
+import javax.faces.el.MethodBinding;
+
+import org.ajax4jsf.resource.ResourceComponent2;
+import org.richfaces.resource.MediaOutputResource;
+import org.richfaces.webapp.taglib.MethodBindingMethodExpressionAdaptor;
+import org.richfaces.webapp.taglib.MethodExpressionMethodBindingAdaptor;
+
+
+/**
+ * @author shura
+ *
+ */
+public abstract class UIMediaOutput extends UIOutput implements ResourceComponent2 {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.MediaOutput";
+
+ /**
+ * Get URI attribute for resource ( src for images, href for links etc ).
+ * @return
+ */
+ public abstract String getUriAttribute();
+
+ /**
+ * Set URI attribute for resource ( src for images, href for links etc ).
+ * @param newvalue
+ */
+ public abstract void setUriAttribute(String newvalue);
+
+ /**
+ * Get Element name for rendering ( imj , a , object, applet ).
+ * @return
+ */
+ public abstract String getElement();
+
+ /**
+ * Set Element name for rendering ( imj , a , object, applet ).
+ * @param newvalue
+ */
+ public abstract void setElement(String newvalue);
+
+ /**
+ * Get EL binding to method in user bean to send resource. Method will
+ * called with two parameters - restored data object and servlet output
+ * stream.
+ *
+ * @return MethodBinding to createContent
+ */
+ public MethodBinding getCreateContent() {
+ MethodBinding result = null;
+ MethodExpression me = getCreateContentExpression();
+
+ if (me != null) {
+ // if the MethodExpression is an instance of our private
+ // wrapper class.
+ if (me instanceof MethodExpressionMethodBindingAdaptor) {
+ result = ((MethodExpressionMethodBindingAdaptor) me).getBinding();
+ } else {
+ // otherwise, this is a real MethodExpression. Wrap it
+ // in a MethodBinding.
+ result = new MethodBindingMethodExpressionAdaptor(me);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Set EL binding to method in user bean to send resource. Method will
+ * called with two parameters - restored data object and servlet output
+ * stream.
+ *
+ * @param newvalue - new value of createContent method binding
+ */
+ public void setCreateContent(MethodBinding newvalue) {
+ MethodExpressionMethodBindingAdaptor adapter;
+ if (newvalue != null) {
+ adapter = new MethodExpressionMethodBindingAdaptor(newvalue);
+ setCreateContentExpression(adapter);
+ } else {
+ setCreateContentExpression(null);
+ }
+ }
+
+ public Resource getResource() {
+ FacesContext facesContext = getFacesContext();
+ ResourceHandler resourceHandler = facesContext.getApplication().getResourceHandler();
+ MediaOutputResource resource = (MediaOutputResource)
resourceHandler.createResource(MediaOutputResource.class.getName());
+ resource.initialize(this);
+
+ return resource;
+ }
+}
Copied: root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIPush.java
(from rev 15175,
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPush.java)
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIPush.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIPush.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,127 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Collections;
+
+import javax.el.MethodExpression;
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpSession;
+
+/**
+ * Component for periodically call AJAX events on server ( poll actions )
+ * @author shura
+ *
+ */
+public class UIPush extends UIComponentBase implements ClientBehaviorHolder {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.Push";
+
+ public final static String COMPONENT_FAMILY = "org.richfaces.Push";
+
+ public static final String ON_DATA_AVAILABLE = "ondataavailable";
+
+ private static final Collection<String> EVENT_NAMES =
Collections.singleton(ON_DATA_AVAILABLE);
+
+ private static enum PropertyKeys {
+ eventProducer, enabled, interval
+ }
+
+ public void encodeBegin(FacesContext context) throws IOException {
+ MethodExpression producer = getEventProducer();
+ // Subscribe events producer to push status listener.
+ if (null != producer) {
+ producer.invoke(context.getELContext(), new Object[]{getListener(context)});
+ }
+
+ super.encodeBegin(context);
+ }
+
+ private PushEventTracker getListener(FacesContext context) {
+ PushListenersManager pushListenersManager = PushListenersManager.getInstance(context);
+ return pushListenersManager.getListener(getListenerId(context));
+ }
+
+ public String getListenerId(FacesContext context){
+ Object session = context.getExternalContext().getSession(false);
+ StringBuffer id = new StringBuffer();
+ if(null != session && session instanceof HttpSession){
+ HttpSession httpSession = (HttpSession) session;
+ id.append(httpSession.getId());
+ }
+ id.append(context.getViewRoot().getViewId());
+ id.append(NamingContainer.SEPARATOR_CHAR);
+ id.append(getClientId(context));
+ return id.toString();
+ }
+
+ public MethodExpression getEventProducer() {
+ return (MethodExpression) getStateHelper().get(PropertyKeys.eventProducer);
+ }
+
+ public void setEventProducer(MethodExpression producer) {
+ getStateHelper().put(PropertyKeys.eventProducer, producer);
+ }
+
+ /**
+ * @return time in mc for polling interval.
+ */
+ public int getInterval() {
+ return (Integer) getStateHelper().eval(PropertyKeys.interval, 1000);
+ }
+
+ /**
+ * @param interval time in mc for polling interval.
+ */
+ public void setInterval(int interval) {
+ getStateHelper().put(PropertyKeys.interval, interval);
+ }
+
+ public boolean isEnabled() {
+ return Boolean.valueOf(getStateHelper().eval(PropertyKeys.enabled,
Boolean.TRUE).toString());
+ }
+
+ public void setEnabled(boolean enable) {
+ getStateHelper().put(PropertyKeys.enabled, enable);
+ }
+
+ @Override
+ public String getDefaultEventName() {
+ return ON_DATA_AVAILABLE;
+ }
+
+ @Override
+ public Collection<String> getEventNames() {
+ return EVENT_NAMES;
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+}
Added:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlAjaxFunction.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlAjaxFunction.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlAjaxFunction.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,619 @@
+package org.richfaces.component.html;
+
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.component.UIAjaxFunction;
+
+public class HtmlAjaxFunction extends UIAjaxFunction {
+
+ public final static String COMPONENT_FAMILY = "javax.faces.Command";
+
+ public final static String COMPONENT_TYPE = "org.richfaces.Function";
+
+ public HtmlAjaxFunction() {
+ setRendererType("org.richfaces.FunctionRenderer");
+ }
+
+ /*
+ * Limits JSF tree processing (decoding, conversion, validation and model updating) only
to a component that sends the request. Boolean
+ */
+ private boolean _ajaxSingle = false;
+
+ private boolean _ajaxSingleSet = false;
+
+ /*
+ * If "true", after process validations phase it skips updates of model beans
on a force render response. It can be used for validating components input
+ */
+ private boolean _bypassUpdates = false;
+
+ private boolean _bypassUpdatesSet = false;
+
+ /*
+ * Serialized (on default with JSON) data passed on the client by a developer on AJAX
request. It's accessible via "data.foo" syntax
+ */
+ private Object _data = null;
+
+ /*
+ * Name of requests queue to avoid send next request before complete other from same
event. Can be used to reduce number of requests of frequently events (key press, mouse
move etc.)
+ */
+ private String _eventsQueue = null;
+
+ /*
+ * ID of an element to set focus after request is completed on client side
+ */
+ private String _focus = null;
+
+ /*
+ * Attribute allows to ignore an Ajax Response produced by a request if the newest
'similar' request is
+in a queue already. ignoreDupResponses="true" does not cancel the request while
it is processed on the server,
+but just allows to avoid unnecessary updates on the client side if the response isn't
actual now
+ */
+ private boolean _ignoreDupResponses = false;
+
+ private boolean _ignoreDupResponsesSet = false;
+
+ /*
+ * If "true", then of all AJAX-rendered on the page components only those will
be updated,
+ which ID's are passed to the "reRender" attribute of the describable
component.
+ "false"-the default value-means that all components with
ajaxRendered="true" will be updated.
+ */
+ private boolean _limitToList = false;
+
+ private boolean _limitToListSet = false;
+
+ /*
+ * Name of generated JavaScript function definition
+ */
+ private String _name = null;
+
+ /*
+ * The client-side script method to be called before DOM is updated
+ */
+ private String _onbeforedomupdate = null;
+
+ /*
+ * The client-side script method to be called after the request is completed
+ */
+ private String _oncomplete = null;
+
+ /*
+ * Id['s] (in format of call UIComponent.findComponent()) of components, processed
at the phases 2-5 in case of AjaxRequest caused by this component. Can be single id,
comma-separated list of Id's, or EL Expression with array or Collection
+ */
+ private Object _process = null;
+
+ /*
+ * Id['s] (in format of call UIComponent.findComponent()) of components, rendered
in case of AjaxRequest caused by this component. Can be single id, comma-separated list
of Id's, or EL Expression with array or Collection
+ */
+ private Object _reRender = null;
+
+ /*
+ * Attribute defines the time (in ms.) that the request will be wait in the queue before
it is ready to send.
+When the delay time is over, the request will be sent to the server or removed if the
newest 'similar' request is in a queue already
+ */
+ private int _requestDelay = Integer.MIN_VALUE;
+
+ private boolean _requestDelaySet = false;
+
+ /*
+ * If there are any component requests with identical IDs then these requests will be
grouped.
+ */
+ private String _similarityGroupingId = null;
+
+ /*
+ * ID (in format of call UIComponent.findComponent()) of Request status component
+ */
+ private String _status = null;
+
+ /*
+ * Response waiting time on a particular request. If a response is not received during
this time, the request is aborted
+ */
+ private int _timeout = Integer.MIN_VALUE;
+
+ private boolean _timeoutSet = false;
+
+ public boolean isAjaxSingle(){
+ if (this._ajaxSingleSet) {
+ return (this._ajaxSingle);
+ }
+ ValueExpression ve = getValueExpression("ajaxSingle");
+ if (ve != null) {
+ Boolean value = null;
+
+ try {
+ value = (Boolean) ve.getValue(getFacesContext().getELContext());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+
+ if (null == value) {
+ return (this._ajaxSingle);
+ }
+
+ return value;
+ } else {
+ return (this._ajaxSingle);
+ }
+
+ }
+
+ public void setAjaxSingle(boolean _ajaxSingle){
+ this._ajaxSingle = _ajaxSingle;
+ this._ajaxSingleSet = true;
+ }
+
+ public boolean isBypassUpdates(){
+ if (this._bypassUpdatesSet) {
+ return (this._bypassUpdates);
+ }
+ ValueExpression ve = getValueExpression("bypassUpdates");
+ if (ve != null) {
+ Boolean value = null;
+
+ try {
+ value = (Boolean) ve.getValue(getFacesContext().getELContext());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+
+ if (null == value) {
+ return (this._bypassUpdates);
+ }
+
+ return value;
+ } else {
+ return (this._bypassUpdates);
+ }
+
+ }
+
+ public void setBypassUpdates(boolean _bypassUpdates){
+ this._bypassUpdates = _bypassUpdates;
+ this._bypassUpdatesSet = true;
+ }
+
+ public Object getData(){
+ if (this._data != null) {
+ return this._data;
+ }
+ ValueExpression ve = getValueExpression("data");
+ if (ve != null) {
+ Object value = null;
+
+ try {
+ value = (Object) ve.getValue(getFacesContext().getELContext());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+
+ return value;
+ }
+
+ return null;
+
+
+ }
+
+ public void setData(Object _data){
+ this._data = _data;
+ }
+
+ public String getEventsQueue(){
+ if (this._eventsQueue != null) {
+ return this._eventsQueue;
+ }
+ ValueExpression ve = getValueExpression("eventsQueue");
+ if (ve != null) {
+ String value = null;
+
+ try {
+ value = (String) ve.getValue(getFacesContext().getELContext());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+
+ return value;
+ }
+
+ return null;
+
+
+ }
+
+ public void setEventsQueue(String _eventsQueue){
+ this._eventsQueue = _eventsQueue;
+ }
+
+ public String getFocus(){
+ if (this._focus != null) {
+ return this._focus;
+ }
+ ValueExpression ve = getValueExpression("focus");
+ if (ve != null) {
+ String value = null;
+
+ try {
+ value = (String) ve.getValue(getFacesContext().getELContext());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+
+ return value;
+ }
+
+ return null;
+
+
+ }
+
+ public void setFocus(String _focus){
+ this._focus = _focus;
+ }
+
+ public boolean isIgnoreDupResponses(){
+ if (this._ignoreDupResponsesSet) {
+ return (this._ignoreDupResponses);
+ }
+ ValueExpression ve = getValueExpression("ignoreDupResponses");
+ if (ve != null) {
+ Boolean value = null;
+
+ try {
+ value = (Boolean) ve.getValue(getFacesContext().getELContext());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+
+ if (null == value) {
+ return (this._ignoreDupResponses);
+ }
+
+ return value;
+ } else {
+ return (this._ignoreDupResponses);
+ }
+
+ }
+
+ public void setIgnoreDupResponses(boolean _ignoreDupResponses){
+ this._ignoreDupResponses = _ignoreDupResponses;
+ this._ignoreDupResponsesSet = true;
+ }
+
+ public boolean isLimitToList(){
+ if (this._limitToListSet) {
+ return (this._limitToList);
+ }
+ ValueExpression ve = getValueExpression("limitToList");
+ if (ve != null) {
+ Boolean value = null;
+
+ try {
+ value = (Boolean) ve.getValue(getFacesContext().getELContext());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+
+ if (null == value) {
+ return (this._limitToList);
+ }
+
+ return value;
+ } else {
+ return (this._limitToList);
+ }
+
+ }
+
+ public void setLimitToList(boolean _limitToList){
+ this._limitToList = _limitToList;
+ this._limitToListSet = true;
+ }
+
+ public String getName(){
+ if (this._name != null) {
+ return this._name;
+ }
+ ValueExpression ve = getValueExpression("name");
+ if (ve != null) {
+ String value = null;
+
+ try {
+ value = (String) ve.getValue(getFacesContext().getELContext());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+
+ return value;
+ }
+
+ return null;
+
+
+ }
+
+ public void setName(String _name){
+ this._name = _name;
+ }
+
+ public String getOnbeforedomupdate(){
+ if (this._onbeforedomupdate != null) {
+ return this._onbeforedomupdate;
+ }
+ ValueExpression ve = getValueExpression("onbeforedomupdate");
+ if (ve != null) {
+ String value = null;
+
+ try {
+ value = (String) ve.getValue(getFacesContext().getELContext());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+
+ return value;
+ }
+
+ return null;
+
+
+ }
+
+ public void setOnbeforedomupdate(String _onbeforedomupdate){
+ this._onbeforedomupdate = _onbeforedomupdate;
+ }
+
+ public String getOncomplete(){
+ if (this._oncomplete != null) {
+ return this._oncomplete;
+ }
+ ValueExpression ve = getValueExpression("oncomplete");
+ if (ve != null) {
+ String value = null;
+
+ try {
+ value = (String) ve.getValue(getFacesContext().getELContext());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+
+ return value;
+ }
+
+ return null;
+
+
+ }
+
+ public void setOncomplete(String _oncomplete){
+ this._oncomplete = _oncomplete;
+ }
+
+ public Object getProcess(){
+ if (this._process != null) {
+ return this._process;
+ }
+ ValueExpression ve = getValueExpression("process");
+ if (ve != null) {
+ Object value = null;
+
+ try {
+ value = (Object) ve.getValue(getFacesContext().getELContext());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+
+ return value;
+ }
+
+ return null;
+
+
+ }
+
+ public void setProcess(Object _process){
+ this._process = _process;
+ }
+
+ public Object getReRender(){
+ if (this._reRender != null) {
+ return this._reRender;
+ }
+ ValueExpression ve = getValueExpression("reRender");
+ if (ve != null) {
+ Object value = null;
+
+ try {
+ value = (Object) ve.getValue(getFacesContext().getELContext());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+
+ return value;
+ }
+
+ return null;
+
+
+ }
+
+ public void setReRender(Object _reRender){
+ this._reRender = _reRender;
+ }
+
+ public int getRequestDelay(){
+ if (this._requestDelaySet) {
+ return (this._requestDelay);
+ }
+ ValueExpression ve = getValueExpression("requestDelay");
+ if (ve != null) {
+ Integer value = null;
+
+ try {
+ value = (Integer) ve.getValue(getFacesContext().getELContext());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+
+ if (null == value) {
+ return (this._requestDelay);
+ }
+
+ return value;
+ } else {
+ return (this._requestDelay);
+ }
+
+ }
+
+ public void setRequestDelay(int _requestDelay){
+ this._requestDelay = _requestDelay;
+ this._requestDelaySet = true;
+ }
+
+ public String getSimilarityGroupingId(){
+ if (this._similarityGroupingId != null) {
+ return this._similarityGroupingId;
+ }
+ ValueExpression ve = getValueExpression("similarityGroupingId");
+ if (ve != null) {
+ String value = null;
+
+ try {
+ value = (String) ve.getValue(getFacesContext().getELContext());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+
+ return value;
+ }
+
+ return null;
+
+
+ }
+
+ public void setSimilarityGroupingId(String _similarityGroupingId){
+ this._similarityGroupingId = _similarityGroupingId;
+ }
+
+ public String getStatus(){
+ if (this._status != null) {
+ return this._status;
+ }
+ ValueExpression ve = getValueExpression("status");
+ if (ve != null) {
+ String value = null;
+
+ try {
+ value = (String) ve.getValue(getFacesContext().getELContext());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+
+ return value;
+ }
+
+ return null;
+
+
+ }
+
+ public void setStatus(String _status){
+ this._status = _status;
+ }
+
+ public int getTimeout(){
+ if (this._timeoutSet) {
+ return (this._timeout);
+ }
+ ValueExpression ve = getValueExpression("timeout");
+ if (ve != null) {
+ Integer value = null;
+
+ try {
+ value = (Integer) ve.getValue(getFacesContext().getELContext());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+
+ if (null == value) {
+ return (this._timeout);
+ }
+
+ return value;
+ } else {
+ return (this._timeout);
+ }
+
+ }
+
+ public void setTimeout(int _timeout){
+ this._timeout = _timeout;
+ this._timeoutSet = true;
+ }
+
+ public String getFamily(){
+ return COMPONENT_FAMILY;
+ }
+
+ @Override
+ public Object saveState(FacesContext context){
+ Object [] state = new Object[23];
+ state[0] = super.saveState(context);
+ state[1] = Boolean.valueOf(_ajaxSingle);
+ state[2] = Boolean.valueOf(_ajaxSingleSet);
+ state[3] = Boolean.valueOf(_bypassUpdates);
+ state[4] = Boolean.valueOf(_bypassUpdatesSet);
+ state[5] = saveAttachedState(context, _data);
+ state[6] = _eventsQueue;
+ state[7] = _focus;
+ state[8] = Boolean.valueOf(_ignoreDupResponses);
+ state[9] = Boolean.valueOf(_ignoreDupResponsesSet);
+ state[10] = Boolean.valueOf(_limitToList);
+ state[11] = Boolean.valueOf(_limitToListSet);
+ state[12] = _name;
+ state[13] = _onbeforedomupdate;
+ state[14] = _oncomplete;
+ state[15] = saveAttachedState(context, _process);
+ state[16] = saveAttachedState(context, _reRender);
+ state[17] = Integer.valueOf(_requestDelay);
+ state[18] = Boolean.valueOf(_requestDelaySet);
+ state[19] = _similarityGroupingId;
+ state[20] = _status;
+ state[21] = Integer.valueOf(_timeout);
+ state[22] = Boolean.valueOf(_timeoutSet);
+ return state;
+ }
+
+ @Override
+ public void restoreState(FacesContext context, Object state){
+ Object[] states = (Object[]) state;
+ super.restoreState(context, states[0]);
+ _ajaxSingle = ((Boolean)states[1]).booleanValue();
+ _ajaxSingleSet = ((Boolean)states[2]).booleanValue();
+ _bypassUpdates = ((Boolean)states[3]).booleanValue();
+ _bypassUpdatesSet = ((Boolean)states[4]).booleanValue();
+ _data = (Object)restoreAttachedState(context, states[5]);
+ _eventsQueue = (String)states[6];;
+ _focus = (String)states[7];;
+ _ignoreDupResponses = ((Boolean)states[8]).booleanValue();
+ _ignoreDupResponsesSet = ((Boolean)states[9]).booleanValue();
+ _limitToList = ((Boolean)states[10]).booleanValue();
+ _limitToListSet = ((Boolean)states[11]).booleanValue();
+ _name = (String)states[12];;
+ _onbeforedomupdate = (String)states[13];;
+ _oncomplete = (String)states[14];;
+ _process = (Object)restoreAttachedState(context, states[15]);
+ _reRender = (Object)restoreAttachedState(context, states[16]);
+ _requestDelay = ((Integer)states[17]).intValue();
+ _requestDelaySet = ((Boolean)states[18]).booleanValue();
+ _similarityGroupingId = (String)states[19];;
+ _status = (String)states[20];;
+ _timeout = ((Integer)states[21]).intValue();
+ _timeoutSet = ((Boolean)states[22]).booleanValue();
+
+ }
+
+}
Added:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlMediaOutput.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlMediaOutput.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlMediaOutput.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,415 @@
+package org.richfaces.component.html;
+
+import java.util.Date;
+
+import javax.el.MethodExpression;
+
+import org.richfaces.component.UIMediaOutput;
+
+public class HtmlMediaOutput extends UIMediaOutput {
+
+ static public final String COMPONENT_FAMILY = "org.richfaces.MediaOutput";
+
+ static public final String COMPONENT_TYPE = "org.richfaces.MediaOutput";
+
+ private static enum PropertyKeys {
+ onblur, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown,
+ onmousemove, onmouseout, onmouseover, onmouseup, rel, rev, type, title, target,
+ tabindex, styleClass, vspace, usemap, shape, standby, style, uriAttribute, accesskey,
+ align, archive, border, element, declare, coords, hreflang, hspace, dir, codetype,
codebase,
+ charset, classid, lang, mimeType, lastModified, cacheable, createContentExpression,
ismap,
+ session, expires
+ }
+
+ public HtmlMediaOutput() {
+ setRendererType("org.richfaces.MediaOutputRenderer");
+ }
+
+ public String getAccesskey() {
+ return (String) getStateHelper().eval(PropertyKeys.accesskey);
+ }
+
+ public void setAccesskey(String accesskey) {
+ getStateHelper().put(PropertyKeys.accesskey, accesskey);
+ }
+
+ public String getAlign() {
+ return (String) getStateHelper().eval(PropertyKeys.align);
+ }
+
+ public void setAlign(String align) {
+ getStateHelper().put(PropertyKeys.align, align);
+ }
+
+ public String getArchive() {
+ return (String) getStateHelper().eval(PropertyKeys.archive);
+ }
+
+ public void setArchive(String archive) {
+ getStateHelper().put(PropertyKeys.archive, archive);
+ }
+
+ public String getBorder() {
+ return (String) getStateHelper().eval(PropertyKeys.border);
+ }
+
+ public void setBorder(String border) {
+ getStateHelper().put(PropertyKeys.border, border);
+ }
+
+ public boolean isCacheable() {
+ return Boolean.parseBoolean(getStateHelper().eval(PropertyKeys.cacheable,
+ Boolean.FALSE).toString());
+ }
+
+ public void setCacheable(boolean cacheable) {
+ getStateHelper().put(PropertyKeys.cacheable, cacheable);
+ }
+
+ public String getCharset() {
+ return (String) getStateHelper().eval(PropertyKeys.charset);
+ }
+
+ public void setCharset(String charset) {
+ getStateHelper().put(PropertyKeys.charset, charset);
+ }
+
+ public String getClassid() {
+ return (String) getStateHelper().eval(PropertyKeys.classid);
+ }
+
+ public void setClassid(String classid) {
+ getStateHelper().put(PropertyKeys.classid, classid);
+ }
+
+ public String getCodebase() {
+ return (String) getStateHelper().eval(PropertyKeys.codebase);
+ }
+
+ public void setCodebase(String codebase) {
+ getStateHelper().put(PropertyKeys.codebase, codebase);
+ }
+
+ public String getCodetype() {
+ return (String) getStateHelper().eval(PropertyKeys.codetype);
+ }
+
+ public void setCodetype(String codetype) {
+ getStateHelper().put(PropertyKeys.codetype, codetype);
+ }
+
+ public String getCoords() {
+ return (String) getStateHelper().eval(PropertyKeys.coords);
+ }
+
+ public void setCoords(String coords) {
+ getStateHelper().put(PropertyKeys.coords, coords);
+ }
+
+ public MethodExpression getCreateContentExpression() {
+ return (MethodExpression) getStateHelper().get(PropertyKeys.createContentExpression);
+ }
+
+ public void setCreateContentExpression(
+ MethodExpression createContentExpression) {
+ getStateHelper().put(PropertyKeys.createContentExpression,
+ createContentExpression);
+ }
+
+ public String getDeclare() {
+ return (String) getStateHelper().eval(PropertyKeys.declare);
+ }
+
+ public void setDeclare(String declare) {
+ getStateHelper().put(PropertyKeys.declare, declare);
+ }
+
+ public String getDir() {
+ return (String) getStateHelper().eval(PropertyKeys.dir);
+ }
+
+ public void setDir(String dir) {
+ getStateHelper().put(PropertyKeys.dir, dir);
+ }
+
+ public String getElement() {
+ return (String) getStateHelper().eval(PropertyKeys.element);
+ }
+
+ public void setElement(String element) {
+ getStateHelper().put(PropertyKeys.element, element);
+ }
+
+ public Date getExpires() {
+ return (Date) getStateHelper().eval(PropertyKeys.expires);
+ }
+
+ public void setExpires(Date expires) {
+ getStateHelper().put(PropertyKeys.expires, expires);
+ }
+
+ public String getHreflang() {
+ return (String) getStateHelper().eval(PropertyKeys.hreflang);
+ }
+
+ public void setHreflang(String hreflang) {
+ getStateHelper().put(PropertyKeys.hreflang, hreflang);
+ }
+
+ public String getHspace() {
+ return (String) getStateHelper().eval(PropertyKeys.hspace);
+ }
+
+ public void setHspace(String hspace) {
+ getStateHelper().put(PropertyKeys.hspace, hspace);
+ }
+
+ public boolean isIsmap() {
+ return Boolean.parseBoolean(getStateHelper().eval(PropertyKeys.ismap,
Boolean.FALSE).toString());
+ }
+
+ public void setIsmap(boolean ismap) {
+ getStateHelper().put(PropertyKeys.ismap, ismap);
+ }
+
+ public String getLang() {
+ return (String) getStateHelper().eval(PropertyKeys.lang);
+ }
+
+ public void setLang(String lang) {
+ getStateHelper().put(PropertyKeys.lang, lang);
+ }
+
+ public Date getLastModified() {
+ return (Date) getStateHelper().eval(PropertyKeys.lastModified);
+ }
+
+ public void setLastModified(Date lastModified) {
+ getStateHelper().put(PropertyKeys.lastModified, lastModified);
+ }
+
+ public String getMimeType() {
+ return (String) getStateHelper().eval(PropertyKeys.mimeType);
+ }
+
+ public void setMimeType(String mimeType) {
+ getStateHelper().put(PropertyKeys.mimeType, mimeType);
+ }
+
+ public String getOnblur() {
+ return (String) getStateHelper().eval(PropertyKeys.onblur);
+ }
+
+ public void setOnblur(String onblur) {
+ getStateHelper().put(PropertyKeys.onblur, onblur);
+ }
+
+ public String getOnclick() {
+ return (String) getStateHelper().eval(PropertyKeys.onclick);
+ }
+
+ public void setOnclick(String onclick) {
+ getStateHelper().put(PropertyKeys.onclick, onclick);
+ }
+
+ public String getOndblclick() {
+ return (String) getStateHelper().eval(PropertyKeys.ondblclick);
+ }
+
+ public void setOndblclick(String ondblclick) {
+ getStateHelper().put(PropertyKeys.ondblclick, ondblclick);
+ }
+
+ public String getOnfocus() {
+ return (String) getStateHelper().eval(PropertyKeys.onfocus);
+ }
+
+ public void setOnfocus(String onfocus) {
+ getStateHelper().put(PropertyKeys.onfocus, onfocus);
+ }
+
+ public String getOnkeydown() {
+ return (String) getStateHelper().eval(PropertyKeys.onkeydown);
+ }
+
+ public void setOnkeydown(String onkeydown) {
+ getStateHelper().put(PropertyKeys.onkeydown, onkeydown);
+ }
+
+ public String getOnkeypress() {
+ return (String) getStateHelper().eval(PropertyKeys.onkeypress);
+ }
+
+ public void setOnkeypress(String onkeypress) {
+ getStateHelper().put(PropertyKeys.onkeypress, onkeypress);
+ }
+
+ public String getOnkeyup() {
+ return (String) getStateHelper().eval(PropertyKeys.onkeyup);
+ }
+
+ public void setOnkeyup(String onkeyup) {
+ getStateHelper().put(PropertyKeys.onkeyup, onkeyup);
+ }
+
+ public String getOnmousedown() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousedown);
+ }
+
+ public void setOnmousedown(String onmousedown) {
+ getStateHelper().put(PropertyKeys.onmousedown, onmousedown);
+ }
+
+ public String getOnmousemove() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousemove);
+ }
+
+ public void setOnmousemove(String onmousemove) {
+ getStateHelper().put(PropertyKeys.onmousemove, onmousemove);
+ }
+
+ public String getOnmouseout() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseout);
+ }
+
+ public void setOnmouseout(String onmouseout) {
+ getStateHelper().put(PropertyKeys.onmouseout, onmouseout);
+ }
+
+ public String getOnmouseover() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseover);
+ }
+
+ public void setOnmouseover(String onmouseover) {
+ getStateHelper().put(PropertyKeys.onmouseover, onmouseover);
+ }
+
+ public String getOnmouseup() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseup);
+ }
+
+ public void setOnmouseup(String onmouseup) {
+ getStateHelper().put(PropertyKeys.onmouseup, onmouseup);
+ }
+
+ public String getRel() {
+ return (String) getStateHelper().eval(PropertyKeys.rel);
+ }
+
+ public void setRel(String rel) {
+ getStateHelper().put(PropertyKeys.rel, rel);
+ }
+
+ public String getRev() {
+ return (String) getStateHelper().eval(PropertyKeys.rev);
+ }
+
+ public void setRev(String rev) {
+ getStateHelper().put(PropertyKeys.rev, rev);
+ }
+
+ @Deprecated
+ public boolean isSession() {
+ return true;
+ }
+
+ @Deprecated
+ public void setSession(boolean session) {
+ if (!session) {
+ //TODO: log
+ }
+ }
+
+ public String getShape() {
+ return (String) getStateHelper().eval(PropertyKeys.shape);
+ }
+
+ public void setShape(String shape) {
+ getStateHelper().put(PropertyKeys.shape, shape);
+ }
+
+ public String getStandby() {
+ return (String) getStateHelper().eval(PropertyKeys.standby);
+ }
+
+ public void setStandby(String standby) {
+ getStateHelper().put(PropertyKeys.standby, standby);
+ }
+
+ public String getStyle() {
+ return (String) getStateHelper().eval(PropertyKeys.style);
+ }
+
+ public void setStyle(String style) {
+ getStateHelper().put(PropertyKeys.style, style);
+ }
+
+ public String getStyleClass() {
+ return (String) getStateHelper().eval(PropertyKeys.styleClass);
+ }
+
+ public void setStyleClass(String styleClass) {
+ getStateHelper().put(PropertyKeys.styleClass, styleClass);
+ }
+
+ public String getTabindex() {
+ return (String) getStateHelper().eval(PropertyKeys.tabindex);
+ }
+
+ public void setTabindex(String tabindex) {
+ getStateHelper().put(PropertyKeys.tabindex, tabindex);
+ }
+
+ public String getTarget() {
+ return (String) getStateHelper().eval(PropertyKeys.target);
+ }
+
+ public void setTarget(String target) {
+ getStateHelper().put(PropertyKeys.target, target);
+ }
+
+ public String getTitle() {
+ return (String) getStateHelper().eval(PropertyKeys.title);
+ }
+
+ public void setTitle(String title) {
+ getStateHelper().put(PropertyKeys.title, title);
+ }
+
+ public String getType() {
+ return (String) getStateHelper().eval(PropertyKeys.type);
+ }
+
+ public void setType(String type) {
+ getStateHelper().put(PropertyKeys.type, type);
+ }
+
+ public String getUriAttribute() {
+ return (String) getStateHelper().eval(PropertyKeys.uriAttribute);
+ }
+
+ public void setUriAttribute(String uriAttribute) {
+ getStateHelper().put(PropertyKeys.uriAttribute, uriAttribute);
+ }
+
+ public String getUsemap() {
+ return (String) getStateHelper().eval(PropertyKeys.usemap);
+ }
+
+ public void setUsemap(String usemap) {
+ getStateHelper().put(PropertyKeys.usemap, usemap);
+ }
+
+ public String getVspace() {
+ return (String) getStateHelper().eval(PropertyKeys.vspace);
+ }
+
+ public void setVspace(String vspace) {
+ getStateHelper().put(PropertyKeys.vspace, vspace);
+ }
+
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+}
Added:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlOutputPanel.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlOutputPanel.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlOutputPanel.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,153 @@
+package org.richfaces.component.html;
+
+import org.richfaces.component.UIAjaxOutputPanel;
+
+public class HtmlOutputPanel extends UIAjaxOutputPanel {
+
+ static final public String COMPONENT_FAMILY = "javax.faces.Panel";
+
+ static final public String COMPONENT_TYPE = "org.richfaces.OutputPanel";
+
+ private static enum PropertyKeys {
+ dir, lang, layout, onclick, onmousemove, ondblclick, onkeydown, onkeypress,
+ onkeyup, onmousedown, title, style, onmouseout, onmouseover, onmouseup, styleClass
+ }
+
+ public HtmlOutputPanel() {
+ super();
+ setRendererType("org.richfaces.OutputPanelRenderer");
+ }
+
+ public String getDir() {
+ return (String) getStateHelper().eval(PropertyKeys.dir);
+ }
+
+ public void setDir(String dir) {
+ getStateHelper().put(PropertyKeys.dir, dir);
+ }
+
+ public String getLang() {
+ return (String) getStateHelper().eval(PropertyKeys.lang);
+ }
+
+ public void setLang(String lang) {
+ getStateHelper().put(PropertyKeys.lang, lang);
+ }
+
+ public String getLayout() {
+ return (String) getStateHelper().eval(PropertyKeys.layout, "inline");
+ }
+
+ public void setLayout(String layout) {
+ getStateHelper().put(PropertyKeys.layout, layout);
+ }
+
+ public String getOnclick() {
+ return (String) getStateHelper().eval(PropertyKeys.onclick);
+ }
+
+ public void setOnclick(String onclick) {
+ getStateHelper().put(PropertyKeys.onclick, onclick);
+ }
+
+ public String getOndblclick() {
+ return (String) getStateHelper().eval(PropertyKeys.ondblclick);
+ }
+
+ public void setOndblclick(String ondblclick) {
+ getStateHelper().put(PropertyKeys.ondblclick, ondblclick);
+ }
+
+ public String getOnkeydown() {
+ return (String) getStateHelper().eval(PropertyKeys.onkeydown);
+ }
+
+ public void setOnkeydown(String onkeydown) {
+ getStateHelper().put(PropertyKeys.onkeydown, onkeydown);
+ }
+
+ public String getOnkeypress() {
+ return (String) getStateHelper().eval(PropertyKeys.onkeypress);
+ }
+
+ public void setOnkeypress(String onkeypress) {
+ getStateHelper().put(PropertyKeys.onkeypress, onkeypress);
+ }
+
+ public String getOnkeyup() {
+ return (String) getStateHelper().eval(PropertyKeys.onkeyup);
+ }
+
+ public void setOnkeyup(String onkeyup) {
+ getStateHelper().put(PropertyKeys.onkeyup, onkeyup);
+ }
+
+ public String getOnmousedown() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousedown);
+ }
+
+ public void setOnmousedown(String onmousedown) {
+ getStateHelper().put(PropertyKeys.onmousedown, onmousedown);
+ }
+
+ public String getOnmousemove() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousemove);
+ }
+
+ public void setOnmousemove(String onmousemove) {
+ getStateHelper().put(PropertyKeys.onmousemove, onmousemove);
+ }
+
+ public String getOnmouseout() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseout);
+ }
+
+ public void setOnmouseout(String onmouseout) {
+ getStateHelper().put(PropertyKeys.onmouseout, onmouseout);
+ }
+
+ public String getOnmouseover() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseover);
+ }
+
+ public void setOnmouseover(String onmouseover) {
+ getStateHelper().put(PropertyKeys.onmouseover, onmouseover);
+ }
+
+ public String getOnmouseup() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseup);
+ }
+
+ public void setOnmouseup(String onmouseup) {
+ getStateHelper().put(PropertyKeys.onmouseup, onmouseup);
+ }
+
+ public String getStyle() {
+ return (String) getStateHelper().eval(PropertyKeys.style);
+ }
+
+ public void setStyle(String style) {
+ getStateHelper().put(PropertyKeys.style, style);
+ }
+
+ public String getStyleClass() {
+ return (String) getStateHelper().eval(PropertyKeys.styleClass);
+ }
+
+ public void setStyleClass(String styleClass) {
+ getStateHelper().put(PropertyKeys.styleClass, styleClass);
+ }
+
+ public String getTitle() {
+ return (String) getStateHelper().eval(PropertyKeys.title);
+ }
+
+ public void setTitle(String title) {
+ getStateHelper().put(PropertyKeys.title, title);
+ }
+
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+}
Added:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlPush.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlPush.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlPush.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,45 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component.html;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+
+import org.richfaces.component.UIPush;
+
+public class HtmlPush extends UIPush {
+
+ public final static String COMPONENT_FAMILY = "org.richfaces.Push";
+
+ public final static String COMPONENT_TYPE = "org.richfaces.Push";
+
+ public HtmlPush(){
+ setRendererType("org.richfaces.PushRenderer");
+ }
+
+ public String getFamily(){
+ return COMPONENT_FAMILY;
+ }
+
+}
Copied:
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/AjaxCommandRendererBase.java
(from rev 15175,
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/AjaxCommandRendererBase.java)
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/AjaxCommandRendererBase.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/AjaxCommandRendererBase.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,140 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit;
+
+import java.io.IOException;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.ValueHolder;
+import javax.faces.component.html.HtmlCommandButton;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+
+import org.ajax4jsf.component.AjaxComponent;
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.event.AjaxEvent;
+import org.ajax4jsf.renderkit.AjaxComponentRendererBase;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.3 $ $Date: 2007/02/12 17:46:53 $
+ *
+ */
+public abstract class AjaxCommandRendererBase extends AjaxComponentRendererBase {
+
+ private static final Log _log = LogFactory
+ .getLog(AjaxCommandRendererBase.class);
+
+ protected void doDecode(FacesContext facesContext, UIComponent uiComponent) {
+
+ // super.decode must not be called, because value is handled here
+ if (isSubmitted(facesContext, uiComponent)) {
+ ActionEvent event;
+ event = new ActionEvent(uiComponent);
+ uiComponent.queueEvent(event);
+ uiComponent.queueEvent(new AjaxEvent(uiComponent));
+ // Check areas for processing
+ if (uiComponent instanceof AjaxComponent) {
+ AjaxComponent ajaxComponent = (AjaxComponent) uiComponent;
+ Set<String> toProcess = AjaxRendererUtils.asSet(ajaxComponent
+ .getProcess());
+ if (null != toProcess) {
+ Set<String> componentIdsToProcess = new LinkedHashSet<String>();
+ for (String componentId : toProcess) {
+ UIComponent component = getUtils().findComponentFor(uiComponent, componentId);
+ if(null != component){
+ componentIdsToProcess.add(component.getClientId(facesContext));
+ } else {
+ componentIdsToProcess.add(componentId);
+ }
+ }
+ AjaxContext.getCurrentInstance(facesContext).setAjaxAreasToProcess(componentIdsToProcess);
+ }
+ }
+ }
+ }
+
+ public String getOnClick(FacesContext context, UIComponent component) {
+ StringBuffer onClick;
+ if (!getUtils().isBooleanAttribute(component, "disabled")) {
+ onClick = AjaxRendererUtils.buildOnClick(component, context, true);
+ if (!"reset".equals(component.getAttributes().get("type"))) {
+ onClick.append(";return false;");
+ }
+ } else {
+ onClick = new StringBuffer("return false;");
+ }
+ return onClick.toString();
+ }
+
+ public void encodeChildren(FacesContext context, UIComponent component)
+ throws IOException {
+ renderChildren(context, component);
+ }
+
+ public Object getValue(UIComponent uiComponent) {
+ if (uiComponent instanceof ValueHolder) {
+ return ((ValueHolder) uiComponent).getValue();
+ }
+ return uiComponent.getAttributes().get("value");
+ }
+
+ public String getType(UIComponent uiComponent) {
+ String type;
+ if (uiComponent instanceof HtmlCommandButton) {
+ type = ((HtmlCommandButton) uiComponent).getType();
+ } else {
+ type = (String) uiComponent.getAttributes().get("type");
+ }
+ if (type == null) {
+ type = "button";
+ }
+ return type;
+ }
+
+ protected boolean isSubmitted(FacesContext facesContext,
+ UIComponent uiComponent) {
+ // Componet accept only ajax requests.
+ if (!AjaxContext.getCurrentInstance(facesContext).isAjaxRequest()) {
+ return false;
+ }
+ if (getUtils().isBooleanAttribute(uiComponent, "disabled")) {
+ return false;
+ }
+ String clientId = uiComponent.getClientId(facesContext);
+ Map<String, String> paramMap = facesContext.getExternalContext()
+ .getRequestParameterMap();
+ Object value = paramMap.get(clientId);
+ boolean submitted = null != value;
+ if (submitted && _log.isDebugEnabled()) {
+ _log.debug("Decode submit of the Ajax component " + clientId);
+ }
+ return submitted;
+ }
+
+}
Added:
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/AjaxComponentRendererBase.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/AjaxComponentRendererBase.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/AjaxComponentRendererBase.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,32 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit;
+
+import javax.faces.render.Renderer;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class AjaxComponentRendererBase extends Renderer {
+
+}
Added:
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/AjaxFunctionRendererBase.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/AjaxFunctionRendererBase.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/AjaxFunctionRendererBase.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,118 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit;
+
+import java.util.Iterator;
+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.UIParameter;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+
+import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.javascript.JSFunctionDefinition;
+import org.ajax4jsf.javascript.JSReference;
+import org.ajax4jsf.javascript.ScriptUtils;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.richfaces.component.UIAjaxFunction;
+
+/**
+ * @author shura
+ *
+ */
+@ResourceDependencies(value = {
+ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "richfaces.js")
+ })
+public class AjaxFunctionRendererBase extends AjaxCommandRendererBase {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
+ */
+ protected Class<? extends UIComponent> getComponentClass() {
+ return UIAjaxFunction.class;
+ }
+
+ public String getFunction(FacesContext context, UIAjaxFunction component) {
+ String functionName = component.getName();
+ if (functionName == null) {
+ throw new FacesException("Value of 'name' attribute of a4j:jsFunction
component is null!");
+ }
+
+ StringBuffer script = new StringBuffer(functionName).append("=");
+ JSFunctionDefinition func = new JSFunctionDefinition();
+ //func.setName(component.getName());
+ // Create AJAX Submit function.
+ JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(
+ component, context, AjaxRendererUtils.AJAX_FUNCTION_NAME);
+ Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context,
component);
+ ajaxFunction.addParameter(options);
+
+ Map<String, Object> parameters = options;
+// if (null == parameters) {
+// parameters = new HashMap<String, Object>();
+// options.put("parameters", parameters);
+// }
+ // Fill parameters.
+ for (Iterator<UIComponent> it = component.getChildren().iterator();
it.hasNext();) {
+ UIComponent child = it.next();
+ if (child instanceof UIParameter) {
+ UIParameter parameter = ((UIParameter) child);
+ String name = parameter.getName();
+ func.addParameter(name);
+ // Put parameter name to AJAX.Submit parameter, with default value.
+ JSReference reference = new JSReference(name);
+ if (null != parameter.getValue()) {
+ reference = new JSReference(name + "||"
+ + ScriptUtils.toScript(parameters.get(name)));
+
+ }
+ // Replace parameter value to reference.
+ parameters.put(name, reference);
+ }
+ }
+
+ //TODO - added in 4.0 - ?
+ func.addParameter(new JSReference("event"));
+
+ func.addToBody(ajaxFunction.toScript());
+ func.appendScript(script);
+ return script.toString();
+ }
+
+ @Override
+ protected void doDecode(FacesContext facesContext, UIComponent uiComponent) {
+ Map<String, String> requestParameterMap =
facesContext.getExternalContext().getRequestParameterMap();
+ String clientId = uiComponent.getClientId(facesContext);
+
+ if (requestParameterMap.get(clientId) != null) {
+ new ActionEvent(uiComponent).queue();
+ }
+ }
+}
Added:
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/CommandRendererBase.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/CommandRendererBase.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/CommandRendererBase.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,42 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.render.Renderer;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class CommandRendererBase extends Renderer {
+
+ /* (non-Javadoc)
+ * @see javax.faces.render.Renderer#decode(javax.faces.context.FacesContext,
javax.faces.component.UIComponent)
+ */
+ @Override
+ public void decode(FacesContext context, UIComponent component) {
+ // TODO Auto-generated method stub
+ super.decode(context, component);
+ }
+}
Added:
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxCommandButtonRendererBase.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxCommandButtonRendererBase.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxCommandButtonRendererBase.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,60 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.richfaces.renderkit.AjaxCommandRendererBase;
+import org.richfaces.renderkit.CommandRendererBase;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public abstract class AjaxCommandButtonRendererBase extends AjaxCommandRendererBase {
+
+ protected void encodeTypeAndImage(FacesContext context, UIComponent uiComponent)
throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+ String type = (String)uiComponent.getAttributes().get("type");
+ String image = (String)uiComponent.getAttributes().get("image");
+ if(image != null){
+ image = context.getApplication().getViewHandler().getResourceURL(context,image);
+ image = context.getExternalContext().encodeResourceURL(image);
+ writer.writeAttribute("type","image","image");
+ writer.writeURIAttribute("src",image,"image");
+ Object value;
+ if (null == uiComponent.getAttributes().get("alt") && null !=
(value = uiComponent.getAttributes().get("value")) ) {
+ writer.writeAttribute("alt",value,"value");
+ }
+ } else {
+ if(null != type ){
+ writer.writeAttribute("type",type.toLowerCase(),"type");
+ } else {
+ writer.writeAttribute("type","button","type");
+ }
+ }
+ }
+}
Copied:
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxFunctionRenderer1.java
(from rev 15175,
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFunctionRenderer.java)
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxFunctionRenderer1.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxFunctionRenderer1.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,53 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.richfaces.component.UIAjaxFunction;
+import org.richfaces.renderkit.AjaxFunctionRendererBase;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class AjaxFunctionRenderer1 extends AjaxFunctionRendererBase {
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.renderkit.RendererBase#encodeEnd(javax.faces.context.FacesContext,
javax.faces.component.UIComponent)
+ */
+ @Override
+ public void encodeEnd(FacesContext context, UIComponent component)
+ throws IOException {
+ super.encodeEnd(context, component);
+ ResponseWriter writer = context.getResponseWriter();
+ writer.startElement(HTML.SCRIPT_ELEM, component);
+ writer.writeAttribute(HTML.id_ATTRIBUTE, component.getClientId(context),
"id");
+ writer.writeText(getFunction(context, (UIAjaxFunction) component), null);
+ writer.endElement(HTML.SCRIPT_ELEM);
+ }
+}
Copied:
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxOutputPanelRenderer.java
(from rev 15175,
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxOutputPanelRenderer.java)
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxOutputPanelRenderer.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxOutputPanelRenderer.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,149 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.renderkit.RendererBase;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.richfaces.component.UIAjaxOutputPanel;
+
+
+/**
+ * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:27 $
+ *
+ */
+public class AjaxOutputPanelRenderer extends RendererBase {
+
+ private final String[] STYLE_ATTRIBUTES = new
String[]{"style","class"};
+
+ private boolean hasNoneLayout(UIComponent component) {
+ //TODO - A1 won't support 'none' layout
+ return
false;//"none".equals(component.getAttributes().get("layout"));
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.render.Renderer#encodeChildren(javax.faces.context.FacesContext,
javax.faces.component.UIComponent)
+ */
+ public void encodeChildren(FacesContext context, UIComponent component) throws
IOException {
+ //
+ UIAjaxOutputPanel panel = (UIAjaxOutputPanel) component;
+ if (hasNoneLayout(panel)) {
+ if (component.getChildCount() > 0) {
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+ boolean ajaxRequest = ajaxContext.isAjaxRequest();
+ Set<String> ajaxRenderedAreas = ajaxContext.getAjaxRenderedAreas();
+ for (UIComponent child : component.getChildren()) {
+ String childId = child.getClientId(context);
+ if (child.isRendered()) {
+ renderChild(context, child);
+ } else {
+ // Render "dummy" span.
+ ResponseWriter out = context.getResponseWriter();
+ out.startElement(HTML.SPAN_ELEM,child);
+ out.writeAttribute(HTML.id_ATTRIBUTE,childId,HTML.id_ATTRIBUTE);
+ out.writeAttribute(HTML.style_ATTRIBUTE,"display:
none;","style");
+ out.endElement(HTML.SPAN_ELEM);
+ }
+ // register child as rendered
+ if(ajaxRequest && null != ajaxRenderedAreas) {
+ ajaxRenderedAreas.add(childId);
+ }
+ }
+ }
+ } else {
+ renderChildren(context,component);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.render.Renderer#getRendersChildren()
+ */
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
+ */
+ protected Class<? extends UIComponent> getComponentClass() {
+ return UIAjaxOutputPanel.class;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.ajax4jsf.renderkit.RendererBase#doEncodeBegin(javax.faces.context.ResponseWriter,
javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+ */
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException {
+ UIAjaxOutputPanel panel = (UIAjaxOutputPanel) component;
+ if (!hasNoneLayout(component)) {
+ writer.startElement(getTag(panel), panel);
+ getUtils().encodeId(context, component);
+ getUtils().encodePassThru(context, component);
+ getUtils().encodeAttributesFromArray(context,component,STYLE_ATTRIBUTES);
+ }
+ }
+
+ /**
+ * @param panel
+ * @return
+ */
+ private String getTag(UIAjaxOutputPanel panel) {
+ Object layout = panel.getAttributes().get("layout");
+ return "block".equals(layout) ? HTML.DIV_ELEM : HTML.SPAN_ELEM;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.ajax4jsf.renderkit.RendererBase#doEncodeEnd(javax.faces.context.ResponseWriter,
javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+ */
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException {
+ UIAjaxOutputPanel panel = (UIAjaxOutputPanel) component;
+ if (!hasNoneLayout(component)) {
+ writer.endElement(getTag(panel));
+ }
+ if (panel.isKeepTransient()) {
+ markNoTransient(component);
+ }
+ }
+
+ /**
+ * Set "transient" flag to false for component and all its children (
recursive ).
+ * @param component
+ */
+ private void markNoTransient(UIComponent component) {
+ for (Iterator<UIComponent> iter = component.getFacetsAndChildren();
iter.hasNext();) {
+ UIComponent element = iter.next();
+ markNoTransient(element);
+ element.setTransient(false);
+ }
+
+ }
+
+
+}
Copied:
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxPushRenderer.java
(from rev 15175,
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java)
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxPushRenderer.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxPushRenderer.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,128 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html;
+
+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.component.behavior.ClientBehavior;
+import javax.faces.component.behavior.ClientBehaviorContext;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.javascript.JSFunctionDefinition;
+import org.ajax4jsf.renderkit.RendererBase;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.richfaces.component.UIPush;
+
+/**
+ * @author shura
+ *
+ */
+@ResourceDependencies(value = {
+ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "richfaces.js")
+})
+public class AjaxPushRenderer extends RendererBase {
+
+ public static final String PUSH_INTERVAL_PARAMETER =
"A4J.AJAX.Push.INTERVAL";
+
+ public static final String PUSH_WAIT_PARAMETER = "A4J.AJAX.Push.WAIT";
+
+ @Deprecated
+ public static final String PUSH_URL_PARAMETER = "A4J.AJAX.Push.URL";
+
+ public static final int DEFAULT_PUSH_INTERVAL = 1000;
+
+ public static final int DEFAULT_PUSH_WAIT = Integer.MIN_VALUE;
+
+ private static final String AJAX_PUSH_FUNCTION = "A4J.AJAX.Push";
+
+ /* (non-Javadoc)
+ * @see
org.ajax4jsf.renderkit.RendererBase#doEncodeEnd(javax.faces.context.ResponseWriter,
javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+ */
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException {
+ UIPush push = (UIPush) component;
+ writer.startElement(HTML.SPAN_ELEM, component);
+ writer.writeAttribute(HTML.style_ATTRIBUTE, "display:none;", null);
+ getUtils().encodeId(context, component);
+
+ //TODO - ?
+ getUtils().encodeBeginFormIfNessesary(context, component);
+ // pushing script.
+ writer.startElement(HTML.SCRIPT_ELEM, component);
+ writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
+ StringBuffer script = new StringBuffer("\n");
+ if (push.isEnabled()) {
+ JSFunction function = new JSFunction("RichFaces.startPush");
+ // Set dummy form id, if nessesary.
+ Map<String, Object> options = new HashMap<String, Object>();
+
+ int interval = push.getInterval();
+ if (!getUtils().shouldRenderAttribute(interval)) {
+ String intervalInitParameter =
context.getExternalContext().getInitParameter(PUSH_INTERVAL_PARAMETER);
+ if(null != intervalInitParameter){
+ interval = Integer.parseInt(intervalInitParameter);
+ } else {
+ interval = DEFAULT_PUSH_INTERVAL;
+ }
+ }
+
+ options.put("interval", new Integer(interval));
+ options.put("pushId", push.getListenerId(context));
+ ClientBehaviorContext behaviorContext =
ClientBehaviorContext.createClientBehaviorContext(context, push,
push.getDefaultEventName(), push.getClientId(context), null);
+ ClientBehavior clientBehavior =
push.getClientBehaviors().get(push.getDefaultEventName()).get(0);
+ options.put(UIPush.ON_DATA_AVAILABLE, new
JSFunctionDefinition("event").addToBody(clientBehavior.getScript(behaviorContext)));
+ function.addParameter(options);
+ script.append(function.toScript());
+ } else {
+ script.append("RichFaces.stopPush('").append(push.getListenerId(context)).append("')");
+ }
+ script.append(";\n");
+ writer.writeText(script.toString(),null);
+ writer.endElement(HTML.SCRIPT_ELEM);
+ getUtils().encodeEndFormIfNessesary(context, component);
+ writer.endElement(HTML.SPAN_ELEM);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
+ */
+ protected Class<? extends UIComponent> getComponentClass() {
+ // only push component is allowed.
+ return UIPush.class;
+ }
+
+// protected boolean isSubmitted(FacesContext facesContext, UIComponent uiComponent) {
+// boolean submitted = super.isSubmitted(facesContext, uiComponent);
+// UIPush push = (UIPush) uiComponent;
+// push.setSubmitted(submitted);
+// return submitted;
+// }
+
+}
Copied:
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/MediaOutputRenderer.java
(from rev 15175,
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/html/MediaOutputRenderer.java)
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/MediaOutputRenderer.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/MediaOutputRenderer.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,128 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIParameter;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.renderkit.RendererBase;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.richfaces.component.UIMediaOutput;
+
+/**
+ * @author shura
+ *
+ */
+public class MediaOutputRenderer extends RendererBase {
+
+ public static final String RENDERER_TYPE =
"org.richfaces.MediaOutputRenderer";
+
+ /**
+ * Associationd between element name and uri attributes
+ */
+ private static final Map<String, String> uriAttributes;
+
+ static {
+ uriAttributes = new HashMap<String, String>();
+ uriAttributes.put("a","href");
+ uriAttributes.put("img","src");
+ uriAttributes.put("object","data");
+ uriAttributes.put("link","href");
+ }
+
+
+ /* (non-Javadoc)
+ * @see
org.ajax4jsf.renderkit.RendererBase#doEncodeEnd(javax.faces.context.ResponseWriter,
javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+ */
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException {
+ UIMediaOutput mmedia = (UIMediaOutput) component;
+ String element = mmedia.getElement();
+ if(null == element){
+ throw new
FacesException(Messages.getMessage(Messages.NULL_ATTRIBUTE_ERROR,"element",component.getClientId(context)));
+ }
+ writer.endElement(element);
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
+ */
+ protected Class<? extends UIComponent> getComponentClass() {
+ // TODO Auto-generated method stub
+ return UIMediaOutput.class;
+ }
+
+
+ /* (non-Javadoc)
+ * @see
org.ajax4jsf.renderkit.RendererBase#doEncodeBegin(javax.faces.context.ResponseWriter,
javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+ */
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException {
+ UIMediaOutput mmedia = (UIMediaOutput) component;
+ String element = mmedia.getElement();
+ if(null == element){
+ throw new
FacesException(Messages.getMessage(Messages.NULL_ATTRIBUTE_ERROR,"element",component.getClientId(context)));
+ }
+ String uriAttribute = mmedia.getUriAttribute();
+ // Check for pre-defined attributes
+ if(null == uriAttribute){
+ uriAttribute = (String) uriAttributes.get(element);
+
+ if (null == uriAttribute) {
+ throw new
FacesException(Messages.getMessage(Messages.NULL_ATTRIBUTE_ERROR,"uriAttribute",component.getClientId(context)));
+ }
+ }
+ writer.startElement(element,mmedia);
+ getUtils().encodeId(context, component);
+
+ StringBuilder uri = new StringBuilder(mmedia.getResource().getRequestPath());
+ // Append parameters to resource Uri
+ boolean haveQestion = uri.indexOf("?") >= 0;
+ for (UIComponent child : component.getChildren()) {
+ if (child instanceof UIParameter) {
+ UIParameter uiParam = (UIParameter) child;
+ String name = uiParam.getName();
+ Object value = uiParam.getValue();
+ if(null != value){
+ if(haveQestion){
+ uri.append('&');
+ } else {
+ uri.append('?');
+ haveQestion = true;
+ }
+ uri.append(name).append('=').append(value.toString());
+ }
+ }
+ }
+ writer.writeURIAttribute(uriAttribute,uri,"uri");
+ getUtils().encodeAttributesFromArray(context,component,HTML.PASS_THRU_STYLES);
+ getUtils().encodePassThru(context, mmedia);
+ }
+
+}
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/resource/MediaOutputResource.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/resource/MediaOutputResource.java 2009-08-18
09:24:53 UTC (rev 15190)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/resource/MediaOutputResource.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -21,22 +21,88 @@
package org.richfaces.resource;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.InputStream;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+import javax.faces.component.StateHolder;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.component.UIMediaOutput;
+
/**
* @author Nick Belaevski
* @since 4.0
*/
-public class MediaOutputResource extends AbstractBaseResource {
+public class MediaOutputResource extends AbstractBaseResource implements StateHolder {
+ private Object userData;
+
+ private MethodExpression contentProducer;
+
+ /*
+ * TODO: add handling for expressions:
+ *
+ * 1. State saving
+ * 2. Evaluation
+ */
+ private ValueExpression lastModifiedExpression;
+
+ private ValueExpression expiresExpression;
+
+ private ValueExpression timeToLiveExpression;
+
@Override
public InputStream getInputStream() {
- // TODO Auto-generated method stub
- return null;
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ contentProducer.invoke(facesContext.getELContext(), new Object[]{baos, userData});
+ return new ByteArrayInputStream(baos.toByteArray());
}
- @Override
- public void setCacheable(boolean cacheable) {
- super.setCacheable(cacheable);
+ public boolean isTransient() {
+ return false;
}
+
+ public void setTransient(boolean newTransientValue) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object saveState(FacesContext context) {
+ Object[] state = new Object[4];
+
+ //parent fields state saving
+ state[0] = isCacheable(context) ? Boolean.TRUE : Boolean.FALSE;
+ state[1] = getContentType();
+ state[2] = UIComponentBase.saveAttachedState(context, userData);
+ state[3] = UIComponentBase.saveAttachedState(context, contentProducer);
+
+ return state;
+ }
+
+ public void restoreState(FacesContext context, Object stateObject) {
+ Object[] state = (Object[]) stateObject;
+
+ setCacheable((Boolean) state[0]);
+ setContentType((String) state[1]);
+ userData = UIComponentBase.restoreAttachedState(context, state[2]);
+ contentProducer = (MethodExpression) UIComponentBase.restoreAttachedState(context,
state[3]);
+ }
+
+ /**
+ * @param uiMediaOutput
+ */
+ //TODO use ResourceComponent or exchange object as argument?
+ public void initialize(UIMediaOutput uiMediaOutput) {
+ this.setCacheable(uiMediaOutput.isCacheable());
+ this.setContentType(uiMediaOutput.getMimeType());
+ this.userData = uiMediaOutput.getValue();
+ this.contentProducer = uiMediaOutput.getCreateContentExpression();
+ this.lastModifiedExpression =
uiMediaOutput.getValueExpression("lastModfied");
+ this.expiresExpression = uiMediaOutput.getValueExpression("expires");
+ this.timeToLiveExpression = uiMediaOutput.getValueExpression("timeToLive");
+ }
}
Copied: root/ui/trunk/components/core/src/main/java/org/richfaces/taglib/html/facelets
(from rev 15175,
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets)
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/taglib/html/facelets/AjaxPushHandler.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxPushHandler.java 2009-08-14
08:20:51 UTC (rev 15175)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/taglib/html/facelets/AjaxPushHandler.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.ajax4jsf.taglib.html.facelets;
+package org.richfaces.taglib.html.facelets;
import java.util.EventListener;
@@ -32,27 +32,31 @@
import javax.faces.view.facelets.MetadataTarget;
import javax.faces.view.facelets.TagAttribute;
-import org.ajax4jsf.component.UIPush;
+import org.richfaces.component.UIPush;
/**
* @author shura (latest modification by $Author$)
- * @version $Revision$ $Date$
- *
+ * @version $Revision$ $Date: 2009-07-31 14:34:48 +0300 (Пт, 31 июл
+ * 2009) $
+ *
*/
public class AjaxPushHandler extends ComponentHandler {
private static final MetaRule ajaxPushMetaRule = new AjaxPushMetaRule();
-
+
/**
* @param config
*/
public AjaxPushHandler(ComponentConfig config) {
super(config);
-
+
}
- /* (non-Javadoc)
- * @see org.ajax4jsf.tag.AjaxComponentHandler#createMetaRuleset(java.lang.Class)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.ajax4jsf.tag.AjaxComponentHandler#createMetaRuleset(java.lang.Class)
*/
protected MetaRuleset createMetaRuleset(Class type) {
MetaRuleset metaRules = super.createMetaRuleset(type);
@@ -62,10 +66,11 @@
/**
* @author shura (latest modification by $Author$)
- * @version $Revision$ $Date$
- *
+ * @version $Revision$ $Date: 2009-07-31 14:34:48 +0300 (Пт, 31
+ * июл 2009) $
+ *
*/
- static class AjaxPushMetaRule extends MetaRule{
+ static class AjaxPushMetaRule extends MetaRule {
/**
*
@@ -74,31 +79,38 @@
super();
}
- /* (non-Javadoc)
- * @see com.sun.facelets.tag.MetaRule#applyRule(java.lang.String,
com.sun.facelets.tag.TagAttribute, com.sun.facelets.tag.MetadataTarget)
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.sun.facelets.tag.MetaRule#applyRule(java.lang.String,
+ * com.sun.facelets.tag.TagAttribute,
+ * com.sun.facelets.tag.MetadataTarget)
*/
- public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
- if (meta.isTargetInstanceOf(UIPush.class)) {
+ public Metadata applyRule(String name, TagAttribute attribute,
+ MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(UIPush.class)) {
-
- if ("eventProducer".equals(name)) {
- return new AjaxPushActionMapper(attribute);
- }
- }
+ if ("eventProducer".equals(name)) {
+ return new AjaxPushActionMapper(attribute);
+ }
+ }
return null;
}
}
+
/**
* @author shura (latest modification by $Author$)
- * @version $Revision$ $Date$
- *
+ * @version $Revision$ $Date: 2009-07-31 14:34:48 +0300 (Пт, 31
+ * июл 2009) $
+ *
*/
static class AjaxPushActionMapper extends Metadata {
- private static final Class<?>[] AJAX_PUSH_ACTION_SIG = new Class[]
{EventListener.class};
+ private static final Class<?>[] AJAX_PUSH_ACTION_SIG = new Class[] {
EventListener.class };
private final TagAttribute _send;
+
/**
* @param attribute
*/
@@ -106,12 +118,15 @@
_send = attribute;
}
- /* (non-Javadoc)
- * @see com.sun.facelets.tag.Metadata#applyMetadata(com.sun.facelets.FaceletContext,
java.lang.Object)
+ /*
+ * (non-Javadoc)
+ *
+ * @seecom.sun.facelets.tag.Metadata#applyMetadata(com.sun.facelets.
+ * FaceletContext, java.lang.Object)
*/
public void applyMetadata(FaceletContext ctx, Object instance) {
- ((UIPush) instance).setEventProducer(this._send.getMethodExpression(ctx, null,
- AJAX_PUSH_ACTION_SIG));
+ ((UIPush) instance).setEventProducer(this._send
+ .getMethodExpression(ctx, null, AJAX_PUSH_ACTION_SIG));
}
}
Copied:
root/ui/trunk/components/core/src/main/java/org/richfaces/taglib/html/facelets/MediaOutputHandler.java
(from rev 15053,
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/taglib/html/facelets/MediaOutputHandler.java)
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/taglib/html/facelets/MediaOutputHandler.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/taglib/html/facelets/MediaOutputHandler.java 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,124 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.taglib.html.facelets;
+
+import java.io.OutputStream;
+
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
+import org.richfaces.component.UIMediaOutput;
+
+/**
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:22 $
+ *
+ */
+public class MediaOutputHandler extends ComponentHandler {
+
+ private static final MetaRule mmediaMetaRule = new MMediaMetaRule();
+
+ /**
+ * @param config
+ */
+ public MediaOutputHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset metaRules = super.createMetaRuleset(type);
+ metaRules.addRule(mmediaMetaRule);
+ return metaRules;
+ }
+
+ /**
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:22 $
+ *
+ */
+ static class MMediaMetaRule extends MetaRule {
+
+ /**
+ *
+ */
+ public MMediaMetaRule() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.sun.facelets.tag.MetaRule#applyRule(java.lang.String,
+ * com.sun.facelets.tag.TagAttribute,
+ * com.sun.facelets.tag.MetadataTarget)
+ */
+ public Metadata applyRule(String name, TagAttribute attribute,
+ MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(UIMediaOutput.class)) {
+ if ("createContent".equals(name)) {
+ return new MMediaActionMapper(attribute);
+ }
+ }
+ return null;
+ }
+
+ }
+
+ /**
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:22 $
+ *
+ */
+ static class MMediaActionMapper extends Metadata {
+
+ private static final Class<?>[] MMEDIA_ACTION_SIG = new Class[] {
+ OutputStream.class, Object.class };
+
+ private final TagAttribute _send;
+
+ /**
+ * @param attribute
+ */
+ public MMediaActionMapper(TagAttribute attribute) {
+ _send = attribute;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seecom.sun.facelets.tag.Metadata#applyMetadata(com.sun.facelets.
+ * FaceletContext, java.lang.Object)
+ */
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((UIMediaOutput) instance).setCreateContentExpression(this._send
+ .getMethodExpression(ctx, null, MMEDIA_ACTION_SIG));
+ }
+
+ }
+
+}
Modified: root/ui/trunk/components/core/src/main/resources/META-INF/a4j.taglib.xml
===================================================================
--- root/ui/trunk/components/core/src/main/resources/META-INF/a4j.taglib.xml 2009-08-18
09:24:53 UTC (rev 15190)
+++ root/ui/trunk/components/core/src/main/resources/META-INF/a4j.taglib.xml 2009-08-18
09:40:41 UTC (rev 15191)
@@ -6,17 +6,32 @@
<tag>
<tag-name>push</tag-name>
<component>
- <component-type>org.ajax4jsf.Push</component-type>
- <renderer-type>org.ajax4jsf.PushRenderer</renderer-type>
- <handler-class>org.ajax4jsf.taglib.html.facelets.AjaxPushHandler</handler-class>
+ <component-type>org.richfaces.Push</component-type>
+ <renderer-type>org.richfaces.PushRenderer</renderer-type>
+ <handler-class>org.richfaces.taglib.html.facelets.AjaxPushHandler</handler-class>
</component>
</tag>
<tag>
<tag-name>jsFunction</tag-name>
<component>
- <component-type>org.ajax4jsf.Function</component-type>
- <renderer-type>org.ajax4jsf.FunctionRenderer</renderer-type>
+ <component-type>org.richfaces.Function</component-type>
+ <renderer-type>org.richfaces.FunctionRenderer</renderer-type>
</component>
</tag>
+ <tag>
+ <tag-name>outputPanel</tag-name>
+ <component>
+ <component-type>org.richfaces.OutputPanel</component-type>
+ <renderer-type>org.richfaces.OutputPanelRenderer</renderer-type>
+ </component>
+ </tag>
+ <tag>
+ <tag-name>mediaOutput</tag-name>
+ <component>
+ <component-type>org.richfaces.MediaOutput</component-type>
+ <renderer-type>org.richfaces.MediaOutputRenderer</renderer-type>
+ <handler-class>org.richfaces.taglib.html.facelets.MediaOutputHandler</handler-class>
+ </component>
+ </tag>
</facelet-taglib>
Modified: root/ui/trunk/components/core/src/main/resources/META-INF/faces-config.xml
===================================================================
--- root/ui/trunk/components/core/src/main/resources/META-INF/faces-config.xml 2009-08-18
09:24:53 UTC (rev 15190)
+++ root/ui/trunk/components/core/src/main/resources/META-INF/faces-config.xml 2009-08-18
09:40:41 UTC (rev 15191)
@@ -10,26 +10,46 @@
</managed-bean>
<component>
- <component-type>org.ajax4jsf.Push</component-type>
- <component-class>org.ajax4jsf.component.html.HtmlPush</component-class>
+ <component-type>org.richfaces.Push</component-type>
+ <component-class>org.richfaces.component.html.HtmlPush</component-class>
</component>
<component>
- <component-type>org.ajax4jsf.Function</component-type>
- <component-class>org.ajax4jsf.component.html.HtmlAjaxFunction</component-class>
+ <component-type>org.richfaces.Function</component-type>
+ <component-class>org.richfaces.component.html.HtmlAjaxFunction</component-class>
</component>
+ <component>
+ <component-type>org.richfaces.MediaOutput</component-type>
+ <component-class>org.richfaces.component.html.HtmlMediaOutput</component-class>
+ </component>
+
+ <component>
+ <component-type>org.richfaces.OutputPanel</component-type>
+ <component-class>org.richfaces.component.html.HtmlOutputPanel</component-class>
+ </component>
+
<render-kit>
<render-kit-id>HTML_BASIC</render-kit-id>
<renderer>
- <component-family>org.ajax4jsf.Push</component-family>
- <renderer-type>org.ajax4jsf.PushRenderer</renderer-type>
- <renderer-class>org.ajax4jsf.renderkit.html.AjaxPushRenderer</renderer-class>
+ <component-family>org.richfaces.Push</component-family>
+ <renderer-type>org.richfaces.PushRenderer</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.AjaxPushRenderer</renderer-class>
</renderer>
<renderer>
- <component-family>org.ajax4jsf.Function</component-family>
- <renderer-type>org.ajax4jsf.FunctionRenderer</renderer-type>
- <renderer-class>org.ajax4jsf.renderkit.html.AjaxFunctionRenderer</renderer-class>
+ <component-family>javax.faces.Command</component-family>
+ <renderer-type>org.richfaces.FunctionRenderer</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.AjaxFunctionRenderer</renderer-class>
</renderer>
+ <renderer>
+ <component-family>org.richfaces.MediaOutput</component-family>
+ <renderer-type>org.richfaces.MediaOutputRenderer</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.MediaOutputRenderer</renderer-class>
+ </renderer>
+ <renderer>
+ <component-family>javax.faces.Panel</component-family>
+ <renderer-type>org.richfaces.OutputPanelRenderer</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.AjaxOutputPanelRenderer</renderer-class>
+ </renderer>
</render-kit>
</faces-config>
\ No newline at end of file
Added:
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/button.template.xml
===================================================================
---
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/button.template.xml
(rev 0)
+++
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/button.template.xml 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<cdk:root
xmlns="http://richfaces.org/xhtml-el"
xmlns:cdk="http://richfaces.org/cdk"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ class="org.richfaces.renderkit.html.CommandButtonRenderer"
+ superclass="org.richfaces.renderkit.html.AjaxCommandButtonRendererBase"
+ componentclass="org.richfaces.component.UIAjaxCommandButton">
+
+ <!-- f:clientid var="clientId"/ -->
+
+ <input
+ id="#{clientId}"
+ name="#{clientId}"
+ value="#{this.getValue(component)}"
+ cdk:passThroughWithExclusions="value name onclick type id class"
+ onclick="#{this.getOnClick(context,component)}"
+ class="#{component.attributes['styleClass']}"
+ >
+ <cdk:call expression="encodeTypeAndImage(context,component);" />
+ </input>
+
+</cdk:root>
Added:
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/function.template.xml
===================================================================
---
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/function.template.xml
(rev 0)
+++
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/function.template.xml 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<cdk:root
xmlns="http://richfaces.org/xhtml-el"
xmlns:cdk="http://richfaces.org/cdk"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ class="org.richfaces.renderkit.html.AjaxFunctionRenderer"
+ superclass="org.richfaces.renderkit.AjaxFunctionRendererBase"
+ componentclass="org.richfaces.component.UIAjaxFunction">
+
+ <!-- f:clientid var="clientId"/ -->
+ <span id="#{clientId}" style="display: none;">
+ <script type="text/javascript">
+ #{this.getFunction(context,component)};
+ </script>
+ </span>
+</cdk:root>
Added:
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/link.template.xml
===================================================================
---
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/link.template.xml
(rev 0)
+++
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/link.template.xml 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<cdk:root
xmlns="http://richfaces.org/xhtml-el"
xmlns:cdk="http://richfaces.org/cdk"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ class="org.richfaces.renderkit.html.CommandLinkRenderer"
+ superclass="org.richfaces.renderkit.AjaxCommandRendererBase"
+ componentclass="org.richfaces.component.UIAjaxCommandLink">
+
+ <!-- f:clientid var="clientId"/ -->
+ <a
+ id="#{clientId}"
+ name="#{clientId}"
+ type="#{component.attributes['type']}"
+ cdk:passThroughWithExclusions="value name onclick type href id"
+ onclick="#{this.getOnClick(context,component)}"
+ href="#"
+ class="#{component.attributes['styleClass']}"
+ >
+ #{this.getValue(component)}
+ <cdk:body>
+ <cdk:call expression="renderChildren(context,component);" />
+ </cdk:body>
+ </a>
+</cdk:root>
\ No newline at end of file
Added:
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/log.template.xml
===================================================================
---
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/log.template.xml
(rev 0)
+++
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/log.template.xml 2009-08-18
09:40:41 UTC (rev 15191)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<cdk:root
xmlns="http://richfaces.org/xhtml-el"
xmlns:cdk="http://richfaces.org/cdk"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ class="org.richfaces.renderkit.html.LogRenderer"
+ superclass="org.richfaces.renderkit.AjaxComponentRendererBase"
+ componentclass="org.richfaces.component.UIAjaxLog">
+
+ <!-- f:clientid var="clientId"/ -->
+ <cdk:choose>
+ <cdk:when test="#{component.isPopup()}">
+ <script id="#{clientId}" type="text/javascript">
+ LOG.registerPopup(
+ '#{component.attributes["hotkey"]}',
+ '#{component.attributes["name"]}',
+ #{component.attributes["width"]},
+ #{component.attributes["height"]},
+ LOG.#{component.attributes["level"]});
+ </script>
+ </cdk:when>
+ <cdk:otherwise>
+ <div id="richfaces.log"
+ style='width:#{component.attributes["width"]};height:#{component.attributes["height"]};overflow:auto;#{component.attributes["style"]}'
+ cdk:passThroughWithExclusions="value name id style">
+ <button>Clear</button><br />
+ <script type="text/javascript">
+ LOG.LEVEL = LOG.#{component.attributes["level"]};
+ </script>
+ </div>
+ </cdk:otherwise>
+ </cdk:choose>
+</cdk:root>