/** 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); }
public static Group createFormGroup(final Composite parent) { Group group = new Group(parent, SWT.NONE); FormLayout layout = new FormLayout(); layout.marginTop = -5; // Adjust. UX Recommendation for Top Margin of Group: 15 layout.marginWidth = 0; layout.marginHeight = GROUP_MARGIN_HEIGHT; group.setLayout(layout); FormData fd = new FormData(); fd.left = new FormAttachment(0, 0); fd.right = new FormAttachment(100, 0); group.setLayoutData(fd); return group; }
/** * 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 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 void build() { shell = new Shell(parentShell, SWT.TOOL | SWT.CLOSE); final Rectangle bounds = this.display.getBounds(); shell.setLocation(bounds.width - 220, bounds.height - iY); shell.setSize(200, iheight); final Timer upDownWindowTimer = new Timer(true); upDownWindowTimer.schedule( new TimerTask() { public void run() { display.syncExec( new Runnable() { public void run() { if (step < 0 && delayTime > 0) { delayTime = delayTime - 30; return; } shell.setLocation(bounds.width - 220, bounds.height - iY); shell.setSize(200, iheight); iheight = iheight + step; iY = iY + step; if (iheight == 150 && step > 0) { step = -step; delayTime = POPUP_WINDOW_DELAY_TIME; } if (iheight == 0 && step < 0) { step = -step; delayTime = 0; upDownWindowTimer.cancel(); shell.close(); } } }); } }, 0, 30); shell.addShellListener( new ShellAdapter() { public void shellClosed(ShellEvent e) { upDownWindowTimer.cancel(); } }); // For the jmobile invoke. shell.setText(Messages.getString(MessagesConstant.NEW_SMS_TITLE)); // For the main() invoke. // shell.setText("NEW SMS"); setBackGroundWhite(shell); FormLayout layout = new FormLayout(); layout.marginTop = 5; layout.marginLeft = 5; shell.setLayout(layout); // The first row: product name label FormData formData = new FormData(); formData.left = new FormAttachment(0, 0); formData.right = new FormAttachment(0, 200); formData.top = new FormAttachment(0, 0); Label lbSender = new Label(shell, SWT.LEFT); lbSender.setLayoutData(formData); // For the jmobile invoke. lbSender.setText(Messages.getString(MessagesConstant.NEW_SMS_FROM, message.getTeleNum())); // For the main() invoke. // lbSender.setText(message.getTeleNum()); setBackGroundWhite(lbSender); // The first row: product name label formData = new FormData(); formData.left = new FormAttachment(0, 0); formData.right = new FormAttachment(0, 200); formData.top = new FormAttachment(lbSender, 10); Link lkContent = new Link(shell, SWT.NONE); lkContent.setLayoutData(formData); lkContent.setText(MessageFormat.format(smsContentFormat, new Object[] {message.getContent()})); lkContent.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { shell.close(); NewSMSDialog dialog = new NewSMSDialog(NewMessageArrivalPopupWindowShell.this.parentShell); dialog.create(); // set value to control in dialog dialog.getTxtReceiver().setText(message.getTeleNum()); dialog.getTxtContent().setText(message.getContent()); dialog.getTxtContent().setFocus(); dialog.open(); } }); setBackGroundWhite(lkContent); shell.setFocus(); shell.open(); shell.forceActive(); PlaySound.execute(WAV_FILE); }
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; }