Search in sources :

Example 1 with EventArgs

use of org.ovirt.engine.ui.uicompat.EventArgs in project ovirt-engine by oVirt.

the class RoleListModel method eventRaised.

@Override
public void eventRaised(Event ev, Object sender, EventArgs args) {
    super.eventRaised(ev, sender, args);
    if (getWindow() != null && sender == ((RoleModel) getWindow()).getIsAdminRole()) {
        if (commandType == CommandType.New) {
            List<ActionGroup> selectedActionGroups = new ArrayList<>();
            selectedActionGroups.add(ActionGroup.LOGIN);
            setAttachedActionGroups(selectedActionGroups);
        } else {
            Role role = getSelectedItem();
            Frontend.getInstance().runQuery(QueryType.GetRoleActionGroupsByRoleId, new IdQueryParameters(role.getId()), new AsyncQuery<QueryReturnValue>(returnValue -> {
                publicAttachedActions = returnValue.getReturnValue();
                setAttachedActionGroups(publicAttachedActions);
            }));
        }
    }
}
Also used : Role(org.ovirt.engine.core.common.businessentities.Role) QueryType(org.ovirt.engine.core.common.queries.QueryType) Inject(com.google.inject.Inject) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) Event(org.ovirt.engine.ui.uicompat.Event) HashMap(java.util.HashMap) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) SelectionTreeNodeModel(org.ovirt.engine.ui.uicommonweb.models.common.SelectionTreeNodeModel) RoleWithActionGroupsParameters(org.ovirt.engine.core.common.action.RoleWithActionGroupsParameters) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) HasEntity(org.ovirt.engine.ui.uicommonweb.models.HasEntity) ApplicationGuids(org.ovirt.engine.ui.uicommonweb.auth.ApplicationGuids) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) NameableComparator(org.ovirt.engine.core.common.businessentities.comparators.NameableComparator) ActionGroupsToRoleParameter(org.ovirt.engine.core.common.action.ActionGroupsToRoleParameter) RolesOperationsParameters(org.ovirt.engine.core.common.action.RolesOperationsParameters) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) RoleType(org.ovirt.engine.core.common.businessentities.RoleType) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) RolesParameterBase(org.ovirt.engine.core.common.action.RolesParameterBase) List(java.util.List) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) ActionGroup(org.ovirt.engine.core.common.businessentities.ActionGroup) Role(org.ovirt.engine.core.common.businessentities.Role) Collections(java.util.Collections) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ActionGroup(org.ovirt.engine.core.common.businessentities.ActionGroup) ArrayList(java.util.ArrayList)

Example 2 with EventArgs

use of org.ovirt.engine.ui.uicompat.EventArgs in project ovirt-engine by oVirt.

the class HeaderPresenterWidget method onBind.

