Search in sources :

Example 1 with DefaultXulOverlay

use of org.pentaho.ui.xul.impl.DefaultXulOverlay 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;
}
Also used : XulOverlay(org.pentaho.ui.xul.XulOverlay) DefaultXulOverlay(org.pentaho.ui.xul.impl.DefaultXulOverlay) DefaultXulOverlay(org.pentaho.ui.xul.impl.DefaultXulOverlay) Node(org.dom4j.Node) Element(org.dom4j.Element) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList)

Example 2 with DefaultXulOverlay

use of org.pentaho.ui.xul.impl.DefaultXulOverlay in project pentaho-platform by pentaho.

the class SystemPathXmlPluginProvider method processOverlays.

protected void processOverlays(PlatformPlugin plugin, Document doc, IPentahoSession session) {
    // look for content types
    // $NON-NLS-1$
    List<?> nodes = doc.selectNodes("//overlays/overlay");
    for (Object obj : nodes) {
        Element node = (Element) obj;
        DefaultXulOverlay overlay = processOverlay(node);
        if (overlay != null) {
            plugin.addOverlay(overlay);
        }
    }
}
Also used : DefaultXulOverlay(org.pentaho.ui.xul.impl.DefaultXulOverlay) Element(org.dom4j.Element)

Example 3 with DefaultXulOverlay

use of org.pentaho.ui.xul.impl.DefaultXulOverlay in project pentaho-platform by pentaho.

the class SystemPathXmlPluginProvider method processOverlay.

public static DefaultXulOverlay processOverlay(Element node) {
    DefaultXulOverlay overlay = null;
    // $NON-NLS-1$
    String id = node.attributeValue("id");
    // $NON-NLS-1$
    String resourceBundleUri = node.attributeValue("resourcebundle");
    String priority = node.attributeValue("priority");
    String xml = node.asXML();
    if (StringUtils.isNotEmpty(id) && StringUtils.isNotEmpty(xml)) {
        // so default will be used
        if (StringUtils.isNotEmpty(priority)) {
            try {
                overlay = new DefaultXulOverlay(id, null, xml, resourceBundleUri, Integer.parseInt(priority));
            } catch (NumberFormatException e) {
                // don't fail if attribute value is invalid. just use alt constructor without priority
                overlay = new DefaultXulOverlay(id, null, xml, resourceBundleUri);
            }
        } else {
            overlay = new DefaultXulOverlay(id, null, xml, resourceBundleUri);
        }
    }
    return overlay;
}
Also used : DefaultXulOverlay(org.pentaho.ui.xul.impl.DefaultXulOverlay)

Aggregations

DefaultXulOverlay (org.pentaho.ui.xul.impl.DefaultXulOverlay)3 Element (org.dom4j.Element)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Node (org.dom4j.Node)1 XulOverlay (org.pentaho.ui.xul.XulOverlay)1