All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.fluorumlabs.disconnect.vaadin.GridTreeToggle Maven / Gradle / Ivy

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 nameDescription
toggleThe tree toggle icon
* The following state attributes are available for styling: * * * * * * * * * *
AttributeDescriptionPart name
expandedWhen present, the toggle is expanded:host
leafWhen 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 propertyDescriptionDefault
--vaadin-grid-tree-toggle-level-offsetVisual offset step for each tree * sublevel1em
*/ @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"); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy