Directory

← Back

FieldArithmetics Add-on

Arithmetic field extension

Author

Contributors

Rating

FieldArithmetics is an extension add-on that evaluates simple calculations on the client-side before the field value is sent to the server side. in addition to the basic operations: +, -, /, *. (plus, minus, division, multiplication) it also has limited support for ^ (power operator), parenthesis and locale (thousand and decimal separators) auto guessing.

Field types it can extend are: TextField, TextArea and various Stepper add-on's fields.

This add-on uses a custom EventDispatcher that must be registered to the GWT event system before the Vaadin debug windows is opened or the extension will not work when the debug window is open. Because of this, make sure the add-on widget set must be inherited before the Vaadin DefaultWidgetset.

E.g. edit your gwt.xml to look something like this:

<inherits name="org.vaadin.addons.jonni.fieldarithmetics.WidgetSet" /> <inherits name="com.vaadin.DefaultWidgetSet" />

Sample code

final TextField tf = new TextField();
FieldArithmetics.extend(tf);

tf.addValueChangeListener(new ValueChangeListener() {

	@Override
	public void valueChange(ValueChangeEvent event) {
		Notification.show("Value now: " + tf.getValue(),
				Notification.Type.TRAY_NOTIFICATION);

	}
});

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Removed vaadin-client-compiler dependency

Released
2015-01-15
Maturity
EXPERIMENTAL
License
Apache License 2.0

Compatibility

Framework
Vaadin 7.0+
Browser
Browser Independent

FieldArithmetics Add-on - Vaadin Add-on Directory

Arithmetic field extension FieldArithmetics Add-on - Vaadin Add-on Directory
FieldArithmetics is an extension add-on that evaluates simple calculations on the client-side before the field value is sent to the server side. in addition to the basic operations: +, -, /, *. (plus, minus, division, multiplication) it also has limited support for ^ (power operator), parenthesis and locale (thousand and decimal separators) auto guessing. Field types it can extend are: TextField, TextArea and various Stepper add-on's fields. This add-on uses a custom EventDispatcher that must be registered to the GWT event system before the Vaadin debug windows is opened or the extension will not work when the debug window is open. Because of this, make sure the add-on widget set must be inherited before the Vaadin DefaultWidgetset. E.g. edit your gwt.xml to look something like this: ```` ````
Online