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(String caption, ClickListener listener) 

Source Link

Usage

From source file:com.github.wolfie.detachedtabs.DetachedTabs.java

License:Open Source License

/**
 * Add a tab/*from  w w  w .  j av a 2s .c o  m*/
 * 
 * @param content
 *          The {@link Component} that will be shown once its corresponding
 *          tab is selected.
 * @param caption
 *          The caption for the tab.
 */
public void addTab(final Component content, final String caption) {
    if (content == null || caption == null) {
        throw new NullPointerException("Arguments may not be null");
    }

    final Button button = new NativeButton(caption, tabChangeListener);

    if (orientation == Orientation.HORIZONTAL) {
        button.setHeight("100%");
        button.setWidth(getWidth(), getWidthUnits());
    } else {
        button.setHeight(getHeight(), getHeightUnits());
        button.setWidth("100%");
    }

    layout.addComponent(button);
    buttonComponentMap.put(button, content);
    tabs.add(button);

    adjustTabStyles();

    if (shownTab == null) {
        switchTo(content, button);
    }
}

From source file:com.jiangyifen.ec2.ui.LoginLayout.java

/**
 * ?//from  w  w w. j av a 2 s  .c o  m
 * 
 * @param panelContent ????
 * @param roleType      ?
 */
private void createLoginMainComponents(VerticalLayout panelContent, RoleType roleType) {
    GridLayout gridLayout = new GridLayout(2, 5);
    gridLayout.setSpacing(true);
    gridLayout.setMargin(true);
    panelContent.addComponent(gridLayout);
    panelContent.setComponentAlignment(gridLayout, Alignment.MIDDLE_CENTER);

    // ??
    Label username_lb = new Label("    ??", Label.CONTENT_XHTML);
    gridLayout.addComponent(username_lb, 0, 0);
    usernameTextField = new TextField();
    usernameTextField.setWidth("170px");
    usernameTextField.setValue(username);
    gridLayout.addComponent(usernameTextField, 1, 0);

    // ?
    Label password = new Label("       ?", Label.CONTENT_XHTML);
    gridLayout.addComponent(password, 0, 1);
    passwordTextField = new PasswordField();
    passwordTextField.setWidth("170px");
    gridLayout.addComponent(passwordTextField, 1, 1);

    //  ?Csr ?
    if (roleType.equals(RoleType.csr)) {
        Label extenNoLabel = new Label("       ",
                Label.CONTENT_XHTML);
        gridLayout.addComponent(extenNoLabel, 0, 2);
        extenNoField = new TextField();
        extenNoField.setWidth("170px");
        extenNoField.setValue(exten);
        gridLayout.addComponent(extenNoField, 1, 2);
    }

    // ?????
    String warningMsg = "<font color='red'>?????</font>";
    warningLabel = new Label(warningMsg, Label.CONTENT_XHTML);
    warningLabel.setVisible(false);

    gridLayout.addComponent(warningLabel, 1, 3);
    gridLayout.setComponentAlignment(warningLabel, Alignment.MIDDLE_CENTER);

    // ?
    login = new Button("  ", this);
    forget = new NativeButton("?", this);

    //???
    Map<String, String> licenseMap = LicenseManager.licenseValidate();
    String validateResult = licenseMap.get(LicenseManager.LICENSE_VALIDATE_RESULT);
    if (LicenseManager.LICENSE_VALID.equals(validateResult)) {
        SpringContextHolder.getHttpSession().removeAttribute("businessModels");
        String licensedDate = licenseMap.get(LicenseManager.LICENSE_DATE);
        try {
            Date stopDate = LicenseManager.simpleDateFormat.parse(licensedDate);
            Long times = stopDate.getTime() - new Date().getTime();
            int outdateWarnDay = (int) (times / (24 * 3600 * 1000));

            if (outdateWarnDay < 7) {
                isValid = true;
                warningLabel.setValue("<font color='red'>" + outdateWarnDay
                        + ",???</font>");
                if (outdateWarnDay < 0) {
                    warningLabel.setValue("<font color='red'>?,???</font>");
                    isValid = false;
                } else if (outdateWarnDay == 0) {
                    warningLabel.setValue(
                            "<font color='red'>?,???</font>");
                }
                warningLabel.setVisible(true);
            }
            //            //??
            //            if(roleType==RoleType.manager){
            //               login.setEnabled(true);
            //            }
            //            
        } catch (Exception e) {
            e.printStackTrace();
            login.setEnabled(false);
            forget.setEnabled(false);
        }

    } else {
        warningLabel.setVisible(true);
        warningLabel.setValue("<font color='red'>??,???</font>");
        login.setEnabled(false);
        forget.setEnabled(false);
        isValid = false;

        //chb ???
        if (roleType == RoleType.manager) {
            if (isValid == false) {
                login.setEnabled(true);
            } else {
                //normal login
            }
        }

    }

    HorizontalLayout operatorHLayout = new HorizontalLayout();
    operatorHLayout.setSpacing(true);
    operatorHLayout.addComponent(login);
    operatorHLayout.addComponent(forget);
    gridLayout.addComponent(operatorHLayout, 1, 4);
}

