Java 类org.eclipse.swt.widgets.TreeColumn 实例源码

项目:n4js    文件:TreeViewerBuilder.java   
@Override
protected TreeViewer createViewer(final Composite parent, final AbstractColumnLayout columnLayout,
        final int style) {
    final TreeViewer viewer = new TreeViewer(parent, virual ? (style | VIRTUAL) : style);
    final Tree tree = viewer.getTree();
    tree.setLinesVisible(linesVisible);
    tree.setHeaderVisible(headerVisible);

    int columnIndex = 0;
    for (final String columnLabel : columnLabels) {

        final TreeViewerColumn viewerColumn = new TreeViewerColumn(viewer, NONE);
        final TreeColumn column = viewerColumn.getColumn();
        columnLayout.setColumnData(column, createColumnLayoutData(columnIndex));
        column.setText(columnLabel);
        column.setMoveable(moveable);

        columnIndex++;
    }

    return viewer;
}
项目:gemoc-studio-modeldebugging    文件:EnginesStatusView.java   
private void createColumn3() 
    {
        TreeColumn column = new TreeColumn(_viewer.getTree(), SWT.LEFT);
//      column.setText("Step");
        TreeViewerColumn viewerColumn = new TreeViewerColumn(_viewer, column);
        viewerColumn.setLabelProvider(
            new ColumnLabelProvider()
            {
                @Override
                public String getText(Object element) 
                {
                    String result = "";
                    if (element instanceof IExecutionEngine)
                    {                   
                        IExecutionEngine engine = (IExecutionEngine)element;
                        result = String.format("%d", engine.getEngineStatus().getNbLogicalStepRun());
                    }
                    return result;
                }           
            });
    }
