List of usage examples for com.vaadin.ui Embedded TYPE_IMAGE
int TYPE_IMAGE
To view the source code for com.vaadin.ui Embedded TYPE_IMAGE.
Click Source Link
From source file:de.mendelson.comm.as2.webclient2.AboutDialog.java
/**Could be overwritten, contains the content to display*/ @Override/*from www .j av a2 s. c o m*/ public AbstractComponent getContentPanel() { int maxX = 7; Panel panel = new Panel(); GridLayout gridLayout = new GridLayout(maxX, 17); gridLayout.setSizeFull(); Embedded logComm = new Embedded("", new ThemeResource("images/logocommprotocols.gif")); logComm.setType(Embedded.TYPE_IMAGE); VerticalLayout gapLayout = new VerticalLayout(); gapLayout.setMargin(false, true, true, false); gapLayout.addComponent(logComm); gridLayout.addComponent(gapLayout, 0, 0, 1, 3); gridLayout.addComponent( new Label("<strong>" + AS2ServerVersion.getFullProductName() + "</strong>", Label.CONTENT_XHTML), 2, 1, maxX - 1, 1); gridLayout.addComponent(new Label(AS2ServerVersion.getLastModificationDate()), 2, 2, maxX - 1, 2); gridLayout.addComponent(new Label("<hr/>", Label.CONTENT_XHTML), 0, 4, maxX - 1, 4); gridLayout.addComponent(new Label(Copyright.getCopyrightMessage(), Label.CONTENT_XHTML), 0, 5, maxX - 1, 5); gridLayout.addComponent(new Label(AS2ServerVersion.getStreet(), Label.CONTENT_XHTML), 0, 6, maxX - 1, 6); gridLayout.addComponent(new Label(AS2ServerVersion.getZip(), Label.CONTENT_XHTML), 0, 7, maxX - 1, 7); gridLayout.addComponent(new Label(AS2ServerVersion.getTelephone(), Label.CONTENT_XHTML), 0, 8, maxX - 1, 8); gridLayout.addComponent(new Label(AS2ServerVersion.getInfoEmail(), Label.CONTENT_XHTML), 0, 9, maxX - 1, 9); gridLayout.addComponent(new Label("<hr/>", Label.CONTENT_XHTML), 0, 10, 6, 10); gridLayout.addComponent( new Link("http://www.mendelson.de", new ExternalResource("http://www.mendelson.de")), 0, 11, maxX - 1, 11); gridLayout.addComponent( new Link("http://www.mendelson-e-c.com", new ExternalResource("http://www.mendelson-e-c.com")), 0, 12, maxX - 1, 12); gridLayout.addComponent(new Label("<hr/>", Label.CONTENT_XHTML), 0, 13, maxX - 1, 13); gridLayout.addComponent(new Label("<br/>", Label.CONTENT_XHTML), 0, 14, maxX - 1, 14); gridLayout.addComponent( new Label("[Based on VAADIN " + com.vaadin.terminal.gwt.server.ApplicationServlet.VERSION + "]"), 0, 16, maxX - 1, 16); panel.addComponent(gridLayout); return (panel); }
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 w w w . j a va2 s .c o 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 . jav a 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 !")); } }
From source file:edu.vcu.csbc.vahmpexplorer.main.VaHMPExplorer.java
public Component createToolBar(boolean loggedIn) { HorizontalLayout h = new HorizontalLayout(); h.setMargin(true);/*from w w w . ja va 2s . c om*/ 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:org.accelerators.activiti.admin.ui.LoginView.java
License:Open Source License
@SuppressWarnings("serial") public LoginView(AdminApp application) { // Set application reference this.app = application; // Init window caption app.getMainWindow().setCaption(app.getMessage(Messages.Title)); // Set layout to full size setSizeFull();/*from w w w.java2 s. c om*/ // Set style this.setStyleName("login-background"); // Add header bar final HorizontalLayout header = new HorizontalLayout(); header.setHeight("50px"); header.setWidth("100%"); addComponent(header); setComponentAlignment(header, Alignment.MIDDLE_CENTER); // Setup grid GridLayout loginGrid = new GridLayout(1, 2); loginGrid.setWidth("250px"); addComponent(loginGrid); setComponentAlignment(loginGrid, Alignment.MIDDLE_CENTER); // Add title to header GridLayout logoGrid = new GridLayout(1, 1); loginGrid.addComponent(logoGrid, 0, 0); loginGrid.setComponentAlignment(logoGrid, Alignment.MIDDLE_CENTER); Embedded logoImage = new Embedded(null, new ThemeResource("img/login-logo.png")); logoImage.setType(Embedded.TYPE_IMAGE); logoImage.addStyleName("login-image"); logoGrid.addComponent(logoImage, 0, 0); logoGrid.setComponentAlignment(logoImage, Alignment.MIDDLE_CENTER); // Add field and button layout VerticalLayout buttonLayout = new VerticalLayout(); buttonLayout.setSizeFull(); buttonLayout.setSpacing(true); buttonLayout.setMargin(false); buttonLayout.setStyleName("login-form"); loginGrid.addComponent(buttonLayout, 0, 1); loginGrid.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER); // Add username field username = new TextField(app.getMessage(Messages.Username)); username.setWidth("100%"); buttonLayout.addComponent(username); // Add password field password = new PasswordField(app.getMessage(Messages.Password)); password.setWidth("100%"); buttonLayout.addComponent(password); // Add Login button buttonLayout.addComponent(login); buttonLayout.setComponentAlignment(login, Alignment.BOTTOM_RIGHT); // Set focus to this component username.focus(); // Add shortcut to login button login.setClickShortcut(KeyCode.ENTER); login.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { try { // Athenticate the user authenticate((String) username.getValue(), (String) password.getValue()); // Switch to the main view app.getViewManager().switchScreen(MainView.class.getName(), new MainView(app)); } catch (Exception e) { getWindow().showNotification(e.toString()); } } }); HorizontalLayout footer = new HorizontalLayout(); footer.setHeight("50px"); footer.setWidth("100%"); addComponent(footer); }
From source file:org.accelerators.activiti.admin.ui.MainView.java
License:Open Source License
public MainView(AdminApp application) { // Set application this.app = application; // Setup main layout setStyleName(Reindeer.LAYOUT_WHITE); setMargin(false);/*w w w . j a va 2 s . c om*/ setSpacing(false); setSizeFull(); // Add header GridLayout header = new GridLayout(2, 1); header.setWidth("100%"); header.setHeight("34px"); addComponent(header); // Add header styles header.addStyleName(Consts.HEADER); header.addStyleName("header"); header.setSpacing(true); // Add title to header GridLayout logoGrid = new GridLayout(1, 1); header.addComponent(logoGrid, 0, 0); header.setComponentAlignment(logoGrid, Alignment.MIDDLE_LEFT); Embedded logoImage = new Embedded(null, new ThemeResource("img/header-logo.png")); logoImage.setType(Embedded.TYPE_IMAGE); logoImage.addStyleName("header-image"); logoGrid.addComponent(logoImage, 0, 0); logoGrid.setComponentAlignment(logoImage, Alignment.MIDDLE_CENTER); // Add logout button to header GridLayout logoutGrid = new GridLayout(2, 1); Label userLabel = new Label("Signed in as: " + app.getUser().toString()); userLabel.addStyleName("user"); logout.setStyleName(Reindeer.BUTTON_LINK); logout.addStyleName("logout"); logoutGrid.addComponent(userLabel, 0, 0); logoutGrid.addComponent(logout, 1, 0); header.addComponent(logoutGrid, 1, 0); header.setComponentAlignment(logoutGrid, Alignment.TOP_RIGHT); // Create tab sheet TabSheet tabs = new TabSheet(); tabs.setSizeFull(); // Add tab styles tabs.addStyleName(Reindeer.TABSHEET_BORDERLESS); tabs.addStyleName(Reindeer.LAYOUT_WHITE); // Add task view tab tabs.addTab(new UserTab(app)); tabs.addTab(new GroupTab(app)); // Add tab sheet to layout addComponent(tabs); setExpandRatio(tabs, 1.0F); // Add footer text Label footerText = new Label(app.getMessage(Messages.Footer)); footerText.setSizeUndefined(); footerText.setStyleName(Reindeer.LABEL_SMALL); addComponent(footerText); setComponentAlignment(footerText, Alignment.BOTTOM_CENTER); }
From source file:org.activiti.administrator.AdminApp.java
License:Apache License
/** * Switch view/*from www. j a va 2s. c om*/ * * @param name * the name of the view class * @param view * the view to switch to */ public void switchView(String name, Layout view) { // Add view to main layout mainLayout.addComponent(view, Consts.CONTENT); // Add logout button if user is authenticated if ((getUser() != null) && !getUser().toString().isEmpty()) { // Create logout grid with user icon, user id and logout button GridLayout logoutGrid = new GridLayout(3, 1); logoutGrid.setStyleName("logout"); // Add user icon Embedded userIcon = new Embedded(null, new ThemeResource("img/user-icon.png")); userIcon.setType(Embedded.TYPE_IMAGE); userIcon.addStyleName("icon"); // Add user id Label userLabel = new Label(getUser().toString()); userLabel.addStyleName("user"); // Add logout button logout.setStyleName(Reindeer.BUTTON_LINK); logout.addStyleName("logout"); logout.setIcon(new ThemeResource("img/divider-white.png")); // Add to logout grid logoutGrid.addComponent(userIcon, 0, 0); logoutGrid.addComponent(userLabel, 1, 0); logoutGrid.addComponent(logout, 2, 0); // Add logout grid to header mainLayout.addComponent(logoutGrid, Consts.LOGOUT); } else { // Remove logout button mainLayout.removeComponent(Consts.LOGOUT); } // Switch to new view viewManager.switchScreen(name, mainLayout); }
From source file:org.activiti.editor.ui.EditorProcessDefinitionInfoComponent.java
License:Apache License
protected void initImage() { processImageContainer = new VerticalLayout(); Label processTitle = new Label(i18nManager.getMessage(Messages.PROCESS_HEADER_DIAGRAM)); processTitle.addStyleName(ExplorerLayout.STYLE_H3); processImageContainer.addComponent(processTitle); StreamSource streamSource = null; final byte[] editorSourceExtra = repositoryService.getModelEditorSourceExtra(modelData.getId()); if (editorSourceExtra != null) { streamSource = new StreamSource() { private static final long serialVersionUID = 1L; public InputStream getStream() { InputStream inStream = null; try { inStream = new ByteArrayInputStream(editorSourceExtra); } catch (Exception e) { LOGGER.warn("Error reading PNG in StreamSource", e); }/*from w w w .ja va 2 s .c om*/ return inStream; } }; } if (streamSource != null) { Embedded embedded = new Embedded(null, new ImageStreamSource(streamSource, ExplorerApp.get())); embedded.setType(Embedded.TYPE_IMAGE); embedded.setSizeUndefined(); Panel imagePanel = new Panel(); // using panel for scrollbars imagePanel.addStyleName(Reindeer.PANEL_LIGHT); imagePanel.setWidth(100, UNITS_PERCENTAGE); imagePanel.setHeight(700, UNITS_PIXELS); HorizontalLayout panelLayout = new HorizontalLayout(); panelLayout.setSizeUndefined(); imagePanel.setContent(panelLayout); imagePanel.addComponent(embedded); processImageContainer.addComponent(imagePanel); } else { Label noImageAvailable = new Label(i18nManager.getMessage(Messages.PROCESS_NO_DIAGRAM)); processImageContainer.addComponent(noImageAvailable); } addComponent(processImageContainer); }
From source file:org.activiti.explorer.ui.custom.UserProfileLink.java
License:Apache License
protected void initPicture(IdentityService identityService, boolean renderPicture, final String userName) { if (renderPicture) { Picture picture = identityService.getUserPicture(userName); if (picture != null) { Resource imageResource = new StreamResource(new InputStreamStreamSource(picture.getInputStream()), userName + picture.getMimeType(), ExplorerApp.get()); Embedded image = new Embedded(null, imageResource); image.addStyleName(ExplorerLayout.STYLE_CLICKABLE); image.setType(Embedded.TYPE_IMAGE); image.setHeight(30, Embedded.UNITS_PIXELS); image.setWidth(30, Embedded.UNITS_PIXELS); image.addListener(new MouseEvents.ClickListener() { private static final long serialVersionUID = 7341560240277898495L; public void click(MouseEvents.ClickEvent event) { viewManager.showProfilePopup(userName); }//from w w w .j a v a2s .c o m }); addComponent(image); setComponentAlignment(image, Alignment.MIDDLE_LEFT); } else { // TODO: what when no image is available? } } }
From source file:org.activiti.explorer.ui.flow.ProcessDefinitionInfoComponent.java
License:Apache License
protected void initImage() { VerticalLayout processImageContainer = new VerticalLayout(); Label processTitle = new Label(i18nManager.getMessage(Messages.FLOW_HEADER_DIAGRAM)); processTitle.addStyleName(ExplorerLayout.STYLE_H3); processImageContainer.addComponent(processTitle); if (processDefinition.getDiagramResourceName() != null) { StreamResource diagram = new ProcessDefinitionImageStreamResourceBuilder() .buildStreamResource(processDefinition, repositoryService); Embedded embedded = new Embedded("", diagram); embedded.setType(Embedded.TYPE_IMAGE); processImageContainer.addComponent(embedded); } else {// ww w .j av a2 s . com Label noImageAvailable = new Label(i18nManager.getMessage(Messages.FLOW_NO_DIAGRAM)); processImageContainer.addComponent(noImageAvailable); } addComponent(processImageContainer); }