[PATCH] Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui

Wald Commits scm-commit at wald.intevation.org
Wed Feb 7 12:03:03 CET 2018


# HG changeset patch
# User gernotbelger
# Date 1518001378 -3600
# Node ID 78cd6572778d87247ad4e0b1edb71ed668d4d86e
# Parent  c26fb37899ca3e8777e53816fe6cc0aa80d15cb0
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.

diff -r c26fb37899ca -r 78cd6572778d gwt-client/src/main/java/org/dive4elements/river/client/shared/model/ModuleGroup.java
--- /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


More information about the Dive4Elements-commits mailing list