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:ui.window.PdfWindow.java

public PdfWindow(Integer userId, String language) {
    setCaption("Save CV");
    setSizeFull();/*w  w w .j a va  2 s . co m*/
    setResizable(true);
    setWidth("25%");
    setHeight("25%");
    center();
    PdfUtility pdfUtility = new PdfUtility(userId, language, new DescendingEndComparator(), null, new Date());
    pdfUtility.createPdf();
    StreamResource streamResource = pdfUtility.getStreamResource();
    FileDownloader downloader = new FileDownloader(streamResource);
    LifetimeButtonLink downloadButton = new LifetimeButtonLink("Save CV", FontAwesome.SAVE);
    downloader.extend(downloadButton);
    // Here we create a new StreamResource which downloads our StreamSource,
    // which is our pdf.
    setContent(downloadButton);
}

From source file:uk.co.intec.keyDatesApp.pages.KeyDateView.java

License:Apache License

/**
 * Loads the main content for the page. Only called on first entry to the
 * page, because calling method sets <i>isLoaded</i> to true after
 * successfully completing./*w  ww .j av a  2s  .c  om*/
 */
public void loadContent() {
    getEditForm().setSizeUndefined();
    getEditForm().setWidth("100%");

    getBeanFields().setBuffered(false);
    getBeanFields().setItemDataSource(getCurrDocBean());
    getBeanFields().setFieldFactory(DefaultFieldGroupFieldFactory.get());
    getBeanFields().setReadOnly(getCurrDoc().isReadOnly());

    final TextField t1 = (TextField) getBeanFields().buildAndBind("Title: ", "title");
    t1.setNullRepresentation("");
    t1.setSizeFull();
    t1.setRequired(true);
    t1.setRequiredError("Please enter title");

    final DateField d1 = getBeanFields().buildAndBind("Date: ", "date", DateField.class);
    d1.setRequired(true);
    d1.setRequiredError("Please enter date");
    d1.setRangeStart(getStartDate());
    d1.setRangeEnd(getEndDate());

    final TextArea ta1 = getBeanFields().buildAndBind("Description: ", "description", TextArea.class);
    ta1.setSizeFull();

    setCustomerCombo(new ComboBox("Customer:", KeyDateDatabaseUtils.getCustContainer()));
    getCustomerCombo().setInputPrompt("No Customer Selected");
    getCustomerCombo().setFilteringMode(FilteringMode.STARTSWITH);
    getCustomerCombo().setImmediate(true);
    getCustomerCombo().setNewItemsAllowed(true);
    getCustomerCombo().setInvalidAllowed(false);
    getCustomerCombo().setNullSelectionAllowed(true);
    getCustomerCombo().setPageLength(5);
    getCustomerCombo().setWidth("100%");
    getCustomerCombo().setResponsive(true);
    getBeanFields().bind(getCustomerCombo(), "customer");
    getCustomerCombo().addValueChangeListener(new Property.ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        /*
         * (non-Javadoc)
         *
         * @see
         * com.vaadin.data.Property.ValueChangeListener#valueChange(com.
         * vaadin.data.Property.ValueChangeEvent)
         */
        @Override
        public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) {
            getContactCombo().setContainerDataSource(
                    KeyDateDatabaseUtils.getContactContainer((String) event.getProperty().getValue()));
            getContactCombo().setValue("");
        }
    });

    setContactCombo(new ComboBox("Contact:"));
    getContactCombo().setInputPrompt("No Contact Selected");
    getContactCombo().setFilteringMode(FilteringMode.STARTSWITH);
    getContactCombo().setImmediate(true);
    getContactCombo().setNewItemsAllowed(true);
    getContactCombo().setInvalidAllowed(false);
    getContactCombo().setNullSelectionAllowed(true);
    getContactCombo().setPageLength(5);
    getContactCombo().setWidth("100%");
    getContactCombo().setResponsive(true);
    getBeanFields().bind(getContactCombo(), "contact");

    final HorizontalLayout buttonRow = new HorizontalLayout();
    setSaveButton(new Button("Save"));
    getSaveButton().addStyleName(ValoTheme.BUTTON_PRIMARY);
    getSaveButton().setIcon(FontAwesome.SAVE);
    getSaveButton().setVisible(getCurrDoc().isEditable());
    getSaveButton().addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        /*
         * (non-Javadoc)
         *
         * @see
         * com.vaadin.ui.Button.ClickListener#buttonClick(com.vaadin.ui.
         * Button.ClickEvent)
         */
        @Override
        public void buttonClick(ClickEvent event) {
            getCurrDocBean().saveDocumentWrapper(getCurrDoc());
            getCurrDoc().setEditMode(false);
            getCurrDoc().setReadOnly(true);
            getBeanFields().setReadOnly(true);
            getSaveButton().setVisible(false);
            getEditButton().setVisible(true);
        }
    });

    setEditButton(new Button("Edit"));
    getEditButton().addStyleName(ValoTheme.BUTTON_PRIMARY);
    getEditButton().setIcon(FontAwesome.EDIT);
    getEditButton().setVisible(!getCurrDoc().isEditable());
    getEditButton().addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        /*
         * (non-Javadoc)
         *
         * @see
         * com.vaadin.ui.Button.ClickListener#buttonClick(com.vaadin.ui.
         * Button.ClickEvent)
         */
        @Override
        public void buttonClick(ClickEvent event) {
            getCurrDoc().setEditMode(true);
            getCurrDoc().setReadOnly(false);
            getBeanFields().setReadOnly(false);
            getEditButton().setVisible(false);
            getSaveButton().setVisible(true);
        }
    });

    final Button cancelButton = new Button("Cancel");
    cancelButton.addStyleName(ValoTheme.BUTTON_QUIET);
    cancelButton.setIcon(FontAwesome.UNDO);
    cancelButton.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        /*
         * (non-Javadoc)
         *
         * @see
         * com.vaadin.ui.Button.ClickListener#buttonClick(com.vaadin.ui.
         * Button.ClickEvent)
         */
        @Override
        public void buttonClick(ClickEvent event) {
            MainUI.get().getNavigator().navigateTo(MainView.VIEW_NAME);
        }
    });
    buttonRow.addComponents(getEditButton(), getSaveButton(), cancelButton);

    getEditForm().addComponents(t1, d1, ta1, getCustomerCombo(), getContactCombo(), buttonRow);

    addComponent(editForm);

}

