├── .github ├── .lycheeignore ├── ISSUE_TEMPLATE │ ├── config.yml │ ├── question.yml │ ├── enhancement.yml │ └── bug_report.yml ├── workflows │ ├── sync-labels.yml │ ├── broken-links.yml │ ├── test-deploy.yml │ ├── check-build.yml │ ├── release.yml │ └── update-from-template.yml └── labels.yml ├── assets ├── demo.avif └── demo.png ├── .idea ├── codeStyles │ ├── codeStyleConfig.xml │ └── Project.xml ├── externalDependencies.xml ├── inspectionProfiles │ └── Project_Default.xml ├── PMDPlugin.xml ├── saveactions_settings.xml └── checkstyle-idea.xml ├── .mvn └── wrapper │ └── maven-wrapper.properties ├── SECURITY.md ├── .config ├── checkstyle │ ├── suppressions.xml │ └── checkstyle.xml └── pmd │ └── java │ └── ruleset.xml ├── .gitattributes ├── vaadin-editable-label-demo ├── src │ └── main │ │ ├── resources │ │ └── application.yml │ │ └── java │ │ └── software │ │ └── xdev │ │ └── vaadin │ │ ├── Application.java │ │ └── editable_label │ │ └── HomeView.java └── pom.xml ├── vaadin-editable-label ├── src │ └── main │ │ ├── resources │ │ └── META-INF │ │ │ └── resources │ │ │ └── frontend │ │ │ └── styles │ │ │ └── editableLabel.css │ │ └── java │ │ └── software │ │ └── xdev │ │ └── vaadin │ │ └── editable_label │ │ ├── EditableLabelStyles.java │ │ ├── EditableLabel.java │ │ ├── predefined │ │ ├── EditableLabelTextArea.java │ │ ├── EditableLabelTextField.java │ │ ├── EditableLabelNumberField.java │ │ ├── EditableLabelBigDecimalField.java │ │ ├── EditableLabelDatePicker.java │ │ └── EditableLabelComboBox.java │ │ └── AbstractEditableLabel.java └── pom.xml ├── renovate.json5 ├── .run └── Run Demo.run.xml ├── CHANGELOG.md ├── .gitignore ├── README.md ├── pom.xml ├── CONTRIBUTING.md ├── mvnw.cmd ├── LICENSE └── mvnw /.github/.lycheeignore: -------------------------------------------------------------------------------- 1 | # Ignorefile for broken link check 2 | localhost 3 | mvnrepository.com 4 | -------------------------------------------------------------------------------- /assets/demo.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdev-software/vaadin-editable-label/HEAD/assets/demo.avif -------------------------------------------------------------------------------- /assets/demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdev-software/vaadin-editable-label/HEAD/assets/demo.png -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | wrapperVersion=3.3.4 2 | distributionType=only-script 3 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip 4 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Reporting a Vulnerability 4 | 5 | Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/vaadin-editable-label/security/advisories/new). 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | contact_links: 2 | - name: 💬 Contact support 3 | url: https://xdev.software/en/services/support 4 | about: "If you need support as soon as possible or/and you can't wait for any pull request" 5 | -------------------------------------------------------------------------------- /.config/checkstyle/suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Force sh files to have LF 5 | *.sh text eol=lf 6 | 7 | # Force MVN Wrapper Linux files LF 8 | mvnw text eol=lf 9 | maven-wrapper.properties text eol=lf 10 | -------------------------------------------------------------------------------- /.idea/externalDependencies.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /vaadin-editable-label-demo/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | vaadin: 2 | allowed-packages: software/xdev,com/vaadin/flow 3 | devmode: 4 | usageStatistics: 5 | enabled: false 6 | 7 | spring: 8 | devtools: 9 | restart: 10 | poll-interval: 2s 11 | quiet-period: 1s 12 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/PMDPlugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 14 | 16 | -------------------------------------------------------------------------------- /vaadin-editable-label/src/main/resources/META-INF/resources/frontend/styles/editableLabel.css: -------------------------------------------------------------------------------- 1 | .editable-label-container { 2 | display: flex; 3 | align-items: center; 4 | } 5 | 6 | .editable-label-button { 7 | margin: 0; 8 | padding: 0; 9 | cursor: pointer; 10 | } 11 | 12 | .editable-label-edit-button { 13 | display: none; 14 | height: var(--lumo-size-xs); 15 | width: var(--lumo-size-xs); 16 | } 17 | 18 | .editable-label-container:hover>.editable-label-edit-button, .editable-label-edit-button-always-visible { 19 | display: block; 20 | } 21 | -------------------------------------------------------------------------------- /.github/workflows/sync-labels.yml: -------------------------------------------------------------------------------- 1 | name: Sync labels 2 | 3 | on: 4 | push: 5 | branches: develop 6 | paths: 7 | - .github/labels.yml 8 | 9 | workflow_dispatch: 10 | 11 | permissions: 12 | issues: write 13 | 14 | jobs: 15 | labels: 16 | runs-on: ubuntu-latest 17 | timeout-minutes: 10 18 | steps: 19 | - uses: actions/checkout@v5 20 | with: 21 | sparse-checkout: .github/labels.yml 22 | 23 | - uses: EndBug/label-sync@52074158190acb45f3077f9099fea818aa43f97a # v2 24 | with: 25 | config-file: .github/labels.yml 26 | -------------------------------------------------------------------------------- /renovate.json5: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "rebaseWhen": "behind-base-branch", 4 | "packageRules": [ 5 | { 6 | "description": "Ignore project internal dependencies", 7 | "packagePattern": "^software.xdev:vaadin-editable-label", 8 | "datasources": [ 9 | "maven" 10 | ], 11 | "enabled": false 12 | }, 13 | { 14 | "description": "Group net.sourceforge.pmd", 15 | "matchPackagePatterns": [ 16 | "^net.sourceforge.pmd" 17 | ], 18 | "datasources": [ 19 | "maven" 20 | ], 21 | "groupName": "net.sourceforge.pmd" 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /.run/Run Demo.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /vaadin-editable-label-demo/src/main/java/software/xdev/vaadin/Application.java: -------------------------------------------------------------------------------- 1 | package software.xdev.vaadin; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 6 | 7 | import com.vaadin.flow.component.page.AppShellConfigurator; 8 | import com.vaadin.flow.component.page.Push; 9 | import com.vaadin.flow.spring.annotation.EnableVaadin; 10 | 11 | 12 | @SuppressWarnings({"checkstyle:HideUtilityClassConstructor", "PMD.UseUtilityClass"}) 13 | @SpringBootApplication 14 | @EnableVaadin 15 | @Push 16 | public class Application extends SpringBootServletInitializer implements AppShellConfigurator 17 | { 18 | public static void main(final String[] args) 19 | { 20 | SpringApplication.run(Application.class, args); 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /.idea/saveactions_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 22 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 2.1.3 2 | * Cache `DateTimeFormatter` if possible 3 | * Updated dependencies 4 | 5 | # 2.1.2 6 | * Migrated deployment to _Sonatype Maven Central Portal_ [#155](https://github.com/xdev-software/standard-maven-template/issues/155) 7 | * Updated dependencies 8 | 9 | # 2.1.1 10 | * Fix naming so that Vaadin Directory sync works [#318](https://github.com/xdev-software/vaadin-addon-template/issues/318) 11 | * Updated dependencies 12 | 13 | # 2.1.0 14 | * Updated to Vaadin 24.4 15 | 16 | # 2.0.1 17 | * ⚠️ GroupId changed from ``com.xdev-software`` to ``software.xdev`` 18 | * Replaced deprecated ``Label``-Vaadin component with ``Span`` 19 | * Updated dependencies 20 | 21 | # 2.0.0 22 | ⚠️This release contains breaking changes 23 | 24 | * Adds support for Vaadin 24+, drops support for Vaadin 23
25 | If you are still using Vaadin 23, use the ``1.x`` versions. 26 | * Requires Java 17+ 27 | * Updated dependencies 28 | 29 | 30 | # 1.0.1 31 | * Updated dependencies 32 | 33 | # 1.0.0 34 | Initial release 35 | -------------------------------------------------------------------------------- /.idea/checkstyle-idea.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11.0.0 5 | JavaOnlyWithTests 6 | true 7 | true 8 | 12 | 19 | 20 | -------------------------------------------------------------------------------- /.github/labels.yml: -------------------------------------------------------------------------------- 1 | # Default 2 | ## Required for template 3 | - name: bug 4 | description: "Something isn't working" 5 | color: 'd73a4a' 6 | - name: enhancement 7 | description: New feature or request 8 | color: '#a2eeef' 9 | - name: question 10 | description: Information is requested 11 | color: '#d876e3' 12 | ## Others 13 | - name: duplicate 14 | description: This already exists 15 | color: '#cfd3d7' 16 | - name: good first issue 17 | description: Good for newcomers 18 | color: '#7057ff' 19 | - name: help wanted 20 | description: Extra attention is needed 21 | color: '#008672' 22 | - name: invalid 23 | description: "This doesn't seem right" 24 | color: '#e4e669' 25 | # Custom 26 | - name: automated 27 | description: Created by an automation 28 | color: '#000000' 29 | - name: "can't reproduce" 30 | color: '#e95f2c' 31 | - name: customer-requested 32 | description: Was requested by a customer of us 33 | color: '#068374' 34 | - name: stale 35 | color: '#ededed' 36 | - name: waiting-for-response 37 | description: If no response is received after a certain time the issue will be closed 38 | color: '#202020' 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.yml: -------------------------------------------------------------------------------- 1 | name: ❓ Question 2 | description: Ask a question 3 | labels: [question] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | Thanks for taking the time to fill out this form! 9 | 10 | - type: checkboxes 11 | id: checklist 12 | attributes: 13 | label: "Checklist" 14 | options: 15 | - label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/vaadin-editable-label/issues) or [closed](https://github.com/xdev-software/vaadin-editable-label/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to." 16 | required: true 17 | - label: "I have taken the time to fill in all the required details. I understand that the question will be dismissed otherwise." 18 | required: true 19 | 20 | - type: textarea 21 | id: what-is-the-question 22 | attributes: 23 | label: What is/are your question(s)? 24 | validations: 25 | required: true 26 | 27 | - type: textarea 28 | id: additional-information 29 | attributes: 30 | label: Additional information 31 | description: "Any other information you'd like to include - for instance logs, screenshots, etc." 32 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/enhancement.yml: -------------------------------------------------------------------------------- 1 | name: ✨ Feature/Enhancement 2 | description: Suggest a new feature or enhancement 3 | labels: [enhancement] 4 | type: feature 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Thank you for suggesting a new feature/enhancement. 10 | 11 | - type: checkboxes 12 | id: checklist 13 | attributes: 14 | label: "Checklist" 15 | options: 16 | - label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/vaadin-editable-label/issues) or [closed](https://github.com/xdev-software/vaadin-editable-label/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to." 17 | required: true 18 | - label: "I have taken the time to fill in all the required details. I understand that the feature request will be dismissed otherwise." 19 | required: true 20 | - label: "This issue contains only one feature request/enhancement." 21 | required: true 22 | 23 | - type: textarea 24 | id: description 25 | attributes: 26 | label: Description 27 | validations: 28 | required: true 29 | 30 | - type: textarea 31 | id: additional-information 32 | attributes: 33 | label: Additional information 34 | -------------------------------------------------------------------------------- /vaadin-editable-label/src/main/java/software/xdev/vaadin/editable_label/EditableLabelStyles.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2023 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.editable_label; 17 | 18 | /** 19 | * Styles for the {@link AbstractEditableLabel} 20 | */ 21 | public final class EditableLabelStyles 22 | { 23 | private EditableLabelStyles() 24 | { 25 | } 26 | 27 | public static final String LOCATION = "./styles/editableLabel.css"; 28 | 29 | public static final String CONTAINER = "editable-label-container"; 30 | public static final String BUTTON = "editable-label-button"; 31 | public static final String EDIT_BUTTON = "editable-label-edit-button"; 32 | public static final String EDIT_BUTTON_ALWAYS_VISIBLE = "editable-label-edit-button-always-visible"; 33 | public static final String LABEL = "editable-label-label"; 34 | public static final String EDITOR = "editable-label-editor"; 35 | } 36 | -------------------------------------------------------------------------------- /.github/workflows/broken-links.yml: -------------------------------------------------------------------------------- 1 | name: Broken links 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | - cron: "23 23 * * 0" 7 | 8 | permissions: 9 | issues: write 10 | 11 | jobs: 12 | link-checker: 13 | runs-on: ubuntu-latest 14 | timeout-minutes: 15 15 | steps: 16 | - uses: actions/checkout@v5 17 | 18 | - run: mv .github/.lycheeignore .lycheeignore 19 | 20 | - name: Link Checker 21 | id: lychee 22 | uses: lycheeverse/lychee-action@885c65f3dc543b57c898c8099f4e08c8afd178a2 # v2 23 | with: 24 | fail: false # Don't fail on broken links, create an issue instead 25 | 26 | - name: Find already existing issue 27 | id: find-issue 28 | run: | 29 | echo "number=$(gh issue list -l 'bug' -l 'automated' -L 1 -S 'in:title "Link Checker Report"' -s 'open' --json 'number' --jq '.[].number')" >> $GITHUB_OUTPUT 30 | env: 31 | GH_TOKEN: ${{ github.token }} 32 | 33 | - name: Close issue if everything is fine 34 | if: steps.lychee.outputs.exit_code == 0 && steps.find-issue.outputs.number != '' 35 | run: gh issue close -r 'not planned' ${{ steps.find-issue.outputs.number }} 36 | env: 37 | GH_TOKEN: ${{ github.token }} 38 | 39 | - name: Create Issue From File 40 | if: steps.lychee.outputs.exit_code != 0 41 | uses: peter-evans/create-issue-from-file@fca9117c27cdc29c6c4db3b86c48e4115a786710 # v6 42 | with: 43 | issue-number: ${{ steps.find-issue.outputs.number }} 44 | title: Link Checker Report 45 | content-filepath: ./lychee/out.md 46 | labels: bug, automated 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Maven 2 | target/ 3 | dependency-reduced-pom.xml 4 | 5 | # Maven Wrapper 6 | .mvn/wrapper/maven-wrapper.jar 7 | 8 | # Maven Flatten Plugin 9 | .flattened-pom.xml 10 | 11 | # Compiled class file 12 | *.class 13 | 14 | # Log file 15 | *.log 16 | 17 | # Package/Binary Files don't belong into a git repo 18 | *.jar 19 | *.war 20 | *.ear 21 | *.zip 22 | *.tar.gz 23 | *.dll 24 | *.exe 25 | *.bin 26 | 27 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 28 | hs_err_pid* 29 | 30 | # Eclipse 31 | .metadata 32 | .settings 33 | .classpath 34 | .project 35 | 36 | #vaadin/node webpack/frontend stuff 37 | # Ignore Node 38 | node/ 39 | 40 | # The following files are generated/updated by vaadin-maven-plugin 41 | node_modules/ 42 | 43 | # Vaadin 44 | package.json 45 | package-lock.json 46 | webpack.generated.js 47 | webpack.config.js 48 | tsconfig.json 49 | types.d.ts 50 | vite.config.ts 51 | vite.generated.ts 52 | **/src/main/frontend/generated/ 53 | **/src/main/frontend/index.html 54 | **/src/main/bundles/ 55 | *.lock 56 | 57 | 58 | # == IntelliJ == 59 | *.iml 60 | *.ipr 61 | 62 | # Some files are user/installation independent and are used for configuring the IDE 63 | # See also https://stackoverflow.com/a/35279076 64 | 65 | .idea/* 66 | !.idea/saveactions_settings.xml 67 | !.idea/checkstyle-idea.xml 68 | !.idea/externalDependencies.xml 69 | !.idea/PMDPlugin.xml 70 | 71 | !.idea/inspectionProfiles/ 72 | .idea/inspectionProfiles/* 73 | !.idea/inspectionProfiles/Project_Default.xml 74 | 75 | !.idea/codeStyles/ 76 | .idea/codeStyles/* 77 | !.idea/codeStyles/codeStyleConfig.xml 78 | !.idea/codeStyles/Project.xml 79 | 80 | .run/* 81 | -------------------------------------------------------------------------------- /vaadin-editable-label/src/main/java/software/xdev/vaadin/editable_label/EditableLabel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2023 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.editable_label; 17 | 18 | import java.util.function.Consumer; 19 | 20 | import com.vaadin.flow.component.Component; 21 | import com.vaadin.flow.component.HasSize; 22 | import com.vaadin.flow.component.HasStyle; 23 | import com.vaadin.flow.component.HasValue; 24 | 25 | 26 | /** 27 | * The default simple implementation of {@link AbstractEditableLabel}. 28 | * 29 | * @param value type which is handled through this component 30 | * @param Vaadin-{@link Component} to edit the value 31 | * 32 | * @author AB 33 | * @author JR 34 | */ 35 | public class EditableLabel, V> 36 | extends AbstractEditableLabel, C, V> 37 | { 38 | public EditableLabel(final C editor) 39 | { 40 | this(editor, null); 41 | } 42 | 43 | public EditableLabel(final C editor, final Consumer> additionalInitActions) 44 | { 45 | super(editor, additionalInitActions); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /.github/workflows/test-deploy.yml: -------------------------------------------------------------------------------- 1 | name: Test Deployment 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | env: 7 | PRIMARY_MAVEN_MODULE: ${{ github.event.repository.name }} 8 | 9 | jobs: 10 | publish-maven: 11 | runs-on: ubuntu-latest 12 | timeout-minutes: 60 13 | steps: 14 | - uses: actions/checkout@v5 15 | 16 | - name: Set up JDK 17 | uses: actions/setup-java@v5 18 | with: # running setup-java overwrites the settings.xml 19 | distribution: 'temurin' 20 | java-version: '17' 21 | server-id: github-central 22 | server-password: PACKAGES_CENTRAL_TOKEN 23 | gpg-passphrase: MAVEN_GPG_PASSPHRASE 24 | gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Only import once 25 | 26 | - name: Publish to GitHub Packages Central 27 | run: ../mvnw -B deploy -P publish -DskipTests -DaltDeploymentRepository=github-central::https://maven.pkg.github.com/xdev-software/central 28 | working-directory: ${{ env.PRIMARY_MAVEN_MODULE }} 29 | env: 30 | PACKAGES_CENTRAL_TOKEN: ${{ secrets.PACKAGES_CENTRAL_TOKEN }} 31 | MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} 32 | 33 | - name: Set up JDK 34 | uses: actions/setup-java@v5 35 | with: # running setup-java again overwrites the settings.xml 36 | distribution: 'temurin' 37 | java-version: '17' 38 | server-id: sonatype-central-portal 39 | server-username: MAVEN_CENTRAL_USERNAME 40 | server-password: MAVEN_CENTRAL_TOKEN 41 | gpg-passphrase: MAVEN_GPG_PASSPHRASE 42 | 43 | - name: Publish to Central Portal 44 | run: ../mvnw -B deploy -P publish,publish-sonatype-central-portal -DskipTests 45 | working-directory: ${{ env.PRIMARY_MAVEN_MODULE }} 46 | env: 47 | MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_USERNAME }} 48 | MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_TOKEN }} 49 | MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} 50 | -------------------------------------------------------------------------------- /vaadin-editable-label/src/main/java/software/xdev/vaadin/editable_label/predefined/EditableLabelTextArea.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2023 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.editable_label.predefined; 17 | 18 | import java.util.function.Consumer; 19 | 20 | import com.vaadin.flow.component.textfield.TextArea; 21 | import com.vaadin.flow.component.textfield.TextAreaVariant; 22 | 23 | import software.xdev.vaadin.editable_label.AbstractEditableLabel; 24 | 25 | 26 | /** 27 | * Offers a simple label which can be edited as a {@link TextArea}. 28 | * 29 | * @author JR 30 | * @author AB 31 | */ 32 | public class EditableLabelTextArea 33 | extends AbstractEditableLabel 34 | { 35 | public EditableLabelTextArea() 36 | { 37 | this(new TextArea()); 38 | } 39 | 40 | public EditableLabelTextArea(final TextArea editor) 41 | { 42 | this(editor, null); 43 | } 44 | 45 | public EditableLabelTextArea(final Consumer additionalInitActions) 46 | { 47 | this(new TextArea(), additionalInitActions); 48 | } 49 | 50 | public EditableLabelTextArea( 51 | final TextArea editor, 52 | final Consumer additionalInitActions) 53 | { 54 | super(editor, additionalInitActions); 55 | } 56 | 57 | @Override 58 | protected void initUI() 59 | { 60 | super.initUI(); 61 | this.getEditor().setAutoselect(true); 62 | this.getEditor().addThemeVariants(TextAreaVariant.LUMO_SMALL); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /vaadin-editable-label/src/main/java/software/xdev/vaadin/editable_label/predefined/EditableLabelTextField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2023 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.editable_label.predefined; 17 | 18 | import java.util.function.Consumer; 19 | 20 | import com.vaadin.flow.component.textfield.TextField; 21 | import com.vaadin.flow.component.textfield.TextFieldVariant; 22 | 23 | import software.xdev.vaadin.editable_label.AbstractEditableLabel; 24 | 25 | 26 | /** 27 | * Offers a simple label which can be edited as a {@link TextField}. 28 | * 29 | * @author JR 30 | * @author AB 31 | */ 32 | public class EditableLabelTextField 33 | extends AbstractEditableLabel 34 | { 35 | public EditableLabelTextField() 36 | { 37 | this(new TextField()); 38 | } 39 | 40 | public EditableLabelTextField(final TextField editor) 41 | { 42 | this(editor, null); 43 | } 44 | 45 | public EditableLabelTextField(final Consumer additionalInitActions) 46 | { 47 | this(new TextField(), additionalInitActions); 48 | } 49 | 50 | public EditableLabelTextField( 51 | final TextField editor, 52 | final Consumer additionalInitActions) 53 | { 54 | super(editor, additionalInitActions); 55 | } 56 | 57 | @Override 58 | protected void initUI() 59 | { 60 | super.initUI(); 61 | this.getEditor().setAutoselect(true); 62 | this.getEditor().addThemeVariants(TextFieldVariant.LUMO_SMALL); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /vaadin-editable-label/src/main/java/software/xdev/vaadin/editable_label/predefined/EditableLabelNumberField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2023 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.editable_label.predefined; 17 | 18 | import java.util.function.Consumer; 19 | 20 | import com.vaadin.flow.component.textfield.NumberField; 21 | import com.vaadin.flow.component.textfield.TextFieldVariant; 22 | 23 | import software.xdev.vaadin.editable_label.AbstractEditableLabel; 24 | 25 | 26 | /** 27 | * Offers a simple label which can be edited as a {@link NumberField}. 28 | * 29 | * @author JR 30 | * @author AB 31 | */ 32 | public class EditableLabelNumberField 33 | extends AbstractEditableLabel 34 | { 35 | public EditableLabelNumberField() 36 | { 37 | this(new NumberField()); 38 | } 39 | 40 | public EditableLabelNumberField(final NumberField editor) 41 | { 42 | this(editor, null); 43 | } 44 | 45 | public EditableLabelNumberField(final Consumer additionalInitActions) 46 | { 47 | this(new NumberField(), additionalInitActions); 48 | } 49 | 50 | public EditableLabelNumberField( 51 | final NumberField editor, 52 | final Consumer additionalInitActions) 53 | { 54 | super(editor, additionalInitActions); 55 | } 56 | 57 | @Override 58 | protected void initUI() 59 | { 60 | super.initUI(); 61 | this.getEditor().setAutoselect(true); 62 | this.getEditor().addThemeVariants(TextFieldVariant.LUMO_SMALL); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /vaadin-editable-label/src/main/java/software/xdev/vaadin/editable_label/predefined/EditableLabelBigDecimalField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2023 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.editable_label.predefined; 17 | 18 | import java.math.BigDecimal; 19 | import java.text.NumberFormat; 20 | import java.util.function.Consumer; 21 | 22 | import com.vaadin.flow.component.textfield.BigDecimalField; 23 | 24 | import software.xdev.vaadin.editable_label.AbstractEditableLabel; 25 | 26 | 27 | /** 28 | * Offers a simple label which can be edited as a {@link BigDecimalField}. 29 | * 30 | * @author JR 31 | * @author AB 32 | */ 33 | public class EditableLabelBigDecimalField 34 | extends AbstractEditableLabel 35 | { 36 | public EditableLabelBigDecimalField() 37 | { 38 | this(new BigDecimalField()); 39 | } 40 | 41 | public EditableLabelBigDecimalField(final BigDecimalField editor) 42 | { 43 | this(editor, null); 44 | } 45 | 46 | public EditableLabelBigDecimalField(final Consumer additionalInitActions) 47 | { 48 | this(new BigDecimalField(), additionalInitActions); 49 | } 50 | 51 | public EditableLabelBigDecimalField( 52 | final BigDecimalField editor, 53 | final Consumer additionalInitActions) 54 | { 55 | super(editor, additionalInitActions); 56 | } 57 | 58 | @Override 59 | protected void initUI() 60 | { 61 | super.initUI(); 62 | this.getEditor().setAutoselect(true); 63 | } 64 | 65 | public EditableLabelBigDecimalField withNumberFormat(final NumberFormat format) 66 | { 67 | return this.withLabelGenerator(format::format); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: 🐞 Bug 2 | description: Create a bug report for something that is broken 3 | labels: [bug] 4 | type: bug 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Thank you for reporting a bug. 10 | 11 | Please fill in as much information as possible about your bug so that we don't have to play "information ping-pong" and can help you immediately. 12 | 13 | - type: checkboxes 14 | id: checklist 15 | attributes: 16 | label: "Checklist" 17 | options: 18 | - label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/vaadin-editable-label/releases/latest)" 19 | required: true 20 | - label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/vaadin-editable-label/issues) or [closed](https://github.com/xdev-software/vaadin-editable-label/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to." 21 | required: true 22 | - label: "I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise." 23 | required: true 24 | - label: "This issue contains only one bug." 25 | required: true 26 | 27 | - type: input 28 | id: app-version 29 | attributes: 30 | label: Affected version 31 | description: "In which version did you encounter the bug?" 32 | placeholder: "x.x.x" 33 | validations: 34 | required: true 35 | 36 | - type: textarea 37 | id: description 38 | attributes: 39 | label: Description of the problem 40 | description: | 41 | Describe as exactly as possible what is not working. 42 | validations: 43 | required: true 44 | 45 | - type: textarea 46 | id: steps-to-reproduce 47 | attributes: 48 | label: Steps to reproduce the bug 49 | description: | 50 | What did you do for the bug to show up? 51 | 52 | If you can't cause the bug to show up again reliably (and hence don't have a proper set of steps to give us), please still try to give as many details as possible on how you think you encountered the bug. 53 | placeholder: | 54 | 1. Use '...' 55 | 2. Do '...' 56 | validations: 57 | required: true 58 | 59 | - type: textarea 60 | id: additional-information 61 | attributes: 62 | label: Additional information 63 | description: | 64 | Any other relevant information you'd like to include 65 | -------------------------------------------------------------------------------- /vaadin-editable-label/src/main/java/software/xdev/vaadin/editable_label/predefined/EditableLabelDatePicker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2023 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.editable_label.predefined; 17 | 18 | import java.time.LocalDate; 19 | import java.time.format.DateTimeFormatter; 20 | import java.util.Collections; 21 | import java.util.Map; 22 | import java.util.WeakHashMap; 23 | import java.util.function.Consumer; 24 | 25 | import com.vaadin.flow.component.datepicker.DatePicker; 26 | 27 | import software.xdev.vaadin.editable_label.AbstractEditableLabel; 28 | 29 | 30 | /** 31 | * Offers a simple label which can be edited as a {@link DatePicker}. 32 | * 33 | * @author JR 34 | * @author AB 35 | */ 36 | public class EditableLabelDatePicker 37 | extends AbstractEditableLabel 38 | { 39 | protected static final Map CACHE_DTF = Collections.synchronizedMap(new WeakHashMap<>()); 40 | 41 | public EditableLabelDatePicker() 42 | { 43 | this(new DatePicker()); 44 | } 45 | 46 | public EditableLabelDatePicker(final DatePicker editor) 47 | { 48 | this(editor, null); 49 | } 50 | 51 | public EditableLabelDatePicker(final Consumer additionalInitActions) 52 | { 53 | this(new DatePicker(), additionalInitActions); 54 | } 55 | 56 | public EditableLabelDatePicker( 57 | final DatePicker editor, 58 | final Consumer additionalInitActions) 59 | { 60 | super(editor, additionalInitActions); 61 | } 62 | 63 | public EditableLabelDatePicker withTryUseI18NFormat() 64 | { 65 | final DatePicker.DatePickerI18n i18n = this.editor.getI18n(); 66 | if(i18n != null && !i18n.getDateFormats().isEmpty()) 67 | { 68 | final DateTimeFormatter dtf = 69 | CACHE_DTF.computeIfAbsent(i18n.getDateFormats().get(0), DateTimeFormatter::ofPattern); 70 | this.withLabelGenerator(dtf::format); 71 | } 72 | return this.self(); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Published on Vaadin Directory](https://img.shields.io/badge/Vaadin%20Directory-published-00b4f0?logo=vaadin)](https://vaadin.com/directory/component/editable-labels-for-vaadin) 2 | [![Latest version](https://img.shields.io/maven-central/v/software.xdev/vaadin-editable-label?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/vaadin-editable-label) 3 | [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/vaadin-editable-label/check-build.yml?branch=develop)](https://github.com/xdev-software/vaadin-editable-label/actions/workflows/check-build.yml?query=branch%3Adevelop) 4 | ![Vaadin 24+](https://img.shields.io/badge/Vaadin%20Platform/Flow-24+-00b4f0) 5 | 6 | # Editable Labels for Vaadin 7 | A Vaadin Flow implementation for editable labels 8 | 9 | ![demo](assets/demo.png) 10 | 11 | This component provides a couple of elements that are displayed as simple read-only components, but can be edited with a 12 | simple click. 13 | Following components are available: 14 | 15 | * [EditableLabelTextField](./vaadin-editable-label/src/main/java/software/xdev/vaadin/editable_label/predefined/EditableLabelTextField.java) 16 | * [EditableLabelTextArea](./vaadin-editable-label/src/main/java/software/xdev/vaadin/editable_label/predefined/EditableLabelTextArea.java) 17 | * [EditableLabelComboBox](./vaadin-editable-label/src/main/java/software/xdev/vaadin/editable_label/predefined/EditableLabelComboBox.java) 18 | * [EditableLabelDatePicker](./vaadin-editable-label/src/main/java/software/xdev/vaadin/editable_label/predefined/EditableLabelDatePicker.java) 19 | * [EditableLabelNumberField](./vaadin-editable-label/src/main/java/software/xdev/vaadin/editable_label/predefined/EditableLabelNumberField.java) 20 | * [EditableLabelBigDecimalField](./vaadin-editable-label/src/main/java/software/xdev/vaadin/editable_label/predefined/EditableLabelBigDecimalField.java) 21 | 22 | It's also possible to create a custom element: 23 | 24 | ```java 25 | final EditableLabel emailLabel = new EditableLabel<>(new EmailField()).withValue(defaultValue); 26 | ``` 27 | 28 | ## Installation 29 | [Installation guide for the latest release](https://github.com/xdev-software/vaadin-editable-label/releases/latest#Installation) 30 | 31 | #### Compatibility with Vaadin 32 | | Vaadin version | Editable label version | 33 | | --- | --- | 34 | | Vaadin 24+ (latest) | ``2+`` | 35 | | Vaadin 23 | ``1.x`` | 36 | 37 | ### Spring-Boot 38 | * You may have to include ``software/xdev`` inside [``vaadin.allowed-packages``](https://vaadin.com/docs/latest/integrations/spring/configuration#configure-the-scanning-of-packages) 39 | 40 | ## Run the Demo 41 | * Checkout the repo 42 | * Run ``mvn install && mvn -f vaadin-editable-label-demo spring-boot:run`` 43 | * Open http://localhost:8080 44 | 45 |
46 | Show example 47 | 48 | ![demo](assets/demo.avif) 49 |
50 | 51 | ## Support 52 | If you need support as soon as possible and you can't wait for any pull request, feel free to use [our support](https://xdev.software/en/services/support). 53 | 54 | ## Contributing 55 | See the [contributing guide](./CONTRIBUTING.md) for detailed instructions on how to get started with our project. 56 | 57 | ## Dependencies and Licenses 58 | View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/vaadin-editable-label/dependencies) 59 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | software.xdev 8 | vaadin-editable-label-root 9 | 2.1.4-SNAPSHOT 10 | pom 11 | 12 | 13 | XDEV Software 14 | https://xdev.software 15 | 16 | 17 | 18 | vaadin-editable-label 19 | vaadin-editable-label-demo 20 | 21 | 22 | 23 | UTF-8 24 | UTF-8 25 | 26 | 27 | 28 | 29 | Apache-2.0 30 | https://www.apache.org/licenses/LICENSE-2.0.txt 31 | repo 32 | 33 | 34 | 35 | 36 | 37 | checkstyle 38 | 39 | 40 | 41 | org.apache.maven.plugins 42 | maven-checkstyle-plugin 43 | 3.6.0 44 | 45 | 46 | com.puppycrawl.tools 47 | checkstyle 48 | 12.1.0 49 | 50 | 51 | 52 | .config/checkstyle/checkstyle.xml 53 | true 54 | 55 | 56 | 57 | 58 | check 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | pmd 68 | 69 | 70 | 71 | org.apache.maven.plugins 72 | maven-pmd-plugin 73 | 3.28.0 74 | 75 | true 76 | true 77 | true 78 | 79 | .config/pmd/java/ruleset.xml 80 | 81 | 82 | 83 | 84 | net.sourceforge.pmd 85 | pmd-core 86 | 7.17.0 87 | 88 | 89 | net.sourceforge.pmd 90 | pmd-java 91 | 7.17.0 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | org.apache.maven.plugins 102 | maven-jxr-plugin 103 | 3.6.0 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /vaadin-editable-label/src/main/java/software/xdev/vaadin/editable_label/predefined/EditableLabelComboBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2023 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.editable_label.predefined; 17 | 18 | import java.util.Collection; 19 | import java.util.function.Consumer; 20 | 21 | import com.vaadin.flow.component.ItemLabelGenerator; 22 | import com.vaadin.flow.component.combobox.ComboBox; 23 | import com.vaadin.flow.component.combobox.dataview.ComboBoxDataView; 24 | import com.vaadin.flow.component.combobox.dataview.ComboBoxLazyDataView; 25 | import com.vaadin.flow.component.combobox.dataview.ComboBoxListDataView; 26 | import com.vaadin.flow.data.provider.BackEndDataProvider; 27 | import com.vaadin.flow.data.provider.DataProvider; 28 | import com.vaadin.flow.data.provider.HasDataView; 29 | import com.vaadin.flow.data.provider.HasLazyDataView; 30 | import com.vaadin.flow.data.provider.HasListDataView; 31 | import com.vaadin.flow.data.provider.InMemoryDataProvider; 32 | import com.vaadin.flow.data.provider.ListDataProvider; 33 | import com.vaadin.flow.function.SerializableFunction; 34 | 35 | import software.xdev.vaadin.editable_label.AbstractEditableLabel; 36 | 37 | 38 | /** 39 | * Offers a simple label which can be edited as a {@link ComboBox}. 40 | * 41 | * @author AB 42 | * @author JR 43 | */ 44 | public class EditableLabelComboBox 45 | extends AbstractEditableLabel, ComboBox, T> 46 | implements 47 | HasDataView>, 48 | HasListDataView>, 49 | HasLazyDataView> 50 | { 51 | public EditableLabelComboBox() 52 | { 53 | this(new ComboBox<>()); 54 | } 55 | 56 | public EditableLabelComboBox(final ComboBox editor) 57 | { 58 | this(editor, null); 59 | } 60 | 61 | public EditableLabelComboBox(final Consumer> additionalInitActions) 62 | { 63 | this(new ComboBox<>(), additionalInitActions); 64 | } 65 | 66 | public EditableLabelComboBox( 67 | final ComboBox editor, 68 | final Consumer> additionalInitActions) 69 | { 70 | super(editor, additionalInitActions); 71 | } 72 | 73 | @Override 74 | protected void initUI() 75 | { 76 | super.initUI(); 77 | // Open ComboBox when in edit mode 78 | this.addEditModeChangedListener(ev -> this.getEditor().setOpened(ev.isEditModeEnabled())); 79 | } 80 | 81 | @Override 82 | public EditableLabelComboBox withNativeLabelGenerator(final ItemLabelGenerator labelGenerator) 83 | { 84 | super.withNativeLabelGenerator(labelGenerator); 85 | this.getEditor().setItemLabelGenerator(labelGenerator); 86 | return this.self(); 87 | } 88 | 89 | public EditableLabelComboBox withItems(final T... items) 90 | { 91 | return this.withItems(DataProvider.ofItems(items)); 92 | } 93 | 94 | public EditableLabelComboBox withItems(final Collection items) 95 | { 96 | return this.withItems(DataProvider.ofCollection(items)); 97 | } 98 | 99 | public EditableLabelComboBox withItems(final ListDataProvider items) 100 | { 101 | this.setItems(items); 102 | return this.self(); 103 | } 104 | 105 | @Override 106 | public ComboBoxListDataView setItems(final ListDataProvider dataProvider) 107 | { 108 | return this.getEditor().setItems(dataProvider); 109 | } 110 | 111 | @Override 112 | public ComboBoxListDataView getListDataView() 113 | { 114 | return this.getEditor().getListDataView(); 115 | } 116 | 117 | @Override 118 | public ComboBoxDataView setItems(final DataProvider dataProvider) 119 | { 120 | return this.getEditor().setItems(dataProvider); 121 | } 122 | 123 | /** 124 | * @see ComboBox#setItems(InMemoryDataProvider, SerializableFunction) 125 | * @deprecated See upstream 126 | */ 127 | @Deprecated(forRemoval = true) 128 | @Override 129 | public ComboBoxDataView setItems(final InMemoryDataProvider dataProvider) 130 | { 131 | return this.getEditor().setItems(dataProvider); 132 | } 133 | 134 | @Override 135 | public ComboBoxDataView getGenericDataView() 136 | { 137 | return this.getEditor().getGenericDataView(); 138 | } 139 | 140 | @Override 141 | public ComboBoxLazyDataView setItems(final BackEndDataProvider dataProvider) 142 | { 143 | return this.getEditor().setItems(dataProvider); 144 | } 145 | 146 | @Override 147 | public ComboBoxLazyDataView getLazyDataView() 148 | { 149 | return this.getEditor().getLazyDataView(); 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 99 | -------------------------------------------------------------------------------- /.github/workflows/check-build.yml: -------------------------------------------------------------------------------- 1 | name: Check Build 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: [ develop ] 7 | paths-ignore: 8 | - '**.md' 9 | - '.config/**' 10 | - '.github/**' 11 | - '.idea/**' 12 | - 'assets/**' 13 | pull_request: 14 | branches: [ develop ] 15 | paths-ignore: 16 | - '**.md' 17 | - '.config/**' 18 | - '.github/**' 19 | - '.idea/**' 20 | - 'assets/**' 21 | 22 | env: 23 | DEMO_MAVEN_MODULE: ${{ github.event.repository.name }}-demo 24 | 25 | jobs: 26 | build: 27 | runs-on: ubuntu-latest 28 | timeout-minutes: 30 29 | strategy: 30 | matrix: 31 | java: [17, 21, 25] 32 | distribution: [temurin] 33 | steps: 34 | - uses: actions/checkout@v5 35 | 36 | - name: Set up JDK 37 | uses: actions/setup-java@v5 38 | with: 39 | distribution: ${{ matrix.distribution }} 40 | java-version: ${{ matrix.java }} 41 | 42 | - name: Cache Maven 43 | uses: actions/cache@v4 44 | with: 45 | path: ~/.m2/repository 46 | key: ${{ runner.os }}-mvn-build-${{ hashFiles('**/pom.xml') }} 47 | restore-keys: | 48 | ${{ runner.os }}-mvn-build- 49 | 50 | - name: Cache Vaadin prod bundles 51 | uses: actions/cache@v4 52 | with: 53 | path: | 54 | **/bundles/prod.bundle 55 | key: ${{ runner.os }}-vaadin-prod-bundles-${{ hashFiles('**/pom.xml') }} 56 | restore-keys: | 57 | ${{ runner.os }}-vaadin-prod-bundles- 58 | 59 | - name: Build with Maven 60 | run: ./mvnw -B clean package 61 | 62 | - name: Check for uncommited changes 63 | run: | 64 | if [[ "$(git status --porcelain)" != "" ]]; then 65 | echo ---------------------------------------- 66 | echo git status 67 | echo ---------------------------------------- 68 | git status 69 | echo ---------------------------------------- 70 | echo git diff 71 | echo ---------------------------------------- 72 | git diff 73 | echo ---------------------------------------- 74 | echo Troubleshooting 75 | echo ---------------------------------------- 76 | echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && ./mvnw -B clean package -Pproduction" 77 | exit 1 78 | fi 79 | 80 | - name: Upload demo files 81 | uses: actions/upload-artifact@v4 82 | with: 83 | name: demo-files-java-${{ matrix.java }} 84 | path: ${{ env.DEMO_MAVEN_MODULE }}/target/${{ env.DEMO_MAVEN_MODULE }}.jar 85 | if-no-files-found: error 86 | 87 | checkstyle: 88 | runs-on: ubuntu-latest 89 | if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }} 90 | timeout-minutes: 15 91 | strategy: 92 | matrix: 93 | java: [17] 94 | distribution: [temurin] 95 | steps: 96 | - uses: actions/checkout@v5 97 | 98 | - name: Set up JDK 99 | uses: actions/setup-java@v5 100 | with: 101 | distribution: ${{ matrix.distribution }} 102 | java-version: ${{ matrix.java }} 103 | 104 | - name: Cache Maven 105 | uses: actions/cache@v4 106 | with: 107 | path: ~/.m2/repository 108 | key: ${{ runner.os }}-mvn-checkstyle-${{ hashFiles('**/pom.xml') }} 109 | restore-keys: | 110 | ${{ runner.os }}-mvn-checkstyle- 111 | 112 | - name: CheckStyle Cache 113 | uses: actions/cache@v4 114 | with: 115 | path: '**/target/checkstyle-cachefile' 116 | key: ${{ runner.os }}-checkstyle-${{ hashFiles('**/pom.xml') }} 117 | restore-keys: | 118 | ${{ runner.os }}-checkstyle- 119 | 120 | - name: Run Checkstyle 121 | run: ./mvnw -B checkstyle:check -P checkstyle -T2C 122 | 123 | pmd: 124 | runs-on: ubuntu-latest 125 | if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }} 126 | timeout-minutes: 15 127 | strategy: 128 | matrix: 129 | java: [17] 130 | distribution: [temurin] 131 | steps: 132 | - uses: actions/checkout@v5 133 | 134 | - name: Set up JDK 135 | uses: actions/setup-java@v5 136 | with: 137 | distribution: ${{ matrix.distribution }} 138 | java-version: ${{ matrix.java }} 139 | 140 | - name: Cache Maven 141 | uses: actions/cache@v4 142 | with: 143 | path: ~/.m2/repository 144 | key: ${{ runner.os }}-mvn-pmd-${{ hashFiles('**/pom.xml') }} 145 | restore-keys: | 146 | ${{ runner.os }}-mvn-pmd- 147 | 148 | - name: PMD Cache 149 | uses: actions/cache@v4 150 | with: 151 | path: '**/target/pmd/pmd.cache' 152 | key: ${{ runner.os }}-pmd-${{ hashFiles('**/pom.xml') }} 153 | restore-keys: | 154 | ${{ runner.os }}-pmd- 155 | 156 | - name: Run PMD 157 | run: ./mvnw -B test pmd:aggregate-pmd-no-fork pmd:check -P pmd -DskipTests -T2C 158 | 159 | - name: Run CPD (Copy Paste Detector) 160 | run: ./mvnw -B pmd:aggregate-cpd pmd:cpd-check -P pmd -DskipTests -T2C 161 | 162 | - name: Upload report 163 | if: always() 164 | uses: actions/upload-artifact@v4 165 | with: 166 | name: pmd-report 167 | if-no-files-found: ignore 168 | path: | 169 | target/reports/** 170 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing 2 | 3 | We would absolutely love to get the community involved, and we welcome any form of contributions – comments and questions on different communication channels, issues and pull request and anything that you build and share using our components. 4 | 5 | ### Communication channels 6 | * Communication is primarily done using issues. 7 | * If you need support as soon as possible and you can't wait for any pull request, feel free to use [our support](https://xdev.software/en/services/support). 8 | * As a last resort measure or on otherwise important matter you may also [contact us directly](https://xdev.software/en/about-us/contact). 9 | 10 | ### Ways to help 11 | * **Report bugs**
Create an issue or send a pull request 12 | * **Send pull requests**
If you want to contribute code, check out the development instructions below. 13 | * However when contributing larger new features, please first discuss the change you wish to make via issue with the owners of this repository before making it.
Otherwise your work might be rejected and your effort was pointless. 14 | 15 | We also encourage you to read the [contribution instructions by GitHub](https://docs.github.com/en/get-started/quickstart/contributing-to-projects). 16 | 17 | ## Developing 18 | 19 | ### Software Requirements 20 | You should have the following things installed: 21 | * Git 22 | * Java 25 - should be as unmodified as possible (Recommended: [Eclipse Adoptium](https://adoptium.net/temurin/releases/)) 23 | * Maven (Note that the [Maven Wrapper](https://maven.apache.org/wrapper/) is shipped with the repo) 24 | 25 | ### Recommended setup 26 | * Install ``IntelliJ`` (Community Edition is sufficient) 27 | * Install the following plugins: 28 | * [Save Actions](https://plugins.jetbrains.com/plugin/22113) - Provides save actions, like running the formatter or adding ``final`` to fields 29 | * [SonarLint](https://plugins.jetbrains.com/plugin/7973-sonarlint) - CodeStyle/CodeAnalysis 30 | * You may consider disabling telemetry in the settings under ``Tools > Sonarlint -> About`` 31 | * [Checkstyle-IDEA](https://plugins.jetbrains.com/plugin/1065-checkstyle-idea) - CodeStyle/CodeAnalysis 32 | * Import the project 33 | * Ensure that everything is encoded in ``UTF-8`` 34 | * Ensure that the JDK/Java-Version is correct 35 | * To enable AUTOMATIC reloading/restarting while developing and running the app do this (further information in " 36 | SpringBoot-Devtools" section below; [Source](https://stackoverflow.com/q/33349456)): 37 | * ``Settings > Build, Execution, Deployment > Compiler``:
38 | Enable [``Build project automatically``](https://www.jetbrains.com/help/idea/compiling-applications.html#auto-build) 39 | * ``Settings > Advanced Settings``:
40 | Enable [``Allow auto-make to start even if developed application is currently running``](https://www.jetbrains.com/help/idea/advanced-settings.html#advanced_compiler) 41 | * To launch the Demo execute the predefined (launch) configuration ``Run Demo`` 42 | 43 | #### [SpringBoot-Developer-Tools](https://docs.spring.io/spring-boot/docs/current/reference/html/using.html#using.devtools) 44 | ... should automatically be enabled.
45 | If you are changing a file and build the project, parts of the app get restarted.
46 | Bigger changes may require a complete restart. 47 | * [Vaadin automatically reloads the UI on each restart](https://vaadin.com/docs/latest/configuration/live-reload/spring-boot).
48 | You can control this behavior with the ``vaadin.devmode.liveReload.enabled`` property (default: ``true``). 49 | 50 | ## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/vaadin-editable-label/release.yml?branch=master)](https://github.com/xdev-software/vaadin-editable-label/actions/workflows/release.yml) 51 | 52 | Before releasing: 53 | * Consider doing a [test-deployment](https://github.com/xdev-software/vaadin-editable-label/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing. 54 | * Check the [changelog](CHANGELOG.md) 55 | 56 | If the ``develop`` is ready for release, create a pull request to the ``master``-Branch and merge the changes 57 | 58 | When the release is finished do the following: 59 | * Merge the auto-generated PR (with the incremented version number) back into the ``develop`` 60 | * Ensure that [Vaadin Directory](https://vaadin.com/directory) syncs the update and maybe update the component / version there 61 | 62 | ### Release failures 63 | 64 | There are 2 modes of release failure: 65 | 1. The remote server was e.g. down and non of the artifacts got published 66 | 2. There was a build failure during release and only parts of the artifacts got released 67 | 68 | In case 1 we can re-release the existing version,
in case 2 we have to release a new version when we can't get the artifacts deleted (as is the case with Maven Central) 69 | 70 | #### How-to: Re-Releasing an existing version 71 | 72 | 1. Delete the release on GitHub 73 | 2. Delete the release Git tag from the repo (locally and remote!) 74 | 3. Delete the ``master``-Branch and re-create it from the ``develop`` branch (or reset it to the state before the release-workflow commits have been done) 75 | * This requires __temporarily__ removing the branch protection 76 | * Once this was done a new release is triggered immediately! 77 | 78 | #### How-to: Releasing a new version 79 | 80 | 1. Merge the ``master`` branch back into ``develop`` (or another temporary branch) 81 | 2. Make sure all master branch versions are prepared for a new release
e.g. if the broken release was ``1.0.0`` the version should now be at ``1.0.1-SNAPSHOT`` - the ``SNAPSHOT`` is important for the workflow! 82 | 3. Mark the broken release as broken e.g. inside the Changelog, GitHub Release page, etc.
83 | You can use something like this: 84 | ``` 85 | > [!WARNING] 86 | > This release is broken as my cat accidentally clicked the abort button during the process 87 | ``` 88 | 4. Merge the changes back into the ``master`` branch to trigger a new release 89 | -------------------------------------------------------------------------------- /.config/checkstyle/checkstyle.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 148 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /vaadin-editable-label-demo/src/main/java/software/xdev/vaadin/editable_label/HomeView.java: -------------------------------------------------------------------------------- 1 | package software.xdev.vaadin.editable_label; 2 | 3 | import static java.util.Map.entry; 4 | 5 | import java.math.BigDecimal; 6 | import java.text.NumberFormat; 7 | import java.time.LocalDate; 8 | import java.util.Map; 9 | import java.util.concurrent.Executors; 10 | import java.util.concurrent.ScheduledExecutorService; 11 | import java.util.concurrent.TimeUnit; 12 | 13 | import org.slf4j.Logger; 14 | import org.slf4j.LoggerFactory; 15 | 16 | import com.vaadin.flow.component.Composite; 17 | import com.vaadin.flow.component.button.Button; 18 | import com.vaadin.flow.component.datepicker.DatePicker; 19 | import com.vaadin.flow.component.formlayout.FormLayout; 20 | import com.vaadin.flow.component.html.H4; 21 | import com.vaadin.flow.component.orderedlayout.FlexComponent; 22 | import com.vaadin.flow.component.orderedlayout.HorizontalLayout; 23 | import com.vaadin.flow.component.orderedlayout.VerticalLayout; 24 | import com.vaadin.flow.component.textfield.EmailField; 25 | import com.vaadin.flow.component.textfield.TextArea; 26 | import com.vaadin.flow.component.textfield.TextAreaVariant; 27 | import com.vaadin.flow.router.PageTitle; 28 | import com.vaadin.flow.router.Route; 29 | 30 | import software.xdev.vaadin.editable_label.predefined.EditableLabelBigDecimalField; 31 | import software.xdev.vaadin.editable_label.predefined.EditableLabelComboBox; 32 | import software.xdev.vaadin.editable_label.predefined.EditableLabelDatePicker; 33 | import software.xdev.vaadin.editable_label.predefined.EditableLabelNumberField; 34 | import software.xdev.vaadin.editable_label.predefined.EditableLabelTextArea; 35 | import software.xdev.vaadin.editable_label.predefined.EditableLabelTextField; 36 | 37 | 38 | @PageTitle("Editable Label Examples") 39 | @Route("") 40 | public class HomeView extends Composite 41 | { 42 | private static final Logger LOG = LoggerFactory.getLogger(HomeView.class); 43 | private final TextArea valueChangeEventTa = new TextArea(); 44 | 45 | public HomeView() 46 | { 47 | this.initUI(); 48 | } 49 | 50 | private void initUI() 51 | { 52 | this.valueChangeEventTa.setReadOnly(true); 53 | this.valueChangeEventTa.addThemeVariants(TextAreaVariant.LUMO_SMALL); 54 | this.valueChangeEventTa.setWidthFull(); 55 | 56 | this.getContent().setSpacing(false); 57 | this.getContent().add( 58 | new H4("Predefined components"), 59 | this.getPredefinedComponents(), 60 | new H4("Custom Component"), 61 | this.getCustomComponent(), 62 | new H4("Event"), 63 | this.valueChangeEventTa); 64 | } 65 | 66 | @SuppressWarnings("checkstyle:MagicNumber") 67 | private FormLayout getPredefinedComponents() 68 | { 69 | final FormLayout formLayout = new FormLayout(); 70 | formLayout.setResponsiveSteps( 71 | new FormLayout.ResponsiveStep( 72 | "0", 73 | 1, 74 | FormLayout.ResponsiveStep.LabelsPosition.TOP), 75 | new FormLayout.ResponsiveStep( 76 | "800px", 77 | 2, 78 | FormLayout.ResponsiveStep.LabelsPosition.TOP)); 79 | 80 | // Types are required here otherwise a compile error occurs (see https://github.com/vaadin/flow/issues/7920) 81 | Map.>ofEntries( 82 | entry( 83 | "TextField", 84 | new EditableLabelTextField() 85 | .withValue("Some text")), 86 | entry( 87 | "TextField with empty value", 88 | new EditableLabelTextField()), 89 | entry( 90 | "Textarea", 91 | new EditableLabelTextArea() 92 | .withValue( 93 | "Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut " 94 | + "labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation " 95 | + "ullamco laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure " 96 | + "reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.")), 97 | entry( 98 | "NumberField", 99 | new EditableLabelNumberField() 100 | .withValue(123.45)), 101 | entry( 102 | "BigDecimalField", 103 | new EditableLabelBigDecimalField() 104 | .withValue(BigDecimal.ONE)), 105 | entry( 106 | "BigDecimalField with currency", 107 | new EditableLabelBigDecimalField() 108 | .withValue(BigDecimal.TEN) 109 | .withNumberFormat(NumberFormat.getCurrencyInstance())), 110 | entry( 111 | "ComboBox", 112 | new EditableLabelComboBox() 113 | .withItems(Vehicle.values()) 114 | .withValue(Vehicle.PLANE) 115 | .withLabelGenerator(Vehicle::getEmoji)), 116 | entry( 117 | "ComboBox with empty value 🚲", 118 | new EditableLabelComboBox(el -> el.getEditor().setClearButtonVisible(true)) 119 | .withItems(Vehicle.values()) 120 | .withLabelGenerator(Vehicle::getEmoji, "🚲")), 121 | entry( 122 | "DatePicker", 123 | new EditableLabelDatePicker() 124 | ), 125 | entry( 126 | "DatePicker with I18N", 127 | new EditableLabelDatePicker(getDatepickerWithI18N()) 128 | .withValue(LocalDate.of(2000, 1, 1)) 129 | .withTryUseI18NFormat() 130 | ) 131 | ).entrySet() 132 | .stream() 133 | .sorted(Map.Entry.comparingByKey()) 134 | .forEach(e -> { 135 | this.registerValueChangeEvent(e.getKey(), e.getValue()); 136 | formLayout.addFormItem(e.getValue(), e.getKey()); 137 | }); 138 | 139 | return formLayout; 140 | } 141 | 142 | private HorizontalLayout getCustomComponent() 143 | { 144 | final String defaultValue = "example@example.com"; 145 | final EditableLabel emailLabel = new EditableLabel<>(new EmailField()) 146 | .withValue(defaultValue); 147 | 148 | this.registerValueChangeEvent("Custom-Component", emailLabel); 149 | 150 | final Button btnRestoreDefault = new Button("Restore default", ev -> emailLabel.setValue(defaultValue)); 151 | 152 | final ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); 153 | final Button btnRestoreDefaultIn5s = 154 | new Button( 155 | "Restore default in 5s", 156 | ev -> scheduledExecutorService.schedule( 157 | () -> ev.getSource().getUI().ifPresent(ui -> { 158 | try 159 | { 160 | ui.access(() -> 161 | { 162 | emailLabel.setValue(defaultValue); 163 | ev.getSource().setEnabled(true); 164 | }); 165 | } 166 | catch(final Exception ex) 167 | { 168 | // Ignore 169 | } 170 | }), 171 | 5, 172 | TimeUnit.SECONDS)); 173 | btnRestoreDefaultIn5s.setDisableOnClick(true); 174 | 175 | final HorizontalLayout hlButtons = new HorizontalLayout(); 176 | hlButtons.add(btnRestoreDefault, btnRestoreDefaultIn5s); 177 | 178 | final HorizontalLayout hl = new HorizontalLayout(); 179 | hl.add(emailLabel, hlButtons); 180 | hl.setJustifyContentMode(FlexComponent.JustifyContentMode.BETWEEN); 181 | hl.setWidthFull(); 182 | return hl; 183 | } 184 | 185 | private void registerValueChangeEvent(final String source, final AbstractEditableLabel ael) 186 | { 187 | ael.addValueChangeListener(ev -> { 188 | final String header = "Source '" + source + "' - ValueChangeEvent"; 189 | final String text = "value: " + ev.getValue() + "\n" 190 | + "oldValue: " + ev.getOldValue() + "\n" 191 | + "isFromClient: " + ev.isFromClient(); 192 | LOG.info("{}\n{}", header, text); 193 | 194 | this.valueChangeEventTa.setLabel(header); 195 | this.valueChangeEventTa.setValue(text); 196 | }); 197 | } 198 | 199 | private static DatePicker getDatepickerWithI18N() 200 | { 201 | final DatePicker datePicker = new DatePicker(); 202 | datePicker.setI18n(new DatePicker.DatePickerI18n() 203 | .setDateFormat("yyyy⏰MM⏰dd")); 204 | return datePicker; 205 | } 206 | 207 | enum Vehicle 208 | { 209 | CAR("🚗"), 210 | TRAIN("🚂"), 211 | PLANE("✈"); 212 | 213 | private final String emoji; 214 | 215 | Vehicle(final String emoji) 216 | { 217 | this.emoji = emoji; 218 | } 219 | 220 | public String getEmoji() 221 | { 222 | return this.emoji; 223 | } 224 | } 225 | } 226 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | 7 | env: 8 | PRIMARY_MAVEN_MODULE: ${{ github.event.repository.name }} 9 | 10 | permissions: 11 | contents: write 12 | pull-requests: write 13 | 14 | # DO NOT RESTORE CACHE for critical release steps to prevent a (extremely unlikely) scenario 15 | # where a supply chain attack could be achieved due to poisoned cache 16 | jobs: 17 | check-code: 18 | runs-on: ubuntu-latest 19 | timeout-minutes: 30 20 | steps: 21 | - uses: actions/checkout@v5 22 | 23 | - name: Set up JDK 24 | uses: actions/setup-java@v5 25 | with: 26 | java-version: '17' 27 | distribution: 'temurin' 28 | 29 | # Try to reuse existing cache from check-build 30 | - name: Try restore Maven Cache 31 | uses: actions/cache/restore@v4 32 | with: 33 | path: ~/.m2/repository 34 | key: ${{ runner.os }}-mvn-build-${{ hashFiles('**/pom.xml') }} 35 | restore-keys: | 36 | ${{ runner.os }}-mvn-build- 37 | 38 | - name: Build with Maven 39 | run: ./mvnw -B clean package -Pproduction -T2C 40 | 41 | - name: Check for uncommited changes 42 | run: | 43 | if [[ "$(git status --porcelain)" != "" ]]; then 44 | echo ---------------------------------------- 45 | echo git status 46 | echo ---------------------------------------- 47 | git status 48 | echo ---------------------------------------- 49 | echo git diff 50 | echo ---------------------------------------- 51 | git diff 52 | echo ---------------------------------------- 53 | echo Troubleshooting 54 | echo ---------------------------------------- 55 | echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && ./mvnw -B clean package -Pproduction" 56 | exit 1 57 | fi 58 | 59 | prepare-release: 60 | runs-on: ubuntu-latest 61 | needs: [check-code] 62 | timeout-minutes: 10 63 | outputs: 64 | upload_url: ${{ steps.create-release.outputs.upload_url }} 65 | steps: 66 | - uses: actions/checkout@v5 67 | 68 | - name: Configure Git 69 | run: | 70 | git config --global user.email "actions@github.com" 71 | git config --global user.name "GitHub Actions" 72 | 73 | - name: Un-SNAP 74 | run: ./mvnw -B versions:set -DremoveSnapshot -DprocessAllModules -DgenerateBackupPoms=false 75 | 76 | - name: Get version 77 | id: version 78 | run: | 79 | version=$(../mvnw help:evaluate -Dexpression=project.version -q -DforceStdout) 80 | echo "release=$version" >> $GITHUB_OUTPUT 81 | echo "releasenumber=${version//[!0-9]/}" >> $GITHUB_OUTPUT 82 | working-directory: ${{ env.PRIMARY_MAVEN_MODULE }} 83 | 84 | - name: Commit and Push 85 | run: | 86 | git add -A 87 | git commit -m "Release ${{ steps.version.outputs.release }}" 88 | git push origin 89 | git tag v${{ steps.version.outputs.release }} 90 | git push origin --tags 91 | 92 | - name: Create Release 93 | id: create-release 94 | uses: shogo82148/actions-create-release@28d99e2a5b407558d17c15d0384fc0d7fb625b4c # v1 95 | with: 96 | tag_name: v${{ steps.version.outputs.release }} 97 | release_name: v${{ steps.version.outputs.release }} 98 | commitish: master 99 | body: | 100 | ## [Changelog](https://github.com/${{ github.repository }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }}) 101 | See [Changelog#v${{ steps.version.outputs.release }}](https://github.com/${{ github.repository }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }}) for more information. 102 | 103 | ## Installation 104 | Add the following lines to your pom: 105 | ```XML 106 | 107 | software.xdev 108 | ${{ env.PRIMARY_MAVEN_MODULE }} 109 | ${{ steps.version.outputs.release }} 110 | 111 | ``` 112 | 113 | ### Additional notes 114 | * [Spring-Boot] You may have to include ``software/xdev`` inside [``vaadin.allowed-packages``](https://vaadin.com/docs/latest/integrations/spring/configuration#configure-the-scanning-of-packages) 115 | 116 | publish-maven: 117 | runs-on: ubuntu-latest 118 | needs: [prepare-release] 119 | timeout-minutes: 60 120 | steps: 121 | - uses: actions/checkout@v5 122 | 123 | - name: Init Git and pull 124 | run: | 125 | git config --global user.email "actions@github.com" 126 | git config --global user.name "GitHub Actions" 127 | git pull 128 | 129 | - name: Set up JDK 130 | uses: actions/setup-java@v5 131 | with: # running setup-java overwrites the settings.xml 132 | distribution: 'temurin' 133 | java-version: '17' 134 | server-id: github-central 135 | server-password: PACKAGES_CENTRAL_TOKEN 136 | gpg-passphrase: MAVEN_GPG_PASSPHRASE 137 | gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Only import once 138 | 139 | - name: Publish to GitHub Packages Central 140 | run: ../mvnw -B deploy -P publish -DskipTests -DaltDeploymentRepository=github-central::https://maven.pkg.github.com/xdev-software/central 141 | working-directory: ${{ env.PRIMARY_MAVEN_MODULE }} 142 | env: 143 | PACKAGES_CENTRAL_TOKEN: ${{ secrets.PACKAGES_CENTRAL_TOKEN }} 144 | MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} 145 | 146 | - name: Set up JDK 147 | uses: actions/setup-java@v5 148 | with: # running setup-java again overwrites the settings.xml 149 | distribution: 'temurin' 150 | java-version: '17' 151 | server-id: sonatype-central-portal 152 | server-username: MAVEN_CENTRAL_USERNAME 153 | server-password: MAVEN_CENTRAL_TOKEN 154 | gpg-passphrase: MAVEN_GPG_PASSPHRASE 155 | 156 | - name: Publish to Central Portal 157 | run: ../mvnw -B deploy -P publish,publish-sonatype-central-portal -DskipTests 158 | env: 159 | MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_USERNAME }} 160 | MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_TOKEN }} 161 | MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} 162 | working-directory: ${{ env.PRIMARY_MAVEN_MODULE }} 163 | 164 | publish-pages: 165 | runs-on: ubuntu-latest 166 | needs: [prepare-release] 167 | timeout-minutes: 15 168 | steps: 169 | - uses: actions/checkout@v5 170 | 171 | - name: Init Git and pull 172 | run: | 173 | git config --global user.email "actions@github.com" 174 | git config --global user.name "GitHub Actions" 175 | git pull 176 | 177 | - name: Setup - Java 178 | uses: actions/setup-java@v5 179 | with: 180 | java-version: '17' 181 | distribution: 'temurin' 182 | 183 | # Try to reuse existing cache from check-build 184 | - name: Try restore Maven Cache 185 | uses: actions/cache/restore@v4 186 | with: 187 | path: ~/.m2/repository 188 | key: ${{ runner.os }}-mvn-build-${{ hashFiles('**/pom.xml') }} 189 | restore-keys: | 190 | ${{ runner.os }}-mvn-build- 191 | 192 | - name: Build site 193 | run: ../mvnw -B compile site -DskipTests -T2C 194 | working-directory: ${{ env.PRIMARY_MAVEN_MODULE }} 195 | 196 | - name: Deploy to Github pages 197 | uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4 198 | with: 199 | github_token: ${{ secrets.GITHUB_TOKEN }} 200 | publish_dir: ./${{ env.PRIMARY_MAVEN_MODULE }}/target/site 201 | force_orphan: true 202 | 203 | after-release: 204 | runs-on: ubuntu-latest 205 | needs: [publish-maven] 206 | timeout-minutes: 10 207 | steps: 208 | - uses: actions/checkout@v5 209 | 210 | - name: Init Git and pull 211 | run: | 212 | git config --global user.email "actions@github.com" 213 | git config --global user.name "GitHub Actions" 214 | git pull 215 | 216 | - name: Inc Version and SNAP 217 | run: ./mvnw -B versions:set -DnextSnapshot -DprocessAllModules -DgenerateBackupPoms=false 218 | 219 | - name: Git Commit and Push 220 | run: | 221 | git add -A 222 | git commit -m "Preparing for next development iteration" 223 | git push origin 224 | 225 | - name: pull-request 226 | env: 227 | GH_TOKEN: ${{ github.token }} 228 | run: | 229 | gh_pr_up() { 230 | gh pr create "$@" || gh pr edit "$@" 231 | } 232 | gh_pr_up -B "develop" \ 233 | --title "Sync back" \ 234 | --body "An automated PR to sync changes back" 235 | -------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | <# : batch portion 2 | @REM ---------------------------------------------------------------------------- 3 | @REM Licensed to the Apache Software Foundation (ASF) under one 4 | @REM or more contributor license agreements. See the NOTICE file 5 | @REM distributed with this work for additional information 6 | @REM regarding copyright ownership. The ASF licenses this file 7 | @REM to you under the Apache License, Version 2.0 (the 8 | @REM "License"); you may not use this file except in compliance 9 | @REM with the License. You may obtain a copy of the License at 10 | @REM 11 | @REM http://www.apache.org/licenses/LICENSE-2.0 12 | @REM 13 | @REM Unless required by applicable law or agreed to in writing, 14 | @REM software distributed under the License is distributed on an 15 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | @REM KIND, either express or implied. See the License for the 17 | @REM specific language governing permissions and limitations 18 | @REM under the License. 19 | @REM ---------------------------------------------------------------------------- 20 | 21 | @REM ---------------------------------------------------------------------------- 22 | @REM Apache Maven Wrapper startup batch script, version 3.3.4 23 | @REM 24 | @REM Optional ENV vars 25 | @REM MVNW_REPOURL - repo url base for downloading maven distribution 26 | @REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven 27 | @REM MVNW_VERBOSE - true: enable verbose log; others: silence the output 28 | @REM ---------------------------------------------------------------------------- 29 | 30 | @IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) 31 | @SET __MVNW_CMD__= 32 | @SET __MVNW_ERROR__= 33 | @SET __MVNW_PSMODULEP_SAVE=%PSModulePath% 34 | @SET PSModulePath= 35 | @FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( 36 | IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) 37 | ) 38 | @SET PSModulePath=%__MVNW_PSMODULEP_SAVE% 39 | @SET __MVNW_PSMODULEP_SAVE= 40 | @SET __MVNW_ARG0_NAME__= 41 | @SET MVNW_USERNAME= 42 | @SET MVNW_PASSWORD= 43 | @IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) 44 | @echo Cannot start maven from wrapper >&2 && exit /b 1 45 | @GOTO :EOF 46 | : end batch / begin powershell #> 47 | 48 | $ErrorActionPreference = "Stop" 49 | if ($env:MVNW_VERBOSE -eq "true") { 50 | $VerbosePreference = "Continue" 51 | } 52 | 53 | # calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties 54 | $distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl 55 | if (!$distributionUrl) { 56 | Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" 57 | } 58 | 59 | switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { 60 | "maven-mvnd-*" { 61 | $USE_MVND = $true 62 | $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" 63 | $MVN_CMD = "mvnd.cmd" 64 | break 65 | } 66 | default { 67 | $USE_MVND = $false 68 | $MVN_CMD = $script -replace '^mvnw','mvn' 69 | break 70 | } 71 | } 72 | 73 | # apply MVNW_REPOURL and calculate MAVEN_HOME 74 | # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ 75 | if ($env:MVNW_REPOURL) { 76 | $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } 77 | $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" 78 | } 79 | $distributionUrlName = $distributionUrl -replace '^.*/','' 80 | $distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' 81 | 82 | $MAVEN_M2_PATH = "$HOME/.m2" 83 | if ($env:MAVEN_USER_HOME) { 84 | $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" 85 | } 86 | 87 | if (-not (Test-Path -Path $MAVEN_M2_PATH)) { 88 | New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null 89 | } 90 | 91 | $MAVEN_WRAPPER_DISTS = $null 92 | if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { 93 | $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" 94 | } else { 95 | $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" 96 | } 97 | 98 | $MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" 99 | $MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' 100 | $MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" 101 | 102 | if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { 103 | Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" 104 | Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" 105 | exit $? 106 | } 107 | 108 | if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { 109 | Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" 110 | } 111 | 112 | # prepare tmp dir 113 | $TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile 114 | $TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" 115 | $TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null 116 | trap { 117 | if ($TMP_DOWNLOAD_DIR.Exists) { 118 | try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } 119 | catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } 120 | } 121 | } 122 | 123 | New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null 124 | 125 | # Download and Install Apache Maven 126 | Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." 127 | Write-Verbose "Downloading from: $distributionUrl" 128 | Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" 129 | 130 | $webclient = New-Object System.Net.WebClient 131 | if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { 132 | $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) 133 | } 134 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 135 | $webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null 136 | 137 | # If specified, validate the SHA-256 sum of the Maven distribution zip file 138 | $distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum 139 | if ($distributionSha256Sum) { 140 | if ($USE_MVND) { 141 | Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." 142 | } 143 | Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash 144 | if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { 145 | Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." 146 | } 147 | } 148 | 149 | # unzip and move 150 | Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null 151 | 152 | # Find the actual extracted directory name (handles snapshots where filename != directory name) 153 | $actualDistributionDir = "" 154 | 155 | # First try the expected directory name (for regular distributions) 156 | $expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" 157 | $expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" 158 | if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { 159 | $actualDistributionDir = $distributionUrlNameMain 160 | } 161 | 162 | # If not found, search for any directory with the Maven executable (for snapshots) 163 | if (!$actualDistributionDir) { 164 | Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { 165 | $testPath = Join-Path $_.FullName "bin/$MVN_CMD" 166 | if (Test-Path -Path $testPath -PathType Leaf) { 167 | $actualDistributionDir = $_.Name 168 | } 169 | } 170 | } 171 | 172 | if (!$actualDistributionDir) { 173 | Write-Error "Could not find Maven distribution directory in extracted archive" 174 | } 175 | 176 | Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" 177 | Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null 178 | try { 179 | Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null 180 | } catch { 181 | if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { 182 | Write-Error "fail to move MAVEN_HOME" 183 | } 184 | } finally { 185 | try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } 186 | catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } 187 | } 188 | 189 | Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" 190 | -------------------------------------------------------------------------------- /vaadin-editable-label-demo/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | 8 | software.xdev 9 | vaadin-editable-label-root 10 | 2.1.4-SNAPSHOT 11 | 12 | 13 | vaadin-editable-label-demo 14 | 2.1.4-SNAPSHOT 15 | jar 16 | 17 | 18 | XDEV Software 19 | https://xdev.software 20 | 21 | 22 | 23 | 17 24 | ${javaVersion} 25 | 26 | UTF-8 27 | UTF-8 28 | 29 | software.xdev.vaadin.Application 30 | 31 | 32 | 24.9.3 33 | 34 | 3.5.6 35 | 36 | 37 | 38 | 39 | 40 | com.vaadin 41 | vaadin-bom 42 | pom 43 | import 44 | ${vaadin.version} 45 | 46 | 47 | 48 | 49 | 50 | 51 | org.springframework.boot 52 | spring-boot-dependencies 53 | ${org.springframework.boot.version} 54 | pom 55 | import 56 | 57 | 58 | 59 | 60 | 61 | 62 | com.vaadin 63 | vaadin-core 64 | 65 | 66 | 67 | com.vaadin 68 | hilla-dev 69 | 70 | 71 | com.vaadin 72 | copilot 73 | 74 | 75 | 76 | com.vaadin 77 | vaadin-material-theme 78 | 79 | 80 | 81 | com.vaadin 82 | flow-react 83 | 84 | 85 | 86 | com.vaadin 87 | collaboration-engine 88 | 89 | 90 | 91 | com.vaadin.servletdetector 92 | throw-if-servlet3 93 | 94 | 95 | 96 | 97 | software.xdev 98 | vaadin-editable-label 99 | ${project.version} 100 | 101 | 102 | 103 | 104 | com.vaadin 105 | vaadin-spring-boot-starter 106 | 107 | 108 | 109 | com.vaadin 110 | hilla 111 | 112 | 113 | 114 | 115 | 116 | org.yaml 117 | snakeyaml 118 | 119 | 120 | org.springframework.boot 121 | spring-boot-devtools 122 | true 123 | 124 | 125 | 126 | 127 | ${project.artifactId} 128 | 129 | 130 | 131 | 132 | org.springframework.boot 133 | spring-boot-maven-plugin 134 | ${org.springframework.boot.version} 135 | 136 | 137 | 138 | 139 | 140 | 141 | org.codehaus.mojo 142 | exec-maven-plugin 143 | 3.6.2 144 | 145 | 146 | patch-package-json-overrides 147 | compile 148 | 149 | java 150 | 151 | 152 | software.xdev.vaadin.vpjo.Launcher 153 | 154 | ${project.basedir} 155 | ${project.build.directory} 156 | 157 | false 158 | true 159 | 160 | software.xdev 161 | vaadin-package-json-optimizer 162 | 163 | 164 | 165 | 166 | 167 | 168 | software.xdev 169 | vaadin-package-json-optimizer 170 | 1.0.0 171 | 172 | 173 | 174 | 175 | com.vaadin 176 | vaadin-maven-plugin 177 | ${vaadin.version} 178 | 179 | 180 | 181 | prepare-frontend 182 | 183 | 184 | 185 | 186 | 187 | 188 | false 189 | 190 | false 191 | 192 | 193 | 194 | 195 | software.xdev 196 | *vaadin* 197 | 198 | 199 | com.vaadin 200 | 201 | 202 | 203 | 204 | com.vaadin.external* 205 | 206 | 207 | 208 | 209 | 210 | 211 | org.apache.maven.plugins 212 | maven-compiler-plugin 213 | 3.14.1 214 | 215 | ${maven.compiler.release} 216 | 217 | -proc:none 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | dev 227 | 228 | true 229 | 230 | 231 | 232 | software.xdev 233 | vaadin-package-json-optimizer 234 | 1.0.0 235 | 236 | 237 | 238 | 239 | production 240 | 241 | 242 | 243 | com.vaadin 244 | vaadin-core 245 | 246 | 247 | com.vaadin 248 | vaadin-dev 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | com.vaadin 257 | vaadin-maven-plugin 258 | ${vaadin.version} 259 | 260 | 261 | 262 | prepare-frontend 263 | build-frontend 264 | 265 | 266 | 267 | 268 | 269 | org.springframework.boot 270 | spring-boot-maven-plugin 271 | 272 | ${mainClass} 273 | 274 | 275 | 276 | repackage 277 | 278 | repackage 279 | 280 | package 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | -------------------------------------------------------------------------------- /vaadin-editable-label/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | software.xdev 8 | vaadin-editable-label 9 | 2.1.4-SNAPSHOT 10 | jar 11 | 12 | Editable Labels for Vaadin 13 | Editable Labels for Vaadin 14 | https://github.com/xdev-software/vaadin-editable-label 15 | 16 | 17 | https://github.com/xdev-software/vaadin-editable-label 18 | scm:git:https://github.com/xdev-software/vaadin-editable-label.git 19 | 20 | 21 | 2023 22 | 23 | 24 | XDEV Software 25 | https://xdev.software 26 | 27 | 28 | 29 | 30 | XDEV Software 31 | XDEV Software 32 | https://xdev.software 33 | 34 | 35 | 36 | 37 | 38 | Apache-2.0 39 | https://www.apache.org/licenses/LICENSE-2.0.txt 40 | repo 41 | 42 | 43 | 44 | 45 | 17 46 | ${javaVersion} 47 | 48 | UTF-8 49 | UTF-8 50 | 51 | 52 | 24.9.3 53 | 54 | 55 | 56 | 57 | 58 | com.vaadin 59 | vaadin-bom 60 | pom 61 | import 62 | ${vaadin.version} 63 | 64 | 65 | 66 | 67 | 68 | 69 | com.vaadin 70 | vaadin-core 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | org.apache.maven.plugins 80 | maven-site-plugin 81 | 4.0.0-M16 82 | 83 | 84 | org.apache.maven.plugins 85 | maven-project-info-reports-plugin 86 | 3.9.0 87 | 88 | 89 | 90 | 91 | 92 | com.mycila 93 | license-maven-plugin 94 | 5.0.0 95 | 96 | 97 | ${project.organization.url} 98 | 99 | 100 | 101 |
com/mycila/maven/plugin/license/templates/APACHE-2.txt
102 | 103 | src/main/java/** 104 | src/test/java/** 105 | 106 |
107 |
108 |
109 | 110 | 111 | first 112 | 113 | format 114 | 115 | process-sources 116 | 117 | 118 |
119 | 120 | 121 | org.apache.maven.plugins 122 | maven-compiler-plugin 123 | 3.14.1 124 | 125 | ${maven.compiler.release} 126 | 127 | -proc:none 128 | 129 | 130 | 131 | 132 | org.apache.maven.plugins 133 | maven-javadoc-plugin 134 | 3.12.0 135 | 136 | 137 | attach-javadocs 138 | package 139 | 140 | jar 141 | 142 | 143 | 144 | 145 | true 146 | none 147 | 148 | 149 | 150 | org.apache.maven.plugins 151 | maven-source-plugin 152 | 3.3.1 153 | 154 | 155 | attach-sources 156 | package 157 | 158 | jar-no-fork 159 | 160 | 161 | 162 | 163 | 164 | org.apache.maven.plugins 165 | maven-jar-plugin 166 | 3.4.2 167 | 168 | 169 | true 170 | 171 | false 172 | true 173 | 174 | 175 | 176 | 1 177 | 178 | 179 | 180 | 181 | 182 | META-INF/VAADIN/ 183 | 184 | 185 | 186 | 187 |
188 |
189 | 190 | 191 | publish 192 | 193 | 194 | 195 | org.codehaus.mojo 196 | flatten-maven-plugin 197 | 1.7.3 198 | 199 | ossrh 200 | 201 | 202 | 203 | flatten 204 | process-resources 205 | 206 | flatten 207 | 208 | 209 | 210 | 211 | 212 | org.apache.maven.plugins 213 | maven-gpg-plugin 214 | 3.2.8 215 | 216 | 217 | sign-artifacts 218 | verify 219 | 220 | sign 221 | 222 | 223 | 224 | 225 | 226 | --pinentry-mode 227 | loopback 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | publish-sonatype-central-portal 238 | 239 | 240 | 241 | org.sonatype.central 242 | central-publishing-maven-plugin 243 | 0.9.0 244 | true 245 | 246 | sonatype-central-portal 247 | true 248 | 249 | 250 | 251 | 252 | 253 | 254 | checkstyle 255 | 256 | 257 | 258 | org.apache.maven.plugins 259 | maven-checkstyle-plugin 260 | 3.6.0 261 | 262 | 263 | com.puppycrawl.tools 264 | checkstyle 265 | 12.1.0 266 | 267 | 268 | 269 | ../.config/checkstyle/checkstyle.xml 270 | true 271 | 272 | 273 | 274 | 275 | check 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | pmd 285 | 286 | 287 | 288 | org.apache.maven.plugins 289 | maven-pmd-plugin 290 | 3.28.0 291 | 292 | true 293 | true 294 | true 295 | 296 | ../.config/pmd/java/ruleset.xml 297 | 298 | 299 | 300 | 301 | net.sourceforge.pmd 302 | pmd-core 303 | 7.17.0 304 | 305 | 306 | net.sourceforge.pmd 307 | pmd-java 308 | 7.17.0 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | org.apache.maven.plugins 319 | maven-jxr-plugin 320 | 3.6.0 321 | 322 | 323 | 324 | 325 | 326 |
327 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2024 XDEV Software 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Apache Maven Wrapper startup batch script, version 3.3.4 23 | # 24 | # Optional ENV vars 25 | # ----------------- 26 | # JAVA_HOME - location of a JDK home dir, required when download maven via java source 27 | # MVNW_REPOURL - repo url base for downloading maven distribution 28 | # MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven 29 | # MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output 30 | # ---------------------------------------------------------------------------- 31 | 32 | set -euf 33 | [ "${MVNW_VERBOSE-}" != debug ] || set -x 34 | 35 | # OS specific support. 36 | native_path() { printf %s\\n "$1"; } 37 | case "$(uname)" in 38 | CYGWIN* | MINGW*) 39 | [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" 40 | native_path() { cygpath --path --windows "$1"; } 41 | ;; 42 | esac 43 | 44 | # set JAVACMD and JAVACCMD 45 | set_java_home() { 46 | # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched 47 | if [ -n "${JAVA_HOME-}" ]; then 48 | if [ -x "$JAVA_HOME/jre/sh/java" ]; then 49 | # IBM's JDK on AIX uses strange locations for the executables 50 | JAVACMD="$JAVA_HOME/jre/sh/java" 51 | JAVACCMD="$JAVA_HOME/jre/sh/javac" 52 | else 53 | JAVACMD="$JAVA_HOME/bin/java" 54 | JAVACCMD="$JAVA_HOME/bin/javac" 55 | 56 | if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then 57 | echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 58 | echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 59 | return 1 60 | fi 61 | fi 62 | else 63 | JAVACMD="$( 64 | 'set' +e 65 | 'unset' -f command 2>/dev/null 66 | 'command' -v java 67 | )" || : 68 | JAVACCMD="$( 69 | 'set' +e 70 | 'unset' -f command 2>/dev/null 71 | 'command' -v javac 72 | )" || : 73 | 74 | if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then 75 | echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 76 | return 1 77 | fi 78 | fi 79 | } 80 | 81 | # hash string like Java String::hashCode 82 | hash_string() { 83 | str="${1:-}" h=0 84 | while [ -n "$str" ]; do 85 | char="${str%"${str#?}"}" 86 | h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) 87 | str="${str#?}" 88 | done 89 | printf %x\\n $h 90 | } 91 | 92 | verbose() { :; } 93 | [ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } 94 | 95 | die() { 96 | printf %s\\n "$1" >&2 97 | exit 1 98 | } 99 | 100 | trim() { 101 | # MWRAPPER-139: 102 | # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. 103 | # Needed for removing poorly interpreted newline sequences when running in more 104 | # exotic environments such as mingw bash on Windows. 105 | printf "%s" "${1}" | tr -d '[:space:]' 106 | } 107 | 108 | scriptDir="$(dirname "$0")" 109 | scriptName="$(basename "$0")" 110 | 111 | # parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties 112 | while IFS="=" read -r key value; do 113 | case "${key-}" in 114 | distributionUrl) distributionUrl=$(trim "${value-}") ;; 115 | distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; 116 | esac 117 | done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" 118 | [ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" 119 | 120 | case "${distributionUrl##*/}" in 121 | maven-mvnd-*bin.*) 122 | MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ 123 | case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in 124 | *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; 125 | :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; 126 | :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; 127 | :Linux*x86_64*) distributionPlatform=linux-amd64 ;; 128 | *) 129 | echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 130 | distributionPlatform=linux-amd64 131 | ;; 132 | esac 133 | distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" 134 | ;; 135 | maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; 136 | *) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; 137 | esac 138 | 139 | # apply MVNW_REPOURL and calculate MAVEN_HOME 140 | # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ 141 | [ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" 142 | distributionUrlName="${distributionUrl##*/}" 143 | distributionUrlNameMain="${distributionUrlName%.*}" 144 | distributionUrlNameMain="${distributionUrlNameMain%-bin}" 145 | MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" 146 | MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" 147 | 148 | exec_maven() { 149 | unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : 150 | exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" 151 | } 152 | 153 | if [ -d "$MAVEN_HOME" ]; then 154 | verbose "found existing MAVEN_HOME at $MAVEN_HOME" 155 | exec_maven "$@" 156 | fi 157 | 158 | case "${distributionUrl-}" in 159 | *?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; 160 | *) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; 161 | esac 162 | 163 | # prepare tmp dir 164 | if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then 165 | clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } 166 | trap clean HUP INT TERM EXIT 167 | else 168 | die "cannot create temp dir" 169 | fi 170 | 171 | mkdir -p -- "${MAVEN_HOME%/*}" 172 | 173 | # Download and Install Apache Maven 174 | verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." 175 | verbose "Downloading from: $distributionUrl" 176 | verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" 177 | 178 | # select .zip or .tar.gz 179 | if ! command -v unzip >/dev/null; then 180 | distributionUrl="${distributionUrl%.zip}.tar.gz" 181 | distributionUrlName="${distributionUrl##*/}" 182 | fi 183 | 184 | # verbose opt 185 | __MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' 186 | [ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v 187 | 188 | # normalize http auth 189 | case "${MVNW_PASSWORD:+has-password}" in 190 | '') MVNW_USERNAME='' MVNW_PASSWORD='' ;; 191 | has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; 192 | esac 193 | 194 | if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then 195 | verbose "Found wget ... using wget" 196 | wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" 197 | elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then 198 | verbose "Found curl ... using curl" 199 | curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" 200 | elif set_java_home; then 201 | verbose "Falling back to use Java to download" 202 | javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" 203 | targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" 204 | cat >"$javaSource" <<-END 205 | public class Downloader extends java.net.Authenticator 206 | { 207 | protected java.net.PasswordAuthentication getPasswordAuthentication() 208 | { 209 | return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); 210 | } 211 | public static void main( String[] args ) throws Exception 212 | { 213 | setDefault( new Downloader() ); 214 | java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); 215 | } 216 | } 217 | END 218 | # For Cygwin/MinGW, switch paths to Windows format before running javac and java 219 | verbose " - Compiling Downloader.java ..." 220 | "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" 221 | verbose " - Running Downloader.java ..." 222 | "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" 223 | fi 224 | 225 | # If specified, validate the SHA-256 sum of the Maven distribution zip file 226 | if [ -n "${distributionSha256Sum-}" ]; then 227 | distributionSha256Result=false 228 | if [ "$MVN_CMD" = mvnd.sh ]; then 229 | echo "Checksum validation is not supported for maven-mvnd." >&2 230 | echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 231 | exit 1 232 | elif command -v sha256sum >/dev/null; then 233 | if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then 234 | distributionSha256Result=true 235 | fi 236 | elif command -v shasum >/dev/null; then 237 | if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then 238 | distributionSha256Result=true 239 | fi 240 | else 241 | echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 242 | echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 243 | exit 1 244 | fi 245 | if [ $distributionSha256Result = false ]; then 246 | echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 247 | echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 248 | exit 1 249 | fi 250 | fi 251 | 252 | # unzip and move 253 | if command -v unzip >/dev/null; then 254 | unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" 255 | else 256 | tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" 257 | fi 258 | 259 | # Find the actual extracted directory name (handles snapshots where filename != directory name) 260 | actualDistributionDir="" 261 | 262 | # First try the expected directory name (for regular distributions) 263 | if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then 264 | if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then 265 | actualDistributionDir="$distributionUrlNameMain" 266 | fi 267 | fi 268 | 269 | # If not found, search for any directory with the Maven executable (for snapshots) 270 | if [ -z "$actualDistributionDir" ]; then 271 | # enable globbing to iterate over items 272 | set +f 273 | for dir in "$TMP_DOWNLOAD_DIR"/*; do 274 | if [ -d "$dir" ]; then 275 | if [ -f "$dir/bin/$MVN_CMD" ]; then 276 | actualDistributionDir="$(basename "$dir")" 277 | break 278 | fi 279 | fi 280 | done 281 | set -f 282 | fi 283 | 284 | if [ -z "$actualDistributionDir" ]; then 285 | verbose "Contents of $TMP_DOWNLOAD_DIR:" 286 | verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" 287 | die "Could not find Maven distribution directory in extracted archive" 288 | fi 289 | 290 | verbose "Found extracted Maven distribution directory: $actualDistributionDir" 291 | printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" 292 | mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" 293 | 294 | clean || : 295 | exec_maven "$@" 296 | -------------------------------------------------------------------------------- /vaadin-editable-label/src/main/java/software/xdev/vaadin/editable_label/AbstractEditableLabel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2023 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.editable_label; 17 | 18 | import java.util.Objects; 19 | import java.util.function.Consumer; 20 | import java.util.function.Supplier; 21 | import java.util.stream.Stream; 22 | 23 | import com.vaadin.flow.component.AbstractCompositeField; 24 | import com.vaadin.flow.component.ClickEvent; 25 | import com.vaadin.flow.component.Component; 26 | import com.vaadin.flow.component.ComponentEvent; 27 | import com.vaadin.flow.component.ComponentEventListener; 28 | import com.vaadin.flow.component.Focusable; 29 | import com.vaadin.flow.component.HasSize; 30 | import com.vaadin.flow.component.HasStyle; 31 | import com.vaadin.flow.component.HasValue; 32 | import com.vaadin.flow.component.ItemLabelGenerator; 33 | import com.vaadin.flow.component.Key; 34 | import com.vaadin.flow.component.button.Button; 35 | import com.vaadin.flow.component.button.ButtonVariant; 36 | import com.vaadin.flow.component.dependency.CssImport; 37 | import com.vaadin.flow.component.html.Div; 38 | import com.vaadin.flow.component.html.Span; 39 | import com.vaadin.flow.component.icon.VaadinIcon; 40 | import com.vaadin.flow.shared.Registration; 41 | 42 | 43 | /** 44 | * Describes a label which is editable. 45 | *

46 | * The default implementation is {@link EditableLabel} 47 | * 48 | * @param own extending class (self). 49 | * @param value type which is handled through this component 50 | * @param Vaadin-{@link Component} to edit the value 51 | * 52 | * @author AB 53 | * @author JR 54 | */ 55 | @CssImport(value = EditableLabelStyles.LOCATION) 56 | public abstract class AbstractEditableLabel< 57 | S extends AbstractEditableLabel, 58 | C extends Component & HasSize & HasStyle & HasValue, 59 | V> 60 | extends AbstractCompositeField // Using div because shadow root causes otherwise styling issues 61 | implements 62 | HasStyle, 63 | HasSize 64 | { 65 | /* 66 | * UI-Components 67 | */ 68 | protected final Button btnEdit = new Button(VaadinIcon.PENCIL.create()); 69 | protected final Button btnSave = new Button(VaadinIcon.CHECK.create()); 70 | protected final Button btnClose = new Button(VaadinIcon.CLOSE.create()); 71 | protected final Span label = new Span(); 72 | 73 | protected final C editor; 74 | 75 | /* 76 | * Suppliers / Configuration 77 | */ 78 | protected ItemLabelGenerator nativeLabelGenerator; 79 | protected String emptyLabelValue = ""; 80 | 81 | protected AbstractEditableLabel(final C editor, final Consumer additionalInitActions) 82 | { 83 | super(editor.getEmptyValue()); 84 | 85 | this.editor = editor; 86 | 87 | this.initUI(); 88 | this.registerListeners(); 89 | 90 | if(additionalInitActions != null) 91 | { 92 | additionalInitActions.accept(this.self()); 93 | } 94 | 95 | // initial UI state 96 | this.disableEditMode(); 97 | this.withLabelGenerator(Object::toString); 98 | } 99 | 100 | protected void initUI() 101 | { 102 | this.addClassName(EditableLabelStyles.CONTAINER); 103 | 104 | this.label.addClassName(EditableLabelStyles.LABEL); 105 | 106 | this.btnEdit.addClassName(EditableLabelStyles.EDIT_BUTTON); 107 | 108 | this.btnSave.addClickShortcut(Key.ENTER); 109 | 110 | this.btnClose.addClickShortcut(Key.ESCAPE); 111 | 112 | Stream.of(this.btnEdit, this.btnSave, this.btnClose) 113 | .forEach(btn -> { 114 | btn.addClassName(EditableLabelStyles.BUTTON); 115 | btn.addThemeVariants(ButtonVariant.LUMO_SMALL, ButtonVariant.LUMO_TERTIARY); 116 | }); 117 | 118 | this.getEditor().addClassName(EditableLabelStyles.EDITOR); 119 | this.getEditor().setWidthFull(); 120 | 121 | this.getContent().add(this.label, this.editor, this.btnEdit, this.btnSave, this.btnClose); 122 | } 123 | 124 | // region Listeners 125 | 126 | protected void registerListeners() 127 | { 128 | this.btnEdit.addClickListener(this::onEdit); 129 | this.btnSave.addClickListener(this::onSave); 130 | this.btnClose.addClickListener(this::onClose); 131 | } 132 | 133 | protected void onEdit(final ClickEvent