Class SourceCodeViewer

All Implemented Interfaces:
AttachNotifier, ClickNotifier<Div>, DetachNotifier, HasComponents, HasElement, HasEnabled, HasOrderedComponents, HasSize, HasStyle, HasText, Serializable

@JsModule("./code-viewer.ts") public class SourceCodeViewer extends Div implements HasSize
See Also:
  • Constructor Details

  • Method Details

    • fetchContents

      public void fetchContents(String url, String language)
    • highlightOnHover

      public static void highlightOnHover(Component c, String filenameAndId)
      Highlights the block identified by filenameAndId when the component is hovered over.

      If the component is in an additional source, filenameAndId can be given as a string in the format filename#id. If no '#' is present, it is assumed that the identifier corresponds to a block in the first source panel.

      Parameters:
      c - The component that triggers the highlight action when hovered over.
      filenameAndId - The identifier string that combines filename and id separated by '#'.
    • highlightOnClick

      public static <T extends HasElement & ClickNotifier<?>> void highlightOnClick(T c, String filenameAndId)
      Highlight block id when the component is clicked.

      If the component is in an additional source, filenameAndId can be given as a string in the format filename#id. If no '#' is present, it is assumed that the identifier corresponds to a block in the first source panel.

      Parameters:
      c - The component that triggers the highlight action when clicked.
      filenameAndId - The identifier string that combines filename and id separated by '#'.
    • highlight

      public static void highlight(String filenameAndId)
      Highlights the block identified by filenameAndId.

      If the component is in an additional source, filenameAndId can be given as a string in the format filename#id. If no '#' is present, it is assumed that the identifier corresponds to a block in the first source panel.

      Parameters:
      filenameAndId - The identifier string that combines filename and id separated by '#'.