use of org.eclipse.swt.custom.CTabItem in project pentaho-kettle by pentaho.
the class PropertyInputDialog method addAdditionalFieldsTab.
private void addAdditionalFieldsTab() {
// ////////////////////////
// START OF ADDITIONAL FIELDS TAB ///
// ////////////////////////
wAdditionalFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
wAdditionalFieldsTab.setText(BaseMessages.getString(PKG, "PropertyInputDialog.AdditionalFieldsTab.TabTitle"));
wAdditionalFieldsComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wAdditionalFieldsComp);
FormLayout fieldsLayout = new FormLayout();
fieldsLayout.marginWidth = 3;
fieldsLayout.marginHeight = 3;
wAdditionalFieldsComp.setLayout(fieldsLayout);
// ShortFileFieldName line
wlShortFileFieldName = new Label(wAdditionalFieldsComp, SWT.RIGHT);
wlShortFileFieldName.setText(BaseMessages.getString(PKG, "PropertyInputDialog.ShortFileFieldName.Label"));
props.setLook(wlShortFileFieldName);
fdlShortFileFieldName = new FormData();
fdlShortFileFieldName.left = new FormAttachment(0, 0);
fdlShortFileFieldName.top = new FormAttachment(wInclRownumField, margin);
fdlShortFileFieldName.right = new FormAttachment(middle, -margin);
wlShortFileFieldName.setLayoutData(fdlShortFileFieldName);
wShortFileFieldName = new TextVar(transMeta, wAdditionalFieldsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wShortFileFieldName);
wShortFileFieldName.addModifyListener(lsMod);
fdShortFileFieldName = new FormData();
fdShortFileFieldName.left = new FormAttachment(middle, 0);
fdShortFileFieldName.right = new FormAttachment(100, -margin);
fdShortFileFieldName.top = new FormAttachment(wInclRownumField, margin);
wShortFileFieldName.setLayoutData(fdShortFileFieldName);
// ExtensionFieldName line
wlExtensionFieldName = new Label(wAdditionalFieldsComp, SWT.RIGHT);
wlExtensionFieldName.setText(BaseMessages.getString(PKG, "PropertyInputDialog.ExtensionFieldName.Label"));
props.setLook(wlExtensionFieldName);
fdlExtensionFieldName = new FormData();
fdlExtensionFieldName.left = new FormAttachment(0, 0);
fdlExtensionFieldName.top = new FormAttachment(wShortFileFieldName, margin);
fdlExtensionFieldName.right = new FormAttachment(middle, -margin);
wlExtensionFieldName.setLayoutData(fdlExtensionFieldName);
wExtensionFieldName = new TextVar(transMeta, wAdditionalFieldsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wExtensionFieldName);
wExtensionFieldName.addModifyListener(lsMod);
fdExtensionFieldName = new FormData();
fdExtensionFieldName.left = new FormAttachment(middle, 0);
fdExtensionFieldName.right = new FormAttachment(100, -margin);
fdExtensionFieldName.top = new FormAttachment(wShortFileFieldName, margin);
wExtensionFieldName.setLayoutData(fdExtensionFieldName);
// PathFieldName line
wlPathFieldName = new Label(wAdditionalFieldsComp, SWT.RIGHT);
wlPathFieldName.setText(BaseMessages.getString(PKG, "PropertyInputDialog.PathFieldName.Label"));
props.setLook(wlPathFieldName);
fdlPathFieldName = new FormData();
fdlPathFieldName.left = new FormAttachment(0, 0);
fdlPathFieldName.top = new FormAttachment(wExtensionFieldName, margin);
fdlPathFieldName.right = new FormAttachment(middle, -margin);
wlPathFieldName.setLayoutData(fdlPathFieldName);
wPathFieldName = new TextVar(transMeta, wAdditionalFieldsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPathFieldName);
wPathFieldName.addModifyListener(lsMod);
fdPathFieldName = new FormData();
fdPathFieldName.left = new FormAttachment(middle, 0);
fdPathFieldName.right = new FormAttachment(100, -margin);
fdPathFieldName.top = new FormAttachment(wExtensionFieldName, margin);
wPathFieldName.setLayoutData(fdPathFieldName);
// SizeFieldName line
wlSizeFieldName = new Label(wAdditionalFieldsComp, SWT.RIGHT);
wlSizeFieldName.setText(BaseMessages.getString(PKG, "PropertyInputDialog.SizeFieldName.Label"));
props.setLook(wlSizeFieldName);
fdlSizeFieldName = new FormData();
fdlSizeFieldName.left = new FormAttachment(0, 0);
fdlSizeFieldName.top = new FormAttachment(wPathFieldName, margin);
fdlSizeFieldName.right = new FormAttachment(middle, -margin);
wlSizeFieldName.setLayoutData(fdlSizeFieldName);
wSizeFieldName = new TextVar(transMeta, wAdditionalFieldsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSizeFieldName);
wSizeFieldName.addModifyListener(lsMod);
fdSizeFieldName = new FormData();
fdSizeFieldName.left = new FormAttachment(middle, 0);
fdSizeFieldName.right = new FormAttachment(100, -margin);
fdSizeFieldName.top = new FormAttachment(wPathFieldName, margin);
wSizeFieldName.setLayoutData(fdSizeFieldName);
// IsHiddenName line
wlIsHiddenName = new Label(wAdditionalFieldsComp, SWT.RIGHT);
wlIsHiddenName.setText(BaseMessages.getString(PKG, "PropertyInputDialog.IsHiddenName.Label"));
props.setLook(wlIsHiddenName);
fdlIsHiddenName = new FormData();
fdlIsHiddenName.left = new FormAttachment(0, 0);
fdlIsHiddenName.top = new FormAttachment(wSizeFieldName, margin);
fdlIsHiddenName.right = new FormAttachment(middle, -margin);
wlIsHiddenName.setLayoutData(fdlIsHiddenName);
wIsHiddenName = new TextVar(transMeta, wAdditionalFieldsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wIsHiddenName);
wIsHiddenName.addModifyListener(lsMod);
fdIsHiddenName = new FormData();
fdIsHiddenName.left = new FormAttachment(middle, 0);
fdIsHiddenName.right = new FormAttachment(100, -margin);
fdIsHiddenName.top = new FormAttachment(wSizeFieldName, margin);
wIsHiddenName.setLayoutData(fdIsHiddenName);
// LastModificationTimeName line
wlLastModificationTimeName = new Label(wAdditionalFieldsComp, SWT.RIGHT);
wlLastModificationTimeName.setText(BaseMessages.getString(PKG, "PropertyInputDialog.LastModificationTimeName.Label"));
props.setLook(wlLastModificationTimeName);
fdlLastModificationTimeName = new FormData();
fdlLastModificationTimeName.left = new FormAttachment(0, 0);
fdlLastModificationTimeName.top = new FormAttachment(wIsHiddenName, margin);
fdlLastModificationTimeName.right = new FormAttachment(middle, -margin);
wlLastModificationTimeName.setLayoutData(fdlLastModificationTimeName);
wLastModificationTimeName = new TextVar(transMeta, wAdditionalFieldsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wLastModificationTimeName);
wLastModificationTimeName.addModifyListener(lsMod);
fdLastModificationTimeName = new FormData();
fdLastModificationTimeName.left = new FormAttachment(middle, 0);
fdLastModificationTimeName.right = new FormAttachment(100, -margin);
fdLastModificationTimeName.top = new FormAttachment(wIsHiddenName, margin);
wLastModificationTimeName.setLayoutData(fdLastModificationTimeName);
// UriName line
wlUriName = new Label(wAdditionalFieldsComp, SWT.RIGHT);
wlUriName.setText(BaseMessages.getString(PKG, "PropertyInputDialog.UriName.Label"));
props.setLook(wlUriName);
fdlUriName = new FormData();
fdlUriName.left = new FormAttachment(0, 0);
fdlUriName.top = new FormAttachment(wLastModificationTimeName, margin);
fdlUriName.right = new FormAttachment(middle, -margin);
wlUriName.setLayoutData(fdlUriName);
wUriName = new TextVar(transMeta, wAdditionalFieldsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wUriName);
wUriName.addModifyListener(lsMod);
fdUriName = new FormData();
fdUriName.left = new FormAttachment(middle, 0);
fdUriName.right = new FormAttachment(100, -margin);
fdUriName.top = new FormAttachment(wLastModificationTimeName, margin);
wUriName.setLayoutData(fdUriName);
// RootUriName line
wlRootUriName = new Label(wAdditionalFieldsComp, SWT.RIGHT);
wlRootUriName.setText(BaseMessages.getString(PKG, "PropertyInputDialog.RootUriName.Label"));
props.setLook(wlRootUriName);
fdlRootUriName = new FormData();
fdlRootUriName.left = new FormAttachment(0, 0);
fdlRootUriName.top = new FormAttachment(wUriName, margin);
fdlRootUriName.right = new FormAttachment(middle, -margin);
wlRootUriName.setLayoutData(fdlRootUriName);
wRootUriName = new TextVar(transMeta, wAdditionalFieldsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wRootUriName);
wRootUriName.addModifyListener(lsMod);
fdRootUriName = new FormData();
fdRootUriName.left = new FormAttachment(middle, 0);
fdRootUriName.right = new FormAttachment(100, -margin);
fdRootUriName.top = new FormAttachment(wUriName, margin);
wRootUriName.setLayoutData(fdRootUriName);
fdAdditionalFieldsComp = new FormData();
fdAdditionalFieldsComp.left = new FormAttachment(0, 0);
fdAdditionalFieldsComp.top = new FormAttachment(wStepname, margin);
fdAdditionalFieldsComp.right = new FormAttachment(100, 0);
fdAdditionalFieldsComp.bottom = new FormAttachment(100, 0);
wAdditionalFieldsComp.setLayoutData(fdAdditionalFieldsComp);
wAdditionalFieldsComp.layout();
wAdditionalFieldsTab.setControl(wAdditionalFieldsComp);
// ///////////////////////////////////////////////////////////
// / END OF ADDITIONAL FIELDS TAB
// ///////////////////////////////////////////////////////////
}
use of org.eclipse.swt.custom.CTabItem in project pentaho-kettle by pentaho.
the class PropertyOutputDialog 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();
}
};
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, "PropertyOutputDialog.DialogTitle"));
// get previous fields name
getFields();
// 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);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.GeneralTab.TabTitle"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// Fields grouping?
// ////////////////////////
// START OF Fields GROUP
//
wFields = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wFields);
wFields.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.Group.Fields.Label"));
FormLayout groupFieldsLayout = new FormLayout();
groupFieldsLayout.marginWidth = 10;
groupFieldsLayout.marginHeight = 10;
wFields.setLayout(groupFieldsLayout);
// Key field
wlKeyField = new Label(wFields, SWT.RIGHT);
wlKeyField.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.KeyField.Label"));
props.setLook(wlKeyField);
fdlKeyField = new FormData();
fdlKeyField.left = new FormAttachment(0, 0);
fdlKeyField.top = new FormAttachment(0, 3 * margin);
fdlKeyField.right = new FormAttachment(middle, -margin);
wlKeyField.setLayoutData(fdlKeyField);
wKeyField = new CCombo(wFields, SWT.BORDER | SWT.READ_ONLY);
wKeyField.setEditable(true);
wKeyField.setItems(fieldNames);
props.setLook(wKeyField);
wKeyField.addModifyListener(lsMod);
fdKeyField = new FormData();
fdKeyField.left = new FormAttachment(middle, 0);
fdKeyField.top = new FormAttachment(0, 3 * margin);
fdKeyField.right = new FormAttachment(100, 0);
wKeyField.setLayoutData(fdKeyField);
// Value field
wlValueField = new Label(wFields, SWT.RIGHT);
wlValueField.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.ValueField.Label"));
props.setLook(wlValueField);
fdlValueField = new FormData();
fdlValueField.left = new FormAttachment(0, 0);
fdlValueField.top = new FormAttachment(wKeyField, margin);
fdlValueField.right = new FormAttachment(middle, -margin);
wlValueField.setLayoutData(fdlValueField);
wValueField = new CCombo(wFields, SWT.BORDER | SWT.READ_ONLY);
wValueField.setEditable(true);
wValueField.setItems(fieldNames);
props.setLook(wValueField);
wValueField.addModifyListener(lsMod);
fdValueField = new FormData();
fdValueField.left = new FormAttachment(middle, 0);
fdValueField.top = new FormAttachment(wKeyField, margin);
fdValueField.right = new FormAttachment(100, 0);
wValueField.setLayoutData(fdValueField);
// Comment
wlComment = new Label(wGeneralComp, SWT.RIGHT);
wlComment.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.Comment.Label"));
props.setLook(wlComment);
fdlComment = new FormData();
fdlComment.left = new FormAttachment(0, 0);
fdlComment.top = new FormAttachment(wFields, 2 * margin);
fdlComment.right = new FormAttachment(middle, -margin);
wlComment.setLayoutData(fdlComment);
wComment = new Text(wGeneralComp, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
wComment.setToolTipText(BaseMessages.getString(PKG, "PropertyOutputDialog.Comment.Tooltip"));
props.setLook(wComment);
wComment.addModifyListener(lsMod);
fdComment = new FormData();
fdComment.left = new FormAttachment(middle, 0);
fdComment.top = new FormAttachment(wFields, 2 * margin);
fdComment.right = new FormAttachment(100, 0);
fdComment.bottom = new FormAttachment(100, -margin);
wComment.setLayoutData(fdComment);
fdFields = new FormData();
fdFields.left = new FormAttachment(0, margin);
fdFields.top = new FormAttachment(0, margin);
fdFields.right = new FormAttachment(100, -margin);
wFields.setLayoutData(fdFields);
// ///////////////////////////////////////////////////////////
// / END OF Fields GROUP
// ///////////////////////////////////////////////////////////
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(0, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF CONTENT TAB///
// /
wContentTab = new CTabItem(wTabFolder, SWT.NONE);
wContentTab.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.ContentTab.TabTitle"));
FormLayout contentLayout = new FormLayout();
contentLayout.marginWidth = 3;
contentLayout.marginHeight = 3;
wContentComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wContentComp);
wContentComp.setLayout(contentLayout);
// File grouping?
// ////////////////////////
// START OF FileName GROUP
//
wFileName = new Group(wContentComp, SWT.SHADOW_NONE);
props.setLook(wFileName);
wFileName.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.Group.File.Label"));
FormLayout groupFileLayout = new FormLayout();
groupFileLayout.marginWidth = 10;
groupFileLayout.marginHeight = 10;
wFileName.setLayout(groupFileLayout);
// Filename line
wlFilename = new Label(wFileName, SWT.RIGHT);
wlFilename.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.Filename.Label"));
props.setLook(wlFilename);
fdlFilename = new FormData();
fdlFilename.left = new FormAttachment(0, 0);
fdlFilename.top = new FormAttachment(wFields, margin);
fdlFilename.right = new FormAttachment(middle, -margin);
wlFilename.setLayoutData(fdlFilename);
wbFilename = new Button(wFileName, SWT.PUSH | SWT.CENTER);
props.setLook(wbFilename);
wbFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbFilename = new FormData();
fdbFilename.right = new FormAttachment(100, 0);
fdbFilename.top = new FormAttachment(wFields, 0);
wbFilename.setLayoutData(fdbFilename);
wFilename = new TextVar(transMeta, wFileName, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFilename);
wFilename.addModifyListener(lsMod);
fdFilename = new FormData();
fdFilename.left = new FormAttachment(middle, 0);
fdFilename.top = new FormAttachment(wFields, margin);
fdFilename.right = new FormAttachment(wbFilename, -margin);
wFilename.setLayoutData(fdFilename);
// Append checkbox
wlAppend = new Label(wFileName, SWT.RIGHT);
wlAppend.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.Append.Label"));
props.setLook(wlAppend);
fdlAppend = new FormData();
fdlAppend.left = new FormAttachment(0, 0);
fdlAppend.top = new FormAttachment(wFilename, margin);
fdlAppend.right = new FormAttachment(middle, -margin);
wlAppend.setLayoutData(fdlAppend);
wAppend = new Button(wFileName, SWT.CHECK);
props.setLook(wAppend);
wAppend.setToolTipText(BaseMessages.getString(PKG, "PropertyOutputDialog.Append.Tooltip"));
fdAppend = new FormData();
fdAppend.left = new FormAttachment(middle, 0);
fdAppend.top = new FormAttachment(wFilename, margin);
fdAppend.right = new FormAttachment(100, 0);
wAppend.setLayoutData(fdAppend);
wAppend.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
input.setChanged();
}
});
// Create Parent Folder
wlCreateParentFolder = new Label(wFileName, SWT.RIGHT);
wlCreateParentFolder.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.CreateParentFolder.Label"));
props.setLook(wlCreateParentFolder);
fdlCreateParentFolder = new FormData();
fdlCreateParentFolder.left = new FormAttachment(0, 0);
fdlCreateParentFolder.top = new FormAttachment(wAppend, margin);
fdlCreateParentFolder.right = new FormAttachment(middle, -margin);
wlCreateParentFolder.setLayoutData(fdlCreateParentFolder);
wCreateParentFolder = new Button(wFileName, SWT.CHECK);
wCreateParentFolder.setToolTipText(BaseMessages.getString(PKG, "PropertyOutputDialog.CreateParentFolder.Tooltip"));
props.setLook(wCreateParentFolder);
fdCreateParentFolder = new FormData();
fdCreateParentFolder.left = new FormAttachment(middle, 0);
fdCreateParentFolder.top = new FormAttachment(wAppend, margin);
fdCreateParentFolder.right = new FormAttachment(100, 0);
wCreateParentFolder.setLayoutData(fdCreateParentFolder);
wCreateParentFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// FileNameInField line
wlFileNameInField = new Label(wFileName, SWT.RIGHT);
wlFileNameInField.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.FileNameInField.Label"));
props.setLook(wlFileNameInField);
fdlFileNameInField = new FormData();
fdlFileNameInField.left = new FormAttachment(0, 0);
fdlFileNameInField.top = new FormAttachment(wCreateParentFolder, margin);
fdlFileNameInField.right = new FormAttachment(middle, -margin);
wlFileNameInField.setLayoutData(fdlFileNameInField);
wFileNameInField = new Button(wFileName, SWT.CHECK);
wlFileNameInField.setToolTipText(BaseMessages.getString(PKG, "PropertyOutputDialog.FileNameInField.Label"));
props.setLook(wFileNameInField);
fdFileNameInField = new FormData();
fdFileNameInField.left = new FormAttachment(middle, 0);
fdFileNameInField.top = new FormAttachment(wCreateParentFolder, margin);
fdFileNameInField.right = new FormAttachment(100, 0);
wFileNameInField.setLayoutData(fdFileNameInField);
wFileNameInField.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
activeFilenameInField();
}
});
// FileNameField Line
wlFileNameField = new Label(wFileName, SWT.RIGHT);
wlFileNameField.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.FileNameField.Label"));
props.setLook(wlFileNameField);
fdlFileNameField = new FormData();
fdlFileNameField.left = new FormAttachment(0, 0);
fdlFileNameField.right = new FormAttachment(middle, -margin);
fdlFileNameField.top = new FormAttachment(wFileNameInField, margin);
wlFileNameField.setLayoutData(fdlFileNameField);
wFileNameField = new ComboVar(transMeta, wFileName, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFileNameField);
wFileNameField.addModifyListener(lsMod);
fdFileNameField = new FormData();
fdFileNameField.left = new FormAttachment(middle, 0);
fdFileNameField.top = new FormAttachment(wFileNameInField, margin);
fdFileNameField.right = new FormAttachment(100, 0);
wFileNameField.setLayoutData(fdFileNameField);
wFileNameField.setEnabled(false);
wFileNameField.setItems(fieldNames);
// Extension line
wlExtension = new Label(wFileName, SWT.RIGHT);
wlExtension.setText(BaseMessages.getString(PKG, "System.Label.Extension"));
props.setLook(wlExtension);
fdlExtension = new FormData();
fdlExtension.left = new FormAttachment(0, 0);
fdlExtension.top = new FormAttachment(wFileNameField, margin);
fdlExtension.right = new FormAttachment(middle, -margin);
wlExtension.setLayoutData(fdlExtension);
wExtension = new TextVar(transMeta, wFileName, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wExtension);
wExtension.addModifyListener(lsMod);
fdExtension = new FormData();
fdExtension.left = new FormAttachment(middle, 0);
fdExtension.top = new FormAttachment(wFileNameField, margin);
fdExtension.right = new FormAttachment(100, -margin);
wExtension.setLayoutData(fdExtension);
// Create multi-part file?
wlAddStepnr = new Label(wFileName, SWT.RIGHT);
wlAddStepnr.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.AddStepnr.Label"));
props.setLook(wlAddStepnr);
fdlAddStepnr = new FormData();
fdlAddStepnr.left = new FormAttachment(0, 0);
fdlAddStepnr.top = new FormAttachment(wExtension, 2 * margin);
fdlAddStepnr.right = new FormAttachment(middle, -margin);
wlAddStepnr.setLayoutData(fdlAddStepnr);
wAddStepnr = new Button(wFileName, SWT.CHECK);
props.setLook(wAddStepnr);
fdAddStepnr = new FormData();
fdAddStepnr.left = new FormAttachment(middle, 0);
fdAddStepnr.top = new FormAttachment(wExtension, 2 * margin);
fdAddStepnr.right = new FormAttachment(100, 0);
wAddStepnr.setLayoutData(fdAddStepnr);
wAddStepnr.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// Create multi-part file?
wlAddDate = new Label(wFileName, SWT.RIGHT);
wlAddDate.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.AddDate.Label"));
props.setLook(wlAddDate);
fdlAddDate = new FormData();
fdlAddDate.left = new FormAttachment(0, 0);
fdlAddDate.top = new FormAttachment(wAddStepnr, margin);
fdlAddDate.right = new FormAttachment(middle, -margin);
wlAddDate.setLayoutData(fdlAddDate);
wAddDate = new Button(wFileName, SWT.CHECK);
props.setLook(wAddDate);
fdAddDate = new FormData();
fdAddDate.left = new FormAttachment(middle, 0);
fdAddDate.top = new FormAttachment(wAddStepnr, margin);
fdAddDate.right = new FormAttachment(100, 0);
wAddDate.setLayoutData(fdAddDate);
wAddDate.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
// System.out.println("wAddDate.getSelection()="+wAddDate.getSelection());
}
});
// Create multi-part file?
wlAddTime = new Label(wFileName, SWT.RIGHT);
wlAddTime.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.AddTime.Label"));
props.setLook(wlAddTime);
fdlAddTime = new FormData();
fdlAddTime.left = new FormAttachment(0, 0);
fdlAddTime.top = new FormAttachment(wAddDate, margin);
fdlAddTime.right = new FormAttachment(middle, -margin);
wlAddTime.setLayoutData(fdlAddTime);
wAddTime = new Button(wFileName, SWT.CHECK);
props.setLook(wAddTime);
fdAddTime = new FormData();
fdAddTime.left = new FormAttachment(middle, 0);
fdAddTime.top = new FormAttachment(wAddDate, margin);
fdAddTime.right = new FormAttachment(100, 0);
wAddTime.setLayoutData(fdAddTime);
wAddTime.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
wbShowFiles = new Button(wFileName, SWT.PUSH | SWT.CENTER);
props.setLook(wbShowFiles);
wbShowFiles.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.ShowFiles.Button"));
fdbShowFiles = new FormData();
fdbShowFiles.left = new FormAttachment(middle, 0);
fdbShowFiles.top = new FormAttachment(wAddTime, margin * 2);
wbShowFiles.setLayoutData(fdbShowFiles);
wbShowFiles.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
PropertyOutputMeta tfoi = new PropertyOutputMeta();
getInfo(tfoi);
String[] files = tfoi.getFiles(transMeta);
if (files != null && files.length > 0) {
EnterSelectionDialog esd = new EnterSelectionDialog(shell, files, BaseMessages.getString(PKG, "PropertyOutputDialog.SelectOutputFiles.DialogTitle"), BaseMessages.getString(PKG, "PropertyOutputDialog.SelectOutputFiles.DialogMessage"));
esd.setViewOnly();
esd.open();
} else {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(BaseMessages.getString(PKG, "PropertyOutputDialog.NoFilesFound.DialogMessage"));
mb.setText(BaseMessages.getString(PKG, "System.DialogTitle.Error"));
mb.open();
}
}
});
fdFileName = new FormData();
fdFileName.left = new FormAttachment(0, margin);
fdFileName.top = new FormAttachment(wFields, margin);
fdFileName.right = new FormAttachment(100, -margin);
wFileName.setLayoutData(fdFileName);
// ///////////////////////////////////////////////////////////
// / END OF FileName GROUP
// ///////////////////////////////////////////////////////////
// File grouping?
// ////////////////////////
// START OF ResultFile GROUP
//
wResultFile = new Group(wContentComp, SWT.SHADOW_NONE);
props.setLook(wResultFile);
wResultFile.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.Group.ResultFile.Label"));
FormLayout groupResultFile = new FormLayout();
groupResultFile.marginWidth = 10;
groupResultFile.marginHeight = 10;
wResultFile.setLayout(groupResultFile);
// Add File to the result files name
wlAddToResult = new Label(wResultFile, SWT.RIGHT);
wlAddToResult.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.AddFileToResult.Label"));
props.setLook(wlAddToResult);
fdlAddToResult = new FormData();
fdlAddToResult.left = new FormAttachment(0, 0);
fdlAddToResult.top = new FormAttachment(wFileName, margin);
fdlAddToResult.right = new FormAttachment(middle, -margin);
wlAddToResult.setLayoutData(fdlAddToResult);
wAddToResult = new Button(wResultFile, SWT.CHECK);
wAddToResult.setToolTipText(BaseMessages.getString(PKG, "PropertyOutputDialog.AddFileToResult.Tooltip"));
props.setLook(wAddToResult);
fdAddToResult = new FormData();
fdAddToResult.left = new FormAttachment(middle, 0);
fdAddToResult.top = new FormAttachment(wFileName, margin);
fdAddToResult.right = new FormAttachment(100, 0);
wAddToResult.setLayoutData(fdAddToResult);
SelectionAdapter lsSelAR = new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
input.setChanged();
}
};
wAddToResult.addSelectionListener(lsSelAR);
fdResultFile = new FormData();
fdResultFile.left = new FormAttachment(0, margin);
fdResultFile.top = new FormAttachment(wFileName, margin);
fdResultFile.right = new FormAttachment(100, -margin);
wResultFile.setLayoutData(fdResultFile);
// ///////////////////////////////////////////////////////////
// / END OF ResultFile GROUP
// ///////////////////////////////////////////////////////////
fdContentComp = new FormData();
fdContentComp.left = new FormAttachment(0, 0);
fdContentComp.top = new FormAttachment(0, 0);
fdContentComp.right = new FormAttachment(100, 0);
fdContentComp.bottom = new FormAttachment(100, 0);
wContentComp.setLayoutData(wContentComp);
wContentComp.layout();
wContentTab.setControl(wContentComp);
// ///////////////////////////////////////////////////////////
// / END OF CONTENT TAB
// ///////////////////////////////////////////////////////////
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);
// Some buttons
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
wOK.addListener(SWT.Selection, lsOK);
wCancel.addListener(SWT.Selection, lsCancel);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wbFilename.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.SAVE);
dialog.setFilterExtensions(new String[] { "*.txt", "*.TXT", "*" });
if (wFilename.getText() != null) {
dialog.setFileName(transMeta.environmentSubstitute(wFilename.getText()));
}
dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "System.FileType.TextFiles"), BaseMessages.getString(PKG, "System.FileType.CSVFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
if (dialog.open() != null) {
String extension = wExtension.getText();
if (extension != null && dialog.getFileName() != null && dialog.getFileName().endsWith("." + extension)) {
// The extension is filled in and matches the end
// of the selected file => Strip off the extension.
String fileName = dialog.getFileName();
wFilename.setText(dialog.getFilterPath() + System.getProperty("file.separator") + fileName.substring(0, fileName.length() - (extension.length() + 1)));
} else {
wFilename.setText(dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName());
}
}
}
});
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
lsResize = new Listener() {
public void handleEvent(Event event) {
// Point size = shell.getSize();
}
};
shell.addListener(SWT.Resize, lsResize);
wTabFolder.setSelection(0);
// Set the shell size, based upon previous time...
setSize();
getData();
activeFilenameInField();
// backupChanged);
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.eclipse.swt.custom.CTabItem in project pentaho-kettle by pentaho.
the class RegexEvalDialog 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 lsSel = new SelectionAdapter() {
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, "RegexEvalDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Filename line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "RegexEvalDialog.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);
wSash = new SashForm(shell, SWT.VERTICAL);
wTabFolder = new CTabFolder(wSash, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "RegexEvalDialog.GeneralTab.TabTitle"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// Step Settings grouping?
// ////////////////////////
// START OF Step Settings GROUP
//
wStepSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wStepSettings);
wStepSettings.setText(BaseMessages.getString(PKG, "RegexEvalDialog.Group.StepSettings.Label"));
FormLayout groupLayout = new FormLayout();
groupLayout.marginWidth = 10;
groupLayout.marginHeight = 10;
wStepSettings.setLayout(groupLayout);
// fieldevaluate
wlfieldevaluate = new Label(wStepSettings, SWT.RIGHT);
wlfieldevaluate.setText(BaseMessages.getString(PKG, "RegexEvalDialog.Matcher.Label"));
props.setLook(wlfieldevaluate);
fdlfieldevaluate = new FormData();
fdlfieldevaluate.left = new FormAttachment(0, 0);
fdlfieldevaluate.top = new FormAttachment(wStepname, margin);
fdlfieldevaluate.right = new FormAttachment(middle, -margin);
wlfieldevaluate.setLayoutData(fdlfieldevaluate);
wfieldevaluate = new CCombo(wStepSettings, SWT.BORDER | SWT.READ_ONLY);
wfieldevaluate.setEditable(true);
props.setLook(wfieldevaluate);
wfieldevaluate.addModifyListener(lsMod);
fdfieldevaluate = new FormData();
fdfieldevaluate.left = new FormAttachment(middle, margin);
fdfieldevaluate.top = new FormAttachment(wStepname, margin);
fdfieldevaluate.right = new FormAttachment(100, -margin);
wfieldevaluate.setLayoutData(fdfieldevaluate);
wfieldevaluate.addSelectionListener(lsSel);
wfieldevaluate.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);
getPreviousFields();
shell.setCursor(null);
busy.dispose();
}
});
// Output Fieldame
wResultField = new LabelTextVar(transMeta, wStepSettings, BaseMessages.getString(PKG, "RegexEvalDialog.ResultField.Label"), BaseMessages.getString(PKG, "RegexEvalDialog.ResultField.Tooltip"));
props.setLook(wResultField);
wResultField.addModifyListener(lsMod);
fdResultField = new FormData();
fdResultField.left = new FormAttachment(0, 0);
fdResultField.top = new FormAttachment(wfieldevaluate, margin);
fdResultField.right = new FormAttachment(100, 0);
wResultField.setLayoutData(fdResultField);
// Allow capture groups?
wlAllowCaptureGroups = new Label(wStepSettings, SWT.RIGHT);
wlAllowCaptureGroups.setText(BaseMessages.getString(PKG, "RegexEvalDialog.AllowCaptureGroups.Label"));
props.setLook(wlAllowCaptureGroups);
FormData fdlAllowCaptureGroups = new FormData();
fdlAllowCaptureGroups.left = new FormAttachment(0, 0);
fdlAllowCaptureGroups.top = new FormAttachment(wResultField, margin);
fdlAllowCaptureGroups.right = new FormAttachment(middle, -margin);
wlAllowCaptureGroups.setLayoutData(fdlAllowCaptureGroups);
wAllowCaptureGroups = new Button(wStepSettings, SWT.CHECK);
wAllowCaptureGroups.setToolTipText(BaseMessages.getString(PKG, "RegexEvalDialog.AllowCaptureGroups.Tooltip"));
props.setLook(wAllowCaptureGroups);
FormData fdAllowCaptureGroups = new FormData();
fdAllowCaptureGroups.left = new FormAttachment(middle, margin);
fdAllowCaptureGroups.top = new FormAttachment(wResultField, margin);
fdAllowCaptureGroups.right = new FormAttachment(100, 0);
wAllowCaptureGroups.setLayoutData(fdAllowCaptureGroups);
wAllowCaptureGroups.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setFieldsEnabledStatus();
input.setChanged();
}
});
// Replace fields?
wlReplaceFields = new Label(wStepSettings, SWT.RIGHT);
wlReplaceFields.setText(BaseMessages.getString(PKG, "RegexEvalDialog.ReplaceFields.Label"));
props.setLook(wlReplaceFields);
FormData fdlReplaceFields = new FormData();
fdlReplaceFields.left = new FormAttachment(0, 0);
fdlReplaceFields.top = new FormAttachment(wAllowCaptureGroups, margin);
fdlReplaceFields.right = new FormAttachment(middle, -margin);
wlReplaceFields.setLayoutData(fdlReplaceFields);
wReplaceFields = new Button(wStepSettings, SWT.CHECK);
wReplaceFields.setToolTipText(BaseMessages.getString(PKG, "RegexEvalDialog.ReplaceFields.Tooltip"));
props.setLook(wReplaceFields);
FormData fdReplaceFields = new FormData();
fdReplaceFields.left = new FormAttachment(middle, margin);
fdReplaceFields.top = new FormAttachment(wAllowCaptureGroups, margin);
fdReplaceFields.right = new FormAttachment(100, 0);
wReplaceFields.setLayoutData(fdReplaceFields);
wReplaceFields.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// settings layout
fdStepSettings = new FormData();
fdStepSettings.left = new FormAttachment(0, margin);
fdStepSettings.top = new FormAttachment(wStepname, margin);
fdStepSettings.right = new FormAttachment(100, -margin);
wStepSettings.setLayoutData(fdStepSettings);
// ///////////////////////////////////////////////////////////
// / END OF STEP SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// Script line
wlScript = new Label(wGeneralComp, SWT.NONE);
wlScript.setText(BaseMessages.getString(PKG, "RegexEvalDialog.Javascript.Label"));
props.setLook(wlScript);
fdlScript = new FormData();
fdlScript.left = new FormAttachment(0, 0);
fdlScript.top = new FormAttachment(wStepSettings, margin);
wlScript.setLayoutData(fdlScript);
wbTestRegExScript = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbTestRegExScript);
wbTestRegExScript.setText(BaseMessages.getString(PKG, "RegexEvalDialog.TestScript.Label"));
fdbTestRegExScript = new FormData();
fdbTestRegExScript.right = new FormAttachment(100, -margin);
fdbTestRegExScript.top = new FormAttachment(wStepSettings, margin);
wbTestRegExScript.setLayoutData(fdbTestRegExScript);
wScript = new StyledTextComp(transMeta, wGeneralComp, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
wScript.setText(BaseMessages.getString(PKG, "RegexEvalDialog.Script.Label"));
props.setLook(wScript, Props.WIDGET_STYLE_FIXED);
wScript.addModifyListener(lsMod);
fdScript = new FormData();
fdScript.left = new FormAttachment(0, 0);
fdScript.top = new FormAttachment(wbTestRegExScript, margin);
fdScript.right = new FormAttachment(100, -10);
fdScript.bottom = new FormAttachment(100, -25);
wScript.setLayoutData(fdScript);
// SelectionAdapter lsVar = VariableButtonListenerFactory.getSelectionAdapter(shell, wScript);
// wScript.addKeyListener(TextVar.getControlSpaceKeyListener(wScript, lsVar));
// Variable substitution?
wlUseVar = new Label(wGeneralComp, SWT.NONE);
wlUseVar.setText(BaseMessages.getString(PKG, "RegexEvalDialog.UseVar.Label"));
props.setLook(wlUseVar);
FormData fdlUseVar = new FormData();
fdlUseVar.left = new FormAttachment(0, margin);
fdlUseVar.top = new FormAttachment(wScript, margin);
wlUseVar.setLayoutData(fdlUseVar);
wUseVar = new Button(wGeneralComp, SWT.CHECK);
wUseVar.setToolTipText(BaseMessages.getString(PKG, "RegexEvalDialog.UseVar.Tooltip"));
props.setLook(wUseVar);
FormData fdUseVar = new FormData();
fdUseVar.left = new FormAttachment(wlUseVar, margin);
fdUseVar.top = new FormAttachment(wScript, margin);
wUseVar.setLayoutData(fdUseVar);
wUseVar.addSelectionListener(lsSel);
wBottom = new Composite(wSash, SWT.NONE);
props.setLook(wBottom);
FormLayout bottomLayout = new FormLayout();
bottomLayout.marginWidth = Const.FORM_MARGIN;
bottomLayout.marginHeight = Const.FORM_MARGIN;
wBottom.setLayout(bottomLayout);
wSeparator = new Label(wBottom, SWT.SEPARATOR | SWT.HORIZONTAL);
fdSeparator = new FormData();
fdSeparator.left = new FormAttachment(0, 0);
fdSeparator.right = new FormAttachment(100, 0);
fdSeparator.top = new FormAttachment(0, -margin + 2);
wSeparator.setLayoutData(fdSeparator);
wlFields = new Label(wBottom, SWT.NONE);
wlFields.setText(BaseMessages.getString(PKG, "RegexEvalDialog.Fields.Label"));
wlFields.setToolTipText(BaseMessages.getString(PKG, "RegexEvalDialog.Fields.Tooltip"));
props.setLook(wlFields);
fdlFields = new FormData();
fdlFields.left = new FormAttachment(0, 0);
fdlFields.top = new FormAttachment(wSeparator, 0);
wlFields.setLayoutData(fdlFields);
final int fieldsRows = input.getFieldName().length;
ColumnInfo[] columnInfo = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "RegexEvalDialog.ColumnInfo.NewField"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "RegexEvalDialog.ColumnInfo.Type"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames()), new ColumnInfo(BaseMessages.getString(PKG, "RegexEvalDialog.ColumnInfo.Length"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "RegexEvalDialog.ColumnInfo.Precision"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "RegexEvalDialog.ColumnInfo.Format"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "RegexEvalDialog.ColumnInfo.Group"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "RegexEvalDialog.ColumnInfo.Decimal"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "RegexEvalDialog.ColumnInfo.Currency"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "RegexEvalDialog.ColumnInfo.Nullif"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "RegexEvalDialog.ColumnInfo.IfNull"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "RegexEvalDialog.ColumnInfo.TrimType"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaString.trimTypeDesc, true) };
wFields = new TableView(transMeta, wBottom, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, columnInfo, fieldsRows, lsMod, props);
fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(wlFields, margin);
fdFields.right = new FormAttachment(100, 0);
fdFields.bottom = new FormAttachment(100, 0);
wFields.setLayoutData(fdFields);
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(0, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF CONTENT TAB///
// /
wContentTab = new CTabItem(wTabFolder, SWT.NONE);
wContentTab.setText(BaseMessages.getString(PKG, "RegexEvalDialog.ContentTab.TabTitle"));
FormLayout contentLayout = new FormLayout();
contentLayout.marginWidth = 3;
contentLayout.marginHeight = 3;
wContentComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wContentComp);
wContentComp.setLayout(contentLayout);
// Step RegexSettings grouping?
// ////////////////////////
// START OF RegexSettings GROUP
//
wRegexSettings = new Group(wContentComp, SWT.SHADOW_NONE);
props.setLook(wRegexSettings);
wRegexSettings.setText("Regex Settings");
FormLayout regexLayout = new FormLayout();
regexLayout.marginWidth = 10;
regexLayout.marginHeight = 10;
wRegexSettings.setLayout(regexLayout);
// Canon_Eq?
wlCanonEq = new Label(wRegexSettings, SWT.RIGHT);
wlCanonEq.setText(BaseMessages.getString(PKG, "RegexEvalDialog.CanonEq.Label"));
props.setLook(wlCanonEq);
FormData fdlCanonEq = new FormData();
fdlCanonEq.left = new FormAttachment(0, 0);
fdlCanonEq.top = new FormAttachment(wStepSettings, margin);
fdlCanonEq.right = new FormAttachment(middle, -margin);
wlCanonEq.setLayoutData(fdlCanonEq);
wCanonEq = new Button(wRegexSettings, SWT.CHECK);
wCanonEq.setToolTipText(BaseMessages.getString(PKG, "RegexEvalDialog.CanonEq.Tooltip"));
props.setLook(wCanonEq);
FormData fdCanonEq = new FormData();
fdCanonEq.left = new FormAttachment(middle, 0);
fdCanonEq.top = new FormAttachment(wStepSettings, margin);
fdCanonEq.right = new FormAttachment(100, 0);
wCanonEq.setLayoutData(fdCanonEq);
wCanonEq.addSelectionListener(lsSel);
// CASE_INSENSITIVE?
wlCaseInsensitive = new Label(wRegexSettings, SWT.RIGHT);
wlCaseInsensitive.setText(BaseMessages.getString(PKG, "RegexEvalDialog.CaseInsensitive.Label"));
props.setLook(wlCaseInsensitive);
FormData fdlCaseInsensitive = new FormData();
fdlCaseInsensitive.left = new FormAttachment(0, 0);
fdlCaseInsensitive.top = new FormAttachment(wCanonEq, margin);
fdlCaseInsensitive.right = new FormAttachment(middle, -margin);
wlCaseInsensitive.setLayoutData(fdlCaseInsensitive);
wCaseInsensitive = new Button(wRegexSettings, SWT.CHECK);
wCaseInsensitive.setToolTipText(BaseMessages.getString(PKG, "RegexEvalDialog.CaseInsensitive.Tooltip"));
props.setLook(wCaseInsensitive);
FormData fdCaseInsensitive = new FormData();
fdCaseInsensitive.left = new FormAttachment(middle, 0);
fdCaseInsensitive.top = new FormAttachment(wCanonEq, margin);
fdCaseInsensitive.right = new FormAttachment(100, 0);
wCaseInsensitive.setLayoutData(fdCaseInsensitive);
wCaseInsensitive.addSelectionListener(lsSel);
// COMMENT?
wlComment = new Label(wRegexSettings, SWT.RIGHT);
wlComment.setText(BaseMessages.getString(PKG, "RegexEvalDialog.Comment.Label"));
props.setLook(wlComment);
FormData fdlComment = new FormData();
fdlComment.left = new FormAttachment(0, 0);
fdlComment.top = new FormAttachment(wCaseInsensitive, margin);
fdlComment.right = new FormAttachment(middle, -margin);
wlComment.setLayoutData(fdlComment);
wComment = new Button(wRegexSettings, SWT.CHECK);
wComment.setToolTipText(BaseMessages.getString(PKG, "RegexEvalDialog.Comment.Tooltip"));
props.setLook(wComment);
FormData fdComment = new FormData();
fdComment.left = new FormAttachment(middle, 0);
fdComment.top = new FormAttachment(wCaseInsensitive, margin);
fdComment.right = new FormAttachment(100, 0);
wComment.setLayoutData(fdComment);
wComment.addSelectionListener(lsSel);
// DOTALL?
wlDotAll = new Label(wRegexSettings, SWT.RIGHT);
wlDotAll.setText(BaseMessages.getString(PKG, "RegexEvalDialog.DotAll.Label"));
props.setLook(wlDotAll);
FormData fdlDotAll = new FormData();
fdlDotAll.left = new FormAttachment(0, 0);
fdlDotAll.top = new FormAttachment(wComment, margin);
fdlDotAll.right = new FormAttachment(middle, -margin);
wlDotAll.setLayoutData(fdlDotAll);
wDotAll = new Button(wRegexSettings, SWT.CHECK);
wDotAll.setToolTipText(BaseMessages.getString(PKG, "RegexEvalDialog.DotAll.Tooltip"));
props.setLook(wDotAll);
FormData fdDotAll = new FormData();
fdDotAll.left = new FormAttachment(middle, 0);
fdDotAll.top = new FormAttachment(wComment, margin);
fdDotAll.right = new FormAttachment(100, 0);
wDotAll.setLayoutData(fdDotAll);
wDotAll.addSelectionListener(lsSel);
// MULTILINE?
wlMultiline = new Label(wRegexSettings, SWT.RIGHT);
wlMultiline.setText(BaseMessages.getString(PKG, "RegexEvalDialog.Multiline.Label"));
props.setLook(wlMultiline);
FormData fdlMultiline = new FormData();
fdlMultiline.left = new FormAttachment(0, 0);
fdlMultiline.top = new FormAttachment(wDotAll, margin);
fdlMultiline.right = new FormAttachment(middle, -margin);
wlMultiline.setLayoutData(fdlMultiline);
wMultiline = new Button(wRegexSettings, SWT.CHECK);
wMultiline.setToolTipText(BaseMessages.getString(PKG, "RegexEvalDialog.Multiline.Tooltip"));
props.setLook(wMultiline);
FormData fdMultiline = new FormData();
fdMultiline.left = new FormAttachment(middle, 0);
fdMultiline.top = new FormAttachment(wDotAll, margin);
fdMultiline.right = new FormAttachment(100, 0);
wMultiline.setLayoutData(fdMultiline);
wMultiline.addSelectionListener(lsSel);
// UNICODE?
wlUnicode = new Label(wRegexSettings, SWT.RIGHT);
wlUnicode.setText(BaseMessages.getString(PKG, "RegexEvalDialog.Unicode.Label"));
props.setLook(wlUnicode);
FormData fdlUnicode = new FormData();
fdlUnicode.left = new FormAttachment(0, 0);
fdlUnicode.top = new FormAttachment(wMultiline, margin);
fdlUnicode.right = new FormAttachment(middle, -margin);
wlUnicode.setLayoutData(fdlUnicode);
wUnicode = new Button(wRegexSettings, SWT.CHECK);
wUnicode.setToolTipText(BaseMessages.getString(PKG, "RegexEvalDialog.Unicode.Tooltip"));
props.setLook(wUnicode);
FormData fdUnicode = new FormData();
fdUnicode.left = new FormAttachment(middle, 0);
fdUnicode.top = new FormAttachment(wMultiline, margin);
fdUnicode.right = new FormAttachment(100, 0);
wUnicode.setLayoutData(fdUnicode);
wUnicode.addSelectionListener(lsSel);
// UNIX?
wlUnix = new Label(wRegexSettings, SWT.RIGHT);
wlUnix.setText(BaseMessages.getString(PKG, "RegexEvalDialog.Unix.Label"));
props.setLook(wlUnix);
FormData fdlUnix = new FormData();
fdlUnix.left = new FormAttachment(0, 0);
fdlUnix.top = new FormAttachment(wUnicode, margin);
fdlUnix.right = new FormAttachment(middle, -margin);
wlUnix.setLayoutData(fdlUnix);
wUnix = new Button(wRegexSettings, SWT.CHECK);
wUnix.setToolTipText(BaseMessages.getString(PKG, "RegexEvalDialog.Unix.Tooltip"));
props.setLook(wUnix);
FormData fdUnix = new FormData();
fdUnix.left = new FormAttachment(middle, 0);
fdUnix.top = new FormAttachment(wUnicode, margin);
fdUnix.right = new FormAttachment(100, 0);
wUnix.setLayoutData(fdUnix);
wUnix.addSelectionListener(lsSel);
fdRegexSettings = new FormData();
fdRegexSettings.left = new FormAttachment(0, margin);
fdRegexSettings.top = new FormAttachment(wStepSettings, margin);
fdRegexSettings.right = new FormAttachment(100, -margin);
wRegexSettings.setLayoutData(fdRegexSettings);
// ///////////////////////////////////////////////////////////
// / END OF RegexSettings GROUP
// ///////////////////////////////////////////////////////////
fdContentComp = new FormData();
fdContentComp.left = new FormAttachment(0, 0);
fdContentComp.top = new FormAttachment(0, 0);
fdContentComp.right = new FormAttachment(100, 0);
fdContentComp.bottom = new FormAttachment(100, 0);
wContentComp.setLayoutData(wContentComp);
wContentComp.layout();
wContentTab.setControl(wContentComp);
// ///////////////////////////////////////////////////////////
// / END OF CONTENT TAB
// ///////////////////////////////////////////////////////////
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);
fdBottom = new FormData();
fdBottom.left = new FormAttachment(0, 0);
fdBottom.top = new FormAttachment(0, 0);
fdBottom.right = new FormAttachment(100, 0);
fdBottom.bottom = new FormAttachment(100, 0);
wBottom.setLayoutData(fdBottom);
fdSash = new FormData();
fdSash.left = new FormAttachment(0, 0);
fdSash.top = new FormAttachment(wStepname, 0);
fdSash.right = new FormAttachment(100, 0);
fdSash.bottom = new FormAttachment(100, -50);
wSash.setLayoutData(fdSash);
wSash.setWeights(new int[] { 60, 40 });
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
lsbTestRegExScript = new Listener() {
public void handleEvent(Event e) {
testRegExScript();
}
};
wbTestRegExScript.addListener(SWT.Selection, lsbTestRegExScript);
setButtonPositions(new Button[] { wOK, wCancel }, margin, null);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wTabFolder.setSelection(0);
// Set the shell size, based upon previous time...
setSize();
getData();
setFieldsEnabledStatus();
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.eclipse.swt.custom.CTabItem in project pentaho-kettle by pentaho.
the class RestDialog 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();
}
};
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, "RestDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "RestDialog.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);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, PropsUI.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "RestDialog.GeneralTab.Title"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout fileLayout = new FormLayout();
fileLayout.marginWidth = 3;
fileLayout.marginHeight = 3;
wGeneralComp.setLayout(fileLayout);
// ////////////////////////
// START Settings GROUP
Group gSettings = new Group(wGeneralComp, SWT.SHADOW_ETCHED_IN);
gSettings.setText(BaseMessages.getString(PKG, "RestDialog.SettingsGroup.Label"));
FormLayout SettingsLayout = new FormLayout();
SettingsLayout.marginWidth = 3;
SettingsLayout.marginHeight = 3;
gSettings.setLayout(SettingsLayout);
props.setLook(gSettings);
wlUrl = new Label(gSettings, SWT.RIGHT);
wlUrl.setText(BaseMessages.getString(PKG, "RestDialog.URL.Label"));
props.setLook(wlUrl);
fdlUrl = new FormData();
fdlUrl.left = new FormAttachment(0, 0);
fdlUrl.right = new FormAttachment(middle, -margin);
fdlUrl.top = new FormAttachment(wGeneralComp, margin * 2);
wlUrl.setLayoutData(fdlUrl);
wUrl = new TextVar(transMeta, gSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wUrl);
wUrl.addModifyListener(lsMod);
fdUrl = new FormData();
fdUrl.left = new FormAttachment(middle, 0);
fdUrl.top = new FormAttachment(wGeneralComp, margin * 2);
fdUrl.right = new FormAttachment(100, 0);
wUrl.setLayoutData(fdUrl);
// UrlInField line
wlUrlInField = new Label(gSettings, SWT.RIGHT);
wlUrlInField.setText(BaseMessages.getString(PKG, "RestDialog.UrlInField.Label"));
props.setLook(wlUrlInField);
fdlUrlInField = new FormData();
fdlUrlInField.left = new FormAttachment(0, 0);
fdlUrlInField.top = new FormAttachment(wUrl, margin);
fdlUrlInField.right = new FormAttachment(middle, -margin);
wlUrlInField.setLayoutData(fdlUrlInField);
wUrlInField = new Button(gSettings, SWT.CHECK);
props.setLook(wUrlInField);
fdUrlInField = new FormData();
fdUrlInField.left = new FormAttachment(middle, 0);
fdUrlInField.top = new FormAttachment(wUrl, margin);
fdUrlInField.right = new FormAttachment(100, 0);
wUrlInField.setLayoutData(fdUrlInField);
wUrlInField.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
activeUrlInfield();
}
});
// UrlField Line
wlUrlField = new Label(gSettings, SWT.RIGHT);
wlUrlField.setText(BaseMessages.getString(PKG, "RestDialog.UrlField.Label"));
props.setLook(wlUrlField);
fdlUrlField = new FormData();
fdlUrlField.left = new FormAttachment(0, 0);
fdlUrlField.right = new FormAttachment(middle, -margin);
fdlUrlField.top = new FormAttachment(wUrlInField, margin);
wlUrlField.setLayoutData(fdlUrlField);
wUrlField = new ComboVar(transMeta, gSettings, SWT.BORDER | SWT.READ_ONLY);
wUrlField.setEditable(true);
props.setLook(wUrlField);
wUrlField.addModifyListener(lsMod);
fdUrlField = new FormData();
fdUrlField.left = new FormAttachment(middle, 0);
fdUrlField.top = new FormAttachment(wUrlInField, margin);
fdUrlField.right = new FormAttachment(100, -margin);
wUrlField.setLayoutData(fdUrlField);
wUrlField.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);
setStreamFields();
shell.setCursor(null);
busy.dispose();
}
});
// Method Line
wlMethod = new Label(gSettings, SWT.RIGHT);
wlMethod.setText(BaseMessages.getString(PKG, "RestDialog.Method.Label"));
props.setLook(wlMethod);
fdlMethod = new FormData();
fdlMethod.left = new FormAttachment(0, 0);
fdlMethod.right = new FormAttachment(middle, -margin);
fdlMethod.top = new FormAttachment(wUrlField, 2 * margin);
wlMethod.setLayoutData(fdlMethod);
wMethod = new ComboVar(transMeta, gSettings, SWT.BORDER | SWT.READ_ONLY);
wMethod.setEditable(true);
props.setLook(wMethod);
wMethod.addModifyListener(lsMod);
fdMethod = new FormData();
fdMethod.left = new FormAttachment(middle, 0);
fdMethod.top = new FormAttachment(wUrlField, 2 * margin);
fdMethod.right = new FormAttachment(100, -margin);
wMethod.setLayoutData(fdMethod);
wMethod.setItems(RestMeta.HTTP_METHODS);
wMethod.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setMethod();
}
});
// MethodInField line
wlMethodInField = new Label(gSettings, SWT.RIGHT);
wlMethodInField.setText(BaseMessages.getString(PKG, "RestDialog.MethodInField.Label"));
props.setLook(wlMethodInField);
fdlMethodInField = new FormData();
fdlMethodInField.left = new FormAttachment(0, 0);
fdlMethodInField.top = new FormAttachment(wMethod, margin);
fdlMethodInField.right = new FormAttachment(middle, -margin);
wlMethodInField.setLayoutData(fdlMethodInField);
wMethodInField = new Button(gSettings, SWT.CHECK);
props.setLook(wMethodInField);
fdMethodInField = new FormData();
fdMethodInField.left = new FormAttachment(middle, 0);
fdMethodInField.top = new FormAttachment(wMethod, margin);
fdMethodInField.right = new FormAttachment(100, 0);
wMethodInField.setLayoutData(fdMethodInField);
wMethodInField.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
activeMethodInfield();
}
});
// MethodField Line
wlMethodField = new Label(gSettings, SWT.RIGHT);
wlMethodField.setText(BaseMessages.getString(PKG, "RestDialog.MethodField.Label"));
props.setLook(wlMethodField);
fdlMethodField = new FormData();
fdlMethodField.left = new FormAttachment(0, 0);
fdlMethodField.right = new FormAttachment(middle, -margin);
fdlMethodField.top = new FormAttachment(wMethodInField, margin);
wlMethodField.setLayoutData(fdlMethodField);
wMethodField = new ComboVar(transMeta, gSettings, SWT.BORDER | SWT.READ_ONLY);
wMethodField.setEditable(true);
props.setLook(wMethodField);
wMethodField.addModifyListener(lsMod);
fdMethodField = new FormData();
fdMethodField.left = new FormAttachment(middle, 0);
fdMethodField.top = new FormAttachment(wMethodInField, margin);
fdMethodField.right = new FormAttachment(100, -margin);
wMethodField.setLayoutData(fdMethodField);
wMethodField.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);
setStreamFields();
shell.setCursor(null);
busy.dispose();
}
});
// Body Line
wlBody = new Label(gSettings, SWT.RIGHT);
wlBody.setText(BaseMessages.getString(PKG, "RestDialog.Body.Label"));
props.setLook(wlBody);
fdlBody = new FormData();
fdlBody.left = new FormAttachment(0, 0);
fdlBody.right = new FormAttachment(middle, -margin);
fdlBody.top = new FormAttachment(wMethodField, 2 * margin);
wlBody.setLayoutData(fdlBody);
wBody = new ComboVar(transMeta, gSettings, SWT.BORDER | SWT.READ_ONLY);
wBody.setEditable(true);
props.setLook(wBody);
wBody.addModifyListener(lsMod);
fdBody = new FormData();
fdBody.left = new FormAttachment(middle, 0);
fdBody.top = new FormAttachment(wMethodField, 2 * margin);
fdBody.right = new FormAttachment(100, -margin);
wBody.setLayoutData(fdBody);
wBody.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);
setStreamFields();
shell.setCursor(null);
busy.dispose();
}
});
// ApplicationType Line
wlApplicationType = new Label(gSettings, SWT.RIGHT);
wlApplicationType.setText(BaseMessages.getString(PKG, "RestDialog.ApplicationType.Label"));
props.setLook(wlApplicationType);
fdlApplicationType = new FormData();
fdlApplicationType.left = new FormAttachment(0, 0);
fdlApplicationType.right = new FormAttachment(middle, -margin);
fdlApplicationType.top = new FormAttachment(wBody, 2 * margin);
wlApplicationType.setLayoutData(fdlApplicationType);
wApplicationType = new ComboVar(transMeta, gSettings, SWT.BORDER | SWT.READ_ONLY);
wApplicationType.setEditable(true);
props.setLook(wApplicationType);
wApplicationType.addModifyListener(lsMod);
fdApplicationType = new FormData();
fdApplicationType.left = new FormAttachment(middle, 0);
fdApplicationType.top = new FormAttachment(wBody, 2 * margin);
fdApplicationType.right = new FormAttachment(100, -margin);
wApplicationType.setLayoutData(fdApplicationType);
wApplicationType.setItems(RestMeta.APPLICATION_TYPES);
wApplicationType.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
FormData fdSettings = new FormData();
fdSettings.left = new FormAttachment(0, 0);
fdSettings.right = new FormAttachment(100, 0);
fdSettings.top = new FormAttachment(wStepname, margin);
gSettings.setLayoutData(fdSettings);
// END Output Settings GROUP
// ////////////////////////
// ////////////////////////
// START Output Fields GROUP
Group gOutputFields = new Group(wGeneralComp, SWT.SHADOW_ETCHED_IN);
gOutputFields.setText(BaseMessages.getString(PKG, "RestDialog.OutputFieldsGroup.Label"));
FormLayout OutputFieldsLayout = new FormLayout();
OutputFieldsLayout.marginWidth = 3;
OutputFieldsLayout.marginHeight = 3;
gOutputFields.setLayout(OutputFieldsLayout);
props.setLook(gOutputFields);
// Result line...
wlResult = new Label(gOutputFields, SWT.RIGHT);
wlResult.setText(BaseMessages.getString(PKG, "RestDialog.Result.Label"));
props.setLook(wlResult);
fdlResult = new FormData();
fdlResult.left = new FormAttachment(0, 0);
fdlResult.right = new FormAttachment(middle, -margin);
fdlResult.top = new FormAttachment(gSettings, margin);
wlResult.setLayoutData(fdlResult);
wResult = new TextVar(transMeta, gOutputFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wResult);
wResult.addModifyListener(lsMod);
fdResult = new FormData();
fdResult.left = new FormAttachment(middle, 0);
fdResult.top = new FormAttachment(gSettings, margin * 2);
fdResult.right = new FormAttachment(100, -margin);
wResult.setLayoutData(fdResult);
// Resultcode line...
wlResultCode = new Label(gOutputFields, SWT.RIGHT);
wlResultCode.setText(BaseMessages.getString(PKG, "RestDialog.ResultCode.Label"));
props.setLook(wlResultCode);
fdlResultCode = new FormData();
fdlResultCode.left = new FormAttachment(0, 0);
fdlResultCode.right = new FormAttachment(middle, -margin);
fdlResultCode.top = new FormAttachment(wResult, margin);
wlResultCode.setLayoutData(fdlResultCode);
wResultCode = new TextVar(transMeta, gOutputFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wResultCode);
wResultCode.addModifyListener(lsMod);
fdResultCode = new FormData();
fdResultCode.left = new FormAttachment(middle, 0);
fdResultCode.top = new FormAttachment(wResult, margin);
fdResultCode.right = new FormAttachment(100, -margin);
wResultCode.setLayoutData(fdResultCode);
// Response time line...
wlResponseTime = new Label(gOutputFields, SWT.RIGHT);
wlResponseTime.setText(BaseMessages.getString(PKG, "RestDialog.ResponseTime.Label"));
props.setLook(wlResponseTime);
fdlResponseTime = new FormData();
fdlResponseTime.left = new FormAttachment(0, 0);
fdlResponseTime.right = new FormAttachment(middle, -margin);
fdlResponseTime.top = new FormAttachment(wResultCode, margin);
wlResponseTime.setLayoutData(fdlResponseTime);
wResponseTime = new TextVar(transMeta, gOutputFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wResponseTime);
wResponseTime.addModifyListener(lsMod);
fdResponseTime = new FormData();
fdResponseTime.left = new FormAttachment(middle, 0);
fdResponseTime.top = new FormAttachment(wResultCode, margin);
fdResponseTime.right = new FormAttachment(100, 0);
wResponseTime.setLayoutData(fdResponseTime);
// Response header line...
wlResponseHeader = new Label(gOutputFields, SWT.RIGHT);
wlResponseHeader.setText(BaseMessages.getString(PKG, "RestDialog.ResponseHeader.Label"));
props.setLook(wlResponseHeader);
fdlResponseHeader = new FormData();
fdlResponseHeader.left = new FormAttachment(0, 0);
fdlResponseHeader.right = new FormAttachment(middle, -margin);
fdlResponseHeader.top = new FormAttachment(wResponseTime, margin);
wlResponseHeader.setLayoutData(fdlResponseHeader);
wResponseHeader = new TextVar(transMeta, gOutputFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wResponseHeader);
wResponseHeader.addModifyListener(lsMod);
fdResponseHeader = new FormData();
fdResponseHeader.left = new FormAttachment(middle, 0);
fdResponseHeader.top = new FormAttachment(wResponseTime, margin);
fdResponseHeader.right = new FormAttachment(100, 0);
wResponseHeader.setLayoutData(fdResponseHeader);
FormData fdOutputFields = new FormData();
fdOutputFields.left = new FormAttachment(0, 0);
fdOutputFields.right = new FormAttachment(100, 0);
fdOutputFields.top = new FormAttachment(gSettings, margin);
gOutputFields.setLayoutData(fdOutputFields);
// END Output Fields GROUP
// ////////////////////////
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(wStepname, margin);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// Auth tab...
//
wAuthTab = new CTabItem(wTabFolder, SWT.NONE);
wAuthTab.setText(BaseMessages.getString(PKG, "RestDialog.Auth.Title"));
FormLayout alayout = new FormLayout();
alayout.marginWidth = Const.FORM_MARGIN;
alayout.marginHeight = Const.FORM_MARGIN;
wAuthComp = new Composite(wTabFolder, SWT.NONE);
wAuthComp.setLayout(alayout);
props.setLook(wAuthComp);
// ////////////////////////
// START HTTP AUTH GROUP
Group gHttpAuth = new Group(wAuthComp, SWT.SHADOW_ETCHED_IN);
gHttpAuth.setText(BaseMessages.getString(PKG, "RestDialog.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, "RestDialog.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, "RestDialog.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, "RestDialog.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, "RestDialog.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);
// Preemptive line
wlPreemptive = new Label(gHttpAuth, SWT.RIGHT);
wlPreemptive.setText(BaseMessages.getString(PKG, "RestDialog.Preemptive.Label"));
props.setLook(wlPreemptive);
fdlPreemptive = new FormData();
fdlPreemptive.left = new FormAttachment(0, 0);
fdlPreemptive.top = new FormAttachment(wHttpPassword, margin);
fdlPreemptive.right = new FormAttachment(middle, -margin);
wlPreemptive.setLayoutData(fdlPreemptive);
wPreemptive = new Button(gHttpAuth, SWT.CHECK);
props.setLook(wPreemptive);
fdPreemptive = new FormData();
fdPreemptive.left = new FormAttachment(middle, 0);
fdPreemptive.top = new FormAttachment(wHttpPassword, margin);
fdPreemptive.right = new FormAttachment(100, 0);
wPreemptive.setLayoutData(fdPreemptive);
wPreemptive.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
FormData fdHttpAuth = new FormData();
fdHttpAuth.left = new FormAttachment(0, 0);
fdHttpAuth.right = new FormAttachment(100, 0);
fdHttpAuth.top = new FormAttachment(gOutputFields, margin);
gHttpAuth.setLayoutData(fdHttpAuth);
// END HTTP AUTH GROUP
// ////////////////////////
// ////////////////////////
// START PROXY GROUP
Group gProxy = new Group(wAuthComp, SWT.SHADOW_ETCHED_IN);
gProxy.setText(BaseMessages.getString(PKG, "RestDialog.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, "RestDialog.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, "RestDialog.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, "RestDialog.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, "RestDialog.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
// ////////////////////////
fdAuthComp = new FormData();
fdAuthComp.left = new FormAttachment(0, 0);
fdAuthComp.top = new FormAttachment(wStepname, margin);
fdAuthComp.right = new FormAttachment(100, 0);
fdAuthComp.bottom = new FormAttachment(100, 0);
wAuthComp.setLayoutData(fdAuthComp);
wAuthComp.layout();
wAuthTab.setControl(wAuthComp);
// ////// END of Auth Tab
// SSL tab...
//
wSSLTab = new CTabItem(wTabFolder, SWT.NONE);
wSSLTab.setText(BaseMessages.getString(PKG, "RestDialog.SSL.Title"));
FormLayout ssll = new FormLayout();
ssll.marginWidth = Const.FORM_MARGIN;
ssll.marginHeight = Const.FORM_MARGIN;
wSSLComp = new Composite(wTabFolder, SWT.NONE);
wSSLComp.setLayout(ssll);
props.setLook(wSSLComp);
// ////////////////////////
// START SSLTrustStore GROUP
Group gSSLTrustStore = new Group(wSSLComp, SWT.SHADOW_ETCHED_IN);
gSSLTrustStore.setText(BaseMessages.getString(PKG, "RestDialog.SSLTrustStoreGroup.Label"));
FormLayout SSLTrustStoreLayout = new FormLayout();
SSLTrustStoreLayout.marginWidth = 3;
SSLTrustStoreLayout.marginHeight = 3;
gSSLTrustStore.setLayout(SSLTrustStoreLayout);
props.setLook(gSSLTrustStore);
// TrustStoreFile line
wlTrustStoreFile = new Label(gSSLTrustStore, SWT.RIGHT);
wlTrustStoreFile.setText(BaseMessages.getString(PKG, "RestDialog.TrustStoreFile.Label"));
props.setLook(wlTrustStoreFile);
fdlTrustStoreFile = new FormData();
fdlTrustStoreFile.left = new FormAttachment(0, 0);
fdlTrustStoreFile.top = new FormAttachment(0, margin);
fdlTrustStoreFile.right = new FormAttachment(middle, -margin);
wlTrustStoreFile.setLayoutData(fdlTrustStoreFile);
wbTrustStoreFile = new Button(gSSLTrustStore, SWT.PUSH | SWT.CENTER);
props.setLook(wbTrustStoreFile);
wbTrustStoreFile.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbTrustStoreFile = new FormData();
fdbTrustStoreFile.right = new FormAttachment(100, 0);
fdbTrustStoreFile.top = new FormAttachment(0, 0);
wbTrustStoreFile.setLayoutData(fdbTrustStoreFile);
wbTrustStoreFile.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.SAVE);
dialog.setFilterExtensions(new String[] { "*.*" });
if (wTrustStoreFile.getText() != null) {
dialog.setFileName(transMeta.environmentSubstitute(wTrustStoreFile.getText()));
}
dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "System.FileType.AllFiles") });
if (dialog.open() != null) {
wTrustStoreFile.setText(dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName());
}
}
});
wTrustStoreFile = new TextVar(transMeta, gSSLTrustStore, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTrustStoreFile);
wTrustStoreFile.addModifyListener(lsMod);
fdTrustStoreFile = new FormData();
fdTrustStoreFile.left = new FormAttachment(middle, 0);
fdTrustStoreFile.top = new FormAttachment(0, margin);
fdTrustStoreFile.right = new FormAttachment(wbTrustStoreFile, -margin);
wTrustStoreFile.setLayoutData(fdTrustStoreFile);
// TrustStorePassword line
wlTrustStorePassword = new Label(gSSLTrustStore, SWT.RIGHT);
wlTrustStorePassword.setText(BaseMessages.getString(PKG, "RestDialog.TrustStorePassword.Label"));
props.setLook(wlTrustStorePassword);
fdlTrustStorePassword = new FormData();
fdlTrustStorePassword.left = new FormAttachment(0, 0);
fdlTrustStorePassword.top = new FormAttachment(wbTrustStoreFile, margin);
fdlTrustStorePassword.right = new FormAttachment(middle, -margin);
wlTrustStorePassword.setLayoutData(fdlTrustStorePassword);
wTrustStorePassword = new PasswordTextVar(transMeta, gSSLTrustStore, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTrustStorePassword);
wTrustStorePassword.addModifyListener(lsMod);
fdTrustStorePassword = new FormData();
fdTrustStorePassword.left = new FormAttachment(middle, 0);
fdTrustStorePassword.top = new FormAttachment(wbTrustStoreFile, margin);
fdTrustStorePassword.right = new FormAttachment(100, 0);
wTrustStorePassword.setLayoutData(fdTrustStorePassword);
FormData fdSSLTrustStore = new FormData();
fdSSLTrustStore.left = new FormAttachment(0, 0);
fdSSLTrustStore.right = new FormAttachment(100, 0);
fdSSLTrustStore.top = new FormAttachment(gHttpAuth, margin);
gSSLTrustStore.setLayoutData(fdSSLTrustStore);
// END HTTP AUTH GROUP
// ////////////////////////
fdSSLComp = new FormData();
fdSSLComp.left = new FormAttachment(0, 0);
fdSSLComp.top = new FormAttachment(wStepname, margin);
fdSSLComp.right = new FormAttachment(100, 0);
fdSSLComp.bottom = new FormAttachment(100, 0);
wSSLComp.setLayoutData(fdSSLComp);
wSSLComp.layout();
wSSLTab.setControl(wSSLComp);
// ////// END of SSL Tab
// Additional tab...
//
wAdditionalTab = new CTabItem(wTabFolder, SWT.NONE);
wAdditionalTab.setText(BaseMessages.getString(PKG, "RestDialog.Headers.Title"));
FormLayout addLayout = new FormLayout();
addLayout.marginWidth = Const.FORM_MARGIN;
addLayout.marginHeight = Const.FORM_MARGIN;
wAdditionalComp = new Composite(wTabFolder, SWT.NONE);
wAdditionalComp.setLayout(addLayout);
props.setLook(wAdditionalComp);
wlFields = new Label(wAdditionalComp, SWT.NONE);
wlFields.setText(BaseMessages.getString(PKG, "RestDialog.Headers.Label"));
props.setLook(wlFields);
fdlFields = new FormData();
fdlFields.left = new FormAttachment(0, 0);
fdlFields.top = new FormAttachment(wStepname, margin);
wlFields.setLayoutData(fdlFields);
wGetHeaders = new Button(wAdditionalComp, SWT.PUSH);
wGetHeaders.setText(BaseMessages.getString(PKG, "RestDialog.GetHeaders.Button"));
FormData fdGetHeaders = new FormData();
fdGetHeaders.top = new FormAttachment(wlFields, margin);
fdGetHeaders.right = new FormAttachment(100, 0);
wGetHeaders.setLayoutData(fdGetHeaders);
final int FieldsRows = input.getHeaderName().length;
colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "RestDialog.ColumnInfo.Field"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "RestDialog.ColumnInfo.Name"), ColumnInfo.COLUMN_TYPE_TEXT, false) };
colinf[1].setUsingVariables(true);
wFields = new TableView(transMeta, wAdditionalComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(wlFields, margin);
fdFields.right = new FormAttachment(wGetHeaders, -margin);
fdFields.bottom = new FormAttachment(100, -margin);
wFields.setLayoutData(fdFields);
fdAdditionalComp = new FormData();
fdAdditionalComp.left = new FormAttachment(0, 0);
fdAdditionalComp.top = new FormAttachment(wStepname, margin);
fdAdditionalComp.right = new FormAttachment(100, -margin);
fdAdditionalComp.bottom = new FormAttachment(100, 0);
wAdditionalComp.setLayoutData(fdAdditionalComp);
wAdditionalComp.layout();
wAdditionalTab.setControl(wAdditionalComp);
// ////// END of Additional Tab
// Query Parameters tab...
//
wParametersTab = new CTabItem(wTabFolder, SWT.NONE);
wParametersTab.setText(BaseMessages.getString(PKG, "RestDialog.Parameters.Title"));
FormLayout playout = new FormLayout();
playout.marginWidth = Const.FORM_MARGIN;
playout.marginHeight = Const.FORM_MARGIN;
wParametersComp = new Composite(wTabFolder, SWT.NONE);
wParametersComp.setLayout(playout);
props.setLook(wParametersComp);
wlParameters = new Label(wParametersComp, SWT.NONE);
wlParameters.setText(BaseMessages.getString(PKG, "RestDialog.Parameters.Label"));
props.setLook(wlParameters);
fdlParameters = new FormData();
fdlParameters.left = new FormAttachment(0, 0);
fdlParameters.top = new FormAttachment(wStepname, margin);
wlParameters.setLayoutData(fdlParameters);
wGet = new Button(wParametersComp, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "RestDialog.GetParameters.Button"));
FormData fdGet = new FormData();
fdGet.top = new FormAttachment(wlParameters, margin);
fdGet.right = new FormAttachment(100, 0);
wGet.setLayoutData(fdGet);
final int ParametersRows = input.getParameterField().length;
colinfoparams = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "RestDialog.ColumnInfo.ParameterField"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "RestDialog.ColumnInfo.ParameterName"), ColumnInfo.COLUMN_TYPE_TEXT, false) };
wParameters = new TableView(transMeta, wParametersComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinfoparams, ParametersRows, lsMod, props);
fdParameters = new FormData();
fdParameters.left = new FormAttachment(0, 0);
fdParameters.top = new FormAttachment(wlParameters, margin);
fdParameters.right = new FormAttachment(wGet, -margin);
fdParameters.bottom = new FormAttachment(100, -margin);
wParameters.setLayoutData(fdParameters);
fdParametersComp = new FormData();
fdParametersComp.left = new FormAttachment(0, 0);
fdParametersComp.top = new FormAttachment(wStepname, margin);
fdParametersComp.right = new FormAttachment(100, 0);
fdParametersComp.bottom = new FormAttachment(100, 0);
wParametersComp.setLayoutData(fdParametersComp);
wParametersComp.layout();
wParametersTab.setControl(wParametersComp);
// ////// END of Query Parameters Tab
// Matrix Parameters tab
wMatrixParametersTab = new CTabItem(wTabFolder, SWT.NONE);
wMatrixParametersTab.setText(BaseMessages.getString(PKG, "RestDialog.MatrixParameters.Title"));
FormLayout pl = new FormLayout();
pl.marginWidth = Const.FORM_MARGIN;
pl.marginHeight = Const.FORM_MARGIN;
wMatrixParametersComp = new Composite(wTabFolder, SWT.NONE);
wMatrixParametersComp.setLayout(pl);
props.setLook(wMatrixParametersComp);
wlMatrixParameters = new Label(wMatrixParametersComp, SWT.NONE);
wlMatrixParameters.setText(BaseMessages.getString(PKG, "RestDialog.Parameters.Label"));
props.setLook(wlMatrixParameters);
fdlMatrixParameters = new FormData();
fdlMatrixParameters.left = new FormAttachment(0, 0);
fdlMatrixParameters.top = new FormAttachment(wStepname, margin);
wlMatrixParameters.setLayoutData(fdlMatrixParameters);
wMatrixGet = new Button(wMatrixParametersComp, SWT.PUSH);
wMatrixGet.setText(BaseMessages.getString(PKG, "RestDialog.GetParameters.Button"));
FormData fdMatrixGet = new FormData();
fdMatrixGet.top = new FormAttachment(wlMatrixParameters, margin);
fdMatrixGet.right = new FormAttachment(100, 0);
wMatrixGet.setLayoutData(fdMatrixGet);
int matrixParametersRows = input.getMatrixParameterField().length;
colinfoparams = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "RestDialog.ColumnInfo.ParameterField"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "RestDialog.ColumnInfo.ParameterName"), ColumnInfo.COLUMN_TYPE_TEXT, false) };
wMatrixParameters = new TableView(transMeta, wMatrixParametersComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinfoparams, matrixParametersRows, lsMod, props);
fdMatrixParameters = new FormData();
fdMatrixParameters.left = new FormAttachment(0, 0);
fdMatrixParameters.top = new FormAttachment(wlMatrixParameters, margin);
fdMatrixParameters.right = new FormAttachment(wMatrixGet, -margin);
fdMatrixParameters.bottom = new FormAttachment(100, -margin);
wMatrixParameters.setLayoutData(fdMatrixParameters);
fdMatrixParametersComp = new FormData();
fdMatrixParametersComp.left = new FormAttachment(0, 0);
fdMatrixParametersComp.top = new FormAttachment(wStepname, margin);
fdMatrixParametersComp.right = new FormAttachment(100, 0);
fdMatrixParametersComp.bottom = new FormAttachment(100, 0);
wMatrixParametersComp.setLayoutData(fdMatrixParametersComp);
wMatrixParametersComp.layout();
wMatrixParametersTab.setControl(wMatrixParametersComp);
// END of Matrix Parameters Tab
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);
//
// 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(), Integer.valueOf(i));
}
setComboBoxes();
} catch (KettleException e) {
log.logError(toString(), BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"));
}
}
}
};
new Thread(runnable).start();
// THE BUTTONS
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsGet = new Listener() {
public void handleEvent(Event e) {
getParametersFields(wParameters);
}
};
lsMatrixGet = new Listener() {
public void handleEvent(Event e) {
getParametersFields(wMatrixParameters);
}
};
Listener lsGetHeaders = new Listener() {
public void handleEvent(Event e) {
getHeaders();
}
};
wOK.addListener(SWT.Selection, lsOK);
wGet.addListener(SWT.Selection, lsGet);
wMatrixGet.addListener(SWT.Selection, lsMatrixGet);
wGetHeaders.addListener(SWT.Selection, lsGetHeaders);
wCancel.addListener(SWT.Selection, lsCancel);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wUrl.addSelectionListener(lsDef);
wResult.addSelectionListener(lsDef);
wResultCode.addSelectionListener(lsDef);
wResponseTime.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
lsResize = new Listener() {
public void handleEvent(Event event) {
Point size = shell.getSize();
wFields.setSize(size.x - 10, size.y - 50);
wFields.table.setSize(size.x - 10, size.y - 50);
wFields.redraw();
}
};
shell.addListener(SWT.Resize, lsResize);
// Set the shell size, based upon previous time...
setSize();
wTabFolder.setSelection(0);
getData();
activeUrlInfield();
activeMethodInfield();
setMethod();
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.eclipse.swt.custom.CTabItem in project pentaho-kettle by pentaho.
the class DataGridDialog 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);
lsMod = new ModifyListener() {
@Override
public void modifyText(ModifyEvent 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, "DataGridDialog.DialogTitle"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Filename 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);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// //////////////////////
// START OF META TAB ///
// //////////////////////
wMetaTab = new CTabItem(wTabFolder, SWT.NONE);
wMetaTab.setText(BaseMessages.getString(PKG, "DataGridDialog.Meta.Label"));
wMetaComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wMetaComp);
FormLayout fileLayout = new FormLayout();
fileLayout.marginWidth = 3;
fileLayout.marginHeight = 3;
wMetaComp.setLayout(fileLayout);
final int FieldsRows = input.getFieldName().length;
ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "DataGridDialog.Name.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "DataGridDialog.Type.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames()), new ColumnInfo(BaseMessages.getString(PKG, "DataGridDialog.Format.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, Const.getDateFormats()), new ColumnInfo(BaseMessages.getString(PKG, "DataGridDialog.Length.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "DataGridDialog.Precision.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "DataGridDialog.Currency.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "DataGridDialog.Decimal.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "DataGridDialog.Group.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "DataGridDialog.Value.SetEmptyString"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }) };
wFields = new TableView(transMeta, wMetaComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
FormData fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(0, 0);
fdFields.right = new FormAttachment(100, 0);
fdFields.bottom = new FormAttachment(100, 0);
wFields.setLayoutData(fdFields);
wMetaComp.layout();
wMetaTab.setControl(wMetaComp);
// //////////////////////
// START OF DATA TAB ///
// //////////////////////
wDataTab = new CTabItem(wTabFolder, SWT.NONE);
wDataTab.setText(BaseMessages.getString(PKG, "DataGridDialog.Data.Label"));
wDataComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wDataComp);
FormLayout filesettingLayout = new FormLayout();
filesettingLayout.marginWidth = 3;
filesettingLayout.marginHeight = 3;
wDataComp.setLayout(fileLayout);
addDataGrid(false);
FormData fdDataComp = new FormData();
fdDataComp.left = new FormAttachment(0, 0);
fdDataComp.top = new FormAttachment(0, 0);
fdDataComp.right = new FormAttachment(100, 0);
fdDataComp.bottom = new FormAttachment(100, 0);
wDataComp.setLayoutData(fdDataComp);
wDataComp.layout();
wDataTab.setControl(wDataComp);
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);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wPreview = new Button(shell, SWT.PUSH);
wPreview.setText(BaseMessages.getString(PKG, "System.Button.Preview"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wPreview, wCancel }, margin, wTabFolder);
// Add listeners
lsOK = new Listener() {
@Override
public void handleEvent(Event e) {
ok();
}
};
lsPreview = new Listener() {
@Override
public void handleEvent(Event e) {
preview();
}
};
lsCancel = new Listener() {
@Override
public void handleEvent(Event e) {
cancel();
}
};
wOK.addListener(SWT.Selection, lsOK);
wPreview.addListener(SWT.Selection, lsPreview);
wCancel.addListener(SWT.Selection, lsCancel);
lsDef = new SelectionAdapter() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
@Override
public void shellClosed(ShellEvent e) {
cancel();
}
});
lsResize = new Listener() {
@Override
public void handleEvent(Event event) {
Point size = shell.getSize();
wFields.setSize(size.x - 10, size.y - 50);
wFields.table.setSize(size.x - 10, size.y - 50);
wFields.redraw();
}
};
shell.addListener(SWT.Resize, lsResize);
getData();
wTabFolder.setSelection(0);
wTabFolder.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
addDataGrid(true);
}
});
// Set the shell size, based upon previous time...
setSize();
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
Aggregations