1 /** 2 * This file Copyright (c) 2013-2018 Magnolia International 3 * Ltd. (http://www.magnolia-cms.com). All rights reserved. 4 * 5 * 6 * This file is dual-licensed under both the Magnolia 7 * Network Agreement and the GNU General Public License. 8 * You may elect to use one or the other of these licenses. 9 * 10 * This file is distributed in the hope that it will be 11 * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the 12 * implied warranty of MERCHANTABILITY or FITNESS FOR A 13 * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT. 14 * Redistribution, except as permitted by whichever of the GPL 15 * or MNA you select, is prohibited. 16 * 17 * 1. For the GPL license (GPL), you can redistribute and/or 18 * modify this file under the terms of the GNU General 19 * Public License, Version 3, as published by the Free Software 20 * Foundation. You should have received a copy of the GNU 21 * General Public License, Version 3 along with this program; 22 * if not, write to the Free Software Foundation, Inc., 51 23 * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 24 * 25 * 2. For the Magnolia Network Agreement (MNA), this file 26 * and the accompanying materials are made available under the 27 * terms of the MNA which accompanies this distribution, and 28 * is available at http://www.magnolia-cms.com/mna.html 29 * 30 * Any modifications to this file must keep this entire header 31 * intact. 32 * 33 */ 34 package info.magnolia.ui.api.overlay; 35 36 37 import info.magnolia.annotation.deprecation.MgnlDeprecated; 38 import info.magnolia.ui.api.view.View; 39 40 /** 41 * Implementers can open overlay views (with a degree of modality) over their display area. 42 * 43 * @deprecated since 6.0, use either {@link info.magnolia.ui.AlertBuilder AlertBuilder} to open alerts and confirm-dialogs, 44 * or default Vaadin {@link com.vaadin.ui.Notification Notifications} and {@link com.vaadin.ui.Window Windows}. 45 * 46 * @see com.vaadin.ui.Notification 47 * @see info.magnolia.ui.AlertBuilder 48 * @see info.magnolia.ui.DialogBuilder 49 * @see info.magnolia.ui.LightBoxBuilder 50 */ 51 @Deprecated 52 public interface OverlayLayer { 53 54 /** 55 * The available locations of modality for opening a modal. 56 * Represents what will be blocked by the opened modal. 57 * 58 * @deprecated since 6.1, overlays are no longer bound to specific views. 59 */ 60 @Deprecated 61 enum ModalityDomain { 62 SUB_APP("sub-app"), 63 APP("app"), 64 SHELL("shell"); 65 66 private String cssClass; 67 68 ModalityDomain(String cssClass) { 69 this.cssClass = cssClass; 70 } 71 72 public String getCssClass() { 73 return cssClass; 74 } 75 76 } 77 78 /** 79 * The available levels of modality. 80 * Determines how "modal" it is - 81 * -STRONG creates a dark background that prevents clicks. 82 * -LIGHT adds a border, creates a transparent background that prevents clicks. 83 * -NON_MODAL does not prevent clicks. 84 * 85 * @deprecated since 6.1, use {@link info.magnolia.ui.DialogBuilder#light()} 86 */ 87 //@Deprecated this would mark all old definitions in definitions app as deprecated; waiting for whole replacement before doing that 88 @MgnlDeprecated(since = "6.1", description = "Use info.magnolia.ui.DialogBuilder#light() instead") 89 enum ModalityLevel { 90 STRONG("strong", "modality-strong"), 91 LIGHT("light", "modality-light center-vertical"), 92 NON_MODAL("non-modal", "modality-non-modal"); 93 94 private String cssClass; 95 private String name; 96 97 ModalityLevel(String name, String cssClass) { 98 this.name = name; 99 this.cssClass = cssClass; 100 } 101 102 public String getCssClass() { 103 return cssClass; 104 } 105 106 public String getName(){ 107 return name; 108 } 109 110 } 111 112 /** 113 * Open an Overlay on top of the OverlayLayer implementer. 114 * 115 * @param view View of the component to be displayed modally. 116 * @deprecated since 6.1, use either Magnolia's {@link info.magnolia.ui.AlertBuilder AlertBuilder}, {@link info.magnolia.ui.DialogBuilder DialogBuilder} or {@link info.magnolia.ui.LightBoxBuilder LightBoxBuilder}, 117 * or default Vaadin {@link com.vaadin.ui.Notification Notifications}, {@link com.vaadin.ui.Window Windows} or {@link com.vaadin.ui.PopupView PopupViews}. 118 */ 119 @Deprecated 120 OverlayCloser openOverlay(View view); 121 122 /** 123 * Open an Overlay on top of the OverlayLayer implementer. 124 * 125 * @param modalityLevel Modality level 126 * @deprecated since 6.1, use either Magnolia's {@link info.magnolia.ui.AlertBuilder AlertBuilder}, {@link info.magnolia.ui.DialogBuilder DialogBuilder} or {@link info.magnolia.ui.LightBoxBuilder LightBoxBuilder}, 127 * or default Vaadin {@link com.vaadin.ui.Notification Notifications}, {@link com.vaadin.ui.Window Windows} or {@link com.vaadin.ui.PopupView PopupViews}. 128 */ 129 @Deprecated 130 OverlayCloser openOverlay(View view, ModalityLevel modalityLevel); 131 132 /** 133 * Opens an alert dialog of given {@link MessageStyleType type}, with given title and body. 134 * 135 * @param type the message level, i.e. INFO, WARNING or ERROR 136 * @param title the alert dialog's title 137 * @param body the alert dialog's text body 138 * @param okButton the OK button text 139 * @param callback the callback to execute when the OK button is pressed, or when the dialog is closed 140 * @deprecated since 6.1, use the {@link info.magnolia.ui.AlertBuilder AlertBuilder}. 141 */ 142 @Deprecated 143 void openAlert(MessageStyleType type, String title, String body, String okButton, AlertCallback callback); 144 145 /** 146 * Opens an alert dialog of given {@link MessageStyleType type}, with given title and body. 147 * 148 * @param type the message level, i.e. INFO, WARNING or ERROR 149 * @param title the alert dialog's title 150 * @param body the alert dialog's body as a magnolia {@link View}; alternatively one may wrap any Vaadin component as a View using {@link ViewAdapter} 151 * @param okButton the OK button text 152 * @param callback the callback to execute when the OK button is pressed, or when the dialog is closed 153 * @deprecated since 6.1, use the {@link info.magnolia.ui.AlertBuilder AlertBuilder}. 154 */ 155 @Deprecated 156 void openAlert(MessageStyleType type, String title, View body, String okButton, AlertCallback callback); 157 158 /** 159 * Opens a confirmation dialog of given {@link MessageStyleType type}, with given title and body. 160 * 161 * @param type the message level, i.e. INFO, WARNING or ERROR 162 * @param title the confirmation dialog's title 163 * @param body the confirmation dialog's body text 164 * @param confirmButton the confirm button text 165 * @param cancelButton the cancel button text 166 * @param cancelIsDefault whether the cancel button should be focused by default 167 * @param callback the callback to execute when any button is pressed, or when the dialog is closed 168 * @deprecated since 6.1, use the {@link info.magnolia.ui.AlertBuilder AlertBuilder}. 169 */ 170 @Deprecated 171 void openConfirmation(MessageStyleType type, String title, String body, String confirmButton, String cancelButton, boolean cancelIsDefault, ConfirmationCallback callback); 172 173 /** 174 * Opens a confirmation dialog of given {@link MessageStyleType type}, with given title and body. 175 * 176 * @param type the message level, i.e. INFO, WARNING or ERROR 177 * @param title the confirmation dialog's title 178 * @param body the confirmation dialog's body as a magnolia {@link View}; alternatively one may wrap any Vaadin component as a View using {@link ViewAdapter} 179 * @param confirmButton the confirm button text 180 * @param cancelButton the cancel button text 181 * @param cancelIsDefault whether the cancel button should be focused by default 182 * @param callback the callback to execute when any button is pressed, or when the dialog is closed 183 * @deprecated since 6.1, use the {@link info.magnolia.ui.AlertBuilder AlertBuilder}. 184 */ 185 @Deprecated 186 void openConfirmation(MessageStyleType type, String title, View body, String confirmButton, String cancelButton, boolean cancelIsDefault, ConfirmationCallback callback); 187 188 /** 189 * Notification indicator is a message banner that only shows a message to user. 190 * Message is shown until user clicks close button or timeout expires. 191 * 192 * @param viewToShow Content to show as View. 193 * @deprecated since 6.1, use default Vaadin {@link com.vaadin.ui.Notification Notifications}. 194 * Mind the following mappings from {@link MessageStyleType} to {@link com.vaadin.ui.Notification.Type Notification.Type}:<br> 195 * INFO => HUMANIZED_MESSAGE,<br> 196 * WARNING => WARNING_MESSAGE,<br> 197 * ERROR => ERROR_MESSAGE. 198 */ 199 @Deprecated 200 void openNotification(MessageStyleType type, boolean doesTimeout, View viewToShow); 201 202 /** 203 * Notification indicator is a message banner that only shows a message to user. 204 * Message is shown until user clicks close button or timeout expires. 205 * 206 * @param title Content to show as string. 207 * @deprecated since 6.1, use default Vaadin {@link com.vaadin.ui.Notification Notifications}. 208 * Mind the following mappings from {@link MessageStyleType} to {@link com.vaadin.ui.Notification.Type Notification.Type}:<br> 209 * INFO => HUMANIZED_MESSAGE,<br> 210 * WARNING => WARNING_MESSAGE,<br> 211 * ERROR => ERROR_MESSAGE. 212 */ 213 @Deprecated 214 void openNotification(MessageStyleType type, boolean doesTimeout, String title); 215 216 /** 217 * Notification indicator is a message banner that only shows a message to user. 218 * Message is shown until user clicks close button or timeout expires. 219 * 220 * @param title Content to show as string. 221 * @param linkText Text to show in a link button. 222 * @param cb Callback for when user clicks on link. 223 * @deprecated since 6.1, use default Vaadin {@link com.vaadin.ui.Notification Notifications}. 224 * Mind the following mappings from {@link MessageStyleType} to {@link com.vaadin.ui.Notification.Type Notification.Type}:<br> 225 * INFO => HUMANIZED_MESSAGE,<br> 226 * WARNING => WARNING_MESSAGE,<br> 227 * ERROR => ERROR_MESSAGE. 228 */ 229 @Deprecated 230 void openNotification(MessageStyleType type, boolean doesTimeout, String title, String linkText, NotificationCallback cb); 231 }