Example usage for com.vaadin.server FontAwesome PENCIL

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

Introduction

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

Prototype

FontAwesome PENCIL

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

Click Source Link

Usage

From source file:com.cavisson.gui.dashboard.components.controls.Panels.java

License:Apache License

public Panels() {
    setMargin(true);//w  w  w .  j  a v a2 s .  c o  m

    Label h1 = new Label("Panels & Layout panels");
    h1.addStyleName("h1");
    addComponent(h1);

    HorizontalLayout row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);
    TestIcon testIcon = new TestIcon(60);

    Panel panel = new Panel("Normal");
    panel.setIcon(testIcon.get());
    panel.setContent(panelContent());
    row.addComponent(panel);

    panel = new Panel("Sized");
    panel.setIcon(testIcon.get());
    panel.setWidth("10em");
    panel.setHeight("250px");
    panel.setContent(panelContent());
    row.addComponent(panel);

    panel = new Panel("Custom Caption");
    panel.setIcon(testIcon.get());
    panel.addStyleName("color1");
    panel.setContent(panelContent());
    row.addComponent(panel);

    panel = new Panel("Custom Caption");
    panel.setIcon(testIcon.get());
    panel.addStyleName("color2");
    panel.setContent(panelContent());
    row.addComponent(panel);

    panel = new Panel("Custom Caption");
    panel.setIcon(testIcon.get());
    panel.addStyleName("color3");
    panel.setContent(panelContent());
    row.addComponent(panel);

    panel = new Panel("Borderless style");
    panel.setIcon(testIcon.get());
    panel.addStyleName("borderless");
    panel.setContent(panelContent());
    row.addComponent(panel);

    panel = new Panel("Borderless + scroll divider");
    panel.setIcon(testIcon.get());
    panel.addStyleName("borderless");
    panel.addStyleName("scroll-divider");
    panel.setContent(panelContentScroll());
    panel.setHeight("17em");
    row.addComponent(panel);

    panel = new Panel("Well style");
    panel.setIcon(testIcon.get());
    panel.addStyleName("well");
    panel.setContent(panelContent());
    row.addComponent(panel);

    CssLayout layout = new CssLayout();
    layout.setIcon(testIcon.get());
    layout.setCaption("Panel style layout");
    layout.addStyleName("card");
    layout.addComponent(panelContent());
    row.addComponent(layout);

    layout = new CssLayout();
    layout.addStyleName("card");
    row.addComponent(layout);
    HorizontalLayout panelCaption = new HorizontalLayout();
    panelCaption.addStyleName("v-panel-caption");
    panelCaption.setWidth("100%");
    // panelCaption.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    Label label = new Label("Panel style layout");
    panelCaption.addComponent(label);
    panelCaption.setExpandRatio(label, 1);

    Button action = new Button();
    action.setIcon(FontAwesome.PENCIL);
    action.addStyleName("borderless-colored");
    action.addStyleName("small");
    action.addStyleName("icon-only");
    panelCaption.addComponent(action);
    MenuBar dropdown = new MenuBar();
    dropdown.addStyleName("borderless");
    dropdown.addStyleName("small");
    MenuItem addItem = dropdown.addItem("", FontAwesome.CHEVRON_DOWN, null);
    addItem.setStyleName("icon-only");
    addItem.addItem("Settings", null);
    addItem.addItem("Preferences", null);
    addItem.addSeparator();
    addItem.addItem("Sign Out", null);
    panelCaption.addComponent(dropdown);

    layout.addComponent(panelCaption);
    layout.addComponent(panelContent());
    layout.setWidth("14em");

    layout = new CssLayout();
    layout.setIcon(testIcon.get());
    layout.setCaption("Well style layout");
    layout.addStyleName("well");
    layout.addComponent(panelContent());
    row.addComponent(layout);
}

From source file:com.esofthead.mycollab.shell.view.MainViewImpl.java

License:Open Source License

private MHorizontalLayout buildAccountMenuLayout() {
    accountLayout.removeAllComponents();

    if (SiteConfiguration.isDemandEdition()) {
        // display trial box if user in trial mode
        SimpleBillingAccount billingAccount = AppContext.getBillingAccount();
        if (AccountStatusConstants.TRIAL.equals(billingAccount.getStatus())) {
            if ("Free".equals(billingAccount.getBillingPlan().getBillingtype())) {
                Label informLbl = new Label(
                        "<div class='informBlock'>FREE CHARGE<br>UPGRADE</div><div class='informBlock'>&gt;&gt;</div>",
                        ContentMode.HTML);
                informLbl.addStyleName("trialEndingNotification");
                informLbl.setHeight("100%");
                HorizontalLayout informBox = new HorizontalLayout();
                informBox.addStyleName("trialInformBox");
                informBox.setSizeFull();
                informBox.addComponent(informLbl);
                informBox.setMargin(new MarginInfo(false, true, false, false));
                informBox.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override//w  w  w  .  j  a  va 2s .co  m
                    public void layoutClick(LayoutClickEvent event) {
                        EventBusFactory.getInstance()
                                .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "billing" }));
                    }
                });
                accountLayout.with(informBox).withAlign(informBox, Alignment.MIDDLE_LEFT);
            } else {
                Label informLbl = new Label("", ContentMode.HTML);
                informLbl.addStyleName("trialEndingNotification");
                informLbl.setHeight("100%");
                HorizontalLayout informBox = new HorizontalLayout();
                informBox.addStyleName("trialInformBox");
                informBox.setSizeFull();
                informBox.setMargin(new MarginInfo(false, true, false, false));
                informBox.addComponent(informLbl);
                informBox.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void layoutClick(LayoutClickEvent event) {
                        EventBusFactory.getInstance()
                                .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "billing" }));
                    }
                });
                accountLayout.with(informBox).withAlign(informBox, Alignment.MIDDLE_LEFT);

                Duration dur = new Duration(new DateTime(billingAccount.getCreatedtime()), new DateTime());
                int daysLeft = dur.toStandardDays().getDays();
                if (daysLeft > 30) {
                    informLbl.setValue(
                            "<div class='informBlock'>Trial<br></div><div class='informBlock'>&gt;&gt;</div>");
                    //                        AppContext.getInstance().setIsValidAccount(false);
                } else {
                    informLbl.setValue(String.format("<div class='informBlock'>Trial ending<br>%d days "
                            + "left</div><div class='informBlock'>&gt;&gt;</div>", 30 - daysLeft));
                }
            }
        }
    }

    Label accountNameLabel = new Label(AppContext.getSubDomain());
    accountNameLabel.addStyleName("subdomain");
    accountLayout.addComponent(accountNameLabel);

    if (SiteConfiguration.isCommunityEdition()) {
        Button buyPremiumBtn = new Button("Upgrade to Pro edition", new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                UI.getCurrent().addWindow(new AdWindow());
            }
        });
        buyPremiumBtn.setIcon(FontAwesome.SHOPPING_CART);
        buyPremiumBtn.addStyleName("ad");
        accountLayout.addComponent(buyPremiumBtn);
    }

    LicenseResolver licenseResolver = AppContextUtil.getSpringBean(LicenseResolver.class);
    if (licenseResolver != null) {
        LicenseInfo licenseInfo = licenseResolver.getLicenseInfo();
        if (licenseInfo != null) {
            if (licenseInfo.isExpired()) {
                Button buyPremiumBtn = new Button(AppContext.getMessage(LicenseI18nEnum.EXPIRE_NOTIFICATION),
                        new ClickListener() {
                            @Override
                            public void buttonClick(ClickEvent event) {
                                UI.getCurrent().addWindow(new BuyPremiumSoftwareWindow());
                            }
                        });
                buyPremiumBtn.setIcon(FontAwesome.SHOPPING_CART);
                buyPremiumBtn.addStyleName("ad");
                accountLayout.addComponent(buyPremiumBtn);
            } else if (licenseInfo.isTrial()) {
                Duration dur = new Duration(new DateTime(), new DateTime(licenseInfo.getExpireDate()));
                int days = dur.toStandardDays().getDays();
                Button buyPremiumBtn = new Button(
                        AppContext.getMessage(LicenseI18nEnum.TRIAL_NOTIFICATION, days), new ClickListener() {
                            @Override
                            public void buttonClick(ClickEvent event) {
                                UI.getCurrent().addWindow(new BuyPremiumSoftwareWindow());
                            }
                        });
                buyPremiumBtn.setIcon(FontAwesome.SHOPPING_CART);
                buyPremiumBtn.addStyleName("ad");
                accountLayout.addComponent(buyPremiumBtn);
            }
        }
    }

    NotificationComponent notificationComponent = new NotificationComponent();
    accountLayout.addComponent(notificationComponent);

    if (StringUtils.isBlank(AppContext.getUser().getAvatarid())) {
        EventBusFactory.getInstance()
                .post(new ShellEvent.NewNotification(this, new RequestUploadAvatarNotification()));
    }

    if (!SiteConfiguration.isDemandEdition()) {
        ExtMailService mailService = AppContextUtil.getSpringBean(ExtMailService.class);
        if (!mailService.isMailSetupValid()) {
            EventBusFactory.getInstance()
                    .post(new ShellEvent.NewNotification(this, new SmtpSetupNotification()));
        }

        SimpleUser user = AppContext.getUser();
        GregorianCalendar tenDaysAgo = new GregorianCalendar();
        tenDaysAgo.add(Calendar.DATE, -10);

        if (Boolean.TRUE.equals(user.getRequestad()) && user.getRegisteredtime().before(tenDaysAgo.getTime())) {
            UI.getCurrent().addWindow(new AdRequestWindow(user));
        }
    }

    Resource userAvatarRes = UserAvatarControlFactory.createAvatarResource(AppContext.getUserAvatarId(), 24);
    final PopupButton accountMenu = new PopupButton("");
    accountMenu.setIcon(userAvatarRes);
    accountMenu.setDescription(AppContext.getUserDisplayName());

    OptionPopupContent accountPopupContent = new OptionPopupContent();

    Button myProfileBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_PROFILE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    accountMenu.setPopupVisible(false);
                    EventBusFactory.getInstance()
                            .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "preview" }));
                }
            });
    myProfileBtn.setIcon(SettingAssetsManager.getAsset(SettingUIConstants.PROFILE));
    accountPopupContent.addOption(myProfileBtn);

    Button userMgtBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_USERS_AND_ROLES),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    accountMenu.setPopupVisible(false);
                    EventBusFactory.getInstance()
                            .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "user", "list" }));
                }
            });
    userMgtBtn.setIcon(SettingAssetsManager.getAsset(SettingUIConstants.USERS));
    accountPopupContent.addOption(userMgtBtn);

    Button generalSettingBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_SETTING),
            new ClickListener() {
                @Override
                public void buttonClick(ClickEvent clickEvent) {
                    accountMenu.setPopupVisible(false);
                    EventBusFactory.getInstance().post(
                            new ShellEvent.GotoUserAccountModule(this, new String[] { "setting", "general" }));
                }
            });
    generalSettingBtn.setIcon(SettingAssetsManager.getAsset(SettingUIConstants.GENERAL_SETTING));
    accountPopupContent.addOption(generalSettingBtn);

    Button themeCustomizeBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_THEME), new ClickListener() {
        @Override
        public void buttonClick(ClickEvent clickEvent) {
            accountMenu.setPopupVisible(false);
            EventBusFactory.getInstance()
                    .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setting", "theme" }));
        }
    });
    themeCustomizeBtn.setIcon(SettingAssetsManager.getAsset(SettingUIConstants.THEME_CUSTOMIZE));
    accountPopupContent.addOption(themeCustomizeBtn);

    if (!SiteConfiguration.isDemandEdition()) {
        Button setupBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_SETUP), new ClickListener() {
            @Override
            public void buttonClick(ClickEvent clickEvent) {
                accountMenu.setPopupVisible(false);
                EventBusFactory.getInstance()
                        .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setup" }));
            }
        });
        setupBtn.setIcon(FontAwesome.WRENCH);
        accountPopupContent.addOption(setupBtn);
    }

    accountPopupContent.addSeparator();

    Button helpBtn = new Button(AppContext.getMessage(GenericI18Enum.ACTION_HELP));
    helpBtn.setIcon(FontAwesome.MORTAR_BOARD);
    ExternalResource helpRes = new ExternalResource("https://community.mycollab.com/meet-mycollab/");
    BrowserWindowOpener helpOpener = new BrowserWindowOpener(helpRes);
    helpOpener.extend(helpBtn);
    accountPopupContent.addOption(helpBtn);

    Button supportBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SUPPORT));
    supportBtn.setIcon(FontAwesome.LIFE_SAVER);
    ExternalResource supportRes = new ExternalResource("http://support.mycollab.com/");
    BrowserWindowOpener supportOpener = new BrowserWindowOpener(supportRes);
    supportOpener.extend(supportBtn);
    accountPopupContent.addOption(supportBtn);

    Button translateBtn = new Button(AppContext.getMessage(GenericI18Enum.ACTION_TRANSLATE));
    translateBtn.setIcon(FontAwesome.PENCIL);
    ExternalResource translateRes = new ExternalResource(
            "https://community.mycollab.com/docs/developing-mycollab/translating/");
    BrowserWindowOpener translateOpener = new BrowserWindowOpener(translateRes);
    translateOpener.extend(translateBtn);
    accountPopupContent.addOption(translateBtn);

    if (!SiteConfiguration.isCommunityEdition()) {
        Button myAccountBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_BILLING),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        accountMenu.setPopupVisible(false);
                        EventBusFactory.getInstance()
                                .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "billing" }));
                    }
                });
        myAccountBtn.setIcon(SettingAssetsManager.getAsset(SettingUIConstants.BILLING));
        accountPopupContent.addOption(myAccountBtn);
    }

    accountPopupContent.addSeparator();
    Button aboutBtn = new Button("About MyCollab", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent clickEvent) {
            accountMenu.setPopupVisible(false);
            Window aboutWindow = ViewManager.getCacheComponent(AbstractAboutWindow.class);
            UI.getCurrent().addWindow(aboutWindow);
        }
    });
    aboutBtn.setIcon(FontAwesome.INFO_CIRCLE);
    accountPopupContent.addOption(aboutBtn);

    Button releaseNotesBtn = new Button("Release Notes");
    ExternalResource releaseNotesRes = new ExternalResource(
            "https://community.mycollab.com/docs/hosting-mycollab-on-your-own-server/releases/");
    BrowserWindowOpener releaseNotesOpener = new BrowserWindowOpener(releaseNotesRes);
    releaseNotesOpener.extend(releaseNotesBtn);

    releaseNotesBtn.setIcon(FontAwesome.BULLHORN);
    accountPopupContent.addOption(releaseNotesBtn);

    Button signoutBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SIGNOUT),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    accountMenu.setPopupVisible(false);
                    EventBusFactory.getInstance().post(new ShellEvent.LogOut(this, null));
                }
            });
    signoutBtn.setIcon(FontAwesome.SIGN_OUT);
    accountPopupContent.addSeparator();
    accountPopupContent.addOption(signoutBtn);

    accountMenu.setContent(accountPopupContent);
    accountLayout.addComponent(accountMenu);
    return accountLayout;
}

From source file:com.etest.view.systemadministration.CurriculumMainUI.java

Table populateDataTable() {
    table.removeAllItems();/*from  ww w . j av  a 2  s .c  om*/
    int i = 0;
    for (Curriculum c : cs.getAllCurriculum()) {
        HorizontalLayout h = new HorizontalLayout();
        h.setWidth("100%");

        Button edit = new Button("edit");
        edit.setSizeFull();
        edit.setIcon(FontAwesome.PENCIL);
        edit.setData(c.getCurriculumId());
        edit.addStyleName(ValoTheme.BUTTON_LINK);
        edit.addStyleName(ValoTheme.BUTTON_TINY);
        edit.addStyleName("button-container");
        edit.addClickListener(buttonClickListener);
        h.addComponent(edit);

        Button delete = new Button("del");
        delete.setSizeFull();
        delete.setIcon(FontAwesome.TRASH_O);
        delete.setData(c.getCurriculumId());
        delete.addStyleName(ValoTheme.BUTTON_LINK);
        delete.addStyleName(ValoTheme.BUTTON_TINY);
        delete.addStyleName("button-container");
        delete.addClickListener(buttonClickListener);
        h.addComponent(delete);

        table.addItem(new Object[] {
                //                c.getCurriculumId(),
                CommonVariableMap.getYearLevel(c.getYearLevel()), c.getSubject(), c.getDescriptiveTitle(),
                CommonVariableMap.getNormCourseOffering(c.getNormCourseOffering()), h }, i);
        i++;
    }
    table.setPageLength(table.size());

    //        table.getListeners(ItemClickEvent.class).stream().forEach((listener) -> {
    //            table.removeListener(ItemClickEvent.class, listener);
    //        });
    //        
    //        table.addItemClickListener((ItemClickEvent event) -> {
    //            Property itemProperty = event.getItem().getItemProperty("id");
    //            
    //            Window sub = new CurriculumFormWindow(CommonUtilities.convertStringToInt(itemProperty.getValue().toString()));
    //            if(sub.getParent() == null){
    //                UI.getCurrent().addWindow(sub);
    //            }
    //            sub.addCloseListener((Window.CloseEvent e) -> {
    //                populateDataTable();
    //            });
    //        });

    return table;
}