项目:neoscada    文件:RealTimeListViewer.java   
public void saveTo ( final IMemento memento )
{
    if ( memento == null )
    {
        return;
    }

    {
        final IMemento tableMemento = memento.createChild ( "tableCols" ); //$NON-NLS-1$

        for ( int i = 0; i < this.viewer.getTree ().getColumnCount (); i++ )
        {
            final TreeColumn col = this.viewer.getTree ().getColumn ( i );
            tableMemento.putInteger ( "col_" + i, col.getWidth () ); //$NON-NLS-1$
        }
    }

    for ( final ListEntry entry : this.list.getItems () )
    {
        final Item item = entry.getItem ();
        item.saveTo ( memento.createChild ( "item" ) ); //$NON-NLS-1$
    }
}
项目:neoscada    文件:SecurityEditor.java   
protected void createColumns ( final Tree tree )
{
    final TreeColumn typeFilterColumn = new TreeColumn ( tree, SWT.NONE );
    typeFilterColumn.setText ( getString ( "_UI_TypeFilterColumn_label" ) ); //$NON-NLS-1$
    typeFilterColumn.setResizable ( true );
    typeFilterColumn.setWidth ( 200 );

    final TreeColumn idFilterColumn = new TreeColumn ( tree, SWT.NONE );
    idFilterColumn.setText ( getString ( "_UI_IdFilterColumn_label" ) ); //$NON-NLS-1$
    idFilterColumn.setResizable ( true );
    idFilterColumn.setWidth ( 200 );

    final TreeColumn actionFilterColumn = new TreeColumn ( tree, SWT.NONE );
    actionFilterColumn.setText ( getString ( "_UI_ActionFilterColumn_label" ) ); //$NON-NLS-1$
    actionFilterColumn.setResizable ( true );
    actionFilterColumn.setWidth ( 200 );
}
项目:pgsqlblocks    文件:TMTreeViewer.java   
private void selectSortColumn(TreeColumn column, int columnIndex) {
    TreeColumn prevSortColumn = getTree().getSortColumn();
    int sortDirection = SWT.DOWN;
    if (prevSortColumn != null) {
        int prevSortDirection = getTree().getSortDirection();
        if (column.equals(prevSortColumn)) {
            sortDirection = prevSortDirection == SWT.UP ? SWT.DOWN : SWT.UP;
            getTree().setSortDirection(sortDirection);
        } else {
            getTree().setSortColumn(column);
            getTree().setSortDirection(SWT.DOWN);
        }
    } else {
        getTree().setSortColumn(column);
        getTree().setSortDirection(SWT.DOWN);
    }
    int fSortDirection = sortDirection;
    sortColumnSelectionListeners.forEach(listener -> listener.didSelectSortColumn(column, columnIndex, fSortDirection));
}
项目:scouter    文件:TreeLabelSorter.java   
public void setColumn(TreeColumn clickedColumn) {
    if (col == clickedColumn) {
        dir = dir * -1;
    } else {
        this.col = clickedColumn;
        this.dir = ORDER_ASC;
    }
    TreeColumn[] cols = tree.getColumns();
    int colLen = cols.length;;
    for (int i = 0; i < colLen; i++) {
        if (cols[i] == this.col) {
            colIndex = i;
            break;
        }
    }
    tree.setSortColumn(clickedColumn);
    switch (dir) {
    case ORDER_ASC:
        tree.setSortDirection(SWT.UP);
        break;
    case ORDER_DESC:
        tree.setSortDirection(SWT.DOWN);
        break;
    }
    viewer.refresh();
}
项目:scouter    文件:DigestTableView.java   
private TreeViewerColumn createTreeViewerColumn(String title, int width, int alignment,  boolean resizable, boolean moveable, final boolean isNumber) {
    final TreeViewerColumn viewerColumn = new TreeViewerColumn(viewer, SWT.NONE);
    final TreeColumn column = viewerColumn.getColumn();
    column.setText(title);
    column.setAlignment(alignment);
    column.setMoveable(moveable);
    columnLayout.setColumnData(column, new ColumnPixelData(width, resizable));
    column.setData("isNumber", isNumber);
    column.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            TreeLabelSorter sorter = (TreeLabelSorter) viewer.getComparator();
            TreeColumn selectedColumn = (TreeColumn) e.widget;
            sorter.setColumn(selectedColumn);
        }
    });
    return viewerColumn;
}
项目:durian-swt    文件:ColumnFormat.java   
/** Builds a table with the given columns. */
protected static Tree buildTree(Composite parent, int style, boolean linesVisible, boolean headerVisible, List<? extends ColumnBuilder> columnBuilders) {
    SwtMisc.assertClean(parent);
    // create the control
    Tree control = new Tree(parent, style);
    control.setLinesVisible(linesVisible);
    control.setHeaderVisible(headerVisible);

    // create the columns and layout
    Function<ColumnBuilder, TreeColumn> buildFunc = builder -> builder.build(control);
    List<TreeColumn> columns = columnBuilders.stream().map(buildFunc).collect(Collectors.toList());
    buildLayout(control, new TreeColumnLayout(), columns, columnBuilders);

    // return the control
    return control;
}
项目:mytourbook    文件:WizardPage_10_CompareTour.java   
private void defineColumn_Date(final TreeColumnLayout treeLayout) {

        final TreeViewerColumn tvc = new TreeViewerColumn(_tourViewer, SWT.LEAD);
        tvc.setLabelProvider(new CellLabelProvider() {
            @Override
            public void update(final ViewerCell cell) {

                final Object element = cell.getElement();

                if (element instanceof TVIWizardCompareYear) {
                    cell.setText(((TVIWizardCompareYear) element).treeColumn);
                } else if (element instanceof TVIWizardCompareMonth) {
                    cell.setText(((TVIWizardCompareMonth) element).treeColumn);
                } else if (element instanceof TVIWizardCompareTour) {
                    cell.setText(((TVIWizardCompareTour) element).treeColumn);
                } else {
                    cell.setText(UI.EMPTY_STRING);
                }
            }
        });

        final TreeColumn tc = tvc.getColumn();
        tc.setText(Messages.tourCatalog_wizard_Column_tour);
        treeLayout.setColumnData(tc, new ColumnPixelData(convertWidthInCharsToPixels(20)));
    }
