Package sc.lang.html

Class HTMLElement<RE>

  • All Implemented Interfaces:
    IDynObject, INamedChildren, IObjChildren, IStatefulPage, INamedNode, ISemanticNode, ISrcStatement, IUserDataNode, ILifecycle, IChildInit, IStoppable, ITypeUpdateHandler
    Direct Known Subclasses:
    A, Body, Div, Document, Form, Head, Html, Img, Input, Option, Page, Select, Span, Style, Textarea

    public class HTMLElement<RE>
    extends Element<RE>
    The base class for all HTML elements. Sync is disabled for HTML elements now (as set in Element. Instead, it's best to synchronize the view model and attach the view model to the HTML view. This is because we can always re-render the HTML page and so do not have to record the low-level dom state as changes are made. If the UI is going to work properly, it should be reactive to the view model anyway, so we can just save the model in one place unambiguously. We want model changes to occur on the client and for the UI to react immediately for interactivity as the default behavior.

    Some frameworks might want to sync some values of the UI to the server and then process clicks and stuff on the server.

    If you do want to sync HTML elements entirely, this is a good node to turn it on. Otherwise you can do it on a tag by tag basis by annotating those classes. The Element class takes the RE type parameter for the repeat element. We can add this back in so that repeatVar is typed with that type. The benefit being that Java compiles in the repeat element's type without needing to add a new repeat var at compile time. There are problems getting that to work in the general case. When you have a parent class that has type parameters and you have an inner instance class which also has type parameters, Java intermittently barfs saying that the parent type is a "raw type" and can't have type parameters. It's weird because in simple cases it works but in the general case it falls over. You would Need to change the code to generate an extends like: class InnerSubClass<TP> extends outerClass<Object>.innerBaseClass<TP>
    • Field Detail

      • _clickEventProp

        public static final IBeanMapper _clickEventProp
      • _dblClickEventProp

        public static final IBeanMapper _dblClickEventProp
      • _mouseDownEventProp

        public static final IBeanMapper _mouseDownEventProp
      • _mouseMoveEventProp

        public static final IBeanMapper _mouseMoveEventProp
      • _mouseOverEventProp

        public static final IBeanMapper _mouseOverEventProp
      • _mouseOutEventProp

        public static final IBeanMapper _mouseOutEventProp
      • _mouseUpEventProp

        public static final IBeanMapper _mouseUpEventProp
      • _keyDownEventProp

        public static final IBeanMapper _keyDownEventProp
      • _keyPressEventProp

        public static final IBeanMapper _keyPressEventProp
      • _keyUpEventProp

        public static final IBeanMapper _keyUpEventProp
      • _focusEventProp

        public static final IBeanMapper _focusEventProp
      • _blurEventProp

        public static final IBeanMapper _blurEventProp
      • _clientWidthProp

        public static final IBeanMapper _clientWidthProp
      • _clientHeightProp

        public static final IBeanMapper _clientHeightProp
      • _scrollWidthProp

        public static final IBeanMapper _scrollWidthProp
      • _scrollHeightProp

        public static final IBeanMapper _scrollHeightProp
      • _offsetLeftProp

        public static final IBeanMapper _offsetLeftProp
      • _offsetTopProp

        public static final IBeanMapper _offsetTopProp
      • _offsetWidthProp

        public static final IBeanMapper _offsetWidthProp
      • _offsetHeightProp

        public static final IBeanMapper _offsetHeightProp
      • _mouseDownMoveUpProp

        public static final IBeanMapper _mouseDownMoveUpProp
      • formattingTags

        public static java.util.Set<java.lang.String> formattingTags
      • formattingAtts

        public static java.util.Set<java.lang.String> formattingAtts
    • Constructor Detail

      • HTMLElement

        public HTMLElement()
      • HTMLElement

        public HTMLElement​(TypeDeclaration concreteType,
                           Element parent,
                           java.lang.String id,
                           java.lang.Object repeatVar,
                           int repeatIx)
      • HTMLElement

        public HTMLElement​(Element parent,
                           java.lang.String id,
                           java.lang.Object repeatVar,
                           int repeatIx)
    • Method Detail

      • getClickEvent

        public MouseEvent getClickEvent()
      • setClickEvent

        public void setClickEvent​(MouseEvent clickEvent)
      • click

        public void click()
        Method implemented on the client only to generate a simulated DOM event that behaves like a click
      • getDblClickEvent

        public MouseEvent getDblClickEvent()
      • setDblClickEvent

        public void setDblClickEvent​(MouseEvent clickEvent)
      • getMouseDownEvent

        public MouseEvent getMouseDownEvent()
      • setMouseDownEvent

        public void setMouseDownEvent​(MouseEvent event)
      • getMouseMoveEvent

        public MouseEvent getMouseMoveEvent()
      • setMouseMoveEvent

        public void setMouseMoveEvent​(MouseEvent event)
      • getMouseOverEvent

        public MouseEvent getMouseOverEvent()
      • setMouseOverEvent

        public void setMouseOverEvent​(MouseEvent event)
      • getMouseOutEvent

        public MouseEvent getMouseOutEvent()
      • setMouseOutEvent

        public void setMouseOutEvent​(MouseEvent event)
      • getMouseUpEvent

        public MouseEvent getMouseUpEvent()
      • setMouseUpEvent

        public void setMouseUpEvent​(MouseEvent event)
      • setKeyDownEvent

        public void setKeyDownEvent​(KeyboardEvent event)
      • setKeyPressEvent

        public void setKeyPressEvent​(KeyboardEvent event)
      • setKeyUpEvent

        public void setKeyUpEvent​(KeyboardEvent event)
      • getFocusEvent

        public Event getFocusEvent()
      • setFocusEvent

        public void setFocusEvent​(Event event)
      • getBlurEvent

        public Event getBlurEvent()
      • setBlurEvent

        public void setBlurEvent​(Event event)
      • getMouseDownMoveUp

        public MouseEvent getMouseDownMoveUp()
      • setMouseDownMoveUp

        public void setMouseDownMoveUp​(MouseEvent event)
      • getDOMEvent

        protected Event getDOMEvent​(sc.lang.html.HTMLElement.EventType type)
      • setDOMEvent

        protected void setDOMEvent​(sc.lang.html.HTMLElement.EventType type,
                                   Event event,
                                   IBeanMapper prop)
      • focus

        public void focus()
      • validateClientHTML

        public static java.lang.String validateClientHTML​(java.lang.String htmlStr,
                                                          java.util.Set<java.lang.String> allowedTags,
                                                          java.util.Set<java.lang.String> allowedAtts)
        Parses and validates the HTML provided in htmlStr. If allowedTags is not null, only tags with those names are allowed
      • validateTagTree

        public static java.lang.String validateTagTree​(Element tag,
                                                       java.util.Set<java.lang.String> allowedTags,
                                                       java.util.Set<java.lang.String> allowedAtts)