Example usage for com.vaadin.server FontAwesome DOWNLOAD

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

Introduction

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

Prototype

FontAwesome DOWNLOAD

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

Click Source Link

Usage

From source file:fr.amapj.view.engine.excelgenerator.LinkCreator.java

License:Open Source License

/**
 * //from   w ww.  j  a  v a  2s  .c  o  m
 * @param generator
 * @param addPrefixTelecharger : si true, on ajoute le libell "Telecharger" devant le nom du fichier
 * @return
 */
static public Link createLink(CoreGenerator generator, boolean addPrefixTelecharger) {
    FileInfoDTO fileInfoDTO = new CoreGeneratorService().getFileInfo(generator);

    String titre = fileInfoDTO.nameToDisplay;
    String fileName = fileInfoDTO.fileName;
    String extension = fileInfoDTO.extension;

    StreamResource streamResource = new StreamResource(new CoreResource(fileInfoDTO.generator),
            fileName + "." + extension);
    streamResource.setCacheTime(1000);

    String lien = addPrefixTelecharger ? "Tlcharger " + titre : titre;
    Link extractFile = new Link(lien, streamResource);
    extractFile.setIcon(FontAwesome.DOWNLOAD);
    extractFile.setTargetName("_blank");

    return extractFile;
}

From source file:fr.amapj.view.engine.excelgenerator.TelechargerPopup.java

License:Open Source License

private void addLink(VerticalLayout contentLayout, FileInfoDTO fileInfoDTO) {
    String titre = fileInfoDTO.nameToDisplay;
    String fileName = fileInfoDTO.fileName;
    String extension = fileInfoDTO.extension;

    StreamResource streamResource = new StreamResource(new CoreResource(fileInfoDTO.generator),
            fileName + "." + extension);
    streamResource.setCacheTime(1000);//from   w ww .j av  a2  s. c  o  m

    Link extractFile = new Link(titre, streamResource);
    extractFile.setIcon(FontAwesome.DOWNLOAD);
    extractFile.setTargetName("_blank");

    contentLayout.addComponent(extractFile);
}

From source file:fr.amapj.view.views.advanced.devtools.PopupAttachementDisplay.java

License:Open Source License

public Link createLink(int pieceNumber, ByteArrayInputStream bais, String fileName) {
    StreamResource streamResource = new StreamResource(() -> bais, fileName);
    streamResource.setCacheTime(1000);/*from www  .  ja  v  a2  s  .  c om*/

    Link extractFile = new Link("Pice " + pieceNumber + " - " + fileName, streamResource);
    extractFile.setIcon(FontAwesome.DOWNLOAD);
    extractFile.setTargetName("_blank");

    return extractFile;
}

From source file:fr.amapj.view.views.advanced.devtools.PopupHtmlToPdf.java

License:Open Source License

private void addFieldSaisie() {
    setStepTitle("Conversion");

    tf = new TextArea("Contenu html");
    tf.setWidth("90%");
    tf.setHeight(10, Unit.CM);/*from www .j  a v a2s.  c o m*/
    tf.setImmediate(true);
    form.addComponent(tf);

    StreamResource streamResource = new StreamResource(new PdfResource(tf), "test.pdf");
    streamResource.setCacheTime(1000);

    Link extractFile = new Link("Tlcharger le pdf", streamResource);
    extractFile.setIcon(FontAwesome.DOWNLOAD);
    extractFile.setTargetName("_blank");

    form.addComponent(extractFile);
}

From source file:life.qbic.components.OfferManagerTab.java

License:Open Source License

/**
 * creates the tab for displaying and modifying the offers in a vaadin grid
 * @return vaadin component/*from w w  w  .  j  a v  a2  s.  co m*/
 * @throws SQLException:
 */
