Webcam
HTML5 webcam for Vaadin 7
Webcam allows you to capture images from the web camera. This add-on uses only JavaScript, so no Flash plug-in is required from the browser.
Currently works only with Google Chrome (also on Android) and Mozilla Firefox.
Sample code
private File targetFile; @Override protected void init(VaadinRequest request) { final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); setContent(layout); // Create the webcam and assign a receiver. final Webcam webcam = new Webcam(); webcam.setWidth("400px"); webcam.setReceiver(new Receiver() { @Override public OutputStream receiveUpload(String filename, String mimeType) { try { targetFile = File.createTempFile(filename, ".jpeg"); targetFile.deleteOnExit(); return new FileOutputStream(targetFile); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; } }); // Add an event listener to be called after a successful capture. webcam.addCaptureSucceededListener(new CaptureSucceededListener() { @Override public void captureSucceeded(CaptureSucceededEvent event) { Image img = new Image("Captured image", new FileResource( targetFile)); img.setWidth("200px"); layout.addComponent(img); } }); // Add a button as an alternative way to capture. Button button = new Button( "Click the webcam viewfinder OR here to capture"); button.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { webcam.capture(); } }); layout.addComponent(webcam); layout.addComponent(button); }
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
Add support for Chrome on Android.
- Released
- 2015-04-15
- Maturity
- EXPERIMENTAL
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 7.0+
- Browser
- Firefox
- Google Chrome
- Android Browser
Popup - Vaadin Add-on Directory
A content-rich small window that can be bound to target elementView on GitHub
Online Demo
Popup version 1.1.0
Updated client dependency to vcf-popup v1.1.0
Popup version 2.0.0
- Added npm support
- Component now supports both bower and npm modes
Popup version 2.1.1
### Version 2.1.1
- Improvement: Popup is opened above target component if there is no space below
Popup version 2.1.2
### 2.1.2
- Updated to use vcf-popup 1.2.1 which supports propagation of theme attribute
Popup version 2.1.3
### Version 2.1.3: Fixing Vaadin 14.1 compatibility issue
Popup version 2.1.4
### Version 2.1.4
- Fixing issue of overlay styles leaking in npm mode
Popup version 2.2.0
### Version 2.2.0
- Added PopupOpenChangedEvent and listener
Popup version 2.2.1
### Version 2.2.1
- Changed to Apache 2 license
- Works only in npm mode
Popup version 2.2.2
### Version 2.2.2
- Fixes issue with Popup getting lost when using @PreserveOnRefresh
Popup version 2.2.3
### Version 2.2.3
- Removing some debug logging
Popup version 2.2.4
Fix a Javascript error when the popup is used in a Grid
Popup version 2.2.5
### Version 2.2.5
- Fixes scrolling issue when using inside Grid's cell
Popup version 3.0.0
### Version 3.0.0
- Fix issues due Vaadin 22.0.0
- Vaadin 22+ required
Popup version 4.0.0
#### New features:
* Updates to make component compatible with Vaadin 24.
Popup version 23.3.0
#### New Features
- upgraded dependency to 23.3.0 version of the Popup web component
- added the possibility to set header title
- added the possibility to easily add components to the header and footer of the popup
- popup can be displayed either modal or modeless
- added the possibility to close the popup automatically on scroll, when in modeless mode
- added a convenient way how to add popups to components rendered in Grids (ComponentWithPopupRenderer)
#### Fixes
- Fixed positioning issues on small screens and near the edges of the browser
- Fixed displaying on mobiles (appearing as a bottom drawer again)
Popup version 24.0.0
This version is a Vaadin 24 compatible version of features and fixes introduced in [version 23.3.0](https://vaadin.com/directory/component/popup/23.3.0)
Popup version 23.3.1
#### Improvements
* improved theming: target element now has 'has-popup' and 'popup-opened' attributes, so it can be better styled when a Popup is attached to it
* improved focus handling: Popup now receives focus when opened; focus cycles through focusable elements inside the Popup
* modeless Popup can now be closed using ESC (the same way as modal Popup)
* better keyboard navigability for Grid cells generated using ComponentWithPopupRenderer - press the spacebar on the focused cell to open the Popup
Popup version 24.0.1
#### Improvements
* improved theming: target element now has 'has-popup' and 'popup-opened' attributes, so it can be better styled when a Popup is attached to it
* improved focus handling: Popup now receives focus when opened; focus cycles through focusable elements inside the Popup
* modeless Popup can now be closed using ESC (the same way as modal Popup)
* better keyboard navigability for Grid cells generated using ComponentWithPopupRenderer - press the spacebar on the focused cell to open the Popup
Popup version 23.3.2
#### Improvements
* Feature: Onboarding Walkthrough - use the new `Onboarding` and `OnboardingStep` classes to easily create walkthroughs using a series of Popups (Next and Previous buttons included!)
* Feature: Highlighting the target element (`setHighlightTarget` method)
* Feature: Popup can now show a little pointer arrow towards the target element (the "pointer-arrow" theme variant)
* Configuration: A position of the Popup can now be configured (see `PopupPosition.BOTTOM` and `PopupPosition.END`)
* Configuration: Popup can also be shown centered to the target element (see `PopupAlignment.CENTER`)
* Configuration: configure if the Popup receives focus upon opening or not (not by default) - see method `setFocusTrap`
* Configuration: Prevent opening the Popup when a target is clicked (see `setIgnoreTargetClick` method)
* Configuration: Set target Element directly - no need for target HTML ID (see `setTarget`)
#### Fixes
* Fixed unwanted reopening of the Popup when it is closed using the spacebar in Grid
Popup version 24.0.2
#### Improvements
* Feature: Onboarding Walkthrough - use the new `Onboarding` and `OnboardingStep` classes to easily create walkthroughs using a series of Popups (Next and Previous buttons included!)
* Feature: Highlighting the target element (`setHighlightTarget` method)
* Feature: Popup can now show a little pointer arrow towards the target element (the "pointer-arrow" theme variant)
* Configuration: A position of the Popup can now be configured (see `PopupPosition.BOTTOM` and `PopupPosition.END`)
* Configuration: Popup can also be shown centered to the target element (see `PopupAlignment.CENTER`)
* Configuration: configure if the Popup receives focus upon opening or not (not by default) - see method `setFocusTrap`
* Configuration: Prevent opening the Popup when a target is clicked (see `setIgnoreTargetClick` method)
* Configuration: Set target Element directly - no need for target HTML ID (see `setTarget`)
#### Fixes
* Fixed unwanted reopening of the Popup when it is closed using the spacebar in Grid
Popup version 23.3.3
#### Improvements
* Improved Popup accessibility by using `role="dialog"` on the overlay and setting proper `aria-label`
* Added possibility to set the `aria-label` of the popup overlay from Java API
Popup version 24.0.4
#### Improvements
* Improved Popup accessibility by using `role="dialog"` on the overlay and setting proper `aria-label`
* Added possibility to set the `aria-label` of the popup overlay from Java API
Popup version 23.3.4
#### Improvements
* add a possibility to scroll the target element into view on Popup open
* make restoreFocusOnClose an optional feature (default is true to keep the backward compatibility)
* scroll the Onboarding step target element into view when a step is executed
#### Fixes
* fix: prevent temporarily displaying unattached Popup when using you are setting the target element and opening the Popup in a single server roundtrip
* Settings of Popups used in the Onboarding feature have been fine-tuned for better user experience (no blinking, no jumping around the page between steps)
Popup version 24.0.5
#### Bug fixes:
* fix setTarget not showing popup when using preserve on refresh ([#21](https://github.com/vaadin-component-factory/popup/issues/21))
Popup version 23.3.5
#### Bug fixes:
* fix setTarget not showing popup when using preserve on refresh ([#21](https://github.com/vaadin-component-factory/popup/issues/21))
Popup version 24.1.0
Fix the issue when the popup is closed when clicking on an overlay (like Select/Combobox).
Popup version 24.1.1
Update the component version to close the element when click on target when modeless = true