Alona Kaplan has uploaded a new change for review. Change subject: webadmin: Remove checkboxes from 3.0 and less host interfaces tab(#831845) ......................................................................
webadmin: Remove checkboxes from 3.0 and less host interfaces tab(#831845) https://bugzilla.redhat.com/831845 Remove the selection checkboxes from 3.0 and lest host-interfaces sub tab. Change-Id: Ia0d4f21c4e1b8570a8aa3be954e6bd8868f7d01d Signed-off-by: Alona Kaplan <[email protected]> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostInterfaceListModel.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/BondPanel.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/HostInterfaceForm.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/InterfacePanel.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/VLanPanel.java 5 files changed, 70 insertions(+), 13 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/41/7541/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostInterfaceListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostInterfaceListModel.java index 82b4d79..3473929 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostInterfaceListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostInterfaceListModel.java @@ -139,6 +139,20 @@ privateOriginalItems = value; } + private boolean isSelectionAvailable; + + public boolean getIsSelectionAvailable() { + return isSelectionAvailable; + } + + public void setSelectionAvailable(boolean value) { + if (isSelectionAvailable != value) + { + isSelectionAvailable = value; + OnPropertyChanged(new PropertyChangedEventArgs("isSelectionAvailable")); //$NON-NLS-1$ + } + } + @Override public Iterable getItems() { @@ -2304,6 +2318,8 @@ getBondCommand().setIsAvailable(isLessThan31); getDetachCommand().setIsAvailable(isLessThan31); getEditManagementNetworkCommand().setIsAvailable(isLessThan31) ; + + setSelectionAvailable(isLessThan31); } } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/BondPanel.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/BondPanel.java index 192581f..6b90f1c 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/BondPanel.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/BondPanel.java @@ -13,8 +13,12 @@ public class BondPanel extends TogglePanel { - public BondPanel(HostInterfaceLineModel lineModel) { + private final boolean isSelectionAvailable; + + public BondPanel(HostInterfaceLineModel lineModel, boolean isSelectionEnabled) { super(lineModel); + this.isSelectionAvailable = isSelectionEnabled; + clear(); Style style = getElement().getStyle(); @@ -23,7 +27,9 @@ style.setBorderStyle(BorderStyle.SOLID); if (lineModel.getIsBonded()) { - add(getCheckBox()); + if (isSelectionEnabled){ + add(getCheckBox()); + } // Bond icon add(new Image(ClientGinjectorProvider.instance().getApplicationResources().splitImage())); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/HostInterfaceForm.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/HostInterfaceForm.java index f652c2f..a8cdacc 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/HostInterfaceForm.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/HostInterfaceForm.java @@ -5,6 +5,7 @@ import org.ovirt.engine.core.compat.Event; import org.ovirt.engine.core.compat.EventArgs; import org.ovirt.engine.core.compat.IEventListener; +import org.ovirt.engine.core.compat.PropertyChangedEventArgs; import org.ovirt.engine.ui.uicommonweb.models.hosts.HostInterfaceLineModel; import org.ovirt.engine.ui.uicommonweb.models.hosts.HostInterfaceListModel; @@ -15,9 +16,11 @@ public class HostInterfaceForm extends Composite { private final Grid grid; + private boolean isSelectionAvailable; @SuppressWarnings("unchecked") - public HostInterfaceForm(HostInterfaceListModel listModel) { + public HostInterfaceForm(final HostInterfaceListModel listModel) { + isSelectionAvailable = listModel.getIsSelectionAvailable(); grid = new Grid(1, 3); grid.getColumnFormatter().setWidth(0, "65%"); //$NON-NLS-1$ grid.getColumnFormatter().setWidth(1, "11%"); //$NON-NLS-1$ @@ -39,10 +42,21 @@ showModels(interfaceLineModels); } }); + + listModel.getPropertyChangedEvent().addListener(new IEventListener() { + @Override + public void eventRaised(Event ev, Object sender, EventArgs args) { + String propName = ((PropertyChangedEventArgs) args).PropertyName; + if ("isSelectionAvailable".equals(propName)) { //$NON-NLS-1$ + isSelectionAvailable = listModel.getIsSelectionAvailable(); + showModels((List<HostInterfaceLineModel>) listModel.getItems()); + } + } + }); } InterfacePanel createInterfacePanel(HostInterfaceLineModel lineModel) { - InterfacePanel panel = new InterfacePanel(); + InterfacePanel panel = new InterfacePanel(isSelectionAvailable); panel.setWidth("100%"); //$NON-NLS-1$ panel.setHeight("100%"); //$NON-NLS-1$ panel.addInterfaces(lineModel.getInterfaces()); @@ -50,14 +64,14 @@ } BondPanel createBondPanel(HostInterfaceLineModel lineModel) { - BondPanel panel = new BondPanel(lineModel); + BondPanel panel = new BondPanel(lineModel, isSelectionAvailable); panel.setWidth("100%"); //$NON-NLS-1$ panel.setHeight("100%"); //$NON-NLS-1$ return panel; } VLanPanel createVLanPanel(HostInterfaceLineModel lineModel) { - VLanPanel panel = new VLanPanel(); + VLanPanel panel = new VLanPanel(isSelectionAvailable); panel.setWidth("100%"); //$NON-NLS-1$ panel.setHeight("100%"); //$NON-NLS-1$ panel.addVLans(lineModel); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/InterfacePanel.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/InterfacePanel.java index 9948892..8dda3e6 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/InterfacePanel.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/InterfacePanel.java @@ -18,18 +18,26 @@ public class InterfacePanel extends VerticalPanel { + private final boolean isSelectionAvailable; + + public InterfacePanel(boolean isSelectionEnabled) { + super(); + this.isSelectionAvailable = isSelectionEnabled; + } public void addInterfaces(List<HostInterface> interfaces) { for (HostInterface hostInterface : interfaces) { - add(new InterfaceElementPanel(hostInterface)); + add(new InterfaceElementPanel(hostInterface, isSelectionAvailable)); } } - } class InterfaceElementPanel extends TogglePanel { - public InterfaceElementPanel(HostInterface hostInterface) { + private final boolean isSelectionAvailable; + + public InterfaceElementPanel(HostInterface hostInterface, boolean isSelectionEnabled) { super(hostInterface); + this.isSelectionAvailable = isSelectionEnabled; add(createRow(hostInterface)); } @@ -55,7 +63,9 @@ // Check box and interface status icon row.setWidget(0, 0, new FlowPanel() { { - add(getCheckBox()); + if (isSelectionAvailable){ + add(getCheckBox()); + } add(new InterfaceStatusImage(hostInterface.getStatus(), ClientGinjectorProvider.instance().getApplicationResources())); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/VLanPanel.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/VLanPanel.java index 06d1338..43be853 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/VLanPanel.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/VLanPanel.java @@ -21,9 +21,15 @@ public static final String CHECK_BOX_COLUMN_WIDTH = "50%"; //$NON-NLS-1$ public static final String NETWORK_NAME_COLUMN_WIDTH = "50%"; //$NON-NLS-1$ + private final boolean isSelectionAvailable; + + public VLanPanel(boolean isSelectionEnabled) { + super(); + this.isSelectionAvailable = isSelectionEnabled; + } public void addVLans(HostInterfaceLineModel lineModel) { for (HostVLan hostVLan : lineModel.getVLans()) { - add(new VLanElementPanel(hostVLan)); + add(new VLanElementPanel(hostVLan, isSelectionAvailable)); } add(new VLanElementPanel(lineModel)); @@ -33,8 +39,11 @@ class VLanElementPanel extends TogglePanel { - public VLanElementPanel(HostVLan hostVLan) { + private boolean isSelectionAvailable = false; + + public VLanElementPanel(HostVLan hostVLan, boolean isSelectionEnabled) { super(hostVLan); + this.isSelectionAvailable = isSelectionEnabled; add(createRow(hostVLan)); } @@ -61,7 +70,9 @@ HorizontalPanel chekboxPanel = new HorizontalPanel(); chekboxPanel.setWidth("100%"); //$NON-NLS-1$ - chekboxPanel.add(getCheckBox()); + if (isSelectionAvailable){ + chekboxPanel.add(getCheckBox()); + } chekboxPanel.add(new Image(ClientGinjectorProvider.instance().getApplicationResources().splitRotateImage())); chekboxPanel.add(new Label(new HostVLanNameRenderer().render(hostVLan))); -- To view, visit http://gerrit.ovirt.org/7541 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia0d4f21c4e1b8570a8aa3be954e6bd8868f7d01d Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alona Kaplan <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
