Search in sources :

Example 1 with ComponentSelectionListener

use of org.pentaho.di.ui.trans.step.ComponentSelectionListener in project pentaho-kettle by pentaho.

the class ChangeFileEncodingDialog method open.

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

        public void modifyText(ModifyEvent e) {
            input.setChanged();
        }
    };
    changed = input.hasChanged();
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "ChangeFileEncodingDialog.Shell.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Stepname line
    wlStepname = new Label(shell, SWT.RIGHT);
    wlStepname.setText(BaseMessages.getString(PKG, "ChangeFileEncodingDialog.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);
    // /////////////////////////////////
    // START OF SourceFile GROUP
    // /////////////////////////////////
    wSourceFileGroup = new Group(shell, SWT.SHADOW_NONE);
    props.setLook(wSourceFileGroup);
    wSourceFileGroup.setText(BaseMessages.getString(PKG, "ChangeFileEncodingDialog.Group.SourceFileGroup.Label"));
    FormLayout SourceFilegroupLayout = new FormLayout();
    SourceFilegroupLayout.marginWidth = 10;
    SourceFilegroupLayout.marginHeight = 10;
    wSourceFileGroup.setLayout(SourceFilegroupLayout);
    // filename field
    wlFileName = new Label(wSourceFileGroup, SWT.RIGHT);
    wlFileName.setText(BaseMessages.getString(PKG, "ChangeFileEncodingDialog.FileName.Label"));
    props.setLook(wlFileName);
    fdlFileName = new FormData();
    fdlFileName.left = new FormAttachment(0, 0);
    fdlFileName.right = new FormAttachment(middle, -margin);
    fdlFileName.top = new FormAttachment(wStepname, margin);
    wlFileName.setLayoutData(fdlFileName);
    wFileName = new CCombo(wSourceFileGroup, SWT.BORDER | SWT.READ_ONLY);
    wFileName.setEditable(true);
    props.setLook(wFileName);
    wFileName.addModifyListener(lsMod);
    fdfileName = new FormData();
    fdfileName.left = new FormAttachment(middle, 0);
    fdfileName.top = new FormAttachment(wStepname, margin);
    fdfileName.right = new FormAttachment(100, -margin);
    wFileName.setLayoutData(fdfileName);
    wFileName.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            get();
        }
    });
    wlSourceEncoding = new Label(wSourceFileGroup, SWT.RIGHT);
    wlSourceEncoding.setText(BaseMessages.getString(PKG, "ChangeFileSourceEncodingDialog.SourceEncoding.Label"));
    props.setLook(wlSourceEncoding);
    fdlSourceEncoding = new FormData();
    fdlSourceEncoding.left = new FormAttachment(0, 0);
    fdlSourceEncoding.top = new FormAttachment(wFileName, margin);
    fdlSourceEncoding.right = new FormAttachment(middle, -margin);
    wlSourceEncoding.setLayoutData(fdlSourceEncoding);
    wSourceEncoding = new ComboVar(transMeta, wSourceFileGroup, SWT.BORDER | SWT.READ_ONLY);
    wSourceEncoding.setEditable(true);
    props.setLook(wSourceEncoding);
    wSourceEncoding.addModifyListener(lsMod);
    fdSourceEncoding = new FormData();
    fdSourceEncoding.left = new FormAttachment(middle, 0);
    fdSourceEncoding.top = new FormAttachment(wFileName, margin);
    fdSourceEncoding.right = new FormAttachment(100, 0);
    wSourceEncoding.setLayoutData(fdSourceEncoding);
    wSourceEncoding.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            setEncodings(wSourceEncoding);
        }
    });
    // Add filename to result filenames?
    wlSourceAddResult = new Label(wSourceFileGroup, SWT.RIGHT);
    wlSourceAddResult.setText(BaseMessages.getString(PKG, "ChangeFileEncodingDialog.AddSourceResult.Label"));
    props.setLook(wlSourceAddResult);
    fdlSourceAddResult = new FormData();
    fdlSourceAddResult.left = new FormAttachment(0, 0);
    fdlSourceAddResult.top = new FormAttachment(wSourceEncoding, margin);
    fdlSourceAddResult.right = new FormAttachment(middle, -margin);
    wlSourceAddResult.setLayoutData(fdlSourceAddResult);
    wSourceAddResult = new Button(wSourceFileGroup, SWT.CHECK);
    props.setLook(wSourceAddResult);
    wSourceAddResult.setToolTipText(BaseMessages.getString(PKG, "ChangeFileEncodingDialog.AddSourceResult.Tooltip"));
    fdSourceAddResult = new FormData();
    fdSourceAddResult.left = new FormAttachment(middle, 0);
    fdSourceAddResult.top = new FormAttachment(wSourceEncoding, margin);
    wSourceAddResult.setLayoutData(fdSourceAddResult);
    wSourceAddResult.addSelectionListener(new ComponentSelectionListener(input));
    fdSourceFileGroup = new FormData();
    fdSourceFileGroup.left = new FormAttachment(0, margin);
    fdSourceFileGroup.top = new FormAttachment(wStepname, margin);
    fdSourceFileGroup.right = new FormAttachment(100, -margin);
    wSourceFileGroup.setLayoutData(fdSourceFileGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF SourceFile GROUP
    // ///////////////////////////////////////////////////////////
    // /////////////////////////////////
    // START OF TargetFile GROUP
    // /////////////////////////////////
    wTargetFileGroup = new Group(shell, SWT.SHADOW_NONE);
    props.setLook(wTargetFileGroup);
    wTargetFileGroup.setText(BaseMessages.getString(PKG, "ChangeFileEncodingDialog.Group.TargetFileGroup.Label"));
    FormLayout TargetFilegroupLayout = new FormLayout();
    TargetFilegroupLayout.marginWidth = 10;
    TargetFilegroupLayout.marginHeight = 10;
    wTargetFileGroup.setLayout(TargetFilegroupLayout);
    // TargetFileName field
    wlTargetFileName = new Label(wTargetFileGroup, SWT.RIGHT);
    wlTargetFileName.setText(BaseMessages.getString(PKG, "ChangeFileEncodingDialog.TargetFileName.Label"));
    props.setLook(wlTargetFileName);
    fdlTargetFileName = new FormData();
    fdlTargetFileName.left = new FormAttachment(0, 0);
    fdlTargetFileName.right = new FormAttachment(middle, -margin);
    fdlTargetFileName.top = new FormAttachment(wSourceEncoding, margin);
    wlTargetFileName.setLayoutData(fdlTargetFileName);
    wTargetFileName = new CCombo(wTargetFileGroup, SWT.BORDER | SWT.READ_ONLY);
    wTargetFileName.setEditable(true);
    props.setLook(wTargetFileName);
    wTargetFileName.addModifyListener(lsMod);
    fdTargetFileName = new FormData();
    fdTargetFileName.left = new FormAttachment(middle, 0);
    fdTargetFileName.top = new FormAttachment(wSourceEncoding, margin);
    fdTargetFileName.right = new FormAttachment(100, -margin);
    wTargetFileName.setLayoutData(fdTargetFileName);
    wTargetFileName.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            get();
        }
    });
    // Create parent folder
    wlCreateParentFolder = new Label(wTargetFileGroup, SWT.RIGHT);
    wlCreateParentFolder.setText(BaseMessages.getString(PKG, "ChangeFileEncodingDialog.CreateParentFolder.Label"));
    props.setLook(wlCreateParentFolder);
    fdlCreateParentFolder = new FormData();
    fdlCreateParentFolder.left = new FormAttachment(0, 0);
    fdlCreateParentFolder.top = new FormAttachment(wTargetFileName, margin);
    fdlCreateParentFolder.right = new FormAttachment(middle, -margin);
    wlCreateParentFolder.setLayoutData(fdlCreateParentFolder);
    wCreateParentFolder = new Button(wTargetFileGroup, SWT.CHECK);
    props.setLook(wCreateParentFolder);
    wCreateParentFolder.setToolTipText(BaseMessages.getString(PKG, "ChangeFileEncodingDialog.CreateParentFolder.Tooltip"));
    fdCreateParentFolder = new FormData();
    fdCreateParentFolder.left = new FormAttachment(middle, 0);
    fdCreateParentFolder.top = new FormAttachment(wTargetFileName, margin);
    wCreateParentFolder.setLayoutData(fdCreateParentFolder);
    wCreateParentFolder.addSelectionListener(new ComponentSelectionListener(input));
    wlTargetEncoding = new Label(wTargetFileGroup, SWT.RIGHT);
    wlTargetEncoding.setText(BaseMessages.getString(PKG, "ChangeFileEncodingDialog.TargetEncoding.Label"));
    props.setLook(wlTargetEncoding);
    fdlTargetEncoding = new FormData();
    fdlTargetEncoding.left = new FormAttachment(0, 0);
    fdlTargetEncoding.top = new FormAttachment(wCreateParentFolder, margin);
    fdlTargetEncoding.right = new FormAttachment(middle, -margin);
    wlTargetEncoding.setLayoutData(fdlTargetEncoding);
    wTargetEncoding = new ComboVar(transMeta, wTargetFileGroup, SWT.BORDER | SWT.READ_ONLY);
    wTargetEncoding.setEditable(true);
    props.setLook(wTargetEncoding);
    wTargetEncoding.addModifyListener(lsMod);
    fdTargetEncoding = new FormData();
    fdTargetEncoding.left = new FormAttachment(middle, 0);
    fdTargetEncoding.top = new FormAttachment(wCreateParentFolder, margin);
    fdTargetEncoding.right = new FormAttachment(100, 0);
    wTargetEncoding.setLayoutData(fdTargetEncoding);
    wTargetEncoding.addFocusListener(new FocusListener() {

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

        public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            setEncodings(wTargetEncoding);
        }
    });
    // Add filename to result filenames?
    wlTargetAddResult = new Label(wTargetFileGroup, SWT.RIGHT);
    wlTargetAddResult.setText(BaseMessages.getString(PKG, "ChangeFileEncodingDialog.AddTargetResult.Label"));
    props.setLook(wlTargetAddResult);
    fdlTargetAddResult = new FormData();
    fdlTargetAddResult.left = new FormAttachment(0, 0);
    fdlTargetAddResult.top = new FormAttachment(wTargetEncoding, margin);
    fdlTargetAddResult.right = new FormAttachment(middle, -margin);
    wlTargetAddResult.setLayoutData(fdlTargetAddResult);
    wTargetAddResult = new Button(wTargetFileGroup, SWT.CHECK);
    props.setLook(wTargetAddResult);
    wTargetAddResult.setToolTipText(BaseMessages.getString(PKG, "ChangeFileEncodingDialog.AddTargetResult.Tooltip"));
    fdTargetAddResult = new FormData();
    fdTargetAddResult.left = new FormAttachment(middle, 0);
    fdTargetAddResult.top = new FormAttachment(wTargetEncoding, margin);
    wTargetAddResult.setLayoutData(fdTargetAddResult);
    wTargetAddResult.addSelectionListener(new ComponentSelectionListener(input));
    fdTargetFileGroup = new FormData();
    fdTargetFileGroup.left = new FormAttachment(0, margin);
    fdTargetFileGroup.top = new FormAttachment(wSourceFileGroup, margin);
    fdTargetFileGroup.right = new FormAttachment(100, -margin);
    wTargetFileGroup.setLayoutData(fdTargetFileGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF TargetFile GROUP
    // ///////////////////////////////////////////////////////////
    // 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, wTargetFileGroup);
    // Add listeners
    lsOK = new Listener() {

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

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

        public void widgetDefaultSelected(SelectionEvent e) {
            ok();
        }
    };
    wStepname.addSelectionListener(lsDef);
    // 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 : Group(org.eclipse.swt.widgets.Group) ComboVar(org.pentaho.di.ui.core.widget.ComboVar) FocusListener(org.eclipse.swt.events.FocusListener) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ComponentSelectionListener(org.pentaho.di.ui.trans.step.ComponentSelectionListener) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) ShellEvent(org.eclipse.swt.events.ShellEvent) ComponentSelectionListener(org.pentaho.di.ui.trans.step.ComponentSelectionListener) 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) 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) 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) Display(org.eclipse.swt.widgets.Display)

Example 2 with ComponentSelectionListener

use of org.pentaho.di.ui.trans.step.ComponentSelectionListener in project pentaho-kettle by pentaho.

the class CubeInputDialog method open.

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

        public void modifyText(ModifyEvent e) {
            input.setChanged();
        }
    };
    changed = input.hasChanged();
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "CubeInputDialog.Shell.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Stepname line
    wlStepname = new Label(shell, SWT.RIGHT);
    wlStepname.setText(BaseMessages.getString(PKG, "CubeInputDialog.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);
    // Filename line
    wlFilename = new Label(shell, SWT.RIGHT);
    wlFilename.setText(BaseMessages.getString(PKG, "CubeInputDialog.Filename.Label"));
    props.setLook(wlFilename);
    fdlFilename = new FormData();
    fdlFilename.left = new FormAttachment(0, 0);
    fdlFilename.top = new FormAttachment(wStepname, margin + 5);
    fdlFilename.right = new FormAttachment(middle, -margin);
    wlFilename.setLayoutData(fdlFilename);
    wbFilename = new Button(shell, SWT.PUSH | SWT.CENTER);
    props.setLook(wbFilename);
    wbFilename.setText(BaseMessages.getString(PKG, "CubeInputDialog.FilenameButton.Label"));
    fdbFilename = new FormData();
    fdbFilename.right = new FormAttachment(100, 0);
    fdbFilename.top = new FormAttachment(wStepname, margin + 5);
    wbFilename.setLayoutData(fdbFilename);
    wFilename = new TextVar(transMeta, shell, 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(wStepname, margin + 5);
    fdFilename.right = new FormAttachment(wbFilename, -margin);
    wFilename.setLayoutData(fdFilename);
    // Limit input ...
    wlLimit = new Label(shell, SWT.RIGHT);
    wlLimit.setText(BaseMessages.getString(PKG, "CubeInputDialog.Limit.Label"));
    props.setLook(wlLimit);
    fdlLimit = new FormData();
    fdlLimit.left = new FormAttachment(0, 0);
    fdlLimit.right = new FormAttachment(middle, -margin);
    fdlLimit.top = new FormAttachment(wFilename, margin);
    wlLimit.setLayoutData(fdlLimit);
    wLimit = new Text(shell, 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(wFilename, margin);
    fdLimit.right = new FormAttachment(100, 0);
    wLimit.setLayoutData(fdLimit);
    // Add filename to result filenames
    wlAddResult = new Label(shell, SWT.RIGHT);
    wlAddResult.setText(BaseMessages.getString(PKG, "CubeInputDialog.AddResult.Label"));
    props.setLook(wlAddResult);
    fdlAddResult = new FormData();
    fdlAddResult.left = new FormAttachment(0, 0);
    fdlAddResult.top = new FormAttachment(wLimit, 2 * margin);
    fdlAddResult.right = new FormAttachment(middle, -margin);
    wlAddResult.setLayoutData(fdlAddResult);
    wAddResult = new Button(shell, SWT.CHECK);
    props.setLook(wAddResult);
    wAddResult.setToolTipText(BaseMessages.getString(PKG, "CubeInputDialog.AddResult.Tooltip"));
    fdAddResult = new FormData();
    fdAddResult.left = new FormAttachment(middle, 0);
    fdAddResult.top = new FormAttachment(wLimit, 2 * margin);
    wAddResult.setLayoutData(fdAddResult);
    wAddResult.addSelectionListener(new ComponentSelectionListener(input));
    // 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, wAddResult);
    // 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);
    wbFilename.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.OPEN);
            dialog.setFilterExtensions(new String[] { "*.cube", "*" });
            if (wFilename.getText() != null) {
                dialog.setFileName(wFilename.getText());
            }
            dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "CubeInputDialog.FilterNames.CubeFiles"), BaseMessages.getString(PKG, "CubeInputDialog.FilterNames.AllFiles") });
            if (dialog.open() != null) {
                wFilename.setText(dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName());
            }
        }
    });
    lsDef = new SelectionAdapter() {

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

        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    getData();
    input.setChanged(changed);
    // Set the shell size, based upon previous time...
    setSize();
    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) ComponentSelectionListener(org.pentaho.di.ui.trans.step.ComponentSelectionListener) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) ShellEvent(org.eclipse.swt.events.ShellEvent) Text(org.eclipse.swt.widgets.Text) ComponentSelectionListener(org.pentaho.di.ui.trans.step.ComponentSelectionListener) TextVar(org.pentaho.di.ui.core.widget.TextVar) 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) FileDialog(org.eclipse.swt.widgets.FileDialog) FormAttachment(org.eclipse.swt.layout.FormAttachment) Display(org.eclipse.swt.widgets.Display)

