annotate gwt-client/src/main/java/org/dive4elements/river/client/shared/model/ModuleGroup.java @ 8871:78cd6572778d

Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui. Also using now the localization info from the server instead of localizing the modules again on the client side.
author gernotbelger
date Wed, 07 Feb 2018 12:02:58 +0100
parents
children
rev   line source
8871
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
2 * Software engineering by
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
3 * Björnsen Beratende Ingenieure GmbH
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
5 *
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
6 * This file is Free Software under the GNU AGPL (>=v3)
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
8 * documentation coming with Dive4Elements River for details.
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
9 */
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
10 package org.dive4elements.river.client.shared.model;
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
11
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
12 import java.io.Serializable;
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
13
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
14 /**
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
15 * A module group marks modules to belong to a common group. Modules of the same group are put together in the user-interface.
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
16 *
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
17 * @author Gernot Belger
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
18 */
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
19 public class ModuleGroup implements Serializable {
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
20
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
21 private static final long serialVersionUID = 1L;
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
22
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
23 private String id;
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
24 private String label;
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
25
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
26 public ModuleGroup() {
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
27 this.id = null;
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
28 this.label = null;
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
29 }
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
30
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
31 public ModuleGroup(final String id, final String label) {
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
32 this.id = id;
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
33 this.label = label;
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
34 }
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
35
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
36 @Override
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
37 public String toString() {
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
38 return label;
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
39 }
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
40
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
41 @Override
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
42 public int hashCode() {
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
43 return id == null ? 0 : id.hashCode();
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
44 }
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
45
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
46 @Override
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
47 public boolean equals(Object obj) {
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
48
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
49 if (obj == null)
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
50 return false;
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
51 if (obj == this)
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
52 return true;
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
53
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
54 if (obj.getClass() != getClass()) {
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
55 return false;
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
56 }
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
57
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
58 final ModuleGroup rhs = (ModuleGroup) obj;
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
59 return (id == rhs.id) || (id != null && id.equals(rhs.id));
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
60 }
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
61
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
62 public boolean showGroupFrame() {
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
63 return label != null && !label.trim().isEmpty();
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
64 }
78cd6572778d Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
diff changeset
65 }

http://dive4elements.wald.intevation.org