List of usage examples for com.vaadin.ui NativeButton addStyleName
@Override public void addStyleName(String style)
From source file:at.peppol.webgui.app.MainWindow.java
License:Mozilla Public License
@SuppressWarnings("serial") private void initUI() { final VerticalLayout root = new VerticalLayout(); root.setMargin(false);/*ww w .j a va 2 s . c o m*/ setContent(root); // createTopBar(); // Changed with menuBar -- under testing createMenuBar(); // Changed with custom layout using bootstrap -- under testing // createHeaderMenu(); final UserFolder<File> userFolder = new UserFolder<File>(); final long polling = 20000; int draftInvoicesNum = um.countItemsInSpace(um.getDrafts()); int inboxInvoicesNum = um.countItemsInSpace(um.getInbox()); int outboxInvoicesNum = um.countItemsInSpace(um.getOutbox()); //Buttons final NativeButton inboxInvoices = new NativeButton("Invoices (" + inboxInvoicesNum + ")"); final NativeButton outboxInvoices = new NativeButton("Invoices (" + outboxInvoicesNum + ")"); final NativeButton draftInvoices = new NativeButton("Invoices (" + draftInvoicesNum + ")"); //thread final Thread tFolderCount = new Thread(new Runnable() { @Override public void run() { try { while (true) { int countDrafts = um.countItemsInSpace(um.getDrafts()); int countInbox = um.countItemsInSpace(um.getInbox()); int countOutbox = um.countItemsInSpace(um.getOutbox()); synchronized (MainWindow.this.getApplication()) { String labelD = draftInvoices.getCaption(); labelD = labelD.replaceFirst("[\\d]+", "" + countDrafts); draftInvoices.setCaption(labelD); String labelI = inboxInvoices.getCaption(); labelI = labelI.replaceFirst("[\\d]+", "" + countInbox); inboxInvoices.setCaption(labelI); String labelO = outboxInvoices.getCaption(); labelO = labelO.replaceFirst("[\\d]+", "" + countOutbox); outboxInvoices.setCaption(labelO); itemsPanel.reloadTable(userFolder); } Thread.sleep(polling); } } catch (InterruptedException e) { System.out.println("Thread folders interrupted!!!"); } } }); // ------ START: Left NavBar ------- final CssLayout leftNavBar = new CssLayout(); leftNavBar.setStyleName("sidebar-menu"); leftNavBar.setSizeFull(); leftNavBar.setWidth("220px"); // User theUser = (User) getApplication().getUser(); final Label homeLbl = new Label("HOME"); homeLbl.addStyleName("blue"); leftNavBar.addComponent(homeLbl); leftNavBar.addComponent(new Label("INBOX")); final NativeButton catalogueBtn = new NativeButton("Catalogue"); leftNavBar.addComponent(catalogueBtn); leftNavBar.addComponent(new NativeButton("Orders")); //leftNavBar.addComponent (new NativeButton ("Invoices")); //int inboxInvoicesNum = um.countItemsInSpace(um.getInbox()); //inboxInvoices = new NativeButton ("Invoices ("+inboxInvoicesNum+")"); inboxInvoices.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { inboxInvoices.setCaption("Invoices (" + um.countItemsInSpace(um.getInbox()) + ")"); userFolder.setFolder(um.getInbox().getFolder()); userFolder.setName(um.getInbox().getName()); showInitialMainContent(userFolder); draftInvoices.removeStyleName("v-bold-nativebuttoncaption"); } }); leftNavBar.addComponent(inboxInvoices); leftNavBar.addComponent(new Label("DRAFTS")); leftNavBar.addComponent(new NativeButton("Catalogue")); leftNavBar.addComponent(new NativeButton("Orders")); //int draftInvoicesNum = um.countItemsInSpace(um.getDrafts()); //draftInvoices = new NativeButton ("Invoices ("+draftInvoicesNum+")"); draftInvoices.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { draftInvoices.setCaption("Invoices (" + um.countItemsInSpace(um.getDrafts()) + ")"); userFolder.setFolder(um.getDrafts().getFolder()); userFolder.setName(um.getDrafts().getName()); showInitialMainContent(userFolder); draftInvoices.removeStyleName("v-bold-nativebuttoncaption"); } }); leftNavBar.addComponent(draftInvoices); leftNavBar.addComponent(new Label("OUTBOX")); leftNavBar.addComponent(new NativeButton("Catalogue")); leftNavBar.addComponent(new NativeButton("Orders")); //leftNavBar.addComponent (new NativeButton ("Invoices")); //int outboxInvoicesNum = um.countItemsInSpace(um.getOutbox()); //outboxInvoices = new NativeButton ("Invoices ("+outboxInvoicesNum+")"); outboxInvoices.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { outboxInvoices.setCaption("Invoices (" + um.countItemsInSpace(um.getOutbox()) + ")"); userFolder.setFolder(um.getOutbox().getFolder()); userFolder.setName(um.getOutbox().getName()); showInitialMainContent(userFolder); draftInvoices.removeStyleName("v-bold-nativebuttoncaption"); } }); leftNavBar.addComponent(outboxInvoices); leftNavBar.addComponent(new Label("SETTINGS")); leftNavBar.addComponent(new NativeButton("My Profile")); leftNavBar.addComponent(new NativeButton("Customers")); leftNavBar.addComponent(new NativeButton("Suppliers")); final Embedded peppolLogoImg = new Embedded(null, new ExternalResource("img/peppol_logo.png")); peppolLogoImg.setStyleName("logo"); leftNavBar.addComponent(peppolLogoImg); middleContentLayout.addComponent(leftNavBar); /*Button refreshButton = new Button("Refresh"); refreshButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { int draftInvoices = um.countItemsInSpace(um.getDrafts()); invoices.setCaption("Invoices ("+draftInvoices+")"); } }); leftNavBar.addComponent(refreshButton);*/ //workaround so that thread refreshes UI. It seems that when a ProgressIndicator is present, //all components receive server side refreshes ProgressIndicator p = new ProgressIndicator(); p.setPollingInterval((int) polling); p.setWidth("0px"); p.setHeight("0px"); leftNavBar.addComponent(p); showInitialMainContent(null); draftInvoices.click(); tFolderCount.start(); draftInvoices.addStyleName("v-bold-nativebuttoncaption"); }
From source file:com.foc.vaadin.FocWebVaadinWindow.java
License:Apache License
protected void menuBarIcons_Add(String menuItem, NativeButton button) { if (menuBarIconsMap == null) { menuBarIconsMap = new HashMap<String, NativeButton>(); }/* w w w. j a v a 2 s . c o m*/ menuBarIconsMap.put(menuItem, button); button.addStyleName("foc-f22"); button.addStyleName("foc-text-center"); button.setWidth("40px"); }
From source file:com.foc.vaadin.FocWebVaadinWindow.java
License:Apache License
public void menuBarIcons_Highlight(NativeButton button) { if (menuBarIconsMap != null) { Iterator<NativeButton> iter = menuBarIconsMap.values().iterator(); while (iter != null && iter.hasNext()) { NativeButton b = iter.next(); if (b != null) { if (b == button) { b.addStyleName("foc-textOrange"); } else { b.removeStyleName("foc-textOrange"); }//from ww w .j a va 2 s . c o m } } } }
From source file:com.foc.vaadin.gui.layouts.validationLayout.FVOptionMobileLayout.java
License:Apache License
private void addMoreItemsAsButtons(FVMenuBar menuBar) { List<MenuItem> munItemList = menuBar.getItems(); if (munItemList.size() > 0) { MenuItem moreItem = munItemList.get(0); if (moreItem != null) { List<MenuItem> children = moreItem.getChildren(); for (int i = 0; i < children.size(); i++) { MenuItem menuItem = children.get(i); if (menuItem != null) { String title = menuItem.getText(); FVMenuBarCommand menuBarCommand = (FVMenuBarCommand) menuItem.getCommand(); if (menuBarCommand != null) { NativeButton button = new NativeButton(title); button.setWidth("100%"); button.setHeight("40px"); button.addStyleName("focBannerButton"); addComponent(button); button.addClickListener(new MenuItemButtonClickListener(menuItem, menuBarCommand)); }//from w w w . j a va 2 s. c o m } } } } }
From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.tagging.components.SearchEngineMetaDescription.java
License:Open Source License
private Component createSEOProgressBar() { ProgressBar seoProgressBar = new ProgressBar(); seoProgressBar.setWidth("250px"); seoProgressBar.setValue(0.5f);/* w w w. j ava2 s.com*/ HorizontalLayout layout = new HorizontalLayout(); layout.addComponent(new Label("SEO Rating:")); layout.addComponent(seoProgressBar); layout.setSpacing(true); layout.setMargin(new MarginInfo(false, false, true, false)); NativeButton addUpdateButton = new NativeButton("", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { // do nothing } }); addUpdateButton.addStyleName("update-button"); addUpdateButton.setHeight("28px"); addUpdateButton.setCaption("Update"); addUpdateButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { updateMetaDescriptionPreview(textArea.getValue()); } }); layout.addComponent(addUpdateButton); return layout; }
From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.tagging.TaggingViewImpl.java
License:Open Source License
private void buildCustomTagsLayout() { final VerticalLayout customTags = new VerticalLayout(); customTags.setCaption("Custom Tags"); final HorizontalLayout newTagLayout = new HorizontalLayout(); newTagLayout.setSizeUndefined();//from w w w .j ava2 s. c o m final TextField newTagTextField = new TextField(); newTagTextField.addStyleName("new-tag-textfield"); newTagTextField.setHeight("52px"); newTagTextField.setWidth("320px"); newTagTextField.setNullRepresentation(""); newTagTextField.setInputPrompt("Add new tag"); NativeButton addTagButton = new NativeButton("", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { addCustomTag(newTagTextField); } }); addTagButton.addStyleName("add-tag-button"); newTagLayout.addComponent(newTagTextField); newTagLayout.addComponent(addTagButton); newTagLayout.setExpandRatio(newTagTextField, 1f); /* NativeButton addGenerateTagsButton = new NativeButton("", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { // Generate Tags } }); addGenerateTagsButton.addStyleName("generate-tags-button"); addGenerateTagsButton.setCaption("Generate Tags"); newTagLayout.addComponent(addGenerateTagsButton); */ customTags.addComponent(newTagLayout); customTags.addComponent(customTagLayout); this.tagLayout.addComponent(customTags); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPageTabVideos.java
License:Open Source License
private void addOneVideo(Media m) { VMPanelWrapper vl = new VMPanelWrapper(); vl.setMargin(false);/*from w w w . j ava 2s . c o m*/ vl.setSpacing(false); vl.ip = new MediaPanel(m, apId, 0, replaceLis); vl.addComponent(vl.ip); HorizontalLayout hl = new HorizontalLayout(); hl.setWidth(MediaPanel.WIDTH); Label lab; hl.addComponent(lab = new Label()); lab.setWidth("3px"); if (m.getType() != MediaType.YOUTUBE) { hl.addComponent(lab = new Label(getDisplayedName(m))); // label lab.addStyleName("m-font-size-11"); hl.setExpandRatio(lab, 1.0f); } else { NativeButton linkButt; hl.addComponent(linkButt = new NativeButton(null)); // link linkButt.setCaption(getDisplayedName(m)); linkButt.setStyleName(BaseTheme.BUTTON_LINK); linkButt.addStyleName("borderless"); linkButt.addStyleName("m-actionplan-nothumbs-button"); linkButt.addClickListener(new LinkVisitor(m)); hl.addComponent(lab = new Label()); lab.setWidth("1px"); hl.setExpandRatio(lab, 1.0f); } hl.addComponent(vl.killButt = new NativeButton(null)); vl.killButt.setCaption("delete"); vl.killButt.setStyleName(BaseTheme.BUTTON_LINK); vl.killButt.addStyleName("borderless"); vl.killButt.addStyleName("m-actionplan-nothumbs-button"); vl.killButt.addClickListener(new VideoRemover(m)); hl.addComponent(lab = new Label()); lab.setWidth("3px"); vl.addComponent(hl); ((AbstractLayout) rightScroller.getContent()).addComponent(vl); vl.ip.initGui(); }
From source file:edu.nps.moves.mmowgli.modules.cards.CallToActionPage.java
License:Open Source License
public void initGui() { Object sessKey = HSess.checkInit(); Label spacer = new Label(); spacer.setWidth(CALLTOACTION_HOR_OFFSET_STR); addComponent(spacer);/* w ww .j a v a2 s . c om*/ VerticalLayout mainVl = new VerticalLayout(); addComponent(mainVl); mainVl.setSpacing(true); mainVl.setWidth("100%"); MovePhase phase = MovePhase.getCurrentMovePhaseTL(); String sum = phase.getCallToActionBriefingSummary(); String tx = phase.getCallToActionBriefingText(); Media v = phase.getCallToActionBriefingVideo(); Embedded headerImg = new Embedded(null, Mmowgli2UI.getGlobals().mediaLocator().getCallToActionBang()); headerImg.setDescription("Review motivation and purpose of this game"); NativeButton needButt = new NativeButton(); needButt.setStyleName("m-weNeedYourHelpButton"); vidPan = new VideoWithRightTextPanel(v, headerImg, sum, tx, needButt); // needImg); vidPan.initGui(); mainVl.addComponent(vidPan); String playCardString = Game.getTL().getCurrentMove().getCurrentMovePhase().getPlayACardTitle(); NativeButton butt; if (!mockupOnly) butt = new IDNativeButton(playCardString, MmowgliEvent.PLAYIDEACLICK); else butt = new NativeButton(playCardString); // no listener butt.addStyleName("borderless"); butt.addStyleName("m-calltoaction-playprompt"); butt.setDescription("View existing cards and play new ones"); mainVl.addComponent(butt); mainVl.setComponentAlignment(butt, Alignment.MIDDLE_CENTER); HSess.checkClose(sessKey); }
From source file:edu.nps.moves.mmowgli.modules.cards.CardChainPage.java
License:Open Source License
@HibernateRead private GhostVerticalLayoutWrapper makeCardMarkingPanelTL() { GhostVerticalLayoutWrapper wrapper = new GhostVerticalLayoutWrapper(); VerticalLayout vl = new VerticalLayout(); vl.setSpacing(true);/* w ww . ja v a2s.co m*/ wrapper.ghost_setContent(vl); Label lab = new HtmlLabel("<b><i>Game Master Actions</i></b>"); vl.addComponent(lab); vl.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); NativeButton editCardButt = new NativeButton("Edit Card"); editCardButt.addStyleName(BaseTheme.BUTTON_LINK); editCardButt.addClickListener(new EditCardTextListener()); vl.addComponent(editCardButt); markingRadioGroup = new OptionGroup(null); markingRadioGroup.setMultiSelect(false); markingRadioGroup.setImmediate(true); markingRadioGroup.setDescription("Only game masters may change."); vl.addComponent(markingRadioGroup); NativeButton clearButt = new NativeButton("clear card marking"); clearButt.addStyleName(BaseTheme.BUTTON_LINK); vl.addComponent(clearButt); clearButt.addClickListener(new MarkingClearListener()); Collection<?> markings = CardMarking.getContainer().getItemIds(); CardMarking hiddencm = null; for (Object o : markings) { CardMarking cm = CardMarking.getTL(o); if (cm == CardMarkingManager.getHiddenMarking()) hiddencm = cm; else if (cm == CardMarkingManager.getNoChildrenMarking()) ; // todo enable with game switch else markingRadioGroup.addItem(cm); } if (hiddencm != null) markingRadioGroup.addItem(hiddencm); Card card = Card.getTL(cardId); // feb refactor DBGet.getCardTL(cardId); vl.addComponent(lab = new Label()); lab.setHeight("5px"); NativeButton newActionPlanButt = new IDNativeButton("create action plan from this card", CARDCREATEACTIONPLANCLICK, cardId); newActionPlanButt.addStyleName(BaseTheme.BUTTON_LINK); vl.addComponent(newActionPlanButt); if (Mmowgli2UI.getGlobals().getUserTL().isTweeter()) { String tweet = TWEETBUTTONEMBEDDED_0 + buildTweet(card) + TWEETBUTTONEMBEDDED_1; Label tweeter = new HtmlLabel(tweet); tweeter.setHeight(TWEETBUTTON_HEIGHT); tweeter.setWidth(TWEETBUTTON_WIDTH); vl.addComponent(tweeter); } return wrapper; }
From source file:edu.nps.moves.mmowgli.modules.cards.CardChainTreeTablePopup.java
License:Open Source License
@HibernateSessionThreadLocalConstructor public CardChainTreeTablePopup(Object rootId, boolean modal, boolean wantSaveButton) { super(null);/* www . j a v a 2s.c o m*/ setWidth("600px"); setHeight("400px"); addStyleName("m-noborder"); // V7 difference super.initGui(); selectedId = tempSelectedId = rootId; setModal(modal); setListener(this); setResizable(true); setTitleString("Card chain"); saveClicked = false; contentVLayout.setSpacing(true); treeT = new CardChainTree(rootId, false, !modal); if (rootId == null) { setTitleString("Card chains"); // instead, do some creative backgrounding to pseudo select children of a card, treeT.setMultiSelect(true); } //treeT.setSizeFull(); treeT.setWidth("99%"); treeT.setHeight("99%"); treeT.addItemClickListener((ItemClickListener) this); treeT.addStyleName("m-greyborder"); contentVLayout.addComponent(treeT); contentVLayout.setComponentAlignment(treeT, Alignment.MIDDLE_CENTER); contentVLayout.setExpandRatio(treeT, 1.0f); /* todo...the saved data was never being retrieved, should pass it back to create action plan panel */ if (wantSaveButton) { // need a save button HorizontalLayout hl = new HorizontalLayout(); hl.setWidth("100%"); contentVLayout.addComponent(hl); Label lab; hl.addComponent(lab = new Label()); hl.setExpandRatio(lab, 1.0f); NativeButton saveButt = new NativeButton(); hl.addComponent(saveButt); saveButt.setIcon(Mmowgli2UI.getGlobals().getMediaLocator().getSaveButtonIcon()); saveButt.setWidth("45px"); //38px"); saveButt.setHeight("16px"); saveButt.addStyleName("borderless"); saveButt.addClickListener(saveListener = new SaveListener()); saveButt.setClickShortcut(KeyCode.ENTER); hl.addComponent(lab = new Label()); lab.setWidth("30px"); contentVLayout.addComponent(hl); } }