Skip to content

Commit

Permalink
Extend javadocs for Text and clarify not-supported API (#8799)
Browse files Browse the repository at this point in the history
Fixes #4882
  • Loading branch information
Denis authored Jul 31, 2020
1 parent 4156e49 commit a153411
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions flow-server/src/main/java/com/vaadin/flow/component/Text.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@

/**
* A component which encapsulates the given text in a text node.
* <p>
* Text node doesn't support setting any attribute or property so you may not
* use Element API (and {@link Text} doesn't provide any such contract) for
* setting attribute/property. It implies that you may not style this component
* as well. Any attempt to set attribute/property value throws an exception. The
* only available API for a {@link Text} component is set a text.
* <p>
* If you need a text component which can be styled then check {@code Span}
* class (from {@code flow-html-components}) module.
*
* @author Vaadin Ltd
* @since 1.0
Expand Down Expand Up @@ -67,6 +76,25 @@ protected <T> void set(PropertyDescriptor<T, ?> descriptor, T value) {
+ "represent an HTML Element but a text Node on the client side.");
}

/**
* The method is not supported for the {@link Text} class.
* <p>
* Always throws an {@link UnsupportedOperationException}.
*
* @throws UnsupportedOperationException
*/
@Override
public void setId(String id) {
super.setId(id);
}

/**
* The method is not supported for the {@link Text} class.
* <p>
* Always throws an {@link UnsupportedOperationException}.
*
* @throws UnsupportedOperationException
*/
@Override
public void setVisible(boolean visible) {
throw new UnsupportedOperationException("Cannot change "
Expand Down

0 comments on commit a153411

Please sign in to comment.