Vojtech Szocs has uploaded a new change for review. Change subject: webadmin: UI plugins - control tab priority ......................................................................
webadmin: UI plugins - control tab priority When adding custom main or sub tab, UI plugins can now specify the priority of the tab, denoting its relative position within the tab panel. Standard main and sub tabs typically have their priority starting at 0 (left-most tab) and incremented by 1 for each next tab. For example, "DataCenter" main tab priority is 0, "Cluster" main tab priority is 1, and so on. Example usage: api.addMainTab('Test', 'test-tab', 'plugin/TestPlugin/tab.html', // tab options object, as documented at // http://www.ovirt.org/Features/UIPlugins#Main_and_sub_tabs { priority: -1 // position this tab before all standard ones } ); Change-Id: I1251ccbe7b3cfbb378fa31ef6009184216409265 Bug-Url: https://bugzilla.redhat.com/1214624 Signed-off-by: Vojtech Szocs <vsz...@redhat.com> --- M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/plugin/api/PluginUiFunctions.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/plugin/api/TabOptions.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/DynamicUrlContentTabProxyFactory.java 3 files changed, 17 insertions(+), 4 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/10/40510/1 diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/plugin/api/PluginUiFunctions.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/plugin/api/PluginUiFunctions.java index 7271fda..5eff9a5 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/plugin/api/PluginUiFunctions.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/plugin/api/PluginUiFunctions.java @@ -99,7 +99,8 @@ // Create and bind tab presenter proxy dynamicUrlContentTabProxyFactory.create( requestTabsEventType, changeTabEventType, slot, - label, historyToken, isMainTab, contentUrl, + label, options.getPriority().floatValue(), + historyToken, isMainTab, contentUrl, options.getAlignRight() ? Align.RIGHT : Align.LEFT); // Redraw the corresponding tab container diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/plugin/api/TabOptions.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/plugin/api/TabOptions.java index 91b653c..2d957fb 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/plugin/api/TabOptions.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/plugin/api/TabOptions.java @@ -19,4 +19,16 @@ return getValueAsBoolean("alignRight", false); //$NON-NLS-1$ } + /** + * Returns the priority of the tab, denoting its relative position within the tab panel. + * <p> + * Standard main and sub tabs typically have their priority starting at 0 (left-most tab) + * and incremented by 1 for each next tab. + * <p> + * Default return value: {@code Double.MAX_VALUE} + */ + public Double getPriority() { + return getValueAsDouble("priority", Double.MAX_VALUE); //$NON-NLS-1$ + } + } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/DynamicUrlContentTabProxyFactory.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/DynamicUrlContentTabProxyFactory.java index afa5cab..c0c3654 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/DynamicUrlContentTabProxyFactory.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/DynamicUrlContentTabProxyFactory.java @@ -34,13 +34,13 @@ Type<RequestTabsHandler> requestTabsEventType, Type<ChangeTabHandler> changeTabEventType, Type<RevealContentHandler<?>> slot, - String label, String historyToken, boolean isMainTab, - String contentUrl, Align align) { + String label, float priority, String historyToken, + boolean isMainTab, String contentUrl, Align align) { return new DynamicUrlContentTabProxy( placeManager, eventBus, gatekeeper, requestTabsEventType, changeTabEventType, slot, viewProvider, - label, Float.MAX_VALUE, historyToken, + label, priority, historyToken, isMainTab, contentUrl, align); } -- To view, visit https://gerrit.ovirt.org/40510 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1251ccbe7b3cfbb378fa31ef6009184216409265 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Vojtech Szocs <vsz...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches