Package org.springframework.ide.eclipse.wizard.template.infrastructure.ui

Examples of org.springframework.ide.eclipse.wizard.template.infrastructure.ui.WizardUIInfoElement


    container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    List<WizardUIInfoElement> elements = inputHandler.getInfoElements();

    for (int i = 0; i < elements.size(); i++) {
      final WizardUIInfoElement element = elements.get(i);
      String description = null;
      if (element.getRequired()) {
        description = element.getDescription() + "*"; //$NON-NLS-1$
      }
      else {
        description = element.getDescription();
      }

      boolean booleanPrompt = element.getType() == Boolean.class;
      String defaultValue = element.getDefaultValue();

      if (booleanPrompt) {
        Composite buttonContainer = new Composite(container, SWT.NONE);
        buttonContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
        GridLayout layout = new GridLayout(2, false);
        layout.horizontalSpacing = 10;
        buttonContainer.setLayout(layout);

        Label label = new Label(buttonContainer, SWT.NONE);

        if (description != null) {
          label.setText(description);
        }

        label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

        final Button button = new Button(buttonContainer, SWT.CHECK);
        button.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
        if (i == 0) {
          button.setFocus();
        }
        button.setData(CONTROL_DATA_KEY, element);

        button.addSelectionListener(new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent event) {
            WizardUIInfoElement element = (WizardUIInfoElement) button.getData(CONTROL_DATA_KEY);
            if (element != null) {
              inputHandler.updateInput(element.getName(), button.getSelection());
            }
          }
        });

        if (defaultValue != null && defaultValue.equals("true")) {
          button.setSelection(true);
        }
        else if (defaultValue != null && defaultValue.equals("false")) {
          button.setSelection(false);
        }

      }
      else {
        Label descriptionLabel = new Label(container, SWT.NONE);

        if (description != null) {
          descriptionLabel.setText(description);
        }

        descriptionLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

        final Text text = new Text(container, SWT.BORDER);
        text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
        text.setEditable(true);

        text.setData(CONTROL_DATA_KEY, element);

        if (defaultValue != null && defaultValue.length() > 0) {
          text.setText(defaultValue);
          inputHandler.updateInput(element.getName(), defaultValue);
        }

        WizardTextKeyValidator validator = new WizardTextKeyValidator(i, element, text, this) {

          @Override
          public void keyReleased(KeyEvent e) {
            WizardUIInfoElement element = (WizardUIInfoElement) text.getData(CONTROL_DATA_KEY);
            if (element != null) {
              inputHandler.updateInput(element.getName(), text.getText());
            }
            super.keyReleased(e);
          }
        };

View Full Code Here

TOP

Related Classes of org.springframework.ide.eclipse.wizard.template.infrastructure.ui.WizardUIInfoElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.