Example usage for com.vaadin.ui Embedded Embedded

List of usage examples for com.vaadin.ui Embedded Embedded

Introduction

In this page you can find the example usage for com.vaadin.ui Embedded Embedded.

Prototype

public Embedded(String caption, Resource source) 

Source Link

Document

Creates a new Embedded object whose contents is loaded from given resource.

Usage

From source file:org.milleni.dunning.ui.customer.form.CustomProcessInstanceDetailPanel.java

License:Apache License

protected void addProcessImage() {
    ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
            .getDeployedProcessDefinition(processDefinition.getId());

    // Only show when graphical notation is defined
    if (processDefinitionEntity != null) {

        boolean didDrawImage = false;

        if (ExplorerApp.get().isUseJavascriptDiagram()) {
            try {

                final InputStream definitionStream = repositoryService.getResourceAsStream(
                        processDefinition.getDeploymentId(), processDefinition.getResourceName());
                XMLInputFactory xif = XMLInputFactory.newInstance();
                XMLStreamReader xtr = xif.createXMLStreamReader(definitionStream);
                BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr);

                if (bpmnModel.getFlowLocationMap().size() > 0) {

                    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;
                        }//from ww  w.j a v  a 2  s .  com
                        double elementY = graphicInfo.getY() + graphicInfo.getHeight();
                        if (maxY < elementY) {
                            maxY = (int) elementY;
                        }
                    }

                    Panel imagePanel = new Panel(); // using panel for scrollbars
                    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() + "&processInstanceId="
                                    + processInstance.getId());
                    Embedded browserPanel = new Embedded("", new ExternalResource(url));
                    browserPanel.setType(Embedded.TYPE_BROWSER);
                    browserPanel.setWidth(maxX + 350 + "px");
                    browserPanel.setHeight(maxY + 220 + "px");

                    HorizontalLayout panelLayoutT = new HorizontalLayout();
                    panelLayoutT.setSizeUndefined();
                    imagePanel.setContent(panelLayoutT);
                    imagePanel.addComponent(browserPanel);

                    panelLayout.addComponent(imagePanel);

                    didDrawImage = true;
                }

            } catch (Exception e) {
                LOGGER.error("Error loading process diagram component", e);
            }
        }

        if (didDrawImage == false && processDefinitionEntity.isGraphicalNotationDefined()) {

            StreamResource diagram = new ProcessDefinitionImageStreamResourceBuilder()
                    .buildStreamResource(processInstance, repositoryService, runtimeService);

            if (diagram != null) {
                Label header = new Label(i18nManager.getMessage(Messages.PROCESS_HEADER_DIAGRAM));
                header.addStyleName(ExplorerLayout.STYLE_H3);
                header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
                header.addStyleName(ExplorerLayout.STYLE_NO_LINE);
                panelLayout.addComponent(header);

                Embedded embedded = new Embedded(null, diagram);
                embedded.setType(Embedded.TYPE_IMAGE);
                embedded.setSizeUndefined();

                Panel imagePanel = new Panel(); // using panel for scrollbars
                imagePanel.setScrollable(true);
                imagePanel.addStyleName(Reindeer.PANEL_LIGHT);
                imagePanel.setWidth(100, UNITS_PERCENTAGE);
                imagePanel.setHeight(100, UNITS_PERCENTAGE);

                HorizontalLayout panelLayoutT = new HorizontalLayout();
                panelLayoutT.setSizeUndefined();
                imagePanel.setContent(panelLayoutT);
                imagePanel.addComponent(embedded);

                panelLayout.addComponent(imagePanel);
            }
        }
    }
}

From source file:org.milleni.dunning.ui.dpdetail.DunningProcessDetailTableListItem.java

License:Apache License

