Example usage for com.vaadin.server FontAwesome KEY

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

Introduction

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

Prototype

FontAwesome KEY

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

Click Source Link

Usage

From source file:ch.bfh.ti.soed.hs16.srs.black.view.loginView.LoginView.java

License:Open Source License

public LoginView() {
    usernameField = new TextField("Username");
    usernameField.setIcon(FontAwesome.USER);
    usernameField.setWidth(12, Unit.EM);
    passwordField = new PasswordField("Password");
    passwordField.setIcon(FontAwesome.KEY);
    passwordField.setWidth(12, Unit.EM);
    loginButton = new Button("Login");
    loginButton.setWidth(5, Unit.EM);/*from  w  ww .j av  a 2  s .c o  m*/
    loginButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signUpButton = new Button("Sign Up");
    signUpButton.setWidth(6, Unit.EM);

    VerticalLayout layout = new VerticalLayout();
    HorizontalLayout layoutButtons = new HorizontalLayout(loginButton, signUpButton);
    layoutButtons.setSpacing(true);
    Panel panel = new Panel("Login - Smart ReservationEntity System");
    panel.setSizeUndefined();
    layout.addComponent(panel);

    FormLayout content = new FormLayout();
    content.addComponents(usernameField, passwordField, layoutButtons);
    content.setSizeFull();
    content.setMargin(true);
    panel.setContent(content);

    setCompositionRoot(layout);

    layout.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
    layout.setMargin(new MarginInfo(true, false, false, false));
}

From source file:ch.bfh.ti.soed.hs16.srs.black.view.signUpView.SignUpView.java

License:Open Source License

public SignUpView() {
    usernameField = new TextField("Username");
    usernameField.setIcon(FontAwesome.USER);
    usernameField.setWidth(12, Unit.EM);
    passwordField = new PasswordField("Password");
    passwordField.setIcon(FontAwesome.KEY);
    passwordField.setWidth(12, Unit.EM);
    passwordFieldRepeat = new PasswordField("Repeat Password");
    passwordFieldRepeat.setIcon(FontAwesome.KEY);
    passwordFieldRepeat.setWidth(12, Unit.EM);
    addUserButton = new Button("Add New User");
    addUserButton.setWidth(12, Unit.EM);
    goBackButton = new Button("Back");

    VerticalLayout layout = new VerticalLayout();
    Panel panel = new Panel("Sign Up - Smart ReservationEntity System");
    panel.setSizeUndefined();/*from  w ww  .j  a v a 2 s.  c  o m*/
    layout.addComponent(panel);

    FormLayout content = new FormLayout();
    content.addComponents(usernameField, passwordField, passwordFieldRepeat, addUserButton);
    content.setSizeUndefined();
    content.setMargin(true);
    VerticalLayout formAndBack = new VerticalLayout(content, goBackButton);
    formAndBack.setMargin(true);
    panel.setContent(formAndBack);

    setCompositionRoot(layout);

    layout.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
    layout.setMargin(new MarginInfo(true, false, false, false));
}

From source file:com.anphat.list.controller.ListStaffController.java

