You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ar...@apache.org on 2011/07/12 17:48:26 UTC
svn commit: r1145638 [1/6] - in /myfaces/trinidad/trunk:
trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/
trinidad-impl/src/main/conf/META-INF/
trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/
trinidad-impl/src/main...
Author: arobinson74
Date: Tue Jul 12 15:48:25 2011
New Revision: 1145638
URL: http://svn.apache.org/viewvc?rev=1145638&view=rev
Log:
TRINIDAD-2111 -- Committing patch from Anand Nath
Added:
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/CasablancaTabletSkin.java (with props)
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/SimpleTabletSkin.java (with props)
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/tablet/
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/tablet/TabletRenderKit.java (with props)
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/simple/tablet/
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/simple/tablet/SimpleTabletUtils.java (with props)
myfaces/trinidad/trunk/trinidad-impl/src/main/resources/META-INF/adf/styles/casablanca-base.css (with props)
myfaces/trinidad/trunk/trinidad-impl/src/main/resources/META-INF/adf/styles/casablanca-tablet.css (with props)
myfaces/trinidad/trunk/trinidad-impl/src/main/resources/META-INF/adf/styles/simple-tablet.css (with props)
Modified:
myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/Agent.java
myfaces/trinidad/trunk/trinidad-impl/src/main/conf/META-INF/faces-config-base.xml
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentNameUtil.java
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/TrinidadAgent.java
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/TrinidadRenderingConstants.java
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinUtils.java
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/LookAndFeelManager.java
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/SimpleDesktopConstants.java
myfaces/trinidad/trunk/trinidad-impl/src/main/resources/META-INF/adf/styles/base-desktop.css
myfaces/trinidad/trunk/trinidad-impl/src/main/resources/META-INF/adf/styles/casablancaSkin.css
myfaces/trinidad/trunk/trinidad-impl/src/main/resources/META-INF/adf/styles/simple-desktop.css
Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/Agent.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/Agent.java?rev=1145638&r1=1145637&r2=1145638&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/Agent.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/Agent.java Tue Jul 12 15:48:25 2011
@@ -66,6 +66,12 @@ public interface Agent
*/
public static final Object TYPE_WEBCRAWLER = "webcrawler";
+
+ /**
+ * Constant for tablet devices
+ */
+ public static final Object TYPE_TABLET = "tablet";
+
/**
* Constant for unknown platform
*/
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/conf/META-INF/faces-config-base.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/conf/META-INF/faces-config-base.xml?rev=1145638&r1=1145637&r2=1145638&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/conf/META-INF/faces-config-base.xml (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/conf/META-INF/faces-config-base.xml Tue Jul 12 15:48:25 2011
@@ -124,6 +124,11 @@
<render-kit-class>org.apache.myfaces.trinidadinternal.renderkit.core.desktop.DesktopRenderKit</render-kit-class>
</render-kit>
+ <render-kit>
+ <render-kit-id>org.apache.myfaces.trinidad.core.tablet</render-kit-id>
+ <render-kit-class>org.apache.myfaces.trinidadinternal.renderkit.core.tablet.TabletRenderKit</render-kit-class>
+ </render-kit>
+
<render-kit>
<render-kit-id>org.apache.myfaces.trinidad.core.pda</render-kit-id>
<render-kit-class>org.apache.myfaces.trinidadinternal.renderkit.core.pda.PdaRenderKit</render-kit-class>
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java?rev=1145638&r1=1145637&r2=1145638&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java Tue Jul 12 15:48:25 2011
@@ -707,7 +707,7 @@ public class AgentFactoryImpl implements
// We need the rv to support @agent versioning in CSS as the date makes no sense,
// so look for the rv:, not the Gecko build date
- agentObj.setType(Agent.TYPE_DESKTOP);
+ _populateAgentType(agent, agentObj);
agentObj.setAgent(Agent.AGENT_GECKO);
int start = agent.indexOf("rv:");
@@ -878,7 +878,9 @@ public class AgentFactoryImpl implements
}
String version = _getVersion(agent, start);
- agentObj.setType(Agent.TYPE_DESKTOP);
+
+ _populateAgentType(agent, agentObj);
+
if ((agent.indexOf("Symbian") > -1) || (agent.indexOf("Nokia") > -1))
{
agentObj.setAgent(Agent.AGENT_NOKIA_S60);
@@ -891,6 +893,19 @@ public class AgentFactoryImpl implements
agentObj.setAgentVersion(version);
}
+ private void _populateAgentType(String agent, AgentImpl agentObj) {
+ if (agent.contains("WebKit") &&
+ (agent.contains("Android") || agent.contains("iPad")
+ || agent.contains("iPhone") || agent.contains("iPod")))
+ {
+ agentObj.setType(Agent.TYPE_TABLET);
+ }
+ else
+ {
+ agentObj.setType(Agent.TYPE_DESKTOP);
+ }
+ }
+
/**
* Returns an AgentEntry for the "Mozilla" family of browsers - which
* most at least pretend to be.
@@ -898,7 +913,7 @@ public class AgentFactoryImpl implements
private void _populateMozillaAgentImpl(String agent,AgentImpl agentObj)
{
int paren = agent.indexOf('(');
- agentObj.setType(Agent.TYPE_DESKTOP); //Is this default realli okay??? These days Mobile agents also use Mozilla/xx.xx
+ _populateAgentType(agent, agentObj);
// No section to qualify the agent; assume Mozilla/Netscape
if (paren == -1)
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentNameUtil.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentNameUtil.java?rev=1145638&r1=1145637&r2=1145638&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentNameUtil.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentNameUtil.java Tue Jul 12 15:48:25 2011
@@ -117,6 +117,11 @@ public class AgentNameUtil
return TrinidadAgent.TYPE_WEBCRAWLER;
}
+ if (otype == Agent.TYPE_TABLET)
+ {
+ return TrinidadAgent.TYPE_TABLET;
+ }
+
//Default to desktop (This is UIX 2.2 logic)
return TrinidadAgent.TYPE_DESKTOP;
}
@@ -173,6 +178,8 @@ public class AgentNameUtil
return Agent.TYPE_PDA;
case TrinidadAgent.TYPE_PHONE:
return Agent.TYPE_PHONE;
+ case TrinidadAgent.TYPE_TABLET:
+ return Agent.TYPE_TABLET;
case TrinidadAgent.TYPE_VOICE:
default:
return Agent.TYPE_UNKNOWN;
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/TrinidadAgent.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/TrinidadAgent.java?rev=1145638&r1=1145637&r2=1145638&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/TrinidadAgent.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/TrinidadAgent.java Tue Jul 12 15:48:25 2011
@@ -285,6 +285,11 @@ public abstract class TrinidadAgent impl
static public final int TYPE_WEBCRAWLER = 4;
/**
+ * Application constant for tablet devices
+ */
+ static public final int TYPE_TABLET = 5;
+
+ /**
* Enumeration representing an Application
*/
public static enum Application
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java?rev=1145638&r1=1145637&r2=1145638&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java Tue Jul 12 15:48:25 2011
@@ -139,6 +139,8 @@ public class CoreRenderKit extends Rende
Agent agent = afc.getAgent();
if (Agent.TYPE_PDA.equals(agent.getType()))
return "org.apache.myfaces.trinidad.core.pda";
+ if (Agent.TYPE_TABLET.equals(agent.getType()))
+ return "org.apache.myfaces.trinidad.core.tablet";
}
return "org.apache.myfaces.trinidad.core.desktop";
}
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java?rev=1145638&r1=1145637&r2=1145638&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java Tue Jul 12 15:48:25 2011
@@ -626,6 +626,10 @@ public class CoreRenderingContext extend
// get rid of this bit of code. Should we use getViewRoot().getRenderKitId() instead?
renderKitId = TrinidadRenderingConstants.APACHE_TRINIDAD_PDA;
}
+ else if (TrinidadAgent.TYPE_TABLET == _agent.getAgentType())
+ {
+ renderKitId = TrinidadRenderingConstants.APACHE_TRINIDAD_TABLET;
+ }
SkinFactory factory = SkinFactory.getFactory();
Added: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/CasablancaTabletSkin.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/CasablancaTabletSkin.java?rev=1145638&view=auto
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/CasablancaTabletSkin.java (added)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/CasablancaTabletSkin.java Tue Jul 12 15:48:25 2011
@@ -0,0 +1,52 @@
+/*
+ * 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.renderkit.core.skin;
+
+import org.apache.myfaces.trinidad.skin.Skin;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.TrinidadRenderingConstants;
+import org.apache.myfaces.trinidadinternal.skin.SkinExtension;
+
+/**
+ * Class for the Casablanca desktop skin
+ */
+public class CasablancaTabletSkin extends SkinExtension {
+
+ /**
+ * Constructs a CasablancaDesktopSkin instance
+ */
+ public CasablancaTabletSkin(Skin baseSkin)
+ {
+ // Create a SkinExtension for Casablanca
+ super(baseSkin,
+ _CASABLANCA_TABLET_ID,
+ TrinidadRenderingConstants.CASABLANCA_SKIN_FAMILY,
+ TrinidadRenderingConstants.APACHE_TRINIDAD_TABLET);
+
+ // Register our style sheet
+ setStyleSheetName(_CASABLANCA_STYLE_SHEET_NAME);
+ }
+
+ // Casablanca skin id
+ private static final String _CASABLANCA_TABLET_ID = "casablanca.tablet";
+
+
+ // Casablanca skin style sheet name
+ private static final String _CASABLANCA_STYLE_SHEET_NAME =
+ "META-INF/adf/styles/casablanca-tablet.css";
+}
Propchange: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/CasablancaTabletSkin.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/SimpleTabletSkin.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/SimpleTabletSkin.java?rev=1145638&view=auto
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/SimpleTabletSkin.java (added)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/SimpleTabletSkin.java Tue Jul 12 15:48:25 2011
@@ -0,0 +1,75 @@
+/*
+ * 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.renderkit.core.skin;
+
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlConstants;
+
+
+/**
+ * Skin implementation for simple tablet
+ *
+ * @version
+ */
+public class SimpleTabletSkin extends BaseDesktopSkin
+{
+
+ /**
+ * Constructs a SimpleDesktopSkin instance
+ */
+ public SimpleTabletSkin()
+ {
+ }
+
+ /**
+ * Returns the name of the XSS style sheet for this Skin.
+ */
+ @Override
+ public String getStyleSheetName()
+ {
+ return "META-INF/adf/styles/simple-tablet.css";
+ }
+
+ /**
+ * Returns the id of this simple desktop Skin "simple.tablet".
+ */
+ @Override
+ public String getId()
+ {
+ return "simple.tablet";
+ }
+
+ /**
+ * Returns the family for the Simple
+ * Skin: "simple".
+ */
+ @Override
+ public String getFamily()
+ {
+ return "simple";
+ }
+
+ /**
+ * Returns the renderKitId for the SimpleDesktopSkin: "org.apache.myfaces.trinidad.tablet".
+ */
+ @Override
+ public String getRenderKitId()
+ {
+ return XhtmlConstants.APACHE_TRINIDAD_TABLET;
+ }
+}
Propchange: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/SimpleTabletSkin.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/tablet/TabletRenderKit.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/tablet/TabletRenderKit.java?rev=1145638&view=auto
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/tablet/TabletRenderKit.java (added)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/tablet/TabletRenderKit.java Tue Jul 12 15:48:25 2011
@@ -0,0 +1,28 @@
+/*
+ * 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.renderkit.core.tablet;
+
+import org.apache.myfaces.trinidadinternal.renderkit.core.desktop.DesktopRenderKit;
+
+public class TabletRenderKit extends DesktopRenderKit
+{
+ public TabletRenderKit()
+ {
+ }
+}
Propchange: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/tablet/TabletRenderKit.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/TrinidadRenderingConstants.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/TrinidadRenderingConstants.java?rev=1145638&r1=1145637&r2=1145638&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/TrinidadRenderingConstants.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/TrinidadRenderingConstants.java Tue Jul 12 15:48:25 2011
@@ -187,6 +187,8 @@ public final class TrinidadRenderingCons
"org.apache.myfaces.trinidad.desktop";
public static final String APACHE_TRINIDAD_PDA =
"org.apache.myfaces.trinidad.pda";
+ public static final String APACHE_TRINIDAD_TABLET =
+ "org.apache.myfaces.trinidad.tablet";
public static final String APACHE_TRINIDAD_PORTLET =
CoreRenderKit.OUTPUT_MODE_PORTLET;
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java?rev=1145638&r1=1145637&r2=1145638&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java Tue Jul 12 15:48:25 2011
@@ -252,7 +252,9 @@ public final class XhtmlConstants
"org.apache.myfaces.trinidad.desktop";
public static final String APACHE_TRINIDAD_PDA =
"org.apache.myfaces.trinidad.pda";
- public static final String APACHE_TRINIDAD_PORTLET =
+ public static final String APACHE_TRINIDAD_TABLET =
+ "org.apache.myfaces.trinidad.tablet";
+ public static final String APACHE_TRINIDAD_PORTLET =
CoreRenderKit.OUTPUT_MODE_PORTLET;
/** Unicode character for non-breaking space */
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java?rev=1145638&r1=1145637&r2=1145638&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java Tue Jul 12 15:48:25 2011
@@ -201,6 +201,8 @@ public class SkinFactoryImpl extends Ski
matchingSkin = getSkin(context, _SIMPLE_PORTLET);
else if (renderKitId.equals(XhtmlConstants.APACHE_TRINIDAD_PDA))
matchingSkin = getSkin(context, _SIMPLE_PDA);
+ else if (renderKitId.equals(XhtmlConstants.APACHE_TRINIDAD_TABLET))
+ matchingSkin = getSkin(context, _SIMPLE_TABLET);
else
matchingSkin = getSkin(context, _SIMPLE_DESKTOP);
}
@@ -315,6 +317,7 @@ public class SkinFactoryImpl extends Ski
static private final String _SIMPLE_PDA = "simple.pda";
static private final String _SIMPLE_DESKTOP = "simple.desktop";
+ static private final String _SIMPLE_TABLET = "simple.tablet";
static private final String _SIMPLE_PORTLET = "simple.portlet";
static private final String _DEFAULT = "default";
static private final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(SkinFactoryImpl.class);
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinUtils.java?rev=1145638&r1=1145637&r2=1145638&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinUtils.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinUtils.java Tue Jul 12 15:48:25 2011
@@ -6,9 +6,9 @@
* 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
@@ -53,12 +53,14 @@ import org.apache.myfaces.trinidadintern
import org.apache.myfaces.trinidadinternal.renderkit.core.skin.CasablancaDesktopSkin;
import org.apache.myfaces.trinidadinternal.renderkit.core.skin.CasablancaPdaSkin;
import org.apache.myfaces.trinidadinternal.renderkit.core.skin.CasablancaPortletSkin;
+import org.apache.myfaces.trinidadinternal.renderkit.core.skin.CasablancaTabletSkin;
import org.apache.myfaces.trinidadinternal.renderkit.core.skin.MinimalDesktopSkinExtension;
import org.apache.myfaces.trinidadinternal.renderkit.core.skin.MinimalPdaSkinExtension;
import org.apache.myfaces.trinidadinternal.renderkit.core.skin.MinimalPortletSkinExtension;
import org.apache.myfaces.trinidadinternal.renderkit.core.skin.SimpleDesktopSkin;
import org.apache.myfaces.trinidadinternal.renderkit.core.skin.SimplePdaSkin;
import org.apache.myfaces.trinidadinternal.renderkit.core.skin.SimplePortletSkin;
+import org.apache.myfaces.trinidadinternal.renderkit.core.skin.SimpleTabletSkin;
import org.apache.myfaces.trinidadinternal.share.xml.ClassParserFactory;
import org.apache.myfaces.trinidadinternal.share.xml.ParseContextImpl;
import org.apache.myfaces.trinidadinternal.share.xml.ParserFactory;
@@ -105,11 +107,11 @@ public class SkinUtils
_registerTrinidadSkins(skinFactory);
}
-
+
/**
* Register any custom skin extensions (and skin-additions) found in the
* trinidad-skins.xml file with the SkinFactory.
- *
+ *
* Make sure the SkinFactory.getFactory() does not return null before
* calling this method.
* You should call registerBaseSkins() before calling this method.
@@ -209,7 +211,7 @@ public class SkinUtils
* is null.
*/
/**
- *
+ *
* @param provider an XMLProvider implementation.
* @param resolver A NameResolver that can be used to locate
* resources, such as source images for colorized
@@ -228,7 +230,7 @@ public class SkinUtils
String configFile
)
{
-
+
if (inputStream == null)
throw new NullPointerException(_LOG.getMessage(
"NO_INPUTSTREAM"));
@@ -240,8 +242,8 @@ public class SkinUtils
{
InputSource input = new InputSource();
input.setByteStream(inputStream);
- input.setPublicId(configFile);
-
+ input.setPublicId(configFile);
+
ParseContextImpl context = new ParseContextImpl();
// Set up the NameResolver if we have one
@@ -252,7 +254,7 @@ public class SkinUtils
TreeBuilder builder = new TreeBuilder(parserManager,
SkinsNode.class);
skinsNode = ((SkinsNode)builder.parse(provider, input, context));
-
+
}
catch (Exception e)
{
@@ -284,7 +286,7 @@ public class SkinUtils
// Register top-level factory
_registerFactory(manager, SkinsNode.class, "SkinsNode");
-
+
// Register skin node factory and skin addition node factory
_registerFactory(manager, SkinNode.class, "SkinNode");
_registerFactory(manager, SkinAdditionNode.class, "SkinAdditionNode");
@@ -334,12 +336,16 @@ public class SkinUtils
SimplePdaSkin simplePdaSkin = new SimplePdaSkin();
skinFactory.addSkin(simplePdaSkin.getId(), simplePdaSkin);
+
+ SimpleTabletSkin simpleTabletSkin = new SimpleTabletSkin();
+ skinFactory.addSkin(simpleTabletSkin.getId(), simpleTabletSkin);
+
//portlet skin maps most of our style classes to portlet style classes,
// so we output portlet style classes.
// It also clears out the portlet style class definitions.
SimplePortletSkin simplePortletSkin = new SimplePortletSkin();
skinFactory.addSkin(simplePortletSkin.getId(), simplePortletSkin);
-
+
MinimalDesktopSkinExtension minimalDesktopSkin =
new MinimalDesktopSkinExtension(simpleDesktopSkin);
skinFactory.addSkin(minimalDesktopSkin.getId(), minimalDesktopSkin);
@@ -347,14 +353,17 @@ public class SkinUtils
MinimalPdaSkinExtension minimalPdaSkin =
new MinimalPdaSkinExtension(simplePdaSkin);
skinFactory.addSkin(minimalPdaSkin.getId(), minimalPdaSkin);
-
- MinimalPortletSkinExtension minimalPortletSkin =
+
+ MinimalPortletSkinExtension minimalPortletSkin =
new MinimalPortletSkinExtension(simplePortletSkin);
skinFactory.addSkin(minimalPortletSkin.getId(), minimalPortletSkin);
CasablancaDesktopSkin casablancaDesktopSkin = new CasablancaDesktopSkin(simpleDesktopSkin);
skinFactory.addSkin(casablancaDesktopSkin.getId(), casablancaDesktopSkin);
+ CasablancaTabletSkin casablancaTabletSkin = new CasablancaTabletSkin(simpleTabletSkin);
+ skinFactory.addSkin(casablancaTabletSkin.getId(), casablancaTabletSkin);
+
CasablancaPdaSkin casablancaPdaSkin = new CasablancaPdaSkin(simplePdaSkin);
skinFactory.addSkin(casablancaPdaSkin.getId(), casablancaPdaSkin);
@@ -365,7 +374,7 @@ public class SkinUtils
/**
* Parse the trinidad-skins.xml file for SkinExtensions and SkinAdditionNodes and add each
* SkinExtension to the skinFactory and each SkinAddition to its skin.
- * First find all the trinidad-skins.xml files that are in META-INF directory, and
+ * First find all the trinidad-skins.xml files that are in META-INF directory, and
* add those skins and skin additions.
* Then find the WEB-INF/trinidad-skins.xml file and add those skins and skin additions.
* The skins are ordered so that the 'extended' skins are registered before the skins that extend
@@ -379,12 +388,12 @@ public class SkinUtils
{
if (context == null)
return;
-
- // Add META-INF/trinidad-skins.xml skins to skin factory. (sorted first to make sure
+
+ // Add META-INF/trinidad-skins.xml skins to skin factory. (sorted first to make sure
// we register the most 'base' skins first)
if (_LOG.isFine()) _LOG.fine("Parse META-INF/trinidad-skins.xml files");
List<SkinsNode> metaInfSkinsNodeList = _getMetaInfSkinsNodeList();
- // Go through each SkinsNode object
+ // Go through each SkinsNode object
// (contains List of SkinNodes and List of SkinAdditionNodes)
// and return a List of the SkinNodes.
List<SkinNode> metaInfSkinNodes = new ArrayList<SkinNode>();
@@ -393,31 +402,31 @@ public class SkinUtils
List<SkinNode> skinNodes = skinsNode.getSkinNodes();
if (skinNodes != null)
metaInfSkinNodes.addAll(skinNodes);
- }
-
+ }
+
List<SkinNode> sortedMetaInfSkinNodes = _sortSkinNodes(skinFactory, metaInfSkinNodes);
-
+
for (SkinNode skinNode : sortedMetaInfSkinNodes)
{
_addSkinToFactory(skinFactory, skinNode, true);
}
-
- // Add WEB-INF/trinidad-skins.xml skins to skin factory. (sorted first)
+
+ // Add WEB-INF/trinidad-skins.xml skins to skin factory. (sorted first)
if (_LOG.isFine()) _LOG.fine("Parse WEB-INF/trinidad-skins.xml files");
SkinsNode webInfSkinsNode = _getWebInfSkinsNode(context);
if (webInfSkinsNode != null)
{
List<SkinNode> webInfSkinNodes = webInfSkinsNode.getSkinNodes();
-
+
List<SkinNode> sortedWebInfSkinNodes = _sortSkinNodes(skinFactory, webInfSkinNodes);
-
+
// register skins found in webInfSkinNodes
for (SkinNode skinNode : sortedWebInfSkinNodes)
{
_addSkinToFactory(skinFactory, skinNode, false);
}
}
-
+
// register all the skin additions from META-INF trinidad-skins.xml and WEB-INF
// trinidad-skins.xml that we have stored in the metaInfSkinsNodeList object and the
// webInfSkinsNode object
@@ -432,12 +441,12 @@ public class SkinUtils
if (webInfSkinsNode != null)
{
List<SkinAdditionNode> skinAdditionNodeList = webInfSkinsNode.getSkinAdditionNodes();
- _registerSkinAdditions(fContext, skinFactory, skinAdditionNodeList, false);
+ _registerSkinAdditions(fContext, skinFactory, skinAdditionNodeList, false);
}
-
+
_registerTrinidadSkinsFromSkinResourceLoaderServices(context, skinFactory);
-
-
+
+
}
// this finds the trinidad-skins.xml files by calling findResource on any SkinResourceLoader
@@ -454,27 +463,27 @@ public class SkinUtils
if (urlProviders != null && !urlProviders.isEmpty())
{
List<SkinsNode> additionalSkins = _getAdditionalTrinidadSkins(context, urlProviders);
-
- // Go through each SkinsNode object
+
+ // Go through each SkinsNode object
// (contains List of SkinNodes and List of SkinAdditionNodes)
// and return a List of the SkinNodes.
List<SkinNode> additionalSkinNodeList = new ArrayList<SkinNode>();
for (SkinsNode skinsNode : additionalSkins)
{
additionalSkinNodeList.addAll(skinsNode.getSkinNodes());
- }
-
+ }
+
List<SkinNode> sortedAdditionalSkinNodes = _sortSkinNodes(skinFactory, additionalSkinNodeList);
-
+
for (SkinNode skinNode : sortedAdditionalSkinNodes)
{
if (_LOG.isFine()) _LOG.fine("Skin {0} with stylesheet {1}",
new Object[]{skinNode.getId(), skinNode.getStyleSheetName()});
_addSkinToFactory(skinFactory, skinNode, false);
- }
+ }
}
}
-
+
/**
* Given the a List of SkinNodes, sort them so that the SkinNodes in such a way so that
* when we register the skins we make sure that the 'base' skins are registered before
@@ -494,7 +503,7 @@ public class SkinUtils
{
baseSkinIds.add(i.next());
}
-
+
// first, the skins that don't extend anything
for (SkinNode skinNode : skinNodes)
{
@@ -506,17 +515,17 @@ public class SkinUtils
skinNodesAdded.add(skinNode.getId());
}
}
-
+
// second, the skins that extend another skin
_sortSkinNodesWithExtensions(skinNodes, sortedSkinNodes, skinNodesAdded, baseSkinIds, 0);
-
+
return sortedSkinNodes;
-
+
}
-
+
/**
* This sorts SkinNodes that have their 'extends' value set, which means the skin
- * extends another skin. The order of our skin nodes matters in this case. We want the
+ * extends another skin. The order of our skin nodes matters in this case. We want the
* base skin to be registered first.
* @param skinNodes
* @param sortedSkinNodes
@@ -531,7 +540,7 @@ public class SkinUtils
int originalLeftOverListSize)
{
List<SkinNode> leftOverList = new ArrayList<SkinNode>();
-
+
for (SkinNode skinNode : skinNodes)
{
String skinExtends = skinNode.getSkinExtends();
@@ -545,24 +554,24 @@ public class SkinUtils
skinNodesAdded.add(skinNode.getId());
}
else
- {
+ {
// left over, put in a left-over list
leftOverList.add(skinNode);
- }
+ }
}
- }
- if ((originalLeftOverListSize > 0) &&
+ }
+ if ((originalLeftOverListSize > 0) &&
(leftOverList.size() == originalLeftOverListSize))
{
// Ok, we are left with skinNodes that cannot be registered because the skin they extend is
- // not in the skinNodesAdded List. The skin they extend might not exist at all, or
+ // not in the skinNodesAdded List. The skin they extend might not exist at all, or
// there is a circular dependency.
// So..., just add these to the list. When we register these, they will cause a severe error
// and the default base skin will be used.
StringBuffer buffer = new StringBuffer();
for (SkinNode leftOverNode : leftOverList)
{
- buffer.append("Skin with id: " + leftOverNode.getId() +
+ buffer.append("Skin with id: " + leftOverNode.getId() +
" extends skin with id: " + leftOverNode.getSkinExtends() + "\n");
sortedSkinNodes.add(leftOverNode);
skinNodesAdded.add(leftOverNode.getId());
@@ -570,23 +579,23 @@ public class SkinUtils
}
_LOG.warning("The following skins extend each other in a circular " +
"fashion or the skin they extend does not exist.\n" + buffer.toString());
-
- }
- else if (leftOverList.size() > 0)
+
+ }
+ else if (leftOverList.size() > 0)
{
- _sortSkinNodesWithExtensions(leftOverList, sortedSkinNodes,
- skinNodesAdded, baseSkinIds, leftOverList.size());
+ _sortSkinNodesWithExtensions(leftOverList, sortedSkinNodes,
+ skinNodesAdded, baseSkinIds, leftOverList.size());
}
}
-
+
/**
- * Given a skinNode, create a Skin object and
+ * Given a skinNode, create a Skin object and
* register the SkinExtension object with the skinFactory
* @param skinFactory
* @param skinNode
*/
private static void _addSkinToFactory(
- SkinFactory skinFactory,
+ SkinFactory skinFactory,
SkinNode skinNode,
boolean isMetaInfFile)
{
@@ -597,12 +606,12 @@ public class SkinUtils
String family = skinNode.getFamily();
String styleSheetName = skinNode.getStyleSheetName();
String bundleName = skinNode.getBundleName();
- String translationSourceExpression =
+ String translationSourceExpression =
skinNode.getTranslationSourceExpression();
SkinVersionNode skinVersionNode = skinNode.getSkinVersionNode();
-
+
SkinVersion skinVersion = _createSkinVersion(skinVersionNode);
-
+
if (renderKitId == null)
renderKitId = _RENDER_KIT_ID_DESKTOP;
@@ -610,16 +619,16 @@ public class SkinUtils
// figure out the base skin.
Skin baseSkin = null;
String skinExtends = skinNode.getSkinExtends();
-
+
if (skinExtends != null)
baseSkin = skinFactory.getSkin(null, skinExtends);
if (baseSkin == null)
{
baseSkin = _getDefaultBaseSkin(skinFactory, renderKitId);
-
+
if (skinExtends != null)
{
- _LOG.severe("UNABLE_LOCATE_BASE_SKIN",
+ _LOG.severe("UNABLE_LOCATE_BASE_SKIN",
new String[]{skinExtends, id, family, renderKitId, baseSkin.getId()});
}
@@ -634,7 +643,7 @@ public class SkinUtils
if (isMetaInfFile)
styleSheetName = _prependMetaInf(styleSheetName);
}
- // If bundleName and translationSourceExpression are both set, then we
+ // If bundleName and translationSourceExpression are both set, then we
// only use the bundleName. An error was already logged during trinidad-skins
// parsing.
@@ -650,17 +659,17 @@ public class SkinUtils
renderKitId,
styleSheetName,
bundleName,
- skinVersion);
+ skinVersion);
}
else
{
ValueExpression translationSourceVE = null;
if (translationSourceExpression != null)
{
- translationSourceVE =
+ translationSourceVE =
_createTranslationSourceValueExpression(translationSourceExpression);
}
-
+
if (translationSourceVE != null)
{
skin = new SkinExtension(baseSkin,
@@ -669,7 +678,7 @@ public class SkinUtils
renderKitId,
styleSheetName,
translationSourceVE,
- skinVersion);
+ skinVersion);
}
else
{
@@ -678,32 +687,32 @@ public class SkinUtils
family,
renderKitId,
styleSheetName,
- skinVersion);
+ skinVersion);
}
}
-
+
// Create a SkinExtension object and register skin with factory
- skinFactory.addSkin(id, skin);
+ skinFactory.addSkin(id, skin);
}
-
+
private static ValueExpression
_createTranslationSourceValueExpression(
String translationSourceExpression)
- {
+ {
if (translationSourceExpression != null)
{
translationSourceExpression = translationSourceExpression.trim();
-
- return LazyValueExpression.createValueExpression(translationSourceExpression,
+
+ return LazyValueExpression.createValueExpression(translationSourceExpression,
Object.class);
}
else
return null;
}
-
+
// Create a SkinVersion object from the SkinVersionNode object.
private static SkinVersion _createSkinVersion(SkinVersionNode skinVersionNode)
{
@@ -719,9 +728,9 @@ public class SkinUtils
else
return SkinVersion.EMPTY_SKIN_VERSION;
}
-
+
/**
- * Get the WEB-INF/trinidad-skins.xml file, parse it, and return a List of SkinsNode objects.
+ * Get the WEB-INF/trinidad-skins.xml file, parse it, and return a List of SkinsNode objects.
* @param context ServletContext used to getResourceAsStream
* @return List of SkinNodes (skin elements) found in trinidad-skins.xml
*/
@@ -731,18 +740,18 @@ public class SkinUtils
InputStream in = context.getResourceAsStream(_CONFIG_FILE);
if (in != null)
{
- SkinsNode webInfSkinsNode =
+ SkinsNode webInfSkinsNode =
_getSkinsNodeFromInputStream(null, null, in, _getDefaultManager(), _CONFIG_FILE);
if (_LOG.isFine())
{
for (SkinNode node : webInfSkinsNode.getSkinNodes())
{
- _LOG.fine("Skin {0} with stylesheet {1}",
+ _LOG.fine("Skin {0} with stylesheet {1}",
new Object[]{node.getId(), node.getStyleSheetName()});
}
for (SkinAdditionNode node: webInfSkinsNode.getSkinAdditionNodes())
{
- _LOG.fine("SkinAddition {0} with stylesheet {1}",
+ _LOG.fine("SkinAddition {0} with stylesheet {1}",
new Object[]{node.getSkinId(), node.getStyleSheetName()});
}
@@ -754,36 +763,36 @@ public class SkinUtils
return null;
}
}
-
+
/**
* Get all the META-INF/trinidad-skins.xml files, parse them, and from each file we get
* a SkinsNode object -- the information inside the <skins> element -- each skin
* and each skin-addition.
- * @return Each SkinsNode object we get from each META-INF/trinidad-skins.xml file,
+ * @return Each SkinsNode object we get from each META-INF/trinidad-skins.xml file,
* in a List<SkinsNode>.
*/
private static List<SkinsNode> _getMetaInfSkinsNodeList()
{
-
- List<SkinsNode> allSkinsNodes = new ArrayList<SkinsNode>();
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
+
+ List<SkinsNode> allSkinsNodes = new ArrayList<SkinsNode>();
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
try
{
-
+
Enumeration<URL> urls = loader.getResources(_META_INF_CONFIG_FILE);
Set<String> urlPaths = new HashSet<String>(16);
-
+
while (urls.hasMoreElements())
{
URL url = urls.nextElement();
-
+
// if url matches one we've already processed, skip it
boolean successfullyAdded = urlPaths.add(url.getPath());
// _processTrinidadSkinsURL logs the url we are processing
_processTrinidadSkinsURL(allSkinsNodes, url, successfullyAdded);
-
-
+
+
}
}
catch (IOException e)
@@ -791,10 +800,10 @@ public class SkinUtils
_LOG.severe("ERR_LOADING_FILE", _META_INF_CONFIG_FILE);
_LOG.severe(e);
}
-
+
return allSkinsNodes;
- }
-
+ }
+
private static Skin _getDefaultBaseSkin(
SkinFactory factory,
String renderKitId)
@@ -812,9 +821,9 @@ public class SkinUtils
return baseSkin;
}
-
- // register the META-INF skin additions.
- // It should not matter what order we process skin-additions since they should not
+
+ // register the META-INF skin additions.
+ // It should not matter what order we process skin-additions since they should not
// depend upon one another.
// We sort them by style-sheet-name so the StyleSheetDocumentId will be the same regardless
// of order. Portals are using the styleSheetDocumentId to determine if the producer's skin
@@ -825,16 +834,16 @@ public class SkinUtils
List<SkinsNode> metaInfSkinsNodeList)
{
List<SkinAdditionNode> skinAdditionNodeList = new ArrayList<SkinAdditionNode>();
-
+
for (SkinsNode skinsNode : metaInfSkinsNodeList)
{
skinAdditionNodeList.addAll(skinsNode.getSkinAdditionNodes());
- }
-
+ }
+
Collections.sort(skinAdditionNodeList);
_registerSkinAdditions(fContext, skinFactory, skinAdditionNodeList, true);
}
-
+
/**
* Get the skin id and other information from each SkinAdditionNode and
* get the skin and register the SkinAddition with the skin
@@ -856,12 +865,12 @@ public class SkinUtils
String skinId = skinAdditionNode.getSkinId();
String styleSheetName = skinAdditionNode.getStyleSheetName();
String resourceBundleName = skinAdditionNode.getResourceBundleName();
- String translationSourceExpression =
+ String translationSourceExpression =
skinAdditionNode.getTranslationSourceExpression();
Skin skin = skinFactory.getSkin(fContext, skinId);
- if (skin != null
- && ((styleSheetName != null)
+ if (skin != null
+ && ((styleSheetName != null)
|| (resourceBundleName != null)
|| (translationSourceExpression != null)))
{
@@ -873,10 +882,10 @@ public class SkinUtils
SkinAddition addition = null;
-
+
if (resourceBundleName != null)
{
- // create SkinAddition with resourceBundleName
+ // create SkinAddition with resourceBundleName
addition = new SkinAddition(styleSheetName, resourceBundleName);
}
else
@@ -884,28 +893,28 @@ public class SkinUtils
ValueExpression translationSourceVE = null;
if (translationSourceExpression != null)
{
- translationSourceVE =
+ translationSourceVE =
_createTranslationSourceValueExpression(translationSourceExpression);
}
-
+
if (translationSourceVE != null)
{
- // Create a SkinAddition with translationSourceVE
+ // Create a SkinAddition with translationSourceVE
addition = new SkinAddition(styleSheetName, translationSourceVE);
}
else
{
- // Create a SkinAddition with stylesheetName only
+ // Create a SkinAddition with stylesheetName only
addition = new SkinAddition(styleSheetName);
}
}
-
+
skin.addSkinAddition(addition);
}
- }
+ }
}
/**
@@ -920,15 +929,15 @@ public class SkinUtils
else
return styleSheetName;
}
-
+
// register skins found in DT using the META-INF/services
private static List<SkinsNode> _getAdditionalTrinidadSkins(
ExternalContext context,
List<SkinResourceLoader> providers)
{
Set<String> urlPaths = new HashSet<String>(16);
- List<SkinsNode> allSkinsNodes = new ArrayList<SkinsNode>();
-
+ List<SkinsNode> allSkinsNodes = new ArrayList<SkinsNode>();
+
for (SkinResourceLoader urlProvider : providers )
{
@@ -955,7 +964,7 @@ public class SkinUtils
}
}
}
-
+
return allSkinsNodes;
}
@@ -979,7 +988,7 @@ public class SkinUtils
else
{
if (_LOG.isFine()) _LOG.fine("Processing skin URL:{0}", url);
-
+
URLConnection urlConnection = url.openConnection();
// prevent caching during DT where the source may change...
if (Beans.isDesignTime())
@@ -997,20 +1006,20 @@ public class SkinUtils
_getSkinsNodeFromInputStream(null, null, in,
_getDefaultManager(),
url.toString());
-
+
if (metaInfSkinsNode != null)
{
// for debug only.
if (_LOG.isFine())
{
for (SkinNode node : metaInfSkinsNode.getSkinNodes())
- _LOG.fine("Skin {0} with stylesheet {1}",
+ _LOG.fine("Skin {0} with stylesheet {1}",
new Object[]{node.getId(), node.getStyleSheetName()});
for (SkinAdditionNode node: metaInfSkinsNode.getSkinAdditionNodes())
- _LOG.fine("SkinAddition {0} with stylesheet {1}",
+ _LOG.fine("SkinAddition {0} with stylesheet {1}",
new Object[]{node.getSkinId(), node.getStyleSheetName()});
}
-
+
allSkinsNodes.add(metaInfSkinsNode);
}
else
@@ -1030,8 +1039,8 @@ public class SkinUtils
}
}
}
-
-
+
+
private SkinUtils() {}
// The default ParserManager
@@ -1058,5 +1067,5 @@ public class SkinUtils
static private final String _RENDER_KIT_ID_PDA = "org.apache.myfaces.trinidad.pda";
static private final String _SIMPLE_PDA_SKIN_ID = "simple.pda";
static private final String _SIMPLE_DESKTOP_SKIN_ID = "simple.desktop";
-
+
}
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/LookAndFeelManager.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/LookAndFeelManager.java?rev=1145638&r1=1145637&r2=1145638&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/LookAndFeelManager.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/LookAndFeelManager.java Tue Jul 12 15:48:25 2011
@@ -26,6 +26,7 @@ import org.apache.myfaces.trinidadintern
import org.apache.myfaces.trinidadinternal.ui.laf.simple.desktop.SimpleDesktopUtils;
import org.apache.myfaces.trinidadinternal.ui.laf.simple.pda.SimplePdaUtils;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
+import org.apache.myfaces.trinidadinternal.ui.laf.simple.tablet.SimpleTabletUtils;
/**
* Manages the set of LookAndFeel instances. LookAndFeel instances can
@@ -73,6 +74,7 @@ public class LookAndFeelManager
SimpleDesktopUtils.registerLookAndFeel(manager);
SimplePdaUtils.registerLookAndFeel(manager);
+ SimpleTabletUtils.registerLookAndFeel(manager);
return manager;
}
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/SimpleDesktopConstants.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/SimpleDesktopConstants.java?rev=1145638&r1=1145637&r2=1145638&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/SimpleDesktopConstants.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/SimpleDesktopConstants.java Tue Jul 12 15:48:25 2011
@@ -35,6 +35,7 @@ public interface SimpleDesktopConstants
* Simple Skin.
*/
public static final String SIMPLE_DESKTOP_ID = "simple.desktop";
+ public static final String SIMPLE_TABLET_ID = "simple.tablet";
// menuTabs Icons
Added: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/simple/tablet/SimpleTabletUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/simple/tablet/SimpleTabletUtils.java?rev=1145638&view=auto
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/simple/tablet/SimpleTabletUtils.java (added)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/simple/tablet/SimpleTabletUtils.java Tue Jul 12 15:48:25 2011
@@ -0,0 +1,81 @@
+/*
+ * 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.ui.laf.simple.tablet;
+
+import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
+import org.apache.myfaces.trinidadinternal.ui.laf.*;
+import org.apache.myfaces.trinidadinternal.ui.laf.base.desktop.BaseDesktopConstants;
+import org.apache.myfaces.trinidadinternal.ui.laf.base.desktop.BaseDesktopUtils;
+import org.apache.myfaces.trinidadinternal.ui.laf.simple.desktop.SimpleDesktopConstants;
+import org.apache.myfaces.trinidadinternal.ui.laf.simple.pda.SimplePdaLookAndFeel;
+
+/**
+ * Utilities for the desktop implementation of the Simple
+ * Look And Feel. Currently the Look And Feel is used only for choosing
+ * renderers. We stripped out the styles, icons, translations, and properties,
+ * since we now use a Skin to customize that. The goal is to get rid of the
+ * LookAndFeel code altogether.
+ *
+ * @version $Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/ui/laf/simple/desktop/SimpleDesktopUtils.java#0 $) $Date: 10-nov-2005.18:51:27 $
+ * @deprecated This class comes from the old Java 1.2 UIX codebase and should not be used anymore.
+ */
+@Deprecated
+public class SimpleTabletUtils extends BaseDesktopUtils
+ implements SimpleDesktopConstants
+{
+
+ /**
+ * Registers the desktop implementation of the Simple
+ * Look And Feel with the specified LookAndFeelManager.
+ */
+ public static void registerLookAndFeel(
+ LookAndFeelManager manager
+ )
+ {
+ LookAndFeel baseLAF = manager.getLookAndFeelById(_SIMPLE_DESKTOP_ID);
+
+ // The Base LAF should always be pre-registered, but just to
+ // be extra safe...
+ if (baseLAF == null)
+ {
+ // No need to log an error message - but an assert
+ // should catch our attention
+ assert false;
+
+ // We can't create SLAF without the Base LAF
+ return;
+ }
+
+ // Create a LookAndFeelExtension for SLAF
+ LookAndFeelExtension simpleLAF =
+ new LookAndFeelExtension(baseLAF, SIMPLE_TABLET_ID, _SIMPLE_FAMILY);
+
+ manager.registerLookAndFeel(_TABLET_SCORER, simpleLAF);
+ }
+
+ private static final String _SIMPLE_FAMILY = "simple";
+ public static final String _SIMPLE_DESKTOP_ID = "simple.desktop";
+
+ private static final NameAndAgentScorer _TABLET_SCORER =
+ new NameAndAgentScorer("simple",
+ null,
+ null,
+ null,
+ TrinidadAgent.TYPE_TABLET);
+}
Propchange: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/simple/tablet/SimpleTabletUtils.java
------------------------------------------------------------------------------
svn:eol-style = native