Search in sources :

Example 1 with ComboVar

use of org.apache.hop.ui.core.widget.ComboVar in project hop by apache.

the class PropertyInputDialog method open.

@Override
public String open() {
    Shell parent = getParent();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
    props.setLook(shell);
    setShellImage(shell, input);
    lsMod = 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, "PropertyInputDialog.DialogTitle"));
    middle = props.getMiddlePct();
    margin = props.getMargin();
    // Buttons at the bottom
    wOk = new Button(shell, SWT.PUSH);
    wOk.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wOk.addListener(SWT.Selection, e -> ok());
    wPreview = new Button(shell, SWT.PUSH);
    wPreview.setText(BaseMessages.getString(PKG, "PropertyInputDialog.Button.PreviewRows"));
    wPreview.addListener(SWT.Selection, e -> preview());
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    wCancel.addListener(SWT.Selection, e -> cancel());
    setButtonPositions(new Button[] { wOk, wPreview, wCancel }, margin, null);
    // TransformName line
    wlTransformName = new Label(shell, SWT.RIGHT);
    wlTransformName.setText(BaseMessages.getString(PKG, "System.Label.TransformName"));
    props.setLook(wlTransformName);
    fdlTransformName = new FormData();
    fdlTransformName.left = new FormAttachment(0, 0);
    fdlTransformName.top = new FormAttachment(0, margin);
    fdlTransformName.right = new FormAttachment(middle, -margin);
    wlTransformName.setLayoutData(fdlTransformName);
    wTransformName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wTransformName.setText(transformName);
    props.setLook(wTransformName);
    wTransformName.addModifyListener(lsMod);
    fdTransformName = new FormData();
    fdTransformName.left = new FormAttachment(middle, 0);
    fdTransformName.top = new FormAttachment(0, margin);
    fdTransformName.right = new FormAttachment(100, 0);
    wTransformName.setLayoutData(fdTransformName);
    wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
    // ////////////////////////
    // START OF FILE TAB ///
    // ////////////////////////
    CTabItem wFileTab = new CTabItem(wTabFolder, SWT.NONE);
    wFileTab.setText(BaseMessages.getString(PKG, "PropertyInputDialog.File.Tab"));
    Composite wFileComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wFileComp);
    FormLayout fileLayout = new FormLayout();
    fileLayout.marginWidth = 3;
    fileLayout.marginHeight = 3;
    wFileComp.setLayout(fileLayout);
    // ///////////////////////////////
    // START OF Origin files GROUP //
    // ///////////////////////////////
    Group wOriginFiles = new Group(wFileComp, SWT.SHADOW_NONE);
    props.setLook(wOriginFiles);
    wOriginFiles.setText(BaseMessages.getString(PKG, "PropertyInputDialog.wOriginFiles.Label"));
    FormLayout originFilesgroupLayout = new FormLayout();
    originFilesgroupLayout.marginWidth = 10;
    originFilesgroupLayout.marginHeight = 10;
    wOriginFiles.setLayout(originFilesgroupLayout);
    // Is Filename defined in a Field
    Label wlFileField = new Label(wOriginFiles, SWT.RIGHT);
    wlFileField.setText(BaseMessages.getString(PKG, "PropertyInputDialog.FileField.Label"));
    props.setLook(wlFileField);
    FormData fdlFileField = new FormData();
    fdlFileField.left = new FormAttachment(0, 0);
    fdlFileField.top = new FormAttachment(0, margin);
    fdlFileField.right = new FormAttachment(middle, -margin);
    wlFileField.setLayoutData(fdlFileField);
    wFileField = new Button(wOriginFiles, SWT.CHECK);
    props.setLook(wFileField);
    wFileField.setToolTipText(BaseMessages.getString(PKG, "PropertyInputDialog.FileField.Tooltip"));
    FormData fdFileField = new FormData();
    fdFileField.left = new FormAttachment(middle, margin);
    fdFileField.top = new FormAttachment(wlFileField, 0, SWT.CENTER);
    wFileField.setLayoutData(fdFileField);
    SelectionAdapter lfilefield = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            activateFileField();
            input.setChanged();
        }
    };
    wFileField.addSelectionListener(lfilefield);
    // Filename field
    wlFilenameField = new Label(wOriginFiles, SWT.RIGHT);
    wlFilenameField.setText(BaseMessages.getString(PKG, "PropertyInputDialog.wlFilenameField.Label"));
    props.setLook(wlFilenameField);
    FormData fdlFilenameField = new FormData();
    fdlFilenameField.left = new FormAttachment(0, 0);
    fdlFilenameField.top = new FormAttachment(wFileField, margin);
    fdlFilenameField.right = new FormAttachment(middle, -margin);
    wlFilenameField.setLayoutData(fdlFilenameField);
    wFilenameField = new CCombo(wOriginFiles, SWT.BORDER | SWT.READ_ONLY);
    wFilenameField.setEditable(true);
    props.setLook(wFilenameField);
    wFilenameField.addModifyListener(lsMod);
    FormData fdFilenameField = new FormData();
    fdFilenameField.left = new FormAttachment(middle, margin);
    fdFilenameField.top = new FormAttachment(wFileField, margin);
    fdFilenameField.right = new FormAttachment(100, -margin);
    wFilenameField.setLayoutData(fdFilenameField);
    wFilenameField.addFocusListener(new FocusListener() {

        @Override
        public void focusLost(FocusEvent e) {
        }

        @Override
        public void focusGained(FocusEvent e) {
            setFileField();
        }
    });
    FormData fdOriginFiles = new FormData();
    fdOriginFiles.left = new FormAttachment(0, margin);
    fdOriginFiles.top = new FormAttachment(wFilenameList, margin);
    fdOriginFiles.right = new FormAttachment(100, -margin);
    wOriginFiles.setLayoutData(fdOriginFiles);
    // ///////////////////////////////////////////////////////////
    // / END OF Origin files GROUP
    // ///////////////////////////////////////////////////////////
    middle = middle / 2;
    // Filename line
    wlFilename = new Label(wFileComp, SWT.RIGHT);
    wlFilename.setText(BaseMessages.getString(PKG, "PropertyInputDialog.Filename.Label"));
    props.setLook(wlFilename);
    FormData fdlFilename = new FormData();
    fdlFilename.left = new FormAttachment(0, 0);
    fdlFilename.top = new FormAttachment(wOriginFiles, 2 * margin);
    fdlFilename.right = new FormAttachment(middle, -margin);
    wlFilename.setLayoutData(fdlFilename);
    wbbFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbbFilename);
    wbbFilename.setText(BaseMessages.getString(PKG, "PropertyInputDialog.FilenameBrowse.Button"));
    wbbFilename.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.BrowseForFileOrDirAndAdd"));
    FormData fdbFilename = new FormData();
    fdbFilename.right = new FormAttachment(100, 0);
    fdbFilename.top = new FormAttachment(wlFilename, 0, SWT.CENTER);
    wbbFilename.setLayoutData(fdbFilename);
    wbaFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbaFilename);
    wbaFilename.setText(BaseMessages.getString(PKG, "PropertyInputDialog.FilenameAdd.Button"));
    wbaFilename.setToolTipText(BaseMessages.getString(PKG, "PropertyInputDialog.FilenameAdd.Tooltip"));
    FormData fdbaFilename = new FormData();
    fdbaFilename.right = new FormAttachment(wbbFilename, -margin);
    fdbaFilename.top = new FormAttachment(wlFilename, 0, SWT.CENTER);
    wbaFilename.setLayoutData(fdbaFilename);
    wFilename = new TextVar(variables, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFilename);
    wFilename.addModifyListener(lsMod);
    FormData fdFilename = new FormData();
    fdFilename.left = new FormAttachment(middle, 0);
    fdFilename.right = new FormAttachment(wbaFilename, -margin);
    fdFilename.top = new FormAttachment(wlFilename, 0, SWT.CENTER);
    wFilename.setLayoutData(fdFilename);
    wlFilemask = new Label(wFileComp, SWT.RIGHT);
    wlFilemask.setText(BaseMessages.getString(PKG, "PropertyInputDialog.RegExp.Label"));
    props.setLook(wlFilemask);
    FormData fdlFilemask = new FormData();
    fdlFilemask.left = new FormAttachment(0, 0);
    fdlFilemask.top = new FormAttachment(wFilename, margin);
    fdlFilemask.right = new FormAttachment(middle, -margin);
    wlFilemask.setLayoutData(fdlFilemask);
    wFilemask = new TextVar(variables, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFilemask);
    wFilemask.addModifyListener(lsMod);
    FormData fdFilemask = new FormData();
    fdFilemask.left = new FormAttachment(middle, 0);
    fdFilemask.top = new FormAttachment(wlFilemask, 0, SWT.CENTER);
    fdFilemask.right = new FormAttachment(wbaFilename, -margin);
    wFilemask.setLayoutData(fdFilemask);
    wlExcludeFilemask = new Label(wFileComp, SWT.RIGHT);
    wlExcludeFilemask.setText(BaseMessages.getString(PKG, "PropertyInputDialog.ExcludeFilemask.Label"));
    props.setLook(wlExcludeFilemask);
    FormData fdlExcludeFilemask = new FormData();
    fdlExcludeFilemask.left = new FormAttachment(0, 0);
    fdlExcludeFilemask.top = new FormAttachment(wFilemask, margin);
    fdlExcludeFilemask.right = new FormAttachment(middle, -margin);
    wlExcludeFilemask.setLayoutData(fdlExcludeFilemask);
    wExcludeFilemask = new TextVar(variables, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wExcludeFilemask);
    wExcludeFilemask.addModifyListener(lsMod);
    FormData fdExcludeFilemask = new FormData();
    fdExcludeFilemask.left = new FormAttachment(middle, 0);
    fdExcludeFilemask.top = new FormAttachment(wlExcludeFilemask, 0, SWT.CENTER);
    fdExcludeFilemask.right = new FormAttachment(wFilename, 0, SWT.RIGHT);
    wExcludeFilemask.setLayoutData(fdExcludeFilemask);
    // Filename list line
    wlFilenameList = new Label(wFileComp, SWT.RIGHT);
    wlFilenameList.setText(BaseMessages.getString(PKG, "PropertyInputDialog.FilenameList.Label"));
    props.setLook(wlFilenameList);
    FormData fdlFilenameList = new FormData();
    fdlFilenameList.left = new FormAttachment(0, 0);
    fdlFilenameList.top = new FormAttachment(wExcludeFilemask, margin);
    fdlFilenameList.right = new FormAttachment(middle, -margin);
    wlFilenameList.setLayoutData(fdlFilenameList);
    // Buttons to the right of the screen...
    wbdFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbdFilename);
    wbdFilename.setText(BaseMessages.getString(PKG, "PropertyInputDialog.FilenameRemove.Button"));
    wbdFilename.setToolTipText(BaseMessages.getString(PKG, "PropertyInputDialog.FilenameRemove.Tooltip"));
    FormData fdbdFilename = new FormData();
    fdbdFilename.right = new FormAttachment(100, 0);
    fdbdFilename.top = new FormAttachment(wExcludeFilemask, margin);
    wbdFilename.setLayoutData(fdbdFilename);
    wbeFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbeFilename);
    wbeFilename.setText(BaseMessages.getString(PKG, "PropertyInputDialog.FilenameEdit.Button"));
    wbeFilename.setToolTipText(BaseMessages.getString(PKG, "PropertyInputDialog.FilenameEdit.Tooltip"));
    FormData fdbeFilename = new FormData();
    fdbeFilename.right = new FormAttachment(100, 0);
    fdbeFilename.left = new FormAttachment(wbdFilename, 0, SWT.LEFT);
    fdbeFilename.top = new FormAttachment(wbdFilename, margin);
    wbeFilename.setLayoutData(fdbeFilename);
    wbShowFiles = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbShowFiles);
    wbShowFiles.setText(BaseMessages.getString(PKG, "PropertyInputDialog.ShowFiles.Button"));
    FormData fdbShowFiles = new FormData();
    fdbShowFiles.left = new FormAttachment(middle, 0);
    fdbShowFiles.bottom = new FormAttachment(100, 0);
    wbShowFiles.setLayoutData(fdbShowFiles);
    ColumnInfo[] colinfo = new ColumnInfo[5];
    colinfo[0] = new ColumnInfo(BaseMessages.getString(PKG, "PropertyInputDialog.Files.Filename.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false);
    colinfo[1] = new ColumnInfo(BaseMessages.getString(PKG, "PropertyInputDialog.Files.Wildcard.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false);
    colinfo[2] = new ColumnInfo(BaseMessages.getString(PKG, "PropertyInputDialog.Files.ExcludeWildcard.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false);
    colinfo[3] = new ColumnInfo(BaseMessages.getString(PKG, "PropertyInputDialog.Required.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, YES_NO_COMBO);
    colinfo[4] = new ColumnInfo(BaseMessages.getString(PKG, "PropertyInputDialog.IncludeSubDirs.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, YES_NO_COMBO);
    colinfo[0].setUsingVariables(true);
    colinfo[1].setUsingVariables(true);
    colinfo[1].setToolTip(BaseMessages.getString(PKG, "PropertyInputDialog.Files.Wildcard.Tooltip"));
    colinfo[2].setUsingVariables(true);
    colinfo[2].setToolTip(BaseMessages.getString(PKG, "PropertyInputDialog.Files.ExcludeWildcard.Tooltip"));
    colinfo[3].setToolTip(BaseMessages.getString(PKG, "PropertyInputDialog.Required.Tooltip"));
    colinfo[4].setToolTip(BaseMessages.getString(PKG, "PropertyInputDialog.IncludeSubDirs.Tooltip"));
    wFilenameList = new TableView(variables, wFileComp, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, colinfo, 2, lsMod, props);
    props.setLook(wFilenameList);
    FormData fdFilenameList = new FormData();
    fdFilenameList.left = new FormAttachment(middle, 0);
    fdFilenameList.right = new FormAttachment(wbdFilename, -margin);
    fdFilenameList.top = new FormAttachment(wExcludeFilemask, margin);
    fdFilenameList.bottom = new FormAttachment(wbShowFiles, -margin);
    wFilenameList.setLayoutData(fdFilenameList);
    FormData fdFileComp = new FormData();
    fdFileComp.left = new FormAttachment(0, 0);
    fdFileComp.top = new FormAttachment(0, 0);
    fdFileComp.right = new FormAttachment(100, 0);
    fdFileComp.bottom = new FormAttachment(100, 0);
    wFileComp.setLayoutData(fdFileComp);
    wFileComp.layout();
    wFileTab.setControl(wFileComp);
    // ///////////////////////////////////////////////////////////
    // / END OF FILE TAB
    // ///////////////////////////////////////////////////////////
    middle = props.getMiddlePct();
    // ////////////////////////
    // START OF CONTENT TAB///
    // /
    CTabItem wContentTab = new CTabItem(wTabFolder, SWT.NONE);
    wContentTab.setText(BaseMessages.getString(PKG, "PropertyInputDialog.Content.Tab"));
    FormLayout contentLayout = new FormLayout();
    contentLayout.marginWidth = 3;
    contentLayout.marginHeight = 3;
    Composite wContentComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wContentComp);
    wContentComp.setLayout(contentLayout);
    // ///////////////////////////////
    // START OF SettingsGroup GROUP //
    // ///////////////////////////////
    Group wSettingsGroup = new Group(wContentComp, SWT.SHADOW_NONE);
    props.setLook(wSettingsGroup);
    wSettingsGroup.setText(BaseMessages.getString(PKG, "PropertyInputDialog.SettingsGroup.Label"));
    FormLayout settingsGroupLayout = new FormLayout();
    settingsGroupLayout.marginWidth = 10;
    settingsGroupLayout.marginHeight = 10;
    wSettingsGroup.setLayout(settingsGroupLayout);
    Label wlFileType = new Label(wSettingsGroup, SWT.RIGHT);
    wlFileType.setText(BaseMessages.getString(PKG, "PropertyInputDialog.FileType.Label"));
    props.setLook(wlFileType);
    FormData fdlFileType = new FormData();
    fdlFileType.left = new FormAttachment(0, 0);
    fdlFileType.top = new FormAttachment(0, margin);
    fdlFileType.right = new FormAttachment(middle, -margin);
    wlFileType.setLayoutData(fdlFileType);
    wFileType = new CCombo(wSettingsGroup, SWT.BORDER | SWT.READ_ONLY);
    wFileType.setEditable(true);
    wFileType.setItems(PropertyInputMeta.fileTypeDesc);
    props.setLook(wFileType);
    wFileType.addModifyListener(lsMod);
    FormData fdFileType = new FormData();
    fdFileType.left = new FormAttachment(middle, 0);
    fdFileType.top = new FormAttachment(0, margin);
    fdFileType.right = new FormAttachment(100, 0);
    wFileType.setLayoutData(fdFileType);
    wFileType.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setFileType();
        }
    });
    wlEncoding = new Label(wSettingsGroup, SWT.RIGHT);
    wlEncoding.setText(BaseMessages.getString(PKG, "PropertyInputDialog.Encoding.Label"));
    props.setLook(wlEncoding);
    FormData fdlEncoding = new FormData();
    fdlEncoding.left = new FormAttachment(0, 0);
    fdlEncoding.top = new FormAttachment(wFileType, margin);
    fdlEncoding.right = new FormAttachment(middle, -margin);
    wlEncoding.setLayoutData(fdlEncoding);
    wEncoding = new ComboVar(variables, wSettingsGroup, SWT.BORDER | SWT.READ_ONLY);
    wEncoding.setEditable(true);
    props.setLook(wEncoding);
    wEncoding.addModifyListener(lsMod);
    FormData fdEncoding = new FormData();
    fdEncoding.left = new FormAttachment(middle, 0);
    fdEncoding.top = new FormAttachment(wFileType, margin);
    fdEncoding.right = new FormAttachment(100, 0);
    wEncoding.setLayoutData(fdEncoding);
    wEncoding.addFocusListener(new FocusListener() {

        @Override
        public void focusLost(FocusEvent e) {
        }

        @Override
        public void focusGained(FocusEvent e) {
            setEncodings();
        }
    });
    wlSection = new Label(wSettingsGroup, SWT.RIGHT);
    wlSection.setText(BaseMessages.getString(PKG, "PropertyInputDialog.Section.Label"));
    props.setLook(wlSection);
    FormData fdlSection = new FormData();
    fdlSection.left = new FormAttachment(0, 0);
    fdlSection.top = new FormAttachment(wEncoding, margin);
    fdlSection.right = new FormAttachment(middle, -margin);
    wlSection.setLayoutData(fdlSection);
    wbbSection = new Button(wSettingsGroup, SWT.PUSH | SWT.CENTER);
    props.setLook(wbbSection);
    wbbSection.setText(BaseMessages.getString(PKG, "PropertyInputDialog.SectionBrowse.Button"));
    FormData fdbSection = new FormData();
    fdbSection.right = new FormAttachment(100, 0);
    fdbSection.top = new FormAttachment(wEncoding, margin);
    wbbSection.setLayoutData(fdbSection);
    wbbSection.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            getSections();
        }
    });
    wSection = new TextVar(variables, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wSection.setToolTipText(BaseMessages.getString(PKG, "PropertyInputDialog.Section.Tooltip"));
    props.setLook(wSection);
    wSection.addModifyListener(lsMod);
    FormData fdSection = new FormData();
    fdSection.left = new FormAttachment(middle, 0);
    fdSection.top = new FormAttachment(wEncoding, margin);
    fdSection.right = new FormAttachment(wbbSection, -margin);
    wSection.setLayoutData(fdSection);
    wlLimit = new Label(wSettingsGroup, SWT.RIGHT);
    wlLimit.setText(BaseMessages.getString(PKG, "PropertyInputDialog.Limit.Label"));
    props.setLook(wlLimit);
    FormData fdlLimit = new FormData();
    fdlLimit.left = new FormAttachment(0, 0);
    fdlLimit.top = new FormAttachment(wbbSection, margin);
    fdlLimit.right = new FormAttachment(middle, -margin);
    wlLimit.setLayoutData(fdlLimit);
    wLimit = new Text(wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wLimit);
    wLimit.addModifyListener(lsMod);
    FormData fdLimit = new FormData();
    fdLimit.left = new FormAttachment(middle, 0);
    fdLimit.top = new FormAttachment(wbbSection, margin);
    fdLimit.right = new FormAttachment(100, 0);
    wLimit.setLayoutData(fdLimit);
    Label wlResolveValueVariable = new Label(wSettingsGroup, SWT.RIGHT);
    wlResolveValueVariable.setText(BaseMessages.getString(PKG, "PropertyInputDialog.resolveValueVariable.Label"));
    props.setLook(wlResolveValueVariable);
    FormData fdlResolveValueVariable = new FormData();
    fdlResolveValueVariable.left = new FormAttachment(0, 0);
    fdlResolveValueVariable.top = new FormAttachment(wLimit, margin);
    fdlResolveValueVariable.right = new FormAttachment(middle, -margin);
    wlResolveValueVariable.setLayoutData(fdlResolveValueVariable);
    wResolveValueVariable = new Button(wSettingsGroup, SWT.CHECK);
    props.setLook(wResolveValueVariable);
    wResolveValueVariable.setToolTipText(BaseMessages.getString(PKG, "PropertyInputDialog.resolveValueVariable.Tooltip"));
    FormData fdResolveValueVariable = new FormData();
    fdResolveValueVariable.left = new FormAttachment(middle, 0);
    fdResolveValueVariable.top = new FormAttachment(wlResolveValueVariable, 0, SWT.CENTER);
    wResolveValueVariable.setLayoutData(fdResolveValueVariable);
    wResolveValueVariable.addSelectionListener(new ComponentSelectionListener(input));
    FormData fdSettingsGroup = new FormData();
    fdSettingsGroup.left = new FormAttachment(0, margin);
    fdSettingsGroup.top = new FormAttachment(wResolveValueVariable, margin);
    fdSettingsGroup.right = new FormAttachment(100, -margin);
    wSettingsGroup.setLayoutData(fdSettingsGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF SettingsGroup GROUP
    // ///////////////////////////////////////////////////////////
    // /////////////////////////////////
    // START OF Additional Fields GROUP
    // /////////////////////////////////
    Group wAdditionalGroup = new Group(wContentComp, SWT.SHADOW_NONE);
    props.setLook(wAdditionalGroup);
    wAdditionalGroup.setText(BaseMessages.getString(PKG, "PropertyInputDialog.Group.AdditionalGroup.Label"));
    FormLayout additionalgroupLayout = new FormLayout();
    additionalgroupLayout.marginWidth = 10;
    additionalgroupLayout.marginHeight = 10;
    wAdditionalGroup.setLayout(additionalgroupLayout);
    wlInclFilename = new Label(wAdditionalGroup, SWT.RIGHT);
    wlInclFilename.setText(BaseMessages.getString(PKG, "PropertyInputDialog.InclFilename.Label"));
    props.setLook(wlInclFilename);
    FormData fdlInclFilename = new FormData();
    fdlInclFilename.left = new FormAttachment(0, 0);
    fdlInclFilename.top = new FormAttachment(wSettingsGroup, margin);
    fdlInclFilename.right = new FormAttachment(middle, -margin);
    wlInclFilename.setLayoutData(fdlInclFilename);
    wInclFilename = new Button(wAdditionalGroup, SWT.CHECK);
    props.setLook(wInclFilename);
    wInclFilename.setToolTipText(BaseMessages.getString(PKG, "PropertyInputDialog.InclFilename.Tooltip"));
    FormData fdInclFilename = new FormData();
    fdInclFilename.left = new FormAttachment(middle, 0);
    fdInclFilename.top = new FormAttachment(wlInclFilename, 0, SWT.CENTER);
    wInclFilename.setLayoutData(fdInclFilename);
    wInclFilename.addSelectionListener(new ComponentSelectionListener(input));
    wlInclFilenameField = new Label(wAdditionalGroup, SWT.LEFT);
    wlInclFilenameField.setText(BaseMessages.getString(PKG, "PropertyInputDialog.InclFilenameField.Label"));
    props.setLook(wlInclFilenameField);
    FormData fdlInclFilenameField = new FormData();
    fdlInclFilenameField.left = new FormAttachment(wInclFilename, margin);
    fdlInclFilenameField.top = new FormAttachment(wSettingsGroup, margin);
    wlInclFilenameField.setLayoutData(fdlInclFilenameField);
    wInclFilenameField = new TextVar(variables, wAdditionalGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wInclFilenameField);
    wInclFilenameField.addModifyListener(lsMod);
    FormData fdInclFilenameField = new FormData();
    fdInclFilenameField.left = new FormAttachment(wlInclFilenameField, margin);
    fdInclFilenameField.top = new FormAttachment(wSettingsGroup, margin);
    fdInclFilenameField.right = new FormAttachment(100, 0);
    wInclFilenameField.setLayoutData(fdInclFilenameField);
    Label wlInclRownum = new Label(wAdditionalGroup, SWT.RIGHT);
    wlInclRownum.setText(BaseMessages.getString(PKG, "PropertyInputDialog.InclRownum.Label"));
    props.setLook(wlInclRownum);
    FormData fdlInclRownum = new FormData();
    fdlInclRownum.left = new FormAttachment(0, 0);
    fdlInclRownum.top = new FormAttachment(wInclFilenameField, margin);
    fdlInclRownum.right = new FormAttachment(middle, -margin);
    wlInclRownum.setLayoutData(fdlInclRownum);
    wInclRownum = new Button(wAdditionalGroup, SWT.CHECK);
    props.setLook(wInclRownum);
    wInclRownum.setToolTipText(BaseMessages.getString(PKG, "PropertyInputDialog.InclRownum.Tooltip"));
    FormData fdRownum = new FormData();
    fdRownum.left = new FormAttachment(middle, 0);
    fdRownum.top = new FormAttachment(wlInclRownum, 0, SWT.CENTER);
    wInclRownum.setLayoutData(fdRownum);
    wInclRownum.addSelectionListener(new ComponentSelectionListener(input));
    wlInclRownumField = new Label(wAdditionalGroup, SWT.RIGHT);
    wlInclRownumField.setText(BaseMessages.getString(PKG, "PropertyInputDialog.InclRownumField.Label"));
    props.setLook(wlInclRownumField);
    FormData fdlInclRownumField = new FormData();
    fdlInclRownumField.left = new FormAttachment(wInclRownum, margin);
    fdlInclRownumField.top = new FormAttachment(wInclFilenameField, margin);
    wlInclRownumField.setLayoutData(fdlInclRownumField);
    wInclRownumField = new TextVar(variables, wAdditionalGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wInclRownumField);
    wInclRownumField.addModifyListener(lsMod);
    FormData fdInclRownumField = new FormData();
    fdInclRownumField.left = new FormAttachment(wlInclRownumField, margin);
    fdInclRownumField.top = new FormAttachment(wInclFilenameField, margin);
    fdInclRownumField.right = new FormAttachment(100, 0);
    wInclRownumField.setLayoutData(fdInclRownumField);
    wlResetRownum = new Label(wAdditionalGroup, SWT.RIGHT);
    wlResetRownum.setText(BaseMessages.getString(PKG, "PropertyInputDialog.ResetRownum.Label"));
    props.setLook(wlResetRownum);
    FormData fdlResetRownum = new FormData();
    fdlResetRownum.left = new FormAttachment(wInclRownum, margin);
    fdlResetRownum.top = new FormAttachment(wInclRownumField, margin);
    wlResetRownum.setLayoutData(fdlResetRownum);
    wResetRownum = new Button(wAdditionalGroup, SWT.CHECK);
    props.setLook(wResetRownum);
    wResetRownum.setToolTipText(BaseMessages.getString(PKG, "PropertyInputDialog.ResetRownum.Tooltip"));
    fdRownum = new FormData();
    fdRownum.left = new FormAttachment(wlResetRownum, margin);
    fdRownum.top = new FormAttachment(wlResetRownum, 0, SWT.CENTER);
    wResetRownum.setLayoutData(fdRownum);
    wResetRownum.addSelectionListener(new ComponentSelectionListener(input));
    wlInclINIsection = new Label(wAdditionalGroup, SWT.RIGHT);
    wlInclINIsection.setText(BaseMessages.getString(PKG, "PropertyInputDialog.InclINIsection.Label"));
    props.setLook(wlInclINIsection);
    FormData fdlInclINIsection = new FormData();
    fdlInclINIsection.left = new FormAttachment(0, 0);
    fdlInclINIsection.top = new FormAttachment(wResetRownum, margin);
    fdlInclINIsection.right = new FormAttachment(middle, -margin);
    wlInclINIsection.setLayoutData(fdlInclINIsection);
    wInclINIsection = new Button(wAdditionalGroup, SWT.CHECK);
    props.setLook(wInclINIsection);
    wInclINIsection.setToolTipText(BaseMessages.getString(PKG, "PropertyInputDialog.InclINIsection.Tooltip"));
    fdRownum = new FormData();
    fdRownum.left = new FormAttachment(middle, 0);
    fdRownum.top = new FormAttachment(wlInclINIsection, 0, SWT.CENTER);
    wInclINIsection.setLayoutData(fdRownum);
    wInclINIsection.addSelectionListener(new ComponentSelectionListener(input));
    wlInclINIsectionField = new Label(wAdditionalGroup, SWT.RIGHT);
    wlInclINIsectionField.setText(BaseMessages.getString(PKG, "PropertyInputDialog.InclINIsectionField.Label"));
    props.setLook(wlInclINIsectionField);
    FormData fdlInclINIsectionField = new FormData();
    fdlInclINIsectionField.left = new FormAttachment(wInclINIsection, margin);
    fdlInclINIsectionField.top = new FormAttachment(wResetRownum, margin);
    wlInclINIsectionField.setLayoutData(fdlInclINIsectionField);
    wInclINIsectionField = new TextVar(variables, wAdditionalGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wInclINIsectionField);
    wInclINIsectionField.addModifyListener(lsMod);
    FormData fdInclINIsectionField = new FormData();
    fdInclINIsectionField.left = new FormAttachment(wlInclINIsectionField, margin);
    fdInclINIsectionField.top = new FormAttachment(wResetRownum, margin);
    fdInclINIsectionField.right = new FormAttachment(100, 0);
    wInclINIsectionField.setLayoutData(fdInclINIsectionField);
    FormData fdAdditionalGroup = new FormData();
    fdAdditionalGroup.left = new FormAttachment(0, margin);
    fdAdditionalGroup.top = new FormAttachment(wSettingsGroup, margin);
    fdAdditionalGroup.right = new FormAttachment(100, -margin);
    wAdditionalGroup.setLayoutData(fdAdditionalGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF DESTINATION ADDRESS GROUP
    // ///////////////////////////////////////////////////////////
    // ///////////////////////////////
    // START OF AddFileResult GROUP //
    // ///////////////////////////////
    Group wAddFileResult = new Group(wContentComp, SWT.SHADOW_NONE);
    props.setLook(wAddFileResult);
    wAddFileResult.setText(BaseMessages.getString(PKG, "PropertyInputDialog.wAddFileResult.Label"));
    FormLayout addFileResultgroupLayout = new FormLayout();
    addFileResultgroupLayout.marginWidth = 10;
    addFileResultgroupLayout.marginHeight = 10;
    wAddFileResult.setLayout(addFileResultgroupLayout);
    Label wlAddResult = new Label(wAddFileResult, SWT.RIGHT);
    wlAddResult.setText(BaseMessages.getString(PKG, "PropertyInputDialog.AddResult.Label"));
    props.setLook(wlAddResult);
    FormData fdlAddResult = new FormData();
    fdlAddResult.left = new FormAttachment(0, 0);
    fdlAddResult.top = new FormAttachment(wAdditionalGroup, margin);
    fdlAddResult.right = new FormAttachment(middle, -margin);
    wlAddResult.setLayoutData(fdlAddResult);
    wAddResult = new Button(wAddFileResult, SWT.CHECK);
    props.setLook(wAddResult);
    wAddResult.setToolTipText(BaseMessages.getString(PKG, "PropertyInputDialog.AddResult.Tooltip"));
    FormData fdAddResult = new FormData();
    fdAddResult.left = new FormAttachment(middle, 0);
    fdAddResult.top = new FormAttachment(wlAddResult, 0, SWT.CENTER);
    wAddResult.setLayoutData(fdAddResult);
    wAddResult.addSelectionListener(new ComponentSelectionListener(input));
    FormData fdAddFileResult = new FormData();
    fdAddFileResult.left = new FormAttachment(0, margin);
    fdAddFileResult.top = new FormAttachment(wAdditionalGroup, margin);
    fdAddFileResult.right = new FormAttachment(100, -margin);
    wAddFileResult.setLayoutData(fdAddFileResult);
    // ///////////////////////////////////////////////////////////
    // / END OF AddFileResult GROUP
    // ///////////////////////////////////////////////////////////
    FormData 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
    // ///////////////////////////////////////////////////////////
    // Fields tab...
    // 
    CTabItem wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
    wFieldsTab.setText(BaseMessages.getString(PKG, "PropertyInputDialog.Fields.Tab"));
    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, "PropertyInputDialog.GetFields.Button"));
    fdGet = new FormData();
    fdGet.left = new FormAttachment(50, 0);
    fdGet.bottom = new FormAttachment(100, 0);
    wGet.setLayoutData(fdGet);
    final int FieldsRows = input.getInputFields().length;
    ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Name.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Attribut.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, PropertyInputField.ColumnDesc, false), new ColumnInfo(BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Type.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames(), true), new ColumnInfo(BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Format.Column"), ColumnInfo.COLUMN_TYPE_FORMAT, 3), new ColumnInfo(BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Length.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Precision.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Currency.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Decimal.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Group.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.TrimType.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, PropertyInputField.trimTypeDesc, true), new ColumnInfo(BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Repeat.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }, true) };
    colinf[0].setUsingVariables(true);
    colinf[0].setToolTip(BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Name.Column.Tooltip"));
    colinf[1].setToolTip(BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Attribut.Column.Tooltip"));
    wFields = new TableView(variables, wFieldsComp, SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
    FormData fdFields = new FormData();
    fdFields.left = new FormAttachment(0, 0);
    fdFields.top = new FormAttachment(0, 0);
    fdFields.right = new FormAttachment(100, 0);
    fdFields.bottom = new FormAttachment(wGet, -margin);
    wFields.setLayoutData(fdFields);
    FormData 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);
    addAdditionalFieldsTab();
    FormData fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(wTransformName, margin);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(wOk, -2 * margin);
    wTabFolder.setLayoutData(fdTabFolder);
    // Add listeners
    wGet.addListener(SWT.Selection, e -> get());
    // Add the file to the list of files...
    SelectionAdapter selA = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            wFilenameList.add(new String[] { wFilename.getText(), wFilemask.getText(), wExcludeFilemask.getText(), PropertyInputMeta.RequiredFilesCode[0], PropertyInputMeta.RequiredFilesCode[0] });
            wFilename.setText("");
            wFilemask.setText("");
            wExcludeFilemask.setText("");
            wFilenameList.removeEmptyRows();
            wFilenameList.setRowNums();
            wFilenameList.optWidth(true);
        }
    };
    wbaFilename.addSelectionListener(selA);
    wFilename.addSelectionListener(selA);
    // Delete files from the list of files...
    wbdFilename.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            int[] idx = wFilenameList.getSelectionIndices();
            wFilenameList.remove(idx);
            wFilenameList.removeEmptyRows();
            wFilenameList.setRowNums();
        }
    });
    // Edit the selected file & remove from the list...
    wbeFilename.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            int idx = wFilenameList.getSelectionIndex();
            if (idx >= 0) {
                String[] string = wFilenameList.getItem(idx);
                wFilename.setText(string[0]);
                wFilemask.setText(string[1]);
                wExcludeFilemask.setText(string[2]);
                wFilenameList.remove(idx);
            }
            wFilenameList.removeEmptyRows();
            wFilenameList.setRowNums();
        }
    });
    // Show the files that are selected at this time...
    wbShowFiles.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            try {
                PropertyInputMeta tfii = new PropertyInputMeta();
                getInfo(tfii);
                FileInputList fileInputList = tfii.getFiles(variables);
                String[] files = fileInputList.getFileStrings();
                if (files.length > 0) {
                    EnterSelectionDialog esd = new EnterSelectionDialog(shell, files, BaseMessages.getString(PKG, "PropertyInputDialog.FilesReadSelection.DialogTitle"), BaseMessages.getString(PKG, "PropertyInputDialog.FilesReadSelection.DialogMessage"));
                    esd.setViewOnly();
                    esd.open();
                } else {
                    MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
                    mb.setMessage(BaseMessages.getString(PKG, "PropertyInputDialog.NoFileFound.DialogMessage"));
                    mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title"));
                    mb.open();
                }
            } catch (Exception ex) {
                new ErrorDialog(shell, BaseMessages.getString(PKG, "PropertyInputDialog.ErrorParsingData.DialogTitle"), BaseMessages.getString(PKG, "PropertyInputDialog.ErrorParsingData.DialogMessage"), ex);
            }
        }
    });
    // Enable/disable the right fields to allow a filename to be added to each row...
    wInclFilename.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setIncludeFilename();
        }
    });
    // Enable/disable the right fields to allow a filename to be added to each row...
    wInclINIsection.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setIncludeSection();
        }
    });
    // Enable/disable the right fields to allow a row number to be added to each row...
    wInclRownum.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setIncludeRownum();
        }
    });
    // Whenever something changes, set the tooltip to the expanded version of the filename:
    wFilename.addModifyListener(e -> wFilename.setToolTipText(""));
    // Listen to the Browse... button
    wbbFilename.addListener(SWT.Selection, e -> BaseDialog.presentFileDialog(shell, wFilename, variables, (PropertyInputMeta.getFileTypeByDesc(wFileType.getText()) == PropertyInputMeta.FILE_TYPE_PROPERTY) ? new String[] { "*.properties;*.PROPERTIES", "*" } : new String[] { "*.ini;*.INI", "*" }, (PropertyInputMeta.getFileTypeByDesc(wFileType.getText()) == PropertyInputMeta.FILE_TYPE_PROPERTY) ? new String[] { BaseMessages.getString(PKG, "PropertyInputDialog.FileType.PropertiesFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") } : new String[] { BaseMessages.getString(PKG, "PropertyInputDialog.FileType.INIFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") }, true));
    wTabFolder.setSelection(0);
    getData(input);
    setFileType();
    input.setChanged(changed);
    activateFileField();
    wFields.optWidth(true);
    BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());
    return transformName;
}
Also used : ComboVar(org.apache.hop.ui.core.widget.ComboVar) CTabFolder(org.eclipse.swt.custom.CTabFolder) ColumnInfo(org.apache.hop.ui.core.widget.ColumnInfo) CTabItem(org.eclipse.swt.custom.CTabItem) ComponentSelectionListener(org.apache.hop.ui.pipeline.transform.ComponentSelectionListener) FormAttachment(org.eclipse.swt.layout.FormAttachment) FileInputList(org.apache.hop.core.fileinput.FileInputList) TableView(org.apache.hop.ui.core.widget.TableView) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) HopException(org.apache.hop.core.exception.HopException) TextVar(org.apache.hop.ui.core.widget.TextVar) CCombo(org.eclipse.swt.custom.CCombo)

