@Override public void eventRaised(Event ev, Object sender, EventArgs args) { if (async && getForm() == null) return; valueMap = new LinkedHashMap<String, String>(); ListModel listModel = (ListModel) sender; Iterable items = listModel.getItems(); if (items != null) { GWT.log("Select box " + selectBox.getTitle() + " items loaded: " + items); itemsCount = 0; for (Object o : items) { itemsCount++; valueMap.put(getItemId(o), getItemName(o)); } if (model.getIsChangable()) { setShowDisabled(false); setDisabled(false); } else { setShowDisabled(true); setDisabled(!model.getIsChangable()); } // Set a tool tip with a prohibition reason when the select box is non-changeable if (!listModel.getIsChangable() && !listModel.getChangeProhibitionReasons().isEmpty()) { setTooltip("<nobr>" + model.getChangeProhibitionReasons().iterator().next() + "</nobr>"); setHoverStyle("gridToolTipStyle"); setHoverWidth(1); setHoverDelay(100); } } else { GWT.log("Select box " + selectBox.getTitle() + " items loaded are null"); } selectBox.setValueMap(valueMap); }
@Override public void eventRaised(Event ev, Object sender, EventArgs args) { super.eventRaised(ev, sender, args); if (ev.equals(ListModel.SelectedItemChangedEventDefinition) && sender == getDataCenter().getVersion()) { DataCenterVersion_SelectedItemChanged(); } }
@Override public void UpdateItemsAvailability() { super.UpdateItemsAvailability(); storage_pool dataCenter = (storage_pool) getModel().getDataCenter().getSelectedItem(); for (IStorageModel item : Linq.<IStorageModel>Cast(getModel().getItems())) { Model model = (Model) item; storage_domains isoStorage = DataProvider.GetIsoDomainByDataCenterId(dataCenter.getId()); storage_domains exportStorage = DataProvider.GetExportDomainByDataCenterId(dataCenter.getId()); // available type/function items are: // all in case of Unassigned DC. // ISO in case the specified DC doesn't have an attached ISO domain. // Export in case the specified DC doesn't have an attached export domain. model.setIsSelectable( (dataCenter.getId().equals(StorageModel.UnassignedDataCenterId) || (item.getRole() == StorageDomainType.ISO && isoStorage == null) || (item.getRole() == StorageDomainType.ImportExport && exportStorage == null))); } }