use of org.eclipse.swt.events.SelectionListener in project translationstudio8 by heartsome.
the class SetSplitPointByWordNumDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite tparent = (Composite) super.createDialogArea(parent);
GridData parentData = new GridData(SWT.FILL, SWT.FILL, true, true);
parentData.widthHint = 400;
parentData.heightHint = 350;
tparent.setLayoutData(parentData);
GridLayoutFactory.swtDefaults().numColumns(1).applyTo(tparent);
Group typeGroup = new Group(tparent, SWT.NONE);
typeGroup.setText(Messages.getString("SetSplitPointByWordNumDialog.splitType"));
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(typeGroup);
GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(true).applyTo(typeGroup);
averageBtn = new Button(typeGroup, SWT.RADIO);
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(averageBtn);
averageBtn.setText(Messages.getString("SetSplitPointByWordNumDialog.splitByAverWordNum"));
averageBtn.setSelection(true);
wordNumberBtn = new Button(typeGroup, SWT.RADIO);
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(wordNumberBtn);
wordNumberBtn.setText(Messages.getString("SetSplitPointByWordNumDialog.splitByFixWordNum"));
// >显示总字数的面板
Composite allNumCmp = new Composite(tparent, SWT.NONE);
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).applyTo(allNumCmp);
GridLayoutFactory.swtDefaults().numColumns(2).applyTo(allNumCmp);
Label countLbl = new Label(allNumCmp, SWT.NONE);
countLbl.setText(Messages.getString("SetSplitPointByWordNumDialog.curFileTotalWordNum"));
countLbl.setFont(totalLblFont);
Label countValueLbl = new Label(allNumCmp, SWT.NONE);
countValueLbl.setText(totalWordNum + "");
countValueLbl.setFont(totalLblFont);
// >两个面板的父面板
Composite contentCmp = new Composite(tparent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, true).applyTo(contentCmp);
contentCmp.setLayout(stack);
// >>平均字数分割方式的面板
averageContentCmp = new Composite(contentCmp, SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, true).applyTo(averageContentCmp);
GridLayoutFactory.swtDefaults().numColumns(2).applyTo(averageContentCmp);
Label segLbl = new Label(averageContentCmp, SWT.NONE);
segLbl.setText(Messages.getString("SetSplitPointByWordNumDialog.segNumLbl"));
segSpiner = new Spinner(averageContentCmp, SWT.BORDER);
segSpiner.setIncrement(1);
segSpiner.setMinimum(2);
segSpiner.setMaximum(totalTuNum - 1);
segSpiner.setSelection(segList.size());
segSpiner.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent arg0) {
String text = segSpiner.getText();
if (!(text.matches("\\d{1,}") && Integer.parseInt(text) <= (totalTuNum - 1))) {
segSpiner.setSelection(2);
}
}
});
GridDataFactory.swtDefaults().hint(50, SWT.DEFAULT).applyTo(segSpiner);
// >>按指定字数分割的面板
wordNumberScroll = new ScrolledComposite(contentCmp, SWT.NONE | SWT.V_SCROLL | SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, true).applyTo(wordNumberScroll);
GridLayoutFactory.swtDefaults().numColumns(1).applyTo(wordNumberScroll);
wordNumberScroll.setExpandHorizontal(true);
wordNumberScroll.setExpandVertical(true);
segParentCmp = new Composite(wordNumberScroll, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, false).applyTo(segParentCmp);
GridLayoutFactory.swtDefaults().spacing(SWT.DEFAULT, 0).numColumns(1).applyTo(segParentCmp);
wordNumberScroll.setContent(segParentCmp);
averageBtn.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
viewerTopControl();
}
public void widgetDefaultSelected(SelectionEvent e) {
viewerTopControl();
}
});
wordNumberBtn.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
viewerTopControl();
}
public void widgetDefaultSelected(SelectionEvent e) {
viewerTopControl();
}
});
stack.topControl = averageContentCmp;
// 开始创建片断列表
for (int i = 0; i < segList.size(); i++) {
SegPointBean bean = segList.get(i);
createSegCmp(bean);
}
wordNumberScroll.setMinSize(segParentCmp.computeSize(SWT.DEFAULT, SWT.DEFAULT));
segParentCmp.layout();
wordNumberScroll.layout();
return tparent;
}
use of org.eclipse.swt.events.SelectionListener in project pentaho-kettle by pentaho.
the class WebServiceDialog method open.
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
props.setLook(shell);
setShellImage(shell, meta);
changed = meta.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "WebServiceDialog.DialogTitle"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.top = new FormAttachment(0, margin);
fdlStepname.right = new FormAttachment(middle, -margin);
wlStepname.setLayoutData(fdlStepname);
wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStepname.setText(stepname);
props.setLook(wStepname);
wStepname.addModifyListener(lsMod);
fdStepname = new FormData();
fdStepname.left = new FormAttachment(middle, 0);
fdStepname.top = new FormAttachment(0, margin);
fdStepname.right = new FormAttachment(100, 0);
wStepname.setLayoutData(fdStepname);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// Add a tab which contains information on the web service(s)
//
tabItemWebService = new CTabItem(wTabFolder, SWT.NONE);
tabItemWebService.setText(BaseMessages.getString(PKG, "WebServiceDialog.MainTab.TabTitle"));
Composite compositeTabWebService = new Composite(wTabFolder, SWT.NONE);
props.setLook(compositeTabWebService);
FormLayout fileLayout = new FormLayout();
fileLayout.marginWidth = 3;
fileLayout.marginHeight = 3;
compositeTabWebService.setLayout(fileLayout);
// URL
wlURL = new Label(compositeTabWebService, SWT.RIGHT);
wlURL.setText(BaseMessages.getString(PKG, "WebServiceDialog.URL.Label"));
props.setLook(wlURL);
FormData fdlURL = new FormData();
fdlURL.left = new FormAttachment(0, 0);
fdlURL.top = new FormAttachment(0, margin);
fdlURL.right = new FormAttachment(middle, -margin);
wlURL.setLayoutData(fdlURL);
wbURL = new Button(compositeTabWebService, SWT.PUSH | SWT.CENTER);
props.setLook(wbURL);
wbURL.setText(BaseMessages.getString(PKG, "WebServiceDialog.URL.Load"));
FormData fdbURL = new FormData();
fdbURL.right = new FormAttachment(100, 0);
fdbURL.top = new FormAttachment(0, 0);
wbURL.setLayoutData(fdbURL);
wbURL.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
//
if (!Utils.isEmpty(wURL.getText())) {
try {
initTreeTabWebService(wURL.getText());
} catch (Throwable throwable) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "WebServiceDialog.Exception.UnableToLoadWebService.Title"), BaseMessages.getString(PKG, "WebServiceDialog.Exception.UnableToLoadWebService.Message"), throwable);
}
}
}
});
wbFile = new Button(compositeTabWebService, SWT.PUSH | SWT.CENTER);
props.setLook(wbFile);
wbFile.setText(BaseMessages.getString(PKG, "WebServiceDialog.File.Load"));
FormData fdbFile = new FormData();
fdbFile.right = new FormAttachment(wbURL, 0);
fdbFile.top = new FormAttachment(0, 0);
wbFile.setLayoutData(fdbFile);
wbFile.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
// We will load the WSDL from a file so we can at least try to debug the metadata extraction phase from the
// support side.
//
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*.wsdl;*.WSDL", "*.*" });
dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "WebServiceDialog.FileType.WsdlFiles"), BaseMessages.getString(PKG, "System.FileType.CSVFiles"), BaseMessages.getString(PKG, "System.FileType.TextFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
if (dialog.open() != null) {
String filename = dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName();
try {
initTreeTabWebService(new File(filename).toURI().toASCIIString());
} catch (Throwable throwable) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "WebServiceDialog.Exception.UnableToLoadWebService.Title"), BaseMessages.getString(PKG, "WebServiceDialog.Exception.UnableToLoadWebService.Message"), throwable);
}
}
}
});
wURL = new TextVar(transMeta, compositeTabWebService, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wURL.addModifyListener(lsMod);
props.setLook(wURL);
FormData fdURL = new FormData();
fdURL.left = new FormAttachment(middle, 0);
fdURL.top = new FormAttachment(0, margin);
fdURL.right = new FormAttachment(wbFile, -margin);
wURL.setLayoutData(fdURL);
// Operation
wlOperation = new Label(compositeTabWebService, SWT.RIGHT);
wlOperation.setText(BaseMessages.getString(PKG, "WebServiceDialog.Operation.Label"));
props.setLook(wlOperation);
FormData fdlOperation = new FormData();
fdlOperation.left = new FormAttachment(0, 0);
fdlOperation.top = new FormAttachment(wURL, margin);
fdlOperation.right = new FormAttachment(middle, -margin);
wlOperation.setLayoutData(fdlOperation);
wOperation = new CCombo(compositeTabWebService, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wOperation.addModifyListener(lsMod);
wOperation.setToolTipText(BaseMessages.getString(PKG, "WebServiceDialog.Operation.Tooltip"));
props.setLook(wOperation);
FormData fdOperation = new FormData();
fdOperation.top = new FormAttachment(wURL, margin);
fdOperation.left = new FormAttachment(middle, 0);
fdOperation.right = new FormAttachment(100, 0);
wOperation.setLayoutData(fdOperation);
wOperation.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent arg0) {
try {
selectWSDLOperation(wOperation.getText());
} catch (KettleException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void widgetDefaultSelected(SelectionEvent arg0) {
// TODO Auto-generated method stub
}
});
// Operation request name (optional)
wlOperationRequest = new Label(compositeTabWebService, SWT.RIGHT);
wlOperationRequest.setText(BaseMessages.getString(PKG, "WebServiceDialog.OperationRequest.Label"));
props.setLook(wlOperationRequest);
FormData fdlOperationRequest = new FormData();
fdlOperationRequest.left = new FormAttachment(0, 0);
fdlOperationRequest.top = new FormAttachment(wOperation, margin);
fdlOperationRequest.right = new FormAttachment(middle, -margin);
wlOperationRequest.setLayoutData(fdlOperationRequest);
wOperationRequest = new Text(compositeTabWebService, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wOperationRequest.addModifyListener(lsMod);
wOperationRequest.setToolTipText(BaseMessages.getString(PKG, "WebServiceDialog.OperationRequest.Tooltip"));
props.setLook(wOperationRequest);
FormData fdOperationRequest = new FormData();
fdOperationRequest.top = new FormAttachment(wOperation, margin);
fdOperationRequest.left = new FormAttachment(middle, 0);
fdOperationRequest.right = new FormAttachment(100, 0);
wOperationRequest.setLayoutData(fdOperationRequest);
// Pas d'appel
wlStep = new Label(compositeTabWebService, SWT.RIGHT);
wlStep.setText(BaseMessages.getString(PKG, "WebServiceDialog.Step.Label"));
props.setLook(wlStep);
FormData fdlStep = new FormData();
fdlStep.left = new FormAttachment(0, 0);
fdlStep.top = new FormAttachment(wOperationRequest, margin);
fdlStep.right = new FormAttachment(middle, -margin);
wlStep.setLayoutData(fdlStep);
wStep = new Text(compositeTabWebService, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStep.addModifyListener(lsMod);
wStep.setToolTipText(BaseMessages.getString(PKG, "WebServiceDialog.Step.Tooltip"));
props.setLook(wStep);
FormData fdStep = new FormData();
fdStep.top = new FormAttachment(wOperationRequest, margin);
fdStep.left = new FormAttachment(middle, 0);
fdStep.right = new FormAttachment(100, 0);
wStep.setLayoutData(fdStep);
// Option to pass all input data to output
//
wlPassInputData = new Label(compositeTabWebService, SWT.RIGHT);
wlPassInputData.setText(BaseMessages.getString(PKG, "WebServiceDialog.PassInputData.Label"));
props.setLook(wlPassInputData);
FormData fdlPassInputData = new FormData();
fdlPassInputData.left = new FormAttachment(0, 0);
fdlPassInputData.top = new FormAttachment(wStep, margin);
fdlPassInputData.right = new FormAttachment(middle, -margin);
wlPassInputData.setLayoutData(fdlPassInputData);
wPassInputData = new Button(compositeTabWebService, SWT.CHECK);
wPassInputData.setToolTipText(BaseMessages.getString(PKG, "WebServiceDialog.PassInputData.Tooltip"));
props.setLook(wPassInputData);
FormData fdPassInputData = new FormData();
fdPassInputData.top = new FormAttachment(wStep, margin);
fdPassInputData.left = new FormAttachment(middle, 0);
fdPassInputData.right = new FormAttachment(100, 0);
wPassInputData.setLayoutData(fdPassInputData);
// Option to use 2.5/3.0 compatible parsing logic
//
wlCompatible = new Label(compositeTabWebService, SWT.RIGHT);
wlCompatible.setText(BaseMessages.getString(PKG, "WebServiceDialog.Compatible.Label"));
props.setLook(wlCompatible);
FormData fdlCompatible = new FormData();
fdlCompatible.left = new FormAttachment(0, 0);
fdlCompatible.top = new FormAttachment(wPassInputData, margin);
fdlCompatible.right = new FormAttachment(middle, -margin);
wlCompatible.setLayoutData(fdlCompatible);
wCompatible = new Button(compositeTabWebService, SWT.CHECK);
wCompatible.setToolTipText(BaseMessages.getString(PKG, "WebServiceDialog.Compatible.Tooltip"));
props.setLook(wCompatible);
FormData fdCompatible = new FormData();
fdCompatible.top = new FormAttachment(wPassInputData, margin);
fdCompatible.left = new FormAttachment(middle, 0);
fdCompatible.right = new FormAttachment(100, 0);
wCompatible.setLayoutData(fdCompatible);
// HTTP Login
wlRepeatingElement = new Label(compositeTabWebService, SWT.RIGHT);
wlRepeatingElement.setText(BaseMessages.getString(PKG, "WebServiceDialog.RepeatingElement.Label"));
props.setLook(wlRepeatingElement);
FormData fdlRepeatingElement = new FormData();
fdlRepeatingElement.top = new FormAttachment(wCompatible, margin);
fdlRepeatingElement.left = new FormAttachment(0, 0);
fdlRepeatingElement.right = new FormAttachment(middle, -margin);
wlRepeatingElement.setLayoutData(fdlRepeatingElement);
wRepeatingElement = new TextVar(transMeta, compositeTabWebService, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wRepeatingElement.addModifyListener(lsMod);
wRepeatingElement.setToolTipText(BaseMessages.getString(PKG, "WebServiceDialog.RepeatingElement.Tooltip"));
props.setLook(wRepeatingElement);
FormData fdRepeatingElement = new FormData();
fdRepeatingElement.top = new FormAttachment(wCompatible, margin);
fdRepeatingElement.left = new FormAttachment(middle, 0);
fdRepeatingElement.right = new FormAttachment(100, 0);
wRepeatingElement.setLayoutData(fdRepeatingElement);
// Return the SOAP body as a String or not?
//
wlReplyAsString = new Label(compositeTabWebService, SWT.RIGHT);
wlReplyAsString.setText(BaseMessages.getString(PKG, "WebServiceDialog.ReplyAsString.Label"));
props.setLook(wlReplyAsString);
FormData fdlBodyAsString = new FormData();
fdlBodyAsString.left = new FormAttachment(0, 0);
fdlBodyAsString.top = new FormAttachment(wRepeatingElement, margin);
fdlBodyAsString.right = new FormAttachment(middle, -margin);
wlReplyAsString.setLayoutData(fdlBodyAsString);
wReplyAsString = new Button(compositeTabWebService, SWT.CHECK);
wReplyAsString.setToolTipText(BaseMessages.getString(PKG, "WebServiceDialog.ReplyAsString.Tooltip"));
props.setLook(wReplyAsString);
FormData fdBodyAsString = new FormData();
fdBodyAsString.top = new FormAttachment(wRepeatingElement, margin);
fdBodyAsString.left = new FormAttachment(middle, 0);
fdBodyAsString.right = new FormAttachment(100, 0);
wReplyAsString.setLayoutData(fdBodyAsString);
// ////////////////////////
// START HTTP AUTH GROUP
Group gHttpAuth = new Group(compositeTabWebService, SWT.SHADOW_ETCHED_IN);
gHttpAuth.setText(BaseMessages.getString(PKG, "WebServicesDialog.HttpAuthGroup.Label"));
FormLayout httpAuthLayout = new FormLayout();
httpAuthLayout.marginWidth = 3;
httpAuthLayout.marginHeight = 3;
gHttpAuth.setLayout(httpAuthLayout);
props.setLook(gHttpAuth);
// HTTP Login
wlHttpLogin = new Label(gHttpAuth, SWT.RIGHT);
wlHttpLogin.setText(BaseMessages.getString(PKG, "WebServiceDialog.HttpLogin.Label"));
props.setLook(wlHttpLogin);
FormData fdlHttpLogin = new FormData();
fdlHttpLogin.top = new FormAttachment(0, margin);
fdlHttpLogin.left = new FormAttachment(0, 0);
fdlHttpLogin.right = new FormAttachment(middle, -margin);
wlHttpLogin.setLayoutData(fdlHttpLogin);
wHttpLogin = new TextVar(transMeta, gHttpAuth, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wHttpLogin.addModifyListener(lsMod);
wHttpLogin.setToolTipText(BaseMessages.getString(PKG, "WebServiceDialog.HttpLogin.Tooltip"));
props.setLook(wHttpLogin);
FormData fdHttpLogin = new FormData();
fdHttpLogin.top = new FormAttachment(0, margin);
fdHttpLogin.left = new FormAttachment(middle, 0);
fdHttpLogin.right = new FormAttachment(100, 0);
wHttpLogin.setLayoutData(fdHttpLogin);
// HTTP Password
wlHttpPassword = new Label(gHttpAuth, SWT.RIGHT);
wlHttpPassword.setText(BaseMessages.getString(PKG, "WebServiceDialog.HttpPassword.Label"));
props.setLook(wlHttpPassword);
FormData fdlHttpPassword = new FormData();
fdlHttpPassword.top = new FormAttachment(wHttpLogin, margin);
fdlHttpPassword.left = new FormAttachment(0, 0);
fdlHttpPassword.right = new FormAttachment(middle, -margin);
wlHttpPassword.setLayoutData(fdlHttpPassword);
wHttpPassword = new PasswordTextVar(transMeta, gHttpAuth, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wHttpPassword.addModifyListener(lsMod);
wHttpPassword.setToolTipText(BaseMessages.getString(PKG, "WebServiceDialog.HttpPassword.Tooltip"));
props.setLook(wHttpPassword);
FormData fdHttpPassword = new FormData();
fdHttpPassword.top = new FormAttachment(wHttpLogin, margin);
fdHttpPassword.left = new FormAttachment(middle, 0);
fdHttpPassword.right = new FormAttachment(100, 0);
wHttpPassword.setLayoutData(fdHttpPassword);
FormData fdHttpAuth = new FormData();
fdHttpAuth.left = new FormAttachment(0, 0);
fdHttpAuth.right = new FormAttachment(100, 0);
fdHttpAuth.top = new FormAttachment(wReplyAsString, margin);
gHttpAuth.setLayoutData(fdHttpAuth);
// END HTTP AUTH GROUP
// ////////////////////////
// ////////////////////////
// START PROXY GROUP
Group gProxy = new Group(compositeTabWebService, SWT.SHADOW_ETCHED_IN);
gProxy.setText(BaseMessages.getString(PKG, "WebServicesDialog.ProxyGroup.Label"));
FormLayout proxyLayout = new FormLayout();
proxyLayout.marginWidth = 3;
proxyLayout.marginHeight = 3;
gProxy.setLayout(proxyLayout);
props.setLook(gProxy);
// HTTP Login
wlProxyHost = new Label(gProxy, SWT.RIGHT);
wlProxyHost.setText(BaseMessages.getString(PKG, "WebServiceDialog.ProxyHost.Label"));
props.setLook(wlProxyHost);
FormData fdlProxyHost = new FormData();
fdlProxyHost.top = new FormAttachment(0, margin);
fdlProxyHost.left = new FormAttachment(0, 0);
fdlProxyHost.right = new FormAttachment(middle, -margin);
wlProxyHost.setLayoutData(fdlProxyHost);
wProxyHost = new TextVar(transMeta, gProxy, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wProxyHost.addModifyListener(lsMod);
wProxyHost.setToolTipText(BaseMessages.getString(PKG, "WebServiceDialog.ProxyHost.Tooltip"));
props.setLook(wProxyHost);
FormData fdProxyHost = new FormData();
fdProxyHost.top = new FormAttachment(0, margin);
fdProxyHost.left = new FormAttachment(middle, 0);
fdProxyHost.right = new FormAttachment(100, 0);
wProxyHost.setLayoutData(fdProxyHost);
// HTTP Password
wlProxyPort = new Label(gProxy, SWT.RIGHT);
wlProxyPort.setText(BaseMessages.getString(PKG, "WebServiceDialog.ProxyPort.Label"));
props.setLook(wlProxyPort);
FormData fdlProxyPort = new FormData();
fdlProxyPort.top = new FormAttachment(wProxyHost, margin);
fdlProxyPort.left = new FormAttachment(0, 0);
fdlProxyPort.right = new FormAttachment(middle, -margin);
wlProxyPort.setLayoutData(fdlProxyPort);
wProxyPort = new TextVar(transMeta, gProxy, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wProxyPort.addModifyListener(lsMod);
wProxyPort.setToolTipText(BaseMessages.getString(PKG, "WebServiceDialog.ProxyPort.Tooltip"));
props.setLook(wProxyPort);
FormData fdProxyPort = new FormData();
fdProxyPort.top = new FormAttachment(wProxyHost, margin);
fdProxyPort.left = new FormAttachment(middle, 0);
fdProxyPort.right = new FormAttachment(100, 0);
wProxyPort.setLayoutData(fdProxyPort);
FormData fdProxy = new FormData();
fdProxy.left = new FormAttachment(0, 0);
fdProxy.right = new FormAttachment(100, 0);
fdProxy.top = new FormAttachment(gHttpAuth, margin);
gProxy.setLayoutData(fdProxy);
// END HTTP AUTH GROUP
// ////////////////////////
// Layout du tab
FormData fdFileComp = new FormData();
fdFileComp.left = new FormAttachment(0, 0);
fdFileComp.top = new FormAttachment(0, 0);
fdFileComp.right = new FormAttachment(100, 0);
fdFileComp.bottom = new FormAttachment(100, 0);
compositeTabWebService.setLayoutData(fdFileComp);
compositeTabWebService.layout();
tabItemWebService.setControl(compositeTabWebService);
wURL.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
getData();
}
});
SelectionAdapter selAdapter = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wHttpPassword.addSelectionListener(selAdapter);
wHttpLogin.addSelectionListener(selAdapter);
wStep.addSelectionListener(selAdapter);
wProxyHost.addSelectionListener(selAdapter);
wProxyPort.addSelectionListener(selAdapter);
wStepname.addSelectionListener(selAdapter);
wTabFolder.setSelection(tabItemWebService);
FormData fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wStepname, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
// Boutons OK / Cancel
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wAddInput = new Button(shell, SWT.PUSH);
wAddInput.setText(BaseMessages.getString(PKG, "WebServiceDialog.Label.AddInputButton"));
wAddOutput = new Button(shell, SWT.PUSH);
wAddOutput.setText(BaseMessages.getString(PKG, "WebServiceDialog.Label.AddOutputButton"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wAddInput, wAddOutput, wCancel }, margin, wTabFolder);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
wOK.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ok();
}
});
wAddInput.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
addTabFieldIn();
wTabFolder.setSelection(tabItemFieldIn);
}
});
wAddOutput.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
addTabFieldOut();
wTabFolder.setSelection(tabItemFieldOut);
}
});
wCancel.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
cancel();
}
});
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
getData();
setComboValues();
// Set the shell size, based upon previous time...
setSize();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.eclipse.swt.events.SelectionListener in project pentaho-kettle by pentaho.
the class TableOutputDialog method open.
/**
* Open the dialog.
*/
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
props.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
input.setChanged();
}
};
ModifyListener lsTableMod = new ModifyListener() {
public void modifyText(ModifyEvent arg0) {
input.setChanged();
setTableFieldCombo();
}
};
SelectionListener lsSelection = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
setTableFieldCombo();
}
};
backupChanged = input.hasChanged();
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "TableOutputDialog.DialogTitle"));
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.right = new FormAttachment(middle, -margin);
fdlStepname.top = new FormAttachment(0, margin);
wlStepname.setLayoutData(fdlStepname);
wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStepname.setText(stepname);
props.setLook(wStepname);
wStepname.addModifyListener(lsMod);
fdStepname = new FormData();
fdStepname.left = new FormAttachment(middle, 0);
fdStepname.top = new FormAttachment(0, margin);
fdStepname.right = new FormAttachment(100, 0);
wStepname.setLayoutData(fdStepname);
// Connection line
wConnection = addConnectionLine(shell, wStepname, middle, margin);
if (input.getDatabaseMeta() == null && transMeta.nrDatabases() == 1) {
wConnection.select(0);
}
wConnection.addModifyListener(lsMod);
wConnection.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
setFlags();
}
});
wConnection.addSelectionListener(lsSelection);
// Schema line...
wlSchema = new Label(shell, SWT.RIGHT);
wlSchema.setText(BaseMessages.getString(PKG, "TableOutputDialog.TargetSchema.Label"));
props.setLook(wlSchema);
fdlSchema = new FormData();
fdlSchema.left = new FormAttachment(0, 0);
fdlSchema.right = new FormAttachment(middle, -margin);
fdlSchema.top = new FormAttachment(wConnection, margin * 2);
wlSchema.setLayoutData(fdlSchema);
wbSchema = new Button(shell, SWT.PUSH | SWT.CENTER);
props.setLook(wbSchema);
wbSchema.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbSchema = new FormData();
fdbSchema.top = new FormAttachment(wConnection, 2 * margin);
fdbSchema.right = new FormAttachment(100, 0);
wbSchema.setLayoutData(fdbSchema);
wSchema = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSchema);
wSchema.addModifyListener(lsTableMod);
fdSchema = new FormData();
fdSchema.left = new FormAttachment(middle, 0);
fdSchema.top = new FormAttachment(wConnection, margin * 2);
fdSchema.right = new FormAttachment(wbSchema, -margin);
wSchema.setLayoutData(fdSchema);
// Table line...
wlTable = new Label(shell, SWT.RIGHT);
wlTable.setText(BaseMessages.getString(PKG, "TableOutputDialog.TargetTable.Label"));
props.setLook(wlTable);
fdlTable = new FormData();
fdlTable.left = new FormAttachment(0, 0);
fdlTable.right = new FormAttachment(middle, -margin);
fdlTable.top = new FormAttachment(wbSchema, margin);
wlTable.setLayoutData(fdlTable);
wbTable = new Button(shell, SWT.PUSH | SWT.CENTER);
props.setLook(wbTable);
wbTable.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbTable = new FormData();
fdbTable.right = new FormAttachment(100, 0);
fdbTable.top = new FormAttachment(wbSchema, margin);
wbTable.setLayoutData(fdbTable);
wTable = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTable);
wTable.addModifyListener(lsTableMod);
fdTable = new FormData();
fdTable.top = new FormAttachment(wbSchema, margin);
fdTable.left = new FormAttachment(middle, 0);
fdTable.right = new FormAttachment(wbTable, -margin);
wTable.setLayoutData(fdTable);
// Commit size ...
wlCommit = new Label(shell, SWT.RIGHT);
wlCommit.setText(BaseMessages.getString(PKG, "TableOutputDialog.CommitSize.Label"));
props.setLook(wlCommit);
fdlCommit = new FormData();
fdlCommit.left = new FormAttachment(0, 0);
fdlCommit.right = new FormAttachment(middle, -margin);
fdlCommit.top = new FormAttachment(wbTable, margin);
wlCommit.setLayoutData(fdlCommit);
wCommit = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wCommit);
wCommit.addModifyListener(lsMod);
fdCommit = new FormData();
fdCommit.left = new FormAttachment(middle, 0);
fdCommit.top = new FormAttachment(wbTable, margin);
fdCommit.right = new FormAttachment(100, 0);
wCommit.setLayoutData(fdCommit);
// Truncate table
wlTruncate = new Label(shell, SWT.RIGHT);
wlTruncate.setText(BaseMessages.getString(PKG, "TableOutputDialog.TruncateTable.Label"));
props.setLook(wlTruncate);
fdlTruncate = new FormData();
fdlTruncate.left = new FormAttachment(0, 0);
fdlTruncate.top = new FormAttachment(wCommit, margin);
fdlTruncate.right = new FormAttachment(middle, -margin);
wlTruncate.setLayoutData(fdlTruncate);
wTruncate = new Button(shell, SWT.CHECK);
props.setLook(wTruncate);
fdTruncate = new FormData();
fdTruncate.left = new FormAttachment(middle, 0);
fdTruncate.top = new FormAttachment(wCommit, margin);
fdTruncate.right = new FormAttachment(100, 0);
wTruncate.setLayoutData(fdTruncate);
SelectionAdapter lsSelMod = new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
input.setChanged();
}
};
wTruncate.addSelectionListener(lsSelMod);
// Ignore errors
wlIgnore = new Label(shell, SWT.RIGHT);
wlIgnore.setText(BaseMessages.getString(PKG, "TableOutputDialog.IgnoreInsertErrors.Label"));
props.setLook(wlIgnore);
fdlIgnore = new FormData();
fdlIgnore.left = new FormAttachment(0, 0);
fdlIgnore.top = new FormAttachment(wTruncate, margin);
fdlIgnore.right = new FormAttachment(middle, -margin);
wlIgnore.setLayoutData(fdlIgnore);
wIgnore = new Button(shell, SWT.CHECK);
props.setLook(wIgnore);
fdIgnore = new FormData();
fdIgnore.left = new FormAttachment(middle, 0);
fdIgnore.top = new FormAttachment(wTruncate, margin);
fdIgnore.right = new FormAttachment(100, 0);
wIgnore.setLayoutData(fdIgnore);
wIgnore.addSelectionListener(lsSelMod);
// Specify fields
wlSpecifyFields = new Label(shell, SWT.RIGHT);
wlSpecifyFields.setText(BaseMessages.getString(PKG, "TableOutputDialog.SpecifyFields.Label"));
props.setLook(wlSpecifyFields);
fdlSpecifyFields = new FormData();
fdlSpecifyFields.left = new FormAttachment(0, 0);
fdlSpecifyFields.top = new FormAttachment(wIgnore, margin);
fdlSpecifyFields.right = new FormAttachment(middle, -margin);
wlSpecifyFields.setLayoutData(fdlSpecifyFields);
wSpecifyFields = new Button(shell, SWT.CHECK);
props.setLook(wSpecifyFields);
fdSpecifyFields = new FormData();
fdSpecifyFields.left = new FormAttachment(middle, 0);
fdSpecifyFields.top = new FormAttachment(wIgnore, margin);
fdSpecifyFields.right = new FormAttachment(100, 0);
wSpecifyFields.setLayoutData(fdSpecifyFields);
wSpecifyFields.addSelectionListener(lsSelMod);
// If the flag is off, gray out the fields tab e.g.
wSpecifyFields.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
setFlags();
}
});
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF KEY TAB ///
// /
wMainTab = new CTabItem(wTabFolder, SWT.NONE);
wMainTab.setText(BaseMessages.getString(PKG, "TableOutputDialog.MainTab.CTabItem"));
FormLayout mainLayout = new FormLayout();
mainLayout.marginWidth = 3;
mainLayout.marginHeight = 3;
Composite wMainComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wMainComp);
wMainComp.setLayout(mainLayout);
// Partitioning support
// Use partitioning?
wlUsePart = new Label(wMainComp, SWT.RIGHT);
wlUsePart.setText(BaseMessages.getString(PKG, "TableOutputDialog.UsePart.Label"));
wlUsePart.setToolTipText(BaseMessages.getString(PKG, "TableOutputDialog.UsePart.Tooltip"));
props.setLook(wlUsePart);
fdlUsePart = new FormData();
fdlUsePart.left = new FormAttachment(0, 0);
fdlUsePart.top = new FormAttachment(wSpecifyFields, margin * 5);
fdlUsePart.right = new FormAttachment(middle, -margin);
wlUsePart.setLayoutData(fdlUsePart);
wUsePart = new Button(wMainComp, SWT.CHECK);
props.setLook(wUsePart);
fdUsePart = new FormData();
fdUsePart.left = new FormAttachment(middle, 0);
fdUsePart.top = new FormAttachment(wSpecifyFields, margin * 5);
fdUsePart.right = new FormAttachment(100, 0);
wUsePart.setLayoutData(fdUsePart);
wUsePart.addSelectionListener(lsSelMod);
wUsePart.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
if (wUsePart.getSelection()) {
wNameInField.setSelection(false);
}
setFlags();
}
});
// Partitioning field
wlPartField = new Label(wMainComp, SWT.RIGHT);
wlPartField.setText(BaseMessages.getString(PKG, "TableOutputDialog.PartField.Label"));
props.setLook(wlPartField);
fdlPartField = new FormData();
fdlPartField.top = new FormAttachment(wUsePart, margin);
fdlPartField.left = new FormAttachment(0, 0);
fdlPartField.right = new FormAttachment(middle, -margin);
wlPartField.setLayoutData(fdlPartField);
wPartField = new ComboVar(transMeta, wMainComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPartField);
wPartField.addModifyListener(lsMod);
fdPartField = new FormData();
fdPartField.top = new FormAttachment(wUsePart, margin);
fdPartField.left = new FormAttachment(middle, 0);
fdPartField.right = new FormAttachment(100, 0);
wPartField.setLayoutData(fdPartField);
wPartField.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(busy);
getFields();
shell.setCursor(null);
busy.dispose();
}
});
// Partition per month
wlPartMonthly = new Label(wMainComp, SWT.RIGHT);
wlPartMonthly.setText(BaseMessages.getString(PKG, "TableOutputDialog.PartMonthly.Label"));
wlPartMonthly.setToolTipText(BaseMessages.getString(PKG, "TableOutputDialog.PartMonthly.Tooltip"));
props.setLook(wlPartMonthly);
fdlPartMonthly = new FormData();
fdlPartMonthly.left = new FormAttachment(0, 0);
fdlPartMonthly.top = new FormAttachment(wPartField, margin);
fdlPartMonthly.right = new FormAttachment(middle, -margin);
wlPartMonthly.setLayoutData(fdlPartMonthly);
wPartMonthly = new Button(wMainComp, SWT.RADIO);
props.setLook(wPartMonthly);
fdPartMonthly = new FormData();
fdPartMonthly.left = new FormAttachment(middle, 0);
fdPartMonthly.top = new FormAttachment(wPartField, margin);
fdPartMonthly.right = new FormAttachment(100, 0);
wPartMonthly.setLayoutData(fdPartMonthly);
wPartMonthly.addSelectionListener(lsSelMod);
wPartMonthly.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
wPartMonthly.setSelection(true);
wPartDaily.setSelection(false);
}
});
// Partition per month
wlPartDaily = new Label(wMainComp, SWT.RIGHT);
wlPartDaily.setText(BaseMessages.getString(PKG, "TableOutputDialog.PartDaily.Label"));
wlPartDaily.setToolTipText(BaseMessages.getString(PKG, "TableOutputDialog.PartDaily.Tooltip"));
props.setLook(wlPartDaily);
fdlPartDaily = new FormData();
fdlPartDaily.left = new FormAttachment(0, 0);
fdlPartDaily.top = new FormAttachment(wPartMonthly, margin);
fdlPartDaily.right = new FormAttachment(middle, -margin);
wlPartDaily.setLayoutData(fdlPartDaily);
wPartDaily = new Button(wMainComp, SWT.RADIO);
props.setLook(wPartDaily);
fdPartDaily = new FormData();
fdPartDaily.left = new FormAttachment(middle, 0);
fdPartDaily.top = new FormAttachment(wPartMonthly, margin);
fdPartDaily.right = new FormAttachment(100, 0);
wPartDaily.setLayoutData(fdPartDaily);
wPartDaily.addSelectionListener(lsSelMod);
wPartDaily.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
wPartDaily.setSelection(true);
wPartMonthly.setSelection(false);
}
});
// Batch update
wlBatch = new Label(wMainComp, SWT.RIGHT);
wlBatch.setText(BaseMessages.getString(PKG, "TableOutputDialog.Batch.Label"));
props.setLook(wlBatch);
fdlBatch = new FormData();
fdlBatch.left = new FormAttachment(0, 0);
fdlBatch.top = new FormAttachment(wPartDaily, 5 * margin);
fdlBatch.right = new FormAttachment(middle, -margin);
wlBatch.setLayoutData(fdlBatch);
wBatch = new Button(wMainComp, SWT.CHECK);
props.setLook(wBatch);
fdBatch = new FormData();
fdBatch.left = new FormAttachment(middle, 0);
fdBatch.top = new FormAttachment(wPartDaily, 5 * margin);
fdBatch.right = new FormAttachment(100, 0);
wBatch.setLayoutData(fdBatch);
wBatch.addSelectionListener(lsSelMod);
wBatch.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
setFlags();
}
});
// NameInField
wlNameInField = new Label(wMainComp, SWT.RIGHT);
wlNameInField.setText(BaseMessages.getString(PKG, "TableOutputDialog.NameInField.Label"));
props.setLook(wlNameInField);
fdlNameInField = new FormData();
fdlNameInField.left = new FormAttachment(0, 0);
fdlNameInField.top = new FormAttachment(wBatch, margin * 5);
fdlNameInField.right = new FormAttachment(middle, -margin);
wlNameInField.setLayoutData(fdlNameInField);
wNameInField = new Button(wMainComp, SWT.CHECK);
props.setLook(wNameInField);
fdNameInField = new FormData();
fdNameInField.left = new FormAttachment(middle, 0);
fdNameInField.top = new FormAttachment(wBatch, margin * 5);
fdNameInField.right = new FormAttachment(100, 0);
wNameInField.setLayoutData(fdNameInField);
wNameInField.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent se) {
if (wNameInField.getSelection()) {
wUsePart.setSelection(false);
}
setFlags();
}
});
wNameInField.addSelectionListener(lsSelMod);
// NameField size ...
wlNameField = new Label(wMainComp, SWT.RIGHT);
wlNameField.setText(BaseMessages.getString(PKG, "TableOutputDialog.NameField.Label"));
props.setLook(wlNameField);
fdlNameField = new FormData();
fdlNameField.left = new FormAttachment(0, 0);
fdlNameField.top = new FormAttachment(wNameInField, margin);
fdlNameField.right = new FormAttachment(middle, -margin);
wlNameField.setLayoutData(fdlNameField);
wNameField = new ComboVar(transMeta, wMainComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wNameField);
wNameField.addModifyListener(lsMod);
fdNameField = new FormData();
fdNameField.left = new FormAttachment(middle, 0);
fdNameField.top = new FormAttachment(wNameInField, margin);
fdNameField.right = new FormAttachment(100, 0);
wNameField.setLayoutData(fdNameField);
wNameField.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(busy);
getFields();
shell.setCursor(null);
busy.dispose();
}
});
// NameInTable
wlNameInTable = new Label(wMainComp, SWT.RIGHT);
wlNameInTable.setText(BaseMessages.getString(PKG, "TableOutputDialog.NameInTable.Label"));
props.setLook(wlNameInTable);
fdlNameInTable = new FormData();
fdlNameInTable.left = new FormAttachment(0, 0);
fdlNameInTable.top = new FormAttachment(wNameField, margin);
fdlNameInTable.right = new FormAttachment(middle, -margin);
wlNameInTable.setLayoutData(fdlNameInTable);
wNameInTable = new Button(wMainComp, SWT.CHECK);
props.setLook(wNameInTable);
fdNameInTable = new FormData();
fdNameInTable.left = new FormAttachment(middle, 0);
fdNameInTable.top = new FormAttachment(wNameField, margin);
fdNameInTable.right = new FormAttachment(100, 0);
wNameInTable.setLayoutData(fdNameInTable);
wNameInTable.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
setFlags();
}
});
wNameInTable.addSelectionListener(lsSelMod);
// Return generated keys?
wlReturnKeys = new Label(wMainComp, SWT.RIGHT);
wlReturnKeys.setText(BaseMessages.getString(PKG, "TableOutputDialog.ReturnKeys.Label"));
wlReturnKeys.setToolTipText(BaseMessages.getString(PKG, "TableOutputDialog.ReturnKeys.Tooltip"));
props.setLook(wlReturnKeys);
fdlReturnKeys = new FormData();
fdlReturnKeys.left = new FormAttachment(0, 0);
fdlReturnKeys.top = new FormAttachment(wNameInTable, margin * 5);
fdlReturnKeys.right = new FormAttachment(middle, -margin);
wlReturnKeys.setLayoutData(fdlReturnKeys);
wReturnKeys = new Button(wMainComp, SWT.CHECK);
props.setLook(wReturnKeys);
fdReturnKeys = new FormData();
fdReturnKeys.left = new FormAttachment(middle, 0);
fdReturnKeys.top = new FormAttachment(wNameInTable, margin * 5);
fdReturnKeys.right = new FormAttachment(100, 0);
wReturnKeys.setLayoutData(fdReturnKeys);
wReturnKeys.addSelectionListener(lsSelMod);
wReturnKeys.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
setFlags();
}
});
// ReturnField size ...
wlReturnField = new Label(wMainComp, SWT.RIGHT);
wlReturnField.setText(BaseMessages.getString(PKG, "TableOutputDialog.ReturnField.Label"));
props.setLook(wlReturnField);
fdlReturnField = new FormData();
fdlReturnField.left = new FormAttachment(0, 0);
fdlReturnField.right = new FormAttachment(middle, -margin);
fdlReturnField.top = new FormAttachment(wReturnKeys, margin);
wlReturnField.setLayoutData(fdlReturnField);
wReturnField = new TextVar(transMeta, wMainComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wReturnField);
wReturnField.addModifyListener(lsMod);
fdReturnField = new FormData();
fdReturnField.left = new FormAttachment(middle, 0);
fdReturnField.top = new FormAttachment(wReturnKeys, margin);
fdReturnField.right = new FormAttachment(100, 0);
wReturnField.setLayoutData(fdReturnField);
fdMainComp = new FormData();
fdMainComp.left = new FormAttachment(0, 0);
fdMainComp.top = new FormAttachment(0, 0);
fdMainComp.right = new FormAttachment(100, 0);
fdMainComp.bottom = new FormAttachment(100, 0);
wMainComp.setLayoutData(fdMainComp);
wMainComp.layout();
wMainTab.setControl(wMainComp);
//
// Fields tab...
//
wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
wFieldsTab.setText(BaseMessages.getString(PKG, "TableOutputDialog.FieldsTab.CTabItem.Title"));
Composite wFieldsComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wFieldsComp);
FormLayout fieldsCompLayout = new FormLayout();
fieldsCompLayout.marginWidth = Const.FORM_MARGIN;
fieldsCompLayout.marginHeight = Const.FORM_MARGIN;
wFieldsComp.setLayout(fieldsCompLayout);
// The fields table
wlFields = new Label(wFieldsComp, SWT.NONE);
wlFields.setText(BaseMessages.getString(PKG, "TableOutputDialog.InsertFields.Label"));
props.setLook(wlFields);
FormData fdlUpIns = new FormData();
fdlUpIns.left = new FormAttachment(0, 0);
fdlUpIns.top = new FormAttachment(0, margin);
wlFields.setLayoutData(fdlUpIns);
int tableCols = 2;
int UpInsRows = (input.getFieldStream() != null ? input.getFieldStream().length : 1);
ciFields = new ColumnInfo[tableCols];
ciFields[0] = new ColumnInfo(BaseMessages.getString(PKG, "TableOutputDialog.ColumnInfo.TableField"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
ciFields[1] = new ColumnInfo(BaseMessages.getString(PKG, "TableOutputDialog.ColumnInfo.StreamField"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
tableFieldColumns.add(ciFields[0]);
wFields = new TableView(transMeta, wFieldsComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciFields, UpInsRows, lsMod, props);
wGetFields = new Button(wFieldsComp, SWT.PUSH);
wGetFields.setText(BaseMessages.getString(PKG, "TableOutputDialog.GetFields.Button"));
fdGetFields = new FormData();
fdGetFields.top = new FormAttachment(wlFields, margin);
fdGetFields.right = new FormAttachment(100, 0);
wGetFields.setLayoutData(fdGetFields);
wDoMapping = new Button(wFieldsComp, SWT.PUSH);
wDoMapping.setText(BaseMessages.getString(PKG, "TableOutputDialog.DoMapping.Button"));
fdDoMapping = new FormData();
fdDoMapping.top = new FormAttachment(wGetFields, margin);
fdDoMapping.right = new FormAttachment(100, 0);
wDoMapping.setLayoutData(fdDoMapping);
wDoMapping.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event arg0) {
generateMappings();
}
});
FormData fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(wlFields, margin);
fdFields.right = new FormAttachment(wDoMapping, -margin);
fdFields.bottom = new FormAttachment(100, -2 * margin);
wFields.setLayoutData(fdFields);
fdFieldsComp = new FormData();
fdFieldsComp.left = new FormAttachment(0, 0);
fdFieldsComp.top = new FormAttachment(0, 0);
fdFieldsComp.right = new FormAttachment(100, 0);
fdFieldsComp.bottom = new FormAttachment(100, 0);
wFieldsComp.setLayoutData(fdFieldsComp);
wFieldsComp.layout();
wFieldsTab.setControl(wFieldsComp);
//
// Search the fields in the background
//
final Runnable runnable = new Runnable() {
public void run() {
StepMeta stepMeta = transMeta.findStep(stepname);
if (stepMeta != null) {
try {
RowMetaInterface row = transMeta.getPrevStepFields(stepMeta);
// Remember these fields...
for (int i = 0; i < row.size(); i++) {
inputFields.put(row.getValueMeta(i).getName(), i);
}
setComboBoxes();
} catch (KettleException e) {
logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"));
}
}
}
};
new Thread(runnable).start();
// Some buttons
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCreate = new Button(shell, SWT.PUSH);
wCreate.setText(BaseMessages.getString(PKG, "System.Button.SQL"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wCancel, wCreate }, margin, null);
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wSpecifyFields, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(wOK, -margin);
wTabFolder.setLayoutData(fdTabFolder);
// Add listeners
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsCreate = new Listener() {
public void handleEvent(Event e) {
sql();
}
};
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsGet = new Listener() {
public void handleEvent(Event e) {
get();
}
};
wOK.addListener(SWT.Selection, lsOK);
wCreate.addListener(SWT.Selection, lsCreate);
wCancel.addListener(SWT.Selection, lsCancel);
wGetFields.addListener(SWT.Selection, lsGet);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wCommit.addSelectionListener(lsDef);
wSchema.addSelectionListener(lsDef);
wTable.addSelectionListener(lsDef);
wPartField.addSelectionListener(lsDef);
wNameField.addSelectionListener(lsDef);
wReturnField.addSelectionListener(lsDef);
wbTable.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
getTableName();
}
});
wbSchema.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
getSchemaNames();
}
});
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
wTabFolder.setSelection(0);
// Set the shell size, based upon previous time...
setSize();
getData();
setTableFieldCombo();
input.setChanged(backupChanged);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.eclipse.swt.events.SelectionListener in project pentaho-kettle by pentaho.
the class PentahoReportingOutputDialog method open.
@Override
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
props.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
input.setChanged();
}
};
SelectionListener selMod = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
};
changed = input.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "PentahoReportingOutputDialog.Shell.Text"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "PentahoReportingOutputDialog.Stepname.Label"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.top = new FormAttachment(0, margin);
fdlStepname.right = new FormAttachment(middle, -margin);
wlStepname.setLayoutData(fdlStepname);
wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStepname.setText(stepname);
props.setLook(wStepname);
wStepname.addModifyListener(lsMod);
fdStepname = new FormData();
fdStepname.left = new FormAttachment(middle, 0);
fdStepname.top = new FormAttachment(0, margin);
fdStepname.right = new FormAttachment(100, 0);
wStepname.setLayoutData(fdStepname);
// input file line (report definition)
wlInput = new Label(shell, SWT.RIGHT);
wlInput.setText(BaseMessages.getString(PKG, "PentahoReportingOutputDialog.InputFilename.Label"));
props.setLook(wlInput);
FormData fdlInput = new FormData();
fdlInput.left = new FormAttachment(0, 0);
fdlInput.top = new FormAttachment(wStepname, margin + 5);
fdlInput.right = new FormAttachment(middle, -margin);
wlInput.setLayoutData(fdlInput);
wInput = new Combo(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wInput);
wInput.addModifyListener(lsMod);
FormData fdInput = new FormData();
fdInput.left = new FormAttachment(middle, 0);
fdInput.top = new FormAttachment(wStepname, margin + 5);
fdInput.right = new FormAttachment(100, 0);
wInput.setLayoutData(fdInput);
String[] fieldNames = new String[] {};
try {
fieldNames = Const.sortStrings(transMeta.getPrevStepFields(stepMeta).getFieldNames());
} catch (KettleException e) {
log.logError("Unexpected error getting fields from previous steps...", e);
}
wInput.setItems(fieldNames);
// output file line
wlOutput = new Label(shell, SWT.RIGHT);
wlOutput.setText(BaseMessages.getString(PKG, "PentahoReportingOutputDialog.OutputFilename.Label"));
props.setLook(wlOutput);
FormData fdlOutput = new FormData();
fdlOutput.left = new FormAttachment(0, 0);
fdlOutput.top = new FormAttachment(wInput, margin + 5);
fdlOutput.right = new FormAttachment(middle, -margin);
wlOutput.setLayoutData(fdlOutput);
wOutput = new Combo(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wOutput);
wOutput.addModifyListener(lsMod);
FormData fdOutput = new FormData();
fdOutput.left = new FormAttachment(middle, 0);
fdOutput.top = new FormAttachment(wInput, margin + 5);
fdOutput.right = new FormAttachment(100, 0);
wOutput.setLayoutData(fdOutput);
wOutput.setItems(fieldNames);
// ParentFolder
wlParentFolder = new Label(shell, SWT.RIGHT);
wlParentFolder.setText(BaseMessages.getString(PKG, "PentahoReportingOutputDialog.ParentFolder.Label"));
props.setLook(wlParentFolder);
FormData fdlParentFolder = new FormData();
fdlParentFolder.left = new FormAttachment(10, 10);
fdlParentFolder.top = new FormAttachment(wlOutput, margin + 15);
fdlParentFolder.right = new FormAttachment(middle, -margin);
wlParentFolder.setLayoutData(fdlParentFolder);
wParentFolder = new Button(shell, SWT.CHECK);
props.setLook(wParentFolder);
wParentFolder.addSelectionListener(selMod);
FormData fdParentFolder = new FormData();
fdParentFolder.left = new FormAttachment(middle, 10);
fdParentFolder.top = new FormAttachment(wlOutput, margin + 15);
fdParentFolder.right = new FormAttachment(100, 10);
wParentFolder.setLayoutData(fdParentFolder);
wParentFolder.setSelection(input.getCreateParentfolder());
// Fields
ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "PentahoReportingOutput.Column.ParameterName"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "PentahoReportingOutput.Column.FieldName"), ColumnInfo.COLUMN_TYPE_CCOMBO, fieldNames, true) };
wFields = new TableView(transMeta, shell, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER, colinf, 1, lsMod, props);
FormData fdFields = new FormData();
fdFields.top = new FormAttachment(wParentFolder, margin * 2);
fdFields.bottom = new FormAttachment(wParentFolder, 250);
fdFields.left = new FormAttachment(0, 0);
fdFields.right = new FormAttachment(100, 0);
wFields.setLayoutData(fdFields);
// output types
//
wlProcessor = new Label(shell, SWT.RIGHT);
wlProcessor.setText(BaseMessages.getString(PKG, "PentahoReportingOutputDialog.Processor.Label"));
props.setLook(wlProcessor);
FormData fdlProcessor = new FormData();
fdlProcessor.left = new FormAttachment(0, 0);
fdlProcessor.top = new FormAttachment(wFields, margin + 5);
fdlProcessor.right = new FormAttachment(middle, -margin);
wlProcessor.setLayoutData(fdlProcessor);
wProcessor = new List(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wProcessor);
FormData fdProcessor = new FormData();
fdProcessor.left = new FormAttachment(middle, 0);
fdProcessor.top = new FormAttachment(wFields, margin + 5);
fdProcessor.right = new FormAttachment(100, 0);
wProcessor.setLayoutData(fdProcessor);
wProcessor.setItems(ProcessorType.getDescriptions());
wProcessor.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
input.setChanged();
}
});
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString("System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString("System.Button.Cancel"));
wGet = new Button(shell, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "PentahoReportingOutputDialog.Button.GetParameters"));
setButtonPositions(new Button[] { wOK, wGet, wCancel }, margin, wProcessor);
// Add listeners
wOK.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
ok();
}
});
wCancel.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
cancel();
}
});
wGet.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
get();
}
});
lsDef = new SelectionAdapter() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wInput.addSelectionListener(lsDef);
wOutput.addSelectionListener(lsDef);
wParentFolder.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
@Override
public void shellClosed(ShellEvent e) {
cancel();
}
});
// Set the shell size, based upon previous time...
setSize();
getData();
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.eclipse.swt.events.SelectionListener in project pentaho-kettle by pentaho.
the class StreamLookupDialog method open.
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
props.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
input.setChanged();
}
};
SelectionListener lsSelection = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
setComboBoxesLookup();
}
};
changed = input.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "StreamLookupDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "StreamLookupDialog.Stepname.Label"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.right = new FormAttachment(middle, -margin);
fdlStepname.top = new FormAttachment(0, margin);
wlStepname.setLayoutData(fdlStepname);
wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStepname.setText(stepname);
props.setLook(wStepname);
wStepname.addModifyListener(lsMod);
fdStepname = new FormData();
fdStepname.left = new FormAttachment(middle, 0);
fdStepname.top = new FormAttachment(0, margin);
fdStepname.right = new FormAttachment(100, 0);
wStepname.setLayoutData(fdStepname);
// Lookup step line...
wlStep = new Label(shell, SWT.RIGHT);
wlStep.setText(BaseMessages.getString(PKG, "StreamLookupDialog.LookupStep.Label"));
props.setLook(wlStep);
fdlStep = new FormData();
fdlStep.left = new FormAttachment(0, 0);
fdlStep.right = new FormAttachment(middle, -margin);
fdlStep.top = new FormAttachment(wStepname, margin * 2);
wlStep.setLayoutData(fdlStep);
wStep = new CCombo(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wStep);
List<StepMeta> previousSteps = transMeta.findPreviousSteps(stepMeta, true);
for (StepMeta previousStep : previousSteps) {
wStep.add(previousStep.getName());
}
// transMeta.getInfoStep()
wStep.addModifyListener(lsMod);
wStep.addSelectionListener(lsSelection);
fdStep = new FormData();
fdStep.left = new FormAttachment(middle, 0);
fdStep.top = new FormAttachment(wStepname, margin * 2);
fdStep.right = new FormAttachment(100, 0);
wStep.setLayoutData(fdStep);
wlKey = new Label(shell, SWT.NONE);
wlKey.setText(BaseMessages.getString(PKG, "StreamLookupDialog.Key.Label"));
props.setLook(wlKey);
fdlKey = new FormData();
fdlKey.left = new FormAttachment(0, 0);
fdlKey.top = new FormAttachment(wStep, margin);
wlKey.setLayoutData(fdlKey);
int nrKeyCols = 2;
int nrKeyRows = (input.getKeystream() != null ? input.getKeystream().length : 1);
ciKey = new ColumnInfo[nrKeyCols];
ciKey[0] = new ColumnInfo(BaseMessages.getString(PKG, "StreamLookupDialog.ColumnInfo.Field"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
ciKey[1] = new ColumnInfo(BaseMessages.getString(PKG, "StreamLookupDialog.ColumnInfo.LookupField"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
wKey = new TableView(transMeta, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciKey, nrKeyRows, lsMod, props);
fdKey = new FormData();
fdKey.left = new FormAttachment(0, 0);
fdKey.top = new FormAttachment(wlKey, margin);
fdKey.right = new FormAttachment(100, 0);
fdKey.bottom = new FormAttachment(wlKey, 180);
wKey.setLayoutData(fdKey);
// THE UPDATE/INSERT TABLE
wlReturn = new Label(shell, SWT.NONE);
wlReturn.setText(BaseMessages.getString(PKG, "StreamLookupDialog.ReturnFields.Label"));
props.setLook(wlReturn);
fdlReturn = new FormData();
fdlReturn.left = new FormAttachment(0, 0);
fdlReturn.top = new FormAttachment(wKey, margin);
wlReturn.setLayoutData(fdlReturn);
int UpInsCols = 4;
int UpInsRows = (input.getValue() != null ? input.getValue().length : 1);
ciReturn = new ColumnInfo[UpInsCols];
ciReturn[0] = new ColumnInfo(BaseMessages.getString(PKG, "StreamLookupDialog.ColumnInfo.FieldReturn"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
ciReturn[1] = new ColumnInfo(BaseMessages.getString(PKG, "StreamLookupDialog.ColumnInfo.NewName"), ColumnInfo.COLUMN_TYPE_TEXT, false);
ciReturn[2] = new ColumnInfo(BaseMessages.getString(PKG, "StreamLookupDialog.ColumnInfo.Default"), ColumnInfo.COLUMN_TYPE_TEXT, false);
ciReturn[3] = new ColumnInfo(BaseMessages.getString(PKG, "StreamLookupDialog.ColumnInfo.Type"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames());
wReturn = new TableView(transMeta, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciReturn, UpInsRows, lsMod, props);
// START MEMORY PRESERVE GROUP
fdReturn = new FormData();
fdReturn.left = new FormAttachment(0, 0);
fdReturn.top = new FormAttachment(wlReturn, margin);
fdReturn.right = new FormAttachment(100, 0);
fdReturn.bottom = new FormAttachment(100, -125);
wReturn.setLayoutData(fdReturn);
wlPreserveMemory = new Label(shell, SWT.RIGHT);
wlPreserveMemory.setText(BaseMessages.getString(PKG, "StreamLookupDialog.PreserveMemory.Label"));
props.setLook(wlPreserveMemory);
fdlPreserveMemory = new FormData();
fdlPreserveMemory.left = new FormAttachment(0, 0);
fdlPreserveMemory.top = new FormAttachment(wReturn, margin);
fdlPreserveMemory.right = new FormAttachment(middle, -margin);
wlPreserveMemory.setLayoutData(fdlPreserveMemory);
wPreserveMemory = new Button(shell, SWT.CHECK);
props.setLook(wPreserveMemory);
fdPreserveMemory = new FormData();
fdPreserveMemory.left = new FormAttachment(middle, 0);
fdPreserveMemory.top = new FormAttachment(wReturn, margin);
fdPreserveMemory.right = new FormAttachment(100, 0);
wPreserveMemory.setLayoutData(fdPreserveMemory);
wPreserveMemory.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
wlIntegerPair = new Label(shell, SWT.RIGHT);
wlIntegerPair.setText(BaseMessages.getString(PKG, "StreamLookupDialog.IntegerPair.Label"));
props.setLook(wlIntegerPair);
fdlIntegerPair = new FormData();
fdlIntegerPair.left = new FormAttachment(0, 0);
fdlIntegerPair.top = new FormAttachment(wPreserveMemory, margin);
fdlIntegerPair.right = new FormAttachment(middle, -margin);
wlIntegerPair.setLayoutData(fdlIntegerPair);
wIntegerPair = new Button(shell, SWT.RADIO);
wIntegerPair.setEnabled(false);
props.setLook(wIntegerPair);
fdIntegerPair = new FormData();
fdIntegerPair.left = new FormAttachment(middle, 0);
fdIntegerPair.top = new FormAttachment(wPreserveMemory, margin);
fdIntegerPair.right = new FormAttachment(100, 0);
wIntegerPair.setLayoutData(fdIntegerPair);
wIntegerPair.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
wlSortedList = new Label(shell, SWT.RIGHT);
wlSortedList.setText(BaseMessages.getString(PKG, "StreamLookupDialog.SortedList.Label"));
props.setLook(wlSortedList);
fdlSortedList = new FormData();
fdlSortedList.left = new FormAttachment(0, 0);
fdlSortedList.top = new FormAttachment(wIntegerPair, margin);
fdlSortedList.right = new FormAttachment(middle, -margin);
wlSortedList.setLayoutData(fdlSortedList);
wSortedList = new Button(shell, SWT.RADIO);
wSortedList.setEnabled(false);
props.setLook(wSortedList);
fdSortedList = new FormData();
fdSortedList.left = new FormAttachment(middle, 0);
fdSortedList.top = new FormAttachment(wIntegerPair, margin);
fdSortedList.right = new FormAttachment(100, 0);
wSortedList.setLayoutData(fdSortedList);
wSortedList.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// PDI-2107 preserve memory should be enabled to have this options on.
wPreserveMemory.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
boolean selection = wPreserveMemory.getSelection();
wSortedList.setEnabled(selection);
wIntegerPair.setEnabled(selection);
}
});
// END MEMORY PRESERVE
// THE BUTTONS
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wGet = new Button(shell, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "StreamLookupDialog.GetFields.Button"));
wGetLU = new Button(shell, SWT.PUSH);
wGetLU.setText(BaseMessages.getString(PKG, "StreamLookupDialog.GetLookupFields.Button"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wCancel, wGet, wGetLU }, margin, null);
// Add listeners
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsGet = new Listener() {
public void handleEvent(Event e) {
get();
}
};
lsGetLU = new Listener() {
public void handleEvent(Event e) {
getlookup();
}
};
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
wOK.addListener(SWT.Selection, lsOK);
wGet.addListener(SWT.Selection, lsGet);
wGetLU.addListener(SWT.Selection, lsGetLU);
wCancel.addListener(SWT.Selection, lsCancel);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
// Set the shell size, based upon previous time...
setSize();
getData();
setComboBoxes();
setComboBoxesLookup();
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
Aggregations