public class RegisterTemplateInfoPanel extends RegisterEntityInfoPanel<VmTemplate> { private ImportTemplateGeneralSubTabView generalView; private TemplateGeneralModel templateGeneralModel; public RegisterTemplateInfoPanel(RegisterEntityModel<VmTemplate> model) { super(model); } private static final ApplicationConstants constants = AssetProvider.getConstants(); @Override protected void init() { // Initialize Tables initGeneralForm(); initDisksTable(); initNicsTable(); // Add Tabs add(new ScrollPanel(generalView.asWidget()), constants.generalLabel()); add(new ScrollPanel(disksTable), constants.disksLabel()); add(new ScrollPanel(nicsTable), constants.nicsLabel()); } @Override public void updateTabsData(ImportEntityData<VmTemplate> importEntityData) { VmTemplate vmTemplate = ((ImportTemplateData) importEntityData).getTemplate(); templateGeneralModel.setEntity(vmTemplate); generalView.setMainTabSelectedItem(vmTemplate); disksTable.setRowData((List) Arrays.asList(vmTemplate.getDiskTemplateMap().values().toArray())); nicsTable.setRowData((List) Arrays.asList(vmTemplate.getInterfaces().toArray())); } private void initGeneralForm() { DetailModelProvider<TemplateListModel, TemplateGeneralModel> modelProvider = new DetailModelProvider<TemplateListModel, TemplateGeneralModel>() { @Override public TemplateGeneralModel getModel() { return getTemplateGeneralModel(); } @Override public void onSubTabSelected() {} @Override public void onSubTabDeselected() {} }; generalView = new ImportTemplateGeneralSubTabView(modelProvider); } public TemplateGeneralModel getTemplateGeneralModel() { if (templateGeneralModel == null) { templateGeneralModel = new TemplateGeneralModel(); } return templateGeneralModel; } }
public class AbstractFindDcPopupView extends AbstractModelBoundPopupView<ListModel> { interface ViewUiBinder extends UiBinder<SimpleDialogPanel, AbstractFindDcPopupView> { ViewUiBinder uiBinder = GWT.create(ViewUiBinder.class); } @UiField(provided = true) EntityModelCellTable<ListModel> table; @UiField Label messageLabel; private static final ApplicationConstants constants = AssetProvider.getConstants(); public AbstractFindDcPopupView(EventBus eventBus, boolean multiSelection) { super(eventBus); table = new EntityModelCellTable<ListModel>(multiSelection); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); // Table Entity Columns table.addColumn( new AbstractEntityModelTextColumn<StoragePool>() { @Override public String getText(StoragePool storage) { return storage.getName(); } }, constants.nameDc()); table.addColumn( new AbstractEntityModelTextColumn<StoragePool>() { @Override protected String getText(StoragePool entity) { return entity.isLocal() ? constants.storageTypeLocal() : constants.storageTypeShared(); } }, constants.storgeTypeDc()); } @Override public void edit(ListModel object) { table.asEditor().edit(object); } @Override public void setMessage(String message) { super.setMessage(message); // Hide table in case of message if (message != null && message.length() > 0) { table.setVisible(false); } messageLabel.setText(message); } @Override public ListModel flush() { return table.asEditor().flush(); } }
public class GlusterHookSyncStatusColumn extends AbstractImageResourceColumn<GlusterHookEntity> { private static final ApplicationResources resources = AssetProvider.getResources(); @Override public ImageResource getValue(GlusterHookEntity hookEntity) { if (hookEntity.hasConflicts()) { return resources.alertImage(); } return null; } }
public class SubTabStorageDiskProfilePresenter extends AbstractSubTabStoragePresenter< DiskProfileListModel, SubTabStorageDiskProfilePresenter.ViewDef, SubTabStorageDiskProfilePresenter.ProxyDef> { private static final ApplicationConstants constants = AssetProvider.getConstants(); @ProxyCodeSplit @NameToken(WebAdminApplicationPlaces.storageDiskProfileSubTabPlace) public interface ProxyDef extends TabContentProxyPlace<SubTabStorageDiskProfilePresenter> {} public interface ViewDef extends AbstractSubTabPresenter.ViewDef<StorageDomain> { void addModelListeners(); } @TabInfo(container = StorageSubTabPanelPresenter.class) static TabData getTabData( SearchableDetailModelProvider<DiskProfile, StorageListModel, DiskProfileListModel> modelProvider) { return new ModelBoundTabData(constants.diskProfilesSubTabLabel(), 10, modelProvider); } @Inject public SubTabStorageDiskProfilePresenter( EventBus eventBus, ViewDef view, ProxyDef proxy, PlaceManager placeManager, StorageMainTabSelectedItems selectedItems, SearchableDetailModelProvider<DiskProfile, StorageListModel, DiskProfileListModel> modelProvider) { super( eventBus, view, proxy, placeManager, modelProvider, selectedItems, StorageSubTabPanelPresenter.TYPE_SetTabContent); } @Override public void initializeHandlers() { super.initializeHandlers(); getView().addModelListeners(); } }
public class MigrationProgressColumn extends AbstractOneColorPercentColumn<VM> { private EnumRenderer<VMStatus> renderer = new EnumRenderer<>(); private static final ApplicationMessages messages = AssetProvider.getMessages(); public MigrationProgressColumn() { super(AbstractProgressBarColumn.ProgressBarColors.GREEN); } @Override public Integer getProgressValue(VM object) { return object.getMigrationProgressPercent(); } public final SafeHtml getValue(VM vm) { if (!migrating(vm)) { return null; } return super.getValue(vm); } public boolean migrating(VM vm) { return vm.getStatus() == VMStatus.MigratingFrom; } @Override protected String getStyle() { return "engine-progress-box-migration"; //$NON-NLS-1$ } @Override protected String getProgressText(VM vm) { String percentText = super.getProgressText(vm); if (migrating(vm)) { return messages.migratingProgress(renderer.render(vm.getStatus()), percentText); } return percentText; } }
public class SubTabNetworkProfilePresenter extends AbstractSubTabNetworkPresenter< NetworkProfileListModel, SubTabNetworkProfilePresenter.ViewDef, SubTabNetworkProfilePresenter.ProxyDef> { private static final ApplicationConstants constants = AssetProvider.getConstants(); @ProxyCodeSplit @NameToken(WebAdminApplicationPlaces.networkProfileSubTabPlace) public interface ProxyDef extends TabContentProxyPlace<SubTabNetworkProfilePresenter> {} public interface ViewDef extends AbstractSubTabPresenter.ViewDef<NetworkView> {} @TabInfo(container = NetworkSubTabPanelPresenter.class) static TabData getTabData( SearchableDetailModelProvider<VnicProfileView, NetworkListModel, NetworkProfileListModel> modelProvider) { return new ModelBoundTabData(constants.vnicProfilesMainTabLabel(), 1, modelProvider); } @Inject public SubTabNetworkProfilePresenter( EventBus eventBus, ViewDef view, ProxyDef proxy, PlaceManager placeManager, NetworkMainTabSelectedItems selectedItems, SearchableDetailModelProvider<VnicProfileView, NetworkListModel, NetworkProfileListModel> modelProvider) { super( eventBus, view, proxy, placeManager, modelProvider, selectedItems, NetworkSubTabPanelPresenter.TYPE_SetTabContent); } }
public class SubTabDataCenterClusterPresenter extends AbstractSubTabDataCenterPresenter< DataCenterClusterListModel, SubTabDataCenterClusterPresenter.ViewDef, SubTabDataCenterClusterPresenter.ProxyDef> { private static final ApplicationConstants constants = AssetProvider.getConstants(); @ProxyCodeSplit @NameToken(WebAdminApplicationPlaces.dataCenterClusterSubTabPlace) public interface ProxyDef extends TabContentProxyPlace<SubTabDataCenterClusterPresenter> {} public interface ViewDef extends AbstractSubTabPresenter.ViewDef<StoragePool> {} @TabInfo(container = DataCenterSubTabPanelPresenter.class) static TabData getTabData( SearchableDetailModelProvider<Cluster, DataCenterListModel, DataCenterClusterListModel> modelProvider) { return new ModelBoundTabData(constants.dataCenterClusterSubTabLabel(), 3, modelProvider); } @Inject public SubTabDataCenterClusterPresenter( EventBus eventBus, ViewDef view, ProxyDef proxy, PlaceManager placeManager, DataCenterMainTabSelectedItems selectedItems, SearchableDetailModelProvider<Cluster, DataCenterListModel, DataCenterClusterListModel> modelProvider) { super( eventBus, view, proxy, placeManager, modelProvider, selectedItems, DataCenterSubTabPanelPresenter.TYPE_SetTabContent); } }
public class SubTabVirtualMachineEventPresenter extends AbstractSubTabVirtualMachinePresenter< VmEventListModel, SubTabVirtualMachineEventPresenter.ViewDef, SubTabVirtualMachineEventPresenter.ProxyDef> { private static final ApplicationConstants constants = AssetProvider.getConstants(); @ProxyCodeSplit @NameToken(WebAdminApplicationPlaces.virtualMachineEventSubTabPlace) public interface ProxyDef extends TabContentProxyPlace<SubTabVirtualMachineEventPresenter> {} public interface ViewDef extends AbstractSubTabPresenter.ViewDef<VM> {} @TabInfo(container = VirtualMachineSubTabPanelPresenter.class) static TabData getTabData( SearchableDetailModelProvider<AuditLog, VmListModel<Void>, VmEventListModel> modelProvider) { return new ModelBoundTabData( constants.virtualMachineEventSubTabLabel(), 10, modelProvider, Align.RIGHT); } @Inject public SubTabVirtualMachineEventPresenter( EventBus eventBus, ViewDef view, ProxyDef proxy, PlaceManager placeManager, VirtualMachineMainTabSelectedItems selectedItems, SearchableDetailModelProvider<AuditLog, VmListModel<Void>, VmEventListModel> modelProvider) { super( eventBus, view, proxy, placeManager, modelProvider, selectedItems, VirtualMachineSubTabPanelPresenter.TYPE_SetTabContent); } }
public class SubTabDataCenterQuotaView extends AbstractSubTabTableView< StoragePool, Quota, DataCenterListModel, DataCenterQuotaListModel> implements SubTabDataCenterQuotaPresenter.ViewDef { interface ViewIdHandler extends ElementIdHandler<SubTabDataCenterQuotaView> { ViewIdHandler idHandler = GWT.create(ViewIdHandler.class); } private static final ApplicationConstants constants = AssetProvider.getConstants(); @Inject public SubTabDataCenterQuotaView( SearchableDetailModelProvider<Quota, DataCenterListModel, DataCenterQuotaListModel> modelProvider) { super(modelProvider); initTable(); initWidget(getTable()); } @Override protected void generateIds() { ViewIdHandler.idHandler.generateAndSetIds(this); } void initTable() { getTable().enableColumnResizing(); QuotaDcStatusColumn dcStatusColumn = new QuotaDcStatusColumn(); dcStatusColumn.setContextMenuTitle(constants.dcStatusQuota()); getTable().addColumn(dcStatusColumn, constants.empty(), "30px"); // $NON-NLS-1$ AbstractTextColumn<Quota> nameColumn = new AbstractTextColumn<Quota>() { @Override public String getValue(Quota object) { return object.getQuotaName() == null ? "" : object.getQuotaName(); // $NON-NLS-1$ } }; nameColumn.makeSortable(); getTable().addColumn(nameColumn, constants.nameQuota(), "400px"); // $NON-NLS-1$ AbstractTextColumn<Quota> descriptionColumn = new AbstractTextColumn<Quota>() { @Override public String getValue(Quota object) { return object.getDescription() == null ? "" : object.getDescription(); // $NON-NLS-1$ } }; descriptionColumn.makeSortable(); getTable().addColumn(descriptionColumn, constants.descriptionQuota(), "400px"); // $NON-NLS-1$ getTable() .addActionButton( new WebAdminButtonDefinition<Quota>(constants.addQuota()) { @Override protected UICommand resolveCommand() { return getDetailModel().getCreateCommand(); } }); getTable() .addActionButton( new WebAdminButtonDefinition<Quota>(constants.editQuota()) { @Override protected UICommand resolveCommand() { return getDetailModel().getEditCommand(); } }); getTable() .addActionButton( new WebAdminButtonDefinition<Quota>(constants.copyQuota()) { @Override protected UICommand resolveCommand() { return getDetailModel().getCloneCommand(); } }); getTable() .addActionButton( new WebAdminButtonDefinition<Quota>(constants.removeQuota()) { @Override protected UICommand resolveCommand() { return getDetailModel().getRemoveCommand(); } }); } }
public class SubTabStorageIsoView extends AbstractSubTabTableView<StorageDomain, RepoImage, StorageListModel, StorageIsoListModel> implements SubTabStorageIsoPresenter.ViewDef { interface ViewIdHandler extends ElementIdHandler<SubTabStorageIsoView> { ViewIdHandler idHandler = GWT.create(ViewIdHandler.class); } private static final ApplicationConstants constants = AssetProvider.getConstants(); @Inject public SubTabStorageIsoView( SearchableDetailModelProvider<RepoImage, StorageListModel, StorageIsoListModel> modelProvider) { super(modelProvider); initTable(); initWidget(getTable()); } @Override protected void generateIds() { ViewIdHandler.idHandler.generateAndSetIds(this); } void initTable() { getTable().enableColumnResizing(); AbstractTextColumn<RepoImage> fileNameColumn = new AbstractTextColumn<RepoImage>() { @Override public String getValue(RepoImage object) { return object.getRepoImageTitle(); } }; fileNameColumn.makeSortable(); getTable().addColumn(fileNameColumn, constants.fileNameIso(), "500px"); // $NON-NLS-1$ AbstractTextColumn<RepoImage> typeColumn = new AbstractTextColumn<RepoImage>() { @Override public String getValue(RepoImage object) { return object.getFileType().toString(); } }; typeColumn.makeSortable(); getTable().addColumn(typeColumn, constants.typeIso(), "200px"); // $NON-NLS-1$ AbstractTextColumn<RepoImage> sizeColumn = new AbstractDiskSizeColumn<RepoImage>( SizeConverter.SizeUnit.BYTES, DiskSizeRenderer.Format.HUMAN_READABLE) { @Override protected Long getRawValue(RepoImage object) { return object.getSize(); } }; sizeColumn.makeSortable(); getTable().addColumn(sizeColumn, constants.actualSizeTemplate(), "100px"); // $NON-NLS-1$ getTable() .addActionButton( new WebAdminButtonDefinition<RepoImage>(constants.importImage()) { @Override protected UICommand resolveCommand() { return getDetailModel().getImportImagesCommand(); } }); getTable().showRefreshButton(); } }
public class SubTabHostGeneralHardwareView extends AbstractSubTabFormView<VDS, HostListModel<Void>, HostHardwareGeneralModel> implements SubTabHostGeneralHardwarePresenter.ViewDef, Editor<HostHardwareGeneralModel> { interface Driver extends UiCommonEditorDriver<HostHardwareGeneralModel, SubTabHostGeneralHardwareView> {} interface ViewIdHandler extends ElementIdHandler<SubTabHostGeneralHardwareView> { ViewIdHandler idHandler = GWT.create(ViewIdHandler.class); } private static final ApplicationConstants constants = AssetProvider.getConstants(); StringValueLabel hardwareManufacturer = new StringValueLabel(); StringValueLabel hardwareProductName = new StringValueLabel(); StringValueLabel hardwareSerialNumber = new StringValueLabel(); StringValueLabel hardwareVersion = new StringValueLabel(); StringValueLabel hardwareUUID = new StringValueLabel(); StringValueLabel hardwareFamily = new StringValueLabel(); StringValueLabel cpuType = new StringValueLabel(); StringValueLabel cpuModel = new StringValueLabel(); NullableNumberValueLabel<Integer> numberOfSockets = new NullableNumberValueLabel<>(constants.unknown()); StringValueLabel coresPerSocket = new StringValueLabel(); StringValueLabel threadsPerCore = new StringValueLabel(); @UiField(provided = true) GeneralFormPanel formPanel; @UiField FlowPanel hbaInventory; FormBuilder formBuilder; private final Driver driver = GWT.create(Driver.class); interface ViewUiBinder extends UiBinder<Widget, SubTabHostGeneralHardwareView> { ViewUiBinder uiBinder = GWT.create(ViewUiBinder.class); } @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); } @Override protected void generateIds() { ViewIdHandler.idHandler.generateAndSetIds(this); } @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); } } } }
public class EditQuotaClusterPopupView extends AbstractModelBoundPopupView<EditQuotaClusterModel> implements EditQuotaClusterPopupPresenterWidget.ViewDef { @UiField WidgetStyle style; @UiField(provided = true) @Path(value = "unlimitedMem.entity") @WithElementId EntityModelRadioButtonEditor unlimitedMemRadioButtonEditor; @UiField(provided = true) @Path(value = "specificMem.entity") @WithElementId EntityModelRadioButtonEditor specificMemRadioButtonEditor; @UiField @Path(value = "specificMemValue.entity") @WithElementId LongEntityModelTextBoxEditor memValueEditor; @UiField(provided = true) @Path(value = "unlimitedCpu.entity") @WithElementId EntityModelRadioButtonEditor unlimitedCpuRadioButtonEditor; @UiField(provided = true) @Path(value = "specificCpu.entity") @WithElementId EntityModelRadioButtonEditor specificCpuRadioButtonEditor; @UiField @Path(value = "specificCpuValue.entity") @WithElementId IntegerEntityModelTextBoxEditor cpuValueEditor; @UiField @Ignore Label memLabel; @UiField @Ignore Label cpuLabel; interface Driver extends SimpleBeanEditorDriver<EditQuotaClusterModel, EditQuotaClusterPopupView> {} interface ViewUiBinder extends UiBinder<SimpleDialogPanel, EditQuotaClusterPopupView> { ViewUiBinder uiBinder = GWT.create(ViewUiBinder.class); } interface ViewIdHandler extends ElementIdHandler<EditQuotaClusterPopupView> { ViewIdHandler idHandler = GWT.create(ViewIdHandler.class); } private final Driver driver = GWT.create(Driver.class); private static final ApplicationConstants constants = AssetProvider.getConstants(); @Inject public EditQuotaClusterPopupView(EventBus eventBus) { super(eventBus); initRadioButtonEditors(); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); ViewIdHandler.idHandler.generateAndSetIds(this); localize(); addStyles(); driver.initialize(this); } private void addStyles() { memValueEditor.addContentWidgetContainerStyleName(style.textBoxWidth()); memValueEditor.addLabelStyleName(style.labelVisible()); cpuValueEditor.addContentWidgetContainerStyleName(style.textBoxWidth()); cpuValueEditor.addLabelStyleName(style.labelVisible()); } private void initRadioButtonEditors() { unlimitedMemRadioButtonEditor = new EntityModelRadioButtonEditor("3"); // $NON-NLS-1$ specificMemRadioButtonEditor = new EntityModelRadioButtonEditor("3"); // $NON-NLS-1$ unlimitedCpuRadioButtonEditor = new EntityModelRadioButtonEditor("4"); // $NON-NLS-1$ specificCpuRadioButtonEditor = new EntityModelRadioButtonEditor("4"); // $NON-NLS-1$ } void localize() { unlimitedMemRadioButtonEditor.setLabel(constants.ultQuotaPopup()); specificMemRadioButtonEditor.setLabel(constants.useQuotaPopup()); unlimitedCpuRadioButtonEditor.setLabel(constants.ultQuotaPopup()); specificCpuRadioButtonEditor.setLabel(constants.useQuotaPopup()); memLabel.setText(constants.memQuotaPopup()); cpuLabel.setText(constants.cpuQuotaPopup()); } @Override public void edit(EditQuotaClusterModel object) { driver.edit(object); } @Override public EditQuotaClusterModel flush() { return driver.flush(); } interface WidgetStyle extends CssResource { String textBoxWidth(); String radioButtonWidth(); String labelVisible(); } }
/** * Presenter for the sub-sub tab (Hosts > General > Errata) that contains errata (singular: Erratum) * for the selected Host. */ public class SubTabHostGeneralHostErrataPresenter extends AbstractSubTabPresenter< VDS, HostListModel<Void>, HostErrataCountModel, SubTabHostGeneralHostErrataPresenter.ViewDef, SubTabHostGeneralHostErrataPresenter.ProxyDef> { private static final ApplicationConstants constants = AssetProvider.getConstants(); @ProxyCodeSplit @NameToken(WebAdminApplicationPlaces.hostGeneralErrataSubTabPlace) public interface ProxyDef extends TabContentProxyPlace<SubTabHostGeneralHostErrataPresenter> {} public interface ViewDef extends AbstractSubTabPresenter.ViewDef<VDS> { AbstractUiCommandButton getTotalSecurity(); AbstractUiCommandButton getTotalBugFix(); AbstractUiCommandButton getTotalEnhancement(); void showErrorMessage(SafeHtml errorMessage); void showCounts(ErrataCounts counts); void showProgress(); } @TabInfo(container = HostGeneralSubTabPanelPresenter.class) static TabData getTabData( DetailTabModelProvider<HostListModel<Void>, HostErrataCountModel> errataCountModelProvider) { return new ModelBoundTabData( constants.hostGeneralErrataSubTabLabel(), 7, errataCountModelProvider); } private final HostErrataCountModel errataCountModel; private VDS currentSelectedHost; @Inject public SubTabHostGeneralHostErrataPresenter( EventBus eventBus, ViewDef view, ProxyDef proxy, PlaceManager placeManager, DetailTabModelProvider<HostListModel<Void>, HostErrataCountModel> errataCountModelProvider) { super( eventBus, view, proxy, placeManager, errataCountModelProvider, HostGeneralSubTabPanelPresenter.TYPE_SetTabContent); errataCountModel = getModelProvider().getModel(); } @Override protected PlaceRequest getMainTabRequest() { return PlaceRequestFactory.get(WebAdminApplicationPlaces.hostMainTabPlace); } @ProxyEvent public void onHostSelectionChange(HostSelectionChangeEvent event) { updateMainTabSelection(event.getSelectedItems()); currentSelectedHost = event.getSelectedItems().isEmpty() ? null : event.getSelectedItems().get(0); if (isVisible()) { updateModel(); } } @Override protected void onReveal() { super.onReveal(); updateModel(); } /* (non-Javadoc) * @see org.ovirt.engine.ui.common.presenter.AbstractSubTabPresenter#initializeHandlers() */ @Override public void initializeHandlers() { super.initializeHandlers(); registerHandler( getView() .getTotalSecurity() .addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { getView().getTotalSecurity().getCommand().execute(); } })); registerHandler( getView() .getTotalBugFix() .addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { getView().getTotalBugFix().getCommand().execute(); } })); registerHandler( getView() .getTotalEnhancement() .addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { getView().getTotalEnhancement().getCommand().execute(); } })); // Handle the counts changing -> simple view update. // errataCountModel.addErrataCountsChangeListener( new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { // bus published message that the counts changed. update view. ErrataCounts counts = errataCountModel.getErrataCounts(); getView().showCounts(counts); } }); // Handle the count model getting a query error -> simple view update. // errataCountModel.addPropertyChangeListener( new IEventListener<PropertyChangedEventArgs>() { @Override public void eventRaised( Event<? extends PropertyChangedEventArgs> ev, Object sender, PropertyChangedEventArgs args) { if ("Message".equals(args.propertyName)) { // $NON-NLS-1$ if (errataCountModel.getMessage() != null && !errataCountModel.getMessage().isEmpty()) { // bus published message that an error occurred communicating with Katello. Show the // alert panel. getView().showErrorMessage(SafeHtmlUtils.fromString(errataCountModel.getMessage())); } } else if (PropertyChangedEventArgs.PROGRESS.equals(args.propertyName)) { if (errataCountModel.getProgress() != null) { getView().showProgress(); } } } }); } @Override protected void onBind() { super.onBind(); getView().getTotalSecurity().setCommand(errataCountModel.getShowSecurityCommand()); getView().getTotalBugFix().setCommand(errataCountModel.getShowBugsCommand()); getView().getTotalEnhancement().setCommand(errataCountModel.getShowEnhancementsCommand()); } private void updateModel() { if (currentSelectedHost != null) { errataCountModel.setGuid(currentSelectedHost.getId()); errataCountModel.setEntity(currentSelectedHost); errataCountModel.runQuery(currentSelectedHost.getId()); } } }
public class SubTabNetworkClusterView extends AbstractSubTabTableView< NetworkView, PairQueryable<Cluster, NetworkCluster>, NetworkListModel, NetworkClusterListModel> implements SubTabNetworkClusterPresenter.ViewDef { interface ViewIdHandler extends ElementIdHandler<SubTabNetworkClusterView> { ViewIdHandler idHandler = GWT.create(ViewIdHandler.class); } private final SafeHtml displayImage; private final SafeHtml migrationImage; private final SafeHtml glusterNwImage; private final SafeHtml emptyImage; private final SafeHtml managementImage; private static final ApplicationResources resources = AssetProvider.getResources(); private static final ApplicationConstants constants = AssetProvider.getConstants(); @Inject public SubTabNetworkClusterView( SearchableDetailModelProvider< PairQueryable<Cluster, NetworkCluster>, NetworkListModel, NetworkClusterListModel> modelProvider) { super(modelProvider); displayImage = SafeHtmlUtils.fromTrustedString( AbstractImagePrototype.create(resources.networkMonitor()).getHTML()); migrationImage = SafeHtmlUtils.fromTrustedString( AbstractImagePrototype.create(resources.migrationNetwork()).getHTML()); glusterNwImage = SafeHtmlUtils.fromTrustedString( AbstractImagePrototype.create(resources.glusterNetwork()).getHTML()); emptyImage = SafeHtmlUtils.fromTrustedString( AbstractImagePrototype.create(resources.networkEmpty()).getHTML()); managementImage = SafeHtmlUtils.fromTrustedString( AbstractImagePrototype.create(resources.mgmtNetwork()).getHTML()); initTable(); initWidget(getTable()); } @Override protected void generateIds() { ViewIdHandler.idHandler.generateAndSetIds(this); } void initTable() { getTable().enableColumnResizing(); AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>> nameColumn = new AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>>() { @Override public String getValue(PairQueryable<Cluster, NetworkCluster> object) { return object.getFirst().getName(); } }; nameColumn.makeSortable(); getTable().addColumn(nameColumn, constants.nameCluster(), "400px"); // $NON-NLS-1$ AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>> versionColumn = new AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>>() { @Override public String getValue(PairQueryable<Cluster, NetworkCluster> object) { return object.getFirst().getCompatibilityVersion().getValue(); } }; versionColumn.makeSortable(); getTable().addColumn(versionColumn, constants.comptVersCluster(), "130px"); // $NON-NLS-1$ AbstractCheckboxColumn<PairQueryable<Cluster, NetworkCluster>> attachedColumn = new AbstractCheckboxColumn<PairQueryable<Cluster, NetworkCluster>>(true) { @Override public Boolean getValue(PairQueryable<Cluster, NetworkCluster> object) { return object.getSecond() != null; } @Override protected boolean canEdit(PairQueryable<Cluster, NetworkCluster> object) { return false; } }; attachedColumn.makeSortable(); getTable() .addColumn(attachedColumn, constants.attachedNetworkCluster(), "120px"); // $NON-NLS-1$ NetworkClusterStatusColumn statusColumn = new NetworkClusterStatusColumn(); statusColumn.makeSortable(new SimpleStatusColumnComparator<>(statusColumn)); getTable().addColumn(statusColumn, constants.networkStatus(), "120px"); // $NON-NLS-1$ AbstractCheckboxColumn<PairQueryable<Cluster, NetworkCluster>> netRequiredColumn = new AbstractCheckboxColumn<PairQueryable<Cluster, NetworkCluster>>(true) { @Override public Boolean getValue(PairQueryable<Cluster, NetworkCluster> object) { if (object.getSecond() != null) { return object.getSecond().isRequired(); } return false; } @Override protected boolean canEdit(PairQueryable<Cluster, NetworkCluster> object) { return false; } }; netRequiredColumn.makeSortable(); getTable().addColumn(netRequiredColumn, constants.requiredNetCluster(), "120px"); // $NON-NLS-1$ AbstractSafeHtmlColumn<PairQueryable<Cluster, NetworkCluster>> netRoleColumn = new AbstractSafeHtmlColumn<PairQueryable<Cluster, NetworkCluster>>() { @Override public SafeHtml getValue(PairQueryable<Cluster, NetworkCluster> object) { List<SafeHtml> images = new LinkedList<>(); if (object.getSecond() != null) { if (object.getSecond().isManagement()) { images.add(managementImage); } else { images.add(emptyImage); } if (object.getSecond().isDisplay()) { images.add(displayImage); } else { images.add(emptyImage); } if (object.getSecond().isMigration()) { images.add(migrationImage); } else { images.add(emptyImage); } if (object.getSecond().isGluster()) { images.add(glusterNwImage); } else { images.add(emptyImage); } } return MultiImageColumnHelper.getValue(images); } @Override public SafeHtml getTooltip(PairQueryable<Cluster, NetworkCluster> object) { Map<SafeHtml, String> imagesToText = new LinkedHashMap<>(); if (object.getSecond() != null) { if (object.getSecond().isManagement()) { imagesToText.put(managementImage, constants.managementItemInfo()); } if (object.getSecond().isDisplay()) { imagesToText.put(displayImage, constants.displayItemInfo()); } if (object.getSecond().isMigration()) { imagesToText.put(migrationImage, constants.migrationItemInfo()); } if (object.getSecond().isGluster()) { imagesToText.put(glusterNwImage, constants.glusterNwItemInfo()); } } return MultiImageColumnHelper.getTooltip(imagesToText); } }; netRoleColumn.makeSortable( new Comparator<PairQueryable<Cluster, NetworkCluster>>() { private int calculateValue(NetworkCluster networkCluster) { int res = 0; if (networkCluster != null) { if (networkCluster.isManagement()) { res += 10; } if (networkCluster.isDisplay()) { res += 4; } if (networkCluster.isMigration()) { res += 2; } if (networkCluster.isGluster()) { res += 1; } } return res; } @Override public int compare( PairQueryable<Cluster, NetworkCluster> o1, PairQueryable<Cluster, NetworkCluster> o2) { return calculateValue(o1.getSecond()) - calculateValue(o2.getSecond()); } }); getTable().addColumn(netRoleColumn, constants.roleNetCluster(), "120px"); // $NON-NLS-1$ AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>> descriptionColumn = new AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>>() { @Override public String getValue(PairQueryable<Cluster, NetworkCluster> object) { return object.getFirst().getDescription(); } }; descriptionColumn.makeSortable(); getTable().addColumn(descriptionColumn, constants.descriptionCluster(), "400px"); // $NON-NLS-1$ getTable() .addActionButton( new WebAdminButtonDefinition<PairQueryable<Cluster, NetworkCluster>>( constants.assignUnassignNetwork()) { @Override protected UICommand resolveCommand() { return getDetailModel().getManageCommand(); } }); } }
public class SubTabClusterGeneralPresenter extends AbstractSubTabClusterPresenter< ClusterGeneralModel, SubTabClusterGeneralPresenter.ViewDef, SubTabClusterGeneralPresenter.ProxyDef> { private static final ApplicationConstants constants = AssetProvider.getConstants(); private static final ApplicationMessages messages = AssetProvider.getMessages(); @ProxyCodeSplit @NameToken(WebAdminApplicationPlaces.clusterGeneralSubTabPlace) public interface ProxyDef extends TabContentProxyPlace<SubTabClusterGeneralPresenter> {} public interface ViewDef extends AbstractSubTabPresenter.ViewDef<VDSGroup> { /** Clear all the alerts currently displayed in the alerts panel of the cluster. */ void clearAlerts(); /** * Displays a new alert in the alerts panel of the host. * * @param widget the widget used to display the alert, usually just a text label, but can also * be a text label with a link to an action embedded */ void addAlert(Widget widget); } @TabInfo(container = ClusterSubTabPanelPresenter.class) static TabData getTabData( DetailModelProvider<ClusterListModel<Void>, ClusterGeneralModel> modelProvider) { return new ModelBoundTabData(constants.clusterGeneralSubTabLabel(), 0, modelProvider); } @Inject public SubTabClusterGeneralPresenter( EventBus eventBus, ViewDef view, ProxyDef proxy, ClusterMainTabSelectedItems selectedItems, PlaceManager placeManager, DetailModelProvider<ClusterListModel<Void>, ClusterGeneralModel> modelProvider) { super( eventBus, view, proxy, placeManager, modelProvider, selectedItems, ClusterSubTabPanelPresenter.TYPE_SetTabContent); } @Override public void initializeHandlers() { super.initializeHandlers(); // Initialize the list of alerts: final ClusterGeneralModel model = getModelProvider().getModel(); updateAlerts(getView(), model); // Listen for changes in the properties of the model in order // to update the alerts panel: model .getPropertyChangedEvent() .addListener( new IEventListener<PropertyChangedEventArgs>() { @Override public void eventRaised( Event<? extends PropertyChangedEventArgs> ev, Object sender, PropertyChangedEventArgs args) { if (args.propertyName.contains("Alert")) { // $NON-NLS-1$ updateAlerts(getView(), model); } else if (args.propertyName.contains( "consoleAddressPartiallyOverridden")) { //$NON-NLS-1$ updateAlerts(getView(), model); } } }); } /** * Review the model and if there are alerts add them to the view. * * @param view the view where alerts should be added * @param model the model to review */ private void updateAlerts(final ViewDef view, final ClusterGeneralModel model) { // Clear all the alerts: view.clearAlerts(); // Review the alerts and add those that are active: if (model.getHasNewGlusterHostsAlert()) { addTextAndLinkAlert( view, messages.clusterHasNewGlusterHosts(), model.getImportNewGlusterHostsCommand(), model.getDetachNewGlusterHostsCommand()); } if (model.isConsoleAddressPartiallyOverridden()) { view.addAlert(new Label(constants.consolePartiallyOverridden())); } } /** * Create a widget containing text and a link that triggers the execution of a command. * * @param view the view where the alert should be added * @param text the text content of the alert * @param commands the command that should be executed when the link is clicked */ private void addTextAndLinkAlert( final ViewDef view, final String text, final UICommand... commands) { // Create a flow panel containing the text and the link: final FlowPanel alertPanel = new FlowPanel(); int start = 0; for (final UICommand command : commands) { // Find the open and close positions of the link within the message: final int openIndex = text.indexOf("<a>", start); // $NON-NLS-1$ final int closeIndex = text.indexOf("</a>", start); // $NON-NLS-1$ if (openIndex == -1 || closeIndex == -1 || closeIndex < openIndex) { break; } // Extract the text before, inside and after the tags: final String beforeText = text.substring(start, openIndex); final String betweenText = text.substring(openIndex + 3, closeIndex); start = closeIndex + 4; // Create the label for the text before the tag: final Label beforeLabel = new Label(beforeText); beforeLabel .getElement() .getStyle() .setProperty("display", "inline"); // $NON-NLS-1$ //$NON-NLS-2$ alertPanel.add(beforeLabel); // Create the anchor: final Anchor betweenAnchor = new Anchor(betweenText); betweenAnchor .getElement() .getStyle() .setProperty("display", "inline"); // $NON-NLS-1$ //$NON-NLS-2$ alertPanel.add(betweenAnchor); // Add a listener to the anchor so that the command is executed when // it is clicked: betweenAnchor.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { command.execute(); } }); } if (start < text.length()) { final String afterText = text.substring(start); // Create the label for the text after the tag: final Label afterLabel = new Label(afterText); afterLabel .getElement() .getStyle() .setProperty("display", "inline"); // $NON-NLS-1$ //$NON-NLS-2$ alertPanel.add(afterLabel); } if (start > 0) { // Add the alert to the view: view.addAlert(alertPanel); } } }
public class SubTabStorageVmBackupView extends AbstractSubTabTableView<StorageDomain, VM, StorageListModel, VmBackupModel> implements SubTabStorageVmBackupPresenter.ViewDef { interface ViewUiBinder extends UiBinder<Widget, SubTabStorageVmBackupView> { ViewUiBinder uiBinder = GWT.create(ViewUiBinder.class); } interface ViewIdHandler extends ElementIdHandler<SubTabStorageVmBackupView> { ViewIdHandler idHandler = GWT.create(ViewIdHandler.class); } private static final VmTemplateNameRenderer vmTemplateNameRenderer = new VmTemplateNameRenderer(); @UiField HorizontalPanel mainContainer; @UiField SimplePanel vmTableContainer; @UiField SimplePanel applicationsTableContainer; ActionCellTable<String> applicationsTable; private static final ApplicationConstants constants = AssetProvider.getConstants(); @Inject public SubTabStorageVmBackupView( SearchableDetailModelProvider<VM, StorageListModel, VmBackupModel> modelProvider) { super(modelProvider); initVmTable(); initApplicationsTable(); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); vmTableContainer.add(getTable()); applicationsTableContainer.add(applicationsTable); mainContainer.setCellWidth(vmTableContainer, "50%"); // $NON-NLS-1$ mainContainer.setCellWidth(applicationsTableContainer, "50%"); // $NON-NLS-1$ } @Override protected void generateIds() { ViewIdHandler.idHandler.generateAndSetIds(this); } void initVmTable() { getTable().enableColumnResizing(); AbstractTextColumn<VM> nameColumn = new AbstractTextColumn<VM>() { @Override public String getValue(VM object) { return object.getName(); } }; nameColumn.makeSortable(); getTable().addColumn(nameColumn, constants.nameVm(), "95px"); // $NON-NLS-1$ AbstractTextColumn<VM> templateColumn = new AbstractTextColumn<VM>() { @Override public String getValue(VM object) { return vmTemplateNameRenderer.render(object); } }; templateColumn.makeSortable(); getTable().addColumn(templateColumn, constants.templateVm(), "95px"); // $NON-NLS-1$ AbstractTextColumn<VM> originColumn = new AbstractEnumColumn<VM, OriginType>() { @Override protected OriginType getRawValue(VM object) { return object.getOrigin(); } }; originColumn.makeSortable(); getTable().addColumn(originColumn, constants.originVm(), "95px"); // $NON-NLS-1$ AbstractTextColumn<VM> memoryColumn = new AbstractTextColumn<VM>() { @Override public String getValue(VM object) { return String.valueOf(object.getVmMemSizeMb()) + " MB"; // $NON-NLS-1$ } }; memoryColumn.makeSortable(); getTable().addColumn(memoryColumn, constants.memoryVm(), "95px"); // $NON-NLS-1$ AbstractTextColumn<VM> cpuColumn = new AbstractTextColumn<VM>() { @Override public String getValue(VM object) { return String.valueOf(object.getNumOfCpus()); } }; cpuColumn.makeSortable(); getTable().addColumn(cpuColumn, constants.cpusVm(), "95px"); // $NON-NLS-1$ AbstractTextColumn<VM> archColumn = new AbstractTextColumn<VM>() { @Override public String getValue(VM object) { return String.valueOf(object.getClusterArch()); } }; archColumn.makeSortable(); getTable().addColumn(archColumn, constants.architectureVm(), "95px"); // $NON-NLS-1$ AbstractTextColumn<VM> diskColumn = new AbstractTextColumn<VM>() { @Override public String getValue(VM object) { return String.valueOf(object.getDiskMap().size()); } }; diskColumn.makeSortable(); getTable().addColumn(diskColumn, constants.disksVm(), "95px"); // $NON-NLS-1$ AbstractTextColumn<VM> creationDateColumn = new AbstractFullDateTimeColumn<VM>() { @Override protected Date getRawValue(VM object) { return object.getVmCreationDate(); } }; creationDateColumn.makeSortable( new Comparator<VM>() { @Override public int compare(VM vm1, VM vm2) { return vm1.getVmCreationDate().compareTo(vm2.getVmCreationDate()); } }); getTable().addColumn(creationDateColumn, constants.creationDateVm(), "95px"); // $NON-NLS-1$ AbstractTextColumn<VM> exportDateColumn = new AbstractFullDateTimeColumn<VM>() { @Override protected Date getRawValue(VM object) { return object.getExportDate(); } }; exportDateColumn.makeSortable( new Comparator<VM>() { @Override public int compare(VM vm1, VM vm2) { return vm1.getExportDate().compareTo(vm2.getExportDate()); } }); getTable().addColumn(exportDateColumn, constants.exportDateVm(), "95px"); // $NON-NLS-1$ getTable() .addActionButton( new WebAdminButtonDefinition<VM>(constants.restoreVm()) { @Override protected UICommand resolveCommand() { return getDetailModel().getRestoreCommand(); } }); getTable() .addActionButton( new WebAdminButtonDefinition<VM>(constants.removeVm()) { @Override protected UICommand resolveCommand() { return getDetailModel().getRemoveCommand(); } }); getTable().showRefreshButton(); } private void initApplicationsTable() { applicationsTable = new ActionCellTable<>( new AbstractDataProvider<String>() { @Override protected void onRangeChanged(HasData<String> display) {} }, GWT.<Resources>create(SubTableResources.class)); AbstractTextColumn<String> nameColumn = new AbstractTextColumn<String>() { @Override public String getValue(String object) { return object; } }; applicationsTable.addColumn(nameColumn, constants.installedAppsVm()); applicationsTable.setWidth("100%"); // $NON-NLS-1$ applicationsTable.setRowData(new ArrayList<String>()); getDetailModel() .getPropertyChangedEvent() .addListener( new IEventListener<EventArgs>() { @SuppressWarnings("unchecked") @Override public void eventRaised( Event<? extends EventArgs> ev, Object sender, EventArgs args) { if (getDetailModel().getAppListModel().getItems() != null) { applicationsTable.setRowData( Linq.toList(getDetailModel().getAppListModel().getItems())); } else { applicationsTable.setRowData(new ArrayList<String>()); } } }); } }
public class SharedMacPoolView extends Composite { private final PermissionModelProvider<MacPool, SharedMacPoolListModel> permissionModelProvider; private final SharedMacPoolModelProvider sharedMacPoolModelProvider; private final SimpleActionTable<MacPool> macPoolTable; private final PermissionListModelTable<PermissionListModel<MacPool>> authorizationTable; private final EventBus eventBus; private final ClientStorage clientStorage; private final MainTableHeaderlessResources headerlessResources; private final MainTableResources tableResources; private final SplitLayoutPanel rootPanel; private static final ApplicationResources resources = AssetProvider.getResources(); private static final ApplicationConstants constants = AssetProvider.getConstants(); @Inject public SharedMacPoolView( final SharedMacPoolModelProvider sharedMacPoolModelProvider, final PermissionModelProvider<MacPool, SharedMacPoolListModel> permissionModelProvider, final EventBus eventBus, final ClientStorage clientStorage, final MainTableHeaderlessResources headerlessResources, final MainTableResources tableResources) { this.sharedMacPoolModelProvider = sharedMacPoolModelProvider; this.permissionModelProvider = permissionModelProvider; this.eventBus = eventBus; this.clientStorage = clientStorage; this.headerlessResources = headerlessResources; this.tableResources = tableResources; macPoolTable = createMacPoolTable(); authorizationTable = new PermissionListModelTable<>(permissionModelProvider, eventBus, clientStorage); authorizationTable.initTable(); authorizationTable .getTable() .getSelectionModel() .addSelectionChangeHandler( new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { permissionModelProvider.setSelectedItems( authorizationTable.getTable().getSelectedItems()); } }); rootPanel = createRootPanel(); setupAuthorizationTableVisibility(false); initWidget(rootPanel); } private void setupAuthorizationTableVisibility(boolean visible) { rootPanel.clear(); if (visible) { rootPanel.addSouth(authorizationTable, 150); } rootPanel.add(macPoolTable); } private SplitLayoutPanel createRootPanel() { SplitLayoutPanel rootPanel = new SplitLayoutPanel(); rootPanel.setHeight("495px"); // $NON-NLS-1$ rootPanel.setWidth("100%"); // $NON-NLS-1$ return rootPanel; } private SimpleActionTable<MacPool> createMacPoolTable() { final SimpleActionTable<MacPool> macPoolTable = new SimpleActionTable<>( sharedMacPoolModelProvider, headerlessResources, tableResources, eventBus, clientStorage); macPoolTable.addColumn( new AbstractImageResourceColumn<MacPool>() { @Override public ImageResource getValue(MacPool macPool) { return macPool.isDefaultPool() ? resources.lockImage() : null; } }, constants.empty(), "20px"); //$NON-NLS-1$ macPoolTable.addColumn( new AbstractTextColumn<MacPool>() { @Override public String getValue(MacPool macPool) { return macPool.getName(); } }, constants.configureMacPoolNameColumn(), "100px"); //$NON-NLS-1$ macPoolTable.addColumn( new AbstractTextColumn<MacPool>() { @Override public String getValue(MacPool macPool) { return macPool.getDescription(); } }, constants.configureMacPoolDescriptionColumn(), "300px"); //$NON-NLS-1$ macPoolTable.addActionButton( new WebAdminButtonDefinition<MacPool>(constants.configureMacPoolAddButton()) { @Override protected UICommand resolveCommand() { return sharedMacPoolModelProvider.getModel().getNewCommand(); } }); macPoolTable.addActionButton( new WebAdminButtonDefinition<MacPool>(constants.configureMacPoolEditButton()) { @Override protected UICommand resolveCommand() { return sharedMacPoolModelProvider.getModel().getEditCommand(); } }); macPoolTable.addActionButton( new WebAdminButtonDefinition<MacPool>(constants.configureMacPoolRemoveButton()) { @Override protected UICommand resolveCommand() { return sharedMacPoolModelProvider.getModel().getRemoveCommand(); } }); macPoolTable .getSelectionModel() .addSelectionChangeHandler( new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { final List<MacPool> selectedItems = macPoolTable.getSelectedItems(); sharedMacPoolModelProvider.setSelectedItems(selectedItems); final PermissionListModel<MacPool> model = permissionModelProvider.getModel(); if (selectedItems.size() == 1) { model.setEntity(selectedItems.get(0)); setupAuthorizationTableVisibility(true); } else { model.setEntity(null); setupAuthorizationTableVisibility(false); } } }); return macPoolTable; } }