-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from charphi/feature-desktop-plugin
Add desktop plugin example
- Loading branch information
Showing
8 changed files
with
307 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,24 @@ | ||
# JDemetra+ v3 - examples extensions | ||
|
||
This repository contains Java examples of how to use the [JDemetra+ v3 libraries](https://github.com/jdemetra/jdplus-main). | ||
|
||
## Developing | ||
|
||
This project is written in Java and uses [Apache Maven](https://maven.apache.org/) as a build tool. | ||
It requires [Java 17 as minimum version](https://whichjdk.com/) and all its dependencies are hosted on [Maven Central](https://search.maven.org/). | ||
|
||
The code can be build using any IDE or by just type-in the following commands in a terminal: | ||
```shell | ||
git clone https://github.com/jdemetra/jdplus-examples.git | ||
cd jdplus-examples | ||
mvn clean install | ||
``` | ||
|
||
## Contributing | ||
|
||
Any contribution is welcome and should be done through pull requests and/or issues. | ||
|
||
## Licensing | ||
|
||
The code of this project is licensed under the [European Union Public Licence (EUPL)](https://joinup.ec.europa.eu/page/eupl-text-11-12). | ||
|
134 changes: 134 additions & 0 deletions
134
jdplus-examples-desktop/jdplus-examples-desktop-plugin/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>eu.europa.ec.joinup.sat</groupId> | ||
<artifactId>jdplus-examples-desktop</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>jdplus-examples-desktop-plugin</artifactId> | ||
<packaging>nbm</packaging> | ||
|
||
<name>${project.artifactId}</name> | ||
<description>${project.parent.artifactId} - ${project.artifactId}</description> | ||
<url>${project.parent.url}</url> | ||
|
||
<dependencies> | ||
<!-- 1. NetBeans Platform --> | ||
<dependency> | ||
<groupId>org.netbeans.api</groupId> | ||
<artifactId>org-openide-util</artifactId> | ||
<version>${netbeans.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.netbeans.api</groupId> | ||
<artifactId>org-openide-awt</artifactId> | ||
<version>${netbeans.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.netbeans.api</groupId> | ||
<artifactId>org-openide-filesystems</artifactId> | ||
<version>${netbeans.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.netbeans.api</groupId> | ||
<artifactId>org-openide-nodes</artifactId> | ||
<version>${netbeans.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.netbeans.api</groupId> | ||
<artifactId>org-openide-windows</artifactId> | ||
<version>${netbeans.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.netbeans.api</groupId> | ||
<artifactId>org-openide-explorer</artifactId> | ||
<version>${netbeans.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.netbeans.api</groupId> | ||
<artifactId>org-openide-util-lookup</artifactId> | ||
<version>${netbeans.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.netbeans.api</groupId> | ||
<artifactId>org-openide-dialogs</artifactId> | ||
<version>${netbeans.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.netbeans.api</groupId> | ||
<artifactId>org-netbeans-api-progress</artifactId> | ||
<version>${netbeans.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.netbeans.api</groupId> | ||
<artifactId>org-openide-util-ui</artifactId> | ||
<version>${netbeans.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.netbeans.api</groupId> | ||
<artifactId>org-netbeans-api-progress-nb</artifactId> | ||
<version>${netbeans.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.netbeans.api</groupId> | ||
<artifactId>org-openide-filesystems-nb</artifactId> | ||
<version>${netbeans.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.netbeans.api</groupId> | ||
<artifactId>org-netbeans-swing-outline</artifactId> | ||
<version>${netbeans.version}</version> | ||
</dependency> | ||
|
||
<!-- 2. JD3 Desktop --> | ||
<dependency> | ||
<groupId>eu.europa.ec.joinup.sat</groupId> | ||
<artifactId>jdplus-main-desktop-design</artifactId> | ||
<version>${jdplus-main.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>eu.europa.ec.joinup.sat</groupId> | ||
<artifactId>jdplus-toolkit-desktop-plugin</artifactId> | ||
<version>${jdplus-main.version}</version> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.netbeans.api</groupId> | ||
<artifactId>*</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>com.github.nbbrd.java-io-util</groupId> | ||
<artifactId>*</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
|
||
<!-- 3. JD3 Base --> | ||
<!-- <dependency>--> | ||
<!-- <groupId>eu.europa.ec.joinup.sat</groupId>--> | ||
<!-- <artifactId>jdplus-examples-base-core</artifactId>--> | ||
<!-- <version>${project.version}</version>--> | ||
<!-- </dependency>--> | ||
|
||
<!-- 4. Other libraries --> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.netbeans.utilities</groupId> | ||
<artifactId>nbm-maven-plugin</artifactId> | ||
<extensions>true</extensions> | ||
<configuration> | ||
<publicPackages> | ||
</publicPackages> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
46 changes: 46 additions & 0 deletions
46
...p-plugin/src/main/java/jdplus/examples/desktop/plugin/ProcDocumentItemFactoryExample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package jdplus.examples.desktop.plugin; | ||
|
||
|
||
import jdplus.toolkit.base.api.processing.ProcDocument; | ||
import jdplus.toolkit.base.api.util.Id; | ||
import jdplus.toolkit.base.api.util.LinearId; | ||
import jdplus.toolkit.desktop.plugin.ui.processing.IProcDocumentItemFactory; | ||
import nbbrd.design.DirectImpl; | ||
import nbbrd.service.ServiceProvider; | ||
import org.checkerframework.checker.nullness.qual.NonNull; | ||
|
||
import javax.swing.*; | ||
|
||
@DirectImpl | ||
@ServiceProvider | ||
public final class ProcDocumentItemFactoryExample implements IProcDocumentItemFactory { | ||
|
||
@Override | ||
public int getPosition() { | ||
return 1000; | ||
} | ||
|
||
@Override | ||
public @NonNull Class<? extends ProcDocument> getDocumentType() { | ||
return ProcDocument.class; | ||
} | ||
|
||
@Override | ||
public @NonNull Id getItemId() { | ||
return new LinearId("_ROOT_", "_CHILD_"); | ||
} | ||
|
||
@Override | ||
public @NonNull JComponent getView(@NonNull ProcDocument procDocument) throws IllegalArgumentException { | ||
JTextArea result = new JTextArea(); | ||
result.setEditable(false); | ||
result.setText(getProcDocumentAsString(procDocument)); | ||
return new JScrollPane(result); | ||
} | ||
|
||
private static String getProcDocumentAsString(ProcDocument<?, ?, ?> procDocument) { | ||
return "KEY = " + procDocument.getKey() + System.lineSeparator() | ||
+ "SPEC = " + procDocument.getSpecification() + System.lineSeparator() | ||
+ "STATUS = " + procDocument.getStatus(); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...s-desktop-plugin/src/main/java/jdplus/examples/desktop/plugin/TsActionOpenSpiExample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package jdplus.examples.desktop.plugin; | ||
|
||
import jdplus.toolkit.base.api.timeseries.Ts; | ||
import jdplus.toolkit.desktop.plugin.TsActionOpenSpi; | ||
import jdplus.toolkit.desktop.plugin.notification.MessageUtil; | ||
import nbbrd.design.DirectImpl; | ||
import nbbrd.service.ServiceProvider; | ||
import org.checkerframework.checker.nullness.qual.NonNull; | ||
|
||
@DirectImpl | ||
@ServiceProvider | ||
public final class TsActionOpenSpiExample implements TsActionOpenSpi { | ||
|
||
@Override | ||
public void open(@NonNull Ts ts) { | ||
MessageUtil.info("You just opened '" + ts.getName() + "'"); | ||
} | ||
|
||
@Override | ||
public @NonNull String getName() { | ||
return "Message box with TS name"; | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
jdplus-examples-desktop/jdplus-examples-desktop-plugin/src/main/javadoc/EmptyJavaDoc.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* Workaround for JavaDoc issues with Lombok. | ||
*/ | ||
public class EmptyJavaDoc { | ||
|
||
} |
4 changes: 4 additions & 0 deletions
4
jdplus-examples-desktop/jdplus-examples-desktop-plugin/src/main/nbm/manifest.mf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Manifest-Version: 1.0 | ||
OpenIDE-Module-Localizing-Bundle: jdplus/examples/desktop/plugin/Bundle.properties | ||
OpenIDE-Module-Display-Category: JD+ Examples | ||
OpenIDE-Module-Java-Dependencies: Java > 17 |
6 changes: 6 additions & 0 deletions
6
...amples-desktop-plugin/src/main/resources/jdplus/examples/desktop/plugin/Bundle.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Localized module labels. Defaults taken from POM (<name>, <description>, <groupId>) if unset. | ||
#OpenIDE-Module-Name= | ||
#OpenIDE-Module-Short-Description= | ||
#OpenIDE-Module-Long-Description= | ||
#OpenIDE-Module-Display-Category= | ||
#Wed Mar 09 13:57:24 CET 2022 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters