# HG changeset patch # User Felix Wolfsteller # Date 1328777460 0 # Node ID 07c38d054f91acf391e1cd2613f0412346ec6989 # Parent 592751b635e38c2fbb3ca618c80f1dc195c44310 Translate data item in locationpanel label. flys-client/trunk@3984 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 592751b635e3 -r 07c38d054f91 flys-client/ChangeLog --- a/flys-client/ChangeLog Thu Feb 09 08:47:39 2012 +0000 +++ b/flys-client/ChangeLog Thu Feb 09 08:51:00 2012 +0000 @@ -1,3 +1,11 @@ +2012-02-09 Felix Wolfsteller + + * src/main/java/de/intevation/flys/client/client/ui/LocationPanel.java, + src/main/java/de/intevation/flys/client/client/ui/MultipleLocationPanel.java: + Minor refactoring, cosmetics and documentation. + Also use translated data item name as label instead of fixed + "location" string. + 2012-02-09 Felix Wolfsteller * src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties, diff -r 592751b635e3 -r 07c38d054f91 flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationPanel.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationPanel.java Thu Feb 09 08:47:39 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationPanel.java Thu Feb 09 08:51:00 2012 +0000 @@ -71,7 +71,8 @@ VLayout layout = new VLayout(); layout.setMembersMargin(10); - Label label = new Label(MSG.location ()); + // Subclass uses translated data items name as label. + Label label = new Label(MSG.location()); Canvas widget = createWidget(data); Canvas submit = getNextButton(); @@ -88,11 +89,13 @@ } + /** Store label of first data item in list. */ public void findDataItemName(DataList list) { this.dataItemName = list.getAll().get(0).getLabel(); } + /** Get label of first data item that this uiprovider has seen. */ public String getDataItemName() { return this.dataItemName; } @@ -117,6 +120,7 @@ Canvas back = getBackButton(dataList.getState()); + // TODO evaluate: isn't this what findDataItemName is doing? Label selected = new Label(loc[0].getLabel()); selected.setWidth("130px"); @@ -209,7 +213,7 @@ protected Canvas createWidget(DataList data) { VLayout layout = new VLayout(); - inputLayout = new HLayout(); + inputLayout = new HLayout(); // The initial view will display the location input mode. locationPanel = new DoubleArrayPanel( @@ -227,14 +231,12 @@ inputLayout.setMembersMargin(30); + /* //picker.prepareFilter(); - - /* helperContainer.addMember(picker.getLocationTable()); helperContainer.addMember(picker.getFilterLayout()); helperContainer.addMember(picker.getResultCountForm()); */ - //createInputPanel(); return layout; } diff -r 592751b635e3 -r 07c38d054f91 flys-client/src/main/java/de/intevation/flys/client/client/ui/MultipleLocationPanel.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/MultipleLocationPanel.java Thu Feb 09 08:47:39 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/MultipleLocationPanel.java Thu Feb 09 08:51:00 2012 +0000 @@ -53,6 +53,7 @@ * then entered in the texfield. */ protected LocationPicker picker; + /** * Creates a new LocationDistancePanel instance. */ @@ -77,7 +78,16 @@ VLayout layout = new VLayout(); layout.setMembersMargin(10); - Label label = new Label(MSG.location ()); + // Take translated data item name as label, if translation available. + String labelString; + try { + labelString = MSG.getString(getDataItemName()); + } + catch(java.util.MissingResourceException mre) { + GWT.log("Cannot find translation for data item name : " + getDataItemName()); + labelString = MSG.location(); + } + Label label = new Label(labelString); Canvas widget = createWidget(data); Canvas submit = getNextButton(); @@ -224,9 +234,9 @@ /** - * This method returns the selected data. + * This method returns the selected data (to feed). * - * @return the selected/inserted data. + * @return the selected/inserted data in feedable form. */ public Data[] getData() { saveLocationValues(locationPanel); @@ -281,6 +291,7 @@ url, river, "locations")); } + // TODO allow multiple selections here or in LocationPanel /** * Callback when an item from the input helper was clicked.