Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#513 #514 done #515

Merged
merged 2 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>pl.unforgiven</groupId>
<artifactId>superfields-parent</artifactId>
Expand All @@ -9,14 +10,15 @@
<module>demo-v24</module>
</modules>
<name>SuperFields - Root project for SuperFields</name>
<description>Root project for SuperFields. Includes basic dependencies, repositories and other configuration.</description>
<description>Root project for SuperFields. Includes basic dependencies, repositories and other configuration.
</description>
<packaging>pom</packaging>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<vaadin.version>24.3.0</vaadin.version>
<vaadin.version>24.3.12</vaadin.version>
</properties>

</project>
2 changes: 1 addition & 1 deletion superfields/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<vaadin.version>24.3.0</vaadin.version>
<vaadin.version>24.3.12</vaadin.version>
<maven.jar.plugin.version>3.1.2</maven.jar.plugin.version>
<javadoc.plugin.version>3.4.1</javadoc.plugin.version>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

/**
* An extension of {@link TextArea} with some useful features.
*
* @author miki
* @since 2020-06-01
*/
Expand All @@ -36,105 +37,105 @@
@CssImport(value = "./styles/label-positions.css", themeFor = "super-text-area")
@SuppressWarnings("squid:S110") // there is no way to reduce the number of parent classes
public class SuperTextArea extends TextArea implements CanSelectText, TextSelectionNotifier<SuperTextArea>,
CanModifyText, WithRequiredMixin<SuperTextArea>, WithLabelPositionableMixin<SuperTextArea>,
WithIdMixin<SuperTextArea>, WithLabelMixin<SuperTextArea>, WithPlaceholderMixin<SuperTextArea>,
WithReceivingSelectionEventsFromClientMixin<SuperTextArea>, WithClearButtonMixin<SuperTextArea>,
WithHelperMixin<SuperTextArea>, WithHelperPositionableMixin<SuperTextArea>,
WithValueMixin<AbstractField.ComponentValueChangeEvent<TextArea, String>, String, SuperTextArea>, WithTooltipMixin<SuperTextArea> {

private final TextModificationDelegate<SuperTextArea> delegate = new TextModificationDelegate<>(this, this.getEventBus(), this::getValue);

public SuperTextArea() {
}

public SuperTextArea(String label) {
super(label);
}

public SuperTextArea(String label, String placeholder) {
super(label, placeholder);
}

public SuperTextArea(String label, String initialValue, String placeholder) {
super(label, initialValue, placeholder);
}

public SuperTextArea(ValueChangeListener<? super ComponentValueChangeEvent<TextArea, String>> listener) {
super(listener);
}

public SuperTextArea(String label, ValueChangeListener<? super ComponentValueChangeEvent<TextArea, String>> listener) {
super(label, listener);
}

public SuperTextArea(String label, String initialValue, ValueChangeListener<? super ComponentValueChangeEvent<TextArea, String>> listener) {
super(label, initialValue, listener);
}

@Override
protected void onAttach(AttachEvent attachEvent) {
this.delegate.onAttach(attachEvent, super::onAttach);
}

@Override
protected void onDetach(DetachEvent detachEvent) {
this.delegate.onDetach(detachEvent, super::onDetach);
}

@Override
public boolean isReceivingSelectionEventsFromClient() {
return this.delegate.isReceivingSelectionEventsFromClient();
}

@Override
public void setReceivingSelectionEventsFromClient(boolean receivingSelectionEventsFromClient) {
this.delegate.setReceivingSelectionEventsFromClient(receivingSelectionEventsFromClient);
}

@Override
public void selectAll() {
this.delegate.selectAll();
}

@Override
public void selectNone() {
this.delegate.selectNone();
}

@Override
public void select(int from, int to) {
this.delegate.select(from, to);
}

@Override
public void modifyText(String replacement, int from, int to) {
this.delegate.modifyText(replacement, from, to);
}

@Override
public Registration addTextSelectionListener(TextSelectionListener<SuperTextArea> listener) {
return this.delegate.addTextSelectionListener(listener);
}

@ClientCallable
private void selectionChanged(int start, int end, String selection) {
this.delegate.fireTextSelectionEvent(true, start, end, selection);
}

@ClientCallable
private void reinitialiseListening() {
this.delegate.reinitialiseListeners();
}

@SuppressWarnings("squid:S1185") // removing this method makes the class impossible to compile due to missing methods
@Override
public void setClearButtonVisible(boolean clearButtonVisible) {
super.setClearButtonVisible(clearButtonVisible);
}

@SuppressWarnings("squid:S1185") // same comment as above
@Override
public boolean isClearButtonVisible() {
return super.isClearButtonVisible();
}
CanModifyText, WithRequiredMixin<SuperTextArea>, WithLabelPositionableMixin<SuperTextArea>,
WithIdMixin<SuperTextArea>, WithLabelMixin<SuperTextArea>, WithPlaceholderMixin<SuperTextArea>,
WithReceivingSelectionEventsFromClientMixin<SuperTextArea>, WithClearButtonMixin<SuperTextArea>,
WithHelperMixin<SuperTextArea>, WithHelperPositionableMixin<SuperTextArea>,
WithValueMixin<AbstractField.ComponentValueChangeEvent<TextArea, String>, String, SuperTextArea>, WithTooltipMixin<SuperTextArea> {

private final TextModificationDelegate<SuperTextArea> delegate = new TextModificationDelegate<>(this, this.getEventBus(), this::getValue);

public SuperTextArea() {
}

public SuperTextArea(String label) {
super(label);
}

public SuperTextArea(String label, String placeholder) {
super(label, placeholder);
}

public SuperTextArea(String label, String initialValue, String placeholder) {
super(label, initialValue, placeholder);
}

public SuperTextArea(ValueChangeListener<? super ComponentValueChangeEvent<TextArea, String>> listener) {
super(listener);
}

public SuperTextArea(String label, ValueChangeListener<? super ComponentValueChangeEvent<TextArea, String>> listener) {
super(label, listener);
}

public SuperTextArea(String label, String initialValue, ValueChangeListener<? super ComponentValueChangeEvent<TextArea, String>> listener) {
super(label, initialValue, listener);
}

@Override
protected void onAttach(AttachEvent attachEvent) {
this.delegate.onAttach(attachEvent, super::onAttach);
}

@Override
protected void onDetach(DetachEvent detachEvent) {
this.delegate.onDetach(detachEvent, super::onDetach);
}

@Override
public boolean isReceivingSelectionEventsFromClient() {
return this.delegate.isReceivingSelectionEventsFromClient();
}

@Override
public void setReceivingSelectionEventsFromClient(boolean receivingSelectionEventsFromClient) {
this.delegate.setReceivingSelectionEventsFromClient(receivingSelectionEventsFromClient);
}

@Override
public void selectAll() {
this.delegate.selectAll();
}

@Override
public void selectNone() {
this.delegate.selectNone();
}

@Override
public void select(int from, int to) {
this.delegate.select(from, to);
}

@Override
public void modifyText(String replacement, int from, int to) {
this.delegate.modifyText(replacement, from, to);
}

@Override
public Registration addTextSelectionListener(TextSelectionListener<SuperTextArea> listener) {
return this.delegate.addTextSelectionListener(listener);
}

@ClientCallable
private void selectionChanged(int start, int end, String selection) {
this.delegate.fireTextSelectionEvent(true, start, end, selection);
}

@ClientCallable
private void performDelayedInitialisation() {
this.delegate.reinitialiseListeners();
}

@SuppressWarnings("squid:S1185") // removing this method makes the class impossible to compile due to missing methods
@Override
public void setClearButtonVisible(boolean clearButtonVisible) {
super.setClearButtonVisible(clearButtonVisible);
}

@SuppressWarnings("squid:S1185") // same comment as above
@Override
public boolean isClearButtonVisible() {
return super.isClearButtonVisible();
}
}
Loading
Loading