Search in sources :

Example 6 with Component

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

the class AdminCompletedInstancesPanel method addTaskItem.

protected void addTaskItem(HistoricTaskInstance task, Table taskTable) {
    Item item = taskTable.addItem(task.getId());
    if (task.getEndTime() != null) {
        item.getItemProperty("finished").setValue(new Embedded(null, Images.TASK_FINISHED_22));
    } else {
        item.getItemProperty("finished").setValue(new Embedded(null, Images.TASK_22));
    }
    item.getItemProperty("name").setValue(task.getName());
    item.getItemProperty("priority").setValue(task.getPriority());
    item.getItemProperty("startDate").setValue(new PrettyTimeLabel(task.getStartTime(), true));
    item.getItemProperty("endDate").setValue(new PrettyTimeLabel(task.getEndTime(), true));
    if (task.getDueDate() != null) {
        Label dueDateLabel = new PrettyTimeLabel(task.getEndTime(), i18nManager.getMessage(Messages.TASK_NOT_FINISHED_YET), true);
        item.getItemProperty("dueDate").setValue(dueDateLabel);
    }
    if (task.getAssignee() != null) {
        Component taskAssigneeComponent = getTaskAssigneeComponent(task.getAssignee());
        if (taskAssigneeComponent != null) {
            item.getItemProperty("assignee").setValue(taskAssigneeComponent);
        }
    }
}
Also used : Item(com.vaadin.data.Item) Label(com.vaadin.ui.Label) PrettyTimeLabel(org.activiti.explorer.ui.custom.PrettyTimeLabel) Embedded(com.vaadin.ui.Embedded) PrettyTimeLabel(org.activiti.explorer.ui.custom.PrettyTimeLabel) Component(com.vaadin.ui.Component)

Example 7 with Component

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

the class UserDetailPanel method loadPicture.

protected void loadPicture() {
    Component pictureComponent = null;
    final Picture userPicture = identityService.getUserPicture(user.getId());
    if (userPicture != null) {
        StreamResource imageresource = new StreamResource(new StreamSource() {

            private static final long serialVersionUID = 1L;

            public InputStream getStream() {
                return userPicture.getInputStream();
            }
        }, user.getId() + "." + Constants.MIMETYPE_EXTENSION_MAPPING.get(userPicture.getMimeType()), ExplorerApp.get());
        pictureComponent = new Embedded(null, imageresource);
    } else {
        pictureComponent = new Label("");
    }
    pictureComponent.setHeight("200px");
    pictureComponent.setWidth("200px");
    pictureComponent.addStyleName(ExplorerLayout.STYLE_PROFILE_PICTURE);
    userDetailsLayout.addComponent(pictureComponent);
    userDetailsLayout.setComponentAlignment(pictureComponent, Alignment.MIDDLE_CENTER);
}
Also used : StreamResource(com.vaadin.terminal.StreamResource) Picture(org.activiti.engine.identity.Picture) InputStream(java.io.InputStream) StreamSource(com.vaadin.terminal.StreamResource.StreamSource) Label(com.vaadin.ui.Label) Embedded(com.vaadin.ui.Embedded) Component(com.vaadin.ui.Component)

Example 8 with Component

use of com.vaadin.ui.Component in project opennms by OpenNMS.

the class ToolbarPanel method createGroup.

private CssLayout createGroup(Component... components) {
    CssLayout group = new CssLayout();
    group.addStyleName("toolbar-component-group");
    group.setSizeFull();
    for (Component eachComponent : components) {
        eachComponent.setPrimaryStyleName("toolbar-group-item");
        group.addComponent(eachComponent);
    }
    return group;
}
Also used : CssLayout(com.vaadin.ui.CssLayout) Component(com.vaadin.ui.Component)

Example 9 with Component

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

the class BasicTest method setup.

@Override
protected void setup() {
    super.setup();
    addMarkers = new CheckBox("Add markers");
    content.addComponentAsFirst(addMarkers);
    delete = new CheckBox("Delete on click");
    content.addComponentAsFirst(delete);
    Button openPopup = new Button("Open popup", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            leafletMarker.openPopup();
        }
    });
    Button closePopup = new Button("Close popup", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            leafletMarker.closePopup();
        }
    });
    content.addComponentAsFirst(closePopup);
    content.addComponentAsFirst(openPopup);
    Button button = new Button("Delete first component from map");
    button.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            Component next = leafletMap.iterator().next();
            leafletMap.removeComponent(next);
        }
    });
    content.addComponentAsFirst(button);
    button = new Button("Add polyline to map");
    button.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            LPolyline lPolyline = new LPolyline(new Point(60.44, 22.30), new Point(60.456, 22.304));
            lPolyline.addClickListener(listener);
            leafletMap.addComponent(lPolyline);
        }
    });
    content.addComponentAsFirst(button);
}
Also used : Button(com.vaadin.ui.Button) CheckBox(com.vaadin.ui.CheckBox) ClickEvent(com.vaadin.ui.Button.ClickEvent) Point(org.vaadin.addon.leaflet.shared.Point) Component(com.vaadin.ui.Component) ClickListener(com.vaadin.ui.Button.ClickListener)

Example 10 with Component

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

the class ChoroplethExample method getTestComponent.

