added community logo support and the logo on top of the community left menu;

fixed some bugs with menu handling
This commit is contained in:
Eric J. Bowersox
2003-06-16 23:59:30 +00:00
parent f8ddd74223
commit 2aae5c47eb
19 changed files with 981 additions and 11 deletions

View File

@@ -0,0 +1,318 @@
/*
* 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.content;
import java.io.*;
import org.apache.log4j.Logger;
import org.w3c.dom.*;
import com.silverwrist.util.xml.*;
import com.silverwrist.dynamo.event.*;
import com.silverwrist.dynamo.except.*;
import com.silverwrist.dynamo.iface.*;
import com.silverwrist.dynamo.util.*;
import com.silverwrist.venice.VeniceNamespaces;
import com.silverwrist.venice.iface.*;
public class CommunityLogoRenderer
implements NamedObject, ComponentInitialize, ComponentShutdown, DynamicUpdateListener, ServiceProvider,
RenderImage
{
/*--------------------------------------------------------------------------------
* Internal rendering object
*--------------------------------------------------------------------------------
*/
private class RenderObject implements SelfRenderable
{
/*====================================================================
* Attributes
*====================================================================
*/
private String m_url;
/*====================================================================
* Constructor
*====================================================================
*/
RenderObject(String url)
{
m_url = url;
} // end constructor
/*====================================================================
* Implementations from interface SelfRenderable
*====================================================================
*/
public void render(SelfRenderControl control) throws IOException, RenderingException
{
renderImageTag(control.getTextRender(),m_url);
} // end render
} // end class RenderObject
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
private static Logger logger = Logger.getLogger(CommunityLogoRenderer.class);
private static final String NAMESPACE = VeniceNamespaces.COMMUNITY_GLOBALS_NAMESPACE;
private static final String PROP_WIDTH = "community.logo.width";
private static final String PROP_HEIGHT = "community.logo.height";
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private String m_name = null; // object name
private ObjectProvider m_props; // pointer to global property provider
private ComponentShutdown m_shut_event; // event handler shutdown
private int m_width; // width for community logos
private int m_height; // height for community logos
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public CommunityLogoRenderer()
{ // do nothing
} // end constructor
/*--------------------------------------------------------------------------------
* Internal operations
*--------------------------------------------------------------------------------
*/
private final int getInitInteger(String name) throws ConfigException
{
try
{ // call through to the property provider
return ((Integer)(m_props.getObject(NAMESPACE,name))).intValue();
} // end try
catch (NoSuchObjectException e)
{ // the property value isn't present? yIkes!
ConfigException ce = new ConfigException(CommunityLogoRenderer.class,"ContentMessages","prop.missing",e);
ce.setParameter(0,name);
throw ce;
} // end catch
catch (ClassCastException e)
{ // not an Integer? for shame!
ConfigException ce = new ConfigException(CommunityLogoRenderer.class,"ContentMessages","prop.wrongType",e);
ce.setParameter(0,name);
throw ce;
} // end catch
} // end getInitInteger
/*--------------------------------------------------------------------------------
* 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("CommunityLogoRenderer initializing");
XMLLoader loader = XMLLoader.get();
String gprops = 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");
} // end try
catch (XMLLoadException e)
{ // error loading XML config data
logger.fatal("XML loader exception in CommunityLogoRenderer",e);
throw new ConfigException(e);
} // end catch
// Get the standard properties provider.
ServiceProvider gdm_sp =
(ServiceProvider)(GetObjectUtils.getDynamoComponent(services,ServiceProvider.class,gprops));
try
{ // get the "properties" service from that object
m_props = (ObjectProvider)(gdm_sp.queryService(ObjectProvider.class,"properties"));
} // end try
catch (NoSuchServiceException e)
{ // this shouldn't happen, but...
logger.fatal("Unable to find global properties object \"" + gprops + "\"",e);
throw new ConfigException(CommunityLogoRenderer.class,"ContentMessages","init.noProp",e);
} // end catch
// Get the initial property values for our properties.
m_width = getInitInteger(PROP_WIDTH);
m_height = getInitInteger(PROP_HEIGHT);
// Register with the event listener to monitor those property values.
EventListenerRegistration reg =
(EventListenerRegistration)(services.queryService(EventListenerRegistration.class));
m_shut_event = reg.registerDynamicUpdateListener(GlobalPropertyUpdateEvent.class,this);
} // end initialize
/*--------------------------------------------------------------------------------
* Implementations from interface ComponentShutdown
*--------------------------------------------------------------------------------
*/
public void shutdown()
{
m_shut_event.shutdown();
m_shut_event = null;
m_props = null;
} // end shutdown
public void updateReceived(DynamicUpdateEvent evt)
{
GlobalPropertyUpdateEvent event = (GlobalPropertyUpdateEvent)evt;
if (NAMESPACE.equals(event.getPropertyNamespace()))
{ // see if this is one of the properties we monitor
try
{ // reuse the "initialization" getters here
if (PROP_WIDTH.equals(event.getPropertyName()))
{ // process new width
int x = getInitInteger(PROP_WIDTH);
m_width = x;
} // end else if
else if (PROP_HEIGHT.equals(event.getPropertyName()))
{ // process new height
int x = getInitInteger(PROP_HEIGHT);
m_height = x;
} // end else if
} // end try
catch (ConfigException ce)
{ // property get failed - don't change the value
} // end catch
} // end if
} // end updateReceived
/*--------------------------------------------------------------------------------
* Implementations from interface ServiceProvider
*--------------------------------------------------------------------------------
*/
/**
* Queries this object for a specified service.
*
* @param klass The class of the object that should be returned as a service.
* @return A service object. The service object is guaranteed to be of the class
* specified by <CODE>klass</CODE>; that is, if <CODE>queryService(klass)</CODE>
* yields some object <CODE>x</CODE>, then the expression <CODE>klass.isInstance(x)</CODE>
* is true.
* @exception com.silverwrist.dynamo.except.NoSuchServiceException If no service is available in
* the specified class.
*/
public Object queryService(Class klass)
{
if (klass==RenderImage.class)
return (RenderImage)this;
throw new NoSuchServiceException(getName(),klass);
} // end queryService
/**
* Queries this object for a specified service.
*
* @param klass The class of the object that should be returned as a service.
* @param serviceid ID for the service to be requested, to further discriminate between requests.
* @return A service object. The service object is guaranteed to be of the class
* specified by <CODE>klass</CODE>; that is, if <CODE>queryService(klass)</CODE>
* yields some object <CODE>x</CODE>, then the expression <CODE>klass.isInstance(x)</CODE>
* is true.
* @exception com.silverwrist.dynamo.except.NoSuchServiceException If no service is available in
* the specified class.
*/
public Object queryService(Class klass, String serviceid)
{
if (klass==RenderImage.class)
return (RenderImage)this;
throw new NoSuchServiceException(getName(),klass,serviceid);
} // end queryService
/*--------------------------------------------------------------------------------
* Implementations from interface RenderImage
*--------------------------------------------------------------------------------
*/
public void renderImageTag(TextRenderControl control, String url) throws IOException, RenderingException
{
PrintWriter wr = control.getWriter();
wr.write("<img src=\"" + url + "\" alt=\"\" width=\"" + m_width + "\" height=\"" + m_height
+ "\" border=\"0\" />");
} // end renderImageTag
public Object getRenderingObject(String url)
{
return new RenderObject(url);
} // end getRenderingObject
} // end class CommunityLogoRenderer

