Example usage for com.vaadin.server FontAwesome CUT

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

Introduction

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

Prototype

FontAwesome CUT

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

Click Source Link

Usage

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

License:Open Source License

protected void buildButtonBar() {
    ButtonBar buttonBar = new ButtonBar();
    addComponent(buttonBar);//w  ww  .j  a  v a 2s  . c  o m
    if (!readOnly) {
        editButton = buttonBar.addButton("Edit Columns", FontAwesome.EDIT);
        editButton.addClickListener(new EditButtonClickListener());
    }
    entityFilterField = buttonBar.addFilter();
    entityFilterField.addTextChangeListener(event -> updateEntityTable(event.getText()));

    if (!readOnly) {
        Button moveUpButton = buttonBar.addButton("Move Up", FontAwesome.ARROW_UP);
        moveUpButton.addClickListener(new MoveUpClickListener());

        Button moveDownButton = buttonBar.addButton("Move Down", FontAwesome.ARROW_DOWN);
        moveDownButton.addClickListener(new MoveDownClickListener());

        Button moveTopButton = buttonBar.addButton("Move Top", FontAwesome.ANGLE_DOUBLE_UP);
        moveTopButton.addClickListener(new MoveTopClickListener());

        Button moveBottomButton = buttonBar.addButton("Move Bottom", FontAwesome.ANGLE_DOUBLE_DOWN);
        moveBottomButton.addClickListener(new MoveBottomClickListener());

        Button cutButton = buttonBar.addButton("Cut", FontAwesome.CUT);
        cutButton.addClickListener(new CutClickListener());

        Button pasteButton = buttonBar.addButton("Paste", FontAwesome.PASTE);
        pasteButton.addClickListener(new PasteClickListener());
    }

    addComponent(buttonBar);
}

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

License:Open Source License

protected void buildUI() {
    if (!readOnly) {
        ButtonBar buttonBar = new ButtonBar();
        addComponent(buttonBar);//from  w  w w. j  a v  a2 s  .co m

        Button moveUpButton = buttonBar.addButton("Move Up", FontAwesome.ARROW_UP);
        moveUpButton.addClickListener(new MoveUpClickListener());

        Button moveDownButton = buttonBar.addButton("Move Down", FontAwesome.ARROW_DOWN);
        moveDownButton.addClickListener(new MoveDownClickListener());

        Button moveTopButton = buttonBar.addButton("Move Top", FontAwesome.ANGLE_DOUBLE_UP);
        moveTopButton.addClickListener(new MoveTopClickListener());

        Button moveBottomButton = buttonBar.addButton("Move Bottom", FontAwesome.ANGLE_DOUBLE_DOWN);
        moveBottomButton.addClickListener(new MoveBottomClickListener());

        Button cutButton = buttonBar.addButton("Cut", FontAwesome.CUT);
        cutButton.addClickListener(new CutClickListener());

        Button pasteButton = buttonBar.addButton("Paste", FontAwesome.PASTE);
        pasteButton.addClickListener(new PasteClickListener());
    }

    table.setContainerDataSource(container);

    table.setSelectable(true);
    table.setSortEnabled(false);
    table.setImmediate(true);
    table.setSizeFull();
    if (component.getType().equals(FixedLengthFormatter.TYPE)
            || component.getType().equals(FixedLengthParser.TYPE)) {
        table.setVisibleColumns(
                new Object[] { "entityName", "attributeName", "width", "startPos", "endPos", "transformText" });
        table.setColumnHeaders(new String[] { "Entity Name", "Attribute Name", "Width", "Start Position",
                "End Position", "Transform" });
        table.setColumnWidth("width", 75);
    } else {
        table.setVisibleColumns(
                new Object[] { "entityName", "attributeName", "ordinalSetting", "transformText" });
        table.setColumnHeaders(new String[] { "Entity Name", "Attribute Name", "Ordinal", "Transform" });
    }
    table.setTableFieldFactory(new EditFieldFactory());
    table.setCellStyleGenerator(new TableCellStyleGenerator());
    table.setEditable(true);
    table.setMultiSelect(true);
    if (!readOnly) {
        table.setDragMode(TableDragMode.MULTIROW);
        table.setDropHandler(new TableDropHandler());
    }
    addComponent(table);
    setExpandRatio(table, 1.0f);

    Model model = component.getInputModel();
    if (component.getType().equals(DelimitedParser.TYPE)
            || component.getType().equals(FixedLengthParser.TYPE)) {
        model = component.getOutputModel();
    }

    if (model != null) {
        model = context.getConfigurationService().findModel(model.getId());
        List<RecordFormat> attributes = new ArrayList<RecordFormat>();

        for (ModelEntity entity : model.getModelEntities()) {
            for (ModelAttribute attr : entity.getModelAttributes()) {
                attributes.add(new RecordFormat(entity, attr));
            }
        }

        Collections.sort(attributes, new Comparator<RecordFormat>() {
            public int compare(RecordFormat o1, RecordFormat o2) {
                return new Integer(o1.getOrdinalSetting()).compareTo(new Integer(o2.getOrdinalSetting()));
            }
        });

        for (RecordFormat recordFormat : attributes) {
            table.addItem(recordFormat);
        }
    }
    calculatePositions();
    saveOrdinalSettings();
    saveLengthSettings();
    saveTransformSettings();
}