/**
   * @param composite
   * @return
   */
  private Composite createLiteralsConfigurationComposite(final Composite composite) {

    final ScrolledComposite scrolledComposite = new ScrolledComposite(composite, SWT.V_SCROLL);
    scrolledComposite.setLayout(new FillLayout());

    final Composite typeComposite = new Composite(scrolledComposite, SWT.NONE);
    typeComposite.setLayout(new GridLayout(1, false));
    DynamicAddRemoveLineComposite literalsComposite =
        new DynamicAddRemoveLineComposite(typeComposite, SWT.NONE) {
          @Override
          protected void lineRemoved(int i) {
            literals.remove(i);

            getShell().pack(true);
            getShell().layout(true, true);

            scrolledComposite.setMinSize(typeComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
            scrolledComposite.setAlwaysShowScrollBars(false);
            scrolledComposite.setExpandHorizontal(true);
            scrolledComposite.setExpandVertical(true);
            scrolledComposite.setContent(typeComposite);

            getContainer().updateButtons();
          }

          @Override
          protected void lineAdded(int i) {

            getShell().pack(true);
            getShell().layout(true, true);

            scrolledComposite.setMinSize(typeComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
            scrolledComposite.setAlwaysShowScrollBars(false);
            scrolledComposite.setExpandHorizontal(true);
            scrolledComposite.setExpandVertical(true);
            scrolledComposite.setContent(typeComposite);
            if (getContainer().getCurrentPage() != null) {
              getContainer().updateButtons();
            }
          }

          @Override
          protected Button createAddButton(Composite parent) {
            Button button = new Button(parent, SWT.FLAT);
            button.setText(Messages.addALiteral);
            return button;
          }

          @Override
          protected TabbedPropertySheetWidgetFactory getWidgetFactory() {
            return null;
          }

          @Override
          protected Composite getTopComposite() {
            return scrolledComposite;
          }

          @SuppressWarnings("restriction")
          @Override
          protected Control createLineComposite(Composite parent, Object object) {
            SimulationLiteral literal;
            if (object == null) {
              literal = SimulationFactory.eINSTANCE.createSimulationLiteral();
              literals.add(literal);
            } else {
              literal = (SimulationLiteral) object;
            }
            Composite composite = new Composite(parent, SWT.NONE);
            composite.setLayout(new GridLayout(4, false));
            Label literalLabel = new Label(composite, SWT.NONE);
            literalLabel.setText(Messages.dataNameLabel);
            Text literalText = new Text(composite, SWT.BORDER);
            literalText.setLayoutData(
                GridDataFactory.swtDefaults()
                    .align(SWT.FILL, SWT.CENTER)
                    .grab(false, false)
                    .hint(200, SWT.DEFAULT)
                    .create());
            // literalText.addModifyListener(updateButtonModifyListener) ;
            Label probaLabel = new Label(composite, SWT.NONE);
            probaLabel.setText(Messages.AddSimulationDataWizardPage_probability);
            Text probaText = new Text(composite, SWT.BORDER);
            probaText.setLayoutData(
                GridDataFactory.swtDefaults()
                    .align(SWT.FILL, SWT.CENTER)
                    .grab(false, false)
                    .hint(60, SWT.DEFAULT)
                    .create());
            //                ControlDecoration controlDecoration = new ControlDecoration(probaText,
            // SWT.LEFT|SWT.TOP);
            //                FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault()
            //                        .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
            //                controlDecoration.setImage(fieldDecoration.getImage());
            //                controlDecoration.setDescriptionText(Messages.mustBeAPercentage);
            context.bindValue(
                SWTObservables.observeText(literalText, SWT.Modify),
                EMFObservables.observeValue(
                    literal, SimulationPackage.Literals.SIMULATION_LITERAL__VALUE));
            UpdateValueStrategy targetToModel = new UpdateValueStrategy();
            targetToModel.setConverter(
                StringToNumberConverter.toDouble(BonitaNumberFormat.getPercentInstance(), true));
            targetToModel.setAfterGetValidator(
                new ProbabilityValidator(
                    new StringToDoubleValidator(
                        StringToNumberConverter.toDouble(
                            BonitaNumberFormat.getPercentInstance(), false))));
            Binding provider =
                context.bindValue(
                    SWTObservables.observeText(probaText, SWT.Modify),
                    EMFObservables.observeValue(
                        literal, SimulationPackage.Literals.SIMULATION_LITERAL__PROBABILITY),
                    targetToModel,
                    new UpdateValueStrategy()
                        .setConverter(
                            NumberToStringConverter.fromDouble(
                                BonitaNumberFormat.getPercentInstance(), false)));

            ControlDecorationSupport.create(provider, SWT.TOP | SWT.LEFT);
            probaText.addModifyListener(
                new ModifyListener() {

                  @Override
                  public void modifyText(ModifyEvent e) {
                    if (getContainer().getCurrentPage() != null) {
                      getContainer().updateButtons();
                    }
                  }
                });
            return composite;
          }
        };
    for (SimulationLiteral literal : literals) {
      literalsComposite.addLine(literal);
    }
    literalsComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    scrolledComposite.setMinSize(typeComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    scrolledComposite.setAlwaysShowScrollBars(false);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setContent(typeComposite);
    return scrolledComposite;
  }
  /**
   * @param composite
   * @return
   */
  private Composite createNumberConfigurationComposite(final Composite composite) {

    final ScrolledComposite scrolledComposite = new ScrolledComposite(composite, SWT.V_SCROLL);
    scrolledComposite.setLayout(new FillLayout());
    final Composite typeComposite = new Composite(scrolledComposite, SWT.NONE);
    typeComposite.setLayout(new GridLayout(1, false));
    DynamicAddRemoveLineComposite literalsComposite =
        new DynamicAddRemoveLineComposite(typeComposite, SWT.NONE) {
          @Override
          protected void lineRemoved(int i) {
            ranges.remove(i);

            getShell().pack(true);
            getShell().layout(true, true);

            scrolledComposite.setMinSize(typeComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
            scrolledComposite.setAlwaysShowScrollBars(false);
            scrolledComposite.setExpandHorizontal(true);
            scrolledComposite.setExpandVertical(true);
            scrolledComposite.setContent(typeComposite);
            if (getContainer().getCurrentPage() != null) {
              getContainer().updateButtons();
            }
          }

          @Override
          protected void lineAdded(int i) {
            getShell().pack(true);
            getShell().layout(true, true);

            scrolledComposite.setMinSize(typeComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
            scrolledComposite.setAlwaysShowScrollBars(false);
            scrolledComposite.setExpandHorizontal(true);
            scrolledComposite.setExpandVertical(true);
            scrolledComposite.setContent(typeComposite);
            if (getContainer().getCurrentPage() != null) {
              getContainer().updateButtons();
            }
          }

          @Override
          protected Button createAddButton(Composite parent) {
            Button button = new Button(parent, SWT.FLAT);
            button.setText(Messages.addARange);
            return button;
          }

          @Override
          protected TabbedPropertySheetWidgetFactory getWidgetFactory() {
            return null;
          }

          @Override
          protected Composite getTopComposite() {
            return scrolledComposite;
          }

          @Override
          protected Control createLineComposite(Composite parent, Object object) {
            SimulationNumberRange range;
            if (object == null) {
              range = SimulationFactory.eINSTANCE.createSimulationNumberRange();
              ranges.add(range);
            } else {
              range = (SimulationNumberRange) object;
            }
            Composite composite = new Composite(parent, SWT.NONE);
            composite.setLayout(new GridLayout(6, false));
            // min
            Label minLabel = new Label(composite, SWT.NONE);
            minLabel.setText(Messages.AddSimulationDataWizardPage_min);
            Text minText = new Text(composite, SWT.BORDER);
            minText.setLayoutData(
                GridDataFactory.swtDefaults()
                    .align(SWT.FILL, SWT.CENTER)
                    .hint(100, SWT.DEFAULT)
                    .create());
            ControlDecoration minControlDecoration =
                new ControlDecoration(minText, SWT.LEFT | SWT.TOP);
            FieldDecoration fieldDecoration =
                FieldDecorationRegistry.getDefault()
                    .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
            minControlDecoration.setImage(fieldDecoration.getImage());
            minControlDecoration.setDescriptionText(Messages.mustBeANumber);
            // max
            Label maxLiteral = new Label(composite, SWT.NONE);
            maxLiteral.setText(Messages.AddSimulationDataWizardPage_max);
            Text maxText = new Text(composite, SWT.BORDER);
            maxText.setLayoutData(
                GridDataFactory.swtDefaults()
                    .align(SWT.FILL, SWT.CENTER)
                    .hint(100, SWT.DEFAULT)
                    .create());
            ControlDecoration maxControlDecoration =
                new ControlDecoration(maxText, SWT.LEFT | SWT.TOP);
            fieldDecoration =
                FieldDecorationRegistry.getDefault()
                    .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
            maxControlDecoration.setImage(fieldDecoration.getImage());
            maxControlDecoration.setDescriptionText(Messages.mustBeANumber);
            // proba
            Label probaLabel = new Label(composite, SWT.NONE);
            probaLabel.setText(Messages.AddSimulationDataWizardPage_probability);
            Text probaText = new Text(composite, SWT.BORDER);
            probaText.setLayoutData(
                GridDataFactory.swtDefaults()
                    .align(SWT.FILL, SWT.CENTER)
                    .hint(40, SWT.DEFAULT)
                    .create());
            //                ControlDecoration controlDecoration = new ControlDecoration(probaText,
            // SWT.LEFT|SWT.TOP);
            //                fieldDecoration = FieldDecorationRegistry.getDefault()
            //                        .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
            //                controlDecoration.setImage(fieldDecoration.getImage());
            //                controlDecoration.setDescriptionText(Messages.mustBeAPercentage);
            // repartitionType

            //				Label repartitionLabel = new Label(composite, SWT.NONE);
            //				repartitionLabel.setText(Messages.AddSimulationDataWizardPage_repartition);
            //				ComboViewer comboViewer = new ComboViewer(new Combo(composite, SWT.READ_ONLY));
            //				comboViewer.setContentProvider(ArrayContentProvider.getInstance());
            //				comboViewer.setLabelProvider(new LabelProvider(){
            //					@Override
            //					public String getText(Object element) {
            //						return ((RepartitionType)element).getName();
            //					}
            //				});
            //				comboViewer.setInput(RepartitionType.VALUES);

            context.bindValue(
                SWTObservables.observeText(minText, SWT.Modify),
                EMFObservables.observeValue(
                    range, SimulationPackage.Literals.SIMULATION_NUMBER_RANGE__MIN),
                new UpdateValueStrategy()
                    .setConverter(StringToNumberConverter.toLong(false))
                    .setAfterGetValidator(
                        new WrappingValidator(
                            minControlDecoration,
                            new StringToLongValidator(StringToNumberConverter.toLong(false)))),
                new UpdateValueStrategy().setConverter(NumberToStringConverter.fromLong(false)));
            context.bindValue(
                SWTObservables.observeText(maxText, SWT.Modify),
                EMFObservables.observeValue(
                    range, SimulationPackage.Literals.SIMULATION_NUMBER_RANGE__MAX),
                new UpdateValueStrategy()
                    .setConverter(StringToNumberConverter.toLong(false))
                    .setAfterGetValidator(
                        new WrappingValidator(
                            maxControlDecoration,
                            new StringToLongValidator(StringToNumberConverter.toLong(false)))),
                new UpdateValueStrategy().setConverter(NumberToStringConverter.fromLong(false)));
            UpdateValueStrategy targetToModel = new UpdateValueStrategy();
            targetToModel.setConverter(
                StringToNumberConverter.toDouble(BonitaNumberFormat.getPercentInstance(), true));
            targetToModel.setAfterGetValidator(
                new ProbabilityValidator(
                    new StringToDoubleValidator(
                        StringToNumberConverter.toDouble(
                            BonitaNumberFormat.getPercentInstance(), false))));
            Binding provider =
                context.bindValue(
                    SWTObservables.observeText(probaText, SWT.Modify),
                    EMFObservables.observeValue(
                        range, SimulationPackage.Literals.SIMULATION_NUMBER_RANGE__PROBABILITY),
                    targetToModel,
                    new UpdateValueStrategy()
                        .setConverter(
                            NumberToStringConverter.fromDouble(
                                BonitaNumberFormat.getPercentInstance(), false)));
            // context.bindValue(ViewersObservables.observeSingleSelection(comboViewer),
            // EMFObservables.observeValue(range,
            // SimulationPackage.Literals.SIMULATION_NUMBER_RANGE__REPARTITION_TYPE));

            //				minText.addModifyListener(updateButtonModifyListener);
            //				maxText.addModifyListener(updateButtonModifyListener) ;
            //				probaText.addModifyListener(updateButtonModifyListener) ;
            ControlDecorationSupport.create(provider, SWT.TOP | SWT.LEFT);

            return composite;
          }
        };
    for (SimulationNumberRange range : ranges) {
      literalsComposite.addLine(range);
    }
    literalsComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    scrolledComposite.setMinSize(typeComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    scrolledComposite.setAlwaysShowScrollBars(false);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setContent(typeComposite);
    return scrolledComposite;
  }