List of usage examples for com.vaadin.ui Embedded setHeight
@Override public void setHeight(String height)
From source file:com.cavisson.gui.dashboard.components.controls.Dragging.java
License:Apache License
private List<Component> createComponents() { final List<Component> components = new ArrayList<Component>(); final Label label = new Label("This is a long text block that will wrap."); label.setWidth("120px"); components.add(label);//from www . ja va 2s .c o m final Embedded image = new Embedded("", new ThemeResource("../runo/icons/64/document.png")); components.add(image); final CssLayout documentLayout = new CssLayout(); documentLayout.setWidth("19px"); for (int i = 0; i < 5; ++i) { final Embedded e = new Embedded(null, new ThemeResource("../runo/icons/16/document.png")); e.setHeight("16px"); e.setWidth("16px"); documentLayout.addComponent(e); } components.add(documentLayout); final VerticalLayout buttonLayout = new VerticalLayout(); final Button button = new Button("Button"); button.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { Notification.show("Button clicked"); } }); buttonLayout.addComponent(button); buttonLayout.setComponentAlignment(button, Alignment.MIDDLE_CENTER); components.add(buttonLayout); return components; }
From source file:com.foc.vaadin.gui.FVIconFactory.java
License:Apache License
public Embedded getFVIcon(String iconName, boolean dispLayCaption) { Resource iconResourse = new ThemeResource("../" + THEME_DIR + "/icons/" + iconName); Embedded embedded = new Embedded(null, iconResourse); if (!iconName.equals(ICON_TRASH_SMALL)) { embedded.setWidth("32px"); embedded.setHeight("32px"); }//from ww w . ja v a2s. c o m if (dispLayCaption) { embedded.setCaption(iconName); } return embedded; }
From source file:com.foc.vaadin.gui.FVIconFactory.java
License:Apache License
public Embedded getFVIcon_Embedded(String iconName, int size) { Embedded embedded = null; Resource resource = getFVIcon_Internal(iconName, size); if (resource != null) { embedded = new Embedded("", resource); if (size == SIZE_NONE) { } else if (size == SIZE_SMALL) { embedded.setWidth("16px"); embedded.setHeight("16px"); } else if (size == SIZE_24) { embedded.setWidth("24px"); embedded.setHeight("24px"); } else if (size == SIZE_BIG) { embedded.setWidth("32px"); embedded.setHeight("32px"); } else if (size == SIZE_48) { embedded.setWidth("48px"); embedded.setHeight("48px"); }/*from w w w.j a va 2 s .c om*/ } return embedded; }
From source file:com.jain.addon.web.table.JainColumnGenerator.java
License:Apache License
private Component createImage(final Property<?> itemProperty, final Table source) { if (itemProperty.getValue() != null) { JStreamSource streamSource = new JStreamSource((byte[]) itemProperty.getValue()); SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS"); String filename = "myfilename-" + df.format(new Date()) + ".png"; StreamResource resource = new StreamResource(streamSource, filename); Embedded embedded = new Embedded("", resource); embedded.setHeight("20px"); return embedded; }//from www . j av a 2 s .co m return null; }
From source file:com.klwork.explorer.ui.task.ProcessInstanceEventsPanel.java
License:Apache License
protected void addTaskEventPicture(final Comment taskEvent, GridLayout eventGrid) { final Picture userPicture = identityService.getUserPicture(taskEvent.getUserId()); Embedded authorPicture = null; if (userPicture != null) { StreamResource imageresource = new StreamResource(new StreamSource() { private static final long serialVersionUID = 1L; public InputStream getStream() { return userPicture.getInputStream(); }/*w ww .ja v a2 s . c om*/ }, "event_" + taskEvent.getUserId() + "." + Constants.MIMETYPE_EXTENSION_MAPPING.get(userPicture.getMimeType())); authorPicture = new Embedded(null, imageresource); } else { authorPicture = new Embedded(null, Images.USER_50); } authorPicture.setType(Embedded.TYPE_IMAGE); authorPicture.setHeight("48px"); authorPicture.setWidth("48px"); authorPicture.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_PICTURE); eventGrid.addComponent(authorPicture); }
From source file:com.klwork.explorer.ui.task.TaskEventsPanel.java
License:Apache License
protected void addTaskEventPicture(final org.activiti.engine.task.Event taskEvent, GridLayout eventGrid) { final Picture userPicture = identityService.getUserPicture(taskEvent.getUserId()); Embedded authorPicture = null; if (userPicture != null) { /*StreamResource imageresource = new StreamResource(new StreamSource() { private static final long serialVersionUID = 1L; public InputStream getStream() { return userPicture.getInputStream(); }/*ww w . j a v a 2 s. c om*/ }, "event_" + taskEvent.getUserId() + "." + Constants.MIMETYPE_EXTENSION_MAPPING.get(userPicture.getMimeType()), ExplorerApp.get()); authorPicture = new Embedded(null, imageresource);*/ } else { authorPicture = new Embedded(null, Images.USER_50); } authorPicture.setType(Embedded.TYPE_IMAGE); authorPicture.setHeight("48px"); authorPicture.setWidth("48px"); authorPicture.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_PICTURE); eventGrid.addComponent(authorPicture); }
From source file:com.klwork.explorer.ui.task.UserDetailsComponent.java
License:Apache License
protected void addUserPicture() { Resource pictureResource = Images.USER_32; // default icon if (user != null) { final Picture userPicture = identityService.getUserPicture(user.getId()); if (userPicture != null) { //WW_TODO ?, pictureResource = new StreamResource(new StreamSource() { public InputStream getStream() { return userPicture.getInputStream(); }/*from ww w. j a va 2 s. c o m*/ }, user.getId()); } } Embedded picture = new Embedded(null, pictureResource); picture.setType(Embedded.TYPE_IMAGE); picture.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_PICTURE); if (user != null) { // Only set fixed height and width when user has image, otherwise icon's dimensions will be used picture.setHeight("32px"); picture.setWidth("32px"); } addComponent(picture); // Add profile popup listener if (user != null) { picture.addStyleName(ExplorerLayout.STYLE_CLICKABLE); // picture.addClickListener(new com.vaadin.event.MouseEvents.ClickListener() { public void click(ClickEvent event) { // ViewToolManager.showProfilePopup(user.getId()); ViewToolManager.showPopupWindow(new ProfilePopupWindow(user.getId())); } }); } }
From source file:com.klwork.explorer.ui.user.UserEventsPanel.java
License:Apache License
protected void addTaskEventPicture(final org.activiti.engine.task.Event taskEvent, GridLayout eventGrid) { if (taskEvent.getUserId() == null) { return;//w w w .j av a 2 s . c om } final Picture userPicture = identityService.getUserPicture(taskEvent.getUserId()); Embedded authorPicture = null; if (userPicture != null) { StreamResource imageresource = new StreamResource(new StreamSource() { private static final long serialVersionUID = 1L; public InputStream getStream() { return userPicture.getInputStream(); } }, "event_" + taskEvent.getUserId() + "." + Constants.MIMETYPE_EXTENSION_MAPPING.get(userPicture.getMimeType())); authorPicture = new Embedded(null, imageresource); } else { authorPicture = new Embedded(null, Images.USER_50); } authorPicture.setType(Embedded.TYPE_IMAGE); authorPicture.setHeight("48px"); authorPicture.setWidth("48px"); authorPicture.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_PICTURE); eventGrid.addComponent(authorPicture); }
From source file:com.ribas.andrei.vaadin.OpenWindowApplication.java
License:Open Source License
private void createSubWindow(String subWindowMessage, boolean modal) { if (subWindow == null) { Embedded iframe = new Embedded(null, OpenWindowApplication.this.getStreamSource()); iframe.setType(Embedded.TYPE_BROWSER); iframe.setWidth("100%"); iframe.setHeight("100%"); createSubWindow(subWindowMessage, modal, iframe); } else if (subWindow.getParent() != null) { mainWindow.showNotification("SubWindow is already open"); }/* w w w .j a v a2 s .c om*/ }
From source file:com.scsb.crpro.MessageBox.java
License:Apache License
/** * Similar to {@link #MessageBox(Window, String, Icon, String, Alignment, ButtonConfig...)}, * but the message component is defined explicitly. The component can be even a composite * of a layout manager and manager further Vaadin components. * // w ww .j av a 2 s . co m * @param messageComponent a Vaadin component */ public MessageBox(String dialogWidth, String dialogHeight, String dialogCaption, Icon dialogIcon, Component messageComponent, Alignment buttonsAlignment, ButtonConfig... buttonConfigs) { super(); setResizable(false); setClosable(false); setSizeUndefined(); setWidth(dialogWidth); //setHeight(dialogHeight); setCaption(dialogCaption); GridLayout mainLayout = new GridLayout(2, 2); mainLayout.setMargin(true); mainLayout.setSpacing(true); mainLayout.setSizeUndefined(); mainLayout.setWidth(GRID_DEFAULT_WIDTH1); // Add Content messageComponent.setSizeUndefined(); messageComponent.setWidth(GRID_DEFAULT_WIDTH2); if (dialogIcon == null || Icon.NONE.equals(dialogIcon)) { mainLayout.addComponent(messageComponent, 0, 0, 1, 0); mainLayout.setRowExpandRatio(0, 1.0f); mainLayout.setColumnExpandRatio(0, 1.0f); } else { mainLayout.addComponent(messageComponent, 1, 0); mainLayout.setRowExpandRatio(0, 1.0f); mainLayout.setColumnExpandRatio(1, 1.0f); Embedded icon = null; switch (dialogIcon) { case QUESTION: icon = new Embedded(null, new ThemeResource("images/question.png")); break; case INFO: icon = new Embedded(null, new ThemeResource("images/info.png")); break; case WARN: icon = new Embedded(null, new ThemeResource("images/warn.png")); break; case ERROR: icon = new Embedded(null, new ThemeResource("images/error.png")); break; } mainLayout.addComponent(icon, 0, 0); icon.setWidth(ICON_DEFAULT_SIZE); icon.setHeight(ICON_DEFAULT_SIZE); } // Add Buttons HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); mainLayout.addComponent(buttonLayout, 0, 1, 1, 1); mainLayout.setComponentAlignment(buttonLayout, buttonsAlignment); for (ButtonConfig buttonConfig : buttonConfigs) { Button button = new Button(buttonConfig.getCaption(), new ButtonClickListener(buttonConfig.getButtonType())); if (buttonConfig.getWidth() != null) { button.setWidth(buttonConfig.getWidth()); } if (buttonConfig.getOptionalResource() != null) { button.setIcon(buttonConfig.getOptionalResource()); } else { Resource icon = null; switch (buttonConfig.getButtonType()) { case ABORT: icon = new ThemeResource("images/famfamfam/cross.png"); break; case CANCEL: icon = new ThemeResource("images/famfamfam/cross.png"); break; case CLOSE: icon = new ThemeResource("images/famfamfam/door.png"); break; case HELP: icon = new ThemeResource("images/famfamfam/lightbulb.png"); break; case OK: icon = new ThemeResource("images/famfamfam/tick.png"); break; case YES: icon = new ThemeResource("images/famfamfam/tick.png"); break; case NO: icon = new ThemeResource("images/famfamfam/cross.png"); break; case SAVE: icon = new ThemeResource("images/famfamfam/disk.png"); break; case RETRY: icon = new ThemeResource("images/famfamfam/arrow_refresh.png"); break; case IGNORE: icon = new ThemeResource("images/famfamfam/lightning_go.png"); break; } button.setIcon(icon); } buttonLayout.addComponent(button); } setContent(mainLayout); }