Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Eclipse Form Section nesting problem(How do I nest a Form Section within a Section?)
Eclipse Form Section nesting problem [message #524656] Thu, 01 April 2010 17:07 Go to next message
Andrew Hubbs is currently offline Andrew HubbsFriend
Messages: 9
Registered: April 2010
Location: Dallas TX
Junior Member

Hi,

I am trying to build a form view into an EMF model editor.

My form shows up but I cannot get a Section within a Section to show up. Is this possible/how should I be doing it?

Here is a chunk of my code where I create the Sections:
//Parameters Section
		parameterSection = toolkit.createSection(form.getBody(), 
				Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
		clData = new ColumnLayoutData();
		parameterSection.setLayoutData(clData);
		parameterSection.addExpansionListener(new ExpansionAdapter()
			{
				public void expansionStateChanged(ExpansionEvent e){
					form.reflow(true);
				}
			});
		parameterSection.setText("Parameters");
		parameterSection.setDescription("Edit the function's parameters in this section");
		
		parameterSecClient = toolkit.createComposite(parameterSection);
		parameterSecClient.setLayoutData(new GridData());
		
		standardParametersSection = toolkit.createSection(parameterSecClient, Section.TITLE_BAR | Section.EXPANDED);
		standardParametersSection.setText("Standard Parameters");
		clData = new ColumnLayoutData();
		standardParametersSection.setLayoutData(clData);
		standardParametersSection.addExpansionListener(new ExpansionAdapter()
			{
				public void expansionStateChanged(ExpansionEvent e){
					form.reflow(true);
				}
			});
		sParamTable = toolkit.createTable(standardParametersSection, SWT.SINGLE);
		sParamTable.setHeaderVisible(true);
		sParamTable.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
		String tableLabels[] = {"Name", "Value"};
		TableColumn sParamColumns[] = new TableColumn[tableLabels.length];
		for(int i=0; i<tableLabels.length; i++){
			sParamColumns[i] = new TableColumn(sParamTable, SWT.NULL);
			sParamColumns[i].setText(tableLabels[i]);
			sParamColumns[i].pack();
			sParamColumns[i].setWidth(100);
		}
		sParamTable.setLayoutData(new GridData());
		
		Composite sParamButtonComp = toolkit.createComposite(standardParametersSection);
		sParamButtonComp.setLayout(new GridLayout(2, false));
		Button sParamButtons[] = new Button[2];
		sParamButtons[0] = toolkit.createButton(sParamButtonComp, "Add Parameter", SWT.PUSH | SWT.CENTER);
		sParamButtons[0].addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				System.out.println("Add");
			}
		});
		sParamButtons[1] = toolkit.createButton(sParamButtonComp, "Delete Parameter", SWT.PUSH | SWT.CENTER);
		sParamButtons[1].addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				System.out.println("Delete"); 
			}
		});
		sParamButtonComp.update();
		
		
		calculatedParametersSection = toolkit.createSection(parameterSecClient, Section.TITLE_BAR | Section.EXPANDED);
		calculatedParametersSection.setText("Calculated Parameters");
		clData = new ColumnLayoutData();
		calculatedParametersSection.setLayoutData(clData);
		calculatedParametersSection.addExpansionListener(new ExpansionAdapter()
		{
			public void expansionStateChanged(ExpansionEvent e){
				form.reflow(true);
			}
		});
			//create table
		sParamTable = toolkit.createTable(calculatedParametersSection, SWT.SINGLE);
		sParamTable.setHeaderVisible(true);
		sParamTable.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
			//create columns
		TableColumn cParamColumns[] = new TableColumn[tableLabels.length];
		for(int i=0; i<tableLabels.length; i++){
			cParamColumns[i] = new TableColumn(sParamTable, SWT.NULL);
			cParamColumns[i].setText(tableLabels[i]);
			cParamColumns[i].pack();
			cParamColumns[i].setWidth(100);
		}
		sParamTable.setLayoutData(new GridData());
		
		
		parameterSection.setClient(parameterSecClient);


What I have tried to do is this: Create a section, Place a composite within that section that then has two sections next to each other that each have a table and some buttons within them.

