Search in sources :

Example 1 with ClickEvent

use of com.vaadin.event.MouseEvents.ClickEvent in project Activiti by Activiti.

the class UserDetailsComponent method addUserPicture.

protected void addUserPicture() {
    // default icon
    Resource pictureResource = Images.USER_32;
    if (user != null) {
        final Picture userPicture = identityService.getUserPicture(user.getId());
        if (userPicture != null) {
            pictureResource = new StreamResource(new StreamSource() {

                public InputStream getStream() {
                    return userPicture.getInputStream();
                }
            }, user.getId(), ExplorerApp.get());
        }
    }
    Embedded picture = new Embedded(null, pictureResource);
    picture.setType(Embedded.TYPE_IMAGE);
    picture.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_PICTURE);
    if (user != null) {
        // Only set fixed height and width when user has image, otherwise icon's dimensions will be used
        picture.setHeight("32px");
        picture.setWidth("32px");
    }
    addComponent(picture);
    // Add profile popup listener
    if (user != null) {
        picture.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
        picture.addListener(new com.vaadin.event.MouseEvents.ClickListener() {

            public void click(ClickEvent event) {
                viewManager.showProfilePopup(user.getId());
            }
        });
    }
}
Also used : StreamResource(com.vaadin.terminal.StreamResource) Picture(org.activiti.engine.identity.Picture) StreamSource(com.vaadin.terminal.StreamResource.StreamSource) ClickEvent(com.vaadin.event.MouseEvents.ClickEvent) StreamResource(com.vaadin.terminal.StreamResource) Resource(com.vaadin.terminal.Resource) Embedded(com.vaadin.ui.Embedded)

Aggregations

ClickEvent (com.vaadin.event.MouseEvents.ClickEvent)1 Resource (com.vaadin.terminal.Resource)1 StreamResource (com.vaadin.terminal.StreamResource)1 StreamSource (com.vaadin.terminal.StreamResource.StreamSource)1 Embedded (com.vaadin.ui.Embedded)1 Picture (org.activiti.engine.identity.Picture)1