Examples of UITextarea


Examples of com.ardor3d.extension.ui.UITextArea

        final UIPanel chatPanel = new UIPanel(new BorderLayout());
        final UIPanel bottomPanel = new UIPanel(new BorderLayout());
        bottomPanel.setLayoutData(BorderLayoutData.SOUTH);
        final UILabel dirLabel = new UILabel("Sample chat.  Try using markup like [b]text[/b]:");
        dirLabel.setLayoutData(BorderLayoutData.NORTH);
        final UITextArea historyArea = new UITextArea();
        historyArea.setStyledText(true);
        historyArea.setAlignment(Alignment.BOTTOM_LEFT);
        historyArea.setEditable(false);
        final UIScrollPanel scrollArea = new UIScrollPanel(historyArea);
        scrollArea.setLayoutData(BorderLayoutData.CENTER);
        final UITextField chatField = new UITextField();
        chatField.setLayoutData(BorderLayoutData.CENTER);
        final UIButton chatButton = new UIButton("SAY");
View Full Code Here

Examples of com.ardor3d.extension.ui.UITextArea

        final UIPanel chatPanel = new UIPanel(new BorderLayout());
        final UIPanel bottomPanel = new UIPanel(new BorderLayout());
        bottomPanel.setLayoutData(BorderLayoutData.SOUTH);
        final UILabel dirLabel = new UILabel("Sample chat.  Try using markup like [b]text[/b]:");
        dirLabel.setLayoutData(BorderLayoutData.NORTH);
        final UITextArea historyArea = new UITextArea();
        historyArea.setStyledText(true);
        historyArea.setAlignment(Alignment.BOTTOM_LEFT);
        historyArea.setEditable(false);
        final UIScrollPanel scrollArea = new UIScrollPanel(historyArea);
        scrollArea.setLayoutData(BorderLayoutData.CENTER);
        final UITextField chatField = new UITextField();
        chatField.setLayoutData(BorderLayoutData.CENTER);
        final UIButton chatButton = new UIButton("SAY");
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UITextarea

    if (!(component instanceof UITextarea)) {
      LOG.error("Wrong type: Need " + UITextarea.class.getName() + ", but was " + component.getClass().getName());
      return;
    }

    final UITextarea input = (UITextarea) component;
    final String title = HtmlRendererUtils.getTitleFromTipAndMessages(facesContext, component);
    final String clientId = input.getClientId(facesContext);
    final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);

    writer.startElement(HtmlElements.TEXTAREA, input);
    writer.writeNameAttribute(clientId);
    writer.writeIdAttribute(clientId);
    HtmlRendererUtils.writeDataAttributes(facesContext, writer, input);
    final Integer rows = input.getRows();
    if (rows != null) {
      writer.writeAttribute(HtmlAttributes.ROWS, rows);
    }
    if (title != null) {
      writer.writeAttribute(HtmlAttributes.TITLE, title, true);
    }
    writer.writeAttribute(HtmlAttributes.READONLY, input.isReadonly());
    writer.writeAttribute(HtmlAttributes.DISABLED, input.isDisabled());
    writer.writeAttribute(HtmlAttributes.REQUIRED, input.isRequired());
    final Integer tabIndex = input.getTabIndex();
    if (tabIndex != null) {
      writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
    }
    HtmlRendererUtils.renderDojoDndItem(component, writer, true);

    writer.writeClassAttribute(Classes.create(input));
    final Style style = new Style(facesContext, input);
    writer.writeStyleAttribute(style);
    final String onchange = ComponentUtils.getStringAttribute(input, Attributes.ONCHANGE);
    if (onchange != null) {
      final CommandMap map = new CommandMap();
      final Command change = new Command();
      change.setScript(onchange);
      map.addCommand("change", change);
    }
    int maxLength = -1;
    final String pattern = null;
    for (Validator validator : input.getValidators()) {
      if (validator instanceof LengthValidator) {
        LengthValidator lengthValidator = (LengthValidator) validator;
        maxLength = lengthValidator.getMaximum();
      }
      /*if (validator instanceof RegexValidator) {
        RegexValidator regexValidator = (RegexValidator) validator;
        pattern = regexValidator.getPattern();
      }*/
    }
    if (maxLength > 0) {
      writer.writeAttribute(HtmlAttributes.MAXLENGTH, maxLength);
    }
    if (pattern != null) {
      writer.writeAttribute(HtmlAttributes.PATTERN, pattern, false);
    }
    HtmlRendererUtils.renderCommandFacet(input, facesContext, writer);
    HtmlRendererUtils.renderFocus(clientId, input.isFocus(), ComponentUtils.isError(input), facesContext, writer);

    /*String placeholder = input.getPlaceholder();
    if (placeholder != null) {
      writer.writeAttribute(HtmlAttributes.PLACEHOLDER, placeholder, true);
    }*/
 
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UITextarea

  }

  @Override
  protected void setProperties(final UIComponent uiComponent) {
    super.setProperties(uiComponent);
    final UITextarea component = (UITextarea) uiComponent;
    final FacesContext context = FacesContext.getCurrentInstance();
    final Application application = context.getApplication();
    if (validatorMessage != null) {
      component.setValueExpression("validatorMessage", validatorMessage);
    }

    if (markup != null) {
      if (!markup.isLiteralText()) {
        component.setValueExpression("markup", markup);
      } else {
        component.setMarkup(org.apache.myfaces.tobago.context.Markup.valueOf(markup.getExpressionString()));
      }
    }
    if (accessKey != null) {
      if (!accessKey.isLiteralText()) {
        component.setValueExpression("accessKey", accessKey);
      } else {
        component.setAccessKey(accessKey.getExpressionString().charAt(0));
      }
    }
    if (validator != null) {
      component.addValidator(new javax.faces.validator.MethodExpressionValidator(validator));
    }
    if (labelWithAccessKey != null) {
      component.setValueExpression("labelWithAccessKey", labelWithAccessKey);
    }

    if (tabIndex != null) {
      if (!tabIndex.isLiteralText()) {
        component.setValueExpression("tabIndex", tabIndex);
      } else {
        component.setTabIndex(Integer.parseInt(tabIndex.getExpressionString()));
      }
    }
    if (tip != null) {
      component.setValueExpression("tip", tip);
    }

    if (valueChangeListener != null) {
      component.addValueChangeListener(new javax.faces.event.MethodExpressionValueChangeListener(valueChangeListener));
    }
    if (converter != null) {
      if (!converter.isLiteralText()) {
        component.setValueExpression("converter", converter);
      } else {
        component.setConverter(application.createConverter(converter.getExpressionString()));
      }
    }
    if (value != null) {
      component.setValueExpression("value", value);
    }

    if (focus != null) {
      if (!focus.isLiteralText()) {
        component.setValueExpression("focus", focus);
      } else {
        component.setFocus(Boolean.parseBoolean(focus.getExpressionString()));
      }
    }
    if (required != null) {
      if (!required.isLiteralText()) {
        component.setValueExpression("required", required);
      } else {
        component.setRequired(Boolean.parseBoolean(required.getExpressionString()));
      }
    }
    if (converterMessage != null) {
      component.setValueExpression("converterMessage", converterMessage);
    }

    if (label != null) {
      component.setValueExpression("label", label);
    }

    if (requiredMessage != null) {
      component.setValueExpression("requiredMessage", requiredMessage);
    }

    if (onchange != null) {
      component.setValueExpression("onchange", onchange);
    }

    if (rows != null) {
      component.setValueExpression("rows", rows);
    }

    if (readonly != null) {
      if (!readonly.isLiteralText()) {
        component.setValueExpression("readonly", readonly);
      } else {
        component.setReadonly(Boolean.parseBoolean(readonly.getExpressionString()));
      }
    }
    if (disabled != null) {
      if (!disabled.isLiteralText()) {
        component.setValueExpression("disabled", disabled);
      } else {
        component.setDisabled(Boolean.parseBoolean(disabled.getExpressionString()));
      }
    }
  }
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UITextarea

    if (!(component instanceof UITextarea)) {
      LOG.error("Wrong type: Need " + UITextarea.class.getName() + ", but was " + component.getClass().getName());
      return;
    }

    UITextarea input = (UITextarea) component;
    String title = HtmlRendererUtils.getTitleFromTipAndMessages(facesContext, component);

    String clientId = input.getClientId(facesContext);
    String onchange = HtmlUtils.generateOnchange(input, facesContext);

    TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
    writer.startElement(HtmlElements.TEXTAREA, input);
    writer.writeNameAttribute(clientId);
    writer.writeIdAttribute(clientId);
    writer.writeAttribute(HtmlAttributes.ROWS, null, Attributes.ROWS);
    if (title != null) {
      writer.writeAttribute(HtmlAttributes.TITLE, title, true);
    }
    writer.writeAttribute(HtmlAttributes.READONLY, input.isReadonly());
    writer.writeAttribute(HtmlAttributes.DISABLED, input.isDisabled());
    Integer tabIndex = input.getTabIndex();
    if (tabIndex != null) {
      writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
    }
    HtmlRendererUtils.renderDojoDndItem(component, writer, true);

    writer.writeClassAttribute(Classes.create(input));
    Style style = new Style(facesContext, input);
    writer.writeStyleAttribute(style);
    if (onchange != null) {
      writer.writeAttribute(HtmlAttributes.ONCHANGE, onchange, null);
    }
    /*int maxLength = -1;
    for (Validator validator : input.getValidators()) {
      if (validator instanceof LengthValidator) {
        LengthValidator lengthValidator = (LengthValidator) validator;
        maxLength = lengthValidator.getMaximum();
      }
    }
    if (maxLength > 0) {
      writer.writeAttribute(HtmlAttributes.MAXLENGTH, maxLength);
    }
    String placeholder = input.getPlaceholder();
    if (placeholder != null) {
      writer.writeAttribute(HtmlAttributes.PLACEHOLDER, placeholder, true);
    }*/
    String currentValue = RenderUtils.currentValue(input);
    if (currentValue != null) {
      // this is because browsers eat the first CR+LF of <textarea>
      if (currentValue.startsWith("\r\n")) {
        currentValue = "\r\n" + currentValue;
      } else if (currentValue.startsWith("\n")) {
        currentValue = "\n" + currentValue;
      } else if (currentValue.startsWith("\r")) {
        currentValue = "\r" + currentValue;
      }
      writer.writeText(currentValue, null);
    }
    writer.endElement(HtmlElements.TEXTAREA);
    /*if (placeholder != null && !VariableResolverUtils.resolveClientProperties(facesContext)
        .getUserAgent().hasCapability(Capability.PLACEHOLDER)) {
      HtmlRendererUtils.createPlaceholderDiv(input, currentValue, placeholder, style, writer);
    }*/

    HtmlRendererUtils.checkForCommandFacet(input, facesContext, writer);
    int maxLength = -1;
    for (Validator validator : input.getValidators()) {
      if (validator instanceof LengthValidator) {
        LengthValidator lengthValidator = (LengthValidator) validator;
        maxLength = lengthValidator.getMaximum();
      }
    }
    boolean required = ComponentUtils.getBooleanAttribute(input, Attributes.REQUIRED);
    if (required || maxLength > 0) {
      final String[] cmds = {
          "new Tobago.In(\"" + input.getClientId(facesContext) + "\"," + required + ",\""
              + Classes.requiredWorkaround(input) + "\" " + (maxLength > -1 ? "," + maxLength : "") + "  );"
      };
      HtmlRendererUtils.writeScriptLoader(facesContext, null, cmds);
    }

