本文整理匯總了Java中org.eclipse.swt.widgets.TreeColumn.setAlignment方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeColumn.setAlignment方法的具體用法?Java TreeColumn.setAlignment怎麽用?Java TreeColumn.setAlignment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.TreeColumn
的用法示例。
在下文中一共展示了TreeColumn.setAlignment方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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;
}
示例2: createPluginColumns
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
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);
}
示例3: createTreeWithUnnamedColumn
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
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) });
}
}
示例4: createComponents
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
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);
}
示例5: createComposite
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
/**
* 뷰어가 담길 컴포지트 생성
*
* @param parent
* @return Composite
*/
public Composite createComposite(final Composite parent) {
Tree tree = new Tree(parent, SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
tree.setLinesVisible(true);
tree.setHeaderVisible(true);
String[] strHeadings = { UMLMessage.LABEL_PROPERTY, UMLMessage.LABEL_VALUE };
TreeColumn propertyTreeColumn = new TreeColumn(tree, SWT.NONE);
propertyTreeColumn.setWidth(240);
propertyTreeColumn.setText(strHeadings[0]);
propertyTreeColumn.setAlignment(SWT.LEFT);
propertyTreeColumn.setResizable(true);
TreeColumn valueTreeColumn = new TreeColumn(tree, SWT.NONE);
valueTreeColumn.setWidth(300);
valueTreeColumn.setText(strHeadings[1]);
valueTreeColumn.setAlignment(SWT.LEFT);
valueTreeColumn.setResizable(true);
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.heightHint = 150;
gridData.horizontalSpan = 2;
tree.setLayoutData(gridData);
viewer = new TreeViewer(tree);
tree.setItemCount(20);
viewer.setContentProvider(new StereotypePropertyTreeContentProvider());
viewer.setLabelProvider(new StereotypePropertyTableColumnLabelProvider(this));
// viewer.setInput(input);
viewer.addSelectionChangedListener(new StereotypePropertySelectionChangedListener(parent, this));
return parent;
}
示例6: 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));
return viewerColumn;
}
示例7: create
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
/**
* Creates the view.
*
* @param root
*/
private void create(final Composite root) {
root.setLayout(new FillLayout());
final Tree tree = new Tree(root, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
tree.setHeaderVisible(true);
treeViewer = new TreeViewer(tree);
tree.setMenu(new ClipboardHandlerTree(treeViewer).getMenu());
final TreeColumn column1 = new TreeColumn(tree, SWT.LEFT);
tree.setLinesVisible(true);
column1.setAlignment(SWT.LEFT);
column1.setText(Resources.getMessage("PropertiesView.1")); //$NON-NLS-1$
column1.setWidth(160);
final TreeColumn column2 = new TreeColumn(tree, SWT.RIGHT);
column2.setAlignment(SWT.LEFT);
column2.setText(Resources.getMessage("PropertiesView.2")); //$NON-NLS-1$
column2.setWidth(100);
treeViewer.setContentProvider(new OutputContentProvider());
treeViewer.setLabelProvider(new OutputLabelProvider());
treeViewer.setInput(roots);
treeViewer.expandAll();
}
示例8: createPartControl
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
public void createPartControl(Composite parent) {
GridData parentData = new GridData(SWT.FILL, SWT.FILL, true, true);
parent.setLayout(new GridLayout(1, true));
parent.setLayoutData(parentData);
Display display = Display.getCurrent();
parent.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
Composite searchMenu = new Composite(parent, SWT.BORDER);
searchMenu.setLayout(new GridLayout(2, false));
searchMenu.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
true, false));
Label searchLabel = new Label(searchMenu, SWT.LEFT);
searchLabel.setLayoutData(new GridData(SWT.FILL, GridData.CENTER,
false, false));
searchLabel.setText("Search: ");
filterText = new Text(searchMenu, SWT.FILL);
filterText.setLayoutData(new GridData(SWT.FILL, GridData.CENTER, true,
false));
Composite tableViewerComposite = new Composite(parent, SWT.NONE);
tableViewerComposite.setLayout(new GridLayout(1, true));
tableViewerComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
true, true));
Tree tree = new Tree(tableViewerComposite, SWT.FILL | SWT.H_SCROLL
| SWT.V_SCROLL);
treeViewer = new TreeViewer(tree);
treeViewer.setData("GroupType", GroupType.STATUS);
treeViewer.getControl().setLayoutData(
new GridData(SWT.FILL, SWT.FILL, true, true));
TreeColumn column1 = new TreeColumn(tree, SWT.LEFT);
tree.setLinesVisible(true);
column1.setAlignment(SWT.LEFT);
TreeColumn column2 = new TreeColumn(tree, SWT.RIGHT);
column2.setAlignment(SWT.LEFT);
column2.setWidth(50);
treeContentProvider = new TreeContentProvider(treeViewer);
treeViewer.setContentProvider(treeContentProvider);
treeViewer.setLabelProvider(new TableLabelProvider(treeViewer,
treeContentProvider));
treeViewer.setInput(getViewSite());
treeViewer.addFilter(filter);
treeViewer.setSorter(new Sorter());
treeViewer.expandAll();
makeActions();
setDoubleClickAction();
createToolbar();
setSearchListener();
parent.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
int parentWidth = parent.getSize().x;
int scrollWidth = 42;
column1.setWidth(parentWidth - column2.getWidth() - scrollWidth);
}
});
}
示例9: createColumns
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
private void createColumns() {
GC gc = new GC(getTree().getParent());
List<Integer> widths = new ArrayList<Integer>();
for (final IGenericTableColumn c : table.getColumns()) {
TreeViewerColumn viewerColumn = new TreeViewerColumn(this, SWT.NONE);
viewerColumn.setLabelProvider(new GenericLabelProvider(c
.getDataProvider()));
if (c.getEditable()) {
viewerColumn.setEditingSupport(c.getEditingSupport(this));
}
TreeColumn column = viewerColumn.getColumn();
if (c.getSortable() && comparator != null) {
column.addSelectionListener(getSelectionAdapter(column, c));
}
column.setText(c.getLabel());
column.setAlignment(c.getAlignMent());
int width;
if (c.getWidth() != -1) {
width = c.getWidth();
}
else if (c.getTextExtent() != null
&& c.getLabel().length() < c.getTextExtent().length()) {
width = gc.textExtent(c.getTextExtent()).x + 2;
}
else {
width = gc.textExtent(c.getLabel()).x + 2;
}
widths.add(width);
column.setWidth(width);
column.setResizable(c.getResizable());
}
gc.dispose();
// /* All columns have their prefered width set now calculate percentages */
// TreeColumnLayout layout = new TreeColumnLayout();
// for (int i = 0; i < widths.size(); i++) {
// layout.setColumnData(getTree().getColumns()[i], new ColumnWeightData(
// widths.get(i), widths.get(i), true));
// }
// getTree().getParent().setLayout(layout);
}
示例10: create
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
/**
* Creates the view.
*
* @param root
*/
private void create(final Composite root) {
root.setLayout(new FillLayout());
Tree tree = new Tree(root, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
tree.setHeaderVisible(true);
treeViewer = new TreeViewer(tree);
tree.setMenu(new ClipboardHandlerTree(treeViewer).getMenu());
final TreeColumn column1 = new TreeColumn(tree, SWT.LEFT);
tree.setLinesVisible(true);
column1.setAlignment(SWT.LEFT);
column1.setText(Resources.getMessage("PropertiesView.3")); //$NON-NLS-1$
column1.setWidth(160);
final TreeColumn column2 = new TreeColumn(tree, SWT.RIGHT);
column2.setAlignment(SWT.LEFT);
column2.setText(Resources.getMessage("PropertiesView.4")); //$NON-NLS-1$
column2.setWidth(100);
final TreeColumn column6 = new TreeColumn(tree, SWT.RIGHT);
column6.setAlignment(SWT.LEFT);
column6.setText(Resources.getMessage("PropertiesView.5")); //$NON-NLS-1$
column6.setWidth(100);
final TreeColumn column7 = new TreeColumn(tree, SWT.RIGHT);
column7.setAlignment(SWT.LEFT);
column7.setText(Resources.getMessage("PropertiesView.101")); //$NON-NLS-1$
column7.setWidth(80);
final TreeColumn column3 = new TreeColumn(tree, SWT.RIGHT);
column3.setAlignment(SWT.LEFT);
column3.setText(Resources.getMessage("PropertiesView.6")); //$NON-NLS-1$
column3.setWidth(50);
final TreeColumn column4 = new TreeColumn(tree, SWT.RIGHT);
column4.setAlignment(SWT.LEFT);
column4.setText(Resources.getMessage("PropertiesView.7")); //$NON-NLS-1$
column4.setWidth(50);
final TreeColumn column5 = new TreeColumn(tree, SWT.RIGHT);
column5.setAlignment(SWT.LEFT);
column5.setText(Resources.getMessage("PropertiesView.8")); //$NON-NLS-1$
column5.setWidth(50);
final TreeColumn column8 = new TreeColumn(tree, SWT.RIGHT);
column8.setAlignment(SWT.LEFT);
column8.setText(Resources.getMessage("PropertiesView.113")); //$NON-NLS-1$
column8.setWidth(50);
final TreeColumn column9 = new TreeColumn(tree, SWT.RIGHT);
column9.setAlignment(SWT.LEFT);
column9.setText(Resources.getMessage("PropertiesView.126")); //$NON-NLS-1$
column9.setWidth(50);
treeViewer.setContentProvider(new InputContentProvider());
treeViewer.setLabelProvider(new InputLabelProvider());
treeViewer.setInput(roots);
treeViewer.expandAll();
}