Package org.apache.pivot.util

Examples of org.apache.pivot.util.CalendarDate$Range


        @Override
        public void render(Object item, Spinner spinner) {
            Calendar calendar = (Calendar)getComponent();

            // Since we're only rendering the month, the year and day do not matter here
            CalendarDate date = new CalendarDate(2000, (Integer)item, 0);

            SimpleDateFormat monthFormat = new SimpleDateFormat("MMMM", calendar.getLocale());
            item = monthFormat.format(date.toCalendar().getTime());

            super.render(item, spinner);
        }
View Full Code Here


    }

    private static class DateButtonDataRenderer extends ButtonDataRenderer {
        @Override
        public void render(Object data, Button button, boolean highlighted) {
            CalendarDate date = (CalendarDate)data;
            super.render(date.day + 1, button, highlighted);

            if (button.isSelected()) {
                label.getStyles().put("color", button.getStyles().get("selectionColor"));
            }
View Full Code Here

            public void selectionChanged(ButtonGroup buttonGroup, Button previousSelection) {
                Calendar calendar = (Calendar)getComponent();

                Button selection = buttonGroup.getSelection();
                if (selection == null) {
                    CalendarDate selectedDate = calendar.getSelectedDate();

                    // If no date was selected, or the selection changed as a
                    // result of the user toggling the date button (as opposed
                    // to changing the month or year), clear the selection
                    if (selectedDate == null
View Full Code Here

                } else {
                    day = k - firstIndex;
                    enabled = true;
                }

                CalendarDate buttonData = new CalendarDate(year, month, day);
                dateButton.setButtonData(buttonData);
                dateButton.setEnabled(enabled
                    && (disabledDateFilter == null
                        || !disabledDateFilter.include(buttonData)));
            }
        }

        // Show/hide last row
        CalendarDate lastWeekStartDate = (CalendarDate)dateButtons[5][0].getButtonData();
        boolean visible = (lastWeekStartDate.month == calendar.getMonth());
        for (Component component : calendarTablePane.getRows().get(7)) {
            component.setVisible(visible);
        }

        today = new CalendarDate();
        updateSelection(calendar.getSelectedDate());
    }
View Full Code Here

        bxmlSerializer.bind(this, CalendarTest.class);

        Filter<CalendarDate> todayFilter = new Filter<CalendarDate>() {
            @Override
            public boolean include(CalendarDate date) {
                CalendarDate today = new CalendarDate();
                return (!date.equals(today));
            }
        };

        calendar.setDisabledDateFilter(todayFilter);
View Full Code Here

        }
    }

    private Component addCalendarDateControl(final Dictionary<String, Object> dictionary,
        final String key, Form.Section section) {
        CalendarDate calendarDate = (CalendarDate)dictionary.get(key);

        CalendarButton calendarButton = new CalendarButton();
        calendarButton.setMinimumWidth(75);
        calendarButton.setSelectedDate(calendarDate);
        section.add(calendarButton);
View Full Code Here

    private void updateCalendarDateControl(Dictionary<String, Object> dictionary, String key) {
        CalendarButton calendarButton = (CalendarButton)controls.get(key);

        if (calendarButton != null) {
            CalendarDate value = (CalendarDate)dictionary.get(key);
            calendarButton.setSelectedDate(value);
        }
    }
View Full Code Here

    /**
     * Creates a new <tt>CalendarDateSpinnerData</tt> bounded from
     * <tt>1900-01-01</tt> to <tt>2099-12-31</tt>.
     */
    public CalendarDateSpinnerData() {
        this(new CalendarDate(1900, 0, 0), new CalendarDate(2099, 11, 30));
    }
View Full Code Here

        // Calculate the desired fields
        int year = calendar.get(Calendar.YEAR);
        int month = calendar.get(Calendar.MONTH);
        int day = calendar.get(Calendar.DAY_OF_MONTH) - 1;

        return new CalendarDate(year, month, day);
    }
View Full Code Here

        if (data == null) {
            data = "";
        } else {
            if (data instanceof CalendarDate) {
                CalendarDate date = (CalendarDate)data;

                DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
                data = dateFormat.format(date.toCalendar().getTime());
            }
        }

        super.render(data, button, highlight);
    }
View Full Code Here

TOP

Related Classes of org.apache.pivot.util.CalendarDate$Range

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.