public DunningProcessDetailTableListItem(DunningProcessDetail dpDetail) {
    this.dpDetail = dpDetail;
    Button detailsField = new Button(dpDetail.getProcessId().getBpmProcessId());
    detailsField.setData(dpDetail.getProcessId().getBpmProcessId());
    detailsField.addListener(new Button.ClickListener() {

        @Override//from   w  w  w .ja v a  2  s . c o m
        public void buttonClick(ClickEvent event) {
            String processId = (String) event.getButton().getData();
            ExplorerApp.get().getViewManager().showPopupWindow(new ProcessDetailPopupWindow(processId));
        }
    });

    Embedded embed = null;
    if (dpDetail.getStatus() != null && Constants.SUCCESS.equals(dpDetail.getStatus().getId())) {
        embed = new Embedded(null, Images.TASK_FINISHED_22);
    } else {
        embed = new Embedded(null, Images.TASK_22);
    }

    String customerName = "";
    String customerStatus = "";
    String masterStatus = "";
    String startDebit = "";
    String currentDebit = "";
    Date dunningInvoiceDate = null;
    Date dunningInvoiceDueDate = null;

    DunningProcessMaster dpm = dpDetail.getProcessId();
    if (dpm != null) {
        Customer customer = dpm.getCustomerId();
        if (customer != null) {
            customerName = customer.getCustomerName();
            customerStatus = customer.getStatus();
        }
        masterStatus = dpm.getStatus() != null ? dpm.getStatus().getStatusText() : "";
        startDebit = dpm.getCurrentDebit() != null ? dpm.getCurrentDebit().toString() : "";
        currentDebit = customer.getCurrentDebit() != null ? customer.getCurrentDebit().toString() : "";
        dunningInvoiceDate = dpm.getDunningInvoiceId() != null ? dpm.getDunningInvoiceId().getInvoiceDate()
                : null;
        dunningInvoiceDueDate = dpm.getDunningInvoiceId() != null
                ? dpm.getDunningInvoiceId().getInvoiceDueDate()
                : null;
    }

    addItemProperty("finished", new ObjectProperty<Embedded>(embed, Embedded.class));
    addItemProperty("name",
            new ObjectProperty<String>(
                    dpDetail.getProcessStepId() != null ? dpDetail.getProcessStepId().getStepText() : "",
                    String.class));
    addItemProperty("startDate", new ObjectProperty<Date>(dpDetail.getCreateDate(), Date.class));
    addItemProperty("endDate", new ObjectProperty<Date>(dpDetail.getStatusDate(), Date.class));
    addItemProperty("status", new ObjectProperty<String>(
            dpDetail.getStatus() != null ? dpDetail.getStatus().getStatusText() : "", String.class));
    addItemProperty("customerId",
            new ObjectProperty<String>(
                    (dpDetail.getProcessId() != null && dpDetail.getProcessId().getCustomerId() != null)
                            ? dpDetail.getProcessId().getCustomerId().getCustomerId()
                            : "",
                    String.class));
    addItemProperty("startDebit", new ObjectProperty<String>(startDebit, String.class));

    addItemProperty("customerName", new ObjectProperty<String>(customerName, String.class));
    addItemProperty("customerStatus", new ObjectProperty<String>(customerStatus, String.class));
    addItemProperty("masterStatus", new ObjectProperty<String>(masterStatus, String.class));
    addItemProperty("dunningInvoiceDate", new ObjectProperty<Date>(dunningInvoiceDate, Date.class));
    addItemProperty("dunningInvoiceDueDate", new ObjectProperty<Date>(dunningInvoiceDueDate, Date.class));
    addItemProperty("currentDebit", new ObjectProperty<String>(currentDebit, String.class));

}

From source file:org.milleni.dunning.ui.prcstart.BulkDunningProcessFinishPanel.java

License:Apache License

protected void initPageTitle() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setWidth(100, UNITS_PERCENTAGE);
    layout.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    layout.setSpacing(true);// w  w  w  .j  a va2  s.c o m
    layout.setMargin(false, false, true, false);
    addDetailComponent(layout);

    Embedded databaseImage = new Embedded(null, Images.DATABASE_50);
    layout.addComponent(databaseImage);

    Label groupName = new Label(i18nManager.getMessage(Messages.MAIN_MENU_DUNNING_PROCESS_BITIR));
    groupName.setSizeUndefined();
    groupName.addStyleName(Reindeer.LABEL_H2);
    layout.addComponent(groupName);
    layout.setComponentAlignment(groupName, Alignment.MIDDLE_LEFT);
    layout.setExpandRatio(groupName, 1.0f);
}

From source file:org.milleni.dunning.ui.prcstart.BulkDunningProcessStartPanel.java

License:Apache License

protected void initPageTitle() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setWidth(100, UNITS_PERCENTAGE);
    layout.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    layout.setSpacing(true);/*ww w  . j a  va  2 s .  c o  m*/
    layout.setMargin(false, false, true, false);
    addDetailComponent(layout);

    Embedded databaseImage = new Embedded(null, Images.DATABASE_50);
    layout.addComponent(databaseImage);

    Label groupName = new Label(i18nManager.getMessage(Messages.MAIN_MENU_DUNNING_PROCESS_BASLAT));
    groupName.setSizeUndefined();
    groupName.addStyleName(Reindeer.LABEL_H2);
    layout.addComponent(groupName);
    layout.setComponentAlignment(groupName, Alignment.MIDDLE_LEFT);
    layout.setExpandRatio(groupName, 1.0f);

}

From source file:org.milleni.dunning.ui.prcstart.CompleteFinansTaskPanel.java

License:Apache License

