Example usage for com.vaadin.server FontAwesome UNDO

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

Introduction

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

Prototype

FontAwesome UNDO

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

Click Source Link

Usage

From source file:org.eclipse.hawkbit.ui.tenantconfiguration.TenantConfigurationDashboardView.java

License:Open Source License

private HorizontalLayout saveConfigurationButtonsLayout() {

    final HorizontalLayout hlayout = new HorizontalLayout();
    hlayout.setSpacing(true);/*from w ww.j  a va2  s  . co  m*/
    saveConfigurationBtn = SPUIComponentProvider.getButton(UIComponentIdProvider.SYSTEM_CONFIGURATION_SAVE, "",
            "", "", true, FontAwesome.SAVE, SPUIButtonStyleNoBorder.class);
    saveConfigurationBtn.setEnabled(false);
    saveConfigurationBtn.setDescription(i18n.getMessage("configuration.savebutton.tooltip"));
    saveConfigurationBtn.addClickListener(event -> saveConfiguration());
    hlayout.addComponent(saveConfigurationBtn);

    undoConfigurationBtn = SPUIComponentProvider.getButton(UIComponentIdProvider.SYSTEM_CONFIGURATION_CANCEL,
            "", "", "", true, FontAwesome.UNDO, SPUIButtonStyleNoBorder.class);
    undoConfigurationBtn.setEnabled(false);
    undoConfigurationBtn.setDescription(i18n.getMessage("configuration.cancellbutton.tooltip"));
    undoConfigurationBtn.addClickListener(event -> undoConfiguration());
    hlayout.addComponent(undoConfigurationBtn);

    final Link linkToSystemConfigHelp = SPUIComponentProvider.getHelpLink(i18n,
            uiProperties.getLinks().getDocumentation().getSystemConfigurationView());
    hlayout.addComponent(linkToSystemConfigHelp);

    return hlayout;
}

From source file:org.lucidj.browser.BrowserView.java

License:Apache License

