Adapt to addition of extension panel ordering Extension panel ordering was added by I51f3ac. Also add a second panel to the change screen below the info block example to demonstrate ordering. Change-Id: I766287f27263d69a2fbd5f7f6b99feb50c26ad1c
diff --git a/example-wuiChangeScreenBelowChangeInfoBlock/src/main/java/com/googlesource/gerrit/plugins/examples/wuichangescreenbelowchangeinfoblock/client/ExampleChangeScreenExtensionTwo.java b/example-wuiChangeScreenBelowChangeInfoBlock/src/main/java/com/googlesource/gerrit/plugins/examples/wuichangescreenbelowchangeinfoblock/client/ExampleChangeScreenExtensionTwo.java new file mode 100644 index 0000000..bced2ca --- /dev/null +++ b/example-wuiChangeScreenBelowChangeInfoBlock/src/main/java/com/googlesource/gerrit/plugins/examples/wuichangescreenbelowchangeinfoblock/client/ExampleChangeScreenExtensionTwo.java
@@ -0,0 +1,57 @@ +// Copyright (C) 2015 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.googlesource.gerrit.plugins.examples.wuichangescreenbelowchangeinfoblock.client; + +import com.google.gerrit.client.GerritUiExtensionPoint; +import com.google.gerrit.client.info.ChangeInfo; +import com.google.gerrit.client.info.ChangeInfo.RevisionInfo; +import com.google.gerrit.plugin.client.extension.Panel; +import com.google.gwt.user.client.ui.Grid; +import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; +import com.google.gwt.user.client.ui.VerticalPanel; +import com.google.gwtexpui.clippy.client.CopyableLabel; + +/** Extension for change screen that displays the numeric change ID with copy-to-clipboard icon. */ +public class ExampleChangeScreenExtensionTwo extends VerticalPanel { + static class Factory implements Panel.EntryPoint { + @Override + public void onLoad(Panel panel) { + panel.setWidget(new ExampleChangeScreenExtensionTwo(panel)); + } + } + + ExampleChangeScreenExtensionTwo(Panel panel) { + ChangeInfo change = panel.getObject(GerritUiExtensionPoint.Key.CHANGE_INFO).cast(); + RevisionInfo rev = panel.getObject(GerritUiExtensionPoint.Key.REVISION_INFO).cast(); + + Grid g = new Grid(2, 2); + g.addStyleName("infoBlock"); + CellFormatter fmt = g.getCellFormatter(); + + g.setText(0, 0, "(2) Numeric Change ID"); + fmt.addStyleName(0, 0, "header"); + fmt.addStyleName(0, 0, "topmost"); + fmt.addStyleName(0, 1, "topmost"); + g.setWidget(0, 1, new CopyableLabel(Integer.toString(change._number()))); + add(g); + + g.setText(1, 0, "(2) Patch Set ID"); + fmt.addStyleName(1, 0, "header"); + fmt.addStyleName(1, 0, "bottomheader"); + fmt.addStyleName(1, 1, "bottomheader"); + g.setWidget(1, 1, new CopyableLabel(String.valueOf(rev._number()))); + add(g); + } +}
diff --git a/example-wuiChangeScreenBelowChangeInfoBlock/src/main/java/com/googlesource/gerrit/plugins/examples/wuichangescreenbelowchangeinfoblock/client/ExamplePlugin.java b/example-wuiChangeScreenBelowChangeInfoBlock/src/main/java/com/googlesource/gerrit/plugins/examples/wuichangescreenbelowchangeinfoblock/client/ExamplePlugin.java index 0a6e189..4e89d5b 100644 --- a/example-wuiChangeScreenBelowChangeInfoBlock/src/main/java/com/googlesource/gerrit/plugins/examples/wuichangescreenbelowchangeinfoblock/client/ExamplePlugin.java +++ b/example-wuiChangeScreenBelowChangeInfoBlock/src/main/java/com/googlesource/gerrit/plugins/examples/wuichangescreenbelowchangeinfoblock/client/ExamplePlugin.java
@@ -33,6 +33,10 @@ Plugin.get() .panel( GerritUiExtensionPoint.CHANGE_SCREEN_BELOW_CHANGE_INFO_BLOCK, - new ExampleChangeScreenExtension.Factory()); + new ExampleChangeScreenExtension.Factory(), "first"); + Plugin.get() + .panel( + GerritUiExtensionPoint.CHANGE_SCREEN_BELOW_CHANGE_INFO_BLOCK, + new ExampleChangeScreenExtensionTwo.Factory(), "second"); } }
diff --git a/example-wuiChangeScreenHeader/src/main/java/com/googlesource/gerrit/plugins/examples/wuichangescreenheader/client/ExamplePlugin.java b/example-wuiChangeScreenHeader/src/main/java/com/googlesource/gerrit/plugins/examples/wuichangescreenheader/client/ExamplePlugin.java index c9467b1..33c96a9 100644 --- a/example-wuiChangeScreenHeader/src/main/java/com/googlesource/gerrit/plugins/examples/wuichangescreenheader/client/ExamplePlugin.java +++ b/example-wuiChangeScreenHeader/src/main/java/com/googlesource/gerrit/plugins/examples/wuichangescreenheader/client/ExamplePlugin.java
@@ -32,6 +32,7 @@ public void onPluginLoad() { Plugin.get() .panel( - GerritUiExtensionPoint.CHANGE_SCREEN_HEADER, new ChangeScreenStatusExtension.Factory()); + GerritUiExtensionPoint.CHANGE_SCREEN_HEADER, + new ChangeScreenStatusExtension.Factory(), "status"); } }
diff --git a/example-wuiChangeScreenHeaderRightOfButtons/src/main/java/com/googlesource/gerrit/plugins/examples/wuichangescreenheaderrightofbuttons/client/ExamplePlugin.java b/example-wuiChangeScreenHeaderRightOfButtons/src/main/java/com/googlesource/gerrit/plugins/examples/wuichangescreenheaderrightofbuttons/client/ExamplePlugin.java index 810dc5a..c2bf459 100644 --- a/example-wuiChangeScreenHeaderRightOfButtons/src/main/java/com/googlesource/gerrit/plugins/examples/wuichangescreenheaderrightofbuttons/client/ExamplePlugin.java +++ b/example-wuiChangeScreenHeaderRightOfButtons/src/main/java/com/googlesource/gerrit/plugins/examples/wuichangescreenheaderrightofbuttons/client/ExamplePlugin.java
@@ -46,6 +46,6 @@ }); panel.setWidget(b); } - }); + }, "library_compliance"); } }
diff --git a/example-wuiChangeScreenHeaderRightOfPopDowns/src/main/java/com/googlesource/gerrit/plugins/examples/wuichangescreenheaderrightofpopdowns/client/ExamplePlugin.java b/example-wuiChangeScreenHeaderRightOfPopDowns/src/main/java/com/googlesource/gerrit/plugins/examples/wuichangescreenheaderrightofpopdowns/client/ExamplePlugin.java index e9ed191..7bcd400 100644 --- a/example-wuiChangeScreenHeaderRightOfPopDowns/src/main/java/com/googlesource/gerrit/plugins/examples/wuichangescreenheaderrightofpopdowns/client/ExamplePlugin.java +++ b/example-wuiChangeScreenHeaderRightOfPopDowns/src/main/java/com/googlesource/gerrit/plugins/examples/wuichangescreenheaderrightofpopdowns/client/ExamplePlugin.java
@@ -33,6 +33,6 @@ Plugin.get() .panel( GerritUiExtensionPoint.CHANGE_SCREEN_HEADER_RIGHT_OF_POP_DOWNS, - new BuildsDropDownPanel.Factory()); + new BuildsDropDownPanel.Factory(), "status"); } }
diff --git a/example-wuiPreferenceScreenBottom/src/main/java/com/googlesource/gerrit/plugins/examples/wuipreferencescreenbottom/client/ExamplePlugin.java b/example-wuiPreferenceScreenBottom/src/main/java/com/googlesource/gerrit/plugins/examples/wuipreferencescreenbottom/client/ExamplePlugin.java index 946bc89..8a88fba 100644 --- a/example-wuiPreferenceScreenBottom/src/main/java/com/googlesource/gerrit/plugins/examples/wuipreferencescreenbottom/client/ExamplePlugin.java +++ b/example-wuiPreferenceScreenBottom/src/main/java/com/googlesource/gerrit/plugins/examples/wuipreferencescreenbottom/client/ExamplePlugin.java
@@ -33,6 +33,7 @@ Plugin.get() .panel( GerritUiExtensionPoint.PREFERENCES_SCREEN_BOTTOM, - new ChangeScreenPreferencePanel.Factory()); + new ChangeScreenPreferencePanel.Factory(), + "change_screen_preferences"); } }
diff --git a/example-wuiProfileExtensionBottom/src/main/java/com/googlesource/gerrit/plugins/examples/wuiprofileextensionbottom/client/ExamplePlugin.java b/example-wuiProfileExtensionBottom/src/main/java/com/googlesource/gerrit/plugins/examples/wuiprofileextensionbottom/client/ExamplePlugin.java index 8f2aad8..a537b27 100644 --- a/example-wuiProfileExtensionBottom/src/main/java/com/googlesource/gerrit/plugins/examples/wuiprofileextensionbottom/client/ExamplePlugin.java +++ b/example-wuiProfileExtensionBottom/src/main/java/com/googlesource/gerrit/plugins/examples/wuiprofileextensionbottom/client/ExamplePlugin.java
@@ -32,6 +32,7 @@ public void onPluginLoad() { Plugin.get() .panel( - GerritUiExtensionPoint.PROFILE_SCREEN_BOTTOM, new ExampleProfileExtension.Factory()); + GerritUiExtensionPoint.PROFILE_SCREEN_BOTTOM, + new ExampleProfileExtension.Factory(), "account_info"); } }