Example usage for com.vaadin.server FontAwesome SAVE

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

Introduction

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

Prototype

FontAwesome SAVE

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

Click Source Link

Usage

From source file:com.esofthead.mycollab.vaadin.ui.BuildCriterionComponent.java

License:Open Source License

private void buildSaveFilterBox() {
    filterBox.removeAllComponents();/*  w  w  w . j  av a 2s  . c o  m*/

    final TextField queryTextField = new TextField();
    queryTextField.setWidth("125px");
    filterBox.addComponent(queryTextField);

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

        @Override
        public void buttonClick(ClickEvent event) {
            String queryText = queryTextField.getValue();
            saveSearchCriteria(queryText);
        }
    });
    saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    saveBtn.setIcon(FontAwesome.SAVE);
    filterBox.addComponent(saveBtn);

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

                @Override
                public void buttonClick(ClickEvent event) {
                    buildFilterBox(null);
                }
            });
    cancelBtn.addStyleName(UIConstants.THEME_GRAY_LINK);
    filterBox.addComponent(cancelBtn);
}

From source file:com.esofthead.mycollab.vaadin.ui.EditFormControlsGenerator.java

License:Open Source License

public HorizontalLayout createButtonControls(final boolean isSaveBtnVisible,
        final boolean isSaveAndNewBtnVisible, final boolean isCancelBtnVisible) {
    final HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);/*from w  w w .  j  a  v a  2 s  . c o m*/
    layout.setSizeUndefined();
    layout.setStyleName("addNewControl");

    if (isSaveBtnVisible) {
        final Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        if (EditFormControlsGenerator.this.editForm.validateForm()) {
                            EditFormControlsGenerator.this.editForm.fireSaveForm();
                        }
                    }
                });
        saveBtn.setIcon(FontAwesome.SAVE);
        saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        layout.addComponent(saveBtn);
        layout.setComponentAlignment(saveBtn, Alignment.MIDDLE_CENTER);
    }

    if (isSaveAndNewBtnVisible) {
        final Button saveAndNewBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE_NEW),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        if (EditFormControlsGenerator.this.editForm.validateForm()) {
                            EditFormControlsGenerator.this.editForm.fireSaveAndNewForm();
                        }
                    }
                });
        saveAndNewBtn.setIcon(FontAwesome.SHARE_ALT);
        saveAndNewBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        layout.addComponent(saveAndNewBtn);
        layout.setComponentAlignment(saveAndNewBtn, Alignment.MIDDLE_CENTER);
    }

    if (isCancelBtnVisible) {
        final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        EditFormControlsGenerator.this.editForm.fireCancelForm();
                    }
                });
        cancelBtn.setIcon(FontAwesome.MINUS);
        cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);
        layout.addComponent(cancelBtn);
        layout.setComponentAlignment(cancelBtn, Alignment.MIDDLE_CENTER);
    }

    return layout;
}

From source file:com.esofthead.mycollab.vaadin.ui.MassUpdateWindow.java

License:Open Source License

protected ComponentContainer buildButtonControls() {
    MHorizontalLayout controlsLayout = new MHorizontalLayout().withMargin(true).withStyleName("addNewControl")
            .withWidth("100%");

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

                @Override//from  ww w. ja v  a 2 s  .  c  o m
                public void buttonClick(ClickEvent event) {
                    updateForm.commit();
                    massUpdateCommand.massUpdate(beanItem);
                    MassUpdateWindow.this.close();
                }
            });
    updateBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    updateBtn.setIcon(FontAwesome.SAVE);

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

        @Override
        public void buttonClick(ClickEvent event) {
            MassUpdateWindow.this.close();
        }
    });
    closeBtn.setStyleName(UIConstants.THEME_GRAY_LINK);

    Label spacing = new Label();
    controlsLayout.with(spacing, updateBtn, closeBtn).alignAll(Alignment.MIDDLE_RIGHT).expand(spacing);
    return controlsLayout;
}

From source file:com.esofthead.mycollab.vaadin.ui.table.CustomizedTableWindow.java

License:Open Source License

public CustomizedTableWindow(final String viewId, final AbstractPagedBeanTable<?, ?> table) {
    super("Customize View");
    this.viewId = viewId;
    this.addStyleName("customize-table-window");
    this.setWidth("400px");
    this.setResizable(false);
    this.setModal(true);
    this.center();

    this.tableItem = table;
    customViewStoreService = ApplicationContextUtil.getSpringBean(CustomViewStoreService.class);

    final VerticalLayout contentLayout = new VerticalLayout();
    contentLayout.setSpacing(true);//from  w  w  w .  j  a v a  2s  . com
    contentLayout.setMargin(true);
    this.setContent(contentLayout);

    this.listBuilder = new ListBuilder();
    this.listBuilder.setImmediate(true);
    this.listBuilder.setColumns(0);
    this.listBuilder.setLeftColumnCaption("Available Columns");
    this.listBuilder.setRightColumnCaption("View Columns");
    this.listBuilder.setWidth(100, Sizeable.Unit.PERCENTAGE);

    this.listBuilder.setItemCaptionMode(ItemCaptionMode.EXPLICIT);
    final BeanItemContainer<TableViewField> container = new BeanItemContainer<>(TableViewField.class,
            this.getAvailableColumns());
    this.listBuilder.setContainerDataSource(container);
    Iterator<TableViewField> iterator = getAvailableColumns().iterator();
    while (iterator.hasNext()) {
        TableViewField field = iterator.next();
        this.listBuilder.setItemCaption(field, AppContext.getMessage(field.getDescKey()));
    }
    this.setSelectedViewColumns();
    contentLayout.addComponent(this.listBuilder);
    contentLayout.setComponentAlignment(listBuilder, Alignment.MIDDLE_CENTER);

    Button restoreLink = new Button("Restore to default", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @SuppressWarnings("unchecked")
        @Override
        public void buttonClick(ClickEvent event) {
            List<TableViewField> defaultSelectedColumns = tableItem.getDefaultSelectedColumns();
            if (defaultSelectedColumns != null) {
                final List<TableViewField> selectedColumns = new ArrayList<>();
                final BeanItemContainer<TableViewField> container = (BeanItemContainer<TableViewField>) CustomizedTableWindow.this.listBuilder
                        .getContainerDataSource();
                final Collection<TableViewField> itemIds = container.getItemIds();

                for (TableViewField column : defaultSelectedColumns) {
                    for (final TableViewField viewField : itemIds) {
                        if (column.getField().equals(viewField.getField())) {
                            selectedColumns.add(viewField);
                        }
                    }
                }

                CustomizedTableWindow.this.listBuilder.setValue(selectedColumns);
            }

        }
    });
    restoreLink.setStyleName("link");
    contentLayout.addComponent(restoreLink);
    contentLayout.setComponentAlignment(restoreLink, Alignment.MIDDLE_RIGHT);

    final HorizontalLayout buttonControls = new HorizontalLayout();
    buttonControls.setSpacing(true);
    final Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @SuppressWarnings("unchecked")
                @Override
                public void buttonClick(final ClickEvent event) {
                    final List<TableViewField> selectedColumns = (List<TableViewField>) CustomizedTableWindow.this.listBuilder
                            .getValue();
                    table.setDisplayColumns(selectedColumns);
                    CustomizedTableWindow.this.close();

                    // Save custom table view def
                    CustomViewStore viewDef = new CustomViewStore();
                    viewDef.setSaccountid(AppContext.getAccountId());
                    viewDef.setCreateduser(AppContext.getUsername());
                    viewDef.setViewid(viewId);
                    viewDef.setViewinfo(XStreamJsonDeSerializer.toJson(new ArrayList<>(selectedColumns)));
                    customViewStoreService.saveOrUpdateViewLayoutDef(viewDef);
                }
            });
    saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    saveBtn.setIcon(FontAwesome.SAVE);
    buttonControls.addComponent(saveBtn);

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

                @Override
                public void buttonClick(final ClickEvent event) {
                    CustomizedTableWindow.this.close();
                }
            });
    cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);
    buttonControls.addComponent(cancelBtn);

    contentLayout.addComponent(buttonControls);
    contentLayout.setComponentAlignment(buttonControls, Alignment.MIDDLE_CENTER);
}

From source file:com.esofthead.mycollab.vaadin.web.ui.BuildCriterionComponent.java

License:Open Source License

private void buildSaveFilterBox() {
    filterBox.removeAllComponents();//from  w  ww.j ava2  s  . c  o m

    final TextField queryTextField = new TextField();
    filterBox.addComponent(queryTextField);

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

        @Override
        public void buttonClick(ClickEvent event) {
            String queryText = queryTextField.getValue();
            saveSearchCriteria(queryText);
        }
    });
    saveBtn.setStyleName(UIConstants.BUTTON_ACTION);
    saveBtn.setIcon(FontAwesome.SAVE);
    filterBox.addComponent(saveBtn);

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

                @Override
                public void buttonClick(ClickEvent event) {
                    buildFilterBox(null);
                }
            });
    cancelBtn.addStyleName(UIConstants.BUTTON_OPTION);
    filterBox.addComponent(cancelBtn);
}

