[PATCH] Anti programming: Removed obsolete classes in client. This may break stuff because of the GWT magic

Wald Commits scm-commit at wald.intevation.org
Fri Sep 5 10:27:54 CEST 2014


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1409905670 -7200
# Node ID 1d0b6500e0e5ef7706bb5427f78a472e4fa6c5a5
# Parent  f799db6b1219d029004f4e2f9e81c3de6c168b42
Anti programming: Removed obsolete classes in client. This may break stuff because of the GWT magic.

diff -r f799db6b1219 -r 1d0b6500e0e5 gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSImages.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSImages.java	Fri Sep 05 10:10:42 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
- * Software engineering by Intevation GmbH
- *
- * 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.client;
-
-import com.google.gwt.resources.client.ClientBundle;
-import com.google.gwt.resources.client.ImageResource;
-
-
-/**
- * This interface grants access to the images used in this application.
- *
- * @author <a href="mailto:ingo.weinzierl at intevation.de">Ingo Weinzierl</a>
- */
-public interface FLYSImages extends ClientBundle {
-
-    @Source("images/bfg_logo.gif")
-    ImageResource logoBfg();
-
-    @Source("images/flys_logo.gif")
-    ImageResource logoFlys();
-
-    @Source("images/FLYS_Karte.png")
-    ImageResource riverMap();
-
-    @Source("images/marker_red.png")
-    ImageResource markerRed ();
-
-    @Source("images/marker_green.png")
-    ImageResource markerGreen ();
-
-    @Source("images/loading.gif")
-    ImageResource loading();
-
-    @Source("images/downloadPNG.png")
-    ImageResource downloadPNG();
-
-    @Source("images/downloadPDF.png")
-    ImageResource downloadPDF();
-
-    @Source("images/downloadSVG.png")
-    ImageResource downloadSVG();
-}
diff -r f799db6b1219 -r 1d0b6500e0e5 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DatacageButton.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DatacageButton.java	Fri Sep 05 10:10:42 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
- * Software engineering by Intevation GmbH
- *
- * 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.client.ui;
-
-import com.smartgwt.client.widgets.Button;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.events.CloseClickHandler;
-import com.smartgwt.client.widgets.events.CloseClickEvent;
-
-import org.dive4elements.river.client.shared.model.Artifact;
-import org.dive4elements.river.client.shared.model.User;
-
-/** Button that opens view of datacage (DataCageWindow). */
-public class DatacageButton extends Button implements ClickHandler {
-
-    protected Artifact artifact;
-    protected User     user;
-    protected CollectionView view;
-
-    public DatacageButton(
-        String         title,
-        Artifact       artifact,
-        User           user,
-        CollectionView view
-    ) {
-        super(title);
-
-        this.artifact = artifact;
-        this.user     = user;
-        this.view     = view;
-
-        addClickHandler(this);
-    }
-
-
-    public void onClick(ClickEvent event) {
-        // TODO: fetch outs!
-        String outs = "";
-
-        final DatacageWindow dc = new DatacageWindow(
-            artifact, user, outs, view);
-        dc.addCloseClickHandler(new CloseClickHandler() {
-            public void onCloseClick(CloseClickEvent event) {
-                dc.destroy();
-            }
-        });
-        dc.show();
-    }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r f799db6b1219 -r 1d0b6500e0e5 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/PropertyEditor.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/PropertyEditor.java	Fri Sep 05 10:10:42 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
- * Software engineering by Intevation GmbH
- *
- * 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.client.ui;
-
-import java.io.Serializable;
-
-/**
- * @author <a href="mailto:raimund.renkert at intevation.de">Raimund Renkert</a>
- */
-public interface PropertyEditor extends Serializable {
-
-    String getI18NString(String name);
-
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r f799db6b1219 -r 1d0b6500e0e5 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sq/SQMultiPeriodPanel.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sq/SQMultiPeriodPanel.java	Fri Sep 05 10:10:42 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
- * Software engineering by Intevation GmbH
- *
- * 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.client.ui.sq;
-
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.events.ResizedEvent;
-import com.smartgwt.client.widgets.events.ResizedHandler;
-
-import org.dive4elements.river.client.client.ui.MultiPeriodPanel;
-
-
-/**
- * This UIProvider creates helper panel for sq relation.
- *
- * @author <a href="mailto:raimund.renkert at intevation.de">Raimund Renkert</a>
- */
-public class SQMultiPeriodPanel extends MultiPeriodPanel implements
-    ResizedHandler {
-    protected SQCampaignChart chartContainer;
-
-    public SQMultiPeriodPanel() {
-    }
-
-    @Override
-    protected Canvas createHelper() {
-        chartContainer = new SQCampaignChart(artifact, this);
-        return chartContainer;
-    }
-
-    @Override
-    public void onResized(ResizedEvent re) {
-        chartContainer.update();
-    }
-}
diff -r f799db6b1219 -r 1d0b6500e0e5 gwt-client/src/main/java/org/dive4elements/river/client/server/ProxyServlet.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/ProxyServlet.java	Fri Sep 05 10:10:42 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
- * Software engineering by Intevation GmbH
- *
- * 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.server;
-
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Enumeration;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.apache.http.Header;
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.StatusLine;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.impl.client.DefaultHttpClient;
-
-import org.apache.log4j.Logger;
-
-import org.dive4elements.river.client.server.auth.User;
-
-/**
- * Implements a Proxy for HTTP Requests
- */
-public class ProxyServlet
-extends HttpServlet
-{
-    private static Logger logger = Logger.getLogger(ProxyServlet.class);
-    private String remoteurl;
-
-    @Override
-    public void init(ServletConfig config) {
-        this.remoteurl = config.getInitParameter("remoteurl");
-    }
-
-    @Override
-    public void doPost(HttpServletRequest req, HttpServletResponse resp) {
-    }
-
-    @Override
-    public void doGet(HttpServletRequest req, HttpServletResponse resp)
-    throws IOException {
-        HttpClient httpclient = new DefaultHttpClient();
-
-        String requesturi = req.getRequestURI();
-        String query = req.getQueryString();
-
-        HttpGet httpget = new HttpGet(this.remoteurl + "?" + query);
-
-        boolean debug = logger.isDebugEnabled();
-
-        for (Enumeration e = req.getHeaderNames(); e.hasMoreElements();) {
-            String name = (String)e.nextElement();
-            for (Enumeration f = req.getHeaders(name); f.hasMoreElements();) {
-                String value = (String)f.nextElement();
-                if (debug) {
-                    logger.debug(
-                        "Adding request header " + name + " : " + value);
-                }
-                httpget.addHeader(name, value);
-            }
-        }
-
-        HttpResponse response = httpclient.execute(httpget);
-
-        StatusLine statusline = response.getStatusLine();
-        if (debug) {
-            logger.debug("Response statuscode " + statusline.getStatusCode());
-        }
-        resp.setStatus(statusline.getStatusCode());
-
-        Header[] headers = response.getAllHeaders();
-        for(Header header : headers) {
-            if (debug) {
-                logger.debug(
-                    "Adding response header " + header.getName() +
-                    " : " + header.getValue());
-            }
-            resp.setHeader(header.getName(), header.getValue());
-        }
-
-        HttpEntity entity = response.getEntity();
-        if (entity != null) {
-            InputStream instream = entity.getContent();
-            byte [] buf = new byte[4096];
-            try {
-                OutputStream outstream = resp.getOutputStream();
-                try {
-                    int read;
-                    while ((read = instream.read(buf)) >= 0) {
-                        outstream.write(buf, 0, read);
-                    }
-                    outstream.flush();
-                }
-                finally {
-                    outstream.close();
-                }
-            }
-            finally {
-                instream.close();
-            }
-        }
-    }
-
-    private User getUser(HttpServletRequest req) {
-            HttpSession session = req.getSession();
-            return (User)session.getAttribute("user");
-    }
-}
diff -r f799db6b1219 -r 1d0b6500e0e5 gwt-client/src/main/java/org/dive4elements/river/client/shared/FieldVerifier.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/FieldVerifier.java	Fri Sep 05 10:10:42 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
- * Software engineering by Intevation GmbH
- *
- * 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;
-
-/**
- * <p>
- * FieldVerifier validates that the name the user enters is valid.
- * </p>
- * <p>
- * This class is in the <code>shared</code> package because we use it in both
- * the client code and on the server. On the client, we verify that the name is
- * valid before sending an RPC request so the user doesn't have to wait for a
- * network round trip to get feedback. On the server, we verify that the name is
- * correct to ensure that the input is correct regardless of where the RPC
- * originates.
- * </p>
- * <p>
- * When creating a class that is used on both the client and the server, be sure
- * that all code is translatable and does not use native JavaScript. Code that
- * is note translatable (such as code that interacts with a database or the file
- * system) cannot be compiled into client side JavaScript. Code that uses native
- * JavaScript (such as Widgets) cannot be run on the server.
- * </p>
- */
-public class FieldVerifier {
-
-  /**
-   * Verifies that the specified name is valid for our service.
-   *
-   * In this example, we only require that the name is at least four
-   * characters. In your application, you can use more complex checks to ensure
-   * that usernames, passwords, email addresses, URLs, and other fields have the
-   * proper syntax.
-   *
-   * @param name the name to validate
-   * @return true if valid, false if invalid
-   */
-  public static boolean isValidName(String name) {
-    if (name == null) {
-      return false;
-    }
-    return name.length() > 3;
-  }
-}
diff -r f799db6b1219 -r 1d0b6500e0e5 gwt-client/src/main/java/org/dive4elements/river/client/shared/model/DefaultTheme.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/DefaultTheme.java	Fri Sep 05 10:10:42 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +0,0 @@
-/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
- * Software engineering by Intevation GmbH
- *
- * 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;
-
-/**
- * @author <a href="mailto:ingo.weinzierl at intevation.de">Ingo Weinzierl</a>
- */
-public class DefaultTheme implements Theme {
-
-    protected int position;
-
-    protected int index;
-
-    protected int active;
-
-    protected int visible;
-
-    protected String artifact;
-
-    protected String facet;
-
-    protected String description;
-
-    /** CollectionItem associated with this facet/themes artifact. */
-    protected CollectionItem collectionItem;
-
-
-    public DefaultTheme() {
-    }
-
-
-    public DefaultTheme(
-        int     pos,
-        int     index,
-        int     active,
-        int     visible,
-        String  art,
-        String  facet,
-        String  description)
-    {
-        this.position       = pos;
-        this.index          = index;
-        this.active         = active;
-        this.visible        = visible;
-        this.artifact       = art;
-        this.facet          = facet;
-        this.description    = description;
-        this.collectionItem = null;
-    }
-
-
-    public int getPosition() {
-        return position;
-    }
-
-
-    public void setPosition(int pos) {
-        this.position = pos;
-    }
-
-
-    public int getIndex() {
-        return index;
-    }
-
-
-    public int getActive() {
-        return active;
-    }
-
-
-    public void setActive(int active) {
-        this.active = active;
-    }
-
-
-    public String getArtifact() {
-        return artifact;
-    }
-
-
-    public String getFacet() {
-        return facet;
-    }
-
-
-    public String getDescription() {
-        return description;
-    }
-
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-
-    public int getVisible() {
-        return visible;
-    }
-
-
-    public void setVisible(int visible) {
-        this.visible = visible;
-    }
-
-
-    public boolean equals(Object o) {
-        if (!(o instanceof DefaultTheme)) {
-            return false;
-        }
-
-        DefaultTheme other = (DefaultTheme) o;
-
-        if (other.position != position) {
-            return false;
-        }
-
-        if (!other.artifact.equals(artifact)) {
-            return false;
-        }
-
-        if (other.active != active) {
-            return false;
-        }
-
-        if (!other.facet.equals(facet)) {
-            return false;
-        }
-
-        if (!other.description.equals(description)) {
-            return false;
-        }
-
-        if (other.index != index) {
-            return false;
-        }
-
-        if (other.visible != visible) {
-            return false;
-        }
-
-        return true;
-    }
-
-    /** Get the CollectionItem representing the facets artifact. */
-    @Override
-    public CollectionItem getCollectionItem() {
-        return collectionItem;
-    }
-
-    /** Set the CollectionItem representing the facets artifact. */
-    @Override
-    public void setCollectionItem(CollectionItem ci) {
-        this.collectionItem = ci;
-    }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r f799db6b1219 -r 1d0b6500e0e5 gwt-client/src/main/java/org/dive4elements/river/client/shared/model/DistanceInfoRecord.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/DistanceInfoRecord.java	Fri Sep 05 10:10:42 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
- * Software engineering by Intevation GmbH
- *
- * 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 com.smartgwt.client.widgets.grid.ListGridRecord;
-
-
-/**
- * The DistanceInfoRecord is a wrapper to put DistanceInfo objects into
- * a ListGrid.
- *
- * @author <a href="mailto:raimund.renkert at intevation.de">Raimund Renkert</a>
- */
-public class DistanceInfoRecord extends ListGridRecord {
-
-    /** The artifact collection. */
-    protected DistanceInfoObject distanceInfo;
-
-
-    /**
-     * The default constructor.
-     *
-     * @param info The distance info object.
-     */
-    public DistanceInfoRecord(DistanceInfoObject info) {
-        this.distanceInfo = info;
-
-        setDescription(info.getDescription());
-        setFrom(info.getFrom());
-        if (info.getTo() != null)
-            setTo(info.getTo());
-        else
-            setTo(info.getFrom());
-        setRiverside(info.getRiverside());
-        setBottom(info.getBottom());
-        setTop(info.getTop());
-    }
-
-
-    /**
-     * Sets the creation time.
-     *
-     * @param creationTime The creation time.
-     */
-    public void setDescription(String description) {
-        setAttribute("description", description);
-    }
-
-
-    /**
-     * Returns the description.
-     *
-     * @return the description.
-     */
-    public String getDescription() {
-        return getAttributeAsString("description");
-    }
-
-
-    public void setFrom(double from) {
-        setAttribute("from", from);
-    }
-
-
-    public double getFrom() {
-        return getAttributeAsDouble("from");
-    }
-
-    public void setTo(double to) {
-        setAttribute("to", to);
-    }
-
-
-    public double getTo() {
-        return getAttributeAsDouble("to");
-    }
-
-
-    public void setRiverside(String side) {
-        setAttribute("riverside", side);
-    }
-
-
-    public String getRiverside() {
-        return getAttributeAsString("riverside");
-    }
-
-    public void setBottom(Double bottom) {
-        setAttribute("bottom", bottom != null ? bottom.toString() : "-");
-    }
-
-    public String getBottom() {
-        return getAttributeAsString("bottom");
-    }
-
-    public void setTop(Double top) {
-        setAttribute("top", top != null ? top.toString() : "-");
-    }
-
-    public String getTop() {
-        return getAttributeAsString("top");
-    }
-
-
-    public DistanceInfoObject getDistanceInfo() {
-        return distanceInfo;
-    }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :


More information about the Dive4Elements-commits mailing list