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

io.imunity.vaadin.auth.extensions.credreset.TextFieldWithContextLabel Maven / Gradle / Ivy

There is a newer version: 4.0.4
Show newest version
/*
 * Copyright (c) 2018 Bixbit - Krzysztof Benedyczak. All rights reserved.
 * See LICENCE.txt file for licensing information.
 */
package io.imunity.vaadin.auth.extensions.credreset;

import com.vaadin.flow.component.textfield.TextField;
import io.imunity.vaadin.elements.ComponentWithLabel;

/**
 * Depending on configuration label may be put as placeholder or as a standard caption of this textfield
 */
public class TextFieldWithContextLabel extends TextField
{
	private final boolean showLabelInline;

	public TextFieldWithContextLabel(boolean showLabelInline)
	{
		this.showLabelInline = showLabelInline;
	}
	
	@Override
	public void setLabel(String label)
	{
		String normalizedLabel = ComponentWithLabel.normalizeLabel(label);
		if (showLabelInline)
			setPlaceholder(normalizedLabel);
		else
			super.setLabel(normalizedLabel + ":");
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy