Search in sources :

Example 1 with LabelText

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

the class HL7MLLPAcknowledgeDialog 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, "HL7MLLPAcknowledgeDialog.Title"));
    int margin = Const.MARGIN;
    // Job entry name line
    wName = new LabelText(shell, BaseMessages.getString(PKG, "HL7MLLPAcknowledgeDialog.Name.Label"), BaseMessages.getString(PKG, "HL7MLLPAcknowledgeDialog.Name.Tooltip"));
    wName.addModifyListener(lsMod);
    FormData fdName = new FormData();
    fdName.top = new FormAttachment(0, 0);
    fdName.left = new FormAttachment(0, 0);
    fdName.right = new FormAttachment(100, 0);
    wName.setLayoutData(fdName);
    Control lastControl = wName;
    // the server
    // 
    wServer = new LabelTextVar(jobMeta, shell, BaseMessages.getString(PKG, "HL7MLLPAcknowledgeDialog.Server.Label"), BaseMessages.getString(PKG, "HL7MLLPAcknowledgeDialog.Server.Tooltip"));
    props.setLook(wServer);
    wServer.addModifyListener(lsMod);
    FormData fdBatchIdSchema = new FormData();
    fdBatchIdSchema.left = new FormAttachment(0, 0);
    fdBatchIdSchema.top = new FormAttachment(lastControl, margin);
    fdBatchIdSchema.right = new FormAttachment(100, 0);
    wServer.setLayoutData(fdBatchIdSchema);
    lastControl = wServer;
    // the port
    // 
    wPort = new LabelTextVar(jobMeta, shell, BaseMessages.getString(PKG, "HL7MLLPAcknowledgeDialog.Port.Label"), BaseMessages.getString(PKG, "HL7MLLPAcknowledgeDialog.Port.Tooltip"));
    props.setLook(wPort);
    wPort.addModifyListener(lsMod);
    FormData fdPort = new FormData();
    fdPort.left = new FormAttachment(0, 0);
    fdPort.top = new FormAttachment(lastControl, margin);
    fdPort.right = new FormAttachment(100, 0);
    wPort.setLayoutData(fdPort);
    lastControl = wPort;
    // the variable
    // 
    wVariable = new LabelTextVar(jobMeta, shell, BaseMessages.getString(PKG, "HL7MLLPAcknowledgeDialog.Variable.Label"), BaseMessages.getString(PKG, "HL7MLLPAcknowledgeDialog.Variable.Tooltip"));
    props.setLook(wVariable);
    wVariable.addModifyListener(lsMod);
    FormData fdVariable = new FormData();
    fdVariable.left = new FormAttachment(0, 0);
    fdVariable.top = new FormAttachment(lastControl, margin);
    fdVariable.right = new FormAttachment(100, 0);
    wVariable.setLayoutData(fdVariable);
    lastControl = wVariable;
    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, lastControl);
    // Add listeners
    // 
    wCancel.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event e) {
            cancel();
        }
    });
    wOK.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event e) {
            ok();
        }
    });
    lsDef = new SelectionAdapter() {

        public void widgetDefaultSelected(SelectionEvent e) {
            ok();
        }
    };
    wName.addSelectionListener(lsDef);
    wServer.addSelectionListener(lsDef);
    wPort.addSelectionListener(lsDef);
    wVariable.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();
    props.setDialogSize(shell, "HL7MLLPAcknowledgeDialog.DialogSize");
    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) ShellEvent(org.eclipse.swt.events.ShellEvent) LabelTextVar(org.pentaho.di.ui.core.widget.LabelTextVar) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Control(org.eclipse.swt.widgets.Control) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) LabelText(org.pentaho.di.ui.core.widget.LabelText) 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 2 with LabelText

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

the class JobEntryFTPDeleteDialog 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) {
            pwdFolder = null;
            ftpclient = null;
            ftpsclient = null;
            sftpclient = null;
            conn = null;
            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, "JobFTPDelete.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Job entry name line
    wName = new LabelText(shell, BaseMessages.getString(PKG, "JobFTPDelete.Name.Label"), BaseMessages.getString(PKG, "JobFTPDelete.Name.Tooltip"));
    wName.addModifyListener(lsMod);
    fdName = new FormData();
    fdName.top = new FormAttachment(0, 0);
    fdName.left = new FormAttachment(0, 0);
    fdName.right = new FormAttachment(100, 0);
    wName.setLayoutData(fdName);
    wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
    // ////////////////////////
    // START OF GENERAL TAB ///
    // ////////////////////////
    wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
    wGeneralTab.setText(BaseMessages.getString(PKG, "JobFTPDelete.Tab.General.Label"));
    wGeneralComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wGeneralComp);
    FormLayout generalLayout = new FormLayout();
    generalLayout.marginWidth = 3;
    generalLayout.marginHeight = 3;
    wGeneralComp.setLayout(generalLayout);
    // ////////////////////////
    // START OF SERVER SETTINGS GROUP///
    // /
    wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wServerSettings);
    wServerSettings.setText(BaseMessages.getString(PKG, "JobFTPDelete.ServerSettings.Group.Label"));
    FormLayout ServerSettingsgroupLayout = new FormLayout();
    ServerSettingsgroupLayout.marginWidth = 10;
    ServerSettingsgroupLayout.marginHeight = 10;
    wServerSettings.setLayout(ServerSettingsgroupLayout);
    // Protocol
    wlProtocol = new Label(wServerSettings, SWT.RIGHT);
    wlProtocol.setText(BaseMessages.getString(PKG, "JobFTPDelete.Protocol.Label"));
    props.setLook(wlProtocol);
    fdlProtocol = new FormData();
    fdlProtocol.left = new FormAttachment(0, 0);
    fdlProtocol.top = new FormAttachment(wName, margin);
    fdlProtocol.right = new FormAttachment(middle, 0);
    wlProtocol.setLayoutData(fdlProtocol);
    wProtocol = new Combo(wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wProtocol.setToolTipText(BaseMessages.getString(PKG, "JobFTPDelete.Protocol.Tooltip"));
    wProtocol.add(JobEntryFTPDelete.PROTOCOL_FTP);
    wProtocol.add(JobEntryFTPDelete.PROTOCOL_FTPS);
    wProtocol.add(JobEntryFTPDelete.PROTOCOL_SFTP);
    wProtocol.add(JobEntryFTPDelete.PROTOCOL_SSH);
    props.setLook(wProtocol);
    fdProtocol = new FormData();
    fdProtocol.left = new FormAttachment(middle, margin);
    fdProtocol.top = new FormAttachment(wName, margin);
    fdProtocol.right = new FormAttachment(100, 0);
    wProtocol.setLayoutData(fdProtocol);
    wProtocol.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            activeFTPProtocol();
            jobEntry.setChanged();
        }
    });
    // ServerName line
    wServerName = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPDelete.Server.Label"), BaseMessages.getString(PKG, "JobFTPDelete.Server.Tooltip"));
    props.setLook(wServerName);
    wServerName.addModifyListener(lsMod);
    fdServerName = new FormData();
    fdServerName.left = new FormAttachment(0, 0);
    fdServerName.top = new FormAttachment(wProtocol, margin);
    fdServerName.right = new FormAttachment(100, 0);
    wServerName.setLayoutData(fdServerName);
    // Proxy port line
    wPort = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPDelete.Port.Label"), BaseMessages.getString(PKG, "JobFTPDelete.Port.Tooltip"));
    props.setLook(wPort);
    wPort.addModifyListener(lsMod);
    fdPort = new FormData();
    fdPort.left = new FormAttachment(0, 0);
    fdPort.top = new FormAttachment(wServerName, margin);
    fdPort.right = new FormAttachment(100, 0);
    wPort.setLayoutData(fdPort);
    // UserName line
    wUserName = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPDelete.User.Label"), BaseMessages.getString(PKG, "JobFTPDelete.User.Tooltip"));
    props.setLook(wUserName);
    wUserName.addModifyListener(lsMod);
    fdUserName = new FormData();
    fdUserName.left = new FormAttachment(0, 0);
    fdUserName.top = new FormAttachment(wPort, margin);
    fdUserName.right = new FormAttachment(100, 0);
    wUserName.setLayoutData(fdUserName);
    // Password line
    wPassword = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPDelete.Password.Label"), BaseMessages.getString(PKG, "JobFTPDelete.Password.Tooltip"), true);
    props.setLook(wPassword);
    wPassword.addModifyListener(lsMod);
    fdPassword = new FormData();
    fdPassword.left = new FormAttachment(0, 0);
    fdPassword.top = new FormAttachment(wUserName, margin);
    fdPassword.right = new FormAttachment(100, 0);
    wPassword.setLayoutData(fdPassword);
    wlConnectionType = new Label(wServerSettings, SWT.RIGHT);
    wlConnectionType.setText(BaseMessages.getString(PKG, "JobFTPDelete.ConnectionType.Label"));
    props.setLook(wlConnectionType);
    fdlConnectionType = new FormData();
    fdlConnectionType.left = new FormAttachment(0, 0);
    fdlConnectionType.right = new FormAttachment(middle, 0);
    fdlConnectionType.top = new FormAttachment(wPassword, 2 * margin);
    wlConnectionType.setLayoutData(fdlConnectionType);
    wConnectionType = new CCombo(wServerSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wConnectionType.setItems(FTPSConnection.connection_type_Desc);
    props.setLook(wConnectionType);
    fdConnectionType = new FormData();
    fdConnectionType.left = new FormAttachment(middle, margin);
    fdConnectionType.top = new FormAttachment(wPassword, 2 * margin);
    fdConnectionType.right = new FormAttachment(100, 0);
    wConnectionType.setLayoutData(fdConnectionType);
    wConnectionType.addModifyListener(lsMod);
    // Use proxy...
    wluseProxy = new Label(wServerSettings, SWT.RIGHT);
    wluseProxy.setText(BaseMessages.getString(PKG, "JobFTPDelete.useProxy.Label"));
    props.setLook(wluseProxy);
    fdluseProxy = new FormData();
    fdluseProxy.left = new FormAttachment(0, 0);
    fdluseProxy.top = new FormAttachment(wConnectionType, margin);
    fdluseProxy.right = new FormAttachment(middle, 0);
    wluseProxy.setLayoutData(fdluseProxy);
    wuseProxy = new Button(wServerSettings, SWT.CHECK);
    props.setLook(wuseProxy);
    wuseProxy.setToolTipText(BaseMessages.getString(PKG, "JobFTPDelete.useProxy.Tooltip"));
    fduseProxy = new FormData();
    fduseProxy.left = new FormAttachment(middle, margin);
    fduseProxy.top = new FormAttachment(wConnectionType, margin);
    fduseProxy.right = new FormAttachment(100, 0);
    wuseProxy.setLayoutData(fduseProxy);
    wuseProxy.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            activeProxy();
            jobEntry.setChanged();
        }
    });
    // Proxy host line
    wProxyHost = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPDelete.ProxyHost.Label"), BaseMessages.getString(PKG, "JobFTPDelete.ProxyHost.Tooltip"));
    props.setLook(wProxyHost);
    wProxyHost.addModifyListener(lsMod);
    fdProxyHost = new FormData();
    fdProxyHost.left = new FormAttachment(0, 0);
    fdProxyHost.top = new FormAttachment(wuseProxy, margin);
    fdProxyHost.right = new FormAttachment(100, 0);
    wProxyHost.setLayoutData(fdProxyHost);
    // Proxy port line
    wProxyPort = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPDelete.ProxyPort.Label"), BaseMessages.getString(PKG, "JobFTPDelete.ProxyPort.Tooltip"));
    props.setLook(wProxyPort);
    wProxyPort.addModifyListener(lsMod);
    fdProxyPort = new FormData();
    fdProxyPort.left = new FormAttachment(0, 0);
    fdProxyPort.top = new FormAttachment(wProxyHost, margin);
    fdProxyPort.right = new FormAttachment(100, 0);
    wProxyPort.setLayoutData(fdProxyPort);
    // Proxy username line
    wProxyUsername = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPDelete.ProxyUsername.Label"), BaseMessages.getString(PKG, "JobFTPDelete.ProxyUsername.Tooltip"));
    props.setLook(wProxyUsername);
    wProxyUsername.addModifyListener(lsMod);
    fdProxyUsername = new FormData();
    fdProxyUsername.left = new FormAttachment(0, 0);
    fdProxyUsername.top = new FormAttachment(wProxyPort, margin);
    fdProxyUsername.right = new FormAttachment(100, 0);
    wProxyUsername.setLayoutData(fdProxyUsername);
    // Proxy password line
    wProxyPassword = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPDelete.ProxyPassword.Label"), BaseMessages.getString(PKG, "JobFTPDelete.ProxyPassword.Tooltip"), true);
    props.setLook(wProxyPassword);
    wProxyPassword.addModifyListener(lsMod);
    fdProxyPasswd = new FormData();
    fdProxyPasswd.left = new FormAttachment(0, 0);
    fdProxyPasswd.top = new FormAttachment(wProxyUsername, margin);
    fdProxyPasswd.right = new FormAttachment(100, 0);
    wProxyPassword.setLayoutData(fdProxyPasswd);
    // usePublicKey
    wlusePublicKey = new Label(wServerSettings, SWT.RIGHT);
    wlusePublicKey.setText(BaseMessages.getString(PKG, "JobFTPDelete.usePublicKeyFiles.Label"));
    props.setLook(wlusePublicKey);
    fdlusePublicKey = new FormData();
    fdlusePublicKey.left = new FormAttachment(0, 0);
    fdlusePublicKey.top = new FormAttachment(wProxyPassword, margin);
    fdlusePublicKey.right = new FormAttachment(middle, 0);
    wlusePublicKey.setLayoutData(fdlusePublicKey);
    wusePublicKey = new Button(wServerSettings, SWT.CHECK);
    wusePublicKey.setToolTipText(BaseMessages.getString(PKG, "JobFTPDelete.usePublicKeyFiles.Tooltip"));
    props.setLook(wusePublicKey);
    fdusePublicKey = new FormData();
    fdusePublicKey.left = new FormAttachment(middle, margin);
    fdusePublicKey.top = new FormAttachment(wProxyPassword, margin);
    fdusePublicKey.right = new FormAttachment(100, 0);
    wusePublicKey.setLayoutData(fdusePublicKey);
    wusePublicKey.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            activeUsePublicKey();
            jobEntry.setChanged();
        }
    });
    // Key File
    wlKeyFilename = new Label(wServerSettings, SWT.RIGHT);
    wlKeyFilename.setText(BaseMessages.getString(PKG, "JobFTPDelete.KeyFilename.Label"));
    props.setLook(wlKeyFilename);
    fdlKeyFilename = new FormData();
    fdlKeyFilename.left = new FormAttachment(0, 0);
    fdlKeyFilename.top = new FormAttachment(wusePublicKey, margin);
    fdlKeyFilename.right = new FormAttachment(middle, -margin);
    wlKeyFilename.setLayoutData(fdlKeyFilename);
    wbKeyFilename = new Button(wServerSettings, SWT.PUSH | SWT.CENTER);
    props.setLook(wbKeyFilename);
    wbKeyFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    fdbKeyFilename = new FormData();
    fdbKeyFilename.right = new FormAttachment(100, 0);
    fdbKeyFilename.top = new FormAttachment(wusePublicKey, 0);
    // fdbKeyFilename.height = 22;
    wbKeyFilename.setLayoutData(fdbKeyFilename);
    wKeyFilename = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wKeyFilename.setToolTipText(BaseMessages.getString(PKG, "JobFTPDelete.KeyFilename.Tooltip"));
    props.setLook(wKeyFilename);
    wKeyFilename.addModifyListener(lsMod);
    fdKeyFilename = new FormData();
    fdKeyFilename.left = new FormAttachment(middle, margin);
    fdKeyFilename.top = new FormAttachment(wusePublicKey, margin);
    fdKeyFilename.right = new FormAttachment(wbKeyFilename, -margin);
    wKeyFilename.setLayoutData(fdKeyFilename);
    // Whenever something changes, set the tooltip to the expanded version:
    wKeyFilename.addModifyListener(new ModifyListener() {

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

        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.OPEN);
            dialog.setFilterExtensions(new String[] { "*.pem", "*" });
            if (wKeyFilename.getText() != null) {
                dialog.setFileName(jobMeta.environmentSubstitute(wKeyFilename.getText()));
            }
            dialog.setFilterNames(FILETYPES);
            if (dialog.open() != null) {
                wKeyFilename.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
            }
        }
    });
    // keyfilePass line
    wkeyfilePass = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTPDelete.keyfilePass.Label"), BaseMessages.getString(PKG, "JobFTPDelete.keyfilePass.Tooltip"), true);
    props.setLook(wkeyfilePass);
    wkeyfilePass.addModifyListener(lsMod);
    fdkeyfilePass = new FormData();
    fdkeyfilePass.left = new FormAttachment(0, 0);
    fdkeyfilePass.top = new FormAttachment(wKeyFilename, margin);
    fdkeyfilePass.right = new FormAttachment(100, 0);
    wkeyfilePass.setLayoutData(fdkeyfilePass);
    // Test connection button
    wTest = new Button(wServerSettings, SWT.PUSH);
    wTest.setText(BaseMessages.getString(PKG, "JobFTPDelete.TestConnection.Label"));
    props.setLook(wTest);
    fdTest = new FormData();
    wTest.setToolTipText(BaseMessages.getString(PKG, "JobFTPDelete.TestConnection.Tooltip"));
    // fdTest.left = new FormAttachment(middle, 0);
    fdTest.top = new FormAttachment(wkeyfilePass, margin);
    fdTest.right = new FormAttachment(100, 0);
    wTest.setLayoutData(fdTest);
    fdServerSettings = new FormData();
    fdServerSettings.left = new FormAttachment(0, margin);
    fdServerSettings.top = new FormAttachment(wName, margin);
    fdServerSettings.right = new FormAttachment(100, -margin);
    wServerSettings.setLayoutData(fdServerSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF SERVER SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    fdGeneralComp = new FormData();
    fdGeneralComp.left = new FormAttachment(0, 0);
    fdGeneralComp.top = new FormAttachment(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 Advanced TAB ///
    // ////////////////////////
    wFilesTab = new CTabItem(wTabFolder, SWT.NONE);
    wFilesTab.setText(BaseMessages.getString(PKG, "JobFTPDelete.Tab.Files.Label"));
    wFilesComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wFilesComp);
    FormLayout AdvancedLayout = new FormLayout();
    AdvancedLayout.marginWidth = 3;
    AdvancedLayout.marginHeight = 3;
    wFilesComp.setLayout(AdvancedLayout);
    // ////////////////////////
    // START OF Advanced SETTINGS GROUP///
    // /
    wAdvancedSettings = new Group(wFilesComp, SWT.SHADOW_NONE);
    props.setLook(wAdvancedSettings);
    wAdvancedSettings.setText(BaseMessages.getString(PKG, "JobFTPDelete.AdvancedSettings.Group.Label"));
    FormLayout AdvancedSettingsgroupLayout = new FormLayout();
    AdvancedSettingsgroupLayout.marginWidth = 10;
    AdvancedSettingsgroupLayout.marginHeight = 10;
    wAdvancedSettings.setLayout(AdvancedSettingsgroupLayout);
    // Timeout line
    wTimeout = new LabelTextVar(jobMeta, wAdvancedSettings, BaseMessages.getString(PKG, "JobFTPDelete.Timeout.Label"), BaseMessages.getString(PKG, "JobFTPDelete.Timeout.Tooltip"));
    props.setLook(wTimeout);
    wTimeout.addModifyListener(lsMod);
    fdTimeout = new FormData();
    fdTimeout.left = new FormAttachment(0, 0);
    fdTimeout.top = new FormAttachment(wActive, margin);
    fdTimeout.right = new FormAttachment(100, 0);
    wTimeout.setLayoutData(fdTimeout);
    // active connection?
    wlActive = new Label(wAdvancedSettings, SWT.RIGHT);
    wlActive.setText(BaseMessages.getString(PKG, "JobFTPDelete.ActiveConns.Label"));
    props.setLook(wlActive);
    fdlActive = new FormData();
    fdlActive.left = new FormAttachment(0, 0);
    fdlActive.top = new FormAttachment(wTimeout, margin);
    fdlActive.right = new FormAttachment(middle, 0);
    wlActive.setLayoutData(fdlActive);
    wActive = new Button(wAdvancedSettings, SWT.CHECK);
    wActive.setToolTipText(BaseMessages.getString(PKG, "JobFTPDelete.ActiveConns.Tooltip"));
    props.setLook(wActive);
    fdActive = new FormData();
    fdActive.left = new FormAttachment(middle, margin);
    fdActive.top = new FormAttachment(wTimeout, margin);
    fdActive.right = new FormAttachment(100, 0);
    wActive.setLayoutData(fdActive);
    fdAdvancedSettings = new FormData();
    fdAdvancedSettings.left = new FormAttachment(0, margin);
    fdAdvancedSettings.top = new FormAttachment(0, margin);
    fdAdvancedSettings.right = new FormAttachment(100, -margin);
    wAdvancedSettings.setLayoutData(fdAdvancedSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF Advanced SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF Remote SETTINGS GROUP///
    // /
    wRemoteSettings = new Group(wFilesComp, SWT.SHADOW_NONE);
    props.setLook(wRemoteSettings);
    wRemoteSettings.setText(BaseMessages.getString(PKG, "JobFTPDelete.RemoteSettings.Group.Label"));
    FormLayout RemoteSettinsgroupLayout = new FormLayout();
    RemoteSettinsgroupLayout.marginWidth = 10;
    RemoteSettinsgroupLayout.marginHeight = 10;
    wRemoteSettings.setLayout(RemoteSettinsgroupLayout);
    // Get arguments from previous result...
    wlgetPrevious = new Label(wRemoteSettings, SWT.RIGHT);
    wlgetPrevious.setText(BaseMessages.getString(PKG, "JobFTPDelete.getPrevious.Label"));
    props.setLook(wlgetPrevious);
    fdlgetPrevious = new FormData();
    fdlgetPrevious.left = new FormAttachment(0, 0);
    fdlgetPrevious.top = new FormAttachment(wAdvancedSettings, margin);
    fdlgetPrevious.right = new FormAttachment(middle, 0);
    wlgetPrevious.setLayoutData(fdlgetPrevious);
    wgetPrevious = new Button(wRemoteSettings, SWT.CHECK);
    props.setLook(wgetPrevious);
    wgetPrevious.setToolTipText(BaseMessages.getString(PKG, "JobFTPDelete.getPrevious.Tooltip"));
    fdgetPrevious = new FormData();
    fdgetPrevious.left = new FormAttachment(middle, margin);
    fdgetPrevious.top = new FormAttachment(wAdvancedSettings, margin);
    fdgetPrevious.right = new FormAttachment(100, 0);
    wgetPrevious.setLayoutData(fdgetPrevious);
    wgetPrevious.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            activeCopyFromPrevious();
            jobEntry.setChanged();
        }
    });
    // FTP directory
    wlFtpDirectory = new Label(wRemoteSettings, SWT.RIGHT);
    wlFtpDirectory.setText(BaseMessages.getString(PKG, "JobFTPDelete.RemoteDir.Label"));
    props.setLook(wlFtpDirectory);
    fdlFtpDirectory = new FormData();
    fdlFtpDirectory.left = new FormAttachment(0, 0);
    fdlFtpDirectory.top = new FormAttachment(wgetPrevious, margin);
    fdlFtpDirectory.right = new FormAttachment(middle, 0);
    wlFtpDirectory.setLayoutData(fdlFtpDirectory);
    // Test remote folder button ...
    wbTestChangeFolderExists = new Button(wRemoteSettings, SWT.PUSH | SWT.CENTER);
    props.setLook(wbTestChangeFolderExists);
    wbTestChangeFolderExists.setText(BaseMessages.getString(PKG, "JobFTPDelete.TestFolderExists.Label"));
    fdbTestChangeFolderExists = new FormData();
    fdbTestChangeFolderExists.right = new FormAttachment(100, 0);
    fdbTestChangeFolderExists.top = new FormAttachment(wgetPrevious, margin);
    wbTestChangeFolderExists.setLayoutData(fdbTestChangeFolderExists);
    wFtpDirectory = new TextVar(jobMeta, wRemoteSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobFTPDelete.RemoteDir.Tooltip"));
    props.setLook(wFtpDirectory);
    wFtpDirectory.addModifyListener(lsMod);
    fdFtpDirectory = new FormData();
    fdFtpDirectory.left = new FormAttachment(middle, margin);
    fdFtpDirectory.top = new FormAttachment(wgetPrevious, margin);
    fdFtpDirectory.right = new FormAttachment(wbTestChangeFolderExists, -margin);
    wFtpDirectory.setLayoutData(fdFtpDirectory);
    // Wildcard line
    wWildcard = new LabelTextVar(jobMeta, wRemoteSettings, BaseMessages.getString(PKG, "JobFTPDelete.Wildcard.Label"), BaseMessages.getString(PKG, "JobFTPDelete.Wildcard.Tooltip"));
    props.setLook(wWildcard);
    wWildcard.addModifyListener(lsMod);
    fdWildcard = new FormData();
    fdWildcard.left = new FormAttachment(0, 0);
    fdWildcard.top = new FormAttachment(wFtpDirectory, margin);
    fdWildcard.right = new FormAttachment(100, 0);
    wWildcard.setLayoutData(fdWildcard);
    fdRemoteSettings = new FormData();
    fdRemoteSettings.left = new FormAttachment(0, margin);
    fdRemoteSettings.top = new FormAttachment(wAdvancedSettings, margin);
    fdRemoteSettings.right = new FormAttachment(100, -margin);
    wRemoteSettings.setLayoutData(fdRemoteSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF Remote SETTINGSGROUP
    // ///////////////////////////////////////////////////////////
    // SuccessOngrouping?
    // ////////////////////////
    // START OF SUCCESS ON GROUP///
    // /
    wSuccessOn = new Group(wFilesComp, SWT.SHADOW_NONE);
    props.setLook(wSuccessOn);
    wSuccessOn.setText(BaseMessages.getString(PKG, "JobFTPDelete.SuccessOn.Group.Label"));
    FormLayout successongroupLayout = new FormLayout();
    successongroupLayout.marginWidth = 10;
    successongroupLayout.marginHeight = 10;
    wSuccessOn.setLayout(successongroupLayout);
    // Success Condition
    wlSuccessCondition = new Label(wSuccessOn, SWT.RIGHT);
    wlSuccessCondition.setText(BaseMessages.getString(PKG, "JobFTPDelete.SuccessCondition.Label") + " ");
    props.setLook(wlSuccessCondition);
    fdlSuccessCondition = new FormData();
    fdlSuccessCondition.left = new FormAttachment(0, 0);
    fdlSuccessCondition.right = new FormAttachment(middle, 0);
    fdlSuccessCondition.top = new FormAttachment(wRemoteSettings, margin);
    wlSuccessCondition.setLayoutData(fdlSuccessCondition);
    wSuccessCondition = new CCombo(wSuccessOn, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wSuccessCondition.add(BaseMessages.getString(PKG, "JobFTPDelete.SuccessWhenAllWorksFine.Label"));
    wSuccessCondition.add(BaseMessages.getString(PKG, "JobFTPDelete.SuccessWhenAtLeat.Label"));
    wSuccessCondition.add(BaseMessages.getString(PKG, "JobFTPDelete.SuccessWhenNrErrorsLessThan.Label"));
    // +1: starts at -1
    wSuccessCondition.select(0);
    props.setLook(wSuccessCondition);
    fdSuccessCondition = new FormData();
    fdSuccessCondition.left = new FormAttachment(middle, 0);
    fdSuccessCondition.top = new FormAttachment(wRemoteSettings, margin);
    fdSuccessCondition.right = new FormAttachment(100, 0);
    wSuccessCondition.setLayoutData(fdSuccessCondition);
    wSuccessCondition.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            activeSuccessCondition();
        }
    });
    // Success when number of errors less than
    wlNrErrorsLessThan = new Label(wSuccessOn, SWT.RIGHT);
    wlNrErrorsLessThan.setText(BaseMessages.getString(PKG, "JobFTPDelete.NrBadFormedLessThan.Label") + " ");
    props.setLook(wlNrErrorsLessThan);
    fdlNrErrorsLessThan = new FormData();
    fdlNrErrorsLessThan.left = new FormAttachment(0, 0);
    fdlNrErrorsLessThan.top = new FormAttachment(wSuccessCondition, margin);
    fdlNrErrorsLessThan.right = new FormAttachment(middle, -margin);
    wlNrErrorsLessThan.setLayoutData(fdlNrErrorsLessThan);
    wNrErrorsLessThan = new TextVar(jobMeta, wSuccessOn, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobFTPDelete.NrBadFormedLessThan.Tooltip"));
    props.setLook(wNrErrorsLessThan);
    wNrErrorsLessThan.addModifyListener(lsMod);
    fdNrErrorsLessThan = new FormData();
    fdNrErrorsLessThan.left = new FormAttachment(middle, 0);
    fdNrErrorsLessThan.top = new FormAttachment(wSuccessCondition, margin);
    fdNrErrorsLessThan.right = new FormAttachment(100, -margin);
    wNrErrorsLessThan.setLayoutData(fdNrErrorsLessThan);
    fdSuccessOn = new FormData();
    fdSuccessOn.left = new FormAttachment(0, margin);
    fdSuccessOn.top = new FormAttachment(wRemoteSettings, margin);
    fdSuccessOn.right = new FormAttachment(100, -margin);
    wSuccessOn.setLayoutData(fdSuccessOn);
    // ///////////////////////////////////////////////////////////
    // / END OF Success ON GROUP
    // ///////////////////////////////////////////////////////////
    fdFilesComp = new FormData();
    fdFilesComp.left = new FormAttachment(0, 0);
    fdFilesComp.top = new FormAttachment(0, 0);
    fdFilesComp.right = new FormAttachment(100, 0);
    fdFilesComp.bottom = new FormAttachment(100, 0);
    wFilesComp.setLayoutData(fdFilesComp);
    wFilesComp.layout();
    wFilesTab.setControl(wFilesComp);
    props.setLook(wFilesComp);
    // ///////////////////////////////////////////////////////////
    // / END OF Advanced TAB
    // ///////////////////////////////////////////////////////////
    // ///////////////////////////////////////////////////////////
    // Start of Socks Proxy Tab
    // ///////////////////////////////////////////////////////////
    wSocksProxyTab = new CTabItem(wTabFolder, SWT.NONE);
    wSocksProxyTab.setText(BaseMessages.getString(PKG, "JobFTPDelete.Tab.Socks.Label"));
    wSocksProxyComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wSocksProxyComp);
    FormLayout SoxProxyLayout = new FormLayout();
    SoxProxyLayout.marginWidth = 3;
    SoxProxyLayout.marginHeight = 3;
    wSocksProxyComp.setLayout(SoxProxyLayout);
    // ////////////////////////////////////////////////////////
    // Start of Proxy Group
    // ////////////////////////////////////////////////////////
    wSocksProxy = new Group(wSocksProxyComp, SWT.SHADOW_NONE);
    props.setLook(wSocksProxy);
    wSocksProxy.setText(BaseMessages.getString(PKG, "JobFTPDelete.SocksProxy.Group.Label"));
    FormLayout SocksProxyGroupLayout = new FormLayout();
    SocksProxyGroupLayout.marginWidth = 10;
    SocksProxyGroupLayout.marginHeight = 10;
    wSocksProxy.setLayout(SocksProxyGroupLayout);
    // host line
    wSocksProxyHost = new LabelTextVar(jobMeta, wSocksProxy, BaseMessages.getString(PKG, "JobFTPDelete.SocksProxyHost.Label"), BaseMessages.getString(PKG, "JobFTPDelete.SocksProxyHost.Tooltip"));
    props.setLook(wSocksProxyHost);
    wSocksProxyHost.addModifyListener(lsMod);
    fdSocksProxyHost = new FormData();
    fdSocksProxyHost.left = new FormAttachment(0, 0);
    fdSocksProxyHost.top = new FormAttachment(wName, margin);
    fdSocksProxyHost.right = new FormAttachment(100, margin);
    wSocksProxyHost.setLayoutData(fdSocksProxyHost);
    // port line
    wSocksProxyPort = new LabelTextVar(jobMeta, wSocksProxy, BaseMessages.getString(PKG, "JobFTPDelete.SocksProxyPort.Label"), BaseMessages.getString(PKG, "JobFTPDelete.SocksProxyPort.Tooltip"));
    props.setLook(wSocksProxyPort);
    wSocksProxyPort.addModifyListener(lsMod);
    fdSocksProxyPort = new FormData();
    fdSocksProxyPort.left = new FormAttachment(0, 0);
    fdSocksProxyPort.top = new FormAttachment(wSocksProxyHost, margin);
    fdSocksProxyPort.right = new FormAttachment(100, margin);
    wSocksProxyPort.setLayoutData(fdSocksProxyPort);
    // username line
    wSocksProxyUsername = new LabelTextVar(jobMeta, wSocksProxy, BaseMessages.getString(PKG, "JobFTPDelete.SocksProxyUsername.Label"), BaseMessages.getString(PKG, "JobFTPDelete.SocksProxyPassword.Tooltip"));
    props.setLook(wSocksProxyUsername);
    wSocksProxyUsername.addModifyListener(lsMod);
    fdSocksProxyUsername = new FormData();
    fdSocksProxyUsername.left = new FormAttachment(0, 0);
    fdSocksProxyUsername.top = new FormAttachment(wSocksProxyPort, margin);
    fdSocksProxyUsername.right = new FormAttachment(100, margin);
    wSocksProxyUsername.setLayoutData(fdSocksProxyUsername);
    // password line
    wSocksProxyPassword = new LabelTextVar(jobMeta, wSocksProxy, BaseMessages.getString(PKG, "JobFTPDelete.SocksProxyPassword.Label"), BaseMessages.getString(PKG, "JobFTPDelete.SocksProxyPassword.Tooltip"), true);
    props.setLook(wSocksProxyPort);
    wSocksProxyPassword.addModifyListener(lsMod);
    fdSocksProxyPassword = new FormData();
    fdSocksProxyPassword.left = new FormAttachment(0, 0);
    fdSocksProxyPassword.top = new FormAttachment(wSocksProxyUsername, margin);
    fdSocksProxyPassword.right = new FormAttachment(100, margin);
    wSocksProxyPassword.setLayoutData(fdSocksProxyPassword);
    // ///////////////////////////////////////////////////////////////
    // End of socks proxy group
    // ///////////////////////////////////////////////////////////////
    fdSocksProxyComp = new FormData();
    fdSocksProxyComp.left = new FormAttachment(0, margin);
    fdSocksProxyComp.top = new FormAttachment(0, margin);
    fdSocksProxyComp.right = new FormAttachment(100, -margin);
    wSocksProxy.setLayoutData(fdSocksProxyComp);
    wSocksProxyComp.layout();
    wSocksProxyTab.setControl(wSocksProxyComp);
    props.setLook(wSocksProxyComp);
    // ////////////////////////////////////////////////////////
    // End of Socks Proxy Tab
    // ////////////////////////////////////////////////////////
    fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(wName, margin);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(100, -50);
    wTabFolder.setLayoutData(fdTabFolder);
    fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(wName, margin);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(100, -50);
    wTabFolder.setLayoutData(fdTabFolder);
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
    // Add listeners
    lsCancel = new Listener() {

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

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

        public void handleEvent(Event e) {
            test();
        }
    };
    lsCheckFolder = new Listener() {

        public void handleEvent(Event e) {
            checkFTPFolder();
        }
    };
    wCancel.addListener(SWT.Selection, lsCancel);
    wOK.addListener(SWT.Selection, lsOK);
    wTest.addListener(SWT.Selection, lsTest);
    wbTestChangeFolderExists.addListener(SWT.Selection, lsCheckFolder);
    lsDef = new SelectionAdapter() {

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

        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    getData();
    activeSuccessCondition();
    activeUsePublicKey();
    activeProxy();
    activeFTPProtocol();
    activeCopyFromPrevious();
    wTabFolder.setSelection(0);
    BaseStepDialog.setSize(shell);
    shell.open();
    props.setDialogSize(shell, "JobFTPDeleteDialogSize");
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return jobEntry;
}
Also used : Group(org.eclipse.swt.widgets.Group) CTabFolder(org.eclipse.swt.custom.CTabFolder) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) ShellEvent(org.eclipse.swt.events.ShellEvent) CCombo(org.eclipse.swt.custom.CCombo) Combo(org.eclipse.swt.widgets.Combo) CTabItem(org.eclipse.swt.custom.CTabItem) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) LabelText(org.pentaho.di.ui.core.widget.LabelText) FormAttachment(org.eclipse.swt.layout.FormAttachment) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TextVar(org.pentaho.di.ui.core.widget.TextVar) LabelTextVar(org.pentaho.di.ui.core.widget.LabelTextVar) LabelTextVar(org.pentaho.di.ui.core.widget.LabelTextVar) CCombo(org.eclipse.swt.custom.CCombo) Event(org.eclipse.swt.widgets.Event) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FileDialog(org.eclipse.swt.widgets.FileDialog) Display(org.eclipse.swt.widgets.Display)

Example 3 with LabelText

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

the class TableCompareDialog method open.

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

        public void modifyText(ModifyEvent e) {
            input.setChanged();
        }
    };
    changed = input.hasChanged();
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    middle = props.getMiddlePct();
    margin = Const.MARGIN;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "TableCompareDialog.Shell.Title"));
    // Stepname line
    wlStepname = new Label(shell, SWT.RIGHT);
    wlStepname.setText(BaseMessages.getString(PKG, "TableCompareDialog.Stepname.Label"));
    props.setLook(wlStepname);
    fdlStepname = new FormData();
    fdlStepname.left = new FormAttachment(0, 0);
    fdlStepname.right = new FormAttachment(middle, -margin);
    fdlStepname.top = new FormAttachment(0, margin);
    wlStepname.setLayoutData(fdlStepname);
    wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wStepname.setText(stepname);
    props.setLook(wStepname);
    wStepname.addModifyListener(lsMod);
    fdStepname = new FormData();
    fdStepname.left = new FormAttachment(middle, 0);
    fdStepname.top = new FormAttachment(0, margin);
    fdStepname.right = new FormAttachment(100, 0);
    wStepname.setLayoutData(fdStepname);
    Control lastControl = wStepname;
    // Reference DB + schema + table
    // 
    wReferenceDB = new LabelCombo(shell, BaseMessages.getString(PKG, "TableCompareDialog.ReferenceDB.Label"), BaseMessages.getString(PKG, "TableCompareDialog.ReferenceDB.Tooltip"));
    props.setLook(wReferenceDB);
    FormData fdReferenceDB = new FormData();
    fdReferenceDB.left = new FormAttachment(0, 0);
    fdReferenceDB.top = new FormAttachment(lastControl, margin);
    fdReferenceDB.right = new FormAttachment(100, 0);
    wReferenceDB.setLayoutData(fdReferenceDB);
    lastControl = wReferenceDB;
    wReferenceSchema = new LabelCombo(shell, BaseMessages.getString(PKG, "TableCompareDialog.ReferenceSchemaField.Label"), BaseMessages.getString(PKG, "TableCompareDialog.ReferenceSchemaField.Tooltip"));
    props.setLook(wReferenceSchema);
    FormData fdReferenceSchema = new FormData();
    fdReferenceSchema.left = new FormAttachment(0, 0);
    fdReferenceSchema.top = new FormAttachment(lastControl, margin);
    fdReferenceSchema.right = new FormAttachment(100, 0);
    wReferenceSchema.setLayoutData(fdReferenceSchema);
    lastControl = wReferenceSchema;
    wReferenceTable = new LabelCombo(shell, BaseMessages.getString(PKG, "TableCompareDialog.ReferenceTableField.Label"), BaseMessages.getString(PKG, "TableCompareDialog.ReferenceTableField.Tooltip"));
    props.setLook(wReferenceTable);
    FormData fdReferenceTable = new FormData();
    fdReferenceTable.left = new FormAttachment(0, 0);
    fdReferenceTable.top = new FormAttachment(lastControl, margin);
    fdReferenceTable.right = new FormAttachment(100, 0);
    wReferenceTable.setLayoutData(fdReferenceTable);
    lastControl = wReferenceTable;
    // Reference DB + schema + table
    // 
    wCompareDB = new LabelCombo(shell, BaseMessages.getString(PKG, "TableCompareDialog.CompareDB.Label"), BaseMessages.getString(PKG, "TableCompareDialog.CompareDB.Tooltip"));
    props.setLook(wCompareDB);
    FormData fdCompareDB = new FormData();
    fdCompareDB.left = new FormAttachment(0, 0);
    fdCompareDB.top = new FormAttachment(lastControl, margin);
    fdCompareDB.right = new FormAttachment(100, 0);
    wCompareDB.setLayoutData(fdCompareDB);
    lastControl = wCompareDB;
    wCompareSchema = new LabelCombo(shell, BaseMessages.getString(PKG, "TableCompareDialog.CompareSchemaField.Label"), BaseMessages.getString(PKG, "TableCompareDialog.CompareSchemaField.Tooltip"));
    props.setLook(wCompareSchema);
    FormData fdCompareSchema = new FormData();
    fdCompareSchema.left = new FormAttachment(0, 0);
    fdCompareSchema.top = new FormAttachment(lastControl, margin);
    fdCompareSchema.right = new FormAttachment(100, 0);
    wCompareSchema.setLayoutData(fdCompareSchema);
    lastControl = wCompareSchema;
    wCompareTable = new LabelCombo(shell, BaseMessages.getString(PKG, "TableCompareDialog.CompareTableField.Label"), BaseMessages.getString(PKG, "TableCompareDialog.CompareTableField.Tooltip"));
    props.setLook(wCompareTable);
    FormData fdCompareTable = new FormData();
    fdCompareTable.left = new FormAttachment(0, 0);
    fdCompareTable.top = new FormAttachment(lastControl, margin);
    fdCompareTable.right = new FormAttachment(100, 0);
    wCompareTable.setLayoutData(fdCompareTable);
    lastControl = wCompareTable;
    wKeyFields = new LabelCombo(shell, BaseMessages.getString(PKG, "TableCompareDialog.KeyFieldsField.Label"), BaseMessages.getString(PKG, "TableCompareDialog.KeyFieldsField.Tooltip"));
    props.setLook(wKeyFields);
    FormData fdKeyFields = new FormData();
    fdKeyFields.left = new FormAttachment(0, 0);
    fdKeyFields.top = new FormAttachment(lastControl, margin);
    fdKeyFields.right = new FormAttachment(100, 0);
    wKeyFields.setLayoutData(fdKeyFields);
    lastControl = wKeyFields;
    wExcludeFields = new LabelCombo(shell, BaseMessages.getString(PKG, "TableCompareDialog.ExcludeFieldsField.Label"), BaseMessages.getString(PKG, "TableCompareDialog.ExcludeFieldsField.Tooltip"));
    props.setLook(wExcludeFields);
    FormData fdExcludeFields = new FormData();
    fdExcludeFields.left = new FormAttachment(0, 0);
    fdExcludeFields.top = new FormAttachment(lastControl, margin);
    fdExcludeFields.right = new FormAttachment(100, 0);
    wExcludeFields.setLayoutData(fdExcludeFields);
    lastControl = wExcludeFields;
    // The nr of errors field
    // 
    wNrErrors = new LabelText(shell, BaseMessages.getString(PKG, "TableCompareDialog.NrErrorsField.Label"), BaseMessages.getString(PKG, "TableCompareDialog.NrErrorsField.Tooltip"));
    props.setLook(wNrErrors);
    FormData fdNrErrors = new FormData();
    fdNrErrors.left = new FormAttachment(0, 0);
    fdNrErrors.top = new FormAttachment(lastControl, margin * 3);
    fdNrErrors.right = new FormAttachment(100, 0);
    wNrErrors.setLayoutData(fdNrErrors);
    lastControl = wNrErrors;
    // The nr of records in the reference table
    // 
    wNrRecordsReference = new LabelText(shell, BaseMessages.getString(PKG, "TableCompareDialog.NrRecordsReferenceField.Label"), BaseMessages.getString(PKG, "TableCompareDialog.NrRecordsReferenceField.Tooltip"));
    props.setLook(wNrRecordsReference);
    FormData fdNrRecordsReference = new FormData();
    fdNrRecordsReference.left = new FormAttachment(0, 0);
    fdNrRecordsReference.top = new FormAttachment(lastControl, margin);
    fdNrRecordsReference.right = new FormAttachment(100, 0);
    wNrRecordsReference.setLayoutData(fdNrRecordsReference);
    lastControl = wNrRecordsReference;
    // The nr of records in the Compare table
    // 
    wNrRecordsCompare = new LabelText(shell, BaseMessages.getString(PKG, "TableCompareDialog.NrRecordsCompareField.Label"), BaseMessages.getString(PKG, "TableCompareDialog.NrRecordsCompareField.Tooltip"));
    props.setLook(wNrRecordsCompare);
    FormData fdNrRecordsCompare = new FormData();
    fdNrRecordsCompare.left = new FormAttachment(0, 0);
    fdNrRecordsCompare.top = new FormAttachment(lastControl, margin);
    fdNrRecordsCompare.right = new FormAttachment(100, 0);
    wNrRecordsCompare.setLayoutData(fdNrRecordsCompare);
    lastControl = wNrRecordsCompare;
    // The nr of errors in the left join
    // 
    wNrErrorsLeftJoin = new LabelText(shell, BaseMessages.getString(PKG, "TableCompareDialog.NrErrorsLeftJoinField.Label"), BaseMessages.getString(PKG, "TableCompareDialog.NrErrorsLeftJoinField.Tooltip"));
    props.setLook(wNrErrorsLeftJoin);
    FormData fdNrErrorsLeftJoin = new FormData();
    fdNrErrorsLeftJoin.left = new FormAttachment(0, 0);
    fdNrErrorsLeftJoin.top = new FormAttachment(lastControl, margin);
    fdNrErrorsLeftJoin.right = new FormAttachment(100, 0);
    wNrErrorsLeftJoin.setLayoutData(fdNrErrorsLeftJoin);
    lastControl = wNrErrorsLeftJoin;
    // The nr of errors in the Inner join
    // 
    wNrErrorsInnerJoin = new LabelText(shell, BaseMessages.getString(PKG, "TableCompareDialog.NrErrorsInnerJoinField.Label"), BaseMessages.getString(PKG, "TableCompareDialog.NrErrorsInnerJoinField.Tooltip"));
    props.setLook(wNrErrorsInnerJoin);
    FormData fdNrErrorsInnerJoin = new FormData();
    fdNrErrorsInnerJoin.left = new FormAttachment(0, 0);
    fdNrErrorsInnerJoin.top = new FormAttachment(lastControl, margin);
    fdNrErrorsInnerJoin.right = new FormAttachment(100, 0);
    wNrErrorsInnerJoin.setLayoutData(fdNrErrorsInnerJoin);
    lastControl = wNrErrorsInnerJoin;
    // The nr of errors in the Right join
    // 
    wNrErrorsRightJoin = new LabelText(shell, BaseMessages.getString(PKG, "TableCompareDialog.NrErrorsRightJoinField.Label"), BaseMessages.getString(PKG, "TableCompareDialog.NrErrorsRightJoinField.Tooltip"));
    props.setLook(wNrErrorsRightJoin);
    FormData fdNrErrorsRightJoin = new FormData();
    fdNrErrorsRightJoin.left = new FormAttachment(0, 0);
    fdNrErrorsRightJoin.top = new FormAttachment(lastControl, margin);
    fdNrErrorsRightJoin.right = new FormAttachment(100, 0);
    wNrErrorsRightJoin.setLayoutData(fdNrErrorsRightJoin);
    lastControl = wNrErrorsRightJoin;
    wKeyDesc = new LabelCombo(shell, BaseMessages.getString(PKG, "TableCompareDialog.KeyDescField.Label"), BaseMessages.getString(PKG, "TableCompareDialog.KeyDescField.Tooltip"));
    props.setLook(wKeyDesc);
    FormData fdKeyDesc = new FormData();
    fdKeyDesc.left = new FormAttachment(0, 0);
    fdKeyDesc.top = new FormAttachment(lastControl, margin * 3);
    fdKeyDesc.right = new FormAttachment(100, 0);
    wKeyDesc.setLayoutData(fdKeyDesc);
    lastControl = wKeyDesc;
    wReferenceValue = new LabelCombo(shell, BaseMessages.getString(PKG, "TableCompareDialog.ReferenceValueField.Label"), BaseMessages.getString(PKG, "TableCompareDialog.ReferenceValueField.Tooltip"));
    props.setLook(wReferenceValue);
    FormData fdReferenceValue = new FormData();
    fdReferenceValue.left = new FormAttachment(0, 0);
    fdReferenceValue.top = new FormAttachment(lastControl, margin);
    fdReferenceValue.right = new FormAttachment(100, 0);
    wReferenceValue.setLayoutData(fdReferenceValue);
    lastControl = wReferenceValue;
    wCompareValue = new LabelCombo(shell, BaseMessages.getString(PKG, "TableCompareDialog.CompareValueField.Label"), BaseMessages.getString(PKG, "TableCompareDialog.CompareValueField.Tooltip"));
    props.setLook(wCompareValue);
    FormData fdCompareValue = new FormData();
    fdCompareValue.left = new FormAttachment(0, 0);
    fdCompareValue.top = new FormAttachment(lastControl, margin);
    fdCompareValue.right = new FormAttachment(100, 0);
    wCompareValue.setLayoutData(fdCompareValue);
    lastControl = wCompareValue;
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    setButtonPositions(new Button[] { wOK, wCancel }, margin, lastControl);
    // Add listeners
    lsCancel = new Listener() {

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

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

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

        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    getData();
    // Set the shell size, based upon previous time...
    // 
    setSize();
    input.setChanged(changed);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return stepname;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) LabelCombo(org.pentaho.di.ui.core.widget.LabelCombo) ShellEvent(org.eclipse.swt.events.ShellEvent) LabelText(org.pentaho.di.ui.core.widget.LabelText) Text(org.eclipse.swt.widgets.Text) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Control(org.eclipse.swt.widgets.Control) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) LabelText(org.pentaho.di.ui.core.widget.LabelText) 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 4 with LabelText

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

the class JobEntrySNMPTrapDialog 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, "JobSNMPTrap.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Job entry name line
    wName = new LabelText(shell, BaseMessages.getString(PKG, "JobSNMPTrap.Name.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.Name.Tooltip"));
    wName.addModifyListener(lsMod);
    fdName = new FormData();
    fdName.top = new FormAttachment(0, 0);
    fdName.left = new FormAttachment(0, 0);
    fdName.right = new FormAttachment(100, 0);
    wName.setLayoutData(fdName);
    wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
    // ////////////////////////
    // START OF GENERAL TAB ///
    // ////////////////////////
    wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
    wGeneralTab.setText(BaseMessages.getString(PKG, "JobSNMPTrap.Tab.General.Label"));
    wGeneralComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wGeneralComp);
    FormLayout generalLayout = new FormLayout();
    generalLayout.marginWidth = 3;
    generalLayout.marginHeight = 3;
    wGeneralComp.setLayout(generalLayout);
    // ////////////////////////
    // START OF SERVER SETTINGS GROUP///
    // /
    wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wServerSettings);
    wServerSettings.setText(BaseMessages.getString(PKG, "JobSNMPTrap.ServerSettings.Group.Label"));
    FormLayout ServerSettingsgroupLayout = new FormLayout();
    ServerSettingsgroupLayout.marginWidth = 10;
    ServerSettingsgroupLayout.marginHeight = 10;
    wServerSettings.setLayout(ServerSettingsgroupLayout);
    // ServerName line
    wServerName = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSNMPTrap.Server.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.Server.Tooltip"));
    props.setLook(wServerName);
    wServerName.addModifyListener(lsMod);
    fdServerName = new FormData();
    fdServerName.left = new FormAttachment(0, 0);
    fdServerName.top = new FormAttachment(wName, margin);
    fdServerName.right = new FormAttachment(100, 0);
    wServerName.setLayoutData(fdServerName);
    // Server port line
    wPort = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSNMPTrap.Port.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.Port.Tooltip"));
    props.setLook(wPort);
    wPort.addModifyListener(lsMod);
    fdPort = new FormData();
    fdPort.left = new FormAttachment(0, 0);
    fdPort.top = new FormAttachment(wServerName, margin);
    fdPort.right = new FormAttachment(100, 0);
    wPort.setLayoutData(fdPort);
    // Server OID line
    wOID = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSNMPTrap.OID.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.OID.Tooltip"));
    props.setLook(wOID);
    wOID.addModifyListener(lsMod);
    fdOID = new FormData();
    fdOID.left = new FormAttachment(0, 0);
    fdOID.top = new FormAttachment(wPort, margin);
    fdOID.right = new FormAttachment(100, 0);
    wOID.setLayoutData(fdOID);
    // Test connection button
    wTest = new Button(wServerSettings, SWT.PUSH);
    wTest.setText(BaseMessages.getString(PKG, "JobSNMPTrap.TestConnection.Label"));
    props.setLook(wTest);
    fdTest = new FormData();
    wTest.setToolTipText(BaseMessages.getString(PKG, "JobSNMPTrap.TestConnection.Tooltip"));
    fdTest.top = new FormAttachment(wOID, margin);
    fdTest.right = new FormAttachment(100, 0);
    wTest.setLayoutData(fdTest);
    fdServerSettings = new FormData();
    fdServerSettings.left = new FormAttachment(0, margin);
    fdServerSettings.top = new FormAttachment(wName, margin);
    fdServerSettings.right = new FormAttachment(100, -margin);
    wServerSettings.setLayoutData(fdServerSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF SERVER SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF Advanced SETTINGS GROUP///
    // /
    wAdvancedSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wAdvancedSettings);
    wAdvancedSettings.setText(BaseMessages.getString(PKG, "JobSNMPTrap.AdvancedSettings.Group.Label"));
    FormLayout AdvancedSettingsgroupLayout = new FormLayout();
    AdvancedSettingsgroupLayout.marginWidth = 10;
    AdvancedSettingsgroupLayout.marginHeight = 10;
    wAdvancedSettings.setLayout(AdvancedSettingsgroupLayout);
    // Target type
    wlTargetType = new Label(wAdvancedSettings, SWT.RIGHT);
    wlTargetType.setText(BaseMessages.getString(PKG, "JobSNMPTrap.TargetType.Label"));
    props.setLook(wlTargetType);
    fdlTargetType = new FormData();
    fdlTargetType.left = new FormAttachment(0, margin);
    fdlTargetType.right = new FormAttachment(middle, -margin);
    fdlTargetType.top = new FormAttachment(wServerSettings, margin);
    wlTargetType.setLayoutData(fdlTargetType);
    wTargetType = new CCombo(wAdvancedSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wTargetType.setItems(JobEntrySNMPTrap.target_type_Desc);
    props.setLook(wTargetType);
    fdTargetType = new FormData();
    fdTargetType.left = new FormAttachment(middle, margin);
    fdTargetType.top = new FormAttachment(wServerSettings, margin);
    fdTargetType.right = new FormAttachment(100, 0);
    wTargetType.setLayoutData(fdTargetType);
    wTargetType.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            CheckuseUserTarget();
        }
    });
    // Community String line
    wComString = new LabelTextVar(jobMeta, wAdvancedSettings, BaseMessages.getString(PKG, "JobSNMPTrap.ComString.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.ComString.Tooltip"));
    props.setLook(wComString);
    wComString.addModifyListener(lsMod);
    fdComString = new FormData();
    fdComString.left = new FormAttachment(0, 0);
    fdComString.top = new FormAttachment(wTargetType, margin);
    fdComString.right = new FormAttachment(100, 0);
    wComString.setLayoutData(fdComString);
    // User line
    wUser = new LabelTextVar(jobMeta, wAdvancedSettings, BaseMessages.getString(PKG, "JobSNMPTrap.User.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.User.Tooltip"));
    props.setLook(wUser);
    wUser.addModifyListener(lsMod);
    fdUser = new FormData();
    fdUser.left = new FormAttachment(0, 0);
    fdUser.top = new FormAttachment(wComString, margin);
    fdUser.right = new FormAttachment(100, 0);
    wUser.setLayoutData(fdUser);
    // Passphrase String line
    wPassphrase = new LabelTextVar(jobMeta, wAdvancedSettings, BaseMessages.getString(PKG, "JobSNMPTrap.Passphrase.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.Passphrase.Tooltip"), true);
    props.setLook(wPassphrase);
    wPassphrase.addModifyListener(lsMod);
    fdPassphrase = new FormData();
    fdPassphrase.left = new FormAttachment(0, 0);
    fdPassphrase.top = new FormAttachment(wUser, margin);
    fdPassphrase.right = new FormAttachment(100, 0);
    wPassphrase.setLayoutData(fdPassphrase);
    // EngineID String line
    wEngineID = new LabelTextVar(jobMeta, wAdvancedSettings, BaseMessages.getString(PKG, "JobSNMPTrap.EngineID.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.EngineID.Tooltip"));
    props.setLook(wEngineID);
    wEngineID.addModifyListener(lsMod);
    fdEngineID = new FormData();
    fdEngineID.left = new FormAttachment(0, 0);
    fdEngineID.top = new FormAttachment(wPassphrase, margin);
    fdEngineID.right = new FormAttachment(100, 0);
    wEngineID.setLayoutData(fdEngineID);
    // Retry line
    wRetry = new LabelTextVar(jobMeta, wAdvancedSettings, BaseMessages.getString(PKG, "JobSNMPTrap.Retry.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.Retry.Tooltip"));
    props.setLook(wRetry);
    wRetry.addModifyListener(lsMod);
    fdRetry = new FormData();
    fdRetry.left = new FormAttachment(0, 0);
    fdRetry.top = new FormAttachment(wEngineID, margin);
    fdRetry.right = new FormAttachment(100, 0);
    wRetry.setLayoutData(fdRetry);
    // Timeout line
    wTimeout = new LabelTextVar(jobMeta, wAdvancedSettings, BaseMessages.getString(PKG, "JobSNMPTrap.Timeout.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.Timeout.Tooltip"));
    props.setLook(wTimeout);
    wTimeout.addModifyListener(lsMod);
    fdTimeout = new FormData();
    fdTimeout.left = new FormAttachment(0, 0);
    fdTimeout.top = new FormAttachment(wRetry, margin);
    fdTimeout.right = new FormAttachment(100, 0);
    wTimeout.setLayoutData(fdTimeout);
    fdAdvancedSettings = new FormData();
    fdAdvancedSettings.left = new FormAttachment(0, margin);
    fdAdvancedSettings.top = new FormAttachment(wServerSettings, margin);
    fdAdvancedSettings.right = new FormAttachment(100, -margin);
    wAdvancedSettings.setLayoutData(fdAdvancedSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF Advanced SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF MESSAGE GROUP///
    // /
    wMessageGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wMessageGroup);
    wMessageGroup.setText(BaseMessages.getString(PKG, "JobSNMPTrap.MessageGroup.Group.Label"));
    FormLayout MessageGroupgroupLayout = new FormLayout();
    MessageGroupgroupLayout.marginWidth = 10;
    MessageGroupgroupLayout.marginHeight = 10;
    wMessageGroup.setLayout(MessageGroupgroupLayout);
    // Message line
    wlMessage = new Label(wMessageGroup, SWT.RIGHT);
    wlMessage.setText(BaseMessages.getString(PKG, "JobSNMPTrap.Message.Label"));
    props.setLook(wlMessage);
    fdlMessage = new FormData();
    fdlMessage.left = new FormAttachment(0, 0);
    fdlMessage.top = new FormAttachment(wComString, margin);
    fdlMessage.right = new FormAttachment(middle, -margin);
    wlMessage.setLayoutData(fdlMessage);
    wMessage = new StyledTextComp(jobEntry, wMessageGroup, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
    props.setLook(wMessage);
    wMessage.addModifyListener(lsMod);
    fdMessage = new FormData();
    fdMessage.left = new FormAttachment(middle, 0);
    fdMessage.top = new FormAttachment(wComString, margin);
    fdMessage.right = new FormAttachment(100, -2 * margin);
    fdMessage.bottom = new FormAttachment(100, -margin);
    wMessage.setLayoutData(fdMessage);
    fdMessageGroup = new FormData();
    fdMessageGroup.left = new FormAttachment(0, margin);
    fdMessageGroup.top = new FormAttachment(wAdvancedSettings, margin);
    fdMessageGroup.right = new FormAttachment(100, -margin);
    fdMessageGroup.bottom = new FormAttachment(100, -margin);
    wMessageGroup.setLayoutData(fdMessageGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF MESSAGE GROUP
    // ///////////////////////////////////////////////////////////
    fdGeneralComp = new FormData();
    fdGeneralComp.left = new FormAttachment(0, 0);
    fdGeneralComp.top = new FormAttachment(0, 0);
    fdGeneralComp.right = new FormAttachment(100, 0);
    fdGeneralComp.bottom = new FormAttachment(100, 0);
    wGeneralComp.setLayoutData(fdGeneralComp);
    wGeneralComp.layout();
    wGeneralTab.setControl(wGeneralComp);
    props.setLook(wGeneralComp);
    // ///////////////////////////////////////////////////////////
    // / END OF GENERAL TAB
    // ///////////////////////////////////////////////////////////
    fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(wName, margin);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(100, -50);
    wTabFolder.setLayoutData(fdTabFolder);
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
    // Add listeners
    lsCancel = new Listener() {

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

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

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

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

        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    getData();
    CheckuseUserTarget();
    wTabFolder.setSelection(0);
    BaseStepDialog.setSize(shell);
    shell.open();
    props.setDialogSize(shell, "JobSNMPTrapDialogSize");
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return jobEntry;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) StyledTextComp(org.pentaho.di.ui.core.widget.StyledTextComp) Group(org.eclipse.swt.widgets.Group) ShellAdapter(org.eclipse.swt.events.ShellAdapter) CTabFolder(org.eclipse.swt.custom.CTabFolder) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) ShellEvent(org.eclipse.swt.events.ShellEvent) CTabItem(org.eclipse.swt.custom.CTabItem) LabelTextVar(org.pentaho.di.ui.core.widget.LabelTextVar) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) CCombo(org.eclipse.swt.custom.CCombo) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) LabelText(org.pentaho.di.ui.core.widget.LabelText) 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 5 with LabelText

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

the class TransDebugDialog method showStepDebugInformation.

private void showStepDebugInformation() {
    // 
    for (Control control : wComposite.getChildren()) {
        control.dispose();
    }
    wComposite.layout(true, true);
    int[] selectionIndices = wSteps.table.getSelectionIndices();
    if (selectionIndices == null || selectionIndices.length != 1) {
        return;
    }
    previousIndex = selectionIndices[0];
    // What step did we click on?
    // 
    final StepMeta stepMeta = transDebugMeta.getTransMeta().getStep(selectionIndices[0]);
    // What is the step debugging metadata?
    // --> This can be null (most likely scenario)
    // 
    final StepDebugMeta stepDebugMeta = stepDebugMetaMap.get(stepMeta);
    // At the top we'll put a few common items like first[x], etc.
    // 
    // The row count (e.g. number of rows to keep)
    // 
    wRowCount = new LabelText(wComposite, BaseMessages.getString(PKG, "TransDebugDialog.RowCount.Label"), BaseMessages.getString(PKG, "TransDebugDialog.RowCount.ToolTip"));
    FormData fdRowCount = new FormData();
    fdRowCount.left = new FormAttachment(0, 0);
    fdRowCount.right = new FormAttachment(100, 0);
    fdRowCount.top = new FormAttachment(0, 0);
    wRowCount.setLayoutData(fdRowCount);
    wRowCount.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetDefaultSelected(SelectionEvent arg0) {
            ok(false);
        }
    });
    // Do we retrieve the first rows passing?
    // 
    wFirstRows = new Button(wComposite, SWT.CHECK);
    props.setLook(wFirstRows);
    wFirstRows.setText(BaseMessages.getString(PKG, "TransDebugDialog.FirstRows.Label"));
    wFirstRows.setToolTipText(BaseMessages.getString(PKG, "TransDebugDialog.FirstRows.ToolTip"));
    FormData fdFirstRows = new FormData();
    fdFirstRows.left = new FormAttachment(middle, 0);
    fdFirstRows.right = new FormAttachment(100, 0);
    fdFirstRows.top = new FormAttachment(wRowCount, margin);
    wFirstRows.setLayoutData(fdFirstRows);
    // Do we pause on break point, when the condition is met?
    // 
    wPauseBreakPoint = new Button(wComposite, SWT.CHECK);
    props.setLook(wPauseBreakPoint);
    wPauseBreakPoint.setText(BaseMessages.getString(PKG, "TransDebugDialog.PauseBreakPoint.Label"));
    wPauseBreakPoint.setToolTipText(BaseMessages.getString(PKG, "TransDebugDialog.PauseBreakPoint.ToolTip"));
    FormData fdPauseBreakPoint = new FormData();
    fdPauseBreakPoint.left = new FormAttachment(middle, 0);
    fdPauseBreakPoint.right = new FormAttachment(100, 0);
    fdPauseBreakPoint.top = new FormAttachment(wFirstRows, margin);
    wPauseBreakPoint.setLayoutData(fdPauseBreakPoint);
    // The condition to pause for...
    // 
    condition = null;
    if (stepDebugMeta != null) {
        condition = stepDebugMeta.getCondition();
    }
    if (condition == null) {
        condition = new Condition();
    }
    // The input fields...
    try {
        stepInputFields = transDebugMeta.getTransMeta().getStepFields(stepMeta);
    } catch (KettleStepException e) {
        stepInputFields = new RowMeta();
    }
    wlCondition = new Label(wComposite, SWT.RIGHT);
    props.setLook(wlCondition);
    wlCondition.setText(BaseMessages.getString(PKG, "TransDebugDialog.Condition.Label"));
    wlCondition.setToolTipText(BaseMessages.getString(PKG, "TransDebugDialog.Condition.ToolTip"));
    FormData fdlCondition = new FormData();
    fdlCondition.left = new FormAttachment(0, 0);
    fdlCondition.right = new FormAttachment(middle, -margin);
    fdlCondition.top = new FormAttachment(wPauseBreakPoint, margin);
    wlCondition.setLayoutData(fdlCondition);
    wCondition = new ConditionEditor(wComposite, SWT.BORDER, condition, stepInputFields);
    FormData fdCondition = new FormData();
    fdCondition.left = new FormAttachment(middle, 0);
    fdCondition.right = new FormAttachment(100, 0);
    fdCondition.top = new FormAttachment(wPauseBreakPoint, margin);
    fdCondition.bottom = new FormAttachment(100, 0);
    wCondition.setLayoutData(fdCondition);
    getStepDebugData(stepDebugMeta);
    // Add a "clear" button at the bottom on the left...
    // 
    Button wClear = new Button(wComposite, SWT.PUSH);
    props.setLook(wClear);
    wClear.setText(BaseMessages.getString(PKG, "TransDebugDialog.Clear.Label"));
    wClear.setToolTipText(BaseMessages.getString(PKG, "TransDebugDialog.Clear.ToolTip"));
    FormData fdClear = new FormData();
    fdClear.left = new FormAttachment(0, 0);
    fdClear.bottom = new FormAttachment(100, 0);
    wClear.setLayoutData(fdClear);
    wClear.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            // Clear the preview step information for this step...
            // 
            stepDebugMetaMap.remove(stepMeta);
            wSteps.table.setSelection(new int[] {});
            previousIndex = -1;
            // refresh the steps list...
            // 
            refreshStepList();
            showStepDebugInformation();
        }
    });
    wComposite.layout(true, true);
}
Also used : FormData(org.eclipse.swt.layout.FormData) Condition(org.pentaho.di.core.Condition) KettleStepException(org.pentaho.di.core.exception.KettleStepException) RowMeta(org.pentaho.di.core.row.RowMeta) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ConditionEditor(org.pentaho.di.ui.core.widget.ConditionEditor) Label(org.eclipse.swt.widgets.Label) StepMeta(org.pentaho.di.trans.step.StepMeta) Control(org.eclipse.swt.widgets.Control) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) LabelText(org.pentaho.di.ui.core.widget.LabelText) FormAttachment(org.eclipse.swt.layout.FormAttachment) StepDebugMeta(org.pentaho.di.trans.debug.StepDebugMeta)