private void build_toolbar() {
    current_toolbar = new CssLayout();

    CssLayout local_toolbar = new CssLayout();
    current_toolbar.addComponent(local_toolbar);

    CssLayout navigation = new CssLayout();
    navigation.addStyleName("v-component-group");
    navigation.addStyleName("ui-toolbar-spacer");
    createButton(navigation, "prev-smartbox", FontAwesome.CHEVRON_LEFT, null, ShortcutAction.KeyCode.ARROW_UP,
            ShortcutAction.ModifierKey.CTRL);
    createButton(navigation, "next-smartbox", FontAwesome.CHEVRON_RIGHT, null,
            ShortcutAction.KeyCode.ARROW_DOWN, ShortcutAction.ModifierKey.CTRL);
    local_toolbar.addComponent(navigation);

    createButton(local_toolbar, "save", FontAwesome.SAVE).addStyleName("ui-toolbar-spacer");
    //        createButton (local_toolbar, "test", FontAwesome.MAGIC)
    //            .addStyleName("ui-toolbar-spacer");
    //        createButton (local_toolbar, "test2", FontAwesome.FLASK)
    //                .addStyleName("ui-toolbar-spacer");

    CssLayout edition = new CssLayout();
    edition.addStyleName("v-component-group");
    edition.addStyleName("ui-toolbar-spacer");
    createButton(edition, "undo-cell-edit", FontAwesome.UNDO, "Undo");
    createButton(edition, "redo-cell-edit", FontAwesome.REPEAT, null);
    createButton(edition, "delete-cell", FontAwesome.TRASH_O, null);
    local_toolbar.addComponent(edition);

    CssLayout view_controls = new CssLayout();
    view_controls.addStyleName("v-component-group");
    view_controls.addStyleName("ui-toolbar-spacer");
    createButton(view_controls, VM_NOTEBOOK,
            new ExternalResource("vaadin://~/Browser_libraries/notebook-view.png"));
    createButton(view_controls, VM_SINGLE, new ExternalResource("vaadin://~/Browser_libraries/single-view.png"),
            null, ShortcutAction.KeyCode.INSERT, ShortcutAction.ModifierKey.CTRL);
    local_toolbar.addComponent(view_controls);

    // TODO: CTRL+ENTER => RUN AND SKIP TO NEXT
    // TODO: SELECTION + SHIFT+ENTER => RUN ONLY SELECTED STATEMENTS

    final Button source_view = new Button();
    source_view.setId("output");
    source_view.addStyleName("ui-toolbar-spacer");
    source_view.setHtmlContentAllowed(true);
    String ico = "<path class=\"path1\" d=\"M1088 128h-64v-64c0-35.2-28.8-64-64-64h-896c-35.2 0-64 28.8-64 64v768c0 35.2 28.8 64 64 64h64v64c0 35.2 28.8 64 64 64h896c35.2 0 64-28.8 64-64v-768c0-35.2-28.8-64-64-64zM128 192v640h-63.886c-0.040-0.034-0.082-0.076-0.114-0.116v-767.77c0.034-0.040 0.076-0.082 0.114-0.114h895.77c0.040 0.034 0.082 0.076 0.116 0.116v63.884h-768c-35.2 0-64 28.8-64 64v0zM1088 959.884c-0.034 0.040-0.076 0.082-0.116 0.116h-895.77c-0.040-0.034-0.082-0.076-0.114-0.116v-767.77c0.034-0.040 0.076-0.082 0.114-0.114h895.77c0.040 0.034 0.082 0.076 0.116 0.116v767.768z\"></path>\n"
            + "<path class=\"path2\" d=\"M960 352c0 53.020-42.98 96-96 96s-96-42.98-96-96 42.98-96 96-96 96 42.98 96 96z\"></path>\n"
            + "<path class=\"path3\" d=\"M1024 896h-768v-128l224-384 256 320h64l224-192z\"></path>";
    source_view.setCaption(//from   ww  w .  ja va 2 s .c  om
            "<svg style=\"fill: currentColor; width: 1.5em; margin-top:0.3em;\" viewBox=\"0 0 1152 1024\">"
                    + ico + "</svg>");
    source_view.addStyleName("tiny");
    source_view.addStyleName("toolbar");
    source_view.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            handle_button_click(source_view);
        }
    });
    local_toolbar.addComponent(source_view);

    //        Button output_view = new Button ();
    //        output_view.setHtmlContentAllowed(true);
    //        String ico2 = "<path d=\"M249.649 792.806l-107.776 166.4 11.469 54.426 54.272-11.622 107.725-166.298c-11.469-6.144-22.835-12.698-33.843-19.968-11.162-7.219-21.811-14.95-31.846-22.938zM705.943 734.694c0.717-1.485 1.178-3.123 1.843-4.71 2.714-5.99 5.12-11.981 7.066-18.278 0.307-1.126 0.461-2.253 0.819-3.277 1.997-6.963 3.686-13.824 5.018-20.89 0-0.358 0-0.614 0-1.075 9.984-59.853-7.424-126.618-47.258-186.931l56.832-87.757c65.485 8.346 122.112-8.141 149.35-50.278 47.258-72.858-10.24-194.15-128.256-271.002-118.118-76.902-252.058-80.128-299.213-7.373-27.341 42.189-19.354 100.71 15.002 157.338l-56.934 87.757c-71.117-11.93-139.059-0.819-189.594 32.768-0.307 0.102-0.666 0.205-0.87 0.41-5.888 3.994-11.622 8.397-16.998 13.005-0.87 0.717-1.894 1.382-2.611 2.099-5.018 4.301-9.523 9.114-13.875 13.926-1.024 1.229-2.458 2.304-3.43 3.584-5.427 6.195-10.445 12.749-14.848 19.712-70.861 109.21-10.394 274.483 134.81 369.101 145.306 94.618 320.512 82.637 391.219-26.573 4.454-6.912 8.55-14.131 11.93-21.555zM664.215 224.845c-45.414-29.542-67.584-76.134-49.408-104.243 18.125-28.006 69.683-26.726 114.995 2.816 45.517 29.542 67.482 76.237 49.408 104.243s-69.53 26.726-114.995-2.816z\"></path>";
    //        output_view.setCaption("<svg style=\"fill: currentColor; width: 1.5em; margin-top:0.3em;\" viewBox=\"0 0 1024 1024\">" + ico2 + "</svg>");
    //        output_view.addStyleName("tiny");
    //        view_controls.addComponent (output_view);
    //
    //        Button run = new Button ();
    //        run.setHtmlContentAllowed(true);
    //        String ico3 = "<path class=\"path1\" d=\"M192 128l640 384-640 384z\"></path>";
    //        run.setCaption("<svg style=\"fill: currentColor; width: 1.5em; margin-top:0.3em;\" viewBox=\"0 0 1024 1024\">" + ico3 + "</svg>");
    //        run.addStyleName("tiny");
    //        view_controls.addComponent (run);

}

