JBoss Rich Faces SVN: r5575 - branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-01-23 20:32:41 -0500 (Wed, 23 Jan 2008)
New Revision: 5575
Modified:
branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js
branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-selection.js
branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js
Log:
http://jira.jboss.com/jira/browse/RF-2017
Modified: branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js
===================================================================
--- branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js 2008-01-24 01:29:35 UTC (rev 5574)
+++ branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js 2008-01-24 01:32:41 UTC (rev 5575)
@@ -36,7 +36,7 @@
},
destroy: function() {
- if (this == this.tree.selectionManager.activeItem) {
+ if (this.tree.selectionManager && this == this.tree.selectionManager.activeItem) {
this.tree.selectionManager.activeItem = null;
}
Modified: branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-selection.js
===================================================================
--- branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-selection.js 2008-01-24 01:29:35 UTC (rev 5574)
+++ branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-selection.js 2008-01-24 01:32:41 UTC (rev 5575)
@@ -13,6 +13,14 @@
Event.observe(this.tree.element, "click", this.eventPreventLostFocus);
},
+ destroy: function() {
+ this.activeItem = null;
+ this.tree = null;
+
+ Event.stopObserving(document, "keypress", this.eventKeyPress);
+ Event.stopObserving(document, "click", this.eventLostFocus);
+ },
+
restoreSelection: function() {
if (this.tree.input.value)
{
Modified: branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js
===================================================================
--- branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js 2008-01-24 01:29:35 UTC (rev 5574)
+++ branches/3.1.x/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js 2008-01-24 01:32:41 UTC (rev 5575)
@@ -20,6 +20,8 @@
Tree.prototype = {
initialize: function(id, input, switchType, events, onAjaxSelect, toggleOnClick, showConnectingLines) {
+ this["rich:destructor"] = "destroy";
+
this.childs = [];
this.elements = {};
@@ -30,6 +32,8 @@
this.oncollapse = new Function('event', (events.oncollapse ? events.oncollapse : "") + "; return true;");
this.onAjaxSelect = onAjaxSelect;
this.element = $(id);
+ this.element.component = this;
+
this.inputId = input;
this.input = $(this.inputId);
this.toggleOnClick = toggleOnClick;
@@ -40,7 +44,6 @@
}, arguments[1] || {}
);
this.options = options;
-
//var d = new Date();
this.getElements();
//alert(new Date().getTime() - d.getTime());
@@ -108,6 +111,13 @@
}.bindAsEventListener(this));
},
+ destroy: function() {
+ this.selectionManager.destroy();
+
+ this.element.component = null;
+ this.element = null;
+ },
+
getElements: function(ajaxUpdate) {
this.elements.contentTd = $(this.id +
Tree.ID_DEVIDER + Tree.ID_CHILDS_ROW/* + Tree.ID_DEVIDER + Tree.ID_CHILDS_TD*/);
16 years, 11 months
JBoss Rich Faces SVN: r5573 - in trunk: extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet and 7 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2008-01-23 20:01:33 -0500 (Wed, 23 Jan 2008)
New Revision: 5573
Added:
trunk/ui/virtualEarth/src/main/java/META-INF/
trunk/ui/virtualEarth/src/main/java/META-INF/MANIFEST.MF
Modified:
trunk/extensions/portletbridge/portletbridge-api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/AjaxPortletBridge.java
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/application/PortletViewHandler.java
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/application/PortletViewState.java
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/context/PortletExternalContextImpl.java
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortalPhaseListener.java
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/web.xml
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/edit.xhtml
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/template.xhtml
Log:
Fix some Seam issues.
Modified: trunk/extensions/portletbridge/portletbridge-api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java
===================================================================
--- trunk/extensions/portletbridge/portletbridge-api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java 2008-01-23 19:37:34 UTC (rev 5572)
+++ trunk/extensions/portletbridge/portletbridge-api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java 2008-01-24 01:01:33 UTC (rev 5573)
@@ -83,7 +83,7 @@
config.getInitParameter(Bridge.BRIDGE_PACKAGE_PREFIX + Bridge.RENDER_POLICY);
if (renderPolicy != null)
portletContext.setAttribute(Bridge.BRIDGE_PACKAGE_PREFIX +
- this.getPortletName() + "." + Bridge.RENDER_POLICY,
+ this.getPortletName() + Bridge.RENDER_POLICY_PARAM_ATTR_SUFFIX,
Bridge.BridgeRenderPolicy.valueOf(renderPolicy));
String preserveActionParams =
config.getInitParameter(Bridge.BRIDGE_PACKAGE_PREFIX + Bridge.PRESERVE_ACTION_PARAMS);
Modified: trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/AjaxPortletBridge.java
===================================================================
--- trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/AjaxPortletBridge.java 2008-01-23 19:37:34 UTC (rev 5572)
+++ trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/AjaxPortletBridge.java 2008-01-24 01:01:33 UTC (rev 5573)
@@ -187,6 +187,8 @@
if(null != redirectViewId){
windowState.reset();
windowState.setViewId(redirectViewId);
+ // release old FacesContext.
+ facesContext.release();
// Reset attributes to initial state
ArrayList initialAttributes = (ArrayList) request.getAttribute(AbstractExternalContext.EXCLUDED_PARAMETERS_ATTRIBUTE);
ArrayList currentAttributes = Collections.list(request.getAttributeNames());
@@ -194,8 +196,8 @@
for (Object newAttribute : currentAttributes) {
request.removeAttribute((String) newAttribute);
}
- // Re-create FacesContext.
- facesContext.release();
+ request.setAttribute(AbstractExternalContext.VIEW_ID_PARAMETER, redirectViewId);
+ // Create new FacesContext
facesContext = getFacesContext(request, response);
renderResponse(facesContext, windowState);
}
Modified: trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/application/PortletViewHandler.java
===================================================================
--- trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/application/PortletViewHandler.java 2008-01-23 19:37:34 UTC (rev 5572)
+++ trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/application/PortletViewHandler.java 2008-01-24 01:01:33 UTC (rev 5573)
@@ -82,17 +82,18 @@
public void renderView(FacesContext context, UIViewRoot viewToRender) throws IOException,
FacesException
{
- // Get the renderPolicy from the requestScope
- Bridge.BridgeRenderPolicy renderPolicy = (Bridge.BridgeRenderPolicy) context
- .getExternalContext()
- .getRequestMap()
- .get(
- AbstractExternalContext.RENDER_POLICY_ATTRIBUTE);
+ // Get the renderPolicy from the init parameters
+ String renderPolicyParam = context
+ .getExternalContext()
+ .getInitParameter(Bridge.BRIDGE_PACKAGE_PREFIX+Bridge.RENDER_POLICY);
- if (renderPolicy == null)
+ Bridge.BridgeRenderPolicy renderPolicy ;
+ if (renderPolicyParam == null)
{
- renderPolicy = Bridge.BridgeRenderPolicy.valueOf("DEFAULT");
- }
+ renderPolicy = Bridge.BridgeRenderPolicy.DEFAULT;
+ } else {
+ renderPolicy = Bridge.BridgeRenderPolicy.valueOf(renderPolicyParam);
+ }
if (context.getExternalContext().getContext() instanceof ServletContext
|| renderPolicy == Bridge.BridgeRenderPolicy.ALWAYS_DELEGATE)
Modified: trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/application/PortletViewState.java
===================================================================
--- trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/application/PortletViewState.java 2008-01-23 19:37:34 UTC (rev 5572)
+++ trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/application/PortletViewState.java 2008-01-24 01:01:33 UTC (rev 5573)
@@ -12,6 +12,7 @@
import java.util.Map;
import java.util.Map.Entry;
+import javax.faces.application.Application;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIViewRoot;
import javax.faces.context.ExternalContext;
@@ -287,13 +288,30 @@
}
requestParameters = new HashMap<String, String[]>(facesContext
.getExternalContext().getRequestParameterValuesMap());
+ saveSeamConversationId(facesContext);
+ }
+
+ /**
+ * @param facesContext
+ */
+ public void saveSeamConversationId(FacesContext facesContext) {
// Seam hack - save conversation Id for a request parameter.
try {
- Object conversationId = facesContext.getApplication()
- .evaluateExpressionGet(facesContext, "#{conversation.id}",
- Object.class);
- if(null != conversationId){
- requestParameters.put(AbstractExternalContext.CONVERSATION_ID_PARAMETER, new String[]{conversationId.toString()});
+ Application application = facesContext.getApplication();
+ Object isLongRunningConversation = application
+ .evaluateExpressionGet(facesContext, "#{conversation.longRunning}",
+ Boolean.class);
+ if (Boolean.TRUE.equals(isLongRunningConversation)) {
+ Object conversationId = application.evaluateExpressionGet(
+ facesContext, "#{conversation.id}", Object.class);
+ if (null != conversationId) {
+ requestParameters.put(
+ AbstractExternalContext.CONVERSATION_ID_PARAMETER,
+ new String[] { conversationId.toString() });
+ }
+
+ } else {
+ requestParameters.remove(AbstractExternalContext.CONVERSATION_ID_PARAMETER);
}
} catch (Exception e) {
// Do nothing - no seam conversation found !
Modified: trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/context/PortletExternalContextImpl.java
===================================================================
--- trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/context/PortletExternalContextImpl.java 2008-01-23 19:37:34 UTC (rev 5572)
+++ trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/context/PortletExternalContextImpl.java 2008-01-24 01:01:33 UTC (rev 5573)
@@ -289,10 +289,10 @@
private String _pathInfo = null;
public String getRequestPathInfo() {
- String pathInfo = (String) getRequestParameter(VIEW_ID_PARAMETER);
- if (null == pathInfo) {
- pathInfo = (String) getRequestAttribute(VIEW_ID_PARAMETER);
- }
+// String pathInfo = (String) getRequestParameter(VIEW_ID_PARAMETER);
+// if (null == pathInfo) {
+ String pathInfo = (String) getRequestAttribute(VIEW_ID_PARAMETER);
+// }
return pathInfo;
}
Modified: trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortalPhaseListener.java
===================================================================
--- trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortalPhaseListener.java 2008-01-23 19:37:34 UTC (rev 5572)
+++ trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortalPhaseListener.java 2008-01-24 01:01:33 UTC (rev 5573)
@@ -43,9 +43,13 @@
if (Bridge.PortletPhase.RenderPhase.equals(portletPhase)) {
context.renderResponse();
}
+ } else if (phaseId.equals(PhaseId.RENDER_RESPONSE)) {
+ // save Seam conversation Id.
+ PortletViewState windowState = PortletStateHolder.getInstance(
+ context).getWindowState(context);
+ windowState.saveSeamConversationId(context);
} else if (null == portletPhase && (phaseId.equals(PhaseId.INVOKE_APPLICATION)
- || (!phaseId.equals(PhaseId.RENDER_RESPONSE) && context
- .getRenderResponse()))) {
+ && context.getRenderResponse())) {
// save request scope variables and Faces Messages for a Servlet request.
PortletViewState windowState = PortletStateHolder.getInstance(
context).getWindowState(context);
Modified: trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/web.xml 2008-01-23 19:37:34 UTC (rev 5572)
+++ trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/web.xml 2008-01-24 01:01:33 UTC (rev 5573)
@@ -17,6 +17,12 @@
org.ajax4jsf.portlet.SeamExceptionHandlerImpl
</param-value>
</context-param>
+ <context-param>
+ <param-name>javax.portlet.faces.renderPolicy</param-name>
+ <param-value>
+ ALWAYS_DELEGATE
+ </param-value>
+ </context-param>
<!-- Seam -->
<listener>
Modified: trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/edit.xhtml
===================================================================
--- trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/edit.xhtml 2008-01-23 19:37:34 UTC (rev 5572)
+++ trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/edit.xhtml 2008-01-24 01:01:33 UTC (rev 5573)
@@ -3,6 +3,7 @@
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a="http://richfaces.org/a4j"
xmlns:s="http://jboss.com/products/seam/taglib">
<div class="entry">
@@ -15,7 +16,9 @@
<ui:insert/>
</s:validateAll>
</span>
+ <a:outputPanel ajaxRendered="true">
<s:message styleClass="error errors"/>
+ </a:outputPanel>
</div>
</ui:composition>
\ No newline at end of file
Modified: trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/template.xhtml
===================================================================
--- trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/template.xhtml 2008-01-23 19:37:34 UTC (rev 5572)
+++ trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/template.xhtml 2008-01-24 01:01:33 UTC (rev 5573)
@@ -26,6 +26,6 @@
</div>
</div>
<div id="footer">Created with JBoss Seam 2.0, JBoss EJB 3.0, JSF 1.2, Hibernate 3 and Facelets</div>
- <!-- a:log hotkey="M" /-->
+ <a:log hotkey="M" rendered="#{!ajaxContext.ajaxRequest}" />
</div>
</f:view>
Added: trunk/ui/virtualEarth/src/main/java/META-INF/MANIFEST.MF
===================================================================
--- trunk/ui/virtualEarth/src/main/java/META-INF/MANIFEST.MF (rev 0)
+++ trunk/ui/virtualEarth/src/main/java/META-INF/MANIFEST.MF 2008-01-24 01:01:33 UTC (rev 5573)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
Property changes on: trunk/ui/virtualEarth/src/main/java/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 11 months
JBoss Rich Faces SVN: r5572 - in trunk/sandbox/ui/progressBAR/src/main: java/org/richfaces/renderkit and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-01-23 14:37:34 -0500 (Wed, 23 Jan 2008)
New Revision: 5572
Modified:
trunk/sandbox/ui/progressBAR/src/main/config/component/progressBar.xml
trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java
trunk/sandbox/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js
trunk/sandbox/ui/progressBAR/src/main/templates/org/richfaces/progressBar.jspx
Log:
Modified: trunk/sandbox/ui/progressBAR/src/main/config/component/progressBar.xml
===================================================================
--- trunk/sandbox/ui/progressBAR/src/main/config/component/progressBar.xml 2008-01-23 17:07:24 UTC (rev 5571)
+++ trunk/sandbox/ui/progressBAR/src/main/config/component/progressBar.xml 2008-01-23 19:37:34 UTC (rev 5572)
@@ -35,6 +35,11 @@
<defaultvalue><![CDATA["ajax"]]></defaultvalue>
</property>
<property>
+ <name>parameters</name>
+ <classname>java.lang.Object</classname>
+ <description>Parameters for macrosubstitution in label</description>
+ </property>
+ <property>
<name>minValue</name>
<classname>java.lang.Object</classname>
<description>Min value when initial state should be rendered</description>
@@ -60,11 +65,13 @@
<name>completeClass</name>
<classname>java.lang.String</classname>
<description>CSS class that defines style for progress line rendering</description>
+ <defaultvalue>"rich-progress-bar-completed"</defaultvalue>
</property>
<property>
<name>remainClass</name>
<classname>java.lang.String</classname>
<description>CSS class that defines style for remained part of progress bar</description>
+ <defaultvalue>"rich-progress-bar-remained"</defaultvalue>
</property>
<property>
<name>initialClass</name>
Modified: trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java
===================================================================
--- trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java 2008-01-23 17:07:24 UTC (rev 5571)
+++ trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java 2008-01-23 19:37:34 UTC (rev 5572)
@@ -8,41 +8,157 @@
import java.io.IOException;
import java.math.BigDecimal;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
-import javax.el.ELContext;
-import javax.el.ValueExpression;
-import javax.el.VariableMapper;
+import javax.faces.FactoryFinder;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
+import javax.faces.render.RenderKit;
+import javax.faces.render.RenderKitFactory;
+import javax.servlet.http.HttpServletRequest;
import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.context.AjaxContextImpl;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.javascript.JSFunctionDefinition;
+import org.ajax4jsf.javascript.JSReference;
+import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.AjaxCommandRendererBase;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.ComponentVariables;
import org.ajax4jsf.renderkit.ComponentsVariableResolver;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.resource.CountingOutputWriter;
import org.richfaces.component.UIProgressBar;
-import sun.management.counter.Variability;
-
/**
* Abstract progress bar renderer
*
* @author "Andrey Markavtsov"
*
*/
-public class AbstractProgressBarRenderer extends AjaxCommandRendererBase {
+public class AbstractProgressBarRenderer extends TemplateEncoderRendererBase {
- /** AJAX polling function name */
- private static final String AJAX_POLL_FUNCTION = "A4J.AJAX.Poll";
+ /** Pattern to find macrosubstitution parameters defined in attrs */
+ private static final Pattern PARAMETERS = Pattern
+ .compile("^\\s*([\\w\\d]+)\\s*[=:]\\s*['\"]*([\\w\\d]+)['\"]*\\s*$");
+ /** Expression for params string split */
+ private static final String SPLIT_EXPRS = "[;,]";
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.renderkit.AjaxCommandRendererBase#doDecode(javax.faces.context.FacesContext,
+ * javax.faces.component.UIComponent)
+ */
+ @Override
+ protected void doDecode(FacesContext facesContext, UIComponent uiComponent) {
+ AjaxContext ajaxContext = AjaxContextImpl
+ .getCurrentInstance(facesContext);
+
+ if (!ajaxContext.isAjaxRequest()) {
+ return;
+ }
+
+ HttpServletRequest request = (HttpServletRequest) facesContext
+ .getExternalContext().getRequest();
+
+ ComponentVariables variables = ComponentsVariableResolver.getVariables(
+ this, uiComponent);
+ Number percent = getNumber(uiComponent.getAttributes().get("value"));
+ Number maxValue = getNumber(uiComponent.getAttributes().get("maxValue"));
+ Map params = request.getParameterMap();
+ if (percent.doubleValue() < maxValue.doubleValue()
+ && params.containsKey("percent")) {
+ ajaxContext.removeRenderedArea(uiComponent
+ .getClientId(facesContext));
+ ajaxContext.setResponseData(getResponseData(uiComponent, percent));
+ Object rerenderAfterComplete = uiComponent.getAttributes().get(
+ "reRender");
+ Set ajaxRegions = AjaxRendererUtils.asSet(rerenderAfterComplete);
+
+ if (ajaxRegions != null) {
+ for (Iterator iter = ajaxRegions.iterator(); iter.hasNext();) {
+ String id = iter.next().toString();
+ ajaxContext.addComponentToAjaxRender(uiComponent, id);
+ }
+ }
+ } else {
+ ajaxContext.addComponentToAjaxRender(uiComponent);
+ }
+ }
+
/**
+ * Returns ajax response data
+ * @param uiComponent
+ * @param percent
+ * @return
+ */
+ private String getResponseData(UIComponent uiComponent, Number percent) {
+ UIProgressBar progressBar = (UIProgressBar) uiComponent;
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("percent:");
+ buffer.append(percent);
+ buffer.append(",");
+
+ buffer.append("data:");
+ buffer.append(percent);
+ buffer.append(",");
+
+ boolean enabled = (Boolean) uiComponent.getAttributes().get("enabled");
+ buffer.append("enabled:");
+ buffer.append(Boolean.toString(enabled));
+ buffer.append(",");
+
+ addStyles2Responce(buffer, "completeClass", (String) uiComponent
+ .getAttributes().get("completeClass"));
+ addStyles2Responce(buffer, "remainClass", (String) uiComponent
+ .getAttributes().get("remainClass"));
+ addStyles2Responce(buffer, "styleClass", (String) uiComponent
+ .getAttributes().get("styleClass"));
+ addStyles2Responce(buffer, "initialClass", (String) uiComponent
+ .getAttributes().get("initialClass"));
+ addStyles2Responce(buffer, "finishClass", (String) uiComponent
+ .getAttributes().get("finishClass"));
+
+ return buffer.toString();
+
+ }
+
+ /**
+ * Add component classes to ajax response
+ * @param buffer
+ * @param attr
+ * @param newValue
+ */
+ private void addStyles2Responce(StringBuffer buffer, String attr,
+ String newValue) {
+ if (newValue != null) {
+ buffer.append(attr);
+ buffer.append(":");
+ buffer.append(newValue);
+ buffer.append(",");
+ }
+ }
+
+ /**
+ * Return poll function name
+ * @param component
+ * @return
+ */
+ public String getVarName(UIComponent component) {
+ return "p" + Math.abs(component.hashCode());
+ }
+
+ /**
* Methods encodes AJAX script for polling
*
* @param context -
@@ -62,19 +178,27 @@
writer.writeAttribute(HTML.style_ATTRIBUTE, "display:none;", null);
writer.startElement(HTML.SCRIPT_ELEM, component);
writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
+ String varName = getVarName(component);
+ StringBuffer pollScript = new StringBuffer("\n");
StringBuffer script = new StringBuffer("\n");
- if (progressBar.isEnabled()) {
- JSFunction function = AjaxRendererUtils.buildAjaxFunction( // encode
- // script
- // if
- // polling
- // enable
- component, context, AJAX_POLL_FUNCTION);
+ if (isAjaxMode(component)) {
+
+ pollScript.append(getStopPollScript(clientId));
+
+ pollScript.append("var ");
+ pollScript.append(varName);
+ pollScript.append("= function () { \n");
+
+ JSFunction function = AjaxRendererUtils.buildAjaxFunction(
+ component, context, AjaxRendererUtils.AJAX_FUNCTION_NAME);
+ function.addParameter(new JSReference("null"));
Map options = AjaxRendererUtils.buildEventOptions(context,
component);
Integer interval = new Integer(progressBar.getInterval());
- options.put("pollinterval", interval);
- options.put("pollId", clientId);
+ Map parameters = (Map) options.get("parameters");
+ parameters.put("percent", "percent");
+ options.put("oncomplete", getOnComplete(clientId, progressBar,
+ context, writer, options));
Object onsubmit = component.getAttributes().get("onsubmit");
if (null != onsubmit) {
JSFunctionDefinition onsubmitFunction = new JSFunctionDefinition();
@@ -84,16 +208,72 @@
function.addParameter(options);
function.appendScript(script);
+
+ pollScript.append(script);
+ pollScript.append("\n A4J.AJAX._pollers['");
+ pollScript.append(clientId);
+ pollScript.append("'] = window.setTimeout(");
+ pollScript.append(varName);
+ pollScript.append(",");
+ pollScript.append(progressBar.getInterval());
+ pollScript.append(");\n");
+ pollScript.append("}\n");
+ if (progressBar.isEnabled()) {
+ pollScript.append(varName);
+ pollScript.append("();");
+ }
+
} else {
- script.append("A4J.AJAX.StopPoll('").append(
- component.getClientId(context)).append("')");
+ pollScript.append(getStopPollScript(clientId));
}
- script.append(";\n");
- writer.writeText(script.toString(), null);
+ pollScript.append(";\n");
+ writer.writeText(pollScript.toString(), null);
writer.endElement(HTML.SCRIPT_ELEM);
writer.endElement(HTML.SPAN_ELEM);
}
+
+ /**
+ * Check if component mode is AJAX
+ * @param component
+ * @return
+ */
+ private boolean isAjaxMode (UIComponent component) {
+ String mode = (String)component.getAttributes().get("mode");
+ return "ajax".equalsIgnoreCase(mode);
+ }
+ /**
+ * Creates oncomplete function
+ * @param clientId
+ * @param component
+ * @param context
+ * @param writer
+ * @param options
+ * @return
+ */
+ public JSFunctionDefinition getOnComplete(String clientId,
+ UIProgressBar component, FacesContext context,
+ ResponseWriter writer, Map options) {
+ JSFunctionDefinition functionDefinition = new JSFunctionDefinition();
+ functionDefinition.addParameter("request");
+ functionDefinition.addParameter("event");
+ functionDefinition.addParameter("data");
+ StringBuffer body = new StringBuffer();
+ ComponentVariables variables = ComponentsVariableResolver.getVariables(
+ this, component);
+ UIComponent nestingContainer = (UIComponent) AjaxRendererUtils
+ .findAjaxContainer(context, component);
+ UIComponent form = (UIComponent) AjaxRendererUtils
+ .getNestingForm(component);
+ String content = (String) variables.getVariable("content");
+ body.append("new ProgressBar('" + clientId + "').onComplete(data,'")
+ .append(content).append("',").append(
+ ScriptUtils.toScript(getParametersMap(component)))
+ .append(")");
+ functionDefinition.addToBody(body.toString());
+ return functionDefinition;
+ }
+
/**
* Methods encodes start facet of progress bar component
*
@@ -165,54 +345,54 @@
ComponentVariables variables = ComponentsVariableResolver.getVariables(
this, component);
Number value = (Number) variables.getVariable("percent");
+
String width = String.valueOf(value.intValue());
String style = (String) component.getAttributes().get("style");
Boolean permanent = (Boolean) component.getAttributes()
.get("permanent");
Boolean determined = (Boolean) component.getAttributes().get(
"determined");
-
+ String content = getLabel(context, component, writer);
if (!(permanent != null && permanent.booleanValue())) {
- String completeClass = (component.getAttributes().get(
- "completeClass") != null) ? (String) component
- .getAttributes().get("completeClass")
- : "rich-progress-bar-completed";
+ String completeClass = (String) component.getAttributes().get(
+ "completeClass");
- String remainClass = (component.getAttributes().get("remainClass") != null) ? (String) component
- .getAttributes().get("remainClass")
- : "rich-progress-bar-remained";
+ String remainClass = (String) component.getAttributes().get(
+ "remainClass");
writer.startElement("div", component);
getUtils().writeAttribute(writer, "class",
remainClass + " rich-progress-bar-base");
getUtils().writeAttribute(writer, "id", clientId + ":remain");
getUtils().writeAttribute(writer, "style", style);
+
- if (determined.booleanValue()) {
- renderChildren(context, component);
- }
+ encodeChildren(context, component, clientId + ":remain");
+
writer.endElement("div");
writer.startElement("div", component);
getUtils().writeAttribute(writer, "class",
"rich-progress-bar-uploaded");
getUtils().writeAttribute(writer, "id", clientId + ":upload");
- getUtils().writeAttribute(writer, "style",
- style + "; width: " + width + "%;");
+ getUtils().writeAttribute(
+ writer,
+ "style",
+ (style != null ? style + ";" : "") + " width: " + width
+ + "%;");
writer.startElement("div", component);
getUtils().writeAttribute(writer, "class",
completeClass + " rich-progress-bar-base");
getUtils().writeAttribute(writer, "id", clientId + ":complete");
getUtils().writeAttribute(writer, "style", style);
+
+ encodeChildren(context, component, clientId + ":complete");
- if (determined.booleanValue()) {
- renderChildren(context, component);
- }
+ writer.endElement("div");
writer.endElement("div");
- writer.endElement("div");
} else {
writer.startElement("div", component);
getUtils().writeAttribute(writer, "class",
@@ -222,9 +402,89 @@
}
}
- private void encodeChildrenComponents(FacesContext context,
+ /**
+ * Renderers children label components
+ * @param context
+ * @param component
+ * @param writer
+ * @return
+ */
+ public String getLabel(FacesContext context, UIComponent component,
+ ResponseWriter writer) {
+ String childrenContent = null;
+ CountingOutputWriter customWriter = new CountingOutputWriter();
+ String defaultRenderKitId = context.getApplication()
+ .getDefaultRenderKitId();
+ if (null == defaultRenderKitId) {
+ defaultRenderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT;
+ }
+ RenderKitFactory renderKitFactory = (RenderKitFactory) FactoryFinder
+ .getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+ RenderKit renderKit = renderKitFactory.getRenderKit(context,
+ defaultRenderKitId);
+ try {
+
+ ResponseWriter responseWriter = renderKit.createResponseWriter(
+ customWriter, null, "UTF-8");
+ context.setResponseWriter(responseWriter);
+ renderChildrenComponents(context, component);
+ childrenContent = customWriter.getContent().toString();
+ context.setResponseWriter(writer);
+ } catch (Exception e) {
+ // TODO: do nothing
+ } finally {
+ context.setResponseWriter(writer);
+ }
+ return childrenContent;
+ }
+
+ /**
+ * Gets map with parameters defined in 'parameters' attr
+ * @param component
+ * @return
+ */
+ private Map<String, String> getParametersMap(UIComponent component) {
+ String parameters = (String) component.getAttributes()
+ .get("parameters");
+ if (parameters != null) {
+ Map<String, String> map = new HashMap<String, String>();
+ String[] strs = parameters.split(SPLIT_EXPRS);
+ if (strs != null) {
+ for (String str : strs) {
+ Matcher matcher = PARAMETERS.matcher(str);
+ if (matcher.matches()) {
+ map.put(matcher.group(1), matcher.group(2));
+ }
+ }
+ }
+ return map;
+ }
+
+ return null;
+ }
+
+ /**
+ * Return parameters splitted by ',' to be correctly parsed in JS
+ * @param context
+ * @param component
+ * @return
+ */
+ public String getParametersString(FacesContext context,
UIComponent component) {
+ String parameters = (String) component.getAttributes()
+ .get("parameters");
+ StringBuffer buffer = new StringBuffer();
+ if (parameters != null) {
+ String[] r = parameters.split(SPLIT_EXPRS);
+ for (String s : r) {
+ buffer.append(s);
+ buffer.append(",");
+ }
+ buffer.deleteCharAt(buffer.length() - 1);
+ return buffer.toString();
+ }
+ return "";
}
/**
@@ -270,9 +530,29 @@
if (completed != null) {
renderChild(context, completed);
}
+ if (isAjax) {
+ writer.startElement(HTML.SPAN_ELEM, component);
+ writer.startElement(HTML.SCRIPT_ELEM, component);
+ writer.write(getStopPollScript(clientId).toString());
+ writer.endElement(HTML.SCRIPT_ELEM);
+ writer.endElement(HTML.SPAN_ELEM);
+ }
writer.endElement(HTML.DIV_ELEM);
}
+
+
+ public void encodeChildren(FacesContext context, UIComponent component, String id)
+ throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+ writer.startElement("script", component);
+ writer.write("var evaluator = ");
+ writeScriptBody(context, component, true);
+ //markup.invoke('getContent', context).join('');
+ writer.write(";\n $('"+id+"').innerHTML = evaluator.invoke('getContent', {'minValue': '0'}).join('');");
+ writer.endElement("script");
+ }
+
/**
* Converts value attr to number value
@@ -303,6 +583,17 @@
return result;
}
+ /**
+ * Returns JS script to stop polling
+ * @param clientId
+ * @return
+ */
+ private StringBuffer getStopPollScript(String clientId) {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("A4J.AJAX.StopPoll('").append(clientId).append("');\n");
+ return buffer;
+ }
+
/*
* (non-Javadoc)
*
@@ -313,39 +604,17 @@
return UIProgressBar.class;
}
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.AjaxCommandRendererBase#isSubmitted(javax.faces.context.FacesContext,
- * javax.faces.component.UIComponent)
- */
- protected boolean isSubmitted(FacesContext facesContext,
- UIComponent uiComponent) {
- boolean submitted = super.isSubmitted(facesContext, uiComponent);
- UIProgressBar poll = (UIProgressBar) uiComponent;
- poll.setSubmitted(submitted);
- return submitted;
- }
- /*
- * (non-Javadoc)
+ /**
+ * Renders children components
*
- * @see javax.faces.render.Renderer#getRendersChildren()
+ * @param facesContext
+ * @param component
+ * @throws IOException
*/
- @Override
- public boolean getRendersChildren() {
- return true;
+ private void renderChildrenComponents(FacesContext facesContext,
+ UIComponent component) throws IOException {
+ super.renderChildren(facesContext, component);
}
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.AjaxCommandRendererBase#encodeChildren(javax.faces.context.FacesContext,
- * javax.faces.component.UIComponent)
- */
- @Override
- public void encodeChildren(FacesContext context, UIComponent component)
- throws IOException {
- return; // We don't need to render children !
- }
}
Modified: trunk/sandbox/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js
===================================================================
--- trunk/sandbox/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js 2008-01-23 17:07:24 UTC (rev 5571)
+++ trunk/sandbox/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js 2008-01-23 19:37:34 UTC (rev 5572)
@@ -1,52 +1,167 @@
ProgressBar = {};
-
ProgressBar = Class.create();
Object.extend(ProgressBar.prototype, {
initialize: function(id) {
this.id = id;
+ this.maxValue = $(id + ":max").value;
+ this.minValue = $(id + ":min").value;
this.mode = "initial";
},
- getProgress: function () {
- var d = $(this.id + ":remain");
+ getValue: function () {
+ var d = $(this.id + ":upload");
if (d != null) {
- var v = d.innerHTML;
- if (v != null) {
- return v.replace("%","");
+ var w = d.style.width;
+ if (w) {
+ return w.substring(0,w.length - 1);
}
}
- else return null;
+ return null;
},
- setProgress: function (val) {
+ onComplete: function (data, str, context) {
+ if (data) {
+ this.parseResponse(data);
+ context['value'] = this.value;
+ context['minValue'] = this.minValue;
+ context['maxValue'] = this.maxValue;
+
+ this.mode = "progress";
+ this.setValue(this.value);
+
+ this.context = context;
+ //this.setLabel(str);
+
+ //A4J.AJAX.Poll(containerId, formId, options);
+ /*if (this.value >= this.maxValue) {
+ this.disable();
+ }*/
+ }
+
+ },
+ interpolate: function (placeholders) {
+ for(var k in this.context) {
+ var v = this.context[k];
+ var regexp = new RegExp("\\{" + k + "\\}", "g");
+ placeholders = placeholders.replace(regexp, v);
+ }
+ return placeholders;
+ },
+ parseResponse: function (data) {
+ var params = data.split(",");
+ for (var i = 0; i < params.length; i++) {
+ var param = params[i];
+ if (param) {
+ var t = param.split(":");
+ if (t)
+ if (t.length == 2) {
+ var k = t[0];
+ var v = t[1];
+ this.updateComponent(k,v);
+ }
+ }
+ }
+ },
+ updateComponent: function (k,v) {
+ switch (k) {
+ case "percent" : this.value = v; break;
+ case "enabled" : if (v == "false") { this.disable(); }; break;
+ case "completeClass" : this.updateClassName($(this.id + ":complete"), v, "rich-progress-bar-base"); break;
+ case "remainClass" : this.updateClassName($(this.id + ":remain"), v, "rich-progress-bar-base"); break;
+ case "styleClass" : this.updateClassName($(this.id), v, "rich-progress-bar"); break;
+ case "initialClass" : break;
+ case "finishClass" : break;
+ }
+ },
+ updateClassName: function (o, newName, defaultClass) {
+ if (o.className) {
+ if (o.className.indexOf(newName) < 0){
+ o.className = newName + " "+ defaultClass;
+ }
+ }
+ },
+ setLabel: function (str) {
+ if (!this.context) { this.context = this.parseParams();}
+ str = this.interpolate(str);
+ var d = $(this.id + ":remain");
+ if (d != null) d.innerHTML = str;
+ d = $(this.id + ":complete");
+ if (d != null) d.innerHTML = str;
+ },
+ parseParams: function () {
+ var params = $(this.id + ":parameters").value;
+ if (params != "") {
+ var map = new Array();
+ var p = params.split(",");
+ for (var i = 0; i < p.length; i++) {
+ var k = p[i].match("\\s*([\\w\\d]+)\\s*[:=]+");
+ if (k) {
+ k = k[1];
+ }
+ var v = p[i].match(".*[:=]+\\s*['\"]*([\\w\\d]+)['\"]*\\s*");
+ if (v) {
+ v = v[1];
+ }
+ if (k && v) {
+ map[k] = v;
+ }
+ }
+ map['value'] = this.getValue();
+ map['minValue'] = this.minValue;
+ map['maxValue'] = this.maxValue;
+ return map;
+ }
+ return null;
+ },
+ isAjaxMode: function () {
+ return ($(this.id + ":progressState") == null);
+ },
+ setValue: function (val) {
var p = val;
if (val != null) {
if (val.indexOf("%") < 0)
val = val + "%";
}
- var max = $(this.id + ":max").value;
- if ( parseFloat(p) >= parseFloat(max)) { this.switchMode("completed"); return; }
+
+ if ( parseFloat(p) >= parseFloat(this.maxValue)) {
+ if (!this.isAjaxMode()) {
+ this.switchMode("completed"); return;
+ }
+ }
- if ($(this.id + ":progressState") != null)
- {
- if (this.mode == "progress")
- {
- var d = $(this.id + ":remain");
- if (d != null) d.innerHTML = val;
- d = $(this.id + ":complete");
- if (d != null) d.innerHTML = val;
- d = $(this.id + ":upload");
- if (d != null) d.style.width = val;
- }
- }
+ if (this.mode == "progress" || this.isAjaxMode()) {
+ d = $(this.id + ":upload");
+ if (d != null) d.style.width = val;
+ }
+
},
- enable: function () {
- this.switchMode("progress");
- this.setProgress("0");
+ enable: function (ev) {
+ if (!this.isAjaxMode()) {
+ this.switchMode("progress");
+ this.setValue("0");
+ }else if (!A4J.AJAX._pollers[this.id]) {
+ var funcName = $(this.id + ":func").value;
+ var f = new Function(funcName + "();");
+ f();
+ }
},
+ disable: function () {
+ A4J.AJAX.StopPoll(this.id);
+ },
finish: function () {
- A4J.AJAX.StopPoll(this.id);
this.switchMode("completed");
},
+ getForm: function () {
+ var p = $(this.id).parentNode;
+ while (p) {
+ if (p) {
+ if (p.tagName.toUpperCase() == "FORM") {
+ return p;
+ }
+ }
+ p = p.parentNode;
+ }
+ return null;
+ },
switchMode : function (mode) {
switch (mode) {
case "initial" :
Modified: trunk/sandbox/ui/progressBAR/src/main/templates/org/richfaces/progressBar.jspx
===================================================================
--- trunk/sandbox/ui/progressBAR/src/main/templates/org/richfaces/progressBar.jspx 2008-01-23 17:07:24 UTC (rev 5571)
+++ trunk/sandbox/ui/progressBAR/src/main/templates/org/richfaces/progressBar.jspx 2008-01-23 19:37:34 UTC (rev 5572)
@@ -10,7 +10,9 @@
<h:scripts>
new org.ajax4jsf.javascript.PrototypeScript(),
new org.ajax4jsf.javascript.AjaxScript(),
+ /org/richfaces/renderkit/html/scripts/utils.js,
/org/richfaces/renderkit/html/js/progressBar.js,
+
</h:scripts>
<f:clientId var="clientId" />
@@ -25,7 +27,9 @@
Number maxValue = getNumber(component.getAttributes().get("maxValue"));
boolean isAjax = ("ajax".equalsIgnoreCase(mode));
Number value = getNumber(component.getAttributes().get("value"));
+ String content = getLabel(context, component, writer);
variables.setVariable("percent",value);
+ variables.setVariable("content",content);
variables.setVariable("style",(String)component.getAttributes().get("style"));
variables.setVariable("styleClass",(String)component.getAttributes().get("styleClass"));
@@ -45,8 +49,12 @@
]]>
</jsp:scriptlet>
<div class="rich-progress-bar #{styleClass}" style="#{style}" id="#{clientId}">
- <f:call name="encodeProgressState"/>
- <f:call name="encodePollScript" />
+ <f:call name="encodeProgressState"/>
+ <input type="hidden" id="#{clientId}:min" disabled="true" value="#{component.attributes['minValue']}" />
+ <input type="hidden" id="#{clientId}:max" disabled="true" value="#{component.attributes['maxValue']}" />
+ <input type="hidden" id="#{clientId}:parameters" disabled="true" value="#{this:getParametersString(context, component)}" />
+ <input type="hidden" id="#{clientId}:func" disabled="true" value="#{this:getVarName(component)}" />
+ <f:call name="encodePollScript" />
</div>
<jsp:scriptlet>
<![CDATA[
@@ -64,11 +72,11 @@
<f:call name="encodeCompletedState">
<f:parameter value="false"/>
</f:call>
- <input type="hidden" id="#{clientId}:min" value="#{component.attributes['minValue']}" />
- <input type="hidden" id="#{clientId}:max" value="#{component.attributes['maxValue']}" />
+ <input type="hidden" id="#{clientId}:min" disabled="true" value="#{component.attributes['minValue']}" />
+ <input type="hidden" id="#{clientId}:max" disabled="true" value="#{component.attributes['maxValue']}" />
+ <input type="hidden" id="#{clientId}:parameters" disabled="true" value="#{this:getParametersString(context, component)}" />
<script>
- var pr = new ProgressBar('#{clientId}');
- pr.init();
+ new ProgressBar('#{clientId}').init();
</script>
</div>
<jsp:scriptlet>
16 years, 11 months
JBoss Rich Faces SVN: r5571 - in trunk/ui/menu-components/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: akushunin
Date: 2008-01-23 12:07:24 -0500 (Wed, 23 Jan 2008)
New Revision: 5571
Modified:
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
Log:
http://jira.jboss.com/jira/browse/RF-1993
Modified: trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java
===================================================================
--- trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java 2008-01-23 16:00:44 UTC (rev 5570)
+++ trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java 2008-01-23 17:07:24 UTC (rev 5571)
@@ -165,13 +165,6 @@
writer.endElement("div");
writer.endElement("div");
- writer.startElement("iframe", layer);
- writer.writeAttribute("src","javascript:''", null);
- writer.writeAttribute("id", clientId+"_menu_iframe", null);
- writer.writeAttribute("class", "underneath_iframe", null);
- writer.writeAttribute("style", "position:absolute; z-index: 1;", null);
- writer.endElement("iframe");
-
writer.startElement("script", layer);
writer.writeAttribute("id", clientId+"_menu_script", null);
writer.writeAttribute("type", "text/javascript", null);
Modified: trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
--- trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2008-01-23 16:00:44 UTC (rev 5570)
+++ trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2008-01-23 17:07:24 UTC (rev 5571)
@@ -67,6 +67,7 @@
showTimeoutLength: 0,
queuedId : '',
+
LMPopUp:function(menuName, isCurrent) {
if (!this.loaded || ( this.isVisible(menuName) && !isCurrent)) {
return;
@@ -139,13 +140,23 @@
}
}
},
+
+ initIFrame: function(layer) {
+ var menu = $(layer);
+ new Insertion.Before(menu,
+ "<iframe src=\"javascript:''\" id=\"" + menu.id + "_iframe\" style=\" position: absolute; z-index: 1;\" class=\"underneath_iframe\">" + "</iframe>");
+ },
ieSelectWorkAround: function(menuName, on){
//alert(navigator.userAgent);
if(this.IE || this.NS) {
menuName = $(menuName).id;
var menu = $(menuName);
- var iframe = $(menuName + "_iframe");
+ var iframe = $(menuName + "_iframe");
+ if(!iframe&&on){
+ this.initIFrame(menu);
+ iframe = $(menuName + "_iframe");
+ }
var nsfix = (this.NS ? 7 : 0);
if(on){
var dim = Element.getDimensions(menu);
@@ -154,10 +165,11 @@
iframe.style.width = menu.offsetWidth + "px"
iframe.style.height = menu.offsetHeight + "px"
iframe.style.visibility = "visible";
- } else {
+ } else if(iframe) {
iframe.style.visibility = "hidden";
- }
+ }
}
+
},
shutdown: function () {
@@ -238,6 +250,7 @@
clearPopUpTO: function(){
clearTimeout(this.showTimeOutFlag);
+ this.iframe=null;
},
showMenuLayer: function (layerId, e, delay){
this.clearPopUpTO();
@@ -397,7 +410,7 @@
this.layer.style.left = layerLeft + "px";
this.layer.style.top = layerTop + "px";
-
+
RichFaces.Menu.Layers.LMPopUp(this.layer.id, false);
RichFaces.Menu.Layers.clearLMTO();
}.bind(this);
@@ -550,7 +563,7 @@
this.layer.style.top = layerPos.top + vOffset - deltaY - this.top + "px";
this.layer.style.width = this.layer.clientWidth + "px";
-
+
RichFaces.Menu.Layers.LMPopUp(this.layer.id, false);
RichFaces.Menu.Layers.clearLMTO();
}.bind(this);
16 years, 11 months
JBoss Rich Faces SVN: r5570 - trunk/docs/userguide/en/src/main/resources/images.
by richfaces-svn-commits@lists.jboss.org
Author: cluts
Date: 2008-01-23 11:00:44 -0500 (Wed, 23 Jan 2008)
New Revision: 5570
Added:
trunk/docs/userguide/en/src/main/resources/images/inputNumberSlider_CS2.png
Log:
http://jira.jboss.com/jira/browse/RF-1052 - added screens
Added: trunk/docs/userguide/en/src/main/resources/images/inputNumberSlider_CS2.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/inputNumberSlider_CS2.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 11 months
JBoss Rich Faces SVN: r5569 - trunk/docs/userguide/en/src/main/resources/images.
by richfaces-svn-commits@lists.jboss.org
Author: cluts
Date: 2008-01-23 11:00:32 -0500 (Wed, 23 Jan 2008)
New Revision: 5569
Added:
trunk/docs/userguide/en/src/main/resources/images/inputNumberSlider_CS1.png
Log:
http://jira.jboss.com/jira/browse/RF-1052 - added screens
Added: trunk/docs/userguide/en/src/main/resources/images/inputNumberSlider_CS1.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/inputNumberSlider_CS1.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 11 months
JBoss Rich Faces SVN: r5568 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: cluts
Date: 2008-01-23 10:59:57 -0500 (Wed, 23 Jan 2008)
New Revision: 5568
Modified:
trunk/docs/userguide/en/src/main/docbook/included/inputNumberSlider.xml
Log:
http://jira.jboss.com/jira/browse/RF-1052 - done for inputNumberSlider (added screens)
Modified: trunk/docs/userguide/en/src/main/docbook/included/inputNumberSlider.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/inputNumberSlider.xml 2008-01-23 15:55:17 UTC (rev 5567)
+++ trunk/docs/userguide/en/src/main/docbook/included/inputNumberSlider.xml 2008-01-23 15:59:57 UTC (rev 5568)
@@ -308,7 +308,7 @@
</mediaobject>
</figure>
- <table>
+ <table id="tab_cn">
<title>Classes names that define a component appearance</title>
<tgroup cols="2">
<thead>
@@ -356,38 +356,66 @@
<para>In order to redefine styles for all <emphasis role="bold">
<property><rich:inputNumberSlider></property>
</emphasis> components on a page using CSS, it's enough to create classes with the
- same names and define necessary properties in them.</para>
+ same names (possible classes could be found in the table <ulink linkend="tab_cn">above</ulink>) and define necessary properties in them. An example is placed below:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="CSS"><![CDATA[...
+.rich-inslider-tip{
+ background-color: #FFDAB9;
+ font-family: Arial Black;
+}
+...]]></programlisting>
- <para>To change styles of particular <emphasis role="bold">
- <property><rich:inputNumberSlider></property>
- </emphasis> components, define your own style classes in the corresponding <emphasis
- role="bold">
- <property><rich:inputNumberSlider></property>
- </emphasis>attributes.</para>
+ <para>This is a result:</para>
- <para>CSS code piece used on a page:</para>
-
+ <figure>
+ <title>Redefinition styles with predefined classes</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/inputNumberSlider_CS2.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>In the example a tip background color and font family was changed.</para>
+
+ <para>Also it’s possible to change styles of particular <emphasis role="bold"
+ ><property><rich:inputNumberSlider></property></emphasis> component. In this case you should create own style classes and use them in corresponding <emphasis role="bold"
+ ><property><rich:inputNumberSlider></property></emphasis> <emphasis><property>styleClass</property></emphasis> attributes. An example is placed below:</para>
+
<para>
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="CSS"><![CDATA[...
- .rich-slider-handle{
- border:2px solid;
- }
- .myClass{
- font-style:italic;
- }
-...
-]]></programlisting>
- <para>The component is defined in the following way:</para>
-
+.myClass{
+ font-style: italic;
+}
+...]]></programlisting>
+ <para>The <emphasis>"inputClass"</emphasis> attribute for <emphasis role="bold"
+ ><property><rich:inputNumberSlider> </property></emphasis> is defined as it’s shown in the example below:</para>
+
<para>
<emphasis role="bold">Example:</emphasis>
</para>
- <programlisting role="XML"><![CDATA[<rich:inputNumberSlider ... inputClass="myClass" .../>
-]]></programlisting>
- <para>Hence, header border width of all <property>sliders</property> is redefined on a page as
- well as a style font for an input field of a particular <property>slider</property>.</para>
+ <programlisting role="CSS"><![CDATA[<rich: inputNumberSlider ... inputClass="myClass"/>
+]]></programlisting>
+
+ <para>This is a result:</para>
+
+ <figure>
+ <title>Redefinition styles with own classes and styleClass attributes</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/inputNumberSlider_CS1.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>As it could be seen on the picture above, the font style for input text was changed.</para>
+
+
</section>
<section>
<title>Relevant Resources Links</title>
16 years, 11 months
JBoss Rich Faces SVN: r5567 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-01-23 10:55:17 -0500 (Wed, 23 Jan 2008)
New Revision: 5567
Modified:
trunk/docs/userguide/en/src/main/docbook/included/calendar.xml
Log:
http://jira.jboss.com/jira/browse/RF-920 - add Classes names, Skin Parameters Redefinition
Modified: trunk/docs/userguide/en/src/main/docbook/included/calendar.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/calendar.xml 2008-01-23 15:54:48 UTC (rev 5566)
+++ trunk/docs/userguide/en/src/main/docbook/included/calendar.xml 2008-01-23 15:55:17 UTC (rev 5567)
@@ -916,7 +916,222 @@
</tbody>
</tgroup>
</table>
+
+ <!-- Quick year & month selection-->
+ <table>
+ <title>Skin parameters redefinition for a popup element during quick month and year selection</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+
+ <tbody>
+
+ <row>
+ <entry>tableBackgroundColor</entry>
+ <entry>background</entry>
+ </row>
+
+ <row>
+ <entry>panelBorderColor</entry>
+ <entry>border-color</entry>
+ </row>
+
+ </tbody>
+ </tgroup>
+ </table>
+ <table>
+ <title>Skin parameters redefinition for a shadow</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+
+ <tbody>
+
+ <row>
+ <entry>shadowBackgroundColor</entry>
+ <entry>background-color</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <table>
+ <title>Skin parameters redefinition for a selected month and year</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+
+ <tbody>
+
+ <row>
+ <entry>calendarCurrentBackgroundColor</entry>
+ <entry>background-color</entry>
+ </row>
+
+ <row>
+ <entry>calendarCurrentTextColor</entry>
+ <entry>color</entry>
+ </row>
+
+ </tbody>
+ </tgroup>
+ </table>
+
+ <table>
+ <title>Skin parameters redefinition for a hovered month and year</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+
+ <tbody>
+
+ <row>
+ <entry>panelBorderColor</entry>
+ <entry>border-color</entry>
+ </row>
+
+ <row>
+ <entry>calendarSpecBackgroundColor</entry>
+ <entry>background</entry>
+ </row>
+
+ </tbody>
+ </tgroup>
+ </table>
+
+ <table>
+ <title>Skin parameters redefinition for a month items near split line</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>panelBorderColor</entry>
+ <entry>border-right-color</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <table>
+ <title>Skin parameters redefinition for a hovered toolbar items</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+
+ <tbody>
+
+ <row>
+ <entry>calendarWeekBackgroundColor</entry>
+ <entry>background-color</entry>
+ </row>
+
+ <row>
+ <entry>generalTextColor</entry>
+ <entry>color</entry>
+ </row>
+
+ <row>
+ <entry>tableBackgroundColor</entry>
+ <entry>border-color</entry>
+ </row>
+
+ <row>
+ <entry>panelBorderColor</entry>
+ <entry>border-right-color</entry>
+ </row>
+
+ <row>
+ <entry>panelBorderColor</entry>
+ <entry>border-bottom-color</entry>
+ </row>
+
+ </tbody>
+ </tgroup>
+ </table>
+
+ <table>
+ <title>Skin parameters redefinition for a pressed toolbar items</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+
+ <tbody>
+
+ <row>
+ <entry>panelBorderColor</entry>
+ <entry>border-color</entry>
+ </row>
+
+ <row>
+ <entry>tableBackgroundColor</entry>
+ <entry>border-right-color</entry>
+ </row>
+
+ <row>
+ <entry>tableBackgroundColor</entry>
+ <entry>border-bottom-color</entry>
+ </row>
+
+ </tbody>
+ </tgroup>
+ </table>
+
+ <table>
+ <title>Skin parameters redefinition for "ok" and "cancel" buttons</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+
+ <tbody>
+
+ <row>
+ <entry>additionalBackgroundColor</entry>
+ <entry>background</entry>
+ </row>
+
+ <row>
+ <entry>panelBorderColor</entry>
+ <entry>border-top-color</entry>
+ </row>
+
+ </tbody>
+ </tgroup>
+ </table>
+
</section>
<section>
@@ -932,7 +1147,11 @@
<imagedata fileref="images/calendar1a.png" scalefit="1"/>
</imageobject>
</mediaobject>
-
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/calendar6.png" scalefit="1"/>
+ </imageobject>
+ </mediaobject>
</figure>
@@ -1138,6 +1357,10 @@
<entry>Defines styles for an inactive boundary date</entry>
</row>
<row>
+ <entry>rich-calendar-date-layout-split</entry>
+ <entry>Defines styles for a wrapper <td> element for month items near split line</entry>
+ </row>
+ <row>
<entry>rich-calendar-editor-btn-selected</entry>
<entry>Defines styles for an selected boundary date</entry>
</row>
@@ -1145,24 +1368,32 @@
<entry>rich-calendar-editor-btn-over</entry>
<entry>Defines styles for a boundary date when pointer was moved onto</entry>
</row>
+
<row>
+ <entry>rich-calendar-editor-tool-over</entry>
+ <entry>Defines styles for a hovered toolbar items</entry>
+ </row>
+
+ <row>
+ <entry>rich-calendar-editor-tool-press</entry>
+ <entry>Defines styles for a pressed toolbar items</entry>
+ </row>
+
+ <row>
<entry>rich-calendar-date-layout-ok</entry>
- <entry>Defines styles for a submit button</entry>
+ <entry>Defines styles for a "ok" button</entry>
</row>
<row>
<entry>rich-calendar-date-layout-cancel</entry>
- <entry>Defines styles for a cancel button</entry>
+ <entry>Defines styles for a "cancel" button</entry>
</row>
- <!--row>
- <entry>rich-calendar-date-layout-split</entry>
- <entry></entry>
- </row-->
+
</tbody>
</tgroup>
</table>
<table>
- <title>Classes names that define a popup element during timing selection</title>
+ <title>Classes names that define a popup element during time selection</title>
<tgroup cols="2">
<thead>
@@ -1175,7 +1406,7 @@
<tbody>
<row>
<entry>rich-calendar-time-layout</entry>
- <entry>Defines styles for a popup element during timing selection</entry>
+ <entry>Defines styles for a popup element during time selection</entry>
</row>
<row>
<entry>rich-calendar-editor-layout-shadow</entry>
@@ -1199,19 +1430,19 @@
</row>
<row>
<entry>rich-calendar-spinner-up</entry>
- <entry>Defines styles for a Up button</entry>
+ <entry>Defines styles for a "up" button</entry>
</row>
<row>
<entry>rich-calendar-spinner-down</entry>
- <entry>Defines styles for a Down button</entry>
+ <entry>Defines styles for a "down" button</entry>
</row>
<row>
<entry>rich-calendar-time-layout-ok</entry>
- <entry>Defines styles for a submit button</entry>
+ <entry>Defines styles for a "ok" button</entry>
</row>
<row>
<entry>rich-calendar-time-layout-cancel</entry>
- <entry>Defines styles for a cancel button</entry>
+ <entry>Defines styles for a "cancel" button</entry>
</row>
</tbody>
</tgroup>
16 years, 11 months