• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Table类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.haulmont.cuba.gui.components.Table的典型用法代码示例。如果您正苦于以下问题:Java Table类的具体用法?Java Table怎么用?Java Table使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Table类属于com.haulmont.cuba.gui.components包,在下文中一共展示了Table类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: TreeTableModelAdapter

import com.haulmont.cuba.gui.components.Table; //导入依赖的package包/类
public TreeTableModelAdapter(JXTreeTable treeTable, HierarchicalDatasource datasource, List<Table.Column> columns,
                             boolean autoRefresh) {

    this.treeTable = treeTable;
    this.treeDelegate = createTreeModelAdapter(datasource, autoRefresh);
    this.tableDelegate = new TableModelAdapter(datasource, columns, autoRefresh);

    collectionChangeListener = e -> {
        Object root1 = getRoot();
        // Fixes #1160
        JXTreeTableExt impl = (JXTreeTableExt) TreeTableModelAdapter.this.treeTable;
        impl.setAutoCreateColumnsFromModel(false);
        impl.backupExpandedNodes();

        for (DataChangeListener changeListener : changeListeners) {
            changeListener.beforeChange(true);
        }

        modelSupport.fireTreeStructureChanged(root1 == null ? null : new TreePath(root1));
    };
    //noinspection unchecked
    datasource.addCollectionChangeListener(new WeakCollectionChangeListener(datasource, collectionChangeListener));
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:24,代码来源:TreeTableModelAdapter.java


示例2: init

import com.haulmont.cuba.gui.components.Table; //导入依赖的package包/类
@Override
public void init(final Map<String, Object> params) {
    timeEntriesTable.setStyleProvider(new Table.StyleProvider<TimeEntry>() {
        @Nullable
        @Override
        public String getStyleName(TimeEntry entity, String property) {
            if ("status".equals(property)) {
                return ComponentsHelper.getTimeEntryStatusStyle(entity);
            }
            return null;
        }
    });

    timeEntriesTable.addAction(new CreateAction(timeEntriesTable) {
        @Override
        public Map<String, Object> getInitialValues() {
            Map<String, Object> initialValues = new HashMap<>();
            initialValues.put("task", params.get("task"));
            initialValues.put("user", params.get("user"));
            initialValues.put("date", params.get("date"));
            return initialValues;
        }
    });
}
 
开发者ID:cuba-platform,项目名称:sample-timesheets,代码行数:25,代码来源:TimeEntryLookup.java


示例3: paintAdditionalData

import com.haulmont.cuba.gui.components.Table; //导入依赖的package包/类
@Override
protected void paintAdditionalData(PaintTarget target) throws PaintException {
    if (reqFirstRowToPaint == -1 && items instanceof AggregationContainer && isAggregatable()
            && !((AggregationContainer) items).getAggregationPropertyIds().isEmpty() && isShowTotalAggregation()
            && Table.AggregationStyle.TOP.equals(getAggregationStyle())) {
        paintAggregationRow(target, ((AggregationContainer) items).aggregate(new Context(items.getItemIds())));
    }

    // paint cuba-ids

    AppUI current = AppUI.getCurrent();
    if (current != null && current.isTestMode()) {
        ArrayList<String> visibleColOrder = new ArrayList<>();
        for (Object columnId : visibleColumns) {
            if (!isColumnCollapsed(columnId)) {
                visibleColOrder.add(columnId.toString());
            }
        }
        target.addAttribute("colcubaids", visibleColOrder.toArray());
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:22,代码来源:CubaTreeTable.java


示例4: paintAdditionalData

import com.haulmont.cuba.gui.components.Table; //导入依赖的package包/类
@Override
protected void paintAdditionalData(PaintTarget target) throws PaintException {
    if (reqFirstRowToPaint == -1) {
        boolean hasAggregation = items instanceof AggregationContainer && isAggregatable()
                && !((AggregationContainer) items).getAggregationPropertyIds().isEmpty();

        if (hasAggregation && isShowTotalAggregation()
                && Table.AggregationStyle.TOP.equals(getAggregationStyle())) {
            Context context = new Context(getAggregationItemIds());
            paintAggregationRow(target, ((AggregationContainer) items).aggregate(context));
        }
    }

    // paint cuba-ids

    AppUI current = AppUI.getCurrent();
    if (current != null && current.isTestMode()) {
        ArrayList<String> visibleColOrder = new ArrayList<>();
        for (Object columnId : visibleColumns) {
            if (!isColumnCollapsed(columnId)) {
                visibleColOrder.add(columnId.toString());
            }
        }
        target.addAttribute("colcubaids", visibleColOrder.toArray());
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:27,代码来源:CubaTable.java


示例5: beforeClientResponse

import com.haulmont.cuba.gui.components.Table; //导入依赖的package包/类
@Override
public void beforeClientResponse(boolean initial) {
    super.beforeClientResponse(initial);

    updateClickableColumnKeys();
    updateColumnDescriptions();
    updateAggregatableTooltips();

    if (isAggregatable()) {
        if (Table.AggregationStyle.BOTTOM.equals(getAggregationStyle())) {
            updateFooterAggregation();
        }
    }

    if (focusColumn != null) {
        setCurrentPageFirstItemId(focusItem);
        getRpcProxy(CubaTableClientRpc.class).requestFocus(itemIdMapper.key(focusItem), columnIdMap.key(focusColumn));

        focusColumn = null;
        focusItem = null;
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:23,代码来源:CubaTable.java


示例6: createStyleGenerator

import com.haulmont.cuba.gui.components.Table; //导入依赖的package包/类
@Override
protected StyleGeneratorAdapter createStyleGenerator() {
    return new StyleGeneratorAdapter(){
        @Override
        public String getStyle(com.vaadin.ui.Table source, Object itemId, Object propertyId) {
            if (!component.getGroupProperties().contains(propertyId)) {
                return super.getStyle(source, itemId, propertyId);
            }

            if (styleProviders != null) {
                return getGeneratedCellStyle(itemId, propertyId);
            }
            return null;
        }
    };
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:17,代码来源:WebGroupTable.java


示例7: __handleAggregationResults

import com.haulmont.cuba.gui.components.Table; //导入依赖的package包/类
@Override
protected Map<Object, Object> __handleAggregationResults(AggregationContainer.Context context, Map<Object, Object> results) {
    if (context instanceof CubaGroupTable.GroupAggregationContext) {
        CubaGroupTable.GroupAggregationContext groupContext = (CubaGroupTable.GroupAggregationContext) context;

        for (final Map.Entry<Object, Object> entry : results.entrySet()) {
            final Table.Column column = columns.get(entry.getKey());
            GroupAggregationCells cells;
            if ((cells = groupAggregationCells.get(column)) != null) {
                String value = cells.getValue(groupContext.getGroupId());
                String cellText = getFormattedValue(column, value);
                entry.setValue(cellText);

                String groupValue = cells.getValue(groupContext.getGroupId());
                if (groupValue != null) {
                    String groupCellText = getFormattedValue(column, groupValue);
                    entry.setValue(groupCellText);
                }
            }
        }

        return results;
    } else {
        return super.__handleAggregationResults(context, results);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:27,代码来源:WebGroupTable.java


示例8: __fillGroupAggregationCells

import com.haulmont.cuba.gui.components.Table; //导入依赖的package包/类
protected void __fillGroupAggregationCells(Object groupId, Map<Table.Column, GroupAggregationCells> cells) {
    final Set<Table.Column> aggregatableColumns = aggregationCells.keySet();

    for (final Column column : aggregatableColumns) {
        if (!columns.get(getGroupProperty(groupId)).equals(column)) {
            GroupAggregationCells groupCells = cells.get(column);
            if (groupCells == null) {
                groupCells = new GroupAggregationCells();
                cells.put(column, groupCells);
            }
            groupCells.addCell(groupId, "");
        }
    }

    if (hasChildren(groupId)) {
        final Collection children = getChildren(groupId);
        for (final Object child : children) {
            __fillGroupAggregationCells(child, cells);
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:22,代码来源:WebGroupTable.java


示例9: getPrintable

import com.haulmont.cuba.gui.components.Table; //导入依赖的package包/类
@Nullable
@Override
public Printable getPrintable(String columnId) {
    Printable printable = printables != null ? printables.get(columnId) : null;
    if (printable != null) {
        return printable;
    } else {
        com.vaadin.ui.Table.ColumnGenerator vColumnGenerator = component.getColumnGenerator(getColumn(columnId).getId());
        if (vColumnGenerator instanceof CustomColumnGenerator) {
            ColumnGenerator columnGenerator = ((CustomColumnGenerator) vColumnGenerator).getColumnGenerator();
            if (columnGenerator instanceof Printable)
                return (Printable) columnGenerator;
        }
        return null;
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:17,代码来源:WebAbstractTable.java


示例10: setStyleProvider

import com.haulmont.cuba.gui.components.Table; //导入依赖的package包/类
@Override
public void setStyleProvider(@Nullable Table.StyleProvider<? super E> styleProvider) {
    if (styleProvider != null) {
        if (this.styleProviders == null) {
            this.styleProviders = new LinkedList<>();
        } else {
            this.styleProviders.clear();
        }

        this.styleProviders.add(styleProvider);
    } else {
        this.styleProviders = null;
    }

    component.refreshCellStyles();
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:17,代码来源:WebAbstractTable.java


示例11: getFormattedValue

import com.haulmont.cuba.gui.components.Table; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public String getFormattedValue() {
    final Table.Column column = WebAbstractTable.this.columns.get(propertyPath);
    if (column != null) {
        if (column.getFormatter() != null) {
            return column.getFormatter().format(getValue());
        } else if (column.getXmlDescriptor() != null) {
            String captionProperty = column.getXmlDescriptor().attributeValue("captionProperty");
            if (StringUtils.isNotEmpty(captionProperty)) {
                final Instance item = getInstance();
                final Object captionValue = item.getValueEx(captionProperty);
                return captionValue != null ? String.valueOf(captionValue) : null;
            }
        }
    }
    return super.getFormattedValue();
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:19,代码来源:WebAbstractTable.java


示例12: getNotCollapsedColumns

import com.haulmont.cuba.gui.components.Table; //导入依赖的package包/类
@Override
public List<Table.Column> getNotCollapsedColumns() {
    if (component.getVisibleColumns() == null)
        return Collections.emptyList();

    final List<Table.Column> visibleColumns = new ArrayList<>(component.getVisibleColumns().length);
    Object[] keys = component.getVisibleColumns();
    for (final Object key : keys) {
        if (!component.isColumnCollapsed(key)) {
            Column column = columns.get(key);
            if (column != null)
                visibleColumns.add(column);
        }
    }
    return visibleColumns;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:17,代码来源:WebAbstractTable.java


示例13: addColumnCollapsedListener

import com.haulmont.cuba.gui.components.Table; //导入依赖的package包/类
@Override
public void addColumnCollapsedListener(ColumnCollapseListener columnCollapsedListener) {
    if (columnCollapseListeners == null) {
        columnCollapseListeners = new LinkedList<>();

        component.addColumnCollapseListener((com.vaadin.ui.Table.ColumnCollapseListener) event -> {
            Column collapsedColumn = getColumn(event.getPropertyId().toString());
            boolean collapsed = component.isColumnCollapsed(event.getPropertyId());

            for (ColumnCollapseListener listener : columnCollapseListeners) {
                listener.columnCollapsed(collapsedColumn, collapsed);
            }
        });
    }

    columnCollapseListeners.add(columnCollapsedListener);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:18,代码来源:WebAbstractTable.java


示例14: initPermissionColoredColumns

import com.haulmont.cuba.gui.components.Table; //导入依赖的package包/类
@Override
public void initPermissionColoredColumns(TreeTable screenPermissionsTree) {
    screenPermissionsTree.addGeneratedColumn("permissionVariant", new Table.ColumnGenerator<BasicPermissionTarget>() {
        @Override
        public Component generateCell(BasicPermissionTarget entity) {
            Label label = AppConfig.getFactory().createComponent(Label.class);
            JLabel jLabel = (JLabel) DesktopComponentsHelper.unwrap(label);

            StringBuilder builder = new StringBuilder();

            PermissionVariant permissionVariant = entity.getPermissionVariant();

            if (permissionVariant != PermissionVariant.NOTSET) {
                builder.append("<html>");
                builder.append("<font color=\"").append(permissionVariant.getColor()).append("\">")
                        .append(messages.getMessage(permissionVariant)).append("</font>");

                builder.append("</html>");
            }

            jLabel.setText(builder.toString());

            return label;
        }
    }, Label.class);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:27,代码来源:ScreenPermissionsFrameCompanion.java


示例15: initPermissionColoredColumns

import com.haulmont.cuba.gui.components.Table; //导入依赖的package包/类
@Override
public void initPermissionColoredColumns(TreeTable specificPermissionsTree) {
    specificPermissionsTree.addGeneratedColumn("permissionVariant", new Table.ColumnGenerator<BasicPermissionTarget>() {
        @Override
        public Component generateCell(BasicPermissionTarget entity) {
            Label label = AppConfig.getFactory().createComponent(Label.class);
            JLabel jLabel = (JLabel) DesktopComponentsHelper.unwrap(label);

            StringBuilder builder = new StringBuilder();

            PermissionVariant permissionVariant = entity.getPermissionVariant();

            if (permissionVariant != PermissionVariant.NOTSET) {
                builder.append("<html>");
                builder.append("<font color=\"").append(permissionVariant.getColor()).append("\">")
                        .append(messages.getMessage(permissionVariant)).append("</font>");

                builder.append("</html>");
            }

            jLabel.setText(builder.toString());

            return label;
        }
    }, Label.class);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:27,代码来源:SpecificPermissionsFrameCompanion.java


示例16: initPermissionsColoredColumns

import com.haulmont.cuba.gui.components.Table; //导入依赖的package包/类
@Override
public void initPermissionsColoredColumns(Table uiPermissionsTable) {
    uiPermissionsTable.addGeneratedColumn("permissionVariant", new Table.ColumnGenerator<UiPermissionTarget>() {
        @Override
        public Component generateCell(UiPermissionTarget entity) {
            Label label = AppConfig.getFactory().createComponent(Label.class);
            JLabel jLabel = (JLabel) DesktopComponentsHelper.unwrap(label);

            StringBuilder builder = new StringBuilder();

            UiPermissionVariant permissionVariant = entity.getPermissionVariant();

            if (permissionVariant != UiPermissionVariant.NOTSET) {
                builder.append("<html>");
                builder.append("<font color=\"").append(permissionVariant.getColor()).append("\">")
                        .append(messages.getMessage(permissionVariant)).append("</font>");

                builder.append("</html>");
            }

            jLabel.setText(builder.toString());

            return label;
        }
    }, Label.class);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:27,代码来源:UiPermissionsFrameCompanion.java


示例17: loadColumns

import com.haulmont.cuba.gui.components.Table; //导入依赖的package包/类
@Override
protected List<Table.Column> loadColumns(final Table component, Element columnsElement, CollectionDatasource ds) {
    List<Table.Column> columns = new ArrayList<>();

    Element groupElement = columnsElement.element("group");
    if (groupElement != null) {
        columns.addAll(super.loadColumns(component, groupElement, ds));
        final List<Object> groupProperties = new ArrayList<>(columns.size());
        for (Table.Column column : columns) {
            if (column.isCollapsed()) {
                String msg = String.format("Can't group by collapsed column: %s", column.getId());
                throw new GuiDevelopmentException(msg, context.getFullFrameId());
            }

            if (column.isGroupAllowed()) {
                groupProperties.add(column.getId());
            }
        }
        context.addPostInitTask((context1, window) -> ((GroupTable) component).groupBy(groupProperties.toArray()));
    }

    columns.addAll(super.loadColumns(component, columnsElement, ds));

    return columns;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:26,代码来源:GroupTableLoader.java


示例18: toggleSortOrder

import com.haulmont.cuba.gui.components.Table; //导入依赖的package包/类
@Override
public void toggleSortOrder(int column) {
    Table.Column modelColumn = model.getColumn(column);
    if (model.isGeneratedColumn(modelColumn)) {
        if (!(modelColumn.getId() instanceof MetaPropertyPath)) {
            return;
        }
    }

    SortKey key;
    if (sortKey != null && sortKey.getColumn() == column) {
        if (sortKey.getSortOrder() == SortOrder.ASCENDING) {
            key = new SortKey(sortKey.getColumn(), SortOrder.DESCENDING);
        } else {
            key = null;
        }
    } else {
        key = new SortKey(column, SortOrder.ASCENDING);
    }
    if (key == null)
        setSortKeys(Collections.<SortKey>emptyList());
    else
        setSortKeys(Collections.singletonList(key));
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:25,代码来源:RowSorterImpl.java


示例19: setValueAt

import com.haulmont.cuba.gui.components.Table; //导入依赖的package包/类
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
    Table.Column column = columns.get(columnIndex);
    if (!column.isEditable())
        return;
    if (generatedColumns.contains(column))
        return;

    Object id = getItemId(rowIndex);
    Entity item = datasource.getItem(id);

    if (column.getId() instanceof MetaPropertyPath) {
        String property = column.getId().toString();
        item.setValueEx(property, aValue);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:17,代码来源:TableModelAdapter.java


示例20: init

import com.haulmont.cuba.gui.components.Table; //导入依赖的package包/类
@Override
public void init(Map<String, Object> params) {
    Project project = (Project) params.get("parentProject");
    if (project != null) {
        projectsDs.excludeItem(project);
        List<Project> childrenProjects = projectsService.getProjectChildren(project);
        for (Project child : childrenProjects) {
            projectsDs.excludeItem(child);
        }
    }

    project = (Project) params.get("exclude");
    if (project != null) {
        projectsDs.excludeItem(project);
    }

    projectsTable.setStyleProvider(new Table.StyleProvider<Project>() {
        @Nullable
        @Override
        public String getStyleName(Project entity, String property) {
            if ("status".equals(property)) {
                return ComponentsHelper.getProjectStatusStyle(entity);
            }
            return null;
        }
    });
}
 
开发者ID:cuba-platform,项目名称:sample-timesheets,代码行数:28,代码来源:ProjectLookup.java



注:本文中的com.haulmont.cuba.gui.components.Table类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HttpStatusClass类代码示例发布时间:2022-05-23
下一篇:
Java XYGraphWidget类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap