List of usage examples for com.vaadin.v7.ui VerticalLayout addStyleName
@Override
public void addStyleName(String style)
From source file:info.magnolia.vaadin.periscope.Periscope.java
License:Open Source License
private Component createSpeechButton() { final Button startStopButton = new Button(); startStopButton.addStyleName("record-button"); startStopButton.setCaptionAsHtml(true); startStopButton.setCaption("<span class=\"ion-mic-a\"></span>"); startStopButton.setClickShortcut(ShortcutAction.KeyCode.R, ShortcutAction.ModifierKey.SHIFT, ShortcutAction.ModifierKey.ALT); final AtomicBoolean isRecording = new AtomicBoolean(false); speechRecognizer.addSpeechResultListener(transcript -> { input.setValue(transcript);//from www . ja v a2 s. c om this.consumeQuery(transcript, true); startStopButton.removeStyleName("recording"); isRecording.set(false); }); startStopButton.addClickListener((Button.ClickListener) event -> { if (isRecording.get()) { return; } speechRecognizer.record(); startStopButton.addStyleName("recording"); isRecording.set(true); }); final VerticalLayout speechWrapper = new VerticalLayout(startStopButton, speechRecognizer); speechWrapper.addStyleName("speech-recognition"); return speechWrapper; }