Tabnine Logo
IElementTagStructureHandler.replaceWith
Code IndexAdd Tabnine to your IDE (free)

How to use
replaceWith
method
in
org.thymeleaf.processor.element.IElementTagStructureHandler

Best Java code snippets using org.thymeleaf.processor.element.IElementTagStructureHandler.replaceWith (Showing top 11 results out of 315)

origin: thymeleaf/thymeleaf

    structureHandler.replaceWith(stringWriter.toString(), false);
  } else {
    structureHandler.setBody(stringWriter.toString(), false);
    structureHandler.replaceWith(model, true);
  } else {
    structureHandler.setBody(model, true);
  structureHandler.replaceWith(fragmentModel, true);
} else {
  structureHandler.setBody(fragmentModel, true);
origin: mkalus/segrada

  @Override
  protected void doProcess(
      final ITemplateContext context, final IProcessableElementTag tag,
      final IElementTagStructureHandler structureHandler) {
    final IStandardExpressionParser parser = getParser(context);

    // Get attribute values
    final Long millis = parseTagValue(parser, context, tag, "millis");
    final String format = parseTagValue(parser, context, tag, "format");

    if (millis == null || format == null || format.isEmpty()) {
      // do not show element at all
      structureHandler.removeElement();
    } else {
      DateTimeFormatter formatter = DateTimeFormat.forPattern(format);
      structureHandler.replaceWith(formatter.print(millis), false);
    }
  }
}
origin: io.github.jpenren/thymeleaf-spring-data-dialect

@Override
protected void doProcess(ITemplateContext context, IProcessableElementTag tag, AttributeName attributeName,
    String attributeValue, IElementTagStructureHandler structureHandler) {
  String attrValue = String.valueOf(attributeValue).trim();
  PaginationDecorator decorator = PaginationDecoratorRegistry.getInstance().getDecorator(attrValue);
  String html = decorator.decorate(tag, context);
  boolean isUlNode = Strings.UL.equalsIgnoreCase(tag.getElementCompleteName());
  if (isUlNode) {
    structureHandler.replaceWith(html, false);
  } else {
    structureHandler.setBody(html, false);
  }
}
origin: jpenren/thymeleaf-spring-data-dialect

@Override
protected void doProcess(ITemplateContext context, IProcessableElementTag tag, AttributeName attributeName,
    String attributeValue, IElementTagStructureHandler structureHandler) {
  String attrValue = String.valueOf(attributeValue).trim();
  PaginationDecorator decorator = PaginationDecoratorRegistry.getInstance().getDecorator(attrValue);
  String html = decorator.decorate(tag, context);
  boolean isUlNode = Strings.UL.equalsIgnoreCase(tag.getElementCompleteName());
  if (isUlNode) {
    structureHandler.replaceWith(html, false);
  } else {
    structureHandler.setBody(html, false);
  }
}
origin: theborakompanioni/thymeleaf-extras-shiro

  @Override
  protected void doProcess(ITemplateContext iTemplateContext,
               IProcessableElementTag iProcessableElementTag,
               IElementTagStructureHandler iElementTagStructureHandler) {
    final String type = iProcessableElementTag.getAttributeValue("type");
    final String property = iProcessableElementTag.getAttributeValue("property");

    final String text = ShiroFacade.getPrincipalText(type, property);
    iElementTagStructureHandler.replaceWith(text, false);
  }
}
origin: com.github.theborakompanioni/thymeleaf-extras-shiro

  @Override
  protected void doProcess(ITemplateContext iTemplateContext,
               IProcessableElementTag iProcessableElementTag,
               IElementTagStructureHandler iElementTagStructureHandler) {
    final String type = iProcessableElementTag.getAttributeValue("type");
    final String property = iProcessableElementTag.getAttributeValue("property");

    final String text = ShiroFacade.getPrincipalText(type, property);
    iElementTagStructureHandler.replaceWith(text, false);
  }
}
origin: mkalus/segrada

@Override
protected void doProcess(
    final ITemplateContext context, final IProcessableElementTag tag,
    final IElementTagStructureHandler structureHandler) {
  final IStandardExpressionParser parser = getParser(context);
  String content = parseTagValue(parser, context, tag);
  // If no content is to be applied, just convert to an empty message
  if (content == null) content = "";
  else content = nl2br(content);
  // replace whole tag completely with char sequence
  structureHandler.replaceWith(content, false);
}
origin: mkalus/segrada

