Yaniv Bronhaim has uploaded a new change for review. Change subject: Adding HostSubTab to UI for BIOS information ......................................................................
Adding HostSubTab to UI for BIOS information BIOS information tab is shown under host's subtab as described in the below wiki page. Feature wiki page: http://wiki.ovirt.org/wiki/Features/Design/HostBiosInfo This patch adds all MVP components and the relations between them. Change-Id: I3de1be89f0457f9fc7b9f3db741df8bce05ed704 Bug-Id: https://bugzilla.redhat.com/show_bug.cgi?id=867543 Signed-off-by: Yaniv Bronhaim <ybron...@redhat.com> --- A frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostBiosModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/ManagedComponents.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/PresenterModule.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/HostModule.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/place/ApplicationPlaces.java A frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/host/SubTabHostBiosPresenter.java A frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostBiosView.java 9 files changed, 471 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/15/10115/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostBiosModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostBiosModel.java new file mode 100644 index 0000000..042b8ac --- /dev/null +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostBiosModel.java @@ -0,0 +1,248 @@ +package org.ovirt.engine.ui.uicommonweb.models.hosts; +import org.ovirt.engine.core.common.businessentities.VDS; +import org.ovirt.engine.core.compat.Event; +import org.ovirt.engine.core.compat.EventDefinition; +import org.ovirt.engine.core.compat.PropertyChangedEventArgs; +import org.ovirt.engine.core.compat.StringHelper; +import org.ovirt.engine.ui.uicommonweb.UICommand; +import org.ovirt.engine.ui.uicommonweb.models.EntityModel; +import org.ovirt.engine.ui.uicompat.ConstantsManager; + +@SuppressWarnings("unused") +public class HostBiosModel extends EntityModel +{ + + public static EventDefinition RequestEditEventDefinition; + private Event privateRequestEditEvent; + + public Event getRequestEditEvent() + { + return privateRequestEditEvent; + } + + private void setRequestEditEvent(Event value) + { + privateRequestEditEvent = value; + } + + public static EventDefinition RequestGOToEventsTabEventDefinition; + private Event privateRequestGOToEventsTabEvent; + + public Event getRequestGOToEventsTabEvent() + { + return privateRequestGOToEventsTabEvent; + } + + private void setRequestGOToEventsTabEvent(Event value) + { + privateRequestGOToEventsTabEvent = value; + } + + private UICommand privateInstallCommand; + + public UICommand getInstallCommand() + { + return privateInstallCommand; + } + + private void setInstallCommand(UICommand value) + { + privateInstallCommand = value; + } + + private UICommand privateEditHostCommand; + + public UICommand getEditHostCommand() + { + return privateEditHostCommand; + } + + private void setEditHostCommand(UICommand value) + { + privateEditHostCommand = value; + } + + private UICommand privateGoToEventsCommand; + + public UICommand getGoToEventsCommand() + { + return privateGoToEventsCommand; + } + + private void setGoToEventsCommand(UICommand value) + { + privateGoToEventsCommand = value; + } + + private boolean updateUpgradeAlert; + + @Override + public VDS getEntity() + { + return (VDS) super.getEntity(); + } + + @Override + public void setEntity(Object value) + { + VDS vds = (VDS) value; + updateUpgradeAlert = vds == null || getEntity() == null + || !vds.getId().equals(getEntity().getId()) + || !vds.getstatus().equals(getEntity().getstatus()); + + super.setEntity(value); + } + + private String manufacturer; + + public String getManufacturer() + { + return manufacturer; + } + + public void setManufacturer(String value) + { + if (!StringHelper.stringsEqual(manufacturer, value)) + { + manufacturer = value; + OnPropertyChanged(new PropertyChangedEventArgs("manufacturer")); //$NON-NLS-1$ + } + } + + private String productName; + + public String getProductName() + { + return productName; + } + + public void setProductName(String value) + { + if (!StringHelper.stringsEqual(productName, value)) + { + productName = value; + OnPropertyChanged(new PropertyChangedEventArgs("productName")); //$NON-NLS-1$ + } + } + + private String serialNumber; + + public String getSerialNumber() + { + return serialNumber; + } + + public void setserialNumber(String value) + { + if (!StringHelper.stringsEqual(serialNumber, value)) + { + serialNumber = value; + OnPropertyChanged(new PropertyChangedEventArgs("serialNumber")); //$NON-NLS-1$ + } + } + + private String biosVersion; + + public String getBiosVersion() + { + return biosVersion; + } + + public void setBiosVersion(String value) + { + if (!StringHelper.stringsEqual(biosVersion, value)) + { + biosVersion = value; + OnPropertyChanged(new PropertyChangedEventArgs("biosVersion")); //$NON-NLS-1$ + } + } + + private String uuid; + + public String getUuid() + { + return uuid; + } + + public void setUuid(String value) + { + if (!StringHelper.stringsEqual(uuid, value)) + { + uuid = value; + OnPropertyChanged(new PropertyChangedEventArgs("uuid")); //$NON-NLS-1$ + } + } + + private String family; + + public String getFamily() + { + return family; + } + + public void setFamily(String value) + { + if (!StringHelper.stringsEqual(family, value)) + { + family = value; + OnPropertyChanged(new PropertyChangedEventArgs("family")); //$NON-NLS-1$ + } + } + + static + { + RequestEditEventDefinition = new EventDefinition("RequestEditEvent", HostGeneralModel.class); //$NON-NLS-1$ + RequestGOToEventsTabEventDefinition = new EventDefinition("RequestGOToEventsTabEvent", HostGeneralModel.class); //$NON-NLS-1$ + } + + public HostBiosModel() + { + setRequestEditEvent(new Event(RequestEditEventDefinition)); + setRequestGOToEventsTabEvent(new Event(RequestGOToEventsTabEventDefinition)); + setTitle(ConstantsManager.getInstance().getConstants().generalTitle()); + setHashName("bios"); //$NON-NLS-1$ + + setInstallCommand(new UICommand("Install", this)); //$NON-NLS-1$ + setEditHostCommand(new UICommand("EditHost", this)); //$NON-NLS-1$ + setGoToEventsCommand(new UICommand("GoToEvents", this)); //$NON-NLS-1$ + } + + @Override + protected void EntityPropertyChanged(Object sender, PropertyChangedEventArgs e) + { + super.EntityPropertyChanged(sender, e); + } + + private void UpdateProperties() + { + VDS vds = getEntity(); + setManufacturer(vds.gethost_manufacturer()); + setBiosVersion(vds.gethost_version()); + setProductName(vds.gethost_product_name()); + setUuid(vds.gethost_uuid()); + setserialNumber(vds.gethost_serial_number()); + setFamily(vds.gethost_family()); + } + + private void GoToEvents() + { + this.getRequestGOToEventsTabEvent().raise(this, null); + } + + @Override + protected void OnEntityChanged() + { + super.OnEntityChanged(); + + if (getEntity() != null) + { + UpdateProperties(); + } + } + + @Override + public void ExecuteCommand(UICommand command) + { + super.ExecuteCommand(command); + } +} diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java index 0cb21d6..741f5d5 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java @@ -1445,6 +1445,7 @@ generalModel.getRequestGOToEventsTabEvent().addListener(this); ObservableCollection<EntityModel> list = new ObservableCollection<EntityModel>(); list.add(generalModel); + list.add(new HostBiosModel()); list.add(new HostVmListModel()); list.add(new HostInterfaceListModel()); setHostEventListModel(new HostEventListModel()); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java index 1e58204..ad56cd4 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java @@ -334,6 +334,9 @@ @DefaultStringValue("General") String hostGeneralSubTabLabel(); + @DefaultStringValue("BIOS Information") + String hostBiosSubTabLabel(); + @DefaultStringValue("Virtual Machines") String hostVmSubTabLabel(); @@ -1065,6 +1068,24 @@ @DefaultStringValue("OS Version") String osVersionHostGeneral(); + @DefaultStringValue("Manufacturer") + String hostManufacturerGeneral(); + + @DefaultStringValue("Product Name") + String hostProductNameGeneral(); + + @DefaultStringValue("Version") + String hostBiosVersionGeneral(); + + @DefaultStringValue("Serial Number") + String hostSerialNumberGeneral(); + + @DefaultStringValue("UUID") + String hostUUIDGeneral(); + + @DefaultStringValue("Family") + String hostFamilyGeneral(); + @DefaultStringValue("Kernel Version") String kernelVersionHostGeneral(); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/ManagedComponents.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/ManagedComponents.java index 05da0a7..92baf14 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/ManagedComponents.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/ManagedComponents.java @@ -55,6 +55,7 @@ import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeEventListModel; import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeGeneralModel; import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeParameterListModel; +import org.ovirt.engine.ui.uicommonweb.models.hosts.HostBiosModel; import org.ovirt.engine.ui.uicommonweb.models.hosts.HostEventListModel; import org.ovirt.engine.ui.uicommonweb.models.hosts.HostGeneralModel; import org.ovirt.engine.ui.uicommonweb.models.hosts.HostHooksListModel; @@ -164,6 +165,7 @@ import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.gluster.SubTabVolumePermissionPresenter; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.gluster.VolumeSubTabPanelPresenter; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.host.HostSubTabPanelPresenter; +import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.host.SubTabHostBiosPresenter; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.host.SubTabHostEventPresenter; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.host.SubTabHostGeneralPresenter; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.host.SubTabHostHookPresenter; @@ -456,6 +458,10 @@ DetailModelProvider<HostListModel, HostGeneralModel> getSubTabHostGeneralModelProvider(); + AsyncProvider<SubTabHostBiosPresenter> getSubTabHostBiosPresenter(); + + DetailModelProvider<HostListModel, HostBiosModel> getSubTabHostBiosModelProvider(); + AsyncProvider<SubTabHostVmPresenter> getSubTabHostVmPresenter(); SearchableDetailModelProvider<VM, HostListModel, HostVmListModel> getSubTabHostVmModelProvider(); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/PresenterModule.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/PresenterModule.java index 76e1b25..8cdd208 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/PresenterModule.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/PresenterModule.java @@ -125,6 +125,7 @@ import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.gluster.SubTabVolumePermissionPresenter; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.gluster.VolumeSubTabPanelPresenter; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.host.HostSubTabPanelPresenter; +import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.host.SubTabHostBiosPresenter; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.host.SubTabHostEventPresenter; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.host.SubTabHostGeneralPresenter; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.host.SubTabHostHookPresenter; @@ -303,6 +304,7 @@ import org.ovirt.engine.ui.webadmin.section.main.view.tab.gluster.SubTabVolumePermissionView; import org.ovirt.engine.ui.webadmin.section.main.view.tab.gluster.VolumeSubTabPanelView; import org.ovirt.engine.ui.webadmin.section.main.view.tab.host.HostSubTabPanelView; +import org.ovirt.engine.ui.webadmin.section.main.view.tab.host.SubTabHostBiosView; import org.ovirt.engine.ui.webadmin.section.main.view.tab.host.SubTabHostEventView; import org.ovirt.engine.ui.webadmin.section.main.view.tab.host.SubTabHostGeneralView; import org.ovirt.engine.ui.webadmin.section.main.view.tab.host.SubTabHostHookView; @@ -584,6 +586,10 @@ SubTabHostGeneralPresenter.ViewDef.class, SubTabHostGeneralView.class, SubTabHostGeneralPresenter.ProxyDef.class); + bindPresenter(SubTabHostBiosPresenter.class, + SubTabHostBiosPresenter.ViewDef.class, + SubTabHostBiosView.class, + SubTabHostBiosPresenter.ProxyDef.class); bindPresenter(SubTabHostVmPresenter.class, SubTabHostVmPresenter.ViewDef.class, SubTabHostVmView.class, diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/HostModule.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/HostModule.java index 860913f..e66e4eb 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/HostModule.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/HostModule.java @@ -22,6 +22,7 @@ import org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel; import org.ovirt.engine.ui.uicommonweb.models.Model; import org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel; +import org.ovirt.engine.ui.uicommonweb.models.hosts.HostBiosModel; import org.ovirt.engine.ui.uicommonweb.models.hosts.HostBondInterfaceModel; import org.ovirt.engine.ui.uicommonweb.models.hosts.HostEventListModel; import org.ovirt.engine.ui.uicommonweb.models.hosts.HostGeneralModel; @@ -130,6 +131,25 @@ }; } + @Provides + @Singleton + public DetailModelProvider<HostListModel, HostBiosModel> getHostBiosProvider(ClientGinjector ginjector, + final Provider<HostInstallPopupPresenterWidget> installPopupProvider) { + return new DetailTabModelProvider<HostListModel, HostBiosModel>(ginjector, + HostListModel.class, + HostBiosModel.class) { + @Override + public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(HostBiosModel source, + UICommand lastExecutedCommand, Model windowModel) { + if (lastExecutedCommand == getModel().getInstallCommand()) { + return installPopupProvider.get(); + } else { + return super.getModelPopup(source, lastExecutedCommand, windowModel); + } + } + }; + } + // Searchable Detail Models @Provides diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/place/ApplicationPlaces.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/place/ApplicationPlaces.java index a666d41..bd79c9a 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/place/ApplicationPlaces.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/place/ApplicationPlaces.java @@ -141,6 +141,9 @@ public static final String hostGeneralSubTabPlace = hostMainTabPlace + SUB_TAB_PREFIX + "general"; //$NON-NLS-1$ + public static final String hostBiosSubTabPlace = hostMainTabPlace + SUB_TAB_PREFIX + + "bios"; //$NON-NLS-1$ + public static final String hostVmSubTabPlace = hostMainTabPlace + SUB_TAB_PREFIX + "virtual_machines"; //$NON-NLS-1$ diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/host/SubTabHostBiosPresenter.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/host/SubTabHostBiosPresenter.java new file mode 100644 index 0000000..9f4f629 --- /dev/null +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/host/SubTabHostBiosPresenter.java @@ -0,0 +1,75 @@ +package org.ovirt.engine.ui.webadmin.section.main.presenter.tab.host; +import org.ovirt.engine.core.common.businessentities.VDS; +import org.ovirt.engine.ui.common.presenter.AbstractSubTabPresenter; +import org.ovirt.engine.ui.common.uicommon.model.DetailModelProvider; +import org.ovirt.engine.ui.common.uicommon.model.UiCommonInitEvent; +import org.ovirt.engine.ui.common.widget.tab.ModelBoundTabData; +import org.ovirt.engine.ui.uicommonweb.models.hosts.HostBiosModel; +import org.ovirt.engine.ui.uicommonweb.models.hosts.HostListModel; +import org.ovirt.engine.ui.webadmin.ApplicationMessages; +import org.ovirt.engine.ui.webadmin.gin.ClientGinjector; +import org.ovirt.engine.ui.webadmin.gin.ClientGinjectorProvider; +import org.ovirt.engine.ui.webadmin.place.ApplicationPlaces; +import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.HostSelectionChangeEvent; + +import com.google.gwt.event.shared.EventBus; +import com.google.inject.Inject; +import com.gwtplatform.mvp.client.TabData; +import com.gwtplatform.mvp.client.annotations.NameToken; +import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit; +import com.gwtplatform.mvp.client.annotations.ProxyEvent; +import com.gwtplatform.mvp.client.annotations.TabInfo; +import com.gwtplatform.mvp.client.proxy.PlaceManager; +import com.gwtplatform.mvp.client.proxy.PlaceRequest; +import com.gwtplatform.mvp.client.proxy.RevealContentEvent; +import com.gwtplatform.mvp.client.proxy.TabContentProxyPlace; + +public class SubTabHostBiosPresenter extends AbstractSubTabPresenter<VDS, HostListModel, HostBiosModel, SubTabHostBiosPresenter.ViewDef, SubTabHostBiosPresenter.ProxyDef> { + + @ProxyCodeSplit + @NameToken(ApplicationPlaces.hostBiosSubTabPlace) + public interface ProxyDef extends TabContentProxyPlace<SubTabHostBiosPresenter> { + } + + public interface ViewDef extends AbstractSubTabPresenter.ViewDef<VDS> { + } + + // We need this to get the text of the alert messages: + private final ApplicationMessages messages; + + @TabInfo(container = HostSubTabPanelPresenter.class) + static TabData getTabData(ClientGinjector ginjector) { + return new ModelBoundTabData(ginjector.getApplicationConstants().hostBiosSubTabLabel(), 5, + ginjector.getSubTabHostBiosModelProvider()); + } + + @Inject + public SubTabHostBiosPresenter(EventBus eventBus, ViewDef view, ProxyDef proxy, + PlaceManager placeManager, DetailModelProvider<HostListModel, HostBiosModel> modelProvider) { + super(eventBus, view, proxy, placeManager, modelProvider); + + // Inject a reference to the messages: + messages = ClientGinjectorProvider.instance().getApplicationMessages(); + } + + @Override + public void onUiCommonInit(UiCommonInitEvent event) { + super.onUiCommonInit(event); + } + + @Override + protected void revealInParent() { + RevealContentEvent.fire(this, HostSubTabPanelPresenter.TYPE_SetTabContent, this); + } + + @Override + protected PlaceRequest getMainTabRequest() { + return new PlaceRequest(ApplicationPlaces.hostMainTabPlace); + } + + @ProxyEvent + public void onHostSelectionChange(HostSelectionChangeEvent event) { + updateMainTabSelection(event.getSelectedItems()); + } + +} diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostBiosView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostBiosView.java new file mode 100644 index 0000000..1b5bf45 --- /dev/null +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostBiosView.java @@ -0,0 +1,91 @@ +package org.ovirt.engine.ui.webadmin.section.main.view.tab.host; + +import java.util.ArrayList; + +import javax.inject.Inject; + +import org.ovirt.engine.core.common.businessentities.VDS; +import org.ovirt.engine.ui.common.uicommon.model.DetailModelProvider; +import org.ovirt.engine.ui.common.view.AbstractSubTabFormView; +import org.ovirt.engine.ui.common.widget.form.FormBuilder; +import org.ovirt.engine.ui.common.widget.form.FormItem; +import org.ovirt.engine.ui.common.widget.form.GeneralFormPanel; +import org.ovirt.engine.ui.common.widget.label.TextBoxLabel; +import org.ovirt.engine.ui.uicommonweb.models.hosts.HostBiosModel; +import org.ovirt.engine.ui.uicommonweb.models.hosts.HostListModel; +import org.ovirt.engine.ui.webadmin.ApplicationConstants; +import org.ovirt.engine.ui.webadmin.ApplicationResources; +import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.host.SubTabHostBiosPresenter; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.editor.client.Editor; +import com.google.gwt.editor.client.SimpleBeanEditorDriver; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.ui.Widget; + +public class SubTabHostBiosView extends AbstractSubTabFormView<VDS, HostListModel, HostBiosModel> implements SubTabHostBiosPresenter.ViewDef, Editor<HostBiosModel> { + + interface Driver extends SimpleBeanEditorDriver<HostBiosModel, SubTabHostBiosView> { + Driver driver = GWT.create(Driver.class); + } + + // We need this in order to find the icon for alert messages: + private final ApplicationResources resources; + + TextBoxLabel manufacturer = new TextBoxLabel(); + TextBoxLabel productName = new TextBoxLabel(); + TextBoxLabel serialNumber = new TextBoxLabel(); + TextBoxLabel biosVersion = new TextBoxLabel(); + TextBoxLabel uuid = new TextBoxLabel(); + TextBoxLabel family = new TextBoxLabel(); + + @UiField(provided = true) + GeneralFormPanel formPanel; + + FormBuilder formBuilder; + + interface ViewUiBinder extends UiBinder<Widget, SubTabHostBiosView> { + ViewUiBinder uiBinder = GWT.create(ViewUiBinder.class); + } + + @Inject + public SubTabHostBiosView(DetailModelProvider<HostListModel, HostBiosModel> modelProvider, + ApplicationResources resources, ApplicationConstants constants) { + super(modelProvider); + + // Inject a reference to the resources: + this.resources = resources; + + // Init form panel: + formPanel = new GeneralFormPanel(); + + initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); + Driver.driver.initialize(this); + + // Build a form using the FormBuilder + formBuilder = new FormBuilder(formPanel, 3, 6); + formBuilder.setColumnsWidth("230px", "120px", "270px"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + ArrayList<FormItem> formItems = new ArrayList<FormItem>(); + formItems.add(new FormItem(constants.hostManufacturerGeneral(), manufacturer, 0, 0)); + formItems.add(new FormItem(constants.hostProductNameGeneral(), productName, 1, 0)); + formItems.add(new FormItem(constants.hostUUIDGeneral(), uuid, 2, 0)); + formItems.add(new FormItem(constants.hostBiosVersionGeneral(), biosVersion, 3, 0)); + formItems.add(new FormItem(constants.hostSerialNumberGeneral(), serialNumber, 4, 0)); + formItems.add(new FormItem(constants.hostFamilyGeneral(), family, 5, 0)); + + + for (FormItem formItem : formItems) + { + formBuilder.addFormItem(formItem); + } + } + + @Override + public void setMainTabSelectedItem(VDS selectedItem) { + Driver.driver.edit(getDetailModel()); + + formBuilder.showForm(getDetailModel()); + } +} -- To view, visit http://gerrit.ovirt.org/10115 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3de1be89f0457f9fc7b9f3db741df8bce05ed704 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yaniv Bronhaim <ybron...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches