List of usage examples for com.vaadin.ui Embedded setType
public void setType(int type)
From source file:de.mendelson.comm.as2.webclient2.AS2WebUI.java
/** * Init is invoked on application load (when a user accesses the application * for the first time)./*from ww w . j av a2 s . co m*/ */ @Override public void init() { this.user = null; //display fav icon, set theme setTheme("mendelson"); ICON_IN = new ThemeResource("images/in16x16.gif"); ICON_OUT = new ThemeResource("images/out16x16.gif"); ICON_PENDING = new ThemeResource("images/state_pending16x16.gif"); ICON_STOPPED = new ThemeResource("images/state_stopped16x16.gif"); ICON_FINISHED = new ThemeResource("images/state_finished16x16.gif"); ICON_ALL = new ThemeResource("images/state_all16x16.gif"); this.browser = ((WebApplicationContext) getContext()).getBrowser(); //register the database drivers for the VM try { Class.forName("org.hsqldb.jdbcDriver"); } catch (Exception e) { e.printStackTrace(); mainWindow.showNotification("Fatal", e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE); return; } //establish database connection try { this.configConnection = DBDriverManager.getConnectionWithoutErrorHandling(DBDriverManager.DB_CONFIG, "localhost"); this.runtimeConnection = DBDriverManager.getConnectionWithoutErrorHandling(DBDriverManager.DB_RUNTIME, "localhost"); } catch (Exception e) { e.printStackTrace(); mainWindow.showNotification("Fatal", e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE); } Embedded logoImage = new Embedded("", new ThemeResource("images/logo.jpg")); logoImage.setType(Embedded.TYPE_IMAGE); this.mainWindow.addComponent(logoImage); LoginForm loginForm = new LoginForm(); loginForm.addListener(new LoginListener() { @Override public void onLogin(LoginEvent event) { try { String username = event.getLoginParameter("username"); String password = event.getLoginParameter("password"); UserAccess access = new UserAccess(Logger.getAnonymousLogger()); User foundUser = access.readUser(username); if (foundUser == null || foundUser.getPasswdCrypted() == null || !(foundUser.getPasswdCrypted().equals(User.cryptPassword(password.toCharArray()))) || !foundUser.getPermission(1).equals("FULL")) { mainWindow.showNotification("Login failed", "Wrong credentials or no permission", Window.Notification.TYPE_WARNING_MESSAGE); } else { //login accepted AS2WebUI.this.user = foundUser; AS2WebUI.this.labelUsername.setValue("User: " + AS2WebUI.this.user.getName()); AS2WebUI.this.mainWindow.removeComponent(AS2WebUI.this.loginPanel); AS2WebUI.this.mainWindow.addComponent(AS2WebUI.this.mainPanel); AS2WebUI.this.refreshOverviewTableData(); } } catch (Exception e) { e.printStackTrace(); mainWindow.showNotification("Service not available", "Login not possible at the moment - please try later", Window.Notification.TYPE_WARNING_MESSAGE); } } }); this.loginPanel.addComponent(loginForm); this.mainWindow.addComponent(this.loginPanel); this.mainPanel.addComponent(this.createMenuBar()); this.mainPanel.addComponent(this.createButtonBar()); this.overviewTable = this.createOverviewTable(); this.mainPanel.addComponent(overviewTable); this.footerLayout = new HorizontalLayout(); footerLayout.setMargin(true, false, false, false); footerLayout.setSpacing(true); footerLayout.addComponent(this.footerTransactionSum); footerLayout.addComponent(this.footerTransactionOkSum); footerLayout.addComponent(this.footerTransactionPendingSum); footerLayout.addComponent(this.footerTransactionErrorSum); this.mainPanel.addComponent(footerLayout); this.setMainWindow(this.mainWindow); }
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 w w w. j a va 2 s. co 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 !")); } }
From source file:edu.vcu.csbc.vahmpexplorer.main.VaHMPExplorer.java
public Component createToolBar(boolean loggedIn) { HorizontalLayout h = new HorizontalLayout(); h.setMargin(true);/*w w w . j a v a 2s . c o 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; }
From source file:eu.lod2.CKAN.java
License:Apache License
public CKAN(LOD2DemoState st) { // The internal state state = st;/*from w w w .ja v a2 s . c o m*/ Embedded browser = new Embedded(); try { URL url = new URL("http://ckan.net"); browser = new Embedded("", new ExternalResource(url)); browser.setType(Embedded.TYPE_BROWSER); browser.setSizeFull(); //panel.addComponent(browser); } catch (MalformedURLException e) { e.printStackTrace(); } ; // The composition root MUST be set setCompositionRoot(browser); }
From source file:eu.lod2.D2RCordis.java
License:Apache License
public D2RCordis(LOD2DemoState st) { // The internal state state = st;// w ww. jav a2 s . c o m Embedded browser = new Embedded(); try { LOD2DemoInitApp urlD2r = new LOD2DemoInitApp(st, "http://localhost/d2r-cordis"); System.err.println(urlD2r.service); URL url = new URL(urlD2r.service); browser = new Embedded("", new ExternalResource(url)); browser.setType(Embedded.TYPE_BROWSER); browser.setSizeFull(); //panel.addComponent(browser); } catch (MalformedURLException e) { e.printStackTrace(); } ; // The composition root MUST be set setCompositionRoot(browser); }
From source file:eu.lod2.DBpedia.java
License:Apache License
public DBpedia(LOD2DemoState st) { // The internal state state = st;//from w w w .ja v a2s .c o m Embedded browser = new Embedded(); try { URL url = new URL("http://live.dbpedia.org"); browser = new Embedded("", new ExternalResource(url)); browser.setType(Embedded.TYPE_BROWSER); browser.setSizeFull(); //panel.addComponent(browser); } catch (MalformedURLException e) { e.printStackTrace(); } ; // The composition root MUST be set setCompositionRoot(browser); }
From source file:eu.lod2.ELoadRDFFile.java
License:Apache License
public ELoadRDFFile(LOD2DemoState st) { // The internal state and state = st;/*from w w w.ja v a2 s. c o m*/ initVirtuoso(); Embedded browser = new Embedded(); try { URL url; if (virtuoso_username.equals("") || virtuoso_password.equals("")) { url = new URL( "http://localhost:8890/conductor/rdf_import.vspx?username=dba&t_login_pwd=dba&password=dba"); } else if (virtuoso_service.equals("")) { url = new URL(state.getHostName() + "/conductor/rdf_import.vspx?username=" + virtuoso_username + "&t_login_pwd=" + virtuoso_password + "&password=" + virtuoso_password); } else { url = new URL(virtuoso_service + "/rdf_import.vspx?username=" + virtuoso_username + "&t_login_pwd=" + virtuoso_password + "&password=" + virtuoso_password); } ; browser = new Embedded("", new ExternalResource(url)); browser.setType(Embedded.TYPE_BROWSER); browser.setSizeFull(); //panel.addComponent(browser); } catch (MalformedURLException e) { e.printStackTrace(); } ; browser.setSizeUndefined(); setSizeUndefined(); // The composition root MUST be set setCompositionRoot(browser); }
From source file:eu.lod2.IframedUrl.java
License:Apache License
public IframedUrl(LOD2DemoState st, String urlref) { // The internal state state = st;/*w w w . j a va 2s . c o m*/ Embedded browser = new Embedded(); try { URL url = new URL(urlref); browser = new Embedded("", new ExternalResource(url)); browser.setType(Embedded.TYPE_BROWSER); browser.setSizeFull(); //panel.addComponent(browser); } catch (MalformedURLException e) { e.printStackTrace(); } ; // The composition root MUST be set setCompositionRoot(browser); }
From source file:eu.lod2.LinkingTab.java
License:Apache License
public LinkingTab(LOD2DemoState st) { // The internal state and state = st;//from w w w .j a va 2 s .co m Embedded browser = new Embedded(); try { URL url = new URL(state.getHostName() + "/silk"); browser = new Embedded("", new ExternalResource(url)); browser.setType(Embedded.TYPE_BROWSER); browser.setSizeFull(); } catch (MalformedURLException e) { e.printStackTrace(); } ; // The composition root MUST be set setCompositionRoot(browser); }
From source file:eu.lod2.LODCloud.java
License:Apache License
public LODCloud(LOD2DemoState st) { // The internal state state = st;/*w ww. jav a 2 s . c o m*/ Embedded browser = new Embedded(); try { URL url = new URL("http://lod.openlinksw.com"); browser = new Embedded("", new ExternalResource(url)); browser.setType(Embedded.TYPE_BROWSER); browser.setSizeFull(); //panel.addComponent(browser); } catch (MalformedURLException e) { e.printStackTrace(); } ; // The composition root MUST be set setCompositionRoot(browser); }