From source file:com.etest.view.systemadministration.FacultyMainUI.java

Table populateDataTable() {
    table.removeAllItems();// ww  w  .  j  a  v  a  2s.c  o  m
    int i = 0;
    for (Users u : fs.getAllFaculty()) {
        HorizontalLayout hlayout = new HorizontalLayout();
        hlayout.setWidth("100%");

        Button edit = new Button("edit");
        edit.setWidth("100%");
        edit.setData(u.getFacultyId());
        edit.setIcon(FontAwesome.PENCIL);
        edit.addStyleName(ValoTheme.BUTTON_LINK);
        edit.addStyleName(ValoTheme.BUTTON_TINY);
        edit.addStyleName("button-container");
        edit.addClickListener(modifyBtnClickListener);
        hlayout.addComponent(edit);

        Button delete = new Button("del");
        delete.setWidth("100%");
        delete.setData(u.getFacultyId());
        delete.setIcon(FontAwesome.TRASH_O);
        delete.addStyleName(ValoTheme.BUTTON_LINK);
        delete.addStyleName(ValoTheme.BUTTON_TINY);
        delete.addStyleName("button-container");
        delete.addClickListener(modifyBtnClickListener);
        hlayout.addComponent(delete);

        table.addItem(new Object[] { u.getName().toUpperCase(), u.getUsername_(), u.getUserType(), hlayout },
                new Integer(i));
        i++;
    }
    table.setPageLength(table.size());

    //        table.getListeners(ItemClickEvent.class).stream().forEach((listener) -> {
    //            table.removeListener(ItemClickEvent.class, listener);
    //        });

    //        table.addItemClickListener((ItemClickEvent event) -> {
    //            Property itemProperty = event.getItem().getItemProperty("name");
    //            facultyId = fs.getFacultyIdByName(itemProperty.getValue().toString());
    //            
    //            Window sub = new FacultyFormWindow(facultyId);
    //            if(sub.getParent() == null){
    //                UI.getCurrent().addWindow(sub);
    //            }
    //        });

    return table;
}

From source file:com.etest.view.systemadministration.syllabus.SyllabusFormWindow.java

Component buildSyllabusForms() {
    FormLayout form = new FormLayout();
    form.setWidth("100%");
    form.setMargin(true);//from   w  w w. j  ava  2  s .  c  o m

    subjects.setCaption("Subject: ");
    subjects.setWidth("50%");
    subjects.setIcon(FontAwesome.BOOK);
    subjects.addStyleName(ValoTheme.COMBOBOX_SMALL);
    form.addComponent(subjects);

    topicNo.setCaption("Topic No: ");
    topicNo.setWidth("50%");
    topicNo.setIcon(FontAwesome.TAG);
    topicNo.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    form.addComponent(topicNo);

    topic.setCaption("Topic: ");
    topic.setWidth("100%");
    topic.setIcon(FontAwesome.TAG);
    topic.setInputPrompt("Enter Topic..");
    topic.setRows(3);
    topic.addStyleName(ValoTheme.TEXTAREA_SMALL);
    form.addComponent(topic);

    estimatedTime.setCaption("Estimated Time: ");
    estimatedTime.setWidth("50%");
    estimatedTime.setIcon(FontAwesome.TAG);
    estimatedTime.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    form.addComponent(estimatedTime);

    Button save = new Button("SAVE");
    save.setWidth("50%");
    save.setIcon(FontAwesome.SAVE);
    save.addStyleName(ValoTheme.BUTTON_PRIMARY);
    save.addStyleName(ValoTheme.BUTTON_SMALL);
    save.addClickListener(buttonClickListener);

    Button update = new Button("UPDATE");
    update.setWidth("60%");
    update.setIcon(FontAwesome.PENCIL);
    update.addStyleName(ValoTheme.BUTTON_PRIMARY);
    update.addStyleName(ValoTheme.BUTTON_SMALL);
    update.addClickListener(buttonClickListener);

    Button remove = new Button("REMOVE");
    remove.setWidth("60%");
    remove.setIcon(FontAwesome.TRASH_O);
    remove.addStyleName(ValoTheme.BUTTON_PRIMARY);
    remove.addStyleName(ValoTheme.BUTTON_SMALL);
    remove.addClickListener(buttonClickListener);

    if (getSyllabusId() != 0) {
        s = ss.getSyllabusById(syllabusId);
        subjects.setValue(s.getCurriculumId());
        topicNo.setValue(String.valueOf(s.getTopicNo()));
        estimatedTime.setValue(String.valueOf(s.getEstimatedTime()));
        topic.setValue(s.getTopic());

        if (getButtonCaption().equals("edit")) {
            form.addComponent(update);
        } else {
            form.addComponent(remove);
        }
    } else {
        form.addComponent(save);
    }

    return form;
}

