Search in sources :

Example 16 with EnterSelectionDialog

use of org.pentaho.di.ui.core.dialog.EnterSelectionDialog in project pentaho-kettle by pentaho.

the class ExcelOutputDialog method open.

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

        @Override
        public void modifyText(ModifyEvent e) {
            input.setChanged();
        }
    };
    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, "ExcelOutputDialog.DialogTitle"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Stepname line
    wlStepname = new Label(shell, SWT.RIGHT);
    wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName"));
    props.setLook(wlStepname);
    fdlStepname = new FormData();
    fdlStepname.left = new FormAttachment(0, 0);
    fdlStepname.top = new FormAttachment(0, margin);
    fdlStepname.right = new FormAttachment(middle, -margin);
    wlStepname.setLayoutData(fdlStepname);
    wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wStepname.setText(stepname);
    props.setLook(wStepname);
    wStepname.addModifyListener(lsMod);
    fdStepname = new FormData();
    fdStepname.left = new FormAttachment(middle, 0);
    fdStepname.top = new FormAttachment(0, margin);
    fdStepname.right = new FormAttachment(100, 0);
    wStepname.setLayoutData(fdStepname);
    wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
    // ////////////////////////
    // START OF FILE TAB///
    // /
    wFileTab = new CTabItem(wTabFolder, SWT.NONE);
    wFileTab.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.FileTab.TabTitle"));
    Composite wFileComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wFileComp);
    FormLayout fileLayout = new FormLayout();
    fileLayout.marginWidth = 3;
    fileLayout.marginHeight = 3;
    wFileComp.setLayout(fileLayout);
    // Filename line
    wlFilename = new Label(wFileComp, SWT.RIGHT);
    wlFilename.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Filename.Label"));
    props.setLook(wlFilename);
    fdlFilename = new FormData();
    fdlFilename.left = new FormAttachment(0, 0);
    fdlFilename.top = new FormAttachment(0, margin);
    fdlFilename.right = new FormAttachment(middle, -margin);
    wlFilename.setLayoutData(fdlFilename);
    wbFilename = new Button(wFileComp, 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(0, 0);
    wbFilename.setLayoutData(fdbFilename);
    wFilename = new TextVar(transMeta, wFileComp, 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(0, margin);
    fdFilename.right = new FormAttachment(wbFilename, -margin);
    wFilename.setLayoutData(fdFilename);
    // Create Parent Folder
    wlCreateParentFolder = new Label(wFileComp, SWT.RIGHT);
    wlCreateParentFolder.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.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(wFileComp, SWT.CHECK);
    wCreateParentFolder.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.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() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // Open new File at Init
    wlDoNotOpenNewFileInit = new Label(wFileComp, SWT.RIGHT);
    wlDoNotOpenNewFileInit.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.DoNotOpenNewFileInit.Label"));
    props.setLook(wlDoNotOpenNewFileInit);
    fdlDoNotOpenNewFileInit = new FormData();
    fdlDoNotOpenNewFileInit.left = new FormAttachment(0, 0);
    fdlDoNotOpenNewFileInit.top = new FormAttachment(wCreateParentFolder, margin);
    fdlDoNotOpenNewFileInit.right = new FormAttachment(middle, -margin);
    wlDoNotOpenNewFileInit.setLayoutData(fdlDoNotOpenNewFileInit);
    wDoNotOpenNewFileInit = new Button(wFileComp, SWT.CHECK);
    wDoNotOpenNewFileInit.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.DoNotOpenNewFileInit.Tooltip"));
    props.setLook(wDoNotOpenNewFileInit);
    fdDoNotOpenNewFileInit = new FormData();
    fdDoNotOpenNewFileInit.left = new FormAttachment(middle, 0);
    fdDoNotOpenNewFileInit.top = new FormAttachment(wCreateParentFolder, margin);
    fdDoNotOpenNewFileInit.right = new FormAttachment(100, 0);
    wDoNotOpenNewFileInit.setLayoutData(fdDoNotOpenNewFileInit);
    wDoNotOpenNewFileInit.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // Extension line
    wlExtension = new Label(wFileComp, 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(wDoNotOpenNewFileInit, margin);
    fdlExtension.right = new FormAttachment(middle, -margin);
    wlExtension.setLayoutData(fdlExtension);
    wExtension = new TextVar(transMeta, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wExtension.setText("");
    props.setLook(wExtension);
    wExtension.addModifyListener(lsMod);
    fdExtension = new FormData();
    fdExtension.left = new FormAttachment(middle, 0);
    fdExtension.top = new FormAttachment(wDoNotOpenNewFileInit, margin);
    fdExtension.right = new FormAttachment(wbFilename, -margin);
    wExtension.setLayoutData(fdExtension);
    // Create multi-part file?
    wlAddStepnr = new Label(wFileComp, SWT.RIGHT);
    wlAddStepnr.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.AddStepnr.Label"));
    props.setLook(wlAddStepnr);
    fdlAddStepnr = new FormData();
    fdlAddStepnr.left = new FormAttachment(0, 0);
    fdlAddStepnr.top = new FormAttachment(wExtension, margin);
    fdlAddStepnr.right = new FormAttachment(middle, -margin);
    wlAddStepnr.setLayoutData(fdlAddStepnr);
    wAddStepnr = new Button(wFileComp, SWT.CHECK);
    props.setLook(wAddStepnr);
    fdAddStepnr = new FormData();
    fdAddStepnr.left = new FormAttachment(middle, 0);
    fdAddStepnr.top = new FormAttachment(wExtension, margin);
    fdAddStepnr.right = new FormAttachment(100, 0);
    wAddStepnr.setLayoutData(fdAddStepnr);
    wAddStepnr.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // Create multi-part file?
    wlAddDate = new Label(wFileComp, SWT.RIGHT);
    wlAddDate.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.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(wFileComp, 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() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        // System.out.println("wAddDate.getSelection()="+wAddDate.getSelection());
        }
    });
    // Create multi-part file?
    wlAddTime = new Label(wFileComp, SWT.RIGHT);
    wlAddTime.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.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(wFileComp, 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() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // Specify date time format?
    wlSpecifyFormat = new Label(wFileComp, SWT.RIGHT);
    wlSpecifyFormat.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.SpecifyFormat.Label"));
    props.setLook(wlSpecifyFormat);
    fdlSpecifyFormat = new FormData();
    fdlSpecifyFormat.left = new FormAttachment(0, 0);
    fdlSpecifyFormat.top = new FormAttachment(wAddTime, margin);
    fdlSpecifyFormat.right = new FormAttachment(middle, -margin);
    wlSpecifyFormat.setLayoutData(fdlSpecifyFormat);
    wSpecifyFormat = new Button(wFileComp, SWT.CHECK);
    props.setLook(wSpecifyFormat);
    wSpecifyFormat.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.SpecifyFormat.Tooltip"));
    fdSpecifyFormat = new FormData();
    fdSpecifyFormat.left = new FormAttachment(middle, 0);
    fdSpecifyFormat.top = new FormAttachment(wAddTime, margin);
    fdSpecifyFormat.right = new FormAttachment(100, 0);
    wSpecifyFormat.setLayoutData(fdSpecifyFormat);
    wSpecifyFormat.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
            setDateTimeFormat();
        }
    });
    // Prepare a list of possible DateTimeFormats...
    String[] dats = Const.getDateFormats();
    // DateTimeFormat
    wlDateTimeFormat = new Label(wFileComp, SWT.RIGHT);
    wlDateTimeFormat.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.DateTimeFormat.Label"));
    props.setLook(wlDateTimeFormat);
    fdlDateTimeFormat = new FormData();
    fdlDateTimeFormat.left = new FormAttachment(0, 0);
    fdlDateTimeFormat.top = new FormAttachment(wSpecifyFormat, margin);
    fdlDateTimeFormat.right = new FormAttachment(middle, -margin);
    wlDateTimeFormat.setLayoutData(fdlDateTimeFormat);
    wDateTimeFormat = new CCombo(wFileComp, SWT.BORDER | SWT.READ_ONLY);
    wDateTimeFormat.setEditable(true);
    props.setLook(wDateTimeFormat);
    wDateTimeFormat.addModifyListener(lsMod);
    fdDateTimeFormat = new FormData();
    fdDateTimeFormat.left = new FormAttachment(middle, 0);
    fdDateTimeFormat.top = new FormAttachment(wSpecifyFormat, margin);
    fdDateTimeFormat.right = new FormAttachment(100, 0);
    wDateTimeFormat.setLayoutData(fdDateTimeFormat);
    for (int x = 0; x < dats.length; x++) {
        wDateTimeFormat.add(dats[x]);
    }
    wbShowFiles = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbShowFiles);
    wbShowFiles.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.ShowFiles.Button"));
    fdbShowFiles = new FormData();
    fdbShowFiles.left = new FormAttachment(middle, 0);
    fdbShowFiles.top = new FormAttachment(wDateTimeFormat, margin * 3);
    wbShowFiles.setLayoutData(fdbShowFiles);
    wbShowFiles.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            ExcelOutputMeta tfoi = new ExcelOutputMeta();
            getInfo(tfoi);
            String[] files = tfoi.getFiles(transMeta);
            if (files != null && files.length > 0) {
                EnterSelectionDialog esd = new EnterSelectionDialog(shell, files, BaseMessages.getString(PKG, "ExcelOutputDialog.SelectOutputFiles.DialogTitle"), BaseMessages.getString(PKG, "ExcelOutputDialog.SelectOutputFiles.DialogMessage"));
                esd.setViewOnly();
                esd.open();
            } else {
                MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
                mb.setMessage(BaseMessages.getString(PKG, "ExcelOutputDialog.NoFilesFound.DialogMessage"));
                mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title"));
                mb.open();
            }
        }
    });
    // Add File to the result files name
    wlAddToResult = new Label(wFileComp, SWT.RIGHT);
    wlAddToResult.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.AddFileToResult.Label"));
    props.setLook(wlAddToResult);
    fdlAddToResult = new FormData();
    fdlAddToResult.left = new FormAttachment(0, 0);
    fdlAddToResult.top = new FormAttachment(wbShowFiles, 2 * margin);
    fdlAddToResult.right = new FormAttachment(middle, -margin);
    wlAddToResult.setLayoutData(fdlAddToResult);
    wAddToResult = new Button(wFileComp, SWT.CHECK);
    wAddToResult.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.AddFileToResult.Tooltip"));
    props.setLook(wAddToResult);
    fdAddToResult = new FormData();
    fdAddToResult.left = new FormAttachment(middle, 0);
    fdAddToResult.top = new FormAttachment(wbShowFiles, 2 * margin);
    fdAddToResult.right = new FormAttachment(100, 0);
    wAddToResult.setLayoutData(fdAddToResult);
    SelectionAdapter lsSelR = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            input.setChanged();
        }
    };
    wAddToResult.addSelectionListener(lsSelR);
    fdFileComp = new FormData();
    fdFileComp.left = new FormAttachment(0, 0);
    fdFileComp.top = new FormAttachment(0, 0);
    fdFileComp.right = new FormAttachment(100, 0);
    fdFileComp.bottom = new FormAttachment(100, 0);
    wFileComp.setLayoutData(fdFileComp);
    wFileComp.layout();
    wFileTab.setControl(wFileComp);
    // ///////////////////////////////////////////////////////////
    // / END OF FILE TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF CONTENT TAB///
    // /
    wContentTab = new CTabItem(wTabFolder, SWT.NONE);
    wContentTab.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.ContentTab.TabTitle"));
    FormLayout contentLayout = new FormLayout();
    contentLayout.marginWidth = 3;
    contentLayout.marginHeight = 3;
    Composite wContentComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wContentComp);
    wContentComp.setLayout(contentLayout);
    // Append checkbox
    wlAppend = new Label(wContentComp, SWT.RIGHT);
    wlAppend.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Append.Label"));
    props.setLook(wlAppend);
    fdlAppend = new FormData();
    fdlAppend.left = new FormAttachment(0, 0);
    fdlAppend.top = new FormAttachment(0, 0);
    fdlAppend.right = new FormAttachment(middle, -margin);
    wlAppend.setLayoutData(fdlAppend);
    wAppend = new Button(wContentComp, SWT.CHECK);
    props.setLook(wAppend);
    wAppend.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.Append.Tooltip"));
    fdAppend = new FormData();
    fdAppend.left = new FormAttachment(middle, 0);
    fdAppend.top = new FormAttachment(0, 0);
    fdAppend.right = new FormAttachment(100, 0);
    wAppend.setLayoutData(fdAppend);
    wAppend.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            input.setChanged();
        }
    });
    wlHeader = new Label(wContentComp, SWT.RIGHT);
    wlHeader.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Header.Label"));
    props.setLook(wlHeader);
    fdlHeader = new FormData();
    fdlHeader.left = new FormAttachment(0, 0);
    fdlHeader.top = new FormAttachment(wAppend, margin);
    fdlHeader.right = new FormAttachment(middle, -margin);
    wlHeader.setLayoutData(fdlHeader);
    wHeader = new Button(wContentComp, SWT.CHECK);
    props.setLook(wHeader);
    fdHeader = new FormData();
    fdHeader.left = new FormAttachment(middle, 0);
    fdHeader.top = new FormAttachment(wAppend, margin);
    fdHeader.right = new FormAttachment(100, 0);
    wHeader.setLayoutData(fdHeader);
    wHeader.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    wlFooter = new Label(wContentComp, SWT.RIGHT);
    wlFooter.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Footer.Label"));
    props.setLook(wlFooter);
    fdlFooter = new FormData();
    fdlFooter.left = new FormAttachment(0, 0);
    fdlFooter.top = new FormAttachment(wHeader, margin);
    fdlFooter.right = new FormAttachment(middle, -margin);
    wlFooter.setLayoutData(fdlFooter);
    wFooter = new Button(wContentComp, SWT.CHECK);
    props.setLook(wFooter);
    fdFooter = new FormData();
    fdFooter.left = new FormAttachment(middle, 0);
    fdFooter.top = new FormAttachment(wHeader, margin);
    fdFooter.right = new FormAttachment(100, 0);
    wFooter.setLayoutData(fdFooter);
    wFooter.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    wlEncoding = new Label(wContentComp, SWT.RIGHT);
    wlEncoding.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Encoding.Label"));
    props.setLook(wlEncoding);
    fdlEncoding = new FormData();
    fdlEncoding.left = new FormAttachment(0, 0);
    fdlEncoding.top = new FormAttachment(wFooter, margin);
    fdlEncoding.right = new FormAttachment(middle, -margin);
    wlEncoding.setLayoutData(fdlEncoding);
    wEncoding = new CCombo(wContentComp, 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(wFooter, margin);
    fdEncoding.right = new FormAttachment(100, 0);
    wEncoding.setLayoutData(fdEncoding);
    wEncoding.addFocusListener(new FocusListener() {

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

        @Override
        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();
        }
    });
    wlSplitEvery = new Label(wContentComp, SWT.RIGHT);
    wlSplitEvery.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.SplitEvery.Label"));
    props.setLook(wlSplitEvery);
    fdlSplitEvery = new FormData();
    fdlSplitEvery.left = new FormAttachment(0, 0);
    fdlSplitEvery.top = new FormAttachment(wEncoding, margin);
    fdlSplitEvery.right = new FormAttachment(middle, -margin);
    wlSplitEvery.setLayoutData(fdlSplitEvery);
    wSplitEvery = new Text(wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wSplitEvery);
    wSplitEvery.addModifyListener(lsMod);
    fdSplitEvery = new FormData();
    fdSplitEvery.left = new FormAttachment(middle, 0);
    fdSplitEvery.top = new FormAttachment(wEncoding, margin);
    fdSplitEvery.right = new FormAttachment(100, 0);
    wSplitEvery.setLayoutData(fdSplitEvery);
    // Sheet name line
    wlSheetname = new Label(wContentComp, SWT.RIGHT);
    wlSheetname.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Sheetname.Label"));
    props.setLook(wlSheetname);
    fdlSheetname = new FormData();
    fdlSheetname.left = new FormAttachment(0, 0);
    fdlSheetname.top = new FormAttachment(wSplitEvery, margin);
    fdlSheetname.right = new FormAttachment(middle, -margin);
    wlSheetname.setLayoutData(fdlSheetname);
    wSheetname = new TextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wSheetname.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.Sheetname.Tooltip"));
    props.setLook(wSheetname);
    wSheetname.addModifyListener(lsMod);
    fdSheetname = new FormData();
    fdSheetname.left = new FormAttachment(middle, 0);
    fdSheetname.top = new FormAttachment(wSplitEvery, margin);
    fdSheetname.right = new FormAttachment(100, 0);
    wSheetname.setLayoutData(fdSheetname);
    // Protect Sheet?
    wlProtectSheet = new Label(wContentComp, SWT.RIGHT);
    wlProtectSheet.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.ProtectSheet.Label"));
    props.setLook(wlProtectSheet);
    fdlProtectSheet = new FormData();
    fdlProtectSheet.left = new FormAttachment(0, 0);
    fdlProtectSheet.top = new FormAttachment(wSheetname, margin);
    fdlProtectSheet.right = new FormAttachment(middle, -margin);
    wlProtectSheet.setLayoutData(fdlProtectSheet);
    wProtectSheet = new Button(wContentComp, SWT.CHECK);
    props.setLook(wProtectSheet);
    fdProtectSheet = new FormData();
    fdProtectSheet.left = new FormAttachment(middle, 0);
    fdProtectSheet.top = new FormAttachment(wSheetname, margin);
    fdProtectSheet.right = new FormAttachment(100, 0);
    wProtectSheet.setLayoutData(fdProtectSheet);
    wProtectSheet.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            EnablePassword();
        }
    });
    // Password line
    wlPassword = new Label(wContentComp, SWT.RIGHT);
    wlPassword.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Password.Label"));
    props.setLook(wlPassword);
    fdlPassword = new FormData();
    fdlPassword.left = new FormAttachment(0, 0);
    fdlPassword.top = new FormAttachment(wProtectSheet, margin);
    fdlPassword.right = new FormAttachment(middle, -margin);
    wlPassword.setLayoutData(fdlPassword);
    wPassword = new PasswordTextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wPassword.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.Password.Tooltip"));
    props.setLook(wPassword);
    wPassword.addModifyListener(lsMod);
    fdPassword = new FormData();
    fdPassword.left = new FormAttachment(middle, 0);
    fdPassword.top = new FormAttachment(wProtectSheet, margin);
    fdPassword.right = new FormAttachment(100, 0);
    wPassword.setLayoutData(fdPassword);
    // auto size columns?
    wlAutoSize = new Label(wContentComp, SWT.RIGHT);
    wlAutoSize.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.AutoSize.Label"));
    props.setLook(wlAutoSize);
    fdlAutoSize = new FormData();
    fdlAutoSize.left = new FormAttachment(0, 0);
    fdlAutoSize.top = new FormAttachment(wPassword, margin);
    fdlAutoSize.right = new FormAttachment(middle, -margin);
    wlAutoSize.setLayoutData(fdlAutoSize);
    wAutoSize = new Button(wContentComp, SWT.CHECK);
    props.setLook(wAutoSize);
    wAutoSize.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.AutoSize.Tooltip"));
    fdAutoSize = new FormData();
    fdAutoSize.left = new FormAttachment(middle, 0);
    fdAutoSize.top = new FormAttachment(wPassword, margin);
    fdAutoSize.right = new FormAttachment(100, 0);
    wAutoSize.setLayoutData(fdAutoSize);
    wAutoSize.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            EnableAutoSize();
        }
    });
    // write null values as blank cells ?
    wlNullIsBlank = new Label(wContentComp, SWT.RIGHT);
    wlNullIsBlank.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.NullIsBlank.Label"));
    props.setLook(wlNullIsBlank);
    fdlNullIsBlank = new FormData();
    fdlNullIsBlank.left = new FormAttachment(0, 0);
    fdlNullIsBlank.top = new FormAttachment(wAutoSize, margin);
    fdlNullIsBlank.right = new FormAttachment(middle, -margin);
    wlNullIsBlank.setLayoutData(fdlNullIsBlank);
    wNullIsBlank = new Button(wContentComp, SWT.CHECK);
    props.setLook(wNullIsBlank);
    wNullIsBlank.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.NullIsBlank.Tooltip"));
    fdNullIsBlank = new FormData();
    fdNullIsBlank.left = new FormAttachment(middle, 0);
    fdNullIsBlank.top = new FormAttachment(wAutoSize, margin);
    fdNullIsBlank.right = new FormAttachment(100, 0);
    wNullIsBlank.setLayoutData(fdNullIsBlank);
    // use temporary files?
    wluseTempFiles = new Label(wContentComp, SWT.RIGHT);
    wluseTempFiles.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.useTempFile.Label"));
    props.setLook(wluseTempFiles);
    fdluseTempFiles = new FormData();
    fdluseTempFiles.left = new FormAttachment(0, 0);
    fdluseTempFiles.top = new FormAttachment(wNullIsBlank, margin);
    fdluseTempFiles.right = new FormAttachment(middle, -margin);
    wluseTempFiles.setLayoutData(fdluseTempFiles);
    wuseTempFiles = new Button(wContentComp, SWT.CHECK);
    props.setLook(wuseTempFiles);
    wuseTempFiles.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.useTempFile.Tooltip"));
    fduseTempFiles = new FormData();
    fduseTempFiles.left = new FormAttachment(middle, 0);
    fduseTempFiles.top = new FormAttachment(wNullIsBlank, margin);
    fduseTempFiles.right = new FormAttachment(100, 0);
    wuseTempFiles.setLayoutData(fduseTempFiles);
    wuseTempFiles.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
            useTempFile();
        }
    });
    // TempDirectory line
    wlTempDirectory = new Label(wContentComp, SWT.RIGHT);
    wlTempDirectory.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.TempDirectory.Label"));
    props.setLook(wlTempDirectory);
    fdlTempDirectory = new FormData();
    fdlTempDirectory.left = new FormAttachment(0, 0);
    fdlTempDirectory.top = new FormAttachment(wuseTempFiles, margin);
    fdlTempDirectory.right = new FormAttachment(middle, -margin);
    wlTempDirectory.setLayoutData(fdlTempDirectory);
    // Select TempDir
    wbTempDir = new Button(wContentComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbTempDir);
    wbTempDir.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    fdbTempDir = new FormData();
    fdbTempDir.right = new FormAttachment(100, -margin);
    fdbTempDir.top = new FormAttachment(wuseTempFiles, margin);
    wbTempDir.setLayoutData(fdbTempDir);
    wTempDirectory = new TextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wTempDirectory.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.TempDirectory.Tooltip"));
    props.setLook(wTempDirectory);
    wTempDirectory.addModifyListener(lsMod);
    fdTempDirectory = new FormData();
    fdTempDirectory.left = new FormAttachment(middle, 0);
    fdTempDirectory.top = new FormAttachment(wuseTempFiles, margin);
    fdTempDirectory.right = new FormAttachment(wbTempDir, -margin);
    wTempDirectory.setLayoutData(fdTempDirectory);
    wTempDirectory.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            input.setChanged();
        }
    });
    // ///////////////////////////////
    // START OF Template Group GROUP //
    // ///////////////////////////////
    wTemplateGroup = new Group(wContentComp, SWT.SHADOW_NONE);
    props.setLook(wTemplateGroup);
    wTemplateGroup.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.TemplateGroup.Label"));
    FormLayout TemplateGroupgroupLayout = new FormLayout();
    TemplateGroupgroupLayout.marginWidth = 10;
    TemplateGroupgroupLayout.marginHeight = 10;
    wTemplateGroup.setLayout(TemplateGroupgroupLayout);
    // Use template
    wlTemplate = new Label(wTemplateGroup, SWT.RIGHT);
    wlTemplate.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Template.Label"));
    props.setLook(wlTemplate);
    fdlTemplate = new FormData();
    fdlTemplate.left = new FormAttachment(0, 0);
    fdlTemplate.top = new FormAttachment(wTempDirectory, margin);
    fdlTemplate.right = new FormAttachment(middle, -margin);
    wlTemplate.setLayoutData(fdlTemplate);
    wTemplate = new Button(wTemplateGroup, SWT.CHECK);
    props.setLook(wTemplate);
    fdTemplate = new FormData();
    fdTemplate.left = new FormAttachment(middle, 0);
    fdTemplate.top = new FormAttachment(wTempDirectory, margin);
    fdTemplate.right = new FormAttachment(100, 0);
    wTemplate.setLayoutData(fdTemplate);
    wTemplate.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            EnableTemplate();
        }
    });
    // TemplateFilename line
    wlTemplateFilename = new Label(wTemplateGroup, SWT.RIGHT);
    wlTemplateFilename.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.TemplateFilename.Label"));
    props.setLook(wlTemplateFilename);
    fdlTemplateFilename = new FormData();
    fdlTemplateFilename.left = new FormAttachment(0, 0);
    fdlTemplateFilename.top = new FormAttachment(wTemplate, margin);
    fdlTemplateFilename.right = new FormAttachment(middle, -margin);
    wlTemplateFilename.setLayoutData(fdlTemplateFilename);
    wbTemplateFilename = new Button(wTemplateGroup, SWT.PUSH | SWT.CENTER);
    props.setLook(wbTemplateFilename);
    wbTemplateFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    fdbTemplateFilename = new FormData();
    fdbTemplateFilename.right = new FormAttachment(100, 0);
    fdbTemplateFilename.top = new FormAttachment(wTemplate, 0);
    wbTemplateFilename.setLayoutData(fdbTemplateFilename);
    wTemplateFilename = new TextVar(transMeta, wTemplateGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wTemplateFilename);
    wTemplateFilename.addModifyListener(lsMod);
    fdTemplateFilename = new FormData();
    fdTemplateFilename.left = new FormAttachment(middle, 0);
    fdTemplateFilename.top = new FormAttachment(wTemplate, margin);
    fdTemplateFilename.right = new FormAttachment(wbTemplateFilename, -margin);
    wTemplateFilename.setLayoutData(fdTemplateFilename);
    // Template Append
    wlTemplateAppend = new Label(wTemplateGroup, SWT.RIGHT);
    wlTemplateAppend.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.TemplateAppend.Label"));
    props.setLook(wlTemplateAppend);
    fdlTemplateAppend = new FormData();
    fdlTemplateAppend.left = new FormAttachment(0, 0);
    fdlTemplateAppend.top = new FormAttachment(wTemplateFilename, margin);
    fdlTemplateAppend.right = new FormAttachment(middle, -margin);
    wlTemplateAppend.setLayoutData(fdlTemplateAppend);
    wTemplateAppend = new Button(wTemplateGroup, SWT.CHECK);
    props.setLook(wTemplateAppend);
    fdTemplateAppend = new FormData();
    fdTemplateAppend.left = new FormAttachment(middle, 0);
    fdTemplateAppend.top = new FormAttachment(wTemplateFilename, margin);
    fdTemplateAppend.right = new FormAttachment(100, 0);
    wTemplateAppend.setLayoutData(fdTemplateAppend);
    wTemplateAppend.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    fdTemplateGroup = new FormData();
    fdTemplateGroup.left = new FormAttachment(0, margin);
    fdTemplateGroup.top = new FormAttachment(wTempDirectory, margin);
    fdTemplateGroup.right = new FormAttachment(100, -margin);
    wTemplateGroup.setLayoutData(fdTemplateGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF Template Group 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(fdContentComp);
    wContentComp.layout();
    wContentTab.setControl(wContentComp);
    // ///////////////////////////////////////////////////////////
    // / END OF CONTENT TAB
    // ///////////////////////////////////////////////////////////
    // Custom tab...
    // 
    wCustomTab = new CTabItem(wTabFolder, SWT.NONE);
    wCustomTab.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.CustomTab.TabTitle"));
    FormLayout CustomLayout = new FormLayout();
    CustomLayout.marginWidth = Const.FORM_MARGIN;
    CustomLayout.marginHeight = Const.FORM_MARGIN;
    Composite wCustomComp = new Composite(wTabFolder, SWT.NONE);
    wCustomComp.setLayout(CustomLayout);
    props.setLook(wCustomComp);
    // ///////////////////////////////
    // START OF Header Font GROUP //
    // ///////////////////////////////
    wFontHeaderGroup = new Group(wCustomComp, SWT.SHADOW_NONE);
    props.setLook(wFontHeaderGroup);
    wFontHeaderGroup.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.FontHeaderGroup.Label"));
    FormLayout FontHeadergroupLayout = new FormLayout();
    FontHeadergroupLayout.marginWidth = 10;
    FontHeadergroupLayout.marginHeight = 10;
    wFontHeaderGroup.setLayout(FontHeadergroupLayout);
    // Header font name
    wlHeaderFontName = new Label(wFontHeaderGroup, SWT.RIGHT);
    wlHeaderFontName.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontName.Label"));
    props.setLook(wlHeaderFontName);
    fdlHeaderFontName = new FormData();
    fdlHeaderFontName.left = new FormAttachment(0, 0);
    fdlHeaderFontName.top = new FormAttachment(0, margin);
    fdlHeaderFontName.right = new FormAttachment(middle, -margin);
    wlHeaderFontName.setLayoutData(fdlHeaderFontName);
    wHeaderFontName = new CCombo(wFontHeaderGroup, SWT.BORDER | SWT.READ_ONLY);
    wHeaderFontName.setItems(ExcelOutputMeta.font_name_desc);
    props.setLook(wHeaderFontName);
    wHeaderFontName.addModifyListener(lsMod);
    fdHeaderFontName = new FormData();
    fdHeaderFontName.left = new FormAttachment(middle, 0);
    fdHeaderFontName.top = new FormAttachment(0, margin);
    fdHeaderFontName.right = new FormAttachment(100, 0);
    wHeaderFontName.setLayoutData(fdHeaderFontName);
    // Header font size
    wlHeaderFontSize = new Label(wFontHeaderGroup, SWT.RIGHT);
    wlHeaderFontSize.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontSize.Label"));
    props.setLook(wlHeaderFontSize);
    fdlHeaderFontSize = new FormData();
    fdlHeaderFontSize.left = new FormAttachment(0, 0);
    fdlHeaderFontSize.top = new FormAttachment(wHeaderFontName, margin);
    fdlHeaderFontSize.right = new FormAttachment(middle, -margin);
    wlHeaderFontSize.setLayoutData(fdlHeaderFontSize);
    wHeaderFontSize = new TextVar(transMeta, wFontHeaderGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wHeaderFontSize.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontSize.Tooltip"));
    props.setLook(wHeaderFontSize);
    wHeaderFontSize.addModifyListener(lsMod);
    fdHeaderFontSize = new FormData();
    fdHeaderFontSize.left = new FormAttachment(middle, 0);
    fdHeaderFontSize.top = new FormAttachment(wHeaderFontName, margin);
    fdHeaderFontSize.right = new FormAttachment(100, 0);
    wHeaderFontSize.setLayoutData(fdHeaderFontSize);
    // Header font bold?
    wlHeaderFontBold = new Label(wFontHeaderGroup, SWT.RIGHT);
    wlHeaderFontBold.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontBold.Label"));
    props.setLook(wlHeaderFontBold);
    fdlHeaderFontBold = new FormData();
    fdlHeaderFontBold.left = new FormAttachment(0, 0);
    fdlHeaderFontBold.top = new FormAttachment(wHeaderFontSize, margin);
    fdlHeaderFontBold.right = new FormAttachment(middle, -margin);
    wlHeaderFontBold.setLayoutData(fdlHeaderFontBold);
    wHeaderFontBold = new Button(wFontHeaderGroup, SWT.CHECK);
    props.setLook(wHeaderFontBold);
    fdHeaderFontBold = new FormData();
    fdHeaderFontBold.left = new FormAttachment(middle, 0);
    fdHeaderFontBold.top = new FormAttachment(wHeaderFontSize, margin);
    fdHeaderFontBold.right = new FormAttachment(100, 0);
    wHeaderFontBold.setLayoutData(fdHeaderFontBold);
    wHeaderFontBold.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // Header font bold?
    wlHeaderFontItalic = new Label(wFontHeaderGroup, SWT.RIGHT);
    wlHeaderFontItalic.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontItalic.Label"));
    props.setLook(wlHeaderFontItalic);
    fdlHeaderFontItalic = new FormData();
    fdlHeaderFontItalic.left = new FormAttachment(0, 0);
    fdlHeaderFontItalic.top = new FormAttachment(wHeaderFontBold, margin);
    fdlHeaderFontItalic.right = new FormAttachment(middle, -margin);
    wlHeaderFontItalic.setLayoutData(fdlHeaderFontItalic);
    wHeaderFontItalic = new Button(wFontHeaderGroup, SWT.CHECK);
    props.setLook(wHeaderFontItalic);
    fdHeaderFontItalic = new FormData();
    fdHeaderFontItalic.left = new FormAttachment(middle, 0);
    fdHeaderFontItalic.top = new FormAttachment(wHeaderFontBold, margin);
    fdHeaderFontItalic.right = new FormAttachment(100, 0);
    wHeaderFontItalic.setLayoutData(fdHeaderFontItalic);
    wHeaderFontItalic.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // Font header uderline?
    wlHeaderFontUnderline = new Label(wFontHeaderGroup, SWT.RIGHT);
    wlHeaderFontUnderline.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontUnderline.Label"));
    props.setLook(wlHeaderFontUnderline);
    fdlHeaderFontUnderline = new FormData();
    fdlHeaderFontUnderline.left = new FormAttachment(0, 0);
    fdlHeaderFontUnderline.top = new FormAttachment(wHeaderFontItalic, margin);
    fdlHeaderFontUnderline.right = new FormAttachment(middle, -margin);
    wlHeaderFontUnderline.setLayoutData(fdlHeaderFontUnderline);
    wHeaderFontUnderline = new CCombo(wFontHeaderGroup, SWT.BORDER | SWT.READ_ONLY);
    wHeaderFontUnderline.setItems(ExcelOutputMeta.font_underline_desc);
    props.setLook(wHeaderFontUnderline);
    wHeaderFontUnderline.addModifyListener(lsMod);
    fdHeaderFontUnderline = new FormData();
    fdHeaderFontUnderline.left = new FormAttachment(middle, 0);
    fdHeaderFontUnderline.top = new FormAttachment(wHeaderFontItalic, margin);
    fdHeaderFontUnderline.right = new FormAttachment(100, 0);
    wHeaderFontUnderline.setLayoutData(fdHeaderFontUnderline);
    // Font header orientation
    wlHeaderFontOrientation = new Label(wFontHeaderGroup, SWT.RIGHT);
    wlHeaderFontOrientation.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontOrientation.Label"));
    props.setLook(wlHeaderFontOrientation);
    fdlHeaderFontOrientation = new FormData();
    fdlHeaderFontOrientation.left = new FormAttachment(0, 0);
    fdlHeaderFontOrientation.top = new FormAttachment(wHeaderFontUnderline, margin);
    fdlHeaderFontOrientation.right = new FormAttachment(middle, -margin);
    wlHeaderFontOrientation.setLayoutData(fdlHeaderFontOrientation);
    wHeaderFontOrientation = new CCombo(wFontHeaderGroup, SWT.BORDER | SWT.READ_ONLY);
    wHeaderFontOrientation.setItems(ExcelOutputMeta.font_orientation_desc);
    props.setLook(wHeaderFontOrientation);
    wHeaderFontOrientation.addModifyListener(lsMod);
    fdHeaderFontOrientation = new FormData();
    fdHeaderFontOrientation.left = new FormAttachment(middle, 0);
    fdHeaderFontOrientation.top = new FormAttachment(wHeaderFontUnderline, margin);
    fdHeaderFontOrientation.right = new FormAttachment(100, 0);
    wHeaderFontOrientation.setLayoutData(fdHeaderFontOrientation);
    // Font header color
    wlHeaderFontColor = new Label(wFontHeaderGroup, SWT.RIGHT);
    wlHeaderFontColor.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontColor.Label"));
    props.setLook(wlHeaderFontColor);
    fdlHeaderFontColor = new FormData();
    fdlHeaderFontColor.left = new FormAttachment(0, 0);
    fdlHeaderFontColor.top = new FormAttachment(wHeaderFontOrientation, margin);
    fdlHeaderFontColor.right = new FormAttachment(middle, -margin);
    wlHeaderFontColor.setLayoutData(fdlHeaderFontColor);
    wHeaderFontColor = new CCombo(wFontHeaderGroup, SWT.BORDER | SWT.READ_ONLY);
    props.setLook(wHeaderFontColor);
    fdHeaderFontColor = new FormData();
    fdHeaderFontColor.left = new FormAttachment(middle, 0);
    fdHeaderFontColor.top = new FormAttachment(wHeaderFontOrientation, margin);
    fdHeaderFontColor.right = new FormAttachment(100, 0);
    wHeaderFontColor.setLayoutData(fdHeaderFontColor);
    wHeaderFontColor.setItems(ExcelOutputMeta.font_color_desc);
    // Font header background color
    wlHeaderBackGroundColor = new Label(wFontHeaderGroup, SWT.RIGHT);
    wlHeaderBackGroundColor.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderBackGroundColor.Label"));
    props.setLook(wlHeaderBackGroundColor);
    fdlHeaderBackGroundColor = new FormData();
    fdlHeaderBackGroundColor.left = new FormAttachment(0, 0);
    fdlHeaderBackGroundColor.top = new FormAttachment(wHeaderFontColor, margin);
    fdlHeaderBackGroundColor.right = new FormAttachment(middle, -margin);
    wlHeaderBackGroundColor.setLayoutData(fdlHeaderBackGroundColor);
    wHeaderBackGroundColor = new CCombo(wFontHeaderGroup, SWT.BORDER | SWT.READ_ONLY);
    props.setLook(wHeaderBackGroundColor);
    fdHeaderBackGroundColor = new FormData();
    fdHeaderBackGroundColor.left = new FormAttachment(middle, 0);
    fdHeaderBackGroundColor.top = new FormAttachment(wHeaderFontColor, margin);
    fdHeaderBackGroundColor.right = new FormAttachment(100, 0);
    wHeaderBackGroundColor.setLayoutData(fdHeaderBackGroundColor);
    wHeaderBackGroundColor.setItems(ExcelOutputMeta.font_color_desc);
    // Header font size
    wlHeaderRowHeight = new Label(wFontHeaderGroup, SWT.RIGHT);
    wlHeaderRowHeight.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderRowHeight.Label"));
    props.setLook(wlHeaderRowHeight);
    fdlHeaderRowHeight = new FormData();
    fdlHeaderRowHeight.left = new FormAttachment(0, 0);
    fdlHeaderRowHeight.top = new FormAttachment(wHeaderBackGroundColor, margin);
    fdlHeaderRowHeight.right = new FormAttachment(middle, -margin);
    wlHeaderRowHeight.setLayoutData(fdlHeaderRowHeight);
    wHeaderRowHeight = new TextVar(transMeta, wFontHeaderGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wHeaderRowHeight.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderRowHeight.Tooltip"));
    props.setLook(wHeaderRowHeight);
    wHeaderRowHeight.addModifyListener(lsMod);
    fdHeaderRowHeight = new FormData();
    fdHeaderRowHeight.left = new FormAttachment(middle, 0);
    fdHeaderRowHeight.top = new FormAttachment(wHeaderBackGroundColor, margin);
    fdHeaderRowHeight.right = new FormAttachment(100, 0);
    wHeaderRowHeight.setLayoutData(fdHeaderRowHeight);
    // Header Alignment
    wlHeaderAlignment = new Label(wFontHeaderGroup, SWT.RIGHT);
    wlHeaderAlignment.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderAlignment.Label"));
    props.setLook(wlHeaderAlignment);
    fdlHeaderAlignment = new FormData();
    fdlHeaderAlignment.left = new FormAttachment(0, 0);
    fdlHeaderAlignment.top = new FormAttachment(wHeaderRowHeight, margin);
    fdlHeaderAlignment.right = new FormAttachment(middle, -margin);
    wlHeaderAlignment.setLayoutData(fdlHeaderAlignment);
    wHeaderAlignment = new CCombo(wFontHeaderGroup, SWT.BORDER | SWT.READ_ONLY);
    wHeaderAlignment.setItems(ExcelOutputMeta.font_alignment_desc);
    props.setLook(wHeaderAlignment);
    wHeaderAlignment.addModifyListener(lsMod);
    fdHeaderAlignment = new FormData();
    fdHeaderAlignment.left = new FormAttachment(middle, 0);
    fdHeaderAlignment.top = new FormAttachment(wHeaderRowHeight, margin);
    fdHeaderAlignment.right = new FormAttachment(100, 0);
    wHeaderAlignment.setLayoutData(fdHeaderAlignment);
    // Select Image
    wbImage = new Button(wFontHeaderGroup, SWT.PUSH | SWT.CENTER);
    props.setLook(wbImage);
    wbImage.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.AddImage"));
    fdbImage = new FormData();
    fdbImage.right = new FormAttachment(100, 0);
    fdbImage.top = new FormAttachment(wHeaderAlignment, margin);
    wbImage.setLayoutData(fdbImage);
    wbImage.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.OPEN);
            dialog.setFilterExtensions(new String[] { "*.png", "*.*" });
            if (wImage.getText() != null) {
                dialog.setFileName(transMeta.environmentSubstitute(wImage.getText()));
            }
            dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "ExcelOutputDialog.FileType.PNGFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
            if (dialog.open() != null) {
                wImage.setText(dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName());
            }
        }
    });
    // Image line
    wlImage = new Label(wFontHeaderGroup, SWT.RIGHT);
    wlImage.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Image.Label"));
    props.setLook(wlImage);
    fdlImage = new FormData();
    fdlImage.left = new FormAttachment(0, 0);
    fdlImage.top = new FormAttachment(wHeaderAlignment, margin);
    fdlImage.right = new FormAttachment(middle, -margin);
    wlImage.setLayoutData(fdlImage);
    wImage = new TextVar(transMeta, wFontHeaderGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wImage);
    wImage.addModifyListener(lsMod);
    fdImage = new FormData();
    fdImage.left = new FormAttachment(middle, 0);
    fdImage.top = new FormAttachment(wHeaderAlignment, margin);
    fdImage.right = new FormAttachment(wbImage, -margin);
    wImage.setLayoutData(fdImage);
    fdFontHeaderGroup = new FormData();
    fdFontHeaderGroup.left = new FormAttachment(0, margin);
    fdFontHeaderGroup.top = new FormAttachment(0, margin);
    fdFontHeaderGroup.right = new FormAttachment(100, -margin);
    wFontHeaderGroup.setLayoutData(fdFontHeaderGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF Font Group GROUP
    // ///////////////////////////////////////////////////////////
    // ///////////////////////////////
    // START OF Row Font GROUP //
    // ///////////////////////////////
    wFontRowGroup = new Group(wCustomComp, SWT.SHADOW_NONE);
    props.setLook(wFontRowGroup);
    wFontRowGroup.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.FontRowGroup.Label"));
    FormLayout FontRowGroupLayout = new FormLayout();
    FontRowGroupLayout.marginWidth = 10;
    FontRowGroupLayout.marginHeight = 10;
    wFontRowGroup.setLayout(FontRowGroupLayout);
    // Font Row name
    wlRowFontName = new Label(wFontRowGroup, SWT.RIGHT);
    wlRowFontName.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.RowFontName.Label"));
    props.setLook(wlRowFontName);
    fdlRowFontName = new FormData();
    fdlRowFontName.left = new FormAttachment(0, 0);
    fdlRowFontName.top = new FormAttachment(0, margin);
    fdlRowFontName.right = new FormAttachment(middle, -margin);
    wlRowFontName.setLayoutData(fdlRowFontName);
    wRowFontName = new CCombo(wFontRowGroup, SWT.BORDER | SWT.READ_ONLY);
    wRowFontName.setItems(ExcelOutputMeta.font_name_desc);
    props.setLook(wRowFontName);
    wRowFontName.addModifyListener(lsMod);
    fdRowFontName = new FormData();
    fdRowFontName.left = new FormAttachment(middle, 0);
    fdRowFontName.top = new FormAttachment(0, margin);
    fdRowFontName.right = new FormAttachment(100, 0);
    wRowFontName.setLayoutData(fdRowFontName);
    // Row font size
    wlRowFontSize = new Label(wFontRowGroup, SWT.RIGHT);
    wlRowFontSize.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.RowFontSize.Label"));
    props.setLook(wlRowFontSize);
    fdlRowFontSize = new FormData();
    fdlRowFontSize.left = new FormAttachment(0, 0);
    fdlRowFontSize.top = new FormAttachment(wRowFontName, margin);
    fdlRowFontSize.right = new FormAttachment(middle, -margin);
    wlRowFontSize.setLayoutData(fdlRowFontSize);
    wRowFontSize = new TextVar(transMeta, wFontRowGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wRowFontSize.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.RowFontSize.Tooltip"));
    props.setLook(wRowFontSize);
    wRowFontSize.addModifyListener(lsMod);
    fdRowFontSize = new FormData();
    fdRowFontSize.left = new FormAttachment(middle, 0);
    fdRowFontSize.top = new FormAttachment(wRowFontName, margin);
    fdRowFontSize.right = new FormAttachment(100, 0);
    wRowFontSize.setLayoutData(fdRowFontSize);
    // Font Row color
    wlRowFontColor = new Label(wFontRowGroup, SWT.RIGHT);
    wlRowFontColor.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.RowFontColor.Label"));
    props.setLook(wlRowFontColor);
    fdlRowFontColor = new FormData();
    fdlRowFontColor.left = new FormAttachment(0, 0);
    fdlRowFontColor.top = new FormAttachment(wRowFontSize, margin);
    fdlRowFontColor.right = new FormAttachment(middle, -margin);
    wlRowFontColor.setLayoutData(fdlRowFontColor);
    wRowFontColor = new CCombo(wFontRowGroup, SWT.BORDER | SWT.READ_ONLY);
    props.setLook(wRowFontColor);
    fdRowFontColor = new FormData();
    fdRowFontColor.left = new FormAttachment(middle, 0);
    fdRowFontColor.top = new FormAttachment(wRowFontSize, margin);
    fdRowFontColor.right = new FormAttachment(100, 0);
    wRowFontColor.setLayoutData(fdRowFontColor);
    wRowFontColor.setItems(ExcelOutputMeta.font_color_desc);
    // Font Row background color
    wlRowBackGroundColor = new Label(wFontRowGroup, SWT.RIGHT);
    wlRowBackGroundColor.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.RowBackGroundColor.Label"));
    props.setLook(wlRowBackGroundColor);
    fdlRowBackGroundColor = new FormData();
    fdlRowBackGroundColor.left = new FormAttachment(0, 0);
    fdlRowBackGroundColor.top = new FormAttachment(wRowFontColor, margin);
    fdlRowBackGroundColor.right = new FormAttachment(middle, -margin);
    wlRowBackGroundColor.setLayoutData(fdlRowBackGroundColor);
    wRowBackGroundColor = new CCombo(wFontRowGroup, SWT.BORDER | SWT.READ_ONLY);
    props.setLook(wRowBackGroundColor);
    fdRowBackGroundColor = new FormData();
    fdRowBackGroundColor.left = new FormAttachment(middle, 0);
    fdRowBackGroundColor.top = new FormAttachment(wRowFontColor, margin);
    fdRowBackGroundColor.right = new FormAttachment(100, 0);
    wRowBackGroundColor.setLayoutData(fdRowBackGroundColor);
    wRowBackGroundColor.setItems(ExcelOutputMeta.font_color_desc);
    fdFontRowGroup = new FormData();
    fdFontRowGroup.left = new FormAttachment(0, margin);
    fdFontRowGroup.top = new FormAttachment(wFontHeaderGroup, margin);
    fdFontRowGroup.right = new FormAttachment(100, -margin);
    wFontRowGroup.setLayoutData(fdFontRowGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF Row Font Group
    // ///////////////////////////////////////////////////////////
    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);
    // ///////////////////////////////////////////////////////////
    // / END OF customer TAB
    // ///////////////////////////////////////////////////////////
    // Fields tab...
    // 
    wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
    wFieldsTab.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.FieldsTab.TabTitle"));
    FormLayout fieldsLayout = new FormLayout();
    fieldsLayout.marginWidth = Const.FORM_MARGIN;
    fieldsLayout.marginHeight = Const.FORM_MARGIN;
    Composite wFieldsComp = new Composite(wTabFolder, SWT.NONE);
    wFieldsComp.setLayout(fieldsLayout);
    props.setLook(wFieldsComp);
    wGet = new Button(wFieldsComp, SWT.PUSH);
    wGet.setText(BaseMessages.getString(PKG, "System.Button.GetFields"));
    wGet.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.GetFields"));
    wMinWidth = new Button(wFieldsComp, SWT.PUSH);
    wMinWidth.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.MinWidth.Button"));
    wMinWidth.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.MinWidth.Tooltip"));
    setButtonPositions(new Button[] { wGet, wMinWidth }, margin, null);
    final int FieldsRows = input.getOutputFields().length;
    // Prepare a list of possible formats...
    String[] formats = new String[] { // Numbers
    "#", "0", "0.00", "#,##0", "#,##0.00", "$#,##0;($#,##0)", "$#,##0;($#,##0)", "$#,##0;($#,##0)", "$#,##0;($#,##0)", "0%", "0.00%", "0.00E00", "#,##0;(#,##0)", "#,##0;(#,##0)", "#,##0.00;(#,##0.00)", "#,##0.00;(#,##0.00)", "#,##0;(#,##0)", "#,##0;(#,##0)", "#,##0.00;(#,##0.00)", "#,##0.00;(#,##0.00)", "#,##0.00;(#,##0.00)", "##0.0E0", // Forces text
    "@", // Dates
    "M/d/yy", "d-MMM-yy", "d-MMM", "MMM-yy", "h:mm a", "h:mm:ss a", "H:mm", "H:mm:ss", "M/d/yy H:mm", "mm:ss", "H:mm:ss", "H:mm:ss" };
    colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "ExcelOutputDialog.NameColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "ExcelOutputDialog.TypeColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames()), new ColumnInfo(BaseMessages.getString(PKG, "ExcelOutputDialog.FormatColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, formats) };
    wFields = new TableView(transMeta, wFieldsComp, SWT.BORDER | 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);
    // 
    // Search the fields in the background
    final Runnable runnable = new Runnable() {

        @Override
        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();
    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);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    setButtonPositions(new Button[] { wOK, wCancel }, margin, wTabFolder);
    // Add listeners
    lsOK = new Listener() {

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

        @Override
        public void handleEvent(Event e) {
            get();
        }
    };
    lsMinWidth = new Listener() {

        @Override
        public void handleEvent(Event e) {
            setMinimalWidth();
        }
    };
    lsCancel = new Listener() {

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

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            ok();
        }
    };
    wStepname.addSelectionListener(lsDef);
    wFilename.addSelectionListener(lsDef);
    wTemplateFilename.addSelectionListener(lsDef);
    // Whenever something changes, set the tooltip to the expanded version:
    wFilename.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            wFilename.setToolTipText(transMeta.environmentSubstitute(wFilename.getText()));
        }
    });
    wTemplateFilename.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            wTemplateFilename.setToolTipText(transMeta.environmentSubstitute(wTemplateFilename.getText()));
        }
    });
    wbFilename.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.SAVE);
            dialog.setFilterExtensions(new String[] { "*.xls", "*.*" });
            if (wFilename.getText() != null) {
                dialog.setFileName(transMeta.environmentSubstitute(wFilename.getText()));
            }
            dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "System.FileType.ExcelFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
            if (dialog.open() != null) {
                wFilename.setText(dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName());
            }
        }
    });
    wbTemplateFilename.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.OPEN);
            dialog.setFilterExtensions(new String[] { "*.xls", "*.*" });
            if (wTemplateFilename.getText() != null) {
                dialog.setFileName(transMeta.environmentSubstitute(wTemplateFilename.getText()));
            }
            dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "System.FileType.ExcelFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
            if (dialog.open() != null) {
                wTemplateFilename.setText(dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName());
            }
        }
    });
    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(new ShellAdapter() {

        @Override
        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    lsResize = new Listener() {

        @Override
        public void handleEvent(Event event) {
            Point size = shell.getSize();
            wFields.setSize(size.x - 10, size.y - 50);
            wFields.table.setSize(size.x - 10, size.y - 50);
            wFields.redraw();
        }
    };
    shell.addListener(SWT.Resize, lsResize);
    wTabFolder.setSelection(0);
    // Set the shell size, based upon previous time...
    setSize();
    getData();
    setDateTimeFormat();
    EnableAutoSize();
    useTempFile();
    input.setChanged(changed);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return stepname;
}
Also used : Group(org.eclipse.swt.widgets.Group) KettleException(org.pentaho.di.core.exception.KettleException) CTabFolder(org.eclipse.swt.custom.CTabFolder) 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) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) 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) 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) ExcelOutputMeta(org.pentaho.di.trans.steps.exceloutput.ExcelOutputMeta) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) Point(org.eclipse.swt.graphics.Point) StepMeta(org.pentaho.di.trans.step.StepMeta) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) Point(org.eclipse.swt.graphics.Point) TextVar(org.pentaho.di.ui.core.widget.TextVar) PasswordTextVar(org.pentaho.di.ui.core.widget.PasswordTextVar) MessageBox(org.eclipse.swt.widgets.MessageBox) PasswordTextVar(org.pentaho.di.ui.core.widget.PasswordTextVar) CCombo(org.eclipse.swt.custom.CCombo) 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) FileDialog(org.eclipse.swt.widgets.FileDialog) Display(org.eclipse.swt.widgets.Display)

