Search in sources :

Example 1 with UICommand

use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.

the class AbstractModelBoundPopupPresenterWidget method addFooterButtons.

void addFooterButtons(T model) {
    for (int i = model.getCommands().size() - 1; i >= 0; i--) {
        UICommand command = model.getCommands().get(i);
        final HasUiCommandClickHandlers button = getView().addFooterButton(command.getTitle(), command.getName(), model.getDefaultCommand() != null && model.getDefaultCommand().equals(command));
        button.setCommand(command);
        // Register command execution handler
        registerHandler(button.addClickHandler(event -> {
            getView().flush();
            beforeCommandExecuted(button.getCommand());
            button.getCommand().execute();
        }));
    }
}
Also used : ModelBoundPopupHandler(org.ovirt.engine.ui.common.uicommon.model.ModelBoundPopupHandler) WebUtils(org.ovirt.engine.ui.common.utils.WebUtils) ModelBoundPopupResolver(org.ovirt.engine.ui.common.uicommon.model.ModelBoundPopupResolver) EventBus(com.google.gwt.event.shared.EventBus) HasEditorDriver(org.ovirt.engine.ui.common.widget.HasEditorDriver) HasUiCommandClickHandlers(org.ovirt.engine.ui.common.widget.HasUiCommandClickHandlers) AsyncOperationCompleteEvent(org.ovirt.engine.ui.frontend.communication.AsyncOperationCompleteEvent) AsyncOperationStartedEvent(org.ovirt.engine.ui.frontend.communication.AsyncOperationStartedEvent) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) ContextSensitiveHelpManager(org.ovirt.engine.ui.common.uicommon.ContextSensitiveHelpManager) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) List(java.util.List) Provider(com.google.inject.Provider) HasCleanup(org.ovirt.engine.ui.uicommonweb.HasCleanup) DeferredModelCommandInvoker(org.ovirt.engine.ui.common.uicommon.model.DeferredModelCommandInvoker) DefaultConfirmationPopupPresenterWidget(org.ovirt.engine.ui.common.presenter.popup.DefaultConfirmationPopupPresenterWidget) ObservableCollection(org.ovirt.engine.ui.uicompat.ObservableCollection) Model(org.ovirt.engine.ui.uicommonweb.models.Model) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) HasUiCommandClickHandlers(org.ovirt.engine.ui.common.widget.HasUiCommandClickHandlers)

Example 2 with UICommand

use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.

the class ClusterGeneralModel method fetchAndImportNewGlusterHosts.

public void fetchAndImportNewGlusterHosts() {
    if (getWindow() != null) {
        return;
    }
    final MultipleHostsModel hostsModel = new MultipleHostsModel();
    setWindow(hostsModel);
    hostsModel.setTitle(ConstantsManager.getInstance().getConstants().addMultipleHostsTitle());
    hostsModel.setHelpTag(HelpTag.add_hosts);
    // $NON-NLS-1$
    hostsModel.setHashName("add_hosts");
    // $NON-NLS-1$
    UICommand command = UICommand.createOkUiCommand("OnSaveHosts", this);
    hostsModel.getCommands().add(command);
    hostsModel.getHosts().setItems(new ArrayList<EntityModel<HostDetailModel>>());
    // $NON-NLS-1$
    hostsModel.getCommands().add(UICommand.createCancelUiCommand("Cancel", this));
    hostsModel.startProgress();
    AsyncDataProvider.getInstance().getGlusterHostsNewlyAdded(new AsyncQuery<>(hostMap -> {
        if (hostMap == null || hostMap.isEmpty()) {
            hostsModel.setMessage(ConstantsManager.getInstance().getConstants().emptyNewGlusterHosts());
        } else {
            ArrayList<EntityModel<HostDetailModel>> list = new ArrayList<>();
            for (Map.Entry<String, String> host : hostMap.entrySet()) {
                HostDetailModel hostModel = new HostDetailModel(host.getKey(), host.getValue());
                hostModel.setName(host.getKey());
                // $NON-NLS-1$
                hostModel.setPassword("");
                EntityModel<HostDetailModel> entityModel = new EntityModel<>(hostModel);
                list.add(entityModel);
            }
            hostsModel.getHosts().setItems(list);
        }
        hostsModel.stopProgress();
    }), getEntity().getId(), true);
}
Also used : QueryType(org.ovirt.engine.core.common.queries.QueryType) Guid(org.ovirt.engine.core.compat.Guid) ServiceType(org.ovirt.engine.core.common.businessentities.gluster.ServiceType) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) HostDetailModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostDetailModel) HashMap(java.util.HashMap) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) RemoveGlusterServerParameters(org.ovirt.engine.core.common.action.gluster.RemoveGlusterServerParameters) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) GlusterServiceParameters(org.ovirt.engine.core.common.action.gluster.GlusterServiceParameters) MultipleHostsModel(org.ovirt.engine.ui.uicommonweb.models.hosts.MultipleHostsModel) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) DetachGlusterHostsModel(org.ovirt.engine.ui.uicommonweb.models.gluster.DetachGlusterHostsModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) Objects(java.util.Objects) GlusterStatus(org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus) List(java.util.List) MigrateOnErrorOptions(org.ovirt.engine.core.common.businessentities.MigrateOnErrorOptions) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) VDS(org.ovirt.engine.core.common.businessentities.VDS) GlusterServerService(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService) AddVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters) GlusterServiceStatus(org.ovirt.engine.core.common.businessentities.gluster.GlusterServiceStatus) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) MultipleHostsModel(org.ovirt.engine.ui.uicommonweb.models.hosts.MultipleHostsModel) HostDetailModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostDetailModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ArrayList(java.util.ArrayList) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 3 with UICommand

