How do I force Metawidget to display a date selection widget instead of a number widget for timestamp properties? -


metawidget creates date selection widgets if property type java.util.date. in case, pojo contains timestamps of type long.

public class node {     private long created;     private long lastmodified;     /* ... */ }  node node = new node(); vaadinmetawidget metawidget = new vaadinmetawidget(); metawidget.settoinspect(node); 

how configure metawidget particular long property rendered date selection widget?

you need hook in custom widgetbuilder this. custom widgetbuilder need worry creating date widget 'long', , can return null else:

your custom widgetbuilder needs like:

public class mywidgetbuilder implements widgetbuilder<component, vaadinmetawidget> {     public component buildwidget( string elementname, map<string, string> attributes, vaadinmetawidget metawidget ) {         if ( "long".equals( attributes.get( type ))) {             return new popupdatefield();         }         return null;     } 

}

then wrap inside compositewidgetbuilder metawidget 'falls back' regular vaadinwidgetbuilder else. here's example: http://metawidget.org/doc/reference/en/html/ch02s04.html#section-architecture-widgetbuilders-implementing-your-own

vaadinmetawidget has default widgetbuilders already, may want include too. here defaults: http://metawidget.org/doc/reference/en/html/ch02s04.html#section-architecture-widgetbuilders-defaults


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -