All Implemented Interfaces:
Serializable, IEventSink, IEventSource, IFeedbackContributor, IConverterLocator, IMetadataContext<Serializable,Component>, IHeaderContributor, IRequestableComponent, IHierarchical<Component>, IClusterable

public class Code extends Label
#### Description Wrap inline snippets of code with and use
 for multiple
 lines of code. Angle brackets will be escaped in the code for proper rendering.

 #### Usage

 ```java
 Code code = new Code("id", Model.of("content"))
                  .setShowLineNumbers(true) // whether to show line numbers or not
                  .setLanguage(Language.JAVA) // use java as code language; default is dynamic
                  .setStartFromLine(20); // hide first 20 lines
 add(code);
 ```

 ```html
 <code wicket:id="id"></code>
 ```

 It's possible to use `pre`, `code` and `xmp` as tag name.
See Also:
  • Constructor Details

    • Code

      public Code(String componentId)
      Constructor.
      Parameters:
      componentId - The non-null id of a new component
    • Code

      public Code(String componentId, IModel<String> model)
      Constructor.
      Parameters:
      componentId - The non-null id of a new component
      model - the component's model
  • Method Details

    • hasLineNumbers

      public final boolean hasLineNumbers()
      Returns:
      true, if line numbers will be rendered
    • setShowLineNumbers

      public final Code setShowLineNumbers(boolean showLineNumbers)
      adds line numbers on the left side of code block.
      Returns:
      this instance
    • setStartFromLine

      public final Code setStartFromLine(int from)
      defines from which line number the counting will start.
      Parameters:
      from - which line the numbers will count
      Returns:
      this instance
    • setLanguage

      public final Code setLanguage(CodeBehavior.Language language)
      sets the language.
      Parameters:
      language - the language to use
      Returns:
      this instance