private void initTable() {
    itemContainer = new BeanItemContainer<>(StaffDTO.class);
    //add detail link into tblstaff
    tblStaffs.addGeneratedColumn("resetPassword", new CustomTable.ColumnGenerator() {
        @Override/*from  w w w.  ja  v a  2  s  . c  o  m*/
        public Object generateCell(CustomTable source, final Object itemId, Object columnId) {
            final Button linkDetails = new Button();
            linkDetails.setIcon(FontAwesome.KEY);
            linkDetails.setStyleName(Runo.BUTTON_LINK);
            linkDetails.addStyleName("v-button-link-left");
            linkDetails.addClickListener(new Button.ClickListener() {

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    final StaffDTO staffDTO = (StaffDTO) itemId;
                    ConfirmDialog.show(UI.getCurrent(), "Reset mt khu",
                            "?t li mt khu mc nh cho ti khon " + staffDTO.getName(),
                            "?ng ", "Hu b?", new ConfirmDialog.Listener() {
                                @Override
                                public void onClose(ConfirmDialog dialog) {
                                    if (dialog.isConfirmed()) {
                                        staffDTO.setPassword(
                                                DataUtil.md5(BundleUtils.getStringCas("password_default")));
                                        // Confirmed to continue
                                        String result = WSStaff.updateStaff(staffDTO);
                                        if (Constants.SUCCESS.equalsIgnoreCase(result)) {
                                            CommonMessages.showMessageUpdateSuccess("pass");
                                        }
                                    }
                                }
                            });
                }
            });
            linkDetails.setDescription(BundleUtils.getString("resetPassword"));
            return linkDetails;
        }
    });
    tblStaffs.addGeneratedColumn("detailRole", new CustomTable.ColumnGenerator() {

        @Override
        public Object generateCell(CustomTable source, final Object itemId, Object columnId) {
            final Button btnAddRole = new Button(BundleUtils.getString("detail.roles"));
            btnAddRole.setStyleName(Runo.BUTTON_LINK);
            btnAddRole.addStyleName("v-button-link-left");
            btnAddRole.addClickListener(new Button.ClickListener() {

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    StaffDTO staffDTO = (StaffDTO) itemId;
                    MapStaffRolesDiaglog diaglog = new MapStaffRolesDiaglog(
                            BundleUtils.getString("map.staff.roles.view"));
                    diaglog.setTblRolesVisiableOnly();

                    MapStaffRolesController controller = new MapStaffRolesController(diaglog);
                    controller.initOnlyView(staffDTO);
                    UI.getCurrent().addWindow(diaglog);
                }
            });
            btnAddRole.setDescription(BundleUtils.getString("lb.header.staff.addCustomer.decr"));
            return btnAddRole;
        }
    });
    //160316 NgocND6 them chuc nang hang hoa quan ly cua tung nhan vien
    tblStaffs.addGeneratedColumn("goodsManage", new CustomTable.ColumnGenerator() {

        @Override
        public Object generateCell(CustomTable source, final Object itemId, Object columnId) {
            final Button linkDetails = new Button(BundleUtils.getString("lb.header.staff.goodsManage"));
            linkDetails.setStyleName(Runo.BUTTON_LINK);
            linkDetails.addStyleName("v-button-link-left");
            linkDetails.addClickListener(new Button.ClickListener() {

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    //                        StaffDTO staffDTO = (StaffDTO) itemId;
                    //                        if (staffDTO.getStatus().equalsIgnoreCase("1")) {
                    //                            getListMapStaffCustomer(staffDTO);
                    //                            if (listMapStaffCustomer != null) {
                    //                                DialogGoodsManagement dialogGoodsManagement = new DialogGoodsManagement(BundleUtils.getString("transfer.goods.manage.managoodsassignstaff"));
                    //                                dialogGoodsManagement.initDialog();
                    //                                DialogGoodsManagementController dgmc = new DialogGoodsManagementController(staffDTO, dialogGoodsManagement);
                    //                                UI.getCurrent().addWindow(dialogGoodsManagement);
                    //                            }else{
                    //                                Notification.show(BundleUtils.getString("transfer.goods.manage.staffdontassigncust"), Notification.Type.WARNING_MESSAGE);
                    //                            }
                    //                        } else {
                    //                            Notification.show(BundleUtils.getString("dept.staff.alert.message.notActive"));
                    //                        }
                }
            });
            linkDetails.setDescription(BundleUtils.getString("lb.header.staff.addCustomer.decr"));
            return linkDetails;
        }
    });
    tableUtils = new TableUtils();
    tableUtils.generateColumn(tblStaffs);
    CommonFunctionTableFilter.initTable(staffTablePanel, headerData, itemContainer, captionfieldsetListStaff, 5,
            "lb.header.staff");
    CommonUtils.convertFieldAppParamTable(tblStaffs, Constants.STAFF.STATUS,
            Constants.APP_PARAMS.COMMON_STATUS);
    CommonUtils.convertFieldAppParamTable(tblStaffs, Constants.STAFF.STAFF_TYPE,
            Constants.APP_PARAMS.STAFF_TYPE);
    //        tblStaffs.setColumnHeader("addStock", BundleUtils.getString("add.staff.for.stock"));

}

