Search in sources :

Example 46 with ColumnInfo

use of org.pentaho.di.ui.core.widget.ColumnInfo in project pentaho-kettle by pentaho.

the class MailInputDialog method open.

public String open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
    props.setLook(shell);
    setShellImage(shell, input);
    ModifyListener lsMod = new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            closeMailConnection();
            input.setChanged();
        }
    };
    SelectionListener lsSelection = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
            closeMailConnection();
        }
    };
    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, "MailInputdialog.Shell.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Stepname line
    wlStepname = new Label(shell, SWT.RIGHT);
    wlStepname.setText(BaseMessages.getString(PKG, "MailInputdialog.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, Props.WIDGET_STYLE_TAB);
    // ////////////////////////
    // START OF GENERAL TAB ///
    // ////////////////////////
    wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
    wGeneralTab.setText(BaseMessages.getString(PKG, "MailInput.Tab.General.Label"));
    wGeneralComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wGeneralComp);
    FormLayout generalLayout = new FormLayout();
    generalLayout.marginWidth = 3;
    generalLayout.marginHeight = 3;
    wGeneralComp.setLayout(generalLayout);
    // ////////////////////////
    // START OF SERVER SETTINGS GROUP///
    // /
    wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wServerSettings);
    wServerSettings.setText(BaseMessages.getString(PKG, "MailInput.ServerSettings.Group.Label"));
    FormLayout ServerSettingsgroupLayout = new FormLayout();
    ServerSettingsgroupLayout.marginWidth = 10;
    ServerSettingsgroupLayout.marginHeight = 10;
    wServerSettings.setLayout(ServerSettingsgroupLayout);
    // ServerName line
    wlServerName = new Label(wServerSettings, SWT.RIGHT);
    wlServerName.setText(BaseMessages.getString(PKG, "MailInput.Server.Label"));
    props.setLook(wlServerName);
    fdlServerName = new FormData();
    fdlServerName.left = new FormAttachment(0, 0);
    fdlServerName.top = new FormAttachment(0, 2 * margin);
    fdlServerName.right = new FormAttachment(middle, -margin);
    wlServerName.setLayoutData(fdlServerName);
    wServerName = new TextVar(transMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wServerName);
    wServerName.addModifyListener(lsMod);
    fdServerName = new FormData();
    fdServerName.left = new FormAttachment(middle, 0);
    fdServerName.top = new FormAttachment(0, 2 * margin);
    fdServerName.right = new FormAttachment(100, 0);
    wServerName.setLayoutData(fdServerName);
    // USE connection with SSL
    wlUseSSL = new Label(wServerSettings, SWT.RIGHT);
    wlUseSSL.setText(BaseMessages.getString(PKG, "MailInput.UseSSLMails.Label"));
    props.setLook(wlUseSSL);
    fdlUseSSL = new FormData();
    fdlUseSSL.left = new FormAttachment(0, 0);
    fdlUseSSL.top = new FormAttachment(wServerName, margin);
    fdlUseSSL.right = new FormAttachment(middle, -margin);
    wlUseSSL.setLayoutData(fdlUseSSL);
    wUseSSL = new Button(wServerSettings, SWT.CHECK);
    props.setLook(wUseSSL);
    fdUseSSL = new FormData();
    wUseSSL.setToolTipText(BaseMessages.getString(PKG, "MailInput.UseSSLMails.Tooltip"));
    fdUseSSL.left = new FormAttachment(middle, 0);
    fdUseSSL.top = new FormAttachment(wServerName, margin);
    fdUseSSL.right = new FormAttachment(100, 0);
    wUseSSL.setLayoutData(fdUseSSL);
    wUseSSL.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            closeMailConnection();
            refreshPort(true);
        }
    });
    // port
    wlPort = new Label(wServerSettings, SWT.RIGHT);
    wlPort.setText(BaseMessages.getString(PKG, "MailInput.SSLPort.Label"));
    props.setLook(wlPort);
    fdlPort = new FormData();
    fdlPort.left = new FormAttachment(0, 0);
    fdlPort.top = new FormAttachment(wUseSSL, margin);
    fdlPort.right = new FormAttachment(middle, -margin);
    wlPort.setLayoutData(fdlPort);
    wPort = new TextVar(transMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wPort);
    wPort.setToolTipText(BaseMessages.getString(PKG, "MailInput.SSLPort.Tooltip"));
    wPort.addModifyListener(lsMod);
    fdPort = new FormData();
    fdPort.left = new FormAttachment(middle, 0);
    fdPort.top = new FormAttachment(wUseSSL, margin);
    fdPort.right = new FormAttachment(100, 0);
    wPort.setLayoutData(fdPort);
    // UserName line
    wlUserName = new Label(wServerSettings, SWT.RIGHT);
    wlUserName.setText(BaseMessages.getString(PKG, "MailInput.Username.Label"));
    props.setLook(wlUserName);
    fdlUserName = new FormData();
    fdlUserName.left = new FormAttachment(0, 0);
    fdlUserName.top = new FormAttachment(wPort, margin);
    fdlUserName.right = new FormAttachment(middle, -margin);
    wlUserName.setLayoutData(fdlUserName);
    wUserName = new TextVar(transMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wUserName);
    wUserName.setToolTipText(BaseMessages.getString(PKG, "MailInput.Username.Tooltip"));
    wUserName.addModifyListener(lsMod);
    fdUserName = new FormData();
    fdUserName.left = new FormAttachment(middle, 0);
    fdUserName.top = new FormAttachment(wPort, margin);
    fdUserName.right = new FormAttachment(100, 0);
    wUserName.setLayoutData(fdUserName);
    // Password line
    wlPassword = new Label(wServerSettings, SWT.RIGHT);
    wlPassword.setText(BaseMessages.getString(PKG, "MailInput.Password.Label"));
    props.setLook(wlPassword);
    fdlPassword = new FormData();
    fdlPassword.left = new FormAttachment(0, 0);
    fdlPassword.top = new FormAttachment(wUserName, margin);
    fdlPassword.right = new FormAttachment(middle, -margin);
    wlPassword.setLayoutData(fdlPassword);
    wPassword = new PasswordTextVar(transMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wPassword);
    wPassword.addModifyListener(lsMod);
    fdPassword = new FormData();
    fdPassword.left = new FormAttachment(middle, 0);
    fdPassword.top = new FormAttachment(wUserName, margin);
    fdPassword.right = new FormAttachment(100, 0);
    wPassword.setLayoutData(fdPassword);
    // USE proxy
    wlUseProxy = new Label(wServerSettings, SWT.RIGHT);
    wlUseProxy.setText(BaseMessages.getString(PKG, "MailInput.UseProxyMails.Label"));
    props.setLook(wlUseProxy);
    fdlUseProxy = new FormData();
    fdlUseProxy.left = new FormAttachment(0, 0);
    fdlUseProxy.top = new FormAttachment(wPassword, 2 * margin);
    fdlUseProxy.right = new FormAttachment(middle, -margin);
    wlUseProxy.setLayoutData(fdlUseProxy);
    wUseProxy = new Button(wServerSettings, SWT.CHECK);
    props.setLook(wUseProxy);
    fdUseProxy = new FormData();
    wUseProxy.setToolTipText(BaseMessages.getString(PKG, "MailInput.UseProxyMails.Tooltip"));
    fdUseProxy.left = new FormAttachment(middle, 0);
    fdUseProxy.top = new FormAttachment(wPassword, 2 * margin);
    fdUseProxy.right = new FormAttachment(100, 0);
    wUseProxy.setLayoutData(fdUseProxy);
    wUseProxy.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            setUserProxy();
            input.setChanged();
        }
    });
    // ProxyUsername line
    wlProxyUsername = new Label(wServerSettings, SWT.RIGHT);
    wlProxyUsername.setText(BaseMessages.getString(PKG, "MailInput.ProxyUsername.Label"));
    wProxyUsername = new TextVar(transMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wProxyUsername.setToolTipText(BaseMessages.getString(PKG, "MailInput.ProxyUsername.Tooltip"));
    wProxyUsername.addModifyListener(lsMod);
    addLabelInputPairBelow(wlProxyUsername, wProxyUsername, wUseProxy);
    // Use Batch label/checkbox
    Label wlUseBatch = new Label(wServerSettings, SWT.RIGHT);
    wlUseBatch.setText(BaseMessages.getString(PKG, "MailInputDialog.UseBatch.Label"));
    wUseBatch = new Button(wServerSettings, SWT.CHECK);
    wUseBatch.setToolTipText(BaseMessages.getString(PKG, "MailInputDialog.UseBatch.Tooltip"));
    wUseBatch.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            setBatchSettingsEnabled();
        }
    });
    addLabelInputPairBelow(wlUseBatch, wUseBatch, wProxyUsername);
    // ignore field errors
    wlIgnoreFieldErrors = new Label(wServerSettings, SWT.RIGHT);
    wlIgnoreFieldErrors.setText(BaseMessages.getString(PKG, "MailInput.IgnoreFieldErrors.Label"));
    wIgnoreFieldErrors = new Button(wServerSettings, SWT.CHECK);
    wIgnoreFieldErrors.setToolTipText(BaseMessages.getString(PKG, "MailInput.IgnoreFieldErrors.Tooltip"));
    addLabelInputPairBelow(wlIgnoreFieldErrors, wIgnoreFieldErrors, wUseBatch);
    // Protocol
    wlProtocol = new Label(wServerSettings, SWT.RIGHT);
    wlProtocol.setText(BaseMessages.getString(PKG, "MailInput.Protocol.Label"));
    wProtocol = new CCombo(wServerSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wProtocol.setItems(MailConnectionMeta.protocolCodes);
    wProtocol.select(0);
    wProtocol.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            refreshProtocol(true);
        }
    });
    addLabelInputPairBelow(wlProtocol, wProtocol, wIgnoreFieldErrors);
    // Test connection button
    wTest = new Button(wServerSettings, SWT.PUSH);
    wTest.setText(BaseMessages.getString(PKG, "MailInput.TestConnection.Label"));
    props.setLook(wTest);
    fdTest = new FormData();
    wTest.setToolTipText(BaseMessages.getString(PKG, "MailInput.TestConnection.Tooltip"));
    fdTest.top = new FormAttachment(wProtocol, margin);
    fdTest.right = new FormAttachment(100, 0);
    wTest.setLayoutData(fdTest);
    fdServerSettings = new FormData();
    fdServerSettings.left = new FormAttachment(0, margin);
    fdServerSettings.top = new FormAttachment(wProtocol, margin);
    fdServerSettings.right = new FormAttachment(100, -margin);
    wServerSettings.setLayoutData(fdServerSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF SERVER SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    fdGeneralComp = new FormData();
    fdGeneralComp.left = new FormAttachment(0, 0);
    fdGeneralComp.top = new FormAttachment(wStepname, 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 SETTINGS TAB ///
    // ////////////////////////
    wSettingsTab = new CTabItem(wTabFolder, SWT.NONE);
    wSettingsTab.setText(BaseMessages.getString(PKG, "MailInput.Tab.Pop.Label"));
    wSettingsComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wSettingsComp);
    FormLayout PopLayout = new FormLayout();
    PopLayout.marginWidth = 3;
    PopLayout.marginHeight = 3;
    wSettingsComp.setLayout(PopLayout);
    // Message: for POP3, only INBOX folder is available!
    wlPOP3Message = new Label(wSettingsComp, SWT.RIGHT);
    wlPOP3Message.setText(BaseMessages.getString(PKG, "MailInput.POP3Message.Label"));
    props.setLook(wlPOP3Message);
    fdlPOP3Message = new FormData();
    fdlPOP3Message.left = new FormAttachment(0, margin);
    fdlPOP3Message.top = new FormAttachment(0, 3 * margin);
    wlPOP3Message.setLayoutData(fdlPOP3Message);
    wlPOP3Message.setForeground(GUIResource.getInstance().getColorOrange());
    // ////////////////////////
    // START OF POP3 Settings GROUP///
    // /
    wPOP3Settings = new Group(wSettingsComp, SWT.SHADOW_NONE);
    props.setLook(wPOP3Settings);
    wPOP3Settings.setText(BaseMessages.getString(PKG, "MailInput.POP3Settings.Group.Label"));
    FormLayout POP3SettingsgroupLayout = new FormLayout();
    POP3SettingsgroupLayout.marginWidth = 10;
    POP3SettingsgroupLayout.marginHeight = 10;
    wPOP3Settings.setLayout(POP3SettingsgroupLayout);
    // List of mails of retrieve
    wlListmails = new Label(wPOP3Settings, SWT.RIGHT);
    wlListmails.setText(BaseMessages.getString(PKG, "MailInput.Listmails.Label"));
    props.setLook(wlListmails);
    fdlListmails = new FormData();
    fdlListmails.left = new FormAttachment(0, 0);
    fdlListmails.right = new FormAttachment(middle, 0);
    fdlListmails.top = new FormAttachment(wlPOP3Message, 2 * margin);
    wlListmails.setLayoutData(fdlListmails);
    wListmails = new CCombo(wPOP3Settings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wListmails.add(BaseMessages.getString(PKG, "MailInput.RetrieveAllMails.Label"));
    // [PDI-7241] pop3 does not support retrive unread option
    // wListmails.add( BaseMessages.getString( PKG, "MailInput.RetrieveUnreadMails.Label" ) );
    wListmails.add(BaseMessages.getString(PKG, "MailInput.RetrieveFirstMails.Label"));
    // +1: starts at -1
    wListmails.select(0);
    props.setLook(wListmails);
    fdListmails = new FormData();
    fdListmails.left = new FormAttachment(middle, 0);
    fdListmails.top = new FormAttachment(wlPOP3Message, 2 * margin);
    fdListmails.right = new FormAttachment(100, 0);
    wListmails.setLayoutData(fdListmails);
    wListmails.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
            chooseListMails();
        }
    });
    // Retrieve the first ... mails
    wlFirstmails = new Label(wPOP3Settings, SWT.RIGHT);
    wlFirstmails.setText(BaseMessages.getString(PKG, "MailInput.Firstmails.Label"));
    props.setLook(wlFirstmails);
    fdlFirstmails = new FormData();
    fdlFirstmails.left = new FormAttachment(0, 0);
    fdlFirstmails.right = new FormAttachment(middle, -margin);
    fdlFirstmails.top = new FormAttachment(wListmails, margin);
    wlFirstmails.setLayoutData(fdlFirstmails);
    wFirstmails = new TextVar(transMeta, wPOP3Settings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFirstmails);
    wFirstmails.addModifyListener(lsMod);
    fdFirstmails = new FormData();
    fdFirstmails.left = new FormAttachment(middle, 0);
    fdFirstmails.top = new FormAttachment(wListmails, margin);
    fdFirstmails.right = new FormAttachment(100, 0);
    wFirstmails.setLayoutData(fdFirstmails);
    fdPOP3Settings = new FormData();
    fdPOP3Settings.left = new FormAttachment(0, margin);
    fdPOP3Settings.top = new FormAttachment(wlPOP3Message, 2 * margin);
    fdPOP3Settings.right = new FormAttachment(100, -margin);
    wPOP3Settings.setLayoutData(fdPOP3Settings);
    // ///////////////////////////////////////////////////////////
    // / END OF POP3 SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF IMAP Settings GROUP///
    // /
    wIMAPSettings = new Group(wSettingsComp, SWT.SHADOW_NONE);
    props.setLook(wIMAPSettings);
    wIMAPSettings.setText(BaseMessages.getString(PKG, "MailInput.IMAPSettings.Groupp.Label"));
    FormLayout IMAPSettingsgroupLayout = new FormLayout();
    IMAPSettingsgroupLayout.marginWidth = 10;
    IMAPSettingsgroupLayout.marginHeight = 10;
    wIMAPSettings.setLayout(IMAPSettingsgroupLayout);
    // Is folder name defined in a Field
    wldynamicFolder = new Label(wIMAPSettings, SWT.RIGHT);
    wldynamicFolder.setText(BaseMessages.getString(PKG, "MailInput.dynamicFolder.Label"));
    props.setLook(wldynamicFolder);
    fdldynamicFolder = new FormData();
    fdldynamicFolder.left = new FormAttachment(0, 0);
    fdldynamicFolder.top = new FormAttachment(0, margin);
    fdldynamicFolder.right = new FormAttachment(middle, -margin);
    wldynamicFolder.setLayoutData(fdldynamicFolder);
    wdynamicFolder = new Button(wIMAPSettings, SWT.CHECK);
    props.setLook(wdynamicFolder);
    wdynamicFolder.setToolTipText(BaseMessages.getString(PKG, "MailInput.dynamicFolder.Tooltip"));
    fddynamicFolder = new FormData();
    fddynamicFolder.left = new FormAttachment(middle, 0);
    fddynamicFolder.top = new FormAttachment(0, margin);
    wdynamicFolder.setLayoutData(fddynamicFolder);
    SelectionAdapter lsxmlstream = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            activedynamicFolder();
            input.setChanged();
        }
    };
    wdynamicFolder.addSelectionListener(lsxmlstream);
    // Folder field
    wlFolderField = new Label(wIMAPSettings, SWT.RIGHT);
    wlFolderField.setText(BaseMessages.getString(PKG, "MailInput.wlFolderField.Label"));
    props.setLook(wlFolderField);
    fdlFolderField = new FormData();
    fdlFolderField.left = new FormAttachment(0, 0);
    fdlFolderField.top = new FormAttachment(wdynamicFolder, margin);
    fdlFolderField.right = new FormAttachment(middle, -margin);
    wlFolderField.setLayoutData(fdlFolderField);
    wFolderField = new CCombo(wIMAPSettings, SWT.BORDER | SWT.READ_ONLY);
    wFolderField.setEditable(true);
    props.setLook(wFolderField);
    wFolderField.addModifyListener(lsMod);
    fdFolderField = new FormData();
    fdFolderField.left = new FormAttachment(middle, 0);
    fdFolderField.top = new FormAttachment(wdynamicFolder, margin);
    fdFolderField.right = new FormAttachment(100, -margin);
    wFolderField.setLayoutData(fdFolderField);
    wFolderField.addFocusListener(new FocusListener() {

        public void focusLost(org.eclipse.swt.events.FocusEvent e) {
        }

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            setFolderField();
        }
    });
    // SelectFolder button
    wSelectFolder = new Button(wIMAPSettings, SWT.PUSH);
    wSelectFolder.setImage(GUIResource.getInstance().getImageBol());
    wSelectFolder.setToolTipText(BaseMessages.getString(PKG, "MailInput.SelectFolderConnection.Label"));
    props.setLook(wSelectFolder);
    fdSelectFolder = new FormData();
    wSelectFolder.setToolTipText(BaseMessages.getString(PKG, "MailInput.SelectFolderConnection.Tooltip"));
    fdSelectFolder.top = new FormAttachment(wFolderField, margin);
    fdSelectFolder.right = new FormAttachment(100, 0);
    wSelectFolder.setLayoutData(fdSelectFolder);
    // TestIMAPFolder button
    wTestIMAPFolder = new Button(wIMAPSettings, SWT.PUSH);
    wTestIMAPFolder.setText(BaseMessages.getString(PKG, "MailInput.TestIMAPFolderConnection.Label"));
    props.setLook(wTestIMAPFolder);
    fdTestIMAPFolder = new FormData();
    wTestIMAPFolder.setToolTipText(BaseMessages.getString(PKG, "MailInput.TestIMAPFolderConnection.Tooltip"));
    fdTestIMAPFolder.top = new FormAttachment(wFolderField, margin);
    fdTestIMAPFolder.right = new FormAttachment(wSelectFolder, -margin);
    wTestIMAPFolder.setLayoutData(fdTestIMAPFolder);
    // IMAPFolder line
    wlIMAPFolder = new Label(wIMAPSettings, SWT.RIGHT);
    wlIMAPFolder.setText(BaseMessages.getString(PKG, "MailInput.IMAPFolder.Label"));
    props.setLook(wlIMAPFolder);
    fdlIMAPFolder = new FormData();
    fdlIMAPFolder.left = new FormAttachment(0, 0);
    fdlIMAPFolder.top = new FormAttachment(wFolderField, margin);
    fdlIMAPFolder.right = new FormAttachment(middle, -margin);
    wlIMAPFolder.setLayoutData(fdlIMAPFolder);
    wIMAPFolder = new TextVar(transMeta, wIMAPSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wIMAPFolder);
    wIMAPFolder.setToolTipText(BaseMessages.getString(PKG, "MailInput.IMAPFolder.Tooltip"));
    wIMAPFolder.addModifyListener(lsMod);
    fdIMAPFolder = new FormData();
    fdIMAPFolder.left = new FormAttachment(middle, 0);
    fdIMAPFolder.top = new FormAttachment(wFolderField, margin);
    fdIMAPFolder.right = new FormAttachment(wTestIMAPFolder, -margin);
    wIMAPFolder.setLayoutData(fdIMAPFolder);
    // Include subfolders?
    wlIncludeSubFolders = new Label(wIMAPSettings, SWT.RIGHT);
    wlIncludeSubFolders.setText(BaseMessages.getString(PKG, "MailInput.IncludeSubFoldersMails.Label"));
    props.setLook(wlIncludeSubFolders);
    fdlIncludeSubFolders = new FormData();
    fdlIncludeSubFolders.left = new FormAttachment(0, 0);
    fdlIncludeSubFolders.top = new FormAttachment(wIMAPFolder, margin);
    fdlIncludeSubFolders.right = new FormAttachment(middle, -margin);
    wlIncludeSubFolders.setLayoutData(fdlIncludeSubFolders);
    wIncludeSubFolders = new Button(wIMAPSettings, SWT.CHECK);
    props.setLook(wIncludeSubFolders);
    fdIncludeSubFolders = new FormData();
    wIncludeSubFolders.setToolTipText(BaseMessages.getString(PKG, "MailInput.IncludeSubFoldersMails.Tooltip"));
    fdIncludeSubFolders.left = new FormAttachment(middle, 0);
    fdIncludeSubFolders.top = new FormAttachment(wIMAPFolder, margin);
    fdIncludeSubFolders.right = new FormAttachment(100, 0);
    wIncludeSubFolders.setLayoutData(fdIncludeSubFolders);
    wIncludeSubFolders.addSelectionListener(lsSelection);
    // List of mails of retrieve
    wlIMAPListmails = new Label(wIMAPSettings, SWT.RIGHT);
    wlIMAPListmails.setText(BaseMessages.getString(PKG, "MailInput.IMAPListmails.Label"));
    props.setLook(wlIMAPListmails);
    fdlIMAPListmails = new FormData();
    fdlIMAPListmails.left = new FormAttachment(0, 0);
    fdlIMAPListmails.right = new FormAttachment(middle, -margin);
    fdlIMAPListmails.top = new FormAttachment(wIncludeSubFolders, margin);
    wlIMAPListmails.setLayoutData(fdlIMAPListmails);
    wIMAPListmails = new CCombo(wIMAPSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wIMAPListmails.setItems(MailConnectionMeta.valueIMAPListDesc);
    // +1: starts at -1
    wIMAPListmails.select(0);
    props.setLook(wIMAPListmails);
    fdIMAPListmails = new FormData();
    fdIMAPListmails.left = new FormAttachment(middle, 0);
    fdIMAPListmails.top = new FormAttachment(wIncludeSubFolders, margin);
    fdIMAPListmails.right = new FormAttachment(100, 0);
    wIMAPListmails.setLayoutData(fdIMAPListmails);
    wIMAPListmails.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
        // ChooseIMAPListmails();
        }
    });
    // Retrieve the first ... mails
    wlIMAPFirstmails = new Label(wIMAPSettings, SWT.RIGHT);
    wlIMAPFirstmails.setText(BaseMessages.getString(PKG, "MailInput.IMAPFirstmails.Label"));
    props.setLook(wlIMAPFirstmails);
    fdlIMAPFirstmails = new FormData();
    fdlIMAPFirstmails.left = new FormAttachment(0, 0);
    fdlIMAPFirstmails.right = new FormAttachment(middle, -margin);
    fdlIMAPFirstmails.top = new FormAttachment(wIMAPListmails, margin);
    wlIMAPFirstmails.setLayoutData(fdlIMAPFirstmails);
    wIMAPFirstmails = new TextVar(transMeta, wIMAPSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wIMAPFirstmails);
    wIMAPFirstmails.addModifyListener(lsMod);
    fdIMAPFirstmails = new FormData();
    fdIMAPFirstmails.left = new FormAttachment(middle, 0);
    fdIMAPFirstmails.top = new FormAttachment(wIMAPListmails, margin);
    fdIMAPFirstmails.right = new FormAttachment(100, 0);
    wIMAPFirstmails.setLayoutData(fdIMAPFirstmails);
    fdIMAPSettings = new FormData();
    fdIMAPSettings.left = new FormAttachment(0, margin);
    fdIMAPSettings.top = new FormAttachment(wPOP3Settings, 2 * margin);
    fdIMAPSettings.right = new FormAttachment(100, -margin);
    wIMAPSettings.setLayoutData(fdIMAPSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF IMAP SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////////////
    // START OF Batch Settings GROUP///
    // 
    wBatchSettingsGroup = createGroup(wSettingsComp, wIMAPSettings, BaseMessages.getString(PKG, "MailInputDialog.BatchSettingsGroup.Label"));
    // Batch size
    Label wlBatchSize = new Label(wBatchSettingsGroup, SWT.RIGHT);
    wlBatchSize.setText(BaseMessages.getString(PKG, "MailInputDialog.BatchSize.Label"));
    wBatchSize = new Text(wBatchSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    addLabelInputPairBelow(wlBatchSize, wBatchSize, wBatchSettingsGroup);
    // Starting message
    Label wlStartMessage = new Label(wBatchSettingsGroup, SWT.RIGHT);
    wlStartMessage.setText(BaseMessages.getString(PKG, "MailInputDialog.StartMessage.Label"));
    wStartMessage = new TextVar(transMeta, wBatchSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    addLabelInputPairBelow(wlStartMessage, wStartMessage, wBatchSize);
    // Last message
    Label wlEndMessage = new Label(wBatchSettingsGroup, SWT.RIGHT);
    wlEndMessage.setText(BaseMessages.getString(PKG, "MailInputDialog.EndMessage.Label"));
    wEndMessage = new TextVar(transMeta, wBatchSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    addLabelInputPairBelow(wlEndMessage, wEndMessage, wStartMessage);
    // 
    // / END OF Batch Settings GROUP
    // ///////////////////////////////
    fdSettingsComp = new FormData();
    fdSettingsComp.left = new FormAttachment(0, 0);
    fdSettingsComp.top = new FormAttachment(wStepname, 0);
    fdSettingsComp.right = new FormAttachment(100, 0);
    fdSettingsComp.bottom = new FormAttachment(100, 0);
    wSettingsComp.setLayoutData(fdSettingsComp);
    wSettingsComp.layout();
    wSettingsTab.setControl(wSettingsComp);
    props.setLook(wSettingsComp);
    // ///////////////////////////////////////////////////////////
    // / END OF Pop TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF SEARCH TAB ///
    // ////////////////////////
    wSearchTab = new CTabItem(wTabFolder, SWT.NONE);
    wSearchTab.setText(BaseMessages.getString(PKG, "MailInput.Tab.Search.Label"));
    wSearchComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wSearchComp);
    FormLayout searchLayout = new FormLayout();
    searchLayout.marginWidth = 3;
    searchLayout.marginHeight = 3;
    wSearchComp.setLayout(searchLayout);
    // ////////////////////////
    // START OF HEADER ROUP///
    // /
    wHeader = new Group(wSearchComp, SWT.SHADOW_NONE);
    props.setLook(wHeader);
    wHeader.setText(BaseMessages.getString(PKG, "MailInput.Header.Group.Label"));
    FormLayout HeadergroupLayout = new FormLayout();
    HeadergroupLayout.marginWidth = 10;
    HeadergroupLayout.marginHeight = 10;
    wHeader.setLayout(HeadergroupLayout);
    wNegateSender = new Button(wHeader, SWT.CHECK);
    props.setLook(wNegateSender);
    fdNegateSender = new FormData();
    wNegateSender.setToolTipText(BaseMessages.getString(PKG, "MailInput.NegateSender.Tooltip"));
    fdNegateSender.top = new FormAttachment(0, margin);
    fdNegateSender.right = new FormAttachment(100, -margin);
    wNegateSender.setLayoutData(fdNegateSender);
    // From line
    wlSender = new Label(wHeader, SWT.RIGHT);
    wlSender.setText(BaseMessages.getString(PKG, "MailInput.wSender.Label"));
    props.setLook(wlSender);
    fdlSender = new FormData();
    fdlSender.left = new FormAttachment(0, 0);
    fdlSender.top = new FormAttachment(0, margin);
    fdlSender.right = new FormAttachment(middle, -margin);
    wlSender.setLayoutData(fdlSender);
    wSender = new TextVar(transMeta, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wSender);
    wSender.addModifyListener(lsMod);
    fdSender = new FormData();
    fdSender.left = new FormAttachment(middle, 0);
    fdSender.top = new FormAttachment(0, margin);
    fdSender.right = new FormAttachment(wNegateSender, -margin);
    wSender.setLayoutData(fdSender);
    wNegateReceipient = new Button(wHeader, SWT.CHECK);
    props.setLook(wNegateReceipient);
    fdNegateReceipient = new FormData();
    wNegateReceipient.setToolTipText(BaseMessages.getString(PKG, "MailInput.NegateReceipient.Tooltip"));
    fdNegateReceipient.top = new FormAttachment(wSender, margin);
    fdNegateReceipient.right = new FormAttachment(100, -margin);
    wNegateReceipient.setLayoutData(fdNegateReceipient);
    // Receipient line
    wlReceipient = new Label(wHeader, SWT.RIGHT);
    wlReceipient.setText(BaseMessages.getString(PKG, "MailInput.Receipient.Label"));
    props.setLook(wlReceipient);
    fdlReceipient = new FormData();
    fdlReceipient.left = new FormAttachment(0, 0);
    fdlReceipient.top = new FormAttachment(wSender, margin);
    fdlReceipient.right = new FormAttachment(middle, -margin);
    wlReceipient.setLayoutData(fdlReceipient);
    wReceipient = new TextVar(transMeta, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wReceipient);
    wReceipient.addModifyListener(lsMod);
    fdReceipient = new FormData();
    fdReceipient.left = new FormAttachment(middle, 0);
    fdReceipient.top = new FormAttachment(wSender, margin);
    fdReceipient.right = new FormAttachment(wNegateReceipient, -margin);
    wReceipient.setLayoutData(fdReceipient);
    wNegateSubject = new Button(wHeader, SWT.CHECK);
    props.setLook(wNegateSubject);
    fdNegateSubject = new FormData();
    wNegateSubject.setToolTipText(BaseMessages.getString(PKG, "MailInput.NegateSubject.Tooltip"));
    fdNegateSubject.top = new FormAttachment(wReceipient, margin);
    fdNegateSubject.right = new FormAttachment(100, -margin);
    wNegateSubject.setLayoutData(fdNegateSubject);
    // Subject line
    wlSubject = new Label(wHeader, SWT.RIGHT);
    wlSubject.setText(BaseMessages.getString(PKG, "MailInput.Subject.Label"));
    props.setLook(wlSubject);
    fdlSubject = new FormData();
    fdlSubject.left = new FormAttachment(0, 0);
    fdlSubject.top = new FormAttachment(wReceipient, margin);
    fdlSubject.right = new FormAttachment(middle, -margin);
    wlSubject.setLayoutData(fdlSubject);
    wSubject = new TextVar(transMeta, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wSubject);
    wSubject.addModifyListener(lsMod);
    fdSubject = new FormData();
    fdSubject.left = new FormAttachment(middle, 0);
    fdSubject.top = new FormAttachment(wReceipient, margin);
    fdSubject.right = new FormAttachment(wNegateSubject, -margin);
    wSubject.setLayoutData(fdSubject);
    fdHeader = new FormData();
    fdHeader.left = new FormAttachment(0, margin);
    fdHeader.top = new FormAttachment(wReceipient, 2 * margin);
    fdHeader.right = new FormAttachment(100, -margin);
    wHeader.setLayoutData(fdHeader);
    // ///////////////////////////////////////////////////////////
    // / END OF HEADER GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF RECEIVED DATE ROUP///
    // /
    wReceivedDate = new Group(wSearchComp, SWT.SHADOW_NONE);
    props.setLook(wReceivedDate);
    wReceivedDate.setText(BaseMessages.getString(PKG, "MailInput.ReceivedDate.Group.Label"));
    FormLayout ReceivedDategroupLayout = new FormLayout();
    ReceivedDategroupLayout.marginWidth = 10;
    ReceivedDategroupLayout.marginHeight = 10;
    wReceivedDate.setLayout(ReceivedDategroupLayout);
    wNegateReceivedDate = new Button(wReceivedDate, SWT.CHECK);
    props.setLook(wNegateReceivedDate);
    fdNegateReceivedDate = new FormData();
    wNegateReceivedDate.setToolTipText(BaseMessages.getString(PKG, "MailInput.NegateReceivedDate.Tooltip"));
    fdNegateReceivedDate.top = new FormAttachment(wHeader, margin);
    fdNegateReceivedDate.right = new FormAttachment(100, -margin);
    wNegateReceivedDate.setLayoutData(fdNegateReceivedDate);
    // Received Date Condition
    wlConditionOnReceivedDate = new Label(wReceivedDate, SWT.RIGHT);
    wlConditionOnReceivedDate.setText(BaseMessages.getString(PKG, "MailInput.ConditionOnReceivedDate.Label"));
    props.setLook(wlConditionOnReceivedDate);
    fdlConditionOnReceivedDate = new FormData();
    fdlConditionOnReceivedDate.left = new FormAttachment(0, 0);
    fdlConditionOnReceivedDate.right = new FormAttachment(middle, -margin);
    fdlConditionOnReceivedDate.top = new FormAttachment(wHeader, margin);
    wlConditionOnReceivedDate.setLayoutData(fdlConditionOnReceivedDate);
    wConditionOnReceivedDate = new CCombo(wReceivedDate, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wConditionOnReceivedDate.setItems(MailConnectionMeta.conditionDateDesc);
    // +1: starts at -1
    wConditionOnReceivedDate.select(0);
    props.setLook(wConditionOnReceivedDate);
    fdConditionOnReceivedDate = new FormData();
    fdConditionOnReceivedDate.left = new FormAttachment(middle, 0);
    fdConditionOnReceivedDate.top = new FormAttachment(wHeader, margin);
    fdConditionOnReceivedDate.right = new FormAttachment(wNegateReceivedDate, -margin);
    wConditionOnReceivedDate.setLayoutData(fdConditionOnReceivedDate);
    wConditionOnReceivedDate.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            conditionReceivedDate();
            input.setChanged();
        }
    });
    open = new Button(wReceivedDate, SWT.PUSH);
    open.setImage(GUIResource.getInstance().getImageCalendar());
    open.setToolTipText(BaseMessages.getString(PKG, "MailInput.OpenCalendar"));
    FormData fdlButton = new FormData();
    fdlButton.top = new FormAttachment(wConditionOnReceivedDate, margin);
    fdlButton.right = new FormAttachment(100, 0);
    open.setLayoutData(fdlButton);
    open.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            final Shell dialog = new Shell(shell, SWT.DIALOG_TRIM);
            dialog.setText(BaseMessages.getString(PKG, "MailInput.SelectDate"));
            dialog.setImage(GUIResource.getInstance().getImageSpoon());
            dialog.setLayout(new GridLayout(3, false));
            final DateTime calendar = new DateTime(dialog, SWT.CALENDAR);
            final DateTime time = new DateTime(dialog, SWT.TIME | SWT.TIME);
            new Label(dialog, SWT.NONE);
            new Label(dialog, SWT.NONE);
            Button ok = new Button(dialog, SWT.PUSH);
            ok.setText(BaseMessages.getString(PKG, "System.Button.OK"));
            ok.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
            ok.addSelectionListener(new SelectionAdapter() {

                public void widgetSelected(SelectionEvent e) {
                    Calendar cal = Calendar.getInstance();
                    cal.set(Calendar.YEAR, calendar.getYear());
                    cal.set(Calendar.MONTH, calendar.getMonth());
                    cal.set(Calendar.DAY_OF_MONTH, calendar.getDay());
                    cal.set(Calendar.HOUR_OF_DAY, time.getHours());
                    cal.set(Calendar.MINUTE, time.getMinutes());
                    cal.set(Calendar.SECOND, time.getSeconds());
                    wReadFrom.setText(new SimpleDateFormat(MailInputMeta.DATE_PATTERN).format(cal.getTime()));
                    dialog.close();
                }
            });
            dialog.setDefaultButton(ok);
            dialog.pack();
            dialog.open();
        }
    });
    wlReadFrom = new Label(wReceivedDate, SWT.RIGHT);
    wlReadFrom.setText(BaseMessages.getString(PKG, "MailInput.ReadFrom.Label"));
    props.setLook(wlReadFrom);
    fdlReadFrom = new FormData();
    fdlReadFrom.left = new FormAttachment(0, 0);
    fdlReadFrom.top = new FormAttachment(wConditionOnReceivedDate, margin);
    fdlReadFrom.right = new FormAttachment(middle, -margin);
    wlReadFrom.setLayoutData(fdlReadFrom);
    wReadFrom = new TextVar(transMeta, wReceivedDate, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wReadFrom.setToolTipText(BaseMessages.getString(PKG, "MailInput.ReadFrom.Tooltip"));
    props.setLook(wReadFrom);
    wReadFrom.addModifyListener(lsMod);
    fdReadFrom = new FormData();
    fdReadFrom.left = new FormAttachment(middle, 0);
    fdReadFrom.top = new FormAttachment(wConditionOnReceivedDate, margin);
    fdReadFrom.right = new FormAttachment(open, -margin);
    wReadFrom.setLayoutData(fdReadFrom);
    opento = new Button(wReceivedDate, SWT.PUSH);
    opento.setImage(GUIResource.getInstance().getImageCalendar());
    opento.setToolTipText(BaseMessages.getString(PKG, "MailInput.OpenCalendar"));
    FormData fdlButtonto = new FormData();
    fdlButtonto.top = new FormAttachment(wReadFrom, 2 * margin);
    fdlButtonto.right = new FormAttachment(100, 0);
    opento.setLayoutData(fdlButtonto);
    opento.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            final Shell dialogto = new Shell(shell, SWT.DIALOG_TRIM);
            dialogto.setText(BaseMessages.getString(PKG, "MailInput.SelectDate"));
            dialogto.setImage(GUIResource.getInstance().getImageSpoon());
            dialogto.setLayout(new GridLayout(3, false));
            final DateTime calendarto = new DateTime(dialogto, SWT.CALENDAR | SWT.BORDER);
            final DateTime timeto = new DateTime(dialogto, SWT.TIME | SWT.TIME);
            new Label(dialogto, SWT.NONE);
            new Label(dialogto, SWT.NONE);
            Button okto = new Button(dialogto, SWT.PUSH);
            okto.setText(BaseMessages.getString(PKG, "System.Button.OK"));
            okto.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
            okto.addSelectionListener(new SelectionAdapter() {

                public void widgetSelected(SelectionEvent e) {
                    Calendar cal = Calendar.getInstance();
                    cal.set(Calendar.YEAR, calendarto.getYear());
                    cal.set(Calendar.MONTH, calendarto.getMonth());
                    cal.set(Calendar.DAY_OF_MONTH, calendarto.getDay());
                    cal.set(Calendar.HOUR_OF_DAY, timeto.getHours());
                    cal.set(Calendar.MINUTE, timeto.getMinutes());
                    cal.set(Calendar.SECOND, timeto.getSeconds());
                    wReadTo.setText(new SimpleDateFormat(MailInputMeta.DATE_PATTERN).format(cal.getTime()));
                    dialogto.close();
                }
            });
            dialogto.setDefaultButton(okto);
            dialogto.pack();
            dialogto.open();
        }
    });
    wlReadTo = new Label(wReceivedDate, SWT.RIGHT);
    wlReadTo.setText(BaseMessages.getString(PKG, "MailInput.ReadTo.Label"));
    props.setLook(wlReadTo);
    fdlReadTo = new FormData();
    fdlReadTo.left = new FormAttachment(0, 0);
    fdlReadTo.top = new FormAttachment(wReadFrom, 2 * margin);
    fdlReadTo.right = new FormAttachment(middle, -margin);
    wlReadTo.setLayoutData(fdlReadTo);
    wReadTo = new TextVar(transMeta, wReceivedDate, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wReadTo.setToolTipText(BaseMessages.getString(PKG, "MailInput.ReadTo.Tooltip"));
    props.setLook(wReadTo);
    wReadTo.addModifyListener(lsMod);
    fdReadTo = new FormData();
    fdReadTo.left = new FormAttachment(middle, 0);
    fdReadTo.top = new FormAttachment(wReadFrom, 2 * margin);
    fdReadTo.right = new FormAttachment(opento, -margin);
    wReadTo.setLayoutData(fdReadTo);
    fdReceivedDate = new FormData();
    fdReceivedDate.left = new FormAttachment(0, margin);
    fdReceivedDate.top = new FormAttachment(wHeader, margin);
    fdReceivedDate.right = new FormAttachment(100, -margin);
    wReceivedDate.setLayoutData(fdReceivedDate);
    // ///////////////////////////////////////////////////////////
    // / END OF RECEIVED DATE GROUP
    // ///////////////////////////////////////////////////////////
    wlLimit = new Label(wSearchComp, SWT.RIGHT);
    wlLimit.setText(BaseMessages.getString(PKG, "MailInput.Limit.Label"));
    props.setLook(wlLimit);
    fdlLimit = new FormData();
    fdlLimit.left = new FormAttachment(0, 0);
    fdlLimit.top = new FormAttachment(wReceivedDate, 2 * margin);
    fdlLimit.right = new FormAttachment(middle, -margin);
    wlLimit.setLayoutData(fdlLimit);
    wLimit = new Text(wSearchComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wLimit);
    wLimit.addModifyListener(lsMod);
    fdLimit = new FormData();
    fdLimit.left = new FormAttachment(middle, 0);
    fdLimit.top = new FormAttachment(wReceivedDate, 2 * margin);
    fdLimit.right = new FormAttachment(100, 0);
    wLimit.setLayoutData(fdLimit);
    fdSearchComp = new FormData();
    fdSearchComp.left = new FormAttachment(0, 0);
    fdSearchComp.top = new FormAttachment(wStepname, 0);
    fdSearchComp.right = new FormAttachment(100, 0);
    fdSearchComp.bottom = new FormAttachment(100, 0);
    wSearchComp.setLayoutData(fdSearchComp);
    wSearchComp.layout();
    wSearchTab.setControl(wSearchComp);
    props.setLook(wSearchComp);
    // ////////////////////////////////
    // / END OF SEARCH TAB
    // ////////////////////////////////
    // Fields tab...
    // 
    wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
    wFieldsTab.setText(BaseMessages.getString(PKG, "MailInputdialog.Fields.Tab"));
    FormLayout fieldsLayout = new FormLayout();
    fieldsLayout.marginWidth = Const.FORM_MARGIN;
    fieldsLayout.marginHeight = Const.FORM_MARGIN;
    wFieldsComp = new Composite(wTabFolder, SWT.NONE);
    wFieldsComp.setLayout(fieldsLayout);
    props.setLook(wFieldsComp);
    wGet = new Button(wFieldsComp, SWT.PUSH);
    wGet.setText(BaseMessages.getString(PKG, "MailInputdialog.GetFields.Button"));
    fdGet = new FormData();
    fdGet.left = new FormAttachment(50, 0);
    fdGet.bottom = new FormAttachment(100, 0);
    wGet.setLayoutData(fdGet);
    final int FieldsRows = input.getInputFields().length;
    ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "MailInputdialog.FieldsTable.Name.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "MailInputdialog.FieldsTable.Column.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, MailInputField.ColumnDesc, true) };
    colinf[0].setUsingVariables(true);
    colinf[0].setToolTip(BaseMessages.getString(PKG, "MailInputdialog.FieldsTable.Name.Column.Tooltip"));
    colinf[1].setToolTip(BaseMessages.getString(PKG, "MailInputdialog.FieldsTable.Column.Column.Tooltip"));
    wFields = new TableView(transMeta, wFieldsComp, SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
    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(wGet, -margin);
    wFields.setLayoutData(fdFields);
    fdFieldsComp = new FormData();
    fdFieldsComp.left = new FormAttachment(0, 0);
    fdFieldsComp.top = new FormAttachment(0, 0);
    fdFieldsComp.right = new FormAttachment(100, 0);
    fdFieldsComp.bottom = new FormAttachment(100, 0);
    wFieldsComp.setLayoutData(fdFieldsComp);
    wFieldsComp.layout();
    wFieldsTab.setControl(wFieldsComp);
    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"));
    wCancel = new Button(shell, SWT.PUSH);
    wPreview = new Button(shell, SWT.PUSH);
    wPreview.setText(BaseMessages.getString(PKG, "MailInputDialog.Preview"));
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wPreview, wCancel }, margin, wTabFolder);
    lsGet = new Listener() {

        public void handleEvent(Event e) {
            getFields();
        }
    };
    // Add listeners
    lsCancel = new Listener() {

        public void handleEvent(Event e) {
            cancel();
        }
    };
    lsOK = new Listener() {

        public void handleEvent(Event e) {
            ok();
        }
    };
    lsPreview = new Listener() {

        public void handleEvent(Event e) {
            preview();
        }
    };
    wCancel.addListener(SWT.Selection, lsCancel);
    wOK.addListener(SWT.Selection, lsOK);
    lsDef = new SelectionAdapter() {

        public void widgetDefaultSelected(SelectionEvent e) {
            ok();
        }
    };
    lsTest = new Listener() {

        public void handleEvent(Event e) {
            test();
        }
    };
    wTest.addListener(SWT.Selection, lsTest);
    wPreview.addListener(SWT.Selection, lsPreview);
    wGet.addListener(SWT.Selection, lsGet);
    lsTestIMAPFolder = new Listener() {

        public void handleEvent(Event e) {
            checkFolder(transMeta.environmentSubstitute(wIMAPFolder.getText()));
        }
    };
    wTestIMAPFolder.addListener(SWT.Selection, lsTestIMAPFolder);
    lsSelectFolder = new Listener() {

        public void handleEvent(Event e) {
            selectFolder(wIMAPFolder);
        }
    };
    wSelectFolder.addListener(SWT.Selection, lsSelectFolder);
    wStepname.addSelectionListener(lsDef);
    wServerName.addSelectionListener(lsDef);
    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(new ShellAdapter() {

        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    getData();
    setUserProxy();
    chooseListMails();
    refreshProtocol(false);
    conditionReceivedDate();
    wTabFolder.setSelection(0);
    BaseStepDialog.setSize(shell);
    shell.open();
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return stepname;
}
Also used : Group(org.eclipse.swt.widgets.Group) CTabFolder(org.eclipse.swt.custom.CTabFolder) SelectionListener(org.eclipse.swt.events.SelectionListener) FocusListener(org.eclipse.swt.events.FocusListener) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) ShellEvent(org.eclipse.swt.events.ShellEvent) CTabItem(org.eclipse.swt.custom.CTabItem) DateTime(org.eclipse.swt.widgets.DateTime) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableView(org.pentaho.di.ui.core.widget.TableView) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Calendar(java.util.Calendar) Text(org.eclipse.swt.widgets.Text) TextVar(org.pentaho.di.ui.core.widget.TextVar) PasswordTextVar(org.pentaho.di.ui.core.widget.PasswordTextVar) PasswordTextVar(org.pentaho.di.ui.core.widget.PasswordTextVar) CCombo(org.eclipse.swt.custom.CCombo) GridData(org.eclipse.swt.layout.GridData) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Event(org.eclipse.swt.widgets.Event) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FocusListener(org.eclipse.swt.events.FocusListener) SimpleDateFormat(java.text.SimpleDateFormat) Display(org.eclipse.swt.widgets.Display) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 47 with ColumnInfo

