Search in sources :

Example 61 with Component

use of com.vaadin.ui.Component in project charts by vaadin.

the class ChartWithExternalDataProvider method getChart.

@Override
protected Component getChart() {
    HorizontalLayout lo = new HorizontalLayout();
    lo.setSpacing(true);
    DataProvider<Order, ?> dp = getOrderDataProvider();
    DataProviderSeries<Order> chartDataSeries1 = createChartDataSeries1(dp);
    DataProviderSeries<Order> chartDataSeries2 = createChartDataSeries2(dp);
    Component table = createGrid(dp);
    table.setSizeFull();
    Chart chart1 = createChart1(chartDataSeries1);
    chart1.setSizeFull();
    Chart chart2 = createChart2(chartDataSeries2);
    chart2.setSizeFull();
    lo.setWidth("100%");
    lo.setHeight("450px");
    lo.addComponents(table);
    lo.addComponent(chart1);
    lo.addComponent(chart2);
    lo.setExpandRatio(table, 0.2f);
    lo.setExpandRatio(chart1, 0.4f);
    lo.setExpandRatio(chart2, 0.4f);
    return lo;
}
Also used : Component(com.vaadin.ui.Component) Chart(com.vaadin.addon.charts.Chart) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 62 with Component

use of com.vaadin.ui.Component in project charts by vaadin.

the class DataProviderWithLotsOfData method getChart.

@Override
protected Component getChart() {
    HorizontalLayout lo = new HorizontalLayout();
    DataProviderSeries<Data> ds = createChartDS();
    Component grid = createGrid();
    Component chart = createChart(ds);
    lo.addComponents(grid);
    lo.addComponent(chart);
    grid.setSizeFull();
    chart.setSizeFull();
    lo.setSizeFull();
    lo.setExpandRatio(grid, 1);
    lo.setExpandRatio(chart, 5);
    return lo;
}
Also used : Component(com.vaadin.ui.Component) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 63 with Component

use of com.vaadin.ui.Component in project charts by vaadin.

the class AbstractVaadinChartExample method setup.

protected void setup() {
    if (content.getComponentCount() == 0) {
        final Component map = getChart();
        content.addComponent(map);
        content.setExpandRatio(map, 1);
    }
}
Also used : Component(com.vaadin.ui.Component)

Example 64 with Component

use of com.vaadin.ui.Component in project VaadinUtils by rlsutton1.

the class BaseCrudView method selectFirstFieldAndShowTab.

protected void selectFirstFieldAndShowTab() {
    for (Field<?> field : fieldGroup.getFields()) {
        Component childField = field;
        for (int i = 0; i < 10; i++) {
            Component parentField = childField.getParent();
            if (parentField instanceof TabSheet) {
                ((TabSheet) parentField).setSelectedTab(childField);
                break;
            }
            if (parentField == null) {
                // out of luck, didn't find a parent tab
                break;
            }
            childField = parentField;
        }
        field.focus();
        break;
    }
}
Also used : TabSheet(com.vaadin.ui.TabSheet) Component(com.vaadin.ui.Component)

Example 65 with Component

use of com.vaadin.ui.Component in project v-leaflet by mstahv.

the class GeoJSONExample method getTestComponent.

@Override
public Component getTestComponent() {
    leafletMap = new LMap();
    leafletMap.setWidth("600px");
    leafletMap.setHeight("400px");
    /*
         * Note, this is just one option to read GeoJSON in java. Here, using 
         * helper from geotools library. In some simple cases approach to use
         * plain Json library like Jackson or GSON might be better.
         */
    FeatureJSON io = new FeatureJSON();
    try {
        long currentTimeMillis = System.currentTimeMillis();
        // Look ma, no proxy needed, how cool is that!
        FeatureCollection fc = io.readFeatureCollection(new URL("https://gist.githubusercontent.com/hrbrmstr/91ea5cc9474286c72838/raw/59421ff9b268ff0929b051ddafafbeb94a4c1910/continents.json").openStream());
        Logger.getLogger(GeoJSONExample.class.getName()).severe("Download in " + (System.currentTimeMillis() - currentTimeMillis));
        currentTimeMillis = System.currentTimeMillis();
        FeatureIterator iterator = fc.features();
        try {
            while (iterator.hasNext()) {
                Feature feature = iterator.next();
                Geometry geometry = (Geometry) feature.getDefaultGeometryProperty().getValue();
                // The geojson provided in example is rather complex (several megabytes)
                // Use JTS to simplyfy. Note that it is rather easy to use
                // different settings on different zoom levels, as well as decide
                // to drop the feature form client altogether
                geometry = DouglasPeuckerSimplifier.simplify(geometry, 0.2);
                // In this example can be Polygon/Multipolygon
                Collection<LeafletLayer> toLayers = JTSUtil.toLayers(geometry);
                for (LeafletLayer l : toLayers) {
                    leafletMap.addComponent(l);
                    if (l instanceof LLayerGroup) {
                        LLayerGroup group = (LLayerGroup) l;
                        Iterator<Component> components = group.getComponentIterator();
                        while (components.hasNext()) {
                            LPolygon lPolygon = (LPolygon) components.next();
                            lPolygon.setStroke(false);
                            lPolygon.setFillColor("brown");
                        }
                    }
                }
            }
            Logger.getLogger(GeoJSONExample.class.getName()).severe("Reducing and creating layers " + (System.currentTimeMillis() - currentTimeMillis));
        } finally {
            iterator.close();
        }
    } catch (MalformedURLException ex) {
        Logger.getLogger(GeoJSONExample.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(GeoJSONExample.class.getName()).log(Level.SEVERE, null, ex);
    }
    leafletMap.zoomToContent();
    return leafletMap;
}
Also used : MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) Feature(org.opengis.feature.Feature) URL(java.net.URL) FeatureIterator(org.geotools.feature.FeatureIterator) Geometry(org.locationtech.jts.geom.Geometry) FeatureJSON(org.geotools.geojson.feature.FeatureJSON) FeatureCollection(org.geotools.feature.FeatureCollection) Component(com.vaadin.ui.Component)

Aggregations

Component (com.vaadin.ui.Component)146 LayoutBoundTransferable (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.events.LayoutBoundTransferable)23 VerticalDropLocation (com.vaadin.shared.ui.dd.VerticalDropLocation)13 ComponentContainer (com.vaadin.ui.ComponentContainer)12 SingleComponentContainer (com.vaadin.ui.SingleComponentContainer)12 WebAbstractComponent (com.haulmont.cuba.web.gui.components.WebAbstractComponent)11 HorizontalLayout (com.vaadin.ui.HorizontalLayout)11 VerticalLayout (com.vaadin.ui.VerticalLayout)11 Button (com.vaadin.ui.Button)9 Window (com.haulmont.cuba.gui.components.Window)8 Label (com.vaadin.ui.Label)8 Test (org.junit.Test)8 WebWindow (com.haulmont.cuba.web.gui.WebWindow)7 AbstractOrderedLayout (com.vaadin.ui.AbstractOrderedLayout)6 CssLayout (com.vaadin.ui.CssLayout)6 List (java.util.List)6 com.haulmont.cuba.gui.components (com.haulmont.cuba.gui.components)5 CubaUI (com.haulmont.cuba.web.widgets.CubaUI)5 DDAbsoluteLayout (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDAbsoluteLayout)5 Item (com.vaadin.data.Item)5