From source file:com.etest.view.systemadministration.syllabus.SyllabusMainUI.java

Table populateDataTable() {
    table.removeAllItems();//from   w ww .j ava 2 s  .c om
    int i = 0;
    for (Syllabus s : ss.getAllSyllabus()) {
        VerticalLayout v = new VerticalLayout();
        v.setWidth("100%");

        Button edit = new Button("edit");
        edit.setWidthUndefined();
        edit.setData(s.getSyllabusId());
        edit.setIcon(FontAwesome.PENCIL);
        edit.addStyleName(ValoTheme.BUTTON_LINK);
        edit.addStyleName(ValoTheme.BUTTON_TINY);
        edit.addStyleName("button-container");
        edit.addClickListener(buttonClickListener);
        v.addComponent(edit);

        Button delete = new Button("del");
        delete.setWidthUndefined();
        delete.setData(s.getSyllabusId());
        delete.setIcon(FontAwesome.TRASH_O);
        delete.addStyleName(ValoTheme.BUTTON_LINK);
        delete.addStyleName(ValoTheme.BUTTON_TINY);
        delete.addStyleName("button-container");
        delete.addClickListener(buttonClickListener);
        v.addComponent(delete);

        Label descriptiveTitle = new Label(s.getTopic(), ContentMode.HTML);
        descriptiveTitle.setStyleName("label-padding");

        Label topic = new Label(s.getTopic(), ContentMode.HTML);
        topic.setStyleName("label-padding");

        table.addItem(new Object[] {
                //                s.getSyllabusId(), 
                s.getSubject(), descriptiveTitle, s.getTopicNo(), topic, s.getEstimatedTime(), v }, i);
        i++;
    }
    table.setPageLength(table.size());

    return table;
}

From source file:com.etest.view.testbank.CellCaseMainUI.java

Table populateDataTable() {
    table.removeAllItems();/* w w  w.  java2 s . com*/
    int i = 0;
    for (CellCase cc : ccs.getCellCaseByTopic(getSyllabusId())) {
        VerticalLayout v = new VerticalLayout();
        v.setWidth("100%");

        Button edit = new Button("modify");
        edit.setSizeFull();
        edit.setData(cc.getCellCaseId());
        edit.setIcon(FontAwesome.PENCIL);
        edit.addStyleName(ValoTheme.BUTTON_LINK);
        edit.addStyleName(ValoTheme.BUTTON_TINY);
        edit.addStyleName(ValoTheme.BUTTON_QUIET);
        edit.addStyleName("button-container");
        edit.addClickListener(modifyBtnClickListener);
        v.addComponent(edit);
        v.setComponentAlignment(edit, Alignment.MIDDLE_LEFT);

        Button approve = new Button("status");
        approve.setSizeFull();
        approve.setData(cc.getCellCaseId());
        approve.addStyleName(ValoTheme.BUTTON_LINK);
        approve.addStyleName(ValoTheme.BUTTON_TINY);
        approve.addStyleName(ValoTheme.BUTTON_QUIET);
        approve.addStyleName("button-container");
        v.addComponent(approve);
        v.setComponentAlignment(approve, Alignment.MIDDLE_LEFT);

        if (cc.getApprovalStatus() == 0) {
            approve.setIcon(FontAwesome.THUMBS_DOWN);
        } else {
            approve.setIcon(FontAwesome.THUMBS_UP);
        }

        Button stem = new Button("stems");
        stem.setSizeFull();
        stem.setData(cc.getCellCaseId());
        stem.setIcon(FontAwesome.BRIEFCASE);
        stem.addStyleName(ValoTheme.BUTTON_LINK);
        stem.addStyleName(ValoTheme.BUTTON_TINY);
        stem.addStyleName(ValoTheme.BUTTON_QUIET);
        stem.addStyleName("button-container");
        stem.addClickListener(stemBtnClickListener);
        v.addComponent(stem);
        v.setComponentAlignment(stem, Alignment.MIDDLE_LEFT);

        Label label = new Label(cc.getCaseTopic(), ContentMode.HTML);
        label.setStyleName("label-padding");

        table.addItem(new Object[] { cc.getCellCaseId(), label, cc.getUsername_(), cc.getDateCreated(), v }, i);
        i++;
    }
    table.setPageLength(table.size());

    return table;
}

