|
|
@@ -25,6 +25,7 @@ import org.junit.Test; |
|
|
|
import com.vaadin.data.Container.Indexed; |
|
|
|
import com.vaadin.data.Container.Sortable; |
|
|
|
import com.vaadin.data.Item; |
|
|
|
import com.vaadin.data.Property; |
|
|
|
import com.vaadin.data.util.BeanItemContainer; |
|
|
|
import com.vaadin.data.util.IndexedContainer; |
|
|
|
import com.vaadin.ui.Calendar; |
|
|
@@ -327,6 +328,37 @@ public class ContainerDataSource extends TestCase { |
|
|
|
assertEquals(0, calendar.getEvents(start, end).size()); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
public void testStyleNamePropertyRetrieved() { |
|
|
|
IndexedContainer ic = (IndexedContainer) createTestIndexedContainer(); |
|
|
|
ic.addContainerProperty("testStyleName", String.class, ""); |
|
|
|
for (int i = 0; i < 10; i++) { |
|
|
|
Item item = ic.getItem(ic.getIdByIndex(i)); |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
Property<String> itemProperty = item |
|
|
|
.getItemProperty("testStyleName"); |
|
|
|
itemProperty.setValue("testStyle"); |
|
|
|
} |
|
|
|
|
|
|
|
ContainerEventProvider provider = new ContainerEventProvider(ic); |
|
|
|
provider.setCaptionProperty("testCaption"); |
|
|
|
provider.setDescriptionProperty("testDescription"); |
|
|
|
provider.setStartDateProperty("testStartDate"); |
|
|
|
provider.setEndDateProperty("testEndDate"); |
|
|
|
provider.setStyleNameProperty("testStyleName"); |
|
|
|
|
|
|
|
calendar.setEventProvider(provider); |
|
|
|
java.util.Calendar cal = java.util.Calendar.getInstance(); |
|
|
|
Date now = cal.getTime(); |
|
|
|
cal.add(java.util.Calendar.DAY_OF_MONTH, 20); |
|
|
|
Date then = cal.getTime(); |
|
|
|
List<CalendarEvent> events = calendar.getEventProvider().getEvents(now, |
|
|
|
then); |
|
|
|
for (CalendarEvent ce : events) { |
|
|
|
assertEquals("testStyle", ce.getStyleName()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private static Indexed createTestBeanItemContainer() { |
|
|
|
BeanItemContainer<CalendarEvent> eventContainer = new BeanItemContainer<CalendarEvent>( |
|
|
|
CalendarEvent.class); |