View Full Code Here

Examples of org.apache.myfaces.tobago.component.UITextarea

    if (!(component instanceof UITextarea)) {
      LOG.error("Wrong type: Need " + UITextarea.class.getName() + ", but was " + component.getClass().getName());
      return;
    }

    UITextarea input = (UITextarea) component;
    String title = HtmlRendererUtils.getTitleFromTipAndMessages(facesContext, component);

    String clientId = input.getClientId(facesContext);
    String onchange = HtmlUtils.generateOnchange(input, facesContext);

    TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
    writer.startElement(HtmlElements.TEXTAREA, input);
    writer.writeNameAttribute(clientId);
    writer.writeIdAttribute(clientId);
    writer.writeAttribute(HtmlAttributes.ROWS, null, Attributes.ROWS);
    if (title != null) {
      writer.writeAttribute(HtmlAttributes.TITLE, title, true);
    }
    writer.writeAttribute(HtmlAttributes.READONLY, input.isReadonly());
    writer.writeAttribute(HtmlAttributes.DISABLED, input.isDisabled());
    Integer tabIndex = input.getTabIndex();
    if (tabIndex != null) {
      writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
    }
    HtmlRendererUtils.renderDojoDndItem(component, writer, true);

    writer.writeClassAttribute(Classes.create(input));
    Style style = new Style(facesContext, input);
    writer.writeStyleAttribute(style);
    if (onchange != null) {
      writer.writeAttribute(HtmlAttributes.ONCHANGE, onchange, null);
    }
    /*int maxLength = -1;
    for (Validator validator : input.getValidators()) {
      if (validator instanceof LengthValidator) {
        LengthValidator lengthValidator = (LengthValidator) validator;
        maxLength = lengthValidator.getMaximum();
      }
    }
    if (maxLength > 0) {
      writer.writeAttribute(HtmlAttributes.MAXLENGTH, maxLength);
    }
    String placeholder = input.getPlaceholder();
    if (placeholder != null) {
      writer.writeAttribute(HtmlAttributes.PLACEHOLDER, placeholder, true);
    }*/
    String currentValue = RenderUtils.currentValue(input);
    if (currentValue != null) {
      // this is because browsers eat the first CR+LF of <textarea>
      if (currentValue.startsWith("\r\n")) {
        currentValue = "\r\n" + currentValue;
      } else if (currentValue.startsWith("\n")) {
        currentValue = "\n" + currentValue;
      } else if (currentValue.startsWith("\r")) {
        currentValue = "\r" + currentValue;
      }
      writer.writeText(currentValue);
    }
    writer.endElement(HtmlElements.TEXTAREA);
    /*if (placeholder != null && !VariableResolverUtils.resolveClientProperties(facesContext)
        .getUserAgent().hasCapability(Capability.PLACEHOLDER)) {
      HtmlRendererUtils.createPlaceholderDiv(input, currentValue, placeholder, style, writer);
    }*/

    HtmlRendererUtils.checkForCommandFacet(input, facesContext, writer);
    int maxLength = -1;
    for (Validator validator : input.getValidators()) {
      if (validator instanceof LengthValidator) {
        LengthValidator lengthValidator = (LengthValidator) validator;
        maxLength = lengthValidator.getMaximum();
      }
    }
    boolean required = ComponentUtils.getBooleanAttribute(input, Attributes.REQUIRED);
    if (required || maxLength > 0) {
      final String[] cmds = {
          "new Tobago.In(\"" + input.getClientId(facesContext) + "\"," + required + ",\""
              + Classes.requiredWorkaround(input) + "\" " + (maxLength > -1 ? "," + maxLength : "") + "  );"
      };
      HtmlRendererUtils.writeScriptLoader(facesContext, null, cmds);
    }

