Java Code Examples for com.codename1.ui.Display#PICKER_TYPE_TIME
The following examples show how to use
com.codename1.ui.Display#PICKER_TYPE_TIME .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UiBinding.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
@Override public void assignTo(PropertyType value, Picker cmp) { switch(cmp.getType()) { case Display.PICKER_TYPE_DATE: case Display.PICKER_TYPE_DATE_AND_TIME: cmp.setDate((Date)toComponentType.convert(value)); break; case Display.PICKER_TYPE_TIME: cmp.setTime((Integer)toComponentType.convert(value)); break; case Display.PICKER_TYPE_STRINGS: if(value instanceof Integer) { cmp.setSelectedStringIndex((Integer)toComponentType.convert(value)); } else { cmp.setSelectedString((String)toComponentType.convert(value)); } break; } }
Example 2
Source File: UiBinding.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
@Override public PropertyType getFrom(Picker cmp) { switch(cmp.getType()) { case Display.PICKER_TYPE_DATE: case Display.PICKER_TYPE_DATE_AND_TIME: return (PropertyType)toPropertyType.convert(cmp.getDate()); case Display.PICKER_TYPE_TIME: return (PropertyType)toPropertyType.convert(cmp.getTime()); case Display.PICKER_TYPE_STRINGS: if(toPropertyType instanceof IntegerConverter) { return (PropertyType)new Integer(cmp.getSelectedStringIndex()); } return (PropertyType)toPropertyType.convert(cmp.getSelectedString()); } throw new RuntimeException("Illegal state for picker binding"); }
Example 3
Source File: UiBinding.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
private static ObjectConverter pickerTypeToConverter(int type) { switch(type) { case Display.PICKER_TYPE_DATE: case Display.PICKER_TYPE_DATE_AND_TIME: return new DateConverter(); case Display.PICKER_TYPE_TIME: return new IntegerConverter(); case Display.PICKER_TYPE_STRINGS: return new StringConverter(); } throw new IllegalArgumentException("Unsupported picker type: " + type); }
Example 4
Source File: Picker.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
/** * Checks if the given type is supported in LightWeight mode. * @param type The type. Expects one of the Display.PICKER_XXX constants. * @return True if the given type is supported in lightweight mode. */ private static boolean isLightweightModeSupportedForType(int type) { switch (type) { case Display.PICKER_TYPE_STRINGS: case Display.PICKER_TYPE_DATE: case Display.PICKER_TYPE_TIME: case Display.PICKER_TYPE_DATE_AND_TIME: case Display.PICKER_TYPE_DURATION: case Display.PICKER_TYPE_DURATION_HOURS: case Display.PICKER_TYPE_DURATION_MINUTES: case Display.PICKER_TYPE_CALENDAR: return true; } return false; }