https://github.com/alipsa/guiinteraction
Allows Gade Gui Interactive capabilities from a standalone app
https://github.com/alipsa/guiinteraction
Last synced: about 1 month ago
JSON representation
Allows Gade Gui Interactive capabilities from a standalone app
- Host: GitHub
- URL: https://github.com/alipsa/guiinteraction
- Owner: Alipsa
- License: mit
- Created: 2023-10-16T18:44:48.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-25T18:00:28.000Z (over 1 year ago)
- Last Synced: 2025-02-25T19:19:16.153Z (over 1 year ago)
- Language: Groovy
- Size: 277 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GuiInteraction
A library providing GUI interaction capabilities for Groovy applications, compatible with [Gade](https://github.com/Alipsa/gade).
## Overview
GuiInteraction enables standalone Groovy applications to have the same user interaction capabilities as when running in Gade. Choose the implementation that fits your environment:
| Module | UI Technology | JDK Requirements | Best For |
|---------------------------|---------------|------------------------------------------------|---------------------------------------|
| [gi-fx](gi-fx/) | JavaFX | JDK with JavaFX (e.g., BellSoft Liberica Full) | Rich desktop apps |
| [gi-swing](gi-swing/) | Swing | Any JDK 21+ | Cross-platform desktop apps |
| [gi-console](gi-console/) | Console/Text | Any JDK 21+ | Terminal and Headless/CI environments |
## Features
- File and directory choosers
- User prompts (text, password, selections)
- Date and year-month pickers
- HTML and Markdown content viewing
- Table/Matrix display
- Clipboard operations
- Content type detection (via Apache Tika)
- Resource loading utilities
## Quick Start
### Gradle
```groovy
dependencies {
implementation 'se.alipsa.gi:gi-swing:0.3.0' // or gi-fx, gi-console
}
```
### Maven
```xml
se.alipsa.gi
gi-swing
0.3.0
```
### Groovy Script with Grape
```groovy
@Grab(group:'se.alipsa.gi', module:'gi-swing', version:'0.3.0')
import se.alipsa.gi.swing.InOut
def io = new InOut()
def file = io.chooseFile("Choose a file", ".", "Pick a file please!")
println("File chosen was $file")
```
## Gade Compatibility
Scripts can run both in Gade and standalone by checking for the `io` variable:
```groovy
// This makes the code run equally in Gade and in a standalone Groovy script
if (!binding.hasVariable('io')) {
@Grab(group:'se.alipsa.gi', module:'gi-swing', version:'0.3.0')
import se.alipsa.gi.swing.InOut
binding.setVariable('io', new InOut())
}
def file = io.chooseFile("Choose a file", ".", "Pick a file please!")
println("File chosen was $file")
```
## Documentation
- [API Guide](docs/API-Guide.md) - Detailed usage examples
- [gi-common](gi-common/) - Core interfaces and utilities
- [gi-fx](gi-fx/) - JavaFX implementation
- [gi-swing](gi-swing/) - Swing implementation
- [gi-console](gi-console/) - Console implementation
## Building from Source
```bash
./gradlew build
```
When `org.gradle.configuration-cache=true` is enabled, `build` skips applying Spotless and SpotBugs because their current Gradle tasks are not configuration-cache compatible on Gradle 9. Run the full verification lifecycle explicitly with:
```bash
./gradlew check --no-configuration-cache
```
## Requirements
- JDK 21 or later
- For gi-fx: JDK with JavaFX support (e.g., BellSoft Liberica Full JDK)
## License
MIT License - see [LICENSE](LICENSE)