我正在开发一个具有多页面向导的应用程序。我们希望它像Eclipse中的Preferences页面一样执行。拖动左侧时,只会调整右侧的大小。 下面显示了向导的BasePage。此向导中的每个页面都扩展此BasePage。如何修改BasePage?
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class BasePage extends WizardPage
{
private Logger log = LoggerFactory.getLogger(getClass());
//Color blue = SWTResourceManager.getColor(65, 105, 225);
//Color black = SWTResourceManager.getColor(0, 0, 0);
//Button rbtnIntroduce;
Button rbtnSourcedb;
Button rbtnTargetdb;
Button rbtnDatatype;
Button rbtnSelectObjects;
Button rbtnMigrate;
Composite compositeContent;
SashForm sashContainer;
public BasePage(String name)
{
super(name);
}
@Override
public void createControl(Composite parent)
{
log.debug("BasePage.createControl");
sashContainer = new SashForm(parent, SWT.NONE);
setControl(sashContainer);// must set control for wizard page
GridLayout layout = new GridLayout();
layout.numColumns = 2;
sashContainer.setLayout(layout);
Composite compositeNavigator = new Composite(sashContainer, SWT.BORDER);
/*
rbtnIntroduce = new Button(compositeNavigator, SWT.RADIO);
//rbtnIntroduce.setForeground(blue);
rbtnIntroduce.setBounds(10, 10, 110, 20);
rbtnIntroduce.setText("Introduce");
*/
rbtnTargetdb = new Button(compositeNavigator, SWT.RADIO);
rbtnTargetdb.setBounds(10, 35, 110, 20);
rbtnTargetdb.setText("Target DB");
rbtnSourcedb = new Button(compositeNavigator, SWT.RADIO);
rbtnSourcedb.setBounds(10, 60, 110, 20);
rbtnSourcedb.setText("Source DB");
rbtnDatatype = new Button(compositeNavigator, SWT.RADIO);
rbtnDatatype.setBounds(10, 110, 110, 20);
rbtnDatatype.setText("Datatype Cast");
rbtnSelectObjects = new Button(compositeNavigator, SWT.RADIO);
rbtnSelectObjects.setBounds(10, 85, 110, 20);
rbtnSelectObjects.setText("Object Choose");
rbtnMigrate = new Button(compositeNavigator, SWT.RADIO);
rbtnMigrate.setBounds(10, 135, 110, 20);
rbtnMigrate.setText("Migrate");
compositeContent = new Composite(sashContainer, SWT.NONE);
sashContainer.setWeights(new int[] { 1, 3 });
}
/*
private Button getRadioButton(Composite compositeNavigator, String name)
{
Button rbtn = new Button(compositeNavigator, SWT.RADIO);
rbtn.setText(name);
return rbtn;
}
*/
void updatePage(Button btn)
{
/*
rbtnIntroduce.setSelection(rbtnIntroduce==btn);
rbtnIntroduce.setEnabled(rbtnIntroduce==btn);
//rbtnIntroduce.setForeground(rbtnIntroduce==btn? blue:black);
*/
rbtnTargetdb.setSelection(rbtnTargetdb==btn);
rbtnTargetdb.setEnabled(rbtnTargetdb==btn);
//rbtnTargetdb.setForeground(rbtnTargetdb==btn? blue:black);
rbtnSourcedb.setSelection(rbtnSourcedb==btn);
rbtnSourcedb.setEnabled(rbtnSourcedb==btn);
//rbtnSourcedb.setForeground(rbtnSourcedb==btn? blue:black);
rbtnTargetdb.setSelection(rbtnTargetdb==btn);
rbtnTargetdb.setEnabled(rbtnTargetdb==btn);
//rbtnTargetdb.setForeground(rbtnTargetdb==btn? blue:black);
rbtnDatatype.setSelection(rbtnDatatype==btn);
rbtnDatatype.setEnabled(rbtnDatatype==btn);
//rbtnDatatype.setForeground(rbtnDatatype==btn? blue:black);
rbtnSelectObjects.setSelection(rbtnSelectObjects==btn);
rbtnSelectObjects.setEnabled(rbtnSelectObjects==btn);
//rbtnSelectObjects.setForeground(rbtnSelectObjects==btn? blue:black);
rbtnMigrate.setSelection(rbtnMigrate==btn);
rbtnMigrate.setEnabled(rbtnMigrate==btn);
//rbtnMigrate.setForeground(rbtnMigrate==btn? blue:black);
}
}