Component class abstract

The basic building block of the whole application. Component, is a basic and abstract class, used to define a set of HTML elements to be rendered on screen. For example, to create a button, with image icon, you will create a

Implementers

Constructors

Component.new(String id, String baseInnerHtml)
Creates a Component. The given baseInnerHtml string will be checked if it really has matching id="" tag or not. The given id should exist in baseInnerHtml as id="$id" attribute. This will keep this class in sync with the real DOM.
Component.empty(String id)
Creates empty Component with empty baseInnerHtml. Useful for subclasses where you then create baseInnerHtml string inside the subclass constructor. The subclass constructor can call super.empty to build empty Component.

Properties

baseInnerElement → Element?
no setter
baseInnerHtml String
Sanitizes and sets the baseInnerHtml of this component. Will throw ComponentNoIdException if there is no id="" attribute with the same id value found inside the baseInnerHtml string. This ensures that the DOM is in sync with the object (meaning that the component with id test will really be rendered into DOM with id="test" in the tag.
getter/setter pair
elem → Element
Returns the DOM Element of this component by doing querySelector('$id').
no setter
hashCode int
The hash code for this object.
no setterinherited
htmlElem → HTMLElement
no setter
id String
Setting the component with new ID is basically not recommended. It will change the real HTML ID of this element rendered in DOM too, and will throw ComponentDuplicateIdException when the new ID already exists.
getter/setter pair
mathMlElem → MathMLElement
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
svgElem → SVGElement
no setter

Methods

assertDuplicateId(String id) → void
contains(Node node) bool
Contains checks whether a node is contained in this component. Can only be used by StringComponent if the component has been attached.
isRendered() bool
Check if the component is rendered at DOM or not.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
queryByClass(String elemClass) → NodeList
Does elem.querySelectorAll(.elemClass) to select all element that have matched class.
queryById(String id) → Element?
Does elem.querySelector(#id) to select an element under this component.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited