private void addActions(Layer main) {
   StringBuilder actions =
       new StringBuilder("GroupJoinerHelper.FAILURE_MSG = '")
           .append(iwrb.getLocalizedString("failed", "Failed"))
           .append(JS_STR_INITIALIZATION_END)
           .append("GroupJoinerHelper.ADDING_TO_GROUP_MSG = '")
           .append(iwrb.getLocalizedString("adding_to_group", "Adding to group"))
           .append(JS_STR_INITIALIZATION_END)
           .append("GroupJoinerHelper.REMOVING_FROM_GROUP_MSG = '")
           .append(iwrb.getLocalizedString("removing_from_group", "Removing from group"))
           .append(JS_STR_INITIALIZATION_END);
   String actionString = PresentationUtil.getJavaScriptAction(actions.toString());
   main.add(actionString);
 }
  public PresentationObject getChooser(IWContext iwc, IWBundle bundle) {
    if (useOldLogic) { //	Old chooser
      Table table = new Table(2, 1);
      table.setCellpadding(0);
      table.setCellspacing(0);

      Parameter value = new Parameter(getChooserParameter(), "");
      if (this._stringValue != null) {
        value.setValue(this._stringValue);
      }
      table.add(value);

      PresentationObject object = getPresentationObject(iwc);

      table.add(new Parameter(VALUE_PARAMETER_NAME, value.getName()));
      // GenericButton button = new
      // GenericButton("chooserbutton",bundle.getResourceBundle(iwc).getLocalizedString(chooserText,"Choose"));
      if (this._addForm) {
        SubmitButton button = new SubmitButton(this._iwrb.getLocalizedString("choose", "Choose"));
        table.add(button, 2, 1);
        this._form.addParameter(CHOOSER_SELECTION_PARAMETER, getChooserParameter());
        this._form.addParameter(
            FORM_ID_PARAMETER,
            "window.opener.document.getElementById(\"" + this._form.getID() + "\").");
        this._form.addParameter(SCRIPT_SUFFIX_PARAMETER, "value");
        if (this.filter != null) {
          if (this.filter.length() > 0) {
            this._form.addParameter(FILTER_PARAMETER, this.filter);
          }
        }
        addParametersToForm(this._form);
      } else {
        getLink(this._iwrb);

        if (getUsePublicWindowOpener()) {
          this.link.setPublicWindowToOpen(getChooserWindowClass());
        } else {
          this.link.setWindowToOpen(getChooserWindowClass());
        }
        this.link.addParameter(CHOOSER_SELECTION_PARAMETER, getChooserParameter());

        this.link.addParameter(FORM_ID_PARAMETER, getParentFormID());

        // TODO Make the javascript work for other objects than form elements,
        // e.g. a Link
        /*
         * if(object instanceof Layer){
         * link.addParameter(SCRIPT_SUFFIX_PARAMETER,"title"); }
         */
        this.link.addParameter(SCRIPT_SUFFIX_PARAMETER, "value");
        // }

        // this was object.getID() but the id could change if this object was kept in session but
        // the form changed
        // by using getName() the reference is not lost, however we might need to add extra steps
        // for handling more than one
        // chooser of the same type in the same form.
        this.link.addParameter(DISPLAYSTRING_PARAMETER_NAME, object.getName());
        this.link.addParameter(VALUE_PARAMETER_NAME, value.getName());
        if (this._attributeName != null && this._attributeValue != null) {
          this.link.addParameter(this._attributeName, this._attributeValue);
        }
        if (this.filter != null) {
          if (this.filter.length() > 0) {
            this.link.addParameter(FILTER_PARAMETER, this.filter);
          }
        }

        addParametersToLink(this.link);

        table.add(this.link, 2, 1);
      }

      table.add(object, 1, 1);
      table.add(new Parameter(DISPLAYSTRING_PARAMETER_NAME, "151324213"));
      return (table);
    } else { //	New chooser
      Layer container = new Layer();

      String chooserObject = getChooserHelperVarName();
      if (chooserObject == null) {
        chooserObject = AbstractChooserBlock.GLOBAL_HELPER_NAME;
      } else {
        add(
            PresentationUtil.getJavaScriptAction(
                PresentationUtil.getJavaScriptLinesLoadedLazily(
                    CoreUtil.getResourcesForChooser(iwc),
                    new StringBuilder("if (!")
                        .append(chooserObject)
                        .append(") var ")
                        .append(chooserObject)
                        .append(" = new ChooserHelper();")
                        .toString())));
      }

      PresentationObject object = getPresentationObject(iwc);
      container.add(object);

      Image chooser = getChooser(bundle);
      chooser.setStyleClass("chooserStyle");

      chooser.setMarkupAttribute("choosername", chooserObject);

      //	OnClick action
      StringBuffer action =
          new StringBuffer("addChooserObject('").append(chooser.getId()).append("', '");
      action.append(getChooserWindowClass().getName());
      if (getHiddenInputAttribute() == null) {
        action.append("', null, '");
      } else {
        action.append("', '").append(getHiddenInputAttribute()).append("', '");
      }
      action.append(ICBuilderConstants.CHOOSER_VALUE_VIEWER_ID_ATTRIBUTE).append("', '");
      action
          .append(getResourceBundle().getLocalizedString("loading", "Loading..."))
          .append("', ")
          .append(
              _stringValue == null
                  ? "null"
                  : new StringBuilder("'").append(_stringValue).append("'").toString())
          .append(", ")
          .append(
              _stringDisplay == null
                  ? "null"
                  : new StringBuilder("'").append(_stringDisplay).append("'").toString())
          .append(");");
      chooser.setOnClick(action.toString());

      container.add(chooser);

      return container;
    }
  }