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;
}
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;
}
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<LionBundle> 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);
}
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());
}
Aggregations