com.vaadin.v7.client.ui.VLabel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vaadin-compatibility-client Show documentation
Show all versions of vaadin-compatibility-client Show documentation
Vaadin 7 compatibility package for Vaadin 8
/*
* Copyright (C) 2000-2024 Vaadin Ltd
*
* This program is available under Vaadin Commercial License and Service Terms.
*
* See for the full
* license.
*/
package com.vaadin.v7.client.ui;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.HTML;
import com.vaadin.client.Util;
import com.vaadin.client.VTooltip;
public class VLabel extends HTML {
public static final String CLASSNAME = "v-label";
private static final String CLASSNAME_UNDEFINED_WIDTH = "v-label-undef-w";
public VLabel() {
super();
setStyleName(CLASSNAME);
sinkEvents(VTooltip.TOOLTIP_EVENTS);
}
public VLabel(String text) {
super(text);
setStyleName(CLASSNAME);
}
@Override
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
if (event.getTypeInt() == Event.ONLOAD) {
Util.notifyParentOfSizeChange(this, true);
event.stopPropagation();
return;
}
}
@Override
public void setWidth(String width) {
super.setWidth(width);
if (width == null || width.equals("")) {
setStyleName(getElement(), CLASSNAME_UNDEFINED_WIDTH, true);
} else {
setStyleName(getElement(), CLASSNAME_UNDEFINED_WIDTH, false);
}
}
// Vaadin 8 does not support IE8, no override for setText
}