From source file:com.liferay.mail.vaadin.MessageToolbar.java

License:Open Source License

public MessageToolbar(MainMailView mainMailView) {

    this.mainMailView = mainMailView;

    openDraft = new NativeButton(Lang.get("edit-draft"), new ClickListener() {

        public void buttonClick(ClickEvent event) {

            openDraft();// ww w . j  a v a  2  s .c  om
        }
    });
    openDraft.setIcon(ICON_EDIT_DRAFT);
    openDraft.setStyleName(TOOLBAR_BUTTON_STYLE);
    reply = new NativeButton(Lang.get("reply"), new ClickListener() {

        public void buttonClick(ClickEvent event) {

            reply(false);
        }
    });
    reply.setIcon(ICON_REPLY);
    reply.setStyleName(TOOLBAR_BUTTON_STYLE);
    replyAll = new NativeButton(Lang.get("reply-all"), new ClickListener() {

        public void buttonClick(ClickEvent event) {

            reply(true);
        }
    });
    replyAll.setIcon(ICON_REPLY_ALL);
    replyAll.setStyleName(TOOLBAR_BUTTON_STYLE);
    forward = new NativeButton(Lang.get("forward"), new ClickListener() {

        public void buttonClick(ClickEvent event) {

            forward();
        }
    });
    forward.setIcon(ICON_FORWARD);
    forward.setStyleName(TOOLBAR_BUTTON_STYLE);
    delete = new NativeButton(Lang.get("delete"), new ClickListener() {

        public void buttonClick(ClickEvent event) {

            delete();
        }
    });
    delete.setIcon(ICON_DELETE);
    delete.setStyleName(TOOLBAR_BUTTON_STYLE);
    moveTo = new NativeButton(Lang.get("move-to"), new ClickListener() {

        public void buttonClick(ClickEvent event) {

            selectMoveTarget();
        }
    });
    moveTo.setIcon(ICON_MOVE_TO);
    moveTo.setStyleName(TOOLBAR_BUTTON_STYLE);

    refresh = new NativeButton(Lang.get("refresh"), new ClickListener() {

        public void buttonClick(ClickEvent event) {

            refresh();
        }
    });
    refresh.setIcon(ICON_REFRESH);
    refresh.setStyleName(TOOLBAR_BUTTON_STYLE);

    updateToolbar(null, null);

    setStyleName("toolbar");
}

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);//ww  w. j a  v  a  2 s.co  m

    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  a v a  2  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:dhbw.ka.mwi.businesshorizon2.ui.process.period.timeline.TimelineViewImpl.java

License:Open Source License

/**
 * Erstelle das GUI/*from  w  ww  .j  av  a 2  s  .c  o m*/
 *
 * @author Daniel Dengler
 */
private void generateUi() {
    p.setScrollable(true);
    p.setStyleName("borderless light");
    delPast = new NativeButton("X", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            layout.getComponent(0, 0);
            presenter.removeLastPastPeriod(((PeriodButton) layout.getComponent(0, 0)).getPeriod());
        }
    });
    delFuture = new NativeButton("X", new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            presenter.removeLastFuturePeriod(
                    ((PeriodButton) layout.getComponent(0, layout.getRows() - 1)).getPeriod());
        }
    });

    past = new Button("+", new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            presenter.addPastPeriod();
        }
    });
    this.p.addComponent(past);
    this.p.addComponent(layout);
    future = new Button("+", new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            presenter.addFuturePeriod();
        }
    });

    this.p.addComponent(future);
    this.addComponent(p);
}

