Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
GadgetSource | 35 | 0 | - | 0 | 0 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.rendering.macro.dashboard; | |
21 | ||
22 | import java.util.List; | |
23 | ||
24 | import org.xwiki.component.annotation.Role; | |
25 | import org.xwiki.rendering.block.Block; | |
26 | import org.xwiki.rendering.transformation.MacroTransformationContext; | |
27 | ||
28 | /** | |
29 | * Reads the gadgets for the dashboard macro which is being executed. | |
30 | * | |
31 | * @version $Id: 5c8c5675ef2eb74a256465745bfbb4f81a45c8ef $ | |
32 | * @since 3.0M3 | |
33 | */ | |
34 | @Role | |
35 | public interface GadgetSource | |
36 | { | |
37 | /** | |
38 | * Reads the gadgets for the passed macro transformation context. | |
39 | * | |
40 | * @param source the source to read dashboard gadgets from (a document serialized reference) | |
41 | * @param context the dashboard macro transformation context | |
42 | * @return the list of gadgets for the currently executing macro | |
43 | * @throws Exception in case anything goes wrong reading data, the exception should be translated by the dashboard | |
44 | * macro caller into a macro execution exception | |
45 | */ | |
46 | List<Gadget> getGadgets(String source, MacroTransformationContext context) throws Exception; | |
47 | ||
48 | /** | |
49 | * Get the metadata about this dashboard source, such as source document fullname, gadget add url, gadget remove | |
50 | * url, etc, to pass to the client. <br> | |
51 | * TODO: find a better place for this code, ftm it's here because this is the only class that knows about XWiki data | |
52 | * model | |
53 | * | |
54 | * @param source the source to read dashboard gadgets from (a document serialized reference) | |
55 | * @param context the dashboard macro transformation context | |
56 | * @return a list of blocks that represent the XDOM with the metadata. TODO: might as well be a map of metadata and | |
57 | * leave the rendering in XDOM to the dashboard macro, but ftm this does the job | |
58 | */ | |
59 | List<Block> getDashboardSourceMetadata(String source, MacroTransformationContext context); | |
60 | ||
61 | /** | |
62 | * @return {@code true} if the the current context is in edit mode (gadgets can be edited -- positions, parameters, | |
63 | * adding gadgets etc), {@code false} otherwise <br> | |
64 | * TODO: find a better place to put this function, but for now this is the only interface towards XWiki data | |
65 | * model, and since the mode is set on the current context, this function needs to be here | |
66 | */ | |
67 | boolean isEditing(); | |
68 | } |