[Engine-devel] Got some troubles when I want to modify oVirt GUI

Chen, Wei D wei.d.chen at intel.com
Tue Mar 12 08:48:34 UTC 2013


Hi,
   In order to add new feature to Ovirt, that is user can choose virtual machine whether on trusted machine or not when it runs up, we modified the relative files.
Our goal is when the user click the trusted button, Run/Migration options are disabled. But unfortunately, we haven’t succeeded in graphic interface. 
I modified these files, I can’t see Host Tab, can you give me some help? Maybe we need modify more files. We did the following efforts:
(1) add a trusted radio button.
(2) Modify AbstractVmPopupWidget.ui.xml
<g:HorizontalPanel verticalAlignment='ALIGN_MIDDLE'>
     <g:RadioButton ui:field="runVMOnTrustedHost"/>
     <e:EntityModelRadioButtonEditor width="150px" ui:field="runVMOnTrustedHostEditor"
                  addStyleNames="{style.radioButton}" />
</g:HorizontalPanel>
(3) Modify AbstractVmPopupWidget.java
@UiField(provided = true)
@Path(value = "runVMOnTrustedHost.entity")
    @WithElementId("runVMOnTrustedHost")
public EntityModelRadioButtonEditor runVMOnTrustedHostEditor;

initListeners method:
object.getIsAutoAssign().getPropertyChangedEvent().addListener(new IEventListener() {
            @Override
            public void eventRaised(Event ev, Object sender, EventArgs args) {
                boolean isAutoAssign = (Boolean) object.getIsAutoAssign().getEntity();
                boolean runVMOnTrustedHost = (Boolean) object.getRunVMOnTrustedHost().getEntity();
                defaultHostEditor.setEnabled(!isAutoAssign && !runVMOnTrustedHost);
                //defaultHostEditor.setEnabled(!isAutoAssign);
                // only this is not bind to the model, so needs to listen to the change explicitly
               specificHost.setValue(!isAutoAssign && !runVMOnTrustedHost);
               //specificHost.setValue(!isAutoAssign);
            }
        });
isAutoAssignEditor.addDomHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                defaultHostEditor.setEnabled(false);
            }
        }, ClickEvent.getType());
        vm.getIsAutoAssign().getEntityChangedEvent().addListener(new IEventListener() {
            @Override
            public void eventRaised(Event ev, Object sender, EventArgs args) {
                if (!isAutoAssignEditor.asRadioButton().getValue() && !runVMOnTrustedHostEditor.asRadioButton().getValue())
                {
                    specificHost.setValue(true, true);
                }
            }
        });
        runVMOnTrustedHostEditor.addDomHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                defaultHostEditor.setEnabled(false);
            }
        }, ClickEvent.getType());
        vm.getRunVMOnTrustedHost().getEntityChangedEvent().addListener(new IEventListener() {
            @Override
            public void eventRaised(Event ev, Object sender, EventArgs args) {
                if (!runVMOnTrustedHostEditor.asRadioButton().getValue() && !isAutoAssignEditor.asRadioButton().getValue())
                {
                    specificHost.setValue(true, true);
                }
            }
        });
(4) Modify UnitVmModel.java
  private void RunVMOnTrustedHost_EntityChanged(Object sender, EventArgs args)
   {
        if ((Boolean) getRunVMOnTrustedHost().getEntity() == true)
        {
            clearAndDisable(getRunVMOnSpecificHost());
            clearAndDisable(getHostCpu());
        }
        else
        {
            getRunVMOnSpecificHost().setIsChangable(true);
        }
        behavior.updateCpuPinningVisibility();
  }

-------------- next part --------------
A non-text attachment was scrubbed...
Name: AbstractVmPopupWidget.ui.xml
Type: text/xml
Size: 16078 bytes
Desc: AbstractVmPopupWidget.ui.xml
URL: <http://lists.ovirt.org/pipermail/devel/attachments/20130312/a42da516/attachment-0001.xml>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: UnitVmModel.java
Type: application/octet-stream
Size: 75481 bytes
Desc: UnitVmModel.java
URL: <http://lists.ovirt.org/pipermail/devel/attachments/20130312/a42da516/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AbstractVmPopupWidget.java
Type: application/octet-stream
Size: 44510 bytes
Desc: AbstractVmPopupWidget.java
URL: <http://lists.ovirt.org/pipermail/devel/attachments/20130312/a42da516/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: VmListModel.java
Type: application/octet-stream
Size: 114678 bytes
Desc: VmListModel.java
URL: <http://lists.ovirt.org/pipermail/devel/attachments/20130312/a42da516/attachment-0005.obj>


More information about the Devel mailing list