static Component createOfferManagerTab() throws SQLException {

    Database db = qOfferManager.getDb();

    VerticalLayout offerManLayout = new VerticalLayout();
    HorizontalLayout editSettingsLayout = new HorizontalLayout();
    detailsLayout = new VerticalLayout();

    editSettingsLayout.setSpacing(true);
    detailsLayout.setSizeFull();

    ComboBox updateStatus = new ComboBox("Select Status");
    updateStatus.addItem("In Progress");
    updateStatus.addItem("Sent");
    updateStatus.addItem("Accepted");
    updateStatus.addItem("Rejected");

    Button updateButton = new Button("Update");
    updateButton.setIcon(FontAwesome.SPINNER);
    updateButton.setDescription("Click here to update the currently selected offer.");

    Button deleteOfferButton = new Button("Delete");
    deleteOfferButton.setIcon(FontAwesome.TRASH_O);
    deleteOfferButton.setDescription("Click here to delete the currently selected offer.");

    packageGroupComboBox = new ComboBox("Select package group");
    packageGroupComboBox.addItems("All", "Bioinformatics Analysis", "Mass spectrometry", "Project Management",
            "Sequencing", "Other");
    packageGroupComboBox.setValue("All");
    packageGroupComboBox.setNullSelectionAllowed(false);
    packageGroupComboBox
            .setDescription("Click here to select the package group for the packages displayed below.");

    Button exportTableButton = new Button("Export as .csv");
    exportTableButton.setIcon(FontAwesome.DOWNLOAD);
    exportTableButton.setDescription("Click here to export the table as .csv file.");

    editSettingsLayout.addComponent(updateStatus);
    editSettingsLayout.addComponent(updateButton);
    editSettingsLayout.addComponent(deleteOfferButton);
    editSettingsLayout.addComponent(packageGroupComboBox);
    editSettingsLayout.addComponent(exportTableButton);

    editSettingsLayout.setComponentAlignment(updateButton, Alignment.BOTTOM_CENTER);
    editSettingsLayout.setComponentAlignment(deleteOfferButton, Alignment.BOTTOM_CENTER);
    editSettingsLayout.setComponentAlignment(packageGroupComboBox, Alignment.BOTTOM_CENTER);
    editSettingsLayout.setComponentAlignment(exportTableButton, Alignment.BOTTOM_CENTER);

    Button generateOfferButton = new Button("Download offer");
    generateOfferButton.setIcon(FontAwesome.DOWNLOAD);
    generateOfferButton
            .setDescription("Select an offer from the grid then click here to download it as .docx!");
    generateOfferButton.setEnabled(false);

    offerManLayout.setMargin(true);
    offerManLayout.setSpacing(true);
    offerManLayout.setSizeFull();

    TableQuery tq = new TableQuery("offers", DBManager.getDatabaseInstanceAlternative());
    tq.setVersionColumn("OPTLOCK");
    SQLContainer container = new SQLContainer(tq);
    container.setAutoCommit(true);

    offerManagerGrid = new RefreshableGrid(container);

    // add the filters to the grid
    GridCellFilter filter = new GridCellFilter(offerManagerGrid);
    filter.setTextFilter("offer_id", true, true);
    filter.setTextFilter("offer_number", true, false);
    filter.setTextFilter("offer_project_reference", true, false);
    filter.setTextFilter("offer_facility", true, false);
    filter.setTextFilter("offer_name", true, false);
    filter.setTextFilter("offer_description", true, false);
    filter.setDateFilter("offer_date");
    filter.setDateFilter("last_edited");
    filter.setComboBoxFilter("offer_status", Arrays.asList("In Progress", "Sent", "Accepted", "Rejected"));

    offerManagerGrid.setSelectionMode(Grid.SelectionMode.SINGLE);

    addListeners(db, updateStatus, updateButton, deleteOfferButton, generateOfferButton, container,
            exportTableButton);

    offerManagerGrid.getColumn("offer_id").setHeaderCaption("Id").setWidth(100).setEditable(false);
    offerManagerGrid.getColumn("offer_number").setHeaderCaption("Quotation Number").setWidth(200)
            .setEditable(false);
    offerManagerGrid.getColumn("offer_project_reference").setHeaderCaption("Project Reference")
            .setEditable(false);
    offerManagerGrid.getColumn("offer_name").setHeaderCaption("Offer Name").setWidth(200);
    offerManagerGrid.getColumn("offer_facility").setHeaderCaption("Prospect");
    offerManagerGrid.getColumn("offer_description").setHeaderCaption("Description").setWidth(300);
    offerManagerGrid.getColumn("offer_total").setHeaderCaption("Price ()").setEditable(false);
    offerManagerGrid.getColumn("offer_status").setHeaderCaption("Status").setEditable(false);
    offerManagerGrid.getColumn("offer_date").setHeaderCaption("Date").setEditable(false);
    offerManagerGrid.getColumn("last_edited").setHeaderCaption("Last edited").setEditable(false);
    offerManagerGrid.getColumn("added_by").setHeaderCaption("Added by").setEditable(false);

    offerManagerGrid.setColumnOrder("offer_id", "offer_project_reference", "offer_number", "offer_name",
            "offer_description", "offer_total", "offer_facility", "offer_status", "offer_date", "last_edited",
            "added_by");

    offerManagerGrid.removeColumn("discount");
    offerManagerGrid.removeColumn("internal");
    offerManagerGrid.removeColumn("offer_group");
    offerManagerGrid.removeColumn("offer_extra_price");
    offerManagerGrid.removeColumn("offer_price");

    offerManagerGrid.sort("offer_date", SortDirection.DESCENDING);
    offerManagerGrid.setWidth("100%");
    offerManagerGrid.setSelectionMode(Grid.SelectionMode.SINGLE);
    offerManagerGrid.setEditorEnabled(true);

    // add tooltips to the cells
    offerManagerGrid.setCellDescriptionGenerator((Grid.CellDescriptionGenerator) cell -> {
        if (cell.getValue() == null)
            return null;
        return cell.getValue().toString();
    });

    // add tooltips to the header row
    for (Grid.Column column : offerManagerGrid.getColumns()) {
        Grid.HeaderCell cell = offerManagerGrid.getDefaultHeaderRow().getCell(column.getPropertyId());
        String htmlWithTooltip = String.format("<span title=\"%s\">%s</span>", cell.getText(), cell.getText());
        cell.setHtml(htmlWithTooltip);
    }

    offerManLayout.addComponent(offerManagerGrid);
    offerManLayout.addComponent(editSettingsLayout);
    offerManLayout.addComponent(detailsLayout);
    offerManLayout.addComponent(generateOfferButton);

    return offerManLayout;
}

From source file:life.qbic.components.PackageManagerTab.java

License:Open Source License

/**
 * creates the tab for creating new packages
 * @return vaadin component//from w  w w  .  j  av  a 2s .c  o m
 * @throws SQLException:
 */
static Component createPackageManagerTab() throws SQLException {

    Database db = qOfferManager.getDb();

    VerticalLayout packManVerticalLayout = new VerticalLayout();
    packManVerticalLayout.setMargin(true);
    packManVerticalLayout.setSpacing(true);
    packManVerticalLayout.setSizeFull();

    HorizontalLayout packManHorizontalLayout = new HorizontalLayout();
    packManHorizontalLayout.setSpacing(true);

    Button addPackageButton = new Button("New Package");
    addPackageButton.setIcon(FontAwesome.PLUS);
    addPackageButton.setDescription("Click here to add a new package but don't forget to update the details.");

    ComboBox updatePackageGroupComboBox = new ComboBox("Select package group");
    updatePackageGroupComboBox.addItems("Sequencing", "Project Management", "Bioinformatics Analysis",
            "Mass spectrometry", "Other");
    updatePackageGroupComboBox.setDescription(
            "Select a package group for the currently selected package and hit the " + "update button.");

    Button updateSelectedPackageButton = new Button("Update");
    updateSelectedPackageButton.setIcon(FontAwesome.SPINNER);
    updateSelectedPackageButton.setDescription("Click here to update the currently selected package.");

    Button deleteSelectedPackageButton = new Button("Delete");
    deleteSelectedPackageButton.setIcon(FontAwesome.TRASH_O);
    deleteSelectedPackageButton.setDescription("Click here to delete the currently selected package.");

    Button exportTableButton = new Button("Export as .csv");
    exportTableButton.setIcon(FontAwesome.DOWNLOAD);
    exportTableButton.setDescription("Click here to export the table as .csv file.");

    CheckBox calculatePricesAutomaticallyCheckBox = new CheckBox("Auto-calculate external prices");
    calculatePricesAutomaticallyCheckBox
            .setDescription("Click here to enable/disable the automatic calculation of the "
                    + "external prices based on the internal prices.");
    calculatePricesAutomaticallyCheckBox.setValue(true);

    TableQuery tq = new TableQuery("packages", DBManager.getDatabaseInstanceAlternative());
    tq.setVersionColumn("OPTLOCK");

    SQLContainer container = new SQLContainer(tq);
    container.setAutoCommit(true);

    GeneratedPropertyContainer gpcontainer = new GeneratedPropertyContainer(container);

    // create the column holding the offer_ids where the package is being used in
    // TODO: offer_ids currently not in use; since it's extremely slow..
    /*
        gpcontainer.addGeneratedProperty("offer_ids",
            new PropertyValueGenerator<String>() {
              @Override
              public String getValue(Item item, Object itemId,
                         Object propertyId) {
            
    int package_id = (Integer) item.getItemProperty("package_id").getValue();
            
    // query offers_packages for all offer_ids of the current package
    ArrayList<String> offerIds = db.getOfferIdsForPackage(package_id);
            
    return String.join(",", offerIds);
              }
            
              @Override
              public Class<String> getType() {
    return String.class;
              }
            });
    */

    RefreshableGrid packageGrid = new RefreshableGrid(gpcontainer);

    // add the filters to the grid
    GridCellFilter filter = new GridCellFilter(packageGrid);
    filter.setTextFilter("package_id", true, true);
    filter.setTextFilter("package_name", true, false);
    filter.setTextFilter("package_facility", true, false);
    filter.setTextFilter("package_description", true, false);
    filter.setTextFilter("package_group", true, false);
    filter.setTextFilter("package_unit_type", true, false);
    filter.setComboBoxFilter("package_group", Arrays.asList("Bioinformatics Analysis", "Mass spectrometry",
            "Project Management", "Sequencing", "Other"));

    packageGrid.getColumn("package_id").setHeaderCaption("Id").setWidth(100);
    packageGrid.getColumn("package_name").setHeaderCaption("Name");
    packageGrid.getColumn("package_facility").setHeaderCaption("Facility");
    packageGrid.getColumn("package_description").setHeaderCaption("Description").setWidth(300);
    packageGrid.getColumn("package_group").setHeaderCaption("Package Group").setEditable(false);
    packageGrid.getColumn("package_price_internal").setHeaderCaption("Internal Price ()");
    packageGrid.getColumn("package_price_external_academic").setHeaderCaption("Ext. Academical Price ()");
    packageGrid.getColumn("package_price_external_commercial").setHeaderCaption("Ext. Commercial Price ()");
    // TODO: offer_ids currently not in use; since it's extremely slow..
    //packageGrid.getColumn("offer_ids").setHeaderCaption("Offer Id's");
    packageGrid.getColumn("package_unit_type").setHeaderCaption("Unit Type");

    /*
    // TODO: offer_ids currently not in use; since it's extremely slow..
    packageGrid.setColumnOrder("package_id", "package_name", "package_description", "package_group", "package_facility",
        "package_price_internal", "package_price_external_academic", "package_price_external_commercial",
        "package_unit_type", "offer_ids");*/

    packageGrid.setColumnOrder("package_id", "package_name", "package_description", "package_group",
            "package_facility", "package_price_internal", "package_price_external_academic",
            "package_price_external_commercial", "package_unit_type");

    packageGrid.removeColumn("added_by");
    packageGrid.removeColumn("package_grp");
    packageGrid.removeColumn("package_date");
    packageGrid.removeColumn("last_edited");

    packageGrid.sort("package_name", SortDirection.ASCENDING);
    packageGrid.setWidth("100%");
    packageGrid.setSelectionMode(Grid.SelectionMode.SINGLE);
    packageGrid.setEditorEnabled(true);

    addAutomaticPriceCalculation(calculatePricesAutomaticallyCheckBox, container, packageGrid);

    // add tooltips to the cells
    packageGrid.setCellDescriptionGenerator((Grid.CellDescriptionGenerator) cell -> {
        if (cell.getValue() == null)
            return null;
        return cell.getValue().toString();
    });

    // add tooltips to the header row
    for (Grid.Column column : packageGrid.getColumns()) {
        Grid.HeaderCell cell = packageGrid.getDefaultHeaderRow().getCell(column.getPropertyId());
        String htmlWithTooltip = String.format("<span title=\"%s\">%s</span>", cell.getText(), cell.getText());
        cell.setHtml(htmlWithTooltip);
    }

    addListeners(db, addPackageButton, updatePackageGroupComboBox, updateSelectedPackageButton,
            deleteSelectedPackageButton, container, packageGrid, exportTableButton);

    packManHorizontalLayout.addComponent(addPackageButton);
    packManHorizontalLayout.addComponent(updatePackageGroupComboBox);
    packManHorizontalLayout.addComponent(updateSelectedPackageButton);
    packManHorizontalLayout.addComponent(deleteSelectedPackageButton);
    packManHorizontalLayout.addComponent(exportTableButton);
    packManHorizontalLayout.addComponent(calculatePricesAutomaticallyCheckBox);

    packManHorizontalLayout.setComponentAlignment(addPackageButton, Alignment.BOTTOM_CENTER);
    packManHorizontalLayout.setComponentAlignment(updatePackageGroupComboBox, Alignment.MIDDLE_CENTER);
    packManHorizontalLayout.setComponentAlignment(updateSelectedPackageButton, Alignment.BOTTOM_CENTER);
    packManHorizontalLayout.setComponentAlignment(deleteSelectedPackageButton, Alignment.BOTTOM_CENTER);
    packManHorizontalLayout.setComponentAlignment(calculatePricesAutomaticallyCheckBox,
            Alignment.MIDDLE_CENTER);
    packManHorizontalLayout.setComponentAlignment(exportTableButton, Alignment.BOTTOM_CENTER);

    packManVerticalLayout.addComponent(packageGrid);
    packManVerticalLayout.addComponent(packManHorizontalLayout);

    return packManVerticalLayout;
}

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  w w  .  ja  v a  2  s .co m*/

    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();
}

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

License:Open Source License

protected void buildUI() {
    ButtonBar buttonBar = new ButtonBar();
    addComponent(buttonBar);//www . j  av a  2s .c  o m

    Button editButton = buttonBar.addButton("Edit Template", FontAwesome.FILE_CODE_O);
    editButton.addClickListener(new EditTemplateClickListener());

    Button importButton = buttonBar.addButton("Import Template", FontAwesome.DOWNLOAD);
    importButton.addClickListener(new ImportTemplateClickListener());

    filterPopField = new ComboBox();
    filterPopField.addItem(SHOW_ALL);
    filterPopField.addItem(SHOW_POPULATED_ENTITIES);
    filterPopField.setNullSelectionAllowed(false);
    filterPopField.setImmediate(true);
    filterPopField.setValue(SHOW_ALL);
    filterPopField.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        public void valueChange(ValueChangeEvent event) {
            updateTable(filterTextField.getValue(), filterPopField.getValue().equals(SHOW_POPULATED_ENTITIES));
        }
    });
    buttonBar.addRight(filterPopField);

    filterTextField = buttonBar.addFilter();
    filterTextField.addTextChangeListener(this);

    table.setContainerDataSource(container);
    table.setSelectable(true);
    table.setSortEnabled(false);
    table.setImmediate(true);
    table.setSizeFull();
    table.setVisibleColumns(new Object[] { "entityName", "attributeName", "xpath" });
    table.setColumnHeaders(new String[] { "Entity Name", "Attribute Name", "XPath" });
    table.setTableFieldFactory(new EditFieldFactory());
    table.setEditable(true);
    addComponent(table);
    setExpandRatio(table, 1.0f);

    updateTable(null, false);
    saveXPathSettings();
    buildXpathChoices();
}

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

License:Open Source License

protected void buildUI() {
    ButtonBar buttonBar = new ButtonBar();
    addComponent(buttonBar);/*from w w  w. j av a 2 s.c o  m*/

    Button editButton = buttonBar.addButton("Edit Template", FontAwesome.FILE_CODE_O);
    editButton.addClickListener(new EditTemplateClickListener());

    Button importButton = buttonBar.addButton("Import Template", FontAwesome.DOWNLOAD);
    importButton.addClickListener(new ImportTemplateClickListener());

    filterPopField = new ComboBox();
    filterPopField.addItem(SHOW_ALL);
    filterPopField.addItem(SHOW_POPULATED_ENTITIES);
    filterPopField.setNullSelectionAllowed(false);
    filterPopField.setImmediate(true);
    filterPopField.setValue(SHOW_ALL);
    filterPopField.addValueChangeListener(new ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            updateTable(filterTextField.getValue(), filterPopField.getValue().equals(SHOW_POPULATED_ENTITIES));
        }
    });
    buttonBar.addRight(filterPopField);

    filterTextField = buttonBar.addFilter();
    filterTextField.addTextChangeListener(this);

    table.setContainerDataSource(container);
    table.setSelectable(true);
    table.setSortEnabled(false);
    table.setImmediate(true);
    table.setSizeFull();
    table.setVisibleColumns(new Object[] { "entityName", "attributeName", "xpath" });
    table.setColumnHeaders(new String[] { "Entity Name", "Attribute Name", "XPath" });
    table.setTableFieldFactory(new EditFieldFactory());
    table.setEditable(true);
    addComponent(table);
    setExpandRatio(table, 1.0f);

    updateTable(null, false);
    saveXPathSettings();
    buildXpathChoices();
}

