001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (https://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: https://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: https://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
058        super(caption);
059    }
060
061    /**
062     * Creates a new browser frame with the given caption and content.
063     *
064     * @param caption
065     *            The caption for the component.
066     * @param source
067     *            A Resource representing the Web page that should be displayed.
068     */
069    public CmsBrowserFrame(String caption, Resource source) {
070
071        super(caption, source);
072    }
073
074    /**
075     * Sets the iFrame name attribute.<p>
076     *
077     * @return the iFrame name attribute
078     */
079    public String getName() {
080
081        return getState().getName();
082    }
083
084    /**
085     * Returns the iFrame name attribute.<p>
086     *
087     * @param name the iFrame name attribute
088     */
089    public void setName(String name) {
090
091        getState(true).setName(name);
092    }
093
094    /**
095     * @see com.vaadin.ui.BrowserFrame#getState()
096     */
097    @Override
098    protected CmsBrowserFrameState getState() {
099
100        return (CmsBrowserFrameState)super.getState();
101    }
102
103    /**
104     * @see com.vaadin.ui.AbstractEmbedded#getState(boolean)
105     */
106    @Override
107    protected CmsBrowserFrameState getState(boolean markAsDirty) {
108
109        return (CmsBrowserFrameState)super.getState(markAsDirty);
110    }
111}