From source file:views.AffiliationVIPTab.java

License:Open Source License

public AffiliationVIPTab(Map<String, Integer> persons, Map<String, Integer> affiliations,
        Map<Integer, Tuple> affiliationPeople) {

    this.affiliationMap = affiliations;
    this.personMap = persons;
    this.personAffiliationsInTable = affiliationPeople;

    affiTabOrgs = new ComboBox("Affiliation", affiliations.keySet());
    affiTabOrgs.setStyleName(ValoTheme.COMBOBOX_SMALL);
    affiTabOrgs.setFilteringMode(FilteringMode.CONTAINS);
    affiTabOrgs.addValueChangeListener(new ValueChangeListener() {

        @Override//from w  w w . j a v  a2 s.c  o  m
        public void valueChange(ValueChangeEvent event) {
            Object val = affiTabOrgs.getValue();
            contact.setVisible(val != null);
            head.setVisible(val != null);
            if (val != null) {
                String affiName = val.toString();
                int id = affiliations.get(affiName);
                Tuple names = personAffiliationsInTable.get(id);
                contact.setValue(names.getOne());
                head.setValue(names.getTwo());
            }
        }
    });

    head = new ComboBox("Head", persons.keySet());
    head.setStyleName(ValoTheme.COMBOBOX_SMALL);
    head.setFilteringMode(FilteringMode.CONTAINS);
    head.setVisible(false);
    contact = new ComboBox("Contact Person", persons.keySet());
    contact.setStyleName(ValoTheme.COMBOBOX_SMALL);
    contact.setFilteringMode(FilteringMode.CONTAINS);
    contact.setVisible(false);
    ValueChangeListener personListener = new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            boolean hasData = head.getValue() != null || contact.getValue() != null;
            commitAffiTabButton.setEnabled(hasData);
        }
    };
    head.addValueChangeListener(personListener);
    contact.addValueChangeListener(personListener);

    commitAffiTabButton = new Button("Save Contact");
    commitAffiTabButton.setEnabled(false);

    addComponent(affiTabOrgs);
    addComponent(head);
    addComponent(contact);
    commitAffiTabButton.setIcon(FontAwesome.SAVE);
    addComponent(Styles.questionize(commitAffiTabButton,
            "Add or change records to the selected people. "
                    + "Existing people can only be replaced by a new selection, empty selections are ignored.",
            "Save Changes"));
}