*** empty log message ***
This commit is contained in:
441
src/venice-base/com/silverwrist/venice/frame/FrameAssembler.java
Normal file
441
src/venice-base/com/silverwrist/venice/frame/FrameAssembler.java
Normal file
@@ -0,0 +1,441 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
* (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.mozilla.org/MPL/>.
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
* Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
package com.silverwrist.venice.frame;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.regex.*;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.w3c.dom.*;
|
||||
import com.silverwrist.util.*;
|
||||
import com.silverwrist.util.xml.*;
|
||||
import com.silverwrist.dynamo.RequestType;
|
||||
import com.silverwrist.dynamo.event.*;
|
||||
import com.silverwrist.dynamo.except.*;
|
||||
import com.silverwrist.dynamo.iface.*;
|
||||
import com.silverwrist.dynamo.util.*;
|
||||
import com.silverwrist.dynamo.velocity.VelocityParamSupplier;
|
||||
import com.silverwrist.dynamo.velocity.VelocityRendererConfig;
|
||||
import com.silverwrist.venice.VeniceNamespaces;
|
||||
import com.silverwrist.venice.iface.*;
|
||||
import com.silverwrist.venice.session.SessionInfoParams;
|
||||
|
||||
public class FrameAssembler
|
||||
implements NamedObject, ComponentInitialize, ComponentShutdown, OutputObjectFilter, DynamicUpdateListener,
|
||||
FrameParameters
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Internal class that supplies rendering parameters for the frame
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private class BaseParams implements VelocityParamSupplier
|
||||
{
|
||||
/*====================================================================
|
||||
* Constructor
|
||||
*====================================================================
|
||||
*/
|
||||
|
||||
BaseParams()
|
||||
{ // do nothing
|
||||
} // end constructor
|
||||
|
||||
/*====================================================================
|
||||
* Implementations from interface VelocityParamSupplier
|
||||
*====================================================================
|
||||
*/
|
||||
|
||||
public Object getParameter(String key)
|
||||
{
|
||||
return m_globals.get(key);
|
||||
|
||||
} // end getParameter
|
||||
|
||||
public Collection getParameterNames()
|
||||
{
|
||||
return Collections.unmodifiableSet(m_globals.keySet());
|
||||
|
||||
} // end getParameterNames
|
||||
|
||||
} // end class BaseParams
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Internal class that supplies additional operations for the Velocity engine
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public class VelocityOps
|
||||
{
|
||||
/*====================================================================
|
||||
* Constructor
|
||||
*====================================================================
|
||||
*/
|
||||
|
||||
VelocityOps()
|
||||
{ // do nothing
|
||||
} // end constructor
|
||||
|
||||
/*====================================================================
|
||||
* External operations
|
||||
*====================================================================
|
||||
*/
|
||||
|
||||
public boolean getShowComments()
|
||||
{
|
||||
return m_show_comments;
|
||||
|
||||
} // end showComments
|
||||
|
||||
} // end class VelocityOps
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Static data members
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private static Logger logger = Logger.getLogger(FrameAssembler.class);
|
||||
|
||||
private static final Map PROP_TO_VELOCITY;
|
||||
private static final Map PROP_TO_TYPE;
|
||||
|
||||
private static final Pattern PAT_LINEBREAK = Pattern.compile("\\r*\\n");
|
||||
|
||||
private static final int[] NO_ACLS = new int[0];
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private String m_name; // this object's name
|
||||
private ObjectProvider m_props; // global properties
|
||||
private ObjectProvider m_blocks; // global blocks
|
||||
private MenuProvider m_menu_prov; // menu provider
|
||||
private String m_frame_template; // frame template parameter
|
||||
private HashMap m_globals = new HashMap(); // globals fed to Velocity
|
||||
private BaseParams m_base_params; // base parameters object
|
||||
private boolean m_footer_breaks; // add line breaks to footer?
|
||||
private boolean m_show_comments; // show HTML comments?
|
||||
private ComponentShutdown m_shut_event; // shutdown event handler
|
||||
private ComponentShutdown m_shut_vr; // shutdown Velocity rendering component
|
||||
private ComponentShutdown m_shut_fasm; // shutdown FrameAssembler
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructor
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public FrameAssembler()
|
||||
{ // do nothing
|
||||
} // end constructor
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Internal operations
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private final Object initLoadProperty(String name, Class expected_class) throws ConfigException
|
||||
{
|
||||
try
|
||||
{ // call through to getObject
|
||||
Object rc = m_props.getObject(NAMESPACE,name);
|
||||
if (!(expected_class.isInstance(rc)))
|
||||
{ // not the right class!
|
||||
ConfigException ce = new ConfigException(FrameAssembler.class,"FrameMessages","property.wrongClass");
|
||||
ce.setParameter(0,name);
|
||||
ce.setParameter(1,expected_class.getName());
|
||||
throw ce;
|
||||
|
||||
} // end if
|
||||
|
||||
return rc;
|
||||
|
||||
} // end try
|
||||
catch (NoSuchObjectException e)
|
||||
{ // translate into ConfigException and reflect it back
|
||||
ConfigException ce = new ConfigException(FrameAssembler.class,"FrameMessages","property.notFound",e);
|
||||
ce.setParameter(0,name);
|
||||
throw ce;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end initLoadProperty
|
||||
|
||||
private final void setupOptions(OptionSet set)
|
||||
{
|
||||
m_show_comments = set.get(OPT_COMMENTS);
|
||||
m_globals.put("ms_copyright_violations",Boolean.valueOf(set.get(OPT_SMARTTAG)));
|
||||
m_footer_breaks = set.get(OPT_FOOTER_BREAKS);
|
||||
|
||||
} // end setupOptions
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Overrides from class Object
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "the FrameAssembler";
|
||||
|
||||
} // end toString
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface NamedObject
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return m_name;
|
||||
|
||||
} // end getName
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface ComponentInitialize
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initialize the component.
|
||||
*
|
||||
* @param config_root Pointer to the section of the Dynamo XML configuration file that configures this
|
||||
* particular component. This is to be considered "read-only" by the component.
|
||||
* @param services An implementation of {@link com.silverwrist.dynamo.iface.ServiceProvider ServiceProvider}
|
||||
* which provides initialization services to the component. This will include an implementation
|
||||
* of {@link com.silverwrist.dynamo.iface.ObjectProvider ObjectProvider} which may be used to
|
||||
* get information about other objects previously initialized by the application.
|
||||
* @exception com.silverwrist.dynamo.except.ConfigException If an error is encountered in the component
|
||||
* configuration.
|
||||
*/
|
||||
public void initialize(Element config_root, ServiceProvider services) throws ConfigException
|
||||
{
|
||||
logger.info("FrameAssembler initializing");
|
||||
|
||||
XMLLoader loader = XMLLoader.get();
|
||||
String gprops = null, name_menu = null;
|
||||
try
|
||||
{ // verify the right node name
|
||||
loader.verifyNodeName(config_root,"object");
|
||||
|
||||
// get the object's name
|
||||
m_name = loader.getAttribute(config_root,"name");
|
||||
|
||||
// get the name of the global properties object
|
||||
DOMElementHelper config_root_h = new DOMElementHelper(config_root);
|
||||
Element foo = loader.getSubElement(config_root_h,"global-properties");
|
||||
gprops = loader.getAttribute(foo,"object");
|
||||
|
||||
// get the name of the menu manager
|
||||
foo = loader.getSubElement(config_root_h,"providers");
|
||||
name_menu = loader.getAttribute(foo,"menu");
|
||||
|
||||
} // end try
|
||||
catch (XMLLoadException e)
|
||||
{ // error loading XML config data
|
||||
logger.fatal("XML loader exception in FrameAssembler",e);
|
||||
throw new ConfigException(e);
|
||||
|
||||
} // end catch
|
||||
|
||||
// Get the global data manager object.
|
||||
ServiceProvider gdm_sp =
|
||||
(ServiceProvider)(GetObjectUtils.getDynamoComponent(services,ServiceProvider.class,gprops));
|
||||
try
|
||||
{ // get the "properties" and "blocks" services from that object
|
||||
m_props = (ObjectProvider)(gdm_sp.queryService(ObjectProvider.class,"properties"));
|
||||
m_blocks = (ObjectProvider)(gdm_sp.queryService(ObjectProvider.class,"blocks"));
|
||||
|
||||
} // end try
|
||||
catch (NoSuchServiceException e)
|
||||
{ // this shouldn't happen, but...
|
||||
throw new ConfigException(FrameAssembler.class,"FrameMessages","init.noGlobals",e);
|
||||
|
||||
} // end catch
|
||||
|
||||
// Set up the initial values of the global properties.
|
||||
Iterator it = PROP_TO_VELOCITY.entrySet().iterator();
|
||||
while (it.hasNext())
|
||||
{ // scan through maps and load globals
|
||||
Map.Entry ntry = (Map.Entry)(it.next());
|
||||
String key = ntry.getKey().toString();
|
||||
m_globals.put(ntry.getValue().toString(),initLoadProperty(key,(Class)(PROP_TO_TYPE.get(key))));
|
||||
|
||||
} // end while
|
||||
|
||||
// Set up the frame template.
|
||||
m_frame_template = (String)initLoadProperty(PARAM_FRAME_TEMPLATE_NAME,String.class);
|
||||
|
||||
// Set up the initial values for the option set.
|
||||
setupOptions((OptionSet)initLoadProperty(PARAM_OPTIONSET,OptionSet.class));
|
||||
|
||||
m_base_params = new BaseParams(); // create base parameter object
|
||||
|
||||
// Load the menu provider.
|
||||
m_menu_prov = (MenuProvider)(GetObjectUtils.getDynamoComponent(services,MenuProvider.class,name_menu));
|
||||
|
||||
// Register to receive global property update events.
|
||||
EventListenerRegistration reg =
|
||||
(EventListenerRegistration)(services.queryService(EventListenerRegistration.class));
|
||||
m_shut_event = reg.registerDynamicUpdateListener(GlobalPropertyUpdateEvent.class,this);
|
||||
|
||||
// Add an object to the standard objects available to Velocity.
|
||||
VelocityRendererConfig vrcon =
|
||||
(VelocityRendererConfig)(services.queryService(VelocityRendererConfig.class));
|
||||
m_shut_vr = vrcon.addStandardComponentInstance("frame",new VelocityOps());
|
||||
|
||||
// Register this object as a filter for output.
|
||||
OutputObjectFilterRegistration freg =
|
||||
(OutputObjectFilterRegistration)(services.queryService(OutputObjectFilterRegistration.class));
|
||||
m_shut_fasm = freg.registerOutputObjectFilter(this);
|
||||
|
||||
logger.info("FrameAssembler init complete");
|
||||
|
||||
} // end initialize
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface ComponentShutdown
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public void shutdown()
|
||||
{
|
||||
m_shut_fasm.shutdown();
|
||||
m_shut_fasm = null;
|
||||
m_shut_vr.shutdown();
|
||||
m_shut_vr = null;
|
||||
m_shut_event.shutdown();
|
||||
m_shut_event = null;
|
||||
m_base_params = null;
|
||||
m_menu_prov = null;
|
||||
m_props = null;
|
||||
m_blocks = null;
|
||||
m_globals.clear();
|
||||
|
||||
} // end shutdown
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface OutputObjectFilter
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public Object filterObject(Object input, Request r) throws RenderingException
|
||||
{
|
||||
if (RequestType.HTTP.equals(r.getType()) && (input instanceof FramedContent))
|
||||
{ // we need to retrieve the user from the session
|
||||
try
|
||||
{ // get the user
|
||||
RequestHelper rh = new RequestHelper(r);
|
||||
SessionInfo session = rh.getSession();
|
||||
DynamoUser user = (DynamoUser)(session.getObject(SessionInfoParams.NAMESPACE,
|
||||
SessionInfoParams.ATTR_USER));
|
||||
|
||||
// get the request-borne data
|
||||
String location = (String)(r.getObject(SessionInfoParams.REQ_NAMESPACE,
|
||||
SessionInfoParams.RATTR_LOCATION));
|
||||
Boolean display_login = (Boolean)(r.getObject(SessionInfoParams.REQ_NAMESPACE,
|
||||
SessionInfoParams.RATTR_DISPLAY_LOGIN));
|
||||
|
||||
// get the menus
|
||||
MenuRenderObject fixed_menu = m_menu_prov.getLeftMenu(user,VeniceNamespaces.FRAME_LAF_NAMESPACE,
|
||||
"fixed.menu",NO_ACLS);
|
||||
|
||||
// get the footer and optionally insert line breaks
|
||||
String footer = (String)(m_blocks.getObject(NAMESPACE,BLOCK_FOOTER));
|
||||
if (m_footer_breaks)
|
||||
// set up the regular expression system to replace carriage returns to insert a <br />
|
||||
footer = PAT_LINEBREAK.matcher(footer).replaceAll("<br />\r\n");
|
||||
|
||||
return new FrameRendering((FramedContent)input,m_frame_template,m_base_params,user,location,
|
||||
display_login,fixed_menu,footer);
|
||||
|
||||
} // end try
|
||||
catch (DatabaseException e)
|
||||
{ // rethrow it as a RenderingException
|
||||
throw new RenderingException(e);
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
|
||||
return null;
|
||||
|
||||
} // end filterObject
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface DynamicUpdateListener
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public void updateReceived(DynamicUpdateEvent evt)
|
||||
{
|
||||
GlobalPropertyUpdateEvent event = (GlobalPropertyUpdateEvent)evt;
|
||||
if (NAMESPACE.equals(event.getPropertyNamespace()))
|
||||
{ // see if this is one of the properties we monitor
|
||||
String key = (String)(PROP_TO_VELOCITY.get(event.getPropertyName()));
|
||||
if (key!=null)
|
||||
m_globals.put(key,m_props.getObject(NAMESPACE,event.getPropertyName()));
|
||||
|
||||
if (PARAM_FRAME_TEMPLATE_NAME.equals(event.getPropertyName()))
|
||||
m_frame_template = (String)(m_props.getObject(NAMESPACE,event.getPropertyName()));
|
||||
|
||||
if (PARAM_OPTIONSET.equals(event.getPropertyName()))
|
||||
setupOptions((OptionSet)(m_props.getObject(NAMESPACE,event.getPropertyName())));
|
||||
|
||||
} // end if
|
||||
|
||||
} // end updateReceived
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Static initializer
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static
|
||||
{ // Initialize the mapping from property names to Velocity parameter names.
|
||||
HashMap tmp = new HashMap();
|
||||
HashMap tmp2 = new HashMap();
|
||||
tmp.put(PARAM_SITE_TITLE,"sitetitle");
|
||||
tmp2.put(PARAM_SITE_TITLE,String.class);
|
||||
tmp.put(PARAM_SITE_URL,"siteurl");
|
||||
tmp2.put(PARAM_SITE_URL,String.class);
|
||||
tmp.put(PARAM_SITE_LOGO_URL,"logourl");
|
||||
tmp2.put(PARAM_SITE_LOGO_URL,String.class);
|
||||
tmp.put(PARAM_SITE_LOGO_URL_TYPE,"logourltype");
|
||||
tmp2.put(PARAM_SITE_LOGO_URL_TYPE,String.class);
|
||||
tmp.put(PARAM_SITE_LOGO_WIDTH,"logowidth");
|
||||
tmp2.put(PARAM_SITE_LOGO_WIDTH,Integer.class);
|
||||
tmp.put(PARAM_SITE_LOGO_HEIGHT,"logoheight");
|
||||
tmp2.put(PARAM_SITE_LOGO_HEIGHT,Integer.class);
|
||||
tmp.put(PARAM_FOOTER_LOGO_SCALE,"flogoscale");
|
||||
tmp2.put(PARAM_FOOTER_LOGO_SCALE,Integer.class);
|
||||
tmp.put(PARAM_PAGEICON_URL,"pgicon_url");
|
||||
tmp2.put(PARAM_PAGEICON_URL,String.class);
|
||||
tmp.put(PARAM_PAGEICON_URL_TYPE,"pgicon_ltyp");
|
||||
tmp2.put(PARAM_PAGEICON_URL_TYPE,String.class);
|
||||
tmp.put(PARAM_PAGEICON_TYPE,"pgicon_mime");
|
||||
tmp2.put(PARAM_PAGEICON_TYPE,String.class);
|
||||
tmp.put(PARAM_FAVICON_URL,"favicon_url");
|
||||
tmp2.put(PARAM_FAVICON_URL,String.class);
|
||||
tmp.put(PARAM_FAVICON_URL_TYPE,"favicon_ltyp");
|
||||
tmp2.put(PARAM_FAVICON_URL_TYPE,String.class);
|
||||
PROP_TO_VELOCITY = Collections.unmodifiableMap(tmp);
|
||||
PROP_TO_TYPE = Collections.unmodifiableMap(tmp2);
|
||||
|
||||
} // end static initializer
|
||||
|
||||
} // end class FrameAssembler
|
||||
109
src/venice-base/com/silverwrist/venice/frame/FrameDialog.java
Normal file
109
src/venice-base/com/silverwrist/venice/frame/FrameDialog.java
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
* (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.mozilla.org/MPL/>.
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
* Copyright (C) 2002-03 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
package com.silverwrist.venice.frame;
|
||||
|
||||
import java.io.IOException;
|
||||
import com.silverwrist.dynamo.except.*;
|
||||
import com.silverwrist.dynamo.iface.*;
|
||||
|
||||
public class FrameDialog implements FramedContent, SelfRenderable
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private Dialog m_dialog;
|
||||
private String m_menu_sel = null;
|
||||
private String m_qid = null;
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructors
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public FrameDialog(Dialog dialog)
|
||||
{
|
||||
m_dialog = dialog;
|
||||
|
||||
} // end constructor
|
||||
|
||||
public FrameDialog(Dialog dialog, String menu_sel)
|
||||
{
|
||||
m_dialog = dialog;
|
||||
m_menu_sel = menu_sel;
|
||||
|
||||
} // end constructor
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface FramedContent
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public String getMenuSelector()
|
||||
{
|
||||
return m_menu_sel;
|
||||
|
||||
} // end getMenuSelector
|
||||
|
||||
public String getPageTitle()
|
||||
{
|
||||
String s = m_dialog.getSubtitle();
|
||||
if (s==null)
|
||||
return m_dialog.getTitle();
|
||||
StringBuffer buf = new StringBuffer(m_dialog.getTitle());
|
||||
buf.append(" - ").append(s);
|
||||
return buf.toString();
|
||||
|
||||
} // end getPageTitle
|
||||
|
||||
public String getPageQID()
|
||||
{
|
||||
return m_qid;
|
||||
|
||||
} // end getPageQID
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface SelfRenderable
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public void render(SelfRenderControl control) throws IOException, RenderingException
|
||||
{
|
||||
m_dialog.render(control.getTextRender());
|
||||
|
||||
} // end render
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* External operations
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public void setMenuSelector(String s)
|
||||
{
|
||||
m_menu_sel = s;
|
||||
|
||||
} // end setMenuSelector
|
||||
|
||||
public void setPageQID(String s)
|
||||
{
|
||||
m_qid = s;
|
||||
|
||||
} // end setPageQID
|
||||
|
||||
} // end class FrameDialog
|
||||
@@ -0,0 +1,23 @@
|
||||
# The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
# (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.mozilla.org/MPL/>.
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
# WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
# language governing rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is the Venice Web Communities System.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
# for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
# Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# ---------------------------------------------------------------------------------
|
||||
# This file has been localized for the en_US locale
|
||||
init.noGlobals=Unable to find the global properties provider (should be named "globals").
|
||||
property.notFound=Unable to get value of frame property "{0}".
|
||||
property.wrongClass=Value of property "{0}" is not of class "{1}".
|
||||
ss.noPrefix=Configuration error: no stylesheet prefix configured for servlet path {0}.
|
||||
ss.noTemplate=No stylesheet template name found for property "{0}".
|
||||
ss.renderFail=Unable to render stylesheet template {0}: {1}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
* (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.mozilla.org/MPL/>.
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
* Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
package com.silverwrist.venice.frame;
|
||||
|
||||
import com.silverwrist.venice.VeniceNamespaces;
|
||||
|
||||
public interface FrameParameters
|
||||
{
|
||||
public static final String NAMESPACE = VeniceNamespaces.FRAME_LAF_NAMESPACE;
|
||||
|
||||
public static final String PARAM_SITE_TITLE = "site.title";
|
||||
|
||||
public static final String PARAM_OPTIONSET = "optionset";
|
||||
|
||||
public static final String PARAM_SITE_URL = "site.url";
|
||||
|
||||
public static final String PARAM_SITE_LOGO_URL = "site.logo.url";
|
||||
|
||||
public static final String PARAM_SITE_LOGO_URL_TYPE = "site.logo.url.type";
|
||||
|
||||
public static final String PARAM_SITE_LOGO_WIDTH = "site.logo.width";
|
||||
|
||||
public static final String PARAM_SITE_LOGO_HEIGHT = "site.logo.height";
|
||||
|
||||
public static final String PARAM_FRAME_TEMPLATE_NAME = "frame.template";
|
||||
|
||||
public static final String PARAM_FOOTER_LOGO_SCALE = "footer.logo.scale";
|
||||
|
||||
public static final String PARAM_PAGEICON_URL = "page.icon.url";
|
||||
|
||||
public static final String PARAM_PAGEICON_URL_TYPE = "page.icon.url.type";
|
||||
|
||||
public static final String PARAM_PAGEICON_TYPE = "page.icon.type";
|
||||
|
||||
public static final String PARAM_FAVICON_URL = "page.favicon.url";
|
||||
|
||||
public static final String PARAM_FAVICON_URL_TYPE = "page.favicon.url.type";
|
||||
|
||||
public static final String BLOCK_FOOTER = "footer";
|
||||
|
||||
public static final int OPT_COMMENTS = 0;
|
||||
public static final int OPT_SMARTTAG = 1;
|
||||
public static final int OPT_FOOTER_BREAKS = 2;
|
||||
|
||||
} // end interface FrameParameters
|
||||
102
src/venice-base/com/silverwrist/venice/frame/FrameRendering.java
Normal file
102
src/venice-base/com/silverwrist/venice/frame/FrameRendering.java
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
* (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.mozilla.org/MPL/>.
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
* Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
package com.silverwrist.venice.frame;
|
||||
|
||||
import java.util.*;
|
||||
import com.silverwrist.dynamo.iface.*;
|
||||
import com.silverwrist.dynamo.util.*;
|
||||
import com.silverwrist.dynamo.velocity.VelocityParamSupplier;
|
||||
import com.silverwrist.dynamo.velocity.VelocityRenderable;
|
||||
import com.silverwrist.venice.VeniceNamespaces;
|
||||
import com.silverwrist.venice.iface.*;
|
||||
|
||||
class FrameRendering implements VelocityRenderable
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private String m_templ;
|
||||
private VelocityParamSupplier m_base_params;
|
||||
private HashMap m_local_vars = new HashMap();
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructor
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
FrameRendering(FramedContent content, String templ, VelocityParamSupplier base_params, DynamoUser user,
|
||||
String location, Boolean display_login, MenuRenderObject fixed_menu, String footer)
|
||||
{
|
||||
m_templ = templ;
|
||||
m_base_params = base_params;
|
||||
m_local_vars.put("content",content);
|
||||
m_local_vars.put("pagetitle",content.getPageTitle());
|
||||
m_local_vars.put("qid",content.getPageQID());
|
||||
m_local_vars.put("user",user);
|
||||
m_local_vars.put("unverified",
|
||||
Boolean.valueOf(PropertyUtils.hasProperty(user,VeniceNamespaces.USER_SETTINGS_NAMESPACE,
|
||||
"confirmation.number")));
|
||||
m_local_vars.put("location",location);
|
||||
m_local_vars.put("display_login",display_login);
|
||||
m_local_vars.put("fixed_menu",fixed_menu);
|
||||
m_local_vars.put("footer_text",footer);
|
||||
|
||||
} // end constructor
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface VelocityParamSupplier
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public Object getParameter(String key)
|
||||
{
|
||||
Object rc = m_local_vars.get(key);
|
||||
if (rc==null)
|
||||
rc = m_base_params.getParameter(key);
|
||||
return rc;
|
||||
|
||||
} // end getParameter
|
||||
|
||||
public Collection getParameterNames()
|
||||
{
|
||||
HashSet rc = new HashSet(m_local_vars.keySet());
|
||||
rc.addAll(m_base_params.getParameterNames());
|
||||
return Collections.unmodifiableSet(rc);
|
||||
|
||||
} // end getParameterNames
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface VelocityRenderable
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public String getMimeType()
|
||||
{
|
||||
return "text/html";
|
||||
|
||||
} // end getMimeType
|
||||
|
||||
public String getTemplateName()
|
||||
{
|
||||
return m_templ;
|
||||
|
||||
} // end getTemplateName
|
||||
|
||||
} // end class FrameRendering
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
* (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.mozilla.org/MPL/>.
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
* Copyright (C) 2002-03 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
package com.silverwrist.venice.frame;
|
||||
|
||||
/**
|
||||
* An interface implemented by content objects that are to be rendered inside the Venice frame.
|
||||
* The Venice frame provides the outer border, top bar with basic links and ad banner, left bar with
|
||||
* menus, and page footer with standard text and graphics.
|
||||
* <P>Objects implementing this interface are intercepted by an
|
||||
* {@link com.silverwrist.dynamo.iface.OutputObjectFilter OutputObjectFilter} installed by the
|
||||
* {@link com.silverwrist.venice.frame.FrameAssembler FrameAssembler} class, and are wrapped in an object
|
||||
* ({@link com.silverwrist.venice.frame.FrameRendering FrameRendering}), which then renders it as part
|
||||
* of its rendering process.
|
||||
*
|
||||
* @author Eric J. Bowersox <erbo@silcom.com>
|
||||
* @version X
|
||||
*/
|
||||
public interface FramedContent
|
||||
{
|
||||
/**
|
||||
* Returns the desired menu selector for this page. The <EM>menu selector</EM> is a string that specifies
|
||||
* which menu is to be displayed on the left menu bar, in addition to the "global menu." This value may
|
||||
* be <CODE>null</CODE>, in which case the current menu selector is not changed.
|
||||
*
|
||||
* @return The desired menu selector.
|
||||
*/
|
||||
public String getMenuSelector();
|
||||
|
||||
/**
|
||||
* Returns the desired title for the page. This title is concatenated with the <EM>site title</EM> (set in
|
||||
* global properties) to form the actual page title that gets sent to the browser.
|
||||
*
|
||||
* @return The desired page title.
|
||||
*/
|
||||
public String getPageTitle();
|
||||
|
||||
/**
|
||||
* Returns the desired quick ID for the page. The <EM>page quick ID</EM> is a small text string which can be used
|
||||
* to "tag" the page with a unique identifier, for use with external tools such as offsite hit counters.
|
||||
* If this value is <CODE>null</CODE>, the quick ID is not used for this page.
|
||||
*
|
||||
* @return The desired page quick ID.
|
||||
*/
|
||||
public String getPageQID();
|
||||
|
||||
} // end interface FramedContent
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
* (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.mozilla.org/MPL/>.
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
* Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
package com.silverwrist.venice.frame;
|
||||
|
||||
import java.io.*;
|
||||
import com.silverwrist.dynamo.except.*;
|
||||
import com.silverwrist.dynamo.iface.*;
|
||||
|
||||
class StyleSheetData
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private String m_css_data;
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructor
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
StyleSheetData(String css_data)
|
||||
{
|
||||
m_css_data = css_data;
|
||||
|
||||
} // end constructor
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* External operations
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void render(TextRenderControl control) throws IOException, RenderingException
|
||||
{
|
||||
control.setContentType("text/css");
|
||||
PrintWriter wr = control.getWriter();
|
||||
wr.write(m_css_data);
|
||||
wr.print("\n");
|
||||
wr.flush();
|
||||
|
||||
} // end render
|
||||
|
||||
} // end class StyleSheetData
|
||||
@@ -0,0 +1,288 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
* (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.mozilla.org/MPL/>.
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
* Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
package com.silverwrist.venice.frame;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import org.apache.commons.collections.*;
|
||||
import org.apache.log4j.Logger;
|
||||
import com.silverwrist.dynamo.event.*;
|
||||
import com.silverwrist.dynamo.except.*;
|
||||
import com.silverwrist.dynamo.iface.*;
|
||||
import com.silverwrist.dynamo.servlet.ServletBase;
|
||||
import com.silverwrist.dynamo.util.*;
|
||||
import com.silverwrist.dynamo.velocity.VelocityRenderable;
|
||||
import com.silverwrist.venice.VeniceNamespaces;
|
||||
import com.silverwrist.venice.except.*;
|
||||
import com.silverwrist.venice.iface.*;
|
||||
import com.silverwrist.venice.session.SessionInfoParams;
|
||||
|
||||
public class StyleSheetServlet extends ServletBase
|
||||
implements ComponentShutdown, TextRenderer, DynamicUpdateListener
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Inner class implementing the template for rendering.
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private class StyleSheetTemplate implements VelocityRenderable
|
||||
{
|
||||
/*====================================================================
|
||||
* Attributes
|
||||
*====================================================================
|
||||
*/
|
||||
|
||||
private String m_template_name;
|
||||
|
||||
/*====================================================================
|
||||
* Constructor
|
||||
*====================================================================
|
||||
*/
|
||||
|
||||
StyleSheetTemplate(String template_name)
|
||||
{
|
||||
m_template_name = template_name;
|
||||
|
||||
} // end constructor
|
||||
|
||||
/*====================================================================
|
||||
* Implementations from interface VelocityParamSupplier
|
||||
*====================================================================
|
||||
*/
|
||||
|
||||
public Object getParameter(String key)
|
||||
{
|
||||
return null;
|
||||
|
||||
} // end getParameter
|
||||
|
||||
public Collection getParameterNames()
|
||||
{
|
||||
return Collections.EMPTY_SET;
|
||||
|
||||
} // end getParameterNames
|
||||
|
||||
/*====================================================================
|
||||
* Implementations from interface VelocityRenderable
|
||||
*====================================================================
|
||||
*/
|
||||
|
||||
public String getMimeType()
|
||||
{
|
||||
return "text/css";
|
||||
|
||||
} // end getMimeType
|
||||
|
||||
public String getTemplateName()
|
||||
{
|
||||
return m_template_name;
|
||||
|
||||
} // end getTemplateName
|
||||
|
||||
} // end class StyleSheetTemplate
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Static data members
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private static Logger logger = Logger.getLogger(StyleSheetServlet.class);
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private ObjectProvider m_props;
|
||||
private ReferenceMap m_cache = new ReferenceMap(ReferenceMap.HARD,ReferenceMap.SOFT);
|
||||
private Object m_cache_sync = new Object();
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Abstract implementations from class ServletBase
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected Object process(Request r, Application app) throws Exception
|
||||
{
|
||||
// Get the first half of the sheet property name, based on the request servlet name.
|
||||
StylesheetMapper mapper = (StylesheetMapper)(app.queryService(StylesheetMapper.class));
|
||||
String prop1 = mapper.getStylesheetPrefix(r.getRequestPath());
|
||||
if (prop1==null)
|
||||
{ // no configuration - throw this
|
||||
logger.error("stylesheet prefix for " + r.getRequestPath() + " not configured");
|
||||
StyleSheetException sse = new StyleSheetException(StyleSheetServlet.class,"FrameMessages","ss.noPrefix");
|
||||
sse.setParameter(0,r.getRequestPath());
|
||||
throw sse;
|
||||
|
||||
} // end if
|
||||
|
||||
// Get the second half of the sheet property name - the stylesheet type as noted
|
||||
// in the session.
|
||||
RequestHelper rh = new RequestHelper(r);
|
||||
SessionInfo session = rh.getSession();
|
||||
String prop2 = null;
|
||||
try
|
||||
{ // get the property name
|
||||
prop2 = (String)(session.getObject(SessionInfoParams.NAMESPACE,
|
||||
SessionInfoParams.ATTR_STYLESHEET_SELECTOR));
|
||||
|
||||
} // end try
|
||||
catch (NoSuchObjectException e)
|
||||
{ // property not found
|
||||
logger.warn("session stylesheet selector not found, defaulting to 'normal'");
|
||||
prop2 = "normal"; // default value
|
||||
|
||||
} // end catch
|
||||
|
||||
String propname = "sheet." + prop1 + "." + prop2; // this is the full property name
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Stylesheet property name: " + propname);
|
||||
|
||||
StyleSheetData rc = null;
|
||||
synchronized (m_cache_sync)
|
||||
{ // See if the stylesheet is cached.
|
||||
rc = (StyleSheetData)(m_cache.get(propname));
|
||||
if (rc==null)
|
||||
{ // generate the style sheet data and cache it
|
||||
String template_name = null;
|
||||
try
|
||||
{ // get the template name
|
||||
template_name = (String)(m_props.getObject(VeniceNamespaces.STYLESHEET_NAMESPACE,propname));
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Rendering template name: " + template_name);
|
||||
|
||||
} // end try
|
||||
catch (NoSuchObjectException e)
|
||||
{ // property not found - throw an exception
|
||||
logger.error("did not find stylesheet property with name " + propname,e);
|
||||
StyleSheetException sse = new StyleSheetException(StyleSheetServlet.class,"FrameMessages",
|
||||
"ss.noTemplate",e);
|
||||
sse.setParameter(0,propname);
|
||||
throw sse;
|
||||
|
||||
} // end catch
|
||||
|
||||
// create and render the template
|
||||
StyleSheetTemplate templ = new StyleSheetTemplate(template_name);
|
||||
RenderImmediate rimm = (RenderImmediate)(r.queryService(RenderImmediate.class));
|
||||
try
|
||||
{ // render the stylesheet template and create the StyleSheetData object
|
||||
rc = new StyleSheetData(rimm.renderTextObject(templ));
|
||||
|
||||
} // end try
|
||||
catch (IOException e)
|
||||
{ // throw this as an exception
|
||||
logger.error("RenderImmediate on stylesheet " + template_name + " threw IOException",e);
|
||||
StyleSheetException sse = new StyleSheetException(StyleSheetServlet.class,"FrameMessages",
|
||||
"ss.renderFail",e);
|
||||
sse.setParameter(0,template_name);
|
||||
sse.setParameter(1,e.getMessage());
|
||||
throw sse;
|
||||
|
||||
} // end catch
|
||||
catch (RenderingException e)
|
||||
{ // throw this as an exception
|
||||
logger.error("RenderImmediate on stylesheet " + template_name + " threw RenderingException",e);
|
||||
StyleSheetException sse = new StyleSheetException(StyleSheetServlet.class,"FrameMessages",
|
||||
"ss.renderFail",e);
|
||||
sse.setParameter(0,template_name);
|
||||
sse.setParameter(1,e.getMessage());
|
||||
throw sse;
|
||||
|
||||
} // end catch
|
||||
|
||||
m_cache.put(propname,rc); // cache the new data
|
||||
|
||||
} // end if
|
||||
|
||||
} // end synchronized block
|
||||
|
||||
return rc; // return the style sheet data
|
||||
|
||||
} // end process
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Overrides from class ServletBase
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected void initServlet(ServiceProvider services) throws DynamoException
|
||||
{
|
||||
logger.info("Starting up StyleSheetServlet");
|
||||
|
||||
// Get the global properties provider.
|
||||
ServiceProvider gprop_sp =
|
||||
(ServiceProvider)(GetObjectUtils.getDynamoComponent(services,ServiceProvider.class,"globals"));
|
||||
m_props = (ObjectProvider)(gprop_sp.queryService(ObjectProvider.class,"properties"));
|
||||
|
||||
// Register this class as being a renderer for StyleSheetData.
|
||||
RendererRegistration rreg = (RendererRegistration)(services.queryService(RendererRegistration.class));
|
||||
addShutdownHook(rreg.registerRenderer(StyleSheetData.class,this));
|
||||
|
||||
// Register to receive global property update events.
|
||||
EventListenerRegistration reg =
|
||||
(EventListenerRegistration)(services.queryService(EventListenerRegistration.class));
|
||||
addShutdownHook(reg.registerDynamicUpdateListener(GlobalPropertyUpdateEvent.class,this));
|
||||
|
||||
logger.info("StyleSheetServlet initialized");
|
||||
|
||||
} // end initServlet
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface ComponentShutdown
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public void shutdown()
|
||||
{
|
||||
m_props = null;
|
||||
|
||||
} // end shutdown
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface TextRenderer
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public void render(Object obj, TextRenderControl control) throws IOException, RenderingException
|
||||
{
|
||||
((StyleSheetData)obj).render(control);
|
||||
|
||||
} // end render
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface DynamicUpdateListener
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public void updateReceived(DynamicUpdateEvent evt)
|
||||
{
|
||||
GlobalPropertyUpdateEvent event = (GlobalPropertyUpdateEvent)evt;
|
||||
if (VeniceNamespaces.STYLESHEET_NAMESPACE.equals(event.getPropertyNamespace()))
|
||||
{ // a stylesheet template name has changed...
|
||||
synchronized (m_cache_sync)
|
||||
{ // un-cache the corresponding stylesheet data
|
||||
m_cache.remove(event.getPropertyName());
|
||||
|
||||
} // end synchronized block
|
||||
|
||||
} // end if
|
||||
|
||||
} // end updateReceived
|
||||
|
||||
} // end class StyleSheetServlet
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
* (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.mozilla.org/MPL/>.
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
* Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
package com.silverwrist.venice.frame;
|
||||
|
||||
import java.io.IOException;
|
||||
import com.silverwrist.dynamo.except.*;
|
||||
import com.silverwrist.dynamo.iface.*;
|
||||
|
||||
public class TempFramedContent implements FramedContent, SelfRenderable
|
||||
{
|
||||
private Object m_obj;
|
||||
|
||||
public TempFramedContent(Object obj)
|
||||
{
|
||||
m_obj = obj;
|
||||
|
||||
} // end constructor
|
||||
|
||||
public String getMenuSelector()
|
||||
{
|
||||
return "";
|
||||
|
||||
} // end getMenuSelector
|
||||
|
||||
public String getPageTitle()
|
||||
{
|
||||
return "TempFramedContent";
|
||||
|
||||
} // end getPageTitle
|
||||
|
||||
public String getPageQID()
|
||||
{
|
||||
return "";
|
||||
|
||||
} // end getPageQID
|
||||
|
||||
public void render(SelfRenderControl control) throws IOException, RenderingException
|
||||
{
|
||||
control.getTextRender().renderSubObject(m_obj);
|
||||
|
||||
} // end render
|
||||
|
||||
} // end class TempFramedContent
|
||||
Reference in New Issue
Block a user