protected void initPageTitle() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setWidth(100, UNITS_PERCENTAGE);
    layout.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    layout.setSpacing(true);/*w  ww  .  j ava 2 s .com*/
    layout.setMargin(false, false, true, false);
    addDetailComponent(layout);

    Embedded databaseImage = new Embedded(null, Images.DATABASE_50);
    layout.addComponent(databaseImage);

    Label groupName = new Label("Finans Task Tamamla");
    groupName.setSizeUndefined();
    groupName.addStyleName(Reindeer.LABEL_H2);
    layout.addComponent(groupName);
    layout.setComponentAlignment(groupName, Alignment.MIDDLE_LEFT);
    layout.setExpandRatio(groupName, 1.0f);

    yasalOrTakipCombo = new ComboBox("Yasal Surec Durumu");
    yasalOrTakipCombo.addItem(yasalTakip);
    yasalOrTakipCombo.addItem(takipDisiBirak);
}

From source file:org.milleni.dunning.ui.prcstart.DunningProcessTimingOperationsPanel.java

License:Apache License

protected void initPageTitle() {
    HorizontalLayout layout = createHorizontalLayout();
    addDetailComponent(layout);//w  w  w. j a va  2 s.  c om

    Embedded databaseImage = new Embedded(null, Images.DATABASE_50);
    layout.addComponent(databaseImage);

    Label groupName = new Label("Toplu Tarih Ve Adim Degistirme");
    groupName.setSizeUndefined();
    groupName.addStyleName(Reindeer.LABEL_H2);
    layout.addComponent(groupName);
    layout.setComponentAlignment(groupName, Alignment.MIDDLE_LEFT);
    layout.setExpandRatio(groupName, 1.0f);

    List<DunningPolicy> dunningPolicyList = new ArrayList<DunningPolicy>();
    Iterable<DunningPolicy> dunningPolicies = DaoHelper.getInstance().getDunningPolicyRepository().findAll();
    for (DunningPolicy dunningPolicy : dunningPolicies) {
        dunningPolicyList.add(dunningPolicy);
    }
    BeanItemContainer<DunningPolicy> objects = new BeanItemContainer(DunningPolicy.class, dunningPolicyList);

    policyCombo = new ComboBox(i18nManager.getMessage(Constants.DUNNING_POLICY_TYPE), objects);
    policyCombo.setItemCaptionPropertyId("policyName");

    stepCombo = new ComboBox(i18nManager.getMessage(Constants.DUNNING_NEXT_STEP));
    stepCombo.setItemCaptionPropertyId("stepText");

    nextStepCombo = new ComboBox(i18nManager.getMessage(Constants.DUNNING_NEXT_STEP));
    nextStepCombo.setItemCaptionPropertyId("stepText");

    nextStepDateStart = new DateField(i18nManager.getMessage(Constants.DUNNING_NEXT_STEP_DATE_START));
    executionDate = new DateField(i18nManager.getMessage(Constants.DUNNING_NEXT_STEP_DATE_START));
    nextStepDateEnd = new DateField(i18nManager.getMessage(Constants.DUNNING_NEXT_STEP_DATE_END));

    policyCombo.addListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            selectedDunningPolicy = (DunningPolicy) event.getProperty().getValue();
            List<ProcessSteps> processSteps = DaoHelper.getInstance().getDunningPolicyRepository()
                    .retrieveDunningProcessSteps(selectedDunningPolicy.getPolicyId());
            BeanItemContainer<ProcessSteps> objects = new BeanItemContainer(ProcessSteps.class, processSteps);
            stepCombo.setContainerDataSource(objects);
            nextStepCombo.setContainerDataSource(objects);
        }

    });

    stepCombo.addListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            selectedProcessStep = (ProcessSteps) event.getProperty().getValue();
        }

    });

    nextStepCombo.addListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            nextSelectedProcessStep = (ProcessSteps) event.getProperty().getValue();
        }

    });

}

From source file:org.milleni.dunning.ui.prcstart.StepSelectStartDunningProcessPanel.java

License:Apache License

