Search in sources :

Example 1 with AttachmentRenderer

use of org.activiti.explorer.ui.content.AttachmentRenderer 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)

Example 2 with AttachmentRenderer

use of org.activiti.explorer.ui.content.AttachmentRenderer in project Activiti by Activiti.

the class HistoricTaskDetailPanel method populateRelatedContent.

protected void populateRelatedContent(Table table, List<Attachment> attachments) {
    if (!attachments.isEmpty()) {
        table.setVisible(true);
    }
    for (Attachment attachment : attachments) {
        AttachmentRenderer renderer = attachmentRendererManager.getRenderer(attachment);
        Item attachmentItem = table.addItem(attachment.getId());
        // Simple renderer that just shows a popup window with the attachment
        RelatedContentComponent relatedContentComponent = new RelatedContentComponent() {

            public void showAttachmentDetail(Attachment attachment) {
                AttachmentDetailPopupWindow popup = new AttachmentDetailPopupWindow(attachment);
                ExplorerApp.get().getViewManager().showPopupWindow(popup);
            }
        };
        attachmentItem.getItemProperty("name").setValue(renderer.getOverviewComponent(attachment, relatedContentComponent));
        attachmentItem.getItemProperty("type").setValue(new Embedded(null, renderer.getImage(attachment)));
    }
    table.setPageLength(table.size());
}
Also used : Item(com.vaadin.data.Item) AttachmentDetailPopupWindow(org.activiti.explorer.ui.content.AttachmentDetailPopupWindow) RelatedContentComponent(org.activiti.explorer.ui.content.RelatedContentComponent) Attachment(org.activiti.engine.task.Attachment) Embedded(com.vaadin.ui.Embedded) AttachmentRenderer(org.activiti.explorer.ui.content.AttachmentRenderer)

Aggregations

Item (com.vaadin.data.Item)2 Embedded (com.vaadin.ui.Embedded)2 Attachment (org.activiti.engine.task.Attachment)2 AttachmentRenderer (org.activiti.explorer.ui.content.AttachmentRenderer)2 AttachmentDetailPopupWindow (org.activiti.explorer.ui.content.AttachmentDetailPopupWindow)1 RelatedContentComponent (org.activiti.explorer.ui.content.RelatedContentComponent)1