Aggregations

SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)13 SelectionEvent (org.eclipse.swt.events.SelectionEvent)13 FormAttachment (org.eclipse.swt.layout.FormAttachment)13 FormData (org.eclipse.swt.layout.FormData)13 Button (org.eclipse.swt.widgets.Button)13 LabelText (org.pentaho.di.ui.core.widget.LabelText)13 ModifyEvent (org.eclipse.swt.events.ModifyEvent)12 ModifyListener (org.eclipse.swt.events.ModifyListener)12 ShellAdapter (org.eclipse.swt.events.ShellAdapter)12 ShellEvent (org.eclipse.swt.events.ShellEvent)12 FormLayout (org.eclipse.swt.layout.FormLayout)12 Event (org.eclipse.swt.widgets.Event)12 Listener (org.eclipse.swt.widgets.Listener)12 Shell (org.eclipse.swt.widgets.Shell)12 Display (org.eclipse.swt.widgets.Display)11 Label (org.eclipse.swt.widgets.Label)11 LabelTextVar (org.pentaho.di.ui.core.widget.LabelTextVar)11 CCombo (org.eclipse.swt.custom.CCombo)9 CTabFolder (org.eclipse.swt.custom.CTabFolder)9 CTabItem (org.eclipse.swt.custom.CTabItem)9