Example 17 with EnterSelectionDialog

use of org.pentaho.di.ui.core.dialog.EnterSelectionDialog in project pentaho-kettle by pentaho.

the class VariableButtonListenerFactory method getSelectionAdapter.

// Listen to the Variable... button
public static final SelectionAdapter getSelectionAdapter(final Composite composite, final Text destination, final GetCaretPositionInterface getCaretPositionInterface, final InsertTextInterface insertTextInterface, final VariableSpace space) {
    return new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            String[] keys = space.listVariables();
            Arrays.sort(keys);
            int size = keys.length;
            String[] key = new String[size];
            String[] val = new String[size];
            String[] str = new String[size];
            for (int i = 0; i < keys.length; i++) {
                key[i] = keys[i];
                val[i] = space.getVariable(key[i]);
                str[i] = key[i] + "  [" + val[i] + "]";
            }
            // Before focus is lost, we get the position of where the selected variable needs to be inserted.
            int position = 0;
            if (getCaretPositionInterface != null) {
                position = getCaretPositionInterface.getCaretPosition();
            }
            EnterSelectionDialog esd = new EnterSelectionDialog(composite.getShell(), str, BaseMessages.getString(PKG, "System.Dialog.SelectEnvironmentVar.Title"), BaseMessages.getString(PKG, "System.Dialog.SelectEnvironmentVar.Message"));
            if (esd.open() != null) {
                int nr = esd.getSelectionNr();
                String var = "${" + key[nr] + "}";
                if (insertTextInterface == null) {
                    destination.insert(var);
                    // destination.setToolTipText(StringUtil.environmentSubstitute( destination.getText() ) );
                    e.doit = false;
                } else {
                    insertTextInterface.insertText(var, position);
                }
            }
        }
    };
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) EnterSelectionDialog(org.pentaho.di.ui.core.dialog.EnterSelectionDialog)