@SuppressWarnings("unchecked")
@Override
protected void onBind() {
    super.onBind();
    registerHandler(getView().getLogoutLink().addClickHandler(event -> user.logout()));
    registerHandler(getView().getGuideLink().addClickHandler(event -> WebUtils.openUrlInNewWindow(windowName, guideUrl)));
    registerHandler(getView().getOptionsLink().addClickHandler(event -> {
        OptionsModel model = optionsProvider.getModel();
        model.executeCommand(model.getEditCommand());
    }));
    registerHandler(getView().getAboutLink().addClickHandler(event -> RevealRootPopupContentEvent.fire(HeaderPresenterWidget.this, aboutPopupProvider.get())));
    registerHandler(getView().getTasksWidget().addClickHandler(event -> toggleOverlayPresenter(tasksPresenter)));
    registerHandler(getView().getBookmarkLink().addClickHandler(event -> toggleOverlayPresenter(bookmarksPresenter)));
    registerHandler(getView().getTagsLink().addClickHandler(event -> toggleOverlayPresenter(tagsPresenter)));
    getView().getAlertActionWidget().addAction(constants.dismissAlert(), this.alertModelProvider.getModel().getDismissCommand(), (command, log) -> {
        AlertListModel model = alertModelProvider.getModel();
        if (log != null) {
            model.setSelectedItem(log);
            model.executeCommand(command);
        }
    });
    getView().getAlertActionWidget().addClearAllAction(constants.clearAllDismissedAlerts(), this.alertModelProvider.getModel().getClearAllCommand(), (command, log) -> alertModelProvider.getModel().executeCommand(command));
    getView().getAlertActionWidget().addRestoreAllAction(constants.displayAllDismissedAlerts(), this.alertModelProvider.getModel().getDisplayAllCommand(), (command, log) -> alertModelProvider.getModel().executeCommand(command));
    getView().getEventActionWidget().addAction(constants.dismissEvent(), this.eventModelProvider.getModel().getDismissCommand(), (command, log) -> {
        EventListModel<?> model = eventModelProvider.getModel();
        if (log != null) {
            model.setSelectedItem(log);
            model.executeCommand(command);
        }
    });
    getView().getEventActionWidget().addClearAllAction(constants.clearAllDismissedEvents(), this.eventModelProvider.getModel().getClearAllCommand(), (command, log) -> eventModelProvider.getModel().executeCommand(command));
    getView().getEventActionWidget().addRestoreAllAction(constants.displayAllDismissedEvents(), this.eventModelProvider.getModel().getDisplayAllCommand(), (command, log) -> eventModelProvider.getModel().executeCommand(command));
    taskModelProvider.getModel().getItemsChangedEvent().addListener(new IEventListener<EventArgs>() {

        @Override
        public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) {
            Collection<Job> jobs = taskModelProvider.getModel().getItems();
            long count = jobs.stream().filter(job -> JobExecutionStatus.STARTED.equals(job.getStatus())).count();
            // I know I will never have more than 100 items, so I can cast to int.
            getView().setRunningTaskCount((int) count);
        }
    });
    alertModelProvider.getModel().getItemsChangedEvent().addListener(new IEventListener<EventArgs>() {

        @Override
        public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) {
            Collection<AuditLog> alerts = alertModelProvider.getModel().getItems();
            long count = alerts.stream().filter(alert -> AuditLogSeverity.ALERT.equals(alert.getSeverity())).count();
            // I know I will never have more than 100 items, so I can cast to int.
            getView().setAlertCount((int) count);
        }
    });
}
Also used : RevealRootPopupContentEvent(com.gwtplatform.mvp.client.proxy.RevealRootPopupContentEvent) AssetProvider(org.ovirt.engine.ui.webadmin.gin.AssetProvider) Job(org.ovirt.engine.core.common.job.Job) Inject(com.google.inject.Inject) IEventListener(org.ovirt.engine.ui.uicompat.IEventListener) Event(org.ovirt.engine.ui.uicompat.Event) EventModelProvider(org.ovirt.engine.ui.webadmin.uicommon.model.EventModelProvider) EventListModel(org.ovirt.engine.ui.uicommonweb.models.events.EventListModel) AlertModelProvider(org.ovirt.engine.ui.webadmin.uicommon.model.AlertModelProvider) ActionWidget(org.ovirt.engine.ui.webadmin.widget.alert.ActionWidget) ApplicationConstants(org.ovirt.engine.ui.webadmin.ApplicationConstants) BookmarkPresenterWidget(org.ovirt.engine.ui.webadmin.section.main.presenter.overlay.BookmarkPresenterWidget) OptionsModel(org.ovirt.engine.ui.uicommonweb.models.OptionsModel) TagsPresenterWidget(org.ovirt.engine.ui.webadmin.section.main.presenter.overlay.TagsPresenterWidget) AlertListModel(org.ovirt.engine.ui.uicommonweb.models.events.AlertListModel) PresenterWidget(com.gwtplatform.mvp.client.PresenterWidget) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) TasksPresenterWidget(org.ovirt.engine.ui.webadmin.section.main.presenter.overlay.TasksPresenterWidget) CurrentUser(org.ovirt.engine.ui.common.auth.CurrentUser) SafeHtmlUtils(com.google.gwt.safehtml.shared.SafeHtmlUtils) WebUtils(org.ovirt.engine.ui.common.utils.WebUtils) JobExecutionStatus(org.ovirt.engine.core.common.job.JobExecutionStatus) HasData(com.google.gwt.view.client.HasData) EventBus(com.google.gwt.event.shared.EventBus) View(com.gwtplatform.mvp.client.View) Collection(java.util.Collection) OptionsProvider(org.ovirt.engine.ui.common.uicommon.model.OptionsProvider) AuditLog(org.ovirt.engine.core.common.businessentities.AuditLog) HasClickHandlers(com.google.gwt.event.dom.client.HasClickHandlers) Provider(com.google.inject.Provider) TaskModelProvider(org.ovirt.engine.ui.webadmin.uicommon.model.TaskModelProvider) AuditLogSeverity(org.ovirt.engine.core.common.AuditLogSeverity) ApplicationDynamicMessages(org.ovirt.engine.ui.webadmin.ApplicationDynamicMessages) Named(com.google.inject.name.Named) AlertListModel(org.ovirt.engine.ui.uicommonweb.models.events.AlertListModel) Collection(java.util.Collection) OptionsModel(org.ovirt.engine.ui.uicommonweb.models.OptionsModel) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs)

Example 3 with EventArgs

use of org.ovirt.engine.ui.uicompat.EventArgs in project ovirt-engine by oVirt.

the class TasksPresenterWidget method onBind.

@SuppressWarnings("unchecked")
@Override
public void onBind() {
    super.onBind();
    taskModelProvider.getModel().getItemsChangedEvent().addListener(new IEventListener<EventArgs>() {

        @Override
        public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) {
            getView().updateTaskStatus(taskModelProvider.getModel());
            Collection<Job> jobs = taskModelProvider.getModel().getItems();
            jobs.forEach(job -> {
                String id = job.getCorrelationId().startsWith(TaskListModel.WEBADMIN) ? job.getCorrelationId() : job.getId().toString();
                if (JobExecutionStatus.STARTED.equals(job.getStatus())) {
                    // Since its a set, it will be replaced when its a duplicate.
                    runningTasks.add(id);
                } else if (JobExecutionStatus.FINISHED.equals(job.getStatus()) || JobExecutionStatus.FAILED.equals(job.getStatus()) || JobExecutionStatus.ABORTED.equals(job.getStatus())) {
                    if (runningTasks.contains(id) || (ACTION_TYPE_WHITELIST.contains(job.getActionType()) && job.getEndTime().after(lastNotificationDate))) {
                        ToastNotification notification = ToastNotification.createNotification(// $NON-NLS-1$
                        getPrefixText(job.getStatus()) + " " + job.getDescription());
                        notification.setStatus(getNotificationStatus(job.getStatus()));
                    }
                    runningTasks.remove(id);
                }
                lastNotificationDate = new Date();
            });
        }
    });
}
Also used : JobExecutionStatus(org.ovirt.engine.core.common.job.JobExecutionStatus) Arrays(java.util.Arrays) EnumTranslator(org.ovirt.engine.ui.uicompat.EnumTranslator) AbstractOverlayPresenterWidget(org.ovirt.engine.ui.webadmin.section.main.presenter.AbstractOverlayPresenterWidget) Date(java.util.Date) Job(org.ovirt.engine.core.common.job.Job) Collection(java.util.Collection) Inject(com.google.inject.Inject) ToastNotification(org.ovirt.engine.ui.common.widget.uicommon.tasks.ToastNotification) IEventListener(org.ovirt.engine.ui.uicompat.IEventListener) Set(java.util.Set) Event(org.ovirt.engine.ui.uicompat.Event) NotificationStatus(org.ovirt.engine.ui.common.widget.uicommon.tasks.ToastNotification.NotificationStatus) EventBus(com.google.web.bindery.event.shared.EventBus) TaskListModel(org.ovirt.engine.ui.uicommonweb.models.events.TaskListModel) HashSet(java.util.HashSet) ActionType(org.ovirt.engine.core.common.action.ActionType) List(java.util.List) TaskModelProvider(org.ovirt.engine.ui.webadmin.uicommon.model.TaskModelProvider) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) Collections(java.util.Collections) ToastNotification(org.ovirt.engine.ui.common.widget.uicommon.tasks.ToastNotification) Collection(java.util.Collection) Date(java.util.Date) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs)

Example 4 with EventArgs

use of org.ovirt.engine.ui.uicompat.EventArgs in project ovirt-engine by oVirt.

the class HostPopupView method edit.