From source file:com.esofthead.mycollab.vaadin.web.ui.EditFormControlsGenerator.java

License:Open Source License

public HorizontalLayout createButtonControls(boolean isSaveBtnVisible, boolean isSaveAndNewBtnVisible,
        boolean isCancelBtnVisible) {
    MHorizontalLayout layout = new MHorizontalLayout().withStyleName("addNewControl");
    layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    layout.setSizeUndefined();//ww w . jav a2 s  .  com

    if (isSaveBtnVisible) {
        final Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        if (editForm.validateForm()) {
                            editForm.fireSaveForm();
                        }
                    }
                });
        saveBtn.setIcon(FontAwesome.SAVE);
        saveBtn.setStyleName(UIConstants.BUTTON_ACTION);
        layout.addComponent(saveBtn);
    }

    if (isSaveAndNewBtnVisible) {
        Button saveAndNewBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE_NEW),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        if (editForm.validateForm()) {
                            editForm.fireSaveAndNewForm();
                        }
                    }
                });
        saveAndNewBtn.setIcon(FontAwesome.SHARE_ALT);
        saveAndNewBtn.setStyleName(UIConstants.BUTTON_ACTION);
        layout.addComponent(saveAndNewBtn);
    }

    if (isCancelBtnVisible) {
        Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        editForm.fireCancelForm();
                    }
                });
        cancelBtn.setIcon(FontAwesome.MINUS);
        cancelBtn.setStyleName(UIConstants.BUTTON_OPTION);
        layout.addComponent(cancelBtn);
    }

    return layout;
}

From source file:com.esofthead.mycollab.vaadin.web.ui.MassUpdateWindow.java

License:Open Source License

protected ComponentContainer buildButtonControls() {
    MHorizontalLayout controlsLayout = new MHorizontalLayout().withMargin(true).withFullWidth();

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

                @Override//w w w  . j  av a  2  s . com
                public void buttonClick(ClickEvent event) {
                    updateForm.commit();
                    massUpdateCommand.massUpdate(beanItem);
                    MassUpdateWindow.this.close();
                }
            });
    updateBtn.setStyleName(UIConstants.BUTTON_ACTION);
    updateBtn.setIcon(FontAwesome.SAVE);

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

        @Override
        public void buttonClick(ClickEvent event) {
            MassUpdateWindow.this.close();
        }
    });
    closeBtn.setStyleName(UIConstants.BUTTON_OPTION);

    Label spacing = new Label();
    controlsLayout.with(spacing, closeBtn, updateBtn).alignAll(Alignment.MIDDLE_RIGHT).expand(spacing);
    return controlsLayout;
}

From source file:com.esofthead.mycollab.vaadin.web.ui.table.CustomizedTableWindow.java

License:Open Source License

