elemental2.dom.Element Java Examples
The following examples show how to use
elemental2.dom.Element.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NaluPluginElemento.java From nalu with Apache License 2.0 | 6 votes |
@Override public boolean attach(String selector, Object content) { Element selectorElement = DomGlobal.document.querySelector("#" + selector); if (selectorElement == null) { return false; } else { if (content instanceof Iterable) { Iterable<?> elements = (Iterable<?>) content; for (Object element : elements) { if (element instanceof IsElement) { selectorElement.appendChild(((IsElement<?>) element).element()); } else if (element instanceof HTMLElement) { selectorElement.appendChild(((HTMLElement) element)); } } } else if (content instanceof IsElement) { selectorElement.appendChild(((IsElement<?>) content).element()); } else if (content instanceof HTMLElement) { selectorElement.appendChild(((HTMLElement) content)); } return true; } }
Example #2
Source File: MockShellLogin.java From nalu with Apache License 2.0 | 6 votes |
private HTMLElement render() { document.body.style.margin = CSSProperties.MarginUnionType.of(0); HTMLDivElement shell = (HTMLDivElement) document.createElement("div"); shell.style.height = CSSProperties.HeightUnionType.of("auto"); shell.style.width = CSSProperties.WidthUnionType.of("100%"); shell.style.margin = CSSProperties.MarginUnionType.of(0); HTMLDivElement content = (HTMLDivElement) document.createElement("div"); content.id = "content"; content.style.position = "absolute"; content.style.overflow = "hidden"; content.style.top = "128px"; content.style.bottom = "42px"; content.style.left = "212px"; content.style.right = String.valueOf(0); shell.appendChild(content); Element footer = createSouth(); shell.appendChild(footer); return shell; }
Example #3
Source File: NaluPluginElemental2.java From nalu with Apache License 2.0 | 6 votes |
@Override public void updateMetaPropertyContent(String property, String content) { NodeList<Element> metaTagList = DomGlobal.document.getElementsByTagName("meta"); for (int i = 0; i < metaTagList.length; i++) { if (metaTagList.item(i) instanceof HTMLMetaElement) { HTMLMetaElement nodeListElement = (HTMLMetaElement) metaTagList.item(i); if (!Objects.isNull(nodeListElement.getAttribute("property"))) { if (nodeListElement.getAttribute("property") .equals(property)) { nodeListElement.remove(); break; } } } } HTMLMetaElement metaElement = (HTMLMetaElement) DomGlobal.document.createElement("meta"); metaElement.setAttribute("property", property); metaElement.content = content; DomGlobal.document.head.appendChild(metaElement); }
Example #4
Source File: NaluPluginElemental2.java From nalu with Apache License 2.0 | 6 votes |
@Override public void updateMetaNameContent(String name, String content) { NodeList<Element> metaTagList = DomGlobal.document.getElementsByTagName("meta"); for (int i = 0; i < metaTagList.length; i++) { if (metaTagList.item(i) instanceof HTMLMetaElement) { HTMLMetaElement nodeListElement = (HTMLMetaElement) metaTagList.item(i); if (!Objects.isNull(nodeListElement.name)) { if (nodeListElement.name.equals(name)) { nodeListElement.remove(); break; } } } } HTMLMetaElement metaTagElement = (HTMLMetaElement) DomGlobal.document.createElement("meta"); metaTagElement.name = name; metaTagElement.content = content; DomGlobal.document.head.appendChild(metaTagElement); }
Example #5
Source File: LeafletResources.java From gwty-leaflet with Apache License 2.0 | 6 votes |
public static void whenReady(boolean debug, Element.OnloadFn function){ HTMLScriptElement leafletScript = (HTMLScriptElement) DomGlobal.document.createElement("script"); if (debug) { leafletScript.src = GWT.getModuleName() + "/leaflet/leaflet-src.js"; } else { leafletScript.src = GWT.getModuleName() + "/leaflet/leaflet.js"; } leafletScript.type="text/javascript"; HTMLLinkElement leafletStyle = (HTMLLinkElement) DomGlobal.document.createElement("link"); leafletStyle.href=GWT.getModuleName()+"/leaflet/leaflet.css"; leafletStyle.rel="stylesheet"; DomGlobal.document.head.appendChild(leafletScript); DomGlobal.document.head.appendChild(leafletStyle); leafletScript.onload = function; }
Example #6
Source File: NaluPluginElemento.java From nalu with Apache License 2.0 | 6 votes |
@Override public void updateMetaPropertyContent(String property, String content) { NodeList<Element> metaTagList = DomGlobal.document.getElementsByTagName("meta"); for (int i = 0; i < metaTagList.length; i++) { if (metaTagList.item(i) instanceof HTMLMetaElement) { HTMLMetaElement nodeListElement = (HTMLMetaElement) metaTagList.item(i); if (!Objects.isNull(nodeListElement.getAttribute("property"))) { if (nodeListElement.getAttribute("property") .equals(property)) { nodeListElement.remove(); break; } } } } HTMLMetaElement metaElement = (HTMLMetaElement) DomGlobal.document.createElement("meta"); metaElement.setAttribute("property", property); metaElement.content = content; DomGlobal.document.head.appendChild(metaElement); }
Example #7
Source File: NaluPluginElemento.java From nalu with Apache License 2.0 | 6 votes |
@Override public void updateMetaNameContent(String name, String content) { NodeList<Element> metaTagList = DomGlobal.document.getElementsByTagName("meta"); for (int i = 0; i < metaTagList.length; i++) { if (metaTagList.item(i) instanceof HTMLMetaElement) { HTMLMetaElement nodeListElement = (HTMLMetaElement) metaTagList.item(i); if (!Objects.isNull(nodeListElement.name)) { if (nodeListElement.name.equals(name)) { nodeListElement.remove(); break; } } } } HTMLMetaElement metaTagElement = (HTMLMetaElement) DomGlobal.document.createElement("meta"); metaTagElement.name = name; metaTagElement.content = content; DomGlobal.document.head.appendChild(metaTagElement); }
Example #8
Source File: NaluPluginElemento.java From nalu with Apache License 2.0 | 5 votes |
@Override public void remove(String selector) { Element selectorElement = DomGlobal.document.querySelector("#" + selector); if (selectorElement != null) { if (selectorElement.childNodes.length > 0) { for (int i = selectorElement.childNodes.asList() .size() - 1; i > -1; i--) { selectorElement.removeChild(selectorElement.childNodes.asList() .get(i)); } } } }
Example #9
Source File: InjectedLeafletResources.java From gwty-leaflet with Apache License 2.0 | 5 votes |
public static void whenReady(Element.OnloadFn function){ HTMLScriptElement leafletScript = (HTMLScriptElement) DomGlobal.document.createElement("script"); leafletScript.src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0/leaflet.js"; leafletScript.type="text/javascript"; DomGlobal.document.head.appendChild(leafletScript); leafletScript.onload = function; }
Example #10
Source File: MockShellLogin.java From nalu with Apache License 2.0 | 5 votes |
private Element createNorth() { HTMLElement panel = (HTMLElement) document.createElement("header"); panel.id = "header"; panel.style.position = "absolute"; panel.style.overflow = "hidden"; panel.style.height = CSSProperties.HeightUnionType.of("128px"); panel.style.top = String.valueOf(0); panel.style.right = String.valueOf(0); panel.style.left = String.valueOf(0); panel.style.width = CSSProperties.WidthUnionType.of("100%"); panel.style.borderBottom = "black 1px solid"; return panel; }
Example #11
Source File: MockShellLogin.java From nalu with Apache License 2.0 | 5 votes |
private Element createSouth() { HTMLElement panel = (HTMLElement) document.createElement("header"); panel.id = "footer"; panel.style.position = "absolute"; panel.style.overflow = "hidden"; panel.style.height = CSSProperties.HeightUnionType.of("128px"); panel.style.top = String.valueOf(0); panel.style.right = String.valueOf(0); panel.style.left = String.valueOf(0); panel.style.width = CSSProperties.WidthUnionType.of("100%"); panel.style.borderBottom = "black 1px solid"; return panel; }
Example #12
Source File: MockShell01.java From nalu with Apache License 2.0 | 5 votes |
private HTMLElement render() { document.body.style.margin = CSSProperties.MarginUnionType.of(0); this.shell = (HTMLDivElement) document.createElement("div"); this.shell.style.height = CSSProperties.HeightUnionType.of("auto"); this.shell.style.width = CSSProperties.WidthUnionType.of("100%"); this.shell.style.margin = CSSProperties.MarginUnionType.of(0); Element header = createNorth(); this.shell.appendChild(header); HTMLDivElement navigation = (HTMLDivElement) document.createElement("div"); navigation.id = "navigation"; navigation.style.position = "absolute"; navigation.style.overflow = "hidden"; navigation.style.top = "128px"; navigation.style.bottom = "42px"; navigation.style.left = String.valueOf(0); navigation.style.width = CSSProperties.WidthUnionType.of("212px"); navigation.style.borderRight = "black 1px solid"; this.shell.appendChild(navigation); HTMLDivElement content = (HTMLDivElement) document.createElement("div"); content.id = "content"; content.style.position = "absolute"; content.style.overflow = "hidden"; content.style.top = "128px"; content.style.bottom = "42px"; content.style.left = "212px"; content.style.right = String.valueOf(0); this.shell.appendChild(content); Element footer = createSouth(); this.shell.appendChild(footer); return this.shell; }
Example #13
Source File: MockShell01.java From nalu with Apache License 2.0 | 5 votes |
private Element createNorth() { HTMLElement panel = (HTMLElement) document.createElement("header"); panel.id = "header"; panel.style.position = "absolute"; panel.style.overflow = "hidden"; panel.style.height = CSSProperties.HeightUnionType.of("128px"); panel.style.top = String.valueOf(0); panel.style.right = String.valueOf(0); panel.style.left = String.valueOf(0); panel.style.width = CSSProperties.WidthUnionType.of("100%"); panel.style.borderBottom = "black 1px solid"; return panel; }
Example #14
Source File: MockShell01.java From nalu with Apache License 2.0 | 5 votes |
private Element createSouth() { HTMLElement panel = (HTMLElement) document.createElement("header"); panel.id = "footer"; panel.style.position = "absolute"; panel.style.overflow = "hidden"; panel.style.height = CSSProperties.HeightUnionType.of("128px"); panel.style.top = String.valueOf(0); panel.style.right = String.valueOf(0); panel.style.left = String.valueOf(0); panel.style.width = CSSProperties.WidthUnionType.of("100%"); panel.style.borderBottom = "black 1px solid"; return panel; }
Example #15
Source File: MockShellDuplicateName.java From nalu with Apache License 2.0 | 5 votes |
private HTMLElement render() { document.body.style.margin = CSSProperties.MarginUnionType.of(0); HTMLDivElement shell = (HTMLDivElement) document.createElement("div"); shell.style.height = CSSProperties.HeightUnionType.of("auto"); shell.style.width = CSSProperties.WidthUnionType.of("100%"); shell.style.margin = CSSProperties.MarginUnionType.of(0); Element header = createNorth(); shell.appendChild(header); HTMLDivElement navigation = (HTMLDivElement) document.createElement("div"); navigation.id = "navigation"; navigation.style.position = "absolute"; navigation.style.overflow = "hidden"; navigation.style.top = "128px"; navigation.style.bottom = "42px"; navigation.style.left = String.valueOf(0); navigation.style.width = CSSProperties.WidthUnionType.of("212px"); navigation.style.borderRight = "black 1px solid"; shell.appendChild(navigation); HTMLDivElement content = (HTMLDivElement) document.createElement("div"); content.id = "content"; content.style.position = "absolute"; content.style.overflow = "hidden"; content.style.top = "128px"; content.style.bottom = "42px"; content.style.left = "212px"; content.style.right = String.valueOf(0); shell.appendChild(content); Element footer = createSouth(); shell.appendChild(footer); return shell; }
Example #16
Source File: MockShellDuplicateName.java From nalu with Apache License 2.0 | 5 votes |
private Element createNorth() { HTMLElement panel = (HTMLElement) document.createElement("header"); panel.id = "header"; panel.style.position = "absolute"; panel.style.overflow = "hidden"; panel.style.height = CSSProperties.HeightUnionType.of("128px"); panel.style.top = String.valueOf(0); panel.style.right = String.valueOf(0); panel.style.left = String.valueOf(0); panel.style.width = CSSProperties.WidthUnionType.of("100%"); panel.style.borderBottom = "black 1px solid"; return panel; }
Example #17
Source File: MockShellDuplicateName.java From nalu with Apache License 2.0 | 5 votes |
private Element createSouth() { HTMLElement panel = (HTMLElement) document.createElement("header"); panel.id = "footer"; panel.style.position = "absolute"; panel.style.overflow = "hidden"; panel.style.height = CSSProperties.HeightUnionType.of("128px"); panel.style.top = String.valueOf(0); panel.style.right = String.valueOf(0); panel.style.left = String.valueOf(0); panel.style.width = CSSProperties.WidthUnionType.of("100%"); panel.style.borderBottom = "black 1px solid"; return panel; }
Example #18
Source File: MockShell.java From nalu with Apache License 2.0 | 5 votes |
private HTMLElement render() { document.body.style.margin = CSSProperties.MarginUnionType.of(0); this.shell = (HTMLDivElement) document.createElement("div"); this.shell.style.height = CSSProperties.HeightUnionType.of("auto"); this.shell.style.width = CSSProperties.WidthUnionType.of("100%"); this.shell.style.margin = CSSProperties.MarginUnionType.of(0); Element header = createNorth(); this.shell.appendChild(header); HTMLDivElement navigation = (HTMLDivElement) document.createElement("div"); navigation.id = "navigation"; navigation.style.position = "absolute"; navigation.style.overflow = "hidden"; navigation.style.top = "128px"; navigation.style.bottom = "42px"; navigation.style.left = String.valueOf(0); navigation.style.width = CSSProperties.WidthUnionType.of("212px"); navigation.style.borderRight = "black 1px solid"; this.shell.appendChild(navigation); HTMLDivElement content = (HTMLDivElement) document.createElement("div"); content.id = "content"; content.style.position = "absolute"; content.style.overflow = "hidden"; content.style.top = "128px"; content.style.bottom = "42px"; content.style.left = "212px"; content.style.right = String.valueOf(0); this.shell.appendChild(content); Element footer = createSouth(); this.shell.appendChild(footer); return this.shell; }
Example #19
Source File: MockShell.java From nalu with Apache License 2.0 | 5 votes |
private Element createNorth() { HTMLElement panel = (HTMLElement) document.createElement("header"); panel.id = "header"; panel.style.position = "absolute"; panel.style.overflow = "hidden"; panel.style.height = CSSProperties.HeightUnionType.of("128px"); panel.style.top = String.valueOf(0); panel.style.right = String.valueOf(0); panel.style.left = String.valueOf(0); panel.style.width = CSSProperties.WidthUnionType.of("100%"); panel.style.borderBottom = "black 1px solid"; return panel; }
Example #20
Source File: MockShell.java From nalu with Apache License 2.0 | 5 votes |
private Element createSouth() { HTMLElement panel = (HTMLElement) document.createElement("header"); panel.id = "footer"; panel.style.position = "absolute"; panel.style.overflow = "hidden"; panel.style.height = CSSProperties.HeightUnionType.of("128px"); panel.style.top = String.valueOf(0); panel.style.right = String.valueOf(0); panel.style.left = String.valueOf(0); panel.style.width = CSSProperties.WidthUnionType.of("100%"); panel.style.borderBottom = "black 1px solid"; return panel; }
Example #21
Source File: MockErrorShellIllegal.java From nalu with Apache License 2.0 | 5 votes |
private HTMLElement render() { document.body.style.margin = CSSProperties.MarginUnionType.of(0); HTMLDivElement shell = (HTMLDivElement) document.createElement("div"); shell.style.height = CSSProperties.HeightUnionType.of("auto"); shell.style.width = CSSProperties.WidthUnionType.of("100%"); shell.style.margin = CSSProperties.MarginUnionType.of(0); Element header = createNorth(); shell.appendChild(header); HTMLDivElement navigation = (HTMLDivElement) document.createElement("div"); navigation.id = "navigation"; navigation.style.position = "absolute"; navigation.style.overflow = "hidden"; navigation.style.top = "128px"; navigation.style.bottom = "42px"; navigation.style.left = String.valueOf(0); navigation.style.width = CSSProperties.WidthUnionType.of("212px"); navigation.style.borderRight = "black 1px solid"; shell.appendChild(navigation); HTMLDivElement content = (HTMLDivElement) document.createElement("div"); content.id = "content"; content.style.position = "absolute"; content.style.overflow = "hidden"; content.style.top = "128px"; content.style.bottom = "42px"; content.style.left = "212px"; content.style.right = String.valueOf(0); shell.appendChild(content); Element footer = createSouth(); shell.appendChild(footer); return shell; }
Example #22
Source File: MockErrorShellIllegal.java From nalu with Apache License 2.0 | 5 votes |
private Element createNorth() { HTMLElement panel = (HTMLElement) document.createElement("header"); panel.id = "header"; panel.style.position = "absolute"; panel.style.overflow = "hidden"; panel.style.height = CSSProperties.HeightUnionType.of("128px"); panel.style.top = String.valueOf(0); panel.style.right = String.valueOf(0); panel.style.left = String.valueOf(0); panel.style.width = CSSProperties.WidthUnionType.of("100%"); panel.style.borderBottom = "black 1px solid"; return panel; }
Example #23
Source File: MockErrorShellIllegal.java From nalu with Apache License 2.0 | 5 votes |
private Element createSouth() { HTMLElement panel = (HTMLElement) document.createElement("header"); panel.id = "footer"; panel.style.position = "absolute"; panel.style.overflow = "hidden"; panel.style.height = CSSProperties.HeightUnionType.of("128px"); panel.style.top = String.valueOf(0); panel.style.right = String.valueOf(0); panel.style.left = String.valueOf(0); panel.style.width = CSSProperties.WidthUnionType.of("100%"); panel.style.borderBottom = "black 1px solid"; return panel; }
Example #24
Source File: MockErrorShell.java From nalu with Apache License 2.0 | 5 votes |
private Element createNorth() { HTMLElement panel = (HTMLElement) document.createElement("header"); panel.id = "header"; panel.style.position = "absolute"; panel.style.overflow = "hidden"; panel.style.height = CSSProperties.HeightUnionType.of("128px"); panel.style.top = String.valueOf(0); panel.style.right = String.valueOf(0); panel.style.left = String.valueOf(0); panel.style.width = CSSProperties.WidthUnionType.of("100%"); panel.style.borderBottom = "black 1px solid"; return panel; }
Example #25
Source File: NaluPluginElemental2.java From nalu with Apache License 2.0 | 5 votes |
@Override public boolean attach(String selector, Object asElement) { Element selectorElement = DomGlobal.document.querySelector("#" + selector); if (selectorElement == null) { return false; } else { selectorElement.appendChild((HTMLElement) asElement); return true; } }
Example #26
Source File: NaluPluginElemental2.java From nalu with Apache License 2.0 | 5 votes |
@Override public void remove(String selector) { Element selectorElement = DomGlobal.document.querySelector("#" + selector); if (selectorElement != null) { if (selectorElement.childNodes.length > 0) { for (int i = selectorElement.childNodes.asList() .size() - 1; i > -1; i--) { selectorElement.removeChild(selectorElement.childNodes.asList() .get(i)); } } } }
Example #27
Source File: ShellDoesNotHaveGenericContext.java From nalu with Apache License 2.0 | 5 votes |
private HTMLElement render() { document.body.style.margin = CSSProperties.MarginUnionType.of(0); HTMLDivElement shell = (HTMLDivElement) document.createElement("div"); shell.style.height = CSSProperties.HeightUnionType.of("auto"); shell.style.width = CSSProperties.WidthUnionType.of("100%"); shell.style.margin = CSSProperties.MarginUnionType.of(0); Element header = createNorth(); shell.appendChild(header); HTMLDivElement navigation = (HTMLDivElement) document.createElement("div"); navigation.id = "navigation"; navigation.style.position = "absolute"; navigation.style.overflow = "hidden"; navigation.style.top = "128px"; navigation.style.bottom = "42px"; navigation.style.left = String.valueOf(0); navigation.style.width = CSSProperties.WidthUnionType.of("212px"); navigation.style.borderRight = "black 1px solid"; shell.appendChild(navigation); HTMLDivElement content = (HTMLDivElement) document.createElement("div"); content.id = "content"; content.style.position = "absolute"; content.style.overflow = "hidden"; content.style.top = "128px"; content.style.bottom = "42px"; content.style.left = "212px"; content.style.right = String.valueOf(0); shell.appendChild(content); Element footer = createSouth(); shell.appendChild(footer); return shell; }
Example #28
Source File: ShellDoesNotHaveGenericContext.java From nalu with Apache License 2.0 | 5 votes |
private Element createNorth() { HTMLElement panel = (HTMLElement) document.createElement("header"); panel.id = "header"; panel.style.position = "absolute"; panel.style.overflow = "hidden"; panel.style.height = CSSProperties.HeightUnionType.of("128px"); panel.style.top = String.valueOf(0); panel.style.right = String.valueOf(0); panel.style.left = String.valueOf(0); panel.style.width = CSSProperties.WidthUnionType.of("100%"); panel.style.borderBottom = "black 1px solid"; return panel; }
Example #29
Source File: ShellDoesNotHaveGenericContext.java From nalu with Apache License 2.0 | 5 votes |
private Element createSouth() { HTMLElement panel = (HTMLElement) document.createElement("header"); panel.id = "footer"; panel.style.position = "absolute"; panel.style.overflow = "hidden"; panel.style.height = CSSProperties.HeightUnionType.of("128px"); panel.style.top = String.valueOf(0); panel.style.right = String.valueOf(0); panel.style.left = String.valueOf(0); panel.style.width = CSSProperties.WidthUnionType.of("100%"); panel.style.borderBottom = "black 1px solid"; return panel; }
Example #30
Source File: ShellDoesNotExtendAbstractShell.java From nalu with Apache License 2.0 | 5 votes |
private HTMLElement render() { document.body.style.margin = CSSProperties.MarginUnionType.of(0); HTMLDivElement shell = (HTMLDivElement) document.createElement("div"); shell.style.height = CSSProperties.HeightUnionType.of("auto"); shell.style.width = CSSProperties.WidthUnionType.of("100%"); shell.style.margin = CSSProperties.MarginUnionType.of(0); Element header = createNorth(); shell.appendChild(header); HTMLDivElement navigation = (HTMLDivElement) document.createElement("div"); navigation.id = "navigation"; navigation.style.position = "absolute"; navigation.style.overflow = "hidden"; navigation.style.top = "128px"; navigation.style.bottom = "42px"; navigation.style.left = String.valueOf(0); navigation.style.width = CSSProperties.WidthUnionType.of("212px"); navigation.style.borderRight = "black 1px solid"; shell.appendChild(navigation); HTMLDivElement content = (HTMLDivElement) document.createElement("div"); content.id = "content"; content.style.position = "absolute"; content.style.overflow = "hidden"; content.style.top = "128px"; content.style.bottom = "42px"; content.style.left = "212px"; content.style.right = String.valueOf(0); shell.appendChild(content); Element footer = createSouth(); shell.appendChild(footer); return shell; }