JBoss Rich Faces SVN: r19123 - in branches/RF-7560: core/api/src/main/java/org/richfaces and 28 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-09-06 11:48:48 -0400 (Mon, 06 Sep 2010)
New Revision: 19123
Added:
branches/RF-7560/core/api/src/main/java/org/richfaces/renderkit/AjaxDataSerializer.java
branches/RF-7560/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java
branches/RF-7560/core/api/src/main/java/org/richfaces/renderkit/util/HtmlDimensions.java
branches/RF-7560/core/api/src/main/java/org/richfaces/renderkit/util/IdSplitBuilder.java
branches/RF-7560/core/api/src/main/java/org/richfaces/util/
branches/RF-7560/core/api/src/main/java/org/richfaces/util/LRUMap.java
branches/RF-7560/core/api/src/test/java/org/richfaces/util/
branches/RF-7560/core/api/src/test/java/org/richfaces/util/LRUMapTest.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/AjaxDataSerializerImpl.java
branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/context/
branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/context/OnOffResponseWriter.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java
Removed:
branches/RF-7560/core/impl/src/main/java/org/ajax4jsf/renderkit/AJAXDataSerializer.java
branches/RF-7560/core/impl/src/main/java/org/ajax4jsf/util/LRUMap.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/context/OnOffResponseWriter.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/util/HtmlDimensions.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/util/IdSplitBuilder.java
branches/RF-7560/core/impl/src/test/java/org/ajax4jsf/util/LRUMapTest.java
Modified:
branches/RF-7560/core/api/pom.xml
branches/RF-7560/core/impl/src/main/java/org/ajax4jsf/util/GenericsIntrospectionCache.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/application/DefaultModule.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/cache/lru/CacheMap.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonGradient.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerFieldGradient.java
branches/RF-7560/examples/iteration-demo/pom.xml
branches/RF-7560/examples/misc-demo/pom.xml
branches/RF-7560/examples/parent/pom.xml
branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java
branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/renderkit/util/FormUtil.java
branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/renderkit/util/RendererUtils.java
branches/RF-7560/ui/core/ui/src/main/java/org/ajax4jsf/component/behavior/AjaxBehavior.java
branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/component/PushListenersManager.java
branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueRenderer.java
branches/RF-7560/ui/misc/ui/src/main/java/org/richfaces/function/RichFunction.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java
branches/RF-7560/ui/parent/pom.xml
Log:
RF-7560
Modified: branches/RF-7560/core/api/pom.xml
===================================================================
--- branches/RF-7560/core/api/pom.xml 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/core/api/pom.xml 2010-09-06 15:48:48 UTC (rev 19123)
@@ -36,6 +36,11 @@
</description>
<dependencies>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+
<!-- Provided dependencies -->
<dependency>
<groupId>javax.el</groupId>
Added: branches/RF-7560/core/api/src/main/java/org/richfaces/renderkit/AjaxDataSerializer.java
===================================================================
--- branches/RF-7560/core/api/src/main/java/org/richfaces/renderkit/AjaxDataSerializer.java (rev 0)
+++ branches/RF-7560/core/api/src/main/java/org/richfaces/renderkit/AjaxDataSerializer.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.renderkit;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface AjaxDataSerializer {
+
+ public String asString(Object o);
+
+}
Copied: branches/RF-7560/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java (from rev 19120, branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java)
===================================================================
--- branches/RF-7560/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java (rev 0)
+++ branches/RF-7560/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -0,0 +1,337 @@
+/**
+ * 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.util;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Pattern;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.PartialResponseWriter;
+
+import org.ajax4jsf.component.AjaxComponent;
+import org.ajax4jsf.context.AjaxContext;
+import org.richfaces.application.ServiceTracker;
+import org.richfaces.renderkit.AjaxDataSerializer;
+import org.richfaces.renderkit.HtmlConstants;
+
+import com.google.common.base.Strings;
+
+
+/**
+ * @author shura
+ * <p/>
+ * Some utilites for render AJAX components.
+ */
+public final class CoreAjaxRendererUtils {
+
+ /**
+ * Attribute for keep JavaScript function name for call before updating
+ * DOM tree.
+ */
+ public static final String ONBEFOREDOMUPDATE_ATTR_NAME = "onbeforedomupdate";
+
+ /**
+ * Attribute for keep JavaScript function name for call after complete
+ * request.
+ */
+ public static final String ONCOMPLETE_ATTR_NAME = "oncomplete";
+
+ public static final String DATA_ATTR_NAME = "data";
+
+ /**
+ * Attribute to keep
+ */
+ public static final String LIMITRENDER_ATTR_NAME = "limitRender";
+
+ /**
+ * @since 3.3.0
+ */
+ public static final String AJAX_PROCESS_ATTRIBUTE = "process";
+ public static final String AJAX_REGIONS_ATTRIBUTE = "reRender";
+
+ private static final String EXTENSION_ID = "org.richfaces.extension";
+
+ private static final String BEFOREDOMUPDATE_ELEMENT_NAME = "beforedomupdate";
+ private static final String COMPLETE_ELEMENT_NAME = "complete";
+ private static final String DATA_ELEMENT_NAME = "data";
+ private static final String COMPONENT_DATA_ELEMENT_NAME = "componentData";
+ private static final Pattern ID_SPLIT_PATTERN = Pattern.compile("\\s*(\\s|,)\\s*");
+
+ private CoreAjaxRendererUtils() {
+ }
+
+ private static void startExtensionElementIfNecessary(
+ PartialResponseWriter partialResponseWriter,
+ Map<String, String> attributes,
+ boolean[] writingState) throws IOException {
+
+ if (!writingState[0]) {
+ writingState[0] = true;
+
+ partialResponseWriter.startExtension(attributes);
+ }
+ }
+
+ private static void endExtensionElementIfNecessary(
+ PartialResponseWriter partialResponseWriter,
+ boolean[] writingState) throws IOException {
+
+ if (writingState[0]) {
+ writingState[0] = false;
+
+ partialResponseWriter.endExtension();
+ }
+ }
+
+ public static void renderAjaxExtensions(FacesContext facesContext, UIComponent component) throws IOException {
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(facesContext);
+
+ Map<String, String> attributes = Collections.singletonMap(HtmlConstants.ID_ATTRIBUTE,
+ facesContext.getExternalContext().encodeNamespace(EXTENSION_ID));
+ PartialResponseWriter writer = facesContext.getPartialViewContext().getPartialResponseWriter();
+ boolean[] writingState = new boolean[]{false};
+
+ Object onbeforedomupdate = ajaxContext.getOnbeforedomupdate();
+ if (onbeforedomupdate != null) {
+ String string = onbeforedomupdate.toString();
+ if (string.length() != 0) {
+ startExtensionElementIfNecessary(writer, attributes, writingState);
+ writer.startElement(BEFOREDOMUPDATE_ELEMENT_NAME, component);
+ writer.writeText(onbeforedomupdate, null);
+ writer.endElement(BEFOREDOMUPDATE_ELEMENT_NAME);
+ }
+ }
+
+ Object oncomplete = ajaxContext.getOncomplete();
+ if (oncomplete != null) {
+ String string = oncomplete.toString();
+ if (string.length() != 0) {
+ startExtensionElementIfNecessary(writer, attributes, writingState);
+ writer.startElement(COMPLETE_ELEMENT_NAME, component);
+ writer.writeText(oncomplete, null);
+ writer.endElement(COMPLETE_ELEMENT_NAME);
+ }
+ }
+
+ Object responseData = ajaxContext.getResponseData();
+ if (responseData != null) {
+ startExtensionElementIfNecessary(writer, attributes, writingState);
+ writer.startElement(DATA_ELEMENT_NAME, component);
+
+ AjaxDataSerializer serializer = ServiceTracker.getService(facesContext, AjaxDataSerializer.class);
+ writer.writeText(serializer.asString(responseData), null);
+
+ writer.endElement(DATA_ELEMENT_NAME);
+ }
+
+ Map<String, Object> responseComponentDataMap = ajaxContext.getResponseComponentDataMap();
+ if (responseComponentDataMap != null && !responseComponentDataMap.isEmpty()) {
+ startExtensionElementIfNecessary(writer, attributes, writingState);
+ writer.startElement(COMPONENT_DATA_ELEMENT_NAME, component);
+
+ AjaxDataSerializer serializer = ServiceTracker.getService(facesContext, AjaxDataSerializer.class);
+ writer.writeText(serializer.asString(responseComponentDataMap), null);
+
+ writer.endElement(COMPONENT_DATA_ELEMENT_NAME);
+ }
+
+ endExtensionElementIfNecessary(writer, writingState);
+
+ }
+
+ /**
+ * Split parameter string into array of strings.
+ * @param valuesSet
+ * @return
+ */
+ public static String[] asIdsArray(String valuesSet) {
+ return IdSplitBuilder.split(valuesSet);
+ }
+
+ /**
+ * Get list of clientId's for given component
+ *
+ * @param uiComponent
+ * @return List of areas Id's , updated by this component.
+ */
+ public static Set<String> getAjaxAreas(UIComponent uiComponent) {
+ Object areas;
+
+ if (uiComponent instanceof AjaxComponent) {
+ areas = ((AjaxComponent) uiComponent).getReRender();
+ } else {
+ areas = uiComponent.getAttributes().get(AJAX_REGIONS_ATTRIBUTE);
+ }
+
+ return asIdsSet(areas);
+ }
+
+ /**
+ * Returns set of areas to be processed as a result of this component action invocation
+ *
+ * @param component
+ * @return set of IDs that should be processed as a
+ * @since 3.3.0
+ */
+ public static Set<String> getAjaxAreasToProcess(UIComponent component) {
+ Object areas;
+
+ if (component instanceof AjaxComponent) {
+ areas = ((AjaxComponent) component).getProcess();
+ } else {
+ areas = component.getAttributes().get(AJAX_PROCESS_ATTRIBUTE);
+ }
+
+ return asIdsSet(areas);
+ }
+
+ public static Set<String> asIdsSet(Object valueToSet) {
+ return asSet(valueToSet, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ private static Set<String> asSet(Object valueToSet, boolean idsSet) {
+ if (null != valueToSet) {
+
+ // Simplest case - set.
+ if (valueToSet instanceof Set) {
+ return new LinkedHashSet<String>((Set<String>) valueToSet);
+ } else if (valueToSet instanceof Collection) { // Other collections.
+ return new LinkedHashSet<String>((Collection<String>) valueToSet);
+ } else if (Object[].class.isAssignableFrom(valueToSet.getClass())) { // Array
+ return new LinkedHashSet<String>(Arrays.asList((String[]) valueToSet));
+ } else if (valueToSet instanceof String) { // Tokenize string.
+ String areasString = ((String) valueToSet).trim();
+
+ if (areasString.contains(",") || areasString.contains(" ")) {
+ String[] values;
+ if (idsSet) {
+ values = IdSplitBuilder.split(areasString);
+ } else {
+ values = ID_SPLIT_PATTERN.split(areasString);
+ }
+
+ Set<String> result = new LinkedHashSet<String>(values.length);
+ for (String value : values) {
+ if (Strings.isNullOrEmpty(value)) {
+ continue;
+ }
+
+ result.add(value);
+ }
+
+ return result;
+ } else {
+ Set<String> areasSet = new LinkedHashSet<String>(5);
+
+ if (!Strings.isNullOrEmpty(areasString)) {
+ areasSet.add(areasString);
+ }
+
+ return areasSet;
+ }
+ }
+ }
+
+ return null;
+ }
+
+
+ /**
+ * Calculate, must be component render only given areas, or all sended from
+ * server.
+ *
+ * @param component
+ * @return <code>true</code> if client must render ONLY given areas.
+ */
+ public static boolean isAjaxLimitRender(UIComponent component) {
+ boolean result = false;
+
+ if (component instanceof AjaxComponent) {
+ result = ((AjaxComponent) component).isLimitRender();
+ } else {
+ try {
+ result = ((Boolean) component.getAttributes().get(LIMITRENDER_ATTR_NAME)).booleanValue();
+ } catch (NullPointerException e) {
+
+ // NullPointer - ignore ...
+ } catch (ClassCastException e1) {
+
+ // not Boolean - false ...
+ }
+ }
+
+ return result;
+ }
+
+
+ /**
+ * Get function name for call on completed ajax request.
+ *
+ * @param component for wich calculate function name
+ * @return name of JavaScript function or <code>null</code>
+ */
+ //TODO nick - refactor - remove this method?
+ public static String getAjaxOncomplete(UIComponent component) {
+ if (component instanceof AjaxComponent) {
+ return ((AjaxComponent) component).getOncomplete();
+ }
+
+ return (String) component.getAttributes().get(ONCOMPLETE_ATTR_NAME);
+ }
+
+ /**
+ * Get function name for call before update DOM.
+ *
+ * @param component for wich calculate function name
+ * @return name of JavaScript function or <code>null</code>
+ */
+ //TODO nick - refactor - remove this method?
+ public static String getAjaxOnBeforeDomUpdate(UIComponent component) {
+ if (component instanceof AjaxComponent) {
+ return ((AjaxComponent) component).getOnbeforedomupdate();
+ }
+
+ return (String) component.getAttributes().get(ONBEFOREDOMUPDATE_ATTR_NAME);
+ }
+
+ /**
+ * @param component
+ * @return
+ * @since 4.0
+ */
+ public static Object getAjaxData(UIComponent component) {
+ if (component instanceof AjaxComponent) {
+ return ((AjaxComponent) component).getData();
+ }
+
+ return component.getAttributes().get(DATA_ATTR_NAME);
+ }
+
+}
Copied: branches/RF-7560/core/api/src/main/java/org/richfaces/renderkit/util/HtmlDimensions.java (from rev 19119, branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/util/HtmlDimensions.java)
===================================================================
--- branches/RF-7560/core/api/src/main/java/org/richfaces/renderkit/util/HtmlDimensions.java (rev 0)
+++ branches/RF-7560/core/api/src/main/java/org/richfaces/renderkit/util/HtmlDimensions.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -0,0 +1,90 @@
+/**
+ * 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.util;
+
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+import java.text.ParseException;
+import java.util.regex.Pattern;
+
+import org.ajax4jsf.Messages;
+
+public final class HtmlDimensions {
+ private static final Pattern PATTERN_NUMERIC = Pattern.compile("^[+-]?\\d+(\\.\\d+)?$");
+ private static final Pattern PATTERN_PX = Pattern.compile("^[+-]?\\d+(\\.\\d+)?px$");
+ private static final Pattern PATTERN_PCT = Pattern.compile("^[+-]?\\d+(\\.\\d+)?%$");
+ private static final NumberFormat NUMERIC_FORMAT = new DecimalFormat();
+ private static final DecimalFormat PX_FORMAT = new DecimalFormat();
+ private static final NumberFormat PCT_FORMAT = NumberFormat.getPercentInstance();
+
+ static {
+ PX_FORMAT.setPositiveSuffix("px");
+ PX_FORMAT.setNegativeSuffix("px");
+ }
+
+ private HtmlDimensions() {
+ }
+
+ public static Double decode(String size) {
+
+ // TODO - handle px,ex,pt enc suffixes.
+ double d = 0;
+
+ try {
+ if (size != null) {
+ if (PATTERN_NUMERIC.matcher(size).matches()) {
+ synchronized (NUMERIC_FORMAT) {
+ d = NUMERIC_FORMAT.parse(size).doubleValue();
+ }
+ } else if (PATTERN_PX.matcher(size).matches()) {
+ synchronized (PX_FORMAT) {
+ d = PX_FORMAT.parse(size).doubleValue();
+ }
+ } else if (PATTERN_PCT.matcher(size).matches()) {
+ synchronized (PCT_FORMAT) {
+ d = PCT_FORMAT.parse(size).doubleValue();
+ }
+ }
+ }
+ } catch (ParseException e) {
+ throw new IllegalArgumentException(Messages.getMessage(Messages.DECODE_PARAMETER_ERROR,
+ new Object[]{"size",
+ size, e.getMessage()}));
+ }
+
+ return new Double(d);
+ }
+
+ public static String formatPx(Double value) {
+ return value.intValue() + "px";
+ }
+
+ public static String formatPct(Double value) {
+ String v = "";
+
+ synchronized (PCT_FORMAT) {
+ v = PCT_FORMAT.format(value.doubleValue());
+ }
+
+ return v;
+ }
+}
Copied: branches/RF-7560/core/api/src/main/java/org/richfaces/renderkit/util/IdSplitBuilder.java (from rev 19119, branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/util/IdSplitBuilder.java)
===================================================================
--- branches/RF-7560/core/api/src/main/java/org/richfaces/renderkit/util/IdSplitBuilder.java (rev 0)
+++ branches/RF-7560/core/api/src/main/java/org/richfaces/renderkit/util/IdSplitBuilder.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -0,0 +1,150 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.renderkit.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Nick Belaevski
+ */
+final class IdSplitBuilder {
+
+ private static final int INITIAL_SPLIT_LIST_SIZE = 3;
+
+ private enum State {
+ IN_ID (true) {
+
+ @Override
+ public State getNextState(char c) {
+ if (c == '[') {
+ return State.IN_ID_INSIDE_BRACKETS;
+ } else if (isSeparator(c)) {
+ return State.OUTSIDE_ID;
+ } else {
+ return this;
+ }
+ }
+ },
+ IN_ID_INSIDE_BRACKETS (true) {
+
+ @Override
+ public State getNextState(char c) {
+ if (c == ']') {
+ return State.IN_ID;
+ } else {
+ return this;
+ }
+ }
+ },
+ OUTSIDE_ID (false) {
+
+ @Override
+ public State getNextState(char c) {
+ if (!isSeparator(c)) {
+ if (c == '[') {
+ return State.IN_ID_INSIDE_BRACKETS;
+ } else {
+ return State.IN_ID;
+ }
+ }
+
+ return this;
+ }
+ };
+
+ private final boolean idSegment;
+
+ private State(boolean idSegment) {
+ this.idSegment = idSegment;
+ }
+
+ private static boolean isSeparator(char c) {
+ return c == ',' || Character.isWhitespace(c);
+ }
+
+ public abstract State getNextState(char c);
+
+ public boolean isIdSegment() {
+ return idSegment;
+ }
+
+ public void processChar(IdSplitBuilder builder, char c, int charIdx) {
+ State nextState = getNextState(c);
+
+ if (nextState.isIdSegment() ^ isIdSegment()) {
+ if (nextState.isIdSegment()) {
+ builder.setStartIndex(charIdx);
+ } else {
+ builder.flushBuilder(charIdx);
+ builder.setStartIndex(-1);
+ }
+ }
+
+ builder.state = nextState;
+ }
+ }
+
+ private int startIdx = -1;
+
+ private String sourceString;
+
+ private List<String> result = new ArrayList<String>(INITIAL_SPLIT_LIST_SIZE);
+
+ private State state = State.OUTSIDE_ID;
+
+ private IdSplitBuilder(String sourceString) {
+ super();
+ this.sourceString = sourceString;
+ }
+
+ private void setStartIndex(int idx) {
+ startIdx = idx;
+ }
+
+ private void flushBuilder(int endIdx) {
+ if (startIdx >= 0 && endIdx > startIdx) {
+ String id = sourceString.substring(startIdx, endIdx);
+ result.add(id);
+ }
+ }
+
+ private void build() {
+ int length = sourceString.length();
+ for (int i = 0; i < length; i++) {
+ char c = sourceString.charAt(i);
+ state.processChar(this, c, i);
+ }
+ flushBuilder(length);
+ }
+
+ private String[] getSplit() {
+ return result.toArray(new String[result.size()]);
+ }
+
+ public static String[] split(String s) {
+ IdSplitBuilder splitBuilder = new IdSplitBuilder(s);
+ splitBuilder.build();
+ return splitBuilder.getSplit();
+ }
+
+}
\ No newline at end of file
Copied: branches/RF-7560/core/api/src/main/java/org/richfaces/util/LRUMap.java (from rev 19119, branches/RF-7560/core/impl/src/main/java/org/ajax4jsf/util/LRUMap.java)
===================================================================
--- branches/RF-7560/core/api/src/main/java/org/richfaces/util/LRUMap.java (rev 0)
+++ branches/RF-7560/core/api/src/main/java/org/richfaces/util/LRUMap.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -0,0 +1,62 @@
+/**
+ * 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.util;
+
+import java.io.Serializable;
+import java.util.LinkedHashMap;
+import java.util.Map.Entry;
+
+/**
+ * Last Recent Used Map cache. See {@link LinkedHashMap} for details.
+ *
+ * @author asmirnov
+ */
+public class LRUMap<K, V> extends LinkedHashMap<K, V> implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -7232885382582796665L;
+ private int capacity;
+
+ /**
+ * Default capacity constructor
+ */
+ public LRUMap() {
+ this(1000);
+ }
+
+ /**
+ * @param capacity - maximal cache capacity.
+ */
+ public LRUMap(int capacity) {
+ super(capacity, 1.0f, true);
+ this.capacity = capacity;
+ }
+
+ protected boolean removeEldestEntry(Entry<K, V> entry) {
+
+ // Remove last entry if size exceeded.
+ return size() > capacity;
+ }
+
+}
Copied: branches/RF-7560/core/api/src/test/java/org/richfaces/util/LRUMapTest.java (from rev 19119, branches/RF-7560/core/impl/src/test/java/org/ajax4jsf/util/LRUMapTest.java)
===================================================================
--- branches/RF-7560/core/api/src/test/java/org/richfaces/util/LRUMapTest.java (rev 0)
+++ branches/RF-7560/core/api/src/test/java/org/richfaces/util/LRUMapTest.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -0,0 +1,116 @@
+/**
+ * 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.util;
+
+import java.util.Iterator;
+import java.util.Map.Entry;
+
+import org.richfaces.util.LRUMap;
+
+import junit.framework.TestCase;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class LRUMapTest extends TestCase {
+
+ /**
+ * @param name
+ */
+ public LRUMapTest(String name) {
+ super(name);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Test method for {@link org.richfaces.util.LRUMap#LRUMap(int)}.
+ */
+ public void testLRUMap() {
+ LRUMap map = new LRUMap(5);
+
+ for (int i = 0; i < 10; i++) {
+ map.put(new Integer(i), "Val" + (new Integer(i)));
+ }
+
+ assertEquals(map.size(), 5);
+ }
+
+ /**
+ * Test method for {@link org.richfaces.util.LRUMap#removeEldestEntry(java.util.Map.Entry)}.
+ */
+ public void testRemoveEldestEntryEntry() {
+ LRUMap map = new LRUMap(5) {
+ protected boolean removeEldestEntry(Entry arg0) {
+ boolean eldestEntry = super.removeEldestEntry(arg0);
+
+ assertTrue(eldestEntry ^ size() <= 5);
+
+ return false;
+ }
+ };
+
+ for (int i = 0; i < 10; i++) {
+ map.put(new Integer(i), "Val" + (new Integer(i)));
+ }
+ }
+
+ /**
+ * Test method for {@link java.util.HashMap#put(K, V)}.
+ */
+ public void testPut() {
+ LRUMap map = new LRUMap(5);
+
+ for (int i = 0; i < 10; i++) {
+ map.put(new Integer(i), "Val" + (new Integer(i)));
+ }
+
+ assertEquals(map.size(), 5);
+
+ Iterator iterator = map.values().iterator();
+
+ for (int i = 5; i < 10; i++) {
+ assertTrue(iterator.hasNext());
+ assertEquals("Val" + (new Integer(i)), iterator.next());
+ }
+
+ assertFalse(iterator.hasNext());
+ }
+
+}
Deleted: branches/RF-7560/core/impl/src/main/java/org/ajax4jsf/renderkit/AJAXDataSerializer.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/ajax4jsf/renderkit/AJAXDataSerializer.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/core/impl/src/main/java/org/ajax4jsf/renderkit/AJAXDataSerializer.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -1,34 +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 org.ajax4jsf.javascript.ScriptUtils;
-
-/**
- * @author shura
- */
-public class AJAXDataSerializer {
-
- public String asString(Object data) {
- return ScriptUtils.toScript(data);
- }
-}
Modified: branches/RF-7560/core/impl/src/main/java/org/ajax4jsf/util/GenericsIntrospectionCache.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/ajax4jsf/util/GenericsIntrospectionCache.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/core/impl/src/main/java/org/ajax4jsf/util/GenericsIntrospectionCache.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -21,6 +21,7 @@
package org.ajax4jsf.util;
+import org.richfaces.util.LRUMap;
import org.richfaces.util.ReferenceMap;
import javax.faces.context.ExternalContext;
Deleted: branches/RF-7560/core/impl/src/main/java/org/ajax4jsf/util/LRUMap.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/ajax4jsf/util/LRUMap.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/core/impl/src/main/java/org/ajax4jsf/util/LRUMap.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -1,78 +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.util;
-
-import java.io.Serializable;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map.Entry;
-
-/**
- * Last Recent Used Map cache. See {@link LinkedHashMap} for details.
- *
- * @author asmirnov
- */
-public class LRUMap<K, V> extends LinkedHashMap<K, V> implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = -7232885382582796665L;
- private int capacity;
-
- /**
- * Default capacity constructor
- */
- public LRUMap() {
- this(1000);
- }
-
- /**
- * @param capacity - maximal cache capacity.
- */
- public LRUMap(int capacity) {
- super(capacity, 1.0f, true);
- this.capacity = capacity;
- }
-
- protected boolean removeEldestEntry(Entry<K, V> entry) {
-
- // Remove last entry if size exceeded.
- return size() > capacity;
- }
-
- /**
- * Get most recent used element
- *
- * @return the most Recent value
- */
- public V getMostRecent() {
- Iterator<V> iterator = values().iterator();
- V mostRecent = null;
-
- while (iterator.hasNext()) {
- mostRecent = iterator.next();
- }
-
- return mostRecent;
- }
-}
Modified: branches/RF-7560/core/impl/src/main/java/org/richfaces/application/DefaultModule.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/application/DefaultModule.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/application/DefaultModule.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -1,10 +1,11 @@
package org.richfaces.application;
-import org.ajax4jsf.renderkit.AJAXDataSerializer;
import org.richfaces.application.configuration.ConfigurationService;
import org.richfaces.application.configuration.ConfigurationServiceImpl;
import org.richfaces.cache.Cache;
import org.richfaces.l10n.BundleLoader;
+import org.richfaces.renderkit.AjaxDataSerializer;
+import org.richfaces.renderkit.AjaxDataSerializerImpl;
import org.richfaces.resource.DefaultResourceCodec;
import org.richfaces.resource.ResourceCodec;
import org.richfaces.skin.SkinFactory;
@@ -15,7 +16,7 @@
public void configure(ServicesFactory factory) {
factory.setInstance(ConfigurationService.class, new ConfigurationServiceImpl());
factory.setInstance(SkinFactory.class, new SkinFactoryImpl());
- factory.setInstance(AJAXDataSerializer.class,new AJAXDataSerializer());
+ factory.setInstance(AjaxDataSerializer.class, new AjaxDataSerializerImpl());
factory.setInstance(ResourceCodec.class,ServiceLoader.loadService(ResourceCodec.class, DefaultResourceCodec.class));
factory.setInstance(Cache.class,new CacheProvider());
factory.setInstance(Uptime.class, new Uptime());
Modified: branches/RF-7560/core/impl/src/main/java/org/richfaces/cache/lru/CacheMap.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/cache/lru/CacheMap.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/cache/lru/CacheMap.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -21,7 +21,7 @@
package org.richfaces.cache.lru;
-import org.ajax4jsf.util.LRUMap;
+import org.richfaces.util.LRUMap;
import java.util.PriorityQueue;
Deleted: branches/RF-7560/core/impl/src/main/java/org/richfaces/context/OnOffResponseWriter.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/context/OnOffResponseWriter.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/context/OnOffResponseWriter.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -1,101 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.context;
-
-import java.io.IOException;
-import java.io.Writer;
-
-import javax.faces.context.ResponseWriter;
-import javax.faces.context.ResponseWriterWrapper;
-
-/**
- * @author Nick Belaevski
- *
- */
-public class OnOffResponseWriter extends ResponseWriterWrapper {
-
- private static final Writer NO_OP_WRITER = new Writer() {
-
- @Override
- public void write(char[] cbuf, int off, int len) throws IOException {
- //do nothing
- }
-
- public void write(char[] cbuf) throws IOException {
- //do nothing
- };
-
- public void write(int c) throws IOException {
- //do nothing
- };
-
- public void write(String str) throws IOException {
- //do nothing
- };
-
- public void write(String str, int off, int len) throws IOException {
- //do nothing
- };
-
- @Override
- public void flush() throws IOException {
- //do nothing
- }
-
- @Override
- public void close() throws IOException {
- //do nothing
- }
- };
-
- private boolean switchedOn = false;
-
- private ResponseWriter wrappedWriter;
-
- private ResponseWriter stubWriter;
-
- public OnOffResponseWriter(ResponseWriter wrappedWriter) {
- super();
- this.wrappedWriter = wrappedWriter;
- }
-
- @Override
- public ResponseWriter getWrapped() {
- if (!switchedOn) {
- if (stubWriter == null) {
- stubWriter = wrappedWriter.cloneWithWriter(NO_OP_WRITER);
- }
-
- return stubWriter;
- } else {
- return wrappedWriter;
- }
- }
-
- public void setSwitchedOn(boolean newState) {
- switchedOn = newState;
- }
-
- public boolean isSwitchedOn() {
- return switchedOn;
- }
-}
Added: branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/AjaxDataSerializerImpl.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/AjaxDataSerializerImpl.java (rev 0)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/AjaxDataSerializerImpl.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.renderkit;
+
+import org.ajax4jsf.javascript.ScriptUtils;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class AjaxDataSerializerImpl implements AjaxDataSerializer {
+
+ public String asString(Object data) {
+ return ScriptUtils.toScript(data);
+ }
+
+}
Modified: branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonGradient.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonGradient.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonGradient.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -23,6 +23,7 @@
import org.richfaces.renderkit.html.BaseGradient;
+
public class SpinnerButtonGradient extends BaseGradient {
public SpinnerButtonGradient() {
super(30, 50, 20, "headerGradientColor", "headerBackgroundColor");
Modified: branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerFieldGradient.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerFieldGradient.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerFieldGradient.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -23,6 +23,7 @@
import org.richfaces.renderkit.html.BaseGradient;
+
public class SpinnerFieldGradient extends BaseGradient {
public SpinnerFieldGradient() {
Deleted: branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -1,343 +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.richfaces.renderkit.util;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Pattern;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.PartialResponseWriter;
-
-import org.ajax4jsf.component.AjaxComponent;
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.renderkit.AJAXDataSerializer;
-import org.richfaces.application.ServiceTracker;
-import org.richfaces.log.Logger;
-import org.richfaces.log.RichfacesLogger;
-import org.richfaces.renderkit.HtmlConstants;
-
-import com.google.common.base.Strings;
-
-
-/**
- * @author shura
- * <p/>
- * Some utilites for render AJAX components.
- */
-public final class CoreAjaxRendererUtils {
-
- /**
- * Attribute for keep JavaScript function name for call before updating
- * DOM tree.
- */
- public static final String ONBEFOREDOMUPDATE_ATTR_NAME = "onbeforedomupdate";
-
- /**
- * Attribute for keep JavaScript function name for call after complete
- * request.
- */
- public static final String ONCOMPLETE_ATTR_NAME = "oncomplete";
-
- public static final String DATA_ATTR_NAME = "data";
-
- /**
- * Attribute to keep
- */
- public static final String LIMITRENDER_ATTR_NAME = "limitRender";
-
- /**
- * @since 3.3.0
- */
- public static final String AJAX_PROCESS_ATTRIBUTE = "process";
- public static final String AJAX_REGIONS_ATTRIBUTE = "reRender";
-
- private static final Logger LOG = RichfacesLogger.RENDERKIT.getLogger();
-
- private static final String EXTENSION_ID = "org.richfaces.extension";
-
- private static final String BEFOREDOMUPDATE_ELEMENT_NAME = "beforedomupdate";
- private static final String COMPLETE_ELEMENT_NAME = "complete";
- private static final String DATA_ELEMENT_NAME = "data";
- private static final String COMPONENT_DATA_ELEMENT_NAME = "componentData";
- private static final Class<?> STRING_ARRAY_CLASS = String[].class;
- private static final Pattern ID_SPLIT_PATTERN = Pattern.compile("\\s*(\\s|,)\\s*");
-
- private CoreAjaxRendererUtils() {
- }
-
- private static void startExtensionElementIfNecessary(
- PartialResponseWriter partialResponseWriter,
- Map<String, String> attributes,
- boolean[] writingState) throws IOException {
-
- if (!writingState[0]) {
- writingState[0] = true;
-
- partialResponseWriter.startExtension(attributes);
- }
- }
-
- private static void endExtensionElementIfNecessary(
- PartialResponseWriter partialResponseWriter,
- boolean[] writingState) throws IOException {
-
- if (writingState[0]) {
- writingState[0] = false;
-
- partialResponseWriter.endExtension();
- }
- }
-
- public static void renderAjaxExtensions(FacesContext facesContext, UIComponent component) throws IOException {
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(facesContext);
-
- Map<String, String> attributes = Collections.singletonMap(HtmlConstants.ID_ATTRIBUTE,
- facesContext.getExternalContext().encodeNamespace(EXTENSION_ID));
- PartialResponseWriter writer = facesContext.getPartialViewContext().getPartialResponseWriter();
- boolean[] writingState = new boolean[]{false};
-
- Object onbeforedomupdate = ajaxContext.getOnbeforedomupdate();
- if (onbeforedomupdate != null) {
- String string = onbeforedomupdate.toString();
- if (string.length() != 0) {
- startExtensionElementIfNecessary(writer, attributes, writingState);
- writer.startElement(BEFOREDOMUPDATE_ELEMENT_NAME, component);
- writer.writeText(onbeforedomupdate, null);
- writer.endElement(BEFOREDOMUPDATE_ELEMENT_NAME);
- }
- }
-
- Object oncomplete = ajaxContext.getOncomplete();
- if (oncomplete != null) {
- String string = oncomplete.toString();
- if (string.length() != 0) {
- startExtensionElementIfNecessary(writer, attributes, writingState);
- writer.startElement(COMPLETE_ELEMENT_NAME, component);
- writer.writeText(oncomplete, null);
- writer.endElement(COMPLETE_ELEMENT_NAME);
- }
- }
-
- Object responseData = ajaxContext.getResponseData();
- if (responseData != null) {
- startExtensionElementIfNecessary(writer, attributes, writingState);
- writer.startElement(DATA_ELEMENT_NAME, component);
-
- AJAXDataSerializer serializer = ServiceTracker.getService(facesContext, AJAXDataSerializer.class);
- writer.writeText(serializer.asString(responseData), null);
-
- writer.endElement(DATA_ELEMENT_NAME);
- }
-
- Map<String, Object> responseComponentDataMap = ajaxContext.getResponseComponentDataMap();
- if (responseComponentDataMap != null && !responseComponentDataMap.isEmpty()) {
- startExtensionElementIfNecessary(writer, attributes, writingState);
- writer.startElement(COMPONENT_DATA_ELEMENT_NAME, component);
-
- AJAXDataSerializer serializer = ServiceTracker.getService(facesContext, AJAXDataSerializer.class);
- writer.writeText(serializer.asString(responseComponentDataMap), null);
-
- writer.endElement(COMPONENT_DATA_ELEMENT_NAME);
- }
-
- endExtensionElementIfNecessary(writer, writingState);
-
- }
-
- /**
- * Split parameter string into array of strings.
- * @param valuesSet
- * @return
- */
- public static String[] asIdsArray(String valuesSet) {
- return IdSplitBuilder.split(valuesSet);
- }
-
- /**
- * Get list of clientId's for given component
- *
- * @param uiComponent
- * @return List of areas Id's , updated by this component.
- */
- public static Set<String> getAjaxAreas(UIComponent uiComponent) {
- Object areas;
-
- if (uiComponent instanceof AjaxComponent) {
- areas = ((AjaxComponent) uiComponent).getReRender();
- } else {
- areas = uiComponent.getAttributes().get(AJAX_REGIONS_ATTRIBUTE);
- }
-
- return asIdsSet(areas);
- }
-
- /**
- * Returns set of areas to be processed as a result of this component action invocation
- *
- * @param component
- * @return set of IDs that should be processed as a
- * @since 3.3.0
- */
- public static Set<String> getAjaxAreasToProcess(UIComponent component) {
- Object areas;
-
- if (component instanceof AjaxComponent) {
- areas = ((AjaxComponent) component).getProcess();
- } else {
- areas = component.getAttributes().get(AJAX_PROCESS_ATTRIBUTE);
- }
-
- return asIdsSet(areas);
- }
-
- public static Set<String> asIdsSet(Object valueToSet) {
- return asSet(valueToSet, true);
- }
-
- //TODO - remove code duplication
- @SuppressWarnings("unchecked")
- private static Set<String> asSet(Object valueToSet, boolean idsSet) {
- if (null != valueToSet) {
-
- // Simplest case - set.
- if (valueToSet instanceof Set) {
- return new LinkedHashSet<String>((Set<String>) valueToSet);
- } else if (valueToSet instanceof Collection) { // Other collections.
- return new LinkedHashSet<String>((Collection<String>) valueToSet);
- } else if (Object[].class.isAssignableFrom(valueToSet.getClass())) { // Array
- return new LinkedHashSet<String>(Arrays.asList((String[]) valueToSet));
- } else if (valueToSet instanceof String) { // Tokenize string.
- String areasString = ((String) valueToSet).trim();
-
- if (areasString.contains(",") || areasString.contains(" ")) {
- String[] values;
- if (idsSet) {
- values = IdSplitBuilder.split(areasString);
- } else {
- values = ID_SPLIT_PATTERN.split(areasString);
- }
-
- Set<String> result = new LinkedHashSet<String>(values.length);
- for (String value : values) {
- if (Strings.isNullOrEmpty(value)) {
- continue;
- }
-
- result.add(value);
- }
-
- return result;
- } else {
- Set<String> areasSet = new LinkedHashSet<String>(5);
-
- if (!Strings.isNullOrEmpty(areasString)) {
- areasSet.add(areasString);
- }
-
- return areasSet;
- }
- }
- }
-
- return null;
- }
-
-
- /**
- * Calculate, must be component render only given areas, or all sended from
- * server.
- *
- * @param component
- * @return <code>true</code> if client must render ONLY given areas.
- */
- public static boolean isAjaxLimitRender(UIComponent component) {
- boolean result = false;
-
- if (component instanceof AjaxComponent) {
- result = ((AjaxComponent) component).isLimitRender();
- } else {
- try {
- result = ((Boolean) component.getAttributes().get(LIMITRENDER_ATTR_NAME)).booleanValue();
- } catch (NullPointerException e) {
-
- // NullPointer - ignore ...
- } catch (ClassCastException e1) {
-
- // not Boolean - false ...
- }
- }
-
- return result;
- }
-
-
- /**
- * Get function name for call on completed ajax request.
- *
- * @param component for wich calculate function name
- * @return name of JavaScript function or <code>null</code>
- */
- //TODO nick - refactor - remove this method?
- public static String getAjaxOncomplete(UIComponent component) {
- if (component instanceof AjaxComponent) {
- return ((AjaxComponent) component).getOncomplete();
- }
-
- return (String) component.getAttributes().get(ONCOMPLETE_ATTR_NAME);
- }
-
- /**
- * Get function name for call before update DOM.
- *
- * @param component for wich calculate function name
- * @return name of JavaScript function or <code>null</code>
- */
- //TODO nick - refactor - remove this method?
- public static String getAjaxOnBeforeDomUpdate(UIComponent component) {
- if (component instanceof AjaxComponent) {
- return ((AjaxComponent) component).getOnbeforedomupdate();
- }
-
- return (String) component.getAttributes().get(ONBEFOREDOMUPDATE_ATTR_NAME);
- }
-
- /**
- * @param component
- * @return
- * @since 4.0
- */
- public static Object getAjaxData(UIComponent component) {
- if (component instanceof AjaxComponent) {
- return ((AjaxComponent) component).getData();
- }
-
- return component.getAttributes().get(DATA_ATTR_NAME);
- }
-
-}
Deleted: branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/util/HtmlDimensions.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/util/HtmlDimensions.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/util/HtmlDimensions.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -1,90 +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.richfaces.renderkit.util;
-
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-import java.text.ParseException;
-import java.util.regex.Pattern;
-
-import org.ajax4jsf.Messages;
-
-public final class HtmlDimensions {
- private static final Pattern PATTERN_NUMERIC = Pattern.compile("^[+-]?\\d+(\\.\\d+)?$");
- private static final Pattern PATTERN_PX = Pattern.compile("^[+-]?\\d+(\\.\\d+)?px$");
- private static final Pattern PATTERN_PCT = Pattern.compile("^[+-]?\\d+(\\.\\d+)?%$");
- private static final NumberFormat NUMERIC_FORMAT = new DecimalFormat();
- private static final DecimalFormat PX_FORMAT = new DecimalFormat();
- private static final NumberFormat PCT_FORMAT = NumberFormat.getPercentInstance();
-
- static {
- PX_FORMAT.setPositiveSuffix("px");
- PX_FORMAT.setNegativeSuffix("px");
- }
-
- private HtmlDimensions() {
- }
-
- public static Double decode(String size) {
-
- // TODO - handle px,ex,pt enc suffixes.
- double d = 0;
-
- try {
- if (size != null) {
- if (PATTERN_NUMERIC.matcher(size).matches()) {
- synchronized (NUMERIC_FORMAT) {
- d = NUMERIC_FORMAT.parse(size).doubleValue();
- }
- } else if (PATTERN_PX.matcher(size).matches()) {
- synchronized (PX_FORMAT) {
- d = PX_FORMAT.parse(size).doubleValue();
- }
- } else if (PATTERN_PCT.matcher(size).matches()) {
- synchronized (PCT_FORMAT) {
- d = PCT_FORMAT.parse(size).doubleValue();
- }
- }
- }
- } catch (ParseException e) {
- throw new IllegalArgumentException(Messages.getMessage(Messages.DECODE_PARAMETER_ERROR,
- new Object[]{"size",
- size, e.getMessage()}));
- }
-
- return new Double(d);
- }
-
- public static String formatPx(Double value) {
- return value.intValue() + "px";
- }
-
- public static String formatPct(Double value) {
- String v = "";
-
- synchronized (PCT_FORMAT) {
- v = PCT_FORMAT.format(value.doubleValue());
- }
-
- return v;
- }
-}
Deleted: branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/util/IdSplitBuilder.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/util/IdSplitBuilder.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/util/IdSplitBuilder.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -1,150 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.renderkit.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Nick Belaevski
- */
-final class IdSplitBuilder {
-
- private static final int INITIAL_SPLIT_LIST_SIZE = 3;
-
- private enum State {
- IN_ID (true) {
-
- @Override
- public State getNextState(char c) {
- if (c == '[') {
- return State.IN_ID_INSIDE_BRACKETS;
- } else if (isSeparator(c)) {
- return State.OUTSIDE_ID;
- } else {
- return this;
- }
- }
- },
- IN_ID_INSIDE_BRACKETS (true) {
-
- @Override
- public State getNextState(char c) {
- if (c == ']') {
- return State.IN_ID;
- } else {
- return this;
- }
- }
- },
- OUTSIDE_ID (false) {
-
- @Override
- public State getNextState(char c) {
- if (!isSeparator(c)) {
- if (c == '[') {
- return State.IN_ID_INSIDE_BRACKETS;
- } else {
- return State.IN_ID;
- }
- }
-
- return this;
- }
- };
-
- private final boolean idSegment;
-
- private State(boolean idSegment) {
- this.idSegment = idSegment;
- }
-
- private static boolean isSeparator(char c) {
- return c == ',' || Character.isWhitespace(c);
- }
-
- public abstract State getNextState(char c);
-
- public boolean isIdSegment() {
- return idSegment;
- }
-
- public void processChar(IdSplitBuilder builder, char c, int charIdx) {
- State nextState = getNextState(c);
-
- if (nextState.isIdSegment() ^ isIdSegment()) {
- if (nextState.isIdSegment()) {
- builder.setStartIndex(charIdx);
- } else {
- builder.flushBuilder(charIdx);
- builder.setStartIndex(-1);
- }
- }
-
- builder.state = nextState;
- }
- }
-
- private int startIdx = -1;
-
- private String sourceString;
-
- private List<String> result = new ArrayList<String>(INITIAL_SPLIT_LIST_SIZE);
-
- private State state = State.OUTSIDE_ID;
-
- private IdSplitBuilder(String sourceString) {
- super();
- this.sourceString = sourceString;
- }
-
- private void setStartIndex(int idx) {
- startIdx = idx;
- }
-
- private void flushBuilder(int endIdx) {
- if (startIdx >= 0 && endIdx > startIdx) {
- String id = sourceString.substring(startIdx, endIdx);
- result.add(id);
- }
- }
-
- private void build() {
- int length = sourceString.length();
- for (int i = 0; i < length; i++) {
- char c = sourceString.charAt(i);
- state.processChar(this, c, i);
- }
- flushBuilder(length);
- }
-
- private String[] getSplit() {
- return result.toArray(new String[result.size()]);
- }
-
- public static String[] split(String s) {
- IdSplitBuilder splitBuilder = new IdSplitBuilder(s);
- splitBuilder.build();
- return splitBuilder.getSplit();
- }
-
-}
\ No newline at end of file
Deleted: branches/RF-7560/core/impl/src/test/java/org/ajax4jsf/util/LRUMapTest.java
===================================================================
--- branches/RF-7560/core/impl/src/test/java/org/ajax4jsf/util/LRUMapTest.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/core/impl/src/test/java/org/ajax4jsf/util/LRUMapTest.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -1,132 +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.util;
-
-import java.util.Iterator;
-import java.util.Map.Entry;
-
-import junit.framework.TestCase;
-
-/**
- * @author asmirnov
- *
- */
-public class LRUMapTest extends TestCase {
-
- /**
- * @param name
- */
- public LRUMapTest(String name) {
- super(name);
- }
-
- /*
- * (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- /*
- * (non-Javadoc)
- * @see junit.framework.TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- /**
- * Test method for {@link org.ajax4jsf.util.LRUMap#LRUMap(int)}.
- */
- public void testLRUMap() {
- LRUMap map = new LRUMap(5);
-
- for (int i = 0; i < 10; i++) {
- map.put(new Integer(i), "Val" + (new Integer(i)));
- }
-
- assertEquals(map.size(), 5);
- }
-
- /**
- * Test method for {@link org.ajax4jsf.util.LRUMap#removeEldestEntry(java.util.Map.Entry)}.
- */
- public void testRemoveEldestEntryEntry() {
- LRUMap map = new LRUMap(5) {
- protected boolean removeEldestEntry(Entry arg0) {
- boolean eldestEntry = super.removeEldestEntry(arg0);
-
- assertTrue(eldestEntry ^ size() <= 5);
-
- return false;
- }
- };
-
- for (int i = 0; i < 10; i++) {
- map.put(new Integer(i), "Val" + (new Integer(i)));
- }
- }
-
- /**
- * Test method for {@link java.util.HashMap#put(K, V)}.
- */
- public void testPut() {
- LRUMap map = new LRUMap(5);
-
- for (int i = 0; i < 10; i++) {
- map.put(new Integer(i), "Val" + (new Integer(i)));
- }
-
- assertEquals(map.size(), 5);
-
- Iterator iterator = map.values().iterator();
-
- for (int i = 5; i < 10; i++) {
- assertTrue(iterator.hasNext());
- assertEquals("Val" + (new Integer(i)), iterator.next());
- }
-
- assertFalse(iterator.hasNext());
- }
-
- public void testGetMostRecent() throws Exception {
- LRUMap map = new LRUMap(5);
-
- for (int i = 0; i < 10; i++) {
- String last = "Val" + (new Integer(i));
-
- map.put(new Integer(i), last);
- assertSame(last, map.getMostRecent());
- }
-
- assertEquals(map.size(), 5);
-
- for (int i = 5; i < 10; i++) {
- Object lastGet = map.get(new Integer(i));
-
- assertSame(lastGet, map.getMostRecent());
- }
- }
-}
Modified: branches/RF-7560/examples/iteration-demo/pom.xml
===================================================================
--- branches/RF-7560/examples/iteration-demo/pom.xml 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/examples/iteration-demo/pom.xml 2010-09-06 15:48:48 UTC (rev 19123)
@@ -63,10 +63,6 @@
<artifactId>richfaces-core-api</artifactId>
</dependency>
<dependency>
- <groupId>org.richfaces.core</groupId>
- <artifactId>richfaces-core-impl</artifactId>
- </dependency>
- <dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
Modified: branches/RF-7560/examples/misc-demo/pom.xml
===================================================================
--- branches/RF-7560/examples/misc-demo/pom.xml 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/examples/misc-demo/pom.xml 2010-09-06 15:48:48 UTC (rev 19123)
@@ -53,10 +53,6 @@
<artifactId>richfaces-ui-core-ui</artifactId>
</dependency>
<dependency>
- <groupId>org.richfaces.core</groupId>
- <artifactId>richfaces-core-impl</artifactId>
- </dependency>
- <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
Modified: branches/RF-7560/examples/parent/pom.xml
===================================================================
--- branches/RF-7560/examples/parent/pom.xml 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/examples/parent/pom.xml 2010-09-06 15:48:48 UTC (rev 19123)
@@ -53,6 +53,13 @@
</dependencies>
</dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-impl</artifactId>
+ </dependency>
+ </dependencies>
+
<!-- Build -->
<build>
<!--
Copied: branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/context/OnOffResponseWriter.java (from rev 19119, branches/RF-7560/core/impl/src/main/java/org/richfaces/context/OnOffResponseWriter.java)
===================================================================
--- branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/context/OnOffResponseWriter.java (rev 0)
+++ branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/context/OnOffResponseWriter.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.context;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import javax.faces.context.ResponseWriter;
+import javax.faces.context.ResponseWriterWrapper;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class OnOffResponseWriter extends ResponseWriterWrapper {
+
+ private static final Writer NO_OP_WRITER = new Writer() {
+
+ @Override
+ public void write(char[] cbuf, int off, int len) throws IOException {
+ //do nothing
+ }
+
+ public void write(char[] cbuf) throws IOException {
+ //do nothing
+ };
+
+ public void write(int c) throws IOException {
+ //do nothing
+ };
+
+ public void write(String str) throws IOException {
+ //do nothing
+ };
+
+ public void write(String str, int off, int len) throws IOException {
+ //do nothing
+ };
+
+ @Override
+ public void flush() throws IOException {
+ //do nothing
+ }
+
+ @Override
+ public void close() throws IOException {
+ //do nothing
+ }
+ };
+
+ private boolean switchedOn = false;
+
+ private ResponseWriter wrappedWriter;
+
+ private ResponseWriter stubWriter;
+
+ public OnOffResponseWriter(ResponseWriter wrappedWriter) {
+ super();
+ this.wrappedWriter = wrappedWriter;
+ }
+
+ @Override
+ public ResponseWriter getWrapped() {
+ if (!switchedOn) {
+ if (stubWriter == null) {
+ stubWriter = wrappedWriter.cloneWithWriter(NO_OP_WRITER);
+ }
+
+ return stubWriter;
+ } else {
+ return wrappedWriter;
+ }
+ }
+
+ public void setSwitchedOn(boolean newState) {
+ switchedOn = newState;
+ }
+
+ public boolean isSwitchedOn() {
+ return switchedOn;
+ }
+}
Modified: branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java
===================================================================
--- branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -21,15 +21,9 @@
package org.richfaces.renderkit.util;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.LinkedHashSet;
import java.util.Map;
-import java.util.Set;
-import java.util.regex.Pattern;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIForm;
import javax.faces.context.FacesContext;
import org.ajax4jsf.component.AjaxClientBehavior;
@@ -40,8 +34,6 @@
import org.ajax4jsf.javascript.JSReference;
import org.richfaces.renderkit.AjaxEventOptions;
import org.richfaces.renderkit.HtmlConstants;
-
-import com.google.common.base.Strings;
/**
* @author shura
* <p/>
@@ -80,9 +72,6 @@
public static final String QUEUE_ID_ATTRIBUTE = "queueId";
private static final RendererUtils RENDERER_UTILS = RendererUtils.getInstance();
- private static final Class<?> STRING_ARRAY_CLASS = String[].class;
-
- private static final Pattern ID_SPLIT_PATTERN = Pattern.compile("\\s*(\\s|,)\\s*");
/**
* Static class - protect constructor
@@ -549,69 +538,6 @@
// }
/**
- * Convert parameter ( Collection, List, array, String, comma-separated
- * String, whitespace-separate String) to set of strings.
- *
- * @param valueToSet -
- * object for conversion to Set.
- * @return - set of strings.
- */
- public static Set<String> asSet(Object valueToSet) {
- return asSet(valueToSet, false);
- }
-
- public static Set<String> asIdsSet(Object valueToSet) {
- return asSet(valueToSet, true);
- }
-
- @SuppressWarnings("unchecked")
- private static Set<String> asSet(Object valueToSet, boolean idsSet) {
- if (null != valueToSet) {
-
- // Simplest case - set.
- if (valueToSet instanceof Set) {
- return new LinkedHashSet<String>((Set<String>) valueToSet);
- } else if (valueToSet instanceof Collection) { // Other collections.
- return new LinkedHashSet<String>((Collection<String>) valueToSet);
- } else if (STRING_ARRAY_CLASS.isAssignableFrom(valueToSet.getClass())) { // Array
- return new LinkedHashSet<String>(Arrays.asList((String[]) valueToSet));
- } else if (valueToSet instanceof String) { // Tokenize string.
- String areasString = ((String) valueToSet).trim();
-
- if (areasString.contains(",") || areasString.contains(" ")) {
- String[] values;
- if (idsSet) {
- values = IdSplitBuilder.split(areasString);
- } else {
- values = ID_SPLIT_PATTERN.split(areasString);
- }
-
- Set<String> result = new LinkedHashSet<String>(values.length);
- for (String value : values) {
- if (Strings.isNullOrEmpty(value)) {
- continue;
- }
-
- result.add(value);
- }
-
- return result;
- } else {
- Set<String> areasSet = new LinkedHashSet<String>(5);
-
- if (!Strings.isNullOrEmpty(areasString)) {
- areasSet.add(areasString);
- }
-
- return areasSet;
- }
- }
- }
-
- return null;
- }
-
- /**
* Get status area Id for given component.
*
* @param component
@@ -673,181 +599,10 @@
return (String) component.getAttributes().get(ONBEGIN_ATTR_NAME);
}
- /**
- * Find nested form for given component
- *
- * @param component
- * @return nested <code>UIForm</code> component, or <code>null</code>
- */
- public static UIComponent getNestingForm(UIComponent component) {
- UIComponent parent = component;
-
- // Search enclosed UIForm or ADF UIXForm component
- while ((parent != null) && !(parent instanceof UIForm)
- && !("org.apache.myfaces.trinidad.Form".equals(parent.getFamily()))
- && !("oracle.adf.Form".equals(parent.getFamily()))) {
- parent = parent.getParent();
- }
-
- return parent;
- }
-
protected static String getAjaxActionUrl(FacesContext facesContext) {
return AjaxContext.getCurrentInstance(facesContext).getAjaxActionURL(facesContext);
}
-// /**
-// * Encode rendered areas as special HTML tag ( span in current release )
-// *
-// * @param context
-// * @param component
-// * @throws IOException
-// */
-// public static void encodeAreas(FacesContext context, UIComponent component) throws IOException {
-// AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
-// ExternalContext externalContext = context.getExternalContext();
-// Map<String, Object> requestMap = externalContext.getRequestMap();
-// Set<String> rendered = ajaxContext.getAjaxRenderedAreas();
-//
-// // write special area for list of rendered elements. Client-side
-// // Java
-// // Script
-// // read this structure for update areas of DOM tree.
-// ResponseWriter out = context.getResponseWriter();
-//
-// // Create <span> element to keep list rendered aread ( in title
-// // attribute )
-// // More right will create special namespace for such
-// // information,
-// // but I want to keep simple html ( xhtml ) document - on case
-// // I have troubles with microsoft XMLHTTP validations.
-// out.startElement(AjaxContainerRenderer.AJAX_RESULT_GROUP_TAG, component);
-// out.writeAttribute(HTML.NAME_ATTRIBUTE, AjaxContainerRenderer.AJAX_UPDATE_HEADER, null);
-//
-// StringBuffer senderString = new StringBuffer();
-//
-// for (Iterator<String> it = rendered.iterator(); it.hasNext();) {
-// String id = it.next();
-//
-// senderString.append(id);
-//
-// if (it.hasNext()) {
-// senderString.append(',');
-// }
-// }
-//
-// out.writeAttribute(AjaxContainerRenderer.AJAX_RESULT_GROUP_ATTR, senderString, null);
-// out.endElement(AjaxContainerRenderer.AJAX_RESULT_GROUP_TAG);
-//
-// // For sequences and client-saved states.
-// out.startElement(AjaxContainerRenderer.AJAX_VIEW_STATE_TAG, component);
-// out.writeAttribute(HTML.ID_ATTRIBUTE, AjaxContainerRenderer.AJAX_VIEW_STATE_ID, null);
-// writeState(context);
-// out.endElement(AjaxContainerRenderer.AJAX_VIEW_STATE_TAG);
-//
-// // Write rendered flag to html <meta>
-// out.startElement(AjaxContainerRenderer.AJAX_RESULT_GROUP_TAG, component);
-// out.writeAttribute(HTML.ID_ATTRIBUTE, AjaxContainerRenderer.AJAX_FLAG_HEADER, null);
-// out.writeAttribute(HTML.NAME_ATTRIBUTE, AjaxContainerRenderer.AJAX_FLAG_HEADER, null);
-// out.writeAttribute(AjaxContainerRenderer.AJAX_RESULT_GROUP_ATTR, "true", null);
-// out.endElement(AjaxContainerRenderer.AJAX_RESULT_GROUP_TAG);
-//
-// // set response header with list of rendered ID's
-// Object response = externalContext.getResponse();
-//
-// // Use reflection for send responce headers - we can get
-// // different responces classes
-// // for different environment ( portal, cocoon etc )
-// if (response instanceof HttpServletResponse) {
-// HttpServletResponse httpResponse = (HttpServletResponse) response;
-//
-// httpResponse.setHeader(AjaxContainerRenderer.AJAX_FLAG_HEADER, "true");
-// } else {
-// try {
-// Method setHeadergMethod = response.getClass().getMethod("setHeader",
-// new Class[]{String.class, String.class});
-//
-// setHeadergMethod.invoke(response, AjaxContainerRenderer.AJAX_FLAG_HEADER, "true");
-// } catch (Exception e) {
-// LOG.error(Messages.getMessage(Messages.DETECTING_ENCODING_DISABLED_ERROR));
-// LOG.error(Messages.getMessage(Messages.OBTAIN_RESPONSE_SET_HEADER_ERROR, e));
-// }
-// }
-//
-// Map<String, Object> responseDataMap = ajaxContext.getResponseComponentDataMap();
-//
-// // Get data serializer instance
-// AJAXDataSerializer serializer = ServiceTracker.getService(context, AJAXDataSerializer.class);
-//
-// // Put data to JavaScript handlers, inside <span> elements.
-// for (Map.Entry<String, Object> entry : responseDataMap.entrySet()) {
-// out.startElement(HTML.SPAN_ELEM, component);
-// out.writeAttribute(HTML.ID_ATTRIBUTE, entry.getKey(), null);
-//
-// String dataString = serializer.asString(entry.getValue());
-//
-// out.write(dataString);
-// out.endElement(HTML.SPAN_ELEM);
-// }
-//
-// // Include active 'oncomplete' function content :
-// Object oncomplete = ajaxContext.getOncomplete();
-//
-// if (null != oncomplete) {
-// out.startElement(HTML.SPAN_ELEM, component);
-// out.writeAttribute(HTML.ID_ATTRIBUTE, ONCOMPLETE_CONTENT_ID, null);
-// out.writeText(oncomplete, null);
-// out.endElement(HTML.SPAN_ELEM);
-// }
-//
-// // For self-rendered case, we use own methods for replace stateKey by
-// // real value in XML filter.
-// // if(ajaxContext.isSelfRender()){
-// // saveViewState(context, out);
-// // }
-// requestMap.put(AJAX_AREAS_RENDERED, "true");
-// }
-
-// /**
-// * Encode declaration for AJAX response. Render <html><body>
-// *
-// * @param context
-// * @param component
-// * @throws IOException
-// */
-// public static void encodeAjaxBegin(FacesContext context, UIComponent component) throws IOException {
-//
-// // AjaxContainer ajax = (AjaxContainer) component;
-// ResponseWriter out = context.getResponseWriter();
-//
-// // DebugUtils.traceView("ViewRoot in AJAX Page encode begin");
-// out.startElement("html", component);
-//
-// Locale locale = context.getViewRoot().getLocale();
-//
-// out.writeAttribute(HTML.LANG_ATTRIBUTE, locale.toString(), "lang");
-// out.startElement("body", component);
-// }
-//
-// /**
-// * End encoding of AJAX response. Render tag with included areas and close
-// * </body></html>
-// *
-// * @param context
-// * @param component
-// * @throws IOException
-// */
-// public static void encodeAjaxEnd(FacesContext context, UIComponent component) throws IOException {
-//
-// // AjaxContainer ajax = (AjaxContainer) component;
-// ResponseWriter out = context.getResponseWriter();
-//
-// // DebugUtils.traceView("ViewRoot in AJAX Page encode begin");
-// encodeAreas(context, component);
-// out.endElement("body");
-// out.endElement("html");
-// }
-
/**
* @param facesContext
* @return
Modified: branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/renderkit/util/FormUtil.java
===================================================================
--- branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/renderkit/util/FormUtil.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/renderkit/util/FormUtil.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -21,12 +21,11 @@
package org.richfaces.renderkit.util;
-import org.richfaces.component.SwitchType;
-
import javax.faces.component.UIComponent;
-import javax.faces.component.UIForm;
import javax.faces.context.FacesContext;
+import org.richfaces.component.SwitchType;
+
/**
* @author Filip Antonov - mailto:fantonov@exadel.com
* created 08.02.2007
@@ -38,7 +37,7 @@
public static void throwEnclFormReqExceptionIfNeed(FacesContext context, UIComponent component)
throws EnclosingFormRequiredException {
- UIForm form = RendererUtils.getInstance().getNestingForm(context, component);
+ UIComponent form = RendererUtils.getInstance().getNestingForm(context, component);
// TODO nick -> nick - switchType checking can be harmful here
SwitchType switchType = (SwitchType) component.getAttributes().get("switchType");
Modified: branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/renderkit/util/RendererUtils.java
===================================================================
--- branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/renderkit/util/RendererUtils.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/renderkit/util/RendererUtils.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -759,22 +759,17 @@
* @param component
* @return nested <code>UIForm</code> component, or <code>null</code>
*/
- public UIForm getNestingForm(FacesContext context, UIComponent component) {
- UIComponent parent = component.getParent();
+ public UIComponent getNestingForm(FacesContext context, UIComponent component) {
+ UIComponent parent = component;
- while ((parent != null) && !(parent instanceof UIForm)) {
+ // Search enclosed UIForm or ADF UIXForm component
+ while ((parent != null) && !(parent instanceof UIForm)
+ && !("org.apache.myfaces.trinidad.Form".equals(parent.getFamily()))
+ && !("oracle.adf.Form".equals(parent.getFamily()))) {
parent = parent.getParent();
}
- UIForm nestingForm = null;
-
- if (parent != null) {
-
- // link is nested inside a form
- nestingForm = (UIForm) parent;
- }
-
- return nestingForm;
+ return parent;
}
/**
@@ -784,7 +779,7 @@
* @throws IOException
*/
public void encodeBeginFormIfNessesary(FacesContext context, UIComponent component) throws IOException {
- UIForm form = getNestingForm(context, component);
+ UIComponent form = getNestingForm(context, component);
if (null == form) {
ResponseWriter writer = context.getResponseWriter();
@@ -824,7 +819,7 @@
* @throws IOException
*/
public void encodeEndFormIfNessesary(FacesContext context, UIComponent component) throws IOException {
- UIForm form = getNestingForm(context, component);
+ UIComponent form = getNestingForm(context, component);
if (null == form) {
ResponseWriter writer = context.getResponseWriter();
Modified: branches/RF-7560/ui/core/ui/src/main/java/org/ajax4jsf/component/behavior/AjaxBehavior.java
===================================================================
--- branches/RF-7560/ui/core/ui/src/main/java/org/ajax4jsf/component/behavior/AjaxBehavior.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/ui/core/ui/src/main/java/org/ajax4jsf/component/behavior/AjaxBehavior.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -47,7 +47,7 @@
import org.richfaces.cdk.annotations.JsfBehavior;
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.annotations.TagType;
-import org.richfaces.renderkit.util.AjaxRendererUtils;
+import org.richfaces.renderkit.util.CoreAjaxRendererUtils;
/**
* @author Anton Belevich
@@ -119,7 +119,7 @@
}
if (result == null) {
- result = AjaxRendererUtils.asIdsSet(value);
+ result = CoreAjaxRendererUtils.asIdsSet(value);
}
if (result == null) {
Modified: branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/component/PushListenersManager.java
===================================================================
--- branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/component/PushListenersManager.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/component/PushListenersManager.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -23,17 +23,21 @@
package org.richfaces.component;
+import java.util.Map;
+
import javax.faces.context.FacesContext;
-import org.ajax4jsf.util.LRUMap;
+import org.richfaces.util.LRUMap;
/**
* @author Nick Belaevski
* @since 4.0
*/
public class PushListenersManager {
+
private static final String CONTEXT_ATTRIBUTE_NAME = "richFacesPushListenersManager";
- private LRUMap<String, PushEventTracker> listeners;
+
+ private Map<String, PushEventTracker> listeners;
public PushListenersManager() {
Modified: branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueRenderer.java
===================================================================
--- branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueRenderer.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueRenderer.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -22,7 +22,6 @@
package org.richfaces.renderkit.html;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIForm;
import javax.faces.context.FacesContext;
import org.richfaces.cdk.annotations.JsfRenderer;
@@ -41,7 +40,7 @@
String nameAttributeValue = (String) comp.getAttributes().get(NAME_ATTRIBBUTE);
if (nameAttributeValue == null || nameAttributeValue.length() == 0) {
- UIForm form = utils.getNestingForm(context, comp);
+ UIComponent form = utils.getNestingForm(context, comp);
if (form != null) {
nameAttributeValue = form.getClientId(context);
} else {
Modified: branches/RF-7560/ui/misc/ui/src/main/java/org/richfaces/function/RichFunction.java
===================================================================
--- branches/RF-7560/ui/misc/ui/src/main/java/org/richfaces/function/RichFunction.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/ui/misc/ui/src/main/java/org/richfaces/function/RichFunction.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -28,7 +28,7 @@
import javax.faces.context.FacesContext;
import org.richfaces.cdk.annotations.Function;
-import org.richfaces.renderkit.util.AjaxRendererUtils;
+import org.richfaces.renderkit.util.CoreAjaxRendererUtils;
import org.richfaces.renderkit.util.RendererUtils;
/**
@@ -125,7 +125,7 @@
@Function
public static boolean isUserInRole(Object rolesObject) {
//TODO nick - AjaxRendererUtils split text by commas and whitespace, what is the right variant?
- Set<String> rolesSet = AjaxRendererUtils.asSet(rolesObject);
+ Set<String> rolesSet = CoreAjaxRendererUtils.asIdsSet(rolesObject);
if (rolesSet != null) {
FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext = facesContext.getExternalContext();
Modified: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -22,14 +22,15 @@
package org.richfaces.component;
-import org.richfaces.renderkit.HtmlConstants;
+import java.io.IOException;
+import java.util.Map;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.render.Renderer;
-import java.io.IOException;
-import java.util.Map;
+import org.richfaces.renderkit.HtmlConstants;
+
/**
* @author akolonitsky
* @version 1.0
@@ -96,8 +97,8 @@
protected static void hidePanelItem(UIComponent item) {
Map<String,Object> attrs = item.getAttributes();
- Object style = attrs.get(RendererUtils.HTML.STYLE_ATTRIBUTE);
- attrs.put(RendererUtils.HTML.STYLE_ATTRIBUTE, "display:none; " + style);
+ Object style = attrs.get(HtmlConstants.STYLE_ATTRIBUTE);
+ attrs.put(HtmlConstants.STYLE_ATTRIBUTE, "display:none; " + style);
}
public abstract String getName();
Modified: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -22,23 +22,24 @@
package org.richfaces.renderkit.html;
-import org.ajax4jsf.javascript.JSObject;
-import org.richfaces.component.AbstractTogglePanelTitledItem;
-import org.richfaces.renderkit.HtmlConstants;
-import org.richfaces.renderkit.RenderKitUtils;
+import static org.richfaces.component.util.HtmlUtil.concatClasses;
+import static org.richfaces.renderkit.RenderKitUtils.renderPassThroughAttributes;
+import java.io.IOException;
+import java.util.Map;
+
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import java.io.IOException;
-import java.util.Map;
-import static org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates;
-import static org.richfaces.component.html.HtmlAccordionItem.PropertyKeys;
-import static org.richfaces.component.util.HtmlUtil.concatClasses;
-import static org.richfaces.renderkit.RenderKitUtils.renderPassThroughAttributes;
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.component.AbstractTogglePanelTitledItem;
+import org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates;
+import org.richfaces.component.html.HtmlAccordionItem.PropertyKeys;
+import org.richfaces.renderkit.HtmlConstants;
+import org.richfaces.renderkit.RenderKitUtils;
/**
*
@@ -103,10 +104,10 @@
return;
}
- writer.startElement(RendererUtils.HTML.SCRIPT_ELEM, component);
- writer.writeAttribute(RendererUtils.HTML.TYPE_ATTR, "text/javascript", "type");
+ writer.startElement(HtmlConstants.SCRIPT_ELEM, component);
+ writer.writeAttribute(HtmlConstants.TYPE_ATTR, "text/javascript", "type");
writer.writeText(script, null);
- writer.endElement(RendererUtils.HTML.SCRIPT_ELEM);
+ writer.endElement(HtmlConstants.SCRIPT_ELEM);
}
private void encodeContentBegin(UIComponent component, ResponseWriter writer) throws IOException {
Modified: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -111,12 +111,12 @@
super.doEncodeBegin(writer, context, comp);
AbstractTogglePanel panel = (AbstractTogglePanel) comp;
- writer.startElement(HTML.INPUT_ELEM, comp);
- writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
- writer.writeAttribute(HTML.VALUE_ATTRIBUTE, panel.getActiveItem(), "activeItem");
- writer.writeAttribute(HTML.ID_ATTRIBUTE, getValueRequestParamName(context, comp), null);
- writer.writeAttribute(HTML.NAME_ATTRIBUTE, getValueRequestParamName(context, comp), null);
- writer.endElement(HTML.INPUT_ELEM);
+ writer.startElement(HtmlConstants.INPUT_ELEM, comp);
+ writer.writeAttribute(HtmlConstants.TYPE_ATTR, HtmlConstants.INPUT_TYPE_HIDDEN, null);
+ writer.writeAttribute(HtmlConstants.VALUE_ATTRIBUTE, panel.getActiveItem(), "activeItem");
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, getValueRequestParamName(context, comp), null);
+ writer.writeAttribute(HtmlConstants.NAME_ATTRIBUTE, getValueRequestParamName(context, comp), null);
+ writer.endElement(HtmlConstants.INPUT_ELEM);
}
@Override
Modified: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -67,9 +67,5 @@
source.addChangeExpandListener(new LazyChangeExpandListener(this.listenerType, expression));
}
- @Override
- public boolean isEventSource(UIComponent comp) {
- return comp instanceof ChangeExpandSource;
- }
}
Copied: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java (from rev 19094, trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java)
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java (rev 0)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -0,0 +1,147 @@
+/**
+ * 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.view.facelets.html;
+
+import java.io.IOException;
+import java.io.Serializable;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+import javax.faces.view.EditableValueHolderAttachedObjectHandler;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagAttributeException;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagException;
+import javax.faces.view.facelets.TagHandler;
+
+import org.richfaces.component.AbstractCollapsiblePanel;
+import org.richfaces.view.facelets.TagHandlerUtils;
+
+/**
+ * @author akolonitsky
+ * @since Aug 31, 2010
+ */
+public abstract class EventListenerHandler extends TagHandler implements EditableValueHolderAttachedObjectHandler {
+
+ protected final TagAttribute binding;
+
+ protected final String listenerType;
+
+ public abstract static class LazyEventListener<L extends FacesListener> implements FacesListener, Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected final String type;
+
+ protected final ValueExpression binding;
+
+ protected LazyEventListener(String type, ValueExpression binding) {
+ this.type = type;
+ this.binding = binding;
+ }
+
+ public void processEvent(FacesEvent event) throws AbortProcessingException {
+
+ FacesContext faces = FacesContext.getCurrentInstance();
+ if (faces == null) {
+ return;
+ }
+
+ L instance = null;
+ if (this.binding != null) {
+ instance = (L) binding.getValue(faces.getELContext());
+ }
+ if (instance == null && this.type != null) {
+ try {
+ instance = (L) forName(this.type).newInstance();
+ } catch (Exception e) {
+ throw new AbortProcessingException("Couldn't Lazily instantiate EventListener", e);
+ }
+ if (this.binding != null) {
+ binding.setValue(faces.getELContext(), instance);
+ }
+ }
+
+ if (instance != null) {
+ event.processListener(instance);
+ }
+ }
+ }
+
+ public EventListenerHandler(TagConfig config) {
+ super(config);
+ this.binding = this.getAttribute("binding");
+ TagAttribute type = this.getAttribute("type");
+ if (type != null) {
+ if (type.isLiteral()) {
+ try {
+ forName(type.getValue());
+ } catch (ClassNotFoundException e) {
+ throw new TagAttributeException(type, "Couldn't qualify EventListener", e);
+ }
+ } else {
+ throw new TagAttributeException(type, "Must be a literal class name of type EventListener");
+ }
+ this.listenerType = type.getValue();
+ } else {
+ this.listenerType = null;
+ }
+ }
+
+ public void apply(FaceletContext ctx, UIComponent parent) throws IOException {
+
+ // only process if it's been created
+ if (parent == null || !ComponentHandler.isNew(parent)) {
+ return;
+ }
+
+ if (parent instanceof AbstractCollapsiblePanel) {
+ applyAttachedObject(ctx.getFacesContext(), parent);
+ } else if (UIComponent.isCompositeComponent(parent)) {
+ // Allow the composite component to know about the target component.
+ TagHandlerUtils.getOrCreateRetargetableHandlersList(parent).add(this);
+ } else {
+ throw new TagException(this.tag, "Parent is not of type EditableValueHolder, type is: " + parent);
+ }
+ }
+
+ public String getFor() {
+ TagAttribute attr = this.getAttribute("for");
+ return attr == null ? null : attr.getValue();
+ }
+
+ public static Class<?> forName(String name) throws ClassNotFoundException {
+ if (null == name || "".equals(name)) {
+ return null;
+ }
+
+ return Class.forName(name, false, Thread.currentThread().getContextClassLoader());
+ }
+}
+
+
Modified: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java 2010-09-06 15:48:48 UTC (rev 19123)
@@ -22,9 +22,7 @@
package org.richfaces.view.facelets.html;
-import org.richfaces.event.ItemChangeEvent;
-import org.richfaces.event.ItemChangeListener;
-import org.richfaces.event.ItemChangeSource;
+import java.io.Serializable;
import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
@@ -32,8 +30,11 @@
import javax.faces.event.AbortProcessingException;
import javax.faces.view.facelets.FaceletContext;
import javax.faces.view.facelets.TagConfig;
-import java.io.Serializable;
+import org.richfaces.event.ItemChangeEvent;
+import org.richfaces.event.ItemChangeListener;
+import org.richfaces.event.ItemChangeSource;
+
/**
*
* @author akolonitsky
@@ -68,9 +69,5 @@
evh.addItemChangeListener(new LazyItemChangeListener(this.listenerType, valueExpr));
}
- @Override
- public boolean isEventSource(UIComponent comp) {
- return comp instanceof ItemChangeSource;
- }
}
Modified: branches/RF-7560/ui/parent/pom.xml
===================================================================
--- branches/RF-7560/ui/parent/pom.xml 2010-09-06 15:37:00 UTC (rev 19122)
+++ branches/RF-7560/ui/parent/pom.xml 2010-09-06 15:48:48 UTC (rev 19123)
@@ -96,6 +96,7 @@
<!-- todo remove this dependency or move to test scope -->
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-impl</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
14 years, 4 months
JBoss Rich Faces SVN: r19122 - in branches/RF-8992/ui/input/ui/src/main: resources/META-INF/resources/org.richfaces and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-09-06 11:37:00 -0400 (Mon, 06 Sep 2010)
New Revision: 19122
Modified:
branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss
branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss
branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
branches/RF-8992/ui/input/ui/src/main/templates/inplaceSelect.template.xml
Log:
fix styles, add script stub for the inplaceSelect component, fix inplace renderers, implement markup for the inplaceSelect
Modified: branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2010-09-06 13:40:47 UTC (rev 19121)
+++ branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2010-09-06 15:37:00 UTC (rev 19122)
@@ -77,14 +77,7 @@
public static final String OPTIONS_INITIAL_VALUE = "initialValue";
- private static final String READY_STATE_CSS = "rf-ii-d-s";
- private static final String EDIT_STATE_CSS = "rf-ii-e-s";
-
- private static final String CHANGED_STATE_CSS = "rf-ii-c-s";
-
- private static final String NONE_CSS = "rf-ii-none";
-
private static final Map<String, ComponentAttribute> INPLACEINPUT_HANDLER_ATTRIBUTES = Collections
.unmodifiableMap(ComponentAttribute.createMap(
new ComponentAttribute(HTML.ONCLICK_ATTRIBUTE).setEventNames("inputClick").
@@ -143,11 +136,11 @@
}
public String getReadyStyleClass(UIComponent component, InplaceState inplaceState) {
- return (InplaceState.changed != inplaceState) ? READY_STATE_CSS : HtmlUtil.concatClasses(READY_STATE_CSS, CHANGED_STATE_CSS);
+ return (InplaceState.changed != inplaceState) ? getReadyStateCss() : HtmlUtil.concatClasses(getReadyStateCss(), getChangedStateCss());
}
public String getEditStyleClass(UIComponent component, InplaceState inplaceState) {
- return (InplaceState.edit != inplaceState)? HtmlUtil.concatClasses(EDIT_STATE_CSS, NONE_CSS) : EDIT_STATE_CSS;
+ return (InplaceState.edit != inplaceState)? HtmlUtil.concatClasses(getEditStateCss(), getNoneCss()) : getEditStateCss();
}
public String getReadyClientId(FacesContext facesContext, UIComponent component, InplaceState inplaceState) {
String clientId = component.getClientId(facesContext);
@@ -170,13 +163,12 @@
public void buildScript(ResponseWriter writer, FacesContext facesContext, UIComponent component) throws IOException {
AbstractInplaceInput inplaceInput = (AbstractInplaceInput)component;
JSFunction function = new JSFunction("new RichFaces.ui.InplaceInput");
- function.addParameter(inplaceInput.getClientId(facesContext));
String clientId = inplaceInput.getClientId(facesContext);
Map<String, Object> options = new HashMap<String, Object>();
options.put(OPTIONS_EDIT_EVENT, inplaceInput.getEditEvent());
- options.put(OPTIONS_NONE_CSS, NONE_CSS);
- options.put(OPTIONS_CHANGED_CSS, CHANGED_STATE_CSS);
+ options.put(OPTIONS_NONE_CSS, getNoneCss());
+ options.put(OPTIONS_CHANGED_CSS, getChangedStateCss());
options.put(OPTIONS_EDIT_CONTAINER, clientId + ":edit");
options.put(OPTIONS_INPUT, clientId + ":input");
options.put(OPTIONS_LABEL, clientId + ":label");
@@ -189,8 +181,25 @@
options.put(OPTIONS_BUTTON_OK, clientId + ":okbtn");
options.put(OPTIONS_BUTTON_CANCEL, clientId + ":cancelbtn");
}
+
+ function.addParameter(clientId);
function.addParameter(options);
-
writer.write(function.toString());
}
+
+ public String getReadyStateCss() {
+ return "rf-ii-d-s";
+ }
+
+ public String getEditStateCss() {
+ return "rf-ii-e-s";
+ }
+
+ public String getChangedStateCss() {
+ return "rf-ii-c-s";
+ }
+
+ public String getNoneCss() {
+ return "rf-ii-none";
+ }
}
Modified: branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2010-09-06 13:40:47 UTC (rev 19121)
+++ branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2010-09-06 15:37:00 UTC (rev 19122)
@@ -1,6 +1,8 @@
package org.richfaces.renderkit;
import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
@@ -8,7 +10,10 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
+import org.ajax4jsf.javascript.JSFunction;
+import org.richfaces.component.AbstractInplaceSelect;
+
/**
* @author Anton Belevich
*
@@ -24,9 +29,34 @@
@Override
public void buildScript(ResponseWriter writer, FacesContext facesContext, UIComponent component) throws IOException {
+ AbstractInplaceSelect inplaceSelect = (AbstractInplaceSelect)component;
+ JSFunction function = new JSFunction("new RichFaces.ui.InplaceSelect");
+
+ String clientId = inplaceSelect.getClientId(facesContext);
+ Map<String, Object> options = new HashMap<String, Object>();
+
+ function.addParameter(clientId);
+ function.addParameter(options);
+ writer.write(function.toString());
}
public String getListStyles(FacesContext facesContext, UIComponent component) {
return "";
}
+
+ public String getReadyStateCss() {
+ return "insel_default_state";
+ }
+
+ public String getEditStateCss() {
+ return "insel_edit_state";
+ }
+
+ public String getChangedStateCss() {
+ return "insel_changed_state";
+ }
+
+ public String getNoneCss() {
+ return "rf-is-none";
+ }
}
Modified: branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss 2010-09-06 13:40:47 UTC (rev 19121)
+++ branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss 2010-09-06 15:37:00 UTC (rev 19122)
@@ -1,6 +1,7 @@
input.rf-ii-f {
background-image: none;
background-color : '#{richSkin.editBackgroundColor}';
+ /*TODO: seems these styles are incorrect*/
border-bottom-width : 10px;
border-bottom-style: solid;
border-bottom-color: '#{richSkin.editBackgroundColor}';
Modified: branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss 2010-09-06 13:40:47 UTC (rev 19121)
+++ branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss 2010-09-06 15:37:00 UTC (rev 19122)
@@ -1,45 +1,216 @@
-.insel_default_state{ display : inline-block; position : relative; white-space : nowrap; background-color : #f1f1f1/*editorBackgroundColor*/; border-bottom : 1px dashed #000000/*generalTextColor*/; padding-left : 3px; padding-right : 3px;}
-.insel_changed_state{ background-image:url(images/mark_changed.gif); background-position : top left; background-repeat : no-repeat;}
+input.insel_field {
+ background : '#{richSkin.editBackgroundColor}';
+ padding : 0px 0px 0px 0px;
+ border : 0px;
+ margin : 0px;
+ width : 112px;
+ background-image:"url(#{resource['org.richfaces:mark_list.gif']})";
+ background-position : center right;
+ background-repeat : no-repeat;
+ font-family:inherit;
+ font-size : inherit;
+}
-.insel_edit_state{ position : absolute; top : 0px; left : 0px; width : 100px; display : inline-block;}
-.insel_field{ background : #FBFF8E/*editBackgroundColor*/; padding : 0px 0px 0px 0px; border : 0px; margin : 0px; width : 112px; background-image:url(images/mark_list.gif); background-position : center right; background-repeat : no-repeat;}
+.rf-is-none {
+ display: none;
+}
-.insel_btn{
- background : url(images/bg_btn.png) top repeat-x #C7D7EC; /*gradient - from generalBackgroundColor to tabBackgroundColor, background-color - tabBackgroundColor*/
- border : 1px outset #BED6F8; /*panelBorderColor*/
+.insel_font {
+}
+
+.insel_default_state {
+ display : inline-block;
+ position : relative;
+ white-space : nowrap;
+ background-color : '#{richSkin.editBackgroundColor}';
+ border-bottom-width : 1px;
+ border-bottom-style : dashed;
+ border-bottom-color : '#{richSkin.generalTextColor}';
+ padding-left : 3px;
+ padding-right : 3px;
+}
+
+.insel_changed_state {
+ background-image : "url(#{resource['org.richfaces:mark_changed.gif']})";
+ background-position : top left;
+ background-repeat : no-repeat;
+}
+
+.insel_edit_state {
+ position : absolute;
+ top : 0px;
+ left : 0px;
+ width : 100px;
+ display : inline-block;
+}
+
+.insel_field {
+ background-color : '#{richSkin.editBackgroundColor}';
+ padding : 0px 0px 0px 0px;
+ border : 0px;
+ margin : 0px;
+ width : 112px;
+ background-image: "url(#{resource['org.richfaces:mark_list.gif']})";
+ background-position : center right;
+ background-repeat : no-repeat;
+}
+
+.insel_btn {
+ background-image : "url(#{resource['org.richfaces.renderkit.html.images.InplaceComponentButtonGradientImage']})";
+ background-position : top;
+ background-repeat: repeat-x;
+ background-color: '#{richSkin.tabBackgroundColor}';
+ border-width : 1px;
+ border-style : outset;
+ border-color : '#{richSkin.panelBorderColor}';
padding : 0px;
- margin : 0px;}
-.insel_btn_press{
- background : url(images/bg_press.png) top repeat-x #C7D7EC; /*gradient - from tabBackgroundColor to generalBackgroundColor, background-color - tabBackgroundColor*/
- border : 1px inset #BED6F8; /*panelBorderColor*/
+ margin : 0px;
+}
+
+.insel_btn_press {
+ background-image : "url(#{resource['org.richfaces.renderkit.html.images.InplaceComponentPressButtonGradientImage']})";
+ background-position : top;
+ background-repeat : repeat-x;
+ background-color : '#{richSkin.tabBackgroundColor}';
+ border-width : 1px;
+ border-style : inset;
+ border-color : '#{richSkin.panelBorderColor}';
padding : 0px;
- margin : 0px;}
-.insel_btn_set{ position : absolute; top:0px; left : 112px; white-space : nowrap}
+ margin : 0px;
+}
+
+.insel_btn_set {
+ position : absolute;
+ top : 0px;
+ left : 112px;
+ white-space : nowrap;
+}
-.insel_list_cord{ position : relative; font-size : 0px;d@isplay : none}/*DDL is hidden!!!!!*/
-.insel_list_position{ position : absolute; top: 0px; left: -1px; }
-.insel_list_decoration{ border : 1px solid #A6A6A6 /*panelBorderColor*/; padding : 0px; background : #FBFF8E; /*editorBackgroundColor*/}
-.insel_list_scroll{ overflow : auto; overflow-x : hidden; height : 100px;}
-.insel_option{ padding : 2px; white-space : nowrap; background : #FBFF8E /*editorBackgroundColor*/; cursor : default;}
-.insel_select{ padding : 1px; width : 100%; background-color: #DFE8F6; border : 1px dotted #a3bae9;/*generalTextColor*/}
-.insel_width_list{ width : 250px;}
+.insel_list_cord {
+ position : absolute;
+ font-family:inherit;
+ font-size : inherit;
+}
+.insel_list_position {
+ position : absolute;
+ top: 0px;
+ left: -1px;
+}
-.insel_list_cord{ position : relative; font-size : 0px;d@isplay : none}/*DDL is hidden!!!!!*/
-.insel_list_decoration{ border : 1px solid #A6A6A6 /*panelBorderColor*/; padding : 0px; background : #FFFFFF; /*tableBackgroundColor*/}
-.insel_list_scroll{ overflow : auto; overflow-x : hidden;}
-.insel_option{ padding : 2px; white-space : nowrap; cursor : default;}
-.insel_select{ padding : 1px; width : 100%; background-color: #DFE8F6; border : 1px dotted #a3bae9;/*generalTextColor*/}
+.insel_list_decoration {
+ border-width : 1px;
+ border-style : solid;
+ border-color : '#{richSkin.panelBorderColor}';
+ padding : 0px;
+ display: inline-block;
+ width: 100%;
+ background-color : '#{richSkin.editBackgroundColor}';
+}
+.insel_list_scroll {
+ overflow : auto;
+ overflow-x : hidden;
+ height : 100px;
+ display: inline-block;
+ width: 100%;
+}
+.insel_option {
+ padding : 2px;
+ white-space : nowrap;
+ background-color : '#{richSkin.editBackgroundColor}';
+ cursor : default;
+ display : inline-block;
+ width : 100%;
+}
-.insel_btn_preposition { position : absolute; top : 0px; right : 0px; wigth : 1px; height : 1px;}
-.insel_btn_position { position : absolute; top : 0px; left : 0px; white-space : nowrap;}
+.insel_select {
+ padding : 1px;
+ width : 100%;
+ background-color: #DFE8F6; /*get from skin???*/
+ border-width : 1px;
+ border-style : dotted;
+ border-color : '#{richSkin.generalTextColor}';
+}
-.insel_btn_shadow {position: relative; padding : 6px 6px 6px 6px; top : -6px; right : -6px;}
-.insel_shadow {position: relative; padding : 6px 6px 6px 6px; top : -6px; left : -6px;}
+.insel_width_list {
+ width : 250px;
+}
-.insel_shadow_t {background: url(images/bg_shadow.png) top left; position: absolute; width: 6px; top: 0px; bottom: 6px; left : 0px}
-.insel_shadow_l {background: url(images/bg_shadow.png) bottom left; position: absolute; height: 6px; bottom: 0px; left: 0px; right: 6px;}
-.insel_shadow_r {background: url(images/bg_shadow.png) bottom right; position: absolute; width: 6px; top: 6px; bottom: 0px; right: 0px;}
-.insel_shadow_b {background: url(images/bg_shadow.png) right top; position: absolute; height: 6px; top: 0px; left: 6px; right: 0px;}
\ No newline at end of file
+.insel_select {
+ padding : 1px;
+ width : 100%;
+ background-color: #DFE8F6;
+ border-width : 1px;
+ border-style : dotted;
+ border-color : '#{richSkin.generalTextColor}';
+}
+
+.insel_btn_preposition {
+ position : absolute;
+ top : 0px;
+ right : 0px;
+ wigth : 1px;
+ height : 1px;
+}
+
+.insel_btn_position {
+ position : absolute;
+ top : 0px;
+ left : 0px;
+ white-space : nowrap;
+}
+
+.insel_btn_shadow {
+ position: relative;
+ padding : 6px 6px 6px 6px;
+ top : -6px;
+ right : -6px;
+}
+
+.insel_shadow {
+ display: inline-block;
+ width: 100%;
+ position: relative;
+ padding : 6px 6px 6px 6px;
+ top : -6px; left : -6px;
+}
+
+.insel_shadow_t {
+ background-image : "url(#{resource['org.richfaces:bg_shadow.png']})";
+ background-position : top left;
+ position: absolute;
+ width: 6px;
+ top: 0px;
+ bottom: 6px;
+ left : 0px
+}
+.insel_shadow_l {
+ background-image : "url(#{resource['org.richfaces:bg_shadow.png']})";
+ background-position : bottom left;
+ position : absolute;
+ height : 6px;
+ bottom : 0px;
+ left : 0px;
+ right : 6px;
+}
+.insel_shadow_r {
+ background : "url(#{resource['org.richfaces:bg_shadow.png']})";
+ background-position : bottom right;
+ position : absolute;
+ width : 6px;
+ top : 6px;
+ bottom : 0px;
+ right : 0px;
+}
+
+.insel_shadow_b {
+ background : "url(#{resource['org.richfaces:bg_shadow.png']})";
+ background-position : right top;
+ position: absolute;
+ height : 6px;
+ top: 0px;
+ left : 6px;
+ right : 0px;
+}
\ No newline at end of file
Modified: branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2010-09-06 13:40:47 UTC (rev 19121)
+++ branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2010-09-06 15:37:00 UTC (rev 19122)
@@ -0,0 +1,9 @@
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.InplaceSelect = function(id, options) {
+
+ }
+
+})(jQuery, window.RichFaces);
Modified: branches/RF-8992/ui/input/ui/src/main/templates/inplaceSelect.template.xml
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-09-06 13:40:47 UTC (rev 19121)
+++ branches/RF-8992/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-09-06 15:37:00 UTC (rev 19122)
@@ -36,73 +36,69 @@
<span id="#{clientId}" class="#{getReadyStyleClass(component, inplaceState)}"
cdk:passThroughWithExclusions="id class">
- <span id="#{clientId}:label" class="rf-ii-lbl">
+
+ <span id="#{clientId}:label" class="rf-is-lbl">
#{inplaceValue}
</span>
- <input id="#{clientId}:focus" type="image"
- style="position: absolute; top: 0px; left: 0px; outline-style: none;"
- class="rf-ii-none" />
- <span id="#{clientId}:edit" class="#{getEditStyleClass(component, inplaceState)}">
+
+ <input id="#{clientId}:focus" type="image" style="position: absolute; top: 0px; left: 0px; outline-style: none;" class="rf-is-none" />
+
+ <span id="#{clientId}:edit" class="#{getEditStyleClass(component, inplaceState)}"
+ style="display: inline-block;">
<input id="#{clientId}:input" autocomplete="off" name="#{clientId}"
type="text" value="#{getInputValue(facesContext, component)}"
- class="rf-ii-f" style="width: #{component.attributes['inputWidth']};"
+ class="insel_field" style="width: #{component.attributes['inputWidth']};"
cdk:passThrough="tabIndex" readonly="readonly">
<cdk:call expression="renderInputHandlers(facesContext, component);" />
</input>
<c:if test="#{component.attributes['showControls']}">
- <span class="rf-ii-btn-prepos">
- <span class="rf-ii-btn-pos">
- <span id="#{clientId}:btnshadow" class="rf-ii-btn-shadow">
- <span class="rf-ii-btn-shadow-t"></span>
- <span class="rf-ii-btn-shadow-l"></span>
- <span class="rf-ii-btn-shadow-r"></span>
- <span class="rf-ii-btn-shadow-b"></span>
+ <span class="insel_btn_preposition">
+ <span class="insel_btn_position">
+ <span id="#{clientId}:btnshadow" class="insel_shadow">
- <span id="#{clientId}:btn" style="position : relative">
+ <span class="insel_shadow_t"></span>
+ <span class="insel_shadow_l"></span>
+ <span class="insel_shadow_r"></span>
+ <span class="insel_shadow_b"></span>
+
+ <span id="#{clientId}:btn" style="position : relative;">
<input type="image" id="#{clientId}:okbtn"
src="#{getResourcePath(facesContext, 'org.richfaces/ico_ok.gif')}"
- class="rf-ii-btn" onmousedown="this.className='rf-ii-btn-p'"
- onmouseout="this.className='rf-ii-btn'" onmouseup="this.className='rf-ii-btn'" />
+ class="insel_btn" onmousedown="this.className='insel_btn_press'"
+ onmouseout="this.className='insel_btn_press'" onmouseup="this.className='insel_btn'" />
<input type="image" id="#{clientId}:cancelbtn"
src="#{getResourcePath(facesContext,'org.richfaces/ico_cancel.gif')}"
- class="rf-ii-btn" onmousedown="this.className='rf-ii-btn-press'"
- onmouseout="this.className='rf-ii-btn'" onmouseup="this.className='rf-ii-btn'" />
+ class="insel_btn" onmousedown="this.className='insel_btn_press'"
+ onmouseout="this.className='insel_btn_press'" onmouseup="this.className='insel_btn'" />
<br />
</span>
+
</span>
</span>
</span>
</c:if>
-
+ <br/>
<span class="insel_list_cord">
- <span class="insel_shadow">
- <span class="insel_shadow_t">
- <span class="insel_shadow_l"></span>
- <span class="insel_shadow_r"></span>
- <span class="insel_shadow_b"></span>
- <span class="insel_list_decoration">
- <span class="insel_list_scroll">
- <span class="insel_option insel_font" onmouseout="this.className='insel_option insel_font'"
- onmouseover="this.className='insel_option insel_font insel_select'">Option 1</span>
- <span class="insel_option insel_font" onmouseout="this.className='insel_option insel_font'"
- onmouseover="this.className='insel_option insel_font insel_select'">Option 2</span>
- <span class="insel_option insel_font" onmouseout="this.className='insel_option insel_font'"
- onmouseover="this.className='insel_option insel_font insel_select'">Option 3</span>
- <span class="insel_option insel_font" onmouseout="this.className='insel_option insel_font'"
- onmouseover="this.className='insel_option insel_font insel_select'">Option 4</span>
- <span class="insel_option insel_font" onmouseout="this.className='insel_option insel_font'"
- onmouseover="this.className='insel_option insel_font insel_select'">Option 6</span>
- <span class="insel_option insel_font" onmouseout="this.className='insel_option insel_font'"
- onmouseover="this.className='insel_option insel_font insel_select'">Option 7</span>
- <span class="insel_option insel_font" onmouseout="this.className='insel_option insel_font'"
- onmouseover="this.className='insel_option insel_font insel_select'">Option 8</span>
- <span class="insel_option insel_font" onmouseout="this.className='insel_option insel_font'"
- onmouseover="this.className='insel_option insel_font insel_select'">Option 9</span>
- <span class="insel_option insel_font" onmouseout="this.className='insel_option insel_font'"
- onmouseover="this.className='insel_option insel_font insel_select'">Option 0</span>
+ <span class="insel_list_position insel_width_list">
+ <span class="insel_shadow">
+ <span class="insel_shadow_t"></span>
+ <span class="insel_shadow_l"></span>
+ <span class="insel_shadow_r"></span>
+ <span class="insel_shadow_b"></span>
+ <span class="insel_list_decoration">
+ <span class="insel_list_scroll">
+ <span class="insel_option insel_font">Option 1</span>
+ <br/>
+ <span class="insel_option insel_font">Option 2</span>
+ <br/>
+ <span class="insel_option insel_font">Option 3</span>
+ <br/>
+ <span class="insel_option insel_font">Option 4</span>
+ <br/>
</span>
</span>
</span>
+
</span>
</span>
</span>
14 years, 4 months
JBoss Rich Faces SVN: r19121 - in branches/RF-7560: core/impl/src/main/java/org/richfaces/application and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-09-06 09:40:47 -0400 (Mon, 06 Sep 2010)
New Revision: 19121
Added:
branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/view/facelets/TagHandlerUtils.java
Modified:
branches/RF-7560/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationServiceHelper.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/application/CoreConfiguration.java
branches/RF-7560/core/impl/src/test/java/org/richfaces/resource/ResourceHandlerImplTest.java
branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/ActionListenerHandler.java
branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/AjaxHandler.java
branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/LazyActionListener.java
branches/RF-7560/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerRenderTest.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java
Log:
RF-7560
Modified: branches/RF-7560/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationServiceHelper.java
===================================================================
--- branches/RF-7560/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationServiceHelper.java 2010-09-03 18:18:05 UTC (rev 19120)
+++ branches/RF-7560/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationServiceHelper.java 2010-09-06 13:40:47 UTC (rev 19121)
@@ -31,6 +31,8 @@
*/
public final class ConfigurationServiceHelper {
+ private ConfigurationServiceHelper() {}
+
public static final Boolean getBooleanConfigurationValue(FacesContext facesContext, Enum<?> key) {
return ServiceTracker.getService(ConfigurationService.class).getBooleanValue(facesContext, key);
}
Modified: branches/RF-7560/core/impl/src/main/java/org/richfaces/application/CoreConfiguration.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/application/CoreConfiguration.java 2010-09-03 18:18:05 UTC (rev 19120)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/application/CoreConfiguration.java 2010-09-06 13:40:47 UTC (rev 19121)
@@ -22,7 +22,6 @@
package org.richfaces.application;
import org.richfaces.application.configuration.ConfigurationItem;
-import org.richfaces.skin.Skin;
/**
* @author Nick Belaevski
@@ -49,7 +48,7 @@
* Name of web application init parameter for current skin . Can be simple
* String for non-modified name, or EL-expression for calculate current
* skin. If EL evaluated to <code>String</code> - used as skin name, if to
- * instance of {@link Skin } - used this instance. by default -
+ * instance of {@link org.richfaces.Skin } - used this instance. by default -
* "org.richfaces.skin"
*/
@ConfigurationItem(names = SKIN_PARAM_NAME)
Modified: branches/RF-7560/core/impl/src/test/java/org/richfaces/resource/ResourceHandlerImplTest.java
===================================================================
--- branches/RF-7560/core/impl/src/test/java/org/richfaces/resource/ResourceHandlerImplTest.java 2010-09-03 18:18:05 UTC (rev 19120)
+++ branches/RF-7560/core/impl/src/test/java/org/richfaces/resource/ResourceHandlerImplTest.java 2010-09-06 13:40:47 UTC (rev 19121)
@@ -50,6 +50,8 @@
import org.richfaces.application.ServicesFactory;
import org.richfaces.application.ServicesFactoryImpl;
import org.richfaces.application.Uptime;
+import org.richfaces.application.configuration.ConfigurationService;
+import org.richfaces.application.configuration.ConfigurationServiceImpl;
import org.richfaces.util.Util;
import com.gargoylesoftware.htmlunit.Cache;
@@ -250,6 +252,7 @@
injector.setInstance(org.richfaces.cache.Cache.class,mockCache);
injector.setInstance(Uptime.class, new Uptime());
injector.setInstance(DependencyInjector.class, new DependencyInjectionServiceImpl());
+ injector.setInstance(ConfigurationService.class, new ConfigurationServiceImpl());
}
}));
Copied: branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/view/facelets/TagHandlerUtils.java (from rev 19094, trunk/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java)
===================================================================
--- branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/view/facelets/TagHandlerUtils.java (rev 0)
+++ branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/view/facelets/TagHandlerUtils.java 2010-09-06 13:40:47 UTC (rev 19121)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.view.facelets;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.view.AttachedObjectHandler;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public final class TagHandlerUtils {
+
+ // TODO - is that implementation dependency?
+ private static final String JAVAX_FACES_RETARGETABLE_HANDLERS = "javax.faces.RetargetableHandlers";
+
+ private TagHandlerUtils() {
+ //utility class constructor
+ }
+
+ public static List<AttachedObjectHandler> getOrCreateRetargetableHandlersList(UIComponent component) {
+ Map<String, Object> attrs = component.getAttributes();
+ @SuppressWarnings({
+ "unchecked"}) List<AttachedObjectHandler> list =
+ (List<AttachedObjectHandler>) attrs.get(JAVAX_FACES_RETARGETABLE_HANDLERS);
+
+ if (list == null) {
+ list = new ArrayList<AttachedObjectHandler>();
+ attrs.put(JAVAX_FACES_RETARGETABLE_HANDLERS, list);
+ }
+
+ return list;
+ }
+
+ public static <T> Class<? extends T> loadClass(String className, Class<T> type)
+ throws ClassNotFoundException, ClassCastException {
+
+ ClassLoader ccl = Thread.currentThread().getContextClassLoader();
+ Class<?> loadedClass = Class.forName(className, false, ccl);
+
+ return loadedClass.asSubclass(type);
+ }
+
+}
Modified: branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/ActionListenerHandler.java
===================================================================
--- branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/ActionListenerHandler.java 2010-09-03 18:18:05 UTC (rev 19120)
+++ branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/ActionListenerHandler.java 2010-09-06 13:40:47 UTC (rev 19121)
@@ -40,6 +40,8 @@
import javax.faces.view.facelets.TagException;
import javax.faces.view.facelets.TagHandler;
+import org.richfaces.view.facelets.TagHandlerUtils;
+
/**
* @author Nick Belaevski
*
Modified: branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/AjaxHandler.java
===================================================================
--- branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/AjaxHandler.java 2010-09-03 18:18:05 UTC (rev 19120)
+++ branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/AjaxHandler.java 2010-09-06 13:40:47 UTC (rev 19121)
@@ -47,6 +47,7 @@
import org.ajax4jsf.component.behavior.AjaxBehavior;
import org.richfaces.component.AbstractAttachQueue;
+import org.richfaces.view.facelets.TagHandlerUtils;
import org.richfaces.view.facelets.html.BehaviorStack.BehaviorInfo;
import org.richfaces.view.facelets.tag.AjaxBehaviorRule;
Modified: branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/LazyActionListener.java
===================================================================
--- branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/LazyActionListener.java 2010-09-03 18:18:05 UTC (rev 19120)
+++ branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/LazyActionListener.java 2010-09-06 13:40:47 UTC (rev 19121)
@@ -32,6 +32,7 @@
import org.richfaces.cdk.annotations.Event;
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.annotations.TagType;
+import org.richfaces.view.facelets.TagHandlerUtils;
/**
* @author Nick Belaevski
Modified: branches/RF-7560/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerRenderTest.java
===================================================================
--- branches/RF-7560/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerRenderTest.java 2010-09-03 18:18:05 UTC (rev 19120)
+++ branches/RF-7560/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerRenderTest.java 2010-09-06 13:40:47 UTC (rev 19121)
@@ -57,12 +57,12 @@
HtmlElement previous = getPreviousButton(page, scrollerId);
assertEquals("span", previous.getNodeName());
- assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", previous.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", previous.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
// currently selected digital button
HtmlElement dc1 = getDigitalButton(page, scrollerId, 1);
assertEquals("span", dc1.getNodeName());
- assertEquals("rf-ds-dtl rf-ds-cur", dc1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("rf-ds-dtl rf-ds-cur", dc1.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
// digital buttons
HtmlElement d2 = getDigitalButton(page, scrollerId, 2);
@@ -88,8 +88,8 @@
// next/fastForward/last buttons with arrows
HtmlElement next = getNextButton(page, scrollerId);
assertEquals("a", next.getNodeName());
- assertEquals("rf-ds-btn rf-ds-r", next.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
- assertEquals("javascript:void(0);", next.getAttribute(HTML.HREF_ATTR));
+ assertEquals("rf-ds-btn rf-ds-r", next.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
+ assertEquals("javascript:void(0);", next.getAttribute(HtmlConstants.HREF_ATTR));
HtmlElement fastForward = getFastForwardButton(page, scrollerId);
assertEquals("a", fastForward.getNodeName());
@@ -151,12 +151,12 @@
HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
assertEquals("span", currentDigital1.getNodeName());
- assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
// if scroller inside dataTable has switched
HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
assertEquals("span", currentDigital2.getNodeName());
- assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
// check if page has switched
assertEquals(i + " page content", getCurrentPageContent(page, i));
@@ -171,12 +171,12 @@
HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
assertEquals("span", currentDigital1.getNodeName());
- assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
// if scroller inside dataTable has switched
HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
assertEquals("span", currentDigital2.getNodeName());
- assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
// check if page has switched
assertEquals(i + " page content", getCurrentPageContent(page, i));
@@ -198,12 +198,12 @@
next.click();
HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
assertEquals("span", currentDigital2.getNodeName());
- assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
// if scroller outside dataTable has switched
HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
assertEquals("span", currentDigital1.getNodeName());
- assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
// check if page has switched
assertEquals(i + " page content", getCurrentPageContent(page, i));
@@ -218,12 +218,12 @@
HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
assertEquals("span", currentDigital2.getNodeName());
- assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
// if scroller inside dataTable has switched
HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
assertEquals("span", currentDigital1.getNodeName());
- assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
// check if page has switched
assertEquals(i + " page content", getCurrentPageContent(page, i));
@@ -443,7 +443,7 @@
assertEquals("rf-ds-btn rf-ds-r", last.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
assertEquals("a", next.getNodeName());
- assertEquals("rf-ds-btn rf-ds-r", next.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("rf-ds-btn rf-ds-r", next.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
fastForward = getFastForwardButton(page, secondScrollerId);
last = getFastForwardButton(page, secondScrollerId);
@@ -456,7 +456,7 @@
assertEquals("rf-ds-btn rf-ds-r", last.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
assertEquals("a", next.getNodeName());
- assertEquals("rf-ds-btn rf-ds-r", next.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("rf-ds-btn rf-ds-r", next.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
//check if left buttons is disabled
HtmlElement fastRewind = getFastRewindButton(page, firstScrollerId);
@@ -470,7 +470,7 @@
assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", first.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
assertEquals("span", previous.getNodeName());
- assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", previous.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", previous.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
fastRewind = getFastRewindButton(page, secondScrollerId);
first = getFirstButton(page, secondScrollerId);
@@ -480,10 +480,10 @@
assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", fastRewind.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
assertEquals("span", first.getNodeName());
- assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", first.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", first.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
assertEquals("span", previous.getNodeName());
- assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", previous.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", previous.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
}
private void checkLastPageButtons(HtmlPage page, String firstScrollerId, String secondScrollerId) throws Exception {
@@ -499,7 +499,7 @@
assertEquals("rf-ds-btn rf-ds-r rf-ds-dis", last.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
assertEquals("span", next.getNodeName());
- assertEquals("rf-ds-btn rf-ds-r rf-ds-dis", next.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("rf-ds-btn rf-ds-r rf-ds-dis", next.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
fastForward = getFastForwardButton(page, secondScrollerId);
@@ -513,7 +513,7 @@
assertEquals("rf-ds-btn rf-ds-r rf-ds-dis", last.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
assertEquals("span", next.getNodeName());
- assertEquals("rf-ds-btn rf-ds-r rf-ds-dis", next.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("rf-ds-btn rf-ds-r rf-ds-dis", next.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
//check if left buttons is enabled
HtmlElement fastRewind = getFastRewindButton(page, firstScrollerId);
@@ -527,7 +527,7 @@
assertEquals("rf-ds-btn rf-ds-l", first.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
assertEquals("a", previous.getNodeName());
- assertEquals("rf-ds-btn rf-ds-l", previous.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("rf-ds-btn rf-ds-l", previous.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
fastRewind = getFastRewindButton(page, secondScrollerId);
first = getFirstButton(page, secondScrollerId);
@@ -540,7 +540,7 @@
assertEquals("rf-ds-btn rf-ds-l", first.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
assertEquals("a", previous.getNodeName());
- assertEquals("rf-ds-btn rf-ds-l", previous.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("rf-ds-btn rf-ds-l", previous.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
}
private String getCurrentPageContent(HtmlPage page, int i) throws Exception {
Modified: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java 2010-09-03 18:18:05 UTC (rev 19120)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java 2010-09-06 13:40:47 UTC (rev 19121)
@@ -22,10 +22,6 @@
package org.richfaces.view.facelets.html;
-import org.richfaces.event.ChangeExpandEvent;
-import org.richfaces.event.ChangeExpandListener;
-import org.richfaces.event.ChangeExpandSource;
-
import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -33,6 +29,10 @@
import javax.faces.view.facelets.FaceletContext;
import javax.faces.view.facelets.TagConfig;
+import org.richfaces.event.ChangeExpandEvent;
+import org.richfaces.event.ChangeExpandListener;
+import org.richfaces.event.ChangeExpandSource;
+
/**
*
* @author akolonitsky
14 years, 4 months
JBoss Rich Faces SVN: r19120 - in branches/RF-7560: cdk/generator/src/main/java/org/richfaces/cdk/generate/taglib and 43 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-09-03 14:18:05 -0400 (Fri, 03 Sep 2010)
New Revision: 19120
Added:
branches/RF-7560/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml
branches/RF-7560/examples/output-demo/src/main/webapp/qunit/collapsiblePanel.xhtml
branches/RF-7560/examples/output-demo/src/main/webapp/resources/tests/richfaces-collapsible-panel-qunit.js
branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/event/
branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java
branches/RF-7560/ui/iteration/ui/src/main/templates/buttons.template.include
branches/RF-7560/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandEvent.java
branches/RF-7560/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandListener.java
branches/RF-7560/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandSource.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/UICollapsiblePanel.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionChangeExpandListener.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/CollapsiblePanelTagHandler.java
branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js
branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js
branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss
branches/RF-7560/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelItemTest.java
Removed:
branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java
branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java
Modified:
branches/RF-7560/
branches/RF-7560/cdk/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java
branches/RF-7560/cdk/generator/src/main/script/SchemaProcessorNamespaceContext.groovy
branches/RF-7560/core/api/src/main/java/org/ajax4jsf/javascript/JSEncoder.java
branches/RF-7560/core/api/src/main/java/org/richfaces/application/MessageFactory.java
branches/RF-7560/core/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/VersionBean.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/application/MessageFactoryImpl.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java
branches/RF-7560/core/impl/src/main/resources/META-INF/resources/richfaces.js
branches/RF-7560/core/impl/src/test/java/org/richfaces/resource/ResourceHandlerImplTest.java
branches/RF-7560/examples/core-demo/src/main/webapp/ajax.xhtml
branches/RF-7560/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java
branches/RF-7560/examples/input-demo/src/main/webapp/autocomplete.xhtml
branches/RF-7560/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml
branches/RF-7560/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml
branches/RF-7560/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-headers-qunit.js
branches/RF-7560/examples/output-demo/src/main/webapp/templates/template.xhtml
branches/RF-7560/examples/richfaces-showcase/src/main/webapp/richfaces/accordion/samples/simple-sample.xhtml
branches/RF-7560/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/simple-sample.xhtml
branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java
branches/RF-7560/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
branches/RF-7560/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
branches/RF-7560/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js
branches/RF-7560/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js
branches/RF-7560/ui/input/ui/src/main/templates/autocomplete.template.xml
branches/RF-7560/ui/input/ui/src/main/templates/inplaceInput.template.xml
branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java
branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java
branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java
branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ControlsState.java
branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java
branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java
branches/RF-7560/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.js
branches/RF-7560/ui/iteration/ui/src/main/templates/datascroller.template.xml
branches/RF-7560/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerBean.java
branches/RF-7560/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerRenderTest.java
branches/RF-7560/ui/iteration/ui/src/test/resources/org/richfaces/renderkit/dataTableTest.xhtml
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractDivPanel.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionItemChangeListener.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java
branches/RF-7560/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
branches/RF-7560/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js
branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss
Log:
Merged revisions 19039,19041,19045,19058,19060,19065-19066,19068-19070,19072,19074,19078,19080-19086,19089,19092,19094,19096-19097,19100,19106-19108 via svnmerge from
https://svn.jboss.org/repos/richfaces/trunk
Property changes on: branches/RF-7560
___________________________________________________________________
Name: svnmerge-integrated
- /trunk:1-19037 /branches/RFPL-754:1-18909 /branches/RFPL-434:1-19024
+ /trunk:1-19119 /branches/RFPL-754:1-18909
Modified: branches/RF-7560/cdk/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java
===================================================================
--- branches/RF-7560/cdk/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/cdk/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -214,10 +214,10 @@
Element attr = tag.addElement("attribute");
addDescription(attr, attribute);
attr.addElement("name").addText(name);
- attr.addElement("type").addText(attribute.getType().getName());
if (attribute.isRequired()) {
attr.addElement("required").addText("true");
}
+ attr.addElement("type").addText(attribute.getType().getName());
return attr;
}
Modified: branches/RF-7560/cdk/generator/src/main/script/SchemaProcessorNamespaceContext.groovy
===================================================================
--- branches/RF-7560/cdk/generator/src/main/script/SchemaProcessorNamespaceContext.groovy 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/cdk/generator/src/main/script/SchemaProcessorNamespaceContext.groovy 2010-09-03 18:18:05 UTC (rev 19120)
@@ -37,7 +37,7 @@
SchemaProcessorNamespaceContext() {
biMap = HashBiMap.create();
biMap.put("http://www.w3.org/2001/XMLSchema", "xs");
- biMap.put("http://richfaces.org/cdk/additional-attributes-info", "cdk-schema-info");
+ biMap.put("http://jboss.org/schema/richfaces/cdk/additional-attributes-info", "cdk-schema-info");
}
@Override
Modified: branches/RF-7560/core/api/src/main/java/org/ajax4jsf/javascript/JSEncoder.java
===================================================================
--- branches/RF-7560/core/api/src/main/java/org/ajax4jsf/javascript/JSEncoder.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/core/api/src/main/java/org/ajax4jsf/javascript/JSEncoder.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -31,13 +31,14 @@
// private char APOSTROPHE[] = { '\\', '\'' };
private static final char[] ENCODE_HEX = "0123456789ABCDEF".toCharArray();
- private static final char[] ENCODE_APOS = "\\'".toCharArray();
private static final char[] ENCODE_QUOT = "\\\"".toCharArray();
private static final char[] ENCODE_LF = "\\n".toCharArray();
+ private static final char[] ENCODE_BC = "\\b".toCharArray();
private static final char[] ENCODE_FF = "\\f".toCharArray();
private static final char[] ENCODE_CR = "\\r".toCharArray();
private static final char[] ENCODE_TAB = "\\t".toCharArray();
private static final char[] ENCODE_BS = "\\\\".toCharArray();
+ private static final char[] ENCODE_FS = "\\/".toCharArray();
// private static final char ENCODE_ESC[] = "\\e".toCharArray();
@@ -47,32 +48,34 @@
public JSEncoder() {}
/**
- * Return true or false wether this encoding can encode the specified
+ * Return true or false whether this encoding/format can encode the specified
* character or not.
* <p>
* This method will return true for the following character range: <br />
* <code>
- * <nobr>#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]</nobr>
+ * <nobr>\b | \f | \t | \r | \n | " | \ | / | [#x20-#xD7FF] | [#xE000-#xFFFD]</nobr>
* </code>
* </p>
*
* @see <a href="http://www.w3.org/TR/REC-xml#charsets">W3C XML 1.0 </a>
+ * @see <a href="http://json.org/">JSON.org</a>
*/
public boolean compile(char c) {
- if ((c == 0x09) || // [\t]
- (c == 0x0a) || // [\n]
- (c == 0x0d) || // [\r](c == 0x22) || // ["]
- (c == 0x22) || // ["]
- (c == 0x27) || // [']
- (c == 0x5c) || // [\]
- (c == 0x03) || // [esc]
- (c == ']') || // ] - to avoid conflicts in CDATA
- (c == '<') || // - escape HTML markup characters
- (c == '>') || // - HTML
- (c == '&') || // - HTML
- (c == '-') || // - HTML comments
- (c < 0x20) || // See <http://www.w3.org/TR/REC-xml#charsets>
- ((c > 0xd7ff) && (c < 0xe000)) || (c > 0xfffd) || (c > 0xff)) {
+ if ((c == '\b') ||
+ (c == '\f') |
+ (c == '\t') ||
+ (c == '\n') ||
+ (c == '\r') ||
+ (c == '"') ||
+ (c == '\\') ||
+ (c == '/') ||
+ (c == ']') || // ] - to avoid conflicts in CDATA
+ (c == '<') || // - escape HTML markup characters
+ (c == '>') || // - HTML
+ (c == '&') || // - HTML
+ (c == '-') || // - HTML comments
+ (c < 0x20) || // See <http://www.w3.org/TR/REC-xml#charsets>
+ ((c > 0xd7ff) && (c < 0xe000)) || (c > 0xfffd) || (c > 0xff)) {
return false;
}
@@ -85,39 +88,36 @@
*/
public char[] encode(char c) {
switch (c) {
- case 0x03 :
- return ENCODE_FF; // (>) [>]
+ case '\b' :
+ return ENCODE_BC;
+
+ case '\f' :
+ return ENCODE_FF;
- case 0x09 :
- return ENCODE_TAB; // (>) [>]
+ case '\t' :
+ return ENCODE_TAB;
- case 0x0a :
- return ENCODE_LF; // (>) [>]
+ case '\n' :
+ return ENCODE_LF;
- case 0x0d :
- return ENCODE_CR; // (>) [>]
+ case '\r' :
+ return ENCODE_CR;
- case 0x22 :
- return ENCODE_QUOT; // (") ["]
+ case '"' :
+ return ENCODE_QUOT;
- case 0x27 :
- return ENCODE_APOS; // (') [']
+ case '\\' :
+ return ENCODE_BS;
- case 0x5c :
- return ENCODE_BS; // (<) [<]
-
+ case '/' :
+ return ENCODE_FS;
+
default : {
- if (c > 0xff) {
- char[] ret = {
- '\\', 'u', ENCODE_HEX[c >> 0xc & 0xf], ENCODE_HEX[c >> 0x8 & 0xf], ENCODE_HEX[c >> 0x4 & 0xf],
- ENCODE_HEX[c & 0xf]
- };
+ char[] ret = {
+ '\\', 'u', ENCODE_HEX[c >> 0xc & 0xf], ENCODE_HEX[c >> 0x8 & 0xf], ENCODE_HEX[c >> 0x4 & 0xf],
+ ENCODE_HEX[c & 0xf]
+ };
- return ret;
- }
-
- char[] ret = {'\\', 'x', ENCODE_HEX[c >> 0x4 & 0xf], ENCODE_HEX[c & 0xf]};
-
return ret;
}
}
Modified: branches/RF-7560/core/api/src/main/java/org/richfaces/application/MessageFactory.java
===================================================================
--- branches/RF-7560/core/api/src/main/java/org/richfaces/application/MessageFactory.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/core/api/src/main/java/org/richfaces/application/MessageFactory.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -35,4 +35,6 @@
public FacesMessage createMessage(FacesContext facesContext, Severity severity, Enum<?> messageKey, Object... args);
+ public String getMessageText(FacesContext facesContext, Enum<?> messageKey, Object... args);
+
}
Modified: branches/RF-7560/core/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java
===================================================================
--- branches/RF-7560/core/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/core/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -123,9 +123,9 @@
* Test method for {@link org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
*/
public void testStringToScript() {
- Object obj = "foo";
+ Object obj = "f \b\r\t\f\n\"'\\/ oo";
- assertEquals("\"foo\"", ScriptUtils.toScript(obj));
+ assertEquals("\"f \\b\\r\\t\\f\\n\\\"'\\\\\\/ oo\"", ScriptUtils.toScript(obj));
}
/**
@@ -260,8 +260,8 @@
public void testAddEncoded() {
StringBuilder buff = new StringBuilder();
- ScriptUtils.addEncoded(buff, "foo\"\'");
- assertEquals("foo\\\"\\\'", buff.toString());
+ ScriptUtils.addEncoded(buff, "foo");
+ assertEquals("foo", buff.toString());
}
/**
Modified: branches/RF-7560/core/impl/src/main/java/org/richfaces/VersionBean.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/VersionBean.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/VersionBean.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -22,16 +22,20 @@
package org.richfaces;
import java.io.IOException;
+import java.io.InputStream;
import java.net.JarURLConnection;
+import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.security.CodeSource;
import java.security.ProtectionDomain;
import java.text.MessageFormat;
import java.util.jar.Attributes;
+import java.util.jar.JarFile;
import java.util.jar.JarInputStream;
import java.util.jar.Manifest;
+import org.ajax4jsf.resource.util.URLToStreamHelper;
import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
@@ -45,9 +49,6 @@
public static final Version VERSION = new Version();
- private static final Logger LOGGER = RichfacesLogger.APPLICATION.getLogger();
-
-
/**
* Class for incapsulate version info.
*
@@ -56,6 +57,8 @@
*/
public static class Version {
+ private static final Logger LOGGER = RichfacesLogger.APPLICATION.getLogger();
+
private static final String UNKNOWN = "";
private String implementationVendor = UNKNOWN;
@@ -125,6 +128,30 @@
if (codeSource != null) {
URL url = codeSource.getLocation();
if (url != null) {
+ InputStream manifestStream = null;
+ try {
+ manifestStream = URLToStreamHelper.urlToStream(new URL(url, JarFile.MANIFEST_NAME));
+ return new Manifest(manifestStream);
+ } catch (MalformedURLException e1) {
+ //that's ok - just log in debug
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug(e1.getMessage(), e1);
+ }
+ } catch (IOException e) {
+ //that's ok - just log in debug
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug(e.getMessage(), e);
+ }
+ } finally {
+ if (manifestStream != null) {
+ try {
+ manifestStream.close();
+ } catch (IOException e) {
+ LOGGER.error(MessageFormat.format("Error closing stream: {0}", e.getMessage()), e);
+ }
+ }
+ }
+
JarInputStream jis = null;
try {
URLConnection urlConnection = url.openConnection();
Modified: branches/RF-7560/core/impl/src/main/java/org/richfaces/application/MessageFactoryImpl.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/application/MessageFactoryImpl.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/application/MessageFactoryImpl.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -40,6 +40,53 @@
*/
public class MessageFactoryImpl implements MessageFactory {
+ protected static interface Factory<T> {
+
+ public T create(ResourceBundle bundle, Enum<?> messageKey, Object... args) throws MissingResourceException;
+
+ }
+
+ private static final Factory<FacesMessage> MESSAGE_FACTORY = new Factory<FacesMessage>() {
+
+ public FacesMessage create(ResourceBundle bundle, Enum<?> messageKey, Object... args)
+ throws MissingResourceException {
+
+ String messageId = messageKey.toString();
+
+ String summary = null;
+ String detail = null;
+
+ try {
+ summary = bundle.getString(messageId);
+ detail = bundle.getString(messageId + "_detail");
+ } catch (MissingResourceException e) {
+ // do nothing
+ }
+
+ if (summary != null) {
+ String formattedSummary = MessageFormat.format(summary, args);
+ String formattedDetail = null;
+
+ if (detail != null) {
+ formattedDetail = MessageFormat.format(detail, args);
+ }
+
+ return new FacesMessage(formattedSummary, formattedDetail);
+ }
+
+ return null;
+ }
+ };
+
+ private static final Factory<String> LABEL_FACTORY = new Factory<String>() {
+
+ public String create(ResourceBundle bundle, Enum<?> messageKey, Object... args) throws MissingResourceException {
+ String pattern = bundle.getString(messageKey.toString());
+ return MessageFormat.format(pattern, args);
+ }
+
+ };
+
private BundleLoader bundleLoader;
public MessageFactoryImpl(BundleLoader bundleLoader) {
@@ -73,26 +120,46 @@
throw new NullPointerException("messageKey");
}
- FacesMessage result = null;
+ FacesMessage result = detectLocalesAndCreate(facesContext, MESSAGE_FACTORY, messageKey, args);
- Locale locale = detectLocale(facesContext);
+ if (result != null) {
+ result.setSeverity(severity);
+ }
+
+ return result;
+ }
+
+ public String getMessageText(FacesContext facesContext, Enum<?> messageKey, Object... args) {
+ String text = detectLocalesAndCreate(facesContext, LABEL_FACTORY, messageKey, args);
+ if (text == null) {
+ text = "???" + messageKey + "???";
+ }
+
+ return text;
+ }
+
+ protected <T> T detectLocalesAndCreate(FacesContext context, Factory<T> factory, Enum<?> messageKey, Object... args) {
+
+ T result = null;
+
+ Locale locale = detectLocale(context);
if (locale != null) {
- result = createMessage(facesContext, severity, locale, messageKey, args);
+ result = create(context, factory, locale, messageKey, args);
}
if (result == null) {
Locale defaultLocale = Locale.getDefault();
if (!defaultLocale.equals(locale)) {
- result = createMessage(facesContext, severity, defaultLocale, messageKey, args);
+ result = create(context, factory, defaultLocale, messageKey, args);
}
}
-
+
return result;
}
-
- protected FacesMessage createMessage(FacesContext context, Severity severity, Locale locale, Enum<?> messageKey,
+
+ protected <T> T create(FacesContext context, Factory<T> factory, Locale locale, Enum<?> messageKey,
Object... args) {
MessageBundle messageBundle = messageKey.getClass().getAnnotation(MessageBundle.class);
@@ -101,41 +168,25 @@
return null;
}
- String messageId = messageKey.toString();
+ T result = null;
- String summary = null;
- String detail = null;
-
try {
ResourceBundle bundle = bundleLoader.getApplicationBundle(context, messageKey, locale);
- summary = bundle.getString(messageId);
- detail = bundle.getString(messageId + "_detail");
+ result = factory.create(bundle, messageKey, args);
} catch (MissingResourceException e) {
// do nothing
}
- if (summary == null) {
+ if (result == null) {
try {
ResourceBundle bundle = bundleLoader.getBundle(messageKey, locale);
- summary = bundle.getString(messageId);
- detail = bundle.getString(messageId + "_detail");
+ result = factory.create(bundle, messageKey, args);
} catch (MissingResourceException e) {
// do nothing
}
}
- if (summary == null) {
- return null;
- }
-
- String formattedSummary = MessageFormat.format(summary, args);
- String formattedDetail = null;
-
- if (detail != null) {
- formattedDetail = MessageFormat.format(detail, args);
- }
-
- return new FacesMessage(severity, formattedSummary, formattedDetail);
+ return result;
}
}
Modified: branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -42,7 +42,9 @@
import org.richfaces.log.RichfacesLogger;
import org.richfaces.renderkit.HtmlConstants;
+import com.google.common.base.Strings;
+
/**
* @author shura
* <p/>
@@ -243,6 +245,10 @@
Set<String> result = new LinkedHashSet<String>(values.length);
for (String value : values) {
+ if (Strings.isNullOrEmpty(value)) {
+ continue;
+ }
+
result.add(value);
}
@@ -250,7 +256,9 @@
} else {
Set<String> areasSet = new LinkedHashSet<String>(5);
- areasSet.add(areasString);
+ if (!Strings.isNullOrEmpty(areasString)) {
+ areasSet.add(areasString);
+ }
return areasSet;
}
Modified: branches/RF-7560/core/impl/src/main/resources/META-INF/resources/richfaces.js
===================================================================
--- branches/RF-7560/core/impl/src/main/resources/META-INF/resources/richfaces.js 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/core/impl/src/main/resources/META-INF/resources/richfaces.js 2010-09-03 18:18:05 UTC (rev 19120)
@@ -128,7 +128,7 @@
//there is the same pattern in server-side code:
//org.ajax4jsf.javascript.ScriptUtils.escapeCSSMetachars(String)
- var CSS_METACHARS_PATTERN = /([#;&,.+*~':"!^$[\]()=>|\/])/g;
+ var CSS_METACHARS_PATTERN = /([#;&,.+*~':"!^$\[\]()=>|\/])/g;
/**
* Escapes CSS meta-characters in string according to
Modified: branches/RF-7560/core/impl/src/test/java/org/richfaces/resource/ResourceHandlerImplTest.java
===================================================================
--- branches/RF-7560/core/impl/src/test/java/org/richfaces/resource/ResourceHandlerImplTest.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/core/impl/src/test/java/org/richfaces/resource/ResourceHandlerImplTest.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -43,6 +43,8 @@
import org.easymock.classextension.EasyMock;
import org.jboss.test.faces.AbstractFacesTest;
import org.jboss.test.faces.htmlunit.LocalWebClient;
+import org.richfaces.application.DependencyInjectionServiceImpl;
+import org.richfaces.application.DependencyInjector;
import org.richfaces.application.Module;
import org.richfaces.application.ServiceTracker;
import org.richfaces.application.ServicesFactory;
@@ -247,6 +249,7 @@
injector.setInstance(ResourceCodec.class,mockedCodec);
injector.setInstance(org.richfaces.cache.Cache.class,mockCache);
injector.setInstance(Uptime.class, new Uptime());
+ injector.setInstance(DependencyInjector.class, new DependencyInjectionServiceImpl());
}
}));
Modified: branches/RF-7560/examples/core-demo/src/main/webapp/ajax.xhtml
===================================================================
--- branches/RF-7560/examples/core-demo/src/main/webapp/ajax.xhtml 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/examples/core-demo/src/main/webapp/ajax.xhtml 2010-09-03 18:18:05 UTC (rev 19120)
@@ -88,7 +88,7 @@
<a:ajax bypassUpdates="true" />
</h:commandLink>
- bypassUpdates="#{true}"
+ bypassUpdates="#{'#'}{true}"
<h:inputText>
<a:ajax bypassUpdates="#{true}" event="keyup" />
</h:inputText>
Modified: branches/RF-7560/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java
===================================================================
--- branches/RF-7560/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -22,6 +22,7 @@
package org.richfaces.demo;
import java.io.Serializable;
+import java.util.Arrays;
import java.util.Locale;
import javax.faces.bean.ManagedBean;
@@ -30,6 +31,8 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import org.richfaces.component.UIAutocomplete;
+
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
@@ -60,7 +63,17 @@
return input.getName().toLowerCase(Locale.US).startsWith(countryNamePrefix);
}
}
+
+ private String mode = "lazyClient";
+ public String getMode() {
+ return mode;
+ }
+
+ public void setMode(String mode) {
+ this.mode = mode;
+ }
+
@ManagedProperty(value = "#{countriesBean}")
private CountriesBean countriesBean;
@@ -69,7 +82,13 @@
}
public Object autocomplete(FacesContext facesContext, UIComponent component, String value) {
- return Collections2.filter(countriesBean.getCountries(), new CountryNamePredicate(value));
+ // for tests when value does not starts with prefix
+ /*String str = value;
+ if (str.charAt(0)=='i') {
+ str = str.substring(1);
+ }*/
+ String v = mode.equals("lazyClient") || mode.equals("client") ? "" : value;
+ return Collections2.filter(countriesBean.getCountries(), new CountryNamePredicate(v.toLowerCase()));
}
}
Modified: branches/RF-7560/examples/input-demo/src/main/webapp/autocomplete.xhtml
===================================================================
--- branches/RF-7560/examples/input-demo/src/main/webapp/autocomplete.xhtml 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/examples/input-demo/src/main/webapp/autocomplete.xhtml 2010-09-03 18:18:05 UTC (rev 19120)
@@ -13,11 +13,17 @@
<h:body style="margin: 30px;">
<h:form id="form">
+ <h:selectOneMenu value="#{autoCompleteBean.mode}" onchange="submit()">
+ <f:selectItem itemValue="lazyClient"/>
+ <f:selectItem itemValue="client"/>
+ <f:selectItem itemValue="cachedAjax"/>
+ <f:selectItem itemValue="ajax"/>
+ </h:selectOneMenu>
<div style="height: 300px; width: 300px; overflow: auto;">Text
block text block text block text block text block text block text
block text block
- <input:autocomplete mode="" minChars="2" autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country" fetchValue="#{country.name}" showButton="true">
+ <input:autocomplete clientFilter="if(subString.length>1) if(value.indexOf(subString)!=-1) return true;" mode="#{autoCompleteBean.mode}" minChars="2" autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country" fetchValue="#{country.name}" showButton="true">
#{country.name} #{country.iso} #{country.domain}
</input:autocomplete>
Modified: branches/RF-7560/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- branches/RF-7560/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-09-03 18:18:05 UTC (rev 19120)
@@ -34,6 +34,10 @@
<from-outcome>accordion</from-outcome>
<to-view-id>/examples/accordion.xhtml</to-view-id>
</navigation-case>
+ <navigation-case>
+ <from-outcome>collapsiblePanel</from-outcome>
+ <to-view-id>/examples/collapsiblePanel.xhtml</to-view-id>
+ </navigation-case>
<!-- QUnit -->
<navigation-case>
@@ -52,5 +56,9 @@
<from-outcome>qunit/accordionHeaders</from-outcome>
<to-view-id>/qunit/accordionHeaders.xhtml</to-view-id>
</navigation-case>
+ <navigation-case>
+ <from-outcome>qunit/collapsiblePanel</from-outcome>
+ <to-view-id>/qunit/collapsiblePanel.xhtml</to-view-id>
+ </navigation-case>
</navigation-rule>
</faces-config>
Copied: branches/RF-7560/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml (from rev 19108, trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml)
===================================================================
--- branches/RF-7560/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml (rev 0)
+++ branches/RF-7560/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml 2010-09-03 18:18:05 UTC (rev 19120)
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:pn="http://richfaces.org/output">
+
+<body>
+<ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="title">Collapsible Panel QUnit</ui:define>
+ <ui:define name="body_head">Collapsible Panel QUnit</ui:define>
+
+ <ui:define name="body">
+ <p>Page</p>
+
+ <h:form id="f">
+ <pn:collapsiblePanel id="panel">
+ <f:facet name="headerExpanded" >
+ header exanded
+ </f:facet>
+ <f:facet name="headerCollapsed" >
+ header collapsed
+ </f:facet>
+
+ Hello!!!
+
+ </pn:collapsiblePanel>
+
+ </h:form>
+ </ui:define>
+</ui:composition>
+</body>
+</html>
+
Modified: branches/RF-7560/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml
===================================================================
--- branches/RF-7560/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml 2010-09-03 18:18:05 UTC (rev 19120)
@@ -26,22 +26,43 @@
<pn:accordionItem header="label 1">
<f:facet name="headerInactive">headerInactive 1</f:facet>
<f:facet name="headerActive">headerActive 1</f:facet>
- <f:facet name="headerDisable">headerDisable 1</f:facet>
+ <f:facet name="header">headerDisable 1</f:facet>
content 1
</pn:accordionItem>
<pn:accordionItem header="label 2" disabled="true">
<f:facet name="headerInactive">headerInactive 2</f:facet>
- <f:facet name="headerActive">headerActive 2</f:facet>
+ <f:facet name="header">headerActive 2</f:facet>
<f:facet name="headerDisable">headerDisable 2</f:facet>
content 2
</pn:accordionItem>
<pn:accordionItem header="label 3">
- <f:facet name="headerInactive">headerInactive 3</f:facet>
+ <f:facet name="header">headerInactive 3</f:facet>
<f:facet name="headerActive">headerActive 3</f:facet>
<f:facet name="headerDisable">headerDisable 3</f:facet>
content 3
</pn:accordionItem>
</pn:accordion>
+
+ <h:outputLink>
+ <pn:toggleControl targetPanel="panel" targetItem="@first" event="click"/>
+ |< first
+ </h:outputLink>
+ |
+ <h:outputLink>
+ <pn:toggleControl targetPanel="panel" targetItem="@prev" event="click"/>
+ <- prev
+ </h:outputLink>
+ |
+ <h:outputLink>
+ <pn:toggleControl targetPanel="panel" targetItem="@next" event="click"/>
+ next ->
+ </h:outputLink>
+ |
+ <h:outputLink>
+ <pn:toggleControl targetPanel="panel" targetItem="@last" event="click"/>
+ last >|
+ </h:outputLink>
+
</h:form>
<p>Result</p>
Copied: branches/RF-7560/examples/output-demo/src/main/webapp/qunit/collapsiblePanel.xhtml (from rev 19108, trunk/examples/output-demo/src/main/webapp/qunit/collapsiblePanel.xhtml)
===================================================================
--- branches/RF-7560/examples/output-demo/src/main/webapp/qunit/collapsiblePanel.xhtml (rev 0)
+++ branches/RF-7560/examples/output-demo/src/main/webapp/qunit/collapsiblePanel.xhtml 2010-09-03 18:18:05 UTC (rev 19120)
@@ -0,0 +1,51 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:pn="http://richfaces.org/output">
+
+<body>
+<ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="scripts">
+ <h:outputScript name="qunit/qunit.js" />
+ <h:outputScript name="qunit/richfaces-qunit.js" />
+
+ <h:outputStylesheet name="qunit/qunit.css" />
+ </ui:define>
+
+ <ui:define name="title">Collapsible Panel QUnit</ui:define>
+ <ui:define name="body_head">Collapsible Panel QUnit</ui:define>
+
+ <ui:define name="body">
+ <p>Page</p>
+
+ <h:form id="f">
+ <pn:collapsiblePanel id="panel" switchType="client">
+ <f:facet name="headerExpanded" >
+ header exanded
+ </f:facet>
+ <f:facet name="headerCollapsed" >
+ header collapsed
+ </f:facet>
+
+ Hello!!!
+
+ </pn:collapsiblePanel>
+
+ </h:form>
+
+ <p>Result</p>
+ <div>
+ <ol id="qunit-tests"></ol>
+
+ <div id="testDiv" style="margin-top:10px; border:1px solid #a0a0a0">Main Test Div</div>
+
+ </div>
+ <h:outputScript name="tests/richfaces-collapsible-panel-qunit.js" />
+ </ui:define>
+</ui:composition>
+</body>
+</html>
+
Modified: branches/RF-7560/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-headers-qunit.js
===================================================================
--- branches/RF-7560/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-headers-qunit.js 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-headers-qunit.js 2010-09-03 18:18:05 UTC (rev 19120)
@@ -25,6 +25,34 @@
var ACCORDION_ID = "f:panel";
+ function testFirst(items) {
+ ok(items[0].__header("act").is(":visible"), "1 item: active visible");
+ ok(!items[0].__header("inact").is(":visible"), "1 item: inactive unvisible");
+ ok(!items[0].__header("dis").is(":visible"), "1 item: disabled unvisible");
+
+ ok(!items[1].__header("act").is(":visible"), "2 item: active visible");
+ ok(!items[1].__header("inact").is(":visible"), "2 item: inactive unvisible");
+ ok(items[1].__header("dis").is(":visible"), "2 item: disabled unvisible");
+
+ ok(!items[2].__header("act").is(":visible"), "3 item: active unvisible");
+ ok(items[2].__header("inact").is(":visible"), "3 item: inactive visible");
+ ok(!items[2].__header("dis").is(":visible"), "3 item: disabled unvisible");
+ }
+
+ function testLast(items) {
+ ok(!items[0].__header("act").is(":visible"), "1 item: active unvisible");
+ ok(items[0].__header("inact").is(":visible"), "1 item: inactive visible");
+ ok(!items[0].__header("dis").is(":visible"), "1 item: disabled unvisible");
+
+ ok(!items[1].__header("act").is(":visible"), "2 item: active visible");
+ ok(!items[1].__header("inact").is(":visible"), "2 item: inactive unvisible");
+ ok(items[1].__header("dis").is(":visible"), "2 item: disabled unvisible");
+
+ ok(items[2].__header("act").is(":visible"), "3 item: active visible");
+ ok(!items[2].__header("inact").is(":visible"), "3 item: inactive unvisible");
+ ok(!items[2].__header("dis").is(":visible"), "3 item: disabled unvisible");
+ }
+
test("RichFaces.ui.Accordion change headers", function () {
var c = RichFaces.$(ACCORDION_ID);
@@ -34,31 +62,38 @@
equals(c.getItems().length, 3, "getItems().length");
var items = c.getItems();
- ok( items[0].__header("active" ).is(":visible"), "1 item: active visible");
- ok(!items[0].__header("inactive").is(":visible"), "1 item: inactive unvisible");
- ok(!items[0].__header("disable" ).is(":visible"), "1 item: disabled unvisible");
+ testFirst(items);
- ok(!items[1].__header("active" ).is(":visible"), "2 item: active unvisible");
- ok(!items[1].__header("inactive").is(":visible"), "2 item: inactive unvisible");
- ok( items[1].__header("disable" ).is(":visible"), "2 item: disabled visible");
+ c.switchToItem(items[2].getName());
+ testLast(items);
- ok(!items[2].__header("active" ).is(":visible"), "3 item: active unvisible");
- ok( items[2].__header("inactive").is(":visible"), "3 item: inactive visible");
- ok(!items[2].__header("disable" ).is(":visible"), "3 item: disabled unvisible");
+ c.switchToItem("@first");
+ testFirst(items);
- c.switchToItem(items[2].getName());
- ok(!items[0].__header("active" ).is(":visible"), "1 item: active unvisible");
- ok( items[0].__header("inactive").is(":visible"), "1 item: inactive visible");
- ok(!items[0].__header("disable" ).is(":visible"), "1 item: disabled unvisible");
+ c.switchToItem("@last");
+ testLast(items);
- ok(!items[1].__header("active" ).is(":visible"), "2 item: active unvisible");
- ok(!items[1].__header("inactive").is(":visible"), "2 item: inactive unvisible");
- ok( items[1].__header("disable" ).is(":visible"), "2 item: disabled visible");
+ c.switchToItem("@prev");
+ testFirst(items);
- ok( items[2].__header("active" ).is(":visible"), "3 item: active visible");
- ok(!items[2].__header("inactive").is(":visible"), "3 item: inactive unvisible");
- ok(!items[2].__header("disable" ).is(":visible"), "3 item: disabled unvisible");
+ c.switchToItem("@next");
+ testLast(items);
+ });
+ test("RichFaces.ui.Accordion change disabled headers", function () {
+ var c = RichFaces.$(ACCORDION_ID);
+
+ ok(c instanceof RichFaces.ui.Accordion, "inctance of RichFaces.ui.Accordion");
+ equals(c.id, ACCORDION_ID, "id");
+
+ equals(c.getItems().length, 3, "getItems().length");
+
+ var items = c.getItems();
+
c.switchToItem(items[0].getName());
+ testFirst(items);
+
+ c.switchToItem(items[1].getName());
+ testFirst(items);
});
});
Copied: branches/RF-7560/examples/output-demo/src/main/webapp/resources/tests/richfaces-collapsible-panel-qunit.js (from rev 19108, trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-collapsible-panel-qunit.js)
===================================================================
--- branches/RF-7560/examples/output-demo/src/main/webapp/resources/tests/richfaces-collapsible-panel-qunit.js (rev 0)
+++ branches/RF-7560/examples/output-demo/src/main/webapp/resources/tests/richfaces-collapsible-panel-qunit.js 2010-09-03 18:18:05 UTC (rev 19120)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+RichFaces.QUnit.run(function() {
+ module("richfaces-collapsible-panel");
+
+ var COLLAPSIBLE_PANEL_ID = "f:panel";
+
+ function handler (msg, returnValue) {
+ return function () {
+ ok(true, msg);
+
+ if (returnValue != undefined) {
+ return returnValue;
+ }
+ };
+ }
+
+ test("RichFaces.ui.CollapsiblePanel test constructor", function () {
+ var c = RichFaces.$(COLLAPSIBLE_PANEL_ID);
+
+ ok(c instanceof RichFaces.ui.CollapsiblePanel, "inctance of RichFaces.ui.CollapsiblePanel");
+ equals(c.id, COLLAPSIBLE_PANEL_ID, "id");
+ // TODO other params
+
+ });
+
+ test("RichFaces.ui.CollapsiblePanel test public api", function () {
+ var c = RichFaces.$(COLLAPSIBLE_PANEL_ID);
+
+ var PUBLIC_API = ["switchPanel"];
+
+ for (var i in PUBLIC_API) {
+ var funcName = PUBLIC_API[i];
+ ok(c[funcName], funcName + " present in component");
+ equals(typeof c[funcName], "function", funcName + "is function");
+ }
+ });
+
+ test("RichFaces.ui.CollapsiblePanel.Events", function () {
+ var componentId = COLLAPSIBLE_PANEL_ID;
+ var c = RichFaces.$(componentId);
+
+ expect(4);
+
+ var beforeswitchHandler = function (event, comp, data) {
+ ok(true, "beforeswitch handler invouked");
+
+ same(data.id, componentId, "component id");
+ same(data.isExpanded, "false", "panel collapsed");
+
+ return true;
+ };
+
+ var beforeswitchHandlerWrapper = RichFaces.Event.bindById(componentId, "beforeswitch", beforeswitchHandler);
+
+ var switchHandler = handler("switch handler invouked", undefined);
+ var switchHandlerWrapper = RichFaces.Event.bindById(componentId, "switch", switchHandler);
+
+ c.switchPanel();
+
+ RichFaces.Event.unbindById(componentId, "beforeswitch", beforeswitchHandlerWrapper);
+ RichFaces.Event.unbindById(componentId, "switch", switchHandlerWrapper);
+
+ c.switchPanel();
+ });
+
+ test("RichFaces.ui.CollapsiblePanel.Events test cancelable", function () {
+ var c = RichFaces.$(COLLAPSIBLE_PANEL_ID);
+
+ expect(2);
+ var beforeswitch1 = RichFaces.Event.bindById(COLLAPSIBLE_PANEL_ID, "beforeswitch", function () {
+ ok(true, "beforeswitch handler invouked");
+
+ return false;
+ });
+
+ var beforeswitch2 = RichFaces.Event.bindById(COLLAPSIBLE_PANEL_ID, "beforeswitch", function () {
+ ok(true, "beforeswitch handler invouked");
+
+ return true;
+ });
+
+ var switchHandler = RichFaces.Event.bindById(COLLAPSIBLE_PANEL_ID, "switch", function () {
+ ok(false, "switch handler should't been invouked");
+ });
+
+ c.switchPanel();
+
+ RichFaces.Event.unbindById(COLLAPSIBLE_PANEL_ID, "beforeswitch", beforeswitch1);
+ RichFaces.Event.unbindById(COLLAPSIBLE_PANEL_ID, "beforeswitch", beforeswitch2);
+ RichFaces.Event.unbindById(COLLAPSIBLE_PANEL_ID, "switch", switchHandler);
+
+ c.switchPanel();
+ });
+});
Modified: branches/RF-7560/examples/output-demo/src/main/webapp/templates/template.xhtml
===================================================================
--- branches/RF-7560/examples/output-demo/src/main/webapp/templates/template.xhtml 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/examples/output-demo/src/main/webapp/templates/template.xhtml 2010-09-03 18:18:05 UTC (rev 19120)
@@ -11,9 +11,161 @@
<meta http-equiv="content-type" content="text/xhtml; charset=UTF-8" />
+ <style type="text/css">
+ * {
+ font-family: verdana
+ }
+
+ .rftp_toptab {
+ display: table-cell;
+ border: 1px solid #A6A6A6;
+ padding: 0px 0px 3px 0px;
+ vertical-align: bottom;
+ background: url(tab_bg.gif) top repeat-x #DAE7F5;
+ }
+
+ .rftp_active_top {
+ border-bottom: 0px;
+ font-weight: bold;
+ padding: 3px 0px 0px 0px;
+ vertical-align: top;
+ background: url(acttab_bg.gif) top repeat-x #C9DBEF;
+ }
+
+ .rftp_active2_top {
+ border-bottom: 0px;
+ font-weight: bold;
+ padding: 3px 0px 0px 0px;
+ vertical-align: top;
+ background: url(acttab2_bg.gif) top repeat-x #FFFFFF;
+ }
+
+ .rftp_toptab_tabline_vis {
+ border: 1px solid #a6a6a6;
+ background: url(tabline_bg.gif) top repeat-x #EEF4FB;
+ border-bottom: 0px;
+ padding-top: 2px;
+ overflow: hidden;
+ height: 23px;
+ white-space: nowrap;
+ position: relative;
+ }
+
+ .rftp_toptab_tabline_dis {
+ border-bottom: 0px;
+ padding-top: 2px;
+ overflow: hidden;
+ height: 25px;
+ white-space: nowrap;
+ position: relative;
+ }
+
+ .rftp_toptab_tabs {
+ display: table;
+ border: 0px;
+ width: 100%;
+ height: 100%;
+ }
+
+ .rftp_toptab_spacer {
+ display: table-cell;
+ border-bottom: 1px solid #A6A6A6;
+ }
+
+ .rftp_horizonttab_tabspacer_width {
+ padding-left: 1px;
+ }
+
+ .rftp_icon {
+ display: table-cell;
+ vertical-align: middle;
+ padding: 0px 5px 0px 5px;
+ }
+
+ .rftp_close {
+ display: table-cell;
+ vertical-align: middle;
+ padding: 0px 3px 0px 15px;
+ }
+
+ .rftp_label {
+ display: table-cell;
+ vertical-align: middle;
+ font-family: verdana;
+ font-size: 11px;
+ }
+
+ .rftp_toptab_scroll_left {
+ background: url(acttab_bg.gif) top repeat-x #C9DBEF;
+ position: absolute;
+ top: 1px;
+ left: 1px;
+ width: 15px;
+ height: 250px;
+ border: 1px solid #a6a6a6;
+ font-weight: bold;
+ text-align: center;
+ font-family: verdana;
+ font-size: 11px;
+ padding-top: 6px;
+ }
+
+ .rftp_toptab_scroll_right {
+ background: url(acttab_bg.gif) top repeat-x #C9DBEF;
+ position: absolute;
+ top: 1px;
+ right: 17px;
+ width: 15px;
+ height: 250px;
+ border: 1px solid #a6a6a6;
+ font-weight: bold;
+ text-align: center;
+ font-family: verdana;
+ font-size: 11px;
+ padding-top: 6px;
+ }
+
+ .rftp_toptab_tabslist {
+ background: url(acttab_bg.gif) top repeat-x #C9DBEF;
+ position: absolute;
+ top: 1px;
+ right: 1px;
+ width: 15px;
+ height: 250px;
+ border: 1px solid #a6a6a6;
+ font-weight: bold;
+ text-align: center;
+ font-family: verdana;
+ font-size: 14px;
+ padding-top: 2px;
+ }
+
+ .rftp_toptab_border {
+ border: 1px solid #A6A6A6;
+ border-top: 0px;
+ height: 2px;
+ background: #C9DBEF;
+ }
+
+ .rftp_toptab_content {
+ border: 1px solid #A6A6A6;
+ border-top: 0px;
+ font-family: verdana;
+ font-size: 11px;
+ padding: 10px;
+ background: #ffffff;
+ }
+
+ .rftp_hidden {
+ display: none
+ }
+ </style>
+
</h:head>
<h:body>
+
+
<ui:insert name="scripts" ></ui:insert>
<table width="100%">
<thead>
@@ -46,6 +198,12 @@
<li><h:commandLink value="accordion" action="accordion" /></li>
</ul>
</li>
+ <li>
+ <p>Collapsible Panel</p>
+ <ul>
+ <li><h:commandLink value="Collapsible Panel" action="collapsiblePanel" /></li>
+ </ul>
+ </li>
</ul>
<p>QUnit</p>
<ul>
@@ -53,6 +211,7 @@
<li><h:commandLink value="togglePanelItem" action="qunit/togglePanelItem" /></li>
<li><h:commandLink value="accordion" action="qunit/accordion" /></li>
<li><h:commandLink value="accordionHeaders" action="qunit/accordionHeaders" /></li>
+ <li><h:commandLink value="collapsiblePanel" action="qunit/collapsiblePanel" /></li>
</ul>
</h:form>
</td>
Modified: branches/RF-7560/examples/richfaces-showcase/src/main/webapp/richfaces/accordion/samples/simple-sample.xhtml
===================================================================
--- branches/RF-7560/examples/richfaces-showcase/src/main/webapp/richfaces/accordion/samples/simple-sample.xhtml 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/examples/richfaces-showcase/src/main/webapp/richfaces/accordion/samples/simple-sample.xhtml 2010-09-03 18:18:05 UTC (rev 19120)
@@ -9,7 +9,7 @@
.rf-ac{
width: 500px;
}
-.rf-aci-c {
+.rf-ac-itm-c {
height: 220px;
}
</style>
Modified: branches/RF-7560/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/simple-sample.xhtml
===================================================================
--- branches/RF-7560/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/simple-sample.xhtml 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/simple-sample.xhtml 2010-09-03 18:18:05 UTC (rev 19120)
@@ -6,7 +6,7 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<style>
-.rf-tgp-i {
+.rf-tgp-itm {
border: 1px solid #{richSkin.panelBorderColor};
padding:5px;
}
Copied: branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/event (from rev 19108, trunk/ui/common/ui/src/main/java/org/richfaces/event)
Deleted: branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java 2010-09-03 08:56:24 UTC (rev 19108)
+++ branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -1,197 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.event;
-
-import javax.el.ELContext;
-import javax.el.ELException;
-import javax.el.MethodExpression;
-import javax.el.MethodNotFoundException;
-import javax.faces.component.StateHolder;
-import javax.faces.component.UIComponentBase;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
-
-/**
- * <p><strong><span
- * class="changed_modified_2_0">MethodExpressionEventListener</span></strong>
- * is a {@link FacesListener} that wraps a {@link
- * MethodExpression}. When it receives a {@link FacesEvent}, it
- * executes a method on an object identified by the {@link
- * MethodExpression}.</p>
- *
- * @author akolonitsky
- * @version 1.0
- *
- */
-public abstract class MethodExpressionEventListener implements FacesListener, StateHolder {
-
- private static final Class<?>[] EVENT_LISTENER_ZERO_ARG_SIG = new Class[] { };
-
- private static final Object[] NO_PARAMS = new Object[0];
-
- // ------------------------------------------------------ Instance Variables
-
- private MethodExpression methodExpressionOneArg = null;
- private MethodExpression methodExpressionZeroArg = null;
-
- private boolean isTransient;
-
- protected MethodExpressionEventListener() {
- }
-
- /**
- * <p><span class="changed_modified_2_0">Construct</span> a {@link
- * FacesListener} that contains a {@link
- * MethodExpression}.<span
- * class="changed_added_2_0">To accomodate method expression targets
- * that take no arguments instead of taking a {@link
- * FacesEvent} argument</span>, the implementation of this
- * class must take the argument <code>methodExpressionOneArg</code>,
- * extract its expression string, and create another
- * <code>MethodExpression</code> whose expected param types match
- * those of a zero argument method. The usage requirements for both
- * of these <code>MethodExpression</code> instances are described in
- * {@link #processEvent}.</span></p>
- *
- * @param methodExpressionOneArg a <code>MethodExpression</code>
- * that points to a method that returns <code>void</code> and takes
- * a single argument of type {@link FacesEvent}.
- */
- protected MethodExpressionEventListener(MethodExpression methodExpressionOneArg) {
-
- super();
- this.methodExpressionOneArg = methodExpressionOneArg;
- FacesContext context = FacesContext.getCurrentInstance();
- ELContext elContext = context.getELContext();
- this.methodExpressionZeroArg = context.getApplication().getExpressionFactory().createMethodExpression(
- elContext, methodExpressionOneArg.getExpressionString(), Void.class, EVENT_LISTENER_ZERO_ARG_SIG);
- }
-
- /**
- * <p>Construct a {@link FacesListener} that contains a {@link MethodExpression}.</p>
- *
- * @param methodExprOneArg
- * @param methodExprZeroArg
- */
- protected MethodExpressionEventListener(MethodExpression methodExprOneArg, MethodExpression methodExprZeroArg) {
-
- super();
- this.methodExpressionOneArg = methodExprOneArg;
- this.methodExpressionZeroArg = methodExprZeroArg;
- }
-
- // ------------------------------------------------------- Event Method
-
- /**
- * <p><span class="changed_modified_2_0">Call</span> through to the
- * {@link MethodExpression} passed in our constructor. <span
- * class="changed_added_2_0">First, try to invoke the
- * <code>MethodExpression</code> passed to the constructor of this
- * instance, passing the argument {@link FacesEvent} as the
- * argument. If a {@link MethodNotFoundException} is thrown, call
- * to the zero argument <code>MethodExpression</code> derived from
- * the <code>MethodExpression</code> passed to the constructor of
- * this instance. If that fails for any reason, throw an {@link
- * AbortProcessingException}, including the cause of the
- * failure.</span></p>
- *
- * @throws NullPointerException {@inheritDoc}
- * @throws AbortProcessingException {@inheritDoc}
- */
- public void processEvent(FacesEvent event) throws AbortProcessingException {
-
- if (event == null) {
- throw new NullPointerException();
- }
- FacesContext context = FacesContext.getCurrentInstance();
- ELContext elContext = context.getELContext();
- // PENDING: The corresponding code in MethodExpressionActionListener
- // has an elaborate message capture, logging, and rethrowing block.
- // Why not here?
- try {
- methodExpressionOneArg.invoke(elContext, new Object[] {event});
- } catch (MethodNotFoundException mnf) {
- if (null != methodExpressionZeroArg) {
-
- try {
- // try to invoke a no-arg version
- methodExpressionZeroArg.invoke(elContext, NO_PARAMS);
- } catch (ELException e) {
- throw new AbortProcessingException(e.getMessage(), e.getCause());
- }
- }
- } catch (ELException e) {
- throw new AbortProcessingException(e.getMessage(), e.getCause());
- }
- }
-
-
- // ------------------------------------------------ Methods from StateHolder
-
-
- /**
- * <p class="changed_modified_2_0">Both {@link MethodExpression}
- * instances described in the constructor must be saved.</p>
- */
- public Object saveState(FacesContext context) {
- if (context == null) {
- throw new NullPointerException();
- }
-
- return new Object[] {
- UIComponentBase.saveAttachedState(context, methodExpressionOneArg),
- UIComponentBase.saveAttachedState(context, methodExpressionZeroArg)
- };
- }
-
-
- /**
- * <p class="changed_modified_2_0">Both {@link MethodExpression}
- * instances described in the constructor must be restored.</p>
- */
- public void restoreState(FacesContext context, Object state) {
-
- if (context == null) {
- throw new NullPointerException();
- }
- if (state == null) {
- return;
- }
-
- methodExpressionOneArg = (MethodExpression) UIComponentBase
- .restoreAttachedState(context, ((Object[]) state)[0]);
- methodExpressionZeroArg = (MethodExpression) UIComponentBase
- .restoreAttachedState(context, ((Object[]) state)[1]);
- }
-
-
- public boolean isTransient() {
- return isTransient;
- }
-
- public void setTransient(boolean newTransientValue) {
- isTransient = newTransientValue;
- }
-}
Copied: branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java (from rev 19108, trunk/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java)
===================================================================
--- branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java (rev 0)
+++ branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -0,0 +1,197 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.event;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.MethodExpression;
+import javax.el.MethodNotFoundException;
+import javax.faces.component.StateHolder;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+/**
+ * <p><strong><span
+ * class="changed_modified_2_0">MethodExpressionEventListener</span></strong>
+ * is a {@link FacesListener} that wraps a {@link
+ * MethodExpression}. When it receives a {@link FacesEvent}, it
+ * executes a method on an object identified by the {@link
+ * MethodExpression}.</p>
+ *
+ * @author akolonitsky
+ * @version 1.0
+ *
+ */
+public abstract class MethodExpressionEventListener implements FacesListener, StateHolder {
+
+ private static final Class<?>[] EVENT_LISTENER_ZERO_ARG_SIG = new Class[] { };
+
+ private static final Object[] NO_PARAMS = new Object[0];
+
+ // ------------------------------------------------------ Instance Variables
+
+ private MethodExpression methodExpressionOneArg = null;
+ private MethodExpression methodExpressionZeroArg = null;
+
+ private boolean isTransient;
+
+ protected MethodExpressionEventListener() {
+ }
+
+ /**
+ * <p><span class="changed_modified_2_0">Construct</span> a {@link
+ * FacesListener} that contains a {@link
+ * MethodExpression}.<span
+ * class="changed_added_2_0">To accomodate method expression targets
+ * that take no arguments instead of taking a {@link
+ * FacesEvent} argument</span>, the implementation of this
+ * class must take the argument <code>methodExpressionOneArg</code>,
+ * extract its expression string, and create another
+ * <code>MethodExpression</code> whose expected param types match
+ * those of a zero argument method. The usage requirements for both
+ * of these <code>MethodExpression</code> instances are described in
+ * {@link #processEvent}.</span></p>
+ *
+ * @param methodExpressionOneArg a <code>MethodExpression</code>
+ * that points to a method that returns <code>void</code> and takes
+ * a single argument of type {@link FacesEvent}.
+ */
+ protected MethodExpressionEventListener(MethodExpression methodExpressionOneArg) {
+
+ super();
+ this.methodExpressionOneArg = methodExpressionOneArg;
+ FacesContext context = FacesContext.getCurrentInstance();
+ ELContext elContext = context.getELContext();
+ this.methodExpressionZeroArg = context.getApplication().getExpressionFactory().createMethodExpression(
+ elContext, methodExpressionOneArg.getExpressionString(), Void.class, EVENT_LISTENER_ZERO_ARG_SIG);
+ }
+
+ /**
+ * <p>Construct a {@link FacesListener} that contains a {@link MethodExpression}.</p>
+ *
+ * @param methodExprOneArg
+ * @param methodExprZeroArg
+ */
+ protected MethodExpressionEventListener(MethodExpression methodExprOneArg, MethodExpression methodExprZeroArg) {
+
+ super();
+ this.methodExpressionOneArg = methodExprOneArg;
+ this.methodExpressionZeroArg = methodExprZeroArg;
+ }
+
+ // ------------------------------------------------------- Event Method
+
+ /**
+ * <p><span class="changed_modified_2_0">Call</span> through to the
+ * {@link MethodExpression} passed in our constructor. <span
+ * class="changed_added_2_0">First, try to invoke the
+ * <code>MethodExpression</code> passed to the constructor of this
+ * instance, passing the argument {@link FacesEvent} as the
+ * argument. If a {@link MethodNotFoundException} is thrown, call
+ * to the zero argument <code>MethodExpression</code> derived from
+ * the <code>MethodExpression</code> passed to the constructor of
+ * this instance. If that fails for any reason, throw an {@link
+ * AbortProcessingException}, including the cause of the
+ * failure.</span></p>
+ *
+ * @throws NullPointerException {@inheritDoc}
+ * @throws AbortProcessingException {@inheritDoc}
+ */
+ public void processEvent(FacesEvent event) throws AbortProcessingException {
+
+ if (event == null) {
+ throw new NullPointerException();
+ }
+ FacesContext context = FacesContext.getCurrentInstance();
+ ELContext elContext = context.getELContext();
+ // PENDING: The corresponding code in MethodExpressionActionListener
+ // has an elaborate message capture, logging, and rethrowing block.
+ // Why not here?
+ try {
+ methodExpressionOneArg.invoke(elContext, new Object[] {event});
+ } catch (MethodNotFoundException mnf) {
+ if (null != methodExpressionZeroArg) {
+
+ try {
+ // try to invoke a no-arg version
+ methodExpressionZeroArg.invoke(elContext, NO_PARAMS);
+ } catch (ELException e) {
+ throw new AbortProcessingException(e.getMessage(), e.getCause());
+ }
+ }
+ } catch (ELException e) {
+ throw new AbortProcessingException(e.getMessage(), e.getCause());
+ }
+ }
+
+
+ // ------------------------------------------------ Methods from StateHolder
+
+
+ /**
+ * <p class="changed_modified_2_0">Both {@link MethodExpression}
+ * instances described in the constructor must be saved.</p>
+ */
+ public Object saveState(FacesContext context) {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ return new Object[] {
+ UIComponentBase.saveAttachedState(context, methodExpressionOneArg),
+ UIComponentBase.saveAttachedState(context, methodExpressionZeroArg)
+ };
+ }
+
+
+ /**
+ * <p class="changed_modified_2_0">Both {@link MethodExpression}
+ * instances described in the constructor must be restored.</p>
+ */
+ public void restoreState(FacesContext context, Object state) {
+
+ if (context == null) {
+ throw new NullPointerException();
+ }
+ if (state == null) {
+ return;
+ }
+
+ methodExpressionOneArg = (MethodExpression) UIComponentBase
+ .restoreAttachedState(context, ((Object[]) state)[0]);
+ methodExpressionZeroArg = (MethodExpression) UIComponentBase
+ .restoreAttachedState(context, ((Object[]) state)[1]);
+ }
+
+
+ public boolean isTransient() {
+ return isTransient;
+ }
+
+ public void setTransient(boolean newTransientValue) {
+ isTransient = newTransientValue;
+ }
+}
Modified: branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java
===================================================================
--- branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -40,6 +40,8 @@
import org.ajax4jsf.javascript.JSReference;
import org.richfaces.renderkit.AjaxEventOptions;
import org.richfaces.renderkit.HtmlConstants;
+
+import com.google.common.base.Strings;
/**
* @author shura
* <p/>
@@ -586,6 +588,10 @@
Set<String> result = new LinkedHashSet<String>(values.length);
for (String value : values) {
+ if (Strings.isNullOrEmpty(value)) {
+ continue;
+ }
+
result.add(value);
}
@@ -593,7 +599,9 @@
} else {
Set<String> areasSet = new LinkedHashSet<String>(5);
- areasSet.add(areasString);
+ if (!Strings.isNullOrEmpty(areasString)) {
+ areasSet.add(areasString);
+ }
return areasSet;
}
Deleted: branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java
===================================================================
--- branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.view.facelets.html;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.faces.component.UIComponent;
-import javax.faces.view.AttachedObjectHandler;
-
-/**
- * @author Nick Belaevski
- *
- */
-final class TagHandlerUtils {
-
- // TODO - is that implementation dependency?
- private static final String JAVAX_FACES_RETARGETABLE_HANDLERS = "javax.faces.RetargetableHandlers";
-
- private TagHandlerUtils() {
- //utility class constructor
- }
-
- static List<AttachedObjectHandler> getOrCreateRetargetableHandlersList(UIComponent component) {
- Map<String, Object> attrs = component.getAttributes();
- @SuppressWarnings({
- "unchecked"}) List<AttachedObjectHandler> list =
- (List<AttachedObjectHandler>) attrs.get(JAVAX_FACES_RETARGETABLE_HANDLERS);
-
- if (list == null) {
- list = new ArrayList<AttachedObjectHandler>();
- attrs.put(JAVAX_FACES_RETARGETABLE_HANDLERS, list);
- }
-
- return list;
- }
-
- static <T> Class<? extends T> loadClass(String className, Class<T> type)
- throws ClassNotFoundException, ClassCastException {
-
- ClassLoader ccl = Thread.currentThread().getContextClassLoader();
- Class<?> loadedClass = Class.forName(className, false, ccl);
-
- return loadedClass.asSubclass(type);
- }
-
-}
Modified: branches/RF-7560/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
===================================================================
--- branches/RF-7560/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -195,6 +195,9 @@
@Attribute(events = @EventName("beforedomupdate"))
public abstract String getOnbeforedomupdate();
+
+ @Attribute
+ public abstract String getClientFilter();
@Override
public Converter getConverter() {
Modified: branches/RF-7560/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
===================================================================
--- branches/RF-7560/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -46,6 +46,7 @@
import javax.servlet.jsp.jstl.sql.Result;
import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.util.InputUtils;
import org.richfaces.component.AbstractAutocomplete;
@@ -71,6 +72,19 @@
})
public abstract class AutocompleteRendererBase extends InputRendererBase implements MetaComponentRenderer {
+ public JSFunctionDefinition getClientFilterFunction(UIComponent component) {
+ AbstractAutocomplete autocomplete = (AbstractAutocomplete) component;
+ String clientFilter = (String)autocomplete.getAttributes().get("clientFilter");
+ if (clientFilter != null && clientFilter.length() != 0) {
+ JSFunctionDefinition clientFilterFunction = new JSFunctionDefinition("subString");
+ clientFilterFunction.addParameter("value");
+ clientFilterFunction.addToBody(clientFilter);
+ return clientFilterFunction;
+ }
+
+ return null;
+ }
+
public String getScriptOptions(UIComponent component) {
Map<String, Object> attributes = component.getAttributes();
Map<String, Object> options = new HashMap<String, Object>();
@@ -78,7 +92,6 @@
utils.addToScriptHash(options, "buttonId", component.getClientId() + "Button");
utils.addToScriptHash(options, "selectedItemClass", attributes.get("selectedItemClass"));
utils.addToScriptHash(options, "minChars", attributes.get("minChars"), "1");
- utils.addToScriptHash(options, "mode", attributes.get("mode"), "ajax");
utils.addToScriptHash(options, "filterFunction", attributes.get("filterFunction"));
utils.addToScriptHash(options, "autofill", attributes.get("autofill"), "true");
utils.addToScriptHash(options, "disabled", attributes.get("disabled"), "false");
@@ -89,11 +102,16 @@
utils.addToScriptHash(options, "onerror", attributes.get("onerror"));
utils.addToScriptHash(options, "onbeforedomupdate", attributes.get("onbeforedomupdate"));
utils.addToScriptHash(options, "onchange", attributes.get("onchange"));
- if (attributes.get("mode") != null) {
- if (attributes.get("mode").equals("ajax")){
+ utils.addToScriptHash(options, "filterFunction", getClientFilterFunction(component));
+ String mode = (String)attributes.get("mode");
+ if (mode != null) {
+ if (mode.equals("ajax")){
utils.addToScriptHash(options, "isCachedAjax", false, "true");
- } else if (attributes.get("mode").equals("client")) {
+ } else if (mode.equals("client") || mode.equals("lazyClient")) {
utils.addToScriptHash(options, "ajaxMode", false, "true");
+ if (mode.equals("lazyClient")) {
+ utils.addToScriptHash(options, "lazyClientMode", true, "false");
+ }
}
}
StringBuilder builder = new StringBuilder();
@@ -217,13 +235,11 @@
if (mode!= null && mode.equals("client")) {
List<Object> fetchValues = new ArrayList<Object>();
this.encodeItems(facesContext, component, fetchValues);
- } else if (mode!= null && mode.equals("lazyClient")){
+ } else {
strategy.encodeItemsContainerBegin(facesContext, component);
+ // TODO: is it needed
+ //strategy.encodeFakeItem(facesContext, component);
strategy.encodeItemsContainerEnd(facesContext, component);
- } else{
- strategy.encodeItemsContainerBegin(facesContext, component);
- strategy.encodeFakeItem(facesContext, component);
- strategy.encodeItemsContainerEnd(facesContext, component);
}
}
@@ -250,7 +266,7 @@
writer.writeText(item, null);
}
}
-
+ strategy.encodeItemEnd(facesContext, comboBox);
}
private AutocompleteEncodeStrategy getStrategy(UIComponent component) {
Modified: branches/RF-7560/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js
===================================================================
--- branches/RF-7560/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js 2010-09-03 18:18:05 UTC (rev 19120)
@@ -1,14 +1,23 @@
(function ($, rf) {
rf.utils = rf.utils || {};
- rf.utils.Cache = function (key, items, values) {
+ rf.utils.Cache = function (key, items, values, useCache) {
this.key = key.toLowerCase();
this.cache = {}
this.cache[this.key] = items || [];
- this.values = typeof values != "function" ? values || this.cache[this.key] : values(items);
- this.useCache = checkValuesPrefix.call(this);
+ this.originalValues = typeof values == "function" ? values(items) : values || this.cache[this.key];
+ this.values = processValues(this.originalValues);
+ this.useCache = useCache || checkValuesPrefix.call(this);
};
+ var processValues = function (values) {
+ var processedValues = [];
+ for (var i = 0; i<values.length; i++) {
+ processedValues.push(values[i].toLowerCase());
+ }
+ return processedValues;
+ }
+
var checkValuesPrefix = function () {
var result = true;
for (var i = 0; i<this.values.length; i++) {
@@ -20,7 +29,7 @@
return result;
}
- var getItems = function (key) {
+ var getItems = function (key, filterFunction) {
key = key.toLowerCase();
var newCache = [];
@@ -31,12 +40,17 @@
if (this.cache[key]) {
newCache = this.cache[key];
} else {
+ var useCustomFilterFunction = typeof filterFunction == "function";
var itemsCache = this.cache[this.key];
for (var i = 0; i<this.values.length; i++) {
- var value = this.values[i].toLowerCase();
- var p = value.indexOf(key);
- if (p == 0) {
+ var value = this.values[i];
+ if (useCustomFilterFunction && filterFunction(key, value)) {
newCache.push(itemsCache[i]);
+ } else {
+ var p = value.indexOf(key);
+ if (p == 0) {
+ newCache.push(itemsCache[i]);
+ }
}
}
@@ -52,7 +66,7 @@
};
var getItemValue = function (item) {
- return this.values[this.cache[this.key].index(item)];
+ return this.originalValues[this.cache[this.key].index(item)];
};
var isCached = function (key) {
@@ -107,9 +121,11 @@
minChars:1,
selectFirst:true,
ajaxMode:true,
+ lazyClientMode:false,
isCachedAjax:true,
- tokens: ",",
- attachToBody:true
+ tokens: "",
+ attachToBody:true,
+ filterFunction: undefined
};
var ID = {
@@ -150,9 +166,7 @@
if (element) {
if (event.type=="mouseover") {
var index = this.items.index(element);
- if (index!=this.index) {
- selectItem.call(this, index);
- }
+ selectItem.call(this, event, index);
} else {
this.__onChangeValue(event, getSelectedItemValue.call(this));
rf.Selection.setCaretTo(rf.getDomElement(this.fieldId));
@@ -164,7 +178,7 @@
var updateItemsList = function (value, fetchValues) {
this.items = $(rf.getDomElement(this.id+ID.ITEMS)).find("."+this.options.itemClass);
if (this.items.length>0) {
- this.cache = new rf.utils.Cache(value, this.items, fetchValues || getData);
+ this.cache = new rf.utils.Cache((this.options.ajaxMode ? value : ""), this.items, fetchValues || getData, !this.options.ajaxMode);
}
};
@@ -194,18 +208,25 @@
}
};
- var callAjax = function(event, value) {
+ var callAjax = function(event, value, callback) {
clearItems.call(this);
rf.getDomElement(this.id+ID.VALUE).value = value;
var _this = this;
+ var _event = event;
var ajaxSuccess = function (event) {
updateItemsList.call(_this, _this.value, event.componentData && event.componentData[_this.id]);
- if (_this.isVisible && _this.options.selectFirst) {
- selectItem.call(_this, 0);
+ if (_this.options.lazyClientMode && _this.value.length!=0) {
+ updateItemsFromCache.call(_this, _this.value);
}
+ if (_this.focused && _this.items.length!=0 && callback) {
+ callback.call(_this, _event);
+ }
+ if (!callback && _this.isVisible && _this.options.selectFirst) {
+ selectItem.call(_this, _event, 0);
+ }
}
var ajaxError = function (event) {
@@ -219,8 +240,8 @@
rf.ajax(this.id, event, {parameters: params, error: ajaxError, complete:ajaxSuccess});
};
- var selectItem = function(index, isOffset, noAutoFill) {
- if (this.items.length==0) return;
+ var selectItem = function(event, index, isOffset) {
+ if (this.items.length==0 || (!isOffset && this.index == index)) return;
if (this.index!=-1) {
this.items.eq(this.index).removeClass(this.options.selectedItemClass);
@@ -233,11 +254,11 @@
if (isOffset) {
this.index += index;
- if ( this.index<0 ) {
- this.index = this.items.length - 1;
- } else if (this.index >= this.items.length) {
- this.index = 0;
- }
+ if ( this.index<0 ) {
+ this.index = this.items.length - 1;
+ } else if (this.index >= this.items.length) {
+ this.index = 0;
+ }
} else {
if (index<0) {
index = 0;
@@ -249,14 +270,21 @@
var item = this.items.eq(this.index);
item.addClass(this.options.selectedItemClass);
scrollToSelectedItem.call(this);
- !noAutoFill && autoFill.call(this, this.value, getSelectedItemValue.call(this));
+ if (event &&
+ event.which != rf.KEYS.BACKSPACE &&
+ event.which != rf.KEYS.DEL &&
+ event.which != rf.KEYS.LEFT &&
+ event.which != rf.KEYS.RIGHT) {
+ autoFill.call(this, this.value, getSelectedItemValue.call(this));
+ }
};
var updateItemsFromCache = function (value) {
- var newItems = this.cache.getItems(value);
+ var newItems = this.cache.getItems(value, this.options.filterFunction);
this.items = $(newItems);
//TODO: works only with simple markup, not with <tr>
- $(rf.getDomElement(this.id+ID.ITEMS)).empty().append(newItems);
+ $(rf.getDomElement(this.id+ID.ITEMS)).empty().append(this.items);
+ window.console && console.log && console.log("updateItemsFromCache");
};
var clearItems = function () {
@@ -264,31 +292,34 @@
this.items = [];
};
- var onChangeValue = function (event, value) {
- selectItem.call(this);
- this.index = -1;
+ var onChangeValue = function (event, value, callback) {
+ selectItem.call(this, event);
// value is undefined if called from AutocompleteBase onChange
var subValue = (typeof value == "undefined") ? this.__getSubValue() : value;
var oldValue = this.value;
this.value = subValue;
- if (this.cache && this.cache.isCached(subValue)) {
- updateItemsFromCache.call(this, subValue);
- if (this.options.selectFirst) {
- if (event.which == rf.KEYS.RETURN || event.type == "click") {
- this.setInputValue(subValue);
- } else {
- selectItem.call(this, 0, false, event.which == rf.KEYS.BACKSPACE || event.which == rf.KEYS.LEFT || event.which == rf.KEYS.RIGHT);
- }
+ if ((this.options.isCachedAjax || !this.options.ajaxMode) &&
+ this.cache && this.cache.isCached(subValue)) {
+ if (oldValue!=subValue) {
+ updateItemsFromCache.call(this, subValue);
}
+ if (this.items.length!=0 && callback) {
+ callback.call(this, event);
+ }
+ if (event.which == rf.KEYS.RETURN || event.type == "click") {
+ this.setInputValue(subValue);
+ } else if (this.options.selectFirst) {
+ selectItem.call(this, event, 0);
+ }
} else {
if (event.which == rf.KEYS.RETURN || event.type == "click") {
this.setInputValue(subValue);
}
if (subValue.length>=this.options.minChars) {
- if (this.options.ajaxMode && oldValue!=subValue) {
- this.options.ajaxMode && callAjax.call(this, event, subValue);
+ if ((this.options.ajaxMode || this.options.lazyClientMode) && oldValue!=subValue) {
+ callAjax.call(this, event, subValue, callback);
}
} else {
if (this.options.ajaxMode) {
@@ -365,9 +396,11 @@
*/
__updateState: function (event) {
var subValue = this.__getSubValue();
- // called from onShow method, not actually value changed
- if (this.items.length==0 && subValue.length>=this.options.minChars && this.isFirstAjax) {
- this.options.ajaxMode && callAjax.call(this, event, subValue);
+ // called from AutocompleteBase when not actually value changed
+ if (this.items.length==0 && this.isFirstAjax) {
+ if ((this.options.ajaxMode && subValue.length>=this.options.minChars) || this.options.lazyClientMode) {
+ callAjax.call(this, event, subValue);
+ }
}
return;
},
@@ -383,16 +416,16 @@
/*
* Override abstract protected methods
*/
- __onKeyUp: function () {
- selectItem.call(this, -1, true);
+ __onKeyUp: function (event) {
+ selectItem.call(this, event, -1, true);
},
- __onKeyDown: function () {
- selectItem.call(this, 1, true);
+ __onKeyDown: function (event) {
+ selectItem.call(this, event, 1, true);
},
- __onPageUp: function () {
+ __onPageUp: function (event) {
},
- __onPageDown: function () {
+ __onPageDown: function (event) {
},
__onBeforeShow: function (event) {
@@ -404,14 +437,12 @@
//rf.getDomElement(this.fieldId).focus();
},
__onShow: function (event) {
- if (event.which != rf.KEYS.BACKSPACE && this.items && this.items.length>0) {
- if (this.index!=0 && this.options.selectFirst) {
- selectItem.call(this, 0);
- }
+ if (this.options.selectFirst) {
+ selectItem.call(this, event, 0);
}
},
- __onHide: function () {
- selectItem.call(this);
+ __onHide: function (event) {
+ selectItem.call(this, event);
},
/*
* Destructor
Modified: branches/RF-7560/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js
===================================================================
--- branches/RF-7560/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js 2010-09-03 18:18:05 UTC (rev 19120)
@@ -107,6 +107,7 @@
};
var onFocus = function (event) {
+ this.focused = true;
};
var onBlur = function (event) {
@@ -116,6 +117,7 @@
} else if (this.isVisible && !this.isMouseDown) {
var _this = this;
this.timeoutId = window.setTimeout(function(){_this.hide();}, 200);
+ this.focused=false;
}
};
@@ -128,15 +130,11 @@
//TODO: is it needed to chesk keys?
//TODO: we need to set value when autoFill used when LEFT or RIGHT was pressed
if (event.which == rf.KEYS.LEFT || event.which == rf.KEYS.RIGHT || flag) {
- if (flag || this.isVisible) {
- this.__onChangeValue(event);
- }
if (flag) {
+ this.__onChangeValue(event, undefined, (!this.isVisible ? this.show : undefined));
this.currentValue = this.getInputValue();
- /*if(value && value.length>=this.options.minChars){
- onShow.call(this, event);
- }*/ // TODO: AMarkhel: is this check needed??? for what?
- onShow.call(this, event);
+ } else if (this.isVisible) {
+ this.__onChangeValue(event);
}
}
};
Modified: branches/RF-7560/ui/input/ui/src/main/templates/autocomplete.template.xml
===================================================================
--- branches/RF-7560/ui/input/ui/src/main/templates/autocomplete.template.xml 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/input/ui/src/main/templates/autocomplete.template.xml 2010-09-03 18:18:05 UTC (rev 19120)
@@ -29,7 +29,7 @@
onmouseout="#{component.attributes['onmouseout']}"
onkeyup="#{component.attributes['onkeyup']}"
onkeydown="#{component.attributes['onkeydown']}"
- onkeypress="#{component.attributes['onkeypress']}" id="#{clientId}Input" value="#{component.attributes['value']}" disabled="#{disabled}" name="#{clientId}" type="text" class="rf-au-font rf-au-input" />
+ onkeypress="#{component.attributes['onkeypress']}" id="#{clientId}Input" value="#{component.attributes['value']}" disabled="#{disabled}" name="#{clientId}" type="text" class="rf-au-font rf-au-input" autocomplete="off"/>
<c:if test="#{component.attributes['showButton']}">
<c:if test="#{component.attributes['disabled']}">
<div id="#{clientId}Button" class="rf-au-button">
Modified: branches/RF-7560/ui/input/ui/src/main/templates/inplaceInput.template.xml
===================================================================
--- branches/RF-7560/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-09-03 18:18:05 UTC (rev 19120)
@@ -1,5 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+JBoss, Home of Professional Open Source
+Copyright ${year}, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+
+This software 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 software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
<cdk:root xmlns="http://jboss.org/schema/richfaces/cdk/xhtml-el" xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core"
xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core" xmlns:cc="http://jboss.org/schema/richfaces/cdk/jsf/composite"
xmlns:javaee="http://java.sun.com/xml/ns/javaee">
@@ -25,7 +48,7 @@
</span>
<input id="#{clientId}:focus" type="image" style="position: absolute; top: 0px; left: 0px; outline-style: none;" class="rf-ii-none"/>
<span id="#{clientId}:edit" class="#{getEditStyleClass(component, inplaceState)}">
- <input id="#{clientId}:input" autocomplete="off" name="#{clientId}:input"
+ <input id="#{clientId}:input" autocomplete="off" name="#{clientId}"
type="text" value="#{getInputValue(facesContext, component)}" class="rf-ii-f" style="width: #{component.attributes['inputWidth']};"
cdk:passThrough="tabIndex">
<cdk:call expression="renderInputHandlers(facesContext, component);"/>
Modified: branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java
===================================================================
--- branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -50,7 +50,6 @@
public static final String COMPONENT_FAMILY = "org.richfaces.Column";
-
@Attribute
public abstract boolean isBreakRowBefore();
Modified: branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java
===================================================================
--- branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -70,6 +70,10 @@
public static final String LAST_FACET_NAME = "last";
+ public static final String NEXT_FACET_NAME = "next";
+
+ public static final String PREVIOUS_FACET_NAME = "previous";
+
public static final String FAST_FORWARD_FACET_NAME = "fastforward";
public static final String FAST_REWIND_FACET_NAME = "fastrewind";
@@ -84,16 +88,9 @@
private Integer page;
- protected enum PropertyKeys {
- boundaryControls, fastControls, fastStep, forComponent, inactiveStyle, selectStyle, inactiveStyleClass, selectStyleClass, scrollerListener, lastPageMode, maxPages, pageIndexVar, pagesVar, renderIfSinglePage, style, styleClass, stepControls
- }
-
@Attribute
public abstract String getLastPageMode();
- @Attribute(defaultValue="0")
- public abstract int getFastStep();
-
@Attribute
public abstract String getForComponent();
@@ -106,6 +103,12 @@
@Attribute(defaultValue="show")
public abstract String getFastControls();
+ @Attribute(defaultValue="show")
+ public abstract String getStepControls();
+
+ @Attribute(defaultValue="1")
+ public abstract int getFastStep();
+
public void addScrollerListener(DataScrollerListener listener) {
addFacesListener(listener);
}
@@ -165,10 +168,6 @@
return DataScrollerUtils.findDataTable(this);
}
- private int getFastStepOrDefault() {
- return (Integer) getStateHelper().eval(PropertyKeys.fastStep, 1);
- }
-
public int getPageForFacet(String facetName) {
if (facetName == null) {
throw new NullPointerException();
@@ -181,10 +180,14 @@
newPage = 1;
} else if (LAST_FACET_NAME.equals(facetName)) {
newPage = pageCount > 0 ? pageCount : 1;
+ } else if (PREVIOUS_FACET_NAME.equals(facetName)) {
+ newPage = getPage() - 1;
+ } else if (NEXT_FACET_NAME.equals(facetName)) {
+ newPage = getPage() + 1;
} else if (FAST_FORWARD_FACET_NAME.equals(facetName)) {
- newPage = getPage() + getFastStepOrDefault();
+ newPage = getPage() + getFastStep();
} else if (FAST_REWIND_FACET_NAME.equals(facetName)) {
- newPage = getPage() - getFastStepOrDefault();
+ newPage = getPage() - getFastStep();
} else {
try {
newPage = Integer.parseInt(facetName.toString());
@@ -236,7 +239,15 @@
public UIComponent getLast() {
return getFacetByKey(LAST_FACET_NAME);
}
+
+ public UIComponent getNext() {
+ return getFacetByKey(NEXT_FACET_NAME);
+ }
+ public UIComponent getPrevious() {
+ return getFacetByKey(PREVIOUS_FACET_NAME);
+ }
+
public UIComponent getFastForward() {
return getFacetByKey(FAST_FORWARD_FACET_NAME);
}
Modified: branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java
===================================================================
--- branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -52,7 +52,10 @@
Iterator<UIComponent> components = row.columns();
while(components.hasNext()){
- encodeColumn(facesContext, writer, (UIColumn)components.next(),rowHolder);
+ UIColumn column = (UIColumn)components.next();
+ if(column.isRendered()) {
+ encodeColumn(facesContext, writer, column,rowHolder);
+ }
}
encodeRowEnd(writer);
}
Modified: branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ControlsState.java
===================================================================
--- branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ControlsState.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ControlsState.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -35,7 +35,15 @@
private boolean lastRendered = true;
private boolean lastEnabled = true;
+
+ private boolean nextRendered = true;
+
+ private boolean nextEnabled = true;
+ private boolean previousRendered = true;
+
+ private boolean previousEnabled = true;
+
private boolean fastRewindRendered = true;
private boolean fastRewindEnabled = true;
@@ -109,8 +117,40 @@
public void setFastForwardEnabled(boolean fastForwardEnabled) {
this.fastForwardEnabled = fastForwardEnabled;
}
+
+ public boolean getNextRendered() {
+ return nextRendered;
+ }
- public boolean isControlsSeparatorRendered() {
+ public void setNextRendered(boolean nextRendered) {
+ this.nextRendered = nextRendered;
+ }
+
+ public boolean getNextEnabled() {
+ return nextEnabled;
+ }
+
+ public void setNextEnabled(boolean nextEnabled) {
+ this.nextEnabled = nextEnabled;
+ }
+
+ public boolean getPreviousRendered() {
+ return previousRendered;
+ }
+
+ public void setPreviousRendered(boolean previousRendered) {
+ this.previousRendered = previousRendered;
+ }
+
+ public boolean getPreviousEnabled() {
+ return previousEnabled;
+ }
+
+ public void setPreviousEnabled(boolean previousEnabled) {
+ this.previousEnabled = previousEnabled;
+ }
+
+ public boolean getControlsSeparatorRendered() {
return controlsSeparatorRendered;
}
Modified: branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java
===================================================================
--- branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -84,10 +84,10 @@
boolean useFirst = true;
boolean useLast = true;
-
+
boolean useBackFast = true;
boolean useForwFast = true;
-
+
ControlsState controlsState = new ControlsState();
if (pageIndex <= minPageIdx) {
@@ -107,6 +107,7 @@
}
String boundaryControls = (String) component.getAttributes().get("boundaryControls");
+ String stepControls = (String) component.getAttributes().get("stepControls");
String fastControls = (String) component.getAttributes().get("fastControls");
boolean isAuto = "auto".equals(boundaryControls);
@@ -122,7 +123,21 @@
controlsState.setFirstRendered(false);
controlsState.setLastRendered(false);
}
+
+ isAuto = "auto".equals(stepControls);
+ if (isAuto || "show".equals(stepControls)) {
+ if (isAuto) {
+ controlsState.setPreviousRendered(useFirst);
+ controlsState.setNextRendered(useLast);
+ }
+ controlsState.setPreviousEnabled(useFirst);
+ controlsState.setNextEnabled(useLast);
+ } else {
+ controlsState.setPreviousRendered(false);
+ controlsState.setNextRendered(false);
+ }
+
isAuto = "auto".equals(fastControls);
if (isAuto || "show".equals(fastControls)) {
if (isAuto) {
@@ -250,9 +265,17 @@
left.put(clientId + "_ds_fr", AbstractDataScroller.FAST_REWIND_FACET_NAME);
}
+ if (controlsState.getPreviousRendered() && controlsState.getPreviousEnabled()) {
+ left.put(clientId + "_ds_prev", AbstractDataScroller.PREVIOUS_FACET_NAME);
+ }
+
if (controlsState.getFastForwardRendered() && controlsState.getFastForwardEnabled()) {
right.put(clientId + "_ds_ff", AbstractDataScroller.FAST_FORWARD_FACET_NAME);
}
+
+ if (controlsState.getNextRendered() && controlsState.getNextEnabled()) {
+ right.put(clientId + "_ds_next", AbstractDataScroller.NEXT_FACET_NAME);
+ }
if (controlsState.getLastRendered() && controlsState.getLastEnabled()) {
right.put(clientId + "_ds_l", AbstractDataScroller.LAST_FACET_NAME);
@@ -303,6 +326,10 @@
definition.addToBody(buffer);
return definition;
}
+
+ public void encodeFacet(FacesContext context, UIComponent component) throws IOException {
+ component.encodeAll(context);
+ }
public boolean getRendersChildren() {
return true;
Modified: branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
===================================================================
--- branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -147,72 +147,73 @@
RowHolder rowHolder = (RowHolder) holder;
Row row = rowHolder.getRow();
- AbstractDataTable dataTable = (AbstractDataTable)row;
-
- boolean partialUpdate = rowHolder.isUpdatePartial();
+ AbstractDataTable dataTable = (AbstractDataTable) row;
+
+ boolean partialUpdate = rowHolder.isUpdatePartial();
boolean parentTbodyStart = rowHolder.isEncodeParentTBody();
boolean tbodyStart = parentTbodyStart;
-
+
rowHolder.setRowStart(true);
Iterator<UIComponent> components = row.columns();
while (components.hasNext()) {
-
UIComponent child = components.next();
- if(child instanceof Row) {
- boolean isSubtable = (child instanceof AbstractSubTable);
- //new row -> close </tr>
- if (rowHolder.getProcessCell() != 0) {
- encodeRowEnd(writer);
+ if (child.isRendered()) {
+ if (child instanceof Row) {
+ boolean isSubtable = (child instanceof AbstractSubTable);
+ // new row -> close </tr>
+ if (rowHolder.getProcessCell() != 0) {
+ encodeRowEnd(writer);
- if(isSubtable) {
- encodeTableBodyEnd(writer);
- tbodyStart = false;
-
- if (partialUpdate) {
- partialEnd(facesContext);
+ if (isSubtable) {
+ encodeTableBodyEnd(writer);
+ tbodyStart = false;
+
+ if (partialUpdate) {
+ partialEnd(facesContext);
+ }
}
}
- }
-
- rowHolder.nextCell();
-
- if(isSubtable && partialUpdate){
- String id = dataTable.getRelativeClientId(facesContext) + ":"+ child.getId() +":c";
- partialStart(facesContext, id);
- }
-
- child.encodeAll(facesContext);
-
- if (isSubtable && partialUpdate) {
- partialEnd(facesContext);
- }
-
- } else if(child instanceof UIColumn) {
-
- if(!parentTbodyStart && !tbodyStart) {
- if (partialUpdate) {
- partialStart(facesContext, dataTable.getRelativeClientId(facesContext) + ":tb");
+
+ rowHolder.nextCell();
+
+ if (isSubtable && partialUpdate) {
+ String id = dataTable.getRelativeClientId(facesContext) + ":" + child.getId() + ":c";
+ partialStart(facesContext, id);
}
-
- encodeTableBodyStart(writer, facesContext, dataTable);
- rowHolder.setRowStart(true);
- tbodyStart = true;
- }
-
- encodeColumn(facesContext, writer, (UIColumn)child, rowHolder);
-
- if(!components.hasNext()) {
- encodeRowEnd(writer);
-
- if(!parentTbodyStart && tbodyStart) {
- encodeTableBodyEnd(writer);
- tbodyStart = false;
-
- if(partialUpdate) {
- partialEnd(facesContext);
+
+ child.encodeAll(facesContext);
+
+ if (isSubtable && partialUpdate) {
+ partialEnd(facesContext);
+ }
+
+ } else if (child instanceof UIColumn) {
+
+ if (!parentTbodyStart && !tbodyStart) {
+ if (partialUpdate) {
+ partialStart(facesContext, dataTable.getRelativeClientId(facesContext) + ":tb");
}
+
+ encodeTableBodyStart(writer, facesContext, dataTable);
+ rowHolder.setRowStart(true);
+ tbodyStart = true;
}
+
+ encodeColumn(facesContext, writer, (UIColumn) child, rowHolder);
+
+ if (!components.hasNext()) {
+ encodeRowEnd(writer);
+
+ if (!parentTbodyStart && tbodyStart) {
+ encodeTableBodyEnd(writer);
+ tbodyStart = false;
+
+ if (partialUpdate) {
+ partialEnd(facesContext);
+ }
+ }
+ }
}
}
}
Modified: branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java
===================================================================
--- branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -193,18 +193,19 @@
while (components.hasNext()) {
UIComponent component = components.next();
-
- if(component instanceof UIColumn) {
- encodeColumn(facesContext, writer, (UIColumn)component , rowHolder);
-
- } else if (component instanceof AbstractSubTable) {
- if(component.isRendered()) {
- encodeRowEnd(writer);
+ if(component.isRendered()) {
+ if(component instanceof UIColumn ) {
+ encodeColumn(facesContext, writer, (UIColumn)component , rowHolder);
+
+ } else if (component instanceof AbstractSubTable) {
+ if(component.isRendered()) {
+ encodeRowEnd(writer);
+ }
+
+ component.encodeAll(facesContext);
+ rowHolder.setRowStart(true);
}
-
- component.encodeAll(facesContext);
- rowHolder.setRowStart(true);
- }
+ }
}
encodeRowEnd(writer);
Modified: branches/RF-7560/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.js
===================================================================
--- branches/RF-7560/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.js 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.js 2010-09-03 18:18:05 UTC (rev 19120)
@@ -132,13 +132,21 @@
RichFaces.Event.fireById(this.id, this.getScrollEventName(), {'page' : page});
}
},
-
+
+ fastForward: function() {
+ this.switchToPage("fastforward");
+ },
+
+ fastRewind: function() {
+ this.switchToPage("fastrewind");
+ },
+
next: function() {
- this.switchToPage("fastforward");
+ this.switchToPage("next");
},
previous: function() {
- this.switchToPage("fastrewind");
+ this.switchToPage("previous");
},
first: function() {
Copied: branches/RF-7560/ui/iteration/ui/src/main/templates/buttons.template.include (from rev 19108, trunk/ui/iteration/ui/src/main/templates/buttons.template.include)
===================================================================
--- branches/RF-7560/ui/iteration/ui/src/main/templates/buttons.template.include (rev 0)
+++ branches/RF-7560/ui/iteration/ui/src/main/templates/buttons.template.include 2010-09-03 18:18:05 UTC (rev 19120)
@@ -0,0 +1,51 @@
+<!--
+JBoss, Home of Professional Open Source
+Copyright ${year}, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+
+This software 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 software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+
+<c:choose xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core" xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core">
+ <c:when test="#{isEnabled}">
+ <a id="#{id}" class="#{enabledStyles}" href="javascript:void(0);" >
+ <c:choose>
+ <c:when test="#{facet != null}">
+ <cdk:call expression="encodeFacet(facesContext, facet);"/>
+ </c:when>
+ <c:otherwise>
+ #{defaultText}
+ </c:otherwise>
+ </c:choose>
+ </a>
+ </c:when>
+ <c:otherwise>
+ <span id="#{id}" class="#{disabledStyles}">
+ <c:choose>
+ <c:when test="#{facet != null}">
+ <cdk:call expression="encodeFacet(facesContext, facet);"/>
+ </c:when>
+ <c:otherwise>
+ #{defaultText}
+ </c:otherwise>
+ </c:choose>
+ </span>
+ </c:otherwise>
+</c:choose>
Modified: branches/RF-7560/ui/iteration/ui/src/main/templates/datascroller.template.xml
===================================================================
--- branches/RF-7560/ui/iteration/ui/src/main/templates/datascroller.template.xml 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/iteration/ui/src/main/templates/datascroller.template.xml 2010-09-03 18:18:05 UTC (rev 19120)
@@ -1,8 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+JBoss, Home of Professional Open Source
+Copyright ${year}, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+
+This software 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 software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+
<cdk:root xmlns="http://jboss.org/schema/richfaces/cdk/xhtml-el" xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core"
xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core" xmlns:cc="http://jboss.org/schema/richfaces/cdk/jsf/composite"
- xmlns:javaee="http://java.sun.com/xml/ns/javaee">
+ xmlns:javaee="http://java.sun.com/xml/ns/javaee" xmlns:xi="http://www.w3.org/2001/XInclude">
<cc:interface>
<cdk:class>org.richfaces.renderkit.html.DataScrollerRenderer</cdk:class>
@@ -12,81 +36,79 @@
</cc:interface>
<cc:implementation>
-
<cdk:object type="org.richfaces.renderkit.ControlsState" name="controlsState" value="#{getControlsState(facesContext,component)}" />
<span id="#{clientId}" class="rf-ds"><!-- Now decor is disabled !!! -->
+
<c:if test="#{controlsState.firstRendered}">
- <c:choose>
- <c:when test="#{controlsState.firstEnabled}">
- <a id="#{clientId}_ds_f" class="rf-ds-btn rf-ds-l" href="javascript:void(0)" >
- ««
- </a>
- </c:when>
- <c:otherwise>
- <span id="#{clientId}_ds_f" class="rf-ds-btn rf-ds-l rf-ds-dis">
- ««
- </span>
- </c:otherwise>
- </c:choose>
+ <cdk:object type="boolean" name="isEnabled" value="#{controlsState.firstEnabled}"/>
+ <cdk:object type="UIComponent" name="facet" value="#{component.getFacet('first')}"/>
+ <cdk:object type="String" name="enabledStyles" value="rf-ds-btn rf-ds-l"/>
+ <cdk:object type="String" name="disabledStyles" value="rf-ds-btn rf-ds-l rf-ds-dis"/>
+ <cdk:object type="String" name="id" value="#{clientId}_ds_f"/>
+ <cdk:object type="String" name="defaultText" value="««««"/>
+ <xi:include xpointer="xpointer(/*)" href="buttons.template.include" />
</c:if>
-
<c:if test="#{controlsState.fastRewindRendered}">
- <c:choose>
- <c:when test="#{controlsState.fastRewindEnabled}">
- <a id="#{clientId}_ds_fr" class="rf-ds-btn rf-ds-l" href="javascript:void(0)">
- «
- </a>
- </c:when>
- <c:otherwise>
- <span id="#{clientId}_ds_fr" class="rf-ds-btn rf-ds-l rf-ds-dis">
- «
- </span>
- </c:otherwise>
- </c:choose>
+ <cdk:object type="boolean" name="isEnabled" value="#{controlsState.fastRewindEnabled}"/>
+ <cdk:object type="UIComponent" name="facet" value="#{component.getFacet('fastRewind')}"/>
+ <cdk:object type="java.lang.String" name="enabledStyles" value="rf-ds-btn rf-ds-l"/>
+ <cdk:object type="java.lang.String" name="disabledStyles" value="rf-ds-btn rf-ds-l rf-ds-dis"/>
+ <cdk:object type="java.lang.String" name="id" value="#{clientId}_ds_fr"/>
+ <cdk:object type="java.lang.String" name="defaultText" value="««"/>
+ <xi:include xpointer="xpointer(/*)" href="buttons.template.include" />
</c:if>
+
+ <c:if test="#{controlsState.previousRendered}">
+ <cdk:object name="isEnabled" value="#{controlsState.previousEnabled}"/>
+ <cdk:object name="facet" value="#{component.getFacet('previous')}"/>
+ <cdk:object type="java.lang.String" name="enabledStyles" value="rf-ds-btn rf-ds-l"/>
+ <cdk:object type="java.lang.String" name="disabledStyles" value="rf-ds-btn rf-ds-l rf-ds-dis"/>
+ <cdk:object name="id" value="#{clientId}_ds_prev"/>
+ <cdk:object name="defaultText" value="«"/>
+ <xi:include xpointer="xpointer(/*)" href="buttons.template.include" />
+ </c:if>
- <cdk:object type="java.util.Map" name="digitals" value="#{renderPager(responseWriter, facesContext, component)}" />
-
- <c:if test="#{controlsState.fastForwardRendered}">
- <c:choose>
- <c:when test="#{controlsState.fastForwardEnabled}">
- <a id="#{clientId}_ds_ff" class="rf-ds-btn rf-ds-r" href="javascript:void(0);">
- »
- </a>
- </c:when>
- <c:otherwise>
- <span id="#{clientId}_ds_ff" class="rf-ds-btn rf-ds-r rf-ds-dis">
- »
- </span>
- </c:otherwise>
- </c:choose>
+ <cdk:object type="java.util.Map" name="digitals" value="#{renderPager(responseWriter, facesContext, component)}" />
+
+ <c:if test="#{controlsState.nextRendered}">
+ <cdk:object name="isEnabled" value="#{controlsState.nextEnabled}"/>
+ <cdk:object name="facet" value="#{component.getFacet('next')}"/>
+ <cdk:object type="java.lang.String" name="enabledStyles" value="rf-ds-btn rf-ds-r"/>
+ <cdk:object type="java.lang.String" name="disabledStyles" value="rf-ds-btn rf-ds-r rf-ds-dis"/>
+ <cdk:object name="id" value="#{clientId}_ds_next"/>
+ <cdk:object name="defaultText" value="»"/>
+ <xi:include xpointer="xpointer(/*)" href="buttons.template.include" />
</c:if>
+ <c:if test="#{controlsState.fastForwardRendered}">
+ <cdk:object name="isEnabled" value="#{controlsState.fastForwardEnabled}"/>
+ <cdk:object name="facet" value="#{component.getFacet('fastForward')}"/>
+ <cdk:object type="java.lang.String" name="enabledStyles" value="rf-ds-btn rf-ds-r"/>
+ <cdk:object type="java.lang.String" name="disabledStyles" value="rf-ds-btn rf-ds-r rf-ds-dis"/>
+ <cdk:object name="id" value="#{clientId}_ds_ff"/>
+ <cdk:object name="defaultText" value="»»"/>
+ <xi:include xpointer="xpointer(/*)" href="buttons.template.include" />
+ </c:if>
+
<c:if test="#{controlsState.lastRendered}">
- <c:choose>
- <c:when test="#{controlsState.lastEnabled}">
- <a id="#{clientId}_ds_l" class="rf-ds-btn rf-ds-r" href="javascript:void(0);">
- »»
- </a>
- </c:when>
- <c:otherwise>
- <span id="#{clientId}_ds_l" class="rf-ds-btn rf-ds-r rf-ds-dis">
- »»
- </span>
- </c:otherwise>
- </c:choose>
- </c:if>
-
+ <cdk:object name="isEnabled" value="#{controlsState.lastEnabled}"/>
+ <cdk:object name="facet" value="#{component.getFacet('last')}"/>
+ <cdk:object type="java.lang.String" name="enabledStyles" value="rf-ds-btn rf-ds-r"/>
+ <cdk:object type="java.lang.String" name="disabledStyles" value="rf-ds-btn rf-ds-r rf-ds-dis"/>
+ <cdk:object name="id" value="#{clientId}_ds_l"/>
+ <cdk:object name="defaultText" value="»»»»"/>
+ <xi:include xpointer="xpointer(/*)" href="buttons.template.include" />
+ </c:if>
+
<cdk:object type="java.util.Map" name="buttons" value="#{getControls(facesContext, component, controlsState)}" />
<script type="text/javascript">
<cdk:call expression="buildScript(responseWriter, facesContext, component, buttons, digitals);"/>
</script>
</span>
-
-
+
</cc:implementation>
</cdk:root>
\ No newline at end of file
Modified: branches/RF-7560/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerBean.java
===================================================================
--- branches/RF-7560/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerBean.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerBean.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -17,7 +17,6 @@
content.add("3 page content");
content.add("4 page content");
content.add("5 page content");
- content.add("6 page content");
}
public List<String> getContent() {
Modified: branches/RF-7560/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerRenderTest.java
===================================================================
--- branches/RF-7560/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerRenderTest.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerRenderTest.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -46,7 +46,7 @@
assertEquals("span", span.getNodeName());
assertEquals("rf-ds", span.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
- // first/fastRewind buttons with arrows
+ // first/fastRewind/previous buttons with arrows
HtmlElement first = getFirstButton(page, scrollerId);
assertEquals("span", first.getNodeName());
assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", first.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
@@ -55,11 +55,15 @@
assertEquals("span", fastRewind.getNodeName());
assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", fastRewind.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
+ HtmlElement previous = getPreviousButton(page, scrollerId);
+ assertEquals("span", previous.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", previous.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
// currently selected digital button
- HtmlElement dc = getDigitalButton(page, scrollerId, 1);
- assertEquals("span", dc.getNodeName());
- assertEquals("rf-ds-dtl rf-ds-cur", dc.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
-
+ HtmlElement dc1 = getDigitalButton(page, scrollerId, 1);
+ assertEquals("span", dc1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", dc1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
// digital buttons
HtmlElement d2 = getDigitalButton(page, scrollerId, 2);
assertEquals("a", d2.getNodeName());
@@ -81,12 +85,12 @@
assertEquals("rf-ds-dtl", d5.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
assertEquals("javascript:void(0);", d5.getAttribute(HtmlConstants.HREF_ATTR));
- HtmlElement d6 = getDigitalButton(page, scrollerId, 6);
- assertEquals("a", d6.getNodeName());
- assertEquals("rf-ds-dtl", d6.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
- assertEquals("javascript:void(0);", d6.getAttribute(HtmlConstants.HREF_ATTR));
+ // next/fastForward/last buttons with arrows
+ HtmlElement next = getNextButton(page, scrollerId);
+ assertEquals("a", next.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r", next.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("javascript:void(0);", next.getAttribute(HTML.HREF_ATTR));
- // last/fastForward buttons with arrows
HtmlElement fastForward = getFastForwardButton(page, scrollerId);
assertEquals("a", fastForward.getNodeName());
assertEquals("rf-ds-btn rf-ds-r", fastForward.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
@@ -133,6 +137,102 @@
}
@Test
+ public void testOutDataScrollerNextPreviousButtons() throws Exception {
+ HtmlPage page = environment.getPage("/test.jsf");
+ String firstScrollerId = "scroller1";
+
+ //dataScroller inside dataTable 'footer' facet
+ String secondScrollerId = "richTable:scroller2";
+
+ for(int i = 2; i <= 5; i++) {
+ HtmlElement next = getNextButton(page, firstScrollerId);
+
+ next.click();
+
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller inside dataTable has switched
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkLastPageButtons(page, firstScrollerId, secondScrollerId);
+
+ //scroll back
+ for(int i = 4; i >= 1; i--) {
+ HtmlElement previous = getPreviousButton(page, firstScrollerId);
+ previous.click();
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller inside dataTable has switched
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkFirstPageButtons(page, firstScrollerId, secondScrollerId);
+ }
+
+ @Test
+ public void testInnerDataScrollerNextPreviousButtons() throws Exception {
+ HtmlPage page = environment.getPage("/test.jsf");
+ String firstScrollerId = "scroller1";
+
+ //dataScroller inside dataTable 'footer' facet
+ String secondScrollerId = "richTable:scroller2";
+
+ for(int i = 2; i <= 5; i++) {
+ HtmlElement next = getNextButton(page, secondScrollerId);
+ next.click();
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller outside dataTable has switched
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkLastPageButtons(page, firstScrollerId, secondScrollerId);
+
+ //scroll back
+ for(int i = 4; i >= 1; i--) {
+ HtmlElement previous = getPreviousButton(page, secondScrollerId);
+ previous.click();
+
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller inside dataTable has switched
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur", currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkFirstPageButtons(page, firstScrollerId, secondScrollerId);
+ }
+
+ @Test
public void testOutDataScrollerFastButtons() throws Exception {
HtmlPage page = environment.getPage("/test.jsf");
String firstScrollerId = "scroller1";
@@ -140,7 +240,7 @@
//dataScroller inside dataTable 'footer' facet
String secondScrollerId = "richTable:scroller2";
- for(int i = 2; i <= 6; i++) {
+ for(int i = 3; i <= 5; i = i + 2) {
HtmlElement ff = getFastForwardButton(page, firstScrollerId);
ff.click();
@@ -161,7 +261,7 @@
checkLastPageButtons(page, firstScrollerId, secondScrollerId);
//scroll back
- for(int i = 5; i >= 1; i--) {
+ for(int i = 3; i >= 1; i = i - 2) {
HtmlElement fr = getFastRewindButton(page, firstScrollerId);
fr.click();
HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
@@ -189,7 +289,7 @@
//dataScroller inside dataTable 'footer' facet
String secondScrollerId = "richTable:scroller2";
- for(int i = 2; i <= 6; i++) {
+ for(int i = 3; i <= 5; i = i + 2) {
HtmlElement ff = getFastForwardButton(page, secondScrollerId);
ff.click();
HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
@@ -208,7 +308,7 @@
checkLastPageButtons(page, firstScrollerId, secondScrollerId);
//scroll back
- for(int i = 5; i >= 1; i--) {
+ for(int i = 3; i >= 1; i = i - 2) {
HtmlElement fr = getFastRewindButton(page, secondScrollerId);
fr.click();
@@ -227,7 +327,7 @@
checkFirstPageButtons(page, firstScrollerId, secondScrollerId);
}
-
+
@Test
public void testOutDataScrollerDigitalButtons() throws Exception {
HtmlPage page = environment.getPage("/test.jsf");
@@ -236,7 +336,7 @@
//dataScroller inside dataTable 'footer' facet
String secondScrollerId = "richTable:scroller2";
- for(int i = 2; i <= 6; i++) {
+ for(int i = 2; i <= 5; i++) {
HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
currentDigital1.click();
@@ -256,7 +356,7 @@
checkLastPageButtons(page, firstScrollerId, secondScrollerId);
//scroll back
- for(int i = 5; i >= 1; i--) {
+ for(int i = 4; i >= 1; i--) {
HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
currentDigital1.click();
@@ -284,7 +384,7 @@
//dataScroller inside dataTable 'footer' facet
String secondScrollerId = "richTable:scroller2";
- for(int i = 2; i <= 6; i++) {
+ for(int i = 2; i <= 5; i++) {
HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
currentDigital2.click();
@@ -304,7 +404,7 @@
checkLastPageButtons(page, firstScrollerId, secondScrollerId);
//scroll back
- for(int i = 5; i >= 1; i--) {
+ for(int i = 4; i >= 1; i--) {
HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
currentDigital2.click();
@@ -333,25 +433,35 @@
private void checkFirstPageButtons(HtmlPage page, String firstScrollerId, String secondScrollerId) throws Exception {
HtmlElement fastForward = getFastForwardButton(page, firstScrollerId);
HtmlElement last = getLastButton(page, firstScrollerId);
+ HtmlElement next = getNextButton(page, firstScrollerId);
+ //check right buttons
assertEquals("a", fastForward.getNodeName());
assertEquals("rf-ds-btn rf-ds-r", fastForward.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
assertEquals("a", last.getNodeName());
assertEquals("rf-ds-btn rf-ds-r", last.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
+ assertEquals("a", next.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r", next.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
fastForward = getFastForwardButton(page, secondScrollerId);
last = getFastForwardButton(page, secondScrollerId);
-
+ next = getNextButton(page, secondScrollerId);
+
assertEquals("a", fastForward.getNodeName());
assertEquals("rf-ds-btn rf-ds-r", fastForward.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
assertEquals("a", last.getNodeName());
assertEquals("rf-ds-btn rf-ds-r", last.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
+ assertEquals("a", next.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r", next.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
//check if left buttons is disabled
HtmlElement fastRewind = getFastRewindButton(page, firstScrollerId);
HtmlElement first = getFirstButton(page, firstScrollerId);
+ HtmlElement previous = getPreviousButton(page, firstScrollerId);
assertEquals("span", fastRewind.getNodeName());
assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", fastRewind.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
@@ -359,20 +469,28 @@
assertEquals("span", first.getNodeName());
assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", first.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
+ assertEquals("span", previous.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", previous.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
fastRewind = getFastRewindButton(page, secondScrollerId);
first = getFirstButton(page, secondScrollerId);
+ next = getNextButton(page, secondScrollerId);
assertEquals("span", fastRewind.getNodeName());
assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", fastRewind.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
assertEquals("span", first.getNodeName());
- assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", first.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", first.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("span", previous.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis", previous.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
}
private void checkLastPageButtons(HtmlPage page, String firstScrollerId, String secondScrollerId) throws Exception {
//check if right buttons is disabled
HtmlElement fastForward = getFastForwardButton(page, firstScrollerId);
HtmlElement last = getLastButton(page, firstScrollerId);
+ HtmlElement next = getNextButton(page, firstScrollerId);
assertEquals("span", fastForward.getNodeName());
assertEquals("rf-ds-btn rf-ds-r rf-ds-dis", fastForward.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
@@ -380,8 +498,13 @@
assertEquals("span", last.getNodeName());
assertEquals("rf-ds-btn rf-ds-r rf-ds-dis", last.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
+ assertEquals("span", next.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r rf-ds-dis", next.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+
fastForward = getFastForwardButton(page, secondScrollerId);
last = getFastForwardButton(page, secondScrollerId);
+ next = getNextButton(page, secondScrollerId);
assertEquals("span", fastForward.getNodeName());
assertEquals("rf-ds-btn rf-ds-r rf-ds-dis", fastForward.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
@@ -389,9 +512,13 @@
assertEquals("span", last.getNodeName());
assertEquals("rf-ds-btn rf-ds-r rf-ds-dis", last.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
+ assertEquals("span", next.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r rf-ds-dis", next.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
//check if left buttons is enabled
HtmlElement fastRewind = getFastRewindButton(page, firstScrollerId);
HtmlElement first = getFirstButton(page, firstScrollerId);
+ HtmlElement previous = getPreviousButton(page, firstScrollerId);
assertEquals("a", fastRewind.getNodeName());
assertEquals("rf-ds-btn rf-ds-l", fastRewind.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
@@ -399,14 +526,21 @@
assertEquals("a", first.getNodeName());
assertEquals("rf-ds-btn rf-ds-l", first.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
+ assertEquals("a", previous.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l", previous.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
fastRewind = getFastRewindButton(page, secondScrollerId);
first = getFirstButton(page, secondScrollerId);
+ previous = getPreviousButton(page, secondScrollerId);
assertEquals("a", fastRewind.getNodeName());
assertEquals("rf-ds-btn rf-ds-l", fastRewind.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
assertEquals("a", first.getNodeName());
assertEquals("rf-ds-btn rf-ds-l", first.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("a", previous.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l", previous.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
}
private String getCurrentPageContent(HtmlPage page, int i) throws Exception {
@@ -416,6 +550,14 @@
return text.getNodeValue();
}
+ private HtmlElement getPreviousButton(HtmlPage page, String scrollerId) {
+ return page.getFirstByXPath("//*[@id = 'form:" + scrollerId +"_ds_prev']");
+ }
+
+ private HtmlElement getNextButton(HtmlPage page, String scrollerId) {
+ return page.getFirstByXPath("//*[@id = 'form:" + scrollerId +"_ds_next']");
+ }
+
private HtmlElement getFastRewindButton(HtmlPage page, String scrollerId) {
return page.getFirstByXPath("//*[@id = 'form:" + scrollerId +"_ds_fr']");
}
Modified: branches/RF-7560/ui/iteration/ui/src/test/resources/org/richfaces/renderkit/dataTableTest.xhtml
===================================================================
--- branches/RF-7560/ui/iteration/ui/src/test/resources/org/richfaces/renderkit/dataTableTest.xhtml 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/iteration/ui/src/test/resources/org/richfaces/renderkit/dataTableTest.xhtml 2010-09-03 18:18:05 UTC (rev 19120)
@@ -13,7 +13,7 @@
<h:body>
<h:form id="form">
- <it:dataScroller id="scroller1" for="richTable" page="#{dataScrollerBean.pageNumber}" maxPages="6"></it:dataScroller>
+ <it:dataScroller fastStep="2" id="scroller1" for="richTable" page="#{dataScrollerBean.pageNumber}" maxPages="5"></it:dataScroller>
<it:dataTable id="richTable" rowKeyVar="rowKey" var="content" value="#{dataScrollerBean.content}" rows="1">
<it:column>
<h:panelGroup id="pageContent">
@@ -21,7 +21,7 @@
</h:panelGroup>
</it:column>
<f:facet name="footer">
- <it:dataScroller id="scroller2" for="richTable" page="#{dataScrollerBean.pageNumber}" maxPages="6"></it:dataScroller>
+ <it:dataScroller fastStep="2" id="scroller2" for="richTable" page="#{dataScrollerBean.pageNumber}" maxPages="5"></it:dataScroller>
</f:facet>
</it:dataTable>
</h:form>
Copied: branches/RF-7560/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandEvent.java (from rev 19108, trunk/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandEvent.java)
===================================================================
--- branches/RF-7560/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandEvent.java (rev 0)
+++ branches/RF-7560/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandEvent.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.event;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public class ChangeExpandEvent extends FacesEvent {
+
+ private final Boolean isExpanded;
+
+
+ // ------------------------------------------------------------ Constructors
+
+ /**
+ * <p>Construct a new event object from the specified source component,
+ * old value, and new value.</p>
+ *
+ * <p>The default {@link javax.faces.event.PhaseId} for this event is {@link
+ * javax.faces.event.PhaseId#ANY_PHASE}.</p>
+ *
+ * @param component Source {@link UIComponent} for this event
+ * @param isExpanded
+ *
+ * @throws IllegalArgumentException if <code>component</code> is
+ * <code>null</code>
+ */
+ public ChangeExpandEvent(UIComponent component, Boolean isExpanded) {
+ super(component);
+ this.isExpanded = isExpanded;
+ }
+
+
+ // -------------------------------------------------------------- Properties
+
+ public Boolean getExpanded() {
+ return isExpanded;
+ }
+
+ // ------------------------------------------------- Event Broadcast Methods
+
+
+ @Override
+ public boolean isAppropriateListener(FacesListener listener) {
+ return listener instanceof ChangeExpandListener;
+ }
+
+ /**
+ * @throws javax.faces.event.AbortProcessingException {@inheritDoc}
+ */
+ @Override
+ public void processListener(FacesListener listener) {
+ ((ChangeExpandListener) listener).processChangeExpand(this);
+ }
+}
+
Copied: branches/RF-7560/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandListener.java (from rev 19108, trunk/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandListener.java)
===================================================================
--- branches/RF-7560/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandListener.java (rev 0)
+++ branches/RF-7560/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandListener.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.event;
+
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesListener;
+
+/**
+ * <p>A listener interface for receiving {@link ChangeExpandEvent}s. A class
+ * that is interested in receiving such events implements this interface, and
+ * then registers itself with the source {@link javax.faces.component.UIComponent} of interest, by
+ * calling <code>addChangeExpandListener()</code>.</p>
+ *
+ * @author akolonitsky
+ * @version 1.0
+ * @since 2010-08-27
+ *
+ */
+public interface ChangeExpandListener extends FacesListener {
+
+
+ /**
+ * <p>Invoked when {@link ChangeExpandEvent} occurs.</p>
+ *
+ * @param event The {@link ChangeExpandEvent} that has occurred
+ *
+ * @throws AbortProcessingException Signal the JavaServer Faces
+ * implementation that no further processing on the current event
+ * should be performed
+ */
+ public void processChangeExpand(ChangeExpandEvent event)
+ throws AbortProcessingException;
+
+}
Copied: branches/RF-7560/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandSource.java (from rev 19108, trunk/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandSource.java)
===================================================================
--- branches/RF-7560/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandSource.java (rev 0)
+++ branches/RF-7560/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandSource.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.event;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public interface ChangeExpandSource {
+
+ /**
+ * <p>Add a new {@link org.richfaces.event.ChangeExpandListener} to the set of listeners
+ * interested in being notified when {@link org.richfaces.event.ChangeExpandEvent}s occur.</p>
+ *
+ * @param listener The {@link org.richfaces.event.ChangeExpandListener} to be added
+ * @throws NullPointerException if <code>listener</code>
+ * is <code>null</code>
+ */
+ void addChangeExpandListener(ChangeExpandListener listener);
+
+ /**
+ * <p>Return the set of registered {@link org.richfaces.event.ChangeExpandListener}s for this instance.
+ * If there are no registered listeners, a zero-length array is returned.</p>
+ */
+ ChangeExpandListener[] getChangeExpandListeners();
+
+ /**
+ * <p>Remove an existing {@link org.richfaces.event.ChangeExpandListener} (if any) from the
+ * set of listeners interested in being notified when
+ * {@link org.richfaces.event.ChangeExpandEvent}s occur.</p>
+ *
+ * @param listener The {@link org.richfaces.event.ChangeExpandListener} to be removed
+ * @throws NullPointerException if <code>listener</code>
+ * is <code>null</code>
+ */
+ void removeChangeExpandListener(ChangeExpandListener listener);
+
+}
Copied: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java (from rev 19108, trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java)
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java (rev 0)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import org.richfaces.event.ChangeExpandEvent;
+import org.richfaces.event.ChangeExpandListener;
+import org.richfaces.event.ChangeExpandSource;
+import org.richfaces.event.ItemChangeEvent;
+
+import javax.el.MethodExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public abstract class AbstractCollapsiblePanel extends UITogglePanel implements ChangeExpandSource {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.CollapsiblePanel";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.CollapsiblePanel";
+
+ public enum States {
+ expanded("exp"),
+ collapsed("colps");
+
+ private final String abbreviation;
+
+ States(String abbreviation) {
+ this.abbreviation = abbreviation;
+ }
+
+ public String abbreviation() {
+ return abbreviation;
+ }
+ }
+
+ protected AbstractCollapsiblePanel() {
+ setRendererType("org.richfaces.CollapsiblePanel");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ @Override
+ public String getActiveItem() {
+ String ai = super.getActiveItem();
+ return ai == null ? "true" : ai;
+ }
+
+ @Override
+ protected boolean isActiveItem(UIComponent kid) {
+ return isExpanded();
+ }
+
+ @Override
+ protected boolean isActiveItem(UIComponent kid, String value) {
+ return isExpanded();
+ }
+
+
+ public boolean isExpanded() {
+ return Boolean.parseBoolean(getActiveItem());
+ }
+
+ public void setExpanded(boolean isExpanded) {
+ setActiveItem(String.valueOf(isExpanded));
+ }
+
+ public abstract String getHeader();
+
+ public abstract MethodExpression getChangeExpandListener();
+
+ @Override
+ public void queueEvent(FacesEvent facesEvent) {
+ ChangeExpandEvent event = null;
+ if ((facesEvent instanceof ItemChangeEvent) && (facesEvent.getComponent() == this)) {
+ event = new ChangeExpandEvent(this, Boolean.valueOf(((ItemChangeEvent) facesEvent).getNewItem()));
+
+ setEventPhase(event);
+ }
+
+ super.queueEvent(event != null ? event : facesEvent);
+ }
+
+ // ------------------------------------------------ Event Processing Methods
+
+ public void addChangeExpandListener(ChangeExpandListener listener) {
+ addFacesListener(listener);
+ }
+
+ public ChangeExpandListener[] getChangeExpandListeners() {
+ return (ChangeExpandListener[]) getFacesListeners(ChangeExpandListener.class);
+ }
+
+ public void removeChangeExpandListener(ChangeExpandListener listener) {
+ removeFacesListener(listener);
+ }
+}
Modified: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractDivPanel.java
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractDivPanel.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractDivPanel.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -27,7 +27,6 @@
/**
* @author akolonitsky
* @version 1.0
- * @since -4712-01-01
*
*/
public abstract class AbstractDivPanel extends UIOutput {
Modified: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -60,6 +60,14 @@
public static final String COMPONENT_FAMILY = "org.richfaces.TogglePanel";
+ public static final String META_NAME_FIRST = "@first";
+ public static final String META_NAME_PREV = "@prev";
+ public static final String META_NAME_NEXT = "@next";
+ public static final String META_NAME_LAST = "@last";
+
+ // TODO What is MessageId ?
+ public static final String UPDATE_MESSAGE_ID = "javax.faces.component.UIInput.UPDATE";
+
private String submittedActiveItem = null;
private enum PropertyKeys {
@@ -372,7 +380,7 @@
String previous = (String) getValue();
setValue(activeItem);
setSubmittedActiveItem(null);
- if (!previous.equalsIgnoreCase(activeItem)) {
+ if (previous != null && !previous.equalsIgnoreCase(activeItem)) {
queueEvent(new ItemChangeEvent(this, previous, activeItem));
}
}
@@ -380,18 +388,23 @@
@Override
public void queueEvent(FacesEvent event) {
if ((event instanceof ItemChangeEvent) && (event.getComponent() == this)) {
- if (isImmediate()) {
- event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
- } else if (isBypassUpdates()) {
- event.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
- } else {
- event.setPhaseId(PhaseId.INVOKE_APPLICATION);
- }
+ setEventPhase(event);
}
super.queueEvent(event);
}
+ protected void setEventPhase(FacesEvent event) {
+ if (isImmediate()) {
+ event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ } else if (isBypassUpdates()) {
+ event.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
+ } else {
+ event.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ }
+ }
+
+
@Override
public void broadcast(FacesEvent event) throws AbortProcessingException {
super.broadcast(event);
@@ -425,7 +438,7 @@
return isActiveItem(kid, getActiveItemValue());
}
- protected static boolean isActiveItem(UIComponent kid, String value) {
+ protected boolean isActiveItem(UIComponent kid, String value) {
if (kid == null || value == null) {
return false;
}
@@ -469,13 +482,13 @@
}
public AbstractTogglePanelItem getItem(String name) {
- if ("@first".equals(name)) {
+ if (META_NAME_FIRST.equals(name)) {
return getFirstItem();
- } else if ("@prev".equals(name)) {
+ } else if (META_NAME_PREV.equals(name)) {
return getPrevItem();
- } else if ("@next".equals(name)) {
+ } else if (META_NAME_NEXT.equals(name)) {
return getNextItem();
- } else if ("@last".equals(name)) {
+ } else if (META_NAME_LAST.equals(name)) {
return getLastItem();
} else {
return getItemByIndex(getChildIndex(name));
Modified: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -28,6 +28,7 @@
import javax.faces.context.FacesContext;
import javax.faces.render.Renderer;
import java.io.IOException;
+import java.util.Map;
/**
* @author akolonitsky
@@ -94,8 +95,9 @@
}
protected static void hidePanelItem(UIComponent item) {
- //TODO nick - attributes shouldn't be overwritten
- item.getAttributes().put(HtmlConstants.STYLE_ATTRIBUTE, "display:none");
+ Map<String,Object> attrs = item.getAttributes();
+ Object style = attrs.get(RendererUtils.HTML.STYLE_ATTRIBUTE);
+ attrs.put(RendererUtils.HTML.STYLE_ATTRIBUTE, "display:none; " + style);
}
public abstract String getName();
Modified: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -22,6 +22,8 @@
package org.richfaces.component;
+import org.richfaces.renderkit.html.DivPanelRenderer;
+
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import java.io.IOException;
@@ -36,6 +38,22 @@
public static final String COMPONENT_FAMILY = "org.richfaces.TogglePanelTitledItem";
+ public enum HeaderStates {
+ active("act"),
+ inactive("inact"),
+ disable("dis");
+
+ private final String abbreviation;
+
+ HeaderStates(String abbreviation) {
+ this.abbreviation = abbreviation;
+ }
+
+ public String abbreviation() {
+ return abbreviation;
+ }
+ }
+
protected AbstractTogglePanelTitledItem() {
setRendererType("org.richfaces.TogglePanelTitledItem");
}
@@ -61,14 +79,32 @@
}
encodeBegin(context);
- if (getRendersChildren()) {
- encodeChildren(context);
- } else if (this.getChildCount() > 0) {
- for (UIComponent kid : getChildren()) {
- kid.encodeAll(context);
+ if (!isDisabled()) {
+ if (getRendersChildren()) {
+ encodeChildren(context);
+ } else if (this.getChildCount() > 0) {
+ for (UIComponent kid : getChildren()) {
+ kid.encodeAll(context);
+ }
}
}
-
+
encodeEnd(context);
}
+
+ public UIComponent getHeaderFacet(Enum<?> state) {
+ return getHeaderFacet(this, state);
+ }
+
+ public static UIComponent getHeaderFacet(UIComponent component, Enum<?> state) {
+ UIComponent headerFacet = null;
+ if (state != null) {
+ headerFacet = component.getFacet("header" + DivPanelRenderer.capitalize(state.toString()));
+ }
+
+ if (headerFacet == null) {
+ headerFacet = component.getFacet("header");
+ }
+ return headerFacet;
+ }
}
Copied: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/UICollapsiblePanel.java (from rev 19108, trunk/ui/output/ui/src/main/java/org/richfaces/component/UICollapsiblePanel.java)
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/UICollapsiblePanel.java (rev 0)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/UICollapsiblePanel.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import javax.el.MethodExpression;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public class UICollapsiblePanel extends AbstractCollapsiblePanel {
+
+ public enum PropertyKeys {
+ header,
+ changeExpandListener
+ }
+
+ public String getHeader() {
+ return (String) getStateHelper().eval(PropertyKeys.header);
+ }
+
+ public void setHeader(String header) {
+ getStateHelper().put(PropertyKeys.header, header);
+ }
+
+ public MethodExpression getChangeExpandListener() {
+ return (MethodExpression) getStateHelper().get(PropertyKeys.changeExpandListener);
+ }
+
+ public void setChangeExpandListener(MethodExpression changeExpandListener) {
+ getStateHelper().put(PropertyKeys.changeExpandListener, changeExpandListener);
+ }
+}
Modified: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -36,7 +36,7 @@
}
public String getName() {
- return (String) getStateHelper().eval(PropertyKeys.name);
+ return (String) getStateHelper().eval(PropertyKeys.name, getId());
}
public void setName(String name) {
@@ -50,6 +50,4 @@
public void setSwitchType(SwitchType switchType) {
getStateHelper().put(PropertyKeys.switchType, switchType);
}
-
-
}
Modified: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -56,7 +56,7 @@
}
public String getTargetItem() {
- return (String) getStateHelper().eval(PropertyKeys.targetItem);
+ return (String) getStateHelper().eval(PropertyKeys.targetItem, AbstractTogglePanel.META_NAME_NEXT);
}
public void setTargetItem(String target) {
Copied: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java (from rev 19108, trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java)
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java (rev 0)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -0,0 +1,245 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component.html;
+
+import org.richfaces.component.UICollapsiblePanel;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public class HtmlCollapsiblePanel extends UICollapsiblePanel implements ClientBehaviorHolder {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.CollapsiblePanel";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.CollapsiblePanel";
+
+ private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList(
+ "switch",
+ "beforeswitch",
+ "click",
+ "dblclick",
+ "mousedown",
+ "mousemove",
+ "mouseout",
+ "mouseover",
+ "mouseup"
+ ));
+
+
+ public enum PropertyKeys {
+ bodyClass,
+ headerClass,
+ headerControlClass,
+ oncomplete,
+ onbeforedomupdate,
+ onswitch,
+ onbeforeswitch,
+ lang,
+ title,
+ style,
+ styleClass,
+ dir,
+ onclick,
+ ondblclick,
+ onmousedown,
+ onmousemove,
+ onmouseout,
+ onmouseover,
+ onmouseup
+ }
+
+ public HtmlCollapsiblePanel() {
+ setRendererType("org.richfaces.CollapsiblePanel");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public String getBodyClass() {
+ return (String) getStateHelper().eval(PropertyKeys.bodyClass);
+ }
+
+ public void setBodyClass(String bodyClass) {
+ getStateHelper().put(PropertyKeys.bodyClass, bodyClass);
+ }
+
+ public String getHeaderClass() {
+ return (String) getStateHelper().eval(PropertyKeys.headerClass);
+ }
+
+ public void setHeaderClass(String headerClass) {
+ getStateHelper().put(PropertyKeys.headerClass, headerClass);
+ }
+
+ public String getHeaderControlClass() {
+ return (String) getStateHelper().eval(PropertyKeys.headerControlClass);
+ }
+
+ public void setHeaderControlClass(String headerControlClass) {
+ getStateHelper().put(PropertyKeys.headerControlClass, headerControlClass);
+ }
+
+ public String getOncomplete() {
+ return (String) getStateHelper().eval(PropertyKeys.oncomplete);
+ }
+
+ public void setOncomplete(String oncomplete) {
+ getStateHelper().put(PropertyKeys.oncomplete, oncomplete);
+ }
+
+ public String getOnbeforedomupdate() {
+ return (String) getStateHelper().eval(PropertyKeys.onbeforedomupdate);
+ }
+
+ public void setOnbeforedomupdate(String onbeforedomupdate) {
+ getStateHelper().put(PropertyKeys.onbeforedomupdate, onbeforedomupdate);
+ }
+
+ public String getOnswitch() {
+ return (String) getStateHelper().eval(PropertyKeys.onswitch);
+ }
+
+ public void setOnswitch(String onswitch) {
+ getStateHelper().put(PropertyKeys.onswitch, onswitch);
+ }
+
+ public String getOnbeforeswitch() {
+ return (String) getStateHelper().eval(PropertyKeys.onbeforeswitch);
+ }
+
+ public void setOnbeforeswitch(String onbeforeswitch) {
+ getStateHelper().put(PropertyKeys.onbeforeswitch, onbeforeswitch);
+ }
+
+ public String getLang() {
+ return (String) getStateHelper().eval(PropertyKeys.lang);
+ }
+
+ public void setLang(String lang) {
+ getStateHelper().put(PropertyKeys.lang, lang);
+ }
+
+ public String getTitle() {
+ return (String) getStateHelper().eval(PropertyKeys.title);
+ }
+
+ public void setTitle(String title) {
+ getStateHelper().put(PropertyKeys.title, title);
+ }
+
+ 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 getDir() {
+ return (String) getStateHelper().eval(PropertyKeys.dir);
+ }
+
+ public void setDir(String dir) {
+ getStateHelper().put(PropertyKeys.dir, dir);
+ }
+
+ 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 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);
+ }
+
+
+
+ @Override
+ public Collection<String> getEventNames() {
+ return EVENT_NAMES;
+ }
+}
+
Copied: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionChangeExpandListener.java (from rev 19108, trunk/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionChangeExpandListener.java)
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionChangeExpandListener.java (rev 0)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionChangeExpandListener.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.event;
+
+import javax.el.MethodExpression;
+import javax.faces.event.AbortProcessingException;
+
+/**
+ * <p><strong><span
+ * class="changed_modified_2_0">MethodExpressionChangeExpandListener</span></strong>
+ * is a {@link ChangeExpandListener} that wraps a {@link
+ * MethodExpression}. When it receives a {@link ChangeExpandEvent}, it
+ * executes a method on an object identified by the {@link
+ * MethodExpression}.</p>
+ *
+ * @author akolonitsky
+ * @version 1.0
+ *
+ */
+public class MethodExpressionChangeExpandListener extends MethodExpressionEventListener implements ChangeExpandListener {
+
+ public MethodExpressionChangeExpandListener() {
+ super();
+ }
+
+ public MethodExpressionChangeExpandListener(MethodExpression methodExprOneArg) {
+ super(methodExprOneArg);
+ }
+
+ public MethodExpressionChangeExpandListener(MethodExpression methodExprOneArg, MethodExpression methodExprZeroArg) {
+ super(methodExprOneArg, methodExprZeroArg);
+ }
+
+ // ------------------------------------------------------- Listener Method
+
+ public void processChangeExpand(ChangeExpandEvent changeExpandEvent) throws AbortProcessingException {
+ processEvent(changeExpandEvent);
+ }
+}
Modified: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionItemChangeListener.java
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionItemChangeListener.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionItemChangeListener.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -22,13 +22,7 @@
package org.richfaces.event;
-import javax.el.ELContext;
-import javax.el.ELException;
import javax.el.MethodExpression;
-import javax.el.MethodNotFoundException;
-import javax.faces.component.StateHolder;
-import javax.faces.component.UIComponentBase;
-import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
/**
@@ -44,158 +38,23 @@
* @since -4712-01-01
*
*/
-//TODO nick - good candidate for utility class
-public class MethodExpressionItemChangeListener implements ItemChangeListener, StateHolder {
+public class MethodExpressionItemChangeListener extends MethodExpressionEventListener implements ItemChangeListener {
- private static final Class<?>[] ITEM_CHANGE_LISTENER_ZERO_ARG_SIG = new Class[] {};
-
- private static final Object[] NO_PARAMS = new Object[0];
-
- // ------------------------------------------------------ Instance Variables
-
- private MethodExpression methodExpressionOneArg = null;
- private MethodExpression methodExpressionZeroArg = null;
-
- private boolean isTransient;
-
public MethodExpressionItemChangeListener() {
}
- /**
- * <p><span class="changed_modified_2_0">Construct</span> a {@link
- * ItemChangeListener} that contains a {@link
- * MethodExpression}.<span
- * class="changed_added_2_0">To accomodate method expression targets
- * that take no arguments instead of taking a {@link
- * ItemChangeEvent} argument</span>, the implementation of this
- * class must take the argument <code>methodExpressionOneArg</code>,
- * extract its expression string, and create another
- * <code>MethodExpression</code> whose expected param types match
- * those of a zero argument method. The usage requirements for both
- * of these <code>MethodExpression</code> instances are described in
- * {@link #processItemChange}.</p>
- *
- * @param methodExpressionOneArg a <code>MethodExpression</code>
- * that points to a method that returns <code>void</code> and takes
- * a single argument of type {@link ItemChangeEvent}.
- */
- public MethodExpressionItemChangeListener(MethodExpression methodExpressionOneArg) {
-
- super();
- this.methodExpressionOneArg = methodExpressionOneArg;
- FacesContext context = FacesContext.getCurrentInstance();
- ELContext elContext = context.getELContext();
- this.methodExpressionZeroArg = context.getApplication().
- getExpressionFactory().createMethodExpression(elContext,
- methodExpressionOneArg.getExpressionString(), Void.class,
- ITEM_CHANGE_LISTENER_ZERO_ARG_SIG);
+ public MethodExpressionItemChangeListener(MethodExpression methodExprOneArg) {
+ super(methodExprOneArg);
}
- /**
- * <p>Construct a {@link ItemChangeListener} that contains a {@link MethodExpression}.</p>
- *
- * @param methodExpressionOneArg
- * @param methodExpressionZeroArg
- */
- public MethodExpressionItemChangeListener(MethodExpression methodExpressionOneArg,
- MethodExpression methodExpressionZeroArg) {
-
- super();
- this.methodExpressionOneArg = methodExpressionOneArg;
- this.methodExpressionZeroArg = methodExpressionZeroArg;
+ public MethodExpressionItemChangeListener(MethodExpression methodExprOneArg, MethodExpression methodExprZeroArg) {
+ super(methodExprOneArg, methodExprZeroArg);
}
- // ------------------------------------------------------- Event Method
+ // ------------------------------------------------------- Listener Method
- /**
- * <p><span class="changed_modified_2_0">Call</span> through to the
- * {@link MethodExpression} passed in our constructor. <span
- * class="changed_added_2_0">First, try to invoke the
- * <code>MethodExpression</code> passed to the constructor of this
- * instance, passing the argument {@link ItemChangeEvent} as the
- * argument. If a {@link MethodNotFoundException} is thrown, call
- * to the zero argument <code>MethodExpression</code> derived from
- * the <code>MethodExpression</code> passed to the constructor of
- * this instance. If that fails for any reason, throw an {@link
- * AbortProcessingException}, including the cause of the
- * failure.</span></p>
- *
- * @throws NullPointerException {@inheritDoc}
- * @throws AbortProcessingException {@inheritDoc}
- */
public void processItemChange(ItemChangeEvent itemChangeEvent) throws AbortProcessingException {
-
- if (itemChangeEvent == null) {
- throw new NullPointerException();
- }
- FacesContext context = FacesContext.getCurrentInstance();
- ELContext elContext = context.getELContext();
- // PENDING: The corresponding code in MethodExpressionActionListener
- // has an elaborate message capture, logging, and rethrowing block.
- // Why not here?
- try {
- methodExpressionOneArg.invoke(elContext, new Object[] {itemChangeEvent});
- } catch (MethodNotFoundException mnf) {
- if (null != methodExpressionZeroArg) {
-
- try {
- // try to invoke a no-arg version
- methodExpressionZeroArg.invoke(elContext, NO_PARAMS);
- } catch (ELException e) {
- throw new AbortProcessingException(e.getMessage(), e.getCause());
- }
- }
- } catch (ELException e) {
- throw new AbortProcessingException(e.getMessage(), e.getCause());
- }
+ processEvent(itemChangeEvent);
}
-
-
- // ------------------------------------------------ Methods from StateHolder
-
-
- /**
- * <p class="changed_modified_2_0">Both {@link MethodExpression}
- * instances described in the constructor must be saved.</p>
- */
- public Object saveState(FacesContext context) {
- if (context == null) {
- throw new NullPointerException();
- }
-
- return new Object[] {
- UIComponentBase.saveAttachedState(context, methodExpressionOneArg),
- UIComponentBase.saveAttachedState(context, methodExpressionZeroArg)
- };
- }
-
-
- /**
- * <p class="changed_modified_2_0">Both {@link MethodExpression}
- * instances described in the constructor must be restored.</p>
- */
- public void restoreState(FacesContext context, Object state) {
- if (context == null) {
- throw new NullPointerException();
- }
-
- if (state == null) {
- return;
- }
-
- methodExpressionOneArg = (MethodExpression) UIComponentBase
- .restoreAttachedState(context, ((Object[]) state)[0]);
- methodExpressionZeroArg = (MethodExpression) UIComponentBase
- .restoreAttachedState(context, ((Object[]) state)[1]);
- }
-
-
- public boolean isTransient() {
- return isTransient;
- }
-
- public void setTransient(boolean newTransientValue) {
- isTransient = newTransientValue;
- }
}
Modified: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -23,9 +23,9 @@
package org.richfaces.renderkit.html;
import org.ajax4jsf.javascript.JSObject;
-import org.richfaces.component.AbstractTogglePanelItem;
import org.richfaces.component.AbstractTogglePanelTitledItem;
import org.richfaces.renderkit.HtmlConstants;
+import org.richfaces.renderkit.RenderKitUtils;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
@@ -33,16 +33,22 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import java.io.IOException;
+import java.util.Map;
+import static org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates;
+import static org.richfaces.component.html.HtmlAccordionItem.PropertyKeys;
+import static org.richfaces.component.util.HtmlUtil.concatClasses;
+import static org.richfaces.renderkit.RenderKitUtils.renderPassThroughAttributes;
+
/**
*
- * <div id="clientId" class="rf-aci">
- * <div id="clientId:header" class="rf-aci-h">
- * <div class="rf-aci-h-inactive">Level 1</div>
- * <div class="rf-aci-h-active" >Level 1</div>
- * <div class="rf-aci-h-disabled">Level 1</div>
+ * <div id="clientId" class="rf-ac-itm">
+ * <div id="clientId:header" class="rf-ac-itm-hdr">
+ * <div class="rf-ac-itm-hdr-inact">Level 1</div>
+ * <div class="rf-ac-itm-hdr-act" >Level 1</div>
+ * <div class="rf-ac-itm-hdr-dis">Level 1</div>
* </div>
- * <div id="clientId:content" class="rf-aci-c">
+ * <div id="clientId:content" class="rf-ac-itm-cnt">
* Content will be here.
* </div>
* </div>
@@ -50,7 +56,7 @@
* @author akolonitsky
* @since 2010-08-05
*/
-@ResourceDependencies({ // TODO review
+@ResourceDependencies({
@ResourceDependency(library = "javax.faces", name = "jsf.js"),
@ResourceDependency(name = "jquery.js"),
@ResourceDependency(name = "richfaces.js"),
@@ -61,6 +67,14 @@
})
public class AccordionItemRenderer extends TogglePanelItemRenderer {
+ private static final RenderKitUtils.Attributes HEADER_ATTRIBUTES = RenderKitUtils.attributes()
+ .generic("style", PropertyKeys.headerStyle.toString())
+ .generic("onclick", PropertyKeys.onheaderclick.toString(), "headerclick")
+ .generic("ondblclick", PropertyKeys.onheaderdblclick.toString(), "headerdblclick")
+ .generic("onmousedown", PropertyKeys.onheadermousedown.toString(), "headermousedown")
+ .generic("onmousemove", PropertyKeys.onheadermousemove.toString(), "headermousemove")
+ .generic("onmouseup", PropertyKeys.onheadermouseup.toString(), "headermouseup");
+
@Override
protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
super.doEncodeBegin(writer, context, component);
@@ -72,35 +86,36 @@
@Override
protected String getStyleClass(UIComponent component) {
- return "rf-aci " + attributeAsString(component, "styleClass");
+ return concatClasses("rf-ac-itm", attributeAsString(component, "styleClass"));
}
@Override
protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
encodeContentEnd(component, writer);
- super.doEncodeEnd(writer, context, component); //To change body of overridden methods use File | Settings | File Templates.
+ super.doEncodeEnd(writer, context, component);
}
@Override
protected void writeJavaScript(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
- // todo how to call method from parent of parent class?
-
Object script = getScriptObject(context, component);
- if (script != null) {
- writer.startElement(HtmlConstants.SCRIPT_ELEM, component);
- writer.writeAttribute(HtmlConstants.TYPE_ATTR, "text/javascript", "type");
- writer.writeText(script, null);
- writer.endElement(HtmlConstants.SCRIPT_ELEM);
+ if (script == null) {
+ return;
}
+
+ writer.startElement(RendererUtils.HTML.SCRIPT_ELEM, component);
+ writer.writeAttribute(RendererUtils.HTML.TYPE_ATTR, "text/javascript", "type");
+ writer.writeText(script, null);
+ writer.endElement(RendererUtils.HTML.SCRIPT_ELEM);
}
private void encodeContentBegin(UIComponent component, ResponseWriter writer) throws IOException {
writer.startElement("div", component);
- writer.writeAttribute("class", "rf-aci-c " + attributeAsString(component, "contentClass"), null);
+ writer.writeAttribute("class", concatClasses("rf-ac-itm-cnt", attributeAsString(component, "contentClass")), null);
writer.writeAttribute("id", component.getClientId() + ":content", null);
- if (!((AbstractTogglePanelItem) component).isActive()) {
+ AbstractTogglePanelTitledItem item = (AbstractTogglePanelTitledItem) component;
+ if (!item.isActive() || item.isDisabled()) {
writer.writeAttribute("style", "display: none", null);
}
}
@@ -109,24 +124,25 @@
responseWriter.endElement("div");
}
- private void encodeHeader(FacesContext facesContext, UIComponent component, ResponseWriter responseWriter) throws IOException {
+ private void encodeHeader(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException {
- responseWriter.startElement("div", component);
- responseWriter.writeAttribute("class", "rf-aci-h " + attributeAsString(component, "contentClass"), null);
- responseWriter.writeAttribute("id", component.getClientId() + ":header", null);
+ writer.startElement("div", component);
+ writer.writeAttribute("class", concatClasses("rf-ac-itm-hdr", attributeAsString(component, PropertyKeys.headerClass)), null);
+ writer.writeAttribute("id", component.getClientId() + ":header", null);
+ renderPassThroughAttributes(context, component, HEADER_ATTRIBUTES);
AbstractTogglePanelTitledItem titledItem = (AbstractTogglePanelTitledItem) component;
boolean isActive = titledItem.isActive();
boolean isDisabled = titledItem.isDisabled();
- encodeHeader(facesContext, component, responseWriter, "inactive", !isActive && !isDisabled);
- encodeHeader(facesContext, component, responseWriter, "active", isActive && !isDisabled);
- encodeHeader(facesContext, component, responseWriter, "disable", isDisabled);
+ encodeHeader(context, titledItem, writer, HeaderStates.inactive, !isActive && !isDisabled);
+ encodeHeader(context, titledItem, writer, HeaderStates.active, isActive && !isDisabled);
+ encodeHeader(context, titledItem, writer, HeaderStates.disable, isDisabled);
- responseWriter.endElement("div");
+ writer.endElement("div");
}
- private void encodeHeader(FacesContext facesContext, UIComponent component, ResponseWriter writer,
- String state, Boolean isDisplay) throws IOException {
+ private void encodeHeader(FacesContext facesContext, AbstractTogglePanelTitledItem component, ResponseWriter writer,
+ HeaderStates state, Boolean isDisplay) throws IOException {
writer.startElement("div", component);
@@ -134,11 +150,10 @@
writer.writeAttribute("style", "display : none", null);
}
- String name = "headerClass" + capitalize(state);
- writer.writeAttribute("class", "rf-aci-h-" + state + " " + attributeAsString(component, name), name);
+ String name = "headerClass" + capitalize(state.toString());
+ writer.writeAttribute("class", concatClasses("rf-ac-itm-hdr-" + state.abbreviation(), attributeAsString(component, name)), null);
-
- UIComponent headerFacet = component.getFacet("header" + capitalize(state));
+ UIComponent headerFacet = component.getHeaderFacet(state);
if (headerFacet != null && headerFacet.isRendered()) {
headerFacet.encodeAll(facesContext);
} else {
@@ -158,6 +173,14 @@
}
@Override
+ protected Map<String, Object> getScriptObjectOptions(FacesContext context, UIComponent component) {
+ Map<String, Object> res = super.getScriptObjectOptions(context, component);
+ res.put("disabled", ((AbstractTogglePanelTitledItem) component).isDisabled());
+
+ return res;
+ }
+
+ @Override
protected Class<? extends UIComponent> getComponentClass() {
return AbstractTogglePanelTitledItem.class;
}
Modified: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -39,9 +39,8 @@
/**
* @author akolonitsky
- * @since 2010-08-05
*/
-@ResourceDependencies( { // TODO review
+@ResourceDependencies( {
@ResourceDependency(library = "javax.faces", name = "jsf.js"),
@ResourceDependency(name = "jquery.js"),
@ResourceDependency(name = "richfaces.js"),
@@ -69,7 +68,7 @@
@Override
protected String getStyleClass(UIComponent component) {
- return "rf-ac " + attributeAsString(component, "styleClass");
+ return HtmlUtil.concatClasses("rf-ac", attributeAsString(component, "styleClass"));
}
@Override
Copied: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java (from rev 19108, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java)
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java (rev 0)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -0,0 +1,240 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit.html;
+
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.component.AbstractCollapsiblePanel;
+import org.richfaces.component.AbstractTogglePanel;
+import org.richfaces.component.AbstractTogglePanelTitledItem;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.richfaces.component.AbstractCollapsiblePanel.States.*;
+import static org.richfaces.component.util.HtmlUtil.concatClasses;
+import static org.richfaces.component.util.HtmlUtil.concatStyles;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+@ResourceDependencies( {
+ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(name = "richfaces-event.js"),
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(library = "org.richfaces", name = "TogglePanel.js"),
+ @ResourceDependency(library = "org.richfaces", name = "TogglePanelItem.js"),
+ @ResourceDependency(library = "org.richfaces", name = "CollapsiblePanel.js"),
+ @ResourceDependency(library = "org.richfaces", name = "CollapsiblePanelItem.js"),
+ @ResourceDependency(library = "org.richfaces", name = "collapsiblePanel.ecss") })
+public class CollapsiblePanelRenderer extends TogglePanelRenderer {
+
+ public static final String SWITCH = "switch";
+ public static final String BEFORE_SWITCH = "beforeswitch";
+
+ @Override
+ protected void doDecode(FacesContext context, UIComponent component) {
+ AbstractTogglePanel panel = (AbstractTogglePanel) component;
+
+ Map<String, String> requestMap =
+ context.getExternalContext().getRequestParameterMap();
+
+ // Don't overwrite the value unless you have to!
+ String newValue = requestMap.get(getValueRequestParamName(context, component));
+ if (newValue != null) {
+ panel.setSubmittedActiveItem(newValue);
+ }
+
+ String compClientId = component.getClientId(context);
+ String clientId = requestMap.get(compClientId);
+ if (clientId != null && clientId.equals(compClientId)) {
+ String itemClientId = clientId + (Boolean.parseBoolean(newValue) ? ":content" : ":empty");
+ context.getPartialViewContext().getRenderIds().add(itemClientId);
+
+ //TODO nick - this should be done on encode, not on decode
+ addOnCompleteParam(newValue, panel.getClientId());
+ }
+ }
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent comp) throws IOException {
+ super.doEncodeBegin(writer, context, comp);
+
+ encodeHeader(context, comp, writer);
+ }
+
+ @Override
+ protected String getStyleClass(UIComponent component) {
+ return concatClasses("rf-cp", super.getStyleClass(component));
+ }
+
+ @Override
+ protected JSObject getScriptObject(FacesContext context, UIComponent component) {
+ return new JSObject("RichFaces.ui.CollapsiblePanel",
+ component.getClientId(), getScriptObjectOptions(context, component));
+ }
+
+ @Override
+ protected Map<String, Object> getScriptObjectOptions(FacesContext context, UIComponent component) {
+ AbstractTogglePanel panel = (AbstractTogglePanel) component;
+
+ Map<String, Object> options = new HashMap<String, Object>();
+ options.put("activeItem", panel.getActiveItem());
+ options.put("ajax", getAjaxOptions(context, panel));
+ options.put("switchMode", panel.getSwitchType());
+
+ TogglePanelRenderer.addEventOption(context, panel, options, SWITCH);
+ TogglePanelRenderer.addEventOption(context, panel, options, BEFORE_SWITCH);
+
+ return options;
+ }
+
+ private void encodeHeader(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException {
+ writer.startElement("div", component);
+ writer.writeAttribute("id", component.getClientId(context) + ":header", null);
+ writer.writeAttribute("class", concatClasses("rf-cp-hdr", attributeAsString(component, "headerClass")), null);
+
+ AbstractCollapsiblePanel panel = (AbstractCollapsiblePanel) component;
+ encodeHeader(context, component, writer, expanded, panel.isExpanded());
+ encodeHeader(context, component, writer, collapsed, !panel.isExpanded());
+
+ writer.endElement("div");
+ }
+
+ private void encodeHeader(FacesContext context, UIComponent component, ResponseWriter responseWriter, AbstractCollapsiblePanel.States state, boolean isVisible) throws IOException {
+ responseWriter.startElement("div", component);
+ responseWriter.writeAttribute("class", "rf-cp-hdr-" + state.abbreviation(), null);
+ responseWriter.writeAttribute("style", concatStyles(styleElement("display", isVisible ? "" : "none"), attributeAsString(component, "headerClass")), null);
+
+ UIComponent header = AbstractTogglePanelTitledItem.getHeaderFacet(component, state);
+ if (header != null && header.isRendered()) {
+ header.encodeAll(context);
+ } else {
+ String headerText = (String) component.getAttributes().get("header");
+ if (headerText != null && !headerText.isEmpty()) {
+ responseWriter.writeText(headerText, null);
+ }
+ }
+
+ responseWriter.endElement("div");
+ }
+
+ @Override
+ protected void doEncodeChildren(ResponseWriter writer, FacesContext context, UIComponent component)
+ throws IOException {
+
+ AbstractCollapsiblePanel panel = (AbstractCollapsiblePanel) component;
+
+ encodeContentChild(writer, context, component, panel);
+ encodeEmptyChild(writer, context, component, panel);
+ }
+
+ private void encodeContentChild(ResponseWriter writer, FacesContext context, UIComponent component, AbstractCollapsiblePanel panel) throws IOException {
+ if (panel.isExpanded()) {
+ encodeContent(writer, context, component, true);
+ } else {
+ switch (panel.getSwitchType()) {
+ case client:
+ encodeContent(writer, context, component, false);
+ break;
+
+ case ajax:
+ context.getResponseWriter().write(getPlaceHolder(panel.getClientId() + ":content"));
+ break;
+
+ case server:
+ // Do nothing.
+ break;
+
+ default:
+ throw new IllegalStateException("Unknown switch type : " + panel.getSwitchType());
+ }
+ }
+ }
+
+ private void encodeEmptyChild(ResponseWriter writer, FacesContext context, UIComponent component, AbstractCollapsiblePanel panel) throws IOException {
+ if (!panel.isExpanded()) {
+ encodeEmptyDiv(writer, context, component, true);
+ } else {
+ switch (panel.getSwitchType()) {
+ case client:
+ encodeEmptyDiv(writer, context, component, false);
+ break;
+
+ case ajax:
+ context.getResponseWriter().write(getPlaceHolder(panel.getClientId() + ":empty"));
+ break;
+
+ case server:
+ // Do nothing.
+ break;
+
+ default:
+ throw new IllegalStateException("Unknown switch type : " + panel.getSwitchType());
+ }
+ }
+ }
+
+ private String getPlaceHolder(String id) {
+ return "<div id=\"" + id + "\" style=\"display: none\" ></div>";
+ }
+
+ private void encodeContent(ResponseWriter writer, FacesContext context, UIComponent component, boolean visible) throws IOException {
+ writer.startElement("div", component);
+ writer.writeAttribute("id", component.getClientId() + ":content", null);
+ writer.writeAttribute("class", concatClasses("rf-cp-b", attributeAsString(component, "bodyClass")), null);
+ writer.writeAttribute("style", concatStyles(visible ? "" : "none", attributeAsString(component, "style")), null);
+
+ renderChildren(context, component);
+
+ writer.endElement("div");
+ }
+
+ private void encodeEmptyDiv(ResponseWriter writer, FacesContext context, UIComponent component, boolean visible) throws IOException {
+ writer.startElement("div", component);
+ writer.writeAttribute("id", component.getClientId() + ":empty", null);
+ writer.writeAttribute("class", "rf-cp-empty", null);
+ writer.writeAttribute("style", styleElement("display", visible ? "" : "none"), null);
+ writer.endElement("div");
+ }
+
+ @Override
+ protected List<JSObject> getChildrenScriptObjects(FacesContext context, UIComponent component) {
+ return null;
+ }
+
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return AbstractCollapsiblePanel.class;
+ }
+}
+
Modified: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -62,12 +62,18 @@
return "";
}
+ return styleElement(attr, value);
+ }
+
+ protected static String styleElement(Object name, Object value) {
return new StringBuilder()
- .append(attr).append(':').append(value).toString();
+ .append(name).append(':').append(value).toString();
}
+
protected static String attributeAsString(UIComponent comp, Enum attr) {
return attributeAsString(comp, attr.toString());
}
+
protected static String attributeAsString(UIComponent comp, String attr) {
Object o = comp.getAttributes().get(attr);
return o == null ? "" : o.toString();
@@ -80,7 +86,7 @@
* @return Capitalized string.
* @throws IllegalArgumentException String is <kk>null</kk> or empty.
*/
- protected static String capitalize(final String string) {
+ public static String capitalize(final String string) {
return Character.toUpperCase(string.charAt(0)) + string.substring(1);
}
Modified: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -54,7 +54,7 @@
@Override
protected String getStyleClass(UIComponent component) {
- return HtmlUtil.concatClasses("rf-tgp-i", attributeAsString(component, "styleClass"));
+ return HtmlUtil.concatClasses("rf-tgp-itm", attributeAsString(component, "styleClass"));
}
@Override
Modified: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -60,7 +60,7 @@
@ResourceDependency(library = "org.richfaces", name = "TogglePanel.js") })
public class TogglePanelRenderer extends DivPanelRenderer {
- private static final String VALUE_POSTFIX = "-value";
+ public static final String VALUE_POSTFIX = "-value";
private static final String ON = "on";
private static final String ITEM_CHANGE = "itemchange";
@@ -74,7 +74,7 @@
context.getExternalContext().getRequestParameterMap();
// Don't overwrite the value unless you have to!
- String newValue = requestMap.get(getActiveItemRequestParamName(context, component));
+ String newValue = requestMap.get(getValueRequestParamName(context, component));
if (newValue != null) {
panel.setSubmittedActiveItem(newValue);
}
@@ -92,7 +92,7 @@
}
}
- private static void addOnCompleteParam(String newValue, String panelId) {
+ protected static void addOnCompleteParam(String newValue, String panelId) {
StringBuilder onComplete = new StringBuilder();
onComplete.append("RichFaces.$('").append(panelId)
.append("').onCompleteHandler('").append(newValue).append("');");
@@ -100,7 +100,7 @@
AjaxContext.getCurrentInstance().appendOncomplete(onComplete.toString());
}
- private static String getActiveItemRequestParamName(FacesContext context, UIComponent component) {
+ public static String getValueRequestParamName(FacesContext context, UIComponent component) {
return component.getClientId(context) + VALUE_POSTFIX;
}
@@ -111,12 +111,12 @@
super.doEncodeBegin(writer, context, comp);
AbstractTogglePanel panel = (AbstractTogglePanel) comp;
- writer.startElement(HtmlConstants.INPUT_ELEM, comp);
- writer.writeAttribute(HtmlConstants.TYPE_ATTR, HtmlConstants.INPUT_TYPE_HIDDEN, null);
- writer.writeAttribute(HtmlConstants.VALUE_ATTRIBUTE, panel.getActiveItem(), "activeItem");
- writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, getActiveItemRequestParamName(context, comp), null);
- writer.writeAttribute(HtmlConstants.NAME_ATTRIBUTE, getActiveItemRequestParamName(context, comp), null);
- writer.endElement(HtmlConstants.INPUT_ELEM);
+ writer.startElement(HTML.INPUT_ELEM, comp);
+ writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
+ writer.writeAttribute(HTML.VALUE_ATTRIBUTE, panel.getActiveItem(), "activeItem");
+ writer.writeAttribute(HTML.ID_ATTRIBUTE, getValueRequestParamName(context, comp), null);
+ writer.writeAttribute(HTML.NAME_ATTRIBUTE, getValueRequestParamName(context, comp), null);
+ writer.endElement(HTML.INPUT_ELEM);
}
@Override
@@ -127,7 +127,7 @@
@Override
protected void doEncodeChildren(ResponseWriter writer, FacesContext context, UIComponent component)
throws IOException {
-
+
renderChildren(context, component);
}
@@ -141,7 +141,7 @@
protected Map<String, Object> getScriptObjectOptions(FacesContext context, UIComponent component) {
AbstractTogglePanel panel = (AbstractTogglePanel) component;
- Map<String, Object> options = new HashMap<String, Object>(5);
+ Map<String, Object> options = new HashMap<String, Object>();
options.put("activeItem", panel.getActiveItem());
options.put("cycledSwitching", panel.isCycledSwitching());
options.put("items", getChildrenScriptObjects(context, panel));
@@ -155,11 +155,11 @@
public static void addEventOption(FacesContext context, UIComponent component, Map<String, Object> options,
String eventName) {
-
+
HandlersChain handlersChain = new HandlersChain(context, component);
handlersChain.addInlineHandlerFromAttribute(ON + eventName);
handlersChain.addBehaviors(eventName);
- handlersChain.addAjaxSubmitFunction();
+// handlersChain.addAjaxSubmitFunction();
String handler = handlersChain.toScript();
if (handler != null) {
@@ -168,11 +168,11 @@
}
}
- private static AjaxEventOptions getAjaxOptions(FacesContext context, UIComponent panel) {
+ public static AjaxEventOptions getAjaxOptions(FacesContext context, UIComponent panel) {
return AjaxRendererUtils.buildEventOptions(context, panel);
}
- private List<JSObject> getChildrenScriptObjects(FacesContext context, UIComponent component) {
+ protected List<JSObject> getChildrenScriptObjects(FacesContext context, UIComponent component) {
List<JSObject> res = new ArrayList<JSObject>(component.getChildCount());
for (UIComponent child : component.getChildren()) {
res.add(getChildScriptObject(context, (AbstractTogglePanelItem) child));
Copied: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java (from rev 19108, trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java)
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java (rev 0)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.view.facelets.html;
+
+import org.richfaces.event.ChangeExpandEvent;
+import org.richfaces.event.ChangeExpandListener;
+import org.richfaces.event.ChangeExpandSource;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.TagConfig;
+
+/**
+ *
+ * @author akolonitsky
+ * @version 1.0
+ */
+public final class ChangeExpandListenerHandler extends EventListenerHandler {
+
+ private static class LazyChangeExpandListener extends LazyEventListener<ChangeExpandListener> implements ChangeExpandListener {
+ private static final long serialVersionUID = -391020876192823200L;
+
+ LazyChangeExpandListener(String type, ValueExpression binding) {
+ super(type, binding);
+ }
+
+ public void processChangeExpand(ChangeExpandEvent event) throws AbortProcessingException {
+ processEvent(event);
+ }
+ }
+
+ public ChangeExpandListenerHandler(TagConfig config) {
+ super(config);
+ }
+
+ public void applyAttachedObject(FacesContext context, UIComponent parent) {
+ ValueExpression expression = null;
+ if (this.binding != null) {
+ FaceletContext ctx = (FaceletContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
+ expression = this.binding.getValueExpression(ctx, ChangeExpandListener.class);
+ }
+
+ ChangeExpandSource source = (ChangeExpandSource) parent;
+ source.addChangeExpandListener(new LazyChangeExpandListener(this.listenerType, expression));
+ }
+
+ @Override
+ public boolean isEventSource(UIComponent comp) {
+ return comp instanceof ChangeExpandSource;
+ }
+}
+
Copied: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/CollapsiblePanelTagHandler.java (from rev 19108, trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/CollapsiblePanelTagHandler.java)
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/CollapsiblePanelTagHandler.java (rev 0)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/CollapsiblePanelTagHandler.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.view.facelets.html;
+
+import org.richfaces.component.AbstractCollapsiblePanel;
+
+import org.richfaces.event.MethodExpressionChangeExpandListener;
+import org.richfaces.event.ChangeExpandEvent;
+
+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;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public class CollapsiblePanelTagHandler extends ComponentHandler {
+
+ private static final MetaRule META_RULE = new CollapsiblePanelMetaRule();
+
+
+ public CollapsiblePanelTagHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ @Override
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset metaRuleset = super.createMetaRuleset(type);
+ metaRuleset.addRule(META_RULE);
+ return metaRuleset;
+ }
+
+ private static class CollapsiblePanelMetaRule extends MetaRule{
+
+ @Override
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(AbstractCollapsiblePanel.class)) {
+ if ("changeExpandListener".equals(name)) {
+ return new ChangeExpandExpressionMetadata(attribute);
+ }
+
+ }
+ return null;
+ }
+ }
+
+ private static final class ChangeExpandExpressionMetadata extends Metadata {
+ private static final Class<?>[] CHANGE_EXPAND_SIG = new Class[] {ChangeExpandEvent.class };
+
+ private final TagAttribute attr;
+
+ ChangeExpandExpressionMetadata(TagAttribute attr) {
+ this.attr = attr;
+ }
+
+ @Override
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((AbstractCollapsiblePanel) instance).addChangeExpandListener(new MethodExpressionChangeExpandListener(
+ this.attr.getMethodExpression(ctx, null, CHANGE_EXPAND_SIG)));
+ }
+ }
+
+
+
+}
+
Modified: branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -22,7 +22,6 @@
package org.richfaces.view.facelets.html;
-import org.richfaces.component.AbstractTogglePanel;
import org.richfaces.event.ItemChangeEvent;
import org.richfaces.event.ItemChangeListener;
import org.richfaces.event.ItemChangeSource;
@@ -31,14 +30,8 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
-import javax.faces.view.EditableValueHolderAttachedObjectHandler;
-import javax.faces.view.facelets.ComponentHandler;
import javax.faces.view.facelets.FaceletContext;
-import javax.faces.view.facelets.TagAttribute;
-import javax.faces.view.facelets.TagAttributeException;
import javax.faces.view.facelets.TagConfig;
-import javax.faces.view.facelets.TagException;
-import javax.faces.view.facelets.TagHandler;
import java.io.Serializable;
/**
@@ -46,90 +39,24 @@
* @author akolonitsky
* @version 1.0
*/
-public final class ItemChangeListenerHandler extends TagHandler implements EditableValueHolderAttachedObjectHandler {
+public final class ItemChangeListenerHandler extends EventListenerHandler {
- private static class LazyItemChangeListener implements ItemChangeListener, Serializable {
+ private static class LazyItemChangeListener extends LazyEventListener<ItemChangeListener> implements ItemChangeListener, Serializable {
+ private static final long serialVersionUID = 7715606467989165179L;
- private static final long serialVersionUID = 1L;
-
- private final String type;
-
- private final ValueExpression binding;
-
LazyItemChangeListener(String type, ValueExpression binding) {
- this.type = type;
- this.binding = binding;
+ super(type, binding);
}
- public void processItemChange(ItemChangeEvent event)
- throws AbortProcessingException {
-
- FacesContext faces = FacesContext.getCurrentInstance();
- if (faces == null) {
- return;
- }
-
- ItemChangeListener instance = null;
- if (this.binding != null) {
- instance = (ItemChangeListener) binding.getValue(faces.getELContext());
- }
- if (instance == null && this.type != null) {
- try {
- instance = (ItemChangeListener) forName(this.type).newInstance();
- } catch (Exception e) {
- throw new AbortProcessingException("Couldn't Lazily instantiate ItemChangeListener", e);
- }
- if (this.binding != null) {
- binding.setValue(faces.getELContext(), instance);
- }
- }
- if (instance != null) {
- instance.processItemChange(event);
- }
+ public void processItemChange(ItemChangeEvent event) throws AbortProcessingException {
+ processEvent(event);
}
}
- private final TagAttribute binding;
-
- private final String listenerType;
-
public ItemChangeListenerHandler(TagConfig config) {
super(config);
- this.binding = this.getAttribute("binding");
- TagAttribute type = this.getAttribute("type");
- if (type != null) {
- if (type.isLiteral()) {
- try {
- forName(type.getValue());
- } catch (ClassNotFoundException e) {
- throw new TagAttributeException(type, "Couldn't qualify ItemChangeListener", e);
- }
- } else {
- throw new TagAttributeException(type, "Must be a literal class name of type ItemChangeListener");
- }
- this.listenerType = type.getValue();
- } else {
- this.listenerType = null;
- }
}
- public void apply(FaceletContext ctx, UIComponent parent) {
-
- // only process if it's been created
- if (parent == null || !ComponentHandler.isNew(parent)) {
- return;
- }
-
- if (parent instanceof AbstractTogglePanel) {
- applyAttachedObject(ctx.getFacesContext(), parent);
- } else if (UIComponent.isCompositeComponent(parent)) {
- // Allow the composite component to know about the target component.
- TagHandlerUtils.getOrCreateRetargetableHandlersList(parent).add(this);
- } else {
- throw new TagException(this.tag, "Parent is not of type AbstractTogglePanel, type is: " + parent);
- }
- }
-
public void applyAttachedObject(FacesContext context, UIComponent parent) {
ValueExpression valueExpr = null;
if (this.binding != null) {
@@ -141,17 +68,9 @@
evh.addItemChangeListener(new LazyItemChangeListener(this.listenerType, valueExpr));
}
- public String getFor() {
- TagAttribute attr = this.getAttribute("for");
- return attr == null ? null : attr.getValue();
+ @Override
+ public boolean isEventSource(UIComponent comp) {
+ return comp instanceof ItemChangeSource;
}
-
- public static Class<?> forName(String name) throws ClassNotFoundException {
- if (null == name || "".equals(name)) {
- return null;
- }
-
- return Class.forName(name, false, Thread.currentThread().getContextClassLoader());
- }
}
Modified: branches/RF-7560/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-09-03 18:18:05 UTC (rev 19120)
@@ -11,6 +11,61 @@
</behavior>
<component>
+ <component-type>org.richfaces.CollapsiblePanel</component-type>
+ <component-class>org.richfaces.component.html.HtmlCollapsiblePanel</component-class>
+ <property>
+ <description></description>
+ <property-name>switchType</property-name>
+ <property-class>org.richfaces.component.SwitchType</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>expanded</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>header</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>bypassUpdates</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>limitToList</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>data</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>status</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>execute</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>render</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>changeExpandListener</property-name>
+ <property-class>javax.el.MethodExpression</property-class>
+ </property>
+
+ </component>
+ <component>
<component-type>org.richfaces.TogglePanel</component-type>
<component-class>org.richfaces.component.html.HtmlTogglePanel</component-class>
<property>
@@ -604,6 +659,11 @@
<render-kit>
<render-kit-id>HTML_BASIC</render-kit-id>
<renderer>
+ <component-family>org.richfaces.CollapsiblePanel</component-family>
+ <renderer-type>org.richfaces.CollapsiblePanel</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.CollapsiblePanelRenderer</renderer-class>
+ </renderer>
+ <renderer>
<component-family>org.richfaces.TogglePanel</component-family>
<renderer-type>org.richfaces.TogglePanel</renderer-type>
<renderer-class>org.richfaces.renderkit.html.TogglePanelRenderer</renderer-class>
Modified: branches/RF-7560/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-09-03 18:18:05 UTC (rev 19120)
@@ -29,6 +29,217 @@
</tag>
<tag>
+ <tag-name>collapsiblePanel</tag-name>
+ <component>
+ <component-type>org.richfaces.CollapsiblePanel</component-type>
+ <renderer-type>org.richfaces.CollapsiblePanel</renderer-type>
+ <handler-class>org.richfaces.view.facelets.html.CollapsiblePanelTagHandler</handler-class>
+ </component>
+ <attribute>
+ <description></description>
+ <name>switchType</name>
+ <type>org.richfaces.component.SwitchType</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>expanded</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>header</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>bypassUpdates</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>limitToList</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>data</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>status</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>execute</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>render</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>id</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>binding</name>
+ <type>javax.faces.component.UIComponent</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>rendered</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>immediate</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>changeExpandListener</name>
+ <type>javax.el.MethodExpression</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>bodyClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>headerClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>headerControlClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>oncomplete</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onbeforedomupdate</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onswitch</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onbeforeswitch</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>lang</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>title</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>style</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>styleClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>dir</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>ondblclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmousedown</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmousemove</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseout</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseover</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseup</name>
+ <type>java.lang.String</type>
+ </attribute>
+
+ </tag>
+ <tag>
+ <description>
+ Register a ChangeExpandListener instance on the UIComponent
+ associated with the closest parent UIComponent custom
+ action.
+ </description>
+ <tag-name>changeExpandListener</tag-name>
+ <handler-class>org.richfaces.view.facelets.html.ChangeExpandListenerHandler</handler-class>
+ <attribute>
+ <description>
+ Fully qualified Java class name of a
+ ChangeExpandListener to be created and registered.
+ </description>
+ <name>type</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description>
+ Value binding expression that evaluates to an object that
+ implements org.richfaces.event.ChangeExpandListener.
+ </description>
+ <name>binding</name>
+ <required>false</required>
+ <type>org.richfaces.event.ChangeExpandListener</type>
+ </attribute>
+ <attribute>
+ <description>
+ <p class="changed_added_2_0">If present, this attribute refers
+ to the value of one of the exposed attached objects within the
+ composite component inside of which this tag is nested.</p>
+ </description>
+ <name>for</name>
+ <required>false</required>
+ <type>java.lang.String</type>
+ </attribute>
+ </tag>
+
+ <tag>
<tag-name>togglePanel</tag-name>
<component>
<component-type>org.richfaces.TogglePanel</component-type>
@@ -37,6 +248,11 @@
</component>
<attribute>
<description></description>
+ <name>cycledSwitching</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
<name>switchType</name>
<type>org.richfaces.component.SwitchType</type>
</attribute>
@@ -57,11 +273,6 @@
</attribute>
<attribute>
<description></description>
- <name>cycledSwitching</name>
- <type>boolean</type>
- </attribute>
- <attribute>
- <description></description>
<name>data</name>
<type>java.lang.Object</type>
</attribute>
@@ -219,7 +430,7 @@
<component>
<component-type>org.richfaces.TogglePanelItem</component-type>
<renderer-type>org.richfaces.TogglePanelItem</renderer-type>
-
+
</component>
<attribute>
<description></description>
@@ -324,10 +535,15 @@
<component>
<component-type>org.richfaces.Accordion</component-type>
<renderer-type>org.richfaces.Accordion</renderer-type>
-
+
</component>
<attribute>
<description></description>
+ <name>cycledSwitching</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
<name>switchType</name>
<type>org.richfaces.component.SwitchType</type>
</attribute>
@@ -338,16 +554,6 @@
</attribute>
<attribute>
<description></description>
- <name>height</name>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <description></description>
- <name>width</name>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <description></description>
<name>bypassUpdates</name>
<type>boolean</type>
</attribute>
@@ -358,11 +564,6 @@
</attribute>
<attribute>
<description></description>
- <name>cycledSwitching</name>
- <type>boolean</type>
- </attribute>
- <attribute>
- <description></description>
<name>data</name>
<type>java.lang.Object</type>
</attribute>
@@ -408,6 +609,16 @@
</attribute>
<attribute>
<description></description>
+ <name>width</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>height</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
<name>itemHeaderClassActive</name>
<type>java.lang.String</type>
</attribute>
@@ -509,7 +720,7 @@
<component>
<component-type>org.richfaces.TogglePanelTitledItem</component-type>
<renderer-type>org.richfaces.AccordionItem</renderer-type>
-
+
</component>
<attribute>
<description></description>
@@ -673,8 +884,4 @@
</attribute>
</tag>
-
-
-
-
</facelet-taglib>
Modified: branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js 2010-09-03 18:18:05 UTC (rev 19120)
@@ -41,7 +41,16 @@
this.index = options["index"];
this.getTogglePanel().getItems()[this.index] = this;
- rf.Event.bindById(this.id + ":header", "click", this.__onHeaderClick, this)
+ if (!this.disabled) {
+ rf.Event.bindById(this.id + ":header", "click", this.__onHeaderClick, this);
+ }
+
+ if (this.isSelected()) {
+ var item = this;
+ $(this.togglePanelId).ready(function () {
+ item.__fitToHeight(item.getTogglePanel());
+ });
+ }
},
/***************************** Public Methods ****************************************************************/
@@ -59,7 +68,7 @@
__header : function (state) {
var res = $(rf.getDomElement(this.id + ":header"));
if (state) {
- return res.find(".rf-aci-h-" + state);
+ return res.find(".rf-ac-itm-hdr-" + state);
}
return res;
@@ -83,24 +92,28 @@
__enter : function () {
var parentPanel = this.getTogglePanel();
if (parentPanel.isKeepHeight) {
- this.__content().hide();
- var h = parentPanel.getInnerHeight();
-
- var items = parentPanel.getItems();
- for (var i = 0; i < items.length; i++) {
- h -= items[i].__header().outerHeight();
- }
-
- this.__content().height(h - 20); // 20 it is padding top and bottom
+ this.__content().hide(); // TODO ?
+ this.__fitToHeight(parentPanel);
}
this.__content().show();
- this.__header("inactive").hide();
- this.__header("active").show();
+ this.__header("inact").hide();
+ this.__header("act").show();
return this.__fireEnter();
},
+ __fitToHeight : function (parentPanel) {
+ var h = parentPanel.getInnerHeight();
+
+ var items = parentPanel.getItems();
+ for (var i in items) {
+ h -= items[i].__header().outerHeight();
+ }
+
+ this.__content().height(h - 20); // 20 it is padding top and bottom
+ },
+
getHeight : function (recalculate) {
if (recalculate || !this.__height) {
this.__height = $(rf.getDomElement(this.id)).outerHeight(true)
@@ -121,8 +134,8 @@
}
this.__content().hide();
- this.__header("active").hide();
- this.__header("inactive").show();
+ this.__header("act").hide();
+ this.__header("inact").show();
return true;
},
Copied: branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js (from rev 19108, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js)
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js (rev 0)
+++ branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js 2010-09-03 18:18:05 UTC (rev 19120)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.CollapsiblePanel = rf.ui.TogglePanel.extendClass({
+
+ name:"CollapsiblePanel",
+
+ /**
+ * @class CollapsiblePanel
+ * @name CollapsiblePanel
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ rf.ui.TogglePanel.call(this, componentId, options);
+ this.switchMode = options.switchMode;
+
+ this.__addUserEventHandler("beforeswitch");
+ this.__addUserEventHandler("switch");
+
+ this.items = [
+ new RichFaces.ui.CollapsiblePanelItem(
+ this.id + ":content", {"index":0, "togglePanelId":this.id, "switchMode":this.switchMode, "name":"true"}),
+
+ new RichFaces.ui.CollapsiblePanelItem(
+ this.id + ":empty", {"index":1, "togglePanelId":this.id, "switchMode":this.switchMode, "name":"false"})
+ ];
+ this.options.cycledSwitching = true;
+
+ rf.Event.bindById(this.id + ":header", "click", this.__onHeaderClick, this)
+ },
+
+ switchPanel : function (to) {
+ this.switchToItem(to || "@next");
+ },
+
+ /***************************** Private Methods ********************************************************/
+
+ __onHeaderClick : function () {
+ this.switchToItem("@next");
+ },
+
+ __fireItemChange : function (oldItem, newItem) {
+ return new rf.Event.fireById(this.id, "switch", {
+ id: this.id,
+ isExpanded : newItem.getName()
+ });
+ },
+
+ __fireBeforeItemChange : function (oldItem, newItem) {
+ return rf.Event.fireById(this.id, "beforeswitch", {
+ id: this.id,
+ isExpanded : newItem.getName()
+ });
+ },
+
+
+ destroy: function () {
+ rf.ui.TogglePanel.destroy.call(this);
+ }
+ });
+})(jQuery, RichFaces);
Copied: branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js (from rev 19108, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js)
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js (rev 0)
+++ branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js 2010-09-03 18:18:05 UTC (rev 19120)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.CollapsiblePanelItem = rf.ui.TogglePanelItem.extendClass({
+
+ init : function (componentId, options) {
+ rf.ui.TogglePanelItem.call(this, componentId, options);
+ },
+
+ __enter : function () {
+ rf.getDomElement(this.id).style.display = "block";
+ this.__header(this.__state()).show();
+
+ return true;
+ },
+
+ __leave : function () {
+ rf.getDomElement(this.id).style.display = "none";
+ this.__header(this.__state()).hide();
+
+ return true;
+ },
+
+ __state : function () {
+ return this.getName() === "true" ? "expanded" : "collapsed";
+ },
+
+ __header : function (state) {
+ var res = $(rf.getDomElement(this.togglePanelId + ":header"));
+ if (state) {
+ return res.find(".rf-cp-hdr-" + state);
+ }
+
+ return res;
+ }
+ });
+})(jQuery, RichFaces);
Modified: branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-09-03 18:18:05 UTC (rev 19120)
@@ -66,7 +66,7 @@
this.__setActiveItem(newPanel.getName());
- rf.submitForm(this.__getParentForm(), null, {});
+ rf.submitForm(this.__getParentForm());
return false;
},
@@ -111,7 +111,7 @@
this.__setActiveItem(newPanel.getName());
newPanel.__enter();
- this.__fireItemChange(oldPanel, newPanel);
+ this.comp.__fireItemChange(oldPanel, newPanel);
return true;
},
@@ -136,16 +136,6 @@
* */
__getValueInputId: function () {
return this.comp.id + "-value"
- },
-
- /********************* Events *************************/
-
- __fireItemChange : function (oldItem, newItem) {
- return new rf.Event.fireById(this.comp.id, "itemchange", {
- id: this.comp.id,
- oldItem : oldItem,
- newItem : newItem
- });
}
};
@@ -163,19 +153,22 @@
name:"TogglePanel",
init : function (componentId, options) {
- // call constructor of parent class
rf.BaseComponent.call(this, componentId);
this.attachToDom(componentId);
this.options = options;
this.activeItem = this.options.activeItem;
this.items = this.options.items;
+
+ this.__addUserEventHandler("itemchange");
+ this.__addUserEventHandler("beforeitemchange");
},
- /***************************** Public Methods ********************************************************************/
+ /***************************** Public Methods ****************************************************************/
/**
* @methodOf
+ *
* @name TogglePanel#getSelectItem
*
* @return {String} name of current selected panel item
@@ -326,20 +319,42 @@
/********************* Methods *************************/
- __ITEMS_META_NAMES : {
- "@first" : function (comp) { return 0; },
- "@prev" : function (comp) { return comp.__getItemIndex(comp.activeItem) - 1; },
- "@next" : function (comp) { return comp.__getItemIndex(comp.activeItem) + 1; },
- "@last" : function (comp) { return comp.items.length - 1; }
- },
+ __ITEMS_META_NAMES : (function () {
+ function goFrom (comp, ind, step) {
+ var res = ind;
+ while ((!comp.items[res] || comp.items[res].disabled) && res < comp.items.length && res > 0) {
+ res += step;
+ }
+ return res;
+ }
+
+ return {
+ "@first" : function (comp) {
+ return goFrom(comp, 0, 1);
+ },
+
+ "@prev" : function (comp) {
+ return goFrom(comp, parseInt(comp.__getItemIndex(comp.activeItem)) - 1 , -1);
+ },
+
+ "@next" : function (comp) {
+ return goFrom(comp, parseInt(comp.__getItemIndex(comp.activeItem)) + 1 , 1);
+ },
+
+ "@last" : function (comp) {
+ return goFrom(comp, comp.items.length - 1, -1);
+ }
+ }
+ })(),
+
/**
* @private
* */
__getItemIndex : function (itemName) {
- for (var i = 0; i < this.items.length; i++) {
- if (this.items[i].getName() === itemName) {
- return i;
+ for (var i in this.items) {
+ if (!this.items[i].disabled && this.items[i].getName() === itemName) {
+ return parseInt(i);
}
}
@@ -349,6 +364,16 @@
/**
* @private
+ * */
+ __addUserEventHandler : function (name) {
+ var handler = this.options["on" + name];
+ if (handler) {
+ rf.Event.bindById(this.id, name, handler);
+ }
+ },
+
+ /**
+ * @private
* @param {Number} index - array index
*
* @return {TogglePanelItem}
@@ -381,6 +406,15 @@
/**
* Fire Concealable Event
* */
+
+ __fireItemChange : function (oldItem, newItem) {
+ return new rf.Event.fireById(this.id, "itemchange", {
+ id: this.id,
+ oldItem : oldItem,
+ newItem : newItem
+ });
+ },
+
__fireBeforeItemChange : function (oldItem, newItem) {
return rf.Event.fireById(this.id, "beforeitemchange", {
id: this.id,
@@ -389,11 +423,8 @@
});
},
- // class stuff
destroy: function () {
- // rf.Event.unbindById(this.options.buttonId, "."+this.namespace);
- // rf.Event.unbindById(this.componentId, "."+this.namespace);
- // $super.destroy.call(this);
+ rf.BaseComponent.destroy.call(this);
}
});
})(jQuery, RichFaces);
Modified: branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js 2010-09-03 18:18:05 UTC (rev 19120)
@@ -38,6 +38,7 @@
this.name = this.options.name;
this.togglePanelId = this.options.togglePanelId;
this.switchMode = this.options.switchMode;
+ this.disabled = this.options.disabled || false;
},
/***************************** Public Methods *****************************************************************/
Modified: branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss 2010-09-03 17:34:35 UTC (rev 19119)
+++ branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss 2010-09-03 18:18:05 UTC (rev 19120)
@@ -1,5 +1,4 @@
.rf-ac {
- /*width: 300px;*/ /*visible width*/
border-width: 1px;
border-style: solid;
border-color: '#{richSkin.panelBorderColor}';
@@ -7,7 +6,7 @@
background: '#{richSkin.generalBackgroundColor}';
}
-.rf-aci-h {
+.rf-ac-itm-hdr {
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: '#{richSkin.panelBorderColor}';
@@ -24,13 +23,17 @@
cursor: pointer;
}
-.rf-aci-c {
+.rf-ac-itm-hdr-act {}
+.rf-ac-itm-hdr-inact {}
+.rf-ac-itm-hdr-dis {}
+
+.rf-ac-itm-cnt {
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: '#{richSkin.panelBorderColor}';
- /*height: 100px*/ /*visible modal panel height minus header height*/;
position: relative;
overflow: auto;
overflow-x: hidden;
padding: 10px;
-}
\ No newline at end of file
+}
+
Copied: branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss (from rev 19108, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss)
===================================================================
--- branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss (rev 0)
+++ branches/RF-7560/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss 2010-09-03 18:18:05 UTC (rev 19120)
@@ -0,0 +1,32 @@
+.rf-cp{
+ background-color:'#{richSkin.generalBackgroundColor}';
+ color:'#{richSkin.panelBorderColor}';
+ border-width:1px;
+ border-style:solid;
+ padding:1px;
+}
+
+.rf-cp-hdr{
+ background-color:'#{richSkin.headerBackgroundColor}';
+ border-color:'#{richSkin.headerBackgroundColor}';
+ font-size:'#{richSkin.headerSizeFont}';
+ color:'#{richSkin.headerTextColor}';
+ font-weight:'#{richSkin.headerWeightFont}';
+ font-family:'#{richSkin.headerFamilyFont}';
+ padding:2px;
+ border-width:1px;
+ border-style:solid;
+ background-position:top left;
+ background-repeat:repeat-x;
+ background-image:"url(#{resource['org.richfaces.renderkit.html.GradientA']})";
+}
+
+.rf-cp-hdr-exp {}
+.rf-cp-hdr-colps {}
+
+.rf-cp-b{
+ font-size:'#{richSkin.generalSizeFont}';
+ color:'#{richSkin.generalTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ padding:10px;
+}
\ No newline at end of file
Copied: branches/RF-7560/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelItemTest.java (from rev 19108, trunk/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelItemTest.java)
===================================================================
--- branches/RF-7560/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelItemTest.java (rev 0)
+++ branches/RF-7560/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelItemTest.java 2010-09-03 18:18:05 UTC (rev 19120)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.faces.component.UIComponent;
+import java.util.List;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-24
+ */
+public class UITogglePanelItemTest {
+
+ private UITogglePanelItem togglePanelItem;
+
+ @Before
+ public void setUp () {
+ togglePanelItem = new UITogglePanelItem();
+ }
+
+ @Test
+ public void testGetName() {
+ Assert.assertNull(togglePanelItem.getName());
+
+ String id = "id";
+ togglePanelItem.setId(id);
+ Assert.assertEquals(togglePanelItem.getId(), id);
+ Assert.assertEquals(togglePanelItem.getName(), id);
+
+ String name = "name";
+ togglePanelItem.setName(name);
+ Assert.assertEquals(togglePanelItem.getName(), name);
+ }
+}
+
14 years, 4 months
JBoss Rich Faces SVN: r19119 - in branches/RF-7560: core/api/src/main/java/org/richfaces/application and 20 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-09-03 13:34:35 -0400 (Fri, 03 Sep 2010)
New Revision: 19119
Added:
branches/RF-7560/core/api/src/main/java/org/richfaces/application/configuration/
branches/RF-7560/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItem.java
branches/RF-7560/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItemSource.java
branches/RF-7560/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationService.java
branches/RF-7560/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationServiceHelper.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/application/CoreConfiguration.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/application/configuration/
branches/RF-7560/core/impl/src/main/java/org/richfaces/application/configuration/ConfigurationServiceImpl.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/application/configuration/ConstantValueExpression.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/application/configuration/ValueExpressionHolder.java
branches/RF-7560/core/impl/src/test/java/org/richfaces/ContextInitParameter.java
branches/RF-7560/core/impl/src/test/java/org/richfaces/ContextInitParameters.java
branches/RF-7560/core/impl/src/test/java/org/richfaces/FacesRequestSetupRule.java
branches/RF-7560/core/impl/src/test/java/org/richfaces/application/Configuration.java
branches/RF-7560/core/impl/src/test/java/org/richfaces/application/ConfigurationServiceImplTest.java
branches/RF-7560/core/impl/src/test/java/org/richfaces/application/Enumeration.java
branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/aplication/
branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/aplication/CoreComponentsConfiguration.java
branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/application/
branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/application/IterationComponentsConfiguration.java
Removed:
branches/RF-7560/core/impl/src/main/java/org/ajax4jsf/context/InitParametersStorage.java
Modified:
branches/RF-7560/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/faces/FacesImpl.java
branches/RF-7560/core/api/src/main/java/org/richfaces/application/ServiceTracker.java
branches/RF-7560/core/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/application/DefaultModule.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/application/InitializationListener.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/cache/EhCacheCacheFactory.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/cache/JBossCacheCacheFactory.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/cache/OSCacheCacheFactory.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/cache/lru/LRUMapCacheFactory.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/context/SkinningResourcesPhaseListener.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/resource/AbstractCacheableResource.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/resource/ExternalStaticResource.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java
branches/RF-7560/core/impl/src/test/java/org/richfaces/cache/BaseCacheTest.java
branches/RF-7560/core/impl/src/test/java/org/richfaces/skin/SkinTestCase.java
branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/component/QueuePreRenderViewListener.java
branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueRendererBase.java
branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/model/ArrangeableModel.java
Log:
RF-7560
Modified: branches/RF-7560/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/faces/FacesImpl.java
===================================================================
--- branches/RF-7560/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/faces/FacesImpl.java 2010-09-03 15:36:40 UTC (rev 19118)
+++ branches/RF-7560/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/faces/FacesImpl.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -26,13 +26,14 @@
import javax.faces.application.ResourceHandler;
import javax.faces.context.FacesContext;
-import org.ajax4jsf.context.InitParametersStorage;
import org.richfaces.application.DependencyInjectionServiceImpl;
import org.richfaces.application.DependencyInjector;
import org.richfaces.application.Module;
import org.richfaces.application.ServiceTracker;
import org.richfaces.application.ServicesFactory;
import org.richfaces.application.ServicesFactoryImpl;
+import org.richfaces.application.configuration.ConfigurationService;
+import org.richfaces.application.configuration.ConfigurationServiceImpl;
import org.richfaces.cdk.Faces;
import org.richfaces.cdk.FileNameMapper;
import org.richfaces.cdk.skin.SkinFactoryImpl;
@@ -62,15 +63,15 @@
Module module = new Module() {
public void configure(ServicesFactory factory) {
+ serviceFactory.setInstance(ConfigurationService.class, new ConfigurationServiceImpl());
serviceFactory.setInstance(SkinFactory.class, new SkinFactoryImpl());
- serviceFactory.setInstance(InitParametersStorage.class, new InitParametersStorage());
serviceFactory.setInstance(FileNameMapper.class, fileNameMapper);
serviceFactory.setInstance(DependencyInjector.class, new DependencyInjectionServiceImpl());
serviceFactory.setInstance(ResourceHandler.class, resourceHandler);
}
};
+ ServiceTracker.setFactory(serviceFactory);
serviceFactory.init(Collections.singleton(module));
- ServiceTracker.setFactory(serviceFactory);
}
public void stop() {
Modified: branches/RF-7560/core/api/src/main/java/org/richfaces/application/ServiceTracker.java
===================================================================
--- branches/RF-7560/core/api/src/main/java/org/richfaces/application/ServiceTracker.java 2010-09-03 15:36:40 UTC (rev 19118)
+++ branches/RF-7560/core/api/src/main/java/org/richfaces/application/ServiceTracker.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -70,7 +70,7 @@
private static ServicesFactory getServicesFactory() {
if(!INSTANCES.containsKey(getCurrentLoader())){
- throw new FacesException("Service Traccker has not been initialized");
+ throw new FacesException("Service Tracker has not been initialized");
}
ServicesFactory service = INSTANCES.get(getCurrentLoader());
return service;
Added: branches/RF-7560/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItem.java
===================================================================
--- branches/RF-7560/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItem.java (rev 0)
+++ branches/RF-7560/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItem.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.application.configuration;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target(ElementType.FIELD)
+@Documented
+public @interface ConfigurationItem {
+
+ public ConfigurationItemSource source() default ConfigurationItemSource.contextInitParameter;
+
+ public String[] names();
+
+ public boolean literal() default false;
+
+ public String defaultValue() default "";
+
+}
Added: branches/RF-7560/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItemSource.java
===================================================================
--- branches/RF-7560/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItemSource.java (rev 0)
+++ branches/RF-7560/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItemSource.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.application.configuration;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public enum ConfigurationItemSource {
+
+ contextInitParameter
+
+}
Added: branches/RF-7560/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationService.java
===================================================================
--- branches/RF-7560/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationService.java (rev 0)
+++ branches/RF-7560/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationService.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -0,0 +1,22 @@
+package org.richfaces.application.configuration;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface ConfigurationService {
+
+ public Boolean getBooleanValue(FacesContext facesContext, Enum<?> key);
+
+ public Integer getIntValue(FacesContext facesContext, Enum<?> key);
+
+ public Long getLongValue(FacesContext facesContext, Enum<?> key);
+
+ public String getStringValue(FacesContext facesContext, Enum<?> key);
+
+ public Object getValue(FacesContext facesContext, Enum<?> key);
+
+ public <T extends Enum<T>> T getEnumValue(FacesContext facesContext, Enum<?> key, Class<T> enumClass);
+
+}
Added: branches/RF-7560/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationServiceHelper.java
===================================================================
--- branches/RF-7560/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationServiceHelper.java (rev 0)
+++ branches/RF-7560/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationServiceHelper.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.application.configuration;
+
+import javax.faces.context.FacesContext;
+
+import org.richfaces.application.ServiceTracker;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public final class ConfigurationServiceHelper {
+
+ public static final Boolean getBooleanConfigurationValue(FacesContext facesContext, Enum<?> key) {
+ return ServiceTracker.getService(ConfigurationService.class).getBooleanValue(facesContext, key);
+ }
+
+ public static final Integer getIntConfigurationValue(FacesContext facesContext, Enum<?> key) {
+ return ServiceTracker.getService(ConfigurationService.class).getIntValue(facesContext, key);
+ }
+
+ public static final Long getLongConfigurationValue(FacesContext facesContext, Enum<?> key) {
+ return ServiceTracker.getService(ConfigurationService.class).getLongValue(facesContext, key);
+ }
+
+ public static final String getStringConfigurationValue(FacesContext facesContext, Enum<?> key) {
+ return ServiceTracker.getService(ConfigurationService.class).getStringValue(facesContext, key);
+ }
+
+ public static final Object getConfigurationValue(FacesContext facesContext, Enum<?> key) {
+ return ServiceTracker.getService(ConfigurationService.class).getValue(facesContext, key);
+ }
+
+ public static final <T extends Enum<T>> T getEnumConfigurationValue(FacesContext facesContext, Enum<?> key, Class<T> enumClass) {
+ return ServiceTracker.getService(ConfigurationService.class).getEnumValue(facesContext, key, enumClass);
+ }
+
+}
\ No newline at end of file
Modified: branches/RF-7560/core/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java 2010-09-03 15:36:40 UTC (rev 19118)
+++ branches/RF-7560/core/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -21,16 +21,11 @@
package org.ajax4jsf.context;
-import javax.el.ExpressionFactory;
import javax.el.ValueExpression;
import javax.faces.FacesException;
-import javax.faces.application.Application;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
-import org.ajax4jsf.util.ELUtils;
-import org.richfaces.application.ServiceTracker;
-
/**
* This class hold all methods for get application init parameters. Created for
* single access point to all parameters - simplest for a documentation.
@@ -39,41 +34,6 @@
*/
public final class ContextInitParameters {
- public static final String[] DATATABLE_USES_VIEW_LOCALE = {"org.richfaces.datatableUsesViewLocale"};
-
- /**
- * This parameter define where {@link javax.faces.application.ViewExpiredException} should be handled.
- * If is it equals "true" , framework should proparate exception to client-side.
- */
- public static final String HANDLE_VIEW_EXPIRED_ON_CLIENT = "org.ajax4jsf.handleViewExpiredOnClient";
- public static final String STD_CONTROLS_SKINNING_PARAM = "org.richfaces.enableControlSkinning";
- public static final String STD_CONTROLS_SKINNING_CLASSES_PARAM = "org.richfaces.enableControlSkinningClasses";
- public static final String[] QUEUE_ENABLED = {"org.richfaces.queue.enabled"};
-
- //TODO - better name
- public static final String RESOURCES_TTL = "org.richfaces.resourceDefaultTTL";
- public static final String RESOURCES_CACHE_SIZE = "org.richfaces.resourceCacheSize";
-
- /**
- * Name of web application init parameter for current skin . Can be simple
- * String for non-modified name, or EL-expression for calculate current
- * skin. If EL evaluated to <code>String</code> - used as skin name, if to
- * instance of {@link Skin } - used this instance. by default -
- * "org.exadel.chameleon.SKIN"
- */
- public static final String SKIN = "org.richfaces.skin";
- public static final String BASE_SKIN = "org.richfaces.baseSkin";
-
- public static final String STATIC_RESOURCE_LOCATION = "org.richfaces.staticResourceLocation";
-
- public static final String STATIC_RESOURCE_LOCATION_VARIABLE = "resourceLocation";
-
- public static final String EXECUTE_AWT_INITIALIZER = "org.richfaces.executeAWTInitializer";
-
- private static final int DEFAULT_TTL = 60 * 60 * 24;
- private static final String[] RESOURCES_TTL_ARRAY = { RESOURCES_TTL };
- private static final String[] RESOURCES_CACHE_SIZE_ARRAY = { RESOURCES_CACHE_SIZE };
-
private static final String INIT_PARAM_PREFIX = ContextInitParameters.class.getSimpleName() + ":";
private static final Object NULL = new Object() {
@@ -92,68 +52,6 @@
// parameters. Do not Instantiate !
}
- /**
- * Defines whether data table should use view root locale for sorting and filtering or the
- * default platform one
- *
- * @param context
- * @return
- */
- public static boolean isDatatableUsesViewLocale(FacesContext context) {
- return getBoolean(context, DATATABLE_USES_VIEW_LOCALE, false);
- }
-
- public static boolean isQueueEnabled(FacesContext context) {
- return getBoolean(context, QUEUE_ENABLED, true);
- }
-
- /**
- * Method for determining STD_CONTROLS_SKINNING_PARAM parameter
- *
- * @param context
- * @return value of STD_CONTROLS_SKINNING_PARAM parameter if present.
- */
- public static boolean isStandardControlSkinningEnabled(FacesContext context) {
- Object paramValue = evaluateInitParameter(context, STD_CONTROLS_SKINNING_PARAM);
- return getBooleanValue(paramValue, true);
- }
-
- public static int getResourcesTimeToLive(FacesContext context) {
- return getInteger(context, RESOURCES_TTL_ARRAY, DEFAULT_TTL);
- }
-
- public static int getResourcesCacheSize(FacesContext context) {
- return getInteger(context, RESOURCES_CACHE_SIZE_ARRAY, 512);
- }
-
- /**
- * Method for determining STD_CONTROLS_SKINNING_CLASSES_PARAM parameter
- *
- * @param context
- * @return value of STD_CONTROLS_SKINNING_CLASSES_PARAM parameter if present.
- */
- public static boolean isStandardControlSkinningClassesEnabled(FacesContext context) {
- Object paramValue = evaluateInitParameter(context, STD_CONTROLS_SKINNING_CLASSES_PARAM);
- return getBooleanValue(paramValue, false);
- }
-
- public static Object getSkin(FacesContext context) {
- return evaluateInitParameter(context, SKIN);
- }
-
- public static Object getBaseSkin(FacesContext context) {
- return evaluateInitParameter(context, BASE_SKIN);
- }
-
- public static String getStaticResourceLocation(FacesContext context) {
- return (String) evaluateInitParameter(context, STATIC_RESOURCE_LOCATION);
- }
-
- public static boolean isExecuteAWTInitializer(FacesContext context) {
- Object paramValue = evaluateInitParameter(context, EXECUTE_AWT_INITIALIZER);
- return getBooleanValue(paramValue, true);
- }
-
static int getInteger(FacesContext context, String[] paramNames, int defaultValue) {
String initParameter = getInitParameter(context, paramNames);
@@ -218,41 +116,6 @@
return ("true".equalsIgnoreCase(stringValue) || "yes".equalsIgnoreCase(stringValue));
}
- private static InitParametersStorage getExpressionsMap(FacesContext context) {
- InitParametersStorage concurrentStorage = ServiceTracker.getService(InitParametersStorage.class);
- return concurrentStorage;
- }
-
- private static Object evaluateInitParameter(FacesContext context, String parameterName) {
- InitParametersStorage expressionsMap = getExpressionsMap(context);
- String parameterKey = INIT_PARAM_PREFIX + parameterName;
-
- Object parameterValue = expressionsMap.get(parameterKey);
- if (parameterValue == null) {
- String initParameter = context.getExternalContext().getInitParameter(parameterName);
- if (initParameter != null) {
-
- if (ELUtils.isValueReference(initParameter)) {
- Application application = context.getApplication();
- ExpressionFactory expressionFactory = application.getExpressionFactory();
-
- parameterValue = expressionFactory.createValueExpression(context.getELContext(),
- initParameter,
- String.class);
- } else {
- parameterValue = initParameter;
- }
-
- } else {
- parameterValue = NULL;
- }
-
- expressionsMap.put(parameterKey, parameterValue);
- }
-
- return evaluateInitParameterExpression(context, parameterValue);
- }
-
private static Object evaluateInitParameterExpression(FacesContext context, Object parameterValue) {
if (parameterValue == NULL || parameterValue == null) {
return null;
Deleted: branches/RF-7560/core/impl/src/main/java/org/ajax4jsf/context/InitParametersStorage.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/ajax4jsf/context/InitParametersStorage.java 2010-09-03 15:36:40 UTC (rev 19118)
+++ branches/RF-7560/core/impl/src/main/java/org/ajax4jsf/context/InitParametersStorage.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -1,49 +0,0 @@
-/*
- * $Id$
- *
- * 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.context;
-
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * <p class="changed_added_4_0"></p>
- * @author asmirnov(a)exadel.com
- *
- */
-public class InitParametersStorage {
-
- ConcurrentMap<String,Object> storage = new ConcurrentHashMap<String, Object>(5);
-
- public Object get(String key){
- return storage.get(key);
- }
-
- public Object put(String key,Object value) {
- return storage.put(key, value);
- }
-
- public boolean containsKey(String key) {
- return storage.containsKey(key);
- }
-}
Added: branches/RF-7560/core/impl/src/main/java/org/richfaces/application/CoreConfiguration.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/application/CoreConfiguration.java (rev 0)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/application/CoreConfiguration.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.application;
+
+import org.richfaces.application.configuration.ConfigurationItem;
+import org.richfaces.skin.Skin;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public final class CoreConfiguration {
+
+ public static final String SKIN_PARAM_NAME = "org.richfaces.skin";
+
+ public static final String BASE_SKIN_PARAM_NAME = "org.richfaces.baseSkin";
+
+ public static final String RESOURCES_CACHE_SIZE_PARAM_NAME = "org.richfaces.resourceCacheSize";
+
+ private CoreConfiguration() {}
+
+ public enum Items {
+ @ConfigurationItem(defaultValue = "true", names = "org.richfaces.enableControlSkinning")
+ standardControlsSkinning,
+
+ @ConfigurationItem(defaultValue = "false", names = "org.richfaces.enableControlSkinningClasses")
+ standardControlsSkinningClasses,
+
+ /**
+ * Name of web application init parameter for current skin . Can be simple
+ * String for non-modified name, or EL-expression for calculate current
+ * skin. If EL evaluated to <code>String</code> - used as skin name, if to
+ * instance of {@link Skin } - used this instance. by default -
+ * "org.richfaces.skin"
+ */
+ @ConfigurationItem(names = SKIN_PARAM_NAME)
+ skin,
+
+ @ConfigurationItem(names = BASE_SKIN_PARAM_NAME)
+ baseSkin,
+
+ @ConfigurationItem(defaultValue = "86400" /* 24 * 60 * 60 */, names = "org.richfaces.resourceDefaultTTL", literal = true)
+ resourcesTTL,
+
+ @ConfigurationItem(defaultValue = "512", names = RESOURCES_CACHE_SIZE_PARAM_NAME, literal = true)
+ resourcesCacheSize,
+
+ @ConfigurationItem(names = "org.ajax4jsf.cache.LRU_MAP_CACHE_SIZE", literal = true)
+ lruMapCacheSize,
+
+ @ConfigurationItem(names = "org.richfaces.staticResourceLocation")
+ staticResourceLocation,
+
+ @ConfigurationItem(defaultValue = "true", names = "org.richfaces.executeAWTInitializer", literal = true)
+ executeAWTInitializer
+ }
+}
Modified: branches/RF-7560/core/impl/src/main/java/org/richfaces/application/DefaultModule.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/application/DefaultModule.java 2010-09-03 15:36:40 UTC (rev 19118)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/application/DefaultModule.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -1,7 +1,8 @@
package org.richfaces.application;
-import org.ajax4jsf.context.InitParametersStorage;
import org.ajax4jsf.renderkit.AJAXDataSerializer;
+import org.richfaces.application.configuration.ConfigurationService;
+import org.richfaces.application.configuration.ConfigurationServiceImpl;
import org.richfaces.cache.Cache;
import org.richfaces.l10n.BundleLoader;
import org.richfaces.resource.DefaultResourceCodec;
@@ -12,13 +13,13 @@
public class DefaultModule implements Module {
public void configure(ServicesFactory factory) {
+ factory.setInstance(ConfigurationService.class, new ConfigurationServiceImpl());
factory.setInstance(SkinFactory.class, new SkinFactoryImpl());
factory.setInstance(AJAXDataSerializer.class,new AJAXDataSerializer());
factory.setInstance(ResourceCodec.class,ServiceLoader.loadService(ResourceCodec.class, DefaultResourceCodec.class));
factory.setInstance(Cache.class,new CacheProvider());
factory.setInstance(Uptime.class, new Uptime());
factory.setInstance(DependencyInjector.class, new DependencyInjectionServiceImpl());
- factory.setInstance(InitParametersStorage.class, new InitParametersStorage());
factory.setInstance(MessageFactory.class, new MessageFactoryImpl(new BundleLoader()));
}
Modified: branches/RF-7560/core/impl/src/main/java/org/richfaces/application/InitializationListener.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/application/InitializationListener.java 2010-09-03 15:36:40 UTC (rev 19118)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/application/InitializationListener.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -21,6 +21,8 @@
*/
package org.richfaces.application;
+import static org.richfaces.application.configuration.ConfigurationServiceHelper.getBooleanConfigurationValue;
+
import java.awt.Toolkit;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -37,7 +39,6 @@
import javax.imageio.ImageIO;
import javax.imageio.stream.ImageInputStream;
-import org.ajax4jsf.context.ContextInitParameters;
import org.richfaces.VersionBean;
import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
@@ -107,7 +108,6 @@
protected void onStart() {
ServicesFactory injector = createFactory();
- ServiceTracker.setFactory(injector);
if (LOGGER.isInfoEnabled()) {
String versionString = VersionBean.VERSION.toString();
@@ -117,7 +117,7 @@
}
FacesContext context = FacesContext.getCurrentInstance();
- if (ContextInitParameters.isExecuteAWTInitializer(context)) {
+ if (getBooleanConfigurationValue(context, CoreConfiguration.Items.executeAWTInitializer)) {
try {
AWTInitializer.initialize();
} catch (NoClassDefFoundError e) {
@@ -128,6 +128,7 @@
protected ServicesFactory createFactory() {
ServicesFactoryImpl injector = new ServicesFactoryImpl();
+ ServiceTracker.setFactory(injector);
ArrayList<Module> modules = new ArrayList<Module>();
modules.add(new DefaultModule());
try {
Added: branches/RF-7560/core/impl/src/main/java/org/richfaces/application/configuration/ConfigurationServiceImpl.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/application/configuration/ConfigurationServiceImpl.java (rev 0)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/application/configuration/ConfigurationServiceImpl.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -0,0 +1,183 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.application.configuration;
+
+import java.beans.PropertyEditor;
+import java.beans.PropertyEditorManager;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.el.ExpressionFactory;
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.util.ELUtils;
+
+import com.google.common.base.Strings;
+import com.google.common.primitives.Primitives;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class ConfigurationServiceImpl implements ConfigurationService {
+
+ private Map<Enum<?>, ValueExpressionHolder> itemsMap = new ConcurrentHashMap<Enum<?>, ValueExpressionHolder>();
+
+ private final ConfigurationItem getConfigurationItemAnnotation(Enum<?> enumKey) {
+ try {
+ return enumKey.getClass().getField(enumKey.name()).getAnnotation(ConfigurationItem.class);
+ } catch (SecurityException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NoSuchFieldException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ private <T> T coerce(FacesContext context, Object value, Class<T> targetType) {
+ if (value == null) {
+ return null;
+ }
+
+ if (targetType.isInstance(value)) {
+ return targetType.cast(value);
+ }
+
+ if (value instanceof String) {
+ PropertyEditor editor = PropertyEditorManager.findEditor(targetType);
+ if (editor == null && Primitives.isWrapperType(targetType)) {
+ editor = PropertyEditorManager.findEditor(Primitives.unwrap(targetType));
+ }
+
+ if (editor != null) {
+
+ editor.setAsText((String) value);
+ return targetType.cast(editor.getValue());
+ } else if (targetType.isEnum()) {
+ return targetType.cast(Enum.valueOf((Class<Enum>) targetType, (String) value));
+ }
+ }
+
+ //TODO message
+ throw new IllegalArgumentException();
+ }
+
+ protected ValueExpressionHolder createValueExpressionHolder(FacesContext context, Enum<?> key, Class<?> targetType) {
+ ConfigurationItem annotation = getConfigurationItemAnnotation(key);
+ if (annotation == null) {
+ //TODO - handle this
+ }
+
+ ValueExpression expression = createValueExpression(context, annotation, targetType);
+
+ Object defaultValue = null;
+
+ if (expression == null || !expression.isLiteralText()) {
+ String defaultValueString = annotation.defaultValue();
+ if (!Strings.isNullOrEmpty(defaultValueString)) {
+ defaultValue = coerce(context, defaultValueString, targetType);
+ }
+ }
+
+ return new ValueExpressionHolder(expression, defaultValue);
+ }
+
+ private final ValueExpression createValueExpression(FacesContext context, ConfigurationItem annotation, Class<?> targetType) {
+ ConfigurationItemSource source = annotation.source();
+
+ if (source == ConfigurationItemSource.contextInitParameter) {
+ Map initMap = context.getExternalContext().getInitParameterMap();
+
+ for (String name : annotation.names()) {
+ String value = (String) initMap.get(name);
+
+ if (Strings.isNullOrEmpty(value)) {
+ continue;
+ }
+
+ if (ELUtils.isValueReference(value)) {
+ ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory();
+
+ if (expressionFactory == null) {
+ //TODO message
+ throw new IllegalStateException();
+ }
+
+ if (annotation.literal()) {
+ //TODO message
+ throw new IllegalArgumentException();
+ }
+
+ return expressionFactory.createValueExpression(context.getELContext(), value, targetType);
+ } else {
+ Object coercedValue = coerce(context, value, targetType);
+ if (coercedValue != null) {
+ return new ConstantValueExpression(coercedValue);
+ }
+ }
+ }
+
+ return null;
+ } else {
+ throw new IllegalArgumentException(source.toString());
+ }
+ }
+
+ protected <T> T getValue(FacesContext facesContext, Enum<?> key, Class<T> returnType) {
+ ValueExpressionHolder holder = itemsMap.get(key);
+
+ if (holder == null) {
+ holder = createValueExpressionHolder(facesContext, key, returnType);
+ itemsMap.put(key, holder);
+ }
+
+ return returnType.cast(holder.getValue(facesContext));
+ }
+
+ public Boolean getBooleanValue(FacesContext facesContext, Enum<?> key) {
+ return getValue(facesContext, key, Boolean.class);
+ }
+
+ public Integer getIntValue(FacesContext facesContext, Enum<?> key) {
+ return getValue(facesContext, key, Integer.class);
+ }
+
+ public Long getLongValue(FacesContext facesContext, Enum<?> key) {
+ return getValue(facesContext, key, Long.class);
+ }
+
+ public String getStringValue(FacesContext facesContext, Enum<?> key) {
+ return getValue(facesContext, key, String.class);
+ }
+
+ public <T extends Enum<T>> T getEnumValue(FacesContext facesContext, Enum<?> key, Class<T> enumClass) {
+ return getValue(facesContext, key, enumClass);
+ }
+
+ public Object getValue(FacesContext facesContext, Enum<?> key) {
+ return getValue(facesContext, key, Object.class);
+ }
+}
Added: branches/RF-7560/core/impl/src/main/java/org/richfaces/application/configuration/ConstantValueExpression.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/application/configuration/ConstantValueExpression.java (rev 0)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/application/configuration/ConstantValueExpression.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.application.configuration;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ValueExpression;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class ConstantValueExpression extends ValueExpression {
+
+ private static final long serialVersionUID = -4455404133234988782L;
+
+ private Object value;
+
+ public ConstantValueExpression(Object value) {
+ super();
+ this.value = value;
+ }
+
+ @Override
+ public Object getValue(ELContext context) {
+ return value;
+ }
+
+ @Override
+ public void setValue(ELContext context, Object value) {
+ throw new ELException("This expression is read-only");
+ }
+
+ @Override
+ public boolean isReadOnly(ELContext context) {
+ return true;
+ }
+
+ @Override
+ public Class<?> getType(ELContext context) {
+ return null;
+ }
+
+ @Override
+ public Class<?> getExpectedType() {
+ return Object.class;
+ }
+
+ @Override
+ public String getExpressionString() {
+ return null;
+ }
+
+ @Override
+ public boolean isLiteralText() {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return this == obj;
+ }
+
+}
Added: branches/RF-7560/core/impl/src/main/java/org/richfaces/application/configuration/ValueExpressionHolder.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/application/configuration/ValueExpressionHolder.java (rev 0)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/application/configuration/ValueExpressionHolder.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.application.configuration;
+
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+final class ValueExpressionHolder {
+
+ private ValueExpression valueExpression;
+
+ private Object defaultValue;
+
+ public ValueExpressionHolder(ValueExpression valueExpression, Object defaultValue) {
+ super();
+ this.valueExpression = valueExpression;
+ this.defaultValue = defaultValue;
+ }
+
+ public Object getValue(FacesContext context) {
+ if (valueExpression != null) {
+ try {
+ Object result = valueExpression.getValue(context.getELContext());
+
+ if (result != null) {
+ return result;
+ }
+ } catch (ELException e) {
+ // TODO: handle exception
+ }
+ }
+
+ return defaultValue;
+ }
+
+}
Modified: branches/RF-7560/core/impl/src/main/java/org/richfaces/cache/EhCacheCacheFactory.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/cache/EhCacheCacheFactory.java 2010-09-03 15:36:40 UTC (rev 19118)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/cache/EhCacheCacheFactory.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -3,6 +3,8 @@
*/
package org.richfaces.cache;
+import static org.richfaces.application.configuration.ConfigurationServiceHelper.getIntConfigurationValue;
+
import java.net.URL;
import java.text.MessageFormat;
import java.util.Map;
@@ -12,7 +14,7 @@
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Ehcache;
-import org.ajax4jsf.context.ContextInitParameters;
+import org.richfaces.application.CoreConfiguration;
import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
@@ -49,7 +51,7 @@
public Cache createCache(FacesContext facesContext, String cacheName, Map<?, ?> env) {
LOG.info("Creating EhCache cache instance");
- int maxCacheSize = ContextInitParameters.getResourcesCacheSize(facesContext);
+ int maxCacheSize = getIntConfigurationValue(facesContext, CoreConfiguration.Items.resourcesCacheSize);
boolean preconfiguredCache = false;
Ehcache ehcache = cacheManager.getEhcache(cacheName);
Modified: branches/RF-7560/core/impl/src/main/java/org/richfaces/cache/JBossCacheCacheFactory.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/cache/JBossCacheCacheFactory.java 2010-09-03 15:36:40 UTC (rev 19118)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/cache/JBossCacheCacheFactory.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -3,6 +3,8 @@
*/
package org.richfaces.cache;
+import static org.richfaces.application.configuration.ConfigurationServiceHelper.getIntConfigurationValue;
+
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
@@ -12,7 +14,6 @@
import javax.faces.FacesException;
import javax.faces.context.FacesContext;
-import org.ajax4jsf.context.ContextInitParameters;
import org.ajax4jsf.resource.util.URLToStreamHelper;
import org.jboss.cache.Cache;
import org.jboss.cache.DefaultCacheFactory;
@@ -23,6 +24,7 @@
import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.eviction.EvictionAlgorithmConfigBase;
import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
+import org.richfaces.application.CoreConfiguration;
import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
@@ -49,7 +51,7 @@
if (evictionAlgorithmConfig instanceof EvictionAlgorithmConfigBase) {
EvictionAlgorithmConfigBase baseEvicitonConfig = (EvictionAlgorithmConfigBase) evictionAlgorithmConfig;
if (baseEvicitonConfig.getMaxNodes() <= 0) {
- int maxCacheSize = ContextInitParameters.getResourcesCacheSize(facesContext);
+ int maxCacheSize = getIntConfigurationValue(facesContext, CoreConfiguration.Items.resourcesCacheSize);
LOG.info(MessageFormat.format("Maximum cache size hasn''t been set, resetting to {0} max items", maxCacheSize));
baseEvicitonConfig.setMaxNodes(maxCacheSize);
}
@@ -90,7 +92,8 @@
Configuration configuration = new Configuration();
EvictionRegionConfig evictionRegionConfig = new EvictionRegionConfig(Fqn.root());
ExpirationAlgorithmConfig expirationAlgorithm = new ExpirationAlgorithmConfig();
- expirationAlgorithm.setMaxNodes(ContextInitParameters.getResourcesCacheSize(facesContext));
+ int maxCacheSize = getIntConfigurationValue(facesContext, CoreConfiguration.Items.resourcesCacheSize);
+ expirationAlgorithm.setMaxNodes(maxCacheSize);
evictionRegionConfig.setEvictionAlgorithmConfig(expirationAlgorithm);
Modified: branches/RF-7560/core/impl/src/main/java/org/richfaces/cache/OSCacheCacheFactory.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/cache/OSCacheCacheFactory.java 2010-09-03 15:36:40 UTC (rev 19118)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/cache/OSCacheCacheFactory.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -21,6 +21,8 @@
package org.richfaces.cache;
+import static org.richfaces.application.configuration.ConfigurationServiceHelper.getIntConfigurationValue;
+
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
@@ -32,8 +34,8 @@
import javax.faces.context.FacesContext;
-import org.ajax4jsf.context.ContextInitParameters;
import org.ajax4jsf.resource.util.URLToStreamHelper;
+import org.richfaces.application.CoreConfiguration;
import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
@@ -107,7 +109,7 @@
String property = cacheProperties.getProperty(AbstractCacheAdministrator.CACHE_CAPACITY_KEY);
if (property == null) {
- int maxCacheSize = ContextInitParameters.getResourcesCacheSize(facesContext);
+ int maxCacheSize = getIntConfigurationValue(facesContext, CoreConfiguration.Items.resourcesCacheSize);
LOG.info(MessageFormat.format("Maximum cache size hasn''t been set, resetting to {0} max items", maxCacheSize));
cacheProperties.put(AbstractCacheAdministrator.CACHE_CAPACITY_KEY,
Integer.toString(maxCacheSize));
Modified: branches/RF-7560/core/impl/src/main/java/org/richfaces/cache/lru/LRUMapCacheFactory.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/cache/lru/LRUMapCacheFactory.java 2010-09-03 15:36:40 UTC (rev 19118)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/cache/lru/LRUMapCacheFactory.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -21,38 +21,38 @@
package org.richfaces.cache.lru;
+import static org.richfaces.application.configuration.ConfigurationServiceHelper.getIntConfigurationValue;
+
import java.util.Map;
import javax.faces.context.FacesContext;
-import org.ajax4jsf.context.ContextInitParameters;
+import org.richfaces.application.CoreConfiguration;
import org.richfaces.cache.Cache;
import org.richfaces.cache.CacheFactory;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
-import org.richfaces.log.Logger;
/**
* @author Nick - mailto:nbelaevski@exadel.com
* created 01.05.2007
*/
public class LRUMapCacheFactory implements CacheFactory {
- public static final String CACHE_SIZE_PARAMETER = "org.ajax4jsf.cache.LRU_MAP_CACHE_SIZE";
private static final Logger LOG = RichfacesLogger.CACHE.getLogger();
public Cache createCache(FacesContext facesContext, String cacheName, Map<?, ?> env) {
//TODO - handle cache name
LOG.info("Creating LRUMap cache instance using parameters: " + env);
- String size = (String) env.get(CACHE_SIZE_PARAMETER);
- if ((size == null) || (size.length() == 0)) {
- size = Integer.toString(ContextInitParameters.getResourcesCacheSize(facesContext));
+ Integer cacheSize = getIntConfigurationValue(facesContext, CoreConfiguration.Items.lruMapCacheSize);
+
+ if (cacheSize == null) {
+ cacheSize = getIntConfigurationValue(facesContext, CoreConfiguration.Items.resourcesCacheSize);
}
+
+ LOG.info("Creating LRUMap cache instance of " + cacheSize + " items capacity");
- int parsedSize = Integer.parseInt(size);
-
- LOG.info("Creating LRUMap cache instance of " + parsedSize + " items capacity");
-
- return new LRUMapCache(parsedSize);
+ return new LRUMapCache(cacheSize);
}
public void destroy() {
Modified: branches/RF-7560/core/impl/src/main/java/org/richfaces/context/SkinningResourcesPhaseListener.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/context/SkinningResourcesPhaseListener.java 2010-09-03 15:36:40 UTC (rev 19118)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/context/SkinningResourcesPhaseListener.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -33,7 +33,9 @@
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;
-import org.ajax4jsf.context.ContextInitParameters;
+import org.richfaces.application.CoreConfiguration;
+import org.richfaces.application.ServiceTracker;
+import org.richfaces.application.configuration.ConfigurationService;
import org.richfaces.el.BaseReadOnlyValueExpression;
/**
@@ -81,9 +83,11 @@
public Object getValue(ELContext context) {
FacesContext facesContext = getFacesContext(context);
- boolean controls = ContextInitParameters.isStandardControlSkinningEnabled(facesContext);
- boolean classes = ContextInitParameters.isStandardControlSkinningClassesEnabled(facesContext);
+ ConfigurationService configurationService = ServiceTracker.getService(ConfigurationService.class);
+ boolean controls = configurationService.getBooleanValue(facesContext, CoreConfiguration.Items.standardControlsSkinning);
+ boolean classes = configurationService.getBooleanValue(facesContext, CoreConfiguration.Items.standardControlsSkinningClasses);
+
if (controls && classes) {
return BOTH_SKINNING;
}
@@ -109,8 +113,10 @@
public Object getValue(ELContext context) {
FacesContext facesContext = getFacesContext(context);
- return ContextInitParameters.isStandardControlSkinningEnabled(facesContext) ||
- ContextInitParameters.isStandardControlSkinningClassesEnabled(facesContext);
+ ConfigurationService configurationService = ServiceTracker.getService(ConfigurationService.class);
+
+ return configurationService.getBooleanValue(facesContext, CoreConfiguration.Items.standardControlsSkinning) ||
+ configurationService.getBooleanValue(facesContext, CoreConfiguration.Items.standardControlsSkinningClasses);
}
}
Modified: branches/RF-7560/core/impl/src/main/java/org/richfaces/resource/AbstractCacheableResource.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/resource/AbstractCacheableResource.java 2010-09-03 15:36:40 UTC (rev 19118)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/resource/AbstractCacheableResource.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -21,6 +21,7 @@
package org.richfaces.resource;
+import static org.richfaces.application.configuration.ConfigurationServiceHelper.getLongConfigurationValue;
import static org.richfaces.resource.ResourceUtils.millisToSecond;
import static org.richfaces.resource.ResourceUtils.secondToMillis;
@@ -30,7 +31,7 @@
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
-import org.ajax4jsf.context.ContextInitParameters;
+import org.richfaces.application.CoreConfiguration;
import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
import org.richfaces.util.Util;
@@ -188,7 +189,7 @@
formattedExpireDate = Util.formatHttpDate(expired);
maxAge = millisToSecond(expired.getTime() - currentTime);
} else {
- maxAge = ContextInitParameters.getResourcesTimeToLive(facesContext);
+ maxAge = getLongConfigurationValue(facesContext, CoreConfiguration.Items.resourcesTTL);
formattedExpireDate = Util.formatHttpDate(currentTime + secondToMillis(maxAge));
}
}
Modified: branches/RF-7560/core/impl/src/main/java/org/richfaces/resource/ExternalStaticResource.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/resource/ExternalStaticResource.java 2010-09-03 15:36:40 UTC (rev 19118)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/resource/ExternalStaticResource.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -21,6 +21,8 @@
*/
package org.richfaces.resource;
+import static org.richfaces.application.configuration.ConfigurationServiceHelper.getStringConfigurationValue;
+
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
@@ -29,7 +31,7 @@
import javax.faces.application.Resource;
import javax.faces.context.FacesContext;
-import org.ajax4jsf.context.ContextInitParameters;
+import org.richfaces.application.CoreConfiguration;
import org.richfaces.skin.SkinFactory;
import com.google.common.base.Joiner;
@@ -40,6 +42,8 @@
*/
public class ExternalStaticResource extends Resource {
+ public static final String STATIC_RESOURCE_LOCATION_VARIABLE = "resourceLocation";
+
private static final Joiner RESOURCE_PATH_JOINER = Joiner.on('/').skipNulls();
private String location;
@@ -77,18 +81,18 @@
public String getRequestPath() {
FacesContext facesContext = FacesContext.getCurrentInstance();
Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
- Object resourceVarValue = requestMap.get(ContextInitParameters.STATIC_RESOURCE_LOCATION_VARIABLE);
+ Object resourceVarValue = requestMap.get(STATIC_RESOURCE_LOCATION_VARIABLE);
try {
String resourceLocation = getResourceLocation(facesContext);
- requestMap.put(ContextInitParameters.STATIC_RESOURCE_LOCATION_VARIABLE, resourceLocation);
+ requestMap.put(STATIC_RESOURCE_LOCATION_VARIABLE, resourceLocation);
//TODO pass via ViewHandler?
- return ContextInitParameters.getStaticResourceLocation(facesContext);
+ return getStringConfigurationValue(facesContext, CoreConfiguration.Items.staticResourceLocation);
} finally {
- requestMap.remove(ContextInitParameters.STATIC_RESOURCE_LOCATION_VARIABLE);
+ requestMap.remove(STATIC_RESOURCE_LOCATION_VARIABLE);
if (resourceVarValue != null) {
- requestMap.put(ContextInitParameters.STATIC_RESOURCE_LOCATION_VARIABLE, resourceVarValue);
+ requestMap.put(STATIC_RESOURCE_LOCATION_VARIABLE, resourceVarValue);
}
}
}
Modified: branches/RF-7560/core/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java 2010-09-03 15:36:40 UTC (rev 19118)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -21,6 +21,8 @@
package org.richfaces.skin;
+import static org.richfaces.application.configuration.ConfigurationServiceHelper.getConfigurationValue;
+
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
@@ -28,7 +30,7 @@
import javax.faces.context.FacesContext;
import org.ajax4jsf.Messages;
-import org.ajax4jsf.context.ContextInitParameters;
+import org.richfaces.application.CoreConfiguration;
/**
* Implementation of {@link SkinFactory} with building skins from properties
@@ -117,7 +119,7 @@
* expression.
*/
protected Skin getSkinOrName(FacesContext context, boolean useBase) {
- Object skinObject = useBase ? ContextInitParameters.getBaseSkin(context) : ContextInitParameters.getSkin(context);
+ Object skinObject = getConfigurationValue(context, useBase ? CoreConfiguration.Items.baseSkin : CoreConfiguration.Items.skin);
Skin result = null;
Added: branches/RF-7560/core/impl/src/test/java/org/richfaces/ContextInitParameter.java
===================================================================
--- branches/RF-7560/core/impl/src/test/java/org/richfaces/ContextInitParameter.java (rev 0)
+++ branches/RF-7560/core/impl/src/test/java/org/richfaces/ContextInitParameter.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target(ElementType.METHOD)
+public @interface ContextInitParameter {
+
+ public String name();
+
+ public String value();
+
+}
Added: branches/RF-7560/core/impl/src/test/java/org/richfaces/ContextInitParameters.java
===================================================================
--- branches/RF-7560/core/impl/src/test/java/org/richfaces/ContextInitParameters.java (rev 0)
+++ branches/RF-7560/core/impl/src/test/java/org/richfaces/ContextInitParameters.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target(ElementType.METHOD)
+public @interface ContextInitParameters {
+
+ public ContextInitParameter[] value();
+
+}
Added: branches/RF-7560/core/impl/src/test/java/org/richfaces/FacesRequestSetupRule.java
===================================================================
--- branches/RF-7560/core/impl/src/test/java/org/richfaces/FacesRequestSetupRule.java (rev 0)
+++ branches/RF-7560/core/impl/src/test/java/org/richfaces/FacesRequestSetupRule.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -0,0 +1,133 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces;
+
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.jboss.test.faces.FacesEnvironment;
+import org.jboss.test.faces.FacesEnvironment.FacesRequest;
+import org.junit.rules.MethodRule;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.Statement;
+
+import com.google.common.collect.Maps;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class FacesRequestSetupRule implements MethodRule {
+
+ private FacesEnvironment environment;
+
+ private FacesRequest facesRequest;
+
+ public Statement apply(final Statement base, final FrameworkMethod method,
+ Object target) {
+ return new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ starting(method);
+ try {
+ base.evaluate();
+ } catch (Throwable t) {
+ throw t;
+ } finally {
+ finished(method);
+ }
+ }
+ };
+ }
+
+ private Map<String, String> getInitParameters(FrameworkMethod method) {
+ Map<String, String> result = Maps.newHashMap();
+
+ ContextInitParameter parameter = method.getAnnotation(ContextInitParameter.class);
+ if (parameter != null) {
+ result.put(parameter.name(), parameter.value());
+ }
+
+ ContextInitParameters parameters = method.getAnnotation(ContextInitParameters.class);
+ if (parameters != null) {
+ for (ContextInitParameter param : parameters.value()) {
+ if (result.put(param.name(), param.value()) != null) {
+ throw new IllegalArgumentException("Parameter " + param + " specified twice");
+ }
+ }
+ }
+
+ return result;
+ }
+
+ protected void starting(FrameworkMethod method) throws Exception {
+ createFacesEnvironment();
+ setUpFacesEnvironment(method);
+
+ createFacesRequest();
+ setUpFacesRequest();
+ }
+
+ protected void finished(FrameworkMethod method) throws Exception {
+ tearDownFacesRequest();
+ tearDownFacesEnvironment();
+ }
+
+ protected void setUpFacesRequest() {
+ facesRequest.start();
+ }
+
+ protected void createFacesRequest() throws Exception {
+ facesRequest = environment.createFacesRequest();
+ }
+
+ protected void setUpFacesEnvironment(FrameworkMethod method) {
+ for (Entry<String, String> paramEntry: getInitParameters(method).entrySet()) {
+ environment.getServer().addInitParameter(paramEntry.getKey(), paramEntry.getValue());
+ }
+
+ environment.start();
+ }
+
+ protected void createFacesEnvironment() {
+ environment = FacesEnvironment.createEnvironment();
+ }
+
+ protected void tearDownFacesEnvironment() {
+ if (environment != null) {
+ environment.release();
+ environment = null;
+ }
+ }
+
+ protected void tearDownFacesRequest() {
+ if (facesRequest != null) {
+ facesRequest.release();
+ facesRequest = null;
+ }
+ }
+
+ public FacesRequest getFacesRequest() {
+ return facesRequest;
+ }
+
+}
Added: branches/RF-7560/core/impl/src/test/java/org/richfaces/application/Configuration.java
===================================================================
--- branches/RF-7560/core/impl/src/test/java/org/richfaces/application/Configuration.java (rev 0)
+++ branches/RF-7560/core/impl/src/test/java/org/richfaces/application/Configuration.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.application;
+
+import org.richfaces.application.configuration.ConfigurationItem;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public enum Configuration {
+
+ @ConfigurationItem(names = "org.richfaces.LongValue")
+ longValue,
+
+ @ConfigurationItem(names = "org.richfaces.LongValueWithDefault", defaultValue = "-100")
+ longValueWithDefault,
+
+ @ConfigurationItem(names = "org.richfaces.IntValue")
+ intValue,
+
+ @ConfigurationItem(names = "org.richfaces.IntValueWithDefault", defaultValue = "-1")
+ intValueWithDefault,
+
+ @ConfigurationItem(names = "org.richfaces.StringValue")
+ stringValue,
+
+ @ConfigurationItem(names = "org.richfaces.StringValueWithDefault", defaultValue = "default name")
+ stringValueWithDefault,
+
+ @ConfigurationItem(names = "org.richfaces.EnumValue")
+ enumValue,
+
+ @ConfigurationItem(names = "org.richfaces.EnumValue", defaultValue = "foo")
+ enumValueWithDefault,
+
+ @ConfigurationItem(names = "org.richfaces.BooleanValue")
+ booleanValue,
+
+ @ConfigurationItem(names = "org.richfaces.BooleanValue", defaultValue = "false")
+ booleanValueWithDefault,
+
+ @ConfigurationItem(names = {"org.richfaces.MultiValue1", "org.richfaces.MultiValue2"})
+ multiValue,
+
+ @ConfigurationItem(names = "org.richfaces.FacesContextReference")
+ facesContext,
+
+ @ConfigurationItem(names = "org.richfaces.DynamicValueWithDefault", defaultValue = "<something>")
+ dynamicValueWithDefault,
+
+ @ConfigurationItem(names = "org.richfaces.LiteralOnlyValue", literal = true)
+ literalOnly,
+
+ @ConfigurationItem(names = "org.richfaces.LiteralOnlyFailingValue", literal = true)
+ literalOnlyFailing
+}
Added: branches/RF-7560/core/impl/src/test/java/org/richfaces/application/ConfigurationServiceImplTest.java
===================================================================
--- branches/RF-7560/core/impl/src/test/java/org/richfaces/application/ConfigurationServiceImplTest.java (rev 0)
+++ branches/RF-7560/core/impl/src/test/java/org/richfaces/application/ConfigurationServiceImplTest.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.application;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.fail;
+import static org.richfaces.application.configuration.ConfigurationServiceHelper.getBooleanConfigurationValue;
+import static org.richfaces.application.configuration.ConfigurationServiceHelper.getConfigurationValue;
+import static org.richfaces.application.configuration.ConfigurationServiceHelper.getEnumConfigurationValue;
+import static org.richfaces.application.configuration.ConfigurationServiceHelper.getIntConfigurationValue;
+import static org.richfaces.application.configuration.ConfigurationServiceHelper.getLongConfigurationValue;
+import static org.richfaces.application.configuration.ConfigurationServiceHelper.getStringConfigurationValue;
+
+import javax.faces.context.FacesContext;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.richfaces.ContextInitParameter;
+import org.richfaces.ContextInitParameters;
+import org.richfaces.FacesRequestSetupRule;
+
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class ConfigurationServiceImplTest {
+
+ @Rule
+ public FacesRequestSetupRule rule = new FacesRequestSetupRule();
+
+ @Test
+ @ContextInitParameters({
+ @ContextInitParameter(name = "org.richfaces.LongValue", value = "223372036854775807"),
+ @ContextInitParameter(name = "org.richfaces.IntValue", value = "32768"),
+ @ContextInitParameter(name = "org.richfaces.StringValue", value = "some string"),
+ @ContextInitParameter(name = "org.richfaces.BooleanValue", value = "true"),
+ @ContextInitParameter(name = "org.richfaces.EnumValue", value = "bar")
+ })
+
+ public void testLiteralValues() throws Exception {
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ assertEquals(223372036854775807l, getLongConfigurationValue(context, Configuration.longValue).longValue());
+ assertEquals(32768, getIntConfigurationValue(context, Configuration.intValue).intValue());
+ assertEquals("some string", getStringConfigurationValue(context, Configuration.stringValue));
+ assertEquals(true, getBooleanConfigurationValue(context, Configuration.booleanValue).booleanValue());
+ assertEquals(Enumeration.bar, getEnumConfigurationValue(context, Configuration.enumValue, Enumeration.class));
+ }
+
+ @Test
+ public void testDefaultValues() throws Exception {
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ assertEquals(-100l, getLongConfigurationValue(context, Configuration.longValueWithDefault).longValue());
+ assertEquals(-1, getIntConfigurationValue(context, Configuration.intValueWithDefault).intValue());
+ assertEquals("default name", getStringConfigurationValue(context, Configuration.stringValueWithDefault));
+ assertEquals(false, getBooleanConfigurationValue(context, Configuration.booleanValueWithDefault).booleanValue());
+ assertEquals(Enumeration.foo, getEnumConfigurationValue(context, Configuration.enumValueWithDefault, Enumeration.class));
+ }
+
+ @Test
+ @ContextInitParameters({
+ @ContextInitParameter(name = "org.richfaces.MultiValue2", value = "test value")
+ })
+ public void testMultiValues() throws Exception {
+ assertEquals("test value", getStringConfigurationValue(FacesContext.getCurrentInstance(), Configuration.multiValue));
+ }
+
+ @Test
+ @ContextInitParameters({
+ @ContextInitParameter(name = "org.richfaces.FacesContextReference", value = "#{facesContext}"),
+ @ContextInitParameter(name = "org.richfaces.DynamicValueWithDefault", value = "#{facesContext.attributes['dummyValue']}")
+ })
+ public void testDynamicValues() throws Exception {
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ assertSame(context, getConfigurationValue(context, Configuration.facesContext));
+ assertEquals("<something>", getConfigurationValue(context, Configuration.dynamicValueWithDefault));
+ }
+
+ @Test
+ @ContextInitParameters({
+ @ContextInitParameter(name = "org.richfaces.LiteralOnlyValue", value = "pure literal"),
+ @ContextInitParameter(name = "org.richfaces.LiteralOnlyFailingValue", value = "#{someEl}")
+ })
+ public void testLiteral() throws Exception {
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ assertEquals("pure literal", getConfigurationValue(context, Configuration.literalOnly));
+ try {
+ getConfigurationValue(context, Configuration.literalOnlyFailing);
+
+ fail();
+ } catch (IllegalArgumentException e) {
+ // TODO: handle exception
+ }
+ }
+}
Added: branches/RF-7560/core/impl/src/test/java/org/richfaces/application/Enumeration.java
===================================================================
--- branches/RF-7560/core/impl/src/test/java/org/richfaces/application/Enumeration.java (rev 0)
+++ branches/RF-7560/core/impl/src/test/java/org/richfaces/application/Enumeration.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.application;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public enum Enumeration {
+
+ foo, bar
+}
Modified: branches/RF-7560/core/impl/src/test/java/org/richfaces/cache/BaseCacheTest.java
===================================================================
--- branches/RF-7560/core/impl/src/test/java/org/richfaces/cache/BaseCacheTest.java 2010-09-03 15:36:40 UTC (rev 19118)
+++ branches/RF-7560/core/impl/src/test/java/org/richfaces/cache/BaseCacheTest.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -29,11 +29,9 @@
import java.util.UUID;
import java.util.concurrent.atomic.AtomicBoolean;
-import org.ajax4jsf.context.ContextInitParameters;
import org.jboss.test.faces.AbstractFacesTest;
import org.junit.Assert;
-import org.richfaces.cache.Cache;
-import org.richfaces.cache.CacheManager;
+import org.richfaces.application.CoreConfiguration;
/**
* @author Nick Belaevski
@@ -56,7 +54,7 @@
protected void setupJsfInitParameters() {
super.setupJsfInitParameters();
this.facesServer.addInitParameter(CacheManager.CACHE_MANAGER_FACTORY_CLASS, cacheManagerFactoryClassName);
- this.facesServer.addInitParameter(ContextInitParameters.RESOURCES_CACHE_SIZE, Integer.toString(sizeLimit));
+ this.facesServer.addInitParameter(CoreConfiguration.RESOURCES_CACHE_SIZE_PARAM_NAME, Integer.toString(sizeLimit));
}
protected Cache getCache() {
Modified: branches/RF-7560/core/impl/src/test/java/org/richfaces/skin/SkinTestCase.java
===================================================================
--- branches/RF-7560/core/impl/src/test/java/org/richfaces/skin/SkinTestCase.java 2010-09-03 15:36:40 UTC (rev 19118)
+++ branches/RF-7560/core/impl/src/test/java/org/richfaces/skin/SkinTestCase.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -21,18 +21,26 @@
package org.richfaces.skin;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.lang.reflect.Method;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.fail;
+import static org.richfaces.application.CoreConfiguration.BASE_SKIN_PARAM_NAME;
+import static org.richfaces.application.CoreConfiguration.SKIN_PARAM_NAME;
+
import java.util.HashMap;
import java.util.Map;
import javax.faces.FacesException;
+import javax.faces.context.FacesContext;
-import org.ajax4jsf.context.ContextInitParameters;
-import org.jboss.test.faces.AbstractFacesTest;
+import org.junit.Rule;
+import org.junit.Test;
+import org.richfaces.ContextInitParameter;
+import org.richfaces.ContextInitParameters;
+import org.richfaces.FacesRequestSetupRule;
/**
* Test for Skin/skin factory methods.
@@ -40,78 +48,43 @@
* @version $Revision: 1.1.2.1 $ $Date: 2007/01/10 14:28:13 $
*
*/
-public class SkinTestCase extends AbstractFacesTest {
+public class SkinTestCase {
+
+ @Rule
+ public FacesRequestSetupRule rule = new FacesRequestSetupRule();
- @Override
- public void setUp() throws Exception {
- super.setUp();
- setupFacesRequest();
- }
-
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
- @Override
- protected void setupJsfInitParameters() {
- super.setupJsfInitParameters();
- setupSkinParameters();
- }
-
- private void setupSkinParameters() {
- try {
- Method method = getClass().getMethod(getName());
- SkinParameters skinParameters = method.getAnnotation(SkinParameters.class);
-
- if (skinParameters != null) {
- String skinName = skinParameters.skinName();
-
- if (skinName != null && skinName.length() != 0) {
- facesServer.addInitParameter(ContextInitParameters.SKIN, skinName);
- }
-
- String baseSkinName = skinParameters.baseSkinName();
-
- if (baseSkinName != null && baseSkinName.length() != 0) {
- facesServer.addInitParameter(ContextInitParameters.BASE_SKIN, baseSkinName);
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
+ private void addParameters(FacesContext facesContext, Object[][] strings) {
+ Map<Object, Object> baseMap = new HashMap<Object, Object>();
+
+ for (Object[] objects : strings) {
+ baseMap.put(objects[0], objects[1]);
}
+
+ facesContext.getExternalContext().getRequestMap().put("test", baseMap);
}
-
- /*
- * Test method for 'org.richfaces.skin.SkinFactory.getInstance()'
- */
+
+ @Test
public void testGetInstance() {
- SkinFactory factory = SkinFactory.getInstance();
- SkinFactory factory1 = SkinFactory.getInstance();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ SkinFactory factory = SkinFactory.getInstance(facesContext);
+ SkinFactory factory1 = SkinFactory.getInstance(facesContext);
assertSame(factory, factory1);
}
- private void addParameters(Object[][] strings) {
- Map<Object, Object> baseMap = new HashMap<Object, Object>();
-
- for (Object[] objects : strings) {
- baseMap.put(objects[0], objects[1]);
- }
-
- facesContext.getExternalContext().getRequestMap().put("test", baseMap);
- }
-
/*
* Test method for 'org.richfaces.skin.SkinFactory.getSkin(FacesContext)'
*/
- @SkinParameters(skinName = "test")
+ @Test
+ @ContextInitParameter(name = SKIN_PARAM_NAME, value = "test")
public void testGetSkin() {
- addParameters(new Object[][] {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ addParameters(facesContext, new Object[][] {
new Object[] {"bean", "test.value"}
});
- SkinFactory factory = SkinFactory.getInstance();
+ SkinFactory factory = SkinFactory.getInstance(facesContext);
// test call
Skin skin = factory.getSkin(facesContext);
@@ -129,9 +102,13 @@
/*
* Test method for 'org.richfaces.skin.SkinFactory.getSkin(FacesContext)'
*/
- @SkinParameters(skinName = "test", baseSkinName = "DEFAULT")
+ @ContextInitParameters({
+ @ContextInitParameter(name = SKIN_PARAM_NAME, value = "test"),
+ @ContextInitParameter(name = BASE_SKIN_PARAM_NAME, value = "DEFAULT")
+ })
public void testSkinReferences() {
- SkinFactory factory = SkinFactory.getInstance();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ SkinFactory factory = SkinFactory.getInstance(facesContext);
// test call
Skin skin = factory.getSkin(facesContext);
@@ -144,9 +121,14 @@
/*
* Test method for 'org.richfaces.skin.SkinFactory.getSkin(FacesContext)'
*/
- @SkinParameters(skinName = "style", baseSkinName = "style_base")
+ @Test
+ @ContextInitParameters({
+ @ContextInitParameter(name = SKIN_PARAM_NAME, value = "style"),
+ @ContextInitParameter(name = BASE_SKIN_PARAM_NAME, value = "style_base")
+ })
public void testSkinReferences1() {
- SkinFactory factory = SkinFactory.getInstance();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ SkinFactory factory = SkinFactory.getInstance(facesContext);
// test call
Skin skin = factory.getSkin(facesContext);
@@ -158,11 +140,16 @@
assertEquals("white.textcolor", skin.getParameter(facesContext, "additionalTextColor"));
}
- @SkinParameters(skinName = "dynatest", baseSkinName = "dynatest_base")
+ @Test
+ @ContextInitParameters({
+ @ContextInitParameter(name = SKIN_PARAM_NAME, value = "dynatest"),
+ @ContextInitParameter(name = BASE_SKIN_PARAM_NAME, value = "dynatest_base")
+ })
public void testBaseSkin() {
- SkinFactory factory = SkinFactory.getInstance();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ SkinFactory factory = SkinFactory.getInstance(facesContext);
- addParameters(new Object[][] {
+ addParameters(facesContext, new Object[][] {
new Object[] {"bean", "dynabase1"}
});
@@ -183,9 +170,13 @@
/*
* Test method for 'org.richfaces.skin.SkinFactory.getSkin(FacesContext)'
*/
- @SkinParameters(skinName = "cyclic")
+ @Test
+ @ContextInitParameters({
+ @ContextInitParameter(name = SKIN_PARAM_NAME, value = "cyclic")
+ })
public void testCyclicSkinReferences() {
- SkinFactory factory = SkinFactory.getInstance();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ SkinFactory factory = SkinFactory.getInstance(facesContext);
try {
Skin skin = factory.getSkin(facesContext);
@@ -201,9 +192,13 @@
/*
* Test method for 'org.richfaces.skin.SkinFactory.getSkin(FacesContext)'
*/
- @SkinParameters(skinName = "noref")
+ @Test
+ @ContextInitParameters({
+ @ContextInitParameter(name = SKIN_PARAM_NAME, value = "noref")
+ })
public void testBadSkinReferences() {
- SkinFactory factory = SkinFactory.getInstance();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ SkinFactory factory = SkinFactory.getInstance(facesContext);
// test call
try {
@@ -220,11 +215,15 @@
/*
* Test method for 'org.richfaces.skin.SkinFactory.getSkin(FacesContext)'
*/
- @SkinParameters(skinName = "#{test.skin}")
+ @Test
+ @ContextInitParameters({
+ @ContextInitParameter(name = SKIN_PARAM_NAME, value = "#{test.skin}")
+ })
public void testGetBindedSkin() {
- SkinFactory factory = SkinFactory.getInstance();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ SkinFactory factory = SkinFactory.getInstance(facesContext);
- addParameters(new Object[][] {
+ addParameters(facesContext, new Object[][] {
new Object[] {"skin", "bindedtest"}, new Object[] {"bean", "binded.test.value"}
});
@@ -240,11 +239,15 @@
assertEquals("binded.test.value", skin.getParameter(facesContext, "bind.property"));
}
- @SkinParameters(skinName = "#{test.skin}")
+ @Test
+ @ContextInitParameters({
+ @ContextInitParameter(name = SKIN_PARAM_NAME, value = "#{test.skin}")
+ })
public void testSkinHash() {
- SkinFactory factory = SkinFactory.getInstance();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ SkinFactory factory = SkinFactory.getInstance(facesContext);
- addParameters(new Object[][] {
+ addParameters(facesContext, new Object[][] {
new Object[] {"skin", "bindedtest"}, new Object[] {"bean", "binded.test.value"}
});
@@ -267,39 +270,36 @@
/*
* Test method for 'org.richfaces.skin.SkinFactory.getDefaultProperties()'
*/
+ @Test
public void testGetDefaultProperties() {
- SkinFactory factory = (SkinFactory) SkinFactory.getInstance();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ SkinFactory factory = (SkinFactory) SkinFactory.getInstance(facesContext);
// assertEquals("HTML_BASIC",defaultProps.getProperty("render.kit"));
// Second default config
assertEquals("default", factory.getDefaultSkin(facesContext).getParameter(facesContext, "a"));
}
- /*
- * Test method for 'org.richfaces.skin.SkinFactory.getSkinName(FacesContext)'
- */
- public void testGetSkinName() {}
-
- @SkinParameters(skinName = "plain")
+ @Test
+ @ContextInitParameters({
+ @ContextInitParameter(name = SKIN_PARAM_NAME, value = "plain")
+ })
public void testPlainSkin() throws Exception {
- SkinFactory factory = (SkinFactory) SkinFactory.getInstance();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ SkinFactory factory = (SkinFactory) SkinFactory.getInstance(facesContext);
assertNull(factory.getSkin(facesContext).getParameter(facesContext, Skin.GENERAL_BACKGROUND_COLOR));
}
-
- @SkinParameters(baseSkinName = "plain")
+
+ @Test
+ @ContextInitParameters({
+ @ContextInitParameter(name = BASE_SKIN_PARAM_NAME, value = "plain")
+ })
public void testPlainSkinBase() throws Exception {
- SkinFactory factory = (SkinFactory) SkinFactory.getInstance();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ SkinFactory factory = (SkinFactory) SkinFactory.getInstance(facesContext);
assertNull(factory.getBaseSkin(facesContext).getParameter(facesContext, Skin.GENERAL_BACKGROUND_COLOR));
}
- @Retention(RetentionPolicy.RUNTIME)
- @Target(ElementType.METHOD)
- private @interface SkinParameters {
- String skinName() default "";
- String baseSkinName() default "";
- }
-
- ;
}
Added: branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/aplication/CoreComponentsConfiguration.java
===================================================================
--- branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/aplication/CoreComponentsConfiguration.java (rev 0)
+++ branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/aplication/CoreComponentsConfiguration.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.aplication;
+
+import org.richfaces.application.configuration.ConfigurationItem;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public final class CoreComponentsConfiguration {
+
+ private CoreComponentsConfiguration() {}
+
+ public enum Items {
+
+ @ConfigurationItem(defaultValue = "true", names = "org.richfaces.queue.enabled", literal = true)
+ queueEnabled
+
+ }
+
+}
Modified: branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/component/QueuePreRenderViewListener.java
===================================================================
--- branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/component/QueuePreRenderViewListener.java 2010-09-03 15:36:40 UTC (rev 19118)
+++ branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/component/QueuePreRenderViewListener.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -21,6 +21,8 @@
*/
package org.richfaces.component;
+import static org.richfaces.application.configuration.ConfigurationServiceHelper.getBooleanConfigurationValue;
+
import javax.faces.application.Application;
import javax.faces.component.UIComponent;
import javax.faces.component.UIOutput;
@@ -30,7 +32,7 @@
import javax.faces.event.SystemEvent;
import javax.faces.event.SystemEventListener;
-import org.ajax4jsf.context.ContextInitParameters;
+import org.richfaces.aplication.CoreComponentsConfiguration;
/**
* @author Nick Belaevski
@@ -48,7 +50,7 @@
FacesContext context = FacesContext.getCurrentInstance();
UIViewRoot viewRoot = context.getViewRoot();
- boolean queueEnabled = ContextInitParameters.isQueueEnabled(context);
+ boolean queueEnabled = getBooleanConfigurationValue(context, CoreComponentsConfiguration.Items.queueEnabled);
if (queueEnabled) {
Application application = context.getApplication();
UIComponent queueResourceComponent = application.createComponent(context,
Modified: branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueRendererBase.java
===================================================================
--- branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueRendererBase.java 2010-09-03 15:36:40 UTC (rev 19118)
+++ branches/RF-7560/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueRendererBase.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -21,6 +21,8 @@
*/
package org.richfaces.renderkit.html;
+import static org.richfaces.application.configuration.ConfigurationServiceHelper.getBooleanConfigurationValue;
+
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
@@ -34,7 +36,7 @@
import javax.faces.event.PreRemoveFromViewEvent;
import javax.faces.render.Renderer;
-import org.ajax4jsf.context.ContextInitParameters;
+import org.richfaces.aplication.CoreComponentsConfiguration;
import org.richfaces.component.QueueRegistry;
import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
@@ -60,7 +62,7 @@
public void processEvent(ComponentSystemEvent event) throws AbortProcessingException {
FacesContext context = FacesContext.getCurrentInstance();
- if (!ContextInitParameters.isQueueEnabled(context)) {
+ if (!getBooleanConfigurationValue(context, CoreComponentsConfiguration.Items.queueEnabled)) {
return;
}
Added: branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/application/IterationComponentsConfiguration.java
===================================================================
--- branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/application/IterationComponentsConfiguration.java (rev 0)
+++ branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/application/IterationComponentsConfiguration.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.application;
+
+import org.richfaces.application.configuration.ConfigurationItem;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public final class IterationComponentsConfiguration {
+
+ private IterationComponentsConfiguration() {}
+
+ public enum Items {
+
+ @ConfigurationItem(defaultValue = "false", names = "org.richfaces.datatableUsesViewLocale")
+ datatableUsesViewLocale
+
+ }
+}
Modified: branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/model/ArrangeableModel.java
===================================================================
--- branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/model/ArrangeableModel.java 2010-09-03 15:36:40 UTC (rev 19118)
+++ branches/RF-7560/ui/iteration/ui/src/main/java/org/richfaces/model/ArrangeableModel.java 2010-09-03 17:34:35 UTC (rev 19119)
@@ -22,6 +22,8 @@
package org.richfaces.model;
+import static org.richfaces.application.configuration.ConfigurationServiceHelper.getBooleanConfigurationValue;
+
import java.text.Collator;
import java.util.ArrayList;
import java.util.Collections;
@@ -35,12 +37,12 @@
import javax.faces.context.FacesContext;
import javax.faces.model.DataModelListener;
-import org.ajax4jsf.context.ContextInitParameters;
import org.ajax4jsf.model.DataVisitResult;
import org.ajax4jsf.model.DataVisitor;
import org.ajax4jsf.model.ExtendedDataModel;
import org.ajax4jsf.model.Range;
import org.ajax4jsf.model.SequenceRange;
+import org.richfaces.application.IterationComponentsConfiguration;
import org.richfaces.component.SortOrder;
/**
@@ -335,7 +337,7 @@
private Comparator<? super String> createStringComparator(FacesContext context) {
Comparator<? super String> comparator = null;
Locale locale = state.getLocale();
- if (locale != null && ContextInitParameters.isDatatableUsesViewLocale(context)) {
+ if (locale != null && getBooleanConfigurationValue(context, IterationComponentsConfiguration.Items.datatableUsesViewLocale)) {
comparator = Collator.getInstance(locale);
} else {
comparator = new Comparator<String>() {
14 years, 4 months
JBoss Rich Faces SVN: r19118 - branches/RF-8992/ui/input/api/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-09-03 11:36:40 -0400 (Fri, 03 Sep 2010)
New Revision: 19118
Added:
branches/RF-8992/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java
Log:
interface for the inplace components
Added: branches/RF-8992/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java
===================================================================
--- branches/RF-8992/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java (rev 0)
+++ branches/RF-8992/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java 2010-09-03 15:36:40 UTC (rev 19118)
@@ -0,0 +1,8 @@
+package org.richfaces.component;
+
+public interface InplaceComponent {
+
+ public String getDefaultLabel();
+
+ public InplaceState getState();
+}
14 years, 4 months
JBoss Rich Faces SVN: r19117 - branches/RF-8992/ui/input/ui/src/main/templates.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-09-03 11:35:29 -0400 (Fri, 03 Sep 2010)
New Revision: 19117
Added:
branches/RF-8992/ui/input/ui/src/main/templates/inplaceSelect.template.xml
Log:
Added: branches/RF-8992/ui/input/ui/src/main/templates/inplaceSelect.template.xml
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/templates/inplaceSelect.template.xml (rev 0)
+++ branches/RF-8992/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-09-03 15:35:29 UTC (rev 19117)
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- JBoss, Home of Professional Open Source Copyright ${year}, Red Hat,
+ Inc. and individual contributors by the @authors tag. See the copyright.txt
+ in the distribution for a full listing of individual contributors. This is
+ free software; you can redistribute it and/or modify it under the terms of
+ the GNU Lesser General Public License as published by the Free Software Foundation;
+ either version 2.1 of the License, or (at your option) any later version.
+ This software 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 software; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the
+ FSF site: http://www.fsf.org. -->
+<cdk:root xmlns="http://jboss.org/schema/richfaces/cdk/xhtml-el"
+ xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core" xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core"
+ xmlns:cc="http://jboss.org/schema/richfaces/cdk/jsf/composite"
+ xmlns:javaee="http://java.sun.com/xml/ns/javaee">
+
+ <cc:interface>
+ <cdk:class>org.richfaces.renderkit.html.InplaceSelectRenderer
+ </cdk:class>
+ <cdk:superclass>org.richfaces.renderkit.InplaceSelectBaseRenderer
+ </cdk:superclass>
+ <cdk:component-family>org.richfaces.InplaceSelect
+ </cdk:component-family>
+ <cdk:renderer-type>org.richfaces.InplaceSelectRenderer
+ </cdk:renderer-type>
+ </cc:interface>
+
+ <cc:implementation>
+ <cdk:object type="org.richfaces.component.InplaceState"
+ name="inplaceState" value="#{getInplaceState(component)}" />
+ <cdk:object type="java.lang.String" name="inplaceValue"
+ value="#{getValue(facesContext, component)}" />
+
+ <span id="#{clientId}" class="#{getReadyStyleClass(component, inplaceState)}"
+ cdk:passThroughWithExclusions="id class">
+ <span id="#{clientId}:label" class="rf-ii-lbl">
+ #{inplaceValue}
+ </span>
+ <input id="#{clientId}:focus" type="image"
+ style="position: absolute; top: 0px; left: 0px; outline-style: none;"
+ class="rf-ii-none" />
+ <span id="#{clientId}:edit" class="#{getEditStyleClass(component, inplaceState)}">
+ <input id="#{clientId}:input" autocomplete="off" name="#{clientId}"
+ type="text" value="#{getInputValue(facesContext, component)}"
+ class="rf-ii-f" style="width: #{component.attributes['inputWidth']};"
+ cdk:passThrough="tabIndex" readonly="readonly">
+ <cdk:call expression="renderInputHandlers(facesContext, component);" />
+ </input>
+ <c:if test="#{component.attributes['showControls']}">
+ <span class="rf-ii-btn-prepos">
+ <span class="rf-ii-btn-pos">
+ <span id="#{clientId}:btnshadow" class="rf-ii-btn-shadow">
+ <span class="rf-ii-btn-shadow-t"></span>
+ <span class="rf-ii-btn-shadow-l"></span>
+ <span class="rf-ii-btn-shadow-r"></span>
+ <span class="rf-ii-btn-shadow-b"></span>
+
+ <span id="#{clientId}:btn" style="position : relative">
+ <input type="image" id="#{clientId}:okbtn"
+ src="#{getResourcePath(facesContext, 'org.richfaces/ico_ok.gif')}"
+ class="rf-ii-btn" onmousedown="this.className='rf-ii-btn-p'"
+ onmouseout="this.className='rf-ii-btn'" onmouseup="this.className='rf-ii-btn'" />
+ <input type="image" id="#{clientId}:cancelbtn"
+ src="#{getResourcePath(facesContext,'org.richfaces/ico_cancel.gif')}"
+ class="rf-ii-btn" onmousedown="this.className='rf-ii-btn-press'"
+ onmouseout="this.className='rf-ii-btn'" onmouseup="this.className='rf-ii-btn'" />
+ <br />
+ </span>
+ </span>
+ </span>
+ </span>
+ </c:if>
+
+ <span class="insel_list_cord">
+ <span class="insel_shadow">
+ <span class="insel_shadow_t">
+ <span class="insel_shadow_l"></span>
+ <span class="insel_shadow_r"></span>
+ <span class="insel_shadow_b"></span>
+ <span class="insel_list_decoration">
+ <span class="insel_list_scroll">
+ <span class="insel_option insel_font" onmouseout="this.className='insel_option insel_font'"
+ onmouseover="this.className='insel_option insel_font insel_select'">Option 1</span>
+ <span class="insel_option insel_font" onmouseout="this.className='insel_option insel_font'"
+ onmouseover="this.className='insel_option insel_font insel_select'">Option 2</span>
+ <span class="insel_option insel_font" onmouseout="this.className='insel_option insel_font'"
+ onmouseover="this.className='insel_option insel_font insel_select'">Option 3</span>
+ <span class="insel_option insel_font" onmouseout="this.className='insel_option insel_font'"
+ onmouseover="this.className='insel_option insel_font insel_select'">Option 4</span>
+ <span class="insel_option insel_font" onmouseout="this.className='insel_option insel_font'"
+ onmouseover="this.className='insel_option insel_font insel_select'">Option 6</span>
+ <span class="insel_option insel_font" onmouseout="this.className='insel_option insel_font'"
+ onmouseover="this.className='insel_option insel_font insel_select'">Option 7</span>
+ <span class="insel_option insel_font" onmouseout="this.className='insel_option insel_font'"
+ onmouseover="this.className='insel_option insel_font insel_select'">Option 8</span>
+ <span class="insel_option insel_font" onmouseout="this.className='insel_option insel_font'"
+ onmouseover="this.className='insel_option insel_font insel_select'">Option 9</span>
+ <span class="insel_option insel_font" onmouseout="this.className='insel_option insel_font'"
+ onmouseover="this.className='insel_option insel_font insel_select'">Option 0</span>
+ </span>
+ </span>
+ </span>
+ </span>
+ </span>
+ </span>
+ <script type="text/javascript">
+ <cdk:call expression="buildScript(responseWriter, facesContext, component);" />
+ </script>
+ </span>
+ </cc:implementation>
+</cdk:root>
\ No newline at end of file
14 years, 4 months
JBoss Rich Faces SVN: r19116 - in branches/RF-8992/ui/input/ui/src/main: java/org/richfaces/renderkit and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-09-03 11:32:53 -0400 (Fri, 03 Sep 2010)
New Revision: 19116
Added:
branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java
branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss
branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
Modified:
branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java
branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
Log:
initial base component/renderer/template, script/style
Modified: branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java 2010-09-03 15:26:46 UTC (rev 19115)
+++ branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java 2010-09-03 15:32:53 UTC (rev 19116)
@@ -40,7 +40,7 @@
renderer = @JsfRenderer(type = "org.richfaces.InplaceInputRenderer"),
tag = @Tag(name="inplaceInput")
)
-public abstract class AbstractInplaceInput extends UIInput {
+public abstract class AbstractInplaceInput extends UIInput implements InplaceComponent {
public static final String COMPONENT_TYPE = "org.richfaces.InplaceInput";
Added: branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java (rev 0)
+++ branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java 2010-09-03 15:32:53 UTC (rev 19116)
@@ -0,0 +1,35 @@
+package org.richfaces.component;
+
+import javax.faces.component.UISelectOne;
+
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+
+
+/**
+ * @author Anton Belevich
+ *
+ */
+
+@JsfComponent(
+ type = AbstractInplaceSelect.COMPONENT_TYPE,
+ family = AbstractInplaceSelect.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UIInplaceSelect",
+ renderer = @JsfRenderer(type = "org.richfaces.InplaceSelectRenderer"),
+ tag = @Tag(name="inplaceSelect")
+)
+public abstract class AbstractInplaceSelect extends UISelectOne implements InplaceComponent {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.InplaceSelect";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.InplaceSelect";
+
+ @Attribute(defaultValue="InplaceState.ready")
+ public abstract InplaceState getState();
+
+ @Attribute
+ public abstract String getDefaultLabel();
+
+}
Modified: branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2010-09-03 15:26:46 UTC (rev 19115)
+++ branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2010-09-03 15:32:53 UTC (rev 19116)
@@ -37,6 +37,7 @@
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.richfaces.component.AbstractInplaceInput;
+import org.richfaces.component.InplaceComponent;
import org.richfaces.component.InplaceState;
import org.richfaces.component.util.HtmlUtil;
@@ -121,14 +122,13 @@
}
public InplaceState getInplaceState(UIComponent component) {
- return ((AbstractInplaceInput) component).getState();
+ return ((InplaceComponent) component).getState();
}
public String getValue(FacesContext facesContext, UIComponent component) throws IOException {
- AbstractInplaceInput inplaceInput = (AbstractInplaceInput)component;
- String value = getInputValue(facesContext, inplaceInput);
+ String value = getInputValue(facesContext, component);
if(value == null || "".equals(value)) {
- value = inplaceInput.getDefaultLabel();
+ value = ((InplaceComponent)component).getDefaultLabel();
}
return value;
}
Added: branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java (rev 0)
+++ branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2010-09-03 15:32:53 UTC (rev 19116)
@@ -0,0 +1,32 @@
+package org.richfaces.renderkit;
+
+import java.io.IOException;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+
+/**
+ * @author Anton Belevich
+ *
+ */
+
+@ResourceDependencies({ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"), @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(name = "richfaces-event.js"),
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(library="org.richfaces", name = "inplaceSelect.js"),
+ @ResourceDependency(library="org.richfaces", name = "inplaceSelect.ecss") })
+public class InplaceSelectBaseRenderer extends InplaceInputBaseRenderer {
+
+ @Override
+ public void buildScript(ResponseWriter writer, FacesContext facesContext, UIComponent component) throws IOException {
+ }
+
+ public String getListStyles(FacesContext facesContext, UIComponent component) {
+ return "";
+ }
+}
Added: branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss (rev 0)
+++ branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss 2010-09-03 15:32:53 UTC (rev 19116)
@@ -0,0 +1,45 @@
+.insel_default_state{ display : inline-block; position : relative; white-space : nowrap; background-color : #f1f1f1/*editorBackgroundColor*/; border-bottom : 1px dashed #000000/*generalTextColor*/; padding-left : 3px; padding-right : 3px;}
+.insel_changed_state{ background-image:url(images/mark_changed.gif); background-position : top left; background-repeat : no-repeat;}
+
+.insel_edit_state{ position : absolute; top : 0px; left : 0px; width : 100px; display : inline-block;}
+.insel_field{ background : #FBFF8E/*editBackgroundColor*/; padding : 0px 0px 0px 0px; border : 0px; margin : 0px; width : 112px; background-image:url(images/mark_list.gif); background-position : center right; background-repeat : no-repeat;}
+
+.insel_btn{
+ background : url(images/bg_btn.png) top repeat-x #C7D7EC; /*gradient - from generalBackgroundColor to tabBackgroundColor, background-color - tabBackgroundColor*/
+ border : 1px outset #BED6F8; /*panelBorderColor*/
+ padding : 0px;
+ margin : 0px;}
+.insel_btn_press{
+ background : url(images/bg_press.png) top repeat-x #C7D7EC; /*gradient - from tabBackgroundColor to generalBackgroundColor, background-color - tabBackgroundColor*/
+ border : 1px inset #BED6F8; /*panelBorderColor*/
+ padding : 0px;
+ margin : 0px;}
+.insel_btn_set{ position : absolute; top:0px; left : 112px; white-space : nowrap}
+
+.insel_list_cord{ position : relative; font-size : 0px;d@isplay : none}/*DDL is hidden!!!!!*/
+.insel_list_position{ position : absolute; top: 0px; left: -1px; }
+.insel_list_decoration{ border : 1px solid #A6A6A6 /*panelBorderColor*/; padding : 0px; background : #FBFF8E; /*editorBackgroundColor*/}
+.insel_list_scroll{ overflow : auto; overflow-x : hidden; height : 100px;}
+.insel_option{ padding : 2px; white-space : nowrap; background : #FBFF8E /*editorBackgroundColor*/; cursor : default;}
+.insel_select{ padding : 1px; width : 100%; background-color: #DFE8F6; border : 1px dotted #a3bae9;/*generalTextColor*/}
+.insel_width_list{ width : 250px;}
+
+
+.insel_list_cord{ position : relative; font-size : 0px;d@isplay : none}/*DDL is hidden!!!!!*/
+.insel_list_decoration{ border : 1px solid #A6A6A6 /*panelBorderColor*/; padding : 0px; background : #FFFFFF; /*tableBackgroundColor*/}
+.insel_list_scroll{ overflow : auto; overflow-x : hidden;}
+.insel_option{ padding : 2px; white-space : nowrap; cursor : default;}
+.insel_select{ padding : 1px; width : 100%; background-color: #DFE8F6; border : 1px dotted #a3bae9;/*generalTextColor*/}
+
+
+
+.insel_btn_preposition { position : absolute; top : 0px; right : 0px; wigth : 1px; height : 1px;}
+.insel_btn_position { position : absolute; top : 0px; left : 0px; white-space : nowrap;}
+
+.insel_btn_shadow {position: relative; padding : 6px 6px 6px 6px; top : -6px; right : -6px;}
+.insel_shadow {position: relative; padding : 6px 6px 6px 6px; top : -6px; left : -6px;}
+
+.insel_shadow_t {background: url(images/bg_shadow.png) top left; position: absolute; width: 6px; top: 0px; bottom: 6px; left : 0px}
+.insel_shadow_l {background: url(images/bg_shadow.png) bottom left; position: absolute; height: 6px; bottom: 0px; left: 0px; right: 6px;}
+.insel_shadow_r {background: url(images/bg_shadow.png) bottom right; position: absolute; width: 6px; top: 6px; bottom: 0px; right: 0px;}
+.insel_shadow_b {background: url(images/bg_shadow.png) right top; position: absolute; height: 6px; top: 0px; left: 6px; right: 0px;}
\ No newline at end of file
Added: branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
===================================================================
14 years, 4 months
JBoss Rich Faces SVN: r19115 - in branches/RF-8992/examples/input-demo/src/main: webapp and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-09-03 11:26:46 -0400 (Fri, 03 Sep 2010)
New Revision: 19115
Added:
branches/RF-8992/examples/input-demo/src/main/java/org/richfaces/demo/InputBean.java
branches/RF-8992/examples/input-demo/src/main/webapp/inplaceSelect.xhtml
Modified:
branches/RF-8992/examples/input-demo/src/main/webapp/index.xhtml
Log:
add inplaceSeelct dev. sample
Added: branches/RF-8992/examples/input-demo/src/main/java/org/richfaces/demo/InputBean.java
===================================================================
--- branches/RF-8992/examples/input-demo/src/main/java/org/richfaces/demo/InputBean.java (rev 0)
+++ branches/RF-8992/examples/input-demo/src/main/java/org/richfaces/demo/InputBean.java 2010-09-03 15:26:46 UTC (rev 19115)
@@ -0,0 +1,20 @@
+package org.richfaces.demo;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+
+
+@SessionScoped
+@ManagedBean(name = "inputBean")
+public class InputBean {
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+}
Modified: branches/RF-8992/examples/input-demo/src/main/webapp/index.xhtml
===================================================================
--- branches/RF-8992/examples/input-demo/src/main/webapp/index.xhtml 2010-09-03 15:01:51 UTC (rev 19114)
+++ branches/RF-8992/examples/input-demo/src/main/webapp/index.xhtml 2010-09-03 15:26:46 UTC (rev 19115)
@@ -9,6 +9,7 @@
<h4>Input Components Sample</h4>
<ul>
<li><h:link outcome="inplaceInput">rich:inplaceInput</h:link></li>
+ <li><h:link outcome="inplaceSelect">rich:inplaceSelect</h:link></li>
<li><h:link outcome="inputNumberSlider">rich:inputNumberSlider</h:link></li>
<li><h:link outcome="autocomplete">rich:autocomplete</h:link></li>
</ul>
Added: branches/RF-8992/examples/input-demo/src/main/webapp/inplaceSelect.xhtml
===================================================================
--- branches/RF-8992/examples/input-demo/src/main/webapp/inplaceSelect.xhtml (rev 0)
+++ branches/RF-8992/examples/input-demo/src/main/webapp/inplaceSelect.xhtml 2010-09-03 15:26:46 UTC (rev 19115)
@@ -0,0 +1,30 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:in="http://richfaces.org/input">
+<f:view contentType="text/html" />
+
+<h:head>
+ <title>InplaceInput</title>
+</h:head>
+
+
+<h:body>
+ <h:form id="form">
+ <div id="scroll" style="width: 400px; height:100px; overflow:auto;" >
+ <fieldset>
+ <legend>Test App</legend>
+ Fresh off his victory in the Florida primary, Sen. John McCain is poised to take another big prize. Former
+ <in:inplaceSelect defaultLabel="Edit Text" value="#{inputBean.value}">
+ </in:inplaceSelect>
+ Mayor Rudy Giuliani plans to drop out and endorse McCain, two GOP sources said. That would give McCain added momentum heading into a debate Wednesday and next week's Super Tuesday contests
+ </fieldset>
+ </div>
+ <h:panelGroup id="out">
+ <h:outputText value="Entered Value: #{inputBean.value}"/>
+ </h:panelGroup>
+ </h:form>
+</h:body>
+</html>
14 years, 4 months
JBoss Rich Faces SVN: r19114 - branches.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-09-03 11:01:51 -0400 (Fri, 03 Sep 2010)
New Revision: 19114
Added:
branches/RF-8992/
Log:
RF-8992 implement inplaceSelect
Copied: branches/RF-8992 (from rev 19113, trunk)
14 years, 4 months