use of org.eclipse.swt.custom.StackLayout in project tdi-studio-se by Talend.
the class SurrogateSection method createContents.
@Override
protected void createContents(Composite parent) {
dragDropManager = new DragDropManager();
key = new SurrogateKey();
final Color white = parent.getDisplay().getSystemColor(SWT.COLOR_WHITE);
parent.setBackground(white);
Composite composite = new Composite(parent, SWT.NONE);
composite.setBackground(white);
GridDataFactory.fillDefaults().grab(true, true).align(SWT.CENTER, SWT.CENTER).applyTo(composite);
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(composite);
// row 1
Label nameLabel = new Label(composite, SWT.NONE);
//$NON-NLS-1$
nameLabel.setText("name");
nameLabel.setBackground(white);
GridDataFactory.swtDefaults().applyTo(nameLabel);
nameText = new Text(composite, SWT.BORDER);
GridDataFactory.swtDefaults().hint(SURROGATE_FIELD_WIDTH, SWT.DEFAULT).applyTo(nameText);
nameText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (StringUtils.isEmpty(nameText.getText())) {
nameText.setBackground(ERROR_COLOR);
} else {
nameText.setBackground(white);
}
// update model value
key.setColumn(nameText.getText());
}
});
// row 2
Label creationLabel = new Label(composite, SWT.NONE);
//$NON-NLS-1$
creationLabel.setText("creation");
creationLabel.setBackground(white);
GridDataFactory.swtDefaults().applyTo(creationLabel);
creationCombo = new CCombo(composite, SWT.READ_ONLY | SWT.BORDER);
creationCombo.setItems(getScdManager().getSurrogateCreationTypeNames());
GridDataFactory.swtDefaults().hint(SURROGATE_FIELD_WIDTH + 3, SWT.DEFAULT).applyTo(creationCombo);
// row 3
Label complementLabel = new Label(composite, SWT.NONE);
//$NON-NLS-1$
complementLabel.setText("complement");
complementLabel.setBackground(white);
GridDataFactory.swtDefaults().applyTo(complementLabel);
final Composite complementComp = new Composite(composite, SWT.NONE);
GridDataFactory.swtDefaults().applyTo(complementComp);
final StackLayout stack = new StackLayout();
complementComp.setLayout(stack);
final Composite inputFieldComp = new Composite(complementComp, SWT.NONE);
GridLayoutFactory.fillDefaults().applyTo(inputFieldComp);
inputFieldLabel = new Label(inputFieldComp, SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, true).hint(100, SWT.DEFAULT).applyTo(inputFieldLabel);
// add drag and drop support for input field
IDragDropDelegate delegate = createDragDropDelegate(inputFieldLabel);
dragDropManager.addDragSupport(inputFieldLabel, delegate);
dragDropManager.addDropSupport(inputFieldLabel, delegate);
// show DB_SEQUENCE in OraleSCD
// final boolean enableOracle = getScdManager().enableOracle();
// if (enableOracle) {
dbSequenceComp = new Composite(complementComp, SWT.NONE);
GridLayoutFactory.fillDefaults().applyTo(dbSequenceComp);
dbSequenceText = new Text(dbSequenceComp, SWT.BORDER);
dbSequenceText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (StringUtils.isEmpty(dbSequenceText.getText())) {
dbSequenceText.setBackground(ERROR_COLOR);
} else {
dbSequenceText.setBackground(white);
}
if (key.getCreation() == SurrogateCreationType.DB_SEQUENCE) {
key.setComplement(dbSequenceText.getText());
}
}
});
GridDataFactory.fillDefaults().hint(SURROGATE_FIELD_WIDTH, SWT.DEFAULT).applyTo(dbSequenceText);
TalendProposalUtils.installOn(dbSequenceText, null);
// }
final Composite routineFieldComp = new Composite(complementComp, SWT.NONE);
GridLayoutFactory.fillDefaults().applyTo(routineFieldComp);
routineText = new Text(routineFieldComp, SWT.BORDER);
routineText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (StringUtils.isEmpty(routineText.getText())) {
routineText.setBackground(ERROR_COLOR);
} else {
routineText.setBackground(white);
}
if (key.getCreation() == SurrogateCreationType.ROUTINE) {
// update model value
key.setComplement(routineText.getText());
}
}
});
GridDataFactory.fillDefaults().hint(SURROGATE_FIELD_WIDTH, SWT.DEFAULT).applyTo(routineText);
// add content proposal for routine
TalendProposalUtils.installOn(routineText, null);
final Label emptyLabel = new Label(complementComp, SWT.NONE);
emptyLabel.setBackground(white);
stack.topControl = emptyLabel;
// when combo is changed, also change the control in complement
creationSwitch = new Runnable() {
public void run() {
String diaplayName = creationCombo.getText();
// SurrogateCreationType type = SurrogateCreationType.getTypeByIndex(index + 1);
SurrogateCreationType type = SurrogateCreationType.getTypeByName(diaplayName);
key.setCreation(type);
if (type == SurrogateCreationType.ROUTINE) {
// routineText;
stack.topControl = routineFieldComp;
if (StringUtils.isEmpty(routineText.getText())) {
routineText.setBackground(ERROR_COLOR);
//$NON-NLS-1$
key.setComplement("");
} else {
routineText.setBackground(white);
}
//$NON-NLS-1$
inputFieldLabel.setText("");
// if (enableOracle) {
//$NON-NLS-1$
dbSequenceText.setText("");
// }
} else if (type == SurrogateCreationType.INPUT_FIELD) {
// inputFieldLabel;
stack.topControl = inputFieldComp;
if (StringUtils.isEmpty(inputFieldLabel.getText())) {
inputFieldLabel.setBackground(ERROR_COLOR);
//$NON-NLS-1$
key.setComplement("");
} else {
inputFieldLabel.setBackground(null);
}
//$NON-NLS-1$
routineText.setText("");
// if (enableOracle) {
//$NON-NLS-1$
dbSequenceText.setText("");
// }
} else if (type == SurrogateCreationType.DB_SEQUENCE) {
// else if (type == SurrogateCreationType.DB_SEQUENCE && enableOracle) {
// dbSequenceText;
stack.topControl = dbSequenceComp;
if (StringUtils.isEmpty(dbSequenceText.getText())) {
dbSequenceText.setBackground(ERROR_COLOR);
//$NON-NLS-1$
key.setComplement("");
} else {
dbSequenceText.setBackground(white);
}
//$NON-NLS-1$
inputFieldLabel.setText("");
routineText.setText("");
} else {
stack.topControl = emptyLabel;
//$NON-NLS-1$
routineText.setText("");
//$NON-NLS-1$
inputFieldLabel.setText("");
// if (enableOracle) {
//$NON-NLS-1$
dbSequenceText.setText("");
// }
//$NON-NLS-1$
key.setComplement("");
}
scdManager.fireFieldChange();
complementComp.layout();
}
};
creationCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
creationSwitch.run();
}
});
}
use of org.eclipse.swt.custom.StackLayout in project tdi-studio-se by Talend.
the class LoginDialog method createDialogArea.
/**
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createDialogArea(final Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(2, false);
layout.marginWidth = 0;
layout.marginHeight = 0;
layout.horizontalSpacing = 0;
layout.verticalSpacing = 0;
container.setLayout(layout);
// container.setBackground(new Color(null, 215, 215, 215));
container.setBackground(new Color(null, 255, 255, 255));
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
new ImageCanvas(container, brandingService.getLoginVImage());
if (!perReader.isHaveUserPer()) {
perReader.createPropertyFile();
}
base = new Composite(container, SWT.NONE);
base.setLayoutData(new GridData(GridData.FILL_BOTH));
stackLayout = new StackLayout();
base.setLayout(stackLayout);
if (!PluginChecker.isSVNProviderPluginLoaded()) {
// tos
loginComposite = new LoginComposite(base, SWT.NONE, this, tosLoginComposite, stackLayout);
loginComposite.populateProjectList();
tosLoginComposite = new TOSLoginComposite(base, SWT.NONE, loginComposite, this);
} else {
loginComposite = new LoginComposite(base, SWT.NONE, this, tosLoginComposite, stackLayout);
}
GridData data = new GridData(GridData.FILL_BOTH);
// data.widthHint = INNER_LOGIN_COMPOSITE_WIDTH;
// data.heightHint = DIALOG_HEIGHT;
loginComposite.setLayoutData(data);
stackLayout.topControl = loginComposite;
base.layout();
if (!PluginChecker.isSVNProviderPluginLoaded()) {
Project[] projectList = readProject();
if (projectList.length > 0) {
advanced();
}
}
return container;
}
use of org.eclipse.swt.custom.StackLayout in project tdi-studio-se by Talend.
the class LoginDialogV2 method createLogonInfoArea.
protected void createLogonInfoArea(Composite container) {
// vertical seperator line
Composite verticalLine = new Composite(container, SWT.NONE);
verticalLine.setBackground(VERTICAL_SEPERATOR_LINE_COLOR);
GridData verticalLineGridData = new GridData(GridData.FILL_VERTICAL);
verticalLineGridData.widthHint = 1;
verticalLine.setLayoutData(verticalLineGridData);
Composite loginInfoArea = new Composite(container, SWT.NONE);
GridData brandingAreaGridData = (GridData) brandingArea.getLayoutData();
GridData loginInfoAreaGridData = new GridData(GridData.FILL_BOTH);
// loginInfoAreaGridData.minimumWidth = 350;
// loginInfoAreaGridData.minimumHeight = brandingAreaGridData.minimumHeight;
loginInfoAreaGridData.widthHint = (int) Math.ceil(realWidthRate * logonInfoAreaWidth);
loginInfoAreaGridData.heightHint = brandingAreaGridData.heightHint;
loginInfoArea.setLayoutData(loginInfoAreaGridData);
loginInfoArea.setLayout(new FormLayout());
base = new Composite(loginInfoArea, SWT.NONE);
FormData baseFormData = new FormData();
baseFormData.top = new FormAttachment(0, 0);
baseFormData.bottom = new FormAttachment(100, 0);
baseFormData.left = new FormAttachment(0, 10);
baseFormData.right = new FormAttachment(100, 0);
base.setLayoutData(baseFormData);
base.setBackground(backgroundColor);
stackLayout = new StackLayout();
stackLayout.marginWidth = 10;
stackLayout.marginHeight = 10;
base.setLayout(stackLayout);
}
use of org.eclipse.swt.custom.StackLayout in project bndtools by bndtools.
the class ResolutionResultsWizardPage method createControl.
/**
* Create contents of the wizard.
*
* @param parent
*/
@Override
public void createControl(Composite parent) {
parent.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
Composite container = new Composite(parent, SWT.NULL);
setControl(container);
stack = new StackLayout();
container.setLayout(stack);
resolutionSuccessPanel.createControl(container);
resolutionFailurePanel.createControl(container);
updateUi();
}
use of org.eclipse.swt.custom.StackLayout in project eclipse.platform.text by eclipse.
the class StatusTextEditor method createPartControl.
/*
* @see org.eclipse.ui.texteditor.AbstractTextEditor.createPartControl(Composite)
*/
@Override
public void createPartControl(Composite parent) {
fParent = new Composite(parent, SWT.NONE);
fStackLayout = new StackLayout();
fParent.setLayout(fStackLayout);
fDefaultComposite = new Composite(fParent, SWT.NONE);
fDefaultComposite.setLayout(new FillLayout());
super.createPartControl(fDefaultComposite);
updatePartControl(getEditorInput());
}
Aggregations