@Override
public void edit(final HostModel object) {
    driver.edit(object);
    setTabIndexes(0);
    object.getFetchResult().getEntityChangedEvent().addListener((ev, sender, args) -> {
        String fetchResultText = object.getFetchResult().getEntity();
        if (ConstantsManager.getInstance().getConstants().errorLoadingFingerprint().equals(fetchResultText)) {
            fetchResult.addStyleName(style.fetchResultErrorLabel());
        } else {
            fetchResult.removeStyleName(style.fetchResultErrorLabel());
        }
        fetchResult.setText(fetchResultText);
    });
    object.getPkSection().getPropertyChangedEvent().addListener((ev, sender, args) -> {
        if ("IsAvailable".equals(args.propertyName)) {
            // $NON-NLS-1$
            setPkPasswordSectionVisiblity(false);
        }
    });
    object.getProviders().getSelectedItemChangedEvent().addListener((ev, sender, args) -> object.updateHosts());
    object.getExternalHostProviderEnabled().getEntityChangedEvent().addListener((ev, sender, args) -> {
        boolean showForemanProviders = object.getExternalHostProviderEnabled().getEntity();
        boolean doProvisioning = object.externalProvisionEnabled();
        boolean isProvisioned = showForemanProviders && doProvisioning;
        providersEditor.setVisible(showForemanProviders);
        // showing or hiding radio buttons
        provisionedHostSection.setVisible(isProvisioned);
        discoveredHostSection.setVisible(isProvisioned);
        // disabling ip and name textbox when using provisioned hosts
        hostAddressEditor.setEnabled(!isProvisioned);
        hostAddressLabel.setStyleName(OvirtCss.LABEL_DISABLED, isProvisioned);
        if (isProvisioned) {
            object.updateHosts();
            object.getIsDiscoveredHosts().setEntity(true);
        } else {
            if (doProvisioning) {
                object.cleanHostParametersFields();
            }
            hideProviderWidgets(object);
            object.getIsDiscoveredHosts().setEntity(null);
        }
    });
    object.getIsDiscoveredHosts().getEntityChangedEvent().addListener((ev, sender, args) -> {
        if (object.getIsDiscoveredHosts().getEntity() != null) {
            if (object.getIsDiscoveredHosts().getEntity()) {
                rbDiscoveredHost.asRadioButton().setValue(true);
                showDiscoveredHostsWidgets(true);
            } else if (!object.getIsDiscoveredHosts().getEntity()) {
                rbProvisionedHost.asRadioButton().setValue(true);
                showProvisionedHostsWidgets(true);
            }
        }
    });
    nameEditor.asValueBox().addKeyDownHandler(event -> Scheduler.get().scheduleDeferred(() -> {
        if (object.getExternalHostProviderEnabled().getEntity() && Boolean.TRUE.equals(object.getIsDiscoveredHosts().getEntity())) {
            ExternalHostGroup dhg = (ExternalHostGroup) object.getExternalHostGroups().getSelectedItem();
            if (dhg != null) {
                String base = nameEditor.asEditor().getSubEditor().getValue();
                if (base == null) {
                    base = constants.empty();
                }
                String generatedHostName = // $NON-NLS-1$
                base + "." + (dhg.getDomainName() != null ? dhg.getDomainName() : constants.empty());
                object.getHost().setEntity(generatedHostName);
            }
        }
    }));
    if (object.isPasswordSectionViewable()) {
        rbPassword.setValue(true);
        rbPassword.setFocus(true);
        fetchSshFingerprint.hideLabel();
        object.setAuthenticationMethod(AuthenticationMethod.Password);
        displayPassPkWindow(true);
        rbPassword.addClickHandler(event -> {
            object.setAuthenticationMethod(AuthenticationMethod.Password);
            displayPassPkWindow(true);
        });
        rbPublicKey.addClickHandler(event -> {
            object.setAuthenticationMethod(AuthenticationMethod.PublicKey);
            displayPassPkWindow(false);
        });
    } else {
        passwordSection.getElement().getStyle().setDisplay(Display.NONE);
        rbPublicKey.getElement().getStyle().setDisplay(Display.NONE);
        rbPublicKeyLabel.setStyleName(OvirtCss.LABEL_DISABLED);
        object.setAuthenticationMethod(AuthenticationMethod.PublicKey);
    }
    updateHostsButton.setResource(resources.searchButtonImage());
    // Create SPM related controls.
    IEventListener<EventArgs> spmListener = (ev, sender, args) -> createSpmControls(object);
    object.getSpmPriority().getItemsChangedEvent().addListener(spmListener);
    object.getSpmPriority().getSelectedItemChangedEvent().addListener(spmListener);
    createSpmControls(object);
    initExternalHostProviderWidgets(object.showExternalProviderPanel());
    // TODO: remove setIsChangeable when configured ssh username is enabled
    userNameEditor.setEnabled(false);
    networkProviderTab.setVisible(object.showNetworkProviderTab());
    networkProviderWidget.edit(object.getNetworkProviderModel());
    this.fenceAgentsEditor.edit(object.getFenceAgentListModel());
    this.proxySourceEditor.edit(object.getPmProxyPreferencesList());
    addTextAndLinkAlert(fetchPanel, constants.fetchingHostFingerprint(), object.getSSHFingerPrint());
    providerSearchFilterLabel.setText(constants.hostPopupProviderSearchFilter());
    nameEditor.setFocus(true);
    hostedEngineTab.setVisible(object.getIsHeSystem() && object.getIsNew());
    object.getHostedEngineWarning().getPropertyChangedEvent().addListener((ev, sender, args) -> {
        EntityModel entity = (EntityModel) sender;
        if ("IsAvailable".equals(args.propertyName)) {
            // $NON-NLS-1$
            hostedEngineWarningLabel.setVisible(entity.getIsAvailable());
        }
    });
    affinityLabelSelectionWidget.init(object.getLabelList());
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) AssetProvider(org.ovirt.engine.ui.webadmin.gin.AssetProvider) Image(com.google.gwt.user.client.ui.Image) OvirtCss(org.ovirt.engine.ui.common.css.OvirtCss) Inject(com.google.inject.Inject) Container(org.gwtbootstrap3.client.ui.Container) Provider(org.ovirt.engine.core.common.businessentities.Provider) CommonApplicationMessages(org.ovirt.engine.ui.common.CommonApplicationMessages) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) Column(org.gwtbootstrap3.client.ui.Column) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) StringEntityModelPasswordBoxEditor(org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelPasswordBoxEditor) UiBinder(com.google.gwt.uibinder.client.UiBinder) AuthenticationMethod(org.ovirt.engine.core.common.action.VdsOperationActionParameters.AuthenticationMethod) ExternalEntityBase(org.ovirt.engine.core.common.businessentities.ExternalEntityBase) StringEntityModelTextAreaLabelEditor(org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelTextAreaLabelEditor) HostNetworkProviderWidget(org.ovirt.engine.ui.webadmin.widget.provider.HostNetworkProviderWidget) FenceAgentsEditor(org.ovirt.engine.ui.webadmin.widget.host.FenceAgentsEditor) Label(com.google.gwt.user.client.ui.Label) RadioButton(com.google.gwt.user.client.ui.RadioButton) AbstractTabbedModelBoundPopupView(org.ovirt.engine.ui.common.view.popup.AbstractTabbedModelBoundPopupView) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) HostPopupPresenterWidget(org.ovirt.engine.ui.webadmin.section.main.presenter.popup.host.HostPopupPresenterWidget) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) InfoIcon(org.ovirt.engine.ui.common.widget.dialog.InfoIcon) OpenstackNetworkProviderProperties(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties) Display(com.google.gwt.dom.client.Style.Display) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) EventBus(com.google.gwt.event.shared.EventBus) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) UiCommonEditorDriver(org.ovirt.engine.ui.common.editor.UiCommonEditorDriver) GroupedListModelListBox(org.ovirt.engine.ui.common.widget.editor.GroupedListModelListBox) WithElementId(org.ovirt.engine.ui.common.idhandler.WithElementId) ApplicationModeHelper(org.ovirt.engine.ui.uicommonweb.models.ApplicationModeHelper) HasClickHandlers(com.google.gwt.event.dom.client.HasClickHandlers) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) GroupedListModelListBoxEditor(org.ovirt.engine.ui.common.widget.editor.GroupedListModelListBoxEditor) CssResource(com.google.gwt.resources.client.CssResource) UiField(com.google.gwt.uibinder.client.UiField) Element(com.google.gwt.dom.client.Element) HostedEngineDeployConfiguration(org.ovirt.engine.core.common.businessentities.HostedEngineDeployConfiguration) AffinityLabelSelectionWithListWidget(org.ovirt.engine.ui.common.widget.AffinityLabelSelectionWithListWidget) DialogTabPanel(org.ovirt.engine.ui.common.widget.dialog.tab.DialogTabPanel) EnumRenderer(org.ovirt.engine.ui.common.widget.renderer.EnumRenderer) HostModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostModel) ExternalHostGroup(org.ovirt.engine.core.common.businessentities.ExternalHostGroup) StringEntityModelTextBoxEditor(org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelTextBoxEditor) IEventListener(org.ovirt.engine.ui.uicompat.IEventListener) StringEntityModelTextBoxOnlyEditor(org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelTextBoxOnlyEditor) Align(org.ovirt.engine.ui.common.widget.Align) GWT(com.google.gwt.core.client.GWT) TextDecoration(com.google.gwt.dom.client.Style.TextDecoration) Button(org.gwtbootstrap3.client.ui.Button) AdvancedParametersExpander(org.ovirt.engine.ui.common.widget.dialog.AdvancedParametersExpander) ListModelListBoxEditor(org.ovirt.engine.ui.common.widget.editor.ListModelListBoxEditor) EnableableFormLabel(org.ovirt.engine.ui.common.widget.label.EnableableFormLabel) ApplicationConstants(org.ovirt.engine.ui.webadmin.ApplicationConstants) ListModelTypeAheadListBoxEditor(org.ovirt.engine.ui.common.widget.editor.ListModelTypeAheadListBoxEditor) DialogTab(org.ovirt.engine.ui.common.widget.dialog.tab.DialogTab) ColumnSize(org.gwtbootstrap3.client.ui.constants.ColumnSize) EntityModelCheckBoxEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor) SafeHtmlUtils(com.google.gwt.safehtml.shared.SafeHtmlUtils) ApplicationResources(org.ovirt.engine.ui.webadmin.ApplicationResources) ElementIdHandler(org.ovirt.engine.ui.common.idhandler.ElementIdHandler) EntityModelRadioButtonEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelRadioButtonEditor) NameRenderer(org.ovirt.engine.ui.common.widget.renderer.NameRenderer) IntegerEntityModelTextBoxEditor(org.ovirt.engine.ui.common.widget.editor.generic.IntegerEntityModelTextBoxEditor) ApplicationTemplates(org.ovirt.engine.ui.webadmin.ApplicationTemplates) Scheduler(com.google.gwt.core.client.Scheduler) SimpleDialogPanel(org.ovirt.engine.ui.common.widget.dialog.SimpleDialogPanel) Row(org.gwtbootstrap3.client.ui.Row) TabName(org.ovirt.engine.ui.uicommonweb.models.TabName) HostProxySourceEditor(org.ovirt.engine.ui.webadmin.widget.host.HostProxySourceEditor) Comparator(java.util.Comparator) VDS(org.ovirt.engine.core.common.businessentities.VDS) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ExternalHostGroup(org.ovirt.engine.core.common.businessentities.ExternalHostGroup) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs)