View File

@@ -37,7 +37,7 @@ public class UserPhotoRenderer
*--------------------------------------------------------------------------------
*/
class RenderObject implements SelfRenderable
private class RenderObject implements SelfRenderable
{
/*====================================================================
* Attributes

View File

@@ -0,0 +1,163 @@
/*
* 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.dialog;
import java.io.*;
import java.util.*;
import org.w3c.dom.*;
import com.silverwrist.util.*;
import com.silverwrist.util.xml.*;
import com.silverwrist.dynamo.Namespaces;
import com.silverwrist.dynamo.dialog.BaseDialogField;
import com.silverwrist.dynamo.except.*;
import com.silverwrist.dynamo.iface.*;
import com.silverwrist.venice.iface.*;
class CommunityLogoField extends BaseDialogField
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private String m_logo_url = null;
private String m_link_url;
private String m_link_type;
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
CommunityLogoField(Element elt) throws DialogException
{
super(false,elt);
XMLLoader loader = XMLLoader.get();
try
{ // get link URL and link type
m_link_url = loader.getAttribute(elt,"link");
m_link_type = loader.getAttribute(elt,"type");
} // end try
catch (XMLLoadException e)
{ // translate to DialogException
throw new DialogException(e);
} // end catch
// Load caption 2 from messages
ResourceBundle b = ResourceBundle.getBundle("com.silverwrist.venice.dialog.VeniceDialogMessages",
Locale.getDefault());
setCaption2(b.getString("communitylogo.caption2"));
} // end constructor
protected CommunityLogoField(CommunityLogoField other)
{
super(other);
m_logo_url = null;
m_link_url = other.m_link_url;
m_link_type = other.m_link_type;
} // end constructor
/*--------------------------------------------------------------------------------
* Abstract implementations from class BaseDialogField
*--------------------------------------------------------------------------------
*/
protected void renderField(TextRenderControl control, Map render_params)
throws IOException, RenderingException
{
PrintWriter wr = control.getWriter();
if (isEnabled())
{ // write the opening <A> tag
URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class));
wr.write("<a href=\""
+ rewriter.rewriteURL(m_link_type,StringUtils.replaceAllVariables(m_link_url,render_params))
+ "\">");
} // end if
// write the <IMG> tag by running it through the standard communtiy logo renderer
ObjectProvider oprov = (ObjectProvider)(control.queryService(ObjectProvider.class));
ServiceProvider sp = (ServiceProvider)(oprov.getObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,
"venice-communitylogo"));
RenderImage rimg = (RenderImage)(sp.queryService(RenderImage.class));
rimg.renderImageTag(control,m_logo_url);
// write the </A> tag
if (isEnabled())
wr.write("</a>");
} // end renderField
protected void validateContents(Request r, Object data) throws ValidationException
{ // do nothing
} // end validateContents
public Object clone()
{
return new CommunityLogoField(this);
} // end clone
public Object getValue()
{
return m_logo_url;
} // end getValue
public boolean containsValue()
{
return (m_logo_url!=null);
} // end containsValue
public void setValue(Object obj)
{
m_logo_url = ((obj==null) ? null : obj.toString());
} // end setValue
public void setValueFrom(Request r)
{ // do nothing - this doesn't get handled in the usual way
} // end setValueFrom
public void reset()
{ // do nothing
} // end reset
/*--------------------------------------------------------------------------------
* Overrides from class BaseDialogField
*--------------------------------------------------------------------------------
*/
protected boolean isNull(Object value)
{
return false;
} // end isNull
public int getFlags()
{
return 0;
} // end getFlags
} // end class CommunityLogoField

