Package net.rim.device.api.ui.picker

Examples of net.rim.device.api.ui.picker.DateTimePicker


     *            Type of spinner to display
     */
    void showSpinnerDialog(final int type) {
        switch (type) {
        case DEFAULT:
            final DateTimePicker datePicker =
                    DateTimePicker.createInstance(_defaultCal);
            if (datePicker.doModal()) {
                final StringBuffer dateStr = new StringBuffer();
                _defaultCal = datePicker.getDateTime();
                _defaultDateFormat.format(_defaultCal, dateStr, null);
                _editFieldDefault.setText(dateStr.toString());
            }
            break;
        case DATE:
            final DateTimePicker datePickerDate =
                    DateTimePicker.createInstance(_dateCal, "yyyy-MM-dd", null);
            if (datePickerDate.doModal()) {
                final StringBuffer dateStrDate = new StringBuffer();
                _dateCal = datePickerDate.getDateTime();
                _dateFormat.format(_dateCal, dateStrDate, null);
                _editFieldDate.setText(dateStrDate.toString());
            }
            break;
        case TIME:
            final DateTimePicker datePickerTime =
                    DateTimePicker
                            .createInstance(_timeCal, null, "hh:mm:ss aa");
            if (datePickerTime.doModal()) {
                final StringBuffer dateStrTime = new StringBuffer();
                _timeCal = datePickerTime.getDateTime();
                _timeFormat.format(_timeCal, dateStrTime, null);
                _editFieldTime.setText(dateStrTime.toString());
            }
            break;
        case LONG:
            final DateTimePicker datePickerLong =
                    DateTimePicker.createInstance(_longDateCal,
                            DateFormat.DATE_LONG, DateFormat.TIME_DEFAULT);
            if (datePickerLong.doModal()) {
                final StringBuffer dateStrLong = new StringBuffer();
                _longDateCal = datePickerLong.getDateTime();
                _longDateFormat.format(_longDateCal, dateStrLong, null);
                _editFieldLong.setText(dateStrLong.toString());
            }
            break;
        case EXPIRY:
            final DateTimePicker datePickerExpiry =
                    DateTimePicker.createInstance(_expiryDateCal,
                            _expiryDateFormat.toPattern(), null);
            if (datePickerExpiry.doModal()) {
                final StringBuffer dateStrExpiry = new StringBuffer();
                _expiryDateCal = datePickerExpiry.getDateTime();
                _expiryDateFormat.format(_expiryDateCal, dateStrExpiry, null);
                _editFieldExpiry.setText(dateStrExpiry.toString());
            }
            break;
        case SPINBOX:
View Full Code Here

TOP

Related Classes of net.rim.device.api.ui.picker.DateTimePicker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.