MuGenericBorder.java :  » J2EE » WiSerFramework » de » ug2t » channel » markup » generic » Java Open Source

Java Open Source » J2EE » WiSerFramework 
WiSerFramework » de » ug2t » channel » markup » generic » MuGenericBorder.java
// @@
// @@
/*
 * Wi.Ser Framework
 *
 * Version: 1.8.1, 20-September-2007  
 * Copyright (C) 2005 Dirk von der Weiden <dvdw@imail.de>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library located in LGPL.txt in the 
 * license directory; if not, write to the 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA  02111-1307, USA.
 * 
 * If this agreement does not cover your requirements, please contact us
 * via email to get detailed information about the commercial license 
 * or our service offerings!
 *
 */
// @@

package de.ug2t.channel.markup.generic;

import java.util.*;

import de.ug2t.channel.markup.html.renderer.*;
import de.ug2t.connector.*;
import de.ug2t.kernel.*;
import de.ug2t.unifiedGui.interfaces.*;

public final class MuGenericBorder extends MuGenericContainer implements IUnBorder, IKePoolable
{
  private IKeView    pem_view    = new HtmlBorderRenderer();

  protected String   pdm_border  = "1";
  protected String   pdm_boColor = "black";
  protected String   pdm_boStyle = "solid";
  protected IUnImage pem_bgImg   = null;
  private boolean    pem_scroll  = true;

  public MuGenericBorder(String xName, ACoDataGetter xTplGetter, Object xTplName, MuGenericApplication xAppl) throws Exception
  {
    super(xName, xTplGetter, xTplName, xAppl);

    this.pcmf_setView(pem_view);
    this.pcmf_setValue(xName);

    this.pcmf_setFill(true, true);
    this.pdm_getMaxSpace = true;

    return;
  };

  // @@

  public Object pcmf_execView()
  {
    try
    {
      if (this.pcmf_isHidden() && !this.pcmf_getRenderIfHidden())
      {
        this.pcmf_setPropChanged(false);
        Iterator l_it = this.pcmf_getDeepSubNodeIt();
        while (l_it.hasNext())
          ((KeTreeElement)l_it.next()).pcmf_setPropChanged(false);

        return (((MuGenericApplication) this.pcmf_getAppl()).pcmf_getRenderer().pcmf_wrapMarkup("", this));
      }

      KeStringTemplate l_retval = null;
      KeStringTemplate l_body = new KeStringTemplate("");
      Iterator it = this.pcmf_getSubIterator();

      l_retval = (KeStringTemplate) pdm_NodeView.pcmf_output(this);

      IMuGenericLayoutManager l_layout = this.pcmf_getLayoutManager();
      if (l_layout == null)
      {
        Object l_obj = null;
        while (it.hasNext())
        {
          l_obj = it.next();
          l_body.pcmf_stringAddEnd(((KeTreeElement) l_obj).pcmf_execView().toString());
        }
      }
      else
      {
        l_layout.pcmf_layout();
        l_body.pcmf_stringAddEnd(l_layout.pcmf_getMarkupString());
      }

      l_retval = KeTools.pcmf_stringSubst(l_retval, "$BODY", l_body.toString());

      return (((MuGenericApplication) this.pcmf_getAppl()).pcmf_getRenderer().pcmf_wrapMarkup(l_retval.toString() + pcmf_evChannelandMenuOut(), this));
    }
    catch (Exception e)
    {
      KeLog.pcmf_logException("ug2t", this, e);
      return ("ERROR");
    }
  };

  public void pcmf_setBorderLine(int xBorder)
  {
    String l_border = Integer.toString(xBorder);

    if (pdm_border.equals(l_border))
      return;

    this.pdm_border = l_border;
    this.pcmf_setPropChanged(true);

    return;
  };

  public String pcmf_getBoLine()
  {
    return (this.pdm_border);
  }

  public void pcmf_setBoColor(String xColor)
  {
    if (this.pdm_boColor.equals(xColor))
      return;

    this.pdm_boColor = xColor;
    this.pcmf_setPropChanged(true);

    return;
  };

  public String pcmf_getBoColor()
  {
    return (this.pdm_boColor);
  }

  public void pcmf_setBoStyle(int xStyle)
  {
    String l_oldStyle = this.pdm_boStyle;
    switch (xStyle)
    {
      case IUnComponent.INSETS_BORDER:
        this.pdm_boStyle = "inset";
        break;
      case IUnComponent.OUTSETS_BORDER:
        this.pdm_boStyle = "outset";
        break;
      case IUnComponent.LINE_BORDER:
        this.pdm_boStyle = "solid";
        break;
      default:
        this.pdm_boStyle = "none";
    }

    if (l_oldStyle.equals(this.pdm_boStyle))
      return;

    this.pcmf_setPropChanged(true);

    return;
  };

  public String pcmf_getBoStyleText()
  {
    return (this.pdm_boStyle);
  }

  public void pcmf_setBgImage(IUnImage xImg)
  {
    if (this.pem_bgImg == xImg)
      return;

    this.pcmf_setPropChanged(true);
    this.pem_bgImg = xImg;
  }

  public IUnImage pcmf_getBgImage()
  {
    return (this.pem_bgImg);
  };

  public void pcmf_setScroll(boolean xScroll)
  {
    if (this.pem_scroll == xScroll)
      return;

    pem_scroll = xScroll;
    this.pcmf_setPropChanged(true);

    return;
  }

  public boolean pcmf_getScroll()
  {
    return (this.pem_scroll);
  }

  // @@
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.