From source file:com.logicbomb.newschool.MyAppWidgetSet.core.UserDetailsWidget.java

public UserDetailsWidget() {
    HorizontalLayout h = new HorizontalLayout();
    addComponent(h);/*from   ww  w.jav  a2  s. c om*/

    h.setSizeFull();
    //h.setSpacing(true);

    Button userPhoto = new Button();
    userPhoto.setIcon(FontAwesome.USER);
    userPhoto.setHeight("100px");
    userPhoto.setWidth("100px");
    h.addComponent(userPhoto);
    //h.setComponentAlignment(userPhoto, Alignment.TOP_LEFT);

    VerticalLayout v = new VerticalLayout();
    //v.setStyleName("backColorBlack");
    h.addComponent(v);
    v.setStyleName("v-layout-padding-left");
    //h.setComponentAlignment(userPhoto, Alignment.TOP_RIGHT);
    v.setHeight("106px");
    v.setWidth("100px");

    // v.setComponentAlignment(userStatus, Alignment.MIDDLE_CENTER);
    Button editProfile = new Button("Profile");
    editProfile.setStyleName("v-button-type3");
    editProfile.setIcon(FontAwesome.USER);
    editProfile.setWidth("100px");
    editProfile.setWidth("102px");
    v.addComponent(editProfile);
    //v.setComponentAlignment(editProfile, Alignment.TOP_LEFT);

    Button settings = new Button("Settings");
    settings.setStyleName("v-button-type3");
    settings.setIcon(FontAwesome.WRENCH);
    settings.setWidth("100px");
    settings.setWidth("102px");
    v.addComponent(settings);
    //v.setComponentAlignment(editProfile, Alignment.MIDDLE_RIGHT);

    Button logOut = new Button("Log Out");
    logOut.setStyleName("v-button-type3");
    logOut.setIcon(FontAwesome.KEY);
    logOut.setWidth("100px");
    logOut.setWidth("102px");
    v.addComponent(logOut);
    //v.setComponentAlignment(editProfile, Alignment.BOTTOM_RIGHT);

    //v.setComponentAlignment(userStatus, Alignment.MIDDLE_CENTER);
}

From source file:com.logicbomb.newschool.MyAppWidgetSet.LoginWidget.java

public LoginWidget() {
    setMargin(true);/*w ww  .  ja v  a2s  .  c o  m*/
    setSpacing(true);

    Panel iPanel = new Panel();
    iPanel.addStyleName("backColorWhite");
    iPanel.setSizeUndefined();

    addComponent(iPanel);

    TextField iTextField = new TextField("Username");
    iTextField.setWidth("300px");
    iTextField.setRequired(true);
    iTextField.setInputPrompt("Your username (eg. joe@email.com)");
    iTextField.setIcon(FontAwesome.USER);
    iTextField.addValidator(new EmailValidator("Username must be an email address"));
    iTextField.setInvalidAllowed(true);
    iTextField.focus();

    PasswordField iPasswordField = new PasswordField("Password");
    iPasswordField.setIcon(FontAwesome.KEY);
    iPasswordField.setWidth("300px");
    iPasswordField.setRequired(true);
    iPasswordField.setValue("");
    iPasswordField.setNullRepresentation("");

    Button iButton = new Button("Login");
    iButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            addComponent(new Label("Login Successfully"));
        }
    });

    FormLayout iFormLayout = new FormLayout();
    iFormLayout.setSpacing(true);
    iFormLayout.setMargin(true);
    iFormLayout.addComponent(iTextField);
    iFormLayout.addComponent(iPasswordField);
    iFormLayout.addComponent(iButton);
    iPanel.setContent(iFormLayout);

}

From source file:lifetime.component.welcome.LoginButton.java

License:Apache License

public LoginButton(String language) {
    super(Translator.getTranslation("Login", language), language, FontAwesome.KEY);
    this.text = Translator.getTranslation("Login", language);
    setDescription(text);/*ww w. j  ava 2  s .  co  m*/
    setId(StyleClassName.LOGIN_BUTTON.getId());
    addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            Page.getCurrent().setLocation(Location.USER.getUri());
        }
    });
}