use of org.pentaho.di.ui.core.widget.ColumnInfo in project pentaho-kettle by pentaho.

the class MappingDialog method addMappingDefinitionTab.

private void addMappingDefinitionTab(List<MappingIODefinition> definitions, final String tabTitle, String listLabel, String addToolTip, String removeToolTip, String inputStepLabel, String outputStepLabel, String descriptionLabel, String sourceColumnLabel, String targetColumnLabel, String noItemsLabel, final boolean input) {
    final CTabItem wTab = new CTabItem(wTabFolder, SWT.NONE);
    wTab.setText(tabTitle);
    Composite wInputComposite = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wInputComposite);
    FormLayout tabLayout = new FormLayout();
    tabLayout.marginWidth = 15;
    tabLayout.marginHeight = 15;
    wInputComposite.setLayout(tabLayout);
    Label wAvailableInputs = new Label(wInputComposite, SWT.LEFT);
    props.setLook(wAvailableInputs);
    wAvailableInputs.setText(listLabel);
    FormData fdwAvailableInputs = new FormData();
    fdwAvailableInputs.left = new FormAttachment(0);
    fdwAvailableInputs.top = new FormAttachment(0);
    Label wRemoveButton = new Label(wInputComposite, SWT.NONE);
    wRemoveButton.setImage(GUIResource.getInstance().getImage("ui/images/generic-delete.svg"));
    wRemoveButton.setToolTipText(removeToolTip);
    props.setLook(wRemoveButton);
    FormData fdwAddInputButton = new FormData();
    fdwAddInputButton.top = new FormAttachment(0);
    fdwAddInputButton.right = new FormAttachment(30);
    wRemoveButton.setLayoutData(fdwAddInputButton);
    Label wAddButton = new Label(wInputComposite, SWT.NONE);
    wAddButton.setImage(GUIResource.getInstance().getImage("ui/images/Add.svg"));
    wAddButton.setToolTipText(addToolTip);
    props.setLook(wAddButton);
    FormData fdwAddButton = new FormData();
    fdwAddButton.top = new FormAttachment(0);
    fdwAddButton.right = new FormAttachment(wRemoveButton, -5);
    wAddButton.setLayoutData(fdwAddButton);
    org.eclipse.swt.widgets.List wInputList = new org.eclipse.swt.widgets.List(wInputComposite, SWT.BORDER);
    FormData fdwInputList = new FormData();
    fdwInputList.left = new FormAttachment(0);
    fdwInputList.top = new FormAttachment(wAvailableInputs, 5);
    fdwInputList.bottom = new FormAttachment(100);
    fdwInputList.right = new FormAttachment(30);
    wInputList.setLayoutData(fdwInputList);
    for (int i = 0; i < definitions.size(); i++) {
        String label = !Utils.isEmpty(definitions.get(i).getInputStepname()) ? definitions.get(i).getInputStepname() : tabTitle + (i > 0 ? String.valueOf(i + 1) : "");
        wInputList.add(label);
    }
    final Label wlNoItems = new Label(wInputComposite, SWT.CENTER);
    wlNoItems.setText(noItemsLabel);
    props.setLook(wlNoItems);
    FormData fdlNoItems = new FormData();
    fdlNoItems.left = new FormAttachment(wInputList, 30);
    fdlNoItems.right = new FormAttachment(100);
    fdlNoItems.top = new FormAttachment(50);
    wlNoItems.setLayoutData(fdlNoItems);
    wlNoItems.setVisible(false);
    Composite wFieldsComposite = new Composite(wInputComposite, SWT.NONE);
    props.setLook(wFieldsComposite);
    FormLayout fieldLayout = new FormLayout();
    fieldLayout.marginWidth = 0;
    fieldLayout.marginHeight = 0;
    wFieldsComposite.setLayout(fieldLayout);
    final Button wMainPath = new Button(wFieldsComposite, SWT.CHECK);
    wMainPath.setText(BaseMessages.getString(PKG, "MappingDialog.input.MainDataPath"));
    props.setLook(wMainPath);
    FormData fdMainPath = new FormData();
    fdMainPath.top = new FormAttachment(0);
    fdMainPath.left = new FormAttachment(0);
    wMainPath.setLayoutData(fdMainPath);
    wMainPath.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            definitions.get(wInputList.getSelectionIndex()).setMainDataPath(!definitions.get(wInputList.getSelectionIndex()).isMainDataPath());
        }
    });
    final Label wlInputStep = new Label(wFieldsComposite, SWT.RIGHT);
    props.setLook(wlInputStep);
    wlInputStep.setText(inputStepLabel);
    FormData fdlInputStep = new FormData();
    fdlInputStep.top = new FormAttachment(wMainPath, 10);
    fdlInputStep.left = new FormAttachment(0);
    wlInputStep.setLayoutData(fdlInputStep);
    // What's the stepname to read from? (empty is OK too)
    // 
    final Button wbInputStep = new Button(wFieldsComposite, SWT.PUSH);
    props.setLook(wbInputStep);
    wbInputStep.setText(BaseMessages.getString(PKG, "MappingDialog.button.SourceStepName"));
    FormData fdbInputStep = new FormData();
    fdbInputStep.top = new FormAttachment(wlInputStep, 5);
    // First one in the
    fdbInputStep.right = new FormAttachment(100);
    // left top corner
    wbInputStep.setLayoutData(fdbInputStep);
    final Text wInputStep = new Text(wFieldsComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wInputStep);
    wInputStep.addModifyListener(lsMod);
    FormData fdInputStep = new FormData();
    fdInputStep.top = new FormAttachment(wlInputStep, 5);
    // To the right of
    fdInputStep.left = new FormAttachment(0);
    // the label
    fdInputStep.right = new FormAttachment(wbInputStep, -5);
    wInputStep.setLayoutData(fdInputStep);
    wInputStep.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(FocusEvent event) {
            definitions.get(wInputList.getSelectionIndex()).setInputStepname(wInputStep.getText());
            String label = !Utils.isEmpty(wInputStep.getText()) ? wInputStep.getText() : tabTitle + (wInputList.getSelectionIndex() > 0 ? String.valueOf(wInputList.getSelectionIndex() + 1) : "");
            wInputList.setItem(wInputList.getSelectionIndex(), label);
        }
    });
    wbInputStep.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            String stepName = selectTransformationStepname(input, input);
            if (stepName != null) {
                wInputStep.setText(stepName);
                definitions.get(wInputList.getSelectionIndex()).setInputStepname(stepName);
            }
        }
    });
    // What's the step name to read from? (empty is OK too)
    // 
    final Label wlOutputStep = new Label(wFieldsComposite, SWT.RIGHT);
    props.setLook(wlOutputStep);
    wlOutputStep.setText(outputStepLabel);
    FormData fdlOutputStep = new FormData();
    fdlOutputStep.top = new FormAttachment(wInputStep, 10);
    fdlOutputStep.left = new FormAttachment(0);
    wlOutputStep.setLayoutData(fdlOutputStep);
    final Button wbOutputStep = new Button(wFieldsComposite, SWT.PUSH);
    props.setLook(wbOutputStep);
    wbOutputStep.setText(BaseMessages.getString(PKG, "MappingDialog.button.SourceStepName"));
    FormData fdbOutputStep = new FormData();
    fdbOutputStep.top = new FormAttachment(wlOutputStep, 5);
    fdbOutputStep.right = new FormAttachment(100);
    wbOutputStep.setLayoutData(fdbOutputStep);
    final Text wOutputStep = new Text(wFieldsComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wOutputStep);
    wOutputStep.addModifyListener(lsMod);
    FormData fdOutputStep = new FormData();
    fdOutputStep.top = new FormAttachment(wlOutputStep, 5);
    // To the right of
    fdOutputStep.left = new FormAttachment(0);
    // the label
    fdOutputStep.right = new FormAttachment(wbOutputStep, -5);
    wOutputStep.setLayoutData(fdOutputStep);
    // Allow for a small description
    // 
    Label wlDescription = new Label(wFieldsComposite, SWT.RIGHT);
    props.setLook(wlDescription);
    wlDescription.setText(descriptionLabel);
    FormData fdlDescription = new FormData();
    fdlDescription.top = new FormAttachment(wOutputStep, 5);
    // First one in the left
    fdlDescription.left = new FormAttachment(0);
    wlDescription.setLayoutData(fdlDescription);
    final Text wDescription = new Text(wFieldsComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wDescription);
    wDescription.addModifyListener(lsMod);
    FormData fdDescription = new FormData();
    fdDescription.top = new FormAttachment(wlDescription, 5);
    // To the right of
    fdDescription.left = new FormAttachment(0);
    // the label
    fdDescription.right = new FormAttachment(100);
    wDescription.setLayoutData(fdDescription);
    wDescription.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(FocusEvent event) {
            definitions.get(wInputList.getSelectionIndex()).setDescription(wDescription.getText());
        }
    });
    final Button wbEnterMapping = new Button(wFieldsComposite, SWT.PUSH);
    props.setLook(wbEnterMapping);
    wbEnterMapping.setText(BaseMessages.getString(PKG, "MappingDialog.button.EnterMapping"));
    FormData fdbEnterMapping = new FormData();
    fdbEnterMapping.bottom = new FormAttachment(100);
    fdbEnterMapping.right = new FormAttachment(100);
    wbEnterMapping.setLayoutData(fdbEnterMapping);
    wbEnterMapping.setEnabled(input);
    ColumnInfo[] colinfo = new ColumnInfo[] { new ColumnInfo(sourceColumnLabel, ColumnInfo.COLUMN_TYPE_TEXT, false, false), new ColumnInfo(targetColumnLabel, ColumnInfo.COLUMN_TYPE_TEXT, false, false) };
    final TableView wFieldMappings = new TableView(transMeta, wFieldsComposite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, colinfo, 1, false, lsMod, props, false);
    props.setLook(wFieldMappings);
    FormData fdMappings = new FormData();
    fdMappings.top = new FormAttachment(wDescription, 20);
    fdMappings.bottom = new FormAttachment(wbEnterMapping, -5);
    fdMappings.left = new FormAttachment(0);
    fdMappings.right = new FormAttachment(100);
    wFieldMappings.setLayoutData(fdMappings);
    wFieldMappings.getTable().addListener(SWT.Resize, new ColumnsResizer(0, 50, 50));
    wbEnterMapping.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            try {
                RowMetaInterface sourceRowMeta = getFieldsFromStep(wInputStep.getText(), true, input);
                RowMetaInterface targetRowMeta = getFieldsFromStep(wOutputStep.getText(), false, input);
                String[] sourceFields = sourceRowMeta.getFieldNames();
                String[] targetFields = targetRowMeta.getFieldNames();
                EnterMappingDialog dialog = new EnterMappingDialog(shell, sourceFields, targetFields);
                List<SourceToTargetMapping> mappings = dialog.open();
                if (mappings != null) {
                    // first clear the dialog...
                    wFieldMappings.clearAll(false);
                    // 
                    definitions.get(wInputList.getSelectionIndex()).getValueRenames().clear();
                    // Now add the new values...
                    for (SourceToTargetMapping mapping : mappings) {
                        TableItem item = new TableItem(wFieldMappings.table, SWT.NONE);
                        item.setText(1, mapping.getSourceString(sourceFields));
                        item.setText(2, mapping.getTargetString(targetFields));
                        String source = input ? item.getText(1) : item.getText(2);
                        String target = input ? item.getText(2) : item.getText(1);
                        definitions.get(wInputList.getSelectionIndex()).getValueRenames().add(new MappingValueRename(source, target));
                    }
                    wFieldMappings.removeEmptyRows();
                    wFieldMappings.setRowNums();
                    wFieldMappings.optWidth(true);
                }
            } catch (KettleException e) {
                new ErrorDialog(shell, BaseMessages.getString(PKG, "System.Dialog.Error.Title"), BaseMessages.getString(PKG, "MappingDialog.Exception.ErrorGettingMappingSourceAndTargetFields", e.toString()), e);
            }
        }
    });
    wOutputStep.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(FocusEvent event) {
            definitions.get(wInputList.getSelectionIndex()).setOutputStepname(wOutputStep.getText());
            try {
                enableMappingButton(wbEnterMapping, input, wInputStep.getText(), wOutputStep.getText());
            } catch (KettleException e) {
                // Show the missing/wrong step name error
                // 
                new ErrorDialog(shell, "Error", "Unexpected error", e);
            }
        }
    });
    wbOutputStep.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            String stepName = selectTransformationStepname(!input, input);
            if (stepName != null) {
                wOutputStep.setText(stepName);
                definitions.get(wInputList.getSelectionIndex()).setOutputStepname(stepName);
                try {
                    enableMappingButton(wbEnterMapping, input, wInputStep.getText(), wOutputStep.getText());
                } catch (KettleException e) {
                    // Show the missing/wrong stepname error
                    new ErrorDialog(shell, "Error", "Unexpected error", e);
                }
            }
        }
    });
    final Button wRenameOutput;
    if (input) {
        // Add a checkbox to indicate that all output mappings need to rename
        // the values back...
        // 
        wRenameOutput = new Button(wFieldsComposite, SWT.CHECK);
        wRenameOutput.setText(BaseMessages.getString(PKG, "MappingDialog.input.RenamingOnOutput"));
        props.setLook(wRenameOutput);
        FormData fdRenameOutput = new FormData();
        fdRenameOutput.top = new FormAttachment(wFieldMappings, 5);
        fdRenameOutput.left = new FormAttachment(0);
        wRenameOutput.setLayoutData(fdRenameOutput);
        wRenameOutput.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent event) {
                definitions.get(wInputList.getSelectionIndex()).setRenamingOnOutput(!definitions.get(wInputList.getSelectionIndex()).isRenamingOnOutput());
            }
        });
    } else {
        wRenameOutput = null;
    }
    FormData fdInputComposite = new FormData();
    fdInputComposite.left = new FormAttachment(0);
    fdInputComposite.top = new FormAttachment(0);
    fdInputComposite.right = new FormAttachment(100);
    fdInputComposite.bottom = new FormAttachment(100);
    wInputComposite.setLayoutData(fdInputComposite);
    FormData fdFieldsComposite = new FormData();
    fdFieldsComposite.left = new FormAttachment(wInputList, 30);
    fdFieldsComposite.right = new FormAttachment(100);
    fdFieldsComposite.bottom = new FormAttachment(100);
    fdFieldsComposite.top = new FormAttachment(0);
    wFieldsComposite.setLayoutData(fdFieldsComposite);
    wInputComposite.layout();
    wTab.setControl(wInputComposite);
    wMainPath.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            setTabFlags(wMainPath, wlInputStep, wInputStep, wbInputStep, wlOutputStep, wOutputStep, wbOutputStep, wlDescription, wDescription);
        }
    });
    wInputList.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent selectionEvent) {
            updateFields(definitions.get(wInputList.getSelectionIndex()), input, wMainPath, wlInputStep, wInputStep, wbInputStep, wlOutputStep, wOutputStep, wbOutputStep, wlDescription, wDescription, wFieldMappings, wRenameOutput);
        }
    });
    wAddButton.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseUp(MouseEvent mouseEvent) {
            MappingIODefinition definition = new MappingIODefinition();
            definition.setMainDataPath(true);
            definitions.add(definition);
            wInputList.add(tabTitle + (definitions.size() > 1 ? String.valueOf(definitions.size()) : ""));
            wInputList.select(definitions.size() - 1);
            updateFields(definitions.get(wInputList.getSelectionIndex()), input, wMainPath, wlInputStep, wInputStep, wbInputStep, wlOutputStep, wOutputStep, wbOutputStep, wlDescription, wDescription, wFieldMappings, wRenameOutput);
            wlNoItems.setVisible(false);
            wFieldsComposite.setVisible(true);
            wRemoveButton.setEnabled(true);
        }
    });
    wRemoveButton.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseUp(MouseEvent mouseEvent) {
            MessageBox box = new MessageBox(shell, SWT.YES | SWT.NO);
            box.setText(BaseMessages.getString(PKG, "MappingDialog.CloseDefinitionTabAreYouSure.Title"));
            box.setMessage(BaseMessages.getString(PKG, "MappingDialog.CloseDefinitionTabAreYouSure.Message"));
            int answer = box.open();
            if (answer != SWT.YES) {
                return;
            }
            int index = wInputList.getSelectionIndex();
            definitions.remove(index);
            wInputList.removeAll();
            for (int i = 0; i < definitions.size(); i++) {
                String label = !Utils.isEmpty(definitions.get(i).getInputStepname()) ? definitions.get(i).getInputStepname() : tabTitle + (i > 0 ? String.valueOf(i + 1) : "");
                wInputList.add(label);
            }
            if (index > 0) {
                wInputList.select(index - 1);
            } else if (definitions.size() > 0) {
                wInputList.select(index);
            } else {
                index = -1;
            }
            if (index != -1) {
                updateFields(definitions.get(wInputList.getSelectionIndex()), input, wMainPath, wlInputStep, wInputStep, wbInputStep, wlOutputStep, wOutputStep, wbOutputStep, wlDescription, wDescription, wFieldMappings, wRenameOutput);
            }
            if (definitions.size() == 0) {
                wlNoItems.setVisible(true);
                wFieldsComposite.setVisible(false);
                wRemoveButton.setEnabled(false);
            }
        }
    });
    if (definitions.size() > 0) {
        wInputList.select(0);
        updateFields(definitions.get(0), input, wMainPath, wlInputStep, wInputStep, wbInputStep, wlOutputStep, wOutputStep, wbOutputStep, wlDescription, wDescription, wFieldMappings, wRenameOutput);
    } else {
        wlNoItems.setVisible(true);
        wFieldsComposite.setVisible(false);
        wRemoveButton.setEnabled(false);
    }
    setTabFlags(wMainPath, wlInputStep, wInputStep, wbInputStep, wlOutputStep, wOutputStep, wbOutputStep, wlDescription, wDescription);
    wTabFolder.setSelection(wTab);
}
Also used : MappingValueRename(org.pentaho.di.trans.steps.mapping.MappingValueRename) FocusAdapter(org.eclipse.swt.events.FocusAdapter) KettleException(org.pentaho.di.core.exception.KettleException) ColumnsResizer(org.pentaho.di.ui.core.widget.ColumnsResizer) EnterMappingDialog(org.pentaho.di.ui.core.dialog.EnterMappingDialog) MappingIODefinition(org.pentaho.di.trans.steps.mapping.MappingIODefinition) TableItem(org.eclipse.swt.widgets.TableItem) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) CTabItem(org.eclipse.swt.custom.CTabItem) FocusEvent(org.eclipse.swt.events.FocusEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SourceToTargetMapping(org.pentaho.di.core.SourceToTargetMapping) List(java.util.List) ArrayList(java.util.ArrayList) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableView(org.pentaho.di.ui.core.widget.TableView) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) MouseEvent(org.eclipse.swt.events.MouseEvent) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) MouseAdapter(org.eclipse.swt.events.MouseAdapter) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) Text(org.eclipse.swt.widgets.Text) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 48 with ColumnInfo

