Example usage for com.vaadin.ui Component getConnectorId

List of usage examples for com.vaadin.ui Component getConnectorId

Introduction

In this page you can find the example usage for com.vaadin.ui Component getConnectorId.

Prototype

public String getConnectorId();

Source Link

Document

Returns the id for this connector.

Usage

From source file:annis.libgui.IDGenerator.java

License:Apache License

public static String assignID(Component c, String fieldName) {
    String id = null;// w w  w  .  j av  a  2  s. c om
    if (c != null && fieldName != null && !fieldName.isEmpty()) {
        Preconditions.checkArgument(c.isAttached(),
                "Component " + c.getConnectorId() + " must be attached before it can get an automatic ID.");
        id = c.getId();
        if (id == null) {
            // try to get the parent ID
            HasComponents parent = c.getParent();
            if (parent == null || parent instanceof UI) {
                // use class name as ID
                id = fieldName;
            } else {
                String parentID = parent.getId();
                if (parentID == null) {
                    parentID = assignID(parent);
                }
                String idBase = parentID + ":" + fieldName;
                // check that no other child has the same ID
                int counter = 1;
                id = idBase;
                while (childHasID(parent, id)) {
                    id = idBase + "." + counter++;
                }
            }
            c.setId(id);
        }
    }
    return id;
}

From source file:com.haulmont.cuba.web.toolkit.ui.renderers.componentrenderer.ComponentRenderer.java

License:Apache License

@Override
public JsonValue encode(Component component) {

    // 1: add component to grid, so connector id can be encoded
    if (component != null) {
        addComponentToGrid(component);/*from w  w w.  j  av  a2s . c  om*/
        return Json.create(component.getConnectorId());
    } else {
        return Json.createNull();
    }
}

From source file:de.datenhahn.vaadin.rendererpackage.ComponentRenderer.java

License:Apache License

@Override
public JsonValue encode(Component component) {
    component.setParent(getParentGrid());
    return Json.create(component.getConnectorId());
}

From source file:it.zero11.vaadin.animatedscrollintoview.AnimatedScrollIntoView.java

License:Apache License

public void scrollIntoView(Component component) {
    if (++offset > 'z')
        offset = 'a';
    getState().scrollToTarget = offset + component.getConnectorId();
}