-
- private void createExistingCompositeGroup(Composite parent) {
- Group group= new Group(parent, SWT.NONE);
- group.setFont(parent.getFont());
- group.setText("Mapped composite");
- GridDataFactory.fillDefaults().grab(true, false).applyTo(group);
- group.setLayout(new GridLayout(1, false));
-
- Composite cmposite = new Composite(group, SWT.NONE);
- cmposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
- cmposite.setLayout(new GridLayout(2, false));
-
- Label compositeMappingLabel = new Label(cmposite, SWT.NONE);
- compositeMappingLabel.setText("Select composite");
-
- compositeMappingCombo = new Combo(cmposite, SWT.READ_ONLY | SWT.BORDER);
- GridDataFactory.fillDefaults().grab(true, false).applyTo(compositeMappingCombo);
- compositeMappingCombo.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- super.widgetSelected(e);
- recalculateMappapleComponents();
- }
- });
-
- Label compojnentMappingLabel = new Label(cmposite, SWT.NONE);
- compojnentMappingLabel.setText("Select component");
-
- componentMappingCombo = new Combo(cmposite, SWT.READ_ONLY | SWT.BORDER);
- GridDataFactory.fillDefaults().grab(true, false).applyTo(componentMappingCombo);
- }
-
- protected void recalculateMappapleComponents() {
- Simantics.getSession().asyncRequest(new ReadRequest() {
-
- @Override
- public void run(ReadGraph graph) throws DatabaseException {
-
-
- composite.getDisplay().asyncExec(() -> {
-
- });
- }
- });
+ @Override
+ public String apply(String s) {
+ try {
+ double d = Double.parseDouble(s);
+ if (d < min)
+ return "Value must be greater than or equal to " + min;
+ if (d > max)
+ return "Value must be less than or equal to " + max;
+ return null;
+ } catch (NumberFormatException e) {
+ return "Specified value is not a number";
+ }