158 lines
4.2 KiB
Java

/*
* 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;
private Object m_content_above = null;
private Object m_content_below = 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
public FrameDialog(Dialog dialog, Object above, Object below)
{
m_dialog = dialog;
m_content_above = above;
m_content_below = below;
} // end constructor
public FrameDialog(Dialog dialog, String menu_sel, Object above, Object below)
{
m_dialog = dialog;
m_menu_sel = menu_sel;
m_content_above = above;
m_content_below = below;
} // 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
{
TextRenderControl ctl = control.getTextRender();
if (m_content_above!=null)
ctl.renderSubObject(m_content_above);
m_dialog.render(ctl);
if (m_content_below!=null)
ctl.renderSubObject(m_content_below);
} // 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
public Object getContentAbove()
{
return m_content_above;
} // end getContentAbove
public void setContentAbove(Object obj)
{
m_content_above = obj;
} // end setContentAbove
public Object getContentBelow()
{
return m_content_below;
} // end getContentBelow
public void setContentBelow(Object obj)
{
m_content_below = obj;
} // end setContentBelow
} // end class FrameDialog