use of com.vaadin.v7.data.Item in project magnolia-vanity-url by aperto.
the class UniqueVanityUrlValidatorTest method customizeItem.
private void customizeItem(final JcrNodeAdapter item) throws RepositoryException {
Property property = mock(Property.class);
when(property.getValue()).thenReturn("site");
when(item.getItemProperty(PN_SITE)).thenReturn(property);
}
use of com.vaadin.v7.data.Item in project charts by vaadin.
the class TListUi method addTest.
@SuppressWarnings("unchecked")
private void addTest(Container indexedContainer, String simpleName, Class<?> forName, String subpackage) throws InstantiationException, IllegalAccessException {
if (AbstractVaadinChartExample.class.isAssignableFrom(forName)) {
AbstractVaadinChartExample newInstance = (AbstractVaadinChartExample) forName.newInstance();
Object id = indexedContainer.addItem();
Item item = indexedContainer.getItem(id);
item.getItemProperty("name").setValue(simpleName);
item.getItemProperty("description").setValue(newInstance.getDescription());
item.getItemProperty("package").setValue(subpackage);
}
}
use of com.vaadin.v7.data.Item in project charts by vaadin.
the class ContainerSeriesJSONSerializationTest method serialize_ZMappedToName_ValuesMappedAsObject.
@SuppressWarnings("unchecked")
@Test
public void serialize_ZMappedToName_ValuesMappedAsObject() {
containerSeries.setXPropertyId("x");
containerSeries.setYPropertyId("y");
containerSeries.addAttributeToPropertyIdMapping("name", "z");
vaadinContainer.addContainerProperty("x", Number.class, null);
vaadinContainer.addContainerProperty("z", Number.class, null);
Item ie = vaadinContainer.addItem(1);
ie.getItemProperty("x").setValue(80);
ie.getItemProperty("y").setValue(80);
ie.getItemProperty("z").setValue(80);
ie = vaadinContainer.addItem(2);
ie.getItemProperty("x").setValue(20);
ie.getItemProperty("y").setValue(20);
ie.getItemProperty("z").setValue(20);
assertEquals("{\"data\":[{\"x\":80,\"y\":80,\"name\":80},{\"x\":20,\"y\":20,\"name\":20}]}", toJSON(containerSeries));
}
use of com.vaadin.v7.data.Item in project charts by vaadin.
the class ContainerSeriesJSONSerializationTest method serialize_ContainerWithXY_ValuesMappedAsArray.
@SuppressWarnings("unchecked")
@Test
public void serialize_ContainerWithXY_ValuesMappedAsArray() {
containerSeries.setXPropertyId("x");
containerSeries.setYPropertyId("y");
vaadinContainer.addContainerProperty("x", Number.class, null);
Item ie = vaadinContainer.addItem(1);
ie.getItemProperty("x").setValue(80);
ie.getItemProperty("y").setValue(80);
ie = vaadinContainer.addItem(2);
ie.getItemProperty("x").setValue(20);
ie.getItemProperty("y").setValue(20);
assertEquals("{\"data\":[[80,80],[20,20]]}", toJSON(containerSeries));
}
use of com.vaadin.v7.data.Item in project charts by vaadin.
the class ContainerSeriesJSONSerializationTest method serialize_ContainerWithXYZ_UnmappedPropertyNotSerialized.
@SuppressWarnings("unchecked")
@Test
public void serialize_ContainerWithXYZ_UnmappedPropertyNotSerialized() {
containerSeries.setXPropertyId("x");
containerSeries.setYPropertyId("y");
vaadinContainer.addContainerProperty("x", Number.class, null);
vaadinContainer.addContainerProperty("z", Number.class, null);
Item ie = vaadinContainer.addItem(1);
ie.getItemProperty("x").setValue(80);
ie.getItemProperty("y").setValue(80);
ie.getItemProperty("z").setValue(80);
ie = vaadinContainer.addItem(2);
ie.getItemProperty("x").setValue(20);
ie.getItemProperty("y").setValue(20);
ie.getItemProperty("z").setValue(20);
assertEquals("{\"data\":[[80,80],[20,20]]}", toJSON(containerSeries));
}
Aggregations