public RiskFactorPreferencePage() {
   super("Risk factor parameters");
   prefStore = Activator.getDefault().getPreferenceStore();
   markers = new ArrayList<String>();
   impacts = new ArrayList<Combo>();
   baselines = new ArrayList<Text>();
 }
  /**
   * This method implements the building of the chosen layout with chosen parameters
   *
   * @return The built layout
   * @throws BadLayoutException If the chosen layout doesn't exist (invalid code was provided)
   */
  public Layout<NodeDescriptor, EdgeDescriptor> build() throws BadLayoutException {
    Layout<NodeDescriptor, EdgeDescriptor> layout;

    String layoutCode = layoutEntry.getCode();
    if (layoutCode.equals(Layouts.LAYOUT_ISOM.getCode())) {
      layout = new TitaniumISOMLayout<NodeDescriptor, EdgeDescriptor>(g);
      ((TitaniumISOMLayout<NodeDescriptor, EdgeDescriptor>) layout)
          .setMaxIterations(
              Activator.getDefault()
                  .getPreferenceStore()
                  .getInt(PreferenceConstants.NO_ITERATIONS));
    } else if (layoutCode.equals(Layouts.LAYOUT_KK.getCode())) {
      layout = new KKLayout<NodeDescriptor, EdgeDescriptor>(g);
      ((KKLayout<NodeDescriptor, EdgeDescriptor>) layout)
          .setMaxIterations(
              Activator.getDefault()
                  .getPreferenceStore()
                  .getInt(PreferenceConstants.NO_ITERATIONS));
    } else if (layoutCode.equals(Layouts.LAYOUT_FR.getCode())) {
      layout = new FRLayout<NodeDescriptor, EdgeDescriptor>(g);
      ((FRLayout<NodeDescriptor, EdgeDescriptor>) layout).setAttractionMultiplier(0.6);
      ((FRLayout<NodeDescriptor, EdgeDescriptor>) layout).setRepulsionMultiplier(0.8);
      ((FRLayout<NodeDescriptor, EdgeDescriptor>) layout)
          .setMaxIterations(
              Activator.getDefault()
                  .getPreferenceStore()
                  .getInt(PreferenceConstants.NO_ITERATIONS));
    } else if (layoutCode.equals(Layouts.LAYOUT_SPRING.getCode())) {
      layout = new SpringLayout<NodeDescriptor, EdgeDescriptor>(g);
    } else if (layoutCode.equals(Layouts.LAYOUT_CIRCLE.getCode())) {
      layout = new CircleLayout<NodeDescriptor, EdgeDescriptor>(g);
    } else if (layoutCode.equals(Layouts.LAYOUT_RTDAG.getCode())) {
      layout = new ReverseDAGLayout<NodeDescriptor, EdgeDescriptor>(g, size);
    } else if (layoutCode.equals(Layouts.LAYOUT_TDAG.getCode())) {
      layout = new TitaniumDAGLayout<NodeDescriptor, EdgeDescriptor>(g, size);
    } else if (layoutCode.equals(Layouts.METRIC_LAYOUT_CODE)) {
      if (!(layoutEntry instanceof MetricsLayoutEntry)) {
        throw new IllegalStateException("A metric must be chosen before using metric layout!");
      }
      layout =
          new MetricLayout<EdgeDescriptor>(g, size, ((MetricsLayoutEntry) layoutEntry).getMetric());
    } else if (layoutCode.equals(Layouts.S_LAYOUT_CLUSTER)) {
      if (clusters == null) {
        throw new IllegalStateException("A clustering must be set before using cluster layout!");
      }
      ClusterTransformer trf =
          new ClusterTransformer(new FRLayout<NodeDescriptor, EdgeDescriptor>(g), clusters, size);
      layout = new StaticLayout<NodeDescriptor, EdgeDescriptor>(g, trf);
    } else if ("STATIC".equals(layoutCode)) {
      if (pointTransformer == null) {
        throw new IllegalStateException(
            "A point transformer must be set before using static layout!");
      }
      layout = new StaticLayout<NodeDescriptor, EdgeDescriptor>(g, pointTransformer);
    } else {
      throw new BadLayoutException(
          "There is no such layout! (Layout=" + layoutCode + ")", ErrorType.NOT_EXISITING_LAYOUT);
    }
    layout.setSize(size);

    return layout;
  }