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);
}
}
}
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);
}
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;
}
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);
}
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;
}
Aggregations