You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by jw...@apache.org on 2010/10/12 01:59:34 UTC
svn commit: r1021551 - in /myfaces/trinidad/branches/1.2.12.3-branch:
trinidad-examples/trinidad-demo/src/main/webapp/skins/purple/
trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/
trinidad-impl/src/main/java/org/apache/myfaces/tri...
Author: jwaldman
Date: Mon Oct 11 23:59:34 2010
New Revision: 1021551
URL: http://svn.apache.org/viewvc?rev=1021551&view=rev
Log:
TRINIDAD-1936 merge skin (server-side) properties the same as skin css properties
removed skin properties from StyleSheetNode and added to StyleNode instead.
TRINIDAD-1937 beef up -tr-property-ref to work in compact css properties like border
border: 1px solid -tr-property-ref(".AFDefaultColor:alias","color"); works now.
new file IncludeCompactPropertyNode.java
removed SkinPropertyNode since it was the same as PropertyNode.
Added:
myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/IncludeCompactPropertyNode.java
Removed:
myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/SkinPropertyNode.java
Modified:
myfaces/trinidad/branches/1.2.12.3-branch/trinidad-examples/trinidad-demo/src/main/webapp/skins/purple/purpleSkin.css
myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java
myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java
myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/IncludePropertyNode.java
myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleNode.java
myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleNodeParser.java
myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetDocument.java
myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNode.java
myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNodeParser.java
myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNodeEqualsTest.java
Modified: myfaces/trinidad/branches/1.2.12.3-branch/trinidad-examples/trinidad-demo/src/main/webapp/skins/purple/purpleSkin.css
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.3-branch/trinidad-examples/trinidad-demo/src/main/webapp/skins/purple/purpleSkin.css?rev=1021551&r1=1021550&r2=1021551&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.3-branch/trinidad-examples/trinidad-demo/src/main/webapp/skins/purple/purpleSkin.css (original)
+++ myfaces/trinidad/branches/1.2.12.3-branch/trinidad-examples/trinidad-demo/src/main/webapp/skins/purple/purpleSkin.css Mon Oct 11 23:59:34 2010
@@ -493,13 +493,6 @@ af|inputDate::launch-icon:rtl
height:24px
}
-/* use special properties to change the ui **/
-/* don't show the last item in breadCrumbs (the default is to show it)*/
-@agent gecko
-{
-af|breadCrumbs {-tr-show-last-item:false}
-}
-
af|breadCrumbs::step {color: purple;}
af|breadCrumbs::step:hover {color: green}
af|breadCrumbs::selected-step:hover {color: green;}
@@ -911,6 +904,51 @@ af|navigationPane::tabs-inactive af|navi
.AFFooIcon:alias {content:url(/skins/purple/images/btns.gif); width:7px; height:18px}
.AFBarIcon {content:url(/skins/purple/images/btns.gif); width:7px; height:18px}
+@agent email
+{
+ af|selectBooleanCheckbox::label {color: red}
+}
+
+
+/* test -tr-rule-ref for skin properties */
+/* works
+.AFShowLastItem:alias {-tr-show-last-item: false;}
+af|breadCrumbs {-tr-rule-ref: selector(".AFShowLastItem:alias");}
+*/
+/* works
+.AFFoo:alias {-tr-show-last-item: false;}
+.AFBar:alias {color: red; background-color: blue}
+.AFCombined:alias {
+-tr-rule-ref: selector(".AFFoo:alias");
+-tr-rule-ref: selector(".AFBar:alias");
+}
+
+af|breadCrumbs {
+-tr-rule-ref: selector(".AFCombined:alias");
+}
+*/
+/* works
+.AFFoo:alias {color: red;}
+af|breadCrumbs {
+-tr-show-last-item: -tr-property-ref(".AFFoo:alias","color");
+}
+*/
+
+.AFFoo:alias {-tr-show-last-item: true;}
+af|breadCrumbs {
+-tr-show-last-item: -tr-property-ref(".AFFoo:alias");
+}
+
+/*
+.AFFoo:alias {-tr-show-last-item: true;color: red; background-color: pink;}
+
+af|breadCrumbs {
+-tr-rule-ref: selector(".AFFoo:alias");
+}
+
+*/
+/* af|tree -tr-show-lines */
+
@agent ie
{
af|tree {
@@ -924,7 +962,6 @@ af|tree {
}
}
-@agent email
-{
- af|selectBooleanCheckbox::label {color: red}
+af|testCompactInclude {
+ border: 1px solid -tr-property-ref(".AFTestForegroundColor:alias","color");
}
Modified: myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java?rev=1021551&r1=1021550&r2=1021551&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java (original)
+++ myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java Mon Oct 11 23:59:34 2010
@@ -39,8 +39,6 @@ import org.apache.myfaces.trinidad.share
import org.apache.myfaces.trinidad.skin.Icon;
import org.apache.myfaces.trinidad.util.URLUtils;
-import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SkinProperties;
-import org.apache.myfaces.trinidadinternal.share.expl.Coercions;
import org.apache.myfaces.trinidadinternal.share.xml.ParseContext;
import org.apache.myfaces.trinidadinternal.share.xml.XMLUtils;
import org.apache.myfaces.trinidadinternal.skin.icon.ContextImageIcon;
@@ -51,10 +49,10 @@ import org.apache.myfaces.trinidadintern
import org.apache.myfaces.trinidadinternal.style.util.CSSUtils;
import org.apache.myfaces.trinidadinternal.style.util.StyleUtils;
import org.apache.myfaces.trinidadinternal.style.xml.parse.IconNode;
+import org.apache.myfaces.trinidadinternal.style.xml.parse.IncludeCompactPropertyNode;
import org.apache.myfaces.trinidadinternal.style.xml.parse.IncludePropertyNode;
import org.apache.myfaces.trinidadinternal.style.xml.parse.IncludeStyleNode;
import org.apache.myfaces.trinidadinternal.style.xml.parse.PropertyNode;
-import org.apache.myfaces.trinidadinternal.style.xml.parse.SkinPropertyNode;
import org.apache.myfaces.trinidadinternal.style.xml.parse.StyleNode;
import org.apache.myfaces.trinidadinternal.style.xml.parse.StyleSheetDocument;
import org.apache.myfaces.trinidadinternal.style.xml.parse.StyleSheetNode;
@@ -198,8 +196,6 @@ class SkinStyleSheetParserUtils
// initialize
List <StyleNode> styleNodeList = new ArrayList<StyleNode>();
List<IconNode> iconNodeList = new ArrayList<IconNode>();
- // trSkinPropertyNodeList, e.g., af|foo {-tr-show-last-item: true}
- List<SkinPropertyNode> trSkinPropertyNodeList = new ArrayList<SkinPropertyNode>();
// process each selector and all its name+values
for (SkinSelectorPropertiesNode cssSelector : selectorNodeList)
@@ -211,11 +207,13 @@ class SkinStyleSheetParserUtils
int direction = skinSSNode.getDirection();
ResolvedSkinProperties resolvedProperties =
- _resolveProperties(selectorName,
- propertyList);
+ _resolveProperties(propertyList);
- trSkinPropertyNodeList.addAll(resolvedProperties.getSkinPropertyNodeList());
+ // trSkinPropertyNodeList, e.g., af|foo {-tr-show-last-item: true}
+ // PropertyNode(-tr-show-last-item, true)
+ List<PropertyNode> trSkinPropertyNodeList = new ArrayList<PropertyNode>();
+ trSkinPropertyNodeList = resolvedProperties.getSkinPropertyNodeList();
List<PropertyNode> noTrPropertyList =
resolvedProperties.getNoTrPropertyList();
@@ -241,8 +239,10 @@ class SkinStyleSheetParserUtils
{
_addStyleNode(selectorName,
noTrPropertyList,
+ trSkinPropertyNodeList,
resolvedProperties.getTrRuleRefList(),
resolvedProperties.getIncludedPropertiesList(),
+ resolvedProperties.getIncludedCompactPropertiesList(),
resolvedProperties.getInhibitedProperties(),
resolvedProperties.isTrTextAntialias(),
styleNodeList);
@@ -253,8 +253,10 @@ class SkinStyleSheetParserUtils
// create a StyleNode object and add it to the styleNodeList.
_addStyleNode(selectorName,
noTrPropertyList,
+ trSkinPropertyNodeList,
resolvedProperties.getTrRuleRefList(),
resolvedProperties.getIncludedPropertiesList(),
+ resolvedProperties.getIncludedCompactPropertiesList(),
resolvedProperties.getInhibitedProperties(),
resolvedProperties.isTrTextAntialias(),
styleNodeList);
@@ -262,8 +264,7 @@ class SkinStyleSheetParserUtils
}
}
- if ((styleNodeList.size() > 0) || (iconNodeList.size() > 0) ||
- (trSkinPropertyNodeList.size() > 0))
+ if ((styleNodeList.size() > 0) || (iconNodeList.size() > 0))
{
// we need to deal with the styleNodeList by building a StyleSheetNode
// with this information.
@@ -272,7 +273,6 @@ class SkinStyleSheetParserUtils
StyleSheetNode ssNode =
new StyleSheetNode(styleNodeArray,
iconNodeList,
- trSkinPropertyNodeList,
null,/*locales, not yet supported*/
skinSSNode.getDirection(),
skinSSNode.getAgentVersions(),
@@ -298,12 +298,10 @@ class SkinStyleSheetParserUtils
/**
* Loop thru every property in the propertyList and store them in
* the ResolvedSkinProperties inner class.
- * @param selectorName
* @param propertyNodeList
* @return
*/
private static ResolvedSkinProperties _resolveProperties(
- String selectorName,
List<PropertyNode> propertyNodeList)
{
@@ -312,8 +310,10 @@ class SkinStyleSheetParserUtils
Set<String> inhibitedPropertySet = new TreeSet<String>();
List<IncludePropertyNode> includedPropertiesList =
new ArrayList<IncludePropertyNode>();
- List<SkinPropertyNode> skinPropertyNodeList =
- new ArrayList<SkinPropertyNode>();
+ List<IncludeCompactPropertyNode> includedCompactPropertiesList =
+ new ArrayList<IncludeCompactPropertyNode>();
+ List<PropertyNode> skinPropertyNodeList =
+ new ArrayList<PropertyNode>();
boolean trTextAntialias = false;
@@ -340,12 +340,44 @@ class SkinStyleSheetParserUtils
// Check for special propertyNames (-tr-rule-ref, -tr- skin properties)
// or propertyValue (-tr-property-ref)
- boolean includedProperty = propertyValue.startsWith(_INCLUDE_PROPERTY);
- if (includedProperty)
+
+ // Check for -tr-property-ref first, either regular or compact
+ if(propertyValue.indexOf(_INCLUDE_PROPERTY) != -1)
{
- IncludePropertyNode node = _createIncludePropertyNode(
- propertyName, propertyValue.substring(_INCLUDE_PROPERTY.length()));
- includedPropertiesList.add(node);
+ List<String> values = separateCompactValues(propertyValue);
+ // border-color: -tr-property-ref(...) versus border: 1px solid -tr-property-ref();
+ if (values.size() == 1)
+ {
+ // include property
+ IncludePropertyNode node = _createIncludePropertyNode(
+ propertyName, propertyValue.substring(_INCLUDE_PROPERTY.length()));
+ includedPropertiesList.add(node);
+ }
+ else
+ {
+ // include compact property
+ List<IncludePropertyNode> compactIncludePropNodes = new ArrayList<IncludePropertyNode>();
+ StringBuilder builder = new StringBuilder();
+ for (String value : values)
+ {
+ if (value.startsWith(_INCLUDE_PROPERTY))
+ {
+ IncludePropertyNode node = _createIncludePropertyNode(
+ propertyName, value.substring(_INCLUDE_PROPERTY.length()));
+ compactIncludePropNodes.add(node);
+ }
+ else
+ {
+ builder.append(value);
+ builder.append(" ");
+ }
+ }
+ IncludeCompactPropertyNode iCPNode =
+ new IncludeCompactPropertyNode(builder.toString(),
+ compactIncludePropNodes, propertyName);
+ includedCompactPropertiesList.add(iCPNode);
+
+ }
}
else
{
@@ -375,10 +407,9 @@ class SkinStyleSheetParserUtils
}
else
{
- // create the SkinPropertyNode
- SkinPropertyNode node =
- _createSkinPropertyNode(selectorName, propertyName, propertyValue);
-
+ // create the PropertyNode for skin properties (e.g., -tr-show-last-item: true)
+ PropertyNode node = new PropertyNode(propertyName, propertyValue);
+
skinPropertyNodeList.add(node);
}
}
@@ -394,11 +425,49 @@ class SkinStyleSheetParserUtils
noTrPropertyList,
trRuleRefList,
includedPropertiesList,
+ includedCompactPropertiesList,
inhibitedPropertySet,
skinPropertyNodeList,
trTextAntialias);
}
+ private static List<String> separateCompactValues(String propertyValue)
+ {
+ String[] test = _SPACE_PATTERN.split(propertyValue);
+ List<String> propertyValueNoSpaces = new ArrayList<String>();
+ boolean inTr = false;
+ int inTrIndex = 0;
+ for (int i=0; i < test.length; i++)
+ {
+ String string = test[i];
+ if (string.startsWith(_INCLUDE_PROPERTY) && !string.endsWith(")"))
+ {
+ // keep looping through the pieces
+ // until we get to a string that endsWith ")".
+ inTr = true;
+ inTrIndex = i;
+ }
+ else if (inTr)
+ {
+ if (string.endsWith(")"))
+ {
+ StringBuilder builder = new StringBuilder();
+ for (int j=inTrIndex; j <= i; j++)
+ {
+ builder.append(test[j]);
+ }
+ inTr = false;
+ propertyValueNoSpaces.add(builder.toString());
+ }
+ }
+ else
+ {
+ propertyValueNoSpaces.add(string);
+ }
+ }
+ return propertyValueNoSpaces;
+ }
+
/**
* Create an IconNode and add it to the iconNodeList.
* @param sourceName
@@ -598,22 +667,55 @@ class SkinStyleSheetParserUtils
}
/**
- * Creates a StyleNode object and adds it to the styleNodeList
+ * Creates a StyleNode object and adds it to the styleNodeList.
+ * The StyleNode object gets completely resolved (the trRuleRefList, includeProperyNodes, etc.,
+ * get resolved in StyleSheetDocument#_resolveStyleNode). The StyleNode here is the unresolved
+ * StyleNode - basically what we have in the skin css file.
* @param selectorName
* @param propertyNodeList
+ * @param skinPropertyNodeList
* @param trRuleRefList
- * @param styleNodeList
+ * @param includePropertyNodes
+ * @param includeCompactPropertyNodes
+ * @param inhibitedProperties
+ * @param trTextAntialias
+ * @param styleNodeList Once the StyleNode is created, it is added to the iconNodeList to be
+ * used outside this method.
+ *
*/
private static void _addStyleNode(
String selectorName,
List<PropertyNode> propertyNodeList,
+ List<PropertyNode> skinPropertyNodeList,
List<String> trRuleRefList,
List<IncludePropertyNode> includePropertyNodes,
+ List<IncludeCompactPropertyNode> includeCompactPropertyNodes,
Set<String> inhibitedProperties,
boolean trTextAntialias,
List<StyleNode> styleNodeList)
{
+ StyleNode styleNode = _createStyleNode(selectorName, propertyNodeList, skinPropertyNodeList,
+ trRuleRefList,
+ includePropertyNodes,
+ includeCompactPropertyNodes,
+ inhibitedProperties,
+ trTextAntialias);
+
+ styleNodeList.add(styleNode);
+
+ }
+
+ private static StyleNode _createStyleNode(
+ String selectorName,
+ List<PropertyNode> propertyNodeList,
+ List<PropertyNode> skinPropertyNodeList,
+ List<String> trRuleRefList,
+ List<IncludePropertyNode> includePropertyNodes,
+ List<IncludeCompactPropertyNode> includeCompactPropertyNodes,
+ Set<String> inhibitedProperties,
+ boolean trTextAntialias)
+ {
// these are the styles.
// At this point I have a selector name and the properties.
// create a StyleNode based on this information.
@@ -665,12 +767,17 @@ class SkinStyleSheetParserUtils
new StyleNode(name,
selector,
propertyArray,
+ skinPropertyNodeList.isEmpty() ?
+ null : skinPropertyNodeList.toArray(new PropertyNode[0]),
includeStyleNodes.toArray(new IncludeStyleNode[0]),
- includePropertyNodes.isEmpty() ? null : includePropertyNodes.toArray(new IncludePropertyNode[0]),
- inhibitedProperties);
-
- styleNodeList.add(styleNode);
-
+ includePropertyNodes.isEmpty() ?
+ null : includePropertyNodes.toArray(new IncludePropertyNode[0]),
+ includeCompactPropertyNodes.isEmpty() ?
+ null : includeCompactPropertyNodes.toArray(new IncludeCompactPropertyNode[0]),
+ inhibitedProperties,
+ false);
+
+ return styleNode;
}
/**
@@ -724,40 +831,6 @@ class SkinStyleSheetParserUtils
return null;
}
- private static SkinPropertyNode _createSkinPropertyNode(
- String selector,
- String name,
- String value)
- {
- // Store the property selector + property Name as the Skin Property Key.
- // e.g., use af|breadCrumbs-tr-show-last-item
- StringBuilder keyBuilder = new StringBuilder(selector.length() + name.length());
- keyBuilder.append(selector);
- keyBuilder.append(name);
- String key = keyBuilder.toString();
-
- // look up in map to get conversion
- Class<?> type = SkinProperties.PROPERTY_CLASS_TYPE_MAP.get(key);
- Object propValueObj = null;
- if (type != null)
- {
- try
- {
- // coerce the value to the type
- propValueObj = Coercions.coerce(null, value, type);
- }
- catch (IllegalArgumentException ex)
- {
- if (_LOG.isWarning())
- _LOG.warning(ex);
- }
- }
-
- SkinPropertyNode node = new SkinPropertyNode(key,
- propValueObj != null ? propValueObj : value);
- return node;
- }
-
// This is for -tr-rule-ref properties on styles.
private static void _addIncludeStyleNodes(
String value,
@@ -955,16 +1028,18 @@ class SkinStyleSheetParserUtils
ResolvedSkinProperties(
- List<PropertyNode> noTrPropertyList,
- List<String> trRuleRefList,
- List<IncludePropertyNode> includedPropertiesList,
- Set<String> inhibitedPropertySet,
- List<SkinPropertyNode> skinPropertyNodeList,
+ List<PropertyNode> noTrPropertyList,
+ List<String> trRuleRefList,
+ List<IncludePropertyNode> includedPropertiesList,
+ List<IncludeCompactPropertyNode> includedCompactPropertiesList,
+ Set<String> inhibitedPropertySet,
+ List<PropertyNode> skinPropertyNodeList,
boolean trTextAntialias)
{
_noTrPropertyList = noTrPropertyList;
_trRuleRefList = trRuleRefList;
_includedPropertiesList = includedPropertiesList;
+ _includedCompactPropertiesList = includedCompactPropertiesList;
_inhibitedPropertySet = inhibitedPropertySet;
_skinPropertyNodeList = skinPropertyNodeList;
_trTextAntialias = trTextAntialias;
@@ -985,7 +1060,12 @@ class SkinStyleSheetParserUtils
return _includedPropertiesList;
}
- public List<SkinPropertyNode> getSkinPropertyNodeList()
+ public List<IncludeCompactPropertyNode> getIncludedCompactPropertiesList()
+ {
+ return _includedCompactPropertiesList;
+ }
+
+ public List<PropertyNode> getSkinPropertyNodeList()
{
return _skinPropertyNodeList;
}
@@ -1004,7 +1084,8 @@ class SkinStyleSheetParserUtils
private List<PropertyNode> _noTrPropertyList;
private List<String> _trRuleRefList;
private List<IncludePropertyNode> _includedPropertiesList;
- private List<SkinPropertyNode> _skinPropertyNodeList;
+ private List<IncludeCompactPropertyNode> _includedCompactPropertiesList;
+ private List<PropertyNode> _skinPropertyNodeList;
private boolean _trTextAntialias;
}
Modified: myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java?rev=1021551&r1=1021550&r2=1021551&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java (original)
+++ myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java Mon Oct 11 23:59:34 2010
@@ -55,7 +55,9 @@ import org.apache.myfaces.trinidad.style
import org.apache.myfaces.trinidad.util.CollectionUtils;
import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderingContext;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SkinProperties;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SkinSelectors;
+import org.apache.myfaces.trinidadinternal.share.expl.Coercions;
import org.apache.myfaces.trinidadinternal.share.io.CachingNameResolver;
import org.apache.myfaces.trinidadinternal.share.io.DefaultNameResolver;
import org.apache.myfaces.trinidadinternal.share.xml.JaxpXMLProvider;
@@ -69,7 +71,6 @@ import org.apache.myfaces.trinidadintern
import org.apache.myfaces.trinidadinternal.style.xml.StyleSheetDocumentUtils;
import org.apache.myfaces.trinidadinternal.style.xml.parse.IconNode;
import org.apache.myfaces.trinidadinternal.style.xml.parse.PropertyNode;
-import org.apache.myfaces.trinidadinternal.style.xml.parse.SkinPropertyNode;
import org.apache.myfaces.trinidadinternal.style.xml.parse.StyleNode;
import org.apache.myfaces.trinidadinternal.style.xml.parse.StyleSheetDocument;
import org.apache.myfaces.trinidadinternal.style.xml.parse.StyleSheetNode;
@@ -554,7 +555,7 @@ public class FileSystemStyleCache implem
ConcurrentMap<String, Icon> icons =
_getStyleContextResolvedIcons(context, document);
ConcurrentMap<Object, Object> skinProperties =
- _getStyleContextResolvedSkinProperties(context, document);
+ _getStyleContextResolvedSkinProperties(styleNodes);
// Create a new entry and cache it in the "normal" cache. The "normal" cache is one
// where the key is the Key object which is built based on information from the StyleContext,
@@ -695,28 +696,55 @@ public class FileSystemStyleCache implem
* styleSheetNodes that have been filtered from the StyleContext and StyleSheetDocument.
*/
private ConcurrentMap<Object, Object> _getStyleContextResolvedSkinProperties(
- StyleContext context,
- StyleSheetDocument document
+ StyleNode[] styleNodes
)
{
- Iterator<StyleSheetNode> styleSheetNodes = document.getStyleSheets(context);
-
- ConcurrentMap<Object, Object> skinProperties = new ConcurrentHashMap<Object, Object>();
- while (styleSheetNodes.hasNext())
- {
- StyleSheetNode styleSheetNode = styleSheetNodes.next();
- Collection<SkinPropertyNode> skinPropertyNodes = styleSheetNode.getSkinProperties();
+ // Use the resolved StyleNode[] to get the skinProperties from them.
+ ConcurrentMap<Object, Object> skinPropertiesMap = new ConcurrentHashMap<Object, Object>();
+ for (StyleNode styleNode : styleNodes)
+ {
+ Collection<PropertyNode> skinPropertyNodes = styleNode.getSkinProperties();
+ for (PropertyNode node : skinPropertyNodes)
+ {
+ // create SkinProperty key and SkinProperty value
+ String selectorName = styleNode.getSelector();
+ if (selectorName == null)
+ {
+ selectorName = "." + styleNode.getName() + ":alias";
+ }
+ String name = node.getName();
- if (skinPropertyNodes != null)
- {
- for (SkinPropertyNode skinPropertyNode : skinPropertyNodes)
+ // Store the property selector + property Name as the Skin Property Key.
+ // e.g., use af|breadCrumbs-tr-show-last-item
+ StringBuilder keyBuilder = new StringBuilder(selectorName.length() + name.length());
+ keyBuilder.append(selectorName);
+ keyBuilder.append(name);
+ String key = keyBuilder.toString();
+
+ // look up in map to get conversion
+ Class<?> type = SkinProperties.PROPERTY_CLASS_TYPE_MAP.get(key);
+ Object propValueObj = null;
+ String value = node.getValue();
+ if (type != null)
{
- skinProperties.put(skinPropertyNode.getKey(), skinPropertyNode.getValue());
+ try
+ {
+ // coerce the value to the type
+ propValueObj = Coercions.coerce(null, value, type);
+ }
+ catch (IllegalArgumentException ex)
+ {
+ if (_LOG.isWarning())
+ _LOG.warning(ex);
+ }
}
+
+ skinPropertiesMap.put(key, (propValueObj != null ? propValueObj : value));
+
}
}
-
- return skinProperties;
+ return skinPropertiesMap;
+
}
/**
Added: myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/IncludeCompactPropertyNode.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/IncludeCompactPropertyNode.java?rev=1021551&view=auto
==============================================================================
--- myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/IncludeCompactPropertyNode.java (added)
+++ myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/IncludeCompactPropertyNode.java Mon Oct 11 23:59:34 2010
@@ -0,0 +1,137 @@
+/*
+ * 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.trinidadinternal.style.xml.parse;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.myfaces.trinidad.logging.TrinidadLogger;
+/**
+ * The includeCompactProperty node is a data structure to store this syntax:
+ * border: 1px solid -tr-property-ref(".AFDarkColor:alias",color);
+ * which should resolve to border: 1px solid #cccccc; (if #cccccc is .AFDarkColor:alias's color.
+ * This is similar to includeProperty element, but it is used on compact css property values.
+ * An IncludePropertyNode is a data structure to store this syntax:
+ * color: -tr-property-ref(".AFDarkColor:alias",color);
+ * includeProperty element is used to include a single property of one style
+ * within another style. Thus, the includeProperty element is very similar to the
+ * includeStyle element. The only difference is that includeStyle includes all properties
+ * of the referenced style, whereas includeProperty includes only a single property.
+ * @version $Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/style/xml/parse/IncludeCompactPropertyNode.java#0 $) $Date: 10-nov-2005.18:58:07 $
+ */
+public class IncludeCompactPropertyNode
+{
+
+ /**
+ * Creates an IncludeCompactPropertyNode.
+ * If we have border: 1px solid -tr-property-ref(".AFDarkColor:alias",color); in the css file,
+ * then localPropertyName == border, propertyValues == {"1px solid"}, and
+ * includePropertyNodeList will contain the -tr-property-ref(".AFDarkColor:alias",color);
+ * @param includePropertyNodeList
+ * @param propertyValues
+ * @param localPropertyName
+ */
+ public IncludeCompactPropertyNode(
+ String propertyValues,
+ List<IncludePropertyNode> includePropertyNodeList,
+ String localPropertyName)
+ {
+ // The caller of this constructor must have all these values filled out.
+ if (propertyValues == null)
+ throw new IllegalArgumentException();
+ if (includePropertyNodeList == null)
+ throw new IllegalArgumentException();
+ if (localPropertyName == null)
+ throw new IllegalArgumentException();
+
+ _propertyValues = propertyValues;
+ _includePropertyNodeList = includePropertyNodeList;
+ _localPropertyName = localPropertyName;
+
+ }
+
+ /**
+ * Returns the name of the style to include.
+ */
+ public String getLocalPropertyName()
+ {
+ return _localPropertyName;
+ }
+
+ /**
+ * Returns the name of the style to include.
+ */
+ public String getPropertyValues()
+ {
+ return _propertyValues;
+ }
+
+ public Collection<IncludePropertyNode> getIncludedProperties()
+ {
+ return _includePropertyNodeList;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (!(obj instanceof IncludeCompactPropertyNode))
+ return false;
+
+ // obj at this point must be an IncludeCompactPropertyNode
+ IncludeCompactPropertyNode test = (IncludeCompactPropertyNode)obj;
+ return
+ (_localPropertyName == test._localPropertyName
+ || (_localPropertyName != null && _localPropertyName.equals(test._localPropertyName)))
+ && (_propertyValues == test._propertyValues
+ || (_propertyValues != null && _propertyValues.equals(test._propertyValues)))
+ && (_includePropertyNodeList == test._includePropertyNodeList
+ || (_includePropertyNodeList != null
+ && _includePropertyNodeList.equals(test._includePropertyNodeList)));
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int hash = 17;
+ hash = 37*hash + ((null == _localPropertyName) ? 0 : _localPropertyName.hashCode());
+ hash = 37*hash + ((null == _propertyValues) ? 0 : _propertyValues.hashCode());
+ hash = 37*hash + ((null == _includePropertyNodeList) ? 0 : _includePropertyNodeList.hashCode());
+
+ return hash;
+ }
+
+
+ @Override
+ // TODO jmwOctober. test this
+ public String toString()
+ {
+ return
+ "[propertyValues=" + _propertyValues + ", " +
+ "includePropertyNodeList=" + _includePropertyNodeList + "]";
+ }
+
+ private final String _propertyValues;
+ private final List<IncludePropertyNode> _includePropertyNodeList;
+ private final String _localPropertyName;
+
+ private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(
+ IncludeCompactPropertyNode.class);
+}
Modified: myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/IncludePropertyNode.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/IncludePropertyNode.java?rev=1021551&r1=1021550&r2=1021551&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/IncludePropertyNode.java (original)
+++ myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/IncludePropertyNode.java Mon Oct 11 23:59:34 2010
@@ -20,22 +20,27 @@ package org.apache.myfaces.trinidadinter
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
/**
- * IncludePropertyNode is used to represent a single <includeProperty%gt; element
- * in a parsed XML Style Sheet Language document.
+ * An IncludePropertyNode is a data structure to store this syntax:
+ * color: -tr-property-ref(".AFDarkColor:alias",color);
* The includeProperty element is used to include a single property of one style
- * within another style. Thus, the includeProperty element is very similar to the
- * includeStyle element. The only difference is that includeStyle includes all properties
- * of the referenced style, whereas includeProperty includes only a single property.
- * Currently, the includeProperty element is not yet ported to the skin's CSS syntax.
- * It exists only in the XSS syntax.
+ * within another style. Thus, the -tr-property-ref element is very similar to the
+ * -tr-rule-ref element, which is stored in IncludeStyleNode.
+ * The only difference is that -tr-rule-ref includes all properties
+ * of the referenced style, whereas -tr-property-ref includes only a single property.
*
* @version $Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/style/xml/parse/IncludePropertyNode.java#0 $) $Date: 10-nov-2005.18:58:07 $
*/
public class IncludePropertyNode
{
/**
- * Creates an IncludePropertyNode. In general, either the name or
- * selector of the included style is specified.
+ * Creates an IncludePropertyNode. In general, either the name (selector that does not
+ * get written to the css file, like an :alias) or the selector of the included style is
+ * specified.
+ * @param name name of the included style if it is a namedStyle
+ * @param selector name of the included style selector if it is a selector and not a namedStyle
+ * @param propertyName propertyName of the included style you want to get the value of
+ * @param localPropertyName if the css is color: 1px solid -tr-property-ref(...), the
+ * localPropertyName is 'color'.
*/
public IncludePropertyNode(
String name,
Modified: myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleNode.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleNode.java?rev=1021551&r1=1021550&r2=1021551&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleNode.java (original)
+++ myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleNode.java Mon Oct 11 23:59:34 2010
@@ -34,6 +34,7 @@ import java.util.Set;
public class StyleNode
{
+
/**
* Creates a Style with the specified properties
*/
@@ -41,31 +42,37 @@ public class StyleNode
String name,
String selector,
PropertyNode[] properties,
+ PropertyNode[] skinProperties,
IncludeStyleNode[] includedStyles,
IncludePropertyNode[] includedProperties,
+ IncludeCompactPropertyNode[] includedCompactProperties,
Set<String> inhibitedProperties
)
{
this(name,
selector,
properties,
+ skinProperties,
includedStyles,
includedProperties,
+ includedCompactProperties,
inhibitedProperties,
false);
}
-
+
// Constructor which also specifies allows resetProperties
- // flag to be specified. This is package-private, since
- // only StyleNodeParser should be calling this.
- StyleNode(
+ // flag to be specified.
+ // skinProperties are server-side properties like -tr-show-last-item: true
+ public StyleNode(
String name,
String selector,
PropertyNode[] properties,
+ PropertyNode[] skinProperties,
IncludeStyleNode[] includedStyles,
IncludePropertyNode[] includedProperties,
+ IncludeCompactPropertyNode[] includedCompactProperties,
Set<String> inhibitedProperties,
- boolean resetProperties
+ boolean resetProperties
)
{
// Initialize _name, _selector, _resetProperties
@@ -108,8 +115,28 @@ public class StyleNode
_includedProperties = Collections.singletonList(includedProperties[0]);
else
_includedProperties = Collections.unmodifiableList(Arrays.asList(includedProperties));
-
-
+
+ // Initialize _includedCompactProperties
+ // ------------------------------
+ if ((includedCompactProperties == null) || (includedCompactProperties.length == 0))
+ _includedCompactProperties = Collections.emptyList();
+ else if (includedCompactProperties.length == 1)
+ _includedCompactProperties = Collections.singletonList(includedCompactProperties[0]);
+ else
+ _includedCompactProperties =
+ Collections.unmodifiableList(Arrays.asList(includedCompactProperties));
+
+ // Initialize _skinProperties. These are server-side skin properties, like -tr-show-last-item,
+ // as opposed to client side, like background-color or color. client side properties get
+ // written to css file, but server-side skin properties do not.
+ // ------------------------------
+ if ((skinProperties == null) || (skinProperties.length == 0))
+ _skinProperties = Collections.emptyList();
+ else if (skinProperties.length == 1)
+ _skinProperties = Collections.singletonList(skinProperties[0]);
+ else
+ _skinProperties = Collections.unmodifiableList(Arrays.asList(skinProperties));
+
// Initialize _inhibitAll and _inhibitedProperties
// -----------------------------------------------
boolean inhibitAll = false;
@@ -198,6 +225,23 @@ public class StyleNode
}
/**
+ * Implementation of StyleNode.getSkinProperties().
+ */
+ public Collection<PropertyNode> getSkinProperties()
+ {
+ return _skinProperties;
+ }
+
+
+ /**
+ * Implementation of StyleNode.getIncludedCompactProperties().
+ */
+ public Collection<IncludeCompactPropertyNode> getIncludedCompactProperties()
+ {
+ return _includedCompactProperties;
+ }
+
+ /**
* Return a Collection of IncludeStyleNode objects for the StyleNode.
* This method will return a Collections.emptyList this StyleNode does
* not have any IncludeStyleNode.
@@ -267,7 +311,9 @@ public class StyleNode
(_inhibitedProperties.equals(test._inhibitedProperties)) &&
(_includedStyles.equals(test._includedStyles)) &&
(_includedProperties.equals(test._includedProperties)) &&
- (_properties.equals(test._properties));
+ (_includedCompactProperties.equals(test._includedCompactProperties)) &&
+ (_properties.equals(test._properties)) &&
+ (_skinProperties.equals(test._skinProperties));
}
@Override
@@ -281,7 +327,9 @@ public class StyleNode
hash = 37*hash + _inhibitedProperties.hashCode();
hash = 37*hash + _includedStyles.hashCode();
hash = 37*hash + _includedProperties.hashCode();
+ hash = 37*hash + _includedCompactProperties.hashCode();
hash = 37*hash + _properties.hashCode();
+ hash = 37*hash + _skinProperties.hashCode();
return hash;
}
@@ -293,8 +341,10 @@ public class StyleNode
"name=" + _name + ", " +
"selector=" + _selector + ", " +
"properties=" + _properties.toString() + ", " +
+ "skinProperties=" + _skinProperties.toString() + ", " +
"includeStyles=" + _includedStyles.toString() + ", " +
"includeProperties=" + _includedProperties.toString() + ", " +
+ "includeCompactProperties=" + _includedCompactProperties.toString() + ", " +
"inhibitedProperties=" + _inhibitedProperties.toString() + ", " +
"resetProperties=" + _resetProperties + ", " +
"inhibitAll=" + _inhibitAll + "]";
@@ -312,8 +362,10 @@ public class StyleNode
private final String _name;
private final String _selector;
private final List<PropertyNode> _properties; // The property nodes
+ private final List<PropertyNode> _skinProperties; // The skin property nodes
private final List<IncludeStyleNode> _includedStyles; // Included styles
private final List<IncludePropertyNode> _includedProperties; // Included properties
+ private final List<IncludeCompactPropertyNode> _includedCompactProperties;
private final List<String> _inhibitedProperties; // Inhibited properties
// These flags checks whether the style should inherit properties
Modified: myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleNodeParser.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleNodeParser.java?rev=1021551&r1=1021550&r2=1021551&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleNodeParser.java (original)
+++ myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleNodeParser.java Mon Oct 11 23:59:34 2010
@@ -98,9 +98,11 @@ public class StyleNodeParser extends Bas
return new StyleNode(_name,
_selector,
properties,
+ null, // skinProperties not supported in XSS (XSS will be deleted soon)
includedStyles,
includedProperties,
null,
+ null,
_resetProperties);
}
Modified: myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetDocument.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetDocument.java?rev=1021551&r1=1021550&r2=1021551&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetDocument.java (original)
+++ myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetDocument.java Mon Oct 11 23:59:34 2010
@@ -45,6 +45,7 @@ import org.apache.myfaces.trinidadintern
import org.apache.myfaces.trinidadinternal.style.util.CSSUtils;
import org.apache.myfaces.trinidadinternal.style.util.ModeUtils;
import org.apache.myfaces.trinidadinternal.style.util.NameUtils;
+import org.apache.myfaces.trinidadinternal.style.util.StyleUtils;
import org.apache.myfaces.trinidadinternal.util.nls.LocaleUtils;
@@ -203,7 +204,7 @@ public class StyleSheetDocument
// We also need to provide a Map for storing selector-based
// styles and another for storing name-based styles, used by
- // _resolveStyle() to store results
+ // _resolveStyleNode() to store results
HashMap<String, StyleNode> resolvedStyles =
new HashMap<String, StyleNode>();
HashMap<String, StyleNode> resolvedNamedStyles =
@@ -212,8 +213,8 @@ public class StyleSheetDocument
// Keep track of all selectors and names that we've already
// found, so that we don't bother re-resolving them
// These differ from the above Maps in that the Maps are
- // mutated by _resolveStyle - so an included selector, for
- // instance, might already be present in _resolveStyle but
+ // mutated by _resolveStyleNode - so an included selector, for
+ // instance, might already be present in _resolveStyleNode but
// not yet have been encountered by this top loop. We
// could eliminate the need for this if we were willing
// to give up the ordering of the list
@@ -253,14 +254,14 @@ public class StyleSheetDocument
// for it again
if (!isFound)
{
- StyleNode resolvedNode = _resolveStyle(context,
- styleSheets,
- resolvedStyles,
- resolvedNamedStyles,
- null,
- null,
- id,
- isNamed);
+ StyleNode resolvedNode = _resolveStyleNode(context,
+ styleSheets,
+ resolvedStyles,
+ resolvedNamedStyles,
+ null,
+ null,
+ id,
+ isNamed);
// If we got a node, add it in to our list
if (resolvedNode != null)
@@ -357,18 +358,23 @@ public class StyleSheetDocument
if (styleSheets.isEmpty())
return null;
- return _resolveStyle(context,
- styleSheets,
- new HashMap<String, StyleNode>(19), // Resolved styles
- new HashMap<String, StyleNode>(19), // Resolved named styles
- null, // Include stack
- null, // Named include stack
- id,
- isNamed);
+ return _resolveStyleNode(context,
+ styleSheets,
+ new HashMap<String, StyleNode>(19), // Resolved styles
+ new HashMap<String, StyleNode>(19), // Resolved named styles
+ null, // Include stack
+ null, // Named include stack
+ id,
+ isNamed);
}
/**
* Resolves the (named or selector-based) style with the specified id.
+ * In SkinStyleSheetParserUtils we parse the CSS file and create a raw StyleNode, one
+ * where all the PropertyNodes/SkinPropertyNodes have not been completely resolved. A
+ * raw StyleNode has trRuleRef properties, trPropertyRef property values, etc. A fully
+ * resolved StyleNode only has propertyNodes and skinPropertyNodes, because everything
+ * else has been resolved into those two things.
* @param context The StyleContext
* @param styleSheets The StyleSheetNodes to use for resolving the style,
* sorted from lowest to highest precedence.
@@ -387,7 +393,7 @@ public class StyleSheetDocument
* resolved style is stored in the appropriate resolved style
* Map.
*/
- private StyleNode _resolveStyle(
+ private StyleNode _resolveStyleNode(
StyleContext context,
StyleSheetList styleSheets,
Map<String, StyleNode> resolvedStyles,
@@ -466,7 +472,67 @@ public class StyleSheetDocument
includesStack.push(id);
}
+ // styleSheets.styleNodes(id, isNamed) returns a List of StyleNodes that match the StyleContext
+ // and have the same selector name. For example, if the css files contains
+ // .someStyle {color: red} .someStyle {font-size: 11px}
+ // you will get two StyleNodes, and the properties will get merged together.
List<StyleNode> nodeList = styleSheets.styleNodes(id, isNamed);
+
+ _resolveStyleWork(context, id, styleSheets, resolvedStyles, resolvedNamedStyles,
+ includesStack, namedIncludesStack, entry, nodeList);
+
+ // Pop the include stack
+ if (isNamed)
+ {
+ namedIncludesStack.pop();
+ }
+ else
+ {
+ includesStack.pop();
+ }
+
+ StyleNode resolvedNode = entry.toStyleNode();
+
+ // If we got a node, add it in to our list
+ if (resolvedNode != null)
+ {
+ // cache already resolved styles so we don't
+ // resolve them again. This saves (a lot of) time.
+ // TODO: AdamWiner: entry.toStyleNode() will return
+ // null if it's an empty style. But that means
+ // that this cache doesn't get used, so we end
+ // up hammering on these. This doesn't appear
+ // to be a performance issue at this time.
+ String namedStyle = resolvedNode.getName();
+ if (namedStyle != null)
+ {
+ resolvedNamedStyles.put(namedStyle, resolvedNode);
+ }
+ else
+ {
+ String selectorStyle = resolvedNode.getSelector();
+ if (selectorStyle != null)
+ {
+ resolvedStyles.put(selectorStyle, resolvedNode);
+ }
+ }
+ }
+
+ // Convert the StyleEntry to a StyleNode and return it
+ return resolvedNode;
+ }
+
+ private void _resolveStyleWork(
+ StyleContext context,
+ String id,
+ StyleSheetList styleSheets,
+ Map<String, StyleNode> resolvedStyles,
+ Map<String, StyleNode> resolvedNamedStyles,
+ Stack<String> includesStack,
+ Stack<String> namedIncludesStack,
+ StyleEntry entry,
+ List<StyleNode> nodeList)
+ {
if (nodeList != null)
{
for (StyleNode node : nodeList)
@@ -480,6 +546,8 @@ public class StyleSheetDocument
// 3. Remove all properties that were inhibited.
// 4. Shove all properties from the matching StyleNode into our
// StyleEntry, overwriting included values
+ // 5. Shove all skin properties from the matching StyleNode into our
+ // StyleEntry, overwriting included values
// -= Simon Lessard =-
// FIXME: That sequence looks buggy. If more than 1 matching node
// is found, then the included properties of the second will
@@ -493,7 +561,7 @@ public class StyleSheetDocument
// 0. Reset properties?
if (node.__getResetProperties() || node.isInhibitingAll())
entry.resetProperties();
-
+
// 1. Resolve included styles
Iterable<IncludeStyleNode> includedStyles = node.getIncludedStyles();
for (IncludeStyleNode includeStyle : includedStyles)
@@ -510,8 +578,8 @@ public class StyleSheetDocument
{
includeID = includeStyle.getSelector();
}
-
- StyleNode resolvedNode = _resolveStyle(context,
+
+ StyleNode resolvedNode = _resolveStyleNode(context,
styleSheets,
resolvedStyles,
resolvedNamedStyles,
@@ -523,34 +591,17 @@ public class StyleSheetDocument
if (resolvedNode != null)
_addIncludedProperties(entry, resolvedNode);
}
-
-
+
+
// 2. Resolve included properties
+ // color: -tr-property-ref(".AFDefaultFont:alias","background-color");
Iterable<IncludePropertyNode> includedProperties = node.getIncludedProperties();
for (IncludePropertyNode includeProperty : includedProperties)
{
- String includeID = null;
- boolean includeIsNamed = false;
-
- if (includeProperty.getName() != null)
- {
- includeID = includeProperty.getName();
- includeIsNamed = true;
- }
- else
- {
- includeID = includeProperty.getSelector();
- }
-
- StyleNode resolvedNode = _resolveStyle(context,
- styleSheets,
- resolvedStyles,
- resolvedNamedStyles,
- includesStack,
- namedIncludesStack,
- includeID,
- includeIsNamed);
-
+ StyleNode resolvedNode =
+ _resolveIncludedProperties(context, styleSheets, resolvedStyles,
+ resolvedNamedStyles, includesStack, namedIncludesStack,
+ includeProperty);
if (resolvedNode != null)
{
_addIncludedProperty(entry,
@@ -559,65 +610,127 @@ public class StyleSheetDocument
includeProperty.getLocalPropertyName());
}
}
-
+
+ // 2'. Resolve included properties in a compact selector.
+ // e.g., border: 1px solid -tr-property-ref(".AFDarkColor:alias",color);
+ Iterable<IncludeCompactPropertyNode> includedCompactProperties =
+ node.getIncludedCompactProperties();
+ for (IncludeCompactPropertyNode includeCompact : includedCompactProperties)
+ {
+ // get each IncludePropertyNode, and resolve it.
+ Iterable<IncludePropertyNode> iPNodeIter = includeCompact.getIncludedProperties();
+ List<String> resolvedValues = new ArrayList<String>();
+ for (IncludePropertyNode includeProperty : iPNodeIter)
+ {
+ StyleNode resolvedNode =
+ _resolveIncludedProperties(context, styleSheets, resolvedStyles,
+ resolvedNamedStyles, includesStack, namedIncludesStack,
+ includeProperty);
+
+ if (resolvedNode != null)
+ {
+ List<PropertyNode> pNodes = _getIncludedPropertyNodes(
+ resolvedNode,
+ includeProperty.getPropertyName(),
+ includeProperty.getLocalPropertyName());
+ // stores all the resolved 'values'. we will concat these values when we
+ // create the PropertyNode because these are compact values, like "1px solid red"
+ if (pNodes != null && !pNodes.isEmpty())
+ resolvedValues.add(pNodes.get(0).getValue());
+ }
+ }
+
+ // here we are. We have processed one IncludeCompactPropertyNode's includePropertyNodes.
+ // now we need to add to the entry:
+ String compactValue = _createCompactValue(includeCompact, resolvedValues);
+ String localName = includeCompact.getLocalPropertyName();
+ PropertyNode propertyNode = new PropertyNode(localName,
+ compactValue);
+
+ if (!(localName.startsWith(_TR_PROPERTY_PREFIX)))
+ entry.addProperty(propertyNode);
+ else
+ entry.addSkinProperty(propertyNode);
+
+ }
+
// 3. Check inhibited properties
Iterable<String> inhibitedProperties = node.getInhibitedProperties();
for (String inhibitedPropertyName : inhibitedProperties)
{
entry.removeProperty(inhibitedPropertyName);
+ entry.removeSkinProperty(inhibitedPropertyName);
}
-
+
// 4. Add non-included properties
Iterable<PropertyNode> properties = node.getProperties();
for (PropertyNode propertyNode : properties)
{
entry.addProperty(propertyNode);
+
+ }
+
+ // 5. Add non-included skin property node properties
+ Iterable<PropertyNode> skinProperties = node.getSkinProperties();
+ for (PropertyNode skinPropNode : skinProperties)
+ {
+ entry.addSkinProperty(skinPropNode);
}
+
}
}
-
- // Pop the include stack
- if (isNamed)
+ }
+
+
+ private String _createCompactValue(
+ IncludeCompactPropertyNode node,
+ List<String> values)
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append(node.getPropertyValues());
+ for(String value : values)
{
- namedIncludesStack.pop();
+ builder.append(value);
+ builder.append(" ");
}
- else
+ return builder.toString();
+ }
+
+ private StyleNode _resolveIncludedProperties(
+ StyleContext context,
+ StyleSheetList styleSheets,
+ Map<String, StyleNode> resolvedStyles,
+ Map<String, StyleNode> resolvedNamedStyles,
+ Stack<String> includesStack,
+ Stack<String> namedIncludesStack,
+ IncludePropertyNode includeProperty)
+ {
+ String includeID = null;
+ boolean includeIsNamed = false;
+
+ if (includeProperty.getName() != null)
{
- includesStack.pop();
+ includeID = includeProperty.getName();
+ includeIsNamed = true;
}
-
- StyleNode resolvedNode = entry.toStyleNode();
-
- // If we got a node, add it in to our list
- if (resolvedNode != null)
+ else
{
- // cache already resolved styles so we don't
- // resolve them again. This saves (a lot of) time.
- // TODO: AdamWiner: entry.toStyleNode() will return
- // null if it's an empty style. But that means
- // that this cache doesn't get used, so we end
- // up hammering on these. This doesn't appear
- // to be a performance issue at this time.
- String namedStyle = resolvedNode.getName();
- if (namedStyle != null)
- {
- resolvedNamedStyles.put(namedStyle, resolvedNode);
- }
- else
- {
- String selectorStyle = resolvedNode.getSelector();
- if (selectorStyle != null)
- {
- resolvedStyles.put(selectorStyle, resolvedNode);
- }
- }
+ includeID = includeProperty.getSelector();
}
- // Convert the StyleEntry to a StyleNode and return it
+ StyleNode resolvedNode = _resolveStyleNode(context,
+ styleSheets,
+ resolvedStyles,
+ resolvedNamedStyles,
+ includesStack,
+ namedIncludesStack,
+ includeID,
+ includeIsNamed);
return resolvedNode;
}
+
// Adds all of the properties from the StyleNode into the StyleEntry
// as included properties.
private void _addIncludedProperties(
@@ -633,9 +746,16 @@ public class StyleSheetDocument
{
entry.addIncludedProperty(propertyNode);
}
+
+ // server-side skin properties
+ Iterable<PropertyNode> skinProperties = node.getSkinProperties();
+ for (PropertyNode skinPropertyNode : skinProperties)
+ {
+ entry.addIncludedSkinProperty(skinPropertyNode);
+ }
}
- // Adds the specified property from the StyleNode into the StyleEntry.
+ // resolves -tr-property-ref, and adds the resolved PropertyNode to the StyleEntry.
private void _addIncludedProperty(
StyleEntry entry,
StyleNode node,
@@ -646,21 +766,135 @@ public class StyleSheetDocument
if (node == null)
return;
- Iterable<PropertyNode> properties = node.getProperties();
+
+ // localPropertyName is the value we are setting.
+ // if we have color: -tr-property-ref(".AFFoo:alias","background-color"), then
+ // localPropertyName is color.
+ if (localPropertyName != null)
+ {
+ // check to see if localPropertyName is a skin property like '-tr-show-last-item',
+ // as opposed to a regular css property like 'color' or 'font-size'.
+ if (localPropertyName.startsWith(_TR_PROPERTY_PREFIX))
+ {
+ // these are currently StyleNode propertyNodes, but they may actually be skin properties.
+ // if we have af|breadCrumbs {-tr-show-last-item: -tr-property-ref(".AFFoo:alias")},
+ // and .AFFoo:alias contains only property nodes, like color: red.
+ // this gets parsed and set on StyleNode as a IncludePropertyNode, not a SkinStyleNode,
+ // then it gets resolved as properties.
+ Iterable<PropertyNode> properties = node.getProperties();
+ List<PropertyNode> includedProperties =
+ _getIncludedProperties(propertyName, localPropertyName, properties);
+ for (PropertyNode propertyToAdd : includedProperties)
+ {
+ entry.addIncludedSkinProperty(propertyToAdd);
+ }
+
+ // most likely this block of code will run instead of the above code
+ // .AFFoo:alias {-tr-show-last-item: true;}
+ // af|breadCrumbs{-tr-show=last-item: -tr-property-ref(".AFFoo:alias");
+ // .AFFoo:alias's -tr-show-last-item is in a SkinPropertyNode, not a PropertyNode
+ Iterable<PropertyNode> skinProperties = node.getSkinProperties();
+ List<PropertyNode> includedSkinProperties =
+ _getIncludedProperties(propertyName, localPropertyName, skinProperties);
+ for (PropertyNode propertyToAdd : includedSkinProperties)
+ {
+ entry.addIncludedSkinProperty(propertyToAdd);
+ }
+
+ }
+ else
+ {
+ // regular css properties (not skin server-side properties)...
+ // loop through all the properties and find a match. then merge.
+ Iterable<PropertyNode> properties = node.getProperties();
+ List<PropertyNode> includedProperties =
+ _getIncludedProperties(propertyName, localPropertyName, properties);
+ for (PropertyNode propertyToAdd : includedProperties)
+ {
+ entry.addIncludedProperty(propertyToAdd);
+ }
+ }
+
+ }
+
+ }
+
+ // resolves -tr-property-ref, and returns the resolved PropertyNodes
+ private List<PropertyNode> _getIncludedPropertyNodes(
+ StyleNode node,
+ String propertyName,
+ String localPropertyName
+ )
+ {
+ if (node == null || localPropertyName == null)
+ return Collections.emptyList();
+
+
+ // check to see if localPropertyName is a skin property like '-tr-show-last-item',
+ // as opposed to a regular css property like 'color' or 'font-size'.
+ if (localPropertyName.startsWith(_TR_PROPERTY_PREFIX))
+ {
+ Iterable<PropertyNode> properties = node.getProperties();
+ List<PropertyNode> includedProperties =
+ _getIncludedProperties(propertyName, localPropertyName, properties);
+
+
+ // most likely this block of code will run instead of the above code
+ // .AFFoo:alias {-tr-show-last-item: true;}
+ // af|breadCrumbs{-tr-show=last-item: -tr-property-ref(".AFFoo:alias");
+ // .AFFoo:alias's -tr-show-last-item is in a SkinPropertyNode, not a PropertyNode
+ Iterable<PropertyNode> skinProperties = node.getSkinProperties();
+ List<PropertyNode> pNodes = _getIncludedProperties(propertyName, localPropertyName, skinProperties);
+ includedProperties.addAll(pNodes);
+ return includedProperties;
+
+ }
+ else
+ {
+ // regular css properties (not skin server-side properties)...
+ // loop through all the properties and find a match. then merge.
+ Iterable<PropertyNode> properties = node.getProperties();
+ List<PropertyNode> includedProperties =
+ _getIncludedProperties(propertyName, localPropertyName, properties);
+ return includedProperties;
+ }
+
+
+
+ }
+
+ // used when resolving -tr-property-ref
+ // given a list of PropertyNodes to traverse, find the one whose name matches the propertyName.
+ // then we assign the value to the localPropertyName.
+ // .AFFoo:alias {color: red} af|test {background-color: -tr-property-ref(".AFFoo:alias", "color");
+ // localPropertyName is background-color
+ // propertyName is color
+ // properties is .AFFoo:alias's properties
+ private List<PropertyNode> _getIncludedProperties(
+ String propertyName,
+ String localPropertyName,
+ Iterable<PropertyNode> properties)
+ {
+ List<PropertyNode> propertyNodesToAdd = new ArrayList<PropertyNode>();
+
for (PropertyNode property : properties)
{
+ // must first find a match of the includeProperty's propertyName
+ // and the property node's name
if (propertyName.equals(property.getName()))
{
if (!propertyName.equals(localPropertyName))
{
- property = new PropertyNode(localPropertyName,
- property.getValue());
+ property = new PropertyNode(localPropertyName, property.getValue());
}
-
- entry.addIncludedProperty(property);
+ // if propertyName is equal to localPropertyName, we can simply reuse the
+ // property node instead of creating a new PropertyNode.
+ // since we found a match, we include this PropertyNode into the entry.
+ //entry.addIncludedSkinProperty(property);
+ propertyNodesToAdd.add(property);
}
}
-
+ return propertyNodesToAdd;
}
// Returns a count of the non-null items in the List
@@ -969,6 +1203,19 @@ public class StyleSheetDocument
this.name = name;
}
+ public void addSkinProperty(PropertyNode property)
+ {
+ if (_skinProperties == null)
+ _skinProperties = new ArrayList<PropertyNode>(2);
+
+ // remove property if it already exists.
+ // We could just use a Set instead of an ArrayList, right?
+ String name = property.getName();
+ removeSkinProperty(name);
+
+ _skinProperties.add(property);
+ }
+
// Add the specified property.
// If we already have a PropertyNode with the same name as the
// property, we remove the old value, as newly added properties
@@ -1012,9 +1259,18 @@ public class StyleSheetDocument
_propertyCount--;
}
+ // Removes the skin property with the specified name
+ public void removeSkinProperty(String name)
+ {
+ if (_removeSkinProperty(_skinProperties, name))
+ _skinPropertyCount--;
+ }
+
// Clears out all properties
public void resetProperties()
{
+ _skinProperties = null;
+ _skinPropertyCount = 0;
_properties = null;
_propertyCount = 0;
_relativeFontSize = 0;
@@ -1042,6 +1298,7 @@ public class StyleSheetDocument
// Adds an "included" property. Include propreties are
// properties which are indirectly included in the style
// via an <includeStyle> element.
+ // TODO jmw Since we no longer track included properties separately, we should delete.
public void addIncludedProperty(PropertyNode property)
{
// We no longer track included properties separately.
@@ -1053,21 +1310,30 @@ public class StyleSheetDocument
addProperty(property);
}
+ public void addIncludedSkinProperty(PropertyNode skinProperty)
+ {
+ addSkinProperty(skinProperty);
+ }
+
// Converts this StyleEntry to a StyleNode
public StyleNode toStyleNode()
{
// Create an PropertyNode array to pass to the new StyleNode.
// The PropertyNode array includes both the included properties
// and the properties defined directly within this style.
- int count = _getNonNullCount(_properties);
+ int propertyCount = _getNonNullCount(_properties);
+ int skinPropertyCount = _getNonNullCount(_skinProperties);
+
- if (count == 0)
+ if (propertyCount + skinPropertyCount == 0)
return null;
- PropertyNode[] properties = new PropertyNode[count];
+ PropertyNode[] properties = new PropertyNode[propertyCount];
+ PropertyNode[] skinProperties = new PropertyNode[skinPropertyCount];
// Copy in the properties
_nonNullCopyInto(_properties, properties, 0);
+ _nonNullCopyInto(_skinProperties, skinProperties, 0);
// Adjust the font size based for relative font
if (_relativeFontSize != 0)
@@ -1085,7 +1351,8 @@ public class StyleSheetDocument
// Create and return our StyleNode. We don't need to specify
// a name or included styles, as they have already been resolved.
- return new StyleNode(name, selector, properties, null, null, null);
+ // StyleNode(name, selector, properties, skinProperties, includedStyles, includedProperties, inhibitedProperties)
+ return new StyleNode(name, selector, properties, skinProperties, null, null,null, null);
}
// Removes the PropertyNode with the specified name from the
@@ -1119,6 +1386,37 @@ public class StyleSheetDocument
return false;
}
+ // Removes the SkinPropertyNode with the specified name from the
+ // List of properties. Note - we assume that the properties
+ // List will contain at most one property with the specified
+ // name. Returns a boolean indicating whether the specified
+ // property was found (and thus removed).
+ private boolean _removeSkinProperty(
+ ArrayList<PropertyNode> properties,
+ String name)
+ {
+ if (properties == null)
+ return false;
+
+ for (int i = 0; i < properties.size(); i++)
+ {
+ PropertyNode property = properties.get(i);
+
+ if ((property != null) && property.getName().equals(name))
+ {
+ // We don't actually remove the old value, just
+ // null it out. We do this to avoid the calls
+ // to System.arraycopy() that would occur if we
+ // actually removed the property. For us, time
+ // is more important than memory usage.
+ properties.set(i, null);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
// Copies the non-null entries from the source vector to the
// target Object array, starting at the specified index
private void _nonNullCopyInto(
@@ -1301,8 +1599,14 @@ public class StyleSheetDocument
// The set of properties (PropertyNodes) defined by this style
private ArrayList<PropertyNode> _properties;
+
+ // The set of skinProperties defined by this style. These are server-side properties,
+ // like -tr-show-last-item
+ private ArrayList<PropertyNode> _skinProperties;
+
// We keep count of the number of non-null values in each vector
private int _propertyCount;
+ private int _skinPropertyCount;
// _relativeFontSize accumulates the total relative font size
// from any "font-size" properties with relative values.
@@ -1420,10 +1724,13 @@ public class StyleSheetDocument
null,
null,
null,
+ null,
+ null,
null);
// Error messages
private static final String _CIRCULAR_INCLUDE_ERROR =
"Circular dependency detected in style ";
+ private static final String _TR_PROPERTY_PREFIX = "-tr-";
private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(StyleSheetDocument.class);
}
Modified: myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNode.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNode.java?rev=1021551&r1=1021550&r2=1021551&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNode.java (original)
+++ myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNode.java Mon Oct 11 23:59:34 2010
@@ -55,7 +55,6 @@ public class StyleSheetNode
public StyleSheetNode(
StyleNode[] styles,
Collection<IconNode> icons,
- Collection<SkinPropertyNode> skinProperties,
Locale[] locales,
int direction,
Map<Integer, Set<Version>> agentVersions,
@@ -75,13 +74,6 @@ public class StyleSheetNode
else
_icons = Collections.emptyList();
-
- if (skinProperties != null)
- _skinProperties = Collections.unmodifiableList(
- new ArrayList<SkinPropertyNode>(skinProperties));
- else
- _skinProperties = Collections.emptyList();
-
// locales, browsers, versions, platforms order does not matter, so these are Sets.
if (locales != null)
{
@@ -136,18 +128,6 @@ public class StyleSheetNode
}
/**
- * Returns the SkinProperties List for this
- * StyleSheetEntry. This is a list of SkinProperyNodes
- * a node contains the selector, the -tr- property, and the value.
- * e.g, selector: af|breadCrumbs, property: -tr-show-last-item,
- * value: true
- */
- public Collection<SkinPropertyNode> getSkinProperties()
- {
- return _skinProperties;
- }
-
- /**
* Implementation of StyleSheetNode.getReadingDirection();
*/
public int getReadingDirection()
@@ -576,10 +556,6 @@ public class StyleSheetNode
private final List<StyleNode> _styles; // The styles contained within this node
private final List<IconNode> _icons; // The icons contained within this node
- // List of -tr- properties that the skin can be set on the skin.
- // This is a List of SkinPropertyNodes
- private List <SkinPropertyNode> _skinProperties;
- // Order does not matter for locales, browsers, versions, platforms
private final Set<Locale> _locales; // The locale variants
private final int _direction; // The reading direction
// The browsers mapped to their versions (multiple versions for browser supported)
Modified: myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNodeParser.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNodeParser.java?rev=1021551&r1=1021550&r2=1021551&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNodeParser.java (original)
+++ myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNodeParser.java Mon Oct 11 23:59:34 2010
@@ -106,7 +106,6 @@ public class StyleSheetNodeParser extend
return new StyleSheetNode(
styles,
null, // icons only supported in skin CSS - not XSS
- null, // properties only supported in skin CSS - not XSS
_locales,
_direction,
browsers,
Modified: myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNodeEqualsTest.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNodeEqualsTest.java?rev=1021551&r1=1021550&r2=1021551&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNodeEqualsTest.java (original)
+++ myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNodeEqualsTest.java Mon Oct 11 23:59:34 2010
@@ -165,7 +165,6 @@ public class StyleSheetNodeEqualsTest ex
StyleSheetNode styleSheetNode =
new StyleSheetNode(styleSheetOneNodes,
iconNodes,
- null,
localesArray,
0,
browsers,
@@ -175,7 +174,6 @@ public class StyleSheetNodeEqualsTest ex
StyleSheetNode anotherStyleSheetNode =
new StyleSheetNode(anotherStyleSheetOneNodes,
anotherIconNodes,
- null,
anotherLocalesArray,
0,
anotherBrowsersDiffOrder,
@@ -185,7 +183,6 @@ public class StyleSheetNodeEqualsTest ex
StyleSheetNode sameDiffOrderStyleSheetNode =
new StyleSheetNode(anotherStyleSheetOneNodes,
anotherIconNodes,
- null,
diffOrderLocalesArray,
0,
anotherBrowsersDiffOrder,
@@ -231,10 +228,11 @@ public class StyleSheetNodeEqualsTest ex
IncludePropertyNode[] defaultFontIncludeProperty =
{ new IncludePropertyNode("AFVeryDarkBackground", null, "background-color", "color") };
+ PropertyNode[] emptyNode = new PropertyNode[0];
return
- new StyleNode("AFDefaultFont", null, defaultFontPropertyNodes,
- defaultFontIncludeStyles, defaultFontIncludeProperty, null, false);
+ new StyleNode("AFDefaultFont", null, defaultFontPropertyNodes, null,
+ defaultFontIncludeStyles, defaultFontIncludeProperty, null, null, false);
}
@@ -252,8 +250,8 @@ public class StyleSheetNodeEqualsTest ex
{ new IncludePropertyNode("AFVeryDarkBackground", null, "background-color", "color") };
return
- new StyleNode("AFDefaultFont", null, defaultFontPropertyNodes,
- defaultFontIncludeStyles, defaultFontIncludeProperty, null, true);
+ new StyleNode("AFDefaultFont", null, defaultFontPropertyNodes, null,
+ defaultFontIncludeStyles, defaultFontIncludeProperty, null, null, true);
}
@@ -270,8 +268,8 @@ public class StyleSheetNodeEqualsTest ex
return
- new StyleNode(null, "af|outputLabel:error", labelPropertyNodes, labelIncludeStyles,
- null, labelInhibitedProperties, false);
+ new StyleNode(null, "af|outputLabel:error", labelPropertyNodes, null, labelIncludeStyles,
+ null, null, labelInhibitedProperties, false);
}
// returns a StyleNode that matches the outputLabelStyleNode
@@ -284,8 +282,8 @@ public class StyleSheetNodeEqualsTest ex
anotherInhibitedProperties.add("background-color");
anotherInhibitedProperties.add("font-size");
- return new StyleNode(null, "af|outputLabel:error", anotherPropertyNodes, anotherIncludeStyles,
- null, anotherInhibitedProperties, false);
+ return new StyleNode(null, "af|outputLabel:error", anotherPropertyNodes, null, anotherIncludeStyles,
+ null, null, anotherInhibitedProperties, false);
}
private Set<Locale> getLocalesSet()