Java 类com.vaadin.ui.Table.TableDragMode 实例源码

项目:incubator-openaz    文件:PolicyEditor.java   
protected void resetComponents() {
    if (this.isReadOnly()) {
        this.checkBoxAutoSave.setEnabled(false);
        this.buttonSave.setEnabled(false);
        this.tree.setDragMode(TableDragMode.NONE);
        this.tree.removeAllActionHandlers();
        this.tree.setReadOnly(true);
    } else {
        this.checkBoxAutoSave.setEnabled(true);
        this.buttonSave.setEnabled(this.isModified);
        this.tree.setReadOnly(false);
        this.tree.setDragMode(TableDragMode.ROW);
        this.installTreeActionHandler();
    }
}
项目:hawkbit    文件:ArtifactDetailsLayout.java   
private void createArtifactDetailsMaxView() {

        artifactDetailsTable.setValue(null);
        artifactDetailsTable.setSelectable(false);
        artifactDetailsTable.setMultiSelect(false);
        artifactDetailsTable.setDragMode(TableDragMode.NONE);
        artifactDetailsTable.setColumnCollapsingAllowed(true);
        artifactUploadState.setArtifactDetailsMaximized(Boolean.TRUE);
        eventBus.publish(this, ArtifactDetailsEvent.MAXIMIZED);
    }
项目:metl    文件:EditDeduperPanel.java   
protected void buildEntityTable() {
    entityTable.setContainerDataSource(entitySettingsContainer);
    entityTable.setSelectable(true);
    entityTable.setSortEnabled(false);
    entityTable.setImmediate(true);
    entityTable.setSizeFull();
    entityTable.addGeneratedColumn("entityName", new ColumnGenerator() {
        private static final long serialVersionUID = 1L;
        @Override
        public Object generateCell(Table source, Object itemId, Object columnId) {
            EntitySettings setting = (EntitySettings) itemId;
            Model model = component.getInputModel();
            ModelEntity entity = model.getEntityById(setting.getEntityId());
            return UiUtils.getName(entityFilterField.getValue(), entity.getName());
        }
    });
    entityTable.setVisibleColumns(new Object[] { "entityName" });
    entityTable.setColumnWidth("entityName", 250);
    entityTable.setColumnHeaders(new String[] { "Entity Name" });
    entityTable.setColumnExpandRatio("entityName", 1);
    entityTable.setTableFieldFactory(new EditEntityFieldFactory());
    entityTable.setEditable(true);
    entityTable.setMultiSelect(true);
    entityTable.setDragMode(TableDragMode.MULTIROW);
    entityTable.setDropHandler(new TableDropHandler());
    entityTable.setCellStyleGenerator(new TableCellStyleGenerator());
    addComponent(entityTable);        
    setExpandRatio(entityTable, 1.0f);
}
项目:metl    文件:EditDataDiffPanel.java   
protected void buildEntityTable() {
    entityTable.setContainerDataSource(entitySettingsContainer);
    entityTable.setSelectable(true);
    entityTable.setSortEnabled(false);
    entityTable.setImmediate(true);
    entityTable.setSizeFull();
    entityTable.addGeneratedColumn("entityName", new ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public Object generateCell(Table source, Object itemId, Object columnId) {
            EntitySettings setting = (EntitySettings) itemId;
            Model model = component.getInputModel();
            ModelEntity entity = model.getEntityById(setting.getEntityId());
            return UiUtils.getName(entityFilterField.getValue(), entity.getName());
        }
    });
    entityTable.setVisibleColumns(new Object[] { "entityName", "addEnabled", "updateEnabled", "deleteEnabled" });
    entityTable.setColumnWidth("entityName", 250);
    entityTable.setColumnHeaders(new String[] { "Entity Name", "Add Enabled", "Chg Enabled", "Del Enabled" });
    entityTable.setColumnExpandRatio("entityName", 1);
    entityTable.setTableFieldFactory(new EditEntityFieldFactory());
    entityTable.setEditable(true);
    entityTable.setMultiSelect(true);
    if (!readOnly) {
        entityTable.setDragMode(TableDragMode.MULTIROW);
        entityTable.setDropHandler(new TableDropHandler());
    }
    entityTable.setCellStyleGenerator(new TableCellStyleGenerator());
    addComponent(entityTable);
    setExpandRatio(entityTable, 1.0f);
}
项目:XACML    文件:PolicyEditor.java   
protected void resetComponents() {
    if (this.isReadOnly()) {
        this.checkBoxAutoSave.setEnabled(false);
        this.buttonSave.setEnabled(false);
        this.tree.setDragMode(TableDragMode.NONE);
        this.tree.removeAllActionHandlers();
        this.tree.setReadOnly(true);
    } else {
        this.checkBoxAutoSave.setEnabled(true);
        this.buttonSave.setEnabled(this.isModified);
        this.tree.setReadOnly(false);
        this.tree.setDragMode(TableDragMode.ROW);
        this.installTreeActionHandler();
    }
}
项目:konekti    文件:AvailableModulesComponent.java   
private void buildMainLayout() {

        availableModuleTable = new Table();
        availableModuleTable.setWidth("450px");
        availableModuleTable.setHeight("100%");
        availableModuleTable.setDragMode(TableDragMode.ROW);
    }
