Search in sources :

Example 46 with UICommand

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

the class VncConsoleModel method connect.

@Override
protected void connect() {
    if (getEntity() == null || getEntity().getRunOnVds() == null) {
        return;
    }
    // $NON-NLS-1$
    getLogger().debug("VNC console info...");
    UICommand invokeConsoleCommand = new UICommand("invokeConsoleCommand", new // $NON-NLS-1$
    BaseCommandTarget() {

        @Override
        public void executeCommand(UICommand uiCommand) {
            invokeConsole();
        }
    });
    executeCommandWithConsoleSafenessWarning(invokeConsoleCommand);
}
Also used : UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 47 with UICommand

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

the class ClusterPopupPresenterWidget method init.

@Override
public void init(final ClusterModel model) {
    super.init(model);
    model.getPropertyChangedEvent().addListener((ev, sender, args) -> {
        String propName = args.propertyName;
        if ("AllowClusterWithVirtGlusterEnabled".equals(propName)) {
            // $NON-NLS-1$
            getView().allowClusterWithVirtGlusterEnabled(model.getAllowClusterWithVirtGlusterEnabled());
        }
    });
    String spiceProxyInConfig = (String) AsyncDataProvider.getInstance().getConfigValuePreConverted(ConfigValues.SpiceProxyDefault);
    String spiceProxyMessage = StringHelper.isNullOrEmpty(spiceProxyInConfig) ? messages.noSpiceProxyDefined() : spiceProxyInConfig;
    getView().setSpiceProxyOverrideExplanation(messages.consoleOverrideSpiceProxyMessage(messages.consoleOverrideDefinedInGlobalConfig(), spiceProxyMessage));
    getModel().getVersion().getSelectedItemChangedEvent().addListener((ev, sender, args) -> {
        final Version selectedVersion = getModel().getVersion().getSelectedItem();
        if (selectedVersion == null) {
            return;
        }
        if (AsyncDataProvider.getInstance().isMigrationPoliciesSupported(selectedVersion)) {
            getView().getMigrationBandwidthLimitTypeEditor().setEnabled(true);
            updateCustomMigrationBandwidthLimitEnabledState(model, null);
        } else {
            final String supportedVersions = String.join(", ", // $NON-NLS-1$
            AsyncDataProvider.getInstance().getMigrationPoliciesSupportedVersions());
            final String message = messages.onlyAvailableInCompatibilityVersions(supportedVersions);
            getView().getMigrationBandwidthLimitTypeEditor().disable(message);
            getView().getMigrationBandwidthLimitTypeEditor().setEnabled(false);
            updateCustomMigrationBandwidthLimitEnabledState(model, message);
        }
    });
    getModel().getMigrationBandwidthLimitType().getSelectedItemChangedEvent().addListener((ev, sender, args) -> updateCustomMigrationBandwidthLimitEnabledState(model, null));
    model.getMacPoolModel().getEntityChangedEvent().addListener((ev, sender, args) -> getView().updateMacPool(model.getMacPoolModel()));
    final UICommand addMacPoolCommand = model.getAddMacPoolCommand();
    if (addMacPoolCommand == null) {
        getView().makeMacPoolButtonInvisible();
    } else {
        getView().getMacPoolButton().setCommand(addMacPoolCommand);
        registerHandler(getView().getMacPoolButton().addClickHandler(event -> getView().getMacPoolButton().getCommand().execute(model)));
    }
}
Also used : ClusterModel(org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterModel) AbstractTabbedModelBoundPopupPresenterWidget(org.ovirt.engine.ui.common.presenter.AbstractTabbedModelBoundPopupPresenterWidget) MacPoolModel(org.ovirt.engine.ui.uicommonweb.models.macpool.MacPoolModel) EventBus(com.google.gwt.event.shared.EventBus) AssetProvider(org.ovirt.engine.ui.webadmin.gin.AssetProvider) HasUiCommandClickHandlers(org.ovirt.engine.ui.common.widget.HasUiCommandClickHandlers) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) Inject(com.google.inject.Inject) MigrationBandwidthLimitType(org.ovirt.engine.core.common.businessentities.MigrationBandwidthLimitType) ApplicationMessages(org.ovirt.engine.ui.webadmin.ApplicationMessages) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) StringHelper(org.ovirt.engine.core.compat.StringHelper) Optional(java.util.Optional) HasEnabledWithHints(org.ovirt.engine.ui.common.widget.HasEnabledWithHints) Version(org.ovirt.engine.core.compat.Version) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) Version(org.ovirt.engine.core.compat.Version) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 48 with UICommand

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

the class GuidePopupView method updateActionsPanels.

private void updateActionsPanels(GuideModel<?> object) {
    compulsoryActionsPanel.clear();
    optionalActionsPanel.clear();
    for (final UICommand command : object.getCompulsoryActions()) {
        addButton(command, compulsoryActionsPanel, IconType.WRENCH);
    }
    for (final UICommand command : object.getOptionalActions()) {
        addButton(command, optionalActionsPanel, IconType.PLUS);
    }
}
Also used : UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 49 with UICommand

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

the class SplitTable method addClickHandler.

private void addClickHandler(final boolean excludedTableIsSource) {
    getButton(excludedTableIsSource).addClickHandler(event -> {
        MultiSelectionModel<T> sourceSelectionModel = getSelectionModel(excludedTableIsSource);
        UICommand command = excludedTableIsSource ? onIncludeButtonPressed : onExcludeButtonPressed;
        if (command != null) {
            command.execute();
        }
        Set<T> selectedItems = sourceSelectionModel.getSelectedSet();
        if (excludedTableIsSource) {
            includeItems(selectedItems, true);
        } else {
            excludeItems(selectedItems, true);
        }
    });
}
Also used : UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 50 with UICommand

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

the class HostListModel method addInstallCommands.

private void addInstallCommands(InstallModel model, VDS host, boolean isOnlyClose) {
    if (!isOnlyClose) {
        // $NON-NLS-1$
        UICommand command = UICommand.createDefaultOkUiCommand("OnInstall", this);
        model.getCommands().add(command);
    }
    model.getUserName().setEntity(host.getSshUsername());
    // $NON-NLS-1$
    UICommand command = new UICommand("Cancel", this);
    command.setTitle(isOnlyClose ? ConstantsManager.getInstance().getConstants().close() : ConstantsManager.getInstance().getConstants().cancel());
    command.setIsCancel(true);
    model.getCommands().add(command);
}
Also used : 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