@Override public void setMainTabSelectedItem(VDS selectedItem) { driver.edit(getDetailModel()); refreshHBADeviceInfo(selectedItem); formBuilder.update(getDetailModel()); }
private void refreshHBADeviceInfo(VDS selectedItem) { /* refresh all the information about Host Bus Adapter (FC, iSCSI) devices */ hbaInventory.clear(); if (selectedItem != null && getDetailModel().getHbaDevices() != null) { /* * traverse the model and get all the HBAs */ for (EnumMap<HostHardwareGeneralModel.HbaDeviceKeys, String> hbaDevice : getDetailModel().getHbaDevices()) { GeneralFormPanel hbaFormPanel = new GeneralFormPanel() { { getElement().getStyle().setFloat(Float.LEFT); getElement().getStyle().setBorderWidth(1, Unit.PX); getElement().getStyle().setBorderStyle(BorderStyle.SOLID); getElement().getStyle().setBorderColor("black"); // $NON-NLS-1$ getElement().getStyle().setMarginLeft(5, Unit.PX); getElement().getStyle().setMarginBottom(5, Unit.PX); getElement().getStyle().setProperty("width", "auto"); // $NON-NLS-1$ //$NON-NLS-2$ } }; StringValueLabel interfaceName = new StringValueLabel(hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.MODEL_NAME)); StringValueLabel interfaceType = new StringValueLabel(hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.TYPE)); StringValueLabel interfaceWWNN = new StringValueLabel(hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.WWNN)); StringValueLabel portWWPNs = new StringValueLabel(hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.WWNPS)); FormBuilder hbaFormBuilder = new FormBuilder(hbaFormPanel, 1, 4); hbaFormBuilder.setRelativeColumnWidth(0, 12); hbaFormBuilder.addFormItem(new FormItem(constants.hbaModelName(), interfaceName, 0, 0)); hbaFormBuilder.addFormItem(new FormItem(constants.hbaDeviceType(), interfaceType, 1, 0)); hbaFormBuilder.addFormItem(new FormItem(constants.hbaWWNN(), interfaceWWNN, 2, 0)); hbaFormBuilder.addFormItem(new FormItem(constants.hbaWWPNs(), portWWPNs, 3, 0)); hbaInventory.add(hbaFormPanel); } } }
@Inject public SubTabHostGeneralHardwareView( DetailModelProvider<HostListModel<Void>, HostHardwareGeneralModel> modelProvider) { super(modelProvider); // Init form panel: formPanel = new GeneralFormPanel(); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); driver.initialize(this); // Build a form using the FormBuilder formBuilder = new FormBuilder(formPanel, 3, 4); formBuilder.setRelativeColumnWidth(0, 4); formBuilder.setRelativeColumnWidth(1, 5); formBuilder.setRelativeColumnWidth(2, 3); formBuilder.addFormItem( new FormItem(constants.hardwareManufacturerGeneral(), hardwareManufacturer, 0, 0), 5, 7); formBuilder.addFormItem( new FormItem(constants.hardwareVersionGeneral(), hardwareVersion, 1, 0), 5, 7); formBuilder.addFormItem(new FormItem(constants.cpuModelHostGeneral(), cpuModel, 2, 0), 5, 7); formBuilder.addFormItem( new FormItem(constants.numOfCoresPerSocketHostGeneral(), coresPerSocket, 3, 0), 5, 7); formBuilder.addFormItem( new FormItem(constants.hardwareFamilyGeneral(), hardwareFamily, 0, 1), 4, 8); formBuilder.addFormItem( new FormItem(constants.hardwareUUIDGeneral(), hardwareUUID, 1, 1), 4, 8); formBuilder.addFormItem(new FormItem(constants.cpuTypeHostGeneral(), cpuType, 2, 1), 4, 8); formBuilder.addFormItem( new FormItem(constants.numOfThreadsPerCoreHostGeneral(), threadsPerCore, 3, 1), 4, 8); formBuilder.addFormItem( new FormItem(constants.hardwareProductNameGeneral(), hardwareProductName, 0, 2), 4, 8); formBuilder.addFormItem( new FormItem(constants.hardwareSerialNumberGeneral(), hardwareSerialNumber, 1, 2), 4, 8); formBuilder.addFormItem( new FormItem(constants.numOfSocketsHostGeneral(), numberOfSockets, 2, 2), 4, 8); }