项目:ModelDebugging    文件:EnginesStatusView.java   
private void createColumn3() 
    {
        TreeColumn column = new TreeColumn(_viewer.getTree(), SWT.LEFT);
//      column.setText("Step");
        TreeViewerColumn viewerColumn = new TreeViewerColumn(_viewer, column);
        viewerColumn.setLabelProvider(
            new ColumnLabelProvider()
            {
                @Override
                public String getText(Object element) 
                {
                    String result = "";
                    if (element instanceof IExecutionEngine)
                    {                   
                        IExecutionEngine engine = (IExecutionEngine)element;
                        result = String.format("%d", engine.getEngineStatus().getNbLogicalStepRun());
                    }
                    return result;
                }           
            });
    }
项目:sophie    文件:SystemTree.java   
/**
 * Create a new tree listing Solr system information.
 * 
 * @param composite
 *            Parent composite.
 */
public SystemTree(Composite composite) throws SophieException {
    // Instantiate Tree.
    tree = new Tree(composite, SWT.BORDER);
    tree.setHeaderVisible(true);
    tree.setLayoutData(new GridData(GridData.FILL_BOTH));

    // Create name/value columns.
    columnName = new TreeColumn(tree, SWT.LEFT);
    columnName.setText("Name");
    columnValue = new TreeColumn(tree, SWT.LEFT);
    columnValue.setText("Value");

    // Populate tree with data from Solr.
    populate();

    // Pack columns.
    columnName.pack();
    columnValue.pack();
}
项目:OpenSPIFe    文件:MergeTreeViewer.java   
/** From the mouse's x location get which column header you right clicked on! */
public int getColumnIndex(int click_x) {
    int columnIndex = 0;
    int x = 0;
    Tree tree = this.getTree();
    TreeColumn[] columns = tree.getColumns();
    int[] order = tree.getColumnOrder();
    for (int i : order) {
        TreeColumn column = columns[i];
        int width = column.getWidth();
        if (click_x < x + width) {
            break;
        }
        x += width;
        columnIndex++;
    }
    return columnIndex;
}
项目:OpenSPIFe    文件:TreeTableViewer.java   
@Override
@SuppressWarnings("unchecked")
public void handleEvent(Event event) {
    TreeItem treeItem = (TreeItem)event.item;
    Object element = treeItem.getData();
    TreeColumn treeColumn = control.getColumn(event.index);
    ITreeTableColumn column = getTreeTableColumn(control, event);
    if (column instanceof IAdvancedDrawingColumn) {
        IAdvancedDrawingColumn drawingColumn = (IAdvancedDrawingColumn) column;
        try {
            event.width = Math.max(treeColumn.getWidth(), event.width);
            Object facet = column.getFacet(element);
            drawingColumn.handlePaintItem(facet, event);
        } catch (ThreadDeath td) {
            throw td;
        } catch (Throwable t) {
            LogUtil.error("column '" + column.getClass().getCanonicalName()
                      + "' had an exception while retrieving facet/handlePaintItem",t);
        }
    }
}
项目:OpenSPIFe    文件:TreeTableComposite.java   
public void updateOrder() {
    TreeColumn[] treeColumns = tree.getColumns();
    int[] order = tree.getColumnOrder();
    List<C> mergeColumns = new Vector<C>();
    mergeColumns.add(configuration.getZeroColumn());
    for (int i = 0 ; i < order.length ; i++) {
        int position = order[i];
        TreeColumn treeColumn = treeColumns[position];
        C mergeColumn = (C)treeColumn.getData(ITreeTableColumn.class.getCanonicalName());
        if (mergeColumn != configuration.getZeroColumn()) {
            mergeColumns.add(mergeColumn);
        }
    }
    if (!mergeColumns.equals(configuration.getColumns())) {
        configuration.setColumns(mergeColumns);
    } else {
        // reset column order
        tree.setColumnOrder(computeOrder());
    }
}
项目:OpenSPIFe    文件:TreeTableComposite.java   
@Override
public void controlResized(ControlEvent e) {
    if (inLayout()) {
        return;
    }
    if (CommonUtils.isOSLinux()) {
        TreeColumn column = (TreeColumn)e.widget;
        Tree tree = column.getParent();
        int[] columnOrder = tree.getColumnOrder();
        int lastI = columnOrder[columnOrder.length - 1];
        TreeColumn[] columns = tree.getColumns();
        TreeColumn lastColumn2 = columns[lastI];
        if (e.widget == lastColumn2) {
            return; // ignore it
        }
    }
    int width = treeColumn.getWidth();
    configuration.resizeColumn(mergeColumn, width);
}
项目:OpenSPIFe    文件:PlanRulesTreeViewer.java   
private void handleColumnSelected(CellLabelProvider labelProvider, TreeColumn treeColumn) {
    PlanRulesViewerComparator comparator = (PlanRulesViewerComparator)getComparator();
    if (labelProvider instanceof IPlanRulesSortableColumn) {
        IPlanRulesSortableColumn column = (IPlanRulesSortableColumn) labelProvider;
        if (comparator.getKey() == column) {
            boolean newReverse = !comparator.isReverse();
            comparator.setReverse(newReverse);
            getTree().setSortDirection(newReverse ? SWT.UP : SWT.DOWN);
        } else {
            getTree().setSortColumn(treeColumn);
            getTree().setSortDirection(SWT.DOWN);
            comparator.setReverse(false);
            comparator.setKey(column);
        }
    } else {
        getTree().setSortColumn(null);
        getTree().setSortDirection(SWT.NONE);
        comparator.setReverse(false);
        comparator.setKey(null);
    }
    refresh();
}
项目:DropTillLate_Application    文件:ShareView.java   
private void getInitialTree()
{
    treeViewer.setContentProvider(new ShareContentProvider());
    treeViewer.setLabelProvider(new ShareLabelProvider());

    // Expand the tree
    treeViewer.setAutoExpandLevel(2);
    // Change TreeTable
    tree = treeViewer.getTree();
    // Tree table specific code starts fill labels
    tree.setHeaderVisible(true);
    tree.setLinesVisible(true);
    for (TableIdentifierShare identifier : TableIdentifierShare.values())
    {
        new TreeColumn(tree, SWT.NONE).setText(Messages.getTableColumnTitleShare(identifier));
        tree.getColumn(identifier.ordinal()).setWidth(identifier.columnWidth);
    }
}
项目:DropTillLate_Application    文件:ViewController.java   
public void initViewController(TreeViewer viewer, Shell shell, EPartService partService, EModelService modelService, MApplication application) {
    // Treeviewer
    this.viewer = viewer;
    this.shell = shell;
    this.partService = partService;
    this.modelService = modelService;
    this.application = application;
    // Set ContentProvider and Labels
    viewer.setContentProvider(new DropTillLateContentProvider());
    viewer.setLabelProvider(new DropTillLateLabelProvider());
    // Expand the tree
    viewer.setAutoExpandLevel(2);
    // Change TreeTable
    tree = viewer.getTree();
    // Tree table specific code starts fill labels
    tree.setHeaderVisible(true);
    tree.setLinesVisible(true);
    for (TableIdentifier identifier : TableIdentifier.values()) {
        new TreeColumn(tree, SWT.NONE).setText(Messages
                .getTableColumnTitle(identifier));
        tree.getColumn(identifier.ordinal()).setWidth(
                identifier.columnWidth);
    }

}
项目:gef-gwt    文件:ConfigureColumns.java   
/**
 * @param item
 * @return
 */
