Java Code Examples for org.eclipse.nebula.widgets.grid.GridColumn#setWordWrap()

The following examples show how to use org.eclipse.nebula.widgets.grid.GridColumn#setWordWrap() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GridSnippet8.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public static void main(String[] args) {
	Display display = new Display();
	Shell shell = new Shell(display);
	shell.setLayout(new FillLayout());

	final Grid grid = new Grid(shell, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
	grid.setHeaderVisible(true);
	grid.setAutoHeight(true);
	grid.setAutoWidth(true);

	GridColumn column1 = new GridColumn(grid, SWT.NONE);
	column1.setText("Column 1");
	column1.setWidth(150);
	column1.setWordWrap(true);

	GridColumn column2 = new GridColumn(grid, SWT.NONE);
	column2.setText("Column 2");
	column2.setWidth(200);
	column2.setWordWrap(true);

	GridItem item1 = new GridItem(grid, SWT.NONE);
	item1.setText(0, "Item 1, Column 0: " + LONG_TEXT);
	item1.setText(1, "Item 1, Column 1: " + LONG_TEXT);

	GridItem item2 = new GridItem(grid, SWT.NONE);
	item2.setText("Item 2, Columns 0-1: " + LONG_TEXT);
	item2.setColumnSpan(0, 1);

	GridItem item3 = new GridItem(grid, SWT.NONE);
	item3.setText(0, "Item 3, Column 0: " + MEDIUM_TEXT);
	item3.setText(1, "Item 3, Column 1: " + MEDIUM_TEXT);

	shell.setSize(400, 400);
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
	display.dispose();
}
 
Example 2
Source File: GridWithTextWrapping.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public static void main(String[] args) {
	Display display = new Display();
	Shell shell = new Shell(display);
	shell.setLayout(new FillLayout());

	fGrid = new Grid(shell, SWT.BORDER | SWT.V_SCROLL);

	fGrid.setTreeLinesVisible(false);
	fGrid.setWordWrapHeader(true);
	fGrid.setHeaderVisible(true);
	GridColumn column = new GridColumn(fGrid, SWT.NONE);
	column.setWordWrap(true);
	column.setText("Column 1");
	column.setWidth(100);
	GridColumn column2 = new GridColumn(fGrid, SWT.NONE);
	column2.setText("Column 2");
	column2.setWidth(100);

	GridItem item1 = new GridItem(fGrid, SWT.NONE);
	item1.setText("First Item. First Item. First Item.");
	item1.setText(1, "xxxxxxx");

	System.out.println("item2");
	final GridItem item2 = new GridItem(fGrid, SWT.NONE);
	item2.setText("This cell contains a lot of text. This cell contains a lot of text");
	item2.setText(1, "xxxxxxx");
	column.addControlListener(new ControlAdapter() {
		@Override
		public void controlResized(ControlEvent e) {
			calculateHeight();
		}
	});

	GridItem item3 = new GridItem(fGrid, SWT.NONE);
	item3.setText("Third Item. Third Item. Third Item. Third Item. Third Item. ");
	item3.setText(1, "xxxxxxx");

	calculateHeight();

	shell.setSize(200, 200);
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
	display.dispose();
}
 
Example 3
Source File: TestBug246608.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public static void main(String[] args) {
	Display display = new Display();
	Shell shell = new Shell(display);
	shell.setLayout(new FillLayout());

	final Grid grid = new Grid(shell, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
	grid.setHeaderVisible(true);
	grid.setAutoWidth(true);

	GridColumn column1 = new GridColumn(grid, SWT.NONE);
	column1.setText("Column 1");
	column1.setWidth(150);
	column1.setWordWrap(true);
	column1.setVerticalAlignment(SWT.TOP);

	GridColumn column2 = new GridColumn(grid, SWT.NONE);
	column2.setText("Column 2");
	column2.setWidth(200);
	column2.setWordWrap(true);
	column2.setVerticalAlignment(SWT.CENTER);

	GridColumn column3 = new GridColumn(grid, SWT.NONE);
	column3.setText("Column 3");
	column3.setWidth(200);
	column3.setVerticalAlignment(SWT.BOTTOM);

	GridItem item1 = new GridItem(grid, SWT.NONE);
	item1.setText(0, "Item 1, Column 0: " + MEDIUM_TEXT);
	item1.setText(1, "Item 1, Column 1: " + MEDIUM_TEXT);
	item1.setText(2, "Item 1, Column 2: " + MEDIUM_TEXT);
	item1.setHeight(150);

	GridItem item2 = new GridItem(grid, SWT.NONE);
	item2.setText("Item 2, Columns 0-1: " + MEDIUM_TEXT);
	item2.setColumnSpan(0, 1);
	item2.setText(2, "Item 2, Column 2: Dummy");
	item2.setHeight(100);

	GridItem item3 = new GridItem(grid, SWT.NONE);
	item3.setText(0, "Item 3, Column 0: " + MEDIUM_TEXT);
	item3.setText(1, "Item 3, Column 1: " + MEDIUM_TEXT);
	item3.setText(2, "Item 3, Column 2: Column");
	item3.setHeight(120);

	shell.setSize(600, 500);
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
	display.dispose();
}