protected void initPageTitle() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setWidth(100, UNITS_PERCENTAGE);
    layout.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    layout.setSpacing(true);//from   www. j  a v  a 2  s  .c  om
    layout.setMargin(false, false, true, false);
    addDetailComponent(layout);

    Embedded databaseImage = new Embedded(null, Images.DATABASE_50);
    layout.addComponent(databaseImage);

    Label groupName = new Label(i18nManager.getMessage(Messages.MAIN_MENU_DUNNING_PROCESS_BASLAT));
    groupName.setSizeUndefined();
    groupName.addStyleName(Reindeer.LABEL_H2);
    layout.addComponent(groupName);
    layout.setComponentAlignment(groupName, Alignment.MIDDLE_LEFT);
    layout.setExpandRatio(groupName, 1.0f);

    List<DunningPolicy> dunningPolicyList = new ArrayList<DunningPolicy>();
    Iterable<DunningPolicy> dunningPolicies = DaoHelper.getInstance().getDunningPolicyRepository().findAll();
    for (DunningPolicy dunningPolicy : dunningPolicies) {
        dunningPolicyList.add(dunningPolicy);
    }
    BeanItemContainer<DunningPolicy> objects = new BeanItemContainer(DunningPolicy.class, dunningPolicyList);

    policyCombo = new ComboBox(i18nManager.getMessage(Constants.DUNNING_POLICY_TYPE), objects);
    policyCombo.setItemCaptionPropertyId("policyName");

    stepCombo = new ComboBox(i18nManager.getMessage(Constants.DUNNING_POLICY_STEP));
    stepCombo.setItemCaptionPropertyId("stepText");
    policyCombo.addListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            DunningPolicy selectedDunningPolicy = (DunningPolicy) event.getProperty().getValue();
            List<ProcessSteps> processSteps = DaoHelper.getInstance().getDunningPolicyRepository()
                    .retrieveDunningProcessSteps(selectedDunningPolicy.getPolicyId());
            BeanItemContainer<ProcessSteps> objects = new BeanItemContainer(ProcessSteps.class, processSteps);
            stepCombo.setContainerDataSource(objects);
        }

    });

    stepCombo.addListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            selectedProcessStep = (ProcessSteps) event.getProperty().getValue();
        }

    });

}

From source file:org.milleni.dunning.ui.prcstart.TaskViewPanel.java

License:Apache License

protected void initPageTitle() {
    HorizontalLayout layout = createHorizontalLayout();
    addDetailComponent(layout);/* w ww  .ja  va2  s.  co m*/

    Embedded databaseImage = new Embedded(null, Images.DATABASE_50);
    layout.addComponent(databaseImage);

    Label groupName = new Label("Task Durum Sorgula");
    groupName.setSizeUndefined();
    groupName.addStyleName(Reindeer.LABEL_H2);
    layout.addComponent(groupName);
    layout.setComponentAlignment(groupName, Alignment.MIDDLE_LEFT);
    layout.setExpandRatio(groupName, 1.0f);

    BeanItemContainer<DunningPolicy> objects = new BeanItemContainer(TaskDefObject.class, taskDefs);

    taskDefCombo = new ComboBox("Tasklar", objects);
    taskDefCombo.setItemCaptionPropertyId("desc");

    taskDefCombo.addListener(new ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            selectedTaskDef = (TaskDefObject) event.getProperty().getValue();
        }
    });

}

From source file:org.opennms.features.topology.api.support.InfoWindow.java

License:Open Source License

public InfoWindow(final URL embeddedURL, LabelCreator labelCreator) {
    infoBrowser = new Embedded("", new ExternalResource(embeddedURL));

    String label = labelCreator == null ? "" : labelCreator.getLabel();
    setCaption(label);//from ww  w  .jav a2 s . co  m
    setImmediate(true);
    setResizable(false);
    setModal(true);

    /*Adds the browser to the main layout*/
    VerticalLayout layout = new VerticalLayout();
    layout.addComponent(infoBrowser);

    setContent(layout);
}

From source file:org.opennms.features.topology.netutils.internal.EventsAlarmsWindow.java

License:Open Source License

/**
 * The EventsAlarmsWindow method constructs a sub-window instance which can be added to a
 * main window. The sub-window contains two embedded browsers which are directed at the Events
 * and Alarms page of the selected node// www.j  a v  a  2 s .  co  m
 * @param node Selected node
 * @param width Width of main window
 * @param height Height of main window
 * @throws MalformedURLException
 */
public EventsAlarmsWindow(final Node node, final URL eventsURL, final URL alarmsURL)
        throws MalformedURLException {
    super("Events & Alarms" + makeLabel(node));
    eventsBrowser = new Embedded("", new ExternalResource(eventsURL));
    eventsBrowser.setSizeFull();
    alarmsBrowser = new Embedded("", new ExternalResource(alarmsURL));
    alarmsBrowser.setSizeFull();

    setImmediate(true);
    setResizable(false);

    /*Adds the two browsers to separate tabs in a tabsheet layout*/
    m_tabSheet = new TabSheet();
    m_tabSheet.setSizeFull();
    m_tabSheet.addTab(eventsBrowser, "Events");
    m_tabSheet.addTab(alarmsBrowser, "Alarms");

    /*Adds tabsheet component to the main layout of the sub-window*/
    VerticalLayout layout = new VerticalLayout();
    layout.addComponent(m_tabSheet);
    layout.setSizeFull();
    setContent(layout);

}