Vaadin cache.js - polymer
I am trying to build a treeSelectView using checkboxes.
It implements HasValue so setValue hands over a list of nodes which should have checked checkboxes. and those checkboxes will be checked whenever the function is called. And here comes the downpart. When the treeSelectView reaches the client a script with the name https://localhost:8443/VAADIN/static/client/client-BF4676DDAFDA5E40AE93EFEB692AAAD5.cache.js is invoked which sets all the checkboxes in the tree to unchecked. This is the logoutput:
Sending xhr message to server: {"csrfToken":"8eb266a3-ec2b-4238-9d2e-00da55a02c27","rpc":[{"type":"mSync","node":313,"feature":1,"property":"selected","value":false},{"type":"mSync","node":307,"feature":1,"property":"selected","value":false},{"type":"mSync","node":301,"feature":1,"property":"selected","value":false},{"type":"mSync","node":295,"feature":1,"property":"selected","value":false},{"type":"mSync","node":289,"feature":1,"property":"selected","value":false},{"type":"mSync","node":283,"feature":1,"property":"selected","value":false},{"type":"mSync","node":277,"feature":1,"property":"selected","value":false},{"type":"mSync","node":271,"feature":1,"property":"selected","value":false},{"type":"mSync","node":265,"feature":1,"property":"selected","value":false},{"type":"mSync","node":259,"feature":1,"property":"selected","value":false},{"type":"mSync","node":253,"feature":1,"property":"selected","value":false},{"type":"mSync","node":247,"feature":1,"property":"selected","value":false},{"type":"mSync","node":241,"feature":1,"property":"selected","value":false},{"type":"mSync","node":235,"feature":1,"property":"selected","value":false},{"type":"mSync","node":229,"feature":1,"property":"selected","value":false},{"type":"mSync","node":223,"feature":1,"property":"selected","value":false},{"type":"mSync","node":217,"feature":1,"property":"selected","value":false},{"type":"mSync","node":211,"feature":1,"property":"selected","value":false},{"type":"mSync","node":205,"feature":1,"property":"selected","value":false},{"type":"mSync","node":199,"feature":1,"property":"selected","value":false},{"type":"mSync","node":193,"feature":1,"property":"selected","value":false},{"type":"mSync","node":187,"feature":1,"property":"selected","value":false},{"type":"mSync","node":181,"feature":1,"property":"selected","value":false},{"type":"mSync","node":175,"feature":1,"property":"selected","value":false},{"type":"mSync","node":169,"feature":1,"property":"selected","value":false},{"type":"mSync","node":163,"feature":1,"property":"selected","value":false},{"type":"mSync","node":157,"feature":1,"property":"selected","value":false},{"type":"mSync","node":151,"feature":1,"property":"selected","value":false},{"type":"mSync","node":145,"feature":1,"property":"selected","value":false},{"type":"mSync","node":139,"feature":1,"property":"selected","value":false},{"type":"mSync","node":133,"feature":1,"property":"selected","value":false},{"type":"mSync","node":127,"feature":1,"property":"selected","value":false},{"type":"mSync","node":121,"feature":1,"property":"selected","value":false},{"type":"mSync","node":115,"feature":1,"property":"selected","value":false},{"type":"mSync","node":109,"feature":1,"property":"selected","value":false},{"type":"mSync","node":103,"feature":1,"property":"selected","value":false},{"type":"mSync","node":97,"feature":1,"property":"selected","value":false},{"type":"mSync","node":91,"feature":1,"property":"selected","value":false},{"type":"mSync","node":85,"feature":1,"property":"selected","value":false},{"type":"mSync","node":79,"feature":1,"property":"selected","value":false},{"type":"mSync","node":73,"feature":1,"property":"selected","value":false},{"type":"mSync","node":67,"feature":1,"property":"selected","value":false},{"type":"mSync","node":61,"feature":1,"property":"selected","value":false},{"type":"mSync","node":55,"feature":1,"property":"selected","value":false},{"type":"mSync","node":49,"feature":1,"property":"selected","value":false},{"type":"mSync","node":43,"feature":1,"property":"selected","value":false},{"type":"mSync","node":37,"feature":1,"property":"selected","value":false},{"type":"mSync","node":31,"feature":1,"property":"selected","value":false},{"type":"mSync","node":25,"feature":1,"property":"selected","value":false},{"type":"mSync","node":19,"feature":1,"property":"selected","value":false}],"syncId":1,"clientId":1}
This is completely unexpected and unwanted behaviour.
Can anybody tell me why this is happening?
UPDATE
Here is my TreeSelectItem:
<link rel="import" href="../../../bower_components/polymer/polymer-element.html">
<link rel="import" href="../../../bower_components/vaadin-checkbox/src/vaadin-checkbox.html">
<link rel="import" href="../../../bower_components/vaadin-button/src/vaadin-button.html">
<dom-module id="tree-select-item">
<template>
<style>
#currentItemContainer{
background-color: var(--lumo-contrast-10pct);
border-radius: var(--lumo-border-radius);
padding: 5px;
margin: 3px;
overflow: auto;
}
.hidden{
display: none;
}
</style>
<div id="currentItemContainer" style$="{{_getStyle(level)}}" class$="{{_isHidden(hidden)}}">
<div style="width: 90px; float: left">
<vaadin-checkbox id="checkbox" checked="{{selected}}" indeterminate="{{indeterminate}}" disabled="{{readOnly}}"></vaadin-checkbox>
<vaadin-button class$="{{_isToggleHidden(hasDescendents)}}" theme="icon" on-click="collapse" style="--lumo-button-size: var(--lumo-size-xs);">
<iron-icon icon="{{_getCollapseToggle(collapsed)}}" slot="prefix"></iron-icon>
</vaadin-button>
</div>
<div id="layout" float: left></div>
</div>
</template>
<script>
{
class TreeSelectItem extends Polymer.Element {
static get is() {
return 'tree-select-item';
}
/* collapse(){
this.collapsed = !this.collapsed;
var parentElement = this.parentNode.__dataHost;
parentElement.collapse(this.id,this.collapsed);
} */
_getCollapseToggle(collapsed){
return collapsed ? "lumo:angle-right" : "lumo:angle-down";
}
_isToggleHidden(hidden){
return !hidden ? "hidden" : "";
}
_isHidden(hidden){
return hidden ? "hidden" : "";
}
_getStyle(marginFactor){
return "margin-left:"+(20*marginFactor)+"px;";
}
}
window.customElements.define(TreeSelectItem.is, TreeSelectItem);
}
</script>
</dom-module>
Here is the java part
#Data
#Tag("tree-select-item")
#HtmlImport("base/template/component/tree-select-item.html")
public class TreeSelectItem<T extends BasicTreeObject<T>> extends PolymerTemplate<TreeSelectItemTemplateModel> {
/**
* The element containing this item
*/
private TreeSelect<T> treeSelect;
private T item;
#Id("layout")
private Div layout;
#Id("checkbox")
private Checkbox checkbox;
public TreeSelectItem(T item, TreeSelect<T> treeSelect) {
setCollapsed(false);
setSelected(false);
getModel().setLevel(item.getLevel());
getModel().setId(item.getId().intValue());
getModel().setHasDescendents(CollectionUtils.isNotEmpty(item.getChildren()));
getModel().setHidden(false);
getModel().setReadOnly(false);
this.treeSelect = treeSelect;
this.item = item;
render();
}
public void render() {
layout.removeAll();
Component label = treeSelect.getItemRenderer().createComponent(item);
layout.add(label);
}
#EventHandler
public void collapse() {
treeSelect.collapse(this);
}
public void setCollapsed(boolean collapsed) {
getModel().setCollapsed(collapsed);
}
public boolean isCollapsed() {
return getModel().isCollapsed();
}
public void setSelected(boolean selected) {
setIndeterminate(false);
getModel().setSelected(selected);
}
public boolean isSelected() {
return getModel().isSelected();
}
public void addSelectionListener(PropertyChangeListener listener) {
getElement().addPropertyChangeListener("selected", listener);
}
public void setHidden(boolean hidden) {
getModel().setHidden(hidden);
}
public void setIndeterminate(boolean indeterminate) {
getModel().setIndeterminate(indeterminate);
}
public void setReadOnly(boolean readOnly) {
getModel().setReadOnly(readOnly);
}
public String toString() {
return this.item.toString();
}
}
And here is the function that sets the values:
#Override
public void setValue(List<T> value) {
for (TreeSelectItem<T> tsi : this.treeSelectItems) {
tsi.setSelected(value.contains(tsi.getItem()));
}
updateParentNodesCheckbox();
}
Related
lit: no attributes values in constructor
I'm building a count down in lit, and there is no HTML attributes (count, width, color, colorback, display) values unless adding timeout to constructor: JS: import {LitElement, html} from 'lit'; class ProgressBar extends LitElement { static get properties() { return { count: {type: Number}, width: {type: Number}, color: {type: String}, colorback: {type: String}, display: {type: String} } } render() { let output = ''; if(this.display==='true') { output = html` <style> :host > div { background-color: ${this.colorback}; width: 100%; } :host > div > div { background-color: ${this.color}; width: ${this.width}%; height: 30px; } </style> <div> <div></div> </div> `; } return output; } draw() { let self = this let x = self._date_end - (+new Date()); self.width = x * 100 / self.count if(self.width>0) { window.setTimeout(function() { self.draw() }, 1000 / 60) } else self.width = 0 } main() { let self = this self._date_end = new Date((+new Date())+self.count); self.draw() } constructor() { super() let self = this // working window.setTimeout(function() { self.main() }, 1000) // not working self.main() } } window.customElements.define('progress-bar', ProgressBar) HTML: <!DOCTYPE html> <html> <head> </head> <body> <progress-bar display="true" width="100" color="#4cAf50" colorback="#ddd" count="5000"> </progress-bar> <script src="main.js"></script> </body> </html> How to deal with it? Thank you
Using connectedCallback method works fine: connectedCallback() { super.connectedCallback() this.main() } constructor() { super() } https://lit.dev/docs/components/lifecycle/#connectedcallback
Combining the ::slotted and ::part pseudo elements
I'm trying to use the ::slotted selector in combination with the ::part selector, I want an outer custom element to style a part in an inner custom element, the problem is that I can't get it to work. So my question is, is my syntax wrong? Is this not possible to do? Here is a basic example demonstration, I want the parent element to make the button in the child element have a red background class ParentElement extends HTMLElement { constructor() { super(); this.attachShadow({mode: 'open'}); let template = document.querySelector("template#parent-template"); this.shadowRoot.append(template.content.cloneNode(true)); } } customElements.define("parent-element", ParentElement); class ChildElement extends HTMLElement { constructor() { super(); this.attachShadow({mode: 'open'}); let template = document.querySelector("template#child-template"); this.shadowRoot.append(template.content.cloneNode(true)); } } customElements.define("child-element", ChildElement); <template id="parent-template"> <style> :host { background-color: pink; padding: 20px; } ::slotted(child-element) { background-color: blue; padding: 10px; } ::slotted(child-element)::part(button) { background-color: red; } </style> <slot></slot> </template> <template id="child-template"> <button part="button">Style me!</button> </template> <parent-element> <child-element></child-element> </parent-element>
You can't do this right now, but that feature is currently being reviewed for addition to the spec. See https://github.com/w3c/csswg-drafts/issues/3896 and https://github.com/w3c/csswg-drafts/issues/7922
You could define the style in the parent-element: class ParentElement extends HTMLElement { constructor() { super(); this.attachShadow({mode: 'open'}); let template = document.querySelector("template#parent-template"); this.shadowRoot.append(template.content.cloneNode(true)); } } customElements.define("parent-element", ParentElement); class ChildElement extends HTMLElement { constructor() { super(); this.attachShadow({mode: 'open'}); let template = document.querySelector("template#child-template"); this.shadowRoot.append(template.content.cloneNode(true)); } } customElements.define("child-element", ChildElement); <template id="parent-template"> <style> :host { background-color: pink; padding: 20px; } ::slotted(child-element) { background-color: blue; padding: 10px; } </style> <slot></slot> </template> <template id="child-template"> <button part="button">Style me!</button> </template> <parent-element> <style> child-element::part(button) { background-color: red; } </style> <child-element></child-element> </parent-element> or directly in the child-element: class ParentElement extends HTMLElement { constructor() { super(); this.attachShadow({mode: 'open'}); let template = document.querySelector("template#parent-template"); this.shadowRoot.append(template.content.cloneNode(true)); } } customElements.define("parent-element", ParentElement); class ChildElement extends HTMLElement { constructor() { super(); this.attachShadow({mode: 'open'}); let template = document.querySelector("template#child-template"); this.shadowRoot.append(template.content.cloneNode(true)); } } customElements.define("child-element", ChildElement); <template id="parent-template"> <style> :host { background-color: pink; padding: 20px; } ::slotted(child-element) { background-color: blue; padding: 10px; } </style> <slot></slot> </template> <template id="child-template"> <style> button { background-color: red; } </style> <button part="button">Style me!</button> </template> <parent-element> <child-element></child-element> </parent-element>
Dynamically create column and row in HTML
I have data structure like this. and <param1> could be repeating . We can have multiple value for param1 <param> <param1> <name> <value> </param1> <param1> <name1> <value1> </param1> </param> I want to display in html dynamically like this(like column row ). How can we do it ??? name name1 value value1 Can someone suggest how to do it . I am new to this area
The solution should be: <!DOCTYPE html> <html> <style> param-list { font-size : 20px; display:inline-block; border:1px solid gray; } param-list > *{ font-size : 20px; display:block; } </style> <body> <param-list> <my-name></my-name> <my-value></my-value> </param-list> <param-list> <my-name1></my-name1> <my-value1></my-value1> </param-list> <script> class ParamList extends HTMLElement { connectedCallback() { this.children; } } customElements.define('param-list', ParamList); class Name extends HTMLElement { connectedCallback() { this.innerHTML = `name`; } } customElements.define('my-name', Name); class Name1 extends HTMLElement { connectedCallback() { this.innerHTML = `name1`; } } customElements.define('my-name1', Name1); class Value extends HTMLElement { connectedCallback() { this.innerHTML = `value`; } } customElements.define('my-value', Value); class Value1 extends HTMLElement { connectedCallback() { this.innerHTML = `value1`; } } customElements.define('my-value1', Value1); </script> </body> </html> Live at custom-element ref: https://www.html5rocks.com/en/tutorials/webcomponents/customelements/ How to create custom tags for html https://dev.to/jfbrennan/custom-html-tags-4788 https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements
Angular 5, HTML, boolean on checkbox is checked
Angular 5, Typescript 2.7.1 I can't seem to get the checkbox to be checked when returning a boolean, I've tried, item.check returns either true or false. <tr class="even" *ngFor="let item of rows"> <input value="{{item.check}}" type="checkbox" checked="item.check"> The checkbox is always checked when checked is written inside input. And it does not get unchecked when checked="false". Is there a better way to do it with Angular features instead? like ngModel or ngIf??? Solution <input type="checkbox" [checked]="item.check == 'true'">
try: [checked]="item.checked" check out: How to Deal with Different Form Controls in Angular
You can use this: <input type="checkbox" [checked]="record.status" (change)="changeStatus(record.id,$event)"> Here, record is the model for current row and status is boolean value.
When you have a copy of an object the [checked] attribute might not work, in that case, you can use (change) in this way: <input type="checkbox" [checked]="item.selected" (change)="item.selected = !item.selected">
Hope this will help somebody to develop custom checkbox component with custom styles. This solution can use with forms too. HTML <label class="lbl"> <input #inputEl type="checkbox" [name]="label" [(ngModel)]="isChecked" (change)="onChange(inputEl.checked)" *ngIf="isChecked" checked> <input #inputEl type="checkbox" [name]="label" [(ngModel)]="isChecked" (change)="onChange(inputEl.checked)" *ngIf="!isChecked" > <span class="chk-box {{isChecked ? 'chk':''}}"></span> <span class="lbl-txt" *ngIf="label" >{{label}}</span> </label> checkbox.component.ts import { Component, Input, EventEmitter, Output, forwardRef, HostListener } from '#angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '#angular/forms'; const noop = () => { }; export const CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CheckboxComponent), multi: true }; /** Custom check box */ #Component({ selector: 'app-checkbox', templateUrl: './checkbox.component.html', styleUrls: ['./checkbox.component.scss'], providers: [CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR] }) export class CheckboxComponent implements ControlValueAccessor { #Input() label: string; #Input() isChecked = false; #Input() disabled = false; #Output() getChange = new EventEmitter(); #Input() className: string; // get accessor get value(): any { return this.isChecked; } // set accessor including call the onchange callback set value(value: any) { this.isChecked = value; } private onTouchedCallback: () => void = noop; private onChangeCallback: (_: any) => void = noop; writeValue(value: any): void { if (value !== this.isChecked) { this.isChecked = value; } } onChange(isChecked) { this.value = isChecked; this.getChange.emit(this.isChecked); this.onChangeCallback(this.value); } // From ControlValueAccessor interface registerOnChange(fn: any) { this.onChangeCallback = fn; } // From ControlValueAccessor interface registerOnTouched(fn: any) { this.onTouchedCallback = fn; } setDisabledState?(isDisabled: boolean): void { } } checkbox.component.scss #import "../../../assets/scss/_variables"; /* CHECKBOX */ .lbl { font-size: 12px; color: #282828; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; cursor: pointer; &.checked { font-weight: 600; } &.focus { .chk-box{ border: 1px solid #a8a8a8; &.chk{ border: none; } } } input { display: none; } /* checkbox icon */ .chk-box { display: block; min-width: 15px; min-height: 15px; background: url('/assets/i/checkbox-not-selected.svg'); background-size: 15px 15px; margin-right: 10px; } input:checked+.chk-box { background: url('/assets/i/checkbox-selected.svg'); background-size: 15px 15px; } .lbl-txt { margin-top: 0px; } } Usage Outside forms <app-checkbox [label]="'Example'" [isChecked]="true"></app-checkbox> Inside forms <app-checkbox [label]="'Type 0'" formControlName="Type1"></app-checkbox>
Here is my answer, In row.model.ts export interface Row { otherProperty : type; checked : bool; otherProperty : type; ... } In .html <tr class="even" *ngFor="let item of rows"> <input [checked]="item.checked" type="checkbox"> </tr> In .ts rows : Row[] = []; update the rows in component.ts
Work with checkboxes using observables You could even choose to use a behaviourSubject to utilize the power of observables so you can start a certain chain of reaction starting at the isChecked$ observable. In your component.ts: public isChecked$ = new BehaviorSubject(false); toggleChecked() { this.isChecked$.next(!this.isChecked$.value) } In your template <input type="checkbox" [checked]="isChecked$ | async" (change)="toggleChecked()">
[checked]= "isChecked" This isChecked will be your varaible of type boolean in component.ts file i.e if you setb isChecked variable to true in component.ts ts checkbox will be checked and vice versa.
<input type="checkbox" [checked]="item.checked == true">
Itext not rendering base64 transform rotated images
I am trying to rotate a base64 embedded image in the html using transform rotate, the image is rotated fine in the html page, but when i am trying to render the same in pdf using itext, the transformation properties has no effect. Below is my sample html code. <?xml version="1.0" encoding="utf-8"?> <html> <head> <style type="text/css"> body,div,td,th,span,h1,h2 { font:9pt/12pt "Roboto", serif; } .fleft { float:left; overflow-x: wrap; } .rotate90 { -webkit-transform: rotate(90deg); -moz-transform: rotate(90deg); -o-transform: rotate(90deg); -ms-transform: rotate(90deg); transform: rotate(90deg); } .gift-icon{ width: 21mm; height: 21mm; } </style> </head> <body> <div> <img class="fleft gift-icon rotate90" alt="" src="data:image/png;base64,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"/> </div> </body> </html> I am using ReplacedElementFactory to re-generate the image, although the width and height of the image is getting rendered properly, the image is not getting rotated. Please find the ReplacedElementFactory class below. public class B64ImgReplacedElementFactory implements ReplacedElementFactory { public ReplacedElement createReplacedElement(LayoutContext c, BlockBox box, UserAgentCallback uac, int cssWidth, int cssHeight) { Element e = box.getElement(); if (e == null) { return null; } String nodeName = e.getNodeName(); if (nodeName.equals("img")) { String attribute = e.getAttribute("src"); FSImage fsImage; try { fsImage = buildImage(attribute, uac); } catch (BadElementException e1) { fsImage = null; } catch (IOException e1) { fsImage = null; } if (fsImage != null) { if (cssWidth != -1 || cssHeight != -1) { fsImage.scale(cssWidth, cssHeight); } return new ITextImageElement(fsImage); } } return null; } protected FSImage buildImage(String srcAttr, UserAgentCallback uac) throws IOException, BadElementException { FSImage fsImage; if (srcAttr.startsWith("data:image/")) { String b64encoded = srcAttr.substring(srcAttr.indexOf("base64,") + "base64,".length(), srcAttr.length()); byte[] decodedBytes = Base64.decode(b64encoded); fsImage = new ITextFSImage(Image.getInstance(decodedBytes)); } else { fsImage = uac.getImageResource(srcAttr).getImage(); } return fsImage; } public void remove(Element e) { } public void reset() { } #Override public void setFormSubmissionListener(FormSubmissionListener listener) { } } Can someone please help me solve this? Thanks in advance