use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.

the class ClusterGlusterHookListModel method viewHook.

private void viewHook() {
    if (getWindow() != null) {
        return;
    }
    GlusterHookEntity hookEntity = getSelectedItem();
    if (hookEntity == null) {
        return;
    }
    final GlusterHookContentModel contentModel = new GlusterHookContentModel();
    contentModel.setTitle(ConstantsManager.getInstance().getConstants().viewContentGlusterHookTitle());
    contentModel.setHelpTag(HelpTag.view_gluster_hook);
    // $NON-NLS-1$
    contentModel.setHashName("view_gluster_hook");
    setWindow(contentModel);
    contentModel.startProgress();
    AsyncDataProvider.getInstance().getGlusterHookContent(new AsyncQuery<>(content -> {
        contentModel.getContent().setEntity(content);
        if (content == null) {
            contentModel.getContent().setIsAvailable(false);
            contentModel.setMessage(ConstantsManager.getInstance().getConstants().viewContentErrorGlusterHook());
        } else if (content.length() == 0) {
            contentModel.getContent().setIsAvailable(false);
            contentModel.setMessage(ConstantsManager.getInstance().getConstants().viewContentEmptyGlusterHook());
        }
        contentModel.stopProgress();
    }), hookEntity.getId(), null);
    // $NON-NLS-1$
    UICommand command = new UICommand("Cancel", this);
    command.setTitle(ConstantsManager.getInstance().getConstants().close());
    command.setIsCancel(true);
    contentModel.getCommands().add(command);
}
Also used : GlusterHookManageParameters(org.ovirt.engine.core.common.action.gluster.GlusterHookManageParameters) GlusterHookEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity) GlusterHookStatus(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookStatus) Guid(org.ovirt.engine.core.compat.Guid) GlusterHookContentType(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookContentType) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) IFrontendActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) GlusterServerHook(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) List(java.util.List) GlusterHookParameters(org.ovirt.engine.core.common.action.gluster.GlusterHookParameters) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) GlusterClusterParameters(org.ovirt.engine.core.common.action.gluster.GlusterClusterParameters) GlusterHookEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 4 with UICommand

use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.

the class ClusterGlusterHookListModel method disableHook.

private void disableHook() {
    if (getWindow() != null) {
        return;
    }
    if (getSelectedItems() == null || getSelectedItems().size() == 0) {
        return;
    }
    ConfirmationModel model = new ConfirmationModel();
    setConfirmWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().confirmDisableGlusterHooks());
    model.setHelpTag(HelpTag.disable_hooks);
    // $NON-NLS-1$
    model.setHashName("disable_hooks");
    model.setMessage(ConstantsManager.getInstance().getConstants().disableGlusterHooksMessage());
    ArrayList<String> list = new ArrayList<>();
    for (GlusterHookEntity hook : getSelectedItems()) {
        list.add(hook.getName());
    }
    model.setItems(list);
    // $NON-NLS-1$
    UICommand okCommand = UICommand.createDefaultOkUiCommand("OnDisableHook", this);
    model.getCommands().add(okCommand);
    // $NON-NLS-1$
    UICommand cancelCommand = UICommand.createCancelUiCommand("OnCancelConfirmation", this);
    model.getCommands().add(cancelCommand);
}
Also used : GlusterHookEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity) ArrayList(java.util.ArrayList) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 5 with UICommand

use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.

the class ClusterGuideModel method displayAddDataCenter.

private void displayAddDataCenter(List<EntityModel<StoragePool>> dataCenters) {
    ListModel<EntityModel<StoragePool>> dataCentersModel = new ListModel<>();
    dataCentersModel.setItems(dataCenters);
    dataCentersModel.setTitle(addDataCenterTitle);
    // $NON-NLS-1$
    dataCentersModel.setHashName("add_datacenter");
    setWindow(dataCentersModel);
    UICommand tempVar = UICommand.createDefaultOkUiCommand(ON_ADD_DATACENTER, ClusterGuideModel.this);
    dataCentersModel.getCommands().add(tempVar);
    UICommand tempVar2 = UICommand.createCancelUiCommand(CANCEL, ClusterGuideModel.this);
    dataCentersModel.getCommands().add(tempVar2);
}
Also used : ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Aggregations

UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)257 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)134 ArrayList (java.util.ArrayList)105 List (java.util.List)49 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)49 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)49 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)48 ActionType (org.ovirt.engine.core.common.action.ActionType)47 Frontend (org.ovirt.engine.ui.frontend.Frontend)47 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)44 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)41 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)36 Guid (org.ovirt.engine.core.compat.Guid)36 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)33 QueryType (org.ovirt.engine.core.common.queries.QueryType)33 VDS (org.ovirt.engine.core.common.businessentities.VDS)30 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)29 Linq (org.ovirt.engine.ui.uicommonweb.Linq)28 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)26 ApplicationMode (org.ovirt.engine.core.common.mode.ApplicationMode)24