private String getColumnName(Item item) {
    String result = ""; //$NON-NLS-1$
    if (item instanceof TableColumn) {
        result = ((TableColumn) item).getText();
        if (result.trim().equals("")) { //$NON-NLS-1$
            result = ((TableColumn) item).getToolTipText();
        }
    } else if (item instanceof TreeColumn) {
        result = ((TreeColumn) item).getText();
        if (result.trim().equals("")) { //$NON-NLS-1$
            result = ((TreeColumn) item).getToolTipText();
        }
    }
    return result;
}
项目:gef-gwt    文件:TreeEditor.java   
/**
 * Removes all associations between the TreeEditor and the row in the tree.
 * The tree and the editor Control are <b>not</b> disposed.
 */
public void dispose() {
    if (tree != null && !tree.isDisposed()) {
        if (this.column > -1 && this.column < tree.getColumnCount()) {
            TreeColumn treeColumn = tree.getColumn(this.column);
            treeColumn.removeControlListener(columnListener);
        }
        if (treeListener != null)
            tree.removeTreeListener(treeListener);
    }
    columnListener = null;
    treeListener = null;
    tree = null;
    item = null;
    column = 0;
    timer = null;
    super.dispose();
}
项目:pm    文件:EventsComposite.java   
private void columnPack(Tree tree) {

    List<Integer> widths = new ArrayList<Integer>();
    TreeColumn[] columns = tree.getColumns();
    for (TreeColumn treeColumn : columns) {
        int minSize = 70;
        int availableSize = (this.getSize().x - ctrlComposite.getSize().x) / columnsHeaders.length;
        if (availableSize <= minSize) { //min columns are bigger than available
            widths.add(minSize);
        } else if (availableSize > minSize) { //min columns are smaller than available
            int actualPackedWidth = treeColumn.getWidth();
            if (actualPackedWidth > availableSize) {
                widths.add(availableSize);
            } else {
                widths.add(availableSize);
            }
        }
    }

    tree.setRedraw(false);
    for (int i = 0; i < columns.length; i++) {
        columns[i].setWidth(widths.get(i));
    }
    tree.setRedraw(true);

}
项目:geokettle-2.0    文件:SelectObjectDialog.java   
protected void setSort(int i)
{
    if (sortColumn==i)
    {
        ascending=!ascending;
    }
    else
    {
        sortColumn=i;
        ascending=true;
    }

    if (sortColumn>=0 && sortColumn<5)
    {
        TreeColumn column = wTree.getColumn(sortColumn);
        wTree.setSortColumn(column);
        wTree.setSortDirection(ascending?SWT.UP:SWT.DOWN);
    }
    refreshTree();
}
项目:geokettle-2.0    文件:RepositoryExplorerDialog.java   
protected void setSort(int i)
{
    if (sortColumn==i)
    {
        ascending=!ascending;
    }
    else
    {
        sortColumn=i;
        ascending=true;
    }

    if (sortColumn>=0 && sortColumn<5)
    {
        TreeColumn column = wTree.getColumn(sortColumn);
        wTree.setSortColumn(column);
        wTree.setSortDirection(ascending?SWT.UP:SWT.DOWN);
    }
    refreshTree();
}
项目:E34MigrationTooling    文件:MigrationStatsE4View.java   
private void createPluginColumns(IPluginModelBase pm)
{
    // Add columns in the tree one column per selected plugin.
    // Create the first column for the key
    TreeViewerColumn col = new TreeViewerColumn(tv, SWT.NONE);
    TreeColumn swtCol = col.getColumn();
    swtCol.setText(getColumnName(pm));
    swtCol.setAlignment(SWT.CENTER);
    PluginDataProvider labelProvider = new PluginDataProvider();

    labelProvider.setPlugin(pm);
    col.setLabelProvider(labelProvider);
    swtCol.setToolTipText(pm.getBundleDescription().getName());
    swtCol.pack();

    columnsCache.put(pm, col);
}
项目:E34MigrationTooling    文件:MigrationStatsE4View.java   
private SelectionAdapter getHeaderSelectionAdapter(final TreeViewer viewer, final TreeColumn column,
        final int columnIndex, final ILabelProvider textProvider)
{
    SelectionAdapter selectionAdapter = new SelectionAdapter()
        {
            @Override
            public void widgetSelected(SelectionEvent e)
            {
                viewer.setComparator(comparator);
                comparator.setColumn(columnIndex);
                comparator.setLabelProvider(textProvider);
                viewer.getTree().setSortDirection(comparator.getDirection());
                viewer.getTree().setSortColumn(column);
                viewer.refresh();
            }
        };
    return selectionAdapter;
}
项目:read-open-source-code    文件:RepositoryExplorerDialog.java   
protected void setSort(int i)
{
    if (sortColumn==i)
    {
        ascending=!ascending;
    }
    else
    {
        sortColumn=i;
        ascending=true;
    }

    if (sortColumn>=0 && sortColumn<5)
    {
        TreeColumn column = wTree.getColumn(sortColumn);
        wTree.setSortColumn(column);
        wTree.setSortDirection(ascending?SWT.UP:SWT.DOWN);
    }
    refreshTree();
}
项目:kettle-4.4.0-stable    文件:RepositoryExplorerDialog.java   
protected void setSort(int i)
{
    if (sortColumn==i)
    {
        ascending=!ascending;
    }
    else
    {
        sortColumn=i;
        ascending=true;
    }

    if (sortColumn>=0 && sortColumn<5)
    {
        TreeColumn column = wTree.getColumn(sortColumn);
        wTree.setSortColumn(column);
        wTree.setSortDirection(ascending?SWT.UP:SWT.DOWN);
    }
    refreshTree();
}
项目:egitblit    文件:RepoExplorerView.java   
/**
 * Prepare view depending on the current config setting E.g. displaying
 * and hiding columns, Setting column labels etc.
 */
