Search in sources :

Example 1 with Item

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);
}
Also used : Property(com.vaadin.v7.data.Property)

Example 2 with Item

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);
    }
}
Also used : Item(com.vaadin.v7.data.Item) AbstractVaadinChartExample(com.vaadin.addon.charts.examples.AbstractVaadinChartExample)

Example 3 with Item

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));
}
Also used : Item(com.vaadin.v7.data.Item) Test(org.junit.Test)

Example 4 with Item

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));
}
Also used : Item(com.vaadin.v7.data.Item) Test(org.junit.Test)

Example 5 with Item

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));
}
Also used : Item(com.vaadin.v7.data.Item) Test(org.junit.Test)

Aggregations

Item (com.vaadin.v7.data.Item)11 Test (org.junit.Test)5 ContainerDataSeries (com.vaadin.v7.addon.charts.model.ContainerDataSeries)4 AbstractVaadinChartExample (com.vaadin.addon.charts.examples.AbstractVaadinChartExample)2 Property (com.vaadin.v7.data.Property)2 IndexedContainer (com.vaadin.v7.data.util.IndexedContainer)2 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 Chart (com.vaadin.addon.charts.Chart)1 Configuration (com.vaadin.addon.charts.model.Configuration)1 DataLabelsRange (com.vaadin.addon.charts.model.DataLabelsRange)1 PlotOptionsArea (com.vaadin.addon.charts.model.PlotOptionsArea)1 PlotOptionsColumn (com.vaadin.addon.charts.model.PlotOptionsColumn)1 PlotOptionsColumnrange (com.vaadin.addon.charts.model.PlotOptionsColumnrange)1 PlotOptionsPie (com.vaadin.addon.charts.model.PlotOptionsPie)1 Tooltip (com.vaadin.addon.charts.model.Tooltip)1 XAxis (com.vaadin.addon.charts.model.XAxis)1 YAxis (com.vaadin.addon.charts.model.YAxis)1 HierarchicalContainer (com.vaadin.v7.data.util.HierarchicalContainer)1