/*
 * 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
