raphael 01/05/27 08:34:38
Modified: src/java/org/apache/jetspeed/portal BasePortletConfig.java
PortletConfig.java PortletURIManager.java
src/java/org/apache/jetspeed/portal/controls
AbstractPortletControl.java
PanedPortletControl.java
src/java/org/apache/jetspeed/portal/factory
PortletConfigFactory.java PortletFactory.java
SkinFactory.java
src/java/org/apache/jetspeed/services Registry.java
src/java/org/apache/jetspeed/services/registry
RegistryFragment.java
src/java/org/apache/jetspeed/services/resources
JetspeedResources.java
Added: src/java/org/apache/jetspeed/om/newregistry SkinEntry.java
src/java/org/apache/jetspeed/om/newregistry/base
BaseSkinEntry.java
src/java/org/apache/jetspeed/portal BasePortletSkin.java
PortletSkin.java
Log:
add a Skin registry and use named Skin configuration within PortletConfig
Revision Changes Path
1.1
jakarta-jetspeed/src/java/org/apache/jetspeed/om/newregistry/SkinEntry.java
Index: SkinEntry.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jetspeed.om.newregistry;
import java.util.Iterator;
import java.util.Map;
/**
* The SkinEntry defines the properties used for storing a Skin description in
* the registry
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
* @version $Id: SkinEntry.java,v 1.1 2001/05/27 15:34:34 raphael Exp $
*/
public interface SkinEntry extends RegistryEntry
{
/** @return an enumeration of this entry parameter names */
public Iterator getParameterNames();
/** Returns a map of parameter values keyed on the parameter names
* @return the parameter values map
*/
public Map getParameterMap();
/** Search for a named parameter and return the associated
* parameter object. The search is case sensitive.
*
* @return the parameter object for a given parameter name
* @param name the parameter name to look for
*/
public Parameter getParameter( String name );
/** Adds a new parameter for this entry
* @param name the new parameter name
* @param value the new parameter value
*/
public void addParameter( String name, String value );
/** Adds a new parameter for this entry
* @param parameter the new parameter to add
*/
public void addParameter( Parameter parameter );
/** Removes all parameter values associated with the
* name
*
* @param name the parameter name to remove
*/
public void removeParameter( String name );
}
1.1
jakarta-jetspeed/src/java/org/apache/jetspeed/om/newregistry/base/BaseSkinEntry.java
Index: BaseSkinEntry.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jetspeed.om.newregistry.base;
import org.apache.jetspeed.om.newregistry.*;
import java.util.*;
/**
* The BaseSkinEntry is a bean like implementation of the SkinEntry
* interface suitable for Castor XML serialization
*
* @see org.apache.jetspeed.om.newregistry.SkinEntry
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
* @version $Id: BaseSkinEntry.java,v 1.1 2001/05/27 15:34:34 raphael Exp $
*/
public class BaseSkinEntry extends BaseRegistryEntry implements SkinEntry
{
private Vector parameter = new Vector();
private transient Map nameIdx = null;
/** @return an enumeration of this entry parameter names */
public Iterator getParameterNames()
{
synchronized (parameter)
{
if (nameIdx == null)
{
buildNameIndex();
}
}
return nameIdx.keySet().iterator();
}
/** Search for a named parameter and return the associated
* parameter object. The search is case sensitive.
*
* @return the parameter object for a given parameter name
* @param name the parameter name to look for
*/
public Parameter getParameter( String name )
{
synchronized (parameter)
{
if (nameIdx == null)
{
buildNameIndex();
}
}
if (name != null)
{
Integer pos = (Integer)nameIdx.get(name);
if (pos != null)
{
return (Parameter)parameter.elementAt(pos.intValue());
}
}
return null;
}
/** Returns a map of parameter values keyed on the parameter names
* @return the parameter values map
*/
public Map getParameterMap()
{
Hashtable params = new Hashtable();
Enumeration en = parameter.elements();
while(en.hasMoreElements())
{
Parameter param = (Parameter)en.nextElement();
params.put(param.getName(),param.getValue());
}
return params;
}
/** Adds a new parameter for this entry
* @param name the new parameter name
* @param value the new parameter value
*/
public void addParameter( String name, String value )
{
if (name != null)
{
Parameter p = getParameter(name);
if (p == null)
{
p = new BaseParameter();
p.setName(name);
}
p.setValue(value);
addParameter(p);
}
}
/** Adds a new parameter for this entry
* @param parameter the new parameter to add
*/
public void addParameter( Parameter param )
{
synchronized (parameter)
{
parameter.addElement( param );
nameIdx.put( param.getName(), new Integer( parameter.size()-1 ) );
}
}
/** Removes all parameter values associated with the
* name
*
* @param name the parameter name to remove
*/
public void removeParameter( String name )
{
if (name == null) return;
synchronized (parameter)
{
Iterator i = parameter.iterator();
while(i.hasNext())
{
Parameter param = (Parameter)i.next();
if (param.getName().equals(name))
{
i.remove();
}
}
buildNameIndex();
}
}
/** This method recreates the paramter name index for quick retrieval
* of parameters by name. Shoule be called whenever a complete index
* of parameter should be rebuilt (eg removing a parameter or setting
* a parameters vector)
*/
private void buildNameIndex()
{
Hashtable idx = new Hashtable();
Iterator i = parameter.iterator();
int count = 0;
while( i.hasNext() )
{
Parameter p = (Parameter)i.next();
idx.put( p.getName(), new Integer(count) );
count++;
}
this.nameIdx = idx;
}
// Castor serialization accessor methods
/** Needed for Castor 0.8.11 XML serialization for retrieving the
* parameters objects associated to this object
*/
public Vector getParameters()
{
return this.parameter;
}
public void setParameters(Vector parameters)
{
this.parameter = parameters;
}
}
1.3 +30 -13
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/BasePortletConfig.java
Index: BasePortletConfig.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/BasePortletConfig.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BasePortletConfig.java 2001/05/27 11:07:31 1.2
+++ BasePortletConfig.java 2001/05/27 15:34:34 1.3
@@ -66,13 +66,14 @@
import org.apache.jetspeed.util.*;
import org.apache.jetspeed.profiler.*;
import org.apache.jetspeed.capability.*;
+import org.apache.jetspeed.portal.factory.SkinFactory;
/**
* Defines a configuration for Portlets. A PortletConfig provides information
* about the running environment of a given Portlet.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Kevin A. Burton</a>
- * @version $Id: BasePortletConfig.java,v 1.2 2001/05/27 11:07:31 raphael Exp $
+ * @version $Id: BasePortletConfig.java,v 1.3 2001/05/27 15:34:34 raphael Exp $
*/
public class BasePortletConfig extends BaseConfig implements PortletConfig
{
@@ -81,7 +82,7 @@
private MetaData metainfo;
private Map layoutConstraints = null;
private int layoutPosition = -1;
- private Map skin;
+ private PortletSkin skin;
private transient PortletSet currentSet;
private CapabilityMap cm = null;
@@ -139,16 +140,7 @@
*/
public Map getSkin()
{
- Hashtable normalSkin = new Hashtable();
-
- if (getPortletSet()!=null)
- {
- normalSkin.putAll(getPortletSet().getPortletConfig().getSkin());
- }
-
- if (this.skin!=null) normalSkin.putAll(this.skin);
-
- return normalSkin;
+ return this.skin;
}
/**
@@ -156,7 +148,7 @@
*/
public void setSkin(Map skin)
{
- this.skin=skin;
+ //this.skin=SkinFactory.getSkin(skin);
}
/**
@@ -301,6 +293,31 @@
}
}
+ /**
+ * Retrieves the Skin object that should be used for this portlet
+ *
+ * @returns the Skin object that should be used
+ */
+ public PortletSkin getPortletSkin()
+ {
+ if ((this.skin==null)&&(getPortletSet()!=null))
+ {
+ return getPortletSet().getPortletConfig().getPortletSkin();
+ }
+
+ return this.skin;
+ }
+
+ /**
+ * Sets the PortletSkin to use for this Portlet
+ *
+ * @param skin the new skin to use
+ */
+ public void setPortletSkin(PortletSkin skin)
+ {
+ this.skin = skin;
+ }
+
/**
*/
public CapabilityMap getCapabilityMap()
1.44 +15 -1
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/PortletConfig.java
Index: PortletConfig.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/PortletConfig.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- PortletConfig.java 2001/05/27 11:07:31 1.43
+++ PortletConfig.java 2001/05/27 15:34:35 1.44
@@ -67,7 +67,7 @@
about the running environment of a given Portlet.
@author <a href="mailto:[EMAIL PROTECTED]">Kevin A. Burton</a>
-@version $Id: PortletConfig.java,v 1.43 2001/05/27 11:07:31 raphael Exp $
+@version $Id: PortletConfig.java,v 1.44 2001/05/27 15:34:35 raphael Exp $
*/
public interface PortletConfig extends Config
@@ -165,6 +165,20 @@
*/
public void setSkin(String name, String value);
+ /**
+ * Retrieves the Skin object that should be used for this portlet
+ *
+ * @returns the Skin object that should be used
+ */
+ public PortletSkin getPortletSkin();
+
+ /**
+ * Sets the PortletSkin to use for this Portlet
+ *
+ * @param skin the new skin to use
+ */
+ public void setPortletSkin(PortletSkin skin);
+
/**
*/
public CapabilityMap getCapabilityMap();
1.34 +7 -18
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/PortletURIManager.java
Index: PortletURIManager.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/PortletURIManager.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- PortletURIManager.java 2001/05/02 10:47:41 1.33
+++ PortletURIManager.java 2001/05/27 15:34:35 1.34
@@ -101,7 +101,7 @@
@author <a href="mailto:[EMAIL PROTECTED]">Kevin A. Burton</a>
@author <a href="mailto:[EMAIL PROTECTED]">Santiago Gala</a>
-@version $Id: PortletURIManager.java,v 1.33 2001/05/02 10:47:41 raphael Exp $
+@version $Id: PortletURIManager.java,v 1.34 2001/05/27 15:34:35 raphael Exp $
*/
public class PortletURIManager {
@@ -128,7 +128,7 @@
RunData data) {
DynamicURI uri = new DynamicURI( data, "Info" );
- uri.addPathInfo( "portlet", URIEncoder.encode( portlet.getName() ) );
+ uri.addPathInfo( "portlet", portlet.getName() );
return uri;
@@ -143,7 +143,7 @@
DynamicURI uri = new DynamicURI( data );
- uri.addPathInfo( "portlet", URIEncoder.encode( entry.getName() ) );
+ uri.addPathInfo( "portlet", entry.getName() );
return uri;
@@ -160,21 +160,10 @@
Return null if we aren't able to figure out the PortletEntry
</p>
*/
- public static final PortletEntry getEntry( ParameterParser params ) {
-
- //jdk1.2 throws Exception.
- //jdk1.3 does not... :-?
- try {
- String name = URIEncoder.decode( params.getString( "portlet" ) );
-
- return (PortletEntry)Registry.getEntry(Registry.PORTLET,
- name );
-
- } catch (Exception e) {
- Log.error( "Exception decoding portlet parameter" );
- Log.error( e );
- return null;
- }
+ public static final PortletEntry getEntry( ParameterParser params )
+ {
+ String name = params.getString( "portlet" );
+ return (PortletEntry)Registry.getEntry(Registry.PORTLET, name );
}
}
1.1
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/BasePortletSkin.java
Index: BasePortletSkin.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jetspeed.portal;
/**
* This default implementation of PortletSkin stores every property
* as a Map of text properties
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
* @version $Id: BasePortletSkin.java,v 1.1 2001/05/27 15:34:35 raphael Exp $
*/
public class BasePortletSkin extends java.util.HashMap implements PortletSkin
{
public String name = null;
/**
* Returns the name of this color scheme
* @return the color scheme name
*/
public String getName()
{
return this.name;
}
/** Sets the name of this Skin
*/
public void setName(String name)
{
this.name = name;
}
/**
* Returns the color to use for displaying the portlet text
* @return the text color value in HTML format (#RRGGBB)
*/
public String getTextColor()
{
return (String)get(TEXT_COLOR);
}
/**
* Sets the color to use for displaying the portlet text
* @param color the text color value in HTML format (#RRGGBB)
*/
public void setTextColor(String color)
{
if (color!=null)
{
put(TEXT_COLOR,color);
}
}
/**
* Returns the color to use for displaying the portlet background
* @return the text color value in HTML format (#RRGGBB)
*/
public String getBackgroundColor()
{
return (String)get(BACKGROUND_COLOR);
}
/**
* Sets the color to use for displaying the portlet background
* @param backgroundColor the background color value in HTML format (#RRGGBB)
*/
public void setBackgroundColor(String color)
{
if (color!=null)
{
put(BACKGROUND_COLOR,color);
}
}
/**
* Returns the color to use for displaying the portlet title text
* @return the text color value in HTML format (#RRGGBB)
*/
public String getTitleTextColor()
{
return (String)get(TITLE_TEXT_COLOR);
}
/**
* Sets the color to use for displaying the portlet title text
* @param titleColor the title color value in HTML format (#RRGGBB)
*/
public void setTitleTextColor(String color)
{
if (color!=null)
{
put(TITLE_TEXT_COLOR,color);
}
}
/**
* Returns the color to use for displaying the portlet title background
* @return the background color value in HTML format (#RRGGBB)
*/
public String getTitleBackgroundColor()
{
return (String)get(TITLE_BACKGROUND_COLOR);
}
/**
* Sets the color to use for displaying the portlet title background
* @param titleColor the title color value in HTML format (#RRGGBB)
*/
public void setTitleBackgroundColor(String color)
{
if (color!=null)
{
put(TITLE_BACKGROUND_COLOR,color);
}
}
/**
* Returns the color to use for displaying an highlighted text
* @return the text color value in HTML format (#RRGGBB)
*/
public String getHighlightTextColor()
{
return (String)get(HIGHLIGHT_TEXT_COLOR);
}
/**
* Sets the color to use for displaying an highlighted text
* @param titleColor a color value in HTML format (#RRGGBB)
*/
public void setHighlightTextColor(String color)
{
if (color!=null)
{
put(HIGHLIGHT_TEXT_COLOR,color);
}
}
/**
* Returns the color to use for displaying an highlighted background
* @return the background color value in HTML format (#RRGGBB)
*/
public String getHighlightBackgroundColor()
{
return (String)get(HIGHLIGHT_BACKGROUND_COLOR);
}
/**
* Sets the color to use for displaying an highlighted background
* @param titleColor the title color value in HTML format (#RRGGBB)
*/
public void setHighlightBackgroundColor(String color)
{
if (color!=null)
{
put(HIGHLIGHT_BACKGROUND_COLOR,color);
}
}
}
1.1
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/PortletSkin.java
Index: PortletSkin.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jetspeed.portal;
/**
* The PortletSkin defines the color scheme to use for displaying a
* specified portlet (and associated control)
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
* @version $Id: PortletSkin.java,v 1.1 2001/05/27 15:34:35 raphael Exp $
*/
public interface PortletSkin extends java.util.Map
{
public static final String TEXT_COLOR = "text-color";
public static final String BACKGROUND_COLOR = "background-color";
public static final String TITLE_TEXT_COLOR = "title-text-color";
public static final String TITLE_BACKGROUND_COLOR = "title-background-color";
public static final String HIGHLIGHT_TEXT_COLOR = "highlight-text-color";
public static final String HIGHLIGHT_BACKGROUND_COLOR =
"highlight-background-color";
/**
* Returns the name of this color scheme
* @return the color scheme name
*/
public String getName();
/**
* Returns the color to use for displaying the portlet text
* @return the text color value in HTML format (#RRGGBB)
*/
public String getTextColor();
/**
* Sets the color to use for displaying the portlet text
* @param color the text color value in HTML format (#RRGGBB)
*/
public void setTextColor(String color);
/**
* Returns the color to use for displaying the portlet background
* @return the text color value in HTML format (#RRGGBB)
*/
public String getBackgroundColor();
/**
* Sets the color to use for displaying the portlet background
* @param backgroundColor the background color value in HTML format (#RRGGBB)
*/
public void setBackgroundColor(String backgroundColor);
/**
* Returns the color to use for displaying the portlet title text
* @return the text color value in HTML format (#RRGGBB)
*/
public String getTitleTextColor();
/**
* Sets the color to use for displaying the portlet title text
* @param titleColor the title color value in HTML format (#RRGGBB)
*/
public void setTitleTextColor(String titleColor);
/**
* Returns the color to use for displaying the portlet title background
* @return the background color value in HTML format (#RRGGBB)
*/
public String getTitleBackgroundColor();
/**
* Sets the color to use for displaying the portlet title background
* @param titleColor the title color value in HTML format (#RRGGBB)
*/
public void setTitleBackgroundColor(String titleColor);
/**
* Returns the color to use for displaying an highlighted text
* @return the text color value in HTML format (#RRGGBB)
*/
public String getHighlightTextColor();
/**
* Sets the color to use for displaying an highlighted text
* @param titleColor a color value in HTML format (#RRGGBB)
*/
public void setHighlightTextColor(String titleColor);
/**
* Returns the color to use for displaying an highlighted background
* @return the background color value in HTML format (#RRGGBB)
*/
public String getHighlightBackgroundColor();
/**
* Sets the color to use for displaying an highlighted background
* @param titleColor the title color value in HTML format (#RRGGBB)
*/
public void setHighlightBackgroundColor(String titleColor);
}
1.3 +7 -7
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/AbstractPortletControl.java
Index: AbstractPortletControl.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/AbstractPortletControl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractPortletControl.java 2001/05/27 11:07:32 1.2
+++ AbstractPortletControl.java 2001/05/27 15:34:36 1.3
@@ -82,7 +82,7 @@
* a simple portlet wherever in a PSML object tree.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
- * @version $Id: AbstractPortletControl.java,v 1.2 2001/05/27 11:07:32 raphael Exp $
+ * @version $Id: AbstractPortletControl.java,v 1.3 2001/05/27 15:34:36 raphael Exp $
*/
public abstract class AbstractPortletControl extends AbstractPortlet
implements PortletControl
@@ -154,7 +154,7 @@
*/
public String getColor()
{
- return getPortlet().getPortletConfig().getSkin( "color", COLOR );
+ return getPortlet().getPortletConfig().getPortletSkin().getTextColor();
}
/**
@@ -167,7 +167,7 @@
*/
public void setColor(String color)
{
- getPortlet().getPortletConfig().setSkin( "color", color );
+ getPortlet().getPortletConfig().getPortletSkin().setTextColor( color );
}
/**
@@ -180,7 +180,7 @@
*/
public String getBackgroundColor()
{
- return getPortlet().getPortletConfig().getSkin( "background-color",
BACKGROUND_COLOR );
+ return
getPortlet().getPortletConfig().getPortletSkin().getBackgroundColor();
}
/**
@@ -193,7 +193,7 @@
*/
public void setBackgroundColor(String backgroundColor)
{
- getPortlet().getPortletConfig().setSkin( "background-color",
backgroundColor );
+ getPortlet().getPortletConfig().getPortletSkin().setBackgroundColor(
backgroundColor );
}
/**
@@ -206,7 +206,7 @@
*/
public String getTitleColor()
{
- return getPortlet().getPortletConfig().getSkin( "title-color", TITLE_COLOR
);
+ return
getPortlet().getPortletConfig().getPortletSkin().getTitleBackgroundColor();
}
/**
@@ -219,7 +219,7 @@
*/
public void setTitleColor(String titleColor)
{
- getPortlet().getPortletConfig().setSkin( "title-color", titleColor );
+ getPortlet().getPortletConfig().getPortletSkin().setTitleBackgroundColor(
titleColor );
}
/**
1.16 +4 -3
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/PanedPortletControl.java
Index: PanedPortletControl.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/PanedPortletControl.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- PanedPortletControl.java 2001/05/07 20:48:53 1.15
+++ PanedPortletControl.java 2001/05/27 15:34:36 1.16
@@ -75,7 +75,7 @@
portlet corresponding to the PortletSet managed</p>
@author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
-@version $Id: PanedPortletControl.java,v 1.15 2001/05/07 20:48:53 raphael Exp $
+@version $Id: PanedPortletControl.java,v 1.16 2001/05/27 15:34:36 raphael Exp $
*/
public class PanedPortletControl extends AbstractPortletControl {
@@ -340,14 +340,15 @@
Sets the color for the tab of the selected pane
*/
public void setSelectedColor(String color) {
- getPortlet().getPortletConfig().setSkin("selected-color",color);
+
getPortlet().getPortletConfig().getPortletSkin().setHighlightBackgroundColor(color);
}
/**
Returns the color to use as bckground of the tab of the selected pane
*/
public String getSelectedColor() {
- return
getPortlet().getPortletConfig().getSkin("selected-color",SELECTED_COLOR);
+ return getPortlet().getPortletConfig()
+ .getPortletSkin().getHighlightBackgroundColor();
}
/**
1.14 +5 -2
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/factory/PortletConfigFactory.java
Index: PortletConfigFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/factory/PortletConfigFactory.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- PortletConfigFactory.java 2001/05/07 20:49:07 1.13
+++ PortletConfigFactory.java 2001/05/27 15:34:36 1.14
@@ -71,7 +71,7 @@
data sets.
@author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
-@version $Id: PortletConfigFactory.java,v 1.13 2001/05/07 20:49:07 raphael Exp $
+@version $Id: PortletConfigFactory.java,v 1.14 2001/05/27 15:34:36 raphael Exp $
*/
public class PortletConfigFactory
{
@@ -106,7 +106,10 @@
PortletConfig pc = new BasePortletConfig();
pc.setInitParameters( ParametersFactory.getParameters( portlets ) );
- pc.setSkin( SkinFactory.getSkin( portlets ) );
+ if (portlets.getSkin()!=null)
+ {
+ pc.setPortletSkin( SkinFactory.getSkin( portlets.getSkin() ) );
+ }
pc.setMetainfo( MetaDataFactory.getMetaData( portlets ) );
return pc;
1.119 +5 -3
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/factory/PortletFactory.java
Index: PortletFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/factory/PortletFactory.java,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -r1.118 -r1.119
--- PortletFactory.java 2001/05/07 20:49:08 1.118
+++ PortletFactory.java 2001/05/27 15:34:36 1.119
@@ -88,7 +88,7 @@
@author <a href="mailto:[EMAIL PROTECTED]">Kevin A. Burton</a>
@author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
@author <a href="mailto:[EMAIL PROTECTED]">Santiago Gala</a>
-@version $Id: PortletFactory.java,v 1.118 2001/05/07 20:49:08 raphael Exp $
+@version $Id: PortletFactory.java,v 1.119 2001/05/27 15:34:36 raphael Exp $
*/
public class PortletFactory {
@@ -121,8 +121,10 @@
pc.getInitParameters() ) );
// initialize skin value
- pc.setSkin( SkinFactory.getSkin( entry ) );
-
+ if (entry.getSkin()!=null)
+ {
+ pc.setPortletSkin( SkinFactory.getSkin( entry.getSkin() ) );
+ }
// return the decorated portlet
return PortletControlFactory
1.9 +71 -28
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/factory/SkinFactory.java
Index: SkinFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/factory/SkinFactory.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SkinFactory.java 2001/05/27 11:07:33 1.8
+++ SkinFactory.java 2001/05/27 15:34:36 1.9
@@ -55,7 +55,13 @@
package org.apache.jetspeed.portal.factory;
//jetspeed stuff
-import org.apache.jetspeed.xml.api.portletmarkup.*;
+import org.apache.jetspeed.portal.PortletSkin;
+import org.apache.jetspeed.portal.BasePortletSkin;
+import org.apache.jetspeed.services.resources.JetspeedResources;
+import org.apache.jetspeed.services.Registry;
+import org.apache.jetspeed.om.newregistry.SkinEntry;
+import org.apache.jetspeed.xml.api.portletmarkup.Skin;
+import org.apache.jetspeed.xml.api.portletmarkup.Property;
//java stuff
import java.util.Map;
@@ -66,10 +72,14 @@
markup
@author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
-@version $Id: SkinFactory.java,v 1.8 2001/05/27 11:07:33 raphael Exp $
+@version $Id: SkinFactory.java,v 1.9 2001/05/27 15:34:36 raphael Exp $
*/
-public class SkinFactory {
-
+public class SkinFactory
+{
+
+ public static final String DEFAULT_SKIN =
+ JetspeedResources.getString(JetspeedResources.SKIN_DEFAULT_KEY,"default");
+
/**
Get the skin properties associated to a PSML Entry
@@ -78,64 +88,97 @@
@returns a Map containing the names/values, an empty Dictonary
is returned if there are no properties
*/
- static Map getSkin( Entry entry )
+ public static PortletSkin getSkin( Skin skin )
{
- if ( entry.getSkin() == null )
- return new Hashtable();
+ PortletSkin result = null;
+ SkinEntry entry = null;
+
+ if (skin.getName()!=null)
+ {
+ entry = (SkinEntry)Registry.getEntry(Registry.SKIN,skin.getName());
+ }
- return getProperties( entry.getSkin().getProperty() );
+ // either we don't have any skin defined, the skin reference is null
+ // or the skin reference is invalid, in all case, retrieve the default
+ // skin entry
+ if (entry == null)
+ {
+ entry = (SkinEntry)Registry.getEntry(Registry.SKIN,DEFAULT_SKIN);
+ }
+
+ // creata the PortletSkin corresponding to this entry
+ result = getSkin( entry );
+
+ // override the values with the locally defined properties
+ result.putAll(getProperties(skin.getProperty()));
+
+ return result;
}
/**
- Get the skin properties associated to a PSML Portlets
+ Get the skin properties associated to a PSML Entry
- @param entry the Portlets object to use
+ @param entry the Entry object to use
@returns a Map containing the names/values, an empty Dictonary
is returned if there are no properties
*/
- static Map getSkin( Portlets entry )
+ public static PortletSkin getSkin( SkinEntry entry )
{
- if (entry.getSkin()==null) return new Hashtable();
- return getProperties(entry.getSkin().getProperty());
+ BasePortletSkin result = new BasePortletSkin();
+
+ if (entry!=null)
+ {
+ // build the PortletSkin object
+ result.setName(entry.getName());
+ result.putAll(entry.getParameterMap());
+ }
+
+ return result;
}
/**
- Transforms an array of PSML Property array in a string name/value Map
+ Get the skin properties associated to a PSML Entry
- @param props the Property array to use
+ @param entry the Entry object to use
@returns a Map containing the names/values, an empty Dictonary
is returned if there are no properties
*/
- private static Map getProperties( Property[] props )
+ public static PortletSkin getSkin( Map skin )
{
- Hashtable hash = new Hashtable();
- if (props!=null) {
- for(int i = 0; i < props.length; ++i) {
- hash.put(props[i].getName(), props[i].getValue() );
- }
+ BasePortletSkin result = null;
+
+ if (skin instanceof PortletSkin)
+ {
+ return (PortletSkin)skin;
}
- return hash;
+
+ if (skin!=null)
+ {
+ result = new BasePortletSkin();
+ result.setName(DEFAULT_SKIN);
+ result.putAll(skin);
+ }
+
+ return result;
}
/**
- Fills a given Map with an array of PSML Property values
+ Transforms an array of PSML Property array in a string name/value Map
@param props the Property array to use
- @param hash the Map to use, if null use a new one.
@returns a Map containing the names/values, an empty Dictonary
is returned if there are no properties
*/
- private static Map getProperties( Property[] props, Map hash )
+ private static Map getProperties( Property[] props )
{
- if (hash!=null) {
+ Hashtable hash = new Hashtable();
+ if (props!=null) {
for(int i = 0; i < props.length; ++i) {
hash.put(props[i].getName(), props[i].getValue() );
}
- } else {
- return getProperties(props);
}
return hash;
}
1.3 +4 -1
jakarta-jetspeed/src/java/org/apache/jetspeed/services/Registry.java
Index: Registry.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/Registry.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Registry.java 2001/05/02 14:17:26 1.2
+++ Registry.java 2001/05/27 15:34:37 1.3
@@ -65,7 +65,7 @@
*
* @see org.apache.jetspeed.services.registrymanager.RegistryService
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
- * @version $Id: Registry.java,v 1.2 2001/05/02 14:17:26 raphael Exp $
+ * @version $Id: Registry.java,v 1.3 2001/05/27 15:34:37 raphael Exp $
*/
public class Registry {
@@ -80,6 +80,9 @@
/** Default MediaType Registry name */
public static String MEDIA_TYPE = "MediaType";
+
+ /** Default Skin Registry name */
+ public static String SKIN = "Skin";
/**
* Commodity method for getting a reference to the service
1.5 +14 -1
jakarta-jetspeed/src/java/org/apache/jetspeed/services/registry/RegistryFragment.java
Index: RegistryFragment.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/registry/RegistryFragment.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- RegistryFragment.java 2001/05/08 19:09:13 1.4
+++ RegistryFragment.java 2001/05/27 15:34:37 1.5
@@ -65,7 +65,7 @@
* by Castor XML serialization
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
- * @version $Id: RegistryFragment.java,v 1.4 2001/05/08 19:09:13 raphael Exp $
+ * @version $Id: RegistryFragment.java,v 1.5 2001/05/27 15:34:37 raphael Exp $
*/
public class RegistryFragment extends Hashtable implements java.io.Serializable {
@@ -196,6 +196,19 @@
if (medias!=null)
{
put(Registry.MEDIA_TYPE,medias);
+ }
+ }
+
+ public Vector getSkins()
+ {
+ return (Vector)get(Registry.SKIN);
+ }
+
+ public void setSkins(Vector skins)
+ {
+ if (skins!=null)
+ {
+ put(Registry.SKIN,skins);
}
}
1.6 +2 -1
jakarta-jetspeed/src/java/org/apache/jetspeed/services/resources/JetspeedResources.java
Index: JetspeedResources.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/resources/JetspeedResources.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- JetspeedResources.java 2001/05/08 06:26:58 1.5
+++ JetspeedResources.java 2001/05/27 15:34:37 1.6
@@ -64,7 +64,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Kevin A. Burton</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Tom Adams</a>
- * @version $Id: JetspeedResources.java,v 1.5 2001/05/08 06:26:58 taylor Exp $
+ * @version $Id: JetspeedResources.java,v 1.6 2001/05/27 15:34:37 raphael Exp $
*/
public class JetspeedResources extends TurbineResources {
@@ -77,6 +77,7 @@
public static final String PROFILER_DEFAULT_CLASSNAME_KEY =
"profiler.default.classname";
public static final String PROFILER_CONFIGURATION_KEY =
"profiler.configuration";
+ public static final String SKIN_DEFAULT_KEY = "skin.default";
public static final String PORTLETCONTROL_DEFAULT_CLASSNAME_KEY =
"portletcontrol.default.classname";
public static final String PORTLETCONTROL_MAXIMIZED_CLASSNAME_KEY =
"portletcontrol.maximized.classname";
public static final String PORTLETCONTROLLER_DEFAULT_CLASSNAME_KEY =
"portletcontroller.default.classname";
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]