use of org.pentaho.ui.xul.XulOverlay in project pentaho-kettle by pentaho.
the class AbstractRepositoryExplorerUISupport method apply.
public void apply(XulDomContainer container) throws XulException {
this.container = container;
container.registerClassLoader(getClass().getClassLoader());
for (XulEventHandler handler : handlers) {
container.addEventHandler(handler);
}
for (XulOverlay overlay : overlays) {
if (overlay instanceof RepositoryExplorerDefaultXulOverlay) {
container.loadOverlay(overlay.getOverlayUri(), new XulSpoonResourceBundle(((RepositoryExplorerDefaultXulOverlay) overlay).getPackageClass()));
} else {
container.loadOverlay(overlay.getOverlayUri(), overlay.getResourceBundleUri());
}
}
}
use of org.pentaho.ui.xul.XulOverlay in project pentaho-platform by pentaho.
the class PerspectiveUtil method processOverlays.
private static ArrayList<XulOverlay> processOverlays(Element node) {
if (node == null) {
return null;
}
ArrayList<XulOverlay> overlays = new ArrayList<XulOverlay>();
@SuppressWarnings("unchecked") List<Node> overlayElements = (List<Node>) node.selectNodes("overlay");
for (Node overlayNode : overlayElements) {
DefaultXulOverlay overlay;
// reuse static method to honor overlay priorities as well
overlay = SystemPathXmlPluginProvider.processOverlay((Element) overlayNode);
if (overlay != null) {
overlays.add(overlay);
}
}
return overlays;
}
use of org.pentaho.ui.xul.XulOverlay in project pentaho-platform by pentaho.
the class PerspectiveUtil method createPerspective.
static IPluginPerspective createPerspective(Element perspectiveNode) {
if (perspectiveNode != null) {
// $NON-NLS-1$
String title = perspectiveNode.attributeValue("title");
// $NON-NLS-1$
String id = perspectiveNode.attributeValue("id");
// $NON-NLS-1$
String contentUrl = perspectiveNode.attributeValue("content-url");
// $NON-NLS-1$
String resourceBundleUri = perspectiveNode.attributeValue("resourcebundle");
// $NON-NLS-1$
String layoutPriorityStr = perspectiveNode.attributeValue("layout-priority");
int layoutPriority = DEFAULT_LAYOUT_PRIORITY;
if (layoutPriorityStr != null && layoutPriorityStr.length() > 0) {
try {
layoutPriority = Integer.parseInt(layoutPriorityStr);
} catch (Exception e) {
layoutPriority = DEFAULT_LAYOUT_PRIORITY;
}
}
String securityActionStr = perspectiveNode.attributeValue("required-security-action");
ArrayList<String> actions = new ArrayList<String>();
if (securityActionStr != null) {
StringTokenizer st = new StringTokenizer(securityActionStr, ";, ");
while (st.hasMoreTokens()) {
String action = st.nextToken();
actions.add(action);
}
}
// $NON-NLS-1$
ArrayList<XulOverlay> overlays = processOverlays(perspectiveNode);
IPluginPerspective perspective = new DefaultPluginPerspective();
perspective.setTitle(title);
perspective.setId(id);
perspective.setContentUrl(contentUrl);
perspective.setLayoutPriority(layoutPriority);
perspective.setOverlays(overlays);
perspective.setRequiredSecurityActions(actions);
perspective.setResourceBundleUri(resourceBundleUri);
return perspective;
}
return null;
}
use of org.pentaho.ui.xul.XulOverlay in project pentaho-platform by pentaho.
the class PerspectiveManager method showPerspectiveContinue.
private void showPerspectiveContinue(IPluginPerspective perspective) {
if (!perspective.getTitle().startsWith("${")) {
perspectiveDropDown.setText(perspective.getTitle());
}
for (MenuItem m : perspectiveMenuItemMap.values()) {
m.getElement().removeClassName("custom-dropdown-selected");
}
perspectiveMenuItemMap.get(perspective.getId()).getElement().addClassName("custom-dropdown-selected");
// before we show.. de-activate current perspective (based on shown widget)
Widget w = MantleApplication.getInstance().getContentDeck().getWidget(MantleApplication.getInstance().getContentDeck().getVisibleWidget());
if (w instanceof Frame && !perspective.getId().equals(w.getElement().getId())) {
// invoke deactivation method
Frame frame = (Frame) w;
perspectiveDeactivated(frame.getElement());
}
// remove current perspective overlays
if (activePerspective != null) {
for (XulOverlay o : activePerspective.getOverlays()) {
if (!o.getId().startsWith("startup") && !o.getId().startsWith("sticky")) {
MantleXul.getInstance().removeOverlay(o.getId());
}
}
for (XulOverlay overlay : MantleXul.getInstance().getOverlays()) {
if (overlay.getId().startsWith(activePerspective.getId() + ".overlay.")) {
MantleXul.getInstance().removeOverlay(overlay.getId());
}
}
}
// now it's safe to set active
this.activePerspective = perspective;
if (perspective.getOverlays() != null) {
// handle PERSPECTIVE overlays
for (XulOverlay overlay : perspective.getOverlays()) {
if (!overlay.getId().startsWith("startup") && !overlay.getId().startsWith("sticky")) {
MantleXul.getInstance().applyOverlay(overlay.getId());
}
}
// handle PLUGIN overlays
for (XulOverlay overlay : MantleXul.getInstance().getOverlays()) {
if (overlay.getId().startsWith(perspective.getId() + ".overlay.")) {
MantleXul.getInstance().applyOverlay(overlay.getId());
}
}
}
if (!perspective.getId().equals(OPENED_PERSPECTIVE) && !perspective.getId().equals(SCHEDULES_PERSPECTIVE) && !perspective.getId().equals(ADMIN_PERSPECTIVE)) {
hijackContentArea(perspective);
}
// if the selected perspective is "opened.perspective"
if (perspective.getId().equals(OPENED_PERSPECTIVE)) {
showOpenedPerspective(true, false);
} else if (perspective.getId().equals(SCHEDULES_PERSPECTIVE)) {
showSchedulesPerspective();
} else if (perspective.getId().equals(ADMIN_PERSPECTIVE)) {
showAdminPerspective(false, false);
}
}
use of org.pentaho.ui.xul.XulOverlay in project pentaho-platform by pentaho.
the class PluginManagerResource method getOverlays.
/**
* Retrieve the list of XUL overlays for the provided id
*
* @param id
* @return list of <code> Overlay </code>
*/
@GET
@Path("/overlays")
@Produces({ APPLICATION_JSON })
@Facet(name = "Unsupported")
public List<Overlay> getOverlays(@QueryParam("id") @DefaultValue("") String id) {
// $NON-NLS-1$
IPluginManager pluginManager = PentahoSystem.get(IPluginManager.class, PentahoSessionHolder.getSession());
List<XulOverlay> overlays = pluginManager.getOverlays();
ArrayList<Overlay> result = new ArrayList<Overlay>();
for (XulOverlay overlay : overlays) {
if (!id.isEmpty() && !overlay.getId().equals(id)) {
continue;
}
Overlay tempOverlay = new Overlay(overlay.getId(), overlay.getOverlayUri(), overlay.getSource(), overlay.getResourceBundleUri(), overlay.getPriority());
result.add(tempOverlay);
}
return result;
}
Aggregations