[Dive4elements-commits] [PATCH] merged changes from default into double-precision branch
Wald Commits
scm-commit at wald.intevation.org
Tue Jun 11 13:17:28 CEST 2013
# HG changeset patch
# User Tom Gottfried <tom.gottfried at intevation.de>
# Date 1370949438 -7200
# Branch double-precision
# Node ID 3d8f9e3bbf2e294f78360518fcc0a758dbeb0267
# Parent e7526a074c0d5c692186c30444826e3d34730645
# Parent 24be0cc1c67cf11ee1fd66023dcb041b9c77f752
merged changes from default into double-precision branch
diff -r e7526a074c0d -r 3d8f9e3bbf2e artifacts/src/main/java/org/dive4elements/river/artifacts/model/FastCrossSectionChunk.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/FastCrossSectionChunk.java Tue Jun 11 13:03:50 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/FastCrossSectionChunk.java Tue Jun 11 13:17:18 2013 +0200
@@ -53,6 +53,7 @@
}
}
+ /** Finds the FastCrossSectionLine at km (null if not found). */
public FastCrossSectionLine getCrossSectionLine(double km) {
FastCrossSectionLine key = new FastCrossSectionLine(km);
int pos = Collections.binarySearch(
diff -r e7526a074c0d -r 3d8f9e3bbf2e backend/src/main/java/org/dive4elements/river/importer/parsers/W80CSVParser.java
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/W80CSVParser.java Tue Jun 11 13:03:50 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/W80CSVParser.java Tue Jun 11 13:17:18 2013 +0200
@@ -214,7 +214,7 @@
this.lastPointGK[0] = gkr;
this.lastPointGK[1] = gkh;
- currentLine.add(new XY(totalX, height/1000d, index));
+ currentLine.add(new XY(totalX, height, index));
return true;
}
diff -r e7526a074c0d -r 3d8f9e3bbf2e backend/src/main/java/org/dive4elements/river/model/CrossSection.java
--- a/backend/src/main/java/org/dive4elements/river/model/CrossSection.java Tue Jun 11 13:03:50 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/model/CrossSection.java Tue Jun 11 13:17:18 2013 +0200
@@ -51,7 +51,7 @@
"ON csp.cross_section_line_id = csl.id " +
"WHERE csl.cross_section_id = :cs_id AND " +
"km between :from_km AND :to_km " +
- "ORDER BY csl.id, csp.col_pos";
+ "ORDER BY csl.km, csl.id, csp.col_pos";
private Integer id;
private River river;
@@ -141,6 +141,7 @@
return query.list();
}
+ /** Get Lines from startkm to endkm, fast because direct usage of sql. */
public List<FastCrossSectionLine> getFastLines(
double startKm,
double endKm
diff -r e7526a074c0d -r 3d8f9e3bbf2e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/RiverInfoPanel.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/RiverInfoPanel.java Tue Jun 11 13:03:50 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/RiverInfoPanel.java Tue Jun 11 13:17:18 2013 +0200
@@ -10,18 +10,17 @@
import java.util.Iterator;
+import org.dive4elements.river.client.client.FLYS;
+import org.dive4elements.river.client.client.FLYSConstants;
+import org.dive4elements.river.client.shared.model.RiverInfo;
+
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.NumberFormat;
-import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
-import com.google.gwt.user.client.ui.HTML;
-
-import org.dive4elements.river.client.client.FLYS;
-import org.dive4elements.river.client.client.FLYSConstants;
-
-import org.dive4elements.river.client.shared.model.RiverInfo;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.LinkItem;
/**
* Panel to display information about a river.
@@ -98,8 +97,12 @@
String url = number != null ?
MSG.gauge_river_url() + number :
MSG.gauge_river_url();
- add(new HTML(WikiLinks.linkHTML(this.flys, url,
- MSG.gauge_river_info_link())));
+ DynamicForm infoLink = WikiLinks.linkHTML(this.flys, url,
+ MSG.gauge_river_info_link());
+ infoLink.setTop(5);
+ LinkItem item = (LinkItem)infoLink.getField("saml");
+ item.setTextBoxStyle("font-size: large;");
+ add(infoLink);
}
public static int getStaticHeight() {
diff -r e7526a074c0d -r 3d8f9e3bbf2e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WQAdaptedInputPanel.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WQAdaptedInputPanel.java Tue Jun 11 13:03:50 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WQAdaptedInputPanel.java Tue Jun 11 13:17:18 2013 +0200
@@ -198,6 +198,10 @@
tabs.disableTab(i*2+1);
}
+ // Defaults at "Q", first input field.
+ tabs.selectTab(0);
+ enableQTabs();
+
helperContainer.addMember(tabs);
}
diff -r e7526a074c0d -r 3d8f9e3bbf2e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WikiLinks.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WikiLinks.java Tue Jun 11 13:03:50 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WikiLinks.java Tue Jun 11 13:17:18 2013 +0200
@@ -8,6 +8,11 @@
package org.dive4elements.river.client.client.ui;
+import com.smartgwt.client.types.FormMethod;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.LinkItem;
+import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
+import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
@@ -37,29 +42,35 @@
}
}
- public static String linkHTML(FLYS flys, String url, String text) {
+ public static DynamicForm linkHTML(FLYS flys, String url, String text) {
String saml = flys.getCurrentUser().getSamlXMLBase64();
String quotedUrl = SafeHtmlUtils.htmlEscape(url);
String quotedText = SafeHtmlUtils.htmlEscape(text);
if (saml != null) {
- return "<form method=\"POST\" target=\"_blank\" action=\""
- + quotedUrl + "\">"
- + "<input type=\"hidden\" name=\"saml\" value=\""
- + SafeHtmlUtils.htmlEscape(saml) + "\">"
- + "<input type=\"submit\" value=\"" + quotedText + "\">"
- + "</form>";
+ final DynamicForm form = new DynamicForm();
+ form.setMethod(FormMethod.POST);
+ form.setTarget("_blank");
+ form.setAction(quotedUrl);
+ form.setCanSubmit(true);
+ LinkItem item = new LinkItem("saml");
+ item.setShowTitle(false);
+ item.setLinkTitle(quotedText);
+ item.setValue(SafeHtmlUtils.htmlEscape(saml));
+ item.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ form.submitForm();
+ }
+ });
+ form.setFields(item);
+ return form;
}
else {
- return "<a href=\"" + quotedUrl + "\">" + quotedText + "</a>";
+ DynamicForm form = new DynamicForm();
+ LinkItem item = new LinkItem(quotedText);
+ item.setShowTitle(false);
+ item.setTarget(quotedUrl);
+ return form;
}
}
-
- public static CellFormatter cellFormatter(final FLYS flys) {
- return new CellFormatter() {
- public String format(Object value, ListGridRecord record,
- int rowNum, int colNum) {
- return linkHTML(flys, (String)value, record.getLinkText());
- }
- };
- }
}
diff -r e7526a074c0d -r 3d8f9e3bbf2e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugeListGrid.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugeListGrid.java Tue Jun 11 13:03:50 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugeListGrid.java Tue Jun 11 13:17:18 2013 +0200
@@ -15,6 +15,7 @@
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.WidgetCanvas;
+import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
@@ -43,12 +44,12 @@
ListGridField sfield = new ListGridField("kmstart", "Start [km]", 60);
ListGridField efield = new ListGridField("kmend", "Ende [km]", 60);
ListGridField stfield = new ListGridField("station", "Station [km]");
- ListGridField lfield = new ListGridField("link", "Info");
- lfield.setType(ListGridFieldType.LINK);
- lfield.setCellFormatter(WikiLinks.cellFormatter(flys));
+ ListGridField lfield = new ListGridField("infolink", "Info");
ListGridField cfield = new ListGridField("curvelink", MSG.gauge_curve_link());
cfield.addRecordClickHandler(this);
+ this.setShowRecordComponents(true);
+ this.setShowRecordComponentsByCell(true);
this.setFields(nfield, sfield, efield, stfield, lfield, cfield);
}
diff -r e7526a074c0d -r 3d8f9e3bbf2e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/InfoListGrid.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/InfoListGrid.java Tue Jun 11 13:03:50 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/InfoListGrid.java Tue Jun 11 13:17:18 2013 +0200
@@ -16,6 +16,7 @@
import org.dive4elements.river.client.client.FLYS;
import org.dive4elements.river.client.client.FLYSConstants;
+import org.dive4elements.river.client.client.ui.WikiLinks;
import org.dive4elements.river.client.shared.model.Data;
import org.dive4elements.river.client.shared.model.DataList;
import org.dive4elements.river.client.shared.model.RiverInfo;
@@ -38,6 +39,23 @@
this.setCanExpandMultipleRecords(true);
}
+ @Override
+ protected Canvas createRecordComponent(
+ final ListGridRecord record,
+ Integer colNum
+ ) {
+ String name = this.getFieldName(colNum);
+ if (name.equals("infolink")) {
+ return WikiLinks.linkHTML(
+ flys,
+ record.getAttribute("link"),
+ record.getLinkText());
+ }
+ else {
+ return null;
+ }
+ }
+
public void openAll() {
GWT.log("InfoListGrid - openAll");
for (ListGridRecord record: this.getRecords()) {
diff -r e7526a074c0d -r 3d8f9e3bbf2e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationListGrid.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationListGrid.java Tue Jun 11 13:03:50 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationListGrid.java Tue Jun 11 13:17:18 2013 +0200
@@ -39,11 +39,12 @@
ListGridField sfield = new ListGridField("kmstart", "Start [km]", 60);
ListGridField efield = new ListGridField("kmend", "Ende [km]", 60);
ListGridField stfield = new ListGridField("station", "Station [km]");
- ListGridField lfield = new ListGridField("link", "Link");
- lfield.setType(ListGridFieldType.LINK);
- lfield.setCellFormatter(WikiLinks.cellFormatter(flys));
+ ListGridField lfield = new ListGridField("infolink", "Link");
ListGridField cfield = new ListGridField("curvelink", "SQ");
cfield.addRecordClickHandler(this);
+
+ this.setShowRecordComponents(true);
+ this.setShowRecordComponentsByCell(true);
this.setFields(nfield, sfield, efield, stfield, lfield, cfield);
}
@@ -112,4 +113,15 @@
flys.newSQRelation(station.getRiverName(), station.getID());
}
+ @Override
+ public String getCellCSSText(ListGridRecord record, int rowNum,
+ int colNum) {
+ if (colNum == 6) {
+ return "text-decoration: underline; color: #0000EE; cursor: pointer;";
+ }
+ else {
+ return super.getCellCSSText(record, rowNum, colNum);
+ }
+ }
+
}
More information about the Dive4elements-commits
mailing list