Search in sources :

Example 1 with BaseMessages.getString

use of org.pentaho.di.i18n.BaseMessages.getString in project pentaho-kettle by pentaho.

the class JmsProducerDialog method open.

@Override
public String open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX | SWT.RESIZE);
    props.setLook(shell);
    setShellImage(shell, meta);
    shell.setMinimumSize(SHELL_MIN_WIDTH, SHELL_MIN_HEIGHT);
    changed = meta.hasChanged();
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = 15;
    formLayout.marginHeight = 15;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "JmsProducerDialog.Shell.Title"));
    Label wicon = new Label(shell, SWT.RIGHT);
    wicon.setImage(getImage());
    FormData fdlicon = new FormData();
    fdlicon.top = new FormAttachment(0, 0);
    fdlicon.right = new FormAttachment(100, 0);
    wicon.setLayoutData(fdlicon);
    props.setLook(wicon);
    wlStepname = new Label(shell, SWT.RIGHT);
    wlStepname.setText(BaseMessages.getString(PKG, "JmsProducerDialog.Stepname.Label"));
    props.setLook(wlStepname);
    fdlStepname = new FormData();
    fdlStepname.left = new FormAttachment(0, 0);
    fdlStepname.top = new FormAttachment(0, 0);
    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.width = 250;
    fdStepname.left = new FormAttachment(0, 0);
    fdStepname.top = new FormAttachment(wlStepname, 5);
    wStepname.setLayoutData(fdStepname);
    Label spacer = new Label(shell, SWT.HORIZONTAL | SWT.SEPARATOR);
    props.setLook(spacer);
    FormData fdSpacer = new FormData();
    fdSpacer.height = 2;
    fdSpacer.left = new FormAttachment(0, 0);
    fdSpacer.top = new FormAttachment(wStepname, 15);
    fdSpacer.right = new FormAttachment(100, 0);
    fdSpacer.width = 497;
    spacer.setLayoutData(fdSpacer);
    // Start of tabbed display
    wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
    wTabFolder.setSimple(false);
    wTabFolder.setUnselectedCloseVisible(true);
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    FormData fdCancel = new FormData();
    fdCancel.right = new FormAttachment(100, 0);
    fdCancel.bottom = new FormAttachment(100, 0);
    wCancel.setLayoutData(fdCancel);
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    FormData fdOk = new FormData();
    fdOk.right = new FormAttachment(wCancel, -5);
    fdOk.bottom = new FormAttachment(100, 0);
    wOK.setLayoutData(fdOk);
    Label hSpacer = new Label(shell, SWT.HORIZONTAL | SWT.SEPARATOR);
    props.setLook(hSpacer);
    FormData fdhSpacer = new FormData();
    fdhSpacer.height = 2;
    fdhSpacer.left = new FormAttachment(0, 0);
    fdhSpacer.bottom = new FormAttachment(wCancel, -15);
    fdhSpacer.right = new FormAttachment(100, 0);
    hSpacer.setLayoutData(fdhSpacer);
    FormData fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(spacer, 15);
    fdTabFolder.bottom = new FormAttachment(hSpacer, -15);
    fdTabFolder.right = new FormAttachment(100, 0);
    wTabFolder.setLayoutData(fdTabFolder);
    // Setup Tab
    CTabItem wSetupTab = new CTabItem(wTabFolder, SWT.NONE);
    wSetupTab.setText(BaseMessages.getString(PKG, "JmsProducerDialog.SetupTab"));
    Composite wSetupComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wSetupComp);
    FormLayout setupLayout = new FormLayout();
    setupLayout.marginHeight = 15;
    setupLayout.marginWidth = 15;
    wSetupComp.setLayout(setupLayout);
    jmsDialogSecurityLayout = new JmsDialogSecurityLayout(props, wTabFolder, lsMod, transMeta, jmsDelegate.sslEnabled, jmsDelegate);
    jmsDialogSecurityLayout.buildSecurityTab();
    connectionForm = new ConnectionForm(wSetupComp, props, transMeta, lsMod, jmsDelegate, jmsDialogSecurityLayout);
    Group group = connectionForm.layoutForm();
    jmsDialogSecurityLayout.setConnectionForm(connectionForm);
    destinationForm = new DestinationForm(wSetupComp, group, props, transMeta, lsMod, jmsDelegate.destinationType, jmsDelegate.destinationName);
    Composite destinationFormComposite = destinationForm.layoutForm();
    Label lbMessageField = new Label(wSetupComp, SWT.LEFT);
    props.setLook(lbMessageField);
    lbMessageField.setText(getString(PKG, "JmsProducerDialog.MessageField"));
    FormData fdMessage = new FormData();
    fdMessage.left = new FormAttachment(0, 0);
    fdMessage.top = new FormAttachment(destinationFormComposite, 15);
    fdMessage.width = 250;
    lbMessageField.setLayoutData(fdMessage);
    wMessageField = new ComboVar(transMeta, wSetupComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wMessageField);
    wMessageField.addModifyListener(lsMod);
    FormData fdMessageField = new FormData();
    fdMessageField.left = new FormAttachment(0, 0);
    fdMessageField.top = new FormAttachment(lbMessageField, 5);
    fdMessageField.width = 250;
    wMessageField.setLayoutData(fdMessageField);
    Listener lsMessageFocus = e -> {
        String current = wMessageField.getText();
        wMessageField.getCComboWidget().removeAll();
        wMessageField.setText(current);
        try {
            RowMetaInterface rmi = transMeta.getPrevStepFields(meta.getParentStepMeta().getName());
            List ls = rmi.getValueMetaList();
            for (Object l : ls) {
                ValueMetaBase vmb = (ValueMetaBase) l;
                wMessageField.add(vmb.getName());
            }
        } catch (KettleStepException ex) {
        // do nothing
        }
    };
    wMessageField.getCComboWidget().addListener(SWT.FocusIn, lsMessageFocus);
    FormData fdSetupComp = new FormData();
    fdSetupComp.left = new FormAttachment(0, 0);
    fdSetupComp.top = new FormAttachment(0, 0);
    fdSetupComp.right = new FormAttachment(100, 0);
    fdSetupComp.bottom = new FormAttachment(100, 0);
    wSetupComp.setLayoutData(fdSetupComp);
    wSetupComp.layout();
    wSetupTab.setControl(wSetupComp);
    wTabFolder.setSelection(0);
    wOK.addListener(SWT.Selection, lsOK);
    wCancel.addListener(SWT.Selection, lsCancel);
    // get data for message field, other fields data is loaded by the forms
    wMessageField.setText(nullToEmpty(meta.getFieldToSend()));
    buildOptionsTab();
    buildProperiesTab();
    setSize();
    meta.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) StringUtils(org.apache.commons.lang.StringUtils) Arrays(java.util.Arrays) StepPluginType(org.pentaho.di.core.plugins.StepPluginType) StepDialogInterface(org.pentaho.di.trans.step.StepDialogInterface) GUIResource(org.pentaho.di.ui.core.gui.GUIResource) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) TransMeta(org.pentaho.di.trans.TransMeta) Composite(org.eclipse.swt.widgets.Composite) Map(java.util.Map) ConstUI(org.pentaho.di.ui.core.ConstUI) TableView(org.pentaho.di.ui.core.widget.TableView) BaseStepDialog(org.pentaho.di.ui.trans.step.BaseStepDialog) ComboVar(org.pentaho.di.ui.core.widget.ComboVar) BaseMessages(org.pentaho.di.i18n.BaseMessages) StepOption(org.pentaho.di.trans.step.StepOption) Text(org.eclipse.swt.widgets.Text) Button(org.eclipse.swt.widgets.Button) JMS_TYPE(org.pentaho.di.trans.step.jms.JmsProducerMeta.JMS_TYPE) CTabFolder(org.eclipse.swt.custom.CTabFolder) DISABLE_MESSAGE_TIMESTAMP(org.pentaho.di.trans.step.jms.JmsProducerMeta.DISABLE_MESSAGE_TIMESTAMP) Display(org.eclipse.swt.widgets.Display) List(java.util.List) DELIVERY_MODE(org.pentaho.di.trans.step.jms.JmsProducerMeta.DELIVERY_MODE) SWT(org.eclipse.swt.SWT) JMS_CORRELATION_ID(org.pentaho.di.trans.step.jms.JmsProducerMeta.JMS_CORRELATION_ID) KettleStepException(org.pentaho.di.core.exception.KettleStepException) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) PKG(org.pentaho.di.trans.step.jms.JmsConstants.PKG) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) Arrays.stream(java.util.Arrays.stream) JmsDelegate(org.pentaho.di.trans.step.jms.JmsDelegate) IntStream(java.util.stream.IntStream) ValueMetaBase(org.pentaho.di.core.row.value.ValueMetaBase) Strings.nullToEmpty(com.google.common.base.Strings.nullToEmpty) TIME_TO_LIVE(org.pentaho.di.trans.step.jms.JmsProducerMeta.TIME_TO_LIVE) Image(org.eclipse.swt.graphics.Image) Table(org.eclipse.swt.widgets.Table) BaseMessages.getString(org.pentaho.di.i18n.BaseMessages.getString) PluginInterface(org.pentaho.di.core.plugins.PluginInterface) LinkedHashMap(java.util.LinkedHashMap) Listener(org.eclipse.swt.widgets.Listener) PluginRegistry(org.pentaho.di.core.plugins.PluginRegistry) JmsProducerMeta(org.pentaho.di.trans.step.jms.JmsProducerMeta) TableItem(org.eclipse.swt.widgets.TableItem) Props(org.pentaho.di.core.Props) Shell(org.eclipse.swt.widgets.Shell) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) DISABLE_MESSAGE_ID(org.pentaho.di.trans.step.jms.JmsProducerMeta.DISABLE_MESSAGE_ID) FormAttachment(org.eclipse.swt.layout.FormAttachment) Group(org.eclipse.swt.widgets.Group) CTabItem(org.eclipse.swt.custom.CTabItem) DELIVERY_DELAY(org.pentaho.di.trans.step.jms.JmsProducerMeta.DELIVERY_DELAY) ModifyListener(org.eclipse.swt.events.ModifyListener) PRIORITY(org.pentaho.di.trans.step.jms.JmsProducerMeta.PRIORITY) INPUT_WIDTH(org.pentaho.di.ui.trans.step.BaseStreamingDialog.INPUT_WIDTH) Group(org.eclipse.swt.widgets.Group) ComboVar(org.pentaho.di.ui.core.widget.ComboVar) CTabFolder(org.eclipse.swt.custom.CTabFolder) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) KettleStepException(org.pentaho.di.core.exception.KettleStepException) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) BaseMessages.getString(org.pentaho.di.i18n.BaseMessages.getString) CTabItem(org.eclipse.swt.custom.CTabItem) Shell(org.eclipse.swt.widgets.Shell) Button(org.eclipse.swt.widgets.Button) List(java.util.List) FormAttachment(org.eclipse.swt.layout.FormAttachment) Display(org.eclipse.swt.widgets.Display) ValueMetaBase(org.pentaho.di.core.row.value.ValueMetaBase)

