Example usage for com.vaadin.ui Button isEnabled

List of usage examples for com.vaadin.ui Button isEnabled

Introduction

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

Prototype

@Override
    public boolean isEnabled() 

Source Link

Usage

From source file:com.rdonasco.common.vaadin.view.ButtonUtil.java

License:Apache License

public static void showButtons(Button... buttons) {
    for (Button button : buttons) {
        button.setVisible(true);/*from w w w .j  av a2  s . c o  m*/
        if (!button.isEnabled()) {
            enableButtons(button);
        }
    }
}

From source file:com.snowy.PostLoginView.java

@PostConstruct
void init() {//from  ww w  .ja va 2  s  .com
    //Logger.getLogger(PostLoginView.class.getName()).info(d);
    d = ((MyVaadinUI) UI.getCurrent()).getDataObject();
    //Logger.getLogger(PostLoginView.class.getName()).info(d);
    g = new GameWindow(d);
    c = new ChatWindow(d);
    HorizontalLayout hl = new HorizontalLayout();
    setMargin(true);
    /*this.getUI().addPollListener(new UIEvents.PollListener(){
    @Override
    public void poll(UIEvents.PollEvent event) {
        c.getUsersList().retrieveActiveUsers();
    }
            
    });*/

    this.setSizeFull();
    Button b = new Button("Logout");
    b.addClickListener(e -> {

        d.logout(VaadinSession.getCurrent().getCsrfToken());
        VaadinSession.getCurrent().close();

        Page.getCurrent().setLocation("/");
    });
    Button ccc = new Button("Unpause polling");
    ccc.setEnabled(false);
    Button cc = new Button("Pause polling");
    cc.addClickListener(e -> {
        if (ccc.isEnabled() == false) {
            UI.getCurrent().setPollInterval(1000000000);
            cc.setEnabled(false);
            ccc.setEnabled(true);
        }
    });
    ccc.addClickListener(e -> {
        if (cc.isEnabled() == false) {
            UI.getCurrent().setPollInterval(1000);
            cc.setEnabled(true);
            ccc.setEnabled(false);
        }
    });
    hl.setSizeFull();
    hl.setSpacing(true);
    //whdjwandjawd
    //this.addComponent(cc);
    //this.addComponent(ccc);
    this.addComponent(b);

    //this.setHeightUndefined();
    this.setSpacing(true);
    this.setComponentAlignment(b, Alignment.TOP_RIGHT);
    //this.addComponent(c);
    //this.addComponent(ul);
    hl.addComponent(g);

    hl.addComponent(c);

    //this.addComponent(c);
    hl.setExpandRatio(c, 1);
    hl.setExpandRatio(g, 3);
    g.setSizeFull();
    c.setSizeFull();
    this.addComponent(hl);
    //this.setExpandRatio(g, 2);
    this.setExpandRatio(hl, 1);
}