Hello Vojtech Szocs,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/18373
to review the following change.
Change subject: userportal: Fix nasty issue in MenuPanelPopup
......................................................................
userportal: Fix nasty issue in MenuPanelPopup
When running UserPortal in web (compiled) mode, a very
nasty issue occurs in MenuPanelPopup constructor. This
issue occurs *only* in web mode and causes UserPortal
login screen to hang after successful authentication.
JS stacktrace points to MenuPanelPopup using UiBinder:
- UiBinder-generated code does SimplePanel.add(widget)
as per <g:SimplePanel> in MenuPanelPopup.ui.xml
- for some reason, 'widget' is an instance of
DecoratedPopupPanel, instead of expected PopupPanel
- JS TypeError occurs with following message:
DecoratedPopupPanel.decPanel field is not initialized
This patch fixes this issue by removing UiBinder usage
from MenuPanelPopup. This isn't a big deal, since
MenuPanelPopup uses UiBinder *only* to apply CSS styles,
its widgets are declared using @UiField(provided=true).
Change-Id: Ic3f9c3318234bb5315f950c0cba44e6eaa8cb24f
Bug-Url: https://bugzilla.redhat.com/992960
Signed-off-by: Vojtech Szocs <[email protected]>
---
M
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/action/MenuPanelPopup.java
D
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/action/MenuPanelPopup.ui.xml
A
frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/css/MenuPanelPopup.css
3 files changed, 52 insertions(+), 50 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/73/18373/1
diff --git
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/action/MenuPanelPopup.java
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/action/MenuPanelPopup.java
index af63f4f..37e14cc 100644
---
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/action/MenuPanelPopup.java
+++
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/action/MenuPanelPopup.java
@@ -7,25 +7,34 @@
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NodeList;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.resources.client.ClientBundle;
+import com.google.gwt.resources.client.CssResource;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.user.client.ui.MenuItemSeparator;
-import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.SimplePanel;
public class MenuPanelPopup extends Composite {
- interface WidgetUiBinder extends UiBinder<Widget, MenuPanelPopup> {
- WidgetUiBinder uiBinder = GWT.create(WidgetUiBinder.class);
+ public interface Resources extends ClientBundle {
+
+ @Source("org/ovirt/engine/ui/common/css/MenuPanelPopup.css")
+ Style style();
+
}
- @UiField(provided = true)
- PopupPanel panel;
+ public interface Style extends CssResource {
- @UiField(provided = true)
- MenuBar menu;
+ String actionPanelPopupPanel();
+ String actionPanelPopupMenuBar();
+
+ }
+
+ private static final Resources resources = GWT.create(Resources.class);
+
+ private final PopupPanel panel;
+ private final MenuBar menu;
public MenuPanelPopup(boolean autoHide) {
panel = new PopupPanel(autoHide);
@@ -44,8 +53,12 @@
return super.addSeparator(separator);
}
};
- initWidget(WidgetUiBinder.uiBinder.createAndBindUi(this));
panel.setWidget(menu);
+ initWidget(new SimplePanel(panel));
+
+ resources.style().ensureInjected();
+ panel.setStylePrimaryName(resources.style().actionPanelPopupPanel());
+ menu.setStylePrimaryName(resources.style().actionPanelPopupMenuBar());
NodeList<Element> table =
menu.getElement().getElementsByTagName("table"); //$NON-NLS-1$
table.getItem(0).getStyle().setProperty("width", "100%");
//$NON-NLS-1$ //$NON-NLS-2$
@@ -58,4 +71,5 @@
public MenuBar getMenuBar() {
return menu;
}
+
}
diff --git
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/action/MenuPanelPopup.ui.xml
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/action/MenuPanelPopup.ui.xml
deleted file mode 100644
index c747e43..0000000
---
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/action/MenuPanelPopup.ui.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
-<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
-
- <ui:style>
- .actionPanelPopupMenuBar {
- background-color: white;
- border: 1px solid #96B7D6;
- }
-
- .actionPanelPopupPanel {
- background-color: white;
- }
-
- @external .menuItem;
- .menuItem {
- color: black;
- background-color: white;
- cursor: pointer;
- border-bottom: 1px solid #E0E9F2;
- }
-
- @external .menuItem-selected;
- .menuItem-selected {
- background-color: #E1E8F2;
- }
-
- @external .menuItem-disabled;
- .menuItem-disabled {
- color: #C0C0C0
- }
- </ui:style>
-
- <g:SimplePanel>
- <g:PopupPanel ui:field="panel"
stylePrimaryName='{style.actionPanelPopupPanel}'>
- <g:MenuBar ui:field="menu"
stylePrimaryName='{style.actionPanelPopupMenuBar}'>
- </g:MenuBar>
- </g:PopupPanel>
- </g:SimplePanel>
-
-</ui:UiBinder>
diff --git
a/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/css/MenuPanelPopup.css
b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/css/MenuPanelPopup.css
new file mode 100644
index 0000000..dd38fd3
--- /dev/null
+++
b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/css/MenuPanelPopup.css
@@ -0,0 +1,28 @@
+@external actionPanelPopupPanel;
+.actionPanelPopupPanel {
+ background-color: white;
+}
+
+@external actionPanelPopupMenuBar;
+.actionPanelPopupMenuBar {
+ background-color: white;
+ border: 1px solid #96B7D6;
+}
+
+@external menuItem;
+.menuItem {
+ color: black;
+ background-color: white;
+ cursor: pointer;
+ border-bottom: 1px solid #E0E9F2;
+}
+
+@external menuItem-selected;
+.menuItem-selected {
+ background-color: #E1E8F2;
+}
+
+@external menuItem-disabled;
+.menuItem-disabled {
+ color: #C0C0C0
+}
\ No newline at end of file
--
To view, visit http://gerrit.ovirt.org/18373
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic3f9c3318234bb5315f950c0cba44e6eaa8cb24f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.3
Gerrit-Owner: Alexander Wels <[email protected]>
Gerrit-Reviewer: Vojtech Szocs <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches