Mercurial > dive4elements > river
changeset 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 | c26fb37899ca |
children | 60278b5fe4d9 |
files | gwt-client/src/main/java/org/dive4elements/river/client/shared/model/ModuleGroup.java |
diffstat | 1 files changed, 65 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/ModuleGroup.java Wed Feb 07 12:02:58 2018 +0100 @@ -0,0 +1,65 @@ +/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde + * Software engineering by + * Björnsen Beratende Ingenieure GmbH + * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt + * + * This file is Free Software under the GNU AGPL (>=v3) + * and comes with ABSOLUTELY NO WARRANTY! Check out the + * documentation coming with Dive4Elements River for details. + */ +package org.dive4elements.river.client.shared.model; + +import java.io.Serializable; + +/** + * A module group marks modules to belong to a common group. Modules of the same group are put together in the user-interface. + * + * @author Gernot Belger + */ +public class ModuleGroup implements Serializable { + + private static final long serialVersionUID = 1L; + + private String id; + private String label; + + public ModuleGroup() { + this.id = null; + this.label = null; + } + + public ModuleGroup(final String id, final String label) { + this.id = id; + this.label = label; + } + + @Override + public String toString() { + return label; + } + + @Override + public int hashCode() { + return id == null ? 0 : id.hashCode(); + } + + @Override + public boolean equals(Object obj) { + + if (obj == null) + return false; + if (obj == this) + return true; + + if (obj.getClass() != getClass()) { + return false; + } + + final ModuleGroup rhs = (ModuleGroup) obj; + return (id == rhs.id) || (id != null && id.equals(rhs.id)); + } + + public boolean showGroupFrame() { + return label != null && !label.trim().isEmpty(); + } +} \ No newline at end of file