From source file:com.etest.view.testbank.cellitem.CellCaseItemWindow.java

Table populateDataTable() {
    table.removeAllItems();/*from  ww w .j  a  v  a  2 s  .co m*/
    int i = 0;
    for (CellItem ci : cis.getCellItemByCase(getCellCaseId())) {
        VerticalLayout v = new VerticalLayout();
        v.setSizeFull();

        Button edit = new Button("modify");
        edit.setWidth("100%");
        edit.setData(ci.getCellItemId());
        edit.setIcon(FontAwesome.PENCIL);
        edit.addStyleName(ValoTheme.BUTTON_LINK);
        edit.addStyleName(ValoTheme.BUTTON_TINY);
        edit.addStyleName(ValoTheme.BUTTON_QUIET);
        edit.addClickListener(modifyBtnClickListener);
        v.addComponent(edit);
        v.setComponentAlignment(edit, Alignment.MIDDLE_LEFT);

        Button approve = new Button("status");
        approve.setWidth("100%");
        approve.setData(ci.getCellItemId());
        approve.addStyleName(ValoTheme.BUTTON_LINK);
        approve.addStyleName(ValoTheme.BUTTON_TINY);
        approve.addStyleName(ValoTheme.BUTTON_QUIET);
        v.addComponent(approve);
        v.setComponentAlignment(approve, Alignment.MIDDLE_LEFT);

        Button view = new Button("view");
        view.setWidth("100%");
        view.setData(ci.getCellItemId());
        view.setIcon(FontAwesome.PLAY_CIRCLE);
        view.addStyleName(ValoTheme.BUTTON_LINK);
        view.addStyleName(ValoTheme.BUTTON_TINY);
        view.addStyleName(ValoTheme.BUTTON_QUIET);
        view.addClickListener(modifyBtnClickListener);
        v.addComponent(view);
        v.setComponentAlignment(view, Alignment.MIDDLE_LEFT);

        if (ci.getApproveItemStatus() == 0) {
            approve.setIcon(FontAwesome.THUMBS_DOWN);
        } else {
            approve.setIcon(FontAwesome.THUMBS_UP);
        }

        Label label = new Label(ci.getItem());
        label.setStyleName("label-padding");

        table.addItem(new Object[] { ci.getCellItemId(), label, v }, i);
        i++;
    }
    table.setPageLength(table.size());

    return table;
}

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 ww  w.ja va 2s.  co  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:com.mechanicshop.components.MaintenanceLayout.java

private void customizeTable() {
    table.setSizeFull();/* w  w  w.j a va 2 s .  c  o m*/
    table.setSortEnabled(true);
    table.setStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES);
    table.addStyleName(ValoTheme.TABLE_SMALL);
    table.setEditable(true);
    table.setImmediate(true);

    table.addGeneratedColumn(" ", new Table.ColumnGenerator() {

        @Override
        public Object generateCell(final Table source, final Object itemId, Object columnId) {
            Button icon = new Button();
            icon.setStyleName(ValoTheme.BUTTON_ICON_ONLY);
            icon.addStyleName(ValoTheme.BUTTON_TINY);
            icon.addStyleName(ValoTheme.BUTTON_BORDERLESS);
            icon.setVisible(true);
            icon.setImmediate(true);
            icon.setDescription("Details");
            icon.setIcon(FontAwesome.PENCIL);
            icon.addClickListener(new ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                    Item item = source.getItem(itemId);
                    showDataEntryWindow(item);
                }
            });
            return icon;
        }
    });

}