<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.dellroad</groupId>
        <artifactId>dellroad-stuff-vaadin</artifactId>
        <version>3.0.2</version>
    </parent>
    <artifactId>dellroad-stuff-vaadin24</artifactId>
    <name>DellRoad Stuff Vaadin 24 Classes</name>
    <packaging>jar</packaging>
    <description>DellRoad Stuff classes related to Vaadin 24</description>
    <distributionManagement>
        <site>
            <id>${project.artifactId}-site</id>
            <url>file://${project.basedir}/../../site/${project.artifactId}/</url>
        </site>
    </distributionManagement>

    <properties>
        <auto.module.name>org.dellroad.stuff.vaadin24</auto.module.name>
        <vaadin.version>24.3.2</vaadin.version>
    </properties>

    <!-- Import vaadin-bom, which defaults the versions of all Vaadin dependencies for Vaadin ${vaadin.version} -->
    <dependencyManagement>
        <dependencies>

            <!-- Vaadin -->
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-bom</artifactId>
                <version>${vaadin.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <!-- Dependencies -->
    <dependencies>

        <!-- Vaadin -->
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-core</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Sibling JARs -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>dellroad-stuff-main</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- Guava -->
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>

        <!-- Validation API -->
        <dependency>
            <groupId>jakarta.validation</groupId>
            <artifactId>jakarta.validation-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Servlet API -->
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Test -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>dellroad-stuff-test</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>

            <!-- Checkstyle - we need to configure a suppressions file -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-verify</id>
                        <phase>verify</phase>
                        <configuration>
                            <suppressionsLocation>${project.basedir}/src/checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
                            <suppressionsFileExpression>checkstyle.suppressions.file</suppressionsFileExpression>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- Deal with Vaadin Javadoc brokenness -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <offlineLinks>
                        <offlineLink><!-- https://github.com/vaadin/vaadin.com/issues/100 -->
                            <url>https://vaadin.com/api/platform/${vaadin.version}</url>
                            <location>${project.basedir}/src/javadoc/vaadin</location>
                        </offlineLink>
                    </offlineLinks>
                </configuration>
            </plugin>

            <!-- Auto-generate the FieldBuilder.Foo annotations -->
            <plugin>
                <groupId>org.dellroad</groupId>
                <artifactId>dellroad-stuff-fieldbuilder-plugin</artifactId>
                <version>${project.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate-field-builder</goal>
                        </goals>
                        <configuration>
                            <sourceFile>${project.build.sourceDirectory}/org/dellroad/stuff/vaadin24/field/FieldBuilder.java</sourceFile>
                            <requiredType>com.vaadin.flow.component.AbstractField</requiredType>
                            <separatorLine>// EVERYTHING BELOW THIS LINE IS GENERATED</separatorLine>
                            <implementationPropertyName>implementation</implementationPropertyName>
                            <includeStyleProperties>true</includeStyleProperties>
                            <packageRoots>
                                <packageRoot>com.vaadin.flow.component</packageRoot>
                            </packageRoots>
                            <propertyCustomizations>

                                <!-- Configure the default values for some properties that aren't properly handled automatically -->
                                <propertyCustomization>
                                    <methodPattern>.*\.set(ErrorMessage|Label|Pattern|Placeholder|Title|TooltipText|(Date|Time)?AriaLabel|AriaLabelledBy)\(java\.lang\.String\)</methodPattern>
                                    <defaultValue>""</defaultValue>
                                </propertyCustomization>
                                <propertyCustomization>
                                    <methodPattern>public default void com\.vaadin\.flow\.component\.HasSize\.set(Min|Max|)(Height|Width)\(java\.lang\.String\)</methodPattern>
                                    <defaultValue>""</defaultValue>
                                </propertyCustomization>
                                <propertyCustomization>
                                    <method>public default void com.vaadin.flow.component.Focusable.setTabIndex(int)</method>
                                    <defaultValue>0</defaultValue>
                                </propertyCustomization>
                                <propertyCustomization>
                                    <method>public default void com.vaadin.flow.component.HasAriaLabel.setAriaLabel(java.lang.String)</method>
                                    <defaultValue>""</defaultValue>
                                </propertyCustomization>
                                <propertyCustomization>
                                    <method>public default void com.vaadin.flow.component.HasHelper.setHelperText(java.lang.String)</method>
                                    <defaultValue>""</defaultValue>
                                </propertyCustomization>
                                <propertyCustomization>
                                    <method>public default void com.vaadin.flow.component.textfield.HasAutocapitalize.setAutocapitalize(com.vaadin.flow.component.textfield.Autocapitalize)</method>
                                    <defaultValue>com.vaadin.flow.component.textfield.Autocapitalize.NONE</defaultValue>
                                </propertyCustomization>
                                <propertyCustomization>
                                    <method>public default void com.vaadin.flow.component.textfield.HasAutocomplete.setAutocomplete(com.vaadin.flow.component.textfield.Autocomplete)</method>
                                    <defaultValue>com.vaadin.flow.component.textfield.Autocomplete.ON</defaultValue>
                                </propertyCustomization>
                                <propertyCustomization>
                                    <method>public default void com.vaadin.flow.data.value.HasValueChangeMode.setValueChangeTimeout(int)</method>
                                    <defaultValue>com.vaadin.flow.data.value.HasValueChangeMode.DEFAULT_CHANGE_TIMEOUT</defaultValue>
                                </propertyCustomization>
                                <propertyCustomization>
                                    <method>public void com.vaadin.flow.component.Component.setId(java.lang.String)</method>
                                    <defaultValue>""</defaultValue>
                                </propertyCustomization>
                                <propertyCustomization>
                                    <method>public void com.vaadin.flow.component.checkbox.Checkbox.setLabelAsHtml(java.lang.String)</method>
                                    <defaultValue>""</defaultValue>
                                </propertyCustomization>
                                <propertyCustomization>
                                    <method>public void com.vaadin.flow.component.datepicker.DatePicker.setName(java.lang.String)</method>
                                    <defaultValue>""</defaultValue>
                                </propertyCustomization>
                                <propertyCustomization>
                                    <method>public void com.vaadin.flow.component.datetimepicker.DateTimePicker.setDatePlaceholder(java.lang.String)</method>
                                    <defaultValue>""</defaultValue>
                                </propertyCustomization>
                                <propertyCustomization>
                                    <method>public void com.vaadin.flow.component.datetimepicker.DateTimePicker.setTimePlaceholder(java.lang.String)</method>
                                    <defaultValue>""</defaultValue>
                                </propertyCustomization>
                                <propertyCustomization>
                                    <method>public void com.vaadin.flow.component.textfield.AbstractNumberField.setHasControls(boolean)</method>
                                    <defaultValue>false</defaultValue>
                                </propertyCustomization>
                                <propertyCustomization>
                                    <methodPattern>public (default )?void com\.vaadin\.flow\.component\..*\.setManualValidation\(boolean\)</methodPattern>
                                    <defaultValue>false</defaultValue>
                                </propertyCustomization>

                                <!-- Customizations needed for CustomField because it's abstract -->
                                <propertyCustomization>
                                    <className>com.vaadin.flow.component.customfield.CustomField</className>
                                    <method>public default void com.vaadin.flow.component.HasEnabled.setEnabled(boolean)</method>
                                    <defaultValue>true</defaultValue>
                                </propertyCustomization>
                                <propertyCustomization>
                                    <className>com.vaadin.flow.component.customfield.CustomField</className>
                                    <method>public default void com.vaadin.flow.component.HasValueAndElement.setReadOnly(boolean)</method>
                                    <defaultValue>false</defaultValue>
                                </propertyCustomization>
                                <propertyCustomization>
                                    <className>com.vaadin.flow.component.customfield.CustomField</className>
                                    <method>public default void com.vaadin.flow.component.HasValueAndElement.setRequiredIndicatorVisible(boolean)</method>
                                    <defaultValue>false</defaultValue>
                                </propertyCustomization>
                                <propertyCustomization>
                                    <className>com.vaadin.flow.component.customfield.CustomField</className>
                                    <method>public void com.vaadin.flow.component.Component.setVisible(boolean)</method>
                                    <defaultValue>true</defaultValue>
                                </propertyCustomization>
                            </propertyCustomizations>

                            <!-- Exclude the GeneratedFoo classes and the commercial widgets -->
                            <excludeClasses>
                                <excludeClass>
                                    <classNamePattern>com\.vaadin\.flow\.component\..*\.Generated[\p{Alpha}]+</classNamePattern>
                                </excludeClass>
                                <excludeClass>
                                    <className>com.vaadin.flow.component.richtexteditor.RichTextEditor</className>
                                </excludeClass>
                            </excludeClasses>

                            <!-- Exclude certain methods that don't work or conflict with (i.e., have the same name as) other methods we want to use -->
                            <excludeMethods>
                                <excludeMethod>
                                    <method>public default void com.vaadin.flow.component.HasTheme.setThemeName(java.lang.String)</method>
                                </excludeMethod>
                                <excludeMethod>
                                    <method>public void com.vaadin.flow.component.datetimepicker.DateTimePicker.setThemeName(java.lang.String)</method>
                                </excludeMethod>
                                <excludeMethod>
                                    <methodPattern>.*\.setInvalid\(boolean\)</methodPattern>
                                </excludeMethod>
                                <excludeMethod>
                                    <methodPattern>.*\.setItems\((java\.util\.stream\.Stream|java\.util\.Collection|java.lang.Object\[\]|com\.vaadin\.flow\.data\.provider\.CallbackDataProvider\$FetchCallback)\)</methodPattern>
                                </excludeMethod>
                                <excludeMethod>
                                    <methodPattern>.*\.setValue\(.*\)</methodPattern>
                                </excludeMethod>
                            </excludeMethods>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>com.vaadin</groupId>
                        <artifactId>vaadin-core</artifactId>
                        <version>${vaadin.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

</project>
