# HG changeset patch # User Raimund Renkert # Date 1403787628 -7200 # Node ID ae16292586929dc472b6325086b2d5d4fde0ceaa # Parent 93da474506e7d9636f175ac448dfb7a0b01be63c# Parent 912cf4ec09d1cffc7a1df888740bd922f704c628 merged. diff -r 912cf4ec09d1 -r ae1629258692 artifacts/doc/conf/meta-data.xml --- a/artifacts/doc/conf/meta-data.xml Thu Jun 26 13:00:18 2014 +0200 +++ b/artifacts/doc/conf/meta-data.xml Thu Jun 26 15:00:28 2014 +0200 @@ -1734,23 +1734,22 @@ FROM bed_height_single bhs JOIN bed_height_single_values bhsv ON bhsv.bed_height_single_id = bhs.id - WHERE bhs.river_id = ${river_id} - AND bhs.year BETWEEN ${year_from} AND ${year_to}), + WHERE bhs.river_id = ${river_id}), csta - AS (SELECT b1.id AS id1, + AS (SELECT b1.id AS b1id, b1.description AS b1desc, b1.year AS b1year, - b2.id AS id2, - b2.description AS b2desv, + b2.id AS b2id, + b2.description AS b2desc, b2.year AS b2year FROM sta b1 JOIN sta b2 ON b1.station = b2.station AND b1.id < b2.id) - SELECT id1, b1desc, b1year, - id2, b2desc, b2year + SELECT DISTINCT b1id, b1desc, b1year, + b2id, b2desc, b2year FROM csta - ORDER BY b1year, b2year + ORDER BY b1desc, b2desc @@ -1763,38 +1762,55 @@ - + - + - + - + - - - TODO: Better structure + + - A - B - - B - A - + + + + + + + + + + + + - + diff -r 912cf4ec09d1 -r ae1629258692 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DatacageWidget.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DatacageWidget.java Thu Jun 26 13:00:18 2014 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DatacageWidget.java Thu Jun 26 15:00:28 2014 +0200 @@ -292,6 +292,20 @@ } + public List getPlainSelection() { + ListGridRecord [] selection = treeGrid.getSelectedRecords(); + List nodes = new ArrayList(); + if (selection != null) { + for (ListGridRecord record: selection) { + if (record instanceof TreeNode) { + nodes.add((TreeNode)record); + } + } + } + return nodes; + } + + /** * Returns the titles of selected items (if any). */ diff -r 912cf4ec09d1 -r ae1629258692 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/BedHeightsDatacagePanel.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/BedHeightsDatacagePanel.java Thu Jun 26 13:00:18 2014 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/BedHeightsDatacagePanel.java Thu Jun 26 15:00:28 2014 +0200 @@ -14,14 +14,17 @@ import com.smartgwt.client.data.Record; +import com.smartgwt.client.util.SC; +import com.smartgwt.client.widgets.Button; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.events.ClickEvent; - +import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.grid.ListGridRecord; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; +import com.smartgwt.client.widgets.tree.TreeNode; import org.dive4elements.river.client.client.Config; import org.dive4elements.river.client.client.FLYSConstants; @@ -35,6 +38,7 @@ import org.dive4elements.river.client.client.ui.DatacagePairWidget; import org.dive4elements.river.client.client.ui.DatacageTwinPanel; +import org.dive4elements.river.client.client.ui.DatacageWidget; import org.dive4elements.river.client.client.ui.RecommendationPairRecord; import org.dive4elements.river.client.shared.model.Artifact; @@ -42,6 +46,7 @@ import org.dive4elements.river.client.shared.model.Data; import org.dive4elements.river.client.shared.model.DataItem; import org.dive4elements.river.client.shared.model.DataList; +import org.dive4elements.river.client.shared.model.ToLoad; import org.dive4elements.river.client.shared.model.Recommendation.Facet; import org.dive4elements.river.client.shared.model.Recommendation.Filter; @@ -80,6 +85,7 @@ RemoveArtifactServiceAsync removeArtifactService = GWT.create( org.dive4elements.river.client.client.services.RemoveArtifactService.class); + protected DatacageWidget datacage; public BedHeightsDatacagePanel(User user) { super(user); @@ -120,14 +126,25 @@ public Canvas create(DataList dataList) { GWT.log("createData()"); - String filter = "minfo-heights"; + String filter = "minfo-heights-diff"; Canvas widget = createWidget(); Canvas submit = getNextButton(); + datacage = new DatacageWidget( + this.artifact, user, filter, "load-system:true", false); + + Button plusBtn = new Button(MSG.datacage_add_pair()); + plusBtn.setAutoFit(true); + plusBtn.addClickHandler(new ClickHandler() { + @Override + public void onClick(ClickEvent event) { + plusClicked(); + } + }); VLayout layout = new VLayout(); - HLayout helperLayout = new HLayout(); - helperLayout.addMember(new DatacagePairWidget(this.artifact, - user, filter, differencesList)); + VLayout helperLayout = new VLayout(); + helperLayout.addMember(datacage); + helperLayout.addMember(plusBtn); layout.addMember(widget); layout.addMember(submit); @@ -306,5 +323,53 @@ + recommendation.getDisplayName() + "]"; } } + + /** + * Callback for add-button. + * Fires to load for every selected element and handler. + */ + public void plusClicked() { + List selection = datacage.getPlainSelection(); + + if (selection == null || selection.isEmpty()) { + SC.say(MSG.warning()); + return; + } + + for (TreeNode node : selection) { + ToLoad toLoad1 = new ToLoad(); + ToLoad toLoad2 = new ToLoad(); + + String factory = node.getAttribute("factory"); + if (factory != null) { // we need at least a factory + String artifact = node.getAttribute("artifact-id"); + String out = node.getAttribute("out"); + String name = node.getAttribute("facet"); + String ids = node.getAttribute("ids"); + String info = node.getAttribute("info"); + String targetOut = node.getAttribute("target_out"); + + String[] splitIds = ids.split("#"); + String[] splitInfo = info.split("#"); + toLoad1.add(artifact, + factory, + out, + name, + splitIds[0], + splitInfo[0], + targetOut); + toLoad2.add(artifact, + factory, + out, + name, + splitIds[1], + splitInfo[1], + targetOut); + } + differencesList.addData(new RecommendationPairRecord( + toLoad1.toRecommendations().get(0), + toLoad2.toRecommendations().get(0))); + } + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :