/** Creates content Composite. */ Composite eswtConstructContent(int style) { Composite comp = super.eswtConstructContent(SWT.VERTICAL); FormLayout layout = new FormLayout(); layout.marginBottom = Style.pixelMetric(Style.QSTYLE_PM_LAYOUTBOTTOMMARGIN); layout.marginTop = Style.pixelMetric(Style.QSTYLE_PM_LAYOUTTOPMARGIN); layout.marginLeft = Style.pixelMetric(Style.QSTYLE_PM_LAYOUTLEFTMARGIN); layout.marginRight = Style.pixelMetric(Style.QSTYLE_PM_LAYOUTRIGHTMARGIN); layout.spacing = Style.pixelMetric(Style.QSTYLE_PM_LAYOUTVERTICALSPACING); comp.setLayout(layout); eswtScrolledText = new ScrolledTextComposite(comp, comp.getVerticalBar()); eswtImgLabel = new LabelExtension(comp, SWT.NONE); FormData imageLD = new FormData(); imageLD.right = new FormAttachment(100); imageLD.top = new FormAttachment(0); eswtImgLabel.setLayoutData(imageLD); FormData scrolledTextLD = new FormData(); scrolledTextLD.left = new FormAttachment(0); scrolledTextLD.top = new FormAttachment(0); scrolledTextLD.right = new FormAttachment(eswtImgLabel); eswtScrolledText.setLayoutData(scrolledTextLD); eswtProgbarLD = new FormData(); eswtProgbarLD.left = new FormAttachment(0); eswtProgbarLD.right = new FormAttachment(100); eswtProgbarLD.bottom = new FormAttachment(100); eswtUpdateProgressbar(comp, false, false); return comp; }
public TextVarWarning(VariableSpace space, Composite composite, int flags) { super(composite, SWT.NONE); warningInterfaces = new ArrayList<WarningInterface>(); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = 0; formLayout.marginHeight = 0; formLayout.marginTop = 0; formLayout.marginBottom = 0; this.setLayout(formLayout); // add a text field on it... wText = new TextVar(space, this, flags); warningControlDecoration = new ControlDecoration(wText, SWT.CENTER | SWT.RIGHT); Image warningImage = GUIResource.getInstance().getImageWarning(); warningControlDecoration.setImage(warningImage); warningControlDecoration.setDescriptionText( BaseMessages.getString(PKG, "TextVar.tooltip.FieldIsInUse")); warningControlDecoration.hide(); // If something has changed, check the warning interfaces // wText.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent arg0) { // Verify all the warning interfaces. // Show the first that has a warning to show... // boolean foundOne = false; for (WarningInterface warningInterface : warningInterfaces) { WarningMessageInterface warningSituation = warningInterface.getWarningSituation(wText.getText(), wText, this); if (warningSituation.isWarning()) { foundOne = true; warningControlDecoration.show(); warningControlDecoration.setDescriptionText(warningSituation.getWarningMessage()); break; } } if (!foundOne) { warningControlDecoration.hide(); } } }); FormData fdText = new FormData(); fdText.top = new FormAttachment(0, 0); fdText.left = new FormAttachment(0, 0); fdText.right = new FormAttachment(100, -warningImage.getBounds().width); wText.setLayoutData(fdText); }
public LabelTimeComposite(Composite composite, String labelText, String toolTipText) { super(composite, SWT.NONE); props.setLook(this); int middle = props.getMiddlePct(); int threeQuarters = (middle + 100) / 2; int margin = Const.MARGIN; FormLayout formLayout = new FormLayout(); formLayout.marginWidth = 0; formLayout.marginHeight = 0; formLayout.marginTop = 0; formLayout.marginBottom = 0; this.setLayout(formLayout); wText = new Text(this, SWT.SINGLE | SWT.LEFT | SWT.BORDER); FormData fdText = new FormData(); fdText.left = new FormAttachment(middle, margin); fdText.right = new FormAttachment(threeQuarters, 0); wText.setLayoutData(fdText); wText.setToolTipText(toolTipText); wTimeUnit = new CCombo(this, SWT.SINGLE | SWT.DROP_DOWN | SWT.BORDER | SWT.LEFT); FormData fdCombo = new FormData(); fdCombo.left = new FormAttachment(threeQuarters, margin); fdCombo.right = new FormAttachment(100, 0); wTimeUnit.setEditable(false); wTimeUnit.setLayoutData(fdCombo); wTimeUnit.setItems(getTimeUnits()); wTimeUnit.setToolTipText(toolTipText); wLabel = new Label(this, SWT.RIGHT); props.setLook(wLabel); wLabel.setText(labelText); FormData fdLabel = new FormData(); fdLabel.left = new FormAttachment(0, 0); fdLabel.right = new FormAttachment(middle, 0); fdLabel.top = new FormAttachment(wText, 0, SWT.CENTER); wLabel.setLayoutData(fdLabel); wLabel.setToolTipText(toolTipText); wText.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { if (!StringUtils.isNumeric(wText.getText())) { wText.setText(lastValidValue); } else lastValidValue = wText.getText(); } }); }
protected void createCalculatedMeasureComposite() { calculatedMeasureComposite = new CalculatedMeasureComposite(mainPanel); calculatedMeasureComposite.setLocalizationPkg(PKG); calculatedMeasureComposite.createWidgets(); // take up the entire space of the main panel FormLayout layout = new FormLayout(); layout.marginLeft = 0; layout.marginRight = 0; layout.marginBottom = 0; layout.marginTop = 5; // minor adjustment layout.marginHeight = 0; calculatedMeasureComposite.setLayout(layout); }
/** * Create a new SecurityPolicyComposite. * * @param container the container * @param parent the parent composite * @param style style bits */ public CompositeMainComposite(ICompositeContainer container, Composite parent, int style) { super(org.eclipse.soa.sca.sca1_1.model.sca.Composite.class, container, parent, style); FormLayout layout = new FormLayout(); layout.marginBottom = ITabbedPropertyConstants.VMARGIN; layout.marginTop = ITabbedPropertyConstants.VMARGIN; layout.marginLeft = ITabbedPropertyConstants.HMARGIN; layout.marginRight = ITabbedPropertyConstants.HMARGIN; setLayout(layout); FormToolkit factory = getWidgetFactory(); _nameText = factory.createText(this, ""); // $NON-NLS-1$ FormData data = new FormData(); data.left = new FormAttachment(0, 85); data.right = new FormAttachment(100, 0); data.top = new FormAttachment(0, 4); _nameText.setLayoutData(data); _nameText.addFocusListener( new FocusListener() { @Override public void focusGained(FocusEvent e) { // ignore } @Override public void focusLost(FocusEvent e) { if (_businessObject != null && !_inUpdate) { updateObjectName(_businessObject, _nameText.getText().trim()); } } }); // if (getContainer() instanceof PropertyPage) { // _nameText.addModifyListener(new ModifyListener() { // // @Override // public void modifyText(ModifyEvent arg0) { // if (!_inUpdate) { // updateObjectName(_businessObject, _nameText.getText().trim()); // } // } // // }); // } else { // _nameText.addKeyListener(new KeyListener() { // @Override // public void keyPressed(KeyEvent e) { // // ignore // } // // @Override // public void keyReleased(KeyEvent e) { // if (e.keyCode == SWT.ESC) { // _inUpdate = true; // String name = ((org.eclipse.soa.sca.sca1_1.model.sca.Composite) // _businessObject).getName(); // _nameText.setText(name == null ? "" : name); //$NON-NLS-1$ // _inUpdate = false; // } else if (e.keyCode == SWT.CR) { // updateObjectName(_businessObject, _nameText.getText().trim()); // } // } // }); // } Label valueLabel = factory.createLabel(this, "Name:"); // $NON-NLS-1$ data = new FormData(); data.left = new FormAttachment(0, 0); data.right = new FormAttachment(_nameText, -5); data.top = new FormAttachment(_nameText, 0, SWT.CENTER); valueLabel.setLayoutData(data); _targetNamespaceText = factory.createText(this, ""); // $NON-NLS-1$ data = new FormData(); Integer widthTimes1Point5 = new Integer((int) (85 * 1.5)); data.left = new FormAttachment(0, widthTimes1Point5.intValue()); data.right = new FormAttachment(100, 0); data.top = new FormAttachment(_nameText, 4); _targetNamespaceText.setLayoutData(data); _targetNamespaceText.addFocusListener( new FocusListener() { @Override public void focusGained(FocusEvent e) { // ignore } @Override public void focusLost(FocusEvent e) { if (_businessObject != null && !_inUpdate) { updateTargetNamespace(_businessObject, _targetNamespaceText.getText().trim()); } } }); _targetNamespaceText.addKeyListener( new KeyListener() { @Override public void keyPressed(KeyEvent e) { // ignore } @Override public void keyReleased(KeyEvent e) { if (e.keyCode == SWT.ESC) { _inUpdate = true; undo(_targetNamespaceText); _inUpdate = false; } else if (e.keyCode == SWT.CR || e.keyCode == SWT.TAB) { updateTargetNamespace(_businessObject, _targetNamespaceText.getText().trim()); } } }); _tnsLabel = factory.createLabel(this, Messages.label_targetNamespace); data = new FormData(); data.left = new FormAttachment(0, 0); data.right = new FormAttachment(_targetNamespaceText, -5); data.top = new FormAttachment(_targetNamespaceText, 0, SWT.CENTER); _tnsLabel.setLayoutData(data); // addDomainListener(); }
private void createGeneralGroup(Composite container) { final Group group = new Group(container, SWT.NONE); group.setText(Messages.OPT_TAB_GROUP_GENERAL); FormLayout layout = new FormLayout(); layout.marginBottom = 10; group.setLayout(layout); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // ********************************************** // Row: CleanSession // ********************************************** // CleanSession - Label Label cleanSessionLabel = new Label(group, SWT.NONE); FormData fd = new FormData(); fd.top = new FormAttachment(0, 10); fd.left = new FormAttachment(0, 10); cleanSessionLabel.setLayoutData(fd); cleanSessionLabel.setText(Messages.OPT_TAB_GROUP_GENERAL_CLEAN_SESSION); // CleanSession - Check final Button cleanSessionCheck = new Button(group, SWT.CHECK); fd = new FormData(); fd.top = new FormAttachment(cleanSessionLabel, 0, SWT.CENTER); // fd.left = new FormAttachment(cleanSessionLabel, 60); fd.left = new FormAttachment(0, 160); cleanSessionCheck.setLayoutData(fd); // ********************************************** // Row: SSL // ********************************************** // SSL - Label Label sslLabel = new Label(group, SWT.NONE); fd = new FormData(); fd.top = new FormAttachment(cleanSessionLabel, 10); fd.left = new FormAttachment(0, 10); sslLabel.setLayoutData(fd); sslLabel.setText(Messages.OPT_TAB_GROUP_GENERAL_ENABLE_SSL); // SSL - Check final Button sslCheck = new Button(group, SWT.CHECK); fd = new FormData(); fd.top = new FormAttachment(sslLabel, 0, SWT.CENTER); fd.left = new FormAttachment(cleanSessionCheck, 0, SWT.LEFT); sslCheck.setLayoutData(fd); sslCheck.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Display.getDefault() .asyncExec( new Runnable() { @Override public void run() { sslViewUpdater.update(sslCheck.getSelection()); } }); } }); // ********************************************** // Row: HA // ********************************************** // HA - Label Label haLabel = new Label(group, SWT.NONE); fd = new FormData(); fd.top = new FormAttachment(sslLabel, 10); fd.left = new FormAttachment(0, 10); haLabel.setLayoutData(fd); haLabel.setText(Messages.OPT_TAB_GROUP_GENERAL_ENABLE_HA); // HA - Check final Button haCheck = new Button(group, SWT.CHECK); fd = new FormData(); fd.top = new FormAttachment(haLabel, 0, SWT.CENTER); fd.left = new FormAttachment(cleanSessionCheck, 0, SWT.LEFT); haCheck.setLayoutData(fd); haCheck.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Display.getDefault() .asyncExec( new Runnable() { @Override public void run() { haViewUpdater.update(haCheck.getSelection()); } }); } }); // ********************************************** // Row: LWT // ********************************************** // LWT - Label Label lwtLabel = new Label(group, SWT.NONE); fd = new FormData(); fd.top = new FormAttachment(haLabel, 10); fd.left = new FormAttachment(0, 10); lwtLabel.setLayoutData(fd); lwtLabel.setText(Messages.OPT_TAB_GROUP_GENERAL_ENABLE_LWT); // LWT - Check final Button lwtCheck = new Button(group, SWT.CHECK); fd = new FormData(); fd.top = new FormAttachment(lwtLabel, 0, SWT.CENTER); fd.left = new FormAttachment(cleanSessionCheck, 0, SWT.LEFT); lwtCheck.setLayoutData(fd); lwtCheck.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Display.getDefault() .asyncExec( new Runnable() { @Override public void run() { lwtViewUpdater.update(lwtCheck.getSelection()); } }); } }); // ********************************************** // Row: Keep Alive Interval // ********************************************** // Keep Alive - Label Label keepAliveLabel = new Label(group, SWT.NONE); fd = new FormData(); fd.top = new FormAttachment(lwtLabel, 10); fd.left = new FormAttachment(0, 10); keepAliveLabel.setLayoutData(fd); keepAliveLabel.setText(Messages.OPT_TAB_GROUP_GENERAL_KEEP_ALIVE); // Keep Alive - Spinner final Spinner keepAliveSpinner = new Spinner(group, SWT.BORDER); keepAliveSpinner.setMinimum(0); keepAliveSpinner.setMaximum(Integer.MAX_VALUE); keepAliveSpinner.setIncrement(5); keepAliveSpinner.setPageIncrement(30); trackSpinnerUpdates(keepAliveSpinner); fd = new FormData(); fd.top = new FormAttachment(keepAliveLabel, 0, SWT.CENTER); fd.left = new FormAttachment(cleanSessionCheck, 0, SWT.LEFT); keepAliveSpinner.setLayoutData(fd); // Keep Alive Unit - Label Label keepAliveUnitLabel = new Label(group, SWT.NONE); fd = new FormData(); fd.top = new FormAttachment(keepAliveLabel, 0, SWT.CENTER); fd.left = new FormAttachment(keepAliveSpinner, 10); keepAliveUnitLabel.setLayoutData(fd); keepAliveUnitLabel.setText(Messages.LABEL_SECONDS); // ********************************************** // Row: Connection Timeout // ********************************************** // Connection Timeout - Label Label connectionTimeoutLabel = new Label(group, SWT.NONE); fd = new FormData(); fd.top = new FormAttachment(keepAliveLabel, 10); fd.left = new FormAttachment(0, 10); connectionTimeoutLabel.setLayoutData(fd); connectionTimeoutLabel.setText(Messages.OPT_TAB_GROUP_GENERAL_CONNECTION_TIMEOUT); // Connection Timeout - Spinner final Spinner connectionTimeoutSpinner = new Spinner(group, SWT.BORDER); connectionTimeoutSpinner.setMinimum(0); connectionTimeoutSpinner.setMaximum(Integer.MAX_VALUE); connectionTimeoutSpinner.setIncrement(5); connectionTimeoutSpinner.setPageIncrement(30); trackSpinnerUpdates(connectionTimeoutSpinner); fd = new FormData(); fd.top = new FormAttachment(connectionTimeoutLabel, 0, SWT.CENTER); fd.left = new FormAttachment(cleanSessionCheck, 0, SWT.LEFT); connectionTimeoutSpinner.setLayoutData(fd); // Connection Timeout Unit - Label Label connectionTimeoutUnitLabel = new Label(group, SWT.NONE); fd = new FormData(); fd.top = new FormAttachment(connectionTimeoutLabel, 0, SWT.CENTER); fd.left = new FormAttachment(connectionTimeoutSpinner, 10); connectionTimeoutUnitLabel.setLayoutData(fd); connectionTimeoutUnitLabel.setText(Messages.LABEL_SECONDS); // ********************************************** // Row: Use Login // ********************************************** // Use Login - Label Label loginLabel = new Label(group, SWT.NONE); fd = new FormData(); fd.top = new FormAttachment(connectionTimeoutLabel, 10); fd.left = new FormAttachment(0, 10); loginLabel.setLayoutData(fd); loginLabel.setText(Messages.OPT_TAB_GROUP_GENERAL_ENABLE_LOGIN); // Use Login - Check final Button loginCheck = new Button(group, SWT.CHECK); fd = new FormData(); fd.top = new FormAttachment(loginLabel, 0, SWT.CENTER); fd.left = new FormAttachment(cleanSessionCheck, 0, SWT.LEFT); loginCheck.setLayoutData(fd); loginCheck.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Display.getDefault() .asyncExec( new Runnable() { @Override public void run() { loginViewUpdater.update(loginCheck.getSelection()); } }); } }); // Use Login - Username - Label Label usernameLabel = new Label(group, SWT.NONE); fd = new FormData(); fd.top = new FormAttachment(loginLabel, 0, SWT.CENTER); fd.left = new FormAttachment(connectionTimeoutUnitLabel, 0, SWT.LEFT); usernameLabel.setLayoutData(fd); usernameLabel.setText(Messages.OPT_TAB_GROUP_GENERAL_USERNAME); // Use Login - Username - Text final Text usernameText = new Text(group, SWT.BORDER); fd = new FormData(); fd.top = new FormAttachment(usernameLabel, 0, SWT.CENTER); fd.left = new FormAttachment(usernameLabel, 10); fd.width = 120; usernameText.setLayoutData(fd); // Use Login - Password - Label Label passwordLabel = new Label(group, SWT.NONE); fd = new FormData(); fd.top = new FormAttachment(loginLabel, 0, SWT.CENTER); fd.left = new FormAttachment(usernameText, 20); passwordLabel.setLayoutData(fd); passwordLabel.setText(Messages.OPT_TAB_GROUP_GENERAL_PASSWORD); // Use Login - Password - Text final Text passwordText = new Text(group, SWT.BORDER | SWT.PASSWORD); fd = new FormData(); fd.top = new FormAttachment(passwordLabel, 0, SWT.CENTER); fd.left = new FormAttachment(passwordLabel, 10); fd.width = 120; passwordText.setLayoutData(fd); // ********************************************** // Row: Use Persistence // ********************************************** // Use Persistence - Label Label persistLabel = new Label(group, SWT.NONE); fd = new FormData(); fd.top = new FormAttachment(loginLabel, 10); fd.left = new FormAttachment(0, 10); persistLabel.setLayoutData(fd); persistLabel.setText(Messages.OPT_TAB_GROUP_GENERAL_ENABLE_PERSISTENCE); // Use Persistence - Check final Button persistCheck = new Button(group, SWT.CHECK); fd = new FormData(); fd.top = new FormAttachment(persistLabel, 0, SWT.CENTER); fd.left = new FormAttachment(cleanSessionCheck, 0, SWT.LEFT); persistCheck.setLayoutData(fd); persistCheck.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Display.getDefault() .asyncExec( new Runnable() { @Override public void run() { persistenceViewUpdater.update(persistCheck.getSelection()); } }); } }); // Use Persistence - Directory - Label Label directoryLabel = new Label(group, SWT.NONE); fd = new FormData(); fd.top = new FormAttachment(persistLabel, 0, SWT.CENTER); fd.left = new FormAttachment(connectionTimeoutUnitLabel, 0, SWT.LEFT); directoryLabel.setLayoutData(fd); directoryLabel.setText(Messages.OPT_TAB_GROUP_GENERAL_PERSISTENCE_DIRECTORY); // Use Persistence - Directory - Text final Text directoryText = new Text(group, SWT.BORDER); directoryText.setEditable(false); fd = new FormData(); fd.top = new FormAttachment(directoryLabel, 0, SWT.CENTER); fd.left = new FormAttachment(usernameText, 0, SWT.LEFT); fd.right = new FormAttachment(passwordText, 0, SWT.RIGHT); directoryText.setLayoutData(fd); // Use Persistence - Browse - Button final Button browseDirButton = new Button(group, SWT.PUSH); browseDirButton.setText(Messages.LABEL_BROWSE); fd = new FormData(); fd.top = new FormAttachment(directoryText, 0, SWT.CENTER); fd.left = new FormAttachment(directoryText, 10); browseDirButton.setLayoutData(fd); browseDirButton.setEnabled(connection.getOptions().isPersistenceEnabled()); browseDirButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Display.getDefault() .asyncExec( new Runnable() { @Override public void run() { DirectoryDialog directoryDialog = new DirectoryDialog(getControl().getShell()); directoryDialog.setMessage(Messages.OPT_TAB_GROUP_GENERAL_PERSISTENCE_DLG); String dir = directoryDialog.open(); if (dir != null) { directoryText.setText(dir); } } }); } }); // ********************************************** // DataBinding // ********************************************** final DataBinding dataBinding = DataBindings.createDataBinding(); // updater loginViewUpdater = new ViewUpdater<Boolean>() { final DecoratedBinding usrBinding; final DecoratedBinding pwdBinding; { // username is required usrBinding = dataBinding .bindText( usernameText, connection, Connection.PROP_OPT_LOGIN_USERNAME, Validators.required) .hideDecorations(); // password is not required pwdBinding = dataBinding .bindText( passwordText, connection, Connection.PROP_OPT_LOGIN_PASSWORD, Converters.stringToChars) .hideDecorations(); } @Override public void update(Boolean selected) { if (selected) { usrBinding.showDecorations(); pwdBinding.showDecorations(); Widgets.enable(true, usernameText, passwordText); } else { usrBinding.hideDecorations(); pwdBinding.hideDecorations(); Widgets.enable(false, usernameText, passwordText); } } }; // Persistence view updater persistenceViewUpdater = new ViewUpdater<Boolean>() { final DecoratedBinding binding; { binding = dataBinding .bindText( directoryText, connection, Connection.PROP_OPT_PERSISTENCE_DIRECTORY, Validators.required) .hideDecorations(); directoryText.setText(System.getProperty("user.dir")); // $NON-NLS-1$ } @Override public void update(Boolean selected) { browseDirButton.setEnabled(selected); if (selected) { binding.showDecorations(); } else { binding.hideDecorations(); } } }; // checkbox dataBinding.bindSelection(cleanSessionCheck, connection, Connection.PROP_OPT_CLEAN_SESSION); dataBinding.bindSelection(sslCheck, connection, Connection.PROP_OPT_SSL_ENABLED); dataBinding.bindSelection(haCheck, connection, Connection.PROP_OPT_HA_ENABLED); dataBinding.bindSelection(lwtCheck, connection, Connection.PROP_OPT_LWT_ENABLED); dataBinding.bindSelection(loginCheck, connection, Connection.PROP_OPT_LOGIN_ENABLED); dataBinding.bindSelection(persistCheck, connection, Connection.PROP_OPT_PERSISTENCE_ENABLED); // spinner dataBinding.bindSelection( keepAliveSpinner, connection, Connection.PROP_OPT_KEEP_ALIVE_INTERVAL); dataBinding.bindSelection( connectionTimeoutSpinner, connection, Connection.PROP_OPT_CONNECTION_TIMEOUT); // dispose dataBinding when UI is disposed addDisposeListener(dataBinding); // initial state Widgets.enable(connection.getOptions().isLoginEnabled(), usernameText, passwordText); }
private void createSSLGroup(Composite container) { final Group group = new Group(container, SWT.NONE); group.setText(Messages.OPT_TAB_GROUP_SSL); FormLayout layout = new FormLayout(); layout.marginBottom = 10; group.setLayout(layout); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // 1) // ********************************************** // Row: Keystore - Location // ********************************************** // Keystore Location - Label Label keystoreLabel = new Label(group, SWT.NONE); FormData fd = new FormData(); fd.top = new FormAttachment(0, 10); fd.left = new FormAttachment(0, 10); keystoreLabel.setLayoutData(fd); keystoreLabel.setText(Messages.OPT_TAB_GROUP_SSL_KEY_STORE); // Keystore Location - Directory - Text final Text keystoreDirText = new Text(group, SWT.BORDER); keystoreDirText.setEditable(false); fd = new FormData(); fd.top = new FormAttachment(keystoreLabel, 0, SWT.CENTER); // fd.left = new FormAttachment(keystoreLabel, 30); fd.left = new FormAttachment(0, 160); fd.width = 454; keystoreDirText.setLayoutData(fd); // Keystore Location- Browse - Button final Button keystoreBrowseButton = new Button(group, SWT.PUSH); keystoreBrowseButton.setText(Messages.LABEL_BROWSE); fd = new FormData(); fd.top = new FormAttachment(keystoreDirText, 0, SWT.CENTER); fd.left = new FormAttachment(keystoreDirText, 10); keystoreBrowseButton.setLayoutData(fd); keystoreBrowseButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Display.getDefault() .asyncExec( new Runnable() { @Override public void run() { FileDialog fileDialog = new FileDialog(getControl().getShell()); fileDialog.setText(Messages.OPT_TAB_GROUP_SSL_KEY_STORE_DLG); fileDialog.setFilterExtensions(KEYSTORE_FILE_EXT); String selectedFile = fileDialog.open(); if (selectedFile != null) { keystoreDirText.setText(selectedFile); } } }); } }); // ********************************************** // Row: Keystore - Password // ********************************************** // Keystore - Password - Label Label keystorePwdLabel = new Label(group, SWT.NONE); fd = new FormData(); fd.top = new FormAttachment(keystoreLabel, 10); fd.left = new FormAttachment(0, 10); keystorePwdLabel.setLayoutData(fd); keystorePwdLabel.setText(Messages.OPT_TAB_GROUP_SSL_KEY_STORE_PWD); // Keystore - Password - Text final Text keystorePwdText = new Text(group, SWT.BORDER | SWT.PASSWORD); fd = new FormData(); fd.top = new FormAttachment(keystorePwdLabel, 0, SWT.CENTER); fd.left = new FormAttachment(keystoreDirText, 0, SWT.LEFT); fd.right = new FormAttachment(keystoreDirText, 0, SWT.RIGHT); keystorePwdText.setLayoutData(fd); // 2) // ********************************************** // Row: Truststore - Location // ********************************************** // Truststore Location - Label Label truststoreLabel = new Label(group, SWT.NONE); fd = new FormData(); fd.top = new FormAttachment(keystorePwdLabel, 10); fd.left = new FormAttachment(0, 10); truststoreLabel.setLayoutData(fd); truststoreLabel.setText(Messages.OPT_TAB_GROUP_SSL_TRUST_STORE); // Truststore Location - Directory - Text final Text truststoreDirText = new Text(group, SWT.BORDER); truststoreDirText.setEditable(false); fd = new FormData(); fd.top = new FormAttachment(truststoreLabel, 0, SWT.CENTER); fd.left = new FormAttachment(keystoreDirText, 0, SWT.LEFT); fd.right = new FormAttachment(keystoreDirText, 0, SWT.RIGHT); truststoreDirText.setLayoutData(fd); // Truststore Location- Browse - Button final Button truststoreBrowseButton = new Button(group, SWT.PUSH); truststoreBrowseButton.setText(Messages.LABEL_BROWSE); fd = new FormData(); fd.top = new FormAttachment(truststoreDirText, 0, SWT.CENTER); fd.left = new FormAttachment(truststoreDirText, 10); truststoreBrowseButton.setLayoutData(fd); truststoreBrowseButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Display.getDefault() .asyncExec( new Runnable() { @Override public void run() { FileDialog fileDialog = new FileDialog(getControl().getShell()); fileDialog.setText(Messages.OPT_TAB_GROUP_SSL_TRUST_STORE_DLG); fileDialog.setFilterExtensions(KEYSTORE_FILE_EXT); String selectedFile = fileDialog.open(); if (selectedFile != null) { truststoreDirText.setText(selectedFile); } } }); } }); // ********************************************** // Row: Truststore - Password // ********************************************** // Truststore - Password - Label Label truststorePwdLabel = new Label(group, SWT.NONE); fd = new FormData(); fd.top = new FormAttachment(truststoreLabel, 10); fd.left = new FormAttachment(0, 10); truststorePwdLabel.setLayoutData(fd); truststorePwdLabel.setText(Messages.OPT_TAB_GROUP_SSL_TRUST_STORE_PWD); // Truststore - Password - Text final Text truststorePwdText = new Text(group, SWT.BORDER | SWT.PASSWORD); fd = new FormData(); fd.top = new FormAttachment(truststorePwdLabel, 0, SWT.CENTER); fd.left = new FormAttachment(keystoreDirText, 0, SWT.LEFT); fd.right = new FormAttachment(keystoreDirText, 0, SWT.RIGHT); truststorePwdText.setLayoutData(fd); // ********************************************** // DataBinding // ********************************************** final DataBinding dataBinding = DataBindings.createDataBinding(); // SSL view updater sslViewUpdater = new ViewUpdater<Boolean>() { final DecoratedBinding keystoreBinding; final DecoratedBinding truststoreBinding; { // key store keystoreBinding = dataBinding .bindText( keystoreDirText, connection, Connection.PROP_OPT_SSL_KS, Validators.required) .hideDecorations(); // PWD is not required, no decoration is required dataBinding.bindText( keystorePwdText, connection, Connection.PROP_OPT_SSL_KSPWD, Converters.stringToChars); // trust store truststoreBinding = dataBinding .bindText( truststoreDirText, connection, Connection.PROP_OPT_SSL_TS, Validators.required) .hideDecorations(); // PWD is not required, no decoration is required dataBinding.bindText( truststorePwdText, connection, Connection.PROP_OPT_SSL_TSPWD, Converters.stringToChars); } @Override public void update(Boolean selected) { Widgets.enable(group, selected); if (selected) { keystoreBinding.showDecorations(); truststoreBinding.showDecorations(); } else { keystoreBinding.hideDecorations(); truststoreBinding.hideDecorations(); } } }; // dispose dataBinding when UI is disposed addDisposeListener(dataBinding); // disable all when creation Widgets.enable(group, connection.getOptions().isSslEnabled()); }
private void createLWTGroup(Composite container) { // data model final LWT lwt = connection.getOptions().getLwt(); final Group group = new Group(container, SWT.NONE); group.setText(Messages.OPT_TAB_GROUP_LWT); // layout FormLayout layout = new FormLayout(); layout.marginBottom = 10; group.setLayout(layout); GridData gd = new GridData(GridData.FILL_HORIZONTAL); group.setLayoutData(gd); // ********************************************** // Row: Topic + QoS + Retain // ********************************************** // Topic - label Label topicLabel = new Label(group, SWT.NONE); FormData fd = new FormData(); fd.top = new FormAttachment(0, 10); fd.left = new FormAttachment(0, 10); topicLabel.setLayoutData(fd); topicLabel.setText(Messages.OPT_TAB_GROUP_LWT_TOPIC); // Topic - input final Text topicText = new Text(group, SWT.BORDER); fd = new FormData(); fd.top = new FormAttachment(topicLabel, 10, SWT.CENTER); fd.left = new FormAttachment(topicLabel, 40); fd.right = new FormAttachment(100, -4); topicText.setLayoutData(fd); // QoS - label Label qosLabel = new Label(group, SWT.NONE); fd = new FormData(); fd.top = new FormAttachment(topicLabel, 10); fd.left = new FormAttachment(0, 10); qosLabel.setLayoutData(fd); qosLabel.setText(Messages.OPT_TAB_GROUP_LWT_QOS); // QoS - selection CCombo combo = new CCombo(group, SWT.BORDER); List<String> qosList = new ArrayList<String>(); for (QoS qos : QoS.values()) { qosList.add(qos.getLabel()); } combo.setItems(qosList.toArray(new String[0])); combo.setEditable(false); combo.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { Display.getDefault() .asyncExec( new Runnable() { @Override public void run() { // Note: need manually set (because NOT using databinding for combo) CCombo combo = (CCombo) e.widget; lwt.setQos(QoS.valueOf(combo.getSelectionIndex())); } }); } }); // Note: need manually set (because NOT using databinding for combo) combo.select(lwt.getQos().getValue()); fd = new FormData(); fd.top = new FormAttachment(qosLabel, 0, SWT.CENTER); fd.left = new FormAttachment(topicText, 0, SWT.LEFT); combo.setLayoutData(fd); // Retained Button retained = new Button(group, SWT.CHECK); retained.setText(Messages.OPT_TAB_GROUP_LWT_RETAINED); fd = new FormData(); fd.top = new FormAttachment(qosLabel, 0, SWT.CENTER); fd.left = new FormAttachment(combo, 10); retained.setLayoutData(fd); // Hex final Button hex = new Button(group, SWT.CHECK); hex.setText(Messages.OPT_TAB_GROUP_LWT_HEX); fd = new FormData(); fd.top = new FormAttachment(qosLabel, 0, SWT.CENTER); fd.right = new FormAttachment(100, -4); hex.setLayoutData(fd); // ********************************************** // Row: Message - label // ********************************************** // Topic - label Label messageLabel = new Label(group, SWT.NONE); fd = new FormData(); fd.top = new FormAttachment(topicLabel, 60); fd.left = new FormAttachment(0, 10); messageLabel.setLayoutData(fd); messageLabel.setText(Messages.OPT_TAB_GROUP_LWT_MSG); // Message - input final Text messageText = new Text(group, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL); fd = new FormData(); fd.top = new FormAttachment(messageLabel, 10, SWT.CENTER); fd.left = new FormAttachment(topicText, 0, SWT.LEFT); fd.right = new FormAttachment(topicText, 0, SWT.RIGHT); // fd.width = 300; fd.height = 60; messageText.setLayoutData(fd); // XXX handle input when in HEX mode hex.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { Display.getDefault() .asyncExec( new Runnable() { @Override public void run() { Button button = (Button) e.widget; if (button.getSelection()) { messageText.setText(Strings.toHex(messageText.getText())); messageText.setEditable(false); } else { messageText.setText(Strings.hexToString(messageText.getText())); messageText.setEditable(true); } } }); } }); // ********************************************** // DataBinding // ********************************************** final DataBinding dataBinding = DataBindings.createDataBinding(); dataBinding.bindTextAsBytes(messageText, connection, Connection.PROP_OPT_LWT_PAYLOAD); dataBinding.bindSelection(retained, connection, Connection.PROP_OPT_LWT_RETAIN); // LWT view updater lwtViewUpdater = new ViewUpdater<Boolean>() { final DecoratedBinding binding; { binding = dataBinding .bindText( topicText, connection, Connection.PROP_OPT_LWT_TOPIC, Validators.publishTopic) .hideDecorations(); } @Override public void update(Boolean selected) { Widgets.enable(group, selected); if (selected) { binding.showDecorations(); } else { binding.hideDecorations(); } } }; // dispose dataBinding when UI is disposed addDisposeListener(dataBinding); // initial state Widgets.enable(group, connection.getOptions().isLwtEnabled()); }
private void create(Shell parent, final SymitarFile file) { FormLayout layout = new FormLayout(); layout.marginTop = 5; layout.marginBottom = 5; layout.marginLeft = 5; layout.marginRight = 5; layout.spacing = 5; shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM); shell.setText("Line Printer Options"); shell.setLayout(layout); Label queueLabel = new Label(shell, SWT.NONE); queueLabel.setText("LPT Queue"); Label overrideLabel = new Label(shell, SWT.NONE); overrideLabel.setText("Forms Override"); Label lengthLabel = new Label(shell, SWT.NONE); lengthLabel.setText("Form Length"); Label startLabel = new Label(shell, SWT.NONE); startLabel.setText("Start Page"); Label endLabel = new Label(shell, SWT.NONE); endLabel.setText("End Page"); Label copiesLabel = new Label(shell, SWT.NONE); copiesLabel.setText("Copies"); Label landscapeLabel = new Label(shell, SWT.NONE); landscapeLabel.setText("Landscape"); Label duplexLabel = new Label(shell, SWT.NONE); duplexLabel.setText("Duplex"); Label priorityLabel = new Label(shell, SWT.NONE); priorityLabel.setText("Queue Priority"); // Select All when tabbing through FocusListener selectAllFocuser = new FocusListener() { public void focusGained(FocusEvent e) { if (e.widget instanceof Text) ((Text) e.widget).selectAll(); } public void focusLost(FocusEvent e) {} }; MouseListener mouseFocuser = new MouseAdapter() { public void mouseDown(MouseEvent e) { if (e.widget instanceof Text) ((Text) e.widget).selectAll(); } }; final Text queueText = new Text(shell, SWT.BORDER); queueText.setText("0"); queueText.selectAll(); queueText.addFocusListener(selectAllFocuser); queueText.addMouseListener(mouseFocuser); final Combo overrideCombo = new Combo(shell, SWT.READ_ONLY); overrideCombo.add("No"); overrideCombo.add("Yes"); overrideCombo.select(0); final Text lengthText = new Text(shell, SWT.BORDER); lengthText.setText("0"); lengthText.addFocusListener(selectAllFocuser); lengthText.addMouseListener(mouseFocuser); final Text startText = new Text(shell, SWT.BORDER); startText.setText("0"); startText.addFocusListener(selectAllFocuser); startText.addMouseListener(mouseFocuser); final Text endText = new Text(shell, SWT.BORDER); endText.setText("0"); endText.addFocusListener(selectAllFocuser); endText.addMouseListener(mouseFocuser); final Text copiesText = new Text(shell, SWT.BORDER); copiesText.setText("1"); copiesText.addFocusListener(selectAllFocuser); copiesText.addMouseListener(mouseFocuser); final Combo landscapeCombo = new Combo(shell, SWT.READ_ONLY); landscapeCombo.add("No"); landscapeCombo.add("Yes"); landscapeCombo.select(0); final Combo duplexCombo = new Combo(shell, SWT.READ_ONLY); duplexCombo.add("No"); duplexCombo.add("Yes"); duplexCombo.select(0); final Text priorityText = new Text(shell, SWT.BORDER); priorityText.setText("4"); priorityText.addFocusListener(selectAllFocuser); priorityText.addMouseListener(mouseFocuser); Button okButton = new Button(shell, SWT.PUSH); okButton.setText("Print"); Button cancelButton = new Button(shell, SWT.PUSH); cancelButton.setText("Cancel"); shell.setDefaultButton(okButton); queueText.setFocus(); FormData data = new FormData(); data.left = new FormAttachment(0); data.top = new FormAttachment(0); data.width = 120; queueLabel.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(overrideLabel); data.top = new FormAttachment(0); data.right = new FormAttachment(100); data.width = 80; queueText.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(0); data.top = new FormAttachment(queueText); data.width = 120; overrideLabel.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(overrideLabel); data.top = new FormAttachment(queueText); data.right = new FormAttachment(100); data.width = 80; overrideCombo.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(0); data.top = new FormAttachment(overrideCombo); data.width = 120; lengthLabel.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(lengthLabel); data.top = new FormAttachment(overrideCombo); data.right = new FormAttachment(100); data.width = 80; lengthText.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(0); data.top = new FormAttachment(lengthText); data.width = 120; startLabel.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(startLabel); data.top = new FormAttachment(lengthText); data.right = new FormAttachment(100); data.width = 80; startText.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(0); data.top = new FormAttachment(startText); data.width = 120; endLabel.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(endLabel); data.top = new FormAttachment(startText); data.right = new FormAttachment(100); data.width = 80; endText.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(0); data.top = new FormAttachment(endText); data.width = 120; copiesLabel.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(copiesLabel); data.top = new FormAttachment(endText); data.right = new FormAttachment(100); data.width = 80; copiesText.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(0); data.top = new FormAttachment(copiesText); data.width = 120; landscapeLabel.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(landscapeLabel); data.top = new FormAttachment(copiesText); data.right = new FormAttachment(100); data.width = 80; landscapeCombo.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(0); data.top = new FormAttachment(landscapeCombo); data.width = 120; duplexLabel.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(duplexLabel); data.top = new FormAttachment(landscapeCombo); data.right = new FormAttachment(100); data.width = 80; duplexCombo.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(0); data.top = new FormAttachment(duplexCombo); data.width = 120; priorityLabel.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(priorityLabel); data.top = new FormAttachment(duplexCombo); data.right = new FormAttachment(100); data.width = 80; priorityText.setLayoutData(data); data = new FormData(); data.top = new FormAttachment(priorityText); data.right = new FormAttachment(100); cancelButton.setLayoutData(data); cancelButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { result = false; shell.dispose(); } }); data = new FormData(); data.right = new FormAttachment(cancelButton); data.top = new FormAttachment(priorityText); okButton.setLayoutData(data); okButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { result = true; SessionError result = SessionError.INPUT_ERROR; try { result = RepDevMain.SYMITAR_SESSIONS .get(file.getSym()) .printFileLPT( file, Integer.parseInt(queueText.getText()), false, 0, Integer.parseInt(startText.getText()), Integer.parseInt(endText.getText()), Integer.parseInt(copiesText.getText()), landscapeCombo.getSelectionIndex() == 1, duplexCombo.getSelectionIndex() == 1, Integer.parseInt(priorityText.getText())); } catch (NumberFormatException e1) { } if (result != SessionError.NONE) { MessageBox dialog = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR); dialog.setText("Print Error"); dialog.setMessage(result.toString()); dialog.open(); } shell.dispose(); } }); shell.pack(); shell.open(); }
/** Instantiate the UI */ public TankServerFrame() { messages = new LinkedBlockingQueue<String>(); int width = (int) (Toolkit.getDefaultToolkit()).getScreenSize().getWidth(); int height = (int) (Toolkit.getDefaultToolkit()).getScreenSize().getHeight(); // Prepare the shell (window) display = new Display(); shell = new Shell(display, SWT.MIN); shell.setText("Torpidity Tank Game - Server"); shell.setBounds(width - 700, height - 335, 700, 300); // Layout setup int margin = 3; FormLayout layout = new FormLayout(); layout.marginLeft = margin; layout.marginRight = margin; layout.marginTop = margin; layout.marginBottom = margin; shell.setLayout(layout); // Start button startButton = new Button(shell, SWT.PUSH); startButton.setText("Start Server"); startButton.setEnabled(false); FormData startButtonData = new FormData(); startButtonData.left = new FormAttachment(0); startButtonData.top = new FormAttachment(0); startButton.setLayoutData(startButtonData); // Stop button stopButton = new Button(shell, SWT.PUSH); stopButton.setText("Stop Server"); FormData stopButtonData = new FormData(); stopButtonData.left = new FormAttachment(startButton, margin); stopButtonData.top = new FormAttachment(0); stopButton.setLayoutData(stopButtonData); // Chat Log log = new Text(shell, SWT.WRAP | SWT.BORDER | SWT.V_SCROLL | SWT.READ_ONLY); log.setBackground(new Color(display, 255, 255, 255)); FormData logData = new FormData(); logData.left = new FormAttachment(stopButton, margin); logData.top = new FormAttachment(0); logData.right = new FormAttachment(100); logData.bottom = new FormAttachment(92); log.setLayoutData(logData); // Bandwidth meters bandwidth = new Label(shell, SWT.BORDER); FormData bandwidthData = new FormData(); bandwidthData.left = new FormAttachment(0); bandwidthData.right = new FormAttachment(log, -margin); bandwidthData.top = new FormAttachment(log, margin); bandwidthData.bottom = new FormAttachment(100); bandwidth.setLayoutData(bandwidthData); // Status bar statusBar = new Label(shell, SWT.BORDER); FormData statusBarData = new FormData(); statusBarData.left = new FormAttachment(bandwidth, margin); statusBarData.right = new FormAttachment(100); statusBarData.top = new FormAttachment(log, margin); statusBarData.bottom = new FormAttachment(100); statusBar.setLayoutData(statusBarData); // Player list playerList = new List(shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL); FormData playerListData = new FormData(); playerListData.left = new FormAttachment(0); playerListData.right = new FormAttachment(log, -margin); playerListData.top = new FormAttachment(startButton, margin); playerListData.bottom = new FormAttachment(statusBar, -margin); playerList.setLayoutData(playerListData); // Event handlers SelectionAdapter buttonsAdapter = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Button source = (Button) e.getSource(); if (source == startButton) setStatus(true); else if (source == stopButton) setStatus(false); } }; startButton.addSelectionListener(buttonsAdapter); stopButton.addSelectionListener(buttonsAdapter); }
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, mappingMeta); lsMod = new ModifyListener() { public void modifyText(ModifyEvent e) { mappingMeta.setChanged(); } }; changed = mappingMeta.hasChanged(); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout(formLayout); shell.setText(Messages.getString("MappingFieldRunnerDialog.Shell.Title")); // $NON-NLS-1$ middle = props.getMiddlePct(); margin = Const.MARGIN; // Stepname line wlStepname = new Label(shell, SWT.RIGHT); wlStepname.setText( Messages.getString("MappingFieldRunnerDialog.Stepname.Label")); // $NON-NLS-1$ 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); // Show a group with 2 main options: a transformation in the repository // or on file // // ////////////////////////////////////////////////// // The key creation box // ////////////////////////////////////////////////// // gTransGroup = new Group(shell, SWT.SHADOW_ETCHED_IN); gTransGroup.setText( Messages.getString("MappingFieldRunnerDialog.TransGroup.Label")); // $NON-NLS-1$; gTransGroup.setBackground(shell.getBackground()); // the default looks // ugly FormLayout transGroupLayout = new FormLayout(); transGroupLayout.marginLeft = margin * 2; transGroupLayout.marginTop = margin * 2; transGroupLayout.marginRight = margin * 2; transGroupLayout.marginBottom = margin * 2; gTransGroup.setLayout(transGroupLayout); wFieldname = new ComboVar(transMeta, gTransGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wFieldname); wFieldname.addModifyListener(lsMod); FormData fdFilename = new FormData(); fdFilename.left = new FormAttachment(0, 25); fdFilename.right = new FormAttachment(100, -margin); fdFilename.top = new FormAttachment(0, 0); wFieldname.setLayoutData(fdFilename); wExecuteForEachRow = new Button(gTransGroup, SWT.CHECK); FormData fdExecuteForEachRow = new FormData(); fdExecuteForEachRow.left = new FormAttachment(0, 25); fdExecuteForEachRow.top = new FormAttachment(wFieldname, margin); wExecuteForEachRow.setLayoutData(fdExecuteForEachRow); wlExecuteForEachRow = new Label(gTransGroup, SWT.NONE); wlExecuteForEachRow.setText( Messages.getString("MappingFieldRunnerDialog.ForEachRow.Label")); // $NON-NLS-1$ FormData fdlExecuteForEachRow = new FormData(); fdlExecuteForEachRow.left = new FormAttachment(wExecuteForEachRow, margin); fdlExecuteForEachRow.top = new FormAttachment(wFieldname, margin); wlExecuteForEachRow.setLayoutData(fdlExecuteForEachRow); FormData fdTransGroup = new FormData(); fdTransGroup.left = new FormAttachment(0, 0); fdTransGroup.top = new FormAttachment(wStepname, 2 * margin); fdTransGroup.right = new FormAttachment(100, 0); // fdTransGroup.bottom = new FormAttachment(wStepname, 350); gTransGroup.setLayoutData(fdTransGroup); // // Add a tab folder for the parameters and various input and output // streams // wTabFolder = new CTabFolder(shell, SWT.BORDER); props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB); wTabFolder.setSimple(false); wTabFolder.setUnselectedCloseVisible(true); FormData fdTabFolder = new FormData(); fdTabFolder.left = new FormAttachment(0, 0); fdTabFolder.right = new FormAttachment(100, 0); fdTabFolder.top = new FormAttachment(gTransGroup, margin * 2); fdTabFolder.bottom = new FormAttachment(100, -75); wTabFolder.setLayoutData(fdTabFolder); // Now add buttons that will allow us to add or remove input or output // tabs... wAddInput = new Button(shell, SWT.PUSH); props.setLook(wAddInput); wAddInput.setText(Messages.getString("MappingFieldRunnerDialog.button.AddInput")); wAddInput.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { // Simply add a new MappingIODefinition object to the // inputMappings MappingIODefinition definition = new MappingIODefinition(); inputMappings.add(definition); int index = inputMappings.size() - 1; addInputMappingDefinitionTab(definition, index); } }); wAddOutput = new Button(shell, SWT.PUSH); props.setLook(wAddOutput); wAddOutput.setText(Messages.getString("MappingFieldRunnerDialog.button.AddOutput")); wAddOutput.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { // Simply add a new MappingIODefinition object to the // inputMappings MappingIODefinition definition = new MappingIODefinition(); outputMappings.add(definition); int index = outputMappings.size() - 1; addOutputMappingDefinitionTab(definition, index); } }); setButtonPositions(new Button[] {wAddInput, wAddOutput}, margin, wTabFolder); // Some buttons wOK = new Button(shell, SWT.PUSH); wOK.setText(Messages.getString("System.Button.OK")); // $NON-NLS-1$ wCancel = new Button(shell, SWT.PUSH); wCancel.setText(Messages.getString("System.Button.Cancel")); // $NON-NLS-1$ setButtonPositions(new Button[] {wOK, wCancel}, margin, null); // 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); wFieldname.addSelectionListener(lsDef); wExecuteForEachRow.addSelectionListener(lsDef); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed(ShellEvent e) { cancel(); } }); // Set the shell size, based upon previous time... setSize(); getData(); getFields(); mappingMeta.setChanged(changed); wTabFolder.setSelection(0); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } return stepname; }