com.github.fluorumlabs.disconnect.vaadin.GridTreeToggle Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of disconnect-vaadin Show documentation
Show all versions of disconnect-vaadin Show documentation
Vaadin components bindings for Disconnect Zero
The newest version!
package com.github.fluorumlabs.disconnect.vaadin;
import com.github.fluorumlabs.disconnect.core.annotations.WebComponent;
import com.github.fluorumlabs.disconnect.polymer.types.BooleanPropertyChangeEvent;
import com.github.fluorumlabs.disconnect.vaadin.elements.GridTreeToggleElement;
import com.github.fluorumlabs.disconnect.vaadin.mixins.HasThemableMixin;
import com.github.fluorumlabs.disconnect.vaadin.types.ThemeVariant;
import com.github.fluorumlabs.disconnect.zero.component.AbstractComponent;
import com.github.fluorumlabs.disconnect.zero.component.Component;
import com.github.fluorumlabs.disconnect.zero.component.HasComponents;
import com.github.fluorumlabs.disconnect.zero.component.HasStyle;
import com.github.fluorumlabs.disconnect.zero.observable.ObservableEvent;
import js.extras.JsEnum;
/**
* <vaadin-grid-tree-toggle>
is a helper element for the <vaadin-grid>
* that provides toggle and level display functionality for the item tree.
*
* Example:
* <vaadin-grid-column>
* <template class="header">Package name</template>
* <template>
* <vaadin-grid-tree-toggle
* leaf="[[!item.hasChildren]]"
* expanded="{{expanded}}"
* level="[[level]]">
* [[item.name]]
* </vaadin-grid-tree-toggle>
* </template>
* </vaadin-grid-column>
*
* Styling
* The following shadow DOM parts are available for styling:
*
*
*
* Part name Description
*
*
* toggle
The tree toggle icon
*
*
* The following state attributes are available for styling:
*
*
*
* Attribute Description Part name
*
*
* expanded
When present, the toggle is expanded :host
* leaf
When present, the toggle is not expandable, i. e., the current item is a
* leaf :host
*
*
* The following custom CSS properties are available on
* the <vaadin-grid-tree-toggle>
element:
*
*
*
* Custom CSS property Description Default
*
*
* --vaadin-grid-tree-toggle-level-offset
Visual offset step for each tree
* sublevel 1em
*
*
*/
@WebComponent
public class GridTreeToggle extends AbstractComponent
implements HasThemableMixin,
HasStyle, HasComponents> {
public GridTreeToggle() {
super(GridTreeToggleElement.TAGNAME());
}
/**
* Current level of the tree represented with a horizontal offset
* of the toggle button.
*/
public double level() {
return getNode().getLevel();
}
/**
* Current level of the tree represented with a horizontal offset
* of the toggle button.
*/
public GridTreeToggle level(double level) {
getNode().setLevel(level);
return this;
}
/**
* Hides the toggle icon and disables toggling a tree sublevel.
*/
public boolean leaf() {
return getNode().isLeaf();
}
/**
* Hides the toggle icon and disables toggling a tree sublevel.
*/
public GridTreeToggle leaf(boolean leaf) {
getNode().setLeaf(leaf);
return this;
}
/**
* Sublevel toggle state.
*/
public boolean expanded() {
return getNode().isExpanded();
}
/**
* Sublevel toggle state.
*/
public GridTreeToggle expanded(boolean expanded) {
getNode().setExpanded(expanded);
return this;
}
/**
* Fired when the expanded
property changes.
*/
public ObservableEvent expandedChangedEvent() {
return createEvent("expanded-changed");
}
public abstract static class Variant extends ThemeVariant {
public static final Variant CONNECTORS = JsEnum.of("connectors");
}
}