Vojtech Szocs has uploaded a new change for review. Change subject: webadmin,userportal: CellTable IE8 optimization ......................................................................
webadmin,userportal: CellTable IE8 optimization TODO update commit message Change-Id: If69e21731ddad072405b68b6ea81d8ef814b22dd Signed-off-by: Vojtech Szocs <[email protected]> --- M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/AbstractActionTable.java M frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/ApplicationResources.java A frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/SideTabExtendedTemplateStyle.java M frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedTemplateView.java M frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedVirtualMachineView.java M frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/userportal/css/ExtendedTemplateListTable.css M frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/userportal/css/ExtendedVmListTable.css A frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/userportal/css/SideTabExtendedTemplateStyle.css 8 files changed, 73 insertions(+), 46 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/12/10212/1 diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/AbstractActionTable.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/AbstractActionTable.java index cf46f7a..b597ef3 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/AbstractActionTable.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/AbstractActionTable.java @@ -15,6 +15,7 @@ import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.EventTarget; import com.google.gwt.dom.client.NodeList; import com.google.gwt.dom.client.Style.Position; import com.google.gwt.dom.client.Style.Unit; @@ -42,6 +43,7 @@ import com.google.gwt.user.cellview.client.LoadingStateChangeEvent.LoadingState; import com.google.gwt.user.cellview.client.RowStyles; import com.google.gwt.user.cellview.client.SafeHtmlHeader; +import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.Window; @@ -121,6 +123,11 @@ @Override protected void onBrowserEvent2(Event event) { + EventTarget eventTarget = event.getEventTarget(); + if (!Element.is(eventTarget)) { + return; + } + // Enable multiple selection only when Control/Shift key is pressed mousePosition[0] = event.getClientX(); mousePosition[1] = event.getClientY(); @@ -129,10 +136,33 @@ selectionModel.setMultiRangeSelectEnabled(event.getShiftKey()); } + // IE8 optimization: prevent handling mouseover/mouseout events, as they + // deal with dynamic tr/td element style updates with regard to row + // highlight behavior + switch (DOM.eventGetType(event)) { + case Event.ONMOUSEOVER: + case Event.ONMOUSEOUT: + return; + } + super.onBrowserEvent2(event); } @Override + protected void onFocus() { + // IE8 optimization: prevent default CellTable focus implementation, which + // deals with dynamic tr/td element style updates with regard to current + // keyboard selection + } + + @Override + protected void onBlur() { + // IE8 optimization: prevent default CellTable blur implementation, which + // deals with dynamic tr/td element style updates with regard to current + // keyboard selection + } + + @Override protected int getKeyboardSelectedRow() { if (selectionModel.getLastSelectedRow() == -1) { return super.getKeyboardSelectedRow(); diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/ApplicationResources.java b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/ApplicationResources.java index 92df150..76f19b2 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/ApplicationResources.java +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/ApplicationResources.java @@ -96,6 +96,9 @@ @Source("css/SideTabExtendedVmStyle.css") SideTabExtendedVmStyle sideTabExtendedVmStyle(); + @Source("css/SideTabExtendedTemplateStyle.css") + SideTabExtendedTemplateStyle sideTabExtendedTemplateStyle(); + @Source("css/SideTabWithDetailsViewStyle.css") SideTabWithDetailsViewStyle sideTabWithDetailsViewStyle(); diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/SideTabExtendedTemplateStyle.java b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/SideTabExtendedTemplateStyle.java new file mode 100644 index 0000000..ecb222d --- /dev/null +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/SideTabExtendedTemplateStyle.java @@ -0,0 +1,9 @@ +package org.ovirt.engine.ui.userportal; + +import com.google.gwt.resources.client.CssResource; + +public interface SideTabExtendedTemplateStyle extends CssResource { + + String templateRow(); + +} diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedTemplateView.java b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedTemplateView.java index 867d02d..9c48218 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedTemplateView.java +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedTemplateView.java @@ -25,6 +25,7 @@ import com.google.gwt.safehtml.shared.SafeHtmlBuilder; import com.google.gwt.user.cellview.client.CellTable; import com.google.gwt.user.cellview.client.Column; +import com.google.gwt.user.cellview.client.RowStyles; import com.google.inject.Inject; public class SideTabExtendedTemplateView extends AbstractSideTabWithDetailsView<VmTemplate, UserPortalTemplateListModel> @@ -36,6 +37,8 @@ private static final TemplateTableResources templateTableResources = GWT.create(TemplateTableResources.class); + private final ApplicationResources applicationResources; + @Inject public SideTabExtendedTemplateView( UserPortalTemplateListProvider provider, @@ -43,6 +46,8 @@ ApplicationConstants constants, ApplicationResources applicationResources) { super(provider, applicationResources); + this.applicationResources = applicationResources; + applicationResources.sideTabExtendedTemplateStyle().ensureInjected(); ViewIdHandler.idHandler.generateAndSetIds(this); initTable(templates, constants); } @@ -105,6 +110,17 @@ return getModel().getRemoveCommand(); } }); + + getTable().setExtraRowStyles(new RowStyles<VmTemplate>() { + @Override + public String getStyleNames(VmTemplate row, int rowIndex) { + if (table.getSelectionModel().isSelected(row)) { + return null; + } + + return applicationResources.sideTabExtendedTemplateStyle().templateRow(); + } + }); } public interface TemplateTableResources extends CellTable.Resources { diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedVirtualMachineView.java b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedVirtualMachineView.java index 95f4904..ac41e43 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedVirtualMachineView.java +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedVirtualMachineView.java @@ -2,7 +2,6 @@ import java.util.ArrayList; import java.util.Arrays; -import java.util.List; import org.ovirt.engine.core.common.businessentities.VmOsType; import org.ovirt.engine.ui.common.idhandler.ElementIdHandler; @@ -254,14 +253,9 @@ }); getTable().setExtraRowStyles(new RowStyles<UserPortalItemModel>() { - @Override public String getStyleNames(UserPortalItemModel row, int rowIndex) { - if (row == null) { - return null; - } - - if (isSelectedRow(row)) { + if (table.getSelectionModel().isSelected(row)) { return null; } @@ -269,31 +263,6 @@ applicationResources.sideTabExtendedVmStyle().vmUpRow() : applicationResources.sideTabExtendedVmStyle().vmDownRow(); } - - protected boolean isSelectedRow(UserPortalItemModel row) { - UserPortalItemModel selectedModel = (UserPortalItemModel) getModel().getSelectedItem(); - if (selectedModel != null) { - if (modelProvider.getKey(selectedModel).equals(modelProvider.getKey(row))) { - return true; - } - } - - @SuppressWarnings("unchecked") - List<UserPortalItemModel> selectedModels = getModel().getSelectedItems(); - - if (selectedModels == null) { - return false; - } - - for (UserPortalItemModel model : selectedModels) { - if (modelProvider.getKey(model).equals(modelProvider.getKey(row))) { - return true; - } - } - - return false; - } - }); } diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/userportal/css/ExtendedTemplateListTable.css b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/userportal/css/ExtendedTemplateListTable.css index ea1ac3f..09bf5c9 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/userportal/css/ExtendedTemplateListTable.css +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/userportal/css/ExtendedTemplateListTable.css @@ -1,11 +1,6 @@ .cellTableOddRowCell, .cellTableEvenRowCell { border: 0px; border-bottom: 1px solid #d4d4d4; - background-color: #e1e1e1; -} - -.cellTableHoveredRow .cellTableOddRowCell, .cellTableHoveredRow .cellTableEvenRowCell { - background-color: #b5c5d7; } .cellTableHeader { @@ -19,9 +14,8 @@ .cellTableSelectedRowCell, .cellTableSelectedRow, .cellTableHoveredRow .cellTableSelectedRowCell { background-color: #3a5f7c; - font-size: 14px; - font-family: Arial,sans-serif; + font-size: 14px; + font-family: Arial, sans-serif; font-weight: bold; color: black; -} - +} \ No newline at end of file diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/userportal/css/ExtendedVmListTable.css b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/userportal/css/ExtendedVmListTable.css index 9d973fe..09bf5c9 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/userportal/css/ExtendedVmListTable.css +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/userportal/css/ExtendedVmListTable.css @@ -1,4 +1,4 @@ -.cellTableEvenRowCell, .cellTableOddRowCell { +.cellTableOddRowCell, .cellTableEvenRowCell { border: 0px; border-bottom: 1px solid #d4d4d4; } @@ -12,11 +12,10 @@ padding-right: 2px; } -.cellTableSelectedRowCell, .cellTableSelectedRow - { +.cellTableSelectedRowCell, .cellTableSelectedRow, .cellTableHoveredRow .cellTableSelectedRowCell { background-color: #3a5f7c; - font-size: 14px; - font-family: Arial,sans-serif; + font-size: 14px; + font-family: Arial, sans-serif; font-weight: bold; color: black; } \ No newline at end of file diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/userportal/css/SideTabExtendedTemplateStyle.css b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/userportal/css/SideTabExtendedTemplateStyle.css new file mode 100644 index 0000000..f9f8885 --- /dev/null +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/userportal/css/SideTabExtendedTemplateStyle.css @@ -0,0 +1,7 @@ +.templateRow { + background-color: #e1e1e1; +} + +.templateRow:hover { + background-color: #b5c5d7; +} \ No newline at end of file -- To view, visit http://gerrit.ovirt.org/10212 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If69e21731ddad072405b68b6ea81d8ef814b22dd Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Vojtech Szocs <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