Example 18 with EnterSelectionDialog

use of org.pentaho.di.ui.core.dialog.EnterSelectionDialog in project pentaho-kettle by pentaho.

the class JobLogDelegate method showErrors.

public void showErrors() {
    String all = jobLogText.getText();
    ArrayList<String> err = new ArrayList<String>();
    int i = 0;
    int startpos = 0;
    int crlen = Const.CR.length();
    String line = null;
    String lineUpper = null;
    while (i < all.length() - crlen) {
        if (all.substring(i, i + crlen).equalsIgnoreCase(Const.CR)) {
            line = all.substring(startpos, i);
            lineUpper = line.toUpperCase();
            if (lineUpper.indexOf(BaseMessages.getString(PKG, "JobLog.System.ERROR")) >= 0 || lineUpper.indexOf(BaseMessages.getString(PKG, "JobLog.System.EXCEPTION")) >= 0) {
                err.add(line);
            }
            // New start of line
            startpos = i + crlen;
        }
        i++;
    }
    line = all.substring(startpos);
    lineUpper = line.toUpperCase();
    if (lineUpper.indexOf(BaseMessages.getString(PKG, "JobLog.System.ERROR")) >= 0 || lineUpper.indexOf(BaseMessages.getString(PKG, "JobLog.System.EXCEPTION")) >= 0) {
        err.add(line);
    }
    if (err.size() > 0) {
        String[] err_lines = new String[err.size()];
        for (i = 0; i < err_lines.length; i++) {
            err_lines[i] = err.get(i);
        }
        EnterSelectionDialog esd = new EnterSelectionDialog(jobGraph.getShell(), err_lines, BaseMessages.getString(PKG, "JobLog.Dialog.ErrorLines.Title"), BaseMessages.getString(PKG, "JobLog.Dialog.ErrorLines.Message"));
        line = esd.open();
        if (line != null) {
            JobMeta jobMeta = jobGraph.getManagedObject();
            for (i = 0; i < jobMeta.nrJobEntries(); i++) {
                JobEntryCopy entryCopy = jobMeta.getJobEntry(i);
                if (line.indexOf(entryCopy.getName()) >= 0) {
                    spoon.editJobEntry(jobMeta, entryCopy);
                }
            }
        // System.out.println("Error line selected: "+line);
        }
    }
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) ArrayList(java.util.ArrayList) EnterSelectionDialog(org.pentaho.di.ui.core.dialog.EnterSelectionDialog)

