Package com.vaadin.ui

Examples of com.vaadin.ui.Calendar


    private Calendar calendar;

    @Override
    public void setUp() {
        calendar = new Calendar();
    }
View Full Code Here


public class CalendarBasics {

    @Test
    public void testEmptyConstructorInitialization() {

        Calendar calendar = new Calendar();

        // The calendar should have a basic event provider with no events
        CalendarEventProvider provider = calendar.getEventProvider();
        assertNotNull("Event provider should not be null", provider);

        // Basic event handlers should be registered
        assertNotNull(calendar.getHandler(BackwardEvent.EVENT_ID));
        assertNotNull(calendar.getHandler(ForwardEvent.EVENT_ID));
        assertNotNull(calendar.getHandler(WeekClick.EVENT_ID));
        assertNotNull(calendar.getHandler(DateClickEvent.EVENT_ID));
        assertNotNull(calendar.getHandler(MoveEvent.EVENT_ID));
        assertNotNull(calendar.getHandler(EventResize.EVENT_ID));

        // Calendar should have undefined size
        assertTrue(calendar.getWidth() < 0);
        assertTrue(calendar.getHeight() < 0);
    }
View Full Code Here

    }

    @Test
    public void testConstructorWithCaption() {
        final String caption = "My Calendar Caption";
        Calendar calendar = new Calendar(caption);
        assertEquals(caption, calendar.getCaption());
    }
View Full Code Here

    }

    @Test
    public void testConstructorWithCustomEventProvider() {
        BasicEventProvider myProvider = new BasicEventProvider();
        Calendar calendar = new Calendar(myProvider);
        assertEquals(myProvider, calendar.getEventProvider());
    }
View Full Code Here

    @Test
    public void testConstructorWithCustomEventProviderAndCaption() {
        BasicEventProvider myProvider = new BasicEventProvider();
        final String caption = "My Calendar Caption";
        Calendar calendar = new Calendar(caption, myProvider);
        assertEquals(caption, calendar.getCaption());
        assertEquals(myProvider, calendar.getEventProvider());
    }
View Full Code Here

        assertEquals(myProvider, calendar.getEventProvider());
    }

    @Test
    public void testDefaultStartAndEndDates() {
        Calendar calendar = new Calendar();

        // If no start and end date is set the calendar will display the current
        // week
        java.util.Calendar c = new GregorianCalendar();
        java.util.Calendar c2 = new GregorianCalendar();

        c2.setTime(calendar.getStartDate());
        assertEquals(c.getFirstDayOfWeek(),
                c2.get(java.util.Calendar.DAY_OF_WEEK));
        c2.setTime(calendar.getEndDate());

        c.set(java.util.Calendar.DAY_OF_WEEK, c.getFirstDayOfWeek() + 6);
        assertEquals(c.get(java.util.Calendar.DAY_OF_WEEK),
                c2.get(java.util.Calendar.DAY_OF_WEEK));
    }
View Full Code Here

                c2.get(java.util.Calendar.DAY_OF_WEEK));
    }

    @Test
    public void testCustomStartAndEndDates() {
        Calendar calendar = new Calendar();
        java.util.Calendar c = new GregorianCalendar();

        Date start = c.getTime();
        c.add(java.util.Calendar.DATE, 3);
        Date end = c.getTime();

        calendar.setStartDate(start);
        calendar.setEndDate(end);

        assertEquals(start.getTime(), calendar.getStartDate().getTime());
        assertEquals(end.getTime(), calendar.getEndDate().getTime());
    }
View Full Code Here

        assertEquals(end.getTime(), calendar.getEndDate().getTime());
    }

    @Test
    public void testCustomLocale() {
        Calendar calendar = new Calendar();
        calendar.setLocale(Locale.CANADA_FRENCH);

        // Setting the locale should set the internal calendars locale
        assertEquals(Locale.CANADA_FRENCH, calendar.getLocale());
        java.util.Calendar c = new GregorianCalendar(Locale.CANADA_FRENCH);
        assertEquals(c.getTimeZone().getRawOffset(), calendar
                .getInternalCalendar().getTimeZone().getRawOffset());
    }
View Full Code Here

        VerticalSplitPanel content = new VerticalSplitPanel();
        content.setSizeFull();
        setContent(content);

        // Create Calendar
        calendar = new Calendar();
        calendar.setImmediate(true);
        calendar.setSizeFull();
        calendar.setContainerDataSource(events);
        calendar.setStartDate(new Date(100, 1, 1));
        calendar.setEndDate(new Date(100, 2, 1));
View Full Code Here

*/
public class CalendarRescheduleEvent extends AbstractTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        final Calendar calendar = new Calendar("Test calendar");
        final java.util.Calendar cal = getAdjustedCalendar(1);

        Date from = cal.getTime();

        cal.add(java.util.Calendar.HOUR, 1);
        Date to = cal.getTime();

        final BasicEvent basicEvent = new BasicEvent("event", "description",
                from, to);

        HorizontalLayout info = new HorizontalLayout();
        info.setSpacing(true);
        info.setMargin(true);
        addComponent(info);
        final Label startLbl = new Label();
        startLbl.addStyleName("start");
        info.addComponent(startLbl);

        final Label endLbl = new Label();
        endLbl.addStyleName("end");
        info.addComponent(endLbl);

        BasicEventProvider provider = new BasicEventProvider();
        provider.addEvent(basicEvent);
        calendar.setEventProvider(provider);
        provider.addEventSetChangeListener(new EventSetChangeListener() {

            @Override
            public void eventSetChange(EventSetChangeEvent event) {
                List<CalendarEvent> events = event.getProvider().getEvents(
View Full Code Here

TOP

Related Classes of com.vaadin.ui.Calendar

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.