项目:vaadin-vertx-samples    文件:TransactionsView.java   
private Table buildTable() {
    final Table table = new Table() {
        @Override
        protected String formatPropertyValue(final Object rowId,
                final Object colId, final Property<?> property) {
            String result = super.formatPropertyValue(rowId, colId,
                    property);
            if (colId.equals("time")) {
                result = DATEFORMAT.format(((Date) property.getValue()));
            } else if (colId.equals("price")) {
                if (property != null && property.getValue() != null) {
                    return "$" + DECIMALFORMAT.format(property.getValue());
                } else {
                    return "";
                }
            }
            return result;
        }
    };
    table.setSizeFull();
    table.addStyleName(ValoTheme.TABLE_BORDERLESS);
    table.addStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES);
    table.addStyleName(ValoTheme.TABLE_COMPACT);
    table.setSelectable(true);

    table.setColumnCollapsingAllowed(true);
    table.setColumnCollapsible("time", false);
    table.setColumnCollapsible("price", false);

    table.setColumnReorderingAllowed(true);
    table.setContainerDataSource(new TempTransactionsContainer(DashboardUI
            .getDataProvider().getRecentTransactions(200)));
    table.setSortContainerPropertyId("time");
    table.setSortAscending(false);

    table.setColumnAlignment("seats", Align.RIGHT);
    table.setColumnAlignment("price", Align.RIGHT);

    table.setVisibleColumns("time", "country", "city", "theater", "room",
            "title", "seats", "price");
    table.setColumnHeaders("Time", "Country", "City", "Theater", "Room",
            "Title", "Seats", "Price");

    table.setFooterVisible(true);
    table.setColumnFooter("time", "Total");

    table.setColumnFooter(
            "price",
            "$"
                    + DECIMALFORMAT.format(DashboardUI.getDataProvider()
                            .getTotalSum()));

    // Allow dragging items to the reports menu
    table.setDragMode(TableDragMode.MULTIROW);
    table.setMultiSelect(true);

    table.addActionHandler(new TransactionsActionHandler());

    table.addValueChangeListener(new ValueChangeListener() {
        @Override
        public void valueChange(final ValueChangeEvent event) {
            if (table.getValue() instanceof Set) {
                Set<Object> val = (Set<Object>) table.getValue();
                createReport.setEnabled(val.size() > 0);
            }
        }
    });
    table.setImmediate(true);

    return table;
}
项目:metl    文件:EditFlowSettingsDialog.java   
public EditFlowSettingsDialog(ApplicationContext context, Flow flow, boolean readOnly) {
    super("Flow Settings");
    this.context = context;
    this.flow = flow;

    Button closeButton = new Button("Close");
    closeButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
    closeButton.addClickListener(new CloseClickListener());

    addHeader("General Settings");

    FormLayout formLayout = new FormLayout();
    formLayout.setMargin(true);
    formLayout.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    formLayout.setWidth(100, Unit.PERCENTAGE);
    addComponent(formLayout);

    ImmediateUpdateTextArea description = new ImmediateUpdateTextArea("Notes") {
        protected void save(String text) {
            flow.setNotes(text);
            context.getConfigurationService().save(flow);
        };
    };
    description.setValue(flow.getNotes());
    formLayout.addComponent(description);

    addHeader("Parameters");

    if (!readOnly) {
        ButtonBar buttonBar = new ButtonBar();
        buttonBar.addButton("Add", FontAwesome.PLUS, new AddClickListener());
        insertButton = buttonBar.addButton("Insert", FontAwesome.CHEVRON_RIGHT, new InsertClickListener());
        insertButton.setEnabled(false);
        removeButton = buttonBar.addButton("Remove", FontAwesome.TRASH_O, new RemoveClickListener());
        removeButton.setEnabled(false);
        addComponent(buttonBar);
    }

    VerticalLayout tableWrapperLayout = new VerticalLayout();
    tableWrapperLayout.setMargin(true);
    tableWrapperLayout.setSizeFull();

    table = new Table();
    table.setSizeFull();
    container = new BeanItemContainer<FlowParameter>(FlowParameter.class);
    table.setContainerDataSource(container);
    table.setSelectable(true);
    table.setSortEnabled(false);
    if (!readOnly) {
        table.setEditable(true);
        table.setDragMode(TableDragMode.ROW);
        table.setDropHandler(new TableDropHandler());
        table.setTableFieldFactory(new EditFieldFactory());
        table.addValueChangeListener(this);
    }
    table.setVisibleColumns("position", "name", "defaultValue");
    table.setColumnHeaders("#", "Name", "Default Value");
    table.setColumnExpandRatio("name", .3f);
    table.setColumnExpandRatio("defaultValue", .6f);
    tableWrapperLayout.addComponent(table);

    addComponent(tableWrapperLayout, 1);

    addComponent(buildButtonFooter(closeButton));

    List<FlowParameter> params = flow.getFlowParameters();
    Collections.sort(params, new Comparator<FlowParameter>() {
        public int compare(FlowParameter o1, FlowParameter o2) {
            return new Integer(o1.getPosition()).compareTo(new Integer(o2.getPosition()));
        }
    });

    for (FlowParameter flowParameter : params) {
        table.addItem(flowParameter);
    }
}
项目:metl    文件:EditExcelWriterPanel.java   
protected void buildUI() {
    ButtonBar buttonBar = new ButtonBar();
    if (!readOnly) {
        addComponent(buttonBar);

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

    buttonBar.addButtonRight("Export", FontAwesome.DOWNLOAD, (e)->export());

    table.setContainerDataSource(container);

    table.setSelectable(true);
    table.setSortEnabled(false);
    table.setImmediate(true);
    table.setSizeFull();
    table.setVisibleColumns(new Object[] { "entityName", "attributeName", "ordinalSetting" });
    table.setColumnHeaders(new String[] { "Entity Name", "Attribute Name", "Ordinal" });
    table.setCellStyleGenerator(new TableCellStyleGenerator());
    table.setEditable(false);
    table.setMultiSelect(true);
    if (!readOnly) {
        table.setDragMode(TableDragMode.MULTIROW);
        table.setDropHandler(new TableDropHandler());
    }
    addComponent(table);
    setExpandRatio(table, 1.0f);

    Model model = component.getInputModel();

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

        for (ModelEntity entity : model.getModelEntities()) {
            for (ModelAttrib 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();
}
项目:metl    文件:EditFormatPanel.java   
protected void buildUI() {
    ButtonBar buttonBar = new ButtonBar();
    if (!readOnly) {
        addComponent(buttonBar);

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

    buttonBar.addButtonRight("Export", FontAwesome.DOWNLOAD, (e)->export());

    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 (ModelAttrib 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();
}
项目:VaadinUtils    文件:SearchableSelectableEntityTable.java   
public void setDragMode(TableDragMode mode)
{
    selectableTable.setDragMode(mode);
}
项目:VaadinUtils    文件:EntityList.java   
public void setDragMode(TableDragMode row);