# HG changeset patch # User Andre Heinecke # Date 1423654911 -3600 # Node ID 3e6d4bd1c06e8887c175b36c1e7a1c7dbc491563 # Parent 9e66aa006b4231eb2ec62b3f067935d6351651f7 (issue1051) Add input support for epochs diff -r 9e66aa006b42 -r 3e6d4bd1c06e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadEpochPanel.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadEpochPanel.java Fri Jan 30 15:21:35 2015 +0100 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadEpochPanel.java Wed Feb 11 12:41:51 2015 +0100 @@ -33,6 +33,7 @@ import com.smartgwt.client.widgets.layout.VLayout; import org.dive4elements.river.client.client.Config; +import org.dive4elements.river.client.client.FLYSConstants; import org.dive4elements.river.client.client.services.SedimentLoadInfoService; import org.dive4elements.river.client.client.services.SedimentLoadInfoServiceAsync; import org.dive4elements.river.client.client.ui.AbstractUIProvider; @@ -52,6 +53,8 @@ protected SedimentLoadInfoServiceAsync sedLoadInfoService = GWT.create(SedimentLoadInfoService.class); + protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class); + protected ListGrid elements; private TextItem start; private TextItem end; @@ -206,6 +209,34 @@ sedLoadTable.setEmptyMessage(MSG.empty_table()); sedLoadTable.setCanReorderFields(false); + /* Input support pins */ + String baseUrl = GWT.getHostPageBaseURL(); + ListGridField pinFrom = new ListGridField ("fromIcon", MESSAGES.from()); + pinFrom.setWidth (30); + pinFrom.setType (ListGridFieldType.ICON); + pinFrom.setCellIcon(baseUrl + MESSAGES.markerGreen()); + + ListGridField pinTo = new ListGridField ("toIcon", MESSAGES.to()); + pinTo.setType (ListGridFieldType.ICON); + pinTo.setWidth (30); + pinTo.setCellIcon(baseUrl + MESSAGES.markerRed()); + + pinFrom.addRecordClickHandler (new RecordClickHandler () { + @Override + public void onRecordClick (RecordClickEvent e) { + Record r = e.getRecord(); + start.setValue(r.getAttribute("date")); + } + }); + pinTo.addRecordClickHandler (new RecordClickHandler () { + @Override + public void onRecordClick (RecordClickEvent e) { + Record r = e.getRecord(); + end.setValue(r.getAttribute("date")); + } + }); + + ListGridField date = new ListGridField("date", MSG.year()); date.setType(ListGridFieldType.TEXT); date.setWidth(100); @@ -215,7 +246,7 @@ descr.setType(ListGridFieldType.TEXT); descr.setWidth("*"); - sedLoadTable.setFields(date, descr); + sedLoadTable.setFields(pinFrom, pinTo, date, descr); return sedLoadTable; }