Example 3 with ComponentSelectionListener

use of org.pentaho.di.ui.trans.step.ComponentSelectionListener in project pentaho-kettle by pentaho.

the class SortRowsDialog 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, "SortRowsDialog.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.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);
    // Temp directory for sorting
    wlSortDir = new Label(shell, SWT.RIGHT);
    wlSortDir.setText(BaseMessages.getString(PKG, "SortRowsDialog.SortDir.Label"));
    props.setLook(wlSortDir);
    fdlSortDir = new FormData();
    fdlSortDir.left = new FormAttachment(0, 0);
    fdlSortDir.right = new FormAttachment(middle, -margin);
    fdlSortDir.top = new FormAttachment(wStepname, margin);
    wlSortDir.setLayoutData(fdlSortDir);
    wbSortDir = new Button(shell, SWT.PUSH | SWT.CENTER);
    props.setLook(wbSortDir);
    wbSortDir.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    fdbSortDir = new FormData();
    fdbSortDir.right = new FormAttachment(100, 0);
    fdbSortDir.top = new FormAttachment(wStepname, margin);
    wbSortDir.setLayoutData(fdbSortDir);
    wSortDir = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wSortDir.setText("temp");
    props.setLook(wSortDir);
    wSortDir.addModifyListener(lsMod);
    fdSortDir = new FormData();
    fdSortDir.left = new FormAttachment(middle, 0);
    fdSortDir.top = new FormAttachment(wStepname, margin);
    fdSortDir.right = new FormAttachment(wbSortDir, -margin);
    wSortDir.setLayoutData(fdSortDir);
    wbSortDir.addSelectionListener(new SelectionAdapter() {

        @Override
        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() {

        @Override
        public void modifyText(ModifyEvent e) {
            wSortDir.setToolTipText(transMeta.environmentSubstitute(wSortDir.getText()));
        }
    });
    // Prefix of temporary file
    wlPrefix = new Label(shell, SWT.RIGHT);
    wlPrefix.setText(BaseMessages.getString(PKG, "SortRowsDialog.Prefix.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);
    wPrefix.setText("srt");
    // Maximum number of lines to keep in memory before using temporary files
    wlSortSize = new Label(shell, SWT.RIGHT);
    wlSortSize.setText(BaseMessages.getString(PKG, "SortRowsDialog.SortSize.Label"));
    props.setLook(wlSortSize);
    fdlSortSize = new FormData();
    fdlSortSize.left = new FormAttachment(0, 0);
    fdlSortSize.right = new FormAttachment(middle, -margin);
    fdlSortSize.top = new FormAttachment(wPrefix, margin * 2);
    wlSortSize.setLayoutData(fdlSortSize);
    wSortSize = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wSortSize);
    wSortSize.addModifyListener(lsMod);
    fdSortSize = new FormData();
    fdSortSize.left = new FormAttachment(middle, 0);
    fdSortSize.top = new FormAttachment(wPrefix, margin * 2);
    fdSortSize.right = new FormAttachment(100, 0);
    wSortSize.setLayoutData(fdSortSize);
    // Free Memory to keep
    wlFreeMemory = new Label(shell, SWT.RIGHT);
    wlFreeMemory.setText(BaseMessages.getString(PKG, "SortRowsDialog.FreeMemory.Label"));
    wlFreeMemory.setToolTipText(BaseMessages.getString(PKG, "SortRowsDialog.FreeMemory.ToolTip"));
    props.setLook(wlFreeMemory);
    fdlFreeMemory = new FormData();
    fdlFreeMemory.left = new FormAttachment(0, 0);
    fdlFreeMemory.right = new FormAttachment(middle, -margin);
    fdlFreeMemory.top = new FormAttachment(wSortSize, margin * 2);
    wlFreeMemory.setLayoutData(fdlFreeMemory);
    wFreeMemory = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wFreeMemory.setToolTipText(BaseMessages.getString(PKG, "SortRowsDialog.FreeMemory.ToolTip"));
    props.setLook(wFreeMemory);
    wFreeMemory.addModifyListener(lsMod);
    fdFreeMemory = new FormData();
    fdFreeMemory.left = new FormAttachment(middle, 0);
    fdFreeMemory.top = new FormAttachment(wSortSize, margin * 2);
    fdFreeMemory.right = new FormAttachment(100, 0);
    wFreeMemory.setLayoutData(fdFreeMemory);
    // Using compression for temporary files?
    wlCompress = new Label(shell, SWT.RIGHT);
    wlCompress.setText(BaseMessages.getString(PKG, "SortRowsDialog.Compress.Label"));
    props.setLook(wlCompress);
    fdlCompress = new FormData();
    fdlCompress.left = new FormAttachment(0, 0);
    fdlCompress.right = new FormAttachment(middle, -margin);
    fdlCompress.top = new FormAttachment(wFreeMemory, margin * 2);
    wlCompress.setLayoutData(fdlCompress);
    wCompress = new CheckBoxVar(transMeta, shell, SWT.CHECK, "");
    props.setLook(wCompress);
    fdCompress = new FormData();
    fdCompress.left = new FormAttachment(middle, 0);
    fdCompress.top = new FormAttachment(wFreeMemory, margin * 2);
    fdCompress.right = new FormAttachment(100, 0);
    wCompress.setLayoutData(fdCompress);
    wCompress.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            log.logDetailed("SortRowsDialog", "Selection Listener for compress: " + wCompress.getSelection());
            input.setChanged();
        }
    });
    // Using compression for temporary files?
    wlUniqueRows = new Label(shell, SWT.RIGHT);
    wlUniqueRows.setText(BaseMessages.getString(PKG, "SortRowsDialog.UniqueRows.Label"));
    props.setLook(wlUniqueRows);
    fdlUniqueRows = new FormData();
    fdlUniqueRows.left = new FormAttachment(0, 0);
    fdlUniqueRows.right = new FormAttachment(middle, -margin);
    fdlUniqueRows.top = new FormAttachment(wCompress, margin);
    wlUniqueRows.setLayoutData(fdlUniqueRows);
    wUniqueRows = new Button(shell, SWT.CHECK);
    wUniqueRows.setToolTipText(BaseMessages.getString(PKG, "SortRowsDialog.UniqueRows.Tooltip"));
    props.setLook(wUniqueRows);
    fdUniqueRows = new FormData();
    fdUniqueRows.left = new FormAttachment(middle, 0);
    fdUniqueRows.top = new FormAttachment(wCompress, margin);
    fdUniqueRows.right = new FormAttachment(100, 0);
    wUniqueRows.setLayoutData(fdUniqueRows);
    wUniqueRows.addSelectionListener(new ComponentSelectionListener(input));
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wGet = new Button(shell, SWT.PUSH);
    wGet.setText(BaseMessages.getString(PKG, "System.Button.GetFields"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    setButtonPositions(new Button[] { wOK, wCancel, wGet }, margin, null);
    // Table with fields to sort and sort direction
    wlFields = new Label(shell, SWT.NONE);
    wlFields.setText(BaseMessages.getString(PKG, "SortRowsDialog.Fields.Label"));
    props.setLook(wlFields);
    fdlFields = new FormData();
    fdlFields.left = new FormAttachment(0, 0);
    fdlFields.top = new FormAttachment(wUniqueRows, margin);
    wlFields.setLayoutData(fdlFields);
    final int FieldsRows = input.getFieldName().length;
    colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "SortRowsDialog.Fieldname.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "SortRowsDialog.Ascending.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }), new ColumnInfo(BaseMessages.getString(PKG, "SortRowsDialog.CaseInsensitive.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }), new ColumnInfo(BaseMessages.getString(PKG, "SortRowsDialog.CollatorDisabled.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }), new ColumnInfo(BaseMessages.getString(PKG, "SortRowsDialog.CollatorStrength.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Primary"), BaseMessages.getString(PKG, "System.Combo.Secondary"), BaseMessages.getString(PKG, "System.Combo.Tertiary"), BaseMessages.getString(PKG, "System.Combo.Identical") }, true), new ColumnInfo(BaseMessages.getString(PKG, "SortRowsDialog.PreSortedField.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }) };
    wFields = new TableView(transMeta, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
    fdFields = new FormData();
    fdFields.left = new FormAttachment(0, 0);
    fdFields.top = new FormAttachment(wlFields, margin);
    fdFields.right = new FormAttachment(100, 0);
    fdFields.bottom = new FormAttachment(wOK, -2 * 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();
    // Add listeners
    lsOK = new Listener() {

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

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

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

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

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

        @Override
        public void handleEvent(Event event) {
            Point size = shell.getSize();
            wFields.setSize(size.x - 10, size.y - 50);
            wFields.table.setSize(size.x - 10, size.y - 50);
            wFields.redraw();
        }
    };
    shell.addListener(SWT.Resize, lsResize);
    // 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 : KettleException(org.pentaho.di.core.exception.KettleException) TableItemInsertListener(org.pentaho.di.ui.trans.step.TableItemInsertListener) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ComponentSelectionListener(org.pentaho.di.ui.trans.step.ComponentSelectionListener) 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) ComponentSelectionListener(org.pentaho.di.ui.trans.step.ComponentSelectionListener) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) CheckBoxVar(org.pentaho.di.ui.core.widget.CheckBoxVar) 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) 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) 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)

Example 4 with ComponentSelectionListener

use of org.pentaho.di.ui.trans.step.ComponentSelectionListener in project pentaho-kettle by pentaho.

the class SplitFieldToRowsDialog method open.

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

        public void modifyText(ModifyEvent e) {
            input.setChanged();
        }
    };
    changed = input.hasChanged();
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "SplitFieldToRowsDialog.Shell.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Stepname line
    wlStepname = new Label(shell, SWT.RIGHT);
    wlStepname.setText(BaseMessages.getString(PKG, "SplitFieldToRowsDialog.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);
    // Typefield line
    wlSplitfield = new Label(shell, SWT.RIGHT);
    wlSplitfield.setText(BaseMessages.getString(PKG, "SplitFieldToRowsDialog.SplitField.Label"));
    props.setLook(wlSplitfield);
    fdlSplitfield = new FormData();
    fdlSplitfield.left = new FormAttachment(0, 0);
    fdlSplitfield.right = new FormAttachment(middle, -margin);
    fdlSplitfield.top = new FormAttachment(wStepname, margin);
    wlSplitfield.setLayoutData(fdlSplitfield);
    wSplitfield = new ComboVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wSplitfield.setToolTipText(BaseMessages.getString(PKG, "SplitFieldToRowsDialog.UrlField.Tooltip"));
    props.setLook(wSplitfield);
    wSplitfield.addModifyListener(lsMod);
    fdSplitfield = new FormData();
    fdSplitfield.left = new FormAttachment(middle, 0);
    fdSplitfield.top = new FormAttachment(wStepname, margin);
    fdSplitfield.right = new FormAttachment(100, 0);
    wSplitfield.setLayoutData(fdSplitfield);
    wSplitfield.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);
            BaseStepDialog.getFieldsFromPrevious(wSplitfield, transMeta, stepMeta);
            shell.setCursor(null);
            busy.dispose();
        }
    });
    // Delimiter line
    wlDelimiter = new Label(shell, SWT.RIGHT);
    wlDelimiter.setText(BaseMessages.getString(PKG, "SplitFieldToRowsDialog.Delimiter.Label"));
    props.setLook(wlDelimiter);
    fdlDelimiter = new FormData();
    fdlDelimiter.left = new FormAttachment(0, 0);
    fdlDelimiter.right = new FormAttachment(middle, -margin);
    fdlDelimiter.top = new FormAttachment(wSplitfield, margin);
    wlDelimiter.setLayoutData(fdlDelimiter);
    wDelimiter = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wDelimiter.setText("");
    props.setLook(wDelimiter);
    wDelimiter.addModifyListener(lsMod);
    fdDelimiter = new FormData();
    fdDelimiter.left = new FormAttachment(middle, 0);
    fdDelimiter.top = new FormAttachment(wSplitfield, margin);
    fdDelimiter.right = new FormAttachment(100, 0);
    wDelimiter.setLayoutData(fdDelimiter);
    // Add File to the result files name
    Label wlDelimiterIsRegex = new Label(shell, SWT.RIGHT);
    wlDelimiterIsRegex.setText(BaseMessages.getString(PKG, "SplitFieldToRowsDialog.DelimiterIsRegex.Label"));
    props.setLook(wlDelimiterIsRegex);
    FormData fdlDelimiterIsRegex = new FormData();
    fdlDelimiterIsRegex.left = new FormAttachment(0, 0);
    fdlDelimiterIsRegex.top = new FormAttachment(wDelimiter);
    fdlDelimiterIsRegex.right = new FormAttachment(middle, -margin);
    wlDelimiterIsRegex.setLayoutData(fdlDelimiterIsRegex);
    wDelimiterIsRegex = new Button(shell, SWT.CHECK);
    wDelimiterIsRegex.setToolTipText(BaseMessages.getString(PKG, "SplitFieldToRowsDialog.DelimiterIsRegex.Tooltip"));
    props.setLook(wDelimiterIsRegex);
    FormData fdDelimiterIsRegex = new FormData();
    fdDelimiterIsRegex.left = new FormAttachment(middle, 0);
    fdDelimiterIsRegex.top = new FormAttachment(wDelimiter);
    fdDelimiterIsRegex.right = new FormAttachment(100, 0);
    wDelimiterIsRegex.setLayoutData(fdDelimiterIsRegex);
    SelectionAdapter lsSelR = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            input.setChanged();
        }
    };
    wDelimiterIsRegex.addSelectionListener(lsSelR);
    // ValName line
    wlValName = new Label(shell, SWT.RIGHT);
    wlValName.setText(BaseMessages.getString(PKG, "SplitFieldToRowsDialog.NewFieldName.Label"));
    props.setLook(wlValName);
    fdlValName = new FormData();
    fdlValName.left = new FormAttachment(0, 0);
    fdlValName.right = new FormAttachment(middle, -margin);
    fdlValName.top = new FormAttachment(wDelimiterIsRegex, margin);
    wlValName.setLayoutData(fdlValName);
    wValName = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wValName.setText("");
    props.setLook(wValName);
    wValName.addModifyListener(lsMod);
    fdValName = new FormData();
    fdValName.left = new FormAttachment(middle, 0);
    fdValName.right = new FormAttachment(100, 0);
    fdValName.top = new FormAttachment(wDelimiterIsRegex, margin);
    wValName.setLayoutData(fdValName);
    // ///////////////////////////////
    // START OF Additional Fields GROUP //
    // ///////////////////////////////
    wAdditionalFields = new Group(shell, SWT.SHADOW_NONE);
    props.setLook(wAdditionalFields);
    wAdditionalFields.setText(BaseMessages.getString(PKG, "SplitFieldToRowsDialog.wAdditionalFields.Label"));
    FormLayout AdditionalFieldsgroupLayout = new FormLayout();
    AdditionalFieldsgroupLayout.marginWidth = 10;
    AdditionalFieldsgroupLayout.marginHeight = 10;
    wAdditionalFields.setLayout(AdditionalFieldsgroupLayout);
    wlInclRownum = new Label(wAdditionalFields, SWT.RIGHT);
    wlInclRownum.setText(BaseMessages.getString(PKG, "SplitFieldToRowsDialog.InclRownum.Label"));
    props.setLook(wlInclRownum);
    fdlInclRownum = new FormData();
    fdlInclRownum.left = new FormAttachment(0, 0);
    fdlInclRownum.top = new FormAttachment(wValName, margin);
    fdlInclRownum.right = new FormAttachment(middle, -margin);
    wlInclRownum.setLayoutData(fdlInclRownum);
    wInclRownum = new Button(wAdditionalFields, SWT.CHECK);
    props.setLook(wInclRownum);
    wInclRownum.setToolTipText(BaseMessages.getString(PKG, "SplitFieldToRowsDialog.InclRownum.Tooltip"));
    fdRownum = new FormData();
    fdRownum.left = new FormAttachment(middle, 0);
    fdRownum.top = new FormAttachment(wValName, margin);
    wInclRownum.setLayoutData(fdRownum);
    wInclRownum.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            setIncludeRownum();
            input.setChanged();
        }
    });
    wlInclRownumField = new Label(wAdditionalFields, SWT.RIGHT);
    wlInclRownumField.setText(BaseMessages.getString(PKG, "SplitFieldToRowsDialog.InclRownumField.Label"));
    props.setLook(wlInclRownumField);
    fdlInclRownumField = new FormData();
    fdlInclRownumField.left = new FormAttachment(wInclRownum, margin);
    fdlInclRownumField.top = new FormAttachment(wValName, margin);
    wlInclRownumField.setLayoutData(fdlInclRownumField);
    wInclRownumField = new TextVar(transMeta, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wInclRownumField);
    wInclRownumField.addModifyListener(lsMod);
    fdInclRownumField = new FormData();
    fdInclRownumField.left = new FormAttachment(wlInclRownumField, margin);
    fdInclRownumField.top = new FormAttachment(wValName, margin);
    fdInclRownumField.right = new FormAttachment(100, 0);
    wInclRownumField.setLayoutData(fdInclRownumField);
    wlResetRownum = new Label(wAdditionalFields, SWT.RIGHT);
    wlResetRownum.setText(BaseMessages.getString(PKG, "SplitFieldToRowsDialog.ResetRownum.Label"));
    props.setLook(wlResetRownum);
    fdlResetRownum = new FormData();
    fdlResetRownum.left = new FormAttachment(wInclRownum, margin);
    fdlResetRownum.top = new FormAttachment(wInclRownumField, margin);
    wlResetRownum.setLayoutData(fdlResetRownum);
    wResetRownum = new Button(wAdditionalFields, SWT.CHECK);
    props.setLook(wResetRownum);
    wResetRownum.setToolTipText(BaseMessages.getString(PKG, "SplitFieldToRowsDialog.ResetRownum.Tooltip"));
    fdRownum = new FormData();
    fdRownum.left = new FormAttachment(wlResetRownum, margin);
    fdRownum.top = new FormAttachment(wInclRownumField, margin);
    wResetRownum.setLayoutData(fdRownum);
    wResetRownum.addSelectionListener(new ComponentSelectionListener(input));
    fdAdditionalFields = new FormData();
    fdAdditionalFields.left = new FormAttachment(0, margin);
    fdAdditionalFields.top = new FormAttachment(wValName, margin);
    fdAdditionalFields.right = new FormAttachment(100, -margin);
    wAdditionalFields.setLayoutData(fdAdditionalFields);
    // ///////////////////////////////
    // END OF Additional Fields GROUP //
    // ///////////////////////////////
    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"));
    BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wAdditionalFields);
    // Add listeners
    lsOK = new Listener() {

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

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

        public void widgetDefaultSelected(SelectionEvent e) {
            ok();
        }
    };
    wStepname.addSelectionListener(lsDef);
    wValName.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 : Group(org.eclipse.swt.widgets.Group) ComboVar(org.pentaho.di.ui.core.widget.ComboVar) FocusListener(org.eclipse.swt.events.FocusListener) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ComponentSelectionListener(org.pentaho.di.ui.trans.step.ComponentSelectionListener) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) ShellEvent(org.eclipse.swt.events.ShellEvent) Cursor(org.eclipse.swt.graphics.Cursor) ComponentSelectionListener(org.pentaho.di.ui.trans.step.ComponentSelectionListener) 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) 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) 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) FocusListener(org.eclipse.swt.events.FocusListener) Display(org.eclipse.swt.widgets.Display)

