[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform] TableWrapLayout and excess vertical space

Screenshot attached. Notice that the TableWrapLayout has computed the size to be so high as if it was constrained completely in the horizontal direction, even though it's not.

Any ideas?

----

// Begin snippet

public class FolderDetailsPage2 implements IDetailsPage
{
...
...
public void createContents(Composite parent)
{
parent.setLayout(new GridLayout());

final FormToolkit toolkit = new FormToolkit(parent.getDisplay());

final Section section = toolkit.createSection(parent,Section.DESCRIPTION | Section.TITLE_BAR);
section.setLayoutData(new GridData(GridData.FILL_BOTH));
section.setText("Some title");
section.setDescription("Some description");


final Composite client = toolkit.createComposite(section);
client.setLayoutData(new GridData(GridData.FILL_BOTH));
client.setLayout(new GridLayout());
		
final ToolBar toolbar = new ToolBar(client, SWT.BORDER | SWT.WRAP);
toolbar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
final ToolItem sampleItem = new ToolItem(toolbar, SWT.PUSH);
sampleItem.setText("toolbar button");

final TableWrapLayout twl = new TableWrapLayout();
twl.numColumns = 3;

final Composite articleList = toolkit.createComposite(client);
articleList.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW));
articleList.setLayoutData(new GridData(GridData.FILL_BOTH));
articleList.setLayout(twl);

for (int i=0; i<4; i++)
{
toolkit.createButton(articleList, "", SWT.CHECK);

Label label = toolkit.createLabel(articleList,
"This is some very long summary text that i hope to see " +
"wrap as it gets constrained by the window around it",
SWT.WRAP);
label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_GREEN));


label = toolkit.createLabel(articleList, "2007-01-27"); label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
}


section.setClient(client);
}

.. // End snippet

JPEG image