Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Flat borders for a tableviewer on a form
Flat borders for a tableviewer on a form [message #895472] Fri, 13 July 2012 08:00 Go to next message
Christian Pontesegger is currently offline Christian PonteseggerFriend
Messages: 70
Registered: July 2009
Location: Graz, Austria
Member
I am struggling with getting flat borders for a TableViewer on a form page. Maybe someone can point me in the right direction. Here is my test code:

	protected void createFormContent(final IManagedForm managedForm) {
		final FormToolkit toolkit = managedForm.getToolkit();
		final ScrolledForm form = managedForm.getForm();
		form.setText("Empty FormPage");
		final Composite body = form.getBody();
		toolkit.decorateFormHeading(form.getForm());
		toolkit.paintBordersFor(body);
		final FillLayout fillLayout = new FillLayout(SWT.HORIZONTAL);
		fillLayout.marginWidth = 10;
		fillLayout.marginHeight = 10;
		managedForm.getForm().getBody().setLayout(fillLayout);

		final Composite composite_1 = new Composite(managedForm.getForm().getBody(), SWT.NONE);
		managedForm.getToolkit().adapt(composite_1);
		managedForm.getToolkit().paintBordersFor(composite_1);
		final TableColumnLayout tcl_composite_1 = new TableColumnLayout();
		composite_1.setLayout(tcl_composite_1);
		managedForm.getToolkit().paintBordersFor(composite_1);

		mtable = managedForm.getToolkit().createTable(composite_1, SWT.FULL_SELECTION);
		final TableViewer tableViewer = new TableViewer(mtable);
		mtable.setHeaderVisible(true);
		mtable.setLinesVisible(true);
		managedForm.getToolkit().paintBordersFor(mtable);

		final TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
		final TableColumn tblclmnNewColumn = tableViewerColumn.getColumn();
		tcl_composite_1.setColumnData(tblclmnNewColumn, new ColumnWeightData(1, ColumnWeightData.MINIMUM_WIDTH, true));
		tblclmnNewColumn.setText("New Column");

		final TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tableViewer, SWT.NONE);
		final TableColumn tblclmnNewColumn_1 = tableViewerColumn_1.getColumn();
		tcl_composite_1
				.setColumnData(tblclmnNewColumn_1, new ColumnWeightData(1, ColumnWeightData.MINIMUM_WIDTH, true));
		tblclmnNewColumn_1.setText("New Column");
	}
Re: Flat borders for a tableviewer on a form [message #895508 is a reply to message #895472] Fri, 13 July 2012 10:32 Go to previous messageGo to next message
Thorsten Schlathölter is currently offline Thorsten SchlathölterFriend
Messages: 211
Registered: February 2012
Location: Düsseldorf
Senior Member
Hi Christian,
you need to add the following line to your code:

composite_1.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER);


Regards,
Thorsten
Re: Flat borders for a tableviewer on a form [message #895509 is a reply to message #895508] Fri, 13 July 2012 10:47 Go to previous messageGo to next message
Christian Pontesegger is currently offline Christian PonteseggerFriend
Messages: 70
Registered: July 2009
Location: Graz, Austria
Member
Thorsten Schlathölter wrote on Fri, 13 July 2012 06:32

composite_1.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER);


Thanks, works great for the example code provided.

However for some reason the same code won't render a table border within a tabbed property sheet...
Re: Flat borders for a tableviewer on a form [message #895528 is a reply to message #895509] Fri, 13 July 2012 12:02 Go to previous message
Thorsten Schlathölter is currently offline Thorsten SchlathölterFriend
Messages: 211
Registered: February 2012
Location: Düsseldorf
Senior Member
I am not sure but it could be a layout issue. The above code paints the border on the composite_1. Now if this composite_1 has a layout that fills the whole composite, then there is no space for the border. In other words: You must make sure that the used layout provides a margin that leaves enough room for the border.

Regards,
Thorsten
Previous Topic:Closing editor using CTRL+F4 leaves tooltip behind
Next Topic:What are the most important architecture parts of Eclipse?
Goto Forum:
  


Current Time: Fri Nov 28 19:41:06 GMT 2014

Powered by FUDForum. Page generated in 0.14713 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software