001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com)
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * For further information about Alkacon Software, please see the
018 * company website: http://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: http://www.opencms.org
022 *
023 * You should have received a copy of the GNU Lesser General Public
024 * License along with this library; if not, write to the Free Software
025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026 */
027
028package org.opencms.ui.components;
029
030import org.opencms.ui.shared.CmsBrowserFrameState;
031
032import com.vaadin.server.Resource;
033import com.vaadin.ui.BrowserFrame;
034
035/**
036 * Extending the browser frame class to allow setting of the iFrame name attribute.<p>
037 */
038public class CmsBrowserFrame extends BrowserFrame {
039
040    /** The serial version id. */
041    private static final long serialVersionUID = -7614391470292599811L;
042
043    /**
044     * Creates a new empty browser frame.
045     */
046    public CmsBrowserFrame() {
047
048    }
049
050    /**
051     * Creates a new empty browser frame with the given caption.
052     *
053     * @param caption
054     *            The caption for the component
055     */
056    public CmsBrowserFrame(String caption) {
057        super(caption);
058    }
059
060    /**
061     * Creates a new browser frame with the given caption and content.
062     *
063     * @param caption
064     *            The caption for the component.
065     * @param source
066     *            A Resource representing the Web page that should be displayed.
067     */
068    public CmsBrowserFrame(String caption, Resource source) {
069        super(caption, source);
070    }
071
072    /**
073     * Sets the iFrame name attribute.<p>
074     *
075     * @return the iFrame name attribute
076     */
077    public String getName() {
078
079        return getState().getName();
080    }
081
082    /**
083     * Returns the iFrame name attribute.<p>
084     *
085     * @param name the iFrame name attribute
086     */
087    public void setName(String name) {
088
089        getState(true).setName(name);
090    }
091
092    /**
093     * @see com.vaadin.ui.BrowserFrame#getState()
094     */
095    @Override
096    protected CmsBrowserFrameState getState() {
097
098        return (CmsBrowserFrameState)super.getState();
099    }
100
101    /**
102     * @see com.vaadin.ui.AbstractEmbedded#getState(boolean)
103     */
104    @Override
105    protected CmsBrowserFrameState getState(boolean markAsDirty) {
106
107        return (CmsBrowserFrameState)super.getState(markAsDirty);
108    }
109}