From source file:uicomponents.PoolingTable.java

License:Open Source License

private boolean moveSampleToPool(Table source, Object itemId) {
    boolean added = false;
    final Integer id = (Integer) source.getItem(itemId).getItemProperty("ID").getValue();
    String name = (String) source.getItem(itemId).getItemProperty("Secondary Name").getValue();
    String labID = (String) source.getItem(itemId).getItemProperty("Lab ID").getValue();
    final List<Object> row = new ArrayList<Object>();
    row.add(id);//from w  w w . j  a  v a 2 s  .  c o  m
    row.add(name);
    row.add(labID);
    for (String label : labels) {
        String value = (String) source.getItem(itemId).getItemProperty(label).getValue();
        row.add(value);
    }
    if (!poolIDs.contains(id)) {
        added = true;
        poolIDs.add(id);
        Button delete = new Button();
        Styles.iconButton(delete, FontAwesome.UNDO);
        delete.setData(itemId);
        delete.addClickListener(new Button.ClickListener() {
            /**
            * 
            */
            private static final long serialVersionUID = 5414603256990177472L;

            @Override
            public void buttonClick(ClickEvent event) {
                Integer iid = (Integer) event.getButton().getData();
                poolIDs.remove(id);
                poolTable.removeItem(iid);
                resizeTable();
                int newNumUsed = usedTimes.get(id) - 1;
                if (newNumUsed == 0) {
                    usedTimes.remove(id);
                    used.removeItem(iid);
                    all.addItem(row.toArray(), iid);
                    all.sort(new Object[] { "ID" }, new boolean[] { true });
                } else
                    usedTimes.put(id, newNumUsed);
            }
        });
        poolTable.addItem(new Object[] { id, name, labID, delete }, itemId);
        if (usedTimes.containsKey(id)) {
            int newNumUsed = usedTimes.get(id) + 1;
            usedTimes.put(id, newNumUsed);
        } else {
            usedTimes.put(id, 1);
            all.removeItem(itemId);
            used.addItem(row.toArray(), itemId);
            used.sort(new Object[] { "ID" }, new boolean[] { true });
        }
    }
    return added;
}

From source file:uicomponents.SummaryTable.java

License:Open Source License

