Wiki source code of IPluginClientDashboard


Show last authors
1 {{content/}}
2
3 == Interface IPluginClientDashboard ==
4
5 {{figure image="plugin_client_dashboard_demo.png"}}
6 The result of the demo client dashboard plugin. Shows a simple custom dashboard with a custom fieldset.
7 {{/figure}}
8
9 The interface for client dashboard plugins. This type of plugin lets you add a custom dashboard page to the system. It is possible to install multiple dashboard plugins at the same time. For each {{jpath path="de.xima.fc.entities.Rolle"/}}, an administrator may choose either the default dashboard, or one of the installed plugin dashboards. Each user with that role will then see that dashboard.
10
11 A client dashboard plugin consists of an XHTML page and a managed bean for that XHTML page, see ~{~{jpath path="de.xima.fc.plugin.interfaces.backend.IPluginClientDashboardCustomGUIBean/}} for further info. If a plugin dashboard is set, the XHTML page is shown instead of the normal dashboard. Please note that you cannot change the layout frame (the menu bar to the left and the top bar), but only the main content of the dashboard page.
12
13 == Interface IPluginGenericCustomGUI ==
14
15 This interface is implemented automatically by a client dashboard plugin and contains the following additional methods.
16
17 === Method signatures ===
18
19 {{panel title="{{code language='java'~}~}Iterable<Class> getUnmanagedBeans(){{/code~}~}" triggerable="true" fullwidth="true" styleClass="xm-code-panel"}}
20 (((
21 This must return a list of backing bean classes that control the user interface and are required by the //getXhtmlView//. A new instance of the bean will be created automatically when the view is opened. Make sure each bean has got a no-argument constructor or it cannot be instantiated.
22 )))
23
24 {{html}}<br>{{/html}}
25
26 (((
27 Please note that the beans **are unmanaged** - functionality specific to managed bean is not available. This means, for example, that annotations such as {{jpath path="javax.annotation.PostConstruct"}} and {{jpath path="javax.faces.bean.ManagedProperty"/}}s are not supported and will not work:
28
29 * Instead of //PostConstruct//, you can use //IPluginGenericCustomGUIBean.initialize(de.xima.fc.interfaces.plugin.lifecycle.IPluginInitializeBeanData)//
30 * Instead of //ManagedProperty//, you can access beans you need via the current FacesContext etc.
31 )))
32
33 (((
34 Each bean should be annotated with {{jpath path="javax.faces.bean.ManagedBean"/}} and specify a //ManagedBean.name()//. If this annotation is not present or no name is specified, the name defaults to the simple name of the bean class.
35 )))
36
37 {{html}}<br>{{/html}}
38
39 (((
40 Also, each bean needs to be annotated one of the following scopes: {{jpath path="javax.faces.bean.RequestScoped"/}}, {{jpath path="javax.faces.bean.ViewScoped"/}}, {{jpath path="javax.faces.bean.SessionScoped"/}} or {{jpath path="javax.faces.bean.ApplicationScoped"/}}. Note that it depends on the type of plugin which scopes are actually supported. In case you do not specify a scope, an appropriate scope will be determined automatically.
41 )))
42
43 {{html}}<br>{{/html}}
44
45 (((
46 Certain features of managed beans may be supported partially, depending on the type of plugin, but may work differently. This includes, but is not limited to:
47
48 * The exact timing at which {{jpath path="javax.annotation.PostConstruct"}} and {{jpath path="javax.annotation.PreDestroy"}} are called may differ.
49 * A {{jpath path="javax.faces.bean.ManagedProperty"/}} may not work with all values allowed by the Java Beans specification, and may not perform checks such as the check for circular dependencies. It will also not create new beans when those beans have not been created yet as part of the current page.
50 )))
51
52 {{html}}<br>{{/html}}
53
54 ; Return value
55 : An Iterable over the unmanaged bean classes required by the view
56 {{/panel}}
57
58 {{panel title="{{code language='java'~}~}URL getXhtmlView(){{/code~}~}" triggerable="true" fullwidth="true" styleClass="xm-code-panel"}}
59 This method must return the path to the XHTML page for the custom user interface. Usually the XHTML file is part of the JAR resources of the plugin. In this case, you should return an URL to a JAR file resource (//jar:file:/...//) like so:
60
61 {{code language="java"}}
62 @Override
63 public URL getXhtmlView() {
64 return getClass().getResource("/path/to/view.xhtml");
65 }
66 {{/code}}
67
68 {{/panel}}
69
70 == Interface IPluginClientDashboardCustomGUIBean ==
71
72 The interface for the unmanaged bean used by the client dashboard. It provides some common functionality. You should have your own bean class extends the abstract class {{jpath path="de.xima.fc.plugins.DemoClientDashboard"/}}, it implements most of the required methods and reduces the overhead in creating new beans.