List of usage examples for com.vaadin.ui HorizontalSplitPanel setHeight
@Override public void setHeight(float height, Unit unit)
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();/* ww w . j a va 2 s. c o m*/ 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 !")); } }