Package org.olat.core.gui.components.form.flexible.elements

Examples of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement


   * @param values
   * @param cssClasses
   * @return
   */
  public MultipleSelectionElement addCheckboxesHorizontal(String name, String i18nLabel, FormItemContainer formLayout, String[] keys, String values[], String[] cssClasses) {
    MultipleSelectionElement mse = new MultipleSelectionElementImpl(name, MultipleSelectionElementImpl.createHorizontalLayout(name));
    mse.setKeysAndValues(keys, values, cssClasses);
    setLabelIfNotNull(i18nLabel, mse);
    formLayout.add(mse);
    return mse;
  }
View Full Code Here


   * @param cssClasses
   * @param columns
   * @return
   */
  public MultipleSelectionElement addCheckboxesVertical(String name, String i18nLabel, FormItemContainer formLayout, String[] keys, String values[], String[] cssClasses, int columns) {
    MultipleSelectionElement mse = new MultipleSelectionElementImpl(name, MultipleSelectionElementImpl.createVerticalLayout(name, columns));
    mse.setKeysAndValues(keys, values, cssClasses);
    setLabelIfNotNull(i18nLabel, mse);
    formLayout.add(mse);
    return mse;
  }
View Full Code Here

   * @param i18nLabel
   * @param formLayout
   * @return
   */
  public MultipleSelectionElement addDropdownMultiselect(String name, String i18nLabel, FormItemContainer formLayout) {
    MultipleSelectionElement mse = new MultipleSelectionElementImpl(name, MultipleSelectionElementImpl.createSelectboxLayouter(name));
    setLabelIfNotNull(i18nLabel, mse);
    formLayout.add(mse);
    return mse;
  }
View Full Code Here

   * @param treemodel
   * @param selectableFilter
   * @return
   */
  public MultipleSelectionElement addTreeMultiselect(String name, String i18nLabel, FormItemContainer formLayout, TreeModel treemodel, INodeFilter selectableFilter){
    MultipleSelectionElement mse = new MultiSelectionTree(name, treemodel, selectableFilter);
    setLabelIfNotNull(i18nLabel, mse);
    formLayout.add(mse);
    return mse;
  }