Example 2 with BaseMessages.getString

use of org.pentaho.di.i18n.BaseMessages.getString in project pdi-dataservice-server-plugin by pentaho.

the class DataServiceDialogController method showHelp.

// Bound via XUL
@SuppressWarnings("unused")
public void showHelp() {
    String title = BaseMessages.getString(PKG, "DataServiceDialog.Help.Title");
    String docUrl = Const.getDocUrl(BaseMessages.getString(PKG, "DataServiceDialog.Help.Url"));
    String header = "";
    HelpUtils.openHelpDialog(getDialog().getShell(), title, docUrl, header);
}
Also used : BaseMessages.getString(org.pentaho.di.i18n.BaseMessages.getString)

Aggregations

BaseMessages.getString (org.pentaho.di.i18n.BaseMessages.getString)2 Strings.nullToEmpty (com.google.common.base.Strings.nullToEmpty)1 Arrays (java.util.Arrays)1 Arrays.stream (java.util.Arrays.stream)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Map (java.util.Map)1 IntStream (java.util.stream.IntStream)1 StringUtils (org.apache.commons.lang.StringUtils)1 SWT (org.eclipse.swt.SWT)1 CTabFolder (org.eclipse.swt.custom.CTabFolder)1 CTabItem (org.eclipse.swt.custom.CTabItem)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 Image (org.eclipse.swt.graphics.Image)1 FormAttachment (org.eclipse.swt.layout.FormAttachment)1 FormData (org.eclipse.swt.layout.FormData)1 FormLayout (org.eclipse.swt.layout.FormLayout)1 Button (org.eclipse.swt.widgets.Button)1 Composite (org.eclipse.swt.widgets.Composite)1 Display (org.eclipse.swt.widgets.Display)1