List of usage examples for com.google.gwt.aria.client Property LABELLEDBY
Attribute LABELLEDBY
To view the source code for com.google.gwt.aria.client Property LABELLEDBY.
Click Source Link
From source file:net.sf.mmm.client.ui.gwt.widgets.LabelWidget.java
License:Apache License
/** * This method sets the {@link Widget} labelled by this {@link LabelWidget}. You should always associate the * input widget with a {@link LabelWidget} via this method for advanced usability and * {@link net.sf.mmm.util.lang.api.concern.Accessibility}. <br> * <b>ATTENTION:</b><br> * This method creates a bidirectional connection of this {@link LabelWidget} and the given * <code>labelledWidget</code> via {@link String} attributes pointing to each others IDs. If an ID is * changed afterwards this connection will break. If you are using this classes directly and not via * <code>UiWidgets</code> you have to take care of this and re-invoke this method in case an ID changes. * /*from w w w . j a va 2 s . c om*/ * @see LabelElement#setHtmlFor(String) * * @param labelledWidget is the {@link Widget} labelled by this {@link LabelWidget}. */ public void setLabelledWidget(Widget labelledWidget) { GwtUtil gwtUtil = GwtUtil.getInstance(); String widgetId = gwtUtil.getId(labelledWidget); getLabelElement().setHtmlFor(widgetId); String labelId = gwtUtil.getId(this); Property.LABELLEDBY.set(labelledWidget.getElement(), Id.of(labelId)); }