use of org.pentaho.di.ui.core.widget.ColumnInfo in project pentaho-kettle by pentaho.

the class RowsFromResultDialog method open.

public String open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
    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(getTitle());
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Stepname line
    wlStepname = new Label(shell, SWT.RIGHT);
    wlStepname.setText(BaseMessages.getString(PKG, "RowsFromResultDialog.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);
    wlFields = new Label(shell, SWT.NONE);
    wlFields.setText(BaseMessages.getString(PKG, "RowsFromResultDialog.Fields.Label"));
    props.setLook(wlFields);
    fdlFields = new FormData();
    fdlFields.left = new FormAttachment(0, 0);
    fdlFields.top = new FormAttachment(wStepname, margin);
    wlFields.setLayoutData(fdlFields);
    final int FieldsRows = input.getFieldname().length;
    ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "RowsFromResultDialog.ColumnInfo.Fieldname"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "RowsFromResultDialog.ColumnInfo.Type"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getAllValueMetaNames()), new ColumnInfo(BaseMessages.getString(PKG, "RowsFromResultDialog.ColumnInfo.Length"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "RowsFromResultDialog.ColumnInfo.Precision"), ColumnInfo.COLUMN_TYPE_TEXT, false) };
    wFields = new TableView(transMeta, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
    // 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, null);
    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(wOK, -margin * 2);
    wFields.setLayoutData(fdFields);
    // 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);
    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(new ShellAdapter() {

        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    // Set the shell size, based upon previous time...
    setSize();
    getData();
    input.setChanged(changed);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return stepname;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) ShellEvent(org.eclipse.swt.events.ShellEvent) Text(org.eclipse.swt.widgets.Text) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Event(org.eclipse.swt.widgets.Event) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) Display(org.eclipse.swt.widgets.Display) TableView(org.pentaho.di.ui.core.widget.TableView)

Example 49 with ColumnInfo

use of org.pentaho.di.ui.core.widget.ColumnInfo in project pentaho-kettle by pentaho.

the class RssOutputDialog 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, "RssOutputDialog.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 CHANNEL TAB ///
    // ////////////////////////
    wChannelTab = new CTabItem(wTabFolder, SWT.NONE);
    wChannelTab.setText(BaseMessages.getString(PKG, "RssOutputDialog.ChannelTab.TabTitle"));
    wChannelComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wChannelComp);
    FormLayout channelLayout = new FormLayout();
    channelLayout.marginWidth = 3;
    channelLayout.marginHeight = 3;
    wChannelComp.setLayout(channelLayout);
    // Create Custom RSS?
    wlCustomRss = new Label(wChannelComp, SWT.RIGHT);
    wlCustomRss.setText(BaseMessages.getString(PKG, "RssOutputDialog.CustomRss.Label"));
    props.setLook(wlCustomRss);
    fdlCustomRss = new FormData();
    fdlCustomRss.left = new FormAttachment(0, 0);
    fdlCustomRss.top = new FormAttachment(0, margin);
    fdlCustomRss.right = new FormAttachment(middle, -margin);
    wlCustomRss.setLayoutData(fdlCustomRss);
    wCustomRss = new Button(wChannelComp, SWT.CHECK);
    wCustomRss.setToolTipText(BaseMessages.getString(PKG, "RssOutputDialog.CustomRss.Tooltip"));
    props.setLook(wCustomRss);
    fdCustomRss = new FormData();
    fdCustomRss.left = new FormAttachment(middle, 0);
    fdCustomRss.top = new FormAttachment(0, margin);
    fdCustomRss.right = new FormAttachment(100, 0);
    wCustomRss.setLayoutData(fdCustomRss);
    wCustomRss.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            setCustomRSS();
            input.setChanged();
        }
    });
    // Create Custom RSS?
    wlDisplayItem = new Label(wChannelComp, SWT.RIGHT);
    wlDisplayItem.setText(BaseMessages.getString(PKG, "RssOutputDialog.DisplayItem.Label"));
    props.setLook(wlDisplayItem);
    fdlDisplayItem = new FormData();
    fdlDisplayItem.left = new FormAttachment(0, 0);
    fdlDisplayItem.top = new FormAttachment(wCustomRss, margin);
    fdlDisplayItem.right = new FormAttachment(middle, -margin);
    wlDisplayItem.setLayoutData(fdlDisplayItem);
    wDisplayItem = new Button(wChannelComp, SWT.CHECK);
    wDisplayItem.setToolTipText(BaseMessages.getString(PKG, "RssOutputDialog.DisplayItem.Tooltip"));
    props.setLook(wDisplayItem);
    fdDisplayItem = new FormData();
    fdDisplayItem.left = new FormAttachment(middle, 0);
    fdDisplayItem.top = new FormAttachment(wCustomRss, margin);
    fdDisplayItem.right = new FormAttachment(100, 0);
    wDisplayItem.setLayoutData(fdDisplayItem);
    wDisplayItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // ChannelGroup grouping?
    // ////////////////////////
    // START OF ChannelGroup GROUP
    // 
    wChannelGroup = new Group(wChannelComp, SWT.SHADOW_NONE);
    props.setLook(wChannelGroup);
    wChannelGroup.setText(BaseMessages.getString(PKG, "RssOutputDialog.Group.ChannelGroup.Label"));
    FormLayout groupChannelGroupLayout = new FormLayout();
    groupChannelGroupLayout.marginWidth = 10;
    groupChannelGroupLayout.marginHeight = 10;
    wChannelGroup.setLayout(groupChannelGroupLayout);
    // RemarqChannel
    wlRemarqChannel = new Label(wChannelGroup, SWT.RIGHT);
    wlRemarqChannel.setText(BaseMessages.getString(PKG, "RssOutputDialog.RemarqChannel.Label"));
    props.setLook(wlRemarqChannel);
    fdlRemarqChannel = new FormData();
    fdlRemarqChannel.left = new FormAttachment(0, 0);
    fdlRemarqChannel.top = new FormAttachment(wDisplayItem, margin);
    // fdlRemarq.right = new FormAttachment(middle, -margin);
    wlRemarqChannel.setLayoutData(fdlRemarqChannel);
    // RemarqMandatory
    wlRemarqMandatory = new Label(wChannelGroup, SWT.RIGHT);
    wlRemarqMandatory.setText(BaseMessages.getString(PKG, "RssOutputDialog.RemarqMandatory.Label"));
    props.setLook(wlRemarqMandatory);
    fdlRemarqMandatory = new FormData();
    fdlRemarqMandatory.left = new FormAttachment(0, 0);
    fdlRemarqMandatory.top = new FormAttachment(wlRemarqChannel, margin);
    // fdlRemarq.right = new FormAttachment(middle, -margin);
    wlRemarqMandatory.setLayoutData(fdlRemarqMandatory);
    // ChannelTitle line
    wlChannelTitle = new Label(wChannelGroup, SWT.RIGHT);
    wlChannelTitle.setText(BaseMessages.getString(PKG, "RssOutputDialog.ChannelTitle.Label"));
    props.setLook(wlChannelTitle);
    fdlChannelTitle = new FormData();
    fdlChannelTitle.left = new FormAttachment(0, 0);
    fdlChannelTitle.top = new FormAttachment(wlRemarqMandatory, 2 * margin);
    fdlChannelTitle.right = new FormAttachment(middle, -margin);
    wlChannelTitle.setLayoutData(fdlChannelTitle);
    wChannelTitle = new CCombo(wChannelGroup, SWT.BORDER | SWT.READ_ONLY);
    wChannelTitle.setEditable(true);
    wChannelTitle.setItems(fieldNames);
    props.setLook(wChannelTitle);
    wChannelTitle.addModifyListener(lsMod);
    fdChannelTitle = new FormData();
    fdChannelTitle.left = new FormAttachment(middle, 0);
    fdChannelTitle.top = new FormAttachment(wlRemarqMandatory, 2 * margin);
    fdChannelTitle.right = new FormAttachment(100, 0);
    wChannelTitle.setLayoutData(fdChannelTitle);
    // Channel Description
    wlChannelDescription = new Label(wChannelGroup, SWT.RIGHT);
    wlChannelDescription.setText(BaseMessages.getString(PKG, "RssOutputDialog.ChannelDescription.Label"));
    props.setLook(wlChannelDescription);
    fdlChannelDescription = new FormData();
    fdlChannelDescription.left = new FormAttachment(0, 0);
    fdlChannelDescription.top = new FormAttachment(wChannelTitle, margin);
    fdlChannelDescription.right = new FormAttachment(middle, -margin);
    wlChannelDescription.setLayoutData(fdlChannelDescription);
    wChannelDescription = new CCombo(wChannelGroup, SWT.BORDER | SWT.READ_ONLY);
    wChannelDescription.setEditable(true);
    wChannelDescription.setItems(fieldNames);
    props.setLook(wChannelDescription);
    wChannelDescription.addModifyListener(lsMod);
    fdChannelDescription = new FormData();
    fdChannelDescription.left = new FormAttachment(middle, 0);
    fdChannelDescription.top = new FormAttachment(wChannelTitle, margin);
    fdChannelDescription.right = new FormAttachment(100, 0);
    wChannelDescription.setLayoutData(fdChannelDescription);
    // ChannelLink line
    wlChannelLink = new Label(wChannelGroup, SWT.RIGHT);
    wlChannelLink.setText(BaseMessages.getString(PKG, "RssOutputDialog.ChannelLink.Label"));
    props.setLook(wlChannelLink);
    fdlChannelLink = new FormData();
    fdlChannelLink.left = new FormAttachment(0, 0);
    fdlChannelLink.top = new FormAttachment(wChannelDescription, margin);
    fdlChannelLink.right = new FormAttachment(middle, -margin);
    wlChannelLink.setLayoutData(fdlChannelLink);
    wChannelLink = new CCombo(wChannelGroup, SWT.BORDER | SWT.READ_ONLY);
    wChannelLink.setEditable(true);
    wChannelLink.setItems(fieldNames);
    props.setLook(wChannelLink);
    wChannelLink.addModifyListener(lsMod);
    fdChannelLink = new FormData();
    fdChannelLink.left = new FormAttachment(middle, 0);
    fdChannelLink.top = new FormAttachment(wChannelDescription, margin);
    fdChannelLink.right = new FormAttachment(100, 0);
    wChannelLink.setLayoutData(fdChannelLink);
    // ChannelPubDate line
    wlChannelPubDate = new Label(wChannelGroup, SWT.RIGHT);
    wlChannelPubDate.setText(BaseMessages.getString(PKG, "RssOutputDialog.ChannelPubDate.Label"));
    props.setLook(wlChannelPubDate);
    fdlChannelPubDate = new FormData();
    fdlChannelPubDate.left = new FormAttachment(0, 0);
    fdlChannelPubDate.top = new FormAttachment(wChannelLink, margin);
    fdlChannelPubDate.right = new FormAttachment(middle, -margin);
    wlChannelPubDate.setLayoutData(fdlChannelPubDate);
    wChannelPubDate = new CCombo(wChannelGroup, SWT.BORDER | SWT.READ_ONLY);
    wChannelPubDate.setEditable(true);
    wChannelPubDate.setItems(fieldNames);
    props.setLook(wChannelPubDate);
    wChannelPubDate.addModifyListener(lsMod);
    fdChannelPubDate = new FormData();
    fdChannelPubDate.left = new FormAttachment(middle, 0);
    fdChannelPubDate.top = new FormAttachment(wChannelLink, margin);
    fdChannelPubDate.right = new FormAttachment(100, 0);
    wChannelPubDate.setLayoutData(fdChannelPubDate);
    // Channel Language
    wlChannelLanguage = new Label(wChannelGroup, SWT.RIGHT);
    wlChannelLanguage.setText(BaseMessages.getString(PKG, "RssOutputDialog.ChannelLanguage.Label"));
    props.setLook(wlChannelLanguage);
    fdlChannelLanguage = new FormData();
    fdlChannelLanguage.left = new FormAttachment(0, 0);
    fdlChannelLanguage.top = new FormAttachment(wChannelPubDate, margin);
    fdlChannelLanguage.right = new FormAttachment(middle, -margin);
    wlChannelLanguage.setLayoutData(fdlChannelLanguage);
    wChannelLanguage = new CCombo(wChannelGroup, SWT.BORDER | SWT.READ_ONLY);
    wChannelLanguage.setEditable(true);
    wChannelLanguage.setItems(fieldNames);
    props.setLook(wChannelLanguage);
    wChannelLanguage.addModifyListener(lsMod);
    fdChannelLanguage = new FormData();
    fdChannelLanguage.left = new FormAttachment(middle, 0);
    fdChannelLanguage.top = new FormAttachment(wChannelPubDate, margin);
    fdChannelLanguage.right = new FormAttachment(100, 0);
    wChannelLanguage.setLayoutData(fdChannelLanguage);
    // Channel Author
    wlChannelAuthor = new Label(wChannelGroup, SWT.RIGHT);
    wlChannelAuthor.setText(BaseMessages.getString(PKG, "RssOutputDialog.ChannelAuthor.Label"));
    props.setLook(wlChannelAuthor);
    fdlChannelAuthor = new FormData();
    fdlChannelAuthor.left = new FormAttachment(0, 0);
    fdlChannelAuthor.top = new FormAttachment(wChannelLanguage, margin);
    fdlChannelAuthor.right = new FormAttachment(middle, -margin);
    wlChannelAuthor.setLayoutData(fdlChannelAuthor);
    wChannelAuthor = new CCombo(wChannelGroup, SWT.BORDER | SWT.READ_ONLY);
    wChannelAuthor.setEditable(true);
    wChannelAuthor.setItems(fieldNames);
    props.setLook(wChannelAuthor);
    wChannelAuthor.addModifyListener(lsMod);
    fdChannelAuthor = new FormData();
    fdChannelAuthor.left = new FormAttachment(middle, 0);
    fdChannelAuthor.top = new FormAttachment(wChannelLanguage, margin);
    fdChannelAuthor.right = new FormAttachment(100, 0);
    wChannelAuthor.setLayoutData(fdChannelAuthor);
    // Channel Copyright
    wlChannelCopyright = new Label(wChannelGroup, SWT.RIGHT);
    wlChannelCopyright.setText(BaseMessages.getString(PKG, "RssOutputDialog.ChannelCopyright.Label"));
    props.setLook(wlChannelCopyright);
    fdlChannelCopyright = new FormData();
    fdlChannelCopyright.left = new FormAttachment(0, 0);
    fdlChannelCopyright.top = new FormAttachment(wChannelAuthor, margin);
    fdlChannelCopyright.right = new FormAttachment(middle, -margin);
    wlChannelCopyright.setLayoutData(fdlChannelCopyright);
    wChannelCopyright = new CCombo(wChannelGroup, SWT.BORDER | SWT.READ_ONLY);
    wChannelCopyright.setEditable(true);
    wChannelCopyright.setItems(fieldNames);
    props.setLook(wChannelCopyright);
    wChannelCopyright.addModifyListener(lsMod);
    fdChannelCopyright = new FormData();
    fdChannelCopyright.left = new FormAttachment(middle, 0);
    fdChannelCopyright.top = new FormAttachment(wChannelAuthor, margin);
    fdChannelCopyright.right = new FormAttachment(100, 0);
    wChannelCopyright.setLayoutData(fdChannelCopyright);
    // Add Image ?
    wlAddImage = new Label(wChannelGroup, SWT.RIGHT);
    wlAddImage.setText(BaseMessages.getString(PKG, "RssOutputDialog.AddImage.Label"));
    props.setLook(wlAddImage);
    fdlAddImage = new FormData();
    fdlAddImage.left = new FormAttachment(0, 0);
    fdlAddImage.top = new FormAttachment(wChannelCopyright, margin);
    fdlAddImage.right = new FormAttachment(middle, -margin);
    wlAddImage.setLayoutData(fdlAddImage);
    wAddImage = new Button(wChannelGroup, SWT.CHECK);
    wAddImage.setToolTipText(BaseMessages.getString(PKG, "RssOutputDialog.AddImage.Tooltip"));
    props.setLook(wAddImage);
    fdAddImage = new FormData();
    fdAddImage.left = new FormAttachment(middle, 0);
    fdAddImage.top = new FormAttachment(wChannelCopyright, margin);
    fdAddImage.right = new FormAttachment(100, 0);
    wAddImage.setLayoutData(fdAddImage);
    wAddImage.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            setImage();
            input.setChanged();
        }
    });
    // Channel Image title
    wlChannelImageTitle = new Label(wChannelGroup, SWT.RIGHT);
    wlChannelImageTitle.setText(BaseMessages.getString(PKG, "RssOutputDialog.ChannelImageTitle.Label"));
    props.setLook(wlChannelImageTitle);
    fdlChannelImageTitle = new FormData();
    fdlChannelImageTitle.left = new FormAttachment(0, 0);
    fdlChannelImageTitle.top = new FormAttachment(wAddImage, margin);
    fdlChannelImageTitle.right = new FormAttachment(middle, -margin);
    wlChannelImageTitle.setLayoutData(fdlChannelImageTitle);
    wChannelImageTitle = new CCombo(wChannelGroup, SWT.BORDER | SWT.READ_ONLY);
    wChannelImageTitle.setEditable(true);
    wChannelImageTitle.setItems(fieldNames);
    props.setLook(wChannelImageTitle);
    wChannelImageTitle.addModifyListener(lsMod);
    fdChannelImageTitle = new FormData();
    fdChannelImageTitle.left = new FormAttachment(middle, 0);
    fdChannelImageTitle.top = new FormAttachment(wAddImage, margin);
    fdChannelImageTitle.right = new FormAttachment(100, 0);
    wChannelImageTitle.setLayoutData(fdChannelImageTitle);
    // Channel Image Link
    wlChannelImageLink = new Label(wChannelGroup, SWT.RIGHT);
    wlChannelImageLink.setText(BaseMessages.getString(PKG, "RssOutputDialog.ChannelImageLink.Label"));
    props.setLook(wlChannelImageLink);
    fdlChannelImageLink = new FormData();
    fdlChannelImageLink.left = new FormAttachment(0, 0);
    fdlChannelImageLink.top = new FormAttachment(wChannelImageTitle, margin);
    fdlChannelImageLink.right = new FormAttachment(middle, -margin);
    wlChannelImageLink.setLayoutData(fdlChannelImageLink);
    wChannelImageLink = new CCombo(wChannelGroup, SWT.BORDER | SWT.READ_ONLY);
    wChannelImageLink.setEditable(true);
    wChannelImageLink.setItems(fieldNames);
    props.setLook(wChannelImageLink);
    wChannelImageLink.addModifyListener(lsMod);
    fdChannelImageLink = new FormData();
    fdChannelImageLink.left = new FormAttachment(middle, 0);
    fdChannelImageLink.top = new FormAttachment(wChannelImageTitle, margin);
    fdChannelImageLink.right = new FormAttachment(100, 0);
    wChannelImageLink.setLayoutData(fdChannelImageLink);
    // Channel Image Url
    wlChannelImageUrl = new Label(wChannelGroup, SWT.RIGHT);
    wlChannelImageUrl.setText(BaseMessages.getString(PKG, "RssOutputDialog.ChannelImageUrl.Label"));
    props.setLook(wlChannelImageUrl);
    fdlChannelImageUrl = new FormData();
    fdlChannelImageUrl.left = new FormAttachment(0, 0);
    fdlChannelImageUrl.top = new FormAttachment(wChannelImageLink, margin);
    fdlChannelImageUrl.right = new FormAttachment(middle, -margin);
    wlChannelImageUrl.setLayoutData(fdlChannelImageUrl);
    wChannelImageUrl = new CCombo(wChannelGroup, SWT.BORDER | SWT.READ_ONLY);
    wChannelImageUrl.setEditable(true);
    wChannelImageUrl.setItems(fieldNames);
    props.setLook(wChannelImageUrl);
    wChannelImageUrl.addModifyListener(lsMod);
    fdChannelImageUrl = new FormData();
    fdChannelImageUrl.left = new FormAttachment(middle, 0);
    fdChannelImageUrl.top = new FormAttachment(wChannelImageLink, margin);
    fdChannelImageUrl.right = new FormAttachment(100, 0);
    wChannelImageUrl.setLayoutData(fdChannelImageUrl);
    // Channel Image Description
    wlChannelImageDescription = new Label(wChannelGroup, SWT.RIGHT);
    wlChannelImageDescription.setText(BaseMessages.getString(PKG, "RssOutputDialog.ChannelImageDescription.Label"));
    props.setLook(wlChannelImageDescription);
    fdlChannelImageDescription = new FormData();
    fdlChannelImageDescription.left = new FormAttachment(0, 0);
    fdlChannelImageDescription.top = new FormAttachment(wChannelImageUrl, margin);
    fdlChannelImageDescription.right = new FormAttachment(middle, -margin);
    wlChannelImageDescription.setLayoutData(fdlChannelImageDescription);
    wChannelImageDescription = new CCombo(wChannelGroup, SWT.BORDER | SWT.READ_ONLY);
    wChannelImageDescription.setEditable(true);
    wChannelImageDescription.setItems(fieldNames);
    props.setLook(wChannelImageDescription);
    wChannelImageDescription.addModifyListener(lsMod);
    fdChannelImageDescription = new FormData();
    fdChannelImageDescription.left = new FormAttachment(middle, 0);
    fdChannelImageDescription.top = new FormAttachment(wChannelImageUrl, margin);
    fdChannelImageDescription.right = new FormAttachment(100, 0);
    wChannelImageDescription.setLayoutData(fdChannelImageDescription);
    // Encoding
    wlEncoding = new Label(wChannelComp, SWT.RIGHT);
    wlEncoding.setText(BaseMessages.getString(PKG, "RssOutputDialog.Encoding.Label"));
    props.setLook(wlEncoding);
    fdlEncoding = new FormData();
    fdlEncoding.left = new FormAttachment(0, 0);
    fdlEncoding.top = new FormAttachment(wChannelGroup, 2 * margin);
    fdlEncoding.right = new FormAttachment(middle, -margin);
    wlEncoding.setLayoutData(fdlEncoding);
    wEncoding = new CCombo(wChannelComp, SWT.BORDER | SWT.READ_ONLY);
    wEncoding.setEditable(true);
    props.setLook(wEncoding);
    wEncoding.addModifyListener(lsMod);
    fdEncoding = new FormData();
    fdEncoding.left = new FormAttachment(middle, 0);
    fdEncoding.top = new FormAttachment(wChannelGroup, 2 * margin);
    fdEncoding.right = new FormAttachment(100, 0);
    wEncoding.setLayoutData(fdEncoding);
    wEncoding.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);
            setEncodings();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    // Version
    wlVersion = new Label(wChannelComp, SWT.RIGHT);
    wlVersion.setText(BaseMessages.getString(PKG, "RssOutputDialog.Version.Label"));
    props.setLook(wlVersion);
    fdlVersion = new FormData();
    fdlVersion.left = new FormAttachment(0, 0);
    fdlVersion.top = new FormAttachment(wEncoding, margin);
    fdlVersion.right = new FormAttachment(middle, -margin);
    wlVersion.setLayoutData(fdlVersion);
    wVersion = new CCombo(wChannelComp, SWT.BORDER | SWT.READ_ONLY);
    wVersion.setEditable(true);
    wVersion.setItems(rss_versions);
    props.setLook(wVersion);
    wVersion.addModifyListener(lsMod);
    fdVersion = new FormData();
    fdVersion.left = new FormAttachment(middle, 0);
    fdVersion.top = new FormAttachment(wEncoding, margin);
    fdVersion.right = new FormAttachment(100, 0);
    wVersion.setLayoutData(fdVersion);
    fdChannelGroup = new FormData();
    fdChannelGroup.left = new FormAttachment(0, margin);
    fdChannelGroup.top = new FormAttachment(wDisplayItem, margin);
    fdChannelGroup.right = new FormAttachment(100, -margin);
    wChannelGroup.setLayoutData(fdChannelGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF ChannelGroup GROUP
    // ///////////////////////////////////////////////////////////
    fdChannelComp = new FormData();
    fdChannelComp.left = new FormAttachment(0, 0);
    fdChannelComp.top = new FormAttachment(0, 0);
    fdChannelComp.right = new FormAttachment(100, 0);
    fdChannelComp.bottom = new FormAttachment(100, 0);
    wChannelComp.setLayoutData(fdChannelComp);
    wChannelComp.layout();
    wChannelTab.setControl(wChannelComp);
    props.setLook(wChannelComp);
    // ///////////////////////////////////////////////////////////
    // / END OF GENERAL TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF GENERAL TAB ///
    // ////////////////////////
    wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
    wGeneralTab.setText(BaseMessages.getString(PKG, "RssOutputDialog.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, "RssOutputDialog.Group.Fields.Label"));
    FormLayout groupFieldsLayout = new FormLayout();
    groupFieldsLayout.marginWidth = 10;
    groupFieldsLayout.marginHeight = 10;
    wFields.setLayout(groupFieldsLayout);
    // RemarqItem
    wlRemarqItem = new Label(wFields, SWT.RIGHT);
    wlRemarqItem.setText(BaseMessages.getString(PKG, "RssOutputDialog.RemarqItem.Label"));
    props.setLook(wlRemarqItem);
    fdlRemarqItem = new FormData();
    fdlRemarqItem.left = new FormAttachment(0, 0);
    fdlRemarqItem.top = new FormAttachment(0, margin);
    // fdlRemarq.right = new FormAttachment(middle, -margin);
    wlRemarqItem.setLayoutData(fdlRemarqItem);
    // Item Title
    wlItemTitle = new Label(wFields, SWT.RIGHT);
    wlItemTitle.setText(BaseMessages.getString(PKG, "RssOutputDialog.ItemTitle.Label"));
    props.setLook(wlItemTitle);
    fdlItemTitle = new FormData();
    fdlItemTitle.left = new FormAttachment(0, 0);
    fdlItemTitle.top = new FormAttachment(wlRemarqItem, 3 * margin);
    fdlItemTitle.right = new FormAttachment(middle, -margin);
    wlItemTitle.setLayoutData(fdlItemTitle);
    wItemTitle = new CCombo(wFields, SWT.BORDER | SWT.READ_ONLY);
    wItemTitle.setEditable(true);
    wItemTitle.setItems(fieldNames);
    props.setLook(wItemTitle);
    wItemTitle.addModifyListener(lsMod);
    fdItemTitle = new FormData();
    fdItemTitle.left = new FormAttachment(middle, 0);
    fdItemTitle.top = new FormAttachment(wlRemarqItem, 3 * margin);
    fdItemTitle.right = new FormAttachment(100, 0);
    wItemTitle.setLayoutData(fdItemTitle);
    // Item Description
    wlItemDescription = new Label(wFields, SWT.RIGHT);
    wlItemDescription.setText(BaseMessages.getString(PKG, "RssOutputDialog.ItemDescripion.Label"));
    props.setLook(wlItemDescription);
    fdlItemDescription = new FormData();
    fdlItemDescription.left = new FormAttachment(0, 0);
    fdlItemDescription.top = new FormAttachment(wItemTitle, margin);
    fdlItemDescription.right = new FormAttachment(middle, -margin);
    wlItemDescription.setLayoutData(fdlItemDescription);
    wItemDescription = new CCombo(wFields, SWT.BORDER | SWT.READ_ONLY);
    wItemDescription.setEditable(true);
    wItemDescription.setItems(fieldNames);
    props.setLook(wItemDescription);
    wItemDescription.addModifyListener(lsMod);
    fdItemDescription = new FormData();
    fdItemDescription.left = new FormAttachment(middle, 0);
    fdItemDescription.top = new FormAttachment(wItemTitle, margin);
    fdItemDescription.right = new FormAttachment(100, 0);
    wItemDescription.setLayoutData(fdItemDescription);
    // Item Link
    wlItemLink = new Label(wFields, SWT.RIGHT);
    wlItemLink.setText(BaseMessages.getString(PKG, "RssOutputDialog.ItemLink.Label"));
    props.setLook(wlItemLink);
    fdlItemLink = new FormData();
    fdlItemLink.left = new FormAttachment(0, 0);
    fdlItemLink.top = new FormAttachment(wItemDescription, margin);
    fdlItemLink.right = new FormAttachment(middle, -margin);
    wlItemLink.setLayoutData(fdlItemLink);
    wItemLink = new CCombo(wFields, SWT.BORDER | SWT.READ_ONLY);
    wItemLink.setEditable(true);
    wItemLink.setItems(fieldNames);
    props.setLook(wItemLink);
    wItemLink.addModifyListener(lsMod);
    fdItemLink = new FormData();
    fdItemLink.left = new FormAttachment(middle, 0);
    fdItemLink.top = new FormAttachment(wItemDescription, margin);
    fdItemLink.right = new FormAttachment(100, 0);
    wItemLink.setLayoutData(fdItemLink);
    // Item PubDate
    wlItemPubDate = new Label(wFields, SWT.RIGHT);
    wlItemPubDate.setText(BaseMessages.getString(PKG, "RssOutputDialog.ItemPubDate.Label"));
    props.setLook(wlItemPubDate);
    fdlItemPubDate = new FormData();
    fdlItemPubDate.left = new FormAttachment(0, 0);
    fdlItemPubDate.top = new FormAttachment(wItemLink, margin);
    fdlItemPubDate.right = new FormAttachment(middle, -margin);
    wlItemPubDate.setLayoutData(fdlItemPubDate);
    wItemPubDate = new CCombo(wFields, SWT.BORDER | SWT.READ_ONLY);
    wItemPubDate.setEditable(true);
    wItemPubDate.setItems(fieldNames);
    props.setLook(wItemPubDate);
    wItemPubDate.addModifyListener(lsMod);
    fdItemPubDate = new FormData();
    fdItemPubDate.left = new FormAttachment(middle, 0);
    fdItemPubDate.top = new FormAttachment(wItemLink, margin);
    fdItemPubDate.right = new FormAttachment(100, 0);
    wItemPubDate.setLayoutData(fdItemPubDate);
    // Item Author
    wlItemAuthor = new Label(wFields, SWT.RIGHT);
    wlItemAuthor.setText(BaseMessages.getString(PKG, "RssOutputDialog.ItemAuthor.Label"));
    props.setLook(wlItemAuthor);
    fdlItemAuthor = new FormData();
    fdlItemAuthor.left = new FormAttachment(0, 0);
    fdlItemAuthor.top = new FormAttachment(wItemPubDate, margin);
    fdlItemAuthor.right = new FormAttachment(middle, -margin);
    wlItemAuthor.setLayoutData(fdlItemAuthor);
    wItemAuthor = new CCombo(wFields, SWT.BORDER | SWT.READ_ONLY);
    wItemAuthor.setEditable(true);
    wItemAuthor.setItems(fieldNames);
    props.setLook(wItemAuthor);
    wItemAuthor.addModifyListener(lsMod);
    fdItemAuthor = new FormData();
    fdItemAuthor.left = new FormAttachment(middle, 0);
    fdItemAuthor.top = new FormAttachment(wItemPubDate, margin);
    fdItemAuthor.right = new FormAttachment(100, 0);
    wItemAuthor.setLayoutData(fdItemAuthor);
    // Add GeoRSS ?
    wlAddGeoRSS = new Label(wFields, SWT.RIGHT);
    wlAddGeoRSS.setText(BaseMessages.getString(PKG, "RssOutputDialog.AddGeoRSS.Label"));
    props.setLook(wlAddGeoRSS);
    fdlAddGeoRSS = new FormData();
    fdlAddGeoRSS.left = new FormAttachment(0, 0);
    fdlAddGeoRSS.top = new FormAttachment(wItemAuthor, margin);
    fdlAddGeoRSS.right = new FormAttachment(middle, -margin);
    wlAddGeoRSS.setLayoutData(fdlAddGeoRSS);
    wAddGeoRSS = new Button(wFields, SWT.CHECK);
    wAddGeoRSS.setToolTipText(BaseMessages.getString(PKG, "RssOutputDialog.AddGeoRSS.Tooltip"));
    props.setLook(wAddGeoRSS);
    fdAddGeoRSS = new FormData();
    fdAddGeoRSS.left = new FormAttachment(middle, 0);
    fdAddGeoRSS.top = new FormAttachment(wItemAuthor, margin);
    fdAddGeoRSS.right = new FormAttachment(100, 0);
    wAddGeoRSS.setLayoutData(fdAddGeoRSS);
    wAddGeoRSS.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            activateGeoRSS();
            input.setChanged();
        }
    });
    // Add GeoRSS ?
    wluseGeoRSSGML = new Label(wFields, SWT.RIGHT);
    wluseGeoRSSGML.setText(BaseMessages.getString(PKG, "RssOutputDialog.useGeoRSSGML.Label"));
    props.setLook(wluseGeoRSSGML);
    fdluseGeoRSSGML = new FormData();
    fdluseGeoRSSGML.left = new FormAttachment(0, 0);
    fdluseGeoRSSGML.top = new FormAttachment(wAddGeoRSS, margin);
    fdluseGeoRSSGML.right = new FormAttachment(middle, -margin);
    wluseGeoRSSGML.setLayoutData(fdluseGeoRSSGML);
    wuseGeoRSSGML = new Button(wFields, SWT.CHECK);
    wuseGeoRSSGML.setToolTipText(BaseMessages.getString(PKG, "RssOutputDialog.useGeoRSSGML.Tooltip"));
    props.setLook(wuseGeoRSSGML);
    fduseGeoRSSGML = new FormData();
    fduseGeoRSSGML.left = new FormAttachment(middle, 0);
    fduseGeoRSSGML.top = new FormAttachment(wAddGeoRSS, margin);
    fduseGeoRSSGML.right = new FormAttachment(100, 0);
    wuseGeoRSSGML.setLayoutData(fduseGeoRSSGML);
    wuseGeoRSSGML.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // GeoPointLat
    wlGeoPointLat = new Label(wFields, SWT.RIGHT);
    wlGeoPointLat.setText(BaseMessages.getString(PKG, "RssOutputDialog.GeoPointLat.Label"));
    props.setLook(wlGeoPointLat);
    fdlGeoPointLat = new FormData();
    fdlGeoPointLat.left = new FormAttachment(0, 0);
    fdlGeoPointLat.top = new FormAttachment(wuseGeoRSSGML, margin);
    fdlGeoPointLat.right = new FormAttachment(middle, -margin);
    wlGeoPointLat.setLayoutData(fdlGeoPointLat);
    wGeoPointLat = new CCombo(wFields, SWT.BORDER | SWT.READ_ONLY);
    wGeoPointLat.setEditable(true);
    wGeoPointLat.setItems(fieldNames);
    props.setLook(wGeoPointLat);
    wGeoPointLat.addModifyListener(lsMod);
    fdGeoPointLat = new FormData();
    fdGeoPointLat.left = new FormAttachment(middle, 0);
    fdGeoPointLat.top = new FormAttachment(wuseGeoRSSGML, margin);
    fdGeoPointLat.right = new FormAttachment(100, 0);
    wGeoPointLat.setLayoutData(fdGeoPointLat);
    // GeoPointLong
    wlGeoPointLong = new Label(wFields, SWT.RIGHT);
    wlGeoPointLong.setText(BaseMessages.getString(PKG, "RssOutputDialog.GeoPointLong.Label"));
    props.setLook(wlGeoPointLong);
    fdlGeoPointLong = new FormData();
    fdlGeoPointLong.left = new FormAttachment(0, 0);
    fdlGeoPointLong.top = new FormAttachment(wGeoPointLat, margin);
    fdlGeoPointLong.right = new FormAttachment(middle, -margin);
    wlGeoPointLong.setLayoutData(fdlGeoPointLong);
    wGeoPointLong = new CCombo(wFields, SWT.BORDER | SWT.READ_ONLY);
    wGeoPointLong.setEditable(true);
    wGeoPointLong.setItems(fieldNames);
    props.setLook(wGeoPointLong);
    wGeoPointLong.addModifyListener(lsMod);
    fdGeoPointLong = new FormData();
    fdGeoPointLong.left = new FormAttachment(middle, 0);
    fdGeoPointLong.top = new FormAttachment(wGeoPointLat, margin);
    fdGeoPointLong.right = new FormAttachment(100, 0);
    wGeoPointLong.setLayoutData(fdGeoPointLong);
    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 CUSTOM TAB ///
    // ////////////////////////
    wCustomTab = new CTabItem(wTabFolder, SWT.NONE);
    wCustomTab.setText(BaseMessages.getString(PKG, "RssOutputDialog.CustomTab.TabTitle"));
    wCustomComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wCustomComp);
    FormLayout customLayout = new FormLayout();
    customLayout.marginWidth = 3;
    customLayout.marginHeight = 3;
    wCustomComp.setLayout(customLayout);
    wlChannelCustom = new Label(wCustomComp, SWT.NONE);
    wlChannelCustom.setText(BaseMessages.getString(PKG, "RssOutputDialog.Keys.Label"));
    props.setLook(wlChannelCustom);
    fdlChannelCustom = new FormData();
    fdlChannelCustom.left = new FormAttachment(0, 0);
    fdlChannelCustom.top = new FormAttachment(0, margin);
    wlChannelCustom.setLayoutData(fdlChannelCustom);
    int nrChannelCols = 2;
    int nrChannelRows = (input.getChannelCustomFields() != null ? input.getChannelCustomFields().length : 1);
    ColumnInfo[] ciChannel = new ColumnInfo[nrChannelCols];
    ciChannel[0] = new ColumnInfo(BaseMessages.getString(PKG, "RssOutputDialog.ColumnInfo.Tag"), ColumnInfo.COLUMN_TYPE_TEXT, false);
    ciChannel[1] = new ColumnInfo(BaseMessages.getString(PKG, "RssOutputDialog.ColumnInfo.Field"), ColumnInfo.COLUMN_TYPE_CCOMBO);
    ciChannel[0].setUsingVariables(true);
    ciChannel[1].setComboValues(fieldNames);
    wChannelCustom = new TableView(transMeta, wCustomComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciChannel, nrChannelRows, lsMod, props);
    wGet = new Button(wCustomComp, SWT.PUSH);
    wGet.setText(BaseMessages.getString(PKG, "RssOutputDialog.GetFields.Button"));
    fdGet = new FormData();
    fdGet.right = new FormAttachment(100, 0);
    fdGet.top = new FormAttachment(wlChannelCustom, margin);
    wGet.setLayoutData(fdGet);
    fdChannelCustom = new FormData();
    fdChannelCustom.left = new FormAttachment(0, 0);
    fdChannelCustom.top = new FormAttachment(wlChannelCustom, margin);
    fdChannelCustom.right = new FormAttachment(wGet, -margin);
    fdChannelCustom.bottom = new FormAttachment(wlChannelCustom, 190);
    wChannelCustom.setLayoutData(fdChannelCustom);
    // 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, null);
    // THE Item Custom
    wlItemCustom = new Label(wCustomComp, SWT.NONE);
    wlItemCustom.setText(BaseMessages.getString(PKG, "RssOutputDialog.ItemCustom.Label"));
    props.setLook(wlItemCustom);
    fdlItemCustom = new FormData();
    fdlItemCustom.left = new FormAttachment(0, 0);
    fdlItemCustom.top = new FormAttachment(wChannelCustom, margin);
    wlItemCustom.setLayoutData(fdlItemCustom);
    int UpInsCols = 2;
    int UpInsRows = (input.getItemCustomFields() != null ? input.getItemCustomFields().length : 1);
    ColumnInfo[] ciItem = new ColumnInfo[UpInsCols];
    ciItem[0] = new ColumnInfo(BaseMessages.getString(PKG, "RssOutputDialog.ColumnInfo.Tag"), ColumnInfo.COLUMN_TYPE_TEXT, false);
    ciItem[1] = new ColumnInfo(BaseMessages.getString(PKG, "RssOutputDialog.ColumnInfo.Field"), ColumnInfo.COLUMN_TYPE_CCOMBO);
    ciItem[1].setComboValues(fieldNames);
    wItemCustom = new TableView(transMeta, wCustomComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciItem, UpInsRows, lsMod, props);
    wGetCustomItem = new Button(wCustomComp, SWT.PUSH);
    wGetCustomItem.setText(BaseMessages.getString(PKG, "RssOutputDialog.GetItemFields.Label"));
    fdGetCustomItem = new FormData();
    fdGetCustomItem.top = new FormAttachment(wlItemCustom, margin);
    fdGetCustomItem.right = new FormAttachment(100, 0);
    wGetCustomItem.setLayoutData(fdGetCustomItem);
    fdItemCustom = new FormData();
    fdItemCustom.left = new FormAttachment(0, 0);
    fdItemCustom.top = new FormAttachment(wlItemCustom, margin);
    fdItemCustom.right = new FormAttachment(wGetCustomItem, -margin);
    fdItemCustom.bottom = new FormAttachment(100, -2 * margin);
    wItemCustom.setLayoutData(fdItemCustom);
    fdCustomComp = new FormData();
    fdCustomComp.left = new FormAttachment(0, 0);
    fdCustomComp.top = new FormAttachment(0, 0);
    fdCustomComp.right = new FormAttachment(100, 0);
    fdCustomComp.bottom = new FormAttachment(100, 0);
    wCustomComp.setLayoutData(fdCustomComp);
    wCustomComp.layout();
    wCustomTab.setControl(wCustomComp);
    props.setLook(wCustomComp);
    // ///////////////////////////////////////////////////////////
    // / END OF CUSTOM TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////////////////
    // START OF CUSTOM NAMESPACE TAB ///
    // ////////////////////////////////////
    wCustomNameSpace = new CTabItem(wTabFolder, SWT.NONE);
    wCustomNameSpace.setText(BaseMessages.getString(PKG, "RssOutputDialog.CustomNameSpace.TabTitle"));
    wCustomNameSpaceComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wCustomNameSpaceComp);
    FormLayout customnamespaceLayout = new FormLayout();
    customnamespaceLayout.marginWidth = 3;
    customnamespaceLayout.marginHeight = 3;
    wCustomNameSpaceComp.setLayout(customnamespaceLayout);
    // Namespaces
    wlNameSpace = new Label(wCustomNameSpaceComp, SWT.NONE);
    wlNameSpace.setText(BaseMessages.getString(PKG, "RssOutputDialog.NameSpace.Label"));
    props.setLook(wlNameSpace);
    fdlNameSpace = new FormData();
    fdlNameSpace.left = new FormAttachment(0, 0);
    fdlNameSpace.top = new FormAttachment(0, margin);
    wlNameSpace.setLayoutData(fdlItemCustom);
    int nrRows = (input.getNameSpaces() != null ? input.getNameSpaces().length : 1);
    ColumnInfo[] ciNameSpace = new ColumnInfo[2];
    ciNameSpace[0] = new ColumnInfo(BaseMessages.getString(PKG, "RssOutputDialog.ColumnInfo.NameSpace.Title"), ColumnInfo.COLUMN_TYPE_TEXT, false);
    ciNameSpace[1] = new ColumnInfo(BaseMessages.getString(PKG, "RssOutputDialog.ColumnInfo.NameSpace"), ColumnInfo.COLUMN_TYPE_TEXT, false);
    ciNameSpace[0].setUsingVariables(true);
    ciNameSpace[1].setUsingVariables(true);
    wNameSpaceCustom = new TableView(transMeta, wCustomNameSpaceComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciNameSpace, nrRows, lsMod, props);
    fdNameSpaceCustom = new FormData();
    fdNameSpaceCustom.left = new FormAttachment(0, 0);
    fdNameSpaceCustom.top = new FormAttachment(wlNameSpace, margin);
    fdNameSpaceCustom.right = new FormAttachment(100, -margin);
    fdNameSpaceCustom.bottom = new FormAttachment(100, -2 * margin);
    wNameSpaceCustom.setLayoutData(fdNameSpaceCustom);
    fdCustomNameSpace = new FormData();
    fdCustomNameSpace.left = new FormAttachment(0, 0);
    fdCustomNameSpace.top = new FormAttachment(0, 0);
    fdCustomNameSpace.right = new FormAttachment(100, 0);
    fdCustomNameSpace.bottom = new FormAttachment(100, 0);
    wCustomNameSpaceComp.setLayoutData(fdCustomNameSpace);
    wCustomNameSpaceComp.layout();
    wCustomNameSpace.setControl(wCustomNameSpaceComp);
    props.setLook(wCustomNameSpaceComp);
    // ///////////////////////////////////////////////////////////
    // / END OF CUSTOM NAMESPACE TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF CONTENT TAB///
    // /
    wContentTab = new CTabItem(wTabFolder, SWT.NONE);
    wContentTab.setText(BaseMessages.getString(PKG, "RssOutputDialog.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, "RssOutputDialog.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, "RssOutputDialog.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);
    // Create Parent Folder
    wlCreateParentFolder = new Label(wFileName, SWT.RIGHT);
    wlCreateParentFolder.setText(BaseMessages.getString(PKG, "RssOutputDialog.CreateParentFolder.Label"));
    props.setLook(wlCreateParentFolder);
    fdlCreateParentFolder = new FormData();
    fdlCreateParentFolder.left = new FormAttachment(0, 0);
    fdlCreateParentFolder.top = new FormAttachment(wFilename, margin);
    fdlCreateParentFolder.right = new FormAttachment(middle, -margin);
    wlCreateParentFolder.setLayoutData(fdlCreateParentFolder);
    wCreateParentFolder = new Button(wFileName, SWT.CHECK);
    wCreateParentFolder.setToolTipText(BaseMessages.getString(PKG, "RssOutputDialog.CreateParentFolder.Tooltip"));
    props.setLook(wCreateParentFolder);
    fdCreateParentFolder = new FormData();
    fdCreateParentFolder.left = new FormAttachment(middle, 0);
    fdCreateParentFolder.top = new FormAttachment(wFilename, margin);
    fdCreateParentFolder.right = new FormAttachment(100, 0);
    wCreateParentFolder.setLayoutData(fdCreateParentFolder);
    wCreateParentFolder.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // FileName defined in a field
    wlFileNameInField = new Label(wFileName, SWT.RIGHT);
    wlFileNameInField.setText(BaseMessages.getString(PKG, "RssOutputDialog.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);
    wFileNameInField.setToolTipText(BaseMessages.getString(PKG, "RssOutputDialog.FileNameInField.Tooltip"));
    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) {
            setFieldFilename();
            input.setChanged();
        }
    });
    // FieldFieldFileName line
    wlFieldFilename = new Label(wFileName, SWT.RIGHT);
    wlFieldFilename.setText(BaseMessages.getString(PKG, "RssOutputDialog.FieldFilename.Label"));
    props.setLook(wlFieldFilename);
    fdlFieldFilename = new FormData();
    fdlFieldFilename.left = new FormAttachment(0, 0);
    fdlFieldFilename.top = new FormAttachment(wFileNameInField, margin);
    fdlFieldFilename.right = new FormAttachment(middle, -margin);
    wlFieldFilename.setLayoutData(fdlFieldFilename);
    wFieldFilename = new CCombo(wFileName, SWT.BORDER | SWT.READ_ONLY);
    wFieldFilename.setEditable(true);
    wFieldFilename.setItems(fieldNames);
    props.setLook(wFieldFilename);
    wFieldFilename.addModifyListener(lsMod);
    fdFieldFilename = new FormData();
    fdFieldFilename.left = new FormAttachment(middle, 0);
    fdFieldFilename.top = new FormAttachment(wFileNameInField, margin);
    fdFieldFilename.right = new FormAttachment(100, -margin);
    wFieldFilename.setLayoutData(fdFieldFilename);
    // 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(wFieldFilename, 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(wFieldFilename, 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, "RssOutputDialog.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, "RssOutputDialog.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, "RssOutputDialog.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, "RssOutputDialog.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) {
            RssOutputMeta tfoi = new RssOutputMeta();
            getInfo(tfoi);
            try {
                String[] files = tfoi.getFiles(transMeta);
                if (files != null && files.length > 0) {
                    EnterSelectionDialog esd = new EnterSelectionDialog(shell, files, BaseMessages.getString(PKG, "RssOutputDialog.SelectOutputFiles.DialogTitle"), BaseMessages.getString(PKG, "RssOutputDialog.SelectOutputFiles.DialogMessage"));
                    esd.setViewOnly();
                    esd.open();
                } else {
                    MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
                    mb.setMessage(BaseMessages.getString(PKG, "RssOutputDialog.NoFilesFound.DialogMessage"));
                    mb.setText(BaseMessages.getString(PKG, "System.DialogTitle.Error"));
                    mb.open();
                }
            } catch (KettleStepException s) {
                MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
                mb.setMessage(BaseMessages.getString(PKG, "RssOutputDialog.ErrorGettingFiles.DialogMessage", s.getMessage()));
                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, "RssOutputDialog.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, "RssOutputDialog.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, "RssOutputDialog.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);
    // 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) {
            get(wChannelCustom);
        }
    };
    lsGetCustomItem = new Listener() {

        public void handleEvent(Event e) {
            get(wItemCustom);
        }
    };
    wOK.addListener(SWT.Selection, lsOK);
    wCancel.addListener(SWT.Selection, lsCancel);
    wGet.addListener(SWT.Selection, lsGet);
    wGetCustomItem.addListener(SWT.Selection, lsGetCustomItem);
    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();
    setCustomRSS();
    setFieldFilename();
    setImage();
    activateGeoRSS();
    // backupChanged);
    input.setChanged(changed);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return stepname;
}
Also used : Group(org.eclipse.swt.widgets.Group) CTabFolder(org.eclipse.swt.custom.CTabFolder) KettleStepException(org.pentaho.di.core.exception.KettleStepException) TableItemInsertListener(org.pentaho.di.ui.trans.step.TableItemInsertListener) FocusListener(org.eclipse.swt.events.FocusListener) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) ShellEvent(org.eclipse.swt.events.ShellEvent) Cursor(org.eclipse.swt.graphics.Cursor) CTabItem(org.eclipse.swt.custom.CTabItem) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) RssOutputMeta(org.pentaho.di.trans.steps.rssoutput.RssOutputMeta) FormAttachment(org.eclipse.swt.layout.FormAttachment) EnterSelectionDialog(org.pentaho.di.ui.core.dialog.EnterSelectionDialog) TableView(org.pentaho.di.ui.core.widget.TableView) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) TextVar(org.pentaho.di.ui.core.widget.TextVar) MessageBox(org.eclipse.swt.widgets.MessageBox) CCombo(org.eclipse.swt.custom.CCombo) Event(org.eclipse.swt.widgets.Event) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FocusListener(org.eclipse.swt.events.FocusListener) FileDialog(org.eclipse.swt.widgets.FileDialog) Display(org.eclipse.swt.widgets.Display)