From source file:org.jumpmind.vaadin.ui.sqlexplorer.DefaultButtonBar.java

License:Open Source License

protected void populate(MenuBar menuBar) {
    executeAtCursorButton = menuBar.addItem("", FontAwesome.PLAY, new Command() {

        private static final long serialVersionUID = 1L;

        @Override//w ww .j av a  2  s .  c  o  m
        public void menuSelected(MenuItem selectedItem) {
            queryPanel.execute(false);
        }
    });
    executeAtCursorButton.setDescription("Run sql under cursor (CTRL+ENTER)");

    executeScriptButton = menuBar.addItem("", FontAwesome.FORWARD, new Command() {

        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            queryPanel.execute(true);
        }
    });
    executeScriptButton.setDescription("Run as script");

    commitButton = menuBar.addItem("", FontAwesome.ARROW_CIRCLE_O_RIGHT, new Command() {

        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            queryPanel.commit();
        }
    });
    commitButton.setStyleName("green");
    commitButton.setDescription("Commit");
    commitButton.setEnabled(false);

    rollbackButton = menuBar.addItem("", FontAwesome.ARROW_CIRCLE_O_LEFT, new Command() {

        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            queryPanel.rollback();
        }
    });
    rollbackButton.setStyleName("red");
    rollbackButton.setDescription("Rollback");
    rollbackButton.setEnabled(false);

    historyButton = menuBar.addItem("", FontAwesome.SEARCH, new Command() {

        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            new SqlHistoryDialog(settingsProvider, queryPanel).showAtSize(0.6);
        }
    });
    historyButton.setDescription("Sql History");
    historyButton.setEnabled(true);

    MenuItem optionsButton = menuBar.addItem("", FontAwesome.TASKS, null);
    optionsButton.setDescription("Options");

    importButton = optionsButton.addItem("DB Import", FontAwesome.DOWNLOAD, new Command() {

        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            new DbImportDialog(db.getPlatform()).showAtSize(0.6);
        }
    });

    exportButton = optionsButton.addItem("DB Export", FontAwesome.UPLOAD, new Command() {

        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            new DbExportDialog(db.getPlatform(), queryPanel).showAtSize(0.6);
        }
    });

    fillButton = optionsButton.addItem("DB Fill", FontAwesome.BEER, new Command() {

        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            new DbFillDialog(db.getPlatform(), queryPanel).showAtSize(0.6);
        }
    });

    for (IDbMenuItem item : additionalMenuItems) {
        optionsButton.addItem(item.getCaption(), item.getIcon(), item.getCommand());
    }
}