Search in sources :

Example 1 with WizardPageSelectedEvent

use of org.uberfire.ext.widgets.core.client.wizards.WizardPageSelectedEvent in project kie-wb-common by kiegroup.

the class ProjectPage method fetchRepository.

private void fetchRepository(final ExampleRepository selectedRepository) {
    examplesService.call(new RemoteCallback<Set<ExampleProject>>() {

        @Override
        public void callback(final Set<ExampleProject> projects) {
            activeView = projectsView;
            model.getProjects().clear();
            model.setSourceRepository(selectedRepository);
            final List<ExampleProject> sortedProjects = sort(projects);
            projectsView.setProjectsInRepository(sortedProjects);
            exampleProjects = sortedProjects;
            pageSelectedEvent.fire(new WizardPageSelectedEvent(ProjectPage.this));
        }
    }, new DefaultErrorCallback() {

        @Override
        public boolean error(final Message message, final Throwable throwable) {
            model.setSourceRepository(null);
            model.getSelectedRepository().setUrlValid(false);
            return super.error(message, throwable);
        }
    }).getProjects(selectedRepository);
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) Message(org.jboss.errai.bus.client.api.messaging.Message) DefaultErrorCallback(org.uberfire.ext.widgets.common.client.callbacks.DefaultErrorCallback) WizardPageSelectedEvent(org.uberfire.ext.widgets.core.client.wizards.WizardPageSelectedEvent) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) ExampleProject(org.kie.workbench.common.screens.examples.model.ExampleProject)

Example 2 with WizardPageSelectedEvent

use of org.uberfire.ext.widgets.core.client.wizards.WizardPageSelectedEvent in project kie-wb-common by kiegroup.

the class ProjectPage method updateProjectsInRepository.

private void updateProjectsInRepository(final Collection<String> tags) {
    List<ExampleProject> resultList = exampleProjects.stream().filter(p -> tags.stream().allMatch(userTag -> p.getTags().stream().anyMatch(projectTag -> projectTag.toLowerCase().contains(userTag.toLowerCase())))).sorted((o1, o2) -> o1.getName().compareTo(o2.getName())).collect(Collectors.toList());
    projectsView.setProjectsInRepository(resultList);
    pageSelectedEvent.fire(new WizardPageSelectedEvent(ProjectPage.this));
}
Also used : WizardPageStatusChangeEvent(org.uberfire.ext.widgets.core.client.wizards.WizardPageStatusChangeEvent) ArrayList(java.util.ArrayList) ExampleRepository(org.kie.workbench.common.screens.examples.model.ExampleRepository) HashSet(java.util.HashSet) Inject(javax.inject.Inject) WizardPageSelectedEvent(org.uberfire.ext.widgets.core.client.wizards.WizardPageSelectedEvent) IsWidget(com.google.gwt.user.client.ui.IsWidget) DefaultErrorCallback(org.uberfire.ext.widgets.common.client.callbacks.DefaultErrorCallback) Event(javax.enterprise.event.Event) TranslationService(org.jboss.errai.ui.client.local.spi.TranslationService) Collection(java.util.Collection) Set(java.util.Set) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) ExamplesService(org.kie.workbench.common.screens.examples.service.ExamplesService) Collectors(java.util.stream.Collectors) ExamplesScreenConstants(org.kie.workbench.common.screens.examples.client.resources.i18n.ExamplesScreenConstants) List(java.util.List) Widget(com.google.gwt.user.client.ui.Widget) Message(org.jboss.errai.bus.client.api.messaging.Message) Dependent(javax.enterprise.context.Dependent) Callback(org.uberfire.client.callbacks.Callback) Caller(org.jboss.errai.common.client.api.Caller) BaseExamplesWizardPage(org.kie.workbench.common.screens.examples.client.wizard.pages.BaseExamplesWizardPage) PostConstruct(javax.annotation.PostConstruct) ExampleProject(org.kie.workbench.common.screens.examples.model.ExampleProject) Comparator(java.util.Comparator) Collections(java.util.Collections) WizardPageSelectedEvent(org.uberfire.ext.widgets.core.client.wizards.WizardPageSelectedEvent) ExampleProject(org.kie.workbench.common.screens.examples.model.ExampleProject)

Example 3 with WizardPageSelectedEvent

use of org.uberfire.ext.widgets.core.client.wizards.WizardPageSelectedEvent in project kie-wb-common by kiegroup.

the class ProjectPage method removeAllTags.

@Override
public void removeAllTags() {
    tags.clear();
    projectsView.setProjectsInRepository(exampleProjects);
    pageSelectedEvent.fire(new WizardPageSelectedEvent(ProjectPage.this));
}
Also used : WizardPageSelectedEvent(org.uberfire.ext.widgets.core.client.wizards.WizardPageSelectedEvent)

Aggregations

WizardPageSelectedEvent (org.uberfire.ext.widgets.core.client.wizards.WizardPageSelectedEvent)3 HashSet (java.util.HashSet)2 Set (java.util.Set)2 Message (org.jboss.errai.bus.client.api.messaging.Message)2 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)2 ExampleProject (org.kie.workbench.common.screens.examples.model.ExampleProject)2 DefaultErrorCallback (org.uberfire.ext.widgets.common.client.callbacks.DefaultErrorCallback)2 IsWidget (com.google.gwt.user.client.ui.IsWidget)1 Widget (com.google.gwt.user.client.ui.Widget)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 Comparator (java.util.Comparator)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 PostConstruct (javax.annotation.PostConstruct)1 Dependent (javax.enterprise.context.Dependent)1 Event (javax.enterprise.event.Event)1 Inject (javax.inject.Inject)1 Caller (org.jboss.errai.common.client.api.Caller)1