From source file:edu.nps.moves.mmowgli.modules.administration.GameDesignPanel.java

License:Open Source License

public void initGuiTL() {
    tabSh.setHeight("100%");
    tabSh.setWidth("930px");

    HorizontalLayout topHL = new HorizontalLayout();
    topHL.setSpacing(true);//  ww w . j ava2 s  .c  o  m
    topHL.setMargin(true);
    Label lab;
    topHL.addComponent(lab = new Label());
    lab.setWidth("1px");
    topHL.setExpandRatio(lab, 0.5f);
    topHL.addComponent(lab = new Label("Round being edited:"));
    lab.setSizeUndefined();
    topHL.addComponent(moveSelector = new MoveSelector(null));
    moveSelector.addValueChangeListener(new MoveSelectorListener());
    topHL.addComponent(
            runningMoveWarningLabel = new HtmlLabel("<font color='red'><i>Active game round!</i></font>"));
    runningMoveWarningLabel.setSizeUndefined();
    runningMoveWarningLabel.setVisible(AbstractGameBuilderPanel.isRunningMoveTL(moveBeingEdited));

    topHL.addComponent(newMoveButt = new NativeButton("Add new round to game", new NewMoveListener()));
    topHL.addComponent(lab = new Label());
    lab.setWidth("1px");
    topHL.setExpandRatio(lab, 0.5f);
    topHL.setWidth("100%");
    addComponent(topHL);

    addComponent(lab = new Label("The currently active round is set through the Game Administrator menu"));
    lab.setSizeUndefined();
    setComponentAlignment(lab, Alignment.TOP_CENTER);

    tabSh.addTab(titlesPan, "Game Titles");
    tabSh.addTab(topCardsPan, "Top Card Types");
    tabSh.addTab(subCardsPan, "Sub Card Types");
    //tabSh.addTab(seedCardsPan, "Seed Card Initialization");
    tabSh.addTab(chaptersPan, "Action Plan Headings");
    addComponent(tabSh);

    titlesPan.initGui();
    topCardsPan.initGui();
    subCardsPan.initGui();
    //seedCardsPan.initGui();
    chaptersPan.initGui();
    moveSelector.setMove(Game.getTL().getCurrentMove());
}

From source file:edu.nps.moves.mmowgli.modules.gamemaster.EventMonitorPanel.java

License:Open Source License

@Override
public void initGui() {
    setWidth("950px");
    addStyleName("m-greyborder");
    addStyleName("m-background-lightgrey");
    addStyleName("m-marginleft-25");
    setMargin(true);/*  w  w w .  j  ava 2 s .  c o  m*/
    setSpacing(false);

    buildTopInfo(this);

    pan = new Panel();
    addComponent(pan);
    pan.setWidth("99%");
    pan.setHeight(PANEL_HEIGHT);
    vLay = new VerticalLayout();
    vLay.setMargin(true);
    pan.setContent(vLay);

    setComponentAlignment(pan, Alignment.TOP_CENTER);
    pan.addStyleName("m-greyborder");

    NativeButton moreButt = new NativeButton("Get another page of prior events", this);
    addComponent(moreButt);
    setComponentAlignment(moreButt, Alignment.TOP_RIGHT);

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

    addComponent(new Label("Broadcast message to game masters"));

    messageTA = new TextArea();
    messageTA.setRows(2);
    messageTA.setWidth("100%");

    addComponent(messageTA);

    NativeButton sendButt = new NativeButton("Send", new SendListener());
    addComponent(sendButt);

    loadEvents();
}

From source file:edu.nps.moves.mmowgli.modules.maps.LeafletMap.java

License:Open Source License

