本文整理了Java中org.eclipse.swt.widgets.Tree.getColumns()
方法的一些代码示例,展示了Tree.getColumns()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.getColumns()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Tree
类名称:Tree
方法名:getColumns
[英]Returns an array of TreeColumn
s which are the columns in the receiver. Columns are returned in the order that they were created. If no TreeColumn
s were created by the programmer, the array is empty, despite the fact that visually, one column of items may be visible. This occurs when the programmer uses the tree like a list, adding items but never creating a column.
Note: This is not the actual structure used by the receiver to maintain its list of items, so modifying the array will not affect the receiver.
[中]返回TreeColumn
的数组,它们是接收器中的列。列将按创建顺序返回。如果程序员没有创建TreeColumn
s,则数组是空的,尽管在视觉上,一列项目可能是可见的。当程序员像列表一样使用树,添加项目,但从不创建列时,就会发生这种情况。
注意:这不是接收方维护其项目列表所使用的实际结构,因此修改数组不会影响接收方。
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
/**
* @return
*/
private Item[] getViewerColumns() {
if (targetControl instanceof Table) {
return ((Table) targetControl).getColumns();
} else if (targetControl instanceof Tree) {
return ((Tree) targetControl).getColumns();
}
return new Item[0];
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
/**
* {@inheritDoc}
*
* @since 3.5
*/
@Override
protected void setColumnWidths(Scrollable tree, int[] widths) {
TreeColumn[] columns = ((Tree) tree).getColumns();
for (int i = 0; i < widths.length; i++) {
columns[i].setWidth(widths[i]);
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
/**
* @return
*/
private Item[] getViewerColumns() {
if (targetControl instanceof Table) {
return ((Table) targetControl).getColumns();
} else if (targetControl instanceof Tree) {
return ((Tree) targetControl).getColumns();
}
return new Item[0];
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
/**
* @return
*/
private Item[] getViewerColumns() {
if (targetControl instanceof Table) {
return ((Table) targetControl).getColumns();
} else if (targetControl instanceof Tree) {
return ((Tree) targetControl).getColumns();
}
return new Item[0];
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
/**
* Return the columns for the receiver.
*
* @param composite
* @return Item[]
*/
private Item[] getColumns(Composite composite) {
if (composite instanceof Tree) {
return ((Tree) composite).getColumns();
}
return ((Table) composite).getColumns();
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
/**
* {@inheritDoc}
*
* @since 3.5
*/
@Override
protected void setColumnWidths(Scrollable tree, int[] widths) {
TreeColumn[] columns = ((Tree) tree).getColumns();
for (int i = 0; i < widths.length; i++) {
columns[i].setWidth(widths[i]);
}
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
/**
* {@inheritDoc}
*
* @since 1.3
*/
protected void setColumnWidths(Scrollable tree, int[] widths) {
TreeColumn[] columns = ((Tree) tree).getColumns();
for (int i = 0; i < widths.length; i++) {
columns[i].setWidth(widths[i]);
}
}
代码示例来源:origin: inspectIT/inspectIT
/**
* Return the names of all columns in the tree. Not visible columns names will also be included.
* The order of the names will be same to the initial tree column order, thus not reflecting the
* current state of the table if the columns were moved.
*
* @return List of column names.
*/
public List<String> getColumnNames() {
List<String> names = new ArrayList<>();
for (TreeColumn column : treeViewer.getTree().getColumns()) {
names.add(column.getText());
}
return names;
}
代码示例来源:origin: inspectIT/inspectIT
/**
*
*/
private void resizeColumns() {
for (TreeColumn column : treeViewer.getTree().getColumns()) {
column.pack();
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui
/**
* Persists column sizes in cache
*/
protected void persistColumnSizes() {
Tree tree = getTree();
TreeColumn[] columns = tree.getColumns();
for (int i = 0; i < columns.length; i++) {
TreeColumn treeColumn = columns[i];
Object id = treeColumn.getData();
fColumnSizes.put(id, Integer.valueOf(treeColumn.getWidth()));
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
@Override
void setFontDescription (long /*int*/ font) {
super.setFontDescription (font);
TreeColumn[] columns = getColumns ();
for (int i = 0; i < columns.length; i++) {
if (columns[i] != null) {
columns[i].setFontDescription (font);
}
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
@Override
void setFontDescription (int /*long*/ font) {
super.setFontDescription (font);
TreeColumn[] columns = getColumns ();
for (int i = 0; i < columns.length; i++) {
if (columns[i] != null) {
columns[i].setFontDescription (font);
}
}
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.server.ui
public void saveState(IMemento memento) {
TreeColumn[] tc = treeTable.getColumns();
for (int i = 0; i < 3; i++) {
int width = tc[i].getWidth();
if (width != 0)
memento.putInteger(TAG_COLUMN_WIDTH + i, width);
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
@Override
void setFontDescription (int /*long*/ font) {
super.setFontDescription (font);
TreeColumn[] columns = getColumns ();
for (int i = 0; i < columns.length; i++) {
if (columns[i] != null) {
columns[i].setFontDescription (font);
}
}
}
代码示例来源:origin: com.diffplug.durian/durian-swt
/** Builds a {@link TreeViewer} on the given parent. */
public TreeViewer buildTree(Composite parent) {
Tree control = Portal.buildTree(parent, style, linesVisible, headerVisible, columnBuilders);
return buildViewer(new TreeViewer(control), Arrays.asList(control.getColumns()), TreeViewerColumn::new);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
void resetSortState (final Tree tree) {
tree.setSortDirection (SWT.NONE);
TreeColumn [] columns = tree.getColumns();
for (TreeColumn column : columns) {
SelectionListener listener = (SelectionListener)column.getData("SortListener"); //$NON-NLS-1$
if (listener != null) column.removeSelectionListener(listener);
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide
/**
* @param visible
*/
void setVisibleFields(Collection<MarkerField> visible,int[] widths) {
generator.setVisibleFields(visible);
//viewer.setSelection(new StructuredSelection());
//viewer.removeAndClearAll();
createColumns(viewer.getTree().getColumns(), widths);
scheduleUpdate(0L);
}
代码示例来源:origin: org.eclipse/org.eclipse.ui.views
public void controlResized(ControlEvent e) {
Rectangle area = tree.getClientArea();
TreeColumn[] columns = tree.getColumns();
if (area.width > 0) {
columns[0].setWidth(area.width * 40 / 100);
columns[1].setWidth(area.width - columns[0].getWidth() - 4);
tree.removeControlListener(this);
}
}
});
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.views
@Override
public void controlResized(ControlEvent e) {
Rectangle area = tree.getClientArea();
TreeColumn[] columns = tree.getColumns();
if (area.width > 0) {
columns[0].setWidth(area.width * 40 / 100);
columns[1].setWidth(area.width - columns[0].getWidth() - 4);
tree.removeControlListener(this);
}
}
});
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.views
@Override
public void controlResized(ControlEvent e) {
Rectangle area = tree.getClientArea();
TreeColumn[] columns = tree.getColumns();
if (area.width > 0) {
columns[0].setWidth(area.width * 40 / 100);
columns[1].setWidth(area.width - columns[0].getWidth() - 4);
tree.removeControlListener(this);
}
}
});
内容来源于网络,如有侵权,请联系作者删除!