Search in sources :

Example 66 with VerticalLayout

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

the class ProcessDefinitionInfoComponent 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);
    boolean didDrawImage = false;
    if (ExplorerApp.get().isUseJavascriptDiagram()) {
        try {
            final InputStream definitionStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), processDefinition.getResourceName());
            XMLInputFactory xif = XmlUtil.createSafeXmlInputFactory();
            XMLStreamReader xtr = xif.createXMLStreamReader(definitionStream);
            BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr);
            if (!bpmnModel.getFlowLocationMap().isEmpty()) {
                int maxX = 0;
                int maxY = 0;
                for (String key : bpmnModel.getLocationMap().keySet()) {
                    GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(key);
                    double elementX = graphicInfo.getX() + graphicInfo.getWidth();
                    if (maxX < elementX) {
                        maxX = (int) elementX;
                    }
                    double elementY = graphicInfo.getY() + graphicInfo.getHeight();
                    if (maxY < elementY) {
                        maxY = (int) elementY;
                    }
                }
                // using panel for scrollbars
                Panel imagePanel = new Panel();
                imagePanel.addStyleName(Reindeer.PANEL_LIGHT);
                imagePanel.setWidth(100, UNITS_PERCENTAGE);
                imagePanel.setHeight(100, UNITS_PERCENTAGE);
                URL explorerURL = ExplorerApp.get().getURL();
                URL url = new URL(explorerURL.getProtocol(), explorerURL.getHost(), explorerURL.getPort(), explorerURL.getPath().replace("/ui", "") + "diagram-viewer/index.html?processDefinitionId=" + processDefinition.getId());
                Embedded browserPanel = new Embedded("", new ExternalResource(url));
                browserPanel.setType(Embedded.TYPE_BROWSER);
                browserPanel.setWidth(maxX + 350 + "px");
                browserPanel.setHeight(maxY + 220 + "px");
                HorizontalLayout panelLayout = new HorizontalLayout();
                panelLayout.setSizeUndefined();
                imagePanel.setContent(panelLayout);
                imagePanel.addComponent(browserPanel);
                processImageContainer.addComponent(imagePanel);
                didDrawImage = true;
            }
        } catch (Exception e) {
            LOGGER.error("Error loading process diagram component", e);
        }
    }
    if (didDrawImage == false) {
        StreamResource diagram = null;
        // Try generating process-image stream
        if (processDefinition.getDiagramResourceName() != null) {
            diagram = new ProcessDefinitionImageStreamResourceBuilder().buildStreamResource(processDefinition, repositoryService);
        }
        if (diagram != null) {
            Embedded embedded = new Embedded(null, diagram);
            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(100, UNITS_PERCENTAGE);
            HorizontalLayout panelLayout = new HorizontalLayout();
            panelLayout.setSizeUndefined();
            imagePanel.setContent(panelLayout);
            imagePanel.addComponent(embedded);
            processImageContainer.addComponent(imagePanel);
            didDrawImage = true;
        }
    }
    if (didDrawImage == false) {
        Label noImageAvailable = new Label(i18nManager.getMessage(Messages.PROCESS_NO_DIAGRAM));
        processImageContainer.addComponent(noImageAvailable);
    }
    addComponent(processImageContainer);
}
Also used : XMLStreamReader(javax.xml.stream.XMLStreamReader) InputStream(java.io.InputStream) Label(com.vaadin.ui.Label) GraphicInfo(org.activiti.bpmn.model.GraphicInfo) ExternalResource(com.vaadin.terminal.ExternalResource) URL(java.net.URL) BpmnModel(org.activiti.bpmn.model.BpmnModel) BpmnXMLConverter(org.activiti.bpmn.converter.BpmnXMLConverter) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Panel(com.vaadin.ui.Panel) StreamResource(com.vaadin.terminal.StreamResource) VerticalLayout(com.vaadin.ui.VerticalLayout) Embedded(com.vaadin.ui.Embedded) XMLInputFactory(javax.xml.stream.XMLInputFactory)

Example 67 with VerticalLayout

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

the class SubTaskComponent method initLayout.

protected void initLayout() {
    this.layout = new VerticalLayout();
    setCompositionRoot(layout);
}
Also used : VerticalLayout(com.vaadin.ui.VerticalLayout)

Example 68 with VerticalLayout

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

the class SubTaskComponent method initAddSubTaskPanel.

protected void initAddSubTaskPanel(HorizontalLayout headerLayout) {
    // The add button is placed in a panel, so we can catch 'enter' and 'escape' events
    addSubTaskPanel = new Panel();
    addSubTaskPanel.setContent(new VerticalLayout());
    addSubTaskPanel.setSizeUndefined();
    addSubTaskPanel.addStyleName(Reindeer.PANEL_LIGHT);
    addSubTaskPanel.addStyleName("no-border");
    headerLayout.addComponent(addSubTaskPanel);
    initAddSubTaskPanelKeyboardActions();
    initAddButton();
}
Also used : Panel(com.vaadin.ui.Panel) VerticalLayout(com.vaadin.ui.VerticalLayout)

Example 69 with VerticalLayout

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

the class HistoricTaskDetailPanel method init.

protected void init() {
    setSizeFull();
    addStyleName(Reindeer.LAYOUT_WHITE);
    this.centralLayout = new VerticalLayout();
    centralLayout.setMargin(true);
    setDetailContainer(centralLayout);
    initHeader();
    initDescription();
    initParentTaskLink();
    initPeopleDetails();
    initSubTasks();
    initRelatedContent();
}
Also used : VerticalLayout(com.vaadin.ui.VerticalLayout)

Example 70 with VerticalLayout

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

the class HistoricTaskDetailPanel method initSubTasks.

protected void initSubTasks() {
    subTasksLayout = new VerticalLayout();
    subTasksLayout.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
    addComponent(subTasksLayout);
    initSubTaskTitle();
    List<HistoricTaskInstance> subTasks = historyService.createHistoricTaskInstanceQuery().taskParentTaskId(historicTask.getId()).list();
    if (!subTasks.isEmpty()) {
        initSubTaskGrid();
        populateSubTasks(subTasks);
    } else {
        initNoSubTasksLabel();
    }
}
Also used : HistoricTaskInstance(org.activiti.engine.history.HistoricTaskInstance) VerticalLayout(com.vaadin.ui.VerticalLayout)

Aggregations

VerticalLayout (com.vaadin.ui.VerticalLayout)101 Label (com.vaadin.ui.Label)38 HorizontalLayout (com.vaadin.ui.HorizontalLayout)25 Button (com.vaadin.ui.Button)24 Chart (com.vaadin.addon.charts.Chart)18 ClickEvent (com.vaadin.ui.Button.ClickEvent)15 Link (com.vaadin.ui.Link)15 ExternalResource (com.vaadin.server.ExternalResource)11 Configuration (com.vaadin.addon.charts.model.Configuration)10 ListSeries (com.vaadin.addon.charts.model.ListSeries)9 ClickListener (com.vaadin.ui.Button.ClickListener)8 PostConstruct (javax.annotation.PostConstruct)8 YAxis (com.vaadin.addon.charts.model.YAxis)7 DataSeries (com.vaadin.addon.charts.model.DataSeries)6 Panel (com.vaadin.ui.Panel)6 XAxis (com.vaadin.addon.charts.model.XAxis)5 Embedded (com.vaadin.ui.Embedded)5 TextField (com.vaadin.ui.TextField)5 PointClickEvent (com.vaadin.addon.charts.PointClickEvent)4 PointClickListener (com.vaadin.addon.charts.PointClickListener)4