Search in sources :

Example 1 with Embedded

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

the class TaskDetailPanel method initHeader.

protected void initHeader() {
    GridLayout taskDetails = new GridLayout(2, 2);
    taskDetails.setWidth(100, UNITS_PERCENTAGE);
    taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    taskDetails.setSpacing(true);
    taskDetails.setMargin(false, false, true, false);
    taskDetails.setColumnExpandRatio(1, 1.0f);
    centralLayout.addComponent(taskDetails);
    // Add image
    Embedded image = new Embedded(null, Images.TASK_50);
    taskDetails.addComponent(image, 0, 0, 0, 1);
    // Add task name
    Label nameLabel = new Label(task.getName());
    nameLabel.addStyleName(Reindeer.LABEL_H2);
    taskDetails.addComponent(nameLabel, 1, 0);
    taskDetails.setComponentAlignment(nameLabel, Alignment.MIDDLE_LEFT);
    // Properties
    HorizontalLayout propertiesLayout = new HorizontalLayout();
    propertiesLayout.setSpacing(true);
    taskDetails.addComponent(propertiesLayout);
    propertiesLayout.addComponent(new DueDateComponent(task, i18nManager, taskService));
    propertiesLayout.addComponent(new PriorityComponent(task, i18nManager, taskService));
    initCreateTime(propertiesLayout);
}
Also used : GridLayout(com.vaadin.ui.GridLayout) Label(com.vaadin.ui.Label) PrettyTimeLabel(org.activiti.explorer.ui.custom.PrettyTimeLabel) Embedded(com.vaadin.ui.Embedded) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 2 with Embedded

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

the class TaskEventsPanel method addTaskEventPicture.

protected void addTaskEventPicture(final org.activiti.engine.task.Event taskEvent, GridLayout eventGrid) {
    final Picture userPicture = identityService.getUserPicture(taskEvent.getUserId());
    Embedded authorPicture = null;
    if (userPicture != null) {
        StreamResource imageresource = new StreamResource(new StreamSource() {

            private static final long serialVersionUID = 1L;

            public InputStream getStream() {
                return userPicture.getInputStream();
            }
        }, "event_" + taskEvent.getUserId() + "." + Constants.MIMETYPE_EXTENSION_MAPPING.get(userPicture.getMimeType()), ExplorerApp.get());
        authorPicture = new Embedded(null, imageresource);
    } else {
        authorPicture = new Embedded(null, Images.USER_50);
    }
    authorPicture.setType(Embedded.TYPE_IMAGE);
    authorPicture.setHeight("48px");
    authorPicture.setWidth("48px");
    authorPicture.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_PICTURE);
    eventGrid.addComponent(authorPicture);
}
Also used : StreamResource(com.vaadin.terminal.StreamResource) Picture(org.activiti.engine.identity.Picture) InputStream(java.io.InputStream) StreamSource(com.vaadin.terminal.StreamResource.StreamSource) Embedded(com.vaadin.ui.Embedded)

Example 3 with Embedded

use of com.vaadin.ui.Embedded 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)

Example 4 with Embedded

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

the class ThemeImageColumnGenerator method generateCell.

public Component generateCell(Table source, Object itemId, Object columnId) {
    Embedded embedded = new Embedded(null, image);
    if (clickListener != null) {
        embedded.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
        embedded.setData(itemId);
        embedded.addListener(clickListener);
    }
    return embedded;
}
Also used : Embedded(com.vaadin.ui.Embedded)

Example 5 with Embedded

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

the class TaskRelatedContentComponent method addAttachmentsToTable.

protected void addAttachmentsToTable(List<Attachment> attachments) {
    for (Attachment attachment : attachments) {
        AttachmentRenderer renderer = attachmentRendererManager.getRenderer(attachment);
        Item attachmentItem = table.addItem(attachment.getId());
        attachmentItem.getItemProperty("name").setValue(renderer.getOverviewComponent(attachment, this));
        attachmentItem.getItemProperty("type").setValue(new Embedded(null, renderer.getImage(attachment)));
        Embedded deleteButton = new Embedded(null, Images.DELETE);
        deleteButton.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
        deleteButton.addListener((ClickListener) new DeleteClickedListener(attachment));
        attachmentItem.getItemProperty("delete").setValue(deleteButton);
    }
    if (!table.getItemIds().isEmpty()) {
        table.setVisible(true);
    }
    table.setPageLength(table.size());
}
Also used : Item(com.vaadin.data.Item) Attachment(org.activiti.engine.task.Attachment) Embedded(com.vaadin.ui.Embedded) AttachmentRenderer(org.activiti.explorer.ui.content.AttachmentRenderer)

Aggregations

Embedded (com.vaadin.ui.Embedded)42 Label (com.vaadin.ui.Label)29 HorizontalLayout (com.vaadin.ui.HorizontalLayout)19 PrettyTimeLabel (org.activiti.explorer.ui.custom.PrettyTimeLabel)14 StreamResource (com.vaadin.terminal.StreamResource)12 GridLayout (com.vaadin.ui.GridLayout)9 InputStream (java.io.InputStream)9 Item (com.vaadin.data.Item)7 StreamSource (com.vaadin.terminal.StreamResource.StreamSource)6 ExternalResource (com.vaadin.terminal.ExternalResource)5 Resource (com.vaadin.terminal.Resource)5 VerticalLayout (com.vaadin.ui.VerticalLayout)5 Component (com.vaadin.ui.Component)4 Panel (com.vaadin.ui.Panel)4 Picture (org.activiti.engine.identity.Picture)4 ClickEvent (com.vaadin.ui.Button.ClickEvent)3 ClickListener (com.vaadin.ui.Button.ClickListener)3 Link (com.vaadin.ui.Link)3 ProcessEngineConfiguration (org.activiti.engine.ProcessEngineConfiguration)3 ProcessDefinitionEntity (org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity)3