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.apps;
029
030import org.opencms.ui.I_CmsDialogContext;
031import org.opencms.ui.I_CmsUpdateListener;
032
033import java.io.Serializable;
034
035import com.vaadin.ui.Button;
036import com.vaadin.ui.Component;
037
038/**
039 * The app ui context. Allows OpenCms workplace apps access to the surrounding UI.<p>
040 */
041public interface I_CmsAppUIContext extends Serializable {
042
043    /**
044     * Adds the publish button to the toolbar.<p>
045     *
046     * @param updateListener the update listener, called after publishing
047     *
048     * @return the added button
049     */
050    Button addPublishButton(I_CmsUpdateListener<String> updateListener);
051
052    /**
053     * Adds a toolbar button.<p>
054     *
055     * @param button the button to add
056     */
057    void addToolbarButton(Component button);
058
059    /**
060     * Adds a toolbar button to the right hand side.<p>
061     *
062     * @param button the button to add
063     */
064    void addToolbarButtonRight(Component button);
065
066    /**
067     * Removes the app's toolbar buttons.<p>
068     */
069    void clearToolbarButtons();
070
071    /**
072     * Enables or removes the default toolbar buttons.<p>
073     * These are the context menu and the quick launch drop down.<p>
074     * The default is <code>enabled = true</code>.<p>
075     *
076     * @param enabled <code>true</code> to enable the buttons
077     */
078    void enableDefaultToolbarButtons(boolean enabled);
079
080    /**
081     * Returns the app id.<p>
082     *
083     * @return the app id
084     */
085    String getAppId();
086
087    /**
088     * Gets an attribute.
089     *
090     * @param key the attribute key
091     *
092     * @return the attribute value
093     */
094    Object getAttribute(String key);
095
096    /**
097     * Hides the the toolbar.<p>
098     */
099    void hideToolbar();
100
101    /**
102     * Removes the given button from the toolbar.<p>
103     *
104     * @param button the button to remove
105     */
106    void removeToolbarButton(Component button);
107
108    /**
109     * Sets the app content component.<p>
110     *
111     * @param appContent the app content
112     */
113    void setAppContent(Component appContent);
114
115    /**
116     * Sets the app info component.<p>
117     *
118     * @param infoContent the info component
119     */
120    void setAppInfo(Component infoContent);
121
122    /**
123     * Sets the app title.<p>
124     *
125     * @param title the app title
126     */
127    void setAppTitle(String title);
128
129    /**
130     * Sets an attribute.
131     *
132     * @param key the attribute key
133     * @param value the attribute value
134     */
135    void setAttribute(String key, Object value);
136
137    /**
138     * Sets the dialog context for context menu entries.<p>
139     *
140     * @param context the dialog context
141     */
142    void setMenuDialogContext(I_CmsDialogContext context);
143
144    /**
145     * Sets the info grid visibility.<p>
146     *
147     * @param show <code>true</code> to show the info
148     */
149    void showInfoArea(boolean show);
150
151    /**
152     * Shows the formerly hidden toolbar.<p>
153     */
154    void showToolbar();
155
156    /**
157     * Updates the ui context on site or project changes.<p>
158     */
159    void updateOnChange();
160
161    /**
162     * Updates the displayed user info.<p>
163     */
164    void updateUserInfo();
165}