bhavanak bhavanak - 1 year ago 53
Java Question

How to make vaadin combo box label always floating

I am working with polymer vaadin combo box in java gwt. But the label is always shown in-line . How to make it always floating?

Answer Source

We can use the code for setting the attributes

paperContainerElement.setAttribute("always-float-label", "true");

and the code will go like this

           box.ready(new Function() {

            public Object call(Object arg) {

            NodeList<Node> children =box.getElement().getChildNodes();

            for (int i = 0; i < children.getLength(); i++) {
            Node node = children.getItem(i);                      
            if (node.getNodeName().equals("PAPER-INPUT-CONTAINER")) {
            Element paperContainerElement = (Element) node;
            paperContainerElement.setAttribute("always-float-label", "true");

            return null;


The above code is simply to force inherit the alwaysFloatLabel from the outer vaadinComboBox to the paperInputContainer inside it.