public void update(){
    if(viewer != null){
        // Set the model to display
        viewer.setInput(getModel());
        viewer.refresh(true);
        if(expandCItem != null){
            // sync set the viewmode button
            expandCItem.enable(viewMode == ViewMode.Group);
        }
        TreeColumn col = colFactory.getColumn(ColumnDesc.GroupRepository);
        if(col == null){
            return;
        }
        if(viewMode == ViewMode.Repository){
            // Showing repositories only (no groups)
            col.setText("Repository");
            col.setToolTipText("Name of the repository");
        }
        else{
            // Showing groups
            col.setText("Group / Repository");
            col.setToolTipText("Name of the group and its repositories");
        }
    }
}
项目:egitblit    文件:ColumnFactory.java   
/**
 * Returns the actual column index of the passed ColumnDesc
 * @param desc ColumnDesc
 * @return Position or -1 if column is not present
 */
public final int getColumnIndex(ColumnDesc desc){
    if(desc == null){
        return -1;
    }

    int pos = 0;

    // Initial position
    TreeColumn[] items = viewer.getTree().getColumns();
    // actual order (index is order, value is init position)
    int[] actOrder = viewer.getTree().getColumnOrder();
    for(TreeColumn item : items){
        if(desc == (ColumnDesc) item.getData(KEY_COLDESC)){
            for(int i=0;i<actOrder.length;i++){
                if(actOrder[i] == pos){
                    return i;
                }
            }
        }
        pos++;
    }
    return -1;
}
项目:egitblit    文件:ColumnFactory.java   
/**
 * Init tree sorter
 */
