Eclipse Form Section nesting problem [message #524656] |
Thu, 01 April 2010 17:07 |
|
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 |
Grant Gayed 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.
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03678 seconds