Mercurial > dive4elements > river
changeset 1573:0fbbcec35462
Improved spinner-behaviour in cross section km control.
flys-client/trunk@3838 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 31 Jan 2012 14:10:23 +0000 |
parents | 60f8edc7a6f0 |
children | 465f72f68cee |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java |
diffstat | 2 files changed, 41 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Tue Jan 31 13:04:51 2012 +0000 +++ b/flys-client/ChangeLog Tue Jan 31 14:10:23 2012 +0000 @@ -1,3 +1,10 @@ +2012-01-31 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + * src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java: + Added documentation, minor cleanup. + Added KeyPressHandler to km-spinnerItem, lose focus on + Enter-KeyPress. + 2012-01-31 Felix Wolfsteller <felix.wolfsteller@intevation.de> * src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java Tue Jan 31 13:04:51 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java Tue Jan 31 14:10:23 2012 +0000 @@ -32,6 +32,8 @@ import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; import com.smartgwt.client.widgets.form.fields.events.ChangeHandler; import com.smartgwt.client.widgets.form.fields.events.ChangeHandler; +import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent; +import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler; import com.smartgwt.client.widgets.menu.Menu; import com.smartgwt.client.widgets.menu.MenuItem; @@ -94,6 +96,7 @@ /** Combobox for master artifacts.*/ protected SelectItem masterCb; + /** * Trivial constructor. */ @@ -225,7 +228,8 @@ feedData, new AsyncCallback<Artifact>() { public void onFailure(Throwable caught) { - GWT.log("Could not un-master artifact ("+getCurrentCSMaster()+"): " + + GWT.log("Could not un-master artifact (" + + getCurrentCSMaster() + "): " + caught.getMessage()); SC.warn(MSG.getString(caught.getMessage())); enable(); @@ -288,8 +292,14 @@ return bestMatch; } - /** Feed a single artifact with the km of the crosssection to display. - * If its the selected master, also feed the collectionmaster. */ + + /** + * Feed a single artifact with the km of the crosssection to display. + * If its the selected master, also feed the collectionmaster. + * + * @param artifacts List of artifacts to feed. + * @param kmD The km to set. + */ public void sendFeed(final List<Artifact> artifacts, final double kmD) { Config config = Config.getInstance(); final String locale = config.getLocale(); @@ -319,8 +329,13 @@ }); } - /** Feed a single artifact with the km of the crosssection to display. - * If its the selected master, also feed the collectionmaster. */ + + /** + * Feed a single artifact with the km of the crosssection to display. + * If its the selected master, also feed the collectionmaster. + * @param artUUID The UUID of the artifact to feed. + * @param kmD The km to set. + */ public void sendFeed(final String artUUID, final double kmD) { Config config = Config.getInstance(); final String locale = config.getLocale(); @@ -350,9 +365,11 @@ }); } + public void spinnerValueEntered(final SpinnerItem item, final double enteredKm, final FacetRecord facetRecord ) { + disable(); Config config = Config.getInstance(); final String locale = config.getLocale(); @@ -370,7 +387,6 @@ map.put(dbid, enteredKm); - disable(); kmService.getCrossSectionKMs(locale, map, 2, new AsyncCallback<Map<Integer, Double[]>>() { @@ -380,7 +396,7 @@ + dbid + ": "+ caught.getMessage()); SC.warn(MSG.getString(caught.getMessage())); updateCollection(); - updateGrid(); + //updateGrid(); enable(); } @Override @@ -496,9 +512,9 @@ HLayout recordCanvas = new HLayout(3); recordCanvas.setHeight(22); recordCanvas.setAlign(Alignment.CENTER); + + // When losing focus, update values. final SpinnerItem spinnerItem = createSpinnerItem(facetRecord); - //spinnerItem.addChangedHandler( - // createSpinnerHandler(feedService, facetRecord)); spinnerItem.addBlurHandler(new BlurHandler() { @Override public void onBlur (BlurEvent be) { @@ -508,6 +524,15 @@ } }); + // Add KeyPressHandler to lose focus when Enter key is pressed. + spinnerItem.addKeyPressHandler(new KeyPressHandler(){ + public void onKeyPress(KeyPressEvent kpe) { + if (kpe.getKeyName().equals("Enter")) { + spinnerItem.blurItem(); + } + } + }); + DynamicForm formWrap = new DynamicForm(); formWrap.setFields(spinnerItem); formWrap.setTitlePrefix("");