Search in sources :

Example 1 with PersonSearch

use of de.gishmo.gwt.example.mvp4g2.simpleapplication.client.data.model.dto.PersonSearch in project mvp4g2-examples by mvp4g.

the class ListHistoryConverter method convertFromToken.

@Override
public void convertFromToken(String historyName, String param, Mvp4g2SimpleApplicationWithLoginEventBus eventBus) {
    String searchName = "";
    String searchCity = "";
    if (param.length() > 0) {
        searchName = param.substring(0, param.indexOf(DELIMITER));
        if (param.length() > param.indexOf(DELIMITER) + DELIMITER.length()) {
            searchCity = param.substring(param.indexOf(DELIMITER) + DELIMITER.length());
        }
        ClientContext.get().setPersonSearch(new PersonSearch(searchName, searchCity));
    }
    if (searchName.length() > 0 || searchCity.length() > 0) {
        eventBus.gotoList(searchName, searchCity);
    } else {
        eventBus.gotoSearch("", "");
    }
}
Also used : PersonSearch(de.gishmo.gwt.example.mvp4g2.simpleapplication.client.data.model.dto.PersonSearch)

Example 2 with PersonSearch

use of de.gishmo.gwt.example.mvp4g2.simpleapplication.client.data.model.dto.PersonSearch in project mvp4g2-examples by mvp4g.

the class ListPresenter method onGotoList.

@EventHandler
public void onGotoList(String searchName, String searchCity) {
    List<Person> result = PersonService.get().get(new PersonSearch(searchName, searchCity));
    view.resetTable();
    view.setData(result);
    eventBus.setContent(view.asElement());
    if (result.size() == 0) {
        eventBus.setStatus("No person found");
    } else if (result.size() == 1) {
        eventBus.setStatus("Found one person");
    } else {
        eventBus.setStatus("Found " + Integer.toString(result.size()) + " persons");
    }
}
Also used : PersonSearch(de.gishmo.gwt.example.mvp4g2.simpleapplication.client.data.model.dto.PersonSearch) Person(de.gishmo.gwt.example.mvp4g2.simpleapplication.client.data.model.dto.Person) EventHandler(com.github.mvp4g.mvp4g2.core.ui.annotation.EventHandler)

Example 3 with PersonSearch

use of de.gishmo.gwt.example.mvp4g2.simpleapplication.client.data.model.dto.PersonSearch in project mvp4g2-examples by mvp4g.

the class ListPresenter method onGotoList.

@EventHandler
public void onGotoList(String searchName, String searchCity) {
    GWT.debugger();
    ClientContext.get().getPersonService().search(new PersonSearch(searchName, searchCity), new MethodCallback<List<Person>>() {

        @Override
        public void onFailure(Method method, Throwable throwable) {
            DomGlobal.alert("error: " + throwable.getMessage());
        }

        @Override
        public void onSuccess(Method method, List<Person> persons) {
            GWT.debugger();
            view.setData(persons);
            eventBus.setContent(view.asElement());
            if (persons.size() == 0) {
                eventBus.setStatus("No person found");
            } else if (persons.size() == 1) {
                eventBus.setStatus("Found one person");
            } else {
                eventBus.setStatus("Found " + Integer.toString(persons.size()) + " persons");
            }
        }
    });
}
Also used : PersonSearch(de.gishmo.gwt.example.mvp4g2.springboot.client.data.model.dto.PersonSearch) List(java.util.List) Method(org.fusesource.restygwt.client.Method) Person(de.gishmo.gwt.example.mvp4g2.springboot.client.data.model.dto.Person) EventHandler(com.github.mvp4g.mvp4g2.core.ui.annotation.EventHandler)

Example 4 with PersonSearch

use of de.gishmo.gwt.example.mvp4g2.simpleapplication.client.data.model.dto.PersonSearch in project mvp4g2-examples by mvp4g.

the class SearchPresenter method doClickSearchButton.

@Override
public void doClickSearchButton(String searchName, String searchCity) {
    // fuer NavigatiponPresenter speichern ...
    ClientContext.get().setPersonSearch(new PersonSearch(searchName, searchCity));
    eventBus.gotoList(searchName, searchCity);
}
Also used : PersonSearch(de.gishmo.gwt.example.mvp4g2.springboot.client.data.model.dto.PersonSearch)

Example 5 with PersonSearch

use of de.gishmo.gwt.example.mvp4g2.simpleapplication.client.data.model.dto.PersonSearch in project mvp4g2-examples by mvp4g.

the class ListHistoryConverter method convertFromToken.

@Override
public void convertFromToken(String historyName, String param, Mvp4g2SimpleApplicationUsingElementoAndEventHandlerAnnotationEventBus eventBus) {
    String searchName = "";
    String searchCity = "";
    if (param.length() > 0) {
        searchName = param.substring(0, param.indexOf(DELIMITER));
        if (param.length() > param.indexOf(DELIMITER) + DELIMITER.length()) {
            searchCity = param.substring(param.indexOf(DELIMITER) + DELIMITER.length());
        }
        ClientContext.get().setPersonSearch(new PersonSearch(searchName, searchCity));
    }
    if (searchName.length() > 0 || searchCity.length() > 0) {
        eventBus.gotoList(searchName, searchCity);
    } else {
        eventBus.gotoSearch("", "");
    }
}
Also used : PersonSearch(de.gishmo.gwt.example.mvp4g2.simpleapplication.client.data.model.dto.PersonSearch)

Aggregations

PersonSearch (de.gishmo.gwt.example.mvp4g2.simpleapplication.client.data.model.dto.PersonSearch)4 PersonSearch (de.gishmo.gwt.example.mvp4g2.springboot.client.data.model.dto.PersonSearch)3 EventHandler (com.github.mvp4g.mvp4g2.core.ui.annotation.EventHandler)2 Person (de.gishmo.gwt.example.mvp4g2.simpleapplication.client.data.model.dto.Person)1 Person (de.gishmo.gwt.example.mvp4g2.springboot.client.data.model.dto.Person)1 List (java.util.List)1 Method (org.fusesource.restygwt.client.Method)1