Search in sources :

Example 6 with LionBundle

use of org.onosproject.ui.lion.LionBundle in project onos by opennetworkinglab.

the class TopologyViewMessageHandlerBase method infraLinkDetails.

// Generates a property panel model for a link details response (infra-link)
protected PropertyPanel infraLinkDetails(ConnectPoint cpA, ConnectPoint cpB) {
    log.debug("generate prop panel data for infralink {} {}", cpA, cpB);
    LionBundle lion = getLionBundle(LION_TOPO);
    String title = lion.getSafe("title_infra_link");
    PropertyPanel pp = new PropertyPanel(title, LINK_GLYPH);
    addLinkCpAProps(pp, cpA, lion);
    addLinkCpBProps(pp, cpB, lion);
    addLinkBackingProps(pp, cpA, cpB, lion);
    return pp;
}
Also used : TopoUtils.compactLinkString(org.onosproject.ui.topo.TopoUtils.compactLinkString) LionBundle(org.onosproject.ui.lion.LionBundle) PropertyPanel(org.onosproject.ui.topo.PropertyPanel)

Example 7 with LionBundle

use of org.onosproject.ui.lion.LionBundle in project onos by opennetworkinglab.

the class TopologyViewMessageHandlerBase method deviceDetails.

// Generates a property panel model for device details response
protected PropertyPanel deviceDetails(DeviceId deviceId) {
    log.debug("generate prop panel data for device {}", deviceId);
    Device device = services.device().getDevice(deviceId);
    Annotations annot = device.annotations();
    String proto = annot.value(AnnotationKeys.PROTOCOL);
    String title = friendlyDevice(deviceId);
    LionBundle lion = getLionBundle(LION_TOPO);
    PropertyPanel pp = new PropertyPanel(title, lookupGlyph(device)).navPath(DEVICE_NAV_PATH).id(deviceId.toString());
    addDeviceBasicProps(pp, deviceId, device, proto, lion);
    addLocationProps(pp, annot, lion);
    addDeviceCountStats(pp, deviceId, lion);
    addDeviceCoreButtons(pp);
    return pp;
}
Also used : Annotations(org.onosproject.net.Annotations) Device(org.onosproject.net.Device) TopoUtils.compactLinkString(org.onosproject.ui.topo.TopoUtils.compactLinkString) LionBundle(org.onosproject.ui.lion.LionBundle) PropertyPanel(org.onosproject.ui.topo.PropertyPanel)

Example 8 with LionBundle

use of org.onosproject.ui.lion.LionBundle in project onos by opennetworkinglab.

the class BundleStitcher method generateBundles.

/**
 * Generates an immutable list of localization bundles, using the specified
 * resource tree (base) and localization configuration file names (tags).
 * <p>
 * As an example, you might invoke:
 * <pre>
 * private static final String LION_BASE = "/org/onosproject/ui/lion";
 *
 * private static final String[] LION_TAGS = {
 *     "core.view.App",
 *     "core.view.Settings",
 *     "core.view.Cluster",
 *     "core.view.Processor",
 *     "core.view.Partition",
 * };
 *
 * List&lt;LionBundle&gt; bundles =
 *      LionUtils.generateBundles(LION_BASE, LION_TAGS);
 * </pre>
 * It is expected that in the "LION_BASE" directory there is a subdirectory
 * named "_config" which contains the configuration files listed in the
 * "LION_TAGS" array, each with a ".lioncfg" suffix...
 * <pre>
 * /org/onosproject/ui/lion/
 *   |
 *   +-- _config
 *         |
 *         +-- core.view.App.lioncfg
 *         +-- core.view.Settings.lioncfg
 *         :
 * </pre>
 * These files collate a localization bundle for their particular view
 * by referencing resource bundles and their keys.
 *
 * @param base the base resource directory path
 * @param tags the list of bundles to generate
 * @return a list of generated localization bundles
 */
public static List<LionBundle> generateBundles(String base, String... tags) {
    List<LionBundle> bundles = new ArrayList<>(tags.length);
    BundleStitcher stitcher = new BundleStitcher(base);
    for (String tag : tags) {
        try {
            LionBundle lion = stitcher.stitch(tag);
            bundles.add(lion);
            log.info("Generated LION bundle: {}", lion);
            log.debug(" Dumped: {}", lion.dump());
        } catch (IllegalArgumentException e) {
            log.warn("Unable to generate bundle: {} / {}", base, tag);
            log.debug("BOOM!", e);
        }
    }
    return ImmutableList.copyOf(bundles);
}
Also used : ArrayList(java.util.ArrayList) LionBundle(org.onosproject.ui.lion.LionBundle)

Example 9 with LionBundle

use of org.onosproject.ui.lion.LionBundle in project onos by opennetworkinglab.

the class MainNavResource method includeNavItems.

// Produces an input stream of nav item injections from all extensions.
private InputStream includeNavItems(UiExtensionService service) {
    List<UiExtension> extensions = service.getExtensions();
    LionBundle navLion = service.getNavLionBundle();
    StringBuilder sb = new StringBuilder("\n");
    for (UiView.Category cat : UiView.Category.values()) {
        if (cat == UiView.Category.HIDDEN) {
            continue;
        }
        List<UiView> catViews = getViewsForCat(extensions, cat);
        if (!catViews.isEmpty()) {
            addCatHeader(sb, cat, navLion);
            addCatItems(sb, catViews);
        }
    }
    return new ByteArrayInputStream(sb.toString().getBytes());
}
Also used : UiView(org.onosproject.ui.UiView) ByteArrayInputStream(java.io.ByteArrayInputStream) UiExtension(org.onosproject.ui.UiExtension) LionBundle(org.onosproject.ui.lion.LionBundle)

Aggregations

LionBundle (org.onosproject.ui.lion.LionBundle)9 PropertyPanel (org.onosproject.ui.topo.PropertyPanel)5 TopoUtils.compactLinkString (org.onosproject.ui.topo.TopoUtils.compactLinkString)5 Annotations (org.onosproject.net.Annotations)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 BooleanNode (com.fasterxml.jackson.databind.node.BooleanNode)1 DoubleNode (com.fasterxml.jackson.databind.node.DoubleNode)1 IntNode (com.fasterxml.jackson.databind.node.IntNode)1 JsonNodeFactory (com.fasterxml.jackson.databind.node.JsonNodeFactory)1 LongNode (com.fasterxml.jackson.databind.node.LongNode)1 NullNode (com.fasterxml.jackson.databind.node.NullNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 ShortNode (com.fasterxml.jackson.databind.node.ShortNode)1 TextNode (com.fasterxml.jackson.databind.node.TextNode)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableList.of (com.google.common.collect.ImmutableList.of)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ImmutableSet (com.google.common.collect.ImmutableSet)1