Search in sources :

Example 11 with Person

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

the class PersonService method update.

public void update(Person person) throws PersonException {
    Person value = persons.get(new Long(person.getId()));
    if (value != null) {
        persons.remove(new Long(person.getId()));
        persons.put(new Long(person.getId()), person);
    }
}
Also used : Person(de.gishmo.gwt.example.mvp4g2.simpleapplication.client.data.model.dto.Person)

Example 12 with Person

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

the class PersonService method insert.

public void insert(Person person) throws PersonException {
    Iterator<Person> iter = persons.values().iterator();
    long maxKey = 0;
    while (iter.hasNext()) {
        Person element = iter.next();
        if (maxKey < element.getId()) {
            maxKey = element.getId();
        }
    }
    maxKey++;
    person.setId(maxKey);
    persons.put(new Long(maxKey), person);
}
Also used : Person(de.gishmo.gwt.example.mvp4g2.simpleapplication.client.data.model.dto.Person)

Example 13 with Person

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

the class PersonResource method insert.

@RequestMapping(method = RequestMethod.POST, path = "/insert")
@ResponseStatus(HttpStatus.OK)
@ResponseBody
public void insert(@RequestBody Person person) {
    Iterator<Person> iter = persons.values().iterator();
    long maxKey = 0;
    while (iter.hasNext()) {
        Person element = iter.next();
        if (maxKey < element.getId()) {
            maxKey = element.getId();
        }
    }
    maxKey++;
    person.setId(maxKey);
    persons.put(new Long(maxKey), person);
}
Also used : Person(de.gishmo.gwt.example.mvp4g2.springboot.client.data.model.dto.Person) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 14 with Person

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

the class PersonResource method update.

@RequestMapping(method = RequestMethod.POST, path = "/update")
@ResponseBody
public ResponseEntity<Void> update(@RequestBody Person person) {
    Person value = persons.get(new Long(person.getId()));
    if (value != null) {
        persons.remove(new Long(person.getId()));
        persons.put(new Long(person.getId()), person);
    }
    return new ResponseEntity<Void>(HttpStatus.OK);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) Person(de.gishmo.gwt.example.mvp4g2.springboot.client.data.model.dto.Person) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 15 with Person

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

the class PersonResource method initList.

private void initList() {
    Address address01 = new Address(1, "Evergreen Terrace", "7 42", "Springfield");
    persons.put(new Long(1), new Person(1, "Simpsons", "Homer", address01));
    persons.put(new Long(2), new Person(2, "Simpsons", "Marge", address01));
    persons.put(new Long(3), new Person(3, "Simpsons", "Bart", address01));
    persons.put(new Long(4), new Person(4, "Simpsons", "Maggie", address01));
    persons.put(new Long(5), new Person(5, "Simpsons", "Lisa", address01));
    Address address02 = new Address(2, "Blumenweg Nr. 13", "", "Entenhausen");
    persons.put(new Long(6), new Person(6, "Duck", "Donald", address02));
    persons.put(new Long(7), new Person(7, "Duck", "Trick", address02));
    persons.put(new Long(8), new Person(8, "Duck", "Tick", address02));
    persons.put(new Long(9), new Person(9, "Duck", "Tack", address02));
    Address address03 = new Address(2, "Am Goldberg Nr. 1", "", "Entenhausen");
    persons.put(new Long(10), new Person(10, "Duck", "Dagobert", address03));
}
Also used : Address(de.gishmo.gwt.example.mvp4g2.springboot.client.data.model.dto.Address) Person(de.gishmo.gwt.example.mvp4g2.springboot.client.data.model.dto.Person)

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