private void initTreeSorter(){
    if(this.viewer.getTree().getColumnCount() == 0){
        Activator.logError("Can't init TreeSorter. Tree has no columns.");
        return;
    }
    RepoViewSorter repoViewSorter = new RepoViewSorter();
    viewer.setSorter(repoViewSorter);
    viewer.getTree().setSortColumn(viewer.getTree().getColumn(0));
    viewer.getTree().setSortDirection(SWT.UP);
    viewer.refresh();

    TreeColumn[] cols = viewer.getTree().getColumns();
    for(final TreeColumn item : cols){
        item.addSelectionListener(this.selListener);
    }
}
项目:Pydev    文件:PythonListEditor.java   
/**
 * Returns this field editor's list control.
 * 
 * @param parent the parent control
 * @return the list control
 */
public Tree getListControl(Composite parent) {
    if (treeWithInterpreters == null) {
        treeWithInterpreters = new Tree(parent, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL);

        treeWithInterpreters.setHeaderVisible(true);
        TreeColumn column1 = new TreeColumn(treeWithInterpreters, SWT.LEFT);
        column1.setText("Name");
        column1.setWidth(200);
        TreeColumn column2 = new TreeColumn(treeWithInterpreters, SWT.LEFT);
        column2.setText("Location");
        column2.setWidth(200);

        treeWithInterpreters.setFont(parent.getFont());
        treeWithInterpreters.addSelectionListener(getSelectionListener());
        treeWithInterpreters.addDisposeListener(new DisposeListener() {
            @Override
            public void widgetDisposed(DisposeEvent event) {
                treeWithInterpreters = null;
            }
        });
    } else {
        checkParent(treeWithInterpreters, parent);
    }
    return treeWithInterpreters;
}
项目:kettle-trunk    文件:RepositoryExplorerDialog.java   
protected void setSort(int i)
{
    if (sortColumn==i)
    {
        ascending=!ascending;
    }
    else
    {
        sortColumn=i;
        ascending=true;
    }

    if (sortColumn>=0 && sortColumn<5)
    {
        TreeColumn column = wTree.getColumn(sortColumn);
        wTree.setSortColumn(column);
        wTree.setSortDirection(ascending?SWT.UP:SWT.DOWN);
    }
    refreshTree();
}
项目:VersionOne.Integration.Eclipse    文件:TestTaskView.java   
/**
 * Test columns when effort tracking is enabled
 * 
 * @throws Exception
 */

