-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mixins and javadocs cleaned up (#315)
#313 unified mixin names, added them to missing components added some javadocs in the process as well
- Loading branch information
1 parent
9f58b85
commit 366e878
Showing
35 changed files
with
392 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
demo-v14/src/main/java/org/vaadin/miki/demo/builders/HasTitleBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.vaadin.miki.demo.builders; | ||
|
||
import com.vaadin.flow.component.Component; | ||
import org.vaadin.miki.demo.ContentBuilder; | ||
import org.vaadin.miki.demo.Order; | ||
import org.vaadin.miki.markers.HasTitle; | ||
import org.vaadin.miki.superfields.text.SuperTextField; | ||
|
||
import java.util.function.Consumer; | ||
|
||
/** | ||
* Builds content for anything that implements {@link HasTitle}. | ||
* @author miki | ||
* @since 2021-09-13 | ||
*/ | ||
@Order(118) | ||
public class HasTitleBuilder implements ContentBuilder<HasTitle> { | ||
|
||
@Override | ||
public void buildContent(HasTitle component, Consumer<Component[]> callback) { | ||
final SuperTextField title = new SuperTextField("Title (tooltip) of the component: "); | ||
title.addValueChangeListener(event -> component.setTitle(event.getValue())); | ||
callback.accept(new Component[]{title}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
superfields/src/main/java/org/vaadin/miki/markers/HasNullValueOptionallyAllowed.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.vaadin.miki.markers; | ||
|
||
import com.vaadin.flow.component.HasValue; | ||
|
||
/** | ||
* Marker interface for descendants of {@link HasValue} that may optionally allow {@code null} as value. | ||
* By default, objects should not allow {@code null}s. | ||
* In general, when this feature is turned on and {@link #setValue(Object)} is called with {@code null}, the | ||
* object should never throw a {@link NullPointerException}. | ||
* | ||
* @param <E> Event type. | ||
* @param <V> Value type. | ||
* | ||
* @author miki | ||
* @since 2021-09-13 | ||
*/ | ||
public interface HasNullValueOptionallyAllowed<E extends HasValue.ValueChangeEvent<V>, V> extends HasValue<E, V> { | ||
|
||
/** | ||
* Checks whether {@code null} is allowed as a value of the component. | ||
* @return Whether {@code null} is allowed as a value. Should default to {@code false}. | ||
*/ | ||
boolean isNullValueAllowed(); | ||
|
||
/** | ||
* Sets allowance of {@code null} as this component's value. | ||
* @param allowingNullValue Whether to allow {@code null} as a value. | ||
*/ | ||
void setNullValueAllowed(boolean allowingNullValue); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 0 additions & 41 deletions
41
superfields/src/main/java/org/vaadin/miki/markers/WithNullValueOptionallyAllowed.java
This file was deleted.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
superfields/src/main/java/org/vaadin/miki/markers/WithNullValueOptionallyAllowedMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.vaadin.miki.markers; | ||
|
||
import com.vaadin.flow.component.HasValue; | ||
|
||
/** | ||
* Mixin interface for {@link HasNullValueOptionallyAllowed}. | ||
* | ||
* @author miki | ||
* @since 2020-06-09 | ||
*/ | ||
public interface WithNullValueOptionallyAllowedMixin<SELF extends HasNullValueOptionallyAllowed<E, V>, E extends HasValue.ValueChangeEvent<V>, V> extends HasNullValueOptionallyAllowed<E, V> { | ||
|
||
/** | ||
* Chains {@link #setNullValueAllowed(boolean)} and returns itself. | ||
* @param allowingNullValue Whether to allow {@code null} as a value. | ||
* @return This. | ||
* @see #setNullValueAllowed(boolean) | ||
*/ | ||
@SuppressWarnings("unchecked") | ||
default SELF withNullValueAllowed(boolean allowingNullValue) { | ||
this.setNullValueAllowed(allowingNullValue); | ||
return (SELF)this; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.