View File

@@ -42,6 +42,8 @@ public class VeniceDialogItemFactory implements DialogItemFactory
String tagname = elt.getTagName();
if (tagname.equals("userphoto"))
return new UserPhotoField(elt);
if (tagname.equals("communitylogo"))
return new CommunityLogoField(elt);
throw new UnknownDialogFieldException(tagname,elt);

View File

@@ -122,6 +122,7 @@ public class VeniceDialogManager implements NamedObject, ComponentInitialize, Co
// Register our own field types.
VeniceDialogItemFactory itemfact = new VeniceDialogItemFactory();
m_shutdown_list.addFirst(dlg_conf.registerDialogItem("userphoto",itemfact));
m_shutdown_list.addFirst(dlg_conf.registerDialogItem("communitylogo",itemfact));
} // end initialize

View File

@@ -17,3 +17,4 @@
# This file has been localized for the en_US locale
userphoto.caption2=(click to change)
cheader.fail=Unable to get content header object: {0}
communitylogo.caption2=(click to change)

View File

@@ -17,6 +17,7 @@
*/
package com.silverwrist.venice.frame;
import java.io.*;
import java.security.acl.AclNotFoundException;
import java.text.MessageFormat;
import java.util.*;
@@ -26,6 +27,7 @@ import org.w3c.dom.*;
import com.silverwrist.util.*;
import com.silverwrist.util.xml.*;
import com.silverwrist.dynamo.DynamoVersion;
import com.silverwrist.dynamo.Namespaces;
import com.silverwrist.dynamo.RequestType;
import com.silverwrist.dynamo.event.*;
import com.silverwrist.dynamo.except.*;
@@ -36,6 +38,7 @@ import com.silverwrist.dynamo.velocity.VelocityParamSupplier;
import com.silverwrist.dynamo.velocity.VelocityRendererConfig;
import com.silverwrist.venice.VeniceNamespaces;
import com.silverwrist.venice.VeniceVersion;
import com.silverwrist.venice.community.CommunityService;
import com.silverwrist.venice.iface.*;
import com.silverwrist.venice.session.SessionInfoParams;
@@ -107,6 +110,110 @@ public class FrameAssembler
} // end class VelocityOps
/*--------------------------------------------------------------------------------
* Internal class that "wraps" the community menu to insert the logo
*--------------------------------------------------------------------------------
*/
private class MyMenuObject implements MenuRenderObject, SelfRenderable
{
/*====================================================================
* Attributes
*====================================================================
*/
private MenuRenderObject m_menu; // inner menu object
private String m_url; // URL of community logo
private String m_urltype = null; // URL type for communtiy logo
/*====================================================================
* Constructor
*====================================================================
*/
MyMenuObject(MenuRenderObject menu, VeniceCommunity comm)
{
m_menu = menu;
m_url = StringUtils.stringize(PropertyUtils.getPropertyNoErr(comm,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,
"url.logo"));
if (m_url==null)
{ // load "no logo" URL from the global properties store
m_url = StringUtils.stringize(m_props.getObject(VeniceNamespaces.COMMUNITY_GLOBALS_NAMESPACE,
"community.nologo.url"));
m_urltype = StringUtils.stringize(m_props.getObject(VeniceNamespaces.COMMUNITY_GLOBALS_NAMESPACE,
"community.nologo.url.type"));
} // end if
} // end constructor
/*====================================================================
* Implementations from interface MenuRenderObject
*====================================================================
*/
public int getItemCount()
{
return m_menu.getItemCount();
} // end getItemCount
public int getItemContainingLinkText(String text)
{
return m_menu.getItemContainingLinkText(text);
} // end getItemContainingLinkText
public void setVariable(String name, String value)
{
m_menu.setVariable(name,value);
} // end setVariable
public void setSelectedIndex(int index)
{
m_menu.setSelectedIndex(index);
} // end setSelectedIndex
/*====================================================================
* Implementations from interface SelfRenderable
*====================================================================
*/
/**
* Renders this object to the output.
*
* @param control A rendering control object that provides the means to render this object to the output, as
* well as providing "output services" (through the
* {@link com.silverwrist.dynamo.iface.ServiceProvider ServiceProvider} interface) for the
* rendering process to use.
* @exception java.io.IOException If an I/O error occurs while writing the output.
* @exception com.silverwrist.dynamo.except.RenderingException If the rendering process fails.
*/
public void render(SelfRenderControl control) throws IOException, RenderingException
{
// figure out the final image URL
String image_url = null;
if (m_urltype!=null)
{ // need to use the URL rewriter on this
URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class));
image_url = rewriter.rewriteURL(m_urltype,m_url);
} // end if
else // just use this URL
image_url = m_url;
TextRenderControl tctl = control.getTextRender();
m_commlogo_render.renderImageTag(tctl,image_url);
PrintWriter wr = tctl.getWriter();
wr.write("<br />");
tctl.renderSubObject(m_menu);
} // end render
} // end class MyMenuObject
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
@@ -129,6 +236,7 @@ public class FrameAssembler
private ObjectProvider m_blocks; // global blocks
private SecurityReferenceMonitor m_srm; // security reference monitor
private MenuProvider m_menu_prov; // menu provider
private RenderImage m_commlogo_render; // community logo renderer
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
@@ -237,7 +345,7 @@ public class FrameAssembler
logger.info("FrameAssembler initializing");
XMLLoader loader = XMLLoader.get();
String gprops = null, name_srm = null, name_menu = null;
String gprops = null, name_srm = null, name_menu = null, name_commlogo = null;
try
{ // verify the right node name
loader.verifyNodeName(config_root,"object");
@@ -254,6 +362,7 @@ public class FrameAssembler
foo = loader.getSubElement(config_root_h,"providers");
name_srm = loader.getAttribute(foo,"security");
name_menu = loader.getAttribute(foo,"menu");
name_commlogo = loader.getAttribute(foo,"commlogo");
} // end try
catch (XMLLoadException e)
@@ -278,6 +387,20 @@ public class FrameAssembler
} // end catch
// Get the community logo provider.
ServiceProvider commlogo_sp =
(ServiceProvider)(GetObjectUtils.getDynamoComponent(services,ServiceProvider.class,name_commlogo));
try
{ // get the RenderImage provider
m_commlogo_render = (RenderImage)(commlogo_sp.queryService(RenderImage.class));
} // end try
catch (NoSuchServiceException e)
{ // this shouldn't happen, but...
throw new ConfigException(FrameAssembler.class,"FrameMessages","init.nocommlogo",e);
} // end catch
// Set up the initial values of the global properties.
Iterator it = PROP_TO_VELOCITY.entrySet().iterator();
while (it.hasNext())
@@ -334,6 +457,7 @@ public class FrameAssembler
m_shut_event.shutdown();
m_shut_event = null;
m_base_params = null;
m_commlogo_render = null;
m_menu_prov = null;
m_props = null;
m_blocks = null;
@@ -387,10 +511,40 @@ public class FrameAssembler
{ // get the current menu selector
Object curr_menusel = PropertyUtils.getPropertyNoErr(session,SessionInfoParams.NAMESPACE,
SessionInfoParams.ATTR_MENU_SELECTOR);
if ((curr_menusel==null) || !(menusel_full.equals(curr_menusel.toString())))
if ( (curr_menusel==null) || !(menusel_full.equals(curr_menusel.toString()))
|| !(PropertyUtils.hasProperty(session,SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_MENU)))
reload = true; // need to reload the menu
} // end if
else
{ // no menu selector specified...but do we have to reload the menu anyway?
if (!(PropertyUtils.hasProperty(session,SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_MENU)))
{ // look to see if there's an actual menu selector present
String curr_menusel =
StringUtils.stringize(PropertyUtils.getPropertyNoErr(session,SessionInfoParams.NAMESPACE,
SessionInfoParams.ATTR_MENU_SELECTOR));
if (curr_menusel!=null)
{ // OK, synthesize menu selector elements from the current one
reload = true;
menusel_full = curr_menusel;
if (curr_menusel.startsWith("community:"))
{ // strip off the community ID, get the community
int cid = Integer.parseInt(curr_menusel.substring(10));
ObjectProvider op = (ObjectProvider)(r.queryService(ObjectProvider.class));
CommunityService csvc = (CommunityService)(op.getObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,
"communities"));
comm = csvc.getCommunity(cid);
menusel = "community";
} // end if
else // normal "top"
menusel = menusel_full;
} // end if
} // end if
} // end else
MenuRenderObject floating_menu = null;
String floating_selector = null;
@@ -412,6 +566,7 @@ public class FrameAssembler
floating_menu.setVariable("alias",comm.getAlias());
floating_menu.setVariable("cid",String.valueOf(comm.getCID()));
floating_menu.setVariable("name",comm.getName());
floating_menu = new MyMenuObject(floating_menu,comm);
} // end else if

