Mercurial > dive4elements > river
changeset 8531:3e6d4bd1c06e
(issue1051) Add input support for epochs
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Wed, 11 Feb 2015 12:41:51 +0100 |
parents | 9e66aa006b42 |
children | 73a4c3c202e5 |
files | gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadEpochPanel.java |
diffstat | 1 files changed, 32 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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; }