Example 19 with EnterSelectionDialog

use of org.pentaho.di.ui.core.dialog.EnterSelectionDialog in project pentaho-kettle by pentaho.

the class ClusterSchemaDialog method selectSlaveServers.

private void selectSlaveServers() {
    String[] names = SlaveServer.getSlaveServerNames(slaveServers);
    int[] idx = Const.indexsOfFoundStrings(wServers.getItems(0), names);
    EnterSelectionDialog dialog = new EnterSelectionDialog(shell, names, BaseMessages.getString(PKG, "ClusterSchemaDialog.SelectServers.Label"), BaseMessages.getString(PKG, "ClusterSchemaDialog.SelectServersCluster.Label"));
    dialog.setAvoidQuickSearch();
    dialog.setSelectedNrs(idx);
    dialog.setMulti(true);
    if (dialog.open() != null) {
        clusterSchema.getSlaveServers().clear();
        int[] indeces = dialog.getSelectionIndeces();
        for (int i = 0; i < indeces.length; i++) {
            SlaveServer slaveServer = SlaveServer.findSlaveServer(slaveServers, names[indeces[i]]);
            clusterSchema.getSlaveServers().add(slaveServer);
        }
        refreshSlaveServers();
    }
}
Also used : SlaveServer(org.pentaho.di.cluster.SlaveServer) EnterSelectionDialog(org.pentaho.di.ui.core.dialog.EnterSelectionDialog)

