List of usage examples for com.vaadin.ui Embedded setWidth
@Override public void setWidth(String width)
From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.ReviewComponent.java
License:Open Source License
private void paintReviewGrid() { if (reviewGrid == null) { reviewGrid = new GridLayout(2, currentPageLength); reviewGrid.setSizeFull();//from w ww .j a va 2 s . co m reviewGrid.setSpacing(true); layout.addComponent(reviewGrid); } else { reviewGrid.removeAllComponents(); } int rows = reviewGrid.getRows(); if (rows != currentPageLength) { reviewGrid.setRows(Math.min(size, currentPageLength)); } int row = 0; List<ReviewEntry> latestReviews = getLatestReviews(currentPage, currentPageLength); for (ReviewEntry review : latestReviews) { ProjectRating rating = review.getRating(); Embedded e = new Embedded(null, getIcon(rating)); e.setDescription(getDescription(rating)); e.setWidth("22px"); //$NON-NLS-1$ e.setHeight("22px"); //$NON-NLS-1$ reviewGrid.addComponent(e, 0, row); StringBuilder sb = new StringBuilder(); sb.append("<span style=\"white-space:normal\">"); //$NON-NLS-1$ sb.append(HtmlUtils.clean(review.getComment())); sb.append("<br>"); //$NON-NLS-1$ sb.append("<span style=\"font-size:x-small\">").append(" posted by "); //$NON-NLS-1$ sb.append(StringEscapeUtils.escapeHtml(review.getVoter())); sb.append(" "); //$NON-NLS-1$ long deltaMillis = System.currentTimeMillis() - review.getTimestamp(); long deltaDays = deltaMillis / MILLIS_PER_DAY; if (deltaDays > 0) { sb.append(deltaDays); sb.append(" days ago"); } else { long deltaHours = deltaMillis / MILLIS_PER_HOUR; if (deltaHours > 0) { sb.append(deltaHours).append(" hours ago"); } else { long deltaMinutes = deltaMillis / MILLIS_PER_MINUTE; if (deltaMinutes > 0) { sb.append(deltaMinutes).append(" minutes ago"); } else { sb.append(" just now"); } } sb.append("</span></span>"); //$NON-NLS-1$ } CssLayout css = new CssLayout(); css.setSizeFull(); Label comment = new Label(sb.toString(), Label.CONTENT_XHTML); comment.setSizeUndefined(); css.addComponent(comment); reviewGrid.addComponent(css, 1, row); reviewGrid.setColumnExpandRatio(1, 1.0f); ++row; } }
From source file:org.fossa.rolp.demo.DemoWelcomeScreen.java
License:Open Source License
public DemoWelcomeScreen(RolpApplication app, FossaAuthorizer authorizer) { super(app);/*from w ww . j a v a2s. c om*/ 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);/* ww w. j av a 2s. com*/ logo.setWidth("100px"); logo.setHeight("96px"); headlineApp.addComponent(logo, "logo"); headlineApp.addComponent(authorizerLayout, "authorizerLayout"); headlineApp.addStyleName("headlineApp"); layout.addComponent(headlineApp, "headlineApp"); getMainWindow().setContent(layout); 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);/*ww w . j a v a 2s . co 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 w w w . j ava2 s.com 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.icrisat.gdms.ui.GDMSMain.java
VerticalLayout buildWelcomeScreen() { VerticalLayout layoutForWelcomeTab = new VerticalLayout(); layoutForWelcomeTab.setMargin(true); layoutForWelcomeTab.setSpacing(true); layoutForWelcomeTab.setCaption("Welcome"); layoutForWelcomeTab.setStyleName(Reindeer.LAYOUT_WHITE); CssLayout cssLayout = new CssLayout(); cssLayout.setMargin(true);/*from w w w. ja va 2 s . com*/ cssLayout.setWidth("100%"); layoutForWelcomeTab.addComponent(cssLayout); HeadingOne title = new HeadingOne("Welcome to Genotyping Data Management"); cssLayout.addComponent(title); HorizontalLayout horizLayoutForIntroPara = new HorizontalLayout(); horizLayoutForIntroPara.setSpacing(true); horizLayoutForIntroPara.setWidth("100%"); horizLayoutForIntroPara.setMargin(true, false, true, false); cssLayout.addComponent(horizLayoutForIntroPara); String strIntroPara1 = "<p>The Genotyping Data Management System aims to provide a comprehensive public repository " + "for genotype, linkage map and QTL data from crop species relevant in the semi-arid tropics.</p>"; String strIntroPara2 = "<p>This system is developed in Java and the database is MySQL. The initial release record " + "details of current genotype datasets generated for GCP mandate crops along with details of " + "molecular markers and related metadata. The Retrieve tab is a good starting point to browse " + "or query the database contents. The datasets available for each crop species can be queried. " + "Access to data sets requires a login.</p>"; String strIntroPara3 = "<p>Data may be currently exported to the following formats: 2x2 matrix and flapjack software formats. " + "Data submission is through templates; upload templates are available for genotype, QTL and " + "map data(type of markers - SSR, SNP and DArt). The templates are in the form of excel sheets with built-in " + "validation functions.</p>"; Label lblPara = new Label(strIntroPara1 + strIntroPara2 + strIntroPara3, Label.CONTENT_XHTML); horizLayoutForIntroPara.addComponent(lblPara); horizLayoutForIntroPara.setExpandRatio(lblPara, 1); //Spacer lblPara = new Label(""); lblPara.setWidth("20px"); horizLayoutForIntroPara.addComponent(lblPara); ThemeResource themeResource = new ThemeResource("images/FlowChart.jpg"); Embedded headerImage = new Embedded("", themeResource); headerImage.setWidth("500px"); headerImage.setHeight("400px"); horizLayoutForIntroPara.addComponent(headerImage); return layoutForWelcomeTab; }
From source file:org.icrisat.gdms.ui.GDMSMain.java
CssLayout getBottomPanelLayout() { CssLayout cssLayoutForContactImage = new CssLayout(); cssLayoutForContactImage.setWidth("100%"); ThemeResource themeResource = new ThemeResource("images/GDMS_Footer.gif"); Embedded contactImage = new Embedded("", themeResource); contactImage.setWidth("1000px"); contactImage.setHeight("20px"); cssLayoutForContactImage.addComponent(contactImage); return cssLayoutForContactImage; }
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 w ww . j a v a2s . 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 == 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.universAAL.ucc.controller.desktop.ToolController.java
public void buttonClick(ClickEvent event) { if (event.getButton() == toolWin.getuStoreButton()) { Embedded em = new Embedded("", new ExternalResource(createLink())); em.setType(Embedded.TYPE_BROWSER); em.setWidth("100%"); em.setHeight("850px"); Window w = new Window("uStore"); w.setWidth("1250px"); w.setHeight("800px"); VerticalLayout v = new VerticalLayout(); w.center();// ww w.ja v a 2 s . c om v.addComponent(em); w.setContent(v); app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(w); } if (event.getButton() == toolWin.getOpenAAL()) { // Embedded em = new Embedded("", new ExternalResource( // "http://wiki.openaal.org")); // em.setType(Embedded.TYPE_BROWSER); // em.setWidth("100%"); // em.setHeight("800px"); // Window w = new Window("openAAL"); // w.setWidth("1250px"); // w.setHeight("800px"); // VerticalLayout v = new VerticalLayout(); // w.center(); // v.addComponent(em); // w.setContent(v); BrowseServicesWindow pw = new BrowseServicesWindow(app); PurchasedServicesController pc = new PurchasedServicesController(pw, app); app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(pw); } if (event.getButton() == toolWin.getInstallButton()) { // Later uncomment again only for testing commented out! Upload up = new Upload("", new AALServiceReceiver()); up.setButtonCaption(res.getString("install.button")); up.addListener((Upload.FinishedListener) this); up.addListener((Upload.FailedListener) this); installWindow = new Window(res.getString("install.win.caption")); installWindow.setResizable(false); installWindow.center(); installWindow.setWidth("400px"); VerticalLayout v = new VerticalLayout(); v.setSizeFull(); v.setSpacing(true); v.setMargin(true); v.addComponent(up); installWindow.setContent(v); app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(installWindow); } if (event.getButton() == toolWin.getLogoutButton()) { DesktopController.setCurrentPassword(""); DesktopController.setCurrentUser(""); // if(!DesktopController.web.getSocket().isClosed()) { // try { // DesktopController.web.getSocket().close(); // } catch (IOException e) { // e.printStackTrace(); // } // } app.close(); } if (event.getButton() == toolWin.getUninstallButton()) { app.getMainWindow().removeWindow(toolWin); List<RegisteredService> ids = new ArrayList<RegisteredService>(); Document doc = Model.getSrvDocument(); NodeList nodeList = doc.getElementsByTagName("service"); for (int i = 0; i < nodeList.getLength(); i++) { RegisteredService srv = new RegisteredService(); Element element = (Element) nodeList.item(i); System.err.println(element.getAttribute("serviceId")); srv.setServiceId(element.getAttribute("serviceId")); NodeList srvChilds = element.getChildNodes(); for (int j = 0; j < srvChilds.getLength(); j++) { Node n = srvChilds.item(j); if (n.getNodeName().equals("application")) { Element e = (Element) n; srv.getAppId().add(e.getAttribute("appId")); } if (n.getNodeName().equals("bundle")) { Element b = (Element) n; srv.getBundleId().add(b.getAttribute("id")); srv.setBundleVersion(b.getAttribute("version")); } if (n.getNodeName().equals("menuEntry")) { Element e = (Element) n; srv.setMenuName(e.getAttribute("entryName")); srv.setIconURL(e.getAttribute("iconURL")); srv.setProvider(e.getAttribute("vendor")); srv.setServiceClass(e.getAttribute("serviceClass")); srv.setUserID(e.getAttribute("userID")); } } ids.add(srv); } DeinstallWindow dw = new DeinstallWindow(ids); app.getMainWindow().addWindow(dw); DeinstallController dc = new DeinstallController(dw, app); // frontend.uninstallService(Activator.getSessionKey(), "28002"); // frontend.getInstalledUnitsForService(Activator.getSessionKey(), "28002"); } if (event.getButton() == toolWin.getPersonButton()) { AddNewPersonWindow apw = null; try { apw = new AddNewPersonWindow(null, null, app); } catch (JAXBException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(apw); } if (event.getButton() == toolWin.getConfigButton()) { AddNewHardwareWindow anhw = null; try { anhw = new AddNewHardwareWindow(null, null, app); } catch (JAXBException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(anhw); } if (event.getButton() == toolWin.getEditHW()) { RoomsWindow hardWare = null; try { hardWare = new RoomsWindow(app); } catch (JAXBException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(hardWare); } if (event.getButton() == toolWin.getEditPerson()) { HumansWindow hw = null; try { hw = new HumansWindow(app); } catch (JAXBException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(hw); } if (event.getButton() == toolWin.getEditUC()) { WhichBundleShouldBeConfiguredWindow uc = new WhichBundleShouldBeConfiguredWindow("Use Cases"); app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(uc); } }
From source file:org.vaadin.alump.fancylayouts.demo.PanelDemo.java
License:Apache License
/** * Sample content for panel/*from w w w.ja va2 s .c o m*/ * * @return */ private ComponentContainer createPanelContentA() { VerticalLayout layout = new VerticalLayout(); layout.setWidth("100%"); layout.setMargin(true); layout.setSpacing(true); Label label = new Label(LOREM_STR); layout.addComponent(label); Embedded image = new Embedded(); image.setSource(new ExternalResource("http://misc.siika.fi/fancy-demo1.jpg")); image.setWidth("500px"); image.setHeight("281px"); layout.addComponent(image); return layout; }