List of usage examples for com.vaadin.ui NativeButton setStyleName
@Override public void setStyleName(String style)
From source file:com.foc.vaadin.FocWebVaadinWindow.java
License:Apache License
/** * adjustButtonStyleInHeaderBar allows to customize the look of a button displayed in header menu bar * /*www.j a v a 2 s . c o m*/ * @param nBut * @param asFirst * @param addButton */ protected void adjustButtonStyleInHeaderBar(NativeButton nBut, boolean asFirst, boolean addButton) { nBut.setHeight("40px"); nBut.setStyleName("focBannerButton"); if (addButton) { if (centerHeaderLayout != null) { if (asFirst) { centerHeaderLayout.addComponentAsFirst(nBut); } else { centerHeaderLayout.addComponent(nBut); } centerHeaderLayout.setComponentAlignment(nBut, Alignment.TOP_LEFT); } } }
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 {//from w ww .j a va2 s. c o m 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:edu.nps.moves.mmowgli.components.MmowgliDialog.java
License:Open Source License
protected Button makeCancelButton() { NativeButton butt = new NativeButton(null); butt.setStyleName("m-cancelButton"); return butt;// ww w. j a v a 2 s .c o m }
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 av a 2 s . 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 w w. j a va 2 s. co m 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.registrationlogin.RegistrationPageAgreement.java
License:Open Source License
public RegistrationPageAgreement(Button.ClickListener listener) { super(listener); super.initGui(); setTitleString(getTitle()); //"User Agreement 1"); contentVLayout.setSpacing(true);/*from w w w. j ava2s. c om*/ Label lab = new HtmlLabel(getLabelText()); //"First, please confirm your willingness to meet game requirements. I also confirm that I am at least 18 years of age."); lab.addStyleName(topLabelStyle); contentVLayout.addComponent(lab); HorizontalLayout hlayout = new HorizontalLayout(); contentVLayout.addComponent(hlayout); hlayout.setSpacing(true); hlayout.setWidth("100%"); hlayout.addStyleName(labelStyle); String readUrl = getReadUrlTL(); if (readUrl != null) { Link readLink = new Link("Read", new ExternalResource(getReadUrlTL())); //REGISTRATIONCONSENTURL)); readLink.setTargetName("_agreements"); readLink.setTargetBorder(BorderStyle.DEFAULT); readLink.setDescription("Opens in new window/tab"); hlayout.addComponent(readLink); readLink.setSizeUndefined(); hlayout.setComponentAlignment(readLink, Alignment.MIDDLE_LEFT); } lab = new HtmlLabel(getReadLabel()); //"<i>Consent to Participate in Anonymous Survey</i>"); lab.setSizeUndefined(); hlayout.addComponent(lab); hlayout.setSizeUndefined(); hlayout.setComponentAlignment(lab, Alignment.TOP_LEFT); contentVLayout.addComponent(lab = new Label()); lab.setHeight("15px"); HorizontalLayout hl = new HorizontalLayout(); hl.setWidth("98%"); //"100%"); contentVLayout.addComponent(hl); hl.addComponent(lab = new Label()); lab.setWidth("20px"); NativeButton rejectButt = new NativeButton(); hl.addComponent(rejectButt); rejectButt.setStyleName("m-rejectNoThanksButton"); // Mmowgli2UI.getGlobals().mediaLocator().decorateDialogRejectButton(rejectButt); rejectButt.addClickListener(new RejectListener()); hl.addComponent(lab = new Label()); hl.setExpandRatio(lab, 1.0f); NativeButton continueButt = new NativeButton(); hl.addComponent(continueButt); //Mmowgli2UI.getGlobals().mediaLocator().decorateDialogAcceptAndContinueButton(continueButt); continueButt.setStyleName("m-acceptAndContinueButton"); continueButt.addClickListener(new MyContinueListener()); continueButt.setClickShortcut(KeyCode.ENTER); }
From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPageAgreementCombo.java
License:Open Source License
public RegistrationPageAgreementCombo(Button.ClickListener listener) { super(listener); super.initGui(); setTitleString("User Agreement"); contentVLayout.setSpacing(true);/*from www . j a v a 2s .co m*/ Label lab = new Label("I confirm my willingness to meet game requirements:"); lab.addStyleName(topLabelStyle); contentVLayout.addComponent(lab); // First contentVLayout.addComponent(lab = new Label()); lab.setHeight("5px"); // space contentVLayout.addComponent(lab = new HtmlLabel( "First, I confirm that I am at least 18 years of age, I have been informed of risks<br/>and benefits, and I consent to participate.")); lab.addStyleName(labelStyle); HorizontalLayout hlayout = new HorizontalLayout(); contentVLayout.addComponent(hlayout); hlayout.setSpacing(true); hlayout.setWidth("100%"); hlayout.addStyleName(labelStyle); // First read hlayout.addComponent(lab = new HtmlLabel(" ")); lab.setHeight("10px"); GameLinks gl = GameLinks.getTL(); Link readLink = new Link("Read", new ExternalResource(gl.getInformedConsentLink())); //REGISTRATIONCONSENTURL)); readLink.setTargetName("_agreements"); readLink.setTargetBorder(BorderStyle.DEFAULT); readLink.setDescription("Opens in new window/tab"); hlayout.addComponent(readLink); readLink.setSizeUndefined(); lab = new HtmlLabel("<i>Informed Consent to Participate in Research</i>"); lab.setSizeUndefined(); hlayout.addComponent(lab); hlayout.setSizeUndefined(); // Second contentVLayout.addComponent(lab = new Label()); lab.setHeight("5px"); // space lab = new HtmlLabel( "Second, I understand that <b style='color:red;'>no classified or sensitive information can be<br/>posted</b> to the game since participation is open. Violation of this policy may<br/>lead to serious consequences."); lab.addStyleName(labelStyle); contentVLayout.addComponent(lab); hlayout = new HorizontalLayout(); contentVLayout.addComponent(hlayout); hlayout.setSpacing(true); hlayout.setWidth("100%"); hlayout.addStyleName(labelStyle); // Second read hlayout.addComponent(lab = new HtmlLabel(" ")); readLink = new Link("Read", new ExternalResource(gl.getUserAgreementLink())); readLink.setTargetName("_agreements"); readLink.setTargetBorder(BorderStyle.DEFAULT); readLink.setDescription("Opens in new window/tab"); hlayout.addComponent(readLink); readLink.setSizeUndefined(); lab = new HtmlLabel("<i>Department of Defense Social Media User Agreement</i>"); lab.setSizeUndefined(); hlayout.addComponent(lab); hlayout.setSizeUndefined(); // Third contentVLayout.addComponent(lab = new Label()); lab.setHeight("5px"); // space lab = new HtmlLabel( "Third, the official language of the MMOWGLI game is English. Other languages<br/>are not supported in order to ensure that player postings are appropriate."); lab.addStyleName(labelStyle); contentVLayout.addComponent(lab); contentVLayout.addComponent(lab = new Label()); lab.setHeight("15px"); HorizontalLayout hl = new HorizontalLayout(); hl.setWidth("100%"); contentVLayout.addComponent(hl); hl.addComponent(lab = new Label()); lab.setWidth("20px"); NativeButton rejectButt = new NativeButton(); hl.addComponent(rejectButt); rejectButt.setStyleName("m-rejectNoThanksButton"); //new way rejectButt.addClickListener(new RejectListener()); hl.addComponent(lab = new Label()); hl.setExpandRatio(lab, 1.0f); NativeButton continueButt = new NativeButton(); hl.addComponent(continueButt); continueButt.setStyleName("m-acceptAndContinueButton"); // new way continueButt.addClickListener(new MyContinueListener()); continueButt.setClickShortcut(KeyCode.ENTER); }
From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPagePopupSecond.java
License:Open Source License
public RegistrationPagePopupSecond(Button.ClickListener listener, Long uId) { super(listener); super.initGui(); localUserId = uId;/*from w ww. j ava 2 s .c o m*/ setTitleString("Tell us about you"); contentVLayout.setSpacing(true); Label sp; contentVLayout.addComponent(sp = new Label()); sp.setHeight("20px"); Label header = new HtmlLabel( "<center>Affiliation category and location are optional and are displayed to other game players.</center>"); // and help you</center>"); header.addStyleName("m-dialog-label-noindent"); contentVLayout.addComponent(header); contentVLayout.setComponentAlignment(header, Alignment.TOP_CENTER); HorizontalLayout horL = new HorizontalLayout(); horL.setSpacing(false); horL.setWidth("100%"); contentVLayout.addComponent(horL); horL.addComponent(sp = new Label()); sp.setWidth("20px"); // Use an actual form widget here for data binding and error display. formLay = new FormLayout(); formLay.addStyleName("m-login-form"); // to allow styling contents (v-textfield) formLay.setSizeUndefined(); horL.addComponent(formLay); horL.setExpandRatio(formLay, 1.0f); formLay.addComponent(affilCombo = new BoundAffiliationCombo("Affiliation:")); affilCombo.setValue(affilCombo.getItemIds().toArray()[0]); // Tried to get this to be editable....needs more work formLay.addComponent(locTf = new TextField("Location:")); locTf.setColumns(31); locTf.setInputPrompt("optional"); locTf.addStyleName("m-noleftmargin"); Label lab; contentVLayout.addComponent(lab = new HtmlLabel(warning)); lab.addStyleName(labelStyle); HorizontalLayout hl = new HorizontalLayout(); hl.setWidth("100%"); contentVLayout.addComponent(hl); hl.addComponent(lab = new Label()); hl.setExpandRatio(lab, 1.0f); NativeButton continueButt = new NativeButton(null); continueButt.setStyleName("m-continueButton"); hl.addComponent(continueButt); continueButt.addClickListener(new JoinListener()); continueButt.setClickShortcut(KeyCode.ENTER); hl.addComponent(lab = new Label()); lab.setWidth("20px"); // don't run off the end }
From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPageSecondPermissionPopup.java
License:Open Source License
@HibernateSessionThreadLocalConstructor public RegistrationPageSecondPermissionPopup(Button.ClickListener listener) { super(listener); super.initGui(); Game g = Game.getTL();/*from w ww . j a v a2 s.co m*/ setTitleString(g.getSecondLoginPermissionPageTitle()); contentVLayout.setSpacing(true); Label lab; contentVLayout.addComponent(lab = new Label()); lab.setHeight("15px"); lab = new HtmlLabel(g.getSecondLoginPermissionPageText()); lab.setWidth("82%"); lab.addStyleName(labelStyle); contentVLayout.addComponent(lab); HorizontalLayout hl = new HorizontalLayout(); hl.setWidth("98%"); contentVLayout.addComponent(hl); hl.addComponent(lab = new Label()); lab.setWidth("20px"); NativeButton rejectButt = new NativeButton(); hl.addComponent(rejectButt); rejectButt.setStyleName("m-rejectNoThanksButton"); rejectButt.addClickListener(new RejectListener()); hl.addComponent(lab = new Label()); hl.setExpandRatio(lab, 1.0f); NativeButton continueButt = new NativeButton(); hl.addComponent(continueButt); continueButt.setStyleName("m-acceptAndContinueButton"); continueButt.addClickListener(new MyContinueListener()); continueButt.setClickShortcut(KeyCode.ENTER); }
From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfileMyIdeasPanel2.java
License:Open Source License
Button makeButt(String s) { NativeButton b = new NativeButton(s); b.setStyleName(BaseTheme.BUTTON_LINK); b.addStyleName("m-link-button"); b.addStyleName("borderless"); b.addClickListener(this); return b;//from w w w . j a v a 2 s.co m }