List of usage examples for com.vaadin.ui Embedded Embedded
public Embedded(String caption, Resource source)
From source file:it.vige.greenarea.bpm.custom.ui.form.DettaglioMissioneField.java
License:Apache License
public DettaglioMissioneField(FormProperty formProperty, GreenareaAbstractFormPropertyRenderer<T> greenareaAbstractFormPropertyRenderer, Missione missione) { I18nManager i18nManager = get().getI18nManager(); String caption = i18nManager.getMessage(DETTAGLIO_MISSIONE_TITLE); setSpacing(true);// w w w. ja va2s. c o m setCaption(caption); setHeight(Sizeable.SIZE_UNDEFINED, 0); Label missionIdLabel = new Label(); missionIdLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_ID_MISSIONE) + " " + missione.getNome()); missionIdLabel.setStyleName("missione_label"); Label missionDateLabel = new Label(); missionDateLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_DATA_MISSIONE) + " " + giornata.format(missione.getDataInizio())); missionDateLabel.setStyleName("missione_label"); Label agencyCodeLabel = new Label(); agencyCodeLabel.setValue( i18nManager.getMessage(DETTAGLIO_MISSIONE_CODICE_FILIALE) + " " + missione.getCodiceFiliale()); agencyCodeLabel.setStyleName("missione_label"); Label rankingLabel = new Label(); rankingLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_RANKING)); Embedded rankingImage = null; if (missione.getRanking() != null) { if (missione.getRanking().equals(VERDE)) rankingImage = new Embedded(null, new ThemeResource("img/circle_green.png")); else if (missione.getRanking().equals(GIALLO)) rankingImage = new Embedded(null, new ThemeResource("img/circle_orange.png")); else if (missione.getRanking().equals(ROSSO)) rankingImage = new Embedded(null, new ThemeResource("img/circle_red.png")); rankingImage.setWidth(20, UNITS_PIXELS); rankingImage.setStyleName("missione_label"); } Label mobilityCreditLabel = new Label(); mobilityCreditLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_CREDITO_DI_MOBILITA) + " " + missione.getCreditoMobilita()); mobilityCreditLabel.setStyleName("missione_label"); addComponent(missionIdLabel); addComponent(missionDateLabel); addComponent(agencyCodeLabel); addComponent(rankingLabel); if (rankingImage != null) addComponent(rankingImage); addComponent(mobilityCreditLabel); setStyleName("dettaglio-missione"); policyDetailsButton = new Button(); policyDetailsButton.setCaption(i18nManager.getMessage(DETTAGLIO_MISSIONE_BUTTON)); final GreenareaAbstractFormPropertyRenderer<?> fGreenareaAbstractFormPropertyRenderer = greenareaAbstractFormPropertyRenderer; policyDetailsButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { fGreenareaAbstractFormPropertyRenderer.getGreenareaFormPropertiesForm().getSubmitFormButton() .click(); } }); addComponent(policyDetailsButton); // Invisible textfield, only used as wrapped field wrappedField = new TextField(); wrappedField.setVisible(false); addComponent(wrappedField); }
From source file:it.vige.greenarea.bpm.custom.ui.form.DettaglioMissioneSTField.java
License:Apache License
public DettaglioMissioneSTField(FormProperty formProperty, GreenareaAbstractFormPropertyRenderer<T> greenareaAbstractFormPropertyRenderer, Missione missione) { I18nManager i18nManager = get().getI18nManager(); String caption = i18nManager.getMessage(DETTAGLIO_MISSIONE_TITLE); setSpacing(true);//from w ww . jav a 2s .com setCaption(caption); setHeight(Sizeable.SIZE_UNDEFINED, 0); Label opLabel = new Label(); opLabel.setValue( i18nManager.getMessage(DETTAGLIO_MISSIONE_OPERATORE_LOGISTICO) + " " + missione.getCompagnia()); opLabel.setStyleName("missione_label"); Label missionIdLabel = new Label(); missionIdLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_ID_MISSIONE) + " " + missione.getNome()); missionIdLabel.setStyleName("missione_label"); Label missionDateLabel = new Label(); missionDateLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_DATA_MISSIONE) + " " + giornata.format(missione.getDataInizio())); missionDateLabel.setStyleName("missione_label"); Label agencyCodeLabel = new Label(); agencyCodeLabel.setValue( i18nManager.getMessage(DETTAGLIO_MISSIONE_CODICE_FILIALE) + " " + missione.getCodiceFiliale()); agencyCodeLabel.setStyleName("missione_label"); Label rankingLabel = new Label(); rankingLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_RANKING)); Embedded rankingImage = null; if (missione.getRanking() != null) { if (missione.getRanking().equals(VERDE)) rankingImage = new Embedded(null, new ThemeResource("img/circle_green.png")); else if (missione.getRanking().equals(GIALLO)) rankingImage = new Embedded(null, new ThemeResource("img/circle_orange.png")); else if (missione.getRanking().equals(ROSSO)) rankingImage = new Embedded(null, new ThemeResource("img/circle_red.png")); rankingImage.setWidth(20, UNITS_PIXELS); rankingImage.setStyleName("missione_label"); } Label mobilityCreditLabel = new Label(); mobilityCreditLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_CREDITO_DI_MOBILITA) + " " + missione.getCreditoMobilita()); mobilityCreditLabel.setStyleName("missione_label"); addComponent(opLabel); addComponent(missionIdLabel); addComponent(missionDateLabel); addComponent(agencyCodeLabel); addComponent(rankingLabel); if (rankingImage != null) addComponent(rankingImage); addComponent(mobilityCreditLabel); setStyleName("dettaglio-missione"); policyDetailsButton = new Button(); policyDetailsButton.setCaption(i18nManager.getMessage(DETTAGLIO_MISSIONE_BUTTON)); final GreenareaAbstractFormPropertyRenderer<?> fGreenareaAbstractFormPropertyRenderer = greenareaAbstractFormPropertyRenderer; policyDetailsButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { fGreenareaAbstractFormPropertyRenderer.getGreenareaFormPropertiesForm().getSubmitFormButton() .click(); } }); addComponent(policyDetailsButton); // Invisible textfield, only used as wrapped field wrappedField = new TextField(); wrappedField.setVisible(false); addComponent(wrappedField); }
From source file:it.vige.greenarea.bpm.custom.ui.form.DettaglioMissioneTRField.java
License:Apache License
public DettaglioMissioneTRField(FormProperty formProperty, GreenareaAbstractFormPropertyRenderer<T> greenareaAbstractFormPropertyRenderer, Missione missione) { I18nManager i18nManager = get().getI18nManager(); String caption = i18nManager.getMessage(DETTAGLIO_MISSIONE_TITLE); setSpacing(true);//www .j a v a 2s . c om setCaption(caption); setHeight(Sizeable.SIZE_UNDEFINED, 0); Label opLabel = new Label(); opLabel.setValue( i18nManager.getMessage(DETTAGLIO_MISSIONE_OPERATORE_LOGISTICO) + " " + missione.getCompagnia()); opLabel.setStyleName("missione_label"); Label missionIdLabel = new Label(); missionIdLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_ID_MISSIONE) + " " + missione.getNome()); missionIdLabel.setStyleName("missione_label"); Label missionDateLabel = new Label(); missionDateLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_DATA_MISSIONE) + " " + giornata.format(missione.getDataInizio())); missionDateLabel.setStyleName("missione_label"); Label agencyCodeLabel = new Label(); agencyCodeLabel.setValue( i18nManager.getMessage(DETTAGLIO_MISSIONE_CODICE_FILIALE) + " " + missione.getCodiceFiliale()); agencyCodeLabel.setStyleName("missione_label"); Label rankingLabel = new Label(); rankingLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_RANKING)); Embedded rankingImage = null; if (missione.getRanking() != null) { if (missione.getRanking().equals(VERDE)) rankingImage = new Embedded(null, new ThemeResource("img/circle_green.png")); else if (missione.getRanking().equals(GIALLO)) rankingImage = new Embedded(null, new ThemeResource("img/circle_orange.png")); else if (missione.getRanking().equals(ROSSO)) rankingImage = new Embedded(null, new ThemeResource("img/circle_red.png")); rankingImage.setWidth(20, UNITS_PIXELS); rankingImage.setStyleName("missione_label"); } Label mobilityCreditLabel = new Label(); mobilityCreditLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_CREDITO_DI_MOBILITA) + " " + missione.getCreditoMobilita()); mobilityCreditLabel.setStyleName("missione_label"); addComponent(opLabel); addComponent(missionIdLabel); addComponent(missionDateLabel); addComponent(agencyCodeLabel); addComponent(rankingLabel); if (rankingImage != null) addComponent(rankingImage); addComponent(mobilityCreditLabel); setStyleName("dettaglio-missione"); policyDetailsButton = new Button(); policyDetailsButton.setCaption(i18nManager.getMessage(DETTAGLIO_MISSIONE_BUTTON)); final GreenareaAbstractFormPropertyRenderer<?> fGreenareaAbstractFormPropertyRenderer = greenareaAbstractFormPropertyRenderer; policyDetailsButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { fGreenareaAbstractFormPropertyRenderer.getGreenareaFormPropertiesForm().getSubmitFormButton() .click(); } }); addComponent(policyDetailsButton); // Invisible textfield, only used as wrapped field wrappedField = new TextField(); wrappedField.setVisible(false); addComponent(wrappedField); }
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 .j a v a2s . c o m // 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. java 2 s .c o m 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 w w w . j a v a2s.co m * * @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.EditorProcessDefinitionDetailPanel.java
License:Apache License
protected void initHeader() { GridLayout details = new GridLayout(2, 2); details.setWidth(100, UNITS_PERCENTAGE); details.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); details.setSpacing(true);//from www . j a v a 2s. c om details.setMargin(false, false, true, false); details.setColumnExpandRatio(1, 1.0f); detailPanelLayout.addComponent(details); // Image Embedded image = new Embedded(null, Images.PROCESS_50); details.addComponent(image, 0, 0, 0, 1); // Name Label nameLabel = new Label(modelData.getName()); nameLabel.addStyleName(Reindeer.LABEL_H2); details.addComponent(nameLabel, 1, 0); // Properties HorizontalLayout propertiesLayout = new HorizontalLayout(); propertiesLayout.setSpacing(true); details.addComponent(propertiesLayout); // Version String versionString = i18nManager.getMessage(Messages.PROCESS_VERSION, modelData.getVersion()); Label versionLabel = new Label(versionString); versionLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_VERSION); propertiesLayout.addComponent(versionLabel); }
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); }//w w w . jav a2 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.content.CreateAttachmentPopupWindow.java
License:Apache License
protected void initTable() { attachmentTypes = new Table(); attachmentTypes.setSizeUndefined();//from w ww. java2 s.com attachmentTypes.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN); attachmentTypes.setSelectable(true); attachmentTypes.setImmediate(true); attachmentTypes.setNullSelectionAllowed(false); attachmentTypes.setWidth(200, UNITS_PIXELS); attachmentTypes.setHeight(100, UNITS_PERCENTAGE); attachmentTypes.setCellStyleGenerator(new CellStyleGenerator() { private static final long serialVersionUID = 1L; public String getStyle(Object itemId, Object propertyId) { if ("name".equals(propertyId)) { return ExplorerLayout.STYLE_RELATED_CONTENT_CREATE_LIST_LAST_COLUMN; } return null; } }); attachmentTypes.addStyleName(ExplorerLayout.STYLE_RELATED_CONTENT_CREATE_LIST); attachmentTypes.addContainerProperty("type", Embedded.class, null); attachmentTypes.setColumnWidth("type", 16); attachmentTypes.addContainerProperty("name", String.class, null); // Add all possible attachment types for (AttachmentEditor editor : attachmentRendererManager.getAttachmentEditors()) { String name = editor.getTitle(i18nManager); Embedded image = null; Resource resource = editor.getImage(); if (resource != null) { image = new Embedded(null, resource); } Item item = attachmentTypes.addItem(editor.getName()); item.getItemProperty("type").setValue(image); item.getItemProperty("name").setValue(name); } // Add listener to show editor component attachmentTypes.addListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; public void valueChange(ValueChangeEvent event) { String type = (String) event.getProperty().getValue(); selectType(type); } }); layout.addComponent(attachmentTypes); }
From source file:org.activiti.explorer.ui.content.file.ImageAttachmentRenderer.java
License:Apache License
@Override public Component getDetailComponent(Attachment attachment) { VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setSizeUndefined();/*from w w w . j a v a 2 s. co m*/ verticalLayout.setSpacing(true); verticalLayout.setMargin(true); Label description = new Label(attachment.getDescription()); description.setSizeUndefined(); verticalLayout.addComponent(description); // Image TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService(); String mimeType = extractMineType(attachment.getType()); InputStream imageStream = ImageUtil.resizeImage(taskService.getAttachmentContent(attachment.getId()), mimeType, 900, 550); Resource resource = new StreamResource(new InputStreamStreamSource(imageStream), attachment.getName() + extractExtention(attachment.getType()), ExplorerApp.get()); Embedded image = new Embedded(null, resource); verticalLayout.addComponent(image); // Linke HorizontalLayout LinkLayout = new HorizontalLayout(); LinkLayout.setSpacing(true); verticalLayout.addComponent(LinkLayout); verticalLayout.setComponentAlignment(LinkLayout, Alignment.MIDDLE_CENTER); Label fullSizeLabel = new Label( ExplorerApp.get().getI18nManager().getMessage(Messages.RELATED_CONTENT_SHOW_FULL_SIZE)); LinkLayout.addComponent(fullSizeLabel); Link link = null; if (attachment.getUrl() != null) { link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl())); } else { taskService = ProcessEngines.getDefaultProcessEngine().getTaskService(); Resource res = new StreamResource( new InputStreamStreamSource(taskService.getAttachmentContent(attachment.getId())), attachment.getName() + extractExtention(attachment.getType()), ExplorerApp.get()); link = new Link(attachment.getName(), res); } link.setIcon(Images.RELATED_CONTENT_PICTURE); link.setTargetName(ExplorerLayout.LINK_TARGET_BLANK); LinkLayout.addComponent(link); return verticalLayout; }