public void initGuiTL() {
    setSpacing(true);/*w ww.j av  a 2s .  co m*/
    setSizeUndefined();
    setWidth("950px");
    addStyleName("m-marginleft-20");
    Label lab;

    HorizontalLayout hLay = new HorizontalLayout();
    hLay.setMargin(false);
    hLay.setSpacing(false);
    hLay.setWidth("100%");
    NativeButton butt;
    hLay.addComponent(butt = new NativeButton("go to default game location", new MyDefaultLocationListener()));
    hLay.setExpandRatio(butt, 0.5f);
    hLay.setComponentAlignment(butt, Alignment.BOTTOM_LEFT);

    hLay.addComponent(lab = new HtmlLabel(title));
    lab.setWidth(null);

    makeLayerPopups();
    HorizontalLayout popLay = new HorizontalLayout();
    popLay.setMargin(false);
    popLay.setSpacing(false);
    popLay.setWidth("100%");

    popLay.addComponent(lab = new Label());
    lab.setWidth("1px");
    popLay.setExpandRatio(lab, 1.0f);
    popLay.addComponent(baseLayerPopup);
    popLay.addComponent(overlayPopup);

    hLay.addComponent(popLay);
    hLay.setComponentAlignment(popLay, Alignment.BOTTOM_RIGHT);
    hLay.setExpandRatio(popLay, 0.5f);

    addComponent(hLay);

    User me = Mmowgli2UI.getGlobals().getUserTL();
    this.imAGuest = me.isViewOnly() || me.isAccountDisabled();

    map.setAttributionPrefix("Powered by Leaflet with v-leaflet");
    map.addStyleName("m-greyborder");
    map.removeAllComponents();
    // map.addControl(new LScale());
    layerMap = installAllLayers(map);

    fillLayerPopupsTL(); // build the widgets

    setDefaultMapValuesTL(me); // set default zoom, center, layers

    if (!imAGuest)
        setUserMapValuesTL(me); // set zoom, center and layers from userID pref.

    setOptionGroupWidgetsFromLayerMap();// syncs up the widgets to match the active layers

    Collection<Extension> exts = map.getExtensions();
    LLayers llayers = null;
    for (Extension ex : exts)
        if (ex instanceof LLayers) {
            llayers = (LLayers) ex;
            break;
        }
    if (llayers != null)
        map.removeExtension(llayers);

    addComponent(map);

    setExpandRatio(map, 1);
    map.setHeight("600px");
    map.setWidth("100%");
    map.addMoveEndListener(new MyMoveEndListener());
}

From source file:edu.nps.moves.mmowgli.modules.userprofile.DefineAwardsDialog.java

License:Open Source License

@HibernateSessionThreadLocalConstructor
public DefineAwardsDialog() {
    setCaption("Define Player Award Types");
    setModal(true);/*from  w  w  w .ja v  a 2 s  . c  o m*/
    setSizeUndefined();
    setWidth("700px");
    setHeight("400px");

    VerticalLayout vLay = new VerticalLayout();
    vLay.setMargin(true);
    vLay.setSpacing(true);
    vLay.setSizeFull();
    setContent(vLay);

    vLay.addComponent(new HtmlLabel("<b>This dialog is not yet functional</b>"));

    Panel p = new Panel();
    p.setWidth("99%");
    p.setHeight("100%");
    vLay.addComponent(p);
    vLay.setExpandRatio(p, 1.0f);

    gridLayout = new GridLayout();
    gridLayout.addStyleName("m-headgrid");
    gridLayout.setWidth("100%");
    p.setContent(gridLayout);
    fillPanelTL();

    HorizontalLayout buttPan = new HorizontalLayout();
    buttPan.setWidth("100%");
    buttPan.setSpacing(true);
    NativeButton addButt = new NativeButton("Add new type", new AddListener());
    NativeButton delButt = new NativeButton("Delete type", new DelListener());
    NativeButton saveButt = new NativeButton("Save", new SaveListener());
    NativeButton cancelButt = new NativeButton("Cancel", new CancelListener());
    buttPan.addComponent(addButt);
    buttPan.addComponent(delButt);

    Label lab;
    buttPan.addComponent(lab = new Label());
    buttPan.setExpandRatio(lab, 1.0f);
    buttPan.addComponent(cancelButt);
    buttPan.addComponent(saveButt);
    vLay.addComponent(buttPan);

    //temp
    saveButt.setEnabled(false);
    delButt.setEnabled(false);
}