@Test
public void testEffortEnabled() throws Exception {
    TestDataLayer.getInstance().isEffortTracking = true;
    reCreateTable();
    Tree table = testView.getViewer().getTree();
    Assert.assertNotNull(table);
    Assert.assertEquals(8, table.getColumnCount());
    TreeColumn[] columns = table.getColumns();
    Assert.assertEquals("Title", columns[NAME_COLUMN_INDEX].getText());
    Assert.assertEquals("ID", columns[ID_COLUMN_INDEX].getText());
    Assert.assertEquals("Owner", columns[OWNER_COLUMN_INDEX].getText());
    Assert.assertEquals("Detail Estimate", columns[DETAIL_ESTIMATE_COLUMN_INDEX].getText());
    Assert.assertEquals("Done", columns[DONE_COLUMN_INDEX].getText());
    Assert.assertEquals("Effort", columns[EFFORT_COLUMN_INDEX].getText());
    Assert.assertEquals("To Do", columns[TRACKED_TODO_COLUMN_INDEX].getText());
    Assert.assertEquals("Status", columns[STATUS_COLUMN_INDEX].getText());
}
项目:VersionOne.Integration.Eclipse    文件:TestTaskView.java   
/**
 * Test columns when effort tracking is disabled
 * 
 * @throws Exception
 */
@Test
public void testEffortDisabled() throws Exception {
    TestDataLayer.getInstance().isEffortTracking = false;
    reCreateTable();
    Tree table = testView.getViewer().getTree();
    Assert.assertNotNull(table);
    Assert.assertEquals(6, table.getColumnCount());
    TreeColumn[] columns = table.getColumns();
    Assert.assertEquals("Title", columns[NAME_COLUMN_INDEX].getText());
    Assert.assertEquals("ID", columns[ID_COLUMN_INDEX].getText());
    Assert.assertEquals("Owner", columns[OWNER_COLUMN_INDEX].getText());
    Assert.assertEquals("Detail Estimate", columns[DETAIL_ESTIMATE_COLUMN_INDEX].getText());
    Assert.assertEquals("To Do", columns[TODO_COLUMN_INDEX].getText());
    Assert.assertEquals("Status", columns[STATUS_COLUMN_INDEX].getText());
}
项目:q7.quality.mockups    文件:RCPTT211_EmptyWindowInAssertionMode.java   
private void createTreeWithUnnamedColumn() {
    Tree tree = new Tree(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    tree.setHeaderVisible(true);
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL)
            .grab(true, true).applyTo(tree);

    TreeColumn column = new TreeColumn(tree, SWT.NONE);
    column.setWidth(200);
    column.setAlignment(SWT.LEFT);


    for (int i = 0; i < 5; i++) {
        TreeItem treeItem = new TreeItem(tree, 0);
        treeItem.setText(new String[] { "TreeItem" + i,
                Integer.toString(i) });
    }

}
项目:seg.jUCMNav    文件:IndicatorGroupDialog.java   
/**
 * This method initializes groupCurrentLink
 * 
 */
private void createGroupAvailableIndicatorGroupss() {
    groupAvailableIndicatorGroups = new Group(shell, SWT.NONE);
    groupAvailableIndicatorGroups.setText(Messages.getString("IndicatorGroupDialog.groupAvailableIndicatorGroups")); //$NON-NLS-1$
    groupAvailableIndicatorGroups.setBounds(new Rectangle(5, 86, 267, 271));
    treeAvailableIndicatorGroups = new Tree(groupAvailableIndicatorGroups, SWT.BORDER | SWT.CHECK);
    treeAvailableIndicatorGroups.setToolTipText(Messages.getString("IndicatorGroupDialog.groupAvailableIndicatorGroups.tiptext")); //$NON-NLS-1$
    treeAvailableIndicatorGroups.setBounds(new Rectangle(6, 51, 253, 212));

    TreeColumn nameCol = new TreeColumn(treeAvailableIndicatorGroups, SWT.LEFT);
    nameCol.setText(Messages.getString("IndicatorGroupDialog.Name")); //$NON-NLS-1$
    nameCol.pack();

    TreeColumn idCol = new TreeColumn(treeAvailableIndicatorGroups, SWT.LEFT);
    idCol.setText("ID"); //$NON-NLS-1$
    idCol.pack();
}
项目:seg.jUCMNav    文件:IndicatorGroupDialog.java   
/**
 * This method initializes groupAddLink
 * 
 */
