/**
   * Creates a new FactPatternWidget
   *
   * @param modeller
   * @param eventBus
   * @param action
   * @param readOnly if the widget should be in RO mode. If this parameter is null, the readOnly
   *     attribute is calculated.
   */
  public GlobalCollectionAddWidget(
      RuleModeller modeller,
      EventBus eventBus,
      ActionGlobalCollectionAdd action,
      Boolean readOnly) {

    super(modeller, eventBus);

    this.isFactTypeKnown =
        modeller
            .getDataModelOracle()
            .isFactTypeRecognized(modeller.getModel().getLHSBindingType(action.getFactName()));
    if (readOnly == null) {
      this.readOnly = !this.isFactTypeKnown;
    } else {
      this.readOnly = readOnly;
    }

    ActionGlobalCollectionAdd gca = (ActionGlobalCollectionAdd) action;
    SimplePanel sp = new SimplePanel();
    sp.add(
        new SmallLabel(
            " "
                + GuidedRuleEditorResources.CONSTANTS.AddXToListY(
                    gca.getFactName(), gca.getGlobalName())));

    if (this.readOnly) {
      this.layout.addStyleName("editor-disabled-widget");
      sp.addStyleName("editor-disabled-widget");
    }

    layout.setWidget(0, 0, sp);
    initWidget(layout);

    // This widget couldn't be modified
    this.setModified(false);
  }