List of usage examples for com.vaadin.ui Embedded setType
public void setType(int type)
From source file:org.apache.ace.webui.vaadin.component.BaseObjectPanel.java
License:Apache License
/** * Factory method to create an embeddable icon. * // w w w. ja 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(); }
From source file:org.eclipse.hawkbit.ui.decorators.SPUIEmbedDecorator.java
License:Open Source License
/** * Decorate.//from ww w . j a va 2 s. c om * * @param spUIEmbdValue * as DTO * @return Embedded as UI */ public static Embedded decorate(final SPUIEmbedValue spUIEmbdValue) { final Embedded spUIEmbd = new Embedded(); spUIEmbd.setImmediate(spUIEmbdValue.isImmediate()); spUIEmbd.setType(spUIEmbdValue.getType()); if (null != spUIEmbdValue.getId()) { spUIEmbd.setId(spUIEmbdValue.getId()); } if (null != spUIEmbdValue.getData()) { spUIEmbd.setData(spUIEmbdValue.getData()); } if (null != spUIEmbdValue.getStyleName()) { spUIEmbd.setStyleName(spUIEmbdValue.getStyleName()); } if (null != spUIEmbdValue.getSource()) { spUIEmbd.setSource(new ThemeResource(spUIEmbdValue.getSource())); } if (null != spUIEmbdValue.getMimeType()) { spUIEmbd.setMimeType(spUIEmbdValue.getMimeType()); } if (null != spUIEmbdValue.getDescription()) { spUIEmbd.setDescription(spUIEmbdValue.getDescription()); } return spUIEmbd; }
From source file:org.fossa.rolp.demo.DemoWelcomeScreen.java
License:Open Source License
public DemoWelcomeScreen(RolpApplication app, FossaAuthorizer authorizer) { super(app);/*from w w w.jav a2s . c o m*/ this.app = app; setStyleName("demo"); setWidth("900px"); center(); this.authorizer = authorizer; CustomLayout layout = new CustomLayout("./demo/welcomeScreen"); CustomLayout layoutTop = new CustomLayout("./demo/welcomeScreenTop"); CustomLayout layoutMiddle = new CustomLayout("./demo/welcomeScreenMiddle"); CustomLayout layoutBottom = new CustomLayout("./demo/welcomeScreenBottom"); Embedded logoRolp = new Embedded(null, new ThemeResource(DEMO_LOGO_ROLP_PATH)); logoRolp.setType(Embedded.TYPE_IMAGE); logoRolp.setWidth("100px"); logoRolp.setHeight("96px"); Label rolpDemoText = new Label( "<h2>Wilkommen</h2>Dies ist eine Demoversion der Software ROLP. Whlen Sie eine Rolle aus, um in das entsprechende Szenario zu gelangen. Der Schulleiter hat eine eigene Verwaltungsoberflche, wo er die Lehrer und Klassen berblicken und zuweisen kann. Als Klassenlehrer und Fachlehrer gelangt man auf den Startbildschirm. Von da aus gelangt man zum Klassenlehrer-Dashboard und dem Fachlehrer-Dashboard. Der Klassenlehrer hat Zugang zu beiden Dashboards, da er im Normalfall auch Fcher unterrichtet.", Label.CONTENT_XHTML); Label githubLinkDummy = new Label( "ROLP auf <a href=\"https://github.com/fossaag/rolp\" target=\"_blank\">GitHub.com</a>", Label.CONTENT_XHTML); Embedded logoFossa = new Embedded(null, new ThemeResource(DEMO_LOGO_FOSSA_PATH)); logoFossa.setType(Embedded.TYPE_IMAGE); logoFossa.setWidth("150px"); Label roleSelectCaption = new Label("Bitte whlen Sie eine Rolle aus:", Label.CONTENT_XHTML); BeanItemContainer<String> roles = new BeanItemContainer<String>(String.class); roles.addBean("Fachlehrer"); roles.addBean("Klassenlehrer"); roles.addBean("Schulleiter"); roleSelect.setContainerDataSource(roles); roleSelect.setWidth("200px"); layoutTop.addComponent(logoRolp, "logoRolp"); layoutTop.addComponent(rolpDemoText, "rolpDemoText"); layoutTop.addComponent(logoFossa, "logoFossa"); layout.addComponent(layoutTop, "layoutTop"); layoutMiddle.addComponent(roleSelectCaption, "roleSelectCaption"); layoutMiddle.addComponent(roleSelect, "roleSelect"); layoutMiddle.addComponent(okButton, "okButton"); layout.addComponent(layoutMiddle, "layoutMiddle"); layoutBottom.addComponent(githubLinkDummy, "githubLinkDummy"); layout.addComponent(layoutBottom, "layoutBottom"); setContent(layout); }
From source file:org.fossa.rolp.RolpApplication.java
License:Open Source License
@Override public void buildMainLayout() { Embedded logo = new Embedded(null, new ThemeResource(MAINPAGE_PANEL_ANMELDEN_LOGO_PATH)); logo.setType(Embedded.TYPE_IMAGE); logo.setWidth("100px"); logo.setHeight("96px"); headlineApp.addComponent(logo, "logo"); headlineApp.addComponent(authorizerLayout, "authorizerLayout"); headlineApp.addStyleName("headlineApp"); layout.addComponent(headlineApp, "headlineApp"); getMainWindow().setContent(layout);//from w w w . java2 s .c o m getMainWindow().addComponent(getAnimator()); if (getLoginLehrer().getIsAdmin()) { layout.addComponent(getAdminDashboard(), "admin"); } else { layout.addComponent(main, "main"); buildAppLayout(); } }
From source file:org.fossa.rolp.ui.dashboard.FachlehrerDashboard.java
License:Open Source License
public FachlehrerDashboard(RolpApplication app) { super(app);/*from w ww . j ava 2s .c o m*/ this.app = app; setCaption(" - FachlehrerDashboard - "); setWidth("100%"); setHeight("100%"); buildButtonBatteries(); CustomLayout layout = new CustomLayout("./lehrerDashboards/fachLehrerDashboardMain"); setContent(layout); CustomLayout headline = new CustomLayout("./lehrerDashboards/headline"); headline.addStyleName("headline"); Embedded logo = new Embedded(null, new ThemeResource(MAINPAGE_PANEL_ANMELDEN_LOGO_PATH)); logo.setType(Embedded.TYPE_IMAGE); logo.setWidth("100px"); logo.setHeight("96px"); headline.addComponent(logo, "logo"); CustomLayout faecherListe = new CustomLayout("./lehrerDashboards/liste"); faecherListe.addStyleName("liste"); faecherList = getFaecherList(); faecherList.setHeight("250px"); faecherList.setStyleName("list"); faecherListe.addComponent(faecherList, "list"); faecherListe.setHeight("260px"); layout.addComponent(faecherListe, "liste"); layout.addComponent(headline, "headline"); layout.addComponent(horizontalButtonBattery, "horizontalButtonBattery"); lehrerBlog = getLehrerBlog(); layout.addComponent(lehrerBlog, "blog"); windowCloseButton.setWidth("100%"); layout.addComponent(windowCloseButton, "windowCloseButton"); }
From source file:org.fossa.rolp.ui.dashboard.KlassenlehrerDashboard.java
License:Open Source License
public KlassenlehrerDashboard(RolpApplication app) { super(app);//from ww w . ja v a 2 s. c o m this.app = app; setCaption(" - KlassenlehrerDashboard - "); setWidth("100%"); setHeight("100%"); buildButtonBatteries(); CustomLayout layout = new CustomLayout("./lehrerDashboards/klassenLehrerDashboardMain"); setContent(layout); CustomLayout headline = new CustomLayout("./lehrerDashboards/headline"); headline.addStyleName("headline"); Embedded logo = new Embedded(null, new ThemeResource(MAINPAGE_PANEL_ANMELDEN_LOGO_PATH)); logo.setType(Embedded.TYPE_IMAGE); logo.setWidth("100px"); logo.setHeight("96px"); headline.addComponent(logo, "logo"); headline.addComponent(headdataEditingPanel, "headdataEditingPanel"); Panel hints = new Panel(); hints.addStyleName("hints"); hinweistext = new Label(); hinweistext.setContentMode(Label.CONTENT_XHTML); hinweistext.setReadOnly(true); hinweistext.setHeight("250px"); hints.setHeight("250px"); hints.setScrollable(true); hints.addComponent(hinweistext); refreshHinweistext(); CustomLayout schuelerListe = new CustomLayout("./lehrerDashboards/liste"); schuelerListe.addStyleName("liste"); schuelerList = getSchuelerList(); schuelerList.setHeight("250px"); schuelerList.setStyleName("list"); schuelerListe.addComponent(schuelerList, "list"); schuelerListe.setHeight("260px"); layout.addComponent(schuelerListe, "liste"); layout.addComponent(headline, "headline"); layout.addComponent(horizontalButtonBattery, "horizontalButtonBattery"); layout.addComponent(verticalButtonBattery, "verticalButtonBattery"); layout.addComponent(hints, "hints"); windowCloseButton.setWidth("100%"); layout.addComponent(windowCloseButton, "windowCloseButton"); // app.getAnimator().animate(horizontalButtonBattery, AnimType.ROLL_DOWN_OPEN_POP).setDuration(500).setDelay(500); }
From source file:org.fossa.rolp.ui.leb.LebAnzeigen.java
License:Open Source License
public LebAnzeigen(FossaApplication app, SchuelerLaso schueler, KlasseLaso klasse) throws DocumentException, IOException { super(app);/* w w w. j a v a 2s . c o m*/ setCaption(" - Lernentwicklungsbericht anzeigen - "); VerticalLayout layout = new VerticalLayout(); setWidth("800px"); setContent(layout); layout.setSpacing(true); Embedded embeddedPdf = new Embedded(); embeddedPdf.setType(Embedded.TYPE_BROWSER); DateFormat dateFormat = new SimpleDateFormat("ddMMyy-HHmmss"); String dateiname = "Klasse" + klasse.getKlassenname() + "_" + schueler.getVorname() + "_" + schueler.getName() + "_" + dateFormat.format(new Date()) + ".pdf"; embeddedPdf.setSource(new LebCreator(app, schueler, klasse, dateiname).getLebResource()); embeddedPdf.setWidth(100, Sizeable.UNITS_PERCENTAGE); embeddedPdf.setHeight("580px"); windowCloseButton.setWidth(100, Sizeable.UNITS_PERCENTAGE); layout.addComponent(embeddedPdf); layout.addComponent(windowCloseButton); }
From source file:org.generationcp.breeding.manager.crossingmanager.EmbeddedGermplasmListDetailComponent.java
License:Open Source License
@Override public void afterPropertiesSet() throws Exception { setMargin(false);/*from w w w . j av a 2s. co m*/ setSpacing(true); setWidth("800px"); Tool tool = null; try { tool = workbenchDataManager.getToolWithName(ToolName.germplasm_list_browser.toString()); } catch (MiddlewareQueryException qe) { LOG.error("QueryException", qe); } ExternalResource listBrowserLink = null; if (tool == null) { listBrowserLink = new ExternalResource( "http://localhost:18080/GermplasmStudyBrowser/main/germplasmlist-" + listId); } else { listBrowserLink = new ExternalResource( tool.getPath().replace("germplasmlist/", "germplasmlist-") + listId); } VerticalLayout layoutForList = new VerticalLayout(); layoutForList.setMargin(false); layoutForList.setSpacing(false); Embedded listInfoPage = new Embedded("", listBrowserLink); listInfoPage.setType(Embedded.TYPE_BROWSER); listInfoPage.setSizeFull(); layoutForList.setHeight("550px"); layoutForList.addComponent(listInfoPage); CrossingManagerImportButtonClickListener listener = new CrossingManagerImportButtonClickListener(this); exportButton = new Button(); exportButton.setData(EXPORT_BUTTON_ID); exportButton.addListener(listener); makeCrossesButton = new Button(); makeCrossesButton.setData(MAKE_CROSSES_BUTTON_ID); makeCrossesButton.addListener(listener); HorizontalLayout buttonArea = new HorizontalLayout(); buttonArea.setMargin(true); buttonArea.setSpacing(true); buttonArea.addComponent(exportButton); buttonArea.addComponent(makeCrossesButton); addComponent(layoutForList); addComponent(buttonArea); setComponentAlignment(buttonArea, Alignment.BOTTOM_RIGHT); }
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; }//ww w. ja v a 2 s.co 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 == 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); } } } }