View File

@@ -23,3 +23,4 @@ ss.noTemplate=No stylesheet template name found for property "{0}".
ss.renderFail=Unable to render stylesheet template {0}: {1}
generator=Venice Web Communities System {0}; Dynamo Application Framework {1}
frame.noACL=Unable to locate ACL for menu generation.
init.nocommlogo=Unable to find the community logo renderer.

View File

@@ -0,0 +1,138 @@
/*
* 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 FrameWrapper implements FramedContent, SelfRenderable
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private FramedContent m_content; // the actual content
private String m_menu_sel; // menu selector
private String m_page_title; // page title
private String m_page_qid; // page QID
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public FrameWrapper(FramedContent content)
{
m_content = content;
m_menu_sel = content.getMenuSelector();
m_page_title = content.getPageTitle();
m_page_qid = content.getPageQID();
} // end constructor
/*--------------------------------------------------------------------------------
* Implementations from 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()
{
return m_menu_sel;
} // end 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()
{
return m_page_title;
} // end 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()
{
return m_page_qid;
} // end getPageQID
/*--------------------------------------------------------------------------------
* Implementations from interface SelfRenderable
*--------------------------------------------------------------------------------
*/
/**
* Renders this object to the output.
*
* @param control A rendering control object that provides the means to render this object to the output, as
* well as providing "output services" (through the
* {@link com.silverwrist.dynamo.iface.ServiceProvider ServiceProvider} interface) for the
* rendering process to use.
* @exception java.io.IOException If an I/O error occurs while writing the output.
* @exception com.silverwrist.dynamo.except.RenderingException If the rendering process fails.
*/
public void render(SelfRenderControl control) throws IOException, RenderingException
{
TextRenderControl ctl = control.getTextRender();
ctl.renderSubObject(m_content);
} // end render
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
public void setMenuSelector(String s)
{
m_menu_sel = s;
} // end setMenuSelector
public void setPageTitle(String s)
{
m_page_title = s;
} // end setPageTitle
public void setPageQID(String s)
{
m_page_qid = s;
} // end setPageQID
} // end class FrameWrapper

View File

@@ -136,7 +136,6 @@ public class LibraryVenice
public void forceReloadMenu(SessionInfo session)
{
session.removeObject(SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_MENU_SELECTOR);
session.removeObject(SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_MENU);
} // end forceReloadMenu