@Override
protected void doProcess(
    final ITemplateContext context, final IProcessableElementTag tag,
    final IElementTagStructureHandler structureHandler) {
  final IStandardExpressionParser parser = getParser(context);
  // Get attribute values
  final String markup = parseTagValue(parser, context, tag, "markup");
  final String text = parseTagValue(parser, context, tag, "text");
  // replace tag completely with char sequence
  structureHandler.replaceWith("<div class=\"sg-markup\">" + markup(text, markup) + "</div>", false);
}
origin: mkalus/segrada

  @Override
  protected void doProcess(
      final ITemplateContext context, final IProcessableElementTag tag,
      final IElementTagStructureHandler structureHandler) {
    final IStandardExpressionParser parser = getParser(context);

    // Get attribute values
    final Long number = parseTagValue(parser, context, tag, "number");
    final String format = parseTagValue(parser, context, tag, "format");

    // interpret values
    boolean si = "si".equals(format);

    // if number ok
    if (number != null) {
      // lazily create instance
      if (numberFormatter == null) numberFormatter = new NumberFormatter();

      // parse number
      structureHandler.replaceWith(numberFormatter.humanReadableByteCount(number, si), false);
    } else {
      // do not show element at all
      structureHandler.removeElement();
    }
  }
}
origin: theborakompanioni/thymeleaf-extras-shiro

  @Override
  protected void doProcess(ITemplateContext iTemplateContext,
               IProcessableElementTag iProcessableElementTag,
               AttributeName attributeName,
               String attributeValue,
               IElementTagStructureHandler iElementTagStructureHandler) {

    final String type = iProcessableElementTag.getAttributeValue("type");
    final String property = iProcessableElementTag.getAttributeValue("property");

    final String text = ShiroFacade.getPrincipalText(type, property);
    final String elementCompleteName = iProcessableElementTag.getElementCompleteName();

    final IModelFactory modelFactory = iTemplateContext.getModelFactory();
    final IModel model = modelFactory.createModel();

    model.add(modelFactory.createOpenElementTag(elementCompleteName));
    model.add(modelFactory.createText(HtmlEscape.escapeHtml5(text)));
    model.add(modelFactory.createCloseElementTag(elementCompleteName));

    iElementTagStructureHandler.replaceWith(model, false);
  }
}
origin: com.github.theborakompanioni/thymeleaf-extras-shiro

  @Override
  protected void doProcess(ITemplateContext iTemplateContext,
               IProcessableElementTag iProcessableElementTag,
               AttributeName attributeName,
               String attributeValue,
               IElementTagStructureHandler iElementTagStructureHandler) {

    final String type = iProcessableElementTag.getAttributeValue("type");
    final String property = iProcessableElementTag.getAttributeValue("property");

    final String text = ShiroFacade.getPrincipalText(type, property);
    final String elementCompleteName = iProcessableElementTag.getElementCompleteName();

    final IModelFactory modelFactory = iTemplateContext.getModelFactory();
    final IModel model = modelFactory.createModel();

    model.add(modelFactory.createOpenElementTag(elementCompleteName));
    model.add(modelFactory.createText(HtmlEscape.escapeHtml5(text)));
    model.add(modelFactory.createCloseElementTag(elementCompleteName));

    iElementTagStructureHandler.replaceWith(model, false);
  }
}
org.thymeleaf.processor.elementIElementTagStructureHandlerreplaceWith

Javadoc

Instructs the engine to replace the current element with the specified text (a CharSequence).

Note it is the complete element that will be replaced with the specified text, i.e. the open tag, the body and the close tag.

Popular methods of IElementTagStructureHandler

  • setBody
    Instructs the engine to set a new body for the current element, in the form of an IModel. This is
  • removeAttribute
  • removeElement
  • setAttribute
    Instructs the engine to set an attribute (existing or not) in the current tag being processed.
  • setLocalVariable
  • insertBefore
  • insertImmediatelyAfter
  • replaceAttribute
    Instructs the engine to replace an existing attribute for a new one (which can also exist) in the c
  • removeTags
  • iterateElement
    Instructs the engine to iterate the current element, applying a specific iteration configuration.
  • removeAllButFirstChild
    Instructs the engine to remove all the children of the element being processed, except the first on
  • removeBody
    Instructs the engine to remove the body of the element being processed, but keep the open and close
  • removeAllButFirstChild,
  • removeBody,
  • setInliner,
  • setSelectionTarget,
  • setTemplateData

Popular in Java

  • Reading from database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getApplicationContext (Context)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now