本文整理匯總了Java中org.eclipse.swt.widgets.TreeColumn.setWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeColumn.setWidth方法的具體用法?Java TreeColumn.setWidth怎麽用?Java TreeColumn.setWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.TreeColumn
的用法示例。
在下文中一共展示了TreeColumn.setWidth方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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 );
}
示例2: getListControl
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
/**
* 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;
}
示例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: installDesigns
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
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);
}
}
示例6: expandColumnsAtIndexes
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
private void expandColumnsAtIndexes(Set<Integer> indexes) {
if (indexes != null && !indexes.isEmpty()) {
TreeColumn[] columns = getTree().getColumns();
for (int i = 0; i < columns.length; i++) {
if (!indexes.contains(i)) {
continue;
}
TreeColumn column = columns[i];
column.setWidth(dataSource.columnWidthForColumnIndex(i));
column.setResizable(true);
}
}
}
示例7: collapseColumnsAtIndexes
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
private void collapseColumnsAtIndexes(Set<Integer> indexes) {
if (indexes == null || indexes.isEmpty()) {
return;
}
TreeColumn[] columns = getTree().getColumns();
for (int i = 0; i < columns.length; i++) {
if (!indexes.contains(i)) {
continue;
}
TreeColumn column = columns[i];
column.setWidth(0);
column.setResizable(false);
}
}
示例8: addTreeColumn
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
private void addTreeColumn(final int column, final String headerText, final String preferenceKey) {
final TreeColumn treeColumn = new TreeColumn(tree, SWT.LEFT);
treeColumn.setText(Messages.getString(headerText));
treeColumn.setWidth(100);
WidgetPreferences.tuneTreeColumn(treeColumn, getClass(), preferenceKey);
// treeColumn.addSelectionListener(new
// TreeColumnSelectionAdaptor(treeViewer, column));
}
示例9: tuneTreeColumn
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
/**
* Restores width of a TreeColumn and adds listener to make sure that
* current width is saved
*
* @param column a TreeColumn
* @param id an id for saving and restoring width of the column
*/
public static void tuneTreeColumn(final TreeColumn column, final String id) {
final Rectangle rectangle = PreferenceConverter.getRectangle(ps, id);
if (rectangle.width > 0) {
column.setWidth(rectangle.width);
}
column.addDisposeListener(new DisposeListener() {
public void widgetDisposed(final DisposeEvent e) {
log.debug("saving widget size, id=" + id);
PreferenceConverter.setValue(ps, id, new Rectangle(0, 0, column.getWidth(), 0));
}
});
}
示例10: 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;
}
示例11: setupTree
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
public static void setupTree(EditColTableDef[] tableDef, Tree tree) {
for (EditColTableDef d : tableDef) {
TreeColumn col = new TreeColumn(tree, SWT.LEFT);
col.setText(d.getLabel());
col.setWidth(d.getWidth());
}
}
示例12: ExecutionSelectionViewerTime
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
/***************************************************************************
*
**************************************************************************/
public ExecutionSelectionViewerTime( Tree tree )
{
super(tree);
setComparator(new ViewerComparator()
{
public int compare(Viewer viewer, Object e1, Object e2)
{
ExecutionSelectionNode t1 = (ExecutionSelectionNode) e1;
ExecutionSelectionNode t2 = (ExecutionSelectionNode) e2;
int result = 0;
if (t1.getType().equals(NodeType.ASRUN))
{
result = t1.getDate().compareTo(t2.getDate());
if (result == 0)
{
result = t1.getLabel().compareTo(t2.getLabel());
}
}
else
{
result = t1.getDate().compareTo(t2.getDate());
}
return result;
};
});
for (ExecutionSelectionColumnTime col : ExecutionSelectionColumnTime.values())
{
TreeColumn c = new TreeColumn(tree, col.style);
c.setText(col.title);
c.setWidth(col.width);
}
setContentProvider(new ExecutionSelectionContentProvider());
setLabelProvider(new ExecutionSelectionLabelProviderTime());
}
示例13: ImportTargetTreeComposite
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
public ImportTargetTreeComposite(Composite parent, final ImportConfigurationWindow window) {
super(parent, true, false, true);
TreeColumn column1 = new TreeColumn(tree, SWT.LEFT);
column1.setText(RM.getLabel("property.element.label"));
column1.setWidth(AbstractWindow.computeWidth(260));
TreeColumn column2 = new TreeColumn(tree, SWT.LEFT);
column2.setText(RM.getLabel("property.conf.label"));
column2.setWidth(AbstractWindow.computeWidth(160));
TreeColumn column3 = new TreeColumn(tree, SWT.LEFT);
column3.setText(RM.getLabel("property.source.label"));
column3.setWidth(AbstractWindow.computeWidth(200));
TreeColumn column4 = new TreeColumn(tree, SWT.LEFT);
column4.setText(RM.getLabel("targetedition.storagedirfield.label"));
column4.setWidth(AbstractWindow.computeWidth(360));
tree.setLinesVisible(AbstractWindow.getTableLinesVisible());
tree.setHeaderVisible(true);
tree.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event arg0) {
window.treeItemSelected();
}
});
tree.addMouseListener(new MouseAdapter() {
public void mouseDown(MouseEvent e) {
TreeItem ti = tree.getItem(new Point(e.x, e.y));
if (ti == null) {
tree.deselectAll();
window.treeItemSelected();
}
}
});
}
示例14: columnResized
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
@Override
public void columnResized(C mergeColumn, int width) {
TreeColumn treeColumn = treeTableColumnToTreeColumn.get(mergeColumn);
if (treeColumn != null) {
// On linux setting the width to the same value blocks mouse resizing
if (treeColumn.getWidth() != width) {
treeColumn.setWidth(width);
}
Layout parentLayout = tree.getParent().getLayout();
if (parentLayout instanceof TreeTableColumnLayout) {
TreeTableColumnLayout layout = (TreeTableColumnLayout) parentLayout;
layout.setColumnWidth(treeColumn, width);
}
}
}
示例15: createTableViewerColumn
import org.eclipse.swt.widgets.TreeColumn; //導入方法依賴的package包/類
private TreeViewerColumn createTableViewerColumn(String title, int width, final int colNumber) {
final TreeViewerColumn viewerColumn = new TreeViewerColumn(viewer, SWT.NONE);
TreeColumn column = viewerColumn.getColumn();
column.setText(title);
column.setWidth(width);
column.setResizable(true);
column.setMoveable(false);
return viewerColumn;
}