Example 5 with ComponentSelectionListener

use of org.pentaho.di.ui.trans.step.ComponentSelectionListener in project pentaho-kettle by pentaho.

the class ExcelInputDialog method addErrorTab.

private void addErrorTab() {
    // 
    // START OF ERROR TAB /
    // /
    wErrorTab = new CTabItem(wTabFolder, SWT.NONE);
    wErrorTab.setText(BaseMessages.getString(PKG, "ExcelInputDialog.ErrorTab.TabTitle"));
    FormLayout errorLayout = new FormLayout();
    errorLayout.marginWidth = 3;
    errorLayout.marginHeight = 3;
    wErrorComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wErrorComp);
    wErrorComp.setLayout(errorLayout);
    // ERROR HANDLING...
    // ErrorIgnored?
    wlStrictTypes = new Label(wErrorComp, SWT.RIGHT);
    wlStrictTypes.setText(BaseMessages.getString(PKG, "ExcelInputDialog.StrictTypes.Label"));
    props.setLook(wlStrictTypes);
    fdlStrictTypes = new FormData();
    fdlStrictTypes.left = new FormAttachment(0, 0);
    fdlStrictTypes.top = new FormAttachment(0, margin);
    fdlStrictTypes.right = new FormAttachment(middle, -margin);
    wlStrictTypes.setLayoutData(fdlStrictTypes);
    wStrictTypes = new Button(wErrorComp, SWT.CHECK);
    props.setLook(wStrictTypes);
    wStrictTypes.setToolTipText(BaseMessages.getString(PKG, "ExcelInputDialog.StrictTypes.Tooltip"));
    fdStrictTypes = new FormData();
    fdStrictTypes.left = new FormAttachment(middle, 0);
    fdStrictTypes.top = new FormAttachment(0, margin);
    wStrictTypes.setLayoutData(fdStrictTypes);
    Control previous = wStrictTypes;
    wStrictTypes.addSelectionListener(new ComponentSelectionListener(input));
    // ErrorIgnored?
    wlErrorIgnored = new Label(wErrorComp, SWT.RIGHT);
    wlErrorIgnored.setText(BaseMessages.getString(PKG, "ExcelInputDialog.ErrorIgnored.Label"));
    props.setLook(wlErrorIgnored);
    fdlErrorIgnored = new FormData();
    fdlErrorIgnored.left = new FormAttachment(0, 0);
    fdlErrorIgnored.top = new FormAttachment(previous, margin);
    fdlErrorIgnored.right = new FormAttachment(middle, -margin);
    wlErrorIgnored.setLayoutData(fdlErrorIgnored);
    wErrorIgnored = new Button(wErrorComp, SWT.CHECK);
    props.setLook(wErrorIgnored);
    wErrorIgnored.setToolTipText(BaseMessages.getString(PKG, "ExcelInputDialog.ErrorIgnored.Tooltip"));
    fdErrorIgnored = new FormData();
    fdErrorIgnored.left = new FormAttachment(middle, 0);
    fdErrorIgnored.top = new FormAttachment(previous, margin);
    wErrorIgnored.setLayoutData(fdErrorIgnored);
    previous = wErrorIgnored;
    wErrorIgnored.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            setFlags();
            input.setChanged();
        }
    });
    // Skip error lines?
    wlSkipErrorLines = new Label(wErrorComp, SWT.RIGHT);
    wlSkipErrorLines.setText(BaseMessages.getString(PKG, "ExcelInputDialog.SkipErrorLines.Label"));
    props.setLook(wlSkipErrorLines);
    fdlSkipErrorLines = new FormData();
    fdlSkipErrorLines.left = new FormAttachment(0, 0);
    fdlSkipErrorLines.top = new FormAttachment(previous, margin);
    fdlSkipErrorLines.right = new FormAttachment(middle, -margin);
    wlSkipErrorLines.setLayoutData(fdlSkipErrorLines);
    wSkipErrorLines = new Button(wErrorComp, SWT.CHECK);
    props.setLook(wSkipErrorLines);
    wSkipErrorLines.setToolTipText(BaseMessages.getString(PKG, "ExcelInputDialog.SkipErrorLines.Tooltip"));
    fdSkipErrorLines = new FormData();
    fdSkipErrorLines.left = new FormAttachment(middle, 0);
    fdSkipErrorLines.top = new FormAttachment(previous, margin);
    wSkipErrorLines.setLayoutData(fdSkipErrorLines);
    wSkipErrorLines.addSelectionListener(new ComponentSelectionListener(input));
    previous = wSkipErrorLines;
    // Bad lines files directory + extention
    // WarningDestDir line
    wlWarningDestDir = new Label(wErrorComp, SWT.RIGHT);
    wlWarningDestDir.setText(BaseMessages.getString(PKG, "ExcelInputDialog.WarningDestDir.Label"));
    props.setLook(wlWarningDestDir);
    fdlWarningDestDir = new FormData();
    fdlWarningDestDir.left = new FormAttachment(0, 0);
    fdlWarningDestDir.top = new FormAttachment(previous, margin * 4);
    fdlWarningDestDir.right = new FormAttachment(middle, -margin);
    wlWarningDestDir.setLayoutData(fdlWarningDestDir);
    wbbWarningDestDir = new Button(wErrorComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbbWarningDestDir);
    wbbWarningDestDir.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    wbbWarningDestDir.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.BrowseForDir"));
    fdbWarningDestDir = new FormData();
    fdbWarningDestDir.right = new FormAttachment(100, 0);
    fdbWarningDestDir.top = new FormAttachment(previous, margin * 4);
    wbbWarningDestDir.setLayoutData(fdbWarningDestDir);
    wbvWarningDestDir = new Button(wErrorComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbvWarningDestDir);
    wbvWarningDestDir.setText(BaseMessages.getString(PKG, "System.Button.Variable"));
    wbvWarningDestDir.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.VariableToDir"));
    fdbvWarningDestDir = new FormData();
    fdbvWarningDestDir.right = new FormAttachment(wbbWarningDestDir, -margin);
    fdbvWarningDestDir.top = new FormAttachment(previous, margin * 4);
    wbvWarningDestDir.setLayoutData(fdbvWarningDestDir);
    wWarningExt = new Text(wErrorComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wWarningExt);
    wWarningExt.addModifyListener(lsMod);
    fdWarningDestExt = new FormData();
    fdWarningDestExt.left = new FormAttachment(wbvWarningDestDir, -150);
    fdWarningDestExt.right = new FormAttachment(wbvWarningDestDir, -margin);
    fdWarningDestExt.top = new FormAttachment(previous, margin * 4);
    wWarningExt.setLayoutData(fdWarningDestExt);
    wlWarningExt = new Label(wErrorComp, SWT.RIGHT);
    wlWarningExt.setText(BaseMessages.getString(PKG, "System.Label.Extension"));
    props.setLook(wlWarningExt);
    fdlWarningDestExt = new FormData();
    fdlWarningDestExt.top = new FormAttachment(previous, margin * 4);
    fdlWarningDestExt.right = new FormAttachment(wWarningExt, -margin);
    wlWarningExt.setLayoutData(fdlWarningDestExt);
    wWarningDestDir = new Text(wErrorComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wWarningDestDir);
    wWarningDestDir.addModifyListener(lsMod);
    fdWarningDestDir = new FormData();
    fdWarningDestDir.left = new FormAttachment(middle, 0);
    fdWarningDestDir.right = new FormAttachment(wlWarningExt, -margin);
    fdWarningDestDir.top = new FormAttachment(previous, margin * 4);
    wWarningDestDir.setLayoutData(fdWarningDestDir);
    // Listen to the Browse... button
    wbbWarningDestDir.addSelectionListener(DirectoryDialogButtonListenerFactory.getSelectionAdapter(shell, wWarningDestDir));
    // Listen to the Variable... button
    wbvWarningDestDir.addSelectionListener(VariableButtonListenerFactory.getSelectionAdapter(shell, wWarningDestDir, transMeta));
    // Whenever something changes, set the tooltip to the expanded version of the directory:
    wWarningDestDir.addModifyListener(getModifyListenerTooltipText(wWarningDestDir));
    // Error lines files directory + extention
    previous = wWarningDestDir;
    // ErrorDestDir line
    wlErrorDestDir = new Label(wErrorComp, SWT.RIGHT);
    wlErrorDestDir.setText(BaseMessages.getString(PKG, "ExcelInputDialog.ErrorDestDir.Label"));
    props.setLook(wlErrorDestDir);
    fdlErrorDestDir = new FormData();
    fdlErrorDestDir.left = new FormAttachment(0, 0);
    fdlErrorDestDir.top = new FormAttachment(previous, margin);
    fdlErrorDestDir.right = new FormAttachment(middle, -margin);
    wlErrorDestDir.setLayoutData(fdlErrorDestDir);
    wbbErrorDestDir = new Button(wErrorComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbbErrorDestDir);
    wbbErrorDestDir.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    wbbErrorDestDir.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.BrowseForDir"));
    fdbErrorDestDir = new FormData();
    fdbErrorDestDir.right = new FormAttachment(100, 0);
    fdbErrorDestDir.top = new FormAttachment(previous, margin);
    wbbErrorDestDir.setLayoutData(fdbErrorDestDir);
    wbvErrorDestDir = new Button(wErrorComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbvErrorDestDir);
    wbvErrorDestDir.setText(BaseMessages.getString(PKG, "System.Button.Variable"));
    wbvErrorDestDir.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.VariableToDir"));
    fdbvErrorDestDir = new FormData();
    fdbvErrorDestDir.right = new FormAttachment(wbbErrorDestDir, -margin);
    fdbvErrorDestDir.top = new FormAttachment(previous, margin);
    wbvErrorDestDir.setLayoutData(fdbvErrorDestDir);
    wErrorExt = new Text(wErrorComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wErrorExt);
    wErrorExt.addModifyListener(lsMod);
    fdErrorDestExt = new FormData();
    fdErrorDestExt.left = new FormAttachment(wbvErrorDestDir, -150);
    fdErrorDestExt.right = new FormAttachment(wbvErrorDestDir, -margin);
    fdErrorDestExt.top = new FormAttachment(previous, margin);
    wErrorExt.setLayoutData(fdErrorDestExt);
    wlErrorExt = new Label(wErrorComp, SWT.RIGHT);
    wlErrorExt.setText(BaseMessages.getString(PKG, "System.Label.Extension"));
    props.setLook(wlErrorExt);
    fdlErrorDestExt = new FormData();
    fdlErrorDestExt.top = new FormAttachment(previous, margin);
    fdlErrorDestExt.right = new FormAttachment(wErrorExt, -margin);
    wlErrorExt.setLayoutData(fdlErrorDestExt);
    wErrorDestDir = new Text(wErrorComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wErrorDestDir);
    wErrorDestDir.addModifyListener(lsMod);
    fdErrorDestDir = new FormData();
    fdErrorDestDir.left = new FormAttachment(middle, 0);
    fdErrorDestDir.right = new FormAttachment(wlErrorExt, -margin);
    fdErrorDestDir.top = new FormAttachment(previous, margin);
    wErrorDestDir.setLayoutData(fdErrorDestDir);
    // Listen to the Browse... button
    wbbErrorDestDir.addSelectionListener(DirectoryDialogButtonListenerFactory.getSelectionAdapter(shell, wErrorDestDir));
    // Listen to the Variable... button
    wbvErrorDestDir.addSelectionListener(VariableButtonListenerFactory.getSelectionAdapter(shell, wErrorDestDir, transMeta));
    // Whenever something changes, set the tooltip to the expanded version of the directory:
    wErrorDestDir.addModifyListener(getModifyListenerTooltipText(wErrorDestDir));
    // Line numbers files directory + extention
    previous = wErrorDestDir;
    // LineNrDestDir line
    wlLineNrDestDir = new Label(wErrorComp, SWT.RIGHT);
    wlLineNrDestDir.setText(BaseMessages.getString(PKG, "ExcelInputDialog.LineNrDestDir.Label"));
    props.setLook(wlLineNrDestDir);
    fdlLineNrDestDir = new FormData();
    fdlLineNrDestDir.left = new FormAttachment(0, 0);
    fdlLineNrDestDir.top = new FormAttachment(previous, margin);
    fdlLineNrDestDir.right = new FormAttachment(middle, -margin);
    wlLineNrDestDir.setLayoutData(fdlLineNrDestDir);
    wbbLineNrDestDir = new Button(wErrorComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbbLineNrDestDir);
    wbbLineNrDestDir.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    wbbLineNrDestDir.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.BrowseForDir"));
    fdbLineNrDestDir = new FormData();
    fdbLineNrDestDir.right = new FormAttachment(100, 0);
    fdbLineNrDestDir.top = new FormAttachment(previous, margin);
    wbbLineNrDestDir.setLayoutData(fdbLineNrDestDir);
    wbvLineNrDestDir = new Button(wErrorComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbvLineNrDestDir);
    wbvLineNrDestDir.setText(BaseMessages.getString(PKG, "System.Button.Variable"));
    wbvLineNrDestDir.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.VariableToDir"));
    fdbvLineNrDestDir = new FormData();
    fdbvLineNrDestDir.right = new FormAttachment(wbbLineNrDestDir, -margin);
    fdbvLineNrDestDir.top = new FormAttachment(previous, margin);
    wbvLineNrDestDir.setLayoutData(fdbvLineNrDestDir);
    wLineNrExt = new Text(wErrorComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wLineNrExt);
    wLineNrExt.addModifyListener(lsMod);
    fdLineNrDestExt = new FormData();
    fdLineNrDestExt.left = new FormAttachment(wbvLineNrDestDir, -150);
    fdLineNrDestExt.right = new FormAttachment(wbvLineNrDestDir, -margin);
    fdLineNrDestExt.top = new FormAttachment(previous, margin);
    wLineNrExt.setLayoutData(fdLineNrDestExt);
    wlLineNrExt = new Label(wErrorComp, SWT.RIGHT);
    wlLineNrExt.setText(BaseMessages.getString(PKG, "System.Label.Extension"));
    props.setLook(wlLineNrExt);
    fdlLineNrDestExt = new FormData();
    fdlLineNrDestExt.top = new FormAttachment(previous, margin);
    fdlLineNrDestExt.right = new FormAttachment(wLineNrExt, -margin);
    wlLineNrExt.setLayoutData(fdlLineNrDestExt);
    wLineNrDestDir = new Text(wErrorComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wLineNrDestDir);
    wLineNrDestDir.addModifyListener(lsMod);
    fdLineNrDestDir = new FormData();
    fdLineNrDestDir.left = new FormAttachment(middle, 0);
    fdLineNrDestDir.right = new FormAttachment(wlLineNrExt, -margin);
    fdLineNrDestDir.top = new FormAttachment(previous, margin);
    wLineNrDestDir.setLayoutData(fdLineNrDestDir);
    // Listen to the Browse... button
    wbbLineNrDestDir.addSelectionListener(DirectoryDialogButtonListenerFactory.getSelectionAdapter(shell, wLineNrDestDir));
    // Listen to the Variable... button
    wbvLineNrDestDir.addSelectionListener(VariableButtonListenerFactory.getSelectionAdapter(shell, wLineNrDestDir, transMeta));
    // Whenever something changes, set the tooltip to the expanded version of the directory:
    wLineNrDestDir.addModifyListener(getModifyListenerTooltipText(wLineNrDestDir));
    wErrorComp.layout();
    wErrorTab.setControl(wErrorComp);