View Full Code Here

  /**
   * @see org.olat.core.gui.components.form.flexible.rules.FormItemDependencyRuleImpl#doesTrigger()
   */
  @Override
  protected boolean doesTrigger() {
    MultipleSelectionElement mse = (MultipleSelectionElement)this.triggerElement;
    Set<String> selectedKeys = mse.getSelectedKeys();
    //
    boolean retval = false;
    if(this.triggerVal==null){
      //meaning no selection in a multi selection element
      retval = selectedKeys.size() == 0;
View Full Code Here

    setFormDescription("form.description");
   
    this.formContext.put("username", this.identity.getName());

    // Add the noneditable username field.
    MultipleSelectionElement usernameCheckbox = uifactory.addCheckboxesHorizontal("checkbox_username", null, formLayout, new String[] {"checkbox_username"}, new String[] {""}, null);
    usernameCheckbox.select("checkbox_username", true);
    usernameCheckbox.setEnabled(false);
    StaticTextElement usernameText = uifactory.addStaticTextElement("username", this.identity.getName(), formLayout);
    usernameText.setMandatory(true);
    this.formItems.put("username", usernameText);
   
    String currentGroup = null;
    List<UserPropertyHandler> homepagePropertyHanders = UserManager.getInstance().getUserPropertyHandlersFor(HomePageConfig.class.getCanonicalName(), isAdministrativeUser);
    // show a form element for each property handler
    for (UserPropertyHandler userPropertyHandler : this.userPropertyHandlers) {
      if (userPropertyHandler == null) {
        continue;
      }
     
      // add spacer if necessary (i.e. when group name changes)
      String group = userPropertyHandler.getGroup();
      if (!group.equals(currentGroup)) {
        if (currentGroup != null) {
          SpacerElement spacerElement = uifactory.addSpacerElement("spacer_" + group, formLayout, false);
          this.formItems.put("spacer_" + group, spacerElement);
        }
        currentGroup = group;
      }
     
      if (homepagePropertyHanders.contains(userPropertyHandler)) {
        // add checkbox to container if configured for homepage usage identifier
        String checkboxName = "checkbox_" + userPropertyHandler.getName();
        MultipleSelectionElement publishCheckbox = uifactory.addCheckboxesHorizontal(checkboxName, null, formLayout, new String[] {userPropertyHandler.i18nFormElementLabelKey()}, new String[] {""}, null);
        this.publishCheckboxes.put(checkboxName, publishCheckbox);
        boolean isEnabled = this.conf.isEnabled(userPropertyHandler.getName());
        if (isEnabled) {
          publishCheckbox.select(userPropertyHandler.i18nFormElementLabelKey(), true);
        } else {
          publishCheckbox.select(userPropertyHandler.i18nFormElementLabelKey(), false);
        }       
        // Mandatory homepage properties can not be changed by user
        UserManager um = UserManager.getInstance();
        if (um.isMandatoryUserProperty(HomePageConfig.class.getCanonicalName(), userPropertyHandler)) {
          publishCheckbox.select(userPropertyHandler.i18nFormElementLabelKey(), true);
          publishCheckbox.setEnabled(false);
        }
      } else {
        uifactory.addSpacerElement("spacer_" + userPropertyHandler.getName(), formLayout, true);
      }
     
      // add input field to container
      FormItem formItem = userPropertyHandler.addFormItem(getLocale(), this.identity.getUser(), this.usageIdentifier, this.isAdministrativeUser, formLayout);
      String propertyName = userPropertyHandler.getName();
      this.formItems.put(propertyName, formItem);
     
      if (formItem instanceof TextElement) {
        // it's a text field, so get the value of this property into the text field
        TextElement textElement = (TextElement)formItem;
        textElement.setValue(this.identity.getUser().getProperty(propertyName, getLocale()));
      } else if (formItem instanceof MultipleSelectionElement) {
        // it's a checkbox, so set the box to checked if the corresponding property is set to "true"
        MultipleSelectionElement checkbox = (MultipleSelectionElement)formItem;
        String value = this.identity.getUser().getProperty(propertyName, getLocale());
        if (value != null) {
          checkbox.select(propertyName, value.equals("true"));
        } else {
          // assume "false" if the property is not present
          checkbox.select(propertyName, false);
        }
      }
     
      // special case for email field
      if (userPropertyHandler.getName().equals("email")) {
View Full Code Here

      FormItem formItem = this.formItems.get(userPropertyHandler.getName());

      userPropertyHandler.updateUserFromFormItem(user, formItem);

      // ...and store the "publish" flag for each property.
      MultipleSelectionElement checkbox = this.publishCheckboxes.get("checkbox_" + userPropertyHandler.getName());
      if (checkbox != null) {
        // null when not enabled for the org.olat.user.HomePageConfig usage
        // identifier key
        if (checkbox.getSelectedKeys().size() == 0) {
          config.setEnabled(userPropertyHandler.getName(), false);
        } else {
          config.setEnabled(userPropertyHandler.getName(), true);
        }
      }
View Full Code Here

      // column 1 : checkbox
      row.add("Flexi Lorem" + i);
      // column 2 : checkbox
      row.add("Ipsum" + i);
      // column 3 : checkbox
      MultipleSelectionElement checkbox = new MultipleSelectionElementImpl("checkbox", MultipleSelectionElementImpl.createVerticalLayout("checkbox",1)) {
        {
          keys = new String[] { "ison", "isOff" };
          values = new String[] { "on", "off" };
          select("ison", true);
        }
View Full Code Here

    // on these radio buttons and therefore need to add the current controller
    // to their listeners.
    verticalRadioButtons.addActionListener(this, FormEvent.ONCLICK);

    // checkboxes
    final MultipleSelectionElement checkboxes = uifactory.addCheckboxesVertical("checkboxes", "advanced_form.checkboxes", form, keys, options, null, 1);

    // Translate the keys to the yes and no option values
    final String[] yesOrNoOptions = new String[yesOrNoKeys.length];
    for (int i = 0; i < yesOrNoKeys.length; i++) {
      yesOrNoOptions[i] = translate(yesOrNoKeys[i]);
View Full Code Here

    });
    lTarget.addActionListener(this, FormEvent.ONCHANGE);
    lTarget.setUserObject(link);
    lTargetInputList.add(index, lTarget);
    //add html target
    MultipleSelectionElement htmlTargetSelection = uifactory.addCheckboxesHorizontal("html_target" + counter, titleContainer, new String[]{BLANK_KEY}, new String[]{""}, null);
    htmlTargetSelection.setUserObject(link);
    htmlTargetSelection.select(BLANK_KEY, "_blank".equals(link.getHtmlTarget()));
    lHtmlTargetInputList.add(index, htmlTargetSelection);
   
    // add link description
    TextElement lDescription = uifactory.addTextElement("description" + counter, null, -1, link.getDescription(), titleContainer);
    lDescription.clearError();
View Full Code Here

TOP

Related Classes of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement

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.