Search in sources :

Example 56 with TextVar

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

the class JobDialog method showChannelLogTableOptions.

private void showChannelLogTableOptions(ChannelLogTable channelLogTable) {
    addDBSchemaTableLogOptions(channelLogTable);
    // The log timeout in days
    // 
    Label wlLogTimeout = new Label(wLogOptionsComposite, SWT.RIGHT);
    wlLogTimeout.setText(BaseMessages.getString(PKG, "JobDialog.LogTimeout.Label"));
    wlLogTimeout.setToolTipText(BaseMessages.getString(PKG, "JobDialog.LogTimeout.Tooltip"));
    props.setLook(wlLogTimeout);
    FormData fdlLogTimeout = new FormData();
    fdlLogTimeout.left = new FormAttachment(0, 0);
    fdlLogTimeout.right = new FormAttachment(middle, -margin);
    fdlLogTimeout.top = new FormAttachment(wLogTable, margin);
    wlLogTimeout.setLayoutData(fdlLogTimeout);
    wLogTimeout = new TextVar(jobMeta, wLogOptionsComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wLogTimeout.setToolTipText(BaseMessages.getString(PKG, "JobDialog.LogTimeout.Tooltip"));
    props.setLook(wLogTimeout);
    wLogTimeout.addModifyListener(lsMod);
    FormData fdLogTimeout = new FormData();
    fdLogTimeout.left = new FormAttachment(middle, 0);
    fdLogTimeout.top = new FormAttachment(wLogTable, margin);
    fdLogTimeout.right = new FormAttachment(100, 0);
    wLogTimeout.setLayoutData(fdLogTimeout);
    wLogTimeout.setText(Const.NVL(channelLogTable.getTimeoutInDays(), ""));
    // Add the fields grid...
    // 
    Label wlFields = new Label(wLogOptionsComposite, SWT.NONE);
    wlFields.setText(BaseMessages.getString(PKG, "JobDialog.TransLogTable.Fields.Label"));
    props.setLook(wlFields);
    FormData fdlFields = new FormData();
    fdlFields.left = new FormAttachment(0, 0);
    fdlFields.top = new FormAttachment(wLogTimeout, margin * 2);
    wlFields.setLayoutData(fdlFields);
    final java.util.List<LogTableField> fields = channelLogTable.getFields();
    final int nrRows = fields.size();
    ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "JobDialog.TransLogTable.Fields.FieldName"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "JobDialog.TransLogTable.Fields.Description"), ColumnInfo.COLUMN_TYPE_TEXT, false, true) };
    FieldDisabledListener disabledListener = new FieldDisabledListener() {

        public boolean isFieldDisabled(int rowNr) {
            if (rowNr >= 0 && rowNr < fields.size()) {
                LogTableField field = fields.get(rowNr);
                return field.isSubjectAllowed();
            } else {
                return true;
            }
        }
    };
    colinf[1].setDisabledListener(disabledListener);
    wOptionFields = new // add a
    TableView(// add a
    jobMeta, // add a
    wLogOptionsComposite, // add a
    SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.CHECK, // left...
    colinf, nrRows, true, lsMod, props);
    wOptionFields.setSortable(false);
    for (int i = 0; i < fields.size(); i++) {
        LogTableField field = fields.get(i);
        TableItem item = wOptionFields.table.getItem(i);
        item.setChecked(field.isEnabled());
        item.setText(new String[] { "", Const.NVL(field.getFieldName(), ""), Const.NVL(field.getDescription(), "") });
    }
    wOptionFields.table.getColumn(0).setText(BaseMessages.getString(PKG, "JobDialog.TransLogTable.Fields.Enabled"));
    FormData fdOptionFields = new FormData();
    fdOptionFields.left = new FormAttachment(0, 0);
    fdOptionFields.top = new FormAttachment(wlFields, margin);
    fdOptionFields.right = new FormAttachment(100, 0);
    fdOptionFields.bottom = new FormAttachment(100, 0);
    wOptionFields.setLayoutData(fdOptionFields);
    wOptionFields.optWidth(true);
    wOptionFields.layout();
}
Also used : FormData(org.eclipse.swt.layout.FormData) LogTableField(org.pentaho.di.core.logging.LogTableField) TableItem(org.eclipse.swt.widgets.TableItem) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) FieldDisabledListener(org.pentaho.di.ui.core.widget.FieldDisabledListener) TextVar(org.pentaho.di.ui.core.widget.TextVar) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 57 with TextVar

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

