FieldArithmetics Add-on
Arithmetic field extension
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); } });
Links
Compatibility
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 extensionIssue Tracker
Source Code
FieldArithmetics Add-on version 0.0.1
null
FieldArithmetics Add-on version 0.0.2
Replaced the EvenInterceptor with an EventDispatcher that catches change events before Vaadin handles them. This should cause less problems in the framework which in some cases relies on DOM.getEventListener returning a Widget.
Because the EventDispatcher must be registered before any GWT events occur the add-on widget set must be inherited before the Vaadin DefaultWidgetset or the etension will not work when the Vaadin debug window is enabled.
E.g. edit your gwt.xml to look something like this:
FieldArithmetics Add-on version 0.0.3
Removed vaadin-client-compiler dependency