View Javadoc
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.context;
35  
36  import info.magnolia.ui.api.overlay.AlertCallback;
37  import info.magnolia.ui.api.overlay.ConfirmationCallback;
38  import info.magnolia.ui.api.overlay.MessageStyleType;
39  import info.magnolia.ui.api.overlay.NotificationCallback;
40  import info.magnolia.ui.api.overlay.OverlayCloser;
41  import info.magnolia.ui.api.overlay.OverlayLayer;
42  import info.magnolia.ui.api.view.View;
43  
44  /**
45   * Represents a UI context and allows components, views and presenters to interact with the context that contains them.
46   *
47   * @deprecated since 6.0, use either {@link info.magnolia.ui.AlertBuilder AlertBuilder} to open alerts and confirm-dialogs,
48   * or default Vaadin {@link com.vaadin.ui.Notification Notifications} and {@link com.vaadin.ui.Window Windows}.
49   *
50   * @see com.vaadin.ui.Notification
51   * @see info.magnolia.ui.AlertBuilder
52   * @see info.magnolia.ui.DialogBuilder
53   * @see info.magnolia.ui.LightBoxBuilder
54   */
55  @Deprecated
56  public interface UiContext extends OverlayLayer {
57  
58      /**
59       * @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},
60       * or default Vaadin {@link com.vaadin.ui.Notification Notifications}, {@link com.vaadin.ui.Window Windows} or {@link com.vaadin.ui.PopupView PopupViews}.
61       */
62      @Override
63      @Deprecated
64      default OverlayCloser openOverlay(View view) {
65          return getOverlayDelegate().openOverlay(view);
66      }
67  
68      /**
69       * @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},
70       * or default Vaadin {@link com.vaadin.ui.Notification Notifications}, {@link com.vaadin.ui.Window Windows} or {@link com.vaadin.ui.PopupView PopupViews}.
71       */
72      @Override
73      @Deprecated
74      default OverlayCloser openOverlay(View view, ModalityLevel modalityLevel) {
75          return getOverlayDelegate().openOverlay(view, modalityLevel);
76      }
77  
78      /**
79       * @deprecated since 6.1, use the {@link info.magnolia.ui.AlertBuilder AlertBuilder}.
80       */
81      @Override
82      @Deprecated
83      default void openAlert(MessageStyleType type, String title, String body, String okButton, AlertCallback callback) {
84          getOverlayDelegate().openAlert(type, title, body, okButton, callback);
85      }
86  
87      /**
88       * @deprecated since 6.1, use the {@link info.magnolia.ui.AlertBuilder AlertBuilder}.
89       */
90      @Override
91      @Deprecated
92      default void openAlert(MessageStyleType type, String title, View body, String okButton, AlertCallback callback) {
93          getOverlayDelegate().openAlert(type, title, body, okButton, callback);
94      }
95  
96      /**
97       * @deprecated since 6.1, use the {@link info.magnolia.ui.AlertBuilder AlertBuilder}.
98       */
99      @Override
100     @Deprecated
101     default void openConfirmation(MessageStyleType type, String title, String body, String confirmButton, String cancelButton, boolean cancelIsDefault, ConfirmationCallback callback) {
102         getOverlayDelegate().openConfirmation(type, title, body, confirmButton, cancelButton, cancelIsDefault, callback);
103     }
104 
105     /**
106      * @deprecated since 6.1, use the {@link info.magnolia.ui.AlertBuilder AlertBuilder}.
107      */
108     @Override
109     @Deprecated
110     default void openConfirmation(MessageStyleType type, String title, View body, String confirmButton, String cancelButton, boolean cancelIsDefault, ConfirmationCallback callback) {
111         getOverlayDelegate().openConfirmation(type, title, body, confirmButton, cancelButton, cancelIsDefault, callback);
112     }
113 
114     /**
115      * @deprecated since 6.1, use default Vaadin {@link com.vaadin.ui.Notification Notifications}.
116      *             Mind the following mappings from {@link MessageStyleType} to {@link com.vaadin.ui.Notification.Type Notification.Type}:<br>
117      *             INFO => HUMANIZED_MESSAGE,<br>
118      *             WARNING => WARNING_MESSAGE,<br>
119      *             ERROR => ERROR_MESSAGE.
120      */
121     @Override
122     @Deprecated
123     default void openNotification(MessageStyleType type, boolean doesTimeout, View viewToShow) {
124         getOverlayDelegate().openNotification(type, doesTimeout, viewToShow);
125     }
126 
127     /**
128      * @deprecated since 6.1, use default Vaadin {@link com.vaadin.ui.Notification Notifications}.
129      *             Mind the following mappings from {@link MessageStyleType} to {@link com.vaadin.ui.Notification.Type Notification.Type}:<br>
130      *             INFO => HUMANIZED_MESSAGE,<br>
131      *             WARNING => WARNING_MESSAGE,<br>
132      *             ERROR => ERROR_MESSAGE.
133      */
134     @Override
135     @Deprecated
136     default void openNotification(MessageStyleType type, boolean doesTimeout, String title) {
137         getOverlayDelegate().openNotification(type, doesTimeout, title);
138     }
139 
140     /**
141      * @deprecated since 6.1, use default Vaadin {@link com.vaadin.ui.Notification Notifications}.
142      *             Mind the following mappings from {@link MessageStyleType} to {@link com.vaadin.ui.Notification.Type Notification.Type}:<br>
143      *             INFO => HUMANIZED_MESSAGE,<br>
144      *             WARNING => WARNING_MESSAGE,<br>
145      *             ERROR => ERROR_MESSAGE.
146      */
147     @Override
148     @Deprecated
149     default void openNotification(MessageStyleType type, boolean doesTimeout, String title, String linkText, NotificationCallback cb) {
150         getOverlayDelegate().openNotification(type, doesTimeout, title, linkText, cb);
151     }
152 
153     OverlayLayer getOverlayDelegate();
154 }