// 
// / END OF CONTENT TAB
// 
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) CTabItem(org.eclipse.swt.custom.CTabItem) ComponentSelectionListener(org.pentaho.di.ui.trans.step.ComponentSelectionListener) Control(org.eclipse.swt.widgets.Control) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Aggregations

SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)24 SelectionEvent (org.eclipse.swt.events.SelectionEvent)24 FormAttachment (org.eclipse.swt.layout.FormAttachment)24 FormData (org.eclipse.swt.layout.FormData)24 FormLayout (org.eclipse.swt.layout.FormLayout)24 Button (org.eclipse.swt.widgets.Button)24 Label (org.eclipse.swt.widgets.Label)24 Text (org.eclipse.swt.widgets.Text)24 ComponentSelectionListener (org.pentaho.di.ui.trans.step.ComponentSelectionListener)24 ModifyEvent (org.eclipse.swt.events.ModifyEvent)23 ModifyListener (org.eclipse.swt.events.ModifyListener)23 Display (org.eclipse.swt.widgets.Display)23 Event (org.eclipse.swt.widgets.Event)23 Listener (org.eclipse.swt.widgets.Listener)23 Shell (org.eclipse.swt.widgets.Shell)23 ShellAdapter (org.eclipse.swt.events.ShellAdapter)22 ShellEvent (org.eclipse.swt.events.ShellEvent)22 TextVar (org.pentaho.di.ui.core.widget.TextVar)20 FocusListener (org.eclipse.swt.events.FocusListener)16 Group (org.eclipse.swt.widgets.Group)16