From source file:org.jumpmind.metl.ui.views.design.EditModelPanel.java

License:Open Source License

public EditModelPanel(ApplicationContext context, String modelId, boolean readOnly) {
    this.context = context;
    this.model = new Model(modelId);
    this.readOnly = readOnly;
    context.getConfigurationService().refresh(model);

    ButtonBar buttonBar = new ButtonBar();
    addComponent(buttonBar);//  w  ww .  j  a  v  a  2  s  . com

    if (!readOnly) {
        addEntityButton = buttonBar.addButton("Add Entity", FontAwesome.TABLE);
        addEntityButton.addClickListener(new AddEntityClickListener());

        addAttributeButton = buttonBar.addButton("Add Attribute", FontAwesome.COLUMNS);
        addAttributeButton.addClickListener(new AddAttributeClickListener());

        editButton = buttonBar.addButton("Edit", FontAwesome.EDIT);
        editButton.addClickListener(new EditClickListener());

        removeButton = buttonBar.addButton("Remove", FontAwesome.TRASH_O);
        removeButton.addClickListener(new RemoveClickListener());

        importButton = buttonBar.addButton("Import ...", FontAwesome.DOWNLOAD);
        importButton.addClickListener(new ImportClickListener());
    }

    filterField = buttonBar.addFilter();
    filterField.addTextChangeListener(new TextChangeListener() {
        public void textChange(TextChangeEvent event) {
            filterField.setValue(event.getText());
            treeTable.removeAllItems();
            addAll(event.getText(), EditModelPanel.this.model.getModelEntities());
        }
    });

    treeTable.setSizeFull();
    treeTable.setCacheRate(100);
    treeTable.setPageLength(100);
    treeTable.setImmediate(true);
    treeTable.setSelectable(true);
    treeTable.setMultiSelect(true);
    treeTable.addGeneratedColumn("name", new ColumnGenerator() {
        public Object generateCell(Table source, Object itemId, Object columnId) {
            final AbstractObject obj = (AbstractObject) itemId;
            if (lastEditItemIds.contains(itemId) && !readOnly) {
                ImmediateUpdateTextField t = new ImmediateUpdateTextField(null) {
                    protected void save(String text) {
                        obj.setName(text);
                        EditModelPanel.this.context.getConfigurationService().save(obj);
                    };
                };
                t.setWidth(100, Unit.PERCENTAGE);
                t.setValue(obj.getName());
                t.focus();
                t.selectAll();
                return t;
            } else {
                return UiUtils.getName(filterField.getValue(), obj.getName());
            }
        }
    });
    treeTable.setColumnHeader("name", "Name");

    treeTable.addGeneratedColumn("description", new ColumnGenerator() {
        public Object generateCell(Table source, Object itemId, Object columnId) {
            if (itemId instanceof ModelAttribute) {
                final ModelAttribute obj = (ModelAttribute) itemId;
                if (lastEditItemIds.contains(itemId) && !readOnly) {
                    ImmediateUpdateTextField t = new ImmediateUpdateTextField(null) {
                        protected void save(String text) {
                            obj.setDescription(text);
                            EditModelPanel.this.context.getConfigurationService().save(obj);
                        };
                    };
                    t.setWidth(100, Unit.PERCENTAGE);
                    t.setValue(obj.getDescription());
                    return t;
                } else {
                    return UiUtils.getName(filterField.getValue(), obj.getDescription());
                }
            }
            if (itemId instanceof ModelEntity) {
                final ModelEntity obj = (ModelEntity) itemId;
                if (lastEditItemIds.contains(itemId) && !readOnly) {
                    ImmediateUpdateTextField t = new ImmediateUpdateTextField(null) {
                        protected void save(String text) {
                            obj.setDescription(text);
                            EditModelPanel.this.context.getConfigurationService().save(obj);
                        };
                    };
                    t.setWidth(100, Unit.PERCENTAGE);
                    t.setValue(obj.getDescription());
                    return t;
                } else {
                    return UiUtils.getName(filterField.getValue(), obj.getDescription());
                }
            } else
                return null;
        }
    });
    treeTable.setColumnHeader("description", "Description");

    treeTable.addGeneratedColumn("type", new ColumnGenerator() {
        public Object generateCell(Table source, Object itemId, Object columnId) {
            if (itemId instanceof ModelAttribute) {
                final ModelAttribute obj = (ModelAttribute) itemId;
                if (lastEditItemIds.contains(itemId) && !readOnly) {
                    final ComboBox cbox = new ComboBox();
                    cbox.setNullSelectionAllowed(false);
                    for (DataType dataType : DataType.values()) {
                        cbox.addItem(dataType.name());
                    }
                    cbox.setValue(obj.getType());
                    cbox.addValueChangeListener(new ValueChangeListener() {
                        public void valueChange(ValueChangeEvent event) {
                            obj.setType((String) cbox.getValue());
                            EditModelPanel.this.context.getConfigurationService().save(obj);
                        }
                    });
                    cbox.addBlurListener(new BlurListener() {
                        public void blur(BlurEvent event) {
                            Collection<?> items = treeTable.getItemIds();
                            boolean found = false;
                            for (Object item : items) {
                                if (item.equals(obj)) {
                                    found = true;
                                } else if (found) {
                                    selectOnly(item);
                                    editSelectedItem();
                                    break;
                                }
                            }
                        }
                    });

                    return cbox;
                } else {
                    return obj.getType();
                }
            } else {
                return null;
            }
        }
    });
    treeTable.setColumnHeader("type", "Type");

    treeTable.addGeneratedColumn("pk", new ColumnGenerator() {
        public Object generateCell(Table source, Object itemId, Object columnId) {
            if (itemId instanceof ModelAttribute) {
                final ModelAttribute obj = (ModelAttribute) itemId;
                if (lastEditItemIds.contains(itemId) && !readOnly) {
                    final CheckBox cbox = new CheckBox();
                    cbox.setValue(obj.isPk());
                    cbox.setImmediate(true);
                    cbox.addValueChangeListener(event -> togglePk(obj));
                    cbox.addBlurListener(new BlurListener() {
                        public void blur(BlurEvent event) {
                            Collection<?> items = treeTable.getItemIds();
                            boolean found = false;
                            for (Object item : items) {
                                if (item.equals(obj)) {
                                    found = true;
                                } else if (found) {
                                    selectOnly(item);
                                    editSelectedItem();
                                    break;
                                }
                            }
                        }
                    });

                    return cbox;
                } else if (obj.isPk()) {
                    return new Label(FontAwesome.KEY.getHtml(), ContentMode.HTML);
                }
            }
            return null;
        }
    });
    treeTable.setColumnHeader("pk", "PK");
    treeTable.setColumnWidth("pk", 40);

    treeTable.addItemClickListener(new TreeTableItemClickListener());
    treeTable.addValueChangeListener(new TreeTableValueChangeListener());
    enterKeyListener = new ShortcutListener("Enter", KeyCode.ENTER, null) {
        public void handleAction(Object sender, Object target) {
            lastEditItemIds = Collections.emptySet();
            treeTable.refreshRowCache();
        }
    };

    addComponent(treeTable);
    setExpandRatio(treeTable, 1.0f);

    HorizontalLayout hlayout = new HorizontalLayout();
    addComponent(hlayout);

    Button collapseAll = new Button("Collapse All");
    collapseAll.addStyleName(ValoTheme.BUTTON_LINK);
    collapseAll.addStyleName(ValoTheme.BUTTON_SMALL);
    hlayout.addComponent(collapseAll);
    collapseAll.addClickListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            for (Object itemId : treeTable.getItemIds()) {
                treeTable.setCollapsed(itemId, true);
            }
        }
    });

    Button expandAll = new Button("Expand All");
    expandAll.addStyleName(ValoTheme.BUTTON_LINK);
    expandAll.addStyleName(ValoTheme.BUTTON_SMALL);
    hlayout.addComponent(expandAll);
    expandAll.addClickListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            for (Object itemId : treeTable.getItemIds()) {
                treeTable.setCollapsed(itemId, false);
            }
        }
    });

    addAll("", model.getModelEntities());

    setButtonsEnabled();
}