View Full Code Here

Examples of org.apache.myfaces.tobago.component.UITextarea

  }

  @Override
  protected void setProperties(final UIComponent uiComponent) {
    super.setProperties(uiComponent);
    final UITextarea component = (UITextarea) uiComponent;
    final FacesContext context = FacesContext.getCurrentInstance();
    final Application application = context.getApplication();
    if (validatorMessage != null) {
      component.setValueExpression("validatorMessage", validatorMessage);
    }

    if (markup != null) {
      if (!markup.isLiteralText()) {
        component.setValueExpression("markup", markup);
      } else {
        component.setMarkup(org.apache.myfaces.tobago.context.Markup.valueOf(markup.getExpressionString()));
      }
    }
    if (accessKey != null) {
      if (!accessKey.isLiteralText()) {
        component.setValueExpression("accessKey", accessKey);
      } else {
        component.setAccessKey(accessKey.getExpressionString().charAt(0));
      }
    }
    if (validator != null) {
      component.addValidator(new javax.faces.validator.MethodExpressionValidator(validator));
    }
    if (labelWithAccessKey != null) {
      component.setValueExpression("labelWithAccessKey", labelWithAccessKey);
    }

    if (tabIndex != null) {
      if (!tabIndex.isLiteralText()) {
        component.setValueExpression("tabIndex", tabIndex);
      } else {
        component.setTabIndex(Integer.parseInt(tabIndex.getExpressionString()));
      }
    }
    if (tip != null) {
      component.setValueExpression("tip", tip);
    }

    if (valueChangeListener != null) {
      component.addValueChangeListener(new javax.faces.event.MethodExpressionValueChangeListener(valueChangeListener));
    }
    if (converter != null) {
      if (!converter.isLiteralText()) {
        component.setValueExpression("converter", converter);
      } else {
        component.setConverter(application.createConverter(converter.getExpressionString()));
      }
    }
    if (value != null) {
      component.setValueExpression("value", value);
    }

    if (focus != null) {
      if (!focus.isLiteralText()) {
        component.setValueExpression("focus", focus);
      } else {
        component.setFocus(Boolean.parseBoolean(focus.getExpressionString()));
      }
    }
    if (required != null) {
      if (!required.isLiteralText()) {
        component.setValueExpression("required", required);
      } else {
        component.setRequired(Boolean.parseBoolean(required.getExpressionString()));
      }
    }
    if (converterMessage != null) {
      component.setValueExpression("converterMessage", converterMessage);
    }

    if (sanitize != null) {
      component.setValueExpression("sanitize", sanitize);
    }

    if (label != null) {
      component.setValueExpression("label", label);
    }

    if (requiredMessage != null) {
      component.setValueExpression("requiredMessage", requiredMessage);
    }

    if (onchange != null) {
      component.setValueExpression("onchange", onchange);
    }

    if (rows != null) {
      if (!rows.isLiteralText()) {
        component.setValueExpression("rows", rows);
      } else {
        component.setRows(Integer.parseInt(rows.getExpressionString()));
      }
    }
    if (readonly != null) {
      if (!readonly.isLiteralText()) {
        component.setValueExpression("readonly", readonly);
      } else {
        component.setReadonly(Boolean.parseBoolean(readonly.getExpressionString()));
      }
    }
    if (disabled != null) {
      if (!disabled.isLiteralText()) {
        component.setValueExpression("disabled", disabled);
      } else {
        component.setDisabled(Boolean.parseBoolean(disabled.getExpressionString()));
      }
    }
  }
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UITextarea

    if (!(component instanceof UITextarea)) {
      LOG.error("Wrong type: Need " + UITextarea.class.getName() + ", but was " + component.getClass().getName());
      return;
    }

    UITextarea input = (UITextarea) component;
    String title = HtmlRendererUtils.getTitleFromTipAndMessages(facesContext, component);

    String clientId = input.getClientId(facesContext);
    String onchange = HtmlUtils.generateOnchange(input, facesContext);

    TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
    writer.startElement(HtmlElements.TEXTAREA, input);
    writer.writeNameAttribute(clientId);
    writer.writeIdAttribute(clientId);
    writer.writeAttribute(HtmlAttributes.ROWS, null, Attributes.ROWS);
    if (title != null) {
      writer.writeAttribute(HtmlAttributes.TITLE, title, true);
    }
    writer.writeAttribute(HtmlAttributes.READONLY, input.isReadonly());
    writer.writeAttribute(HtmlAttributes.DISABLED, input.isDisabled());
    Integer tabIndex = input.getTabIndex();
    if (tabIndex != null) {
      writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
    }
    HtmlRendererUtils.renderDojoDndItem(component, writer, true);

    writer.writeClassAttribute(Classes.create(input));
    Style style = new Style(facesContext, input);
    writer.writeStyleAttribute(style);
    if (onchange != null) {
      writer.writeAttribute(HtmlAttributes.ONCHANGE, onchange, null);
    }
    /*int maxLength = -1;
    for (Validator validator : input.getValidators()) {
      if (validator instanceof LengthValidator) {
        LengthValidator lengthValidator = (LengthValidator) validator;
        maxLength = lengthValidator.getMaximum();
      }
    }
    if (maxLength > 0) {
      writer.writeAttribute(HtmlAttributes.MAXLENGTH, maxLength);
    }
    String placeholder = input.getPlaceholder();
    if (placeholder != null) {
      writer.writeAttribute(HtmlAttributes.PLACEHOLDER, placeholder, true);
    }*/
    String currentValue = RenderUtils.currentValue(input);
    if (currentValue != null) {
      // this is because browsers eat the first CR+LF of <textarea>
      if (currentValue.startsWith("\r\n")) {
        currentValue = "\r\n" + currentValue;
      } else if (currentValue.startsWith("\n")) {
        currentValue = "\n" + currentValue;
      } else if (currentValue.startsWith("\r")) {
        currentValue = "\r" + currentValue;
      }
      writer.writeText(currentValue, null);
    }
    writer.endElement(HtmlElements.TEXTAREA);
    /*if (placeholder != null && !VariableResolverUtils.resolveClientProperties(facesContext)
        .getUserAgent().hasCapability(Capability.PLACEHOLDER)) {
      HtmlRendererUtils.createPlaceholderDiv(input, currentValue, placeholder, style, writer);
    }*/

    HtmlRendererUtils.checkForCommandFacet(input, facesContext, writer);
    int maxLength = -1;
    for (Validator validator : input.getValidators()) {
      if (validator instanceof LengthValidator) {
        LengthValidator lengthValidator = (LengthValidator) validator;
        maxLength = lengthValidator.getMaximum();
      }
    }
    boolean required = ComponentUtils.getBooleanAttribute(input, Attributes.REQUIRED);
    if (required || maxLength > 0) {
      final String[] cmds = {
          "new Tobago.In(\"" + input.getClientId(facesContext) + "\"," + required + ",\""
              + Classes.requiredWorkaround(input) + "\" " + (maxLength > -1 ? "," + maxLength : "") + "  );"
      };
      HtmlRendererUtils.writeScriptLoader(facesContext, null, cmds);
    }