Thanks for any suggestions about why I am only getting one empty Section to show up.
Re: Eclipse Form Section nesting problem [message #525432 is a reply to message #524656] Tue, 06 April 2010 14:45 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
You should ask this on the eclipse.platform.ua newsgroup since this is where
the Forms classes come from.

Grant


<andrew.hubbs@siemens.com> wrote in message
news:hp2jtc$4cf$1@build.eclipse.org...
> Hi,
>
> I am trying to build a form view into an EMF model editor.
>
> My form shows up but I cannot get a Section within a Section to show up.
Is this possible/how should I be doing it?
>
> Here is a chunk of my code where I create the Sections:
>
> //Parameters Section
> parameterSection = toolkit.createSection(form.getBody(),
> Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE |
Section.EXPANDED);
> clData = new ColumnLayoutData();
> parameterSection.setLayoutData(clData);
> parameterSection.addExpansionListener(new ExpansionAdapter()
> {
> public void expansionStateChanged(ExpansionEvent e){
> form.reflow(true);
> }
> });
> parameterSection.setText("Parameters");
> parameterSection.setDescription("Edit the function's parameters in this
section");
>
> parameterSecClient = toolkit.createComposite(parameterSection);
> parameterSecClient.setLayoutData(new GridData());
>
> standardParametersSection = toolkit.createSection(parameterSecClient,
Section.TITLE_BAR | Section.EXPANDED);
> standardParametersSection.setText("Standard Parameters");
> clData = new ColumnLayoutData();
> standardParametersSection.setLayoutData(clData);
> standardParametersSection.addExpansionListener(new ExpansionAdapter()
> {
> public void expansionStateChanged(ExpansionEvent e){
> form.reflow(true);
> }
> });
> sParamTable = toolkit.createTable(standardParametersSection, SWT.SINGLE);
> sParamTable.setHeaderVisible(true);
> sParamTable.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
> String tableLabels[] = {"Name", "Value"};
> TableColumn sParamColumns[] = new TableColumn[tableLabels.length];
> for(int i=0; i<tableLabels.length; i++){
> sParamColumns[i] = new TableColumn(sParamTable, SWT.NULL);
> sParamColumns[i].setText(tableLabels[i]);
> sParamColumns[i].pack();
> sParamColumns[i].setWidth(100);
> }
> sParamTable.setLayoutData(new GridData());
>
> Composite sParamButtonComp =
toolkit.createComposite(standardParametersSection);
> sParamButtonComp.setLayout(new GridLayout(2, false));
> Button sParamButtons[] = new Button[2];
> sParamButtons[0] = toolkit.createButton(sParamButtonComp, "Add Parameter",
SWT.PUSH | SWT.CENTER);
> sParamButtons[0].addSelectionListener(new SelectionAdapter() {
> public void widgetSelected(SelectionEvent e) {
> System.out.println("Add");
> }
> });
> sParamButtons[1] = toolkit.createButton(sParamButtonComp, "Delete
Parameter", SWT.PUSH | SWT.CENTER);
> sParamButtons[1].addSelectionListener(new SelectionAdapter() {
> public void widgetSelected(SelectionEvent e) {
> System.out.println("Delete");
> }
> });
> sParamButtonComp.update();
>
>
> calculatedParametersSection = toolkit.createSection(parameterSecClient,
Section.TITLE_BAR | Section.EXPANDED);
> calculatedParametersSection.setText("Calculated Parameters");
> clData = new ColumnLayoutData();
> calculatedParametersSection.setLayoutData(clData);
> calculatedParametersSection.addExpansionListener(new ExpansionAdapter()
> {
> public void expansionStateChanged(ExpansionEvent e){
> form.reflow(true);
> }
> });
> //create table
> sParamTable = toolkit.createTable(calculatedParametersSection,
SWT.SINGLE);
> sParamTable.setHeaderVisible(true);
> sParamTable.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
> //create columns
> TableColumn cParamColumns[] = new TableColumn[tableLabels.length];
> for(int i=0; i<tableLabels.length; i++){
> cParamColumns[i] = new TableColumn(sParamTable, SWT.NULL);
> cParamColumns[i].setText(tableLabels[i]);
> cParamColumns[i].pack();
> cParamColumns[i].setWidth(100);
> }
> sParamTable.setLayoutData(new GridData());
>
>
> parameterSection.setClient(parameterSecClient);
>
>
> What I have tried to do is this: Create a section, Place a composite
within that section that then has two sections next to each other that each
have a table and some buttons within them.
>
> Thanks for any suggestions about why I am only getting one empty Section
to show up.
>
Re: Eclipse Form Section nesting problem [message #527301 is a reply to message #525432] Wed, 14 April 2010 17:53 Go to previous message
Andrew Hubbs is currently offline Andrew HubbsFriend
Messages: 9
Registered: April 2010
Location: Dallas TX
Junior Member

Thank you for directing me to the correct location.

For those interested this problem was a result of not setting the Layout correctly for several of my composites.

Andrew


Thanks,

Andrew Hubbs
Previous Topic:Embedded Mozilla, Cookies
Next Topic:StyledText in SWT Table
Goto Forum:
  


Current Time: Wed Dec 11 06:17:53 GMT 2019

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

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

Back to the top