Example 20 with EnterSelectionDialog

use of org.pentaho.di.ui.core.dialog.EnterSelectionDialog in project pentaho-kettle by pentaho.

the class XulDatabaseExplorerController method getDDLForOther.

public void getDDLForOther() {
    if (databases != null) {
        try {
            // Now select the other connection...
            // Only take non-SAP ERP connections....
            List<DatabaseMeta> dbs = new ArrayList<DatabaseMeta>();
            for (int i = 0; i < databases.size(); i++) {
                if (((databases.get(i)).getDatabaseInterface().isExplorable())) {
                    dbs.add(databases.get(i));
                }
            }
            String[] conn = new String[dbs.size()];
            for (int i = 0; i < conn.length; i++) {
                conn[i] = (dbs.get(i)).getName();
            }
            EnterSelectionDialog esd = new EnterSelectionDialog(this.dbExplorerDialog.getShell(), conn, BaseMessages.getString(PKG, "DatabaseExplorerDialog.TargetDatabase.Title"), BaseMessages.getString(PKG, "DatabaseExplorerDialog.TargetDatabase.Message"));
            String target = esd.open();
            if (target != null) {
                DatabaseMeta targetdbi = DatabaseMeta.findDatabase(dbs, target);
                Database targetdb = new Database(null, targetdbi);
                try {
                    targetdb.connect();
                    String tableName = getSchemaAndTable(model);
                    RowMetaInterface r = targetdb.getTableFields(tableName);
                    String sql = targetdb.getCreateTableStatement(tableName, r, null, false, null, true);
                    SQLEditor se = new SQLEditor(this.getDatabaseMeta(), this.dbExplorerDialog.getShell(), SWT.NONE, this.model.getDatabaseMeta(), this.dbcache, sql);
                    se.open();
                } finally {
                    targetdb.disconnect();
                }
            }
        } catch (KettleDatabaseException dbe) {
            new ErrorDialog(this.dbExplorerDialog.getShell(), BaseMessages.getString(PKG, "Dialog.Error.Header"), BaseMessages.getString(PKG, "DatabaseExplorerDialog.Error.GenDDL"), dbe);
        }
    } else {
        MessageBox mb = new MessageBox(this.dbExplorerDialog.getShell(), SWT.NONE | SWT.ICON_INFORMATION);
        mb.setMessage(BaseMessages.getString(PKG, "DatabaseExplorerDialog.NoConnectionsKnown.Message"));
        mb.setText(BaseMessages.getString(PKG, "DatabaseExplorerDialog.NoConnectionsKnown.Title"));
        mb.open();
    }
}
Also used : KettleDatabaseException(org.pentaho.di.core.exception.KettleDatabaseException) ArrayList(java.util.ArrayList) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) XulMessageBox(org.pentaho.ui.xul.components.XulMessageBox) MessageBox(org.eclipse.swt.widgets.MessageBox) Database(org.pentaho.di.core.database.Database) EnterSelectionDialog(org.pentaho.di.ui.core.dialog.EnterSelectionDialog)

Aggregations

EnterSelectionDialog (org.pentaho.di.ui.core.dialog.EnterSelectionDialog)75 MessageBox (org.eclipse.swt.widgets.MessageBox)42 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)42 KettleException (org.pentaho.di.core.exception.KettleException)41 SelectionEvent (org.eclipse.swt.events.SelectionEvent)30 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)29 ModifyEvent (org.eclipse.swt.events.ModifyEvent)28 ModifyListener (org.eclipse.swt.events.ModifyListener)28 ShellEvent (org.eclipse.swt.events.ShellEvent)28 FormAttachment (org.eclipse.swt.layout.FormAttachment)28 FormData (org.eclipse.swt.layout.FormData)28 FormLayout (org.eclipse.swt.layout.FormLayout)28 Event (org.eclipse.swt.widgets.Event)28 Listener (org.eclipse.swt.widgets.Listener)28 Shell (org.eclipse.swt.widgets.Shell)28 ShellAdapter (org.eclipse.swt.events.ShellAdapter)27 Button (org.eclipse.swt.widgets.Button)27 Display (org.eclipse.swt.widgets.Display)27 Label (org.eclipse.swt.widgets.Label)27 Text (org.eclipse.swt.widgets.Text)27