Alona Kaplan has uploaded a new change for review. Change subject: webadmin: adding custom properties to vnic dialog ......................................................................
webadmin: adding custom properties to vnic dialog Adding KeyValueWidget to vnic add/edit dialog to suport adding custom properties to a vnic (same functionality as for vm->custom properties). Change-Id: Icb066bf96ab50ab40e19c44754fc70608b48cc24 Signed-off-by: Alona Kaplan <alkap...@redhat.com> --- M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/networkinterface/NetworkInterfacePopupWidget.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/networkinterface/NetworkInterfacePopupWidget.ui.xml M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/BaseEditVmInterfaceModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmInterfaceModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java 5 files changed, 60 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/20/15020/1 diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/networkinterface/NetworkInterfacePopupWidget.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/networkinterface/NetworkInterfacePopupWidget.java index 3e783ee..8a4c4a1 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/networkinterface/NetworkInterfacePopupWidget.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/networkinterface/NetworkInterfacePopupWidget.java @@ -12,10 +12,14 @@ import org.ovirt.engine.ui.common.widget.editor.EntityModelRadioButtonEditor; import org.ovirt.engine.ui.common.widget.editor.EntityModelTextBoxEditor; import org.ovirt.engine.ui.common.widget.editor.ListModelListBoxEditor; +import org.ovirt.engine.ui.common.widget.form.key_value.KeyValueWidget; import org.ovirt.engine.ui.common.widget.renderer.EnumRenderer; import org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer; import org.ovirt.engine.ui.common.widget.uicommon.popup.AbstractModelBoundPopupWidget; import org.ovirt.engine.ui.uicommonweb.models.vms.VmInterfaceModel; +import org.ovirt.engine.ui.uicompat.Event; +import org.ovirt.engine.ui.uicompat.EventArgs; +import org.ovirt.engine.ui.uicompat.IEventListener; import com.google.gwt.core.client.GWT; import com.google.gwt.editor.client.SimpleBeanEditorDriver; @@ -135,6 +139,10 @@ @Ignore public Panel expanderContent; + @UiField + @Ignore + public KeyValueWidget customPropertiesSheetEditor; + private final Driver driver = GWT.create(Driver.class); public NetworkInterfacePopupWidget(EventBus eventBus, CommonApplicationConstants constants) { @@ -205,6 +213,7 @@ driver.edit(iface); hideMacWhenNotEnabled(iface); + initCustomPropertySheet(iface); } private void hideMacWhenNotEnabled(VmInterfaceModel iface) { @@ -215,6 +224,16 @@ } } + private void initCustomPropertySheet(final VmInterfaceModel iface) { + iface.getCustomPropertySheet().getKeyValueLines().getItemsChangedEvent().addListener(new IEventListener() { + + @Override + public void eventRaised(Event ev, Object sender, EventArgs args) { + customPropertiesSheetEditor.edit(iface.getCustomPropertySheet()); + } + }); + } + @Override public VmInterfaceModel flush() { return driver.flush(); diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/networkinterface/NetworkInterfacePopupWidget.ui.xml b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/networkinterface/NetworkInterfacePopupWidget.ui.xml index 548c4d5..2454566 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/networkinterface/NetworkInterfacePopupWidget.ui.xml +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/networkinterface/NetworkInterfacePopupWidget.ui.xml @@ -2,7 +2,8 @@ <!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" xmlns:d="urn:import:org.ovirt.engine.ui.common.widget.dialog" - xmlns:e="urn:import:org.ovirt.engine.ui.common.widget.editor"> + xmlns:e="urn:import:org.ovirt.engine.ui.common.widget.editor" + xmlns:k="urn:import:org.ovirt.engine.ui.common.widget.form.key_value" > <ui:with field='constants' type='org.ovirt.engine.ui.common.CommonApplicationConstants' /> @@ -112,6 +113,9 @@ </g:HorizontalPanel> </g:SimplePanel> </g:HorizontalPanel> + <g:FlowPanel> + <k:KeyValueWidget ui:field="customPropertiesSheetEditor"/> + </g:FlowPanel> </g:FlowPanel> </g:FlowPanel> </ui:UiBinder> diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/BaseEditVmInterfaceModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/BaseEditVmInterfaceModel.java index 14a8f86..68ebc57 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/BaseEditVmInterfaceModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/BaseEditVmInterfaceModel.java @@ -54,6 +54,8 @@ initPortMirroring(); initNetworks(); + initCustomPropertySheet(); + // Plug should be the last one updated, cause it controls the changeability of the other editor getPlugged().setEntity(getNic().isPlugged()); if (!hotPlugSupported) { diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmInterfaceModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmInterfaceModel.java index 4c15bc1..c955fd9 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmInterfaceModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmInterfaceModel.java @@ -54,6 +54,7 @@ initPortMirroring(); initNetworks(); + initCustomPropertySheet(); initCommands(); } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java index f0e76b0..600e472 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java @@ -23,6 +23,7 @@ import org.ovirt.engine.ui.uicommonweb.models.EntityModel; import org.ovirt.engine.ui.uicommonweb.models.ListModel; import org.ovirt.engine.ui.uicommonweb.models.Model; +import org.ovirt.engine.ui.uicommonweb.models.vms.key_value.KeyValueModel; import org.ovirt.engine.ui.uicommonweb.validation.I18NNameValidation; import org.ovirt.engine.ui.uicommonweb.validation.IValidation; import org.ovirt.engine.ui.uicommonweb.validation.MacAddressValidation; @@ -62,6 +63,28 @@ private final EntityModel sourceModel; private final Version clusterCompatibilityVersion; + + private KeyValueModel customPropertySheet; + + public KeyValueModel getCustomPropertySheet() { + return customPropertySheet; + } + + public void setCustomPropertySheet(KeyValueModel customPropertySheet) { + this.customPropertySheet = customPropertySheet; + } + + private ArrayList<String> privateCustomPropertiesKeysList; + + public ArrayList<String> getCustomPropertiesKeysList() + { + return privateCustomPropertiesKeysList; + } + + public void setCustomPropertiesKeysList(ArrayList<String> value) + { + privateCustomPropertiesKeysList = value; + } protected VmInterfaceModel(VmBase vm, Version clusterCompatibilityVersion, @@ -124,6 +147,8 @@ setUnplugged_IsSelected(new EntityModel()); getUnplugged_IsSelected().getEntityChangedEvent().addListener(this); + + setCustomPropertySheet(new KeyValueModel()); } protected abstract void init(); @@ -365,7 +390,7 @@ } return getName().getIsValid() && getNetwork().getIsValid() && getNicType().getIsValid() - && getMAC().getIsValid(); + && getMAC().getIsValid() && getCustomPropertySheet().validate(); } protected abstract VmNetworkInterface createBaseNic(); @@ -400,6 +425,8 @@ onSaveMAC(nic); nic.setPlugged((Boolean) getPlugged().getEntity()); + + nic.setCustomProperties(getCustomPropertySheet().getEntity()); startProgress(null); @@ -456,7 +483,7 @@ Collections.sort(networks, new Comparator<Network>() { - private LexoNumericComparator lexoNumeric = new LexoNumericComparator(); + private final LexoNumericComparator lexoNumeric = new LexoNumericComparator(); @Override public int compare(Network net1, Network net2) { @@ -553,4 +580,8 @@ protected void updateNetworkChangability() { getNetwork().setIsChangable(true); } + + protected void initCustomPropertySheet() { + getCustomPropertySheet().setKeyValueString(getCustomPropertiesKeysList()); + } } -- To view, visit http://gerrit.ovirt.org/15020 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icb066bf96ab50ab40e19c44754fc70608b48cc24 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alona Kaplan <alkap...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches