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.admincentral.shellapp.favorites;
35  
36  import info.magnolia.ui.api.view.View;
37  import info.magnolia.ui.vaadin.integration.jcr.AbstractJcrNodeAdapter;
38  import info.magnolia.ui.vaadin.integration.jcr.JcrNewNodeAdapter;
39  
40  import java.util.List;
41  import java.util.Map;
42  
43  /**
44   * View for favorites.
45   */
46  public interface FavoritesView extends View {
47  
48      void setListener(Listener listener);
49  
50      void init(AbstractJcrNodeAdapter favoritesRoot, JcrNewNodeAdapter favoriteSuggestion, JcrNewNodeAdapter groupSuggestion, Map<String, String> availableGroups, boolean itemIconsVisible);
51  
52      void setFavoriteLocation(JcrNewNodeAdapter location, JcrNewNodeAdapter groupSuggestion, Map<String, String> availableGroups);
53  
54      /**
55       * Returns a the list of all EditableFavoriteItem(s).
56       */
57      List<EditableFavoriteItem> getEditableFavoriteItemList();
58  
59      /**
60       * Listener.
61       */
62      interface Listener {
63  
64          /**
65           * Adding instantly a new group and a new favorite (and add the latter to the former).
66           * @param newFavorite The JcrNewNodeAdapter for the new favorite.
67           * @param newGroup The JcrNewNodeAdapter for the new group.
68           */
69          void addFavoriteAndGroup(JcrNewNodeAdapter newFavorite, JcrNewNodeAdapter newGroup);
70  
71          /**
72           * Adds a favorite.
73           * @param newFavorite The JcrNewNodeAdapter for the new favorite.
74           */
75          void addFavorite(JcrNewNodeAdapter newFavorite);
76  
77          /**
78           * Edit a favorite.
79           * @param relPath  The relative path of the favorite to edit.
80           * @param newTitle The new title.
81           */
82          void editFavorite(String relPath, String newTitle);
83  
84          /**
85           * Removes a favorite by the given path.
86           * @param relPath of the favorite to remove.
87           */
88          void removeFavorite(String relPath);
89  
90          /**
91           * To go to the given location.
92           * @param location The location to go to.
93           */
94          void goToLocation(String location);
95  
96          /**
97           * Add a group.
98           * @param newGroup The JcrNewNodeAdapter for the new group.
99           */
100         void addGroup(JcrNewNodeAdapter newGroup);
101 
102         /**
103          * Edit a group.
104          * @param relPath The relative path of the group to edit.
105          * @param newTitle The new title.
106          */
107         void editGroup(String relPath, String newTitle);
108 
109         /**
110          * Remove a group.
111          * @param relPath The relative path of the group to remove.
112          */
113         void removeGroup(String relPath);
114 
115         /**
116          * Moves a favorite.
117          * @param relPath The relative path to move the node.
118          * @param group The node-name of the group.
119          */
120         void moveFavorite(String relPath, String group);
121 
122         /**
123          * Orders a favorite before a sibling.
124          * @param relPath The path of the node to move.
125          * @param sibling The node-name of the sibling.
126          */
127         void orderFavoriteBefore(String relPath, String sibling);
128 
129         /**
130          * Orders a favorite after a sibling.
131          * @param relPath The path of the node to move.
132          * @param sibling The node-name of the sibling.
133          */
134         void orderFavoriteAfter(String relPath, String sibling);
135 
136         /**
137          * Orders a group before a sibling.
138          * @param relPath The path of the node to move.
139          * @param sibling The node-name of the sibling.
140          */
141         void orderGroupBefore(String relPath, String sibling);
142 
143         /**
144          * Orders a group after a sibling.
145          * @param relPath The path of the node to move.
146          * @param groupToMove The node-name of the sibling.
147          */
148         void orderGroupAfter(String groupToMove, String relPath);
149 
150         /**
151          * Switches the all the favorite- and group-items to editable or not-editable, actually showing or hiding the the delete- and edit-icons on the items.
152          *
153          * @param editable boolean indicating whether the items should be set to 'editable' or 'not-editable'.
154          */
155         void setItemsEditable(boolean editable);
156 
157         /**
158          * Returns a boolean indicating whether the group- and favorite-items are currently editable which means whether they are showing or hiding the the delete- and edit-icons.
159          */
160         boolean itemsAreEditable();
161 
162         /**
163          * Returns a boolean indicating whether there is at least one group or favorite-item exiting.
164          */
165         boolean hasItems();
166 
167         /**
168          * Set the id of the EditableFavoriteItem which is currently edited.
169          */
170         void setCurrentEditedItemId(String ItemId);
171 
172         /**
173          * Setting to the state where the EditableFavoriteItem(s) are in not-editable-state and with hidden icons.
174          */
175         void setToInitialState();
176 
177     }
178 
179 }