Example 2 with ComboVar

use of org.apache.hop.ui.core.widget.ComboVar in project hop by apache.

the class PropertyOutputDialog method open.

@Override
public String open() {
    Shell parent = getParent();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
    props.setLook(shell);
    setShellImage(shell, input);
    ModifyListener lsMod = e -> input.setChanged();
    backupChanged = input.hasChanged();
    int middle = props.getMiddlePct();
    int margin = props.getMargin();
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.DialogTitle"));
    // get previous fields name
    getFields();
    // Some buttons
    wOk = new Button(shell, SWT.PUSH);
    wOk.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wOk.addListener(SWT.Selection, e -> ok());
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    wCancel.addListener(SWT.Selection, e -> cancel());
    setButtonPositions(new Button[] { wOk, wCancel }, margin, null);
    // TransformName line
    wlTransformName = new Label(shell, SWT.RIGHT);
    wlTransformName.setText(BaseMessages.getString(PKG, "System.Label.TransformName"));
    props.setLook(wlTransformName);
    fdlTransformName = new FormData();
    fdlTransformName.left = new FormAttachment(0, 0);
    fdlTransformName.right = new FormAttachment(middle, -margin);
    fdlTransformName.top = new FormAttachment(0, margin);
    wlTransformName.setLayoutData(fdlTransformName);
    wTransformName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wTransformName.setText(transformName);
    props.setLook(wTransformName);
    wTransformName.addModifyListener(lsMod);
    fdTransformName = new FormData();
    fdTransformName.left = new FormAttachment(middle, 0);
    fdTransformName.top = new FormAttachment(0, margin);
    fdTransformName.right = new FormAttachment(100, 0);
    wTransformName.setLayoutData(fdTransformName);
    CTabFolder wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
    // ////////////////////////
    // START OF GENERAL TAB ///
    // ////////////////////////
    CTabItem wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
    wGeneralTab.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.GeneralTab.TabTitle"));
    Composite wGeneralComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wGeneralComp);
    FormLayout generalLayout = new FormLayout();
    generalLayout.marginWidth = 3;
    generalLayout.marginHeight = 3;
    wGeneralComp.setLayout(generalLayout);
    // Fields grouping?
    // ////////////////////////
    // START OF Fields GROUP
    // 
    Group wFields = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wFields);
    wFields.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.Group.Fields.Label"));
    FormLayout groupFieldsLayout = new FormLayout();
    groupFieldsLayout.marginWidth = 10;
    groupFieldsLayout.marginHeight = 10;
    wFields.setLayout(groupFieldsLayout);
    // Key field
    Label wlKeyField = new Label(wFields, SWT.RIGHT);
    wlKeyField.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.KeyField.Label"));
    props.setLook(wlKeyField);
    FormData fdlKeyField = new FormData();
    fdlKeyField.left = new FormAttachment(0, 0);
    fdlKeyField.top = new FormAttachment(0, 3 * margin);
    fdlKeyField.right = new FormAttachment(middle, -margin);
    wlKeyField.setLayoutData(fdlKeyField);
    wKeyField = new CCombo(wFields, SWT.BORDER | SWT.READ_ONLY);
    wKeyField.setEditable(true);
    wKeyField.setItems(fieldNames);
    props.setLook(wKeyField);
    wKeyField.addModifyListener(lsMod);
    FormData fdKeyField = new FormData();
    fdKeyField.left = new FormAttachment(middle, 0);
    fdKeyField.top = new FormAttachment(0, 3 * margin);
    fdKeyField.right = new FormAttachment(100, 0);
    wKeyField.setLayoutData(fdKeyField);
    // Value field
    Label wlValueField = new Label(wFields, SWT.RIGHT);
    wlValueField.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.ValueField.Label"));
    props.setLook(wlValueField);
    FormData fdlValueField = new FormData();
    fdlValueField.left = new FormAttachment(0, 0);
    fdlValueField.top = new FormAttachment(wKeyField, margin);
    fdlValueField.right = new FormAttachment(middle, -margin);
    wlValueField.setLayoutData(fdlValueField);
    wValueField = new CCombo(wFields, SWT.BORDER | SWT.READ_ONLY);
    wValueField.setEditable(true);
    wValueField.setItems(fieldNames);
    props.setLook(wValueField);
    wValueField.addModifyListener(lsMod);
    FormData fdValueField = new FormData();
    fdValueField.left = new FormAttachment(middle, 0);
    fdValueField.top = new FormAttachment(wKeyField, margin);
    fdValueField.right = new FormAttachment(100, 0);
    wValueField.setLayoutData(fdValueField);
    // Comment
    Label wlComment = new Label(wGeneralComp, SWT.RIGHT);
    wlComment.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.Comment.Label"));
    props.setLook(wlComment);
    FormData fdlComment = new FormData();
    fdlComment.left = new FormAttachment(0, 0);
    fdlComment.top = new FormAttachment(wFields, 2 * margin);
    fdlComment.right = new FormAttachment(middle, -margin);
    wlComment.setLayoutData(fdlComment);
    wComment = new Text(wGeneralComp, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    wComment.setToolTipText(BaseMessages.getString(PKG, "PropertyOutputDialog.Comment.Tooltip"));
    props.setLook(wComment);
    wComment.addModifyListener(lsMod);
    FormData fdComment = new FormData();
    fdComment.left = new FormAttachment(middle, 0);
    fdComment.top = new FormAttachment(wFields, 2 * margin);
    fdComment.right = new FormAttachment(100, 0);
    fdComment.bottom = new FormAttachment(100, -margin);
    wComment.setLayoutData(fdComment);
    FormData fdFields = new FormData();
    fdFields.left = new FormAttachment(0, margin);
    fdFields.top = new FormAttachment(0, margin);
    fdFields.right = new FormAttachment(100, -margin);
    wFields.setLayoutData(fdFields);
    // ///////////////////////////////////////////////////////////
    // / END OF Fields GROUP
    // ///////////////////////////////////////////////////////////
    FormData fdGeneralComp = new FormData();
    fdGeneralComp.left = new FormAttachment(0, 0);
    fdGeneralComp.top = new FormAttachment(0, 0);
    fdGeneralComp.right = new FormAttachment(100, 0);
    fdGeneralComp.bottom = new FormAttachment(100, 0);
    wGeneralComp.setLayoutData(fdGeneralComp);
    wGeneralComp.layout();
    wGeneralTab.setControl(wGeneralComp);
    props.setLook(wGeneralComp);
    // ///////////////////////////////////////////////////////////
    // / END OF GENERAL TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF CONTENT TAB///
    // /
    CTabItem wContentTab = new CTabItem(wTabFolder, SWT.NONE);
    wContentTab.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.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);
    // File grouping?
    // ////////////////////////
    // START OF FileName GROUP
    // 
    Group wFileName = new Group(wContentComp, SWT.SHADOW_NONE);
    props.setLook(wFileName);
    wFileName.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.Group.File.Label"));
    FormLayout groupFileLayout = new FormLayout();
    groupFileLayout.marginWidth = 10;
    groupFileLayout.marginHeight = 10;
    wFileName.setLayout(groupFileLayout);
    // Filename line
    wlFilename = new Label(wFileName, SWT.RIGHT);
    wlFilename.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.Filename.Label"));
    props.setLook(wlFilename);
    FormData fdlFilename = new FormData();
    fdlFilename.left = new FormAttachment(0, 0);
    fdlFilename.top = new FormAttachment(wFields, margin);
    fdlFilename.right = new FormAttachment(middle, -margin);
    wlFilename.setLayoutData(fdlFilename);
    wbFilename = new Button(wFileName, SWT.PUSH | SWT.CENTER);
    props.setLook(wbFilename);
    wbFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    FormData fdbFilename = new FormData();
    fdbFilename.right = new FormAttachment(100, 0);
    fdbFilename.top = new FormAttachment(wFields, 0);
    wbFilename.setLayoutData(fdbFilename);
    wFilename = new TextVar(variables, wFileName, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFilename);
    wFilename.addModifyListener(lsMod);
    FormData fdFilename = new FormData();
    fdFilename.left = new FormAttachment(middle, 0);
    fdFilename.top = new FormAttachment(wFields, margin);
    fdFilename.right = new FormAttachment(wbFilename, -margin);
    wFilename.setLayoutData(fdFilename);
    // Append checkbox
    Label wlAppend = new Label(wFileName, SWT.RIGHT);
    wlAppend.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.Append.Label"));
    props.setLook(wlAppend);
    FormData fdlAppend = new FormData();
    fdlAppend.left = new FormAttachment(0, 0);
    fdlAppend.top = new FormAttachment(wFilename, margin);
    fdlAppend.right = new FormAttachment(middle, -margin);
    wlAppend.setLayoutData(fdlAppend);
    wAppend = new Button(wFileName, SWT.CHECK);
    props.setLook(wAppend);
    wAppend.setToolTipText(BaseMessages.getString(PKG, "PropertyOutputDialog.Append.Tooltip"));
    FormData fdAppend = new FormData();
    fdAppend.left = new FormAttachment(middle, 0);
    fdAppend.top = new FormAttachment(wlAppend, 0, SWT.CENTER);
    fdAppend.right = new FormAttachment(100, 0);
    wAppend.setLayoutData(fdAppend);
    wAppend.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            input.setChanged();
        }
    });
    // Create Parent Folder
    Label wlCreateParentFolder = new Label(wFileName, SWT.RIGHT);
    wlCreateParentFolder.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.CreateParentFolder.Label"));
    props.setLook(wlCreateParentFolder);
    FormData fdlCreateParentFolder = new FormData();
    fdlCreateParentFolder.left = new FormAttachment(0, 0);
    fdlCreateParentFolder.top = new FormAttachment(wAppend, margin);
    fdlCreateParentFolder.right = new FormAttachment(middle, -margin);
    wlCreateParentFolder.setLayoutData(fdlCreateParentFolder);
    wCreateParentFolder = new Button(wFileName, SWT.CHECK);
    wCreateParentFolder.setToolTipText(BaseMessages.getString(PKG, "PropertyOutputDialog.CreateParentFolder.Tooltip"));
    props.setLook(wCreateParentFolder);
    FormData fdCreateParentFolder = new FormData();
    fdCreateParentFolder.left = new FormAttachment(middle, 0);
    fdCreateParentFolder.top = new FormAttachment(wlCreateParentFolder, 0, SWT.CENTER);
    fdCreateParentFolder.right = new FormAttachment(100, 0);
    wCreateParentFolder.setLayoutData(fdCreateParentFolder);
    wCreateParentFolder.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // FileNameInField line
    Label wlFileNameInField = new Label(wFileName, SWT.RIGHT);
    wlFileNameInField.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.FileNameInField.Label"));
    props.setLook(wlFileNameInField);
    FormData fdlFileNameInField = new FormData();
    fdlFileNameInField.left = new FormAttachment(0, 0);
    fdlFileNameInField.top = new FormAttachment(wCreateParentFolder, margin);
    fdlFileNameInField.right = new FormAttachment(middle, -margin);
    wlFileNameInField.setLayoutData(fdlFileNameInField);
    wFileNameInField = new Button(wFileName, SWT.CHECK);
    wlFileNameInField.setToolTipText(BaseMessages.getString(PKG, "PropertyOutputDialog.FileNameInField.Label"));
    props.setLook(wFileNameInField);
    FormData fdFileNameInField = new FormData();
    fdFileNameInField.left = new FormAttachment(middle, 0);
    fdFileNameInField.top = new FormAttachment(wlFileNameInField, 0, SWT.CENTER);
    fdFileNameInField.right = new FormAttachment(100, 0);
    wFileNameInField.setLayoutData(fdFileNameInField);
    wFileNameInField.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
            activateFilenameInField();
        }
    });
    // FileNameField Line
    wlFileNameField = new Label(wFileName, SWT.RIGHT);
    wlFileNameField.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.FileNameField.Label"));
    props.setLook(wlFileNameField);
    FormData fdlFileNameField = new FormData();
    fdlFileNameField.left = new FormAttachment(0, 0);
    fdlFileNameField.right = new FormAttachment(middle, -margin);
    fdlFileNameField.top = new FormAttachment(wFileNameInField, margin);
    wlFileNameField.setLayoutData(fdlFileNameField);
    wFileNameField = new ComboVar(variables, wFileName, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFileNameField);
    wFileNameField.addModifyListener(lsMod);
    FormData fdFileNameField = new FormData();
    fdFileNameField.left = new FormAttachment(middle, 0);
    fdFileNameField.top = new FormAttachment(wFileNameInField, margin);
    fdFileNameField.right = new FormAttachment(100, 0);
    wFileNameField.setLayoutData(fdFileNameField);
    wFileNameField.setEnabled(false);
    wFileNameField.setItems(fieldNames);
    // Extension line
    wlExtension = new Label(wFileName, SWT.RIGHT);
    wlExtension.setText(BaseMessages.getString(PKG, "System.Label.Extension"));
    props.setLook(wlExtension);
    FormData fdlExtension = new FormData();
    fdlExtension.left = new FormAttachment(0, 0);
    fdlExtension.top = new FormAttachment(wFileNameField, margin);
    fdlExtension.right = new FormAttachment(middle, -margin);
    wlExtension.setLayoutData(fdlExtension);
    wExtension = new TextVar(variables, wFileName, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wExtension);
    wExtension.addModifyListener(lsMod);
    FormData fdExtension = new FormData();
    fdExtension.left = new FormAttachment(middle, 0);
    fdExtension.top = new FormAttachment(wFileNameField, margin);
    fdExtension.right = new FormAttachment(100, -margin);
    wExtension.setLayoutData(fdExtension);
    // Create multi-part file?
    wlAddTransformNr = new Label(wFileName, SWT.RIGHT);
    wlAddTransformNr.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.AddTransformnr.Label"));
    props.setLook(wlAddTransformNr);
    FormData fdlAddTransformNr = new FormData();
    fdlAddTransformNr.left = new FormAttachment(0, 0);
    fdlAddTransformNr.top = new FormAttachment(wExtension, 2 * margin);
    fdlAddTransformNr.right = new FormAttachment(middle, -margin);
    wlAddTransformNr.setLayoutData(fdlAddTransformNr);
    wAddTransformNr = new Button(wFileName, SWT.CHECK);
    props.setLook(wAddTransformNr);
    FormData fdAddTransformNr = new FormData();
    fdAddTransformNr.left = new FormAttachment(middle, 0);
    fdAddTransformNr.top = new FormAttachment(wlAddTransformNr, 0, SWT.CENTER);
    fdAddTransformNr.right = new FormAttachment(100, 0);
    wAddTransformNr.setLayoutData(fdAddTransformNr);
    wAddTransformNr.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // Create multi-part file?
    wlAddDate = new Label(wFileName, SWT.RIGHT);
    wlAddDate.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.AddDate.Label"));
    props.setLook(wlAddDate);
    FormData fdlAddDate = new FormData();
    fdlAddDate.left = new FormAttachment(0, 0);
    fdlAddDate.top = new FormAttachment(wAddTransformNr, margin);
    fdlAddDate.right = new FormAttachment(middle, -margin);
    wlAddDate.setLayoutData(fdlAddDate);
    wAddDate = new Button(wFileName, SWT.CHECK);
    props.setLook(wAddDate);
    FormData fdAddDate = new FormData();
    fdAddDate.left = new FormAttachment(middle, 0);
    fdAddDate.top = new FormAttachment(wlAddDate, 0, SWT.CENTER);
    fdAddDate.right = new FormAttachment(100, 0);
    wAddDate.setLayoutData(fdAddDate);
    wAddDate.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    // Create multi-part file?
    wlAddTime = new Label(wFileName, SWT.RIGHT);
    wlAddTime.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.AddTime.Label"));
    props.setLook(wlAddTime);
    FormData fdlAddTime = new FormData();
    fdlAddTime.left = new FormAttachment(0, 0);
    fdlAddTime.top = new FormAttachment(wAddDate, margin);
    fdlAddTime.right = new FormAttachment(middle, -margin);
    wlAddTime.setLayoutData(fdlAddTime);
    wAddTime = new Button(wFileName, SWT.CHECK);
    props.setLook(wAddTime);
    FormData fdAddTime = new FormData();
    fdAddTime.left = new FormAttachment(middle, 0);
    fdAddTime.top = new FormAttachment(wlAddTime, 0, SWT.CENTER);
    fdAddTime.right = new FormAttachment(100, 0);
    wAddTime.setLayoutData(fdAddTime);
    wAddTime.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    });
    wbShowFiles = new Button(wFileName, SWT.PUSH | SWT.CENTER);
    props.setLook(wbShowFiles);
    wbShowFiles.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.ShowFiles.Button"));
    FormData fdbShowFiles = new FormData();
    fdbShowFiles.left = new FormAttachment(middle, 0);
    fdbShowFiles.top = new FormAttachment(wAddTime, margin * 2);
    wbShowFiles.setLayoutData(fdbShowFiles);
    wbShowFiles.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            PropertyOutputMeta tfoi = new PropertyOutputMeta();
            getInfo(tfoi);
            String[] files = tfoi.getFiles(variables);
            if (files != null && files.length > 0) {
                EnterSelectionDialog esd = new EnterSelectionDialog(shell, files, BaseMessages.getString(PKG, "PropertyOutputDialog.SelectOutputFiles.DialogTitle"), BaseMessages.getString(PKG, "PropertyOutputDialog.SelectOutputFiles.DialogMessage"));
                esd.setViewOnly();
                esd.open();
            } else {
                MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
                mb.setMessage(BaseMessages.getString(PKG, "PropertyOutputDialog.NoFilesFound.DialogMessage"));
                mb.setText(BaseMessages.getString(PKG, "System.DialogTitle.Error"));
                mb.open();
            }
        }
    });
    FormData fdFileName = new FormData();
    fdFileName.left = new FormAttachment(0, margin);
    fdFileName.top = new FormAttachment(wFields, margin);
    fdFileName.right = new FormAttachment(100, -margin);
    wFileName.setLayoutData(fdFileName);
    // ///////////////////////////////////////////////////////////
    // / END OF FileName GROUP
    // ///////////////////////////////////////////////////////////
    // File grouping?
    // ////////////////////////
    // START OF ResultFile GROUP
    // 
    Group wResultFile = new Group(wContentComp, SWT.SHADOW_NONE);
    props.setLook(wResultFile);
    wResultFile.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.Group.ResultFile.Label"));
    FormLayout groupResultFile = new FormLayout();
    groupResultFile.marginWidth = 10;
    groupResultFile.marginHeight = 10;
    wResultFile.setLayout(groupResultFile);
    // Add File to the result files name
    Label wlAddToResult = new Label(wResultFile, SWT.RIGHT);
    wlAddToResult.setText(BaseMessages.getString(PKG, "PropertyOutputDialog.AddFileToResult.Label"));
    props.setLook(wlAddToResult);
    FormData fdlAddToResult = new FormData();
    fdlAddToResult.left = new FormAttachment(0, 0);
    fdlAddToResult.top = new FormAttachment(wFileName, margin);
    fdlAddToResult.right = new FormAttachment(middle, -margin);
    wlAddToResult.setLayoutData(fdlAddToResult);
    wAddToResult = new Button(wResultFile, SWT.CHECK);
    wAddToResult.setToolTipText(BaseMessages.getString(PKG, "PropertyOutputDialog.AddFileToResult.Tooltip"));
    props.setLook(wAddToResult);
    FormData fdAddToResult = new FormData();
    fdAddToResult.left = new FormAttachment(middle, 0);
    fdAddToResult.top = new FormAttachment(wlAddToResult, 0, SWT.CENTER);
    fdAddToResult.right = new FormAttachment(100, 0);
    wAddToResult.setLayoutData(fdAddToResult);
    SelectionAdapter lsSelAR = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            input.setChanged();
        }
    };
    wAddToResult.addSelectionListener(lsSelAR);
    FormData fdResultFile = new FormData();
    fdResultFile.left = new FormAttachment(0, margin);
    fdResultFile.top = new FormAttachment(wFileName, margin);
    fdResultFile.right = new FormAttachment(100, -margin);
    wResultFile.setLayoutData(fdResultFile);
    // ///////////////////////////////////////////////////////////
    // / END OF ResultFile GROUP
    // ///////////////////////////////////////////////////////////
    FormData fdContentComp = new FormData();
    fdContentComp.left = new FormAttachment(0, 0);
    fdContentComp.top = new FormAttachment(0, 0);
    fdContentComp.right = new FormAttachment(100, 0);
    fdContentComp.bottom = new FormAttachment(100, 0);
    wContentComp.setLayoutData(wContentComp);
    wContentComp.layout();
    wContentTab.setControl(wContentComp);
    // ///////////////////////////////////////////////////////////
    // / END OF CONTENT TAB
    // ///////////////////////////////////////////////////////////
    FormData fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(wTransformName, margin);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(wOk, -2 * margin);
    wTabFolder.setLayoutData(fdTabFolder);
    // Add listeners
    wbFilename.addListener(SWT.Selection, e -> BaseDialog.presentFileDialog(shell, wFilename, variables, new String[] { "*.txt", "*.csv", "*" }, new String[] { BaseMessages.getString(PKG, "System.FileType.TextFiles"), BaseMessages.getString(PKG, "System.FileType.CSVFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") }, true));
    wTabFolder.setSelection(0);
    getData();
    activateFilenameInField();
    input.setChanged(changed);
    BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());
    return transformName;
}
Also used : IVariables(org.apache.hop.core.variables.IVariables) Props(org.apache.hop.core.Props) HopException(org.apache.hop.core.exception.HopException) ITransformDialog(org.apache.hop.pipeline.transform.ITransformDialog) PipelineMeta(org.apache.hop.pipeline.PipelineMeta) CCombo(org.eclipse.swt.custom.CCombo) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) IRowMeta(org.apache.hop.core.row.IRowMeta) BaseMessages(org.apache.hop.i18n.BaseMessages) CTabFolder(org.eclipse.swt.custom.CTabFolder) FormLayout(org.eclipse.swt.layout.FormLayout) BaseDialog(org.apache.hop.ui.core.dialog.BaseDialog) FormData(org.eclipse.swt.layout.FormData) org.eclipse.swt.widgets(org.eclipse.swt.widgets) BaseTransformMeta(org.apache.hop.pipeline.transform.BaseTransformMeta) FormAttachment(org.eclipse.swt.layout.FormAttachment) EnterSelectionDialog(org.apache.hop.ui.core.dialog.EnterSelectionDialog) Const(org.apache.hop.core.Const) CTabItem(org.eclipse.swt.custom.CTabItem) ErrorDialog(org.apache.hop.ui.core.dialog.ErrorDialog) ComboVar(org.apache.hop.ui.core.widget.ComboVar) TextVar(org.apache.hop.ui.core.widget.TextVar) ModifyListener(org.eclipse.swt.events.ModifyListener) SWT(org.eclipse.swt.SWT) SelectionEvent(org.eclipse.swt.events.SelectionEvent) BaseTransformDialog(org.apache.hop.ui.pipeline.transform.BaseTransformDialog) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ComboVar(org.apache.hop.ui.core.widget.ComboVar) CTabFolder(org.eclipse.swt.custom.CTabFolder) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) CTabItem(org.eclipse.swt.custom.CTabItem) TextVar(org.apache.hop.ui.core.widget.TextVar) CCombo(org.eclipse.swt.custom.CCombo) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) EnterSelectionDialog(org.apache.hop.ui.core.dialog.EnterSelectionDialog)

Example 3 with ComboVar

use of org.apache.hop.ui.core.widget.ComboVar in project hop by apache.

the class ProjectsConfigOptionPlugin method persistContents.

@Override
public void persistContents(GuiCompositeWidgets compositeWidgets) {
    for (String widgetId : compositeWidgets.getWidgetsMap().keySet()) {
        Control control = compositeWidgets.getWidgetsMap().get(widgetId);
        switch(widgetId) {
            case WIDGET_ID_ENABLE_PROJECTS:
                projectsEnabled = ((Button) control).getSelection();
                ProjectsConfigSingleton.getConfig().setEnabled(projectsEnabled);
                break;
            case WIDGET_ID_PROJECT_MANDATORY:
                projectMandatory = ((Button) control).getSelection();
                ProjectsConfigSingleton.getConfig().setProjectMandatory(projectMandatory);
                break;
            case WIDGET_ID_ENVIRONMENT_MANDATORY:
                environmentMandatory = ((Button) control).getSelection();
                ProjectsConfigSingleton.getConfig().setEnvironmentMandatory(environmentMandatory);
                break;
            case WIDGET_ID_DEFAULT_PROJECT:
                String defProject = ((ComboVar) control).getText();
                if (!StringUtils.isEmpty(defProject)) {
                    boolean defParentPrjExists = ProjectsUtil.projectExists(defProject);
                    if (!defParentPrjExists) {
                        MessageBox box = new MessageBox(HopGui.getInstance().getShell(), SWT.OK | SWT.ICON_ERROR);
                        box.setText(BaseMessages.getString(PKG, "ProjectConfig.ProjectNotExists.Error.Header"));
                        box.setMessage(BaseMessages.getString(PKG, "ProjectConfig.ProjectNotExists.DefaultProject.Error.Message", defProject));
                        box.open();
                    } else {
                        defaultProject = defProject;
                        ProjectsConfigSingleton.getConfig().setDefaultProject(defaultProject);
                    }
                }
                break;
            case WIDGET_ID_DEFAULT_ENVIRONMENT:
                defaultEnvironment = ((TextVar) control).getText();
                ProjectsConfigSingleton.getConfig().setDefaultEnvironment(defaultEnvironment);
                break;
            case WIDGET_ID_STANDARD_PARENT_PROJECT:
                String stdParentProject = ((ComboVar) control).getText();
                if (!StringUtils.isEmpty(stdParentProject)) {
                    boolean stdParentPrjExists = ProjectsUtil.projectExists(stdParentProject);
                    if (!stdParentPrjExists) {
                        MessageBox box = new MessageBox(HopGui.getInstance().getShell(), SWT.OK | SWT.ICON_ERROR);
                        box.setText(BaseMessages.getString(PKG, "ProjectConfig.ProjectNotExists.Error.Header"));
                        box.setMessage(BaseMessages.getString(PKG, "ProjectConfig.ProjectNotExists.StandardProject.Error.Message", stdParentProject));
                        box.open();
                    } else {
                        standardParentProject = stdParentProject;
                        ProjectsConfigSingleton.getConfig().setStandardParentProject(standardParentProject);
                    }
                }
                break;
            case WIDGET_ID_STANDARD_PROJECTS_FOLDER:
                standardProjectsFolder = ((TextVar) control).getText();
                ProjectsConfigSingleton.getConfig().setStandardProjectsFolder(standardProjectsFolder);
                break;
            case WIDGET_ID_DEFAULT_PROJECT_CONFIG_FILENAME:
                defaultProjectConfigFile = ((TextVar) control).getText();
                ProjectsConfigSingleton.getConfig().setDefaultProjectConfigFile(defaultProjectConfigFile);
                break;
        }
    }
    // 
    try {
        ProjectsConfigSingleton.saveConfig();
    } catch (Exception e) {
        new ErrorDialog(HopGui.getInstance().getShell(), BaseMessages.getString(PKG, "ProjectConfig.SavingOption.ErrorDialog.Header"), BaseMessages.getString(PKG, "ProjectConfig.SavingOption.ErrorDialog.Message"), e);
    }
}
Also used : Control(org.eclipse.swt.widgets.Control) ComboVar(org.apache.hop.ui.core.widget.ComboVar) ErrorDialog(org.apache.hop.ui.core.dialog.ErrorDialog) HopException(org.apache.hop.core.exception.HopException) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 4 with ComboVar

