Java Code Examples for org.eclipse.swt.widgets.Tree.getColumns()

The following are Jave code examples for showing how to use getColumns() of the org.eclipse.swt.widgets.Tree class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: depan   File: NodeStatsTableControl.java   Source Code and License Vote up 5 votes
private void configSorters(Tree tree) {
  int index = 0;
  for (TreeColumn column : tree.getColumns()) {
    final int colIndex = index++;

    column.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent event) {
        updateSortColumn((TreeColumn) event.widget, colIndex);
      }
    });
  }
}
 
Example 2
Project: depan   File: NodeDisplayTableControl.java   Source Code and License Vote up 5 votes
private void configSorters(Tree tree) {
  int index = 0;
  for (TreeColumn column : tree.getColumns()) {
    final int colIndex = index++;

    column.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent event) {
        updateSortColumn((TreeColumn) event.widget, colIndex);
      }
    });
  }
}
 
Example 3
Project: mytourbook   File: ColumnManager.java   Source Code and License Vote up 3 votes
private ColumnWrapper getHeaderColumn(final Tree tree, final Point mousePosition, final boolean isTreeHeaderHit) {

		if (isTreeHeaderHit) {

			int columnWidths = 0;

			final TreeColumn[] columns = tree.getColumns();
			final int[] columnOrder = tree.getColumnOrder();

			for (final int creationIndex : columnOrder) {

				final TreeColumn tc = columns[creationIndex];

				final int columnWidth = tc.getWidth();

				if (columnWidths < mousePosition.x && mousePosition.x < columnWidths + columnWidth) {

					final int columnLeftBorder = columnWidths;
					final int columnRightBorder = columnWidths + columnWidth;

					// column found
					return new ColumnWrapper(tc, columnLeftBorder, columnRightBorder);
				}

				columnWidths += columnWidth;
			}
		}

		return null;
	}