Example usage for com.vaadin.server FontAwesome CUBES

List of usage examples for com.vaadin.server FontAwesome CUBES

Introduction

In this page you can find the example usage for com.vaadin.server FontAwesome CUBES.

Prototype

FontAwesome CUBES

To view the source code for com.vaadin.server FontAwesome CUBES.

Click Source Link

Usage

From source file:org.inakirj.imagerulette.MyUI.java

License:Open Source License

@Override
protected void init(VaadinRequest vaadinRequest) {

    TabBarView tabManager = new TabBarView();
    tabManager.addStyleName("tab-style");

    Button addImage = new Button();
    addImage.setIcon(FontAwesome.PLUS);//from w  w w . ja  v  a  2s .  c o m
    addImage.addClickListener(e -> addImageRow());

    tabContent1 = new NavigationView();
    tabContent2 = new NavigationView();
    tabContent3 = new NavigationView();

    // Upload images tab
    tabContent1.setCaption("Set image URLs");
    tabContent1.setContent(new DiceGallerySetupView());
    tabContent1.setData("1");
    tabContent1.setRightComponent(addImage);
    Tab tabUpload = tabManager.addTab(tabContent1, "UPLOAD");
    tabUpload.setIcon(FontAwesome.LINK);

    // Setup tab
    tabContent2.setCaption("Create your dice pool");
    tabContent2.addStyleName("view-background");
    Button resetSliders = new Button("");
    resetSliders.addClickListener(e -> onResetSliders());
    resetSliders.addStyleName("reset-button");
    resetSliders.setIcon(FontAwesome.REPEAT);
    tabContent2.setRightComponent(resetSliders);
    tabContent2.setContent(new DiceURLSetupView(tabContent3));
    tabContent2.setData("2");
    Tab tabSetup = tabManager.addTab(tabContent2, "SETUP");
    tabSetup.setIcon(FontAwesome.COGS);

    // Dice tab
    tabContent3.setCaption("Roll the dice");
    tabContent3.setContent(new DicePlayView());
    tabContent3.setData("3");
    Tab tabPlay = tabManager.addTab(tabContent3, "DICE");
    tabPlay.setIcon(FontAwesome.CUBES);
    tabContent3.setEnabled(false);

    tabManager.setSelectedTab(tabContent2);
    tabManager.addListener(new SelectedTabChangeListener() {

        /** The Constant serialVersionUID. */
        private static final long serialVersionUID = -5418597313724716790L;

        @Override
        public void selectedTabChange(SelectedTabChangeEvent event) {
            NavigationView tab = (NavigationView) (event.getTabSheet().getSelelectedTab()).getComponent();
            if (tab.getData().equals("3") && tab.isEnabled()) {
                ((DicePlayView) tab.getContent()).setupLottery(generateLotteryList);
            }
        }
    });
    setContent(tabManager);
}