Search in sources :

Example 1 with Person

use of de.gishmo.gwt.example.mvp4g2.simpleapplication.shared.dto.Person in project mvp4g2-examples by mvp4g.

the class DetailPresenter method onGotoDetail.

@EventHandler
public void onGotoDetail(long id) {
    eventBus.setNavigationConfirmation(this);
    try {
        Person result = PersonService.get().get(id);
        view.setUpData(result);
        eventBus.setContent(view.asElement());
        eventBus.setStatus("Edit person data");
    } catch (PersonNotFoundException e) {
        DomGlobal.window.alert("Panic!");
    }
}
Also used : PersonNotFoundException(de.gishmo.gwt.example.mvp4g2.simpleapplication.client.data.model.exception.PersonNotFoundException) Person(de.gishmo.gwt.example.mvp4g2.simpleapplication.client.data.model.dto.Person) EventHandler(com.github.mvp4g.mvp4g2.core.ui.annotation.EventHandler)

Example 2 with Person

use of de.gishmo.gwt.example.mvp4g2.simpleapplication.shared.dto.Person in project mvp4g2-examples by mvp4g.

the class DetailView method createView.

public void createView() {
    container = div().add(div().style("width: 100%;").add(div().css("headline").textContent("Details")).add(detailFirstName = new TextField("Firstname")).add(detailName = new TextField("Name")).add(detailStreet = new TextField("Street")).add(detailZip = new TextField("Zip")).add(detailCity = new TextField("City")).add(div().css("buttonBar").add(button().css("button").textContent("Save").on(click, event -> {
        updateDetailForm();
        getPresenter().doUpdate(person);
    })).add(button().css("button").textContent("Revert").on(click, event -> {
        getPresenter().doRevert();
    })))).asElement();
}
Also used : Element(elemental2.dom.Element) Elements.button(org.jboss.gwt.elemento.core.Elements.button) Elements.div(org.jboss.gwt.elemento.core.Elements.div) HTMLDivElement(elemental2.dom.HTMLDivElement) Person(de.gishmo.gwt.example.mvp4g2.simpleapplication.client.data.model.dto.Person) HTMLButtonElement(elemental2.dom.HTMLButtonElement) TextField(de.gishmo.gwt.example.mvp4g2.simpleapplication.client.widgets.TextField) EventType.click(org.jboss.gwt.elemento.core.EventType.click) LazyReverseView(com.github.mvp4g.mvp4g2.core.ui.LazyReverseView) TextField(de.gishmo.gwt.example.mvp4g2.simpleapplication.client.widgets.TextField)

Example 3 with Person

use of de.gishmo.gwt.example.mvp4g2.simpleapplication.shared.dto.Person 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 4 with Person

use of de.gishmo.gwt.example.mvp4g2.simpleapplication.shared.dto.Person in project mvp4g2-examples by mvp4g.

the class DetailView method createView.

public void createView() {
    container = div().add(div().style("width: 100%;").add(div().css("headline").textContent("Details")).add(detailFirstName = new TextField("Firstname")).add(detailName = new TextField("Name")).add(detailStreet = new TextField("Street")).add(detailZip = new TextField("Zip")).add(detailCity = new TextField("City")).add(div().css("buttonBar").add(button().css("button").textContent("Save").on(click, event -> {
        updateDetailForm();
        getPresenter().doUpdate(person);
    })).add(button().css("button").textContent("Revert").on(click, event -> {
        getPresenter().doRevert();
    })))).asElement();
}
Also used : Element(elemental2.dom.Element) Elements.button(org.jboss.gwt.elemento.core.Elements.button) Elements.div(org.jboss.gwt.elemento.core.Elements.div) TextField(de.gishmo.gwt.example.mvp4g2.springboot.client.widgets.TextField) HTMLDivElement(elemental2.dom.HTMLDivElement) HTMLButtonElement(elemental2.dom.HTMLButtonElement) Person(de.gishmo.gwt.example.mvp4g2.springboot.client.data.model.dto.Person) EventType.click(org.jboss.gwt.elemento.core.EventType.click) LazyReverseView(com.github.mvp4g.mvp4g2.core.ui.LazyReverseView) TextField(de.gishmo.gwt.example.mvp4g2.springboot.client.widgets.TextField)

Example 5 with Person

use of de.gishmo.gwt.example.mvp4g2.simpleapplication.shared.dto.Person 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)

Aggregations

Person (de.gishmo.gwt.example.mvp4g2.simpleapplication.client.data.model.dto.Person)7 Person (de.gishmo.gwt.example.mvp4g2.springboot.client.data.model.dto.Person)5 Person (de.gishmo.gwt.example.mvp4g2.simpleapplication.shared.dto.Person)4 EventHandler (com.github.mvp4g.mvp4g2.core.ui.annotation.EventHandler)3 LazyReverseView (com.github.mvp4g.mvp4g2.core.ui.LazyReverseView)2 Element (elemental2.dom.Element)2 HTMLButtonElement (elemental2.dom.HTMLButtonElement)2 HTMLDivElement (elemental2.dom.HTMLDivElement)2 Elements.button (org.jboss.gwt.elemento.core.Elements.button)2 Elements.div (org.jboss.gwt.elemento.core.Elements.div)2 EventType.click (org.jboss.gwt.elemento.core.EventType.click)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 ClickableTextCell (com.google.gwt.cell.client.ClickableTextCell)1 TextCell (com.google.gwt.cell.client.TextCell)1 Address (de.gishmo.gwt.example.mvp4g2.simpleapplication.client.data.model.dto.Address)1 PersonSearch (de.gishmo.gwt.example.mvp4g2.simpleapplication.client.data.model.dto.PersonSearch)1 PersonNotFoundException (de.gishmo.gwt.example.mvp4g2.simpleapplication.client.data.model.exception.PersonNotFoundException)1 TextField (de.gishmo.gwt.example.mvp4g2.simpleapplication.client.widgets.TextField)1 Address (de.gishmo.gwt.example.mvp4g2.simpleapplication.shared.dto.Address)1