public CustomizedTableWindow(final String viewId, final AbstractPagedBeanTable<?, ?> table) {
    super(AppContext.getMessage(GenericI18Enum.OPT_CUSTOMIZE_VIEW));
    this.viewId = viewId;
    this.setWidth("400px");
    this.setResizable(false);
    this.setModal(true);
    this.center();

    this.tableItem = table;
    customViewStoreService = AppContextUtil.getSpringBean(CustomViewStoreService.class);

    final MVerticalLayout contentLayout = new MVerticalLayout();
    this.setContent(contentLayout);

    listBuilder = new ListBuilder();
    listBuilder.setImmediate(true);/*from   w  ww.j a  va2 s . c  o m*/
    listBuilder.setColumns(0);
    listBuilder.setLeftColumnCaption(AppContext.getMessage(GenericI18Enum.OPT_AVAILABLE_COLUMNS));
    listBuilder.setRightColumnCaption(AppContext.getMessage(GenericI18Enum.OPT_VIEW_COLUMNS));
    listBuilder.setWidth(100, Sizeable.Unit.PERCENTAGE);
    listBuilder.setItemCaptionMode(ItemCaptionMode.EXPLICIT);
    final BeanItemContainer<TableViewField> container = new BeanItemContainer<>(TableViewField.class,
            this.getAvailableColumns());
    listBuilder.setContainerDataSource(container);
    Iterator<TableViewField> iterator = getAvailableColumns().iterator();
    while (iterator.hasNext()) {
        TableViewField field = iterator.next();
        listBuilder.setItemCaption(field, AppContext.getMessage(field.getDescKey()));
    }
    this.setSelectedViewColumns();
    contentLayout.with(listBuilder).withAlign(listBuilder, Alignment.TOP_CENTER);

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

                @Override
                public void buttonClick(ClickEvent event) {
                    List<TableViewField> defaultSelectedColumns = tableItem.getDefaultSelectedColumns();
                    if (defaultSelectedColumns != null) {
                        final List<TableViewField> selectedColumns = new ArrayList<>();
                        final BeanItemContainer<TableViewField> container = (BeanItemContainer<TableViewField>) listBuilder
                                .getContainerDataSource();
                        final Collection<TableViewField> itemIds = container.getItemIds();

                        for (TableViewField column : defaultSelectedColumns) {
                            for (final TableViewField viewField : itemIds) {
                                if (column.getField().equals(viewField.getField())) {
                                    selectedColumns.add(viewField);
                                }
                            }
                        }

                        listBuilder.setValue(selectedColumns);
                    }

                }
            });
    restoreLink.setStyleName(UIConstants.BUTTON_LINK);
    contentLayout.with(restoreLink).withAlign(restoreLink, Alignment.TOP_RIGHT);

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

                @SuppressWarnings("unchecked")
                @Override
                public void buttonClick(final ClickEvent event) {
                    List<TableViewField> selectedColumns = (List<TableViewField>) listBuilder.getValue();
                    table.setDisplayColumns(selectedColumns);
                    // Save custom table view def
                    CustomViewStore viewDef = new CustomViewStore();
                    viewDef.setSaccountid(AppContext.getAccountId());
                    viewDef.setCreateduser(AppContext.getUsername());
                    viewDef.setViewid(viewId);
                    viewDef.setViewinfo(FieldDefAnalyzer.toJson(new ArrayList<>(selectedColumns)));
                    customViewStoreService.saveOrUpdateViewLayoutDef(viewDef);
                    close();
                }
            });
    saveBtn.setStyleName(UIConstants.BUTTON_ACTION);
    saveBtn.setIcon(FontAwesome.SAVE);

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

                @Override
                public void buttonClick(final ClickEvent event) {
                    close();
                }
            });
    cancelBtn.setStyleName(UIConstants.BUTTON_OPTION);

    MHorizontalLayout buttonControls = new MHorizontalLayout(cancelBtn, saveBtn);
    contentLayout.with(buttonControls).withAlign(buttonControls, Alignment.TOP_RIGHT);
}

From source file:com.esofthead.mycollab.vaadin.web.ui.utils.FormControlsGenerator.java

License:Open Source License

public static final <T> ComponentContainer generateEditFormControls(final AdvancedEditBeanForm<T> editForm,
        boolean isSaveBtnVisible, boolean isSaveAndNewBtnVisible, boolean isCancelBtnVisible) {
    MHorizontalLayout layout = new MHorizontalLayout();

    if (isCancelBtnVisible) {
        Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override//from   w w  w. j  a  v a  2  s . co m
                    public void buttonClick(final Button.ClickEvent event) {
                        editForm.fireCancelForm();
                    }
                });
        cancelBtn.setIcon(FontAwesome.MINUS);
        cancelBtn.setStyleName(UIConstants.BUTTON_OPTION);
        layout.addComponent(cancelBtn);
    }

    if (isSaveAndNewBtnVisible) {
        Button saveAndNewBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE_NEW),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final Button.ClickEvent event) {
                        if (editForm.validateForm()) {
                            editForm.fireSaveAndNewForm();
                        }
                    }
                });
        saveAndNewBtn.setIcon(FontAwesome.SHARE_ALT);
        saveAndNewBtn.setStyleName(UIConstants.BUTTON_ACTION);
        layout.addComponent(saveAndNewBtn);
    }

    if (isSaveBtnVisible) {
        final Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final Button.ClickEvent event) {
                        if (editForm.validateForm()) {
                            editForm.fireSaveForm();
                        }
                    }
                });
        saveBtn.setIcon(FontAwesome.SAVE);
        saveBtn.setStyleName(UIConstants.BUTTON_ACTION);
        layout.addComponent(saveBtn);
    }

    return layout;
}

From source file:com.etest.common.CommonButton.java

public CommonButton(String caption) {
    super(caption);

    setWidth("100%");
    setCaption(caption);/*from  w  w  w.  j a  v  a2  s . c o m*/
    setIcon(FontAwesome.SAVE);
    addStyleName(ValoTheme.BUTTON_PRIMARY);
    addStyleName(ValoTheme.BUTTON_SMALL);
}