@Override
public Component getTestComponent() {
    leafletMap = new LMap();
    leafletMap.addLayer(new LOpenStreetMapLayer());
    leafletMap.setView(37.8, -96.0, 4.0);
    /*
         * Reading from geojson here, but typically you'd just query
         * your DB directly for the data.
         */
    FeatureJSON io = new FeatureJSON();
    try {
        // 
        // 
        FeatureCollection fc = io.readFeatureCollection(getClass().getResourceAsStream("/us-states.json"));
        FeatureIterator iterator = fc.features();
        try {
            while (iterator.hasNext()) {
                Feature feature = iterator.next();
                final String name = feature.getProperty("name").getValue().toString();
                final Double density = (Double) feature.getProperty("density").getValue();
                System.out.println("State " + name + " read!");
                Geometry geometry = (Geometry) feature.getDefaultGeometryProperty().getValue();
                // Using a helper create v-leaflet components from geojson
                Collection<LeafletLayer> toLayers = JTSUtil.toLayers(geometry);
                for (LeafletLayer l : toLayers) {
                    leafletMap.addComponent(l);
                    if (l instanceof AbstractLeafletVector) {
                        configureFeature(l, density, name);
                    } else if (l instanceof LLayerGroup) {
                        LLayerGroup g = (LLayerGroup) l;
                        for (Component component : g) {
                            configureFeature((LeafletLayer) component, density, name);
                        }
                    }
                }
            }
        } finally {
            iterator.close();
        }
    } catch (MalformedURLException ex) {
        Logger.getLogger(ChoroplethExample.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(ChoroplethExample.class.getName()).log(Level.SEVERE, null, ex);
    }
    /*
         * AbsoluteLayout is a handy layout you can use to place any Vaadin
         * components on top of map. Here we just use raw html label to create
         * a legend, but we could use dynamically generated html or e.g. Table
         * component on top of the map as well.
         */
    AbsoluteLayout absoluteLayout = new AbsoluteLayout();
    absoluteLayout.setWidth("800px");
    absoluteLayout.setHeight("500px");
    absoluteLayout.addComponent(leafletMap);
    Label label = new Label("<style>.legend { background:white; padding:10px; border-radius: 4px; text-align: left; line-height: 18px; color: #555; } .legend i { width: 18px; height: 18px; float: left; margin-right: 8px; opacity: 0.7; }</style><div class=\"info legend leaflet-control\"><i style=\"background:#FFEDA0\"></i> 0–10<br><i style=\"background:#FED976\"></i> 10–20<br><i style=\"background:#FEB24C\"></i> 20–50<br><i style=\"background:#FD8D3C\"></i> 50–100<br><i style=\"background:#FC4E2A\"></i> 100–200<br><i style=\"background:#E31A1C\"></i> 200–500<br><i style=\"background:#BD0026\"></i> 500–1000<br><i style=\"background:#800026\"></i> 1000+</div>", ContentMode.HTML);
    label.setWidth("100px");
    absoluteLayout.addComponent(label, "bottom: 30px; right: 20px;");
    return absoluteLayout;
}
Also used : MalformedURLException(java.net.MalformedURLException) LOpenStreetMapLayer(org.vaadin.addon.leaflet.LOpenStreetMapLayer) LeafletLayer(org.vaadin.addon.leaflet.LeafletLayer) Label(com.vaadin.ui.Label) IOException(java.io.IOException) Feature(org.opengis.feature.Feature) AbsoluteLayout(com.vaadin.ui.AbsoluteLayout) FeatureIterator(org.geotools.feature.FeatureIterator) Geometry(com.vividsolutions.jts.geom.Geometry) LLayerGroup(org.vaadin.addon.leaflet.LLayerGroup) FeatureJSON(org.geotools.geojson.feature.FeatureJSON) LMap(org.vaadin.addon.leaflet.LMap) FeatureCollection(org.geotools.feature.FeatureCollection) Component(com.vaadin.ui.Component) AbstractLeafletVector(org.vaadin.addon.leaflet.AbstractLeafletVector)

Aggregations

Component (com.vaadin.ui.Component)96 HorizontalLayout (com.vaadin.ui.HorizontalLayout)11 WebAbstractComponent (com.haulmont.cuba.web.gui.components.WebAbstractComponent)10 VerticalLayout (com.vaadin.ui.VerticalLayout)10 Button (com.vaadin.ui.Button)9 Label (com.vaadin.ui.Label)9 Test (org.junit.Test)8 Window (com.haulmont.cuba.gui.components.Window)6 CssLayout (com.vaadin.ui.CssLayout)6 List (java.util.List)6 WebWindow (com.haulmont.cuba.web.gui.WebWindow)5 Item (com.vaadin.data.Item)5 ClickEvent (com.vaadin.ui.Button.ClickEvent)5 ClickListener (com.vaadin.ui.Button.ClickListener)5 com.haulmont.cuba.gui.components (com.haulmont.cuba.gui.components)4 WebAppWorkArea (com.haulmont.cuba.web.gui.components.mainwindow.WebAppWorkArea)4 WindowBreadCrumbs (com.haulmont.cuba.web.sys.WindowBreadCrumbs)4 CubaFileUpload (com.haulmont.cuba.web.toolkit.ui.CubaFileUpload)4 com.vaadin.ui (com.vaadin.ui)4 com.haulmont.cuba.web.toolkit.ui (com.haulmont.cuba.web.toolkit.ui)3