private void createGroupAssignedIndicatorGroups() {
    groupAssignedIndicatorGroups = new Group(shell, SWT.NONE);
    groupAssignedIndicatorGroups.setText(Messages.getString("IndicatorGroupDialog.groupAssignedIndicatorGroups")); //$NON-NLS-1$
    groupAssignedIndicatorGroups.setBounds(new Rectangle(324, 86, 267, 271));
    treeAssignedIndicatorGroups = new Tree(groupAssignedIndicatorGroups, SWT.BORDER | SWT.CHECK);
    treeAssignedIndicatorGroups.setToolTipText(Messages.getString("IndicatorGroupDialog.groupAssignedIndicatorGroups.tiptext")); //$NON-NLS-1$
    treeAssignedIndicatorGroups.setBounds(new Rectangle(6, 22, 253, 241));

    TreeColumn nameCol = new TreeColumn(treeAssignedIndicatorGroups, SWT.LEFT);
    nameCol.setText(Messages.getString("IndicatorGroupDialog.Name")); //$NON-NLS-1$
    nameCol.pack();

    TreeColumn idCol = new TreeColumn(treeAssignedIndicatorGroups, SWT.LEFT);
    idCol.setText("ID"); //$NON-NLS-1$
    idCol.pack();
}
项目:arx    文件:ClipboardHandlerTree.java   
/**
 * Renders the tree into a string.
 *
 * @param tree
 * @return
 */
private String getText(TreeViewer tree){

    StringBuilder builder = new StringBuilder();

    List<String> properties = new ArrayList<String>();
    for (TreeColumn column : getColumns(tree)){
        properties.add(column.getText());
    }

    for (Object item : getItems(tree)) {
        getText(tree, item, properties, builder, ""); //$NON-NLS-1$
    }

    return builder.toString();
}
项目:cuina    文件:FunctionListPanel.java   
public void createComponents(Composite parent)
{
    this.viewer = new TreeViewer(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
    viewer.getTree().setHeaderVisible(true);

    TreeColumn nameColumn = new TreeColumn(viewer.getTree(), SWT.LEFT);
    nameColumn.setAlignment(SWT.LEFT);
    nameColumn.setText("Name");
    nameColumn.setWidth(160);
    TreeColumn argsColumn = new TreeColumn(viewer.getTree(), SWT.RIGHT);
    argsColumn.setAlignment(SWT.LEFT);
    argsColumn.setText("Argumente");
    argsColumn.setWidth(100);

    viewer.setContentProvider(new FunctionContentProvider());
    viewer.setLabelProvider(new FunctionLabelProvider());
    viewer.setInput(library);

    EventHandler handler = new EventHandler();
    viewer.addDoubleClickListener(handler);
}
项目:cogtool    文件:ProjectUIModel.java   
protected void installDesigns()
{
    TreeColumn designColumn = new TreeColumn(tree, SWT.LEFT);

    designColumn.setToolTipText(selectAllHelp);

    // TODO: Bonnie wants some indicator for which columns are designs
    // Such as changing "Tasks" here to "Tasks \\ Designs"
    designColumn.setText(L10N.get("PM.Tasks", "Tasks"));
    designColumn.setResizable(true);
    designColumn.setWidth(400);

    if (columnHook != null) {
        columnHook.onColumnCreation(designColumn);
    }

    Iterator<Design> designs = project.getDesigns().iterator();

    while (designs.hasNext()) {
        Design nextDesign = designs.next();

        addTreeColumn(nextDesign);
    }
}