List of usage examples for com.vaadin.ui Embedded setHeight
@Override public void setHeight(float height, Unit unit)
From source file:com.expressui.core.util.UrlUtil.java
License:Open Source License
/** * Only used by sample application to track usage statistics * * @param container container for adding the embedded iframe to *//*from w w w .j a va2s . c o m*/ public static void addTrackingUrl(AbstractComponentContainer container, String tag) { try { URL url = new URL(EXPRESSUI_TEST_PAGE + tag); Embedded browser = new Embedded(null, new ExternalResource(url)); browser.setType(Embedded.TYPE_BROWSER); browser.setWidth(0, Sizeable.UNITS_PIXELS); browser.setHeight(0, Sizeable.UNITS_PIXELS); container.addComponent(browser); } catch (MalformedURLException e) { throw new RuntimeException(e); } }
From source file:com.expressui.core.view.util.CodePopup.java
License:Open Source License
private Embedded getEmbeddedDoc(String u) { try {/*from w w w. j a v a2 s .c o m*/ URL url = new URL(u); Embedded browser = new Embedded("", new ExternalResource(url)); browser.setHeight(15000, Sizeable.UNITS_PIXELS); browser.setType(Embedded.TYPE_BROWSER); return browser; } catch (MalformedURLException e) { throw new RuntimeException(e); } }
From source file:com.expressui.sample.view.HomePage.java
License:Open Source License
@Override public void onDisplay() { try {// ww w. j av a2 s . c om URL url = new URL("http://www.expressui.com/"); Embedded browser = new Embedded("", new ExternalResource(url)); browser.setType(Embedded.TYPE_BROWSER); browser.setWidth(100, Sizeable.UNITS_PERCENTAGE); browser.setHeight(15000, Sizeable.UNITS_PIXELS); setCompositionRoot(browser); } catch (MalformedURLException e) { throw new RuntimeException(e); } getMainApplication().showTrayMessage("<h3>Feature Tip:</h3>" + "<ul>" + "<li>This illustrates how to embed any external page into ExpressUI" + "</ul>"); }
From source file:com.jorambarrez.PropertyPanel.java
License:Apache License
protected void initTrashIcon() { Embedded trashIcon = new Embedded(null, Images.MODELER_TRASH); trashIcon.setWidth(63, UNITS_PIXELS); trashIcon.setHeight(61, UNITS_PIXELS); trashIcon.setType(Embedded.TYPE_IMAGE); VerticalLayout trashLayout = new VerticalLayout(); trashLayout.setWidth(120, UNITS_PIXELS); trashLayout.setHeight(120, UNITS_PIXELS); trashLayout.addComponent(trashIcon); trashLayout.setComponentAlignment(trashIcon, Alignment.MIDDLE_CENTER); DragAndDropWrapper dragAndDropWrapper = new DragAndDropWrapper(trashLayout); dragAndDropWrapper.setDragStartMode(DragStartMode.NONE); dragAndDropWrapper.setSizeUndefined(); addComponent(dragAndDropWrapper);//w ww .j av a 2 s . c o m setComponentAlignment(dragAndDropWrapper, Alignment.BOTTOM_CENTER); dragAndDropWrapper.setDropHandler(new DropHandler() { private static final long serialVersionUID = 1L; public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } public void drop(DragAndDropEvent event) { WrapperTransferable wrapperTransferable = (WrapperTransferable) event.getTransferable(); Node srcNode = (Node) wrapperTransferable.getSourceComponent(); // TODO: use eventrouter! ModelerApp.get().getFlowEditor().removeNode(srcNode); } }); }
From source file:com.klwork.explorer.ui.user.ProfilePanel.java
License:Apache License
protected void initPicture() { StreamResource imageresource = new StreamResource(new StreamSource() { private static final long serialVersionUID = 1L; public InputStream getStream() { return picture.getInputStream(); }// w w w. ja va 2 s.c om }, user.getId()); imageresource.setCacheTime(0); Embedded picture = new Embedded(null, imageresource); picture.setType(Embedded.TYPE_IMAGE); picture.setHeight(200, UNITS_PIXELS); picture.setWidth(200, UNITS_PIXELS); picture.addStyleName(ExplorerLayout.STYLE_PROFILE_PICTURE); imageLayout.addComponent(picture); imageLayout.setWidth(picture.getWidth() + 5, picture.getWidthUnits()); // Change picture button if (isCurrentLoggedInUser) { Upload changePictureButton = initChangePictureButton(); imageLayout.addComponent(changePictureButton); imageLayout.setComponentAlignment(changePictureButton, Alignment.MIDDLE_CENTER); } }
From source file:com.openhris.commons.UploadImage.java
public UploadImage(Panel imagePanel, Embedded avatar, String employeeId) { this.imagePanel = imagePanel; this.avatar = avatar; this.employeeId = employeeId; imagePanel = new Panel("Upload Component"); imagePanel.setWidth("400px"); addComponent(imagePanel);// w ww . ja v a2 s. c o m // Create the Upload component. upload = new Upload("Upload the Image file here", receiver); // Use a custom button caption instead of plain "Upload". upload.setButtonCaption("Upload Now"); // Listen for events regarding the success of upload. upload.addListener((Upload.StartedListener) this); upload.addListener((Upload.SucceededListener) this); upload.addListener((Upload.FailedListener) this); panel.setWidth("100%"); panel.addComponent(new Label("Click 'Choose file' to " + "select a file and then click 'Upload Now'. " + "image should have the same width and height so " + "that image will not look deformed when viewed.")); imagePanel.addComponent(upload); imagePanel.addComponent(panel); avatar = new Embedded(); avatar.setImmediate(true); avatar.setWidth(90, Sizeable.UNITS_PIXELS); avatar.setHeight(90, Sizeable.UNITS_PIXELS); imagePanel.addComponent(avatar); }
From source file:com.rdonasco.common.vaadin.view.utils.EmbeddedResourceBuilder.java
License:Apache License
public Embedded createEmbedded() throws InvalidBuilderParameter { if (null == application) { throw new InvalidBuilderParameter("application not set"); }/*from www . j a v a 2 s.c o m*/ if (null == name) { throw new InvalidBuilderParameter("name not set"); } Embedded embedded = null; if (null != bytes) { embedded = createUsingStreamSource(); } else if (null != resourceId) { embedded = createUsingResourceId(); } else { throw new InvalidBuilderParameter("bytes or resource ID is not set"); } embedded.setDescription(description); embedded.setAlternateText(alternateText); if (null != height) { embedded.setHeight(height, units); } if (null != width) { embedded.setWidth(width, units); } return embedded; }
From source file:de.unioninvestment.portal.explorer.view.vfs.VFSMainView.java
License:Apache License
public VFSMainView(ConfigBean cb, VFSFileExplorerPortlet instance) throws Exception { final String vfsUrl = cb.getVfsUrl(); if (vfsUrl.length() != 0) { removeAllComponents();/*from www . j a va 2s . c om*/ explorerPanel.setStyleName(Reindeer.PANEL_LIGHT); filePanel.setStyleName(Reindeer.PANEL_LIGHT); FileSystemOptions opts = new FileSystemOptions(); logger.log(Level.INFO, "Check Type "); if (cb.getVfsType().equalsIgnoreCase("FTP") || cb.getVfsType().equalsIgnoreCase("SFTP")) { if (cb.getUsername() != null && cb.getUsername().length() > 0) { StaticUserAuthenticator auth = new StaticUserAuthenticator(null, cb.getUsername(), cb.getPassword()); DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth); } } if (cb.getVfsType().equalsIgnoreCase("FTP")) { FtpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(opts, true); FtpFileSystemConfigBuilder.getInstance().setPassiveMode(opts, true); } if (cb.getVfsType().equalsIgnoreCase("SFTP")) { SftpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(opts, true); if (cb.getKeyfile() != null && cb.getKeyfile().length() > 0) { logger.log(Level.INFO, "Keyfile " + cb.getKeyfile()); SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(opts, "no"); File keyFile = new File(cb.getKeyfile()); SftpFileSystemConfigBuilder.getInstance().setIdentities(opts, new File[] { keyFile }); } SftpFileSystemConfigBuilder.getInstance().setProxyType(opts, SftpFileSystemConfigBuilder.PROXY_HTTP); if (cb.getProxyHost() != null && cb.getProxyHost().length() > 0) { SftpFileSystemConfigBuilder.getInstance().setProxyHost(opts, cb.getProxyHost()); logger.log(Level.INFO, "ProxyHost " + cb.getProxyHost()); } if (cb.getProxyPort() != null && cb.getProxyPort().length() > 0) { SftpFileSystemConfigBuilder.getInstance().setProxyPort(opts, Integer.valueOf(cb.getProxyPort())); logger.log(Level.INFO, "ProxyPort " + cb.getProxyPort()); } } DefaultFileSystemManager fsManager = null; fsManager = getManager(); final HorizontalSplitPanel panel = new HorizontalSplitPanel(); panel.setHeight(500, UNITS_PIXELS); panel.setWidth(1400, UNITS_PIXELS); panel.setSplitPosition(350, Sizeable.UNITS_PIXELS); panel.setFirstComponent(explorerPanel); panel.setSecondComponent(filePanel); addComponent(panel); final Embedded image = new Embedded(); image.setType(Embedded.TYPE_IMAGE); image.setSource(FOLDER); image.setHeight(15, Sizeable.UNITS_PIXELS); explorerPanel.setSizeFull(); filePanel.setSizeFull(); explorerPanel.addComponent(tree); filePanel.addComponent(new TableView(instance, fsManager, opts, cb)); tree.setImmediate(true); tree.addListener(new ItemClickEvent.ItemClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(ItemClickEvent event) { VFSFileExplorerPortlet app = (VFSFileExplorerPortlet) getApplication(); String newDir = (String) event.getItemId(); app.getEventBus().fireEvent(new TableChangedEvent(newDir)); } }); scanDirectory(fsManager, opts, vfsUrl); } else { addComponent(new Label("Please configure Portlet !")); } }
From source file:dhbw.ka.mwi.businesshorizon2.ui.initialscreen.projectlist.ProjectListViewImpl.java
License:Open Source License
/** * Konkrete Ausprogrammierung der Darstellung eines einzelnen Projekts. * Ein Projekt wird durch ein VerticalLayout dargestellt, das ein Label * mit dem Projektname enthlt. Auerdem bekommt es einen ClickListener, * um ein Projekt als selektiert zu kennzeichnen und die Details zum Projekt * anzuzeigen.// ww w.j a v a 2s . c o m * * @author Christian Scherer, Mirko Gpfrich, Marco Glaser * @param project * das darzustellende Projekt und der aktuelle Index der Liste * @param i * der Index der zu erstellenden Komponente (besonders fuer den * Loeschbutton relevant) * @return ein VerticalLayout Objekt, das zur Eingliederung in das UI dient */ private VerticalLayout generateSingleProjectUI(Project project, int i) { final Project proj = project; final int a = i; //erzeugt eine Panel fr ein Projekt singleProject = new VerticalLayout(); HorizontalLayout container = new HorizontalLayout(); container.setSizeFull(); if (i == 0) { singleProject.setStyleName("singleProjectSelected"); presenter.projectSelected(project); } else { singleProject.setStyleName("singleProject"); } Embedded icon = new Embedded(null, new ThemeResource("./images/icons/newIcons/1418828714_editor_open_folder-128.png")); icon.setHeight(40, UNITS_PIXELS); icon.setWidth(40, UNITS_PIXELS); Label gap1 = new Label(); Label gap2 = new Label(); Label gap3 = new Label(); gap1.setWidth("15px"); gap2.setWidth("15px"); gap3.setSizeFull(); Label projectName = new Label(project.getName()); projectName.setWidth(Sizeable.SIZE_UNDEFINED, 0); projectName.setHeight(Sizeable.SIZE_UNDEFINED, 0); projectName.setStyleName("projectName"); //Legt ein Layout fr das Projekt-Panel fest //panelContent.setSizeFull(); container.addComponent(gap1); container.addComponent(icon); container.addComponent(gap2); container.addComponent(projectName); container.addComponent(gap3); container.setExpandRatio(gap3, 1.0f); singleProject.addComponent(container); singleProject.setWidth(100, UNITS_PERCENTAGE); singleProject.setHeight(70, UNITS_PIXELS); container.setComponentAlignment(icon, Alignment.MIDDLE_CENTER); container.setComponentAlignment(projectName, Alignment.MIDDLE_CENTER); singleProject.addListener(new LayoutClickListener() { private static final long serialVersionUID = 1L; @Override public void layoutClick(LayoutClickEvent event) { presenter.projectSelected(proj); switchProjectsStyle(a); eventBus.fireEvent(new SelectProjectEvent()); } }); // singleProject.addListener(this); // projectListPanel.addComponent(singleProject); logger.debug("Einzelnes Projektelement erzeugt"); return singleProject; }
From source file:edu.vcu.csbc.vahmpexplorer.main.VaHMPExplorer.java
public Component createToolBar(boolean loggedIn) { HorizontalLayout h = new HorizontalLayout(); h.setMargin(true);/*from w ww . jav a 2 s. co m*/ h.setWidth("100%"); Embedded headerImg = new Embedded(null, new ThemeResource("../vahmpexplorer/img/header.png")); headerImg.setWidth(311, Embedded.UNITS_PIXELS); headerImg.setHeight(45, Embedded.UNITS_PIXELS); headerImg.setType(Embedded.TYPE_IMAGE); headerImg.setStyleName(BaseTheme.BUTTON_LINK); headerImg.setDescription("Version " + HelpMessages.VERSION); h.addComponent(headerImg); if (loggedIn) { Panel panel = new Panel(); Label loggedInUser = new Label( "Welcome: " + user.getFirstName() + " " + user.getLastName() + " (" + user.getLogin() + ")"); changePassword = new Button("Change Password"); changePassword.setStyleName(BaseTheme.BUTTON_LINK); changePassword.addListener((Button.ClickListener) this); logout = new Button("Logout"); logout.setStyleName(BaseTheme.BUTTON_LINK); logout.addListener((Button.ClickListener) this); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); hl.addComponent(changePassword); hl.addComponent(logout); panel.addComponent(loggedInUser); panel.addComponent(hl); h.addComponent(panel); h.setComponentAlignment(panel, Alignment.MIDDLE_RIGHT); } PopupView help = new PopupView(new MainHelpPopup()); h.addComponent(help); h.setComponentAlignment(help, Alignment.MIDDLE_RIGHT); h.setComponentAlignment(headerImg, Alignment.MIDDLE_LEFT); return h; }