public void initTable(List<AOpenbisSample> samples, LabelingMethod labelingMethod) {
    if (labelingMethod != null) {
        this.labelingMethod = labelingMethod;
        isotopes = true;// w  ww .ja v a  2s  .com
    }
    table.setStyleName(Styles.tableTheme);
    // table.addContainerProperty("ID", String.class, null);
    // table.setColumnWidth("ID", 35);
    table.addContainerProperty("Secondary Name", TextField.class, null);
    table.addContainerProperty("External DB ID", TextField.class, null);
    table.setColumnWidth("External DB ID", 106);
    table.setImmediate(true);
    table.setCaption(samples.size() + " " + name);

    if (isotopes)
        table.addContainerProperty(labelingMethod.getName(), ComboBox.class, null);

    List<String> factorLabels = new ArrayList<String>();
    int maxCols = 0;
    AOpenbisSample mostInformative = samples.get(0);
    for (AOpenbisSample s : samples) {
        int size = s.getFactors().size();
        if (size > maxCols) {
            maxCols = size;
            mostInformative = s;
        }
    }
    List<Property> factors = mostInformative.getFactors();
    for (int i = 0; i < factors.size(); i++) {
        String l = factors.get(i).getLabel();

        int j = 2;
        while (factorLabels.contains(l)) {
            l = factors.get(i).getLabel() + " (" + Integer.toString(j) + ")";
            j++;
        }
        factorLabels.add(l);
        table.addContainerProperty(l, String.class, null);
    }

    table.addContainerProperty("Customize", Button.class, null);
    table.setColumnWidth("Customize", 85);

    List<String> reagents = null;
    if (isotopes)
        reagents = labelingMethod.getReagents();
    int i = -1;
    for (AOpenbisSample s : samples) {
        i++;
        // AOpenbisSample s = samples.get(i);
        // Obje id = Integer.toString(i);
        // map.put(id, s);

        // The Table item identifier for the row.
        // Integer itemId = new Integer(i);

        // Create a button and handle its click.
        Button delete = new Button();
        Styles.iconButton(delete, FontAwesome.TRASH_O);
        // delete.setWidth("15px");
        // delete.setHeight("30px");
        delete.setData(s);
        delete.addClickListener(new Button.ClickListener() {
            /**
             * 
             */
            private static final long serialVersionUID = 5414603256990177472L;

            @Override
            public void buttonClick(ClickEvent event) {
                Button b = event.getButton();
                Object iid = b.getData();
                TextField secNameField = (TextField) table.getItem(iid).getItemProperty("Secondary Name")
                        .getValue();
                TextField extIDField = (TextField) table.getItem(iid).getItemProperty("External DB ID")
                        .getValue();
                if (secNameField.getValue().equals("DELETED")) {
                    secNameField.setReadOnly(false);
                    extIDField.setReadOnly(false);

                    // String id = (String) table.getItem(iid).getItemProperty("ID").getValue();
                    secNameField.setValue(s.getQ_SECONDARY_NAME());
                    extIDField.setValue(s.getQ_EXTERNALDB_ID());

                    b.setIcon(FontAwesome.TRASH_O);
                } else {
                    secNameField.setValue("DELETED");
                    secNameField.setReadOnly(true);
                    extIDField.setValue("DELETED");
                    extIDField.setReadOnly(true);
                    b.setIcon(FontAwesome.UNDO);
                }
            }
        });

        // Create the table row.
        List<Object> row = new ArrayList<Object>();

        TextField secNameField = new StandardTextField();
        secNameField.setImmediate(true);
        String secName = "";
        if (s.getQ_SECONDARY_NAME() != null)
            secName = s.getQ_SECONDARY_NAME();
        secNameField.setValue(secName);
        row.add(secNameField);

        TextField extIDField = new StandardTextField();
        extIDField.setWidth("95px");
        extIDField.setImmediate(true);
        String extID = "";
        if (s.getQ_EXTERNALDB_ID() != null)
            extID = s.getQ_EXTERNALDB_ID();
        extIDField.setValue(extID);
        row.add(extIDField);

        if (isotopes) {
            ComboBox cb = new ComboBox();
            cb.setImmediate(true);
            cb.addItems(reagents);
            cb.select(reagents.get(i % reagents.size()));
            row.add(cb);
        }
        int missing = maxCols - s.getFactors().size();
        for (Property f : s.getFactors()) {
            String v = f.getValue();
            if (f.hasUnit())
                v += " " + f.getUnit();
            row.add(v);
        }
        for (int j = 0; j < missing; j++)
            row.add("");
        row.add(delete);
        table.addItem(row.toArray(new Object[row.size()]), s);
    }
}

From source file:uicomponents.WizardUploadsPanel.java

License:Open Source License

private void addListeners() {

    context.addValueChangeListener(new ValueChangeListener() {

        @Override//  www.  j a  v a2s. c o  m
        public void valueChange(ValueChangeEvent event) {
            add.setVisible(current != null);
        }
    });

    add.addClickListener(new ClickListener() {

        @SuppressWarnings("unchecked")
        @Override
        public void buttonClick(ClickEvent event) {
            Button delete = new Button();
            Styles.iconButton(delete, FontAwesome.UNDO);

            Object itemId = toUpload.addItem();

            delete.setData(itemId);
            String secondary = fileInfo.getValue();
            String cntxt = (String) context.getValue();
            attachments.put(itemId, new AttachmentInformation(current.getName(), secondary, userID,
                    getBarcode(cntxt), cntxt, cntxt));

            delete.addClickListener(new Button.ClickListener() {
                /**
                * 
                */
                private static final long serialVersionUID = 5414603256990177472L;

                @Override
                public void buttonClick(ClickEvent event) {
                    Integer iid = (Integer) event.getButton().getData();
                    toUpload.removeItem(iid);
                    attachments.remove(iid);
                    tableChanged();
                }
            });
            toUpload.getContainerProperty(itemId, "Info").setValue(secondary);
            toUpload.getContainerProperty(itemId, "Context").setValue(cntxt);
            toUpload.getContainerProperty(itemId, "Remove").setValue(delete);
            tableChanged();
            add.setVisible(false);
            fileInfo.setVisible(false);
            context.setVisible(false);
        }

        private String getBarcode(String choice) {
            if (choice.equals("General Infos"))
                return project + "000";
            else
                return project + choice.split(" ")[0];
        }
    });
}

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./*from www . j a v  a  2 s  . 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);

}