Search in sources :

Example 11 with Embedded

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

the class ProfilePanel method initPicture.

protected void initPicture() {
    StreamResource imageresource = new StreamResource(new StreamSource() {

        private static final long serialVersionUID = 1L;

        public InputStream getStream() {
            return picture.getInputStream();
        }
    }, user.getId(), ExplorerApp.get());
    imageresource.setCacheTime(0);
    Embedded picture = new Embedded(null, imageresource);
    picture.setType(Embedded.TYPE_IMAGE);
    picture.setHeight(200, UNITS_PIXELS);
    picture.setWidth(200, UNITS_PIXELS);
    picture.addStyleName(ExplorerLayout.STYLE_PROFILE_PICTURE);
    imageLayout.addComponent(picture);
    imageLayout.setWidth(picture.getWidth() + 5, picture.getWidthUnits());
    // Change picture button
    if (isCurrentLoggedInUser) {
        Upload changePictureButton = initChangePictureButton();
        imageLayout.addComponent(changePictureButton);
        imageLayout.setComponentAlignment(changePictureButton, Alignment.MIDDLE_CENTER);
    }
}
Also used : StreamResource(com.vaadin.terminal.StreamResource) InputStream(java.io.InputStream) StreamSource(com.vaadin.terminal.StreamResource.StreamSource) Upload(com.vaadin.ui.Upload) Embedded(com.vaadin.ui.Embedded)

Example 12 with Embedded

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

the class ReportDetailPanel method initHeader.

protected void initHeader() {
    GridLayout details = new GridLayout(2, 2);
    details.setWidth(100, UNITS_PERCENTAGE);
    details.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    details.setSpacing(true);
    details.setMargin(false, false, true, false);
    details.setColumnExpandRatio(1, 1.0f);
    detailPanelLayout.addComponent(details);
    // Image
    Embedded image = new Embedded(null, Images.REPORT_50);
    details.addComponent(image, 0, 0, 0, 1);
    // Name
    Label nameLabel = new Label(getReportDisplayName());
    nameLabel.addStyleName(Reindeer.LABEL_H2);
    details.addComponent(nameLabel, 1, 0);
    // Properties
    HorizontalLayout propertiesLayout = new HorizontalLayout();
    propertiesLayout.setSpacing(true);
    details.addComponent(propertiesLayout);
    // Version
    String versionString = i18nManager.getMessage(Messages.PROCESS_VERSION, processDefinition.getVersion());
    Label versionLabel = new Label(versionString);
    versionLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_VERSION);
    propertiesLayout.addComponent(versionLabel);
}
Also used : GridLayout(com.vaadin.ui.GridLayout) Label(com.vaadin.ui.Label) Embedded(com.vaadin.ui.Embedded) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 13 with Embedded

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

the class HistoricTaskDetailPanel method populateSubTasks.

protected void populateSubTasks(List<HistoricTaskInstance> subTasks) {
    for (final HistoricTaskInstance subTask : subTasks) {
        // icon
        Embedded icon = new Embedded(null, Images.TASK_22);
        icon.setWidth(22, UNITS_PIXELS);
        icon.setWidth(22, UNITS_PIXELS);
        subTaskGrid.addComponent(icon);
        // Link to subtask
        Button subTaskLink = new Button(subTask.getName());
        subTaskLink.addStyleName(Reindeer.BUTTON_LINK);
        subTaskLink.addListener(new ClickListener() {

            public void buttonClick(ClickEvent event) {
                ExplorerApp.get().getViewManager().showTaskPage(subTask.getId());
            }
        });
        subTaskGrid.addComponent(subTaskLink);
        subTaskGrid.setComponentAlignment(subTaskLink, Alignment.MIDDLE_LEFT);
    }
}
Also used : HistoricTaskInstance(org.activiti.engine.history.HistoricTaskInstance) Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) Embedded(com.vaadin.ui.Embedded) ClickListener(com.vaadin.ui.Button.ClickListener)

Example 14 with Embedded

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

Example 15 with Embedded

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

the class EditorProcessDefinitionInfoComponent method initImage.

protected void initImage() {
    processImageContainer = new VerticalLayout();
    Label processTitle = new Label(i18nManager.getMessage(Messages.PROCESS_HEADER_DIAGRAM));
    processTitle.addStyleName(ExplorerLayout.STYLE_H3);
    processImageContainer.addComponent(processTitle);
    StreamSource streamSource = null;
    final byte[] editorSourceExtra = repositoryService.getModelEditorSourceExtra(modelData.getId());
    if (editorSourceExtra != null) {
        streamSource = new StreamSource() {

            private static final long serialVersionUID = 1L;

            public InputStream getStream() {
                InputStream inStream = null;
                try {
                    inStream = new ByteArrayInputStream(editorSourceExtra);
                } catch (Exception e) {
                    LOGGER.warn("Error reading PNG in StreamSource", e);
                }
                return inStream;
            }
        };
    }
    if (streamSource != null) {
        Embedded embedded = new Embedded(null, new ImageStreamSource(streamSource, ExplorerApp.get()));
        embedded.setType(Embedded.TYPE_IMAGE);
        embedded.setSizeUndefined();
        // using panel for scrollbars
        Panel imagePanel = new Panel();
        imagePanel.addStyleName(Reindeer.PANEL_LIGHT);
        imagePanel.setWidth(100, UNITS_PERCENTAGE);
        imagePanel.setHeight(700, UNITS_PIXELS);
        HorizontalLayout panelLayout = new HorizontalLayout();
        panelLayout.setSizeUndefined();
        imagePanel.setContent(panelLayout);
        imagePanel.addComponent(embedded);
        processImageContainer.addComponent(imagePanel);
    } else {
        Label noImageAvailable = new Label(i18nManager.getMessage(Messages.PROCESS_NO_DIAGRAM));
        processImageContainer.addComponent(noImageAvailable);
    }
    addComponent(processImageContainer);
}
Also used : Panel(com.vaadin.ui.Panel) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) StreamSource(com.vaadin.terminal.StreamResource.StreamSource) Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) Embedded(com.vaadin.ui.Embedded) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Aggregations

Embedded (com.vaadin.ui.Embedded)40 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 Item (com.vaadin.data.Item)7 InputStream (java.io.InputStream)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