use of org.apache.hop.ui.core.widget.ComboVar in project hop by apache.

the class BeamBigtableOutputDialog method open.

@Override
public String open() {
    Shell parent = getParent();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
    props.setLook(shell);
    setShellImage(shell, input);
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "BeamBigtableOutputDialog.DialogTitle"));
    String[] sourceFields;
    try {
        sourceFields = pipelineMeta.getPrevTransformFields(variables, transformName).getFieldNames();
    } catch (Exception e) {
        sourceFields = new String[] {};
        LogChannel.UI.logError("Error getting source fields", e);
    }
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Buttons at the bottom
    // 
    wOk = new Button(shell, SWT.PUSH);
    wOk.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wOk.addListener(SWT.Selection, e -> ok());
    wGet = new Button(shell, SWT.PUSH);
    wGet.setText(BaseMessages.getString(PKG, "System.Button.GetFields"));
    wGet.addListener(SWT.Selection, e -> getFields());
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    wCancel.addListener(SWT.Selection, e -> cancel());
    setButtonPositions(new Button[] { wOk, wGet, wCancel }, margin, null);
    // TransformName line
    wlTransformName = new Label(shell, SWT.RIGHT);
    wlTransformName.setText(BaseMessages.getString(PKG, "System.Label.TransformName"));
    props.setLook(wlTransformName);
    fdlTransformName = new FormData();
    fdlTransformName.left = new FormAttachment(0, 0);
    fdlTransformName.top = new FormAttachment(0, margin);
    fdlTransformName.right = new FormAttachment(middle, -margin);
    wlTransformName.setLayoutData(fdlTransformName);
    wTransformName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wTransformName.setText(transformName);
    props.setLook(wTransformName);
    fdTransformName = new FormData();
    fdTransformName.left = new FormAttachment(middle, 0);
    fdTransformName.top = new FormAttachment(wlTransformName, 0, SWT.CENTER);
    fdTransformName.right = new FormAttachment(100, 0);
    wTransformName.setLayoutData(fdTransformName);
    Control lastControl = wTransformName;
    Label wlProjectId = new Label(shell, SWT.RIGHT);
    wlProjectId.setText(BaseMessages.getString(PKG, "BeamBigtableOutputDialog.ProjectId"));
    props.setLook(wlProjectId);
    FormData fdlProjectId = new FormData();
    fdlProjectId.left = new FormAttachment(0, 0);
    fdlProjectId.top = new FormAttachment(lastControl, margin);
    fdlProjectId.right = new FormAttachment(middle, -margin);
    wlProjectId.setLayoutData(fdlProjectId);
    wProjectId = new TextVar(variables, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wProjectId);
    FormData fdProjectId = new FormData();
    fdProjectId.left = new FormAttachment(middle, 0);
    fdProjectId.top = new FormAttachment(wlProjectId, 0, SWT.CENTER);
    fdProjectId.right = new FormAttachment(100, 0);
    wProjectId.setLayoutData(fdProjectId);
    lastControl = wProjectId;
    Label wlInstanceId = new Label(shell, SWT.RIGHT);
    wlInstanceId.setText(BaseMessages.getString(PKG, "BeamBigtableOutputDialog.InstanceId"));
    props.setLook(wlInstanceId);
    FormData fdlInstanceId = new FormData();
    fdlInstanceId.left = new FormAttachment(0, 0);
    fdlInstanceId.top = new FormAttachment(lastControl, margin);
    fdlInstanceId.right = new FormAttachment(middle, -margin);
    wlInstanceId.setLayoutData(fdlInstanceId);
    wInstanceId = new TextVar(variables, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wInstanceId);
    FormData fdInstanceId = new FormData();
    fdInstanceId.left = new FormAttachment(middle, 0);
    fdInstanceId.top = new FormAttachment(wlInstanceId, 0, SWT.CENTER);
    fdInstanceId.right = new FormAttachment(100, 0);
    wInstanceId.setLayoutData(fdInstanceId);
    lastControl = wInstanceId;
    Label wlTableId = new Label(shell, SWT.RIGHT);
    wlTableId.setText(BaseMessages.getString(PKG, "BeamBigtableOutputDialog.TableId"));
    props.setLook(wlTableId);
    FormData fdlTableId = new FormData();
    fdlTableId.left = new FormAttachment(0, 0);
    fdlTableId.top = new FormAttachment(lastControl, margin);
    fdlTableId.right = new FormAttachment(middle, -margin);
    wlTableId.setLayoutData(fdlTableId);
    wTableId = new TextVar(variables, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wTableId);
    FormData fdTableId = new FormData();
    fdTableId.left = new FormAttachment(middle, 0);
    fdTableId.top = new FormAttachment(wlTableId, 0, SWT.CENTER);
    fdTableId.right = new FormAttachment(100, 0);
    wTableId.setLayoutData(fdTableId);
    lastControl = wTableId;
    Label wlKeyField = new Label(shell, SWT.RIGHT);
    wlKeyField.setText(BaseMessages.getString(PKG, "BeamBigtableOutputDialog.KeyField"));
    props.setLook(wlKeyField);
    FormData fdlKeyField = new FormData();
    fdlKeyField.left = new FormAttachment(0, 0);
    fdlKeyField.top = new FormAttachment(lastControl, margin);
    fdlKeyField.right = new FormAttachment(middle, -margin);
    wlKeyField.setLayoutData(fdlKeyField);
    wKeyField = new ComboVar(variables, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wKeyField);
    wKeyField.setItems(sourceFields);
    FormData fdKeyField = new FormData();
    fdKeyField.left = new FormAttachment(middle, 0);
    fdKeyField.top = new FormAttachment(wlKeyField, 0, SWT.CENTER);
    fdKeyField.right = new FormAttachment(100, 0);
    wKeyField.setLayoutData(fdKeyField);
    lastControl = wKeyField;
    Label wlColumns = new Label(shell, SWT.LEFT);
    wlColumns.setText(BaseMessages.getString(PKG, "BeamBigtableOutputDialog.Columns"));
    props.setLook(wlColumns);
    FormData fdlColumns = new FormData();
    fdlColumns.left = new FormAttachment(0, 0);
    fdlColumns.top = new FormAttachment(lastControl, margin);
    fdlColumns.right = new FormAttachment(100, 0);
    wlColumns.setLayoutData(fdlColumns);
    lastControl = wlColumns;
    ColumnInfo[] columns = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "BeamBigtableOutputDialog.Column.Name"), ColumnInfo.COLUMN_TYPE_TEXT, false, false), new ColumnInfo(BaseMessages.getString(PKG, "BeamBigtableOutputDialog.Column.Family"), ColumnInfo.COLUMN_TYPE_TEXT, false, false), new ColumnInfo(BaseMessages.getString(PKG, "BeamBigtableOutputDialog.Column.SourceField"), ColumnInfo.COLUMN_TYPE_CCOMBO, sourceFields, false) };
    wColumns = new TableView(variables, shell, SWT.BORDER, columns, input.getColumns().size(), null, props);
    FormData fdColumns = new FormData();
    fdColumns.left = new FormAttachment(0, 0);
    fdColumns.top = new FormAttachment(lastControl, margin);
    fdColumns.right = new FormAttachment(100, 0);
    fdColumns.bottom = new FormAttachment(wOk, -2 * margin);
    wColumns.setLayoutData(fdColumns);
    getData();
    BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());
    return transformName;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ComboVar(org.apache.hop.ui.core.widget.ComboVar) ColumnInfo(org.apache.hop.ui.core.widget.ColumnInfo) TextVar(org.apache.hop.ui.core.widget.TextVar) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableView(org.apache.hop.ui.core.widget.TableView)

Example 5 with ComboVar

use of org.apache.hop.ui.core.widget.ComboVar in project hop by apache.

the class BeamConsumeDialog method open.

@Override
public String open() {
    Shell parent = getParent();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
    props.setLook(shell);
    setShellImage(shell, input);
    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, "BeamConsumeDialog.DialogTitle"));
    middle = props.getMiddlePct();
    margin = Const.MARGIN;
    // Buttons go at the very bottom
    // 
    wOk = new Button(shell, SWT.PUSH);
    wOk.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wOk.addListener(SWT.Selection, e -> ok());
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    wCancel.addListener(SWT.Selection, e -> cancel());
    BaseTransformDialog.positionBottomButtons(shell, new Button[] { wOk, wCancel }, margin, null);
    // TransformName line
    wlTransformName = new Label(shell, SWT.RIGHT);
    wlTransformName.setText(BaseMessages.getString(PKG, "System.Label.TransformName"));
    props.setLook(wlTransformName);
    fdlTransformName = new FormData();
    fdlTransformName.left = new FormAttachment(0, 0);
    fdlTransformName.top = new FormAttachment(0, margin);
    fdlTransformName.right = new FormAttachment(middle, -margin);
    wlTransformName.setLayoutData(fdlTransformName);
    wTransformName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wTransformName.setText(transformName);
    props.setLook(wTransformName);
    fdTransformName = new FormData();
    fdTransformName.left = new FormAttachment(middle, 0);
    fdTransformName.top = new FormAttachment(wlTransformName, 0, SWT.CENTER);
    fdTransformName.right = new FormAttachment(100, 0);
    wTransformName.setLayoutData(fdTransformName);
    Control lastControl = wTransformName;
    Label wlBootstrapServers = new Label(shell, SWT.RIGHT);
    wlBootstrapServers.setText(BaseMessages.getString(PKG, "BeamConsumeDialog.BootstrapServers"));
    props.setLook(wlBootstrapServers);
    FormData fdlBootstrapServers = new FormData();
    fdlBootstrapServers.left = new FormAttachment(0, 0);
    fdlBootstrapServers.top = new FormAttachment(lastControl, margin);
    fdlBootstrapServers.right = new FormAttachment(middle, -margin);
    wlBootstrapServers.setLayoutData(fdlBootstrapServers);
    wBootstrapServers = new TextVar(variables, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wBootstrapServers);
    FormData fdBootstrapServers = new FormData();
    fdBootstrapServers.left = new FormAttachment(middle, 0);
    fdBootstrapServers.top = new FormAttachment(wlBootstrapServers, 0, SWT.CENTER);
    fdBootstrapServers.right = new FormAttachment(100, 0);
    wBootstrapServers.setLayoutData(fdBootstrapServers);
    lastControl = wBootstrapServers;
    Label wlTopics = new Label(shell, SWT.RIGHT);
    wlTopics.setText(BaseMessages.getString(PKG, "BeamConsumeDialog.Topics"));
    props.setLook(wlTopics);
    FormData fdlTopics = new FormData();
    fdlTopics.left = new FormAttachment(0, 0);
    fdlTopics.top = new FormAttachment(lastControl, margin);
    fdlTopics.right = new FormAttachment(middle, -margin);
    wlTopics.setLayoutData(fdlTopics);
    wTopics = new TextVar(variables, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wTopics);
    FormData fdTopics = new FormData();
    fdTopics.left = new FormAttachment(middle, 0);
    fdTopics.top = new FormAttachment(wlTopics, 0, SWT.CENTER);
    fdTopics.right = new FormAttachment(100, 0);
    wTopics.setLayoutData(fdTopics);
    lastControl = wTopics;
    Label wlGroupId = new Label(shell, SWT.RIGHT);
    wlGroupId.setText(BaseMessages.getString(PKG, "BeamConsumeDialog.GroupId"));
    props.setLook(wlGroupId);
    FormData fdlGroupId = new FormData();
    fdlGroupId.left = new FormAttachment(0, 0);
    fdlGroupId.top = new FormAttachment(lastControl, margin);
    fdlGroupId.right = new FormAttachment(middle, -margin);
    wlGroupId.setLayoutData(fdlGroupId);
    wGroupId = new TextVar(variables, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wGroupId);
    FormData fdGroupId = new FormData();
    fdGroupId.left = new FormAttachment(middle, 0);
    fdGroupId.top = new FormAttachment(wlGroupId, 0, SWT.CENTER);
    fdGroupId.right = new FormAttachment(100, 0);
    wGroupId.setLayoutData(fdGroupId);
    lastControl = wGroupId;
    Label wlKeyField = new Label(shell, SWT.RIGHT);
    wlKeyField.setText(BaseMessages.getString(PKG, "BeamConsumeDialog.KeyField"));
    props.setLook(wlKeyField);
    FormData fdlKeyField = new FormData();
    fdlKeyField.left = new FormAttachment(0, 0);
    fdlKeyField.top = new FormAttachment(lastControl, margin);
    fdlKeyField.right = new FormAttachment(middle, -margin);
    wlKeyField.setLayoutData(fdlKeyField);
    wKeyField = new TextVar(variables, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wKeyField);
    FormData fdKeyField = new FormData();
    fdKeyField.left = new FormAttachment(middle, 0);
    fdKeyField.top = new FormAttachment(wlKeyField, 0, SWT.CENTER);
    fdKeyField.right = new FormAttachment(100, 0);
    wKeyField.setLayoutData(fdKeyField);
    lastControl = wKeyField;
    Label wlMessageField = new Label(shell, SWT.RIGHT);
    wlMessageField.setText(BaseMessages.getString(PKG, "BeamConsumeDialog.MessageField"));
    props.setLook(wlMessageField);
    FormData fdlMessageField = new FormData();
    fdlMessageField.left = new FormAttachment(0, 0);
    fdlMessageField.top = new FormAttachment(lastControl, margin);
    fdlMessageField.right = new FormAttachment(middle, -margin);
    wlMessageField.setLayoutData(fdlMessageField);
    wMessageField = new TextVar(variables, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wMessageField);
    FormData fdMessageField = new FormData();
    fdMessageField.left = new FormAttachment(middle, 0);
    fdMessageField.top = new FormAttachment(wlMessageField, 0, SWT.CENTER);
    fdMessageField.right = new FormAttachment(100, 0);
    wMessageField.setLayoutData(fdMessageField);
    lastControl = wMessageField;
    Label wlMessageType = new Label(shell, SWT.RIGHT);
    wlMessageType.setText(BaseMessages.getString(PKG, "BeamConsumeDialog.MessageType"));
    props.setLook(wlMessageType);
    FormData fdlMessageType = new FormData();
    fdlMessageType.left = new FormAttachment(0, 0);
    fdlMessageType.top = new FormAttachment(lastControl, margin);
    fdlMessageType.right = new FormAttachment(middle, -margin);
    wlMessageType.setLayoutData(fdlMessageType);
    wMessageType = new ComboVar(variables, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wMessageType.setItems(new String[] { "String", "Avro Record" });
    props.setLook(wMessageType);
    FormData fdMessageType = new FormData();
    fdMessageType.left = new FormAttachment(middle, 0);
    fdMessageType.top = new FormAttachment(wlMessageType, 0, SWT.CENTER);
    fdMessageType.right = new FormAttachment(100, 0);
    wMessageType.setLayoutData(fdMessageType);
    lastControl = wMessageType;
    Label wlSchemaRegistryUrl = new Label(shell, SWT.RIGHT);
    wlSchemaRegistryUrl.setText(BaseMessages.getString(PKG, "BeamConsumeDialog.SchemaRegistryUrl"));
    props.setLook(wlSchemaRegistryUrl);
    FormData fdlSchemaRegistryUrl = new FormData();
    fdlSchemaRegistryUrl.left = new FormAttachment(0, 0);
    fdlSchemaRegistryUrl.top = new FormAttachment(lastControl, margin);
    fdlSchemaRegistryUrl.right = new FormAttachment(middle, -margin);
    wlSchemaRegistryUrl.setLayoutData(fdlSchemaRegistryUrl);
    wSchemaRegistryUrl = new TextVar(variables, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wSchemaRegistryUrl);
    FormData fdSchemaRegistryUrl = new FormData();
    fdSchemaRegistryUrl.left = new FormAttachment(middle, 0);
    fdSchemaRegistryUrl.top = new FormAttachment(wlSchemaRegistryUrl, 0, SWT.CENTER);
    fdSchemaRegistryUrl.right = new FormAttachment(100, 0);
    wSchemaRegistryUrl.setLayoutData(fdSchemaRegistryUrl);
    lastControl = wSchemaRegistryUrl;
    Label wlSchemaRegistrySubject = new Label(shell, SWT.RIGHT);
    wlSchemaRegistrySubject.setText(BaseMessages.getString(PKG, "BeamConsumeDialog.SchemaRegistrySubject"));
    props.setLook(wlSchemaRegistrySubject);
    FormData fdlSchemaRegistrySubject = new FormData();
    fdlSchemaRegistrySubject.left = new FormAttachment(0, 0);
    fdlSchemaRegistrySubject.top = new FormAttachment(lastControl, margin);
    fdlSchemaRegistrySubject.right = new FormAttachment(middle, -margin);
    wlSchemaRegistrySubject.setLayoutData(fdlSchemaRegistrySubject);
    wSchemaRegistrySubject = new TextVar(variables, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wSchemaRegistrySubject);
    FormData fdSchemaRegistrySubject = new FormData();
    fdSchemaRegistrySubject.left = new FormAttachment(middle, 0);
    fdSchemaRegistrySubject.top = new FormAttachment(wlSchemaRegistrySubject, 0, SWT.CENTER);
    fdSchemaRegistrySubject.right = new FormAttachment(100, 0);
    wSchemaRegistrySubject.setLayoutData(fdSchemaRegistrySubject);
    lastControl = wSchemaRegistrySubject;
    Label wlUseProcessingTime = new Label(shell, SWT.RIGHT);
    wlUseProcessingTime.setText(BaseMessages.getString(PKG, "BeamProduceDialog.UseProcessingTime"));
    props.setLook(wlUseProcessingTime);
    FormData fdlUseProcessingTime = new FormData();
    fdlUseProcessingTime.left = new FormAttachment(0, 0);
    fdlUseProcessingTime.top = new FormAttachment(lastControl, margin);
    fdlUseProcessingTime.right = new FormAttachment(middle, -margin);
    wlUseProcessingTime.setLayoutData(fdlUseProcessingTime);
    wUseProcessingTime = new Button(shell, SWT.CHECK | SWT.LEFT);
    props.setLook(wUseProcessingTime);
    FormData fdUseProcessingTime = new FormData();
    fdUseProcessingTime.left = new FormAttachment(middle, 0);
    fdUseProcessingTime.top = new FormAttachment(wlUseProcessingTime, 0, SWT.CENTER);
    fdUseProcessingTime.right = new FormAttachment(100, 0);
    wUseProcessingTime.setLayoutData(fdUseProcessingTime);
    lastControl = wUseProcessingTime;
    Label wlUseLogAppendTime = new Label(shell, SWT.RIGHT);
    wlUseLogAppendTime.setText(BaseMessages.getString(PKG, "BeamProduceDialog.UseLogAppendTime"));
    props.setLook(wlUseLogAppendTime);
    FormData fdlUseLogAppendTime = new FormData();
    fdlUseLogAppendTime.left = new FormAttachment(0, 0);
    fdlUseLogAppendTime.top = new FormAttachment(lastControl, 2 * margin);
    fdlUseLogAppendTime.right = new FormAttachment(middle, -margin);
    wlUseLogAppendTime.setLayoutData(fdlUseLogAppendTime);
    wUseLogAppendTime = new Button(shell, SWT.CHECK | SWT.LEFT);
    props.setLook(wUseLogAppendTime);
    FormData fdUseLogAppendTime = new FormData();
    fdUseLogAppendTime.left = new FormAttachment(middle, 0);
    fdUseLogAppendTime.top = new FormAttachment(wlUseLogAppendTime, 0, SWT.CENTER);
    fdUseLogAppendTime.right = new FormAttachment(100, 0);
    wUseLogAppendTime.setLayoutData(fdUseLogAppendTime);
    lastControl = wUseLogAppendTime;
    Label wlUseCreateTime = new Label(shell, SWT.RIGHT);
    wlUseCreateTime.setText(BaseMessages.getString(PKG, "BeamProduceDialog.UseCreateTime"));
    props.setLook(wlUseCreateTime);
    FormData fdlUseCreateTime = new FormData();
    fdlUseCreateTime.left = new FormAttachment(0, 0);
    fdlUseCreateTime.top = new FormAttachment(lastControl, 2 * margin);
    fdlUseCreateTime.right = new FormAttachment(middle, -margin);
    wlUseCreateTime.setLayoutData(fdlUseCreateTime);
    wUseCreateTime = new Button(shell, SWT.CHECK | SWT.LEFT);
    props.setLook(wUseCreateTime);
    FormData fdUseCreateTime = new FormData();
    fdUseCreateTime.left = new FormAttachment(middle, 0);
    fdUseCreateTime.top = new FormAttachment(wlUseCreateTime, 0, SWT.CENTER);
    fdUseCreateTime.right = new FormAttachment(100, 0);
    wUseCreateTime.setLayoutData(fdUseCreateTime);
    lastControl = wUseCreateTime;
    Label wlRestrictToCommitted = new Label(shell, SWT.RIGHT);
    wlRestrictToCommitted.setText(BaseMessages.getString(PKG, "BeamProduceDialog.RestrictToCommitted"));
    props.setLook(wlRestrictToCommitted);
    FormData fdlRestrictToCommitted = new FormData();
    fdlRestrictToCommitted.left = new FormAttachment(0, 0);
    fdlRestrictToCommitted.top = new FormAttachment(lastControl, 2 * margin);
    fdlRestrictToCommitted.right = new FormAttachment(middle, -margin);
    wlRestrictToCommitted.setLayoutData(fdlRestrictToCommitted);
    wRestrictToCommitted = new Button(shell, SWT.CHECK | SWT.LEFT);
    props.setLook(wRestrictToCommitted);
    FormData fdRestrictToCommitted = new FormData();
    fdRestrictToCommitted.left = new FormAttachment(middle, 0);
    fdRestrictToCommitted.top = new FormAttachment(wlRestrictToCommitted, 0, SWT.CENTER);
    fdRestrictToCommitted.right = new FormAttachment(100, 0);
    wRestrictToCommitted.setLayoutData(fdRestrictToCommitted);
    lastControl = wlRestrictToCommitted;
    Label wlAllowCommitConsumed = new Label(shell, SWT.RIGHT);
    wlAllowCommitConsumed.setText(BaseMessages.getString(PKG, "BeamProduceDialog.AllowCommitConsumed"));
    props.setLook(wlAllowCommitConsumed);
    FormData fdlAllowCommitConsumed = new FormData();
    fdlAllowCommitConsumed.left = new FormAttachment(0, 0);
    fdlAllowCommitConsumed.top = new FormAttachment(lastControl, 2 * margin);
    fdlAllowCommitConsumed.right = new FormAttachment(middle, -margin);
    wlAllowCommitConsumed.setLayoutData(fdlAllowCommitConsumed);
    wAllowCommitConsumed = new Button(shell, SWT.CHECK | SWT.LEFT);
    props.setLook(wAllowCommitConsumed);
    FormData fdAllowCommitConsumed = new FormData();
    fdAllowCommitConsumed.left = new FormAttachment(middle, 0);
    fdAllowCommitConsumed.top = new FormAttachment(wlAllowCommitConsumed, 0, SWT.CENTER);
    fdAllowCommitConsumed.right = new FormAttachment(100, 0);
    wAllowCommitConsumed.setLayoutData(fdAllowCommitConsumed);
    lastControl = wlAllowCommitConsumed;
    Label wlConfigOptions = new Label(shell, SWT.LEFT);
    wlConfigOptions.setText(BaseMessages.getString(PKG, "BeamProduceDialog.ConfigOptions"));
    props.setLook(wlConfigOptions);
    FormData fdlConfigOptions = new FormData();
    fdlConfigOptions.left = new FormAttachment(0, 0);
    fdlConfigOptions.top = new FormAttachment(lastControl, 2 * margin);
    fdlConfigOptions.right = new FormAttachment(100, 0);
    wlConfigOptions.setLayoutData(fdlConfigOptions);
    lastControl = wlConfigOptions;
    ColumnInfo[] columns = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "BeamProduceDialog.ConfigOptions.Column.Parameter"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "BeamProduceDialog.ConfigOptions.Column.Value"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "BeamProduceDialog.ConfigOptions.Column.Type"), ColumnInfo.COLUMN_TYPE_CCOMBO, ConfigOption.Type.getTypeNames(), false) };
    columns[0].setUsingVariables(true);
    columns[1].setUsingVariables(true);
    wConfigOptions = new TableView(variables, shell, SWT.NONE, columns, input.getConfigOptions().size(), null, props);
    props.setLook(wConfigOptions);
    FormData fdConfigOptions = new FormData();
    fdConfigOptions.left = new FormAttachment(0, 0);
    fdConfigOptions.right = new FormAttachment(100, 0);
    fdConfigOptions.top = new FormAttachment(lastControl, margin);
    fdConfigOptions.bottom = new FormAttachment(wOk, -margin * 2);
    wConfigOptions.setLayoutData(fdConfigOptions);
    wUseProcessingTime.addListener(SWT.Selection, e -> {
        wUseLogAppendTime.setSelection(false);
        wUseCreateTime.setSelection(false);
    });
    wUseLogAppendTime.addListener(SWT.Selection, e -> {
        wUseProcessingTime.setSelection(false);
        wUseCreateTime.setSelection(false);
    });
    wUseCreateTime.addListener(SWT.Selection, e -> {
        wUseProcessingTime.setSelection(false);
        wUseLogAppendTime.setSelection(false);
    });
    getData();
    BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());
    return transformName;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ComboVar(org.apache.hop.ui.core.widget.ComboVar) ColumnInfo(org.apache.hop.ui.core.widget.ColumnInfo) TextVar(org.apache.hop.ui.core.widget.TextVar) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableView(org.apache.hop.ui.core.widget.TableView)

Aggregations

ComboVar (org.apache.hop.ui.core.widget.ComboVar)35 FormAttachment (org.eclipse.swt.layout.FormAttachment)30 FormData (org.eclipse.swt.layout.FormData)30 FormLayout (org.eclipse.swt.layout.FormLayout)28 TextVar (org.apache.hop.ui.core.widget.TextVar)26 IVariables (org.apache.hop.core.variables.IVariables)22 SWT (org.eclipse.swt.SWT)21 Const (org.apache.hop.core.Const)20 BaseMessages (org.apache.hop.i18n.BaseMessages)20 org.eclipse.swt.widgets (org.eclipse.swt.widgets)19 BaseDialog (org.apache.hop.ui.core.dialog.BaseDialog)18 PipelineMeta (org.apache.hop.pipeline.PipelineMeta)17 BaseTransformDialog (org.apache.hop.ui.pipeline.transform.BaseTransformDialog)17 ColumnInfo (org.apache.hop.ui.core.widget.ColumnInfo)16 TableView (org.apache.hop.ui.core.widget.TableView)16 BaseTransformMeta (org.apache.hop.pipeline.transform.BaseTransformMeta)15 CTabItem (org.eclipse.swt.custom.CTabItem)15 HopException (org.apache.hop.core.exception.HopException)14 Utils (org.apache.hop.core.util.Utils)14 ITransformDialog (org.apache.hop.pipeline.transform.ITransformDialog)14