本文整理匯總了Java中org.eclipse.swt.widgets.TreeColumn類的典型用法代碼示例。如果您正苦於以下問題:Java TreeColumn類的具體用法?Java TreeColumn怎麽用?Java TreeColumn使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TreeColumn類屬於org.eclipse.swt.widgets包,在下文中一共展示了TreeColumn類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setSortColumn
import org.eclipse.swt.widgets.TreeColumn; //導入依賴的package包/類
private void setSortColumn(
TreeColumn column, int colIndex, int direction) {
ViewerComparator sorter = buildColumnSorter(colIndex);
if (SWT.UP == direction) {
sorter = new InverseSorter(sorter);
}
Tree tree = propViewer.getTree();
tree.setSortColumn(column);
tree.setSortDirection(direction);
propViewer.setComparator(sorter);
}
示例2: createViewer
import org.eclipse.swt.widgets.TreeColumn; //導入依賴的package包/類
@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;
}
示例3: createColumn3
import org.eclipse.swt.widgets.TreeColumn; //導入依賴的package包/類
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;
}
});
}
示例4: saveTo
import org.eclipse.swt.widgets.TreeColumn; //導入依賴的package包/類
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$
}
}
示例5: createColumns
import org.eclipse.swt.widgets.TreeColumn; //導入依賴的package包/類
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 );
}
示例6: selectSortColumn
import org.eclipse.swt.widgets.TreeColumn; //導入依賴的package包/類
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));
}
示例7: setColumn
import org.eclipse.swt.widgets.TreeColumn; //導入依賴的package包/類
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();
}
示例8: createTreeViewerColumn
import org.eclipse.swt.widgets.TreeColumn; //導入依賴的package包/類
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;
}
示例9: buildTree
import org.eclipse.swt.widgets.TreeColumn; //導入依賴的package包/類
/** 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;
}
示例10: defineColumn_Date
import org.eclipse.swt.widgets.TreeColumn; //導入依賴的package包/類
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)));
}
示例11: SystemTree
import org.eclipse.swt.widgets.TreeColumn; //導入依賴的package包/類
/**
* 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();
}
示例12: getColumnIndex
import org.eclipse.swt.widgets.TreeColumn; //導入依賴的package包/類
/** 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;
}
示例13: handleEvent
import org.eclipse.swt.widgets.TreeColumn; //導入依賴的package包/類
@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);
}
}
}
示例14: updateOrder
import org.eclipse.swt.widgets.TreeColumn; //導入依賴的package包/類
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());
}
}
示例15: controlResized
import org.eclipse.swt.widgets.TreeColumn; //導入依賴的package包/類
@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);
}