Example 5 with EventArgs

use of org.ovirt.engine.ui.uicompat.EventArgs in project ovirt-engine by oVirt.

the class NetworkModel method createDefaultProfile.

private VnicProfileModel createDefaultProfile() {
    final VnicProfileModel defaultProfile = new NewVnicProfileModel();
    // make sure default profile's name is in sync with network's name
    defaultProfile.getName().setEntity(getName().getEntity());
    final IEventListener<EventArgs> networkNameListener = (ev, sender, args) -> defaultProfile.getName().setEntity(getName().getEntity());
    getName().getEntityChangedEvent().addListener(networkNameListener);
    // if user overrides default name, stop tracking network's name
    defaultProfile.getName().getEntityChangedEvent().addListener(new IEventListener<EventArgs>() {

        @Override
        public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) {
            String defaultProfileName = defaultProfile.getName().getEntity();
            if ((defaultProfileName != null) && (!defaultProfileName.equals(getName().getEntity()))) {
                getName().getEntityChangedEvent().removeListener(networkNameListener);
                defaultProfile.getName().getEntityChangedEvent().removeListener(this);
            }
        }
    });
    return defaultProfile;
}
Also used : ExternalSubnetModel(org.ovirt.engine.ui.uicommonweb.models.providers.ExternalSubnetModel) Arrays(java.util.Arrays) DnsResolverConfiguration(org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration) RegexValidation(org.ovirt.engine.ui.uicommonweb.validation.RegexValidation) SpecialAsciiI18NOrNoneValidation(org.ovirt.engine.ui.uicommonweb.validation.SpecialAsciiI18NOrNoneValidation) Provider(org.ovirt.engine.core.common.businessentities.Provider) Event(org.ovirt.engine.ui.uicompat.Event) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) OpenstackNetworkProviderProperties(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties) IntegerValidation(org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) DnsConfigurationModel(org.ovirt.engine.ui.uicommonweb.models.dnsconfiguration.DnsConfigurationModel) NameServer(org.ovirt.engine.core.common.businessentities.network.NameServer) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) HasValidatedTabs(org.ovirt.engine.ui.uicommonweb.models.HasValidatedTabs) BusinessEntitiesDefinitions(org.ovirt.engine.core.common.businessentities.BusinessEntitiesDefinitions) StringHelper(org.ovirt.engine.core.compat.StringHelper) Collectors(java.util.stream.Collectors) ApplicationModeHelper(org.ovirt.engine.ui.uicommonweb.models.ApplicationModeHelper) List(java.util.List) ValidationCompleteEvent(org.ovirt.engine.ui.uicommonweb.models.ValidationCompleteEvent) NewVnicProfileModel(org.ovirt.engine.ui.uicommonweb.models.profiles.NewVnicProfileModel) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) NewHostNetworkQosModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.qos.NewHostNetworkQosModel) Guid(org.ovirt.engine.core.compat.Guid) IFrontendActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback) IEventListener(org.ovirt.engine.ui.uicompat.IEventListener) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) Frontend(org.ovirt.engine.ui.frontend.Frontend) NetworkProfilesModel(org.ovirt.engine.ui.uicommonweb.models.profiles.NetworkProfilesModel) AddVnicProfileParameters(org.ovirt.engine.core.common.action.AddVnicProfileParameters) Network(org.ovirt.engine.core.common.businessentities.network.Network) LinkedList(java.util.LinkedList) HostNetworkQos(org.ovirt.engine.core.common.businessentities.network.HostNetworkQos) Model(org.ovirt.engine.ui.uicommonweb.models.Model) Linq(org.ovirt.engine.ui.uicommonweb.Linq) VnicProfileModel(org.ovirt.engine.ui.uicommonweb.models.profiles.VnicProfileModel) IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) VnicProfile(org.ovirt.engine.core.common.businessentities.network.VnicProfile) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) TabName(org.ovirt.engine.ui.uicommonweb.models.TabName) AsciiNameValidation(org.ovirt.engine.ui.uicommonweb.validation.AsciiNameValidation) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) NewVnicProfileModel(org.ovirt.engine.ui.uicommonweb.models.profiles.NewVnicProfileModel) NewVnicProfileModel(org.ovirt.engine.ui.uicommonweb.models.profiles.NewVnicProfileModel) VnicProfileModel(org.ovirt.engine.ui.uicommonweb.models.profiles.VnicProfileModel) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs)

Aggregations

EventArgs (org.ovirt.engine.ui.uicompat.EventArgs)8 IEventListener (org.ovirt.engine.ui.uicompat.IEventListener)7 Inject (com.google.inject.Inject)6 List (java.util.List)5 Event (org.ovirt.engine.ui.uicompat.Event)5 ArrayList (java.util.ArrayList)4 Collection (java.util.Collection)4 Collections (java.util.Collections)4 ActionType (org.ovirt.engine.core.common.action.ActionType)4 Provider (org.ovirt.engine.core.common.businessentities.Provider)4 Frontend (org.ovirt.engine.ui.frontend.Frontend)4 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)4 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)4 Arrays (java.util.Arrays)3 HashMap (java.util.HashMap)3 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)3 OpenstackNetworkProviderProperties (org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties)3 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)3 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)3 QueryType (org.ovirt.engine.core.common.queries.QueryType)3