ResultsTable.java 文件源码

java
阅读 22 收藏 0 点赞 0 评论 0

项目:EarthquakeBulletin 作者:
public ResultsTable(final Composite parent, final Object layoutData, final EarthquakeBulletinGui gui) {
    tableViewer = new TableViewer(parent, SWT.BORDER | SWT.FULL_SELECTION) {
        // Auto resize columns on content change
        @Override
        protected void inputChanged(final Object input, final Object oldInput) {
            super.inputChanged(input, oldInput);
            if (!initialized) {
                final Table table = tableViewer.getTable();
                table.setRedraw(false);
                final TableColumn sortedColumn = table.getSortColumn();
                table.setSortColumn(null);
                for (int j = 0; j < table.getColumns().length; j++) {
                    table.getColumn(j).pack();
                }
                table.setSortColumn(sortedColumn);
                table.setRedraw(true);
                initialized = true;
            }
        }
    };
    final Table table = tableViewer.getTable();
    createColumns(table);
    table.setLayoutData(layoutData);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    table.addListener(SWT.DefaultSelection, new ShowMapListener(gui));
    tableViewer.setContentProvider(new ArrayContentProvider());
    ColumnViewerToolTipSupport.enableFor(tableViewer);
    comparator = new EarthquakeViewerComparator();
    tableViewer.setComparator(comparator);

    contextMenu = new ContextMenu(gui);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号