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; 029 030import org.opencms.file.CmsObject; 031import org.opencms.file.CmsProject; 032import org.opencms.file.CmsResource; 033import org.opencms.ui.components.CmsBasicDialog.DialogWidth; 034import org.opencms.util.CmsUUID; 035 036import java.util.Collection; 037import java.util.List; 038 039import com.vaadin.ui.Component; 040import com.vaadin.ui.Window; 041 042/** 043 * Context for dialogs opened from the context menu.<p> 044 */ 045public interface I_CmsDialogContext { 046 047 /** 048 * The available context types.<p> 049 */ 050 enum ContextType { 051 /** The app toolbar context. */ 052 appToolbar, 053 054 /** The container page toolbar context. */ 055 containerpageToolbar, 056 057 /** The file table context. */ 058 fileTable, 059 060 /** The sitemap toolbar context. */ 061 sitemapToolbar 062 } 063 064 /** 065 * Signals an error which occurred in the dialog.<p> 066 * 067 * @param error the error which occcurred 068 */ 069 void error(Throwable error); 070 071 /** 072 * Signals that the dialog has finished.<p> 073 * Call when current project and or site have been changed.<p> 074 * 075 * @param project changed project 076 * @param siteRoot changed site root 077 */ 078 void finish(CmsProject project, String siteRoot); 079 080 /** 081 * Signals that the dialog has finished.<p> 082 * 083 * @param result the list of structure ids of changed resources 084 */ 085 void finish(Collection<CmsUUID> result); 086 087 /** 088 * Tell the system that the resource with the given id should be shown somehow.<p> 089 * 090 * @param structureId the structure id of a resource 091 */ 092 void focus(CmsUUID structureId); 093 094 /** 095 * Gets a list of structure ids of all visible resources, not just the ones selected for the dialog.<p> 096 * 097 * @return the structure ids of all the resources in the current view 098 */ 099 List<CmsUUID> getAllStructureIdsInView(); 100 101 /** 102 * Returns the app id.<p> 103 * 104 * @return the app id 105 */ 106 String getAppId(); 107 108 /** 109 * Gets the CMS context to be used for dialog operations.<p> 110 * 111 * @return the CMS context 112 */ 113 CmsObject getCms(); 114 115 /** 116 * Returns the context type.<p> 117 * May be used for visibility evaluation.<p> 118 * 119 * @return the context type 120 */ 121 ContextType getContextType(); 122 123 /** 124 * Gets the list of resources for which the dialog should be opened.<p> 125 * 126 * @return the list of resources 127 */ 128 List<CmsResource> getResources(); 129 130 /** 131 * Navigates to the given app.<p> 132 * 133 * @param appId the app id 134 */ 135 void navigateTo(String appId); 136 137 /** 138 * Call when the dialog view has changed to re-center the dialog window.<p> 139 */ 140 void onViewChange(); 141 142 /** 143 * Reloads the UI.<p> 144 */ 145 void reload(); 146 147 /** 148 * Sets the current window.<p> 149 * 150 * @param window the current dialog window 151 */ 152 void setWindow(Window window); 153 154 /** 155 * Called to start up the dialog with the given main widget and title string.<p> 156 * 157 * @param title the title to display 158 * @param dialog the dialog main widget 159 */ 160 void start(String title, Component dialog); 161 162 /** 163 * Called to start up the dialog with the given main widget and title string.<p> 164 * 165 * @param title the title to display 166 * @param dialog the dialog main widget 167 * @param width the preferred width for the dialog 168 */ 169 void start(String title, Component dialog, DialogWidth width); 170 171 /** 172 * Called when the user info was changed.<p> 173 */ 174 void updateUserInfo(); 175 176}