use of de.gishmo.gwt.example.mvp4g2.springboot.client.data.model.dto.Person in project mvp4g2-examples by mvp4g.
the class PersonServiceImpl method insert.
@Override
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);
}
use of de.gishmo.gwt.example.mvp4g2.springboot.client.data.model.dto.Person in project mvp4g2-examples by mvp4g.
the class PersonServiceImpl method update.
@Override
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);
}
}
use of de.gishmo.gwt.example.mvp4g2.springboot.client.data.model.dto.Person in project mvp4g2-examples by mvp4g.
the class ListView method createView.
public void createView() {
panel = new ScrollPanel();
FlowPanel resultPanel = new FlowPanel();
resultPanel.addStyleName(style.resultPanel());
panel.add(resultPanel);
Label headline = new Label(ApplicationConstants.CONSTANTS.resultHeadline());
headline.addStyleName(style.headline());
resultPanel.add(headline);
resultTable = new CellTable<Person>();
resultPanel.add(resultTable);
resultTable.setEmptyTableWidget(new HTML(ApplicationConstants.CONSTANTS.resultText()));
Column<Person, String> nameColumn = addColumn(new ClickableTextCell(), ApplicationConstants.CONSTANTS.columnName(), new GetValue<String>() {
@Override
public String getValue(Person person) {
return person.getName() + ", " + person.getFirstName();
}
}, new FieldUpdater<Person, String>() {
@Override
public void update(int index, Person object, String value) {
getPresenter().doUpdate(object);
}
});
Column<Person, String> streetColumn = addColumn(new TextCell(), ApplicationConstants.CONSTANTS.columnStreet(), new GetValue<String>() {
@Override
public String getValue(Person person) {
return person.getAddress().getStreet();
}
}, null);
Column<Person, String> plzColumn = addColumn(new TextCell(), ApplicationConstants.CONSTANTS.columnPlz(), new GetValue<String>() {
@Override
public String getValue(Person person) {
return person.getAddress().getZip();
}
}, null);
plzColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
Column<Person, String> cityColumn = addColumn(new TextCell(), ApplicationConstants.CONSTANTS.columnCity(), new GetValue<String>() {
@Override
public String getValue(Person person) {
return person.getAddress().getCity();
}
}, null);
// Tabellen und Spalten-Breite setzen
resultTable.setWidth("100%");
resultTable.setColumnWidth(nameColumn, "40%");
resultTable.setColumnWidth(streetColumn, "25%");
resultTable.setColumnWidth(plzColumn, "10%");
resultTable.setColumnWidth(cityColumn, "25%");
resetTable();
}
use of de.gishmo.gwt.example.mvp4g2.springboot.client.data.model.dto.Person in project mvp4g2-examples by mvp4g.
the class ListView method createTable.
private HTMLTableElement createTable(List<Person> result) {
resultTable = (HTMLTableElement) document.createElement("table");
resultTable.style.display = "table";
resultTable.style.borderCollapse = "seperate";
resultTable.style.borderSpacing = "2px";
resultTable.style.borderColor = "grey";
resultTable.style.fontFamily = "Arial, sans-serif";
resultTable.style.fontSize = CSSProperties.FontSizeUnionType.of("14px");
resultTable.style.margin = CSSProperties.MarginUnionType.of("12px");
resultTable.style.width = CSSProperties.WidthUnionType.of("100%");
listPanel.appendChild(resultTable);
HTMLElement colGroup = (HTMLElement) document.createElement("colgroup");
resultTable.appendChild(colGroup);
colGroup.appendChild(this.createColElement("40%"));
colGroup.appendChild(this.createColElement("25%"));
colGroup.appendChild(this.createColElement("10%"));
colGroup.appendChild(this.createColElement("25%"));
HTMLElement tableHeadGroud = (HTMLElement) document.createElement("thead");
resultTable.appendChild(tableHeadGroud);
HTMLElement trHead = (HTMLElement) document.createElement("tr");
tableHeadGroud.appendChild(trHead);
tableHeadGroud.appendChild(this.createTableHeaderElement("Name"));
tableHeadGroud.appendChild(this.createTableHeaderElement("Street"));
tableHeadGroud.appendChild(this.createTableHeaderElement("ZIP"));
tableHeadGroud.appendChild(this.createTableHeaderElement("City"));
for (Person person : result) {
resultTable.appendChild(this.createTableDataRow(person));
}
return resultTable;
}
use of de.gishmo.gwt.example.mvp4g2.springboot.client.data.model.dto.Person in project mvp4g2-examples by mvp4g.
the class PersonService 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));
}
Aggregations