the class JobDialog method showJobEntryLogTableOptions.

private void showJobEntryLogTableOptions(JobEntryLogTable jobEntryLogTable) {
    addDBSchemaTableLogOptions(jobEntryLogTable);
    // The log timeout in days
    // 
    Label wlLogTimeout = new Label(wLogOptionsComposite, SWT.RIGHT);
    wlLogTimeout.setText(BaseMessages.getString(PKG, "JobDialog.LogTimeout.Label"));
    wlLogTimeout.setToolTipText(BaseMessages.getString(PKG, "JobDialog.LogTimeout.Tooltip"));
    props.setLook(wlLogTimeout);
    FormData fdlLogTimeout = new FormData();
    fdlLogTimeout.left = new FormAttachment(0, 0);
    fdlLogTimeout.right = new FormAttachment(middle, -margin);
    fdlLogTimeout.top = new FormAttachment(wLogTable, margin);
    wlLogTimeout.setLayoutData(fdlLogTimeout);
    wLogTimeout = new TextVar(jobMeta, wLogOptionsComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wLogTimeout.setToolTipText(BaseMessages.getString(PKG, "JobDialog.LogTimeout.Tooltip"));
    props.setLook(wLogTimeout);
    wLogTimeout.addModifyListener(lsMod);
    FormData fdLogTimeout = new FormData();
    fdLogTimeout.left = new FormAttachment(middle, 0);
    fdLogTimeout.top = new FormAttachment(wLogTable, margin);
    fdLogTimeout.right = new FormAttachment(100, 0);
    wLogTimeout.setLayoutData(fdLogTimeout);
    wLogTimeout.setText(Const.NVL(jobEntryLogTable.getTimeoutInDays(), ""));
    // Add the fields grid...
    // 
    Label wlFields = new Label(wLogOptionsComposite, SWT.NONE);
    wlFields.setText(BaseMessages.getString(PKG, "JobDialog.TransLogTable.Fields.Label"));
    props.setLook(wlFields);
    FormData fdlFields = new FormData();
    fdlFields.left = new FormAttachment(0, 0);
    fdlFields.top = new FormAttachment(wLogTimeout, margin * 2);
    wlFields.setLayoutData(fdlFields);
    final java.util.List<LogTableField> fields = jobEntryLogTable.getFields();
    final int nrRows = fields.size();
    ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "JobDialog.TransLogTable.Fields.FieldName"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "JobDialog.TransLogTable.Fields.Description"), ColumnInfo.COLUMN_TYPE_TEXT, false, true) };
    FieldDisabledListener disabledListener = new FieldDisabledListener() {

        public boolean isFieldDisabled(int rowNr) {
            if (rowNr >= 0 && rowNr < fields.size()) {
                LogTableField field = fields.get(rowNr);
                return field.isSubjectAllowed();
            } else {
                return true;
            }
        }
    };
    colinf[1].setDisabledListener(disabledListener);
    wOptionFields = new // add a
    TableView(// add a
    jobMeta, // add a
    wLogOptionsComposite, // add a
    SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.CHECK, // left...
    colinf, nrRows, true, lsMod, props);
    wOptionFields.setSortable(false);
    for (int i = 0; i < fields.size(); i++) {
        LogTableField field = fields.get(i);
        TableItem item = wOptionFields.table.getItem(i);
        item.setChecked(field.isEnabled());
        item.setText(new String[] { "", Const.NVL(field.getFieldName(), ""), Const.NVL(field.getDescription(), "") });
    }
    wOptionFields.table.getColumn(0).setText(BaseMessages.getString(PKG, "JobDialog.TransLogTable.Fields.Enabled"));
    FormData fdOptionFields = new FormData();
    fdOptionFields.left = new FormAttachment(0, 0);
    fdOptionFields.top = new FormAttachment(wlFields, margin);
    fdOptionFields.right = new FormAttachment(100, 0);
    fdOptionFields.bottom = new FormAttachment(100, 0);
    wOptionFields.setLayoutData(fdOptionFields);
    wOptionFields.optWidth(true);
    wOptionFields.layout();
}
Also used : FormData(org.eclipse.swt.layout.FormData) LogTableField(org.pentaho.di.core.logging.LogTableField) TableItem(org.eclipse.swt.widgets.TableItem) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) FieldDisabledListener(org.pentaho.di.ui.core.widget.FieldDisabledListener) TextVar(org.pentaho.di.ui.core.widget.TextVar) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 58 with TextVar

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

the class JobDialog method addSettingsTab.

private void addSettingsTab() {
    // ////////////////////////
    // START OF SETTINGS TAB///
    // /
    wSettingsTab = new CTabItem(wTabFolder, SWT.NONE);
    wSettingsTab.setText(BaseMessages.getString(PKG, "JobDialog.SettingsTab.Label"));
    FormLayout LogLayout = new FormLayout();
    LogLayout.marginWidth = Const.MARGIN;
    LogLayout.marginHeight = Const.MARGIN;
    Composite wSettingsComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wSettingsComp);
    wSettingsComp.setLayout(LogLayout);
    wlBatchTrans = new Label(wSettingsComp, SWT.RIGHT);
    wlBatchTrans.setText(BaseMessages.getString(PKG, "JobDialog.PassBatchID.Label"));
    props.setLook(wlBatchTrans);
    fdlBatchTrans = new FormData();
    fdlBatchTrans.left = new FormAttachment(0, 0);
    fdlBatchTrans.top = new FormAttachment(0, margin);
    fdlBatchTrans.right = new FormAttachment(middle, -margin);
    wlBatchTrans.setLayoutData(fdlBatchTrans);
    wBatchTrans = new Button(wSettingsComp, SWT.CHECK);
    props.setLook(wBatchTrans);
    wBatchTrans.setToolTipText(BaseMessages.getString(PKG, "JobDialog.PassBatchID.Tooltip"));
    fdBatchTrans = new FormData();
    fdBatchTrans.left = new FormAttachment(middle, 0);
    fdBatchTrans.top = new FormAttachment(0, margin);
    fdBatchTrans.right = new FormAttachment(100, 0);
    wBatchTrans.setLayoutData(fdBatchTrans);
    // Shared objects file
    Label wlSharedObjectsFile = new Label(wSettingsComp, SWT.RIGHT);
    wlSharedObjectsFile.setText(BaseMessages.getString(PKG, "JobDialog.SharedObjectsFile.Label"));
    props.setLook(wlSharedObjectsFile);
    FormData fdlSharedObjectsFile = new FormData();
    fdlSharedObjectsFile.left = new FormAttachment(0, 0);
    fdlSharedObjectsFile.right = new FormAttachment(middle, -margin);
    fdlSharedObjectsFile.top = new FormAttachment(wBatchTrans, 4 * margin);
    wlSharedObjectsFile.setLayoutData(fdlSharedObjectsFile);
    wSharedObjectsFile = new TextVar(jobMeta, wSettingsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wlSharedObjectsFile.setToolTipText(BaseMessages.getString(PKG, "JobDialog.SharedObjectsFile.Tooltip"));
    wSharedObjectsFile.setToolTipText(BaseMessages.getString(PKG, "JobDialog.SharedObjectsFile.Tooltip"));
    props.setLook(wSharedObjectsFile);
    FormData fdSharedObjectsFile = new FormData();
    fdSharedObjectsFile.left = new FormAttachment(middle, 0);
    fdSharedObjectsFile.top = new FormAttachment(wBatchTrans, 4 * margin);
    fdSharedObjectsFile.right = new FormAttachment(100, 0);
    wSharedObjectsFile.setLayoutData(fdSharedObjectsFile);
    wSharedObjectsFile.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent arg0) {
            sharedObjectsFileChanged = true;
        }
    });
    FormData fdLogComp = new FormData();
    fdLogComp.left = new FormAttachment(0, 0);
    fdLogComp.top = new FormAttachment(0, 0);
    fdLogComp.right = new FormAttachment(100, 0);
    fdLogComp.bottom = new FormAttachment(100, 0);
    wSettingsComp.setLayoutData(fdLogComp);
    wSettingsComp.layout();
    wSettingsTab.setControl(wSettingsComp);
// ///////////////////////////////////////////////////////////
// / END OF LOG TAB
// ///////////////////////////////////////////////////////////
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) Button(org.eclipse.swt.widgets.Button) Label(org.eclipse.swt.widgets.Label) CTabItem(org.eclipse.swt.custom.CTabItem) FormAttachment(org.eclipse.swt.layout.FormAttachment) TextVar(org.pentaho.di.ui.core.widget.TextVar)

Example 59 with TextVar

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

the class JobEntryConnectedToRepositoryDialog method open.

public JobEntryInterface open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();
    shell = new Shell(parent, props.getJobsDialogStyle());
    props.setLook(shell);
    JobDialog.setShellImage(shell, jobEntry);
    ModifyListener lsMod = new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            jobEntry.setChanged();
        }
    };
    changed = jobEntry.hasChanged();
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "JobEntryConnectedToRepositoryDialog.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Filename line
    wlName = new Label(shell, SWT.RIGHT);
    wlName.setText(BaseMessages.getString(PKG, "JobEntryConnectedToRepositoryDialog.Label"));
    props.setLook(wlName);
    fdlName = new FormData();
    fdlName.left = new FormAttachment(0, 0);
    fdlName.right = new FormAttachment(middle, -margin);
    fdlName.top = new FormAttachment(0, margin);
    wlName.setLayoutData(fdlName);
    wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wName);
    wName.addModifyListener(lsMod);
    fdName = new FormData();
    fdName.left = new FormAttachment(middle, 0);
    fdName.top = new FormAttachment(0, margin);
    fdName.right = new FormAttachment(100, 0);
    wName.setLayoutData(fdName);
    // Connected to a specific rep?
    wlspecificRep = new Label(shell, SWT.RIGHT);
    wlspecificRep.setText(BaseMessages.getString(PKG, "JobEntryConnectedToRepositoryDialog.specificRep.Label"));
    props.setLook(wlspecificRep);
    fdlspecificRep = new FormData();
    fdlspecificRep.left = new FormAttachment(0, 0);
    fdlspecificRep.top = new FormAttachment(wName, margin);
    fdlspecificRep.right = new FormAttachment(middle, -margin);
    wlspecificRep.setLayoutData(fdlspecificRep);
    wspecificRep = new Button(shell, SWT.CHECK);
    props.setLook(wspecificRep);
    wspecificRep.setToolTipText(BaseMessages.getString(PKG, "JobEntryConnectedToRepositoryDialog.specificRep.Tooltip"));
    fdspecificRep = new FormData();
    fdspecificRep.left = new FormAttachment(middle, 0);
    fdspecificRep.top = new FormAttachment(wName, margin);
    fdspecificRep.right = new FormAttachment(100, 0);
    wspecificRep.setLayoutData(fdspecificRep);
    wspecificRep.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            jobEntry.setChanged();
            activeSpecRep();
        }
    });
    // Repository name
    wlRepName = new Label(shell, SWT.RIGHT);
    wlRepName.setText(BaseMessages.getString(PKG, "JobEntryConnectedToRepositoryDialog.RepName.Label"));
    props.setLook(wlRepName);
    fdlRepName = new FormData();
    fdlRepName.left = new FormAttachment(0, 0);
    fdlRepName.right = new FormAttachment(middle, -margin);
    fdlRepName.top = new FormAttachment(wspecificRep, margin);
    wlRepName.setLayoutData(fdlRepName);
    wbRepositoryname = new Button(shell, SWT.PUSH | SWT.CENTER);
    props.setLook(wbRepositoryname);
    wbRepositoryname.setText(BaseMessages.getString(PKG, "JobEntryConnectedToRepositoryDialog.ListRepositories.Label"));
    wbRepositoryname.setToolTipText(BaseMessages.getString(PKG, "JobEntryConnectedToRepositoryDialog.ListRepositories.Tooltip"));
    fdbRepositoryname = new FormData();
    fdbRepositoryname.right = new FormAttachment(100, 0);
    fdbRepositoryname.top = new FormAttachment(wspecificRep, 0);
    wbRepositoryname.setLayoutData(fdbRepositoryname);
    wbRepositoryname.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            getListRepositories();
        }
    });
    wRepName = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wRepName);
    wRepName.setToolTipText(BaseMessages.getString(PKG, "JobEntryConnectedToRepositoryDialog.RepName.Tooltip"));
    wRepName.addModifyListener(lsMod);
    fdRepName = new FormData();
    fdRepName.left = new FormAttachment(middle, 0);
    fdRepName.top = new FormAttachment(wspecificRep, margin);
    fdRepName.right = new FormAttachment(wbRepositoryname, -margin);
    wRepName.setLayoutData(fdRepName);
    // Connected to a specific user?
    wlspecificUser = new Label(shell, SWT.RIGHT);
    wlspecificUser.setText(BaseMessages.getString(PKG, "JobEntryConnectedToRepositoryDialog.specificUser.Label"));
    props.setLook(wlspecificUser);
    fdlspecificUser = new FormData();
    fdlspecificUser.left = new FormAttachment(0, 0);
    fdlspecificUser.top = new FormAttachment(wRepName, margin);
    fdlspecificUser.right = new FormAttachment(middle, -margin);
    wlspecificUser.setLayoutData(fdlspecificUser);
    wspecificUser = new Button(shell, SWT.CHECK);
    props.setLook(wspecificUser);
    wspecificUser.setToolTipText(BaseMessages.getString(PKG, "JobEntryConnectedToRepositoryDialog.specificUser.Tooltip"));
    fdspecificUser = new FormData();
    fdspecificUser.left = new FormAttachment(middle, 0);
    fdspecificUser.top = new FormAttachment(wRepName, margin);
    fdspecificUser.right = new FormAttachment(100, 0);
    wspecificUser.setLayoutData(fdspecificUser);
    wspecificUser.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            jobEntry.setChanged();
            activeSpecUser();
        }
    });
    // Username
    wlUserName = new Label(shell, SWT.RIGHT);
    wlUserName.setText(BaseMessages.getString(PKG, "JobEntryConnectedToUserositoryDialog.UserName.Label"));
    props.setLook(wlUserName);
    fdlUserName = new FormData();
    fdlUserName.left = new FormAttachment(0, 0);
    fdlUserName.right = new FormAttachment(middle, -margin);
    fdlUserName.top = new FormAttachment(wspecificUser, margin);
    wlUserName.setLayoutData(fdlUserName);
    // Username
    wUserName = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wUserName);
    wUserName.setToolTipText(BaseMessages.getString(PKG, "JobEntryConnectedToUserositoryDialog.UserName.Tooltip"));
    wUserName.addModifyListener(lsMod);
    fdUserName = new FormData();
    fdUserName.left = new FormAttachment(middle, 0);
    fdUserName.top = new FormAttachment(wspecificUser, margin);
    fdUserName.right = new FormAttachment(100, -margin);
    wUserName.setLayoutData(fdUserName);
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    // at the bottom
    BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wUserName);
    // Add listeners
    lsCancel = new Listener() {

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

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

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

        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    getData();
    activeSpecRep();
    activeSpecUser();
    BaseStepDialog.setSize(shell);
    shell.open();
    props.setDialogSize(shell, "JobSuccessDialogSize");
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return jobEntry;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) ShellEvent(org.eclipse.swt.events.ShellEvent) Text(org.eclipse.swt.widgets.Text) TextVar(org.pentaho.di.ui.core.widget.TextVar) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Event(org.eclipse.swt.widgets.Event) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) Display(org.eclipse.swt.widgets.Display)

Example 60 with TextVar

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

the class JobEntryCreateFolderDialog method open.

public JobEntryInterface open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();
    shell = new Shell(parent, props.getJobsDialogStyle());
    props.setLook(shell);
    JobDialog.setShellImage(shell, jobEntry);
    ModifyListener lsMod = new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            jobEntry.setChanged();
        }
    };
    changed = jobEntry.hasChanged();
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "JobCreateFolder.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Foldername line
    wlName = new Label(shell, SWT.RIGHT);
    wlName.setText(BaseMessages.getString(PKG, "JobCreateFolder.Name.Label"));
    props.setLook(wlName);
    fdlName = new FormData();
    fdlName.left = new FormAttachment(0, 0);
    fdlName.right = new FormAttachment(middle, -margin);
    fdlName.top = new FormAttachment(0, margin);
    wlName.setLayoutData(fdlName);
    wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wName);
    wName.addModifyListener(lsMod);
    fdName = new FormData();
    fdName.left = new FormAttachment(middle, 0);
    fdName.top = new FormAttachment(0, margin);
    fdName.right = new FormAttachment(100, 0);
    wName.setLayoutData(fdName);
    // Foldername line
    wlFoldername = new Label(shell, SWT.RIGHT);
    wlFoldername.setText(BaseMessages.getString(PKG, "JobCreateFolder.Foldername.Label"));
    props.setLook(wlFoldername);
    fdlFoldername = new FormData();
    fdlFoldername.left = new FormAttachment(0, 0);
    fdlFoldername.top = new FormAttachment(wName, margin);
    fdlFoldername.right = new FormAttachment(middle, -margin);
    wlFoldername.setLayoutData(fdlFoldername);
    wbFoldername = new Button(shell, SWT.PUSH | SWT.CENTER);
    props.setLook(wbFoldername);
    wbFoldername.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    fdbFoldername = new FormData();
    fdbFoldername.right = new FormAttachment(100, 0);
    fdbFoldername.top = new FormAttachment(wName, 0);
    wbFoldername.setLayoutData(fdbFoldername);
    wFoldername = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFoldername);
    wFoldername.addModifyListener(lsMod);
    fdFoldername = new FormData();
    fdFoldername.left = new FormAttachment(middle, 0);
    fdFoldername.top = new FormAttachment(wName, margin);
    fdFoldername.right = new FormAttachment(wbFoldername, -margin);
    wFoldername.setLayoutData(fdFoldername);
    // Whenever something changes, set the tooltip to the expanded version:
    wFoldername.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            wFoldername.setToolTipText(jobMeta.environmentSubstitute(wFoldername.getText()));
        }
    });
    wbFoldername.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog dialog = new DirectoryDialog(shell, SWT.OPEN);
            if (wFoldername.getText() != null) {
                dialog.setFilterPath(jobMeta.environmentSubstitute(wFoldername.getText()));
            }
            String dir = dialog.open();
            if (dir != null) {
                wFoldername.setText(dir);
            }
        }
    });
    wlAbortExists = new Label(shell, SWT.RIGHT);
    wlAbortExists.setText(BaseMessages.getString(PKG, "JobCreateFolder.FailIfExists.Label"));
    props.setLook(wlAbortExists);
    fdlAbortExists = new FormData();
    fdlAbortExists.left = new FormAttachment(0, 0);
    fdlAbortExists.top = new FormAttachment(wFoldername, margin);
    fdlAbortExists.right = new FormAttachment(middle, -margin);
    wlAbortExists.setLayoutData(fdlAbortExists);
    wAbortExists = new Button(shell, SWT.CHECK);
    props.setLook(wAbortExists);
    wAbortExists.setToolTipText(BaseMessages.getString(PKG, "JobCreateFolder.FailIfExists.Tooltip"));
    fdAbortExists = new FormData();
    fdAbortExists.left = new FormAttachment(middle, 0);
    fdAbortExists.top = new FormAttachment(wFoldername, margin);
    fdAbortExists.right = new FormAttachment(100, 0);
    wAbortExists.setLayoutData(fdAbortExists);
    wAbortExists.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            jobEntry.setChanged();
        }
    });
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wAbortExists);
    // Add listeners
    lsCancel = new Listener() {

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

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

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

        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    getData();
    BaseStepDialog.setSize(shell);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return jobEntry;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) ShellEvent(org.eclipse.swt.events.ShellEvent) Text(org.eclipse.swt.widgets.Text) TextVar(org.pentaho.di.ui.core.widget.TextVar) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Event(org.eclipse.swt.widgets.Event) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) Display(org.eclipse.swt.widgets.Display) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog)

Aggregations

TextVar (org.pentaho.di.ui.core.widget.TextVar)240 Label (org.eclipse.swt.widgets.Label)237 FormAttachment (org.eclipse.swt.layout.FormAttachment)236 FormData (org.eclipse.swt.layout.FormData)236 FormLayout (org.eclipse.swt.layout.FormLayout)220 Button (org.eclipse.swt.widgets.Button)207 SelectionEvent (org.eclipse.swt.events.SelectionEvent)196 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)194 Text (org.eclipse.swt.widgets.Text)189 ModifyListener (org.eclipse.swt.events.ModifyListener)186 ModifyEvent (org.eclipse.swt.events.ModifyEvent)184 Listener (org.eclipse.swt.widgets.Listener)184 Shell (org.eclipse.swt.widgets.Shell)184 Event (org.eclipse.swt.widgets.Event)183 ShellAdapter (org.eclipse.swt.events.ShellAdapter)181 ShellEvent (org.eclipse.swt.events.ShellEvent)181 Display (org.eclipse.swt.widgets.Display)181 CCombo (org.eclipse.swt.custom.CCombo)113 Composite (org.eclipse.swt.widgets.Composite)112 CTabItem (org.eclipse.swt.custom.CTabItem)108