View Full Code Here

Examples of org.apache.myfaces.tobago.component.UITextarea

    if (!(component instanceof UITextarea)) {
      LOG.error("Wrong type: Need " + UITextarea.class.getName() + ", but was " + component.getClass().getName());
      return;
    }

    final UITextarea input = (UITextarea) component;
    final String title = HtmlRendererUtils.getTitleFromTipAndMessages(facesContext, component);
    final String clientId = input.getClientId(facesContext);
    final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);

    writer.startElement(HtmlElements.TEXTAREA, input);
    writer.writeNameAttribute(clientId);
    writer.writeIdAttribute(clientId);
    HtmlRendererUtils.writeDataAttributes(facesContext, writer, input);
    final Integer rows = input.getRows();
    if (rows != null) {
      writer.writeAttribute(HtmlAttributes.ROWS, rows);
    }
    if (title != null) {
      writer.writeAttribute(HtmlAttributes.TITLE, title, true);
    }
    writer.writeAttribute(HtmlAttributes.READONLY, input.isReadonly());
    writer.writeAttribute(HtmlAttributes.DISABLED, input.isDisabled());
    writer.writeAttribute(HtmlAttributes.REQUIRED, input.isRequired());
    final Integer tabIndex = input.getTabIndex();
    if (tabIndex != null) {
      writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
    }

    writer.writeClassAttribute(Classes.create(input));
    final Style style = new Style(facesContext, input);
    writer.writeStyleAttribute(style);
    final String onchange = ComponentUtils.getStringAttribute(input, Attributes.ONCHANGE);
    if (onchange != null) {
      final CommandMap map = new CommandMap();
      final Command change = new Command();
      change.setScript(onchange);
      map.addCommand("change", change);
    }
    int maxLength = -1;
    final String pattern = null;
    for (final Validator validator : input.getValidators()) {
      if (validator instanceof LengthValidator) {
        final LengthValidator lengthValidator = (LengthValidator) validator;
        maxLength = lengthValidator.getMaximum();
      }
      /*if (validator instanceof RegexValidator) {
        RegexValidator regexValidator = (RegexValidator) validator;
        pattern = regexValidator.getPattern();
      }*/
    }
    if (maxLength > 0) {
      writer.writeAttribute(HtmlAttributes.MAXLENGTH, maxLength);
    }
    if (pattern != null) {
      writer.writeAttribute(HtmlAttributes.PATTERN, pattern, false);
    }
    HtmlRendererUtils.renderCommandFacet(input, facesContext, writer);
    HtmlRendererUtils.renderFocus(clientId, input.isFocus(), ComponentUtils.isError(input), facesContext, writer);

    /*String placeholder = input.getPlaceholder();
    if (placeholder != null) {
      writer.writeAttribute(HtmlAttributes.PLACEHOLDER, placeholder, true);
    }*/
 
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UITextarea

    if (!(component instanceof UITextarea)) {
      LOG.error("Wrong type: Need " + UITextarea.class.getName() + ", but was " + component.getClass().getName());
      return;
    }

    final UITextarea input = (UITextarea) component;
    final String title = HtmlRendererUtils.getTitleFromTipAndMessages(facesContext, component);
    final String clientId = input.getClientId(facesContext);
    final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);

    writer.startElement(HtmlElements.TEXTAREA, input);
    writer.writeNameAttribute(clientId);
    writer.writeIdAttribute(clientId);
    HtmlRendererUtils.writeDataAttributes(facesContext, writer, input);
    final Integer rows = input.getRows();
    if (rows != null) {
      writer.writeAttribute(HtmlAttributes.ROWS, rows);
    }
    if (title != null) {
      writer.writeAttribute(HtmlAttributes.TITLE, title, true);
    }
    writer.writeAttribute(HtmlAttributes.READONLY, input.isReadonly());
    writer.writeAttribute(HtmlAttributes.DISABLED, input.isDisabled());
    writer.writeAttribute(HtmlAttributes.REQUIRED, input.isRequired());
    final Integer tabIndex = input.getTabIndex();
    if (tabIndex != null) {
      writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
    }
    HtmlRendererUtils.renderDojoDndItem(component, writer, true);

    writer.writeClassAttribute(Classes.create(input));
    final Style style = new Style(facesContext, input);
    writer.writeStyleAttribute(style);
    final String onchange = ComponentUtils.getStringAttribute(input, Attributes.ONCHANGE);
    if (onchange != null) {
      final CommandMap map = new CommandMap();
      final Command change = new Command();
      change.setScript(onchange);
      map.addCommand("change", change);
    }
    int maxLength = -1;
    final String pattern = null;
    for (final Validator validator : input.getValidators()) {
      if (validator instanceof LengthValidator) {
        final LengthValidator lengthValidator = (LengthValidator) validator;
        maxLength = lengthValidator.getMaximum();
      }
      /*if (validator instanceof RegexValidator) {
        RegexValidator regexValidator = (RegexValidator) validator;
        pattern = regexValidator.getPattern();
      }*/
    }
    if (maxLength > 0) {
      writer.writeAttribute(HtmlAttributes.MAXLENGTH, maxLength);
    }
    if (pattern != null) {
      writer.writeAttribute(HtmlAttributes.PATTERN, pattern, false);
    }
    HtmlRendererUtils.renderCommandFacet(input, facesContext, writer);
    HtmlRendererUtils.renderFocus(clientId, input.isFocus(), ComponentUtils.isError(input), facesContext, writer);

    /*String placeholder = input.getPlaceholder();
    if (placeholder != null) {
      writer.writeAttribute(HtmlAttributes.PLACEHOLDER, placeholder, true);
    }*/
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.