List of usage examples for com.vaadin.ui NativeButton NativeButton
public NativeButton()
From source file:edu.nps.moves.mmowgli.modules.userprofile.ChangeEmailDialog.java
License:Open Source License
@SuppressWarnings("serial") public ChangeEmailDialog(EmailPacket pkt) { this.packet = pkt; // this.uid=uid; //User user = DBGet.getUser(uid); setCaption("Change Email"); setModal(true);// ww w . j a va 2s . com setWidth("350px"); //setHeight("200px"); VerticalLayout vLay = new VerticalLayout(); setContent(vLay); FormLayout fLay = new FormLayout(); oldEmail = new TextField("Current Email", pkt.original);//user.getEmailAddresses().toString()); //oldPw.setColumns(20); oldEmail.setWidth("99%"); fLay.addComponent(oldEmail); newEmail = new TextField("New Email"); newEmail.setWidth("99%"); fLay.addComponent(newEmail); newEmail2 = new TextField("Confirm Email"); newEmail2.setWidth("99%"); fLay.addComponent(newEmail2); vLay.addComponent(fLay); HorizontalLayout buttLay = new HorizontalLayout(); buttLay.setSpacing(true); vLay.addComponent(buttLay); vLay.setComponentAlignment(buttLay, Alignment.TOP_RIGHT); MediaLocator mLoc = Mmowgli2UI.getGlobals().getMediaLocator(); NativeButton cancelButt = new NativeButton(); mLoc.decorateCancelButton(cancelButt); buttLay.addComponent(cancelButt); buttLay.setComponentAlignment(cancelButt, Alignment.BOTTOM_RIGHT); // Label sp; // buttLay.addComponent(sp = new Label()); // sp.setWidth("30px"); saveButt = new NativeButton(); //app.globs().mediaLocator().decorateSaveButton(saveButt); //"save" mLoc.decorateOkButton(saveButt); //"ok" buttLay.addComponent(saveButt); buttLay.setComponentAlignment(saveButt, Alignment.BOTTOM_RIGHT); // buttLay.addComponent(sp = new Label()); // sp.setWidth("5px"); cancelButt.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().removeWindow(ChangeEmailDialog.this); } }); saveButt.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { String oldTry = oldEmail.getValue().toString(); if (!packet.original.equals(oldTry)) { Notification.show("Error", "This should never show", Notification.Type.ERROR_MESSAGE); return; } String check = newEmail2.getValue().toString(); String newStr = newEmail.getValue().toString(); if (check == null || !newStr.trim().equals(check.trim())) { Notification.show("Error", "Emails do not match", Notification.Type.ERROR_MESSAGE); return; } EmailValidator v = new EmailValidator(""); if (newStr == null || !v.isValid(newStr)) { Notification.show("Error", "Please enter a valid email", Notification.Type.ERROR_MESSAGE); return; } packet.updated = newStr.trim(); if (saveListener != null) saveListener.buttonClick(event); UI.getCurrent().removeWindow(ChangeEmailDialog.this); } }); }
From source file:edu.nps.moves.mmowgli.modules.userprofile.ChangePasswordDialog.java
License:Open Source License
@SuppressWarnings("serial") public ChangePasswordDialog(PasswordPacket pkt) { this.packet = pkt; setCaption("Change Password"); setModal(true);// ww w . ja va2s. c o m setWidth("350px"); VerticalLayout vLay = new VerticalLayout(); setContent(vLay); FormLayout fLay = new FormLayout(); oldPw = new PasswordField("Current"); //oldPw.setColumns(20); oldPw.setWidth("99%"); fLay.addComponent(oldPw); newPw = new PasswordField("New"); newPw.setWidth("99%"); fLay.addComponent(newPw); newPw2 = new PasswordField("New again"); newPw2.setWidth("99%"); fLay.addComponent(newPw2); vLay.addComponent(fLay); HorizontalLayout buttLay = new HorizontalLayout(); buttLay.setSpacing(true); vLay.addComponent(buttLay); vLay.setComponentAlignment(buttLay, Alignment.TOP_RIGHT); MediaLocator mLoc = Mmowgli2UI.getGlobals().getMediaLocator(); NativeButton cancelButt = new NativeButton(); mLoc.decorateCancelButton(cancelButt); buttLay.addComponent(cancelButt); buttLay.setComponentAlignment(cancelButt, Alignment.BOTTOM_RIGHT); // Label sp; // buttLay.addComponent(sp = new Label()); // sp.setWidth("30px"); saveButt = new NativeButton(); //app.globs().mediaLocator().decorateSaveButton(saveButt); //"save" mLoc.decorateOkButton(saveButt); //"ok" buttLay.addComponent(saveButt); buttLay.setComponentAlignment(saveButt, Alignment.BOTTOM_RIGHT); // buttLay.addComponent(sp = new Label()); // sp.setWidth("5px"); cancelButt.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().removeWindow(ChangePasswordDialog.this); } }); saveButt.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { String oldTry = oldPw.getValue().toString(); StrongPasswordEncryptor spe = new StrongPasswordEncryptor(); if (!spe.checkPassword(oldTry, packet.original)) { Notification.show("Error", "Existing password incorrect", Notification.Type.ERROR_MESSAGE); return; } String newStr = newPw.getValue().toString(); if (newStr == null || newStr.length() < 6) { Notification.show("Error", "Enter a password of at least six characters", Notification.Type.ERROR_MESSAGE); return; } String check = newPw2.getValue().toString(); if (check == null || !newStr.trim().equals(check.trim())) { Notification.show("Error", "Passwords do not match", Notification.Type.ERROR_MESSAGE); return; } packet.updated = newStr.trim(); if (saveListener != null) saveListener.buttonClick(event); UI.getCurrent().removeWindow(ChangePasswordDialog.this); } }); }
From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfile3Top.java
License:Open Source License
@HibernateSessionThreadLocalConstructor @HibernateUserRead//w ww. j a va 2 s . co m public UserProfile3Top(Object uid) { this.uid = uid; User u = User.getTL(uid); User me = Mmowgli2UI.getGlobals().getUserTL(); itsSomebodyElse = (u.getId() != me.getId()); imGuestAccount = me.isViewOnly(); imAdmin = me.isAdministrator(); imAdminOrGameMaster = me.isAdministrator() || me.isGameMaster(); Game game = Game.getTL(); gameReadOnly = game.isReadonly(); scoresLab = new Label(); exploreScoreLab = new Label(); innovateScoreLab = new Label(); if (game.isActionPlansEnabled()) { scoresLab.addStyleName("m-userProfile3-scores-label"); exploreScoreLab.addStyleName("m-userProfile3-explorescore-label"); exploreScoreLab.setValue(formatFloat(u.getCombinedBasicScore())); // u.getBasicScore())); exploreScoreLab.setDescription("rounds combined"); innovateScoreLab.addStyleName("m-userProfile3-explorescore-label"); innovateScoreLab.setValue(formatFloat(u.getCombinedInnovScore())); // u.getInnovationScore())); innovateScoreLab.setDescription("rounds combined"); } else { scoresLab.addStyleName("m-userProfile3-exploreonlyscore-label"); exploreScoreLab.addStyleName("m-userProfile3-explorescorebig-label"); exploreScoreLab.setValue(formatFloat(u.getCombinedBasicScore())); // u.getBasicScore())); exploreScoreLab.setDescription("rounds combined"); } avatarButt = new NativeButton(); locationLab = new Label(); locationLab.setDescription("Where are you from?"); expertiseLab = new Label(); expertiseLab.setDescription("Enter a short description of your pertinent expertise."); affiliationLab = new Label("AFFILIATION"); affiliationLab.setDescription("Your professional affliation"); affiliationLab.addStyleName("m-userProfile3-learn-label"); coverUpChangePW = new Label(); nameLab = new Label(); nameLab.setValue(u.getUserName()); learnLab = new Label(); GameQuestion q = u.getQuestion(); String questSumm = null; if (q != null) questSumm = q.getSummary(); questSumm = questSumm == null ? "" : questSumm; learnLab.setValue(questSumm); String questDesc = null; if (q != null) questDesc = q.getQuestion(); questDesc = questDesc == null ? "" : questDesc; learnLab.setDescription(questDesc); levelLab = new Label(); Level lev = u.getLevel(); if (u.isGameMaster()) { Level l = Level.getLevelByOrdinalTL(Level.GAME_MASTER_ORDINAL); if (l != null) lev = l; } levelLab.setValue(lev.getDescription()); changePWButt = new NativeButton(); externMailCB = new CheckBox(); externMailCB.setValue(u.isOkEmail()); ingameMailCB = new CheckBox(); ingameMailCB.setValue(u.isOkGameMessages()); String s; locationTF = new TextField(); s = u.getLocation(); locationTF.setValue(s == null ? "" : s); expertiseTA = new TextArea(); s = u.getExpertise(); expertiseTA.setValue(s == null ? "" : s); affiliationTA = new TextArea(); affiliationTA.setInputPrompt("optional additional affiliations"); affiliationCombo = new BoundAffiliationCombo(); affiliationCombo.setInputPrompt("required"); // override "optional" affiliationCombo.setNewItemsAllowed(false); s = u.getAffiliation(); fillAffiliation(s); learnTA = new TextArea(); s = u.getAnswer(); learnTA.setValue(s == null ? "" : s); badgeButts = new NativeButton[8]; badgeLayout = new GridLayout(4, 3); //col,row if (itsSomebodyElse) { followCB = new CheckBox(); followCB.setValue(amIFollowing(me)); followCB.addValueChangeListener(new FollowListener()); } if (imAdmin) { manageAwardsButt = new NativeButton("manage awards"); manageAwardsButt.setDescription("<p>accessible to game administrators</p>"); manageAwardsButt.addClickListener(new ManageAwardsListener()); } }
From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfile3Top.java
License:Open Source License
private void displayBadgesAndAwards(Object uid, Session sess) { MediaLocator loc = Mmowgli2UI.getGlobals().getMediaLocator(); ClickListener lis = new BadgeListener(); Game g = Game.get(sess);/*from w w w . j av a 2 s . co m*/ MSysOut.println(DEBUG_LOGS, "User.get(sess) from UserProfile3Top.displayBadgesAndAwards(sess)"); User u = User.get(uid, sess); Set<Badge> badges = u.getBadges(); badgeLayout.removeAllComponents(); @SuppressWarnings("unchecked") List<Badge> list = (List<Badge>) sess.createCriteria(Badge.class).addOrder(Order.asc("badge_pk")).list(); int nDefinedBadges = list.size(); for (int b = 0; b < nDefinedBadges; b++) { Badge bd = getBadgeById(badges, b + 1); badgeButts[b] = new NativeButton(); badgeButts[b].addStyleName("m-badgeButton"); badgeLayout.addComponent(badgeButts[b]); if (bd != null) { badgeButts[b].setIcon(loc.locate(bd.getMedia())); badgeButts[b].setDescription(getBadgeDescription(g, bd)); // check for undesired action plan mention badgeButts[b].addClickListener(lis); } else { badgeButts[b].setIcon(loc.getEmptyBadgeImage()); if (!((b + 1) == BADGE_EIGHT_ID)) badgeButts[b].setDescription(getBadgeDescription(g, list.get(b))); // check for undesired action plan mention } } List<AwardButton> ablis = getAwardButtons(u, sess); Iterator<AwardButton> bItr = ablis.iterator(); for (int i = 0; i < 4; i++) { NativeButton awb = bItr.hasNext() ? bItr.next() : null; if (awb == null) { awb = new NativeButton(); awb.addStyleName("m-badgeButton"); awb.setDescription("Game-specific awards"); awb.setIcon(loc.getEmptyBadgeImage()); } badgeLayout.addComponent(awb); } }
From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfilePage3.java
License:Open Source License
@HibernateSessionThreadLocalConstructor public UserProfilePage3(Object uid) { User u = User.getTL(uid);//from w w w.ja v a 2 s . c o m User me = Mmowgli2UI.getGlobals().getUserTL(); itsSomebodyElse = (u.getId() != me.getId()); myIdeasPanel = new UserProfileMyIdeasPanel2(uid); myActionsPanel = new UserProfileMyActionsPanel(uid); myBuddiesPanel = new UserProfileMyBuddiesPanel(uid); myMailPanel = new UserProfileMyMailPanel(uid); myIdeasButt = new NativeButton(); myActionPlansButt = new NativeButton(); myBuddiesButt = new NativeButton(); myMailButt = new NativeButton(); currentTabButton = myIdeasButt; currentTabPanel = myIdeasPanel; topPan = new UserProfile3Top(uid); }
From source file:edu.nps.moves.mmowgli.utility.HistoryDialog.java
License:Open Source License
public HistoryDialog(SortedSet<Edits> set, String windowTitle, String tableTitle, String columnTitle, DoneListener dLis) {//from ww w .j ava2 s .c o m this.set = set; this.doneListener = dLis; setCaption(windowTitle); setModal(true); setWidth("500px"); setHeight("400px"); VerticalLayout vLay = new VerticalLayout(); setContent(vLay); vLay.setSizeFull(); table = new Table(tableTitle); table.setSelectable(true); table.setContainerDataSource(makeContainer()); table.addValueChangeListener(new TableListener()); table.setVisibleColumns(new Object[] { "label", "string" }); table.setColumnHeaders(new String[] { "", columnTitle }); table.setImmediate(true); table.setSizeFull(); table.setItemDescriptionGenerator(new ItemDescriptionGenerator() { private static final long serialVersionUID = 1L; public String generateDescription(Component source, Object itemId, Object propertyId) { return ((StringBean) itemId).string; } }); vLay.addComponent(table); vLay.setExpandRatio(table, 1.0f); MediaLocator mLoc = Mmowgli2UI.getGlobals().getMediaLocator(); HorizontalLayout buttLay = new HorizontalLayout(); vLay.addComponent(buttLay); vLay.setComponentAlignment(buttLay, Alignment.TOP_RIGHT); cancelButt = new NativeButton(); mLoc.decorateCancelButton(cancelButt); buttLay.addComponent(cancelButt); buttLay.setComponentAlignment(cancelButt, Alignment.BOTTOM_RIGHT); okButt = new NativeButton(); mLoc.decorateOkButton(okButt); buttLay.addComponent(okButt); buttLay.setComponentAlignment(okButt, Alignment.BOTTOM_RIGHT); okButt.setEnabled(false); cancelButt.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) { HSess.init(); UI.getCurrent().removeWindow(HistoryDialog.this); if (doneListener != null) doneListener.doneTL(null, -1); HSess.close(); } }); okButt.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) { HSess.init(); UI.getCurrent().removeWindow(HistoryDialog.this); StringBean obj = (StringBean) table.getValue(); if (doneListener != null) { if (obj != null) { int idx = obj.getOrder(); doneListener.doneTL(obj.getString(), idx); } else doneListener.doneTL(null, -1); } HSess.close(); } }); }
From source file:edu.nps.moves.security.PasswordResetUI.java
License:Open Source License
private void handleChangeTL(User user) { this.user = user; Game g = Game.getTL();// w w w. j a v a2 s . c o m String brand = g.getCurrentMove().getTitle(); Page.getCurrent().setTitle("Password reset for " + brand + " mmowgli"); HorizontalLayout hLay = new HorizontalLayout(); hLay.setMargin(true); hLay.setWidth("100%"); setContent(hLay); GameLinks gl = GameLinks.getTL(); String blog = gl.getBlogLink(); Label lab; hLay.addComponent(lab = new Label()); hLay.setExpandRatio(lab, 0.5f); VerticalLayout vl = new VerticalLayout(); hLay.addComponent(vl); vl.setWidth(bannerWidthPx); hLay.addComponent(lab = new Label()); hLay.setExpandRatio(lab, 0.5f); vl.addStyleName("m-greyborder"); vl.setMargin(true); vl.setSpacing(true); vl.addComponent(lab = new HtmlLabel("")); lab.addStyleName("m-font-21-bold"); lab.setSizeUndefined(); vl.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); StringBuilder sb = new StringBuilder(); sb.append(thanksHdr1); sb.append(blog); sb.append(thanksHdr2); sb.append(brand); sb.append(thanksHdr3); lab.setValue(sb.toString()); vl.addComponent(lab = new HtmlLabel("")); lab.setHeight("15px"); vl.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); FormLayout fLay = new FormLayout(); fLay.setSizeUndefined(); fLay.addStyleName("m-login-form"); // to allow styling contents (v-textfield) vl.addComponent(fLay); vl.setComponentAlignment(fLay, Alignment.MIDDLE_CENTER); newPw = new PasswordField("New Password"); newPw.setWidth("99%"); fLay.addComponent(newPw); newPw2 = new PasswordField("Again, please"); newPw2.setWidth("99%"); fLay.addComponent(newPw2); HorizontalLayout buttLay = new HorizontalLayout(); buttLay.setSpacing(true); vl.addComponent(buttLay); vl.setComponentAlignment(buttLay, Alignment.TOP_CENTER); NativeButton cancelButt = new NativeButton(); cancelButt.setStyleName("m-cancelButton"); buttLay.addComponent(cancelButt); buttLay.setComponentAlignment(cancelButt, Alignment.BOTTOM_RIGHT); saveButt = new NativeButton(); saveButt.setClickShortcut(ShortcutAction.KeyCode.ENTER); saveButt.setStyleName("m-continueButton"); //m-saveChangesButton"); buttLay.addComponent(saveButt); buttLay.setComponentAlignment(saveButt, Alignment.BOTTOM_RIGHT); cancelButt.addClickListener(this); saveButt.addClickListener(this); }
From source file:info.magnolia.ui.admincentral.shellapp.favorites.FavoritesEntry.java
License:Open Source License
private void construct(final AbstractJcrNodeAdapter favorite, final FavoritesView.Listener listener) { addStyleName("favorites-entry"); setSizeUndefined();/*ww w .jav a2 s. c om*/ root.setSizeUndefined(); this.enterKeyShortcutListener = new EnterKeyShortcutListener(listener); this.escapeKeyShortcutListener = new EscapeKeyShortcutListener(); this.nodename = favorite.getNodeName(); this.location = favorite.getItemProperty(AdmincentralNodeTypes.Favorite.URL).getValue().toString(); this.title = favorite.getItemProperty(AdmincentralNodeTypes.Favorite.TITLE).getValue().toString(); String icon = "icon-app"; if (favorite.getItemProperty(AdmincentralNodeTypes.Favorite.ICON).getValue() != null) { icon = favorite.getItemProperty(AdmincentralNodeTypes.Favorite.ICON).getValue().toString(); } final Label iconLabel = new Label(); iconLabel.setValue("<span class=\"" + icon + "\"></span>"); iconLabel.setStyleName("icon"); iconLabel.setContentMode(ContentMode.HTML); root.addComponent(iconLabel); titleField = new TextField(); titleField.setValue(title); titleField.setReadOnly(true); titleField.addFocusListener(new FocusListener() { @Override public void focus(FocusEvent event) { iconLabel.removeShortcutListener(enterKeyShortcutListener); titleField.addShortcutListener(enterKeyShortcutListener); titleField.addShortcutListener(escapeKeyShortcutListener); } }); titleField.addBlurListener(new BlurListener() { @Override public void blur(BlurEvent event) { titleField.removeShortcutListener(enterKeyShortcutListener); titleField.removeShortcutListener(escapeKeyShortcutListener); } }); root.addComponent(titleField); editButton = new NativeButton(); editButton.setHtmlContentAllowed(true); editButton.setCaption("<span class=\"icon-edit\"></span>"); editButton.addStyleName("favorite-action"); editButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { doEditTitle(listener); } }); editButton.setVisible(false); root.addComponent(editButton); removeButton = new NativeButton(); removeButton.setHtmlContentAllowed(true); removeButton.setCaption("<span class=\"icon-trash\"></span>"); removeButton.addStyleName("favorite-action"); removeButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { shell.openConfirmation(MessageStyleTypeEnum.WARNING, i18n.translate("confirmation.delete.title.generic"), i18n.translate("confirmation.cannot.undo"), i18n.translate("confirmation.delete.yes"), i18n.translate("confirmation.no"), false, new ConfirmationCallback() { @Override public void onSuccess() { listener.removeFavorite(getRelPath()); } @Override public void onCancel() { // no op } }); } }); removeButton.setVisible(false); root.addComponent(removeButton); root.addLayoutClickListener(new LayoutClickListener() { @Override public void layoutClick(LayoutClickEvent event) { if (event.getClickedComponent() == titleField && !editable) { if (event.isDoubleClick()) { // TODO fgrilli commented out as, besides making the text editable, it also goes to the saved location // See MGNLUI-1317 } else { listener.goToLocation(location); } } } }); setCompositionRoot(root); setIconsVisibility(false); }
From source file:info.magnolia.ui.admincentral.shellapp.favorites.FavoritesGroup.java
License:Open Source License
private void construct(final AbstractJcrNodeAdapter favoritesGroup, final FavoritesView.Listener listener) { wrapper = new CssLayout(); wrapper.addStyleName("favorites-group-title"); this.enterKeyShortcutListener = new EnterKeyShortcutListener(listener); this.escapeKeyShortcutListener = new EscapeKeyShortcutListener(); this.relPath = favoritesGroup.getNodeName(); this.title = favoritesGroup.getItemProperty(AdmincentralNodeTypes.Favorite.TITLE).getValue().toString(); titleField = new TextField(); titleField.setValue(title);//from w ww. j a v a2 s. c om titleField.setReadOnly(true); titleField.addFocusListener(new FocusListener() { @Override public void focus(FocusEvent event) { titleField.addShortcutListener(enterKeyShortcutListener); titleField.addShortcutListener(escapeKeyShortcutListener); } }); titleField.addBlurListener(new BlurListener() { @Override public void blur(BlurEvent event) { titleField.removeShortcutListener(enterKeyShortcutListener); titleField.removeShortcutListener(escapeKeyShortcutListener); } }); wrapper.addComponent(titleField); editButton = new NativeButton(); editButton.setHtmlContentAllowed(true); editButton.setCaption("<span class=\"icon-edit\"></span>"); editButton.addStyleName("favorite-action"); editButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { doEditTitle(listener); } }); editButton.setVisible(false); wrapper.addComponent(editButton); removeButton = new NativeButton(); removeButton.setHtmlContentAllowed(true); removeButton.setCaption("<span class=\"icon-trash\"></span>"); removeButton.addStyleName("favorite-action"); removeButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { shell.openConfirmation(MessageStyleTypeEnum.WARNING, i18n.translate("favorites.group.confirmation.title"), i18n.translate("confirmation.cannot.undo"), i18n.translate("confirmation.delete.yes"), i18n.translate("confirmation.no"), false, new ConfirmationCallback() { @Override public void onSuccess() { listener.removeGroup(relPath); } @Override public void onCancel() { // no op } }); } }); removeButton.setVisible(false); wrapper.addComponent(removeButton); dragAndDropWrapper = new GroupDragAndDropWrapper(wrapper, listener, this); addComponent(dragAndDropWrapper); }
From source file:jcaster_vaadin.Gui2.java
License:Open Source License
@AutoGenerated private HorizontalLayout buildHorizontalLayout_1() { // common part: create layout horizontalLayout_1 = new HorizontalLayout(); horizontalLayout_1.setWidth("100.0%"); horizontalLayout_1.setHeight("60px"); horizontalLayout_1.setImmediate(false); horizontalLayout_1.setMargin(false); horizontalLayout_1.setSpacing(true); // rcrdBtn/*from w w w . j ava 2 s . c o m*/ rcrdBtn = new NativeButton(); rcrdBtn.setWidth("100.0%"); rcrdBtn.setHeight("40px"); rcrdBtn.setCaption("Record"); rcrdBtn.setImmediate(true); horizontalLayout_1.addComponent(rcrdBtn); horizontalLayout_1.setExpandRatio(rcrdBtn, 1.0f); horizontalLayout_1.setComponentAlignment(rcrdBtn, new Alignment(33)); rcrdBtn.addListener(new Button.ClickListener() { private static final long serialVersionUID = 8186248537694916910L; public void buttonClick(Button.ClickEvent event) { record(); } }); // psBtn psBtn = new NativeButton(); psBtn.setWidth("100.0%"); psBtn.setHeight("40px"); psBtn.setCaption("Pause"); psBtn.setEnabled(false); //set disabled at start psBtn.setImmediate(true); horizontalLayout_1.addComponent(psBtn); horizontalLayout_1.setExpandRatio(psBtn, 1.0f); horizontalLayout_1.setComponentAlignment(psBtn, new Alignment(48)); psBtn.addListener(new Button.ClickListener() { private static final long serialVersionUID = 675799252337301498L; public void buttonClick(Button.ClickEvent event) { pause(); } }); // stpBtn stpBtn = new NativeButton(); stpBtn.setWidth("100.0%"); stpBtn.setHeight("40px"); stpBtn.setCaption("Stop"); stpBtn.setEnabled(false); //set disabled at start stpBtn.setImmediate(true); horizontalLayout_1.addComponent(stpBtn); horizontalLayout_1.setExpandRatio(stpBtn, 1.0f); horizontalLayout_1.setComponentAlignment(stpBtn, new Alignment(34)); stpBtn.addListener(new Button.ClickListener() { private static final long serialVersionUID = -3317641878189301674L; public void buttonClick(Button.ClickEvent event) { stop(); } }); return horizontalLayout_1; }