You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2010/11/10 09:02:56 UTC
svn commit: r1033387 [2/5] - in /myfaces/trinidad/trunk:
trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/
trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/
trinidad-api/src/main/java/org/apache/myfaces/trinidad/event/ tri...
Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/facelets/MethodRule.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/facelets/MethodRule.java?rev=1033387&r1=1033386&r2=1033387&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/facelets/MethodRule.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/facelets/MethodRule.java Wed Nov 10 08:02:53 2010
@@ -1,203 +1,203 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.myfaces.trinidad.facelets;
-
-import java.io.Serializable;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import javax.el.ELException;
-import javax.el.MethodExpression;
-
-import javax.faces.context.FacesContext;
-import javax.faces.el.EvaluationException;
-import javax.faces.el.MethodBinding;
-
-import javax.faces.el.MethodNotFoundException;
-import javax.faces.view.facelets.FaceletContext;
-import javax.faces.view.facelets.MetaRule;
-import javax.faces.view.facelets.Metadata;
-import javax.faces.view.facelets.MetadataTarget;
-import javax.faces.view.facelets.TagAttribute;
-import javax.faces.view.facelets.TagAttributeException;
-
-/**
- * Optional Rule for binding Method[Binding|Expression] properties
- *
- * @author Mike Kienenberger
- * @author Jacob Hookom
- *
- * Implementation copied from Facelets 1.1.14, as it got hidden by JSF 2.0
- */
-public class MethodRule extends MetaRule {
-
- private final String methodName;
-
- private final Class returnTypeClass;
-
- private final Class[] params;
-
- public MethodRule(String methodName, Class returnTypeClass,
- Class[] params) {
- this.methodName = methodName;
- this.returnTypeClass = returnTypeClass;
- this.params = params;
- }
-
- public Metadata applyRule(String name, TagAttribute attribute,
- MetadataTarget meta) {
- if (false == name.equals(this.methodName))
- return null;
-
- if (MethodBinding.class.equals(meta.getPropertyType(name))) {
- Method method = meta.getWriteMethod(name);
- if (method != null) {
- return new MethodBindingMetadata(method, attribute,
- this.returnTypeClass,
- this.params);
- }
- } else if (MethodExpression.class.equals(meta.getPropertyType(name))) {
- Method method = meta.getWriteMethod(name);
- if (method != null) {
- return new MethodExpressionMetadata(method, attribute,
- this.returnTypeClass,
- this.params);
- }
- }
-
- return null;
- }
-
- private static class MethodBindingMetadata extends Metadata {
- private final Method _method;
-
- private final TagAttribute _attribute;
-
- private Class[] _paramList;
-
- private Class _returnType;
-
- public MethodBindingMetadata(Method method, TagAttribute attribute,
- Class returnType, Class[] paramList) {
- _method = method;
- _attribute = attribute;
- _paramList = paramList;
- _returnType = returnType;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- MethodExpression expr =
- _attribute.getMethodExpression(ctx, _returnType, _paramList);
-
- try {
- _method.invoke(instance,
- new Object[] { new LegacyMethodBinding(expr) });
- } catch (InvocationTargetException e) {
- throw new TagAttributeException(_attribute, e.getCause());
- } catch (Exception e) {
- throw new TagAttributeException(_attribute, e);
- }
- }
- }
-
- private static class MethodExpressionMetadata extends Metadata {
- private final Method _method;
-
- private final TagAttribute _attribute;
-
- private Class[] _paramList;
-
- private Class _returnType;
-
- public MethodExpressionMetadata(Method method, TagAttribute attribute,
- Class returnType, Class[] paramList) {
- _method = method;
- _attribute = attribute;
- _paramList = paramList;
- _returnType = returnType;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- MethodExpression expr =
- _attribute.getMethodExpression(ctx, _returnType, _paramList);
-
- try {
- _method.invoke(instance, new Object[] { expr });
- } catch (InvocationTargetException e) {
- throw new TagAttributeException(_attribute, e.getCause());
- } catch (Exception e) {
- throw new TagAttributeException(_attribute, e);
- }
- }
- }
-
-
- private static class LegacyMethodBinding extends MethodBinding implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private final MethodExpression m;
-
- public LegacyMethodBinding(MethodExpression m) {
- this.m = m;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.el.MethodBinding#getType(javax.faces.context.FacesContext)
- */
-
- public Class getType(FacesContext context) throws MethodNotFoundException {
- try {
- return m.getMethodInfo(context.getELContext()).getReturnType();
- } catch (javax.el.MethodNotFoundException e) {
- throw new MethodNotFoundException(e.getMessage(),
- e.getCause());
- } catch (ELException e) {
- throw new EvaluationException(e.getMessage(), e.getCause());
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.el.MethodBinding#invoke(javax.faces.context.FacesContext,
- * java.lang.Object[])
- */
-
- public Object invoke(FacesContext context,
- Object[] params) throws EvaluationException,
- MethodNotFoundException {
- try {
- return m.invoke(context.getELContext(), params);
- } catch (javax.el.MethodNotFoundException e) {
- throw new MethodNotFoundException(e.getMessage(),
- e.getCause());
- } catch (ELException e) {
- throw new EvaluationException(e.getMessage(), e.getCause());
- }
- }
-
- public String getExpressionString() {
- return m.getExpressionString();
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.trinidad.facelets;
+
+import java.io.Serializable;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import javax.el.ELException;
+import javax.el.MethodExpression;
+
+import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.MethodBinding;
+
+import javax.faces.el.MethodNotFoundException;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagAttributeException;
+
+/**
+ * Optional Rule for binding Method[Binding|Expression] properties
+ *
+ * @author Mike Kienenberger
+ * @author Jacob Hookom
+ *
+ * Implementation copied from Facelets 1.1.14, as it got hidden by JSF 2.0
+ */
+public class MethodRule extends MetaRule {
+
+ private final String methodName;
+
+ private final Class returnTypeClass;
+
+ private final Class[] params;
+
+ public MethodRule(String methodName, Class returnTypeClass,
+ Class[] params) {
+ this.methodName = methodName;
+ this.returnTypeClass = returnTypeClass;
+ this.params = params;
+ }
+
+ public Metadata applyRule(String name, TagAttribute attribute,
+ MetadataTarget meta) {
+ if (false == name.equals(this.methodName))
+ return null;
+
+ if (MethodBinding.class.equals(meta.getPropertyType(name))) {
+ Method method = meta.getWriteMethod(name);
+ if (method != null) {
+ return new MethodBindingMetadata(method, attribute,
+ this.returnTypeClass,
+ this.params);
+ }
+ } else if (MethodExpression.class.equals(meta.getPropertyType(name))) {
+ Method method = meta.getWriteMethod(name);
+ if (method != null) {
+ return new MethodExpressionMetadata(method, attribute,
+ this.returnTypeClass,
+ this.params);
+ }
+ }
+
+ return null;
+ }
+
+ private static class MethodBindingMetadata extends Metadata {
+ private final Method _method;
+
+ private final TagAttribute _attribute;
+
+ private Class[] _paramList;
+
+ private Class _returnType;
+
+ public MethodBindingMetadata(Method method, TagAttribute attribute,
+ Class returnType, Class[] paramList) {
+ _method = method;
+ _attribute = attribute;
+ _paramList = paramList;
+ _returnType = returnType;
+ }
+
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ MethodExpression expr =
+ _attribute.getMethodExpression(ctx, _returnType, _paramList);
+
+ try {
+ _method.invoke(instance,
+ new Object[] { new LegacyMethodBinding(expr) });
+ } catch (InvocationTargetException e) {
+ throw new TagAttributeException(_attribute, e.getCause());
+ } catch (Exception e) {
+ throw new TagAttributeException(_attribute, e);
+ }
+ }
+ }
+
+ private static class MethodExpressionMetadata extends Metadata {
+ private final Method _method;
+
+ private final TagAttribute _attribute;
+
+ private Class[] _paramList;
+
+ private Class _returnType;
+
+ public MethodExpressionMetadata(Method method, TagAttribute attribute,
+ Class returnType, Class[] paramList) {
+ _method = method;
+ _attribute = attribute;
+ _paramList = paramList;
+ _returnType = returnType;
+ }
+
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ MethodExpression expr =
+ _attribute.getMethodExpression(ctx, _returnType, _paramList);
+
+ try {
+ _method.invoke(instance, new Object[] { expr });
+ } catch (InvocationTargetException e) {
+ throw new TagAttributeException(_attribute, e.getCause());
+ } catch (Exception e) {
+ throw new TagAttributeException(_attribute, e);
+ }
+ }
+ }
+
+
+ private static class LegacyMethodBinding extends MethodBinding implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private final MethodExpression m;
+
+ public LegacyMethodBinding(MethodExpression m) {
+ this.m = m;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.el.MethodBinding#getType(javax.faces.context.FacesContext)
+ */
+
+ public Class getType(FacesContext context) throws MethodNotFoundException {
+ try {
+ return m.getMethodInfo(context.getELContext()).getReturnType();
+ } catch (javax.el.MethodNotFoundException e) {
+ throw new MethodNotFoundException(e.getMessage(),
+ e.getCause());
+ } catch (ELException e) {
+ throw new EvaluationException(e.getMessage(), e.getCause());
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.el.MethodBinding#invoke(javax.faces.context.FacesContext,
+ * java.lang.Object[])
+ */
+
+ public Object invoke(FacesContext context,
+ Object[] params) throws EvaluationException,
+ MethodNotFoundException {
+ try {
+ return m.invoke(context.getELContext(), params);
+ } catch (javax.el.MethodNotFoundException e) {
+ throw new MethodNotFoundException(e.getMessage(),
+ e.getCause());
+ } catch (ELException e) {
+ throw new EvaluationException(e.getMessage(), e.getCause());
+ }
+ }
+
+ public String getExpressionString() {
+ return m.getExpressionString();
+ }
+ }
+}
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/facelets/MethodRule.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/menu/GroupNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/menu/ImmutableGroupNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/menu/ImmutableItemNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/menu/ItemNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/menu/MenuNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/menu/MenuUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/CollectionModelDecorator.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/CollectionModelDecorator.java?rev=1033387&r1=1033386&r2=1033387&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/CollectionModelDecorator.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/CollectionModelDecorator.java Wed Nov 10 08:02:53 2010
@@ -1,252 +1,252 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.myfaces.trinidad.model;
-
-import java.util.List;
-
-/**
- * <p>
- * Used by anybody who wants to wrap the <code>CollectionModel</code> class.
- * </p>
- * <p>
- * This class simply delegates all the CollectionModel functionalities to the wrapped class.
- * </p>
- * The wrapped CollectionModel is returned by the <code>getCollectionModel</code> method. And that
- * method needs to be overriden by the subclasses.
- * @see #getCollectionModel
- */
-public abstract class CollectionModelDecorator
- extends CollectionModel
-{
- public Object getRowKey()
- {
- return getCollectionModel().getRowKey();
- }
-
- public void setRowKey(Object key)
- {
- getCollectionModel().setRowKey(key);
- }
-
- public boolean isRowAvailable(int rowIndex)
- {
- return getCollectionModel().isRowAvailable(rowIndex);
- }
-
- public boolean isRowAvailable(Object rowKey)
- {
- return getCollectionModel().isRowAvailable(rowKey);
- }
-
- public Object getRowData(int rowIndex)
- {
- return getCollectionModel().getRowData(rowIndex);
- }
-
- public Object getRowData(Object rowKey)
- {
- return getCollectionModel().getRowData(rowKey);
- }
-
- public boolean isSortable(String property)
- {
- return getCollectionModel().isSortable(property);
- }
-
- public List<SortCriterion> getSortCriteria()
- {
- return getCollectionModel().getSortCriteria();
- }
-
- public void setSortCriteria(List<SortCriterion> criteria)
- {
- getCollectionModel().setSortCriteria(criteria);
- }
-
- public boolean areRowsAvailable(int startIndex, int rowCount)
- {
- return getCollectionModel().areRowsAvailable(startIndex, rowCount);
- }
-
- public boolean areRowsAvailable(Object startRowKey, int rowCount)
- {
- return getCollectionModel().areRowsAvailable(startRowKey, rowCount);
- }
-
- public boolean areRowsAvailable(int rowCount)
- {
- return getCollectionModel().areRowsAvailable(rowCount);
- }
-
- //
- // below are the LocalRowKeyIndex APIs
- //
-
- public boolean areRowsLocallyAvailable(int startIndex, int rowCount)
- {
- return getCollectionModel().areRowsLocallyAvailable(startIndex, rowCount);
- }
-
- public boolean areRowsLocallyAvailable(Object startRowKey, int rowCount)
- {
- return getCollectionModel().areRowsLocallyAvailable(startRowKey, rowCount);
- }
-
- public boolean areRowsLocallyAvailable(int rowCount)
- {
- return getCollectionModel().areRowsLocallyAvailable(rowCount);
- }
-
- public boolean isRowLocallyAvailable(int rowIndex)
- {
- return getCollectionModel().isRowLocallyAvailable(rowIndex);
- }
-
- public boolean isRowLocallyAvailable(Object rowKey)
- {
- return getCollectionModel().isRowLocallyAvailable(rowKey);
- }
-
- public int getEstimatedRowCount()
- {
- return getCollectionModel().getEstimatedRowCount();
- }
-
- public LocalRowKeyIndex.Confidence getEstimatedRowCountConfidence()
- {
- return getCollectionModel().getEstimatedRowCountConfidence();
- }
-
- /**
- * clear all rows from the local cache
- */
- public void clearLocalCache()
- {
- getCollectionModel().clearLocalCache();
- }
-
- /**
- * Clear the requested range of rows from the local cache
- * @param startingIndex starting row index for the range to clear
- * @param rowsToClear number of rows to clear from the cache
- */
- public void clearCachedRows(int startingIndex, int rowsToClear)
- {
- getCollectionModel().clearCachedRows(startingIndex, rowsToClear);
- }
-
- /**
- * Clear the requested range of rows from the local cache
- * @param startingRowKey starting row key for the range to clear
- * @param rowsToClear number of rows to clear from the cache
- */
- public void clearCachedRows(Object startingRowKey, int rowsToClear)
- {
- getCollectionModel().clearCachedRows(startingRowKey, rowsToClear);
- }
-
- /**
- * Clear a row from the local cache by row index
- * @param index row index for the row to clear from the cache
- */
- public void clearCachedRow(int index)
- {
- getCollectionModel().clearCachedRow(index);
- }
-
- /**
- * Clear a row from the local cache by row key
- * @param rowKey row key for the row to clear from the cache
- */
- public void clearCachedRow(Object rowKey)
- {
- getCollectionModel().clearCachedRow(rowKey);
- }
-
- /**
- * Indicates the caching strategy supported by the model
- * @see LocalCachingStrategy
- * @return caching strategy supported by the model
- */
- public LocalRowKeyIndex.LocalCachingStrategy getCachingStrategy()
- {
- return getCollectionModel().getCachingStrategy();
- }
-
- //
- // below are the DataModel public APIs
- //
- public boolean isRowAvailable()
- {
- return getCollectionModel().isRowAvailable();
- }
-
- public int getRowCount()
- {
- return getCollectionModel().getRowCount();
- }
-
- public Object getRowData()
- {
- return getCollectionModel().getRowData();
- }
-
- public int getRowIndex()
- {
- return getCollectionModel().getRowIndex();
- }
-
- public void setRowIndex(int i)
- {
- getCollectionModel().setRowIndex(i);
- }
-
- public Object getWrappedData()
- {
- return getCollectionModel().getWrappedData();
- }
-
- public void setWrappedData(Object object)
- {
- getCollectionModel().setWrappedData(object);
- }
-
- public void addDataModelListener(javax.faces.model.DataModelListener listener)
- {
- getCollectionModel().addDataModelListener(listener);
- }
-
- public javax.faces.model.DataModelListener[] getDataModelListeners()
- {
- return getCollectionModel().getDataModelListeners();
- }
-
- public void removeDataModelListener(javax.faces.model.DataModelListener listener)
- {
- getCollectionModel().removeDataModelListener(listener);
- }
-
- /**
- * This method returns the wrapped <code>CollectionModel</code>.
- *
- * @return the wrapped CollectionModel
- */
- protected abstract CollectionModel getCollectionModel();
-}
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.trinidad.model;
+
+import java.util.List;
+
+/**
+ * <p>
+ * Used by anybody who wants to wrap the <code>CollectionModel</code> class.
+ * </p>
+ * <p>
+ * This class simply delegates all the CollectionModel functionalities to the wrapped class.
+ * </p>
+ * The wrapped CollectionModel is returned by the <code>getCollectionModel</code> method. And that
+ * method needs to be overriden by the subclasses.
+ * @see #getCollectionModel
+ */
+public abstract class CollectionModelDecorator
+ extends CollectionModel
+{
+ public Object getRowKey()
+ {
+ return getCollectionModel().getRowKey();
+ }
+
+ public void setRowKey(Object key)
+ {
+ getCollectionModel().setRowKey(key);
+ }
+
+ public boolean isRowAvailable(int rowIndex)
+ {
+ return getCollectionModel().isRowAvailable(rowIndex);
+ }
+
+ public boolean isRowAvailable(Object rowKey)
+ {
+ return getCollectionModel().isRowAvailable(rowKey);
+ }
+
+ public Object getRowData(int rowIndex)
+ {
+ return getCollectionModel().getRowData(rowIndex);
+ }
+
+ public Object getRowData(Object rowKey)
+ {
+ return getCollectionModel().getRowData(rowKey);
+ }
+
+ public boolean isSortable(String property)
+ {
+ return getCollectionModel().isSortable(property);
+ }
+
+ public List<SortCriterion> getSortCriteria()
+ {
+ return getCollectionModel().getSortCriteria();
+ }
+
+ public void setSortCriteria(List<SortCriterion> criteria)
+ {
+ getCollectionModel().setSortCriteria(criteria);
+ }
+
+ public boolean areRowsAvailable(int startIndex, int rowCount)
+ {
+ return getCollectionModel().areRowsAvailable(startIndex, rowCount);
+ }
+
+ public boolean areRowsAvailable(Object startRowKey, int rowCount)
+ {
+ return getCollectionModel().areRowsAvailable(startRowKey, rowCount);
+ }
+
+ public boolean areRowsAvailable(int rowCount)
+ {
+ return getCollectionModel().areRowsAvailable(rowCount);
+ }
+
+ //
+ // below are the LocalRowKeyIndex APIs
+ //
+
+ public boolean areRowsLocallyAvailable(int startIndex, int rowCount)
+ {
+ return getCollectionModel().areRowsLocallyAvailable(startIndex, rowCount);
+ }
+
+ public boolean areRowsLocallyAvailable(Object startRowKey, int rowCount)
+ {
+ return getCollectionModel().areRowsLocallyAvailable(startRowKey, rowCount);
+ }
+
+ public boolean areRowsLocallyAvailable(int rowCount)
+ {
+ return getCollectionModel().areRowsLocallyAvailable(rowCount);
+ }
+
+ public boolean isRowLocallyAvailable(int rowIndex)
+ {
+ return getCollectionModel().isRowLocallyAvailable(rowIndex);
+ }
+
+ public boolean isRowLocallyAvailable(Object rowKey)
+ {
+ return getCollectionModel().isRowLocallyAvailable(rowKey);
+ }
+
+ public int getEstimatedRowCount()
+ {
+ return getCollectionModel().getEstimatedRowCount();
+ }
+
+ public LocalRowKeyIndex.Confidence getEstimatedRowCountConfidence()
+ {
+ return getCollectionModel().getEstimatedRowCountConfidence();
+ }
+
+ /**
+ * clear all rows from the local cache
+ */
+ public void clearLocalCache()
+ {
+ getCollectionModel().clearLocalCache();
+ }
+
+ /**
+ * Clear the requested range of rows from the local cache
+ * @param startingIndex starting row index for the range to clear
+ * @param rowsToClear number of rows to clear from the cache
+ */
+ public void clearCachedRows(int startingIndex, int rowsToClear)
+ {
+ getCollectionModel().clearCachedRows(startingIndex, rowsToClear);
+ }
+
+ /**
+ * Clear the requested range of rows from the local cache
+ * @param startingRowKey starting row key for the range to clear
+ * @param rowsToClear number of rows to clear from the cache
+ */
+ public void clearCachedRows(Object startingRowKey, int rowsToClear)
+ {
+ getCollectionModel().clearCachedRows(startingRowKey, rowsToClear);
+ }
+
+ /**
+ * Clear a row from the local cache by row index
+ * @param index row index for the row to clear from the cache
+ */
+ public void clearCachedRow(int index)
+ {
+ getCollectionModel().clearCachedRow(index);
+ }
+
+ /**
+ * Clear a row from the local cache by row key
+ * @param rowKey row key for the row to clear from the cache
+ */
+ public void clearCachedRow(Object rowKey)
+ {
+ getCollectionModel().clearCachedRow(rowKey);
+ }
+
+ /**
+ * Indicates the caching strategy supported by the model
+ * @see LocalCachingStrategy
+ * @return caching strategy supported by the model
+ */
+ public LocalRowKeyIndex.LocalCachingStrategy getCachingStrategy()
+ {
+ return getCollectionModel().getCachingStrategy();
+ }
+
+ //
+ // below are the DataModel public APIs
+ //
+ public boolean isRowAvailable()
+ {
+ return getCollectionModel().isRowAvailable();
+ }
+
+ public int getRowCount()
+ {
+ return getCollectionModel().getRowCount();
+ }
+
+ public Object getRowData()
+ {
+ return getCollectionModel().getRowData();
+ }
+
+ public int getRowIndex()
+ {
+ return getCollectionModel().getRowIndex();
+ }
+
+ public void setRowIndex(int i)
+ {
+ getCollectionModel().setRowIndex(i);
+ }
+
+ public Object getWrappedData()
+ {
+ return getCollectionModel().getWrappedData();
+ }
+
+ public void setWrappedData(Object object)
+ {
+ getCollectionModel().setWrappedData(object);
+ }
+
+ public void addDataModelListener(javax.faces.model.DataModelListener listener)
+ {
+ getCollectionModel().addDataModelListener(listener);
+ }
+
+ public javax.faces.model.DataModelListener[] getDataModelListeners()
+ {
+ return getCollectionModel().getDataModelListeners();
+ }
+
+ public void removeDataModelListener(javax.faces.model.DataModelListener listener)
+ {
+ getCollectionModel().removeDataModelListener(listener);
+ }
+
+ /**
+ * This method returns the wrapped <code>CollectionModel</code>.
+ *
+ * @return the wrapped CollectionModel
+ */
+ protected abstract CollectionModel getCollectionModel();
+}
+
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/CollectionModelDecorator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/RowKeyChangeEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/RowKeyChangeListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/XhtmlConstants.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/XhtmlConstants.java?rev=1033387&r1=1033386&r2=1033387&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/XhtmlConstants.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/XhtmlConstants.java Wed Nov 10 08:02:53 2010
@@ -1,103 +1,103 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.myfaces.trinidad.render;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * This class contains some useful constants for (X)HTML rendering.
- */
-public final class XhtmlConstants
-{
- private XhtmlConstants(){}
-
- /**
- * A portlet facet; when supported, this facet should
- * result in a version of page content optimized for use in portlets.
- */
- public static final String FACET_PORTLET = "portlet";
-
- public static final String SCRIPT_NAME = "script";
-
- // Horizontal alignment
- /**
- * Horizontal alignment constant for end alignment; right
- * alignment will be used in left-to-right languages, left
- * alignment in right-to-left languages.
- */
- public static final String H_ALIGN_END = "end";
-
- // Vertical alignment
- /**
- * Vertical alignment constant for centering.
- */
- public static final String V_ALIGN_MIDDLE = "middle";
-
- /**
- * Vertical alignment constant for top alignment.
- */
- public static final String V_ALIGN_TOP = "top";
-
- // ============= Html elements ================
- public static final String DIV_ELEMENT = "div";
- public static final List<String> HEADER_ELEMENTS =
- Arrays.asList(new String[]{"h1", "h2", "h3",
- "h4", "h5", "h6"});
- public static final String LINK_ELEMENT = "a";
- public static final String PARAGRAPH_ELEMENT = "p";
- public static final String SCRIPT_ELEMENT = "script";
- public static final String SPAN_ELEMENT = "span";
- public static final String TABLE_DATA_ELEMENT = "td";
- public static final String TABLE_BODY_ELEMENT = "tbody";
- public static final String TABLE_ELEMENT = "table";
- public static final String TABLE_HEADER_ELEMENT = "th";
- public static final String TABLE_ROW_ELEMENT = "tr";
- public static final String FIELDSET_ELEMENT = "fieldset";
- public static final String LEGEND_ELEMENT = "legend";
-
- /** Unicode character for non-breaking space */
- public static final char NBSP_CHAR = 0xA0;
-
- /** String containing Unicode character for non-breaking space */
- public static final String NBSP_STRING = String.valueOf(NBSP_CHAR);
-
- public static final String ALIGN_ATTRIBUTE = "align";
- public static final String COLS_ATTRIBUTE = "cols";
- public static final String COLSPAN_ATTRIBUTE = "colspan";
- public static final String HEIGHT_ATTRIBUTE = "height";
- public static final String HREF_ATTRIBUTE = "href";
- public static final String ID_ATTRIBUTE = "id";
- public static final String NOWRAP_ATTRIBUTE = "nowrap";
- public static final String ONCLICK_ATTRIBUTE = "onclick";
- public static final String ROWS_ATTRIBUTE = "rows";
- public static final String ROWSPAN_ATTRIBUTE = "rowspan";
- public static final String SIZE_ATTRIBUTE = "size";
- public static final String STYLE_ATTRIBUTE = "style";
- public static final String VALIGN_ATTRIBUTE = "valign";
- public static final String WIDTH_ATTRIBUTE = "width";
-
- public static final String DIR_ATTRIBUTE_VALUE = "dir";
- public static final String EMPTY_STRING_ATTRIBUTE_VALUE = "";
- public static final String LEFT_ATTRIBUTE_VALUE = "left";
- public static final String MIDDLE_ATTRIBUTE_VALUE = "middle";
- public static final String ONE_HUNDRED_PERCENT_ATTRIBUTE_VALUE = "100%";
- public static final String RIGHT_ATTRIBUTE_VALUE = "right";
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.trinidad.render;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This class contains some useful constants for (X)HTML rendering.
+ */
+public final class XhtmlConstants
+{
+ private XhtmlConstants(){}
+
+ /**
+ * A portlet facet; when supported, this facet should
+ * result in a version of page content optimized for use in portlets.
+ */
+ public static final String FACET_PORTLET = "portlet";
+
+ public static final String SCRIPT_NAME = "script";
+
+ // Horizontal alignment
+ /**
+ * Horizontal alignment constant for end alignment; right
+ * alignment will be used in left-to-right languages, left
+ * alignment in right-to-left languages.
+ */
+ public static final String H_ALIGN_END = "end";
+
+ // Vertical alignment
+ /**
+ * Vertical alignment constant for centering.
+ */
+ public static final String V_ALIGN_MIDDLE = "middle";
+
+ /**
+ * Vertical alignment constant for top alignment.
+ */
+ public static final String V_ALIGN_TOP = "top";
+
+ // ============= Html elements ================
+ public static final String DIV_ELEMENT = "div";
+ public static final List<String> HEADER_ELEMENTS =
+ Arrays.asList(new String[]{"h1", "h2", "h3",
+ "h4", "h5", "h6"});
+ public static final String LINK_ELEMENT = "a";
+ public static final String PARAGRAPH_ELEMENT = "p";
+ public static final String SCRIPT_ELEMENT = "script";
+ public static final String SPAN_ELEMENT = "span";
+ public static final String TABLE_DATA_ELEMENT = "td";
+ public static final String TABLE_BODY_ELEMENT = "tbody";
+ public static final String TABLE_ELEMENT = "table";
+ public static final String TABLE_HEADER_ELEMENT = "th";
+ public static final String TABLE_ROW_ELEMENT = "tr";
+ public static final String FIELDSET_ELEMENT = "fieldset";
+ public static final String LEGEND_ELEMENT = "legend";
+
+ /** Unicode character for non-breaking space */
+ public static final char NBSP_CHAR = 0xA0;
+
+ /** String containing Unicode character for non-breaking space */
+ public static final String NBSP_STRING = String.valueOf(NBSP_CHAR);
+
+ public static final String ALIGN_ATTRIBUTE = "align";
+ public static final String COLS_ATTRIBUTE = "cols";
+ public static final String COLSPAN_ATTRIBUTE = "colspan";
+ public static final String HEIGHT_ATTRIBUTE = "height";
+ public static final String HREF_ATTRIBUTE = "href";
+ public static final String ID_ATTRIBUTE = "id";
+ public static final String NOWRAP_ATTRIBUTE = "nowrap";
+ public static final String ONCLICK_ATTRIBUTE = "onclick";
+ public static final String ROWS_ATTRIBUTE = "rows";
+ public static final String ROWSPAN_ATTRIBUTE = "rowspan";
+ public static final String SIZE_ATTRIBUTE = "size";
+ public static final String STYLE_ATTRIBUTE = "style";
+ public static final String VALIGN_ATTRIBUTE = "valign";
+ public static final String WIDTH_ATTRIBUTE = "width";
+
+ public static final String DIR_ATTRIBUTE_VALUE = "dir";
+ public static final String EMPTY_STRING_ATTRIBUTE_VALUE = "";
+ public static final String LEFT_ATTRIBUTE_VALUE = "left";
+ public static final String MIDDLE_ATTRIBUTE_VALUE = "middle";
+ public static final String ONE_HUNDRED_PERCENT_ATTRIBUTE_VALUE = "100%";
+ public static final String RIGHT_ATTRIBUTE_VALUE = "right";
+
}
\ No newline at end of file
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/XhtmlConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/resource/LoggerBundle_en.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/resource/MessageBundle_en.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/resource/SkinResourceLoader.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/resource/SkinResourceLoader.java?rev=1033387&r1=1033386&r2=1033387&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/resource/SkinResourceLoader.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/resource/SkinResourceLoader.java Wed Nov 10 08:02:53 2010
@@ -1,33 +1,33 @@
-package org.apache.myfaces.trinidad.resource;
-
-import java.net.URL;
-
-import java.util.Collections;
-import java.util.Iterator;
-
-import javax.faces.context.ExternalContext;
-
-/**
- * Non-Trinidad skin resource loader implementations should extend this class and override
- * findResources to specify where from where to load skin resources.
- * We will find all overridden classes by calling
- * <pre>
- * List<SkinResourceLoader> urlProviders = ClassLoaderUtils.getServices(
- * "org.apache.myfaces.trinidad.resource.SkinResourceLoader");
- * </pre>
- */
-public class SkinResourceLoader
-{
-
- /**
- * Returns an iterator of URL objects representing all the resources with the given name.
- * @param context The ExternalContext
- * @param filename The filename of the resource to find, e.g., "trinidad-skins.xml"
- * @return An iterator of URL objects for the resources.
- * Returns an empty iterator if no resources were found.
- */
- public Iterator<URL> findResources(ExternalContext context, String filename)
- {
- return Collections.<URL>emptyList().iterator();
- }
+package org.apache.myfaces.trinidad.resource;
+
+import java.net.URL;
+
+import java.util.Collections;
+import java.util.Iterator;
+
+import javax.faces.context.ExternalContext;
+
+/**
+ * Non-Trinidad skin resource loader implementations should extend this class and override
+ * findResources to specify where from where to load skin resources.
+ * We will find all overridden classes by calling
+ * <pre>
+ * List<SkinResourceLoader> urlProviders = ClassLoaderUtils.getServices(
+ * "org.apache.myfaces.trinidad.resource.SkinResourceLoader");
+ * </pre>
+ */
+public class SkinResourceLoader
+{
+
+ /**
+ * Returns an iterator of URL objects representing all the resources with the given name.
+ * @param context The ExternalContext
+ * @param filename The filename of the resource to find, e.g., "trinidad-skins.xml"
+ * @return An iterator of URL objects for the resources.
+ * Returns an empty iterator if no resources were found.
+ */
+ public Iterator<URL> findResources(ExternalContext context, String filename)
+ {
+ return Collections.<URL>emptyList().iterator();
+ }
}
\ No newline at end of file
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/resource/SkinResourceLoader.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/InputStreamProvider.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/InputStreamProvider.java?rev=1033387&r1=1033386&r2=1033387&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/InputStreamProvider.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/InputStreamProvider.java Wed Nov 10 08:02:53 2010
@@ -1,82 +1,82 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.myfaces.trinidad.share.io;
-
-import java.io.InputStream;
-import java.io.IOException;
-
-/**
- * InputStreamProviders encapsulate a single target file. An InputStreamProvider is used to
- * get an inputStream, cache results and see if the file has been modified.
- * (There's no real requirement that there be a physical file
- * at the target location).
- * <p>
- * @version $Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/share/io/InputStreamProvider.java#0 $) $Date: 10-nov-2005.19:00:08 $
- */
-public interface InputStreamProvider
-{
- /**
- * Return an InputStream for the target. This function
- * should never return null - if a stream cannot be opened,
- * throw an IOException.
- */
- public InputStream openInputStream() throws IOException;
-
- /**
- * Returns the name of the target location, suitable
- * for user display.
- */
- public String getDisplayName();
-
- /**
- * Returns an identifier object that uniquely
- * identifies the target location. If two providers
- * return equal identifiers, that is, given:
- * <pre>
- * Object identifierA = providerA.getIdentifier();
- * Object identifierB = providerB.getIdentifier();
- * </pre>
- * ... then:
- * <pre>
- * if (identifierA.equals(identifierB)) ...
- * </pre>
- * then the two providers must point to the same location.
- */
- public Object getIdentifier();
-
- /**
- * Returns true if the underlying target has changed
- * since the last call to openInputStream()
- */
- public boolean hasSourceChanged();
-
- /**
- * Returns the cached result from reading and parsing this
- * provider.
- * @see CachingNameResolver
- */
- public Object getCachedResult();
-
- /**
- * Stores the cached result of reading and parsing this
- * provider.
- * @see CachingNameResolver
- */
- public void setCachedResult(Object value);
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.trinidad.share.io;
+
+import java.io.InputStream;
+import java.io.IOException;
+
+/**
+ * InputStreamProviders encapsulate a single target file. An InputStreamProvider is used to
+ * get an inputStream, cache results and see if the file has been modified.
+ * (There's no real requirement that there be a physical file
+ * at the target location).
+ * <p>
+ * @version $Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/share/io/InputStreamProvider.java#0 $) $Date: 10-nov-2005.19:00:08 $
+ */
+public interface InputStreamProvider
+{
+ /**
+ * Return an InputStream for the target. This function
+ * should never return null - if a stream cannot be opened,
+ * throw an IOException.
+ */
+ public InputStream openInputStream() throws IOException;
+
+ /**
+ * Returns the name of the target location, suitable
+ * for user display.
+ */
+ public String getDisplayName();
+
+ /**
+ * Returns an identifier object that uniquely
+ * identifies the target location. If two providers
+ * return equal identifiers, that is, given:
+ * <pre>
+ * Object identifierA = providerA.getIdentifier();
+ * Object identifierB = providerB.getIdentifier();
+ * </pre>
+ * ... then:
+ * <pre>
+ * if (identifierA.equals(identifierB)) ...
+ * </pre>
+ * then the two providers must point to the same location.
+ */
+ public Object getIdentifier();
+
+ /**
+ * Returns true if the underlying target has changed
+ * since the last call to openInputStream()
+ */
+ public boolean hasSourceChanged();
+
+ /**
+ * Returns the cached result from reading and parsing this
+ * provider.
+ * @see CachingNameResolver
+ */
+ public Object getCachedResult();
+
+ /**
+ * Stores the cached result of reading and parsing this
+ * provider.
+ * @see CachingNameResolver
+ */
+ public void setCachedResult(Object value);
+}
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/InputStreamProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/NameResolver.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/NameResolver.java?rev=1033387&r1=1033386&r2=1033387&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/NameResolver.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/NameResolver.java Wed Nov 10 08:02:53 2010
@@ -1,58 +1,58 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.myfaces.trinidad.share.io;
-
-import java.io.IOException;
-
-
-
-/**
- * NameResolvers are responsible for converting string names
- * into InputStreamProviders, which encapsulate a remote file.
- * Implementations exist that support using URLs, Files, Class
- * resources, and the Servlet API to locate files, but other APIs
- * may be substituted.
- * <p>
- * In some cases, the resolved target file may have need to
- * locate support files of its own (like imported css files). Since those support files should
- * be looked for relative to the target file, NameResolver supports
- * creating new relative NameResolvers.
- * @version $Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/share/io/NameResolver.java#0 $) $Date: 10-nov-2005.19:00:09 $
- */
-public interface NameResolver
-{
- /**
- * Given a name, returns an InputStreamProvider. This
- * function should never return null - if the target
- * cannot be resolved, throw an IOException.
- * @param name the name of the target
- */
- public InputStreamProvider getProvider(String name) throws IOException;
-
- /**
- * Return the new NameResolver that should be used to resolve
- * names relative to a given name. For example, if a css file has an @import,
- * you need to look for the imported file relative to the file. This function should never
- * return null - if the target cannot be resolved, return a
- * resolver that can only support absolute names.
- * @param name the name of the target
- */
- public NameResolver getResolver(String name);
-}
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.trinidad.share.io;
+
+import java.io.IOException;
+
+
+
+/**
+ * NameResolvers are responsible for converting string names
+ * into InputStreamProviders, which encapsulate a remote file.
+ * Implementations exist that support using URLs, Files, Class
+ * resources, and the Servlet API to locate files, but other APIs
+ * may be substituted.
+ * <p>
+ * In some cases, the resolved target file may have need to
+ * locate support files of its own (like imported css files). Since those support files should
+ * be looked for relative to the target file, NameResolver supports
+ * creating new relative NameResolvers.
+ * @version $Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/share/io/NameResolver.java#0 $) $Date: 10-nov-2005.19:00:09 $
+ */
+public interface NameResolver
+{
+ /**
+ * Given a name, returns an InputStreamProvider. This
+ * function should never return null - if the target
+ * cannot be resolved, throw an IOException.
+ * @param name the name of the target
+ */
+ public InputStreamProvider getProvider(String name) throws IOException;
+
+ /**
+ * Return the new NameResolver that should be used to resolve
+ * names relative to a given name. For example, if a css file has an @import,
+ * you need to look for the imported file relative to the file. This function should never
+ * return null - if the target cannot be resolved, return a
+ * resolver that can only support absolute names.
+ * @param name the name of the target
+ */
+ public NameResolver getResolver(String name);
+}
+
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/NameResolver.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinVersion.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinVersion.java?rev=1033387&r1=1033386&r2=1033387&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinVersion.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinVersion.java Wed Nov 10 08:02:53 2010
@@ -1,44 +1,44 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.myfaces.trinidad.skin;
-
-
- /**
- * You can version skins. The skin version works tightly with the skin family.
- * This allows someone to create versions of their skin, like purple, purple-v2,
- * purple-v3. Then the user can say which skin version they want, like:
- * <skin-family>purple</skin-family><skin-version>v3</skin-version> when they
- * pick a skin in trinidad-config.xml.
- * When creating a skin, you give it a version if you care about versioning.
- * When extending this class, you must override equals and hashCode
- */
- abstract public class SkinVersion
- {
-
- // when extending this class, you must override equals and hashCode
- abstract public boolean equals(Object o);
-
- // when extending this class, you must override equals and hashCode
- abstract public int hashCode();
-
- abstract public boolean isDefault();
-
- abstract public String getName();
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.trinidad.skin;
+
+
+ /**
+ * You can version skins. The skin version works tightly with the skin family.
+ * This allows someone to create versions of their skin, like purple, purple-v2,
+ * purple-v3. Then the user can say which skin version they want, like:
+ * <skin-family>purple</skin-family><skin-version>v3</skin-version> when they
+ * pick a skin in trinidad-config.xml.
+ * When creating a skin, you give it a version if you care about versioning.
+ * When extending this class, you must override equals and hashCode
+ */
+ abstract public class SkinVersion
+ {
+
+ // when extending this class, you must override equals and hashCode
+ abstract public boolean equals(Object o);
+
+ // when extending this class, you must override equals and hashCode
+ abstract public int hashCode();
+
+ abstract public boolean isDefault();
+
+ abstract public String getName();
+
}
\ No newline at end of file
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinVersion.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/style/Selector.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/style/Selector.java?rev=1033387&r1=1033386&r2=1033387&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/style/Selector.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/style/Selector.java Wed Nov 10 08:02:53 2010
@@ -1,92 +1,92 @@
-package org.apache.myfaces.trinidad.style;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * A Selector object holds a CSS selector. To create a new Selector, call the
- * static method Selector.createSelector(String selectorString).
- * This class makes the Styles Object APIs clearer,
- * since we have Map<Selector, Style> now instead of Map<String, Style>.
- * Also with this object we'll have the API in place in case we need to
- * hang methods off of this object (like
- * possibily reordering the pseudo-classes in alphabetical order when creating
- * a Selector object so that af|foo:bar:zoo and af|foo:zoo:bar are equal).
- * It was originally thought that we'd add a getNativeSelectorString method
- * here, but we decided to not add it here to keep a better separation of Selectors
- * and the maps that convert the Selectors to the native selector string.
- * @see Styles#getNativeSelectorString(org.apache.myfaces.trinidad.style.Selector) ;
- */
-final public class Selector
-{
-
- /**
- * Given a String that represents the selector, return a Selector object
- * @param selectorString
- * @return a Selector object
- * @throws IllegalArgumentException if selectorString is null or the empty String.
- */
- public static Selector createSelector(String selectorString)
- {
- if (selectorString == null || selectorString.equals(""))
- throw new IllegalArgumentException("selectorString must be non null and non empty.");
-
- return new Selector(selectorString);
- }
-
- // toString
- @Override
- public String toString()
- {
- return _selectorString;
- }
-
- @Override
- public int hashCode()
- {
- // delegate to the String's hashCode();
- return _selectorString.hashCode();
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (this == obj)
- return true;
- if (obj == null || !(obj instanceof Selector))
- return false;
-
- // obj at this point must be a Selector
- Selector test = (Selector)obj;
-
- return (_selectorString.equals(test._selectorString));
- }
-
-
- // Do not call directly. Call from Selector.createSelector
- private Selector(String selectorString)
- {
- _selectorString = selectorString;
- }
-
-
- private final String _selectorString;
-
-
-}
+package org.apache.myfaces.trinidad.style;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * A Selector object holds a CSS selector. To create a new Selector, call the
+ * static method Selector.createSelector(String selectorString).
+ * This class makes the Styles Object APIs clearer,
+ * since we have Map<Selector, Style> now instead of Map<String, Style>.
+ * Also with this object we'll have the API in place in case we need to
+ * hang methods off of this object (like
+ * possibily reordering the pseudo-classes in alphabetical order when creating
+ * a Selector object so that af|foo:bar:zoo and af|foo:zoo:bar are equal).
+ * It was originally thought that we'd add a getNativeSelectorString method
+ * here, but we decided to not add it here to keep a better separation of Selectors
+ * and the maps that convert the Selectors to the native selector string.
+ * @see Styles#getNativeSelectorString(org.apache.myfaces.trinidad.style.Selector) ;
+ */
+final public class Selector
+{
+
+ /**
+ * Given a String that represents the selector, return a Selector object
+ * @param selectorString
+ * @return a Selector object
+ * @throws IllegalArgumentException if selectorString is null or the empty String.
+ */
+ public static Selector createSelector(String selectorString)
+ {
+ if (selectorString == null || selectorString.equals(""))
+ throw new IllegalArgumentException("selectorString must be non null and non empty.");
+
+ return new Selector(selectorString);
+ }
+
+ // toString
+ @Override
+ public String toString()
+ {
+ return _selectorString;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ // delegate to the String's hashCode();
+ return _selectorString.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null || !(obj instanceof Selector))
+ return false;
+
+ // obj at this point must be a Selector
+ Selector test = (Selector)obj;
+
+ return (_selectorString.equals(test._selectorString));
+ }
+
+
+ // Do not call directly. Call from Selector.createSelector
+ private Selector(String selectorString)
+ {
+ _selectorString = selectorString;
+ }
+
+
+ private final String _selectorString;
+
+
+}
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/style/Selector.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/style/Style.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/style/Style.java?rev=1033387&r1=1033386&r2=1033387&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/style/Style.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/style/Style.java Wed Nov 10 08:02:53 2010
@@ -1,49 +1,49 @@
-package org.apache.myfaces.trinidad.style;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.Map;
-
-/**
- * A Style object defines a set of visual (or aural) style properties.
- * The Style interface exposes one method for retrieving properties:
- * getProperties().
- * getProperties() returns a Map<String, String> of the propery name as the
- * key and the property value as the value.
- *
- */
-public abstract class Style
-{
-
- /**
- * Returns an unmodifiable Map of the properties (name/value)
- * defined by this style.
- */
- abstract public Map<String, String> getProperties();
-
-
- /**
- * Converts the style to a String suitable for use as an inline style
- * attribute value.
- */
- abstract public String toInlineString();
-
-}
-
+package org.apache.myfaces.trinidad.style;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Map;
+
+/**
+ * A Style object defines a set of visual (or aural) style properties.
+ * The Style interface exposes one method for retrieving properties:
+ * getProperties().
+ * getProperties() returns a Map<String, String> of the propery name as the
+ * key and the property value as the value.
+ *
+ */
+public abstract class Style
+{
+
+ /**
+ * Returns an unmodifiable Map of the properties (name/value)
+ * defined by this style.
+ */
+ abstract public Map<String, String> getProperties();
+
+
+ /**
+ * Converts the style to a String suitable for use as an inline style
+ * attribute value.
+ */
+ abstract public String toInlineString();
+
+}
+
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/style/Style.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/style/Styles.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/style/Styles.java?rev=1033387&r1=1033386&r2=1033387&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/style/Styles.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/style/Styles.java Wed Nov 10 08:02:53 2010
@@ -1,133 +1,133 @@
-package org.apache.myfaces.trinidad.style;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Styles is a class that contains information about CSS Selectors and their
- * corresponding Style object (i.e., the css properties) for the css selectors
- * that are written to the generated css file. The methods in this class
- * are useful if you need to know in the renderer code what css properties
- * a particular selector has.
- */
-public abstract class Styles
-{
-
- /**
- * Returns a Map containing the Selector Object as the key and the Style
- * Object as the value.
- * The Style object contains all the css property names/values.
- * This Map can then be used to get all the selector keys, or to get the
- * Style Object for a Selector, or to get all the selectors that
- * match some criteria, like they contain a certain simple selector.
- *
- * @return unmodifiableMap of the resolved Selector -> Style map.
- */
- public abstract Map<Selector, Style> getSelectorStyleMap();
-
- /**
- * Returns the Selector in String form, converted to a format that
- * is suitable to be written to the client (e.g., a css-2 format that can be
- * read by a browser)
- * @param selector Selector
- * @return String the Selector in a String form that is suitable to be
- * written to the client.
- */
- public abstract String getNativeSelectorString(Selector selector);
-
-
- /**
- * Given a simple selector (as opposed to a complex selector),
- * this method will return a Set of the Selectors that
- * contain the simple selector. It calls getSelectorStyleMap() and then
- * looks through each Selector to see if the simple selector is contained
- * within it. If so, it puts it in a Set.
- * The recommended usage is to call this for simple selectors, like
- * "af|inputText" or "af|treeTable" and not selectors like
- * "af|inputText::content".
- * @param simpleSelector
- * @return an unmodfiable Set<Selector> of all the complete selectors
- * that contain the simple selector.
- */
- public Set<Selector> getSelectorsForSimpleSelector(String simpleSelector)
- {
- Map<Selector, Style> selectorStyleMap = getSelectorStyleMap();
- Set<Selector> set = null;
-
- // loop through each entry and find all simple selectors
- for (Map.Entry<Selector, Style> entry : selectorStyleMap.entrySet())
- {
- Selector completeSelector = entry.getKey();
- String completeSelectorString = completeSelector.toString();
- int index = completeSelectorString.indexOf(simpleSelector);
- boolean beforeSelectorOk = false;
- boolean afterSelectorOk = false;
- if (index > -1)
- {
- // found the simpleSelector within the complex selector
- // double check that it is the simpleSelector by looking at the characters before
- // and after. e.g., af|foobar does not contain the simple selector af|foo, whereas
- // af|foo.bar or af|foo bar or af|foo:bar does.
- if (index == 0)
- {
- beforeSelectorOk = true;
- }
- else
- {
- char c = completeSelectorString.charAt(index-1);
- if (Character.isWhitespace(c) || c == '.')
- {
- beforeSelectorOk = true;
- }
- }
- if (beforeSelectorOk)
- {
- // now check after the string.
- int endIndex = index + simpleSelector.length();
- if (endIndex < completeSelectorString.length())
- {
- char c = completeSelectorString.charAt(endIndex);
- if (Character.isWhitespace(c) || c == '.' || c == ':')
- afterSelectorOk = true;
- }
- else
- afterSelectorOk = true;
- }
- if (beforeSelectorOk && afterSelectorOk)
- {
- if (set == null)
- set = new HashSet<Selector>();
- set.add(completeSelector);
- }
- }
-
- }
- if (set == null)
- return Collections.emptySet();
- else
- return Collections.unmodifiableSet(set);
-
- }
-
-}
+package org.apache.myfaces.trinidad.style;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Styles is a class that contains information about CSS Selectors and their
+ * corresponding Style object (i.e., the css properties) for the css selectors
+ * that are written to the generated css file. The methods in this class
+ * are useful if you need to know in the renderer code what css properties
+ * a particular selector has.
+ */
+public abstract class Styles
+{
+
+ /**
+ * Returns a Map containing the Selector Object as the key and the Style
+ * Object as the value.
+ * The Style object contains all the css property names/values.
+ * This Map can then be used to get all the selector keys, or to get the
+ * Style Object for a Selector, or to get all the selectors that
+ * match some criteria, like they contain a certain simple selector.
+ *
+ * @return unmodifiableMap of the resolved Selector -> Style map.
+ */
+ public abstract Map<Selector, Style> getSelectorStyleMap();
+
+ /**
+ * Returns the Selector in String form, converted to a format that
+ * is suitable to be written to the client (e.g., a css-2 format that can be
+ * read by a browser)
+ * @param selector Selector
+ * @return String the Selector in a String form that is suitable to be
+ * written to the client.
+ */
+ public abstract String getNativeSelectorString(Selector selector);
+
+
+ /**
+ * Given a simple selector (as opposed to a complex selector),
+ * this method will return a Set of the Selectors that
+ * contain the simple selector. It calls getSelectorStyleMap() and then
+ * looks through each Selector to see if the simple selector is contained
+ * within it. If so, it puts it in a Set.
+ * The recommended usage is to call this for simple selectors, like
+ * "af|inputText" or "af|treeTable" and not selectors like
+ * "af|inputText::content".
+ * @param simpleSelector
+ * @return an unmodfiable Set<Selector> of all the complete selectors
+ * that contain the simple selector.
+ */
+ public Set<Selector> getSelectorsForSimpleSelector(String simpleSelector)
+ {
+ Map<Selector, Style> selectorStyleMap = getSelectorStyleMap();
+ Set<Selector> set = null;
+
+ // loop through each entry and find all simple selectors
+ for (Map.Entry<Selector, Style> entry : selectorStyleMap.entrySet())
+ {
+ Selector completeSelector = entry.getKey();
+ String completeSelectorString = completeSelector.toString();
+ int index = completeSelectorString.indexOf(simpleSelector);
+ boolean beforeSelectorOk = false;
+ boolean afterSelectorOk = false;
+ if (index > -1)
+ {
+ // found the simpleSelector within the complex selector
+ // double check that it is the simpleSelector by looking at the characters before
+ // and after. e.g., af|foobar does not contain the simple selector af|foo, whereas
+ // af|foo.bar or af|foo bar or af|foo:bar does.
+ if (index == 0)
+ {
+ beforeSelectorOk = true;
+ }
+ else
+ {
+ char c = completeSelectorString.charAt(index-1);
+ if (Character.isWhitespace(c) || c == '.')
+ {
+ beforeSelectorOk = true;
+ }
+ }
+ if (beforeSelectorOk)
+ {
+ // now check after the string.
+ int endIndex = index + simpleSelector.length();
+ if (endIndex < completeSelectorString.length())
+ {
+ char c = completeSelectorString.charAt(endIndex);
+ if (Character.isWhitespace(c) || c == '.' || c == ':')
+ afterSelectorOk = true;
+ }
+ else
+ afterSelectorOk = true;
+ }
+ if (beforeSelectorOk && afterSelectorOk)
+ {
+ if (set == null)
+ set = new HashSet<Selector>();
+ set.add(completeSelector);
+ }
+ }
+
+ }
+ if (set == null)
+ return Collections.emptySet();
+ else
+ return Collections.unmodifiableSet(set);
+
+ }
+
+}
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/style/Styles.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentReference.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/RequestType.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/ChainedUploadedFileProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/TrinidadBodyTagSupport.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/TrinidadConverterELTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/TrinidadTagSupport.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/TrinidadValidatorELTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/trinidad/trunk/trinidad-api/src/test/java/org/apache/myfaces/trinidad/ClirrRunnerTest.java
------------------------------------------------------------------------------
svn:eol-style = native