List of usage examples for com.vaadin.ui Embedded setWidth
@Override public void setWidth(String width)
From source file:edu.nps.moves.mmowgli.utility.MediaLocator.java
License:Open Source License
public Embedded getImRegisteredButton133w24h() { Embedded emb = new Embedded(null, locate(new Media("imRegisteredButton133w24h.png", "", "", MediaType.IMAGE, Source.GAME_IMAGES_REPOSITORY))); emb.setWidth("133px"); emb.setHeight("24px"); return emb;/* w ww .j av a 2s. co m*/ }
From source file:edu.nps.moves.mmowgli.utility.MediaLocator.java
License:Open Source License
public Embedded getGuestLogin97w24h() { Embedded emb = new Embedded(null, locate(new Media("guestLogin97w24h.png", "", "", MediaType.IMAGE, Source.GAME_IMAGES_REPOSITORY))); emb.setWidth("97px"); emb.setHeight("24px"); return emb;// w w w .ja va 2s . co m }
From source file:gov.va.ds4p.ds4pmobileportal.ui.eHealthExchange.java
License:Open Source License
private Popover getPopoverPDF(String val, String title) { Popover popover = new Popover(); popover.setModal(true);/* w w w. ja va 2s . com*/ popover.setClosable(true); popover.setWidth("700px"); popover.setHeight("100%"); CssLayout popLayout = new CssLayout(); popLayout.setSizeFull(); popLayout.setMargin(true); NavigationView navView = new NavigationView(popLayout); navView.setCaption(title); CssLayout layout2 = new CssLayout(); Embedded pdf = new Embedded(); pdf.setType(Embedded.TYPE_BROWSER); pdf.setMimeType("application/pdf"); pdf.setSizeFull(); pdf.setWidth("100%"); pdf.setHeight("700px"); pdf.setSource(createPdf(val)); layout2.addComponent(pdf); popLayout.addComponent(layout2); Button close = new Button(null, new ClickListener() { public void buttonClick(ClickEvent event) { event.getButton().getWindow().getParent().removeWindow(event.getButton().getWindow()); } }); close.setIcon(new ThemeResource("../runo/icons/64/cancel.png")); navView.setRightComponent(close); popover.setContent(navView); return popover; }
From source file:nl.amc.biolab.nsg.display.component.ProcessingStatusForm.java
License:Open Source License
private void showHTML(final String htmlContent, final Application app) throws IllegalArgumentException, NullPointerException { app.getMainWindow().addWindow(new Window() { private static final long serialVersionUID = -2307854110750435145L; {/*from w ww. j a va 2 s. c o m*/ center(); setWidth("75%"); setHeight("600px"); StreamResource.StreamSource source = new StreamResource.StreamSource() { private static final long serialVersionUID = -3745013501121916404L; public InputStream getStream() { return new ByteArrayInputStream(htmlContent.getBytes()); } }; StreamResource resource = new StreamResource(source, "TestReport.html", app); Embedded e = new Embedded(); e.setMimeType("text/html"); e.setType(Embedded.TYPE_BROWSER); e.setWidth("100%"); e.setHeight("590px"); e.setSource(resource); addComponent(e); } }); }
From source file:org.activiti.explorer.ui.management.processinstance.ProcessInstanceDetailPanel.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 = 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; }//w ww . j a v a 2 s.c o m 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 && processDefinitionEntity.isGraphicalNotationDefined()) { ProcessEngineConfiguration processEngineConfiguration = ProcessEngines.getDefaultProcessEngine() .getProcessEngineConfiguration(); ProcessDiagramGenerator diagramGenerator = processEngineConfiguration.getProcessDiagramGenerator(); StreamResource diagram = new ProcessDefinitionImageStreamResourceBuilder().buildStreamResource( processInstance, repositoryService, runtimeService, diagramGenerator, processEngineConfiguration); 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.activiti.explorer.ui.process.ProcessDefinitionInfoComponent.java
License:Apache License
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 {//from w ww . j a va2 s .c o m 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; } } 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()); 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(); Panel imagePanel = new Panel(); // using panel for scrollbars 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); }
From source file:org.activiti.explorer.ui.task.TaskEventsPanel.java
License:Apache License
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(); }//from ww w. j a v a2 s .c o m }, "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); }
From source file:org.activiti.explorer.ui.task.UserDetailsComponent.java
License:Apache License
protected void addUserPicture() { Resource pictureResource = Images.USER_32; // default icon if (user != null) { final Picture userPicture = identityService.getUserPicture(user.getId()); if (userPicture != null) { pictureResource = new StreamResource(new StreamSource() { public InputStream getStream() { return userPicture.getInputStream(); }//from w w w . j a v a 2 s . co m }, 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()); } }); } }
From source file:org.apache.ace.webui.vaadin.component.BaseObjectPanel.java
License:Apache License
/** * Factory method to create an embeddable icon. * //from w w w .j a v a 2s . com * @param name * the name of the icon to use (is also used as tooltip text); * @param res * the resource denoting the actual icon. * @return an embeddable icon, never <code>null</code>. */ protected Embedded createIcon(String name, Resource res) { Embedded embedded = new Embedded(name, res); embedded.setType(Embedded.TYPE_IMAGE); embedded.setDescription(name); embedded.setHeight(ICON_HEIGHT + "px"); embedded.setWidth(ICON_WIDTH + "px"); return embedded; }
From source file:org.diretto.web.richwebclient.view.sections.UploadSection.java
/** * Uploads the currently processed file. * //from w ww . ja v a 2 s . c om * @param uploadSettings The {@code UploadSettings} of the file * @param filesWithSameSettings A {@code List} with the names of the files * which should get the given {@code UploadSettings} as presetting */ public void upload(final UploadSettings uploadSettings, List<String> filesWithSameSettings) { final FileInfo fileInfo = currentFile; settings.put(fileInfo.getName(), uploadSettings); for (String fileName : filesWithSameSettings) { preSettings.put(fileName, uploadSettings); } new Thread(new Runnable() { @Override public void run() { ProgressIndicator progressIndicator = multipleUpload.upload(fileInfo); synchronized (application) { VerticalLayout uploadBoxLayout = new VerticalLayout(); mainLayout.addComponent(uploadBoxLayout); HorizontalLayout fileInfoLayout = new HorizontalLayout(); uploadBoxLayout.addComponent(fileInfoLayout); Label nameLabel = StyleUtils.getLabelBold(fileInfo.getName()); fileInfoLayout.addComponent(nameLabel); fileInfoLayout.addComponent(StyleUtils.getLabelSmallHTML(" ")); fileInfoLayout.setComponentAlignment(nameLabel, Alignment.MIDDLE_LEFT); BigDecimal fileSize = new BigDecimal((((double) fileInfo.getSize()) / 1000000.0d)); fileSize = fileSize.setScale(2, BigDecimal.ROUND_HALF_UP); Label typeSizeLabel = StyleUtils.getLabelSmallHTML( fileInfo.getType() + " -- " + fileSize.toPlainString() + " MB"); fileInfoLayout.addComponent(typeSizeLabel); fileInfoLayout.setComponentAlignment(typeSizeLabel, Alignment.MIDDLE_LEFT); uploadBoxLayout.addComponent(StyleUtils.getVerticalSpace("100%", "8px")); uploadBoxLayout.addComponent(progressIndicator); uploadBoxLayout.addComponent(StyleUtils.getVerticalSpace("100%", "8px")); HorizontalLayout resultLayout = new HorizontalLayout(); uploadBoxLayout.addComponent(resultLayout); Label uploadedLabel = StyleUtils.getLabelSmallHTML("Uploaded: "); resultLayout.addComponent(uploadedLabel); resultLayout.setComponentAlignment(uploadedLabel, Alignment.MIDDLE_LEFT); Embedded uploadedEmbedded = new Embedded(null, ResourceUtils.RUNO_ICON_32_GLOBE_RESOURCE); uploadedEmbedded.addStyleName("image-opacity-65"); uploadedEmbedded.setType(Embedded.TYPE_IMAGE); uploadedEmbedded.setImmediate(true); uploadedEmbedded.setWidth("22px"); uploadedEmbedded.setHeight("22px"); resultLayout.addComponent(uploadedEmbedded); uploadedEmbeddeds.put(fileInfo, uploadedEmbedded); resultLayout.addComponent(StyleUtils.getLabelSmallHTML(" ")); Label publishedLabel = StyleUtils.getLabelSmallHTML("Published: "); resultLayout.addComponent(publishedLabel); resultLayout.setComponentAlignment(publishedLabel, Alignment.MIDDLE_LEFT); Embedded publishedEmbedded = new Embedded(null, ResourceUtils.RUNO_ICON_32_GLOBE_RESOURCE); publishedEmbedded.addStyleName("image-opacity-65"); publishedEmbedded.setType(Embedded.TYPE_IMAGE); publishedEmbedded.setImmediate(true); publishedEmbedded.setWidth("22px"); publishedEmbedded.setHeight("22px"); resultLayout.addComponent(publishedEmbedded); publishedEmbeddeds.put(fileInfo, publishedEmbedded); mainLayout.addComponent(StyleUtils.getVerticalSpace("100%", "5px")); requestRepaint(); } } }).start(); handleNextFile(); }