List of usage examples for com.vaadin.ui Button setStyleName
@Override public void setStyleName(String style)
From source file:com.liferay.mail.vaadin.Folders.java
License:Open Source License
private Button createComposeButton() { Button compose = new NativeButton("Compose new message"); compose.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { Controller.get().getApplication().switchToCompose(new Composer(), null); }/*from ww w. j ava 2s . com*/ }); compose.setStyleName("compose"); compose.setWidth("100%"); return compose; }
From source file:com.liferay.mail.vaadin.Folders.java
License:Open Source License
public void setFolders(List<Folder> folders) { for (Folder folder : folders) { Button b = new Button(folder.getDisplayName()); b.setStyleName(BaseTheme.BUTTON_LINK); b.setData(folder);//from www . j a v a2 s. c o m b.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { showFolder(((Folder) event.getButton().getData())); } }); } }
From source file:com.liferay.mail.vaadin.MessageView.java
License:Open Source License
public void showMessage(Message msg) { if (msg == null) { messageLabel.setVisible(false);//from w w w . ja v a2 s . c om headersAndAttachmentLayout.setVisible(false); return; } else { messageLabel.setVisible(true); headersAndAttachmentLayout.setVisible(true); } // Body String text = ""; if (msg != null) { text = msg.getBody(); } messageLabel.setValue(text); // Headers headersLayout = new FormLayout(); headersLayout.setSpacing(false); headersLayout.setMargin(false); if (msg != null) { String to = msg.getTo(); String cc = msg.getCc(); // String replyTo = msg.get(); Label subject = new Label(msg.getSubject()); subject.setCaption(Lang.get("subject")); headersLayout.addComponent(subject); Label from = new Label(msg.getSender()); from.setCaption(Lang.get("from")); headersLayout.addComponent(from); if (to != null && !to.equals("")) { Label toLabel = new Label(to); toLabel.setCaption(Lang.get("to")); headersLayout.addComponent(toLabel); } if (cc != null && !cc.equals("")) { Label ccLabel = new Label(cc); ccLabel.setCaption(Lang.get("cc")); headersLayout.addComponent(ccLabel); } Label date = new Label(formatDate(msg.getSentDate())); date.setCaption(Lang.get("date")); headersLayout.addComponent(date); if (MessageUtil.isImportant(msg)) { Label flag = new Label(Lang.get("important")); flag.setStyleName(MessageList.STYLE_IMPORTANT); flag.setCaption(Lang.get("flag")); headersLayout.addComponent(flag); } } // Attachments try { headersAndAttachmentLayout.removeAllComponents(); headersAndAttachmentLayout.addComponent(headersLayout); Controller controller = Controller.get(); List<Attachment> attachments = AttachmentLocalServiceUtil.getAttachments(msg.getMessageId()); if (attachments != null && !attachments.isEmpty()) { for (Attachment attachment : attachments) { Button attachmentDownload = new Button(); attachmentDownload.setStyleName(BaseTheme.BUTTON_LINK); attachmentDownload.setCaption(attachment.getFileName() + " " + MessageUtil.formatSize(attachment.getSize(), controller.getUserLocale())); attachmentDownload.setData(attachment); attachmentDownload.addListener(this); headersAndAttachmentLayout.addComponent(attachmentDownload); } } } catch (SystemException e) { _log.debug(e); } }
From source file:com.liferay.mail.vaadin.PreferencesView.java
License:Open Source License
private void updateAccountList() { try {//w w w.j av a 2s . c om accountPanel.removeAllComponents(); List<Account> accounts = controller.getAccountManager().getAccounts(controller.getUser()); if (accounts.size() > 0) { GridLayout grid = new GridLayout(3, accounts.size()); grid.setSpacing(true); for (final Account account : accounts) { grid.addComponent(new Label(account.getAddress())); Button editButton = new Button(Lang.get("edit-account")); editButton.setStyleName("small"); editButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { editAccount(account); } }); grid.addComponent(editButton); Button deleteButton = new Button(Lang.get("delete-account")); deleteButton.setStyleName("small"); deleteButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { deleteAccount(account); } }); grid.addComponent(deleteButton); } accountPanel.addComponent(grid); } } catch (SystemException e) { // unable to read account information controller.showUnexpectedError(e); } }
From source file:com.logicbomb.newschool.MyAppWidgetSet.core.HourWidget.java
public HourWidget(int aHourNumber, int aTotalHourNumber) { setWidth("500px"); setHeight("500px"); //setStyleName("backColorGrey"); String[] classes = { "VI", "VII", "VIII", "IX", "X" }; int index1 = new Random().nextInt(classes.length); String selectedClass = (classes[index1]); String[] sections = { "A", "B", "C", "D", "E" }; int index2 = new Random().nextInt(classes.length); String selectedSection = (sections[index2]); String[] content = { "Gravitation", "Lab", "Electricity", "Force", "Motion" }; int index3 = new Random().nextInt(classes.length); String selectedContent = (content[index3]); //Button b= new Button("2"); //addComponent(b); //c.setSizeFull(); Button iMinorText = new Button(selectedContent); double redOrGreen = Math.random(); if (Math.random() > 0.5) { iMinorText.setStyleName("v-button-type1-red"); } else {// w w w. j a va 2 s . com iMinorText.setStyleName("v-button-type1-green"); } iMinorText.setHeight("40px"); iMinorText.setWidth("125px"); //c.setCaptionAsHtml(true); kkk addComponent(iMinorText);//,"top:10px;left:10px"); Label iMajorText = new Label(selectedClass + " - " + selectedSection); iMajorText.setStyleName("v-label-type1"); iMajorText.setHeight("15px"); iMajorText.setWidth("50px"); addComponent(iMajorText, "top:2px;left:1px"); double numberOfMemos = Math.floor(Math.random() * 5); //Diplay if any memo present NativeButton memoButton; if (numberOfMemos > 0) { memoButton = new NativeButton();//String.valueOf(numberOfMemos).replace(".0", "")); memoButton.setStyleName("v-button-type2"); //memoButton.setHeight("15px"); //memoButton.setWidth("30px"); memoButton.setIcon(FontAwesome.PENCIL); addComponent(memoButton, "top:2px;left:85px"); } double numberOfNotifications = Math.floor(Math.random() * 5); NativeButton notificationButton; if (numberOfNotifications > 0) { notificationButton = new NativeButton();//String.valueOf(numberOfNotifications).replace(".0", "")); notificationButton.setStyleName("v-button-type2"); //notificationButton.setHeight("15px"); //notificationButton.setWidth("30px"); notificationButton.setIcon(FontAwesome.BELL); addComponent(notificationButton, "top:2px;left:100px"); } }
From source file:com.logicbomb.newschool.MyAppWidgetSet.core.UserDetailsWidget.java
public UserDetailsWidget() { HorizontalLayout h = new HorizontalLayout(); addComponent(h);/*w ww. j a v a 2 s . c om*/ h.setSizeFull(); //h.setSpacing(true); Button userPhoto = new Button(); userPhoto.setIcon(FontAwesome.USER); userPhoto.setHeight("100px"); userPhoto.setWidth("100px"); h.addComponent(userPhoto); //h.setComponentAlignment(userPhoto, Alignment.TOP_LEFT); VerticalLayout v = new VerticalLayout(); //v.setStyleName("backColorBlack"); h.addComponent(v); v.setStyleName("v-layout-padding-left"); //h.setComponentAlignment(userPhoto, Alignment.TOP_RIGHT); v.setHeight("106px"); v.setWidth("100px"); // v.setComponentAlignment(userStatus, Alignment.MIDDLE_CENTER); Button editProfile = new Button("Profile"); editProfile.setStyleName("v-button-type3"); editProfile.setIcon(FontAwesome.USER); editProfile.setWidth("100px"); editProfile.setWidth("102px"); v.addComponent(editProfile); //v.setComponentAlignment(editProfile, Alignment.TOP_LEFT); Button settings = new Button("Settings"); settings.setStyleName("v-button-type3"); settings.setIcon(FontAwesome.WRENCH); settings.setWidth("100px"); settings.setWidth("102px"); v.addComponent(settings); //v.setComponentAlignment(editProfile, Alignment.MIDDLE_RIGHT); Button logOut = new Button("Log Out"); logOut.setStyleName("v-button-type3"); logOut.setIcon(FontAwesome.KEY); logOut.setWidth("100px"); logOut.setWidth("102px"); v.addComponent(logOut); //v.setComponentAlignment(editProfile, Alignment.BOTTOM_RIGHT); //v.setComponentAlignment(userStatus, Alignment.MIDDLE_CENTER); }
From source file:com.mechanicshop.components.MaintenanceLayout.java
private void buildLayout() { HorizontalLayout layoutTitle = new HorizontalLayout(); layoutTitle.setSizeUndefined();/*from w ww .j av a2s. c om*/ layoutTitle.setWidth("100%"); layoutTitle.setSpacing(false); layoutTitle.setMargin(false); titleLabel.addStyleName(ValoTheme.LABEL_H2); titleLabel.addStyleName(ValoTheme.LABEL_COLORED); titleLabel.addStyleName(ValoTheme.LABEL_NO_MARGIN); titleLabel.addStyleName(ValoTheme.LABEL_BOLD); titleLabel.setSizeUndefined(); layoutTitle.addComponent(titleLabel); layoutTitle.setComponentAlignment(titleLabel, Alignment.MIDDLE_CENTER); VerticalLayout layoutTable = new VerticalLayout(); layoutTable.setSizeFull(); layoutTable.setSpacing(true); HorizontalLayout layoutButtons = new HorizontalLayout(); layoutButtons.setMargin(false); layoutButtons.setSpacing(true); layoutButtons.setSizeUndefined(); Button passwordBtn = new Button("Edit Password"); passwordBtn.addClickListener(passwordListener); passwordBtn.setImmediate(true); passwordBtn.setIcon(FontAwesome.EDIT); passwordBtn.setStyleName(ValoTheme.BUTTON_TINY); Button media1Btn = new Button("Media 1 Default Text"); media1Btn.setStyleName(ValoTheme.BUTTON_TINY); media1Btn.setImmediate(true); media1Btn.setIcon(FontAwesome.EDIT); media1Btn.addClickListener(media1Listener); Button media2Btn = new Button("Media 2 Default Text"); media2Btn.setStyleName(ValoTheme.BUTTON_TINY); media2Btn.setImmediate(true); media2Btn.setIcon(FontAwesome.EDIT); media2Btn.addClickListener(media2Listener); layoutButtons.addComponents(passwordBtn, media1Btn, media2Btn); layoutButtons.setComponentAlignment(passwordBtn, Alignment.MIDDLE_LEFT); layoutButtons.setComponentAlignment(media1Btn, Alignment.MIDDLE_LEFT); layoutButtons.setComponentAlignment(media2Btn, Alignment.MIDDLE_LEFT); addComponent(layoutTitle); addComponent(layoutTable); layoutTable.addComponent(layoutButtons); layoutTable.addComponent(table); layoutTable.setComponentAlignment(table, Alignment.TOP_CENTER); layoutTable.setExpandRatio(table, 3); setComponentAlignment(layoutTitle, Alignment.TOP_CENTER); setComponentAlignment(layoutTable, Alignment.TOP_CENTER); setExpandRatio(layoutTable, 3); setSpacing(true); setMargin(true); }
From source file:com.mechanicshop.components.MaintenanceLayout.java
private void customizeTable() { table.setSizeFull();/*w w w.java 2s . co m*/ table.setSortEnabled(true); table.setStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES); table.addStyleName(ValoTheme.TABLE_SMALL); table.setEditable(true); table.setImmediate(true); table.addGeneratedColumn(" ", new Table.ColumnGenerator() { @Override public Object generateCell(final Table source, final Object itemId, Object columnId) { Button icon = new Button(); icon.setStyleName(ValoTheme.BUTTON_ICON_ONLY); icon.addStyleName(ValoTheme.BUTTON_TINY); icon.addStyleName(ValoTheme.BUTTON_BORDERLESS); icon.setVisible(true); icon.setImmediate(true); icon.setDescription("Details"); icon.setIcon(FontAwesome.PENCIL); icon.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { Item item = source.getItem(itemId); showDataEntryWindow(item); } }); return icon; } }); }
From source file:com.mechanicshop.components.TableLayout.java
private void buildLayout() { HorizontalLayout layoutTitle = new HorizontalLayout(); layoutTitle.setSizeUndefined();/*from www .j a v a 2 s . co m*/ layoutTitle.setWidth("100%"); layoutTitle.setSpacing(false); layoutTitle.setMargin(false); titleLabel.addStyleName(ValoTheme.LABEL_H2); titleLabel.addStyleName(ValoTheme.LABEL_COLORED); titleLabel.addStyleName(ValoTheme.LABEL_NO_MARGIN); titleLabel.addStyleName(ValoTheme.LABEL_BOLD); titleLabel.setSizeUndefined(); layoutTitle.addComponent(titleLabel); layoutTitle.setComponentAlignment(titleLabel, Alignment.MIDDLE_CENTER); VerticalLayout layoutTable = new VerticalLayout(); layoutTable.addComponent(table); layoutTable.setComponentAlignment(table, Alignment.TOP_CENTER); layoutTable.setSizeFull(); layoutTable.setSpacing(true); HorizontalLayout layoutButtons = new HorizontalLayout(); layoutButtons.setMargin(false); layoutButtons.setSpacing(true); layoutButtons.setSizeUndefined(); layoutButtons.setWidth("100%"); Button addBtn = new Button("Add new Car"); addBtn.addClickListener(addBtnListener); addBtn.setImmediate(true); addBtn.setStyleName(ValoTheme.BUTTON_TINY); addBtn.addStyleName(ValoTheme.BUTTON_FRIENDLY); Button deleteBtn = new Button("Delete Selected"); deleteBtn.setStyleName(ValoTheme.BUTTON_TINY); deleteBtn.addStyleName(ValoTheme.BUTTON_DANGER); deleteBtn.setImmediate(true); deleteBtn.addClickListener(removeListener); btnSendSMS.setStyleName(ValoTheme.BUTTON_TINY); btnSendSMS.addStyleName(ValoTheme.BUTTON_FRIENDLY); btnSendSMS.setImmediate(true); btnSendSMS.addClickListener(sendSMSBtnListener); searchTextField.setImmediate(true); searchTextField.addStyleName(ValoTheme.TEXTFIELD_TINY); searchTextField.addTextChangeListener(filterChangeListener); Label lbSearch = new Label("Search"); lbSearch.addStyleName(ValoTheme.LABEL_TINY); lbSearch.setSizeUndefined(); layoutButtons.addComponents(lbSearch, searchTextField, addBtn, deleteBtn, btnSendSMS); layoutButtons.setComponentAlignment(lbSearch, Alignment.MIDDLE_LEFT); layoutButtons.setComponentAlignment(searchTextField, Alignment.BOTTOM_LEFT); layoutButtons.setComponentAlignment(addBtn, Alignment.BOTTOM_RIGHT); layoutButtons.setComponentAlignment(deleteBtn, Alignment.BOTTOM_RIGHT); layoutButtons.setComponentAlignment(btnSendSMS, Alignment.BOTTOM_RIGHT); layoutButtons.setExpandRatio(addBtn, 3); addComponent(layoutTitle); addComponent(layoutTable); layoutTable.addComponent(layoutButtons); layoutTable.setExpandRatio(table, 3); setComponentAlignment(layoutTitle, Alignment.TOP_CENTER); setComponentAlignment(layoutTable, Alignment.TOP_CENTER); setExpandRatio(layoutTable, 3); setSpacing(true); setMargin(true); }
From source file:com.mechanicshop.components.TableLayout.java
private void customizeTable() { table.setSizeFull();/*from w w w .j a v a 2 s . c om*/ table.setSortEnabled(true); table.setStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES); table.addStyleName(ValoTheme.TABLE_SMALL); table.setEditable(true); table.setImmediate(true); table.setSizeFull(); table.addGeneratedColumn("", new Table.ColumnGenerator() { @Override public Object generateCell(Table source, final Object itemId, Object columnId) { boolean selected = false; final CheckBox cb = new CheckBox("", selected); cb.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { if (selectedItemIds.contains(itemId)) { selectedItemIds.remove(itemId); } else { if (cb.getValue() != false) { selectedItemIds.add(itemId); } } } }); return cb; } }); table.addGeneratedColumn(" ", new Table.ColumnGenerator() { @Override public Object generateCell(final Table source, final Object itemId, Object columnId) { Button icon = new Button(); icon.setStyleName(ValoTheme.BUTTON_ICON_ONLY); icon.addStyleName(ValoTheme.BUTTON_TINY); icon.addStyleName(ValoTheme.BUTTON_BORDERLESS); icon.setVisible(true); icon.setImmediate(true); icon.setDescription("Details"); icon.setIcon(FontAwesome.PENCIL); icon.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { Item item = source.getItem(itemId); dataEntryLayout.fillDataEntry(item, titleLabel.getValue()); getUI().addWindow(dataEntryLayout); } }); return icon; } }); }