Example usage for com.vaadin.ui NativeButton NativeButton

List of usage examples for com.vaadin.ui NativeButton NativeButton

Introduction

In this page you can find the example usage for com.vaadin.ui NativeButton NativeButton.

Prototype

public NativeButton() 

Source Link

Usage

From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPageTabTalk.java

License:Open Source License

private Component createChatEntryField() {
    HorizontalLayout hl = new HorizontalLayout();
    chatTextField = new TextArea();
    chatTextField.setRows(3);/*from  w w w. j  a va 2  s  .  com*/
    chatTextField.setWordwrap(true);
    chatTextField.setInputPrompt("Type here to chat, RETURN submits");
    chatTextField.setId(ACTIONPLAN_TALK_IT_OVER_TEXT_BOX);
    hl.addComponent(chatTextField);
    chatTextField.setWidth("99%");
    hl.setExpandRatio(chatTextField, 1.0f);
    chatTextField.setReadOnly(isReadOnly);

    chatSubmitButt = new NativeButton();
    chatSubmitButt.setStyleName("m-submitButton");
    hl.addComponent(chatSubmitButt);
    chatSubmitButt.addClickListener(new ChatButtonListener());
    chatSubmitButt.setEnabled(!isReadOnly);
    chatSubmitButt.setId(ACTIONPLAN_TALK_IT_OVER_SUBMIT_BUTTON);
    return hl;
}

From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPageTabVideos.java

License:Open Source License

@HibernateSessionThreadLocalConstructor
public ActionPlanPageTabVideos(Object apId, boolean isMockup, boolean isReadOnly) {
    super(apId, isMockup, isReadOnly);
    addVideoButt = new NativeButton();
    replaceLis = new VideoReplacer();
}

From source file:edu.nps.moves.mmowgli.modules.actionplans.MediaPanel.java

License:Open Source License

MediaPanel(Media m, Object apId, int idx, ClickListener replaceListener) {
    this.idx = idx;
    this.m = m;/*from  w  ww. j a  va2 s  . co  m*/

    zoom = new NativeButton();
    caption = new TextArea();
    caption.setInputPrompt("Description");
    title = new TextField();
    title.setInputPrompt("Title");
    titleHL = new HorizontalLayout();
    indexLab = new HtmlLabel("");

    FocusHandler fHandler = new FocusHandler();
    caption.addFocusListener((FocusListener) fHandler);
    title.addFocusListener((FocusListener) fHandler);

    captionSavePan = new HorizontalLayout();
    captionSavePan.setSpacing(true);
    captionSavePan.setMargin(false);
    Label lab;
    captionSavePan.addComponent(lab = new Label());
    lab.setWidth("1px");
    captionSavePan.setExpandRatio(lab, 1.0f);
    canButt = new Button("Cancel");
    captionSavePan.addComponent(canButt);
    canButt.setStyleName(Reindeer.BUTTON_SMALL);
    canButt.addClickListener((ClickListener) fHandler);
    saveButt = new Button("Save");
    captionSavePan.addComponent(saveButt);
    saveButt.setStyleName(Reindeer.BUTTON_SMALL);
    saveButt.addStyleName("m-redbutton");
    saveButt.addClickListener((ClickListener) fHandler);
    captionSavePan.addComponent(lab = new Label());
    lab.setWidth("5px");
}

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 ava 2s .c  o  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.cards.CardChainPage.java

License:Open Source License

@HibernateSessionThreadLocalConstructor
public CardChainPage(Object cardId) {
    this.cardId = cardId;
    chainButt = new NativeButton();
    gotoIdeaDashButt = new IDNativeButton(null, IDEADASHBOARDCLICK);
    gotoTopLevelButt = new IDNativeButton(null, PLAYIDEACLICK);
    isGameMaster = Mmowgli2UI.getGlobals().getUserTL().isGameMaster();
}

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);/* ww w  . java2s.  co 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);
    }
}

From source file:edu.nps.moves.mmowgli.modules.registrationlogin.LoginPopup.java

License:Open Source License

public LoginPopup(Button.ClickListener listener, boolean guest) {
    super(listener);
    super.initGui();
    if (guest) {//w w  w  . ja va 2  s.c om
        @SuppressWarnings("unchecked")
        List<User> lis = (List<User>) HSess.get().createCriteria(User.class)
                .add(Restrictions.eq("viewOnly", true)).add(Restrictions.eq("accountDisabled", false)).list();
        if (lis.size() > 0) {
            for (User u : lis) {
                if (u.getUserName().toLowerCase().equals("guest")) {
                    userID = u.getId();
                    return;
                }
            }
        }
        // If here, the guest logon is enabled, but no userID named guest is marked "viewOnly", continue and let
        // caller realize what happened
    }
    setTitleString("Sign in please.");

    contentVLayout.setSpacing(true);
    Label lab = new Label();
    lab.setHeight("20px");
    contentVLayout.addComponent(lab);

    VerticalLayout lay = new VerticalLayout();
    contentVLayout.addComponent(lay);
    contentVLayout.setComponentAlignment(lay, Alignment.TOP_CENTER);

    lay.addComponent(lab = new Label("Player name:"));
    lab.addStyleName("m-dialog-label");

    lay.addComponent(userIDTf = new TextField());
    userIDTf.setColumns(35);
    userIDTf.setTabIndex(100);
    userIDTf.setId(USER_NAME_TEXTBOX);
    userIDTf.addStyleName("m-dialog-entryfield");

    lay.addComponent(lab = new Label());
    lab.setHeight("15px");

    lay.addComponent(lab = new Label("Password:"));
    lab.addStyleName("m-dialog-label");

    lay.addComponent(passwordTf = new PasswordField());
    passwordTf.setColumns(35);
    passwordTf.setTabIndex(101);
    passwordTf.setId(USER_PASSWORD_TEXTBOX);
    passwordTf.addStyleName("m-dialog-entryfield");

    HorizontalLayout hl = new HorizontalLayout();
    hl.setWidth("100%");
    contentVLayout.addComponent(hl);

    hl.addComponent(lab = new Label());
    hl.setExpandRatio(lab, 1.0f);

    continueButt = new NativeButton();
    continueButt.setId(LOGIN_CONTINUE_BUTTON);
    hl.addComponent(continueButt);
    Mmowgli2UI.getGlobals().mediaLocator().decorateDialogContinueButton(continueButt);

    continueButt.addClickListener(new MyContinueListener());
    continueButt.setClickShortcut(KeyCode.ENTER);

    // Password reset
    HorizontalLayout h2 = new HorizontalLayout();
    h2.setWidth("100%");
    contentVLayout.addComponent(h2);

    h2.addComponent(lab = new Label());
    h2.setExpandRatio(lab, 01.0f);
    pwResetButt = new NativeButton("Forgot password or player name?");
    pwResetButt.addStyleName("m-signin-forgotButton");
    h2.addComponent(pwResetButt);

    pwResetButt.addClickListener(new MyForgotLoginInfoListener());

    userIDTf.focus(); // won't do it
    FocusHack.focus(userIDTf); // will do it
}

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);/*  w  w  w  .jav a  2 s .c o m*/
    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 w w w  .jav  a  2s  . c o  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("&nbsp;&nbsp;"));
    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("&nbsp;&nbsp;"));

    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.RegistrationPageSecondPermissionPopup.java

License:Open Source License

@HibernateSessionThreadLocalConstructor
public RegistrationPageSecondPermissionPopup(Button.ClickListener listener) {
    super(listener);
    super.initGui();

    Game g = Game.getTL();//from   ww  w.j a v  a  2  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);
}