Example 50 with ColumnInfo

use of org.pentaho.di.ui.core.widget.ColumnInfo in project pentaho-kettle by pentaho.

the class GroupByDialog 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();
    backupAllRows = input.passAllRows();
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "GroupByDialog.Shell.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Stepname line
    wlStepname = new Label(shell, SWT.RIGHT);
    wlStepname.setText(BaseMessages.getString(PKG, "GroupByDialog.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);
    // Include all rows?
    wlAllRows = new Label(shell, SWT.RIGHT);
    wlAllRows.setText(BaseMessages.getString(PKG, "GroupByDialog.AllRows.Label"));
    props.setLook(wlAllRows);
    fdlAllRows = new FormData();
    fdlAllRows.left = new FormAttachment(0, 0);
    fdlAllRows.top = new FormAttachment(wStepname, margin);
    fdlAllRows.right = new FormAttachment(middle, -margin);
    wlAllRows.setLayoutData(fdlAllRows);
    wAllRows = new Button(shell, SWT.CHECK);
    props.setLook(wAllRows);
    fdAllRows = new FormData();
    fdAllRows.left = new FormAttachment(middle, 0);
    fdAllRows.top = new FormAttachment(wStepname, margin);
    fdAllRows.right = new FormAttachment(100, 0);
    wAllRows.setLayoutData(fdAllRows);
    wAllRows.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setPassAllRows(!input.passAllRows());
            input.setChanged();
            setFlags();
        }
    });
    wlSortDir = new Label(shell, SWT.RIGHT);
    wlSortDir.setText(BaseMessages.getString(PKG, "GroupByDialog.TempDir.Label"));
    props.setLook(wlSortDir);
    fdlSortDir = new FormData();
    fdlSortDir.left = new FormAttachment(0, 0);
    fdlSortDir.right = new FormAttachment(middle, -margin);
    fdlSortDir.top = new FormAttachment(wAllRows, margin);
    wlSortDir.setLayoutData(fdlSortDir);
    wbSortDir = new Button(shell, SWT.PUSH | SWT.CENTER);
    props.setLook(wbSortDir);
    wbSortDir.setText(BaseMessages.getString(PKG, "GroupByDialog.Browse.Button"));
    fdbSortDir = new FormData();
    fdbSortDir.right = new FormAttachment(100, 0);
    fdbSortDir.top = new FormAttachment(wAllRows, margin);
    wbSortDir.setLayoutData(fdbSortDir);
    wSortDir = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wSortDir);
    wSortDir.addModifyListener(lsMod);
    fdSortDir = new FormData();
    fdSortDir.left = new FormAttachment(middle, 0);
    fdSortDir.top = new FormAttachment(wAllRows, margin);
    fdSortDir.right = new FormAttachment(wbSortDir, -margin);
    wSortDir.setLayoutData(fdSortDir);
    wbSortDir.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            DirectoryDialog dd = new DirectoryDialog(shell, SWT.NONE);
            dd.setFilterPath(wSortDir.getText());
            String dir = dd.open();
            if (dir != null) {
                wSortDir.setText(dir);
            }
        }
    });
    // Whenever something changes, set the tooltip to the expanded version:
    wSortDir.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            wSortDir.setToolTipText(transMeta.environmentSubstitute(wSortDir.getText()));
        }
    });
    // Prefix line...
    wlPrefix = new Label(shell, SWT.RIGHT);
    wlPrefix.setText(BaseMessages.getString(PKG, "GroupByDialog.FilePrefix.Label"));
    props.setLook(wlPrefix);
    fdlPrefix = new FormData();
    fdlPrefix.left = new FormAttachment(0, 0);
    fdlPrefix.right = new FormAttachment(middle, -margin);
    fdlPrefix.top = new FormAttachment(wbSortDir, margin * 2);
    wlPrefix.setLayoutData(fdlPrefix);
    wPrefix = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wPrefix);
    wPrefix.addModifyListener(lsMod);
    fdPrefix = new FormData();
    fdPrefix.left = new FormAttachment(middle, 0);
    fdPrefix.top = new FormAttachment(wbSortDir, margin * 2);
    fdPrefix.right = new FormAttachment(100, 0);
    wPrefix.setLayoutData(fdPrefix);
    // Include all rows?
    wlAddLineNr = new Label(shell, SWT.RIGHT);
    wlAddLineNr.setText(BaseMessages.getString(PKG, "GroupByDialog.AddLineNr.Label"));
    props.setLook(wlAddLineNr);
    fdlAddLineNr = new FormData();
    fdlAddLineNr.left = new FormAttachment(0, 0);
    fdlAddLineNr.top = new FormAttachment(wPrefix, margin);
    fdlAddLineNr.right = new FormAttachment(middle, -margin);
    wlAddLineNr.setLayoutData(fdlAddLineNr);
    wAddLineNr = new Button(shell, SWT.CHECK);
    props.setLook(wAddLineNr);
    fdAddLineNr = new FormData();
    fdAddLineNr.left = new FormAttachment(middle, 0);
    fdAddLineNr.top = new FormAttachment(wPrefix, margin);
    fdAddLineNr.right = new FormAttachment(100, 0);
    wAddLineNr.setLayoutData(fdAddLineNr);
    wAddLineNr.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            input.setAddingLineNrInGroup(!input.isAddingLineNrInGroup());
            input.setChanged();
            setFlags();
        }
    });
    // LineNrField line...
    wlLineNrField = new Label(shell, SWT.RIGHT);
    wlLineNrField.setText(BaseMessages.getString(PKG, "GroupByDialog.LineNrField.Label"));
    props.setLook(wlLineNrField);
    fdlLineNrField = new FormData();
    fdlLineNrField.left = new FormAttachment(0, 0);
    fdlLineNrField.right = new FormAttachment(middle, -margin);
    fdlLineNrField.top = new FormAttachment(wAddLineNr, margin);
    wlLineNrField.setLayoutData(fdlLineNrField);
    wLineNrField = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wLineNrField);
    wLineNrField.addModifyListener(lsMod);
    fdLineNrField = new FormData();
    fdLineNrField.left = new FormAttachment(middle, 0);
    fdLineNrField.top = new FormAttachment(wAddLineNr, margin);
    fdLineNrField.right = new FormAttachment(100, 0);
    wLineNrField.setLayoutData(fdLineNrField);
    // Always pass a result rows as output
    // 
    wlAlwaysAddResult = new Label(shell, SWT.RIGHT);
    wlAlwaysAddResult.setText(BaseMessages.getString(PKG, "GroupByDialog.AlwaysAddResult.Label"));
    wlAlwaysAddResult.setToolTipText(BaseMessages.getString(PKG, "GroupByDialog.AlwaysAddResult.ToolTip"));
    props.setLook(wlAlwaysAddResult);
    fdlAlwaysAddResult = new FormData();
    fdlAlwaysAddResult.left = new FormAttachment(0, 0);
    fdlAlwaysAddResult.top = new FormAttachment(wLineNrField, margin);
    fdlAlwaysAddResult.right = new FormAttachment(middle, -margin);
    wlAlwaysAddResult.setLayoutData(fdlAlwaysAddResult);
    wAlwaysAddResult = new Button(shell, SWT.CHECK);
    wAlwaysAddResult.setToolTipText(BaseMessages.getString(PKG, "GroupByDialog.AlwaysAddResult.ToolTip"));
    props.setLook(wAlwaysAddResult);
    fdAlwaysAddResult = new FormData();
    fdAlwaysAddResult.left = new FormAttachment(middle, 0);
    fdAlwaysAddResult.top = new FormAttachment(wLineNrField, margin);
    fdAlwaysAddResult.right = new FormAttachment(100, 0);
    wAlwaysAddResult.setLayoutData(fdAlwaysAddResult);
    wlGroup = new Label(shell, SWT.NONE);
    wlGroup.setText(BaseMessages.getString(PKG, "GroupByDialog.Group.Label"));
    props.setLook(wlGroup);
    fdlGroup = new FormData();
    fdlGroup.left = new FormAttachment(0, 0);
    fdlGroup.top = new FormAttachment(wAlwaysAddResult, margin);
    wlGroup.setLayoutData(fdlGroup);
    int nrKeyCols = 1;
    int nrKeyRows = (input.getGroupField() != null ? input.getGroupField().length : 1);
    ciKey = new ColumnInfo[nrKeyCols];
    ciKey[0] = new ColumnInfo(BaseMessages.getString(PKG, "GroupByDialog.ColumnInfo.GroupField"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
    wGroup = new TableView(transMeta, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciKey, nrKeyRows, lsMod, props);
    wGet = new Button(shell, SWT.PUSH);
    wGet.setText(BaseMessages.getString(PKG, "GroupByDialog.GetFields.Button"));
    fdGet = new FormData();
    fdGet.top = new FormAttachment(wlGroup, margin);
    fdGet.right = new FormAttachment(100, 0);
    wGet.setLayoutData(fdGet);
    fdGroup = new FormData();
    fdGroup.left = new FormAttachment(0, 0);
    fdGroup.top = new FormAttachment(wlGroup, margin);
    fdGroup.right = new FormAttachment(wGet, -margin);
    fdGroup.bottom = new FormAttachment(45, 0);
    wGroup.setLayoutData(fdGroup);
    // THE Aggregate fields
    wlAgg = new Label(shell, SWT.NONE);
    wlAgg.setText(BaseMessages.getString(PKG, "GroupByDialog.Aggregates.Label"));
    props.setLook(wlAgg);
    fdlAgg = new FormData();
    fdlAgg.left = new FormAttachment(0, 0);
    fdlAgg.top = new FormAttachment(wGroup, margin);
    wlAgg.setLayoutData(fdlAgg);
    int UpInsCols = 4;
    int UpInsRows = (input.getAggregateField() != null ? input.getAggregateField().length : 1);
    ciReturn = new ColumnInfo[UpInsCols];
    ciReturn[0] = new ColumnInfo(BaseMessages.getString(PKG, "GroupByDialog.ColumnInfo.Name"), ColumnInfo.COLUMN_TYPE_TEXT, false);
    ciReturn[1] = new ColumnInfo(BaseMessages.getString(PKG, "GroupByDialog.ColumnInfo.Subject"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
    ciReturn[2] = new ColumnInfo(BaseMessages.getString(PKG, "GroupByDialog.ColumnInfo.Type"), ColumnInfo.COLUMN_TYPE_CCOMBO, GroupByMeta.typeGroupLongDesc);
    ciReturn[3] = new ColumnInfo(BaseMessages.getString(PKG, "GroupByDialog.ColumnInfo.Value"), ColumnInfo.COLUMN_TYPE_TEXT, false);
    ciReturn[3].setToolTip(BaseMessages.getString(PKG, "GroupByDialog.ColumnInfo.Value.Tooltip"));
    ciReturn[3].setUsingVariables(true);
    wAgg = new TableView(transMeta, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciReturn, UpInsRows, lsMod, props);
    wGetAgg = new Button(shell, SWT.PUSH);
    wGetAgg.setText(BaseMessages.getString(PKG, "GroupByDialog.GetLookupFields.Button"));
    fdGetAgg = new FormData();
    fdGetAgg.top = new FormAttachment(wlAgg, margin);
    fdGetAgg.right = new FormAttachment(100, 0);
    wGetAgg.setLayoutData(fdGetAgg);
    // 
    // 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) {
                    logError(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, null);
    fdAgg = new FormData();
    fdAgg.left = new FormAttachment(0, 0);
    fdAgg.top = new FormAttachment(wlAgg, margin);
    fdAgg.right = new FormAttachment(wGetAgg, -margin);
    fdAgg.bottom = new FormAttachment(wOK, -margin);
    wAgg.setLayoutData(fdAgg);
    // Add listeners
    lsOK = new Listener() {

        public void handleEvent(Event e) {
            ok();
        }
    };
    lsGet = new Listener() {

        public void handleEvent(Event e) {
            get();
        }
    };
    lsGetAgg = new Listener() {

        public void handleEvent(Event e) {
            getAgg();
        }
    };
    lsCancel = new Listener() {

        public void handleEvent(Event e) {
            cancel();
        }
    };
    wOK.addListener(SWT.Selection, lsOK);
    wGet.addListener(SWT.Selection, lsGet);
    wGetAgg.addListener(SWT.Selection, lsGetAgg);
    wCancel.addListener(SWT.Selection, lsCancel);
    lsDef = new SelectionAdapter() {

        public void widgetDefaultSelected(SelectionEvent e) {
            ok();
        }
    };
    wStepname.addSelectionListener(lsDef);
    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(new ShellAdapter() {

        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    // Set the shell size, based upon previous time...
    setSize();
    getData();
    input.setChanged(backupChanged);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return stepname;
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) ShellEvent(org.eclipse.swt.events.ShellEvent) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog) TableView(org.pentaho.di.ui.core.widget.TableView) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) StepMeta(org.pentaho.di.trans.step.StepMeta) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) TextVar(org.pentaho.di.ui.core.widget.TextVar) Event(org.eclipse.swt.widgets.Event) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Display(org.eclipse.swt.widgets.Display)

Aggregations

ColumnInfo (org.pentaho.di.ui.core.widget.ColumnInfo)258 FormAttachment (org.eclipse.swt.layout.FormAttachment)220 FormData (org.eclipse.swt.layout.FormData)220 TableView (org.pentaho.di.ui.core.widget.TableView)216 FormLayout (org.eclipse.swt.layout.FormLayout)200 Label (org.eclipse.swt.widgets.Label)190 Button (org.eclipse.swt.widgets.Button)183 SelectionEvent (org.eclipse.swt.events.SelectionEvent)173 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)168 ShellEvent (org.eclipse.swt.events.ShellEvent)155 Event (org.eclipse.swt.widgets.Event)155 Listener (org.eclipse.swt.widgets.Listener)154 Shell (org.eclipse.swt.widgets.Shell)154 Display (org.eclipse.swt.widgets.Display)152 Text (org.eclipse.swt.widgets.Text)152 ModifyEvent (org.eclipse.swt.events.ModifyEvent)151 ModifyListener (org.eclipse.swt.events.ModifyListener)151 ShellAdapter (org.eclipse.swt.events.ShellAdapter)150 Composite (org.eclipse.swt.widgets.Composite)105 CTabItem (org.eclipse.swt.custom.CTabItem)100