StackLayout Problem [message #689812] |
Tue, 28 June 2011 12:17 |
teebee Missing name Messages: 4 Registered: June 2011 |
Junior Member |
|
|
hi everybody
i have problems with stacklayout.
Nothing happens at stacklayout.topcontrol in combination with Composite.layout
package editors;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import editors.NewNodeWizard.Typ;
public class WizardEditDataPage extends WizardPage {
private Composite nothing,container,container2,modelContainer,fieldContainer,interfaceContainer;
private StackLayout stacklayout = new StackLayout();
protected WizardEditDataPage() {
super("Edit Page");
setTitle("Create initial data");
setDescription("Change the data you want to edit.");
}
@Override
public void createControl(Composite parent) {
GridLayout layout = new GridLayout();
layout.numColumns = 3;
parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
container = new Composite(parent, SWT.FILL|SWT.BORDER);
container.setLayout(new GridLayout());
container2 = new Composite(parent, SWT.FILL|SWT.BORDER);
container2.setLayout(stacklayout);
container2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan=3;
GridData gd2 = new GridData(GridData.FILL_HORIZONTAL);
GridData gd3 = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan=2;
nothing= new Composite(container2, SWT.BORDER);
modelContainer = new Composite(container, SWT.BORDER);
fieldContainer = new Composite(container2, SWT.BORDER);
interfaceContainer = new Composite(container2, SWT.BORDER);
nothing.setLayout(layout);
modelContainer.setLayout(layout);
fieldContainer.setLayout(layout);
interfaceContainer.setLayout(layout);
nothing.setLayoutData(gd2);
modelContainer.setLayoutData(gd2);
fieldContainer.setLayoutData(gd2);
interfaceContainer.setLayoutData(gd2);
modelContainer.setVisible(false);
Label l;
Text t;
Font f;
FontData tfd = new FontData();
tfd.setName("Arial");
tfd.setStyle(SWT.BOLD);
f = new Font(getShell().getDisplay(), tfd);
//Model
l = new Label(modelContainer,SWT.NONE);
l.setText("Model");
l.setFont(f);
l.setLayoutData(gd);
l = new Label(modelContainer,SWT.NONE);
l.setText("name");
l.setLayoutData(gd2);
t = new Text(modelContainer,SWT.BORDER);
t.setLayoutData(gd3);
//Field
l = new Label(fieldContainer,SWT.BOLD);
l.setLayoutData(gd);
l.setText("Field");
l.setFont(f);
l = new Label(fieldContainer,SWT.NONE);
l.setText(" ");
l = new Label(fieldContainer,SWT.NONE);
l.setText("name");
t = new Text(fieldContainer,SWT.BORDER);
t.setLayoutData(gd2);
//INTERFACE
l = new Label(interfaceContainer,SWT.BOLD);
l.setLayoutData(gd);
l.setText("Interface");
l.setFont(f);
l = new Label(interfaceContainer,SWT.NONE);
l.setText(" ");
l = new Label(interfaceContainer,SWT.NONE);
l.setText("name");
t = new Text(interfaceContainer,SWT.BORDER);
t.setLayoutData(gd2);
l = new Label(interfaceContainer,SWT.NONE);
l.setText(" ");
l = new Label(interfaceContainer,SWT.NONE);
l.setText("description");
t = new Text(interfaceContainer,SWT.BORDER);
t.setLayoutData(gd2);
fieldContainer.pack();
interfaceContainer.pack();
stacklayout.topControl=nothing;
container2.layout();
setControl(container);
setPageComplete(true);
}
public void init(){
if(((NewNodeWizard)getWizard()).isFileOpen()){
modelContainer.setVisible(false);
}else{
modelContainer.setVisible(true);
}
if(((NewNodeWizard)getWizard()).getNodetype()==Typ.FIELD){
stacklayout.topControl=fieldContainer;
container2.layout();
}else if(((NewNodeWizard)getWizard()).getNodetype()==Typ.INTERFACE){
stacklayout.topControl=interfaceContainer;
container2.layout();
}
// TODO Auto-generated method stub
}
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.03804 seconds