Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
astrapi69 committed Oct 18, 2023
2 parents 70875aa + c747892 commit 3466a60
Show file tree
Hide file tree
Showing 21 changed files with 342 additions and 190 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
## Change log
----------------------

Version 3.4
-------------

ADDED:

- new field UNKNOWN in enum MenuType and Anchor for default return value in a search algorithm

CHANGED:

- update of gradle to new version 8.4
- update of lombok to new version 1.18.30
- update of gradle-plugin dependency 'io.freefair.gradle:lombok-plugin' to new version 8.4
- update of gradle-plugin dependency 'com.github.ben-manes.versions.gradle.plugin' to new version 0.49.0
- update of gradle-plugin dependency 'com.diffplug.spotless:spotless-plugin-gradle' to new version 6.22.0
- update of dependency gen-tree to new major version 9
- removed dependency 'javax.help:javahelp'
- moved dependency xstream-extensions to test dependency

Version 3.3
-------------

Expand Down
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,20 @@ The source code comes under the liberal MIT License, making menu-action great fo

## gradle dependency

Replace the variable ${latestVersion} with the current latest version: [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.astrapi69/menu-action/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.astrapi69/menu-action)

You can first define the version in the ext section and add than the following gradle dependency to
your project `build.gradle` if you want to import the core functionality of menu-action:

define version in file gradle.properties
```
menuActionVersion=3.3
menuActionVersion=${latestVersion}
```

or in build.gradle ext area

```
menuActionVersion = "3.3"
menuActionVersion = "${latestVersion}"
```

and then add the dependency to the dependencies area
Expand All @@ -52,6 +54,27 @@ and then add the dependency to the dependencies area
implementation("io.github.astrapi69:menu-action:$menuActionVersion")
```

## 📸 Snapshots

[![Snapshot](https://img.shields.io/badge/dynamic/xml?url=https://oss.sonatype.org/service/local/repositories/snapshots/content/io/github/astrapi69/menu-action/maven-metadata.xml&label=snapshot&color=red&query=.//versioning/latest)](https://oss.sonatype.org/content/repositories/snapshots/io/github/astrapi69/menu-action/)

This section describes how to import snapshot versions into your project.
Add the following code snippet to your gradle file in the repositories section:

repositories {

//...
```groovy
maven {
name "Sonatype Nexus Snapshots"
url "https://oss.sonatype.org/content/repositories/snapshots"
mavenContent {
snapshotsOnly()
}
}
```
}

## Maven dependency

Maven dependency is now on sonatype.
Expand All @@ -64,19 +87,23 @@ Than you can add the dependency to your dependencies:

<properties>
...
```xml
<!-- menu-action version -->
<menu-action.version>3.3</menu-action.version>
```
...
</properties>
...
<dependencies>
...
```xml
<!-- menu-action DEPENDENCY -->
<dependency>
<groupId>io.github.astrapi69</groupId>
<artifactId>menu-action</artifactId>
<version>${menu-action.version}</version>
</dependency>
```
...
</dependencies>

Expand Down
18 changes: 10 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
######################
# project properties #
######################
projectVersion=3.3
projectVersion=3.4
groupPackage=io.github.astrapi69
projectSourceCompatibility=17
projectInceptionYear=2021
Expand All @@ -23,34 +23,36 @@ projectLicenseDistribution=repo
projectIssueManagementSystem=GitHub
projectRepositoriesReleasesRepoUrl=https://oss.sonatype.org/service/local/staging/deploy/maven2/
projectRepositoriesSnapshotsRepoUrl=https://oss.sonatype.org/content/repositories/snapshots
projectRepositoriesReleasesName=Sonatype Nexus Releases
projectRepositoriesSnapshotsName=Sonatype Nexus Snapshots
projectRepositoriesUserNameKey=ossrhUsername
projectRepositoriesPasswordKey=ossrhPassword
###########################
# gradle-plugins versions #
###########################
gradlePluginLombokVersion=8.3
gradlePluginVersionsVersion=0.48.0
gradlePluginLombokVersion=8.4
gradlePluginVersionsVersion=0.49.0
licenseGradlePluginVersion=0.16.1
grgitGradlePluginVersion=5.2.0
spotlessGradlePluginVersion=6.21.0
spotlessGradlePluginVersion=6.22.0
#########################
# dependencies versions #
#########################
lombokVersion=1.18.28
javahelpVersion=2.0.05
lombokVersion=1.18.30
modelDataVersion=3.1
throwableVersion=2.3
jobjCoreVersion=7.1
designPatternsVersion=6
treeApiVersion=1.5
genTreeVersion=8.4
genTreeVersion=9
idGenerateVersion=1.1
xstreamExtensionsVersion=1.1
sillyCollectionVersion=27
dataApiVersion=4.1
##############################
# test dependencies versions #
##############################
jaxbExtensionsVersion=2.1
xstreamExtensionsVersion=1.1
awtExtensionsVersion=1.1
assertjSwingVersion=3.17.1
fileWorkerVersion=17
Expand Down
4 changes: 2 additions & 2 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
dependencies {
compileOnly("org.projectlombok:lombok:$lombokVersion")
annotationProcessor("org.projectlombok:lombok:$lombokVersion")
implementation("javax.help:javahelp:$javahelpVersion")
implementation("io.github.astrapi69:model-data:$modelDataVersion")
implementation("io.github.astrapi69:jobj-core:$jobjCoreVersion")
implementation("io.github.astrapi69:throwable:$throwableVersion")
implementation("io.github.astrapi69:tree-api:$treeApiVersion")
implementation("io.github.astrapi69:gen-tree:$genTreeVersion")
implementation("io.github.astrapi69:visitor:$designPatternsVersion")
implementation("io.github.astrapi69:id-generate:$idGenerateVersion")
implementation("io.github.astrapi69:xstream-extensions:$xstreamExtensionsVersion")
implementation("io.github.astrapi69:silly-collection:$sillyCollectionVersion")
implementation("io.github.astrapi69:data-api:$dataApiVersion")
testCompileOnly("org.projectlombok:lombok:$lombokVersion")
testAnnotationProcessor("org.projectlombok:lombok:$lombokVersion")
testImplementation("io.github.astrapi69:xstream-extensions:$xstreamExtensionsVersion")
testImplementation("io.github.astrapi69:jaxb-extensions:$jaxbExtensionsVersion")
testImplementation("io.github.astrapi69:awt-extensions:$awtExtensionsVersion")
testImplementation("org.assertj:assertj-swing:$assertjSwingVersion")
testImplementation("io.github.astrapi69:silly-io:$sillyIoVersion")
Expand Down
11 changes: 7 additions & 4 deletions gradle/repositories.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ repositories {
mavenLocal()
mavenCentral()
maven {
name "Sonatype Nexus Releases"
url "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
name "$projectRepositoriesReleasesName"
url "$projectRepositoriesReleasesRepoUrl"
mavenContent {
releasesOnly()
}
}
/**
* With this repository you can provide snapshot versions that are previously deployed on the specified url
**/
maven {
name "Sonatype Nexus Snapshots"
url "https://oss.sonatype.org/content/repositories/snapshots"
name "$projectRepositoriesSnapshotsName"
url "$projectRepositoriesSnapshotsRepoUrl"
mavenContent {
snapshotsOnly()
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Wed Feb 19 18:39:09 CET 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@
import java.awt.Frame;
import java.awt.GraphicsDevice;
import java.awt.event.ActionEvent;
import java.io.Serial;

import javax.swing.AbstractAction;
import javax.swing.JFrame;

import lombok.AccessLevel;
import lombok.NonNull;
import lombok.experimental.FieldDefaults;

/**
Expand All @@ -42,6 +44,7 @@ public class ToggleFullScreenAction extends AbstractAction
{

/** The Constant serialVersionUID. */
@Serial
private static final long serialVersionUID = 1L;

/** The frame. */
Expand All @@ -67,16 +70,24 @@ public ToggleFullScreenAction(final String name, JFrame frame)
@Override
public void actionPerformed(final ActionEvent actionEvent)
{
onToggleFullScreen(actionEvent);
onToggleFullScreen();
}

/**
* Callback method to interact on toggle to full screen
*
* @param actionEvent
* the action event
*/
protected void onToggleFullScreen(final ActionEvent actionEvent)
protected void onToggleFullScreen()
{
ToggleFullScreenAction.toggleFullScreen(frame);
}

/**
* Toggle to full screen and back
*
* @param frame
* the {@link JFrame} object
*/
public static void toggleFullScreen(final @NonNull JFrame frame)
{
GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
import javax.swing.SwingUtilities;
import javax.swing.plaf.ActionMapUIResource;

import io.github.astrapi69.swing.menu.model.KeyStrokeInfo;
import lombok.NonNull;

/**
* The class {@link KeyStrokeExtensions}.
*/
Expand Down Expand Up @@ -102,4 +105,19 @@ public static KeyStroke getKeyStroke(String keystrokeAsString)
return KeyStroke.getKeyStroke(keystrokeAsString);
}

/**
* Factory method that creates a {@link KeyStrokeInfo} object from the given {@link KeyStroke}
* object
*
* @param keyStroke
* the {@link KeyStroke} object
* @return the new created {@link KeyStrokeInfo} object
*/
public static KeyStrokeInfo toKeyStrokeInfo(final @NonNull KeyStroke keyStroke)
{
return KeyStrokeInfo.builder().keyCode(keyStroke.getKeyCode())
.modifiers(keyStroke.getModifiers()).onKeyRelease(keyStroke.isOnKeyRelease())
.keystrokeAsString(keyStroke.toString()).build();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,10 @@ public enum Anchor
* If a source menu component have the position value <code>Anchor#LAST</code> it will be placed
* as the last menu component
*/
LAST
LAST,

/**
* if the anchor type is unknown
*/
UNKNOWN
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,10 @@ public enum MenuType
/**
* Represents the popup menu type
*/
POPUP
POPUP,

/**
* if the menu type is unknown
*/
UNKNOWN
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import javax.swing.JMenu;

import io.github.astrapi69.swing.menu.MenuExtensions;
import io.github.astrapi69.swing.menu.model.MenuInfo;
import io.github.astrapi69.swing.menu.model.MenuItemInfo;
import lombok.NonNull;

Expand All @@ -48,8 +47,7 @@ public class JMenuFactory
*/
public static JMenu newJMenu(final @NonNull String text)
{
return MenuItemInfo.builder().menuInfo(MenuInfo.builder().text(text).build()).build()
.toJMenu();
return MenuItemInfo.builder().text(text).build().toJMenu();
}

/**
Expand All @@ -75,8 +73,7 @@ public static JMenu newJMenu(final @NonNull MenuItemInfo menuItemInfo)
*/
public static JMenu newJMenu(final @NonNull String text, final int mnemonic)
{
return MenuItemInfo.builder()
.menuInfo(MenuInfo.builder().text(text).mnemonic(mnemonic).build()).build().toJMenu();
return MenuItemInfo.builder().text(text).mnemonic(mnemonic).build().toJMenu();
}

/**
Expand All @@ -93,9 +90,8 @@ public static JMenu newJMenu(final @NonNull String text, final int mnemonic)
public static JMenu newJMenu(final @NonNull String text, final int mnemonic,
final @NonNull ActionListener actionListener)
{
return MenuItemInfo.builder()
.menuInfo(MenuInfo.builder().text(text).mnemonic(mnemonic).build())
.actionListener(actionListener).build().toJMenu();
return MenuItemInfo.builder().text(text).mnemonic(mnemonic).actionListener(actionListener)
.build().toJMenu();
}

/**
Expand All @@ -109,9 +105,7 @@ public static JMenu newJMenu(final @NonNull String text, final int mnemonic,
*/
public static JMenu newJMenu(final @NonNull String text, final char mnemonic)
{
return MenuItemInfo.builder()
.menuInfo(
MenuInfo.builder().text(text).mnemonic(MenuExtensions.toMnemonic(mnemonic)).build())
return MenuItemInfo.builder().text(text).mnemonic(MenuExtensions.toMnemonic(mnemonic))
.build().toJMenu();
}

Expand All @@ -129,9 +123,7 @@ public static JMenu newJMenu(final @NonNull String text, final char mnemonic)
public static JMenu newJMenu(final @NonNull String text, final char mnemonic,
final @NonNull ActionListener actionListener)
{
return MenuItemInfo.builder()
.menuInfo(
MenuInfo.builder().text(text).mnemonic(MenuExtensions.toMnemonic(mnemonic)).build())
return MenuItemInfo.builder().text(text).mnemonic(MenuExtensions.toMnemonic(mnemonic))
.actionListener(actionListener).build().toJMenu();
}

Expand Down

0 comments on commit 3466a60

Please sign in to comment.