Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#21 Add About-Dialog and a check for a newer github release version o…
…n startup
- Loading branch information
Showing
11 changed files
with
510 additions
and
2 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
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
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,50 @@ | ||
package at.esque.kafka; | ||
|
||
import at.esque.kafka.handlers.VersionInfo; | ||
import at.esque.kafka.handlers.VersionInfoHandler; | ||
import javafx.scene.control.Label; | ||
import javafx.scene.image.ImageView; | ||
import javafx.scene.input.MouseEvent; | ||
import javafx.scene.layout.HBox; | ||
import javafx.scene.text.Text; | ||
|
||
import java.awt.*; | ||
import java.io.IOException; | ||
import java.net.URI; | ||
import java.net.URISyntaxException; | ||
|
||
public class AboutController { | ||
public ImageView imageView; | ||
public HBox infoContainer; | ||
public Text infoText; | ||
public Label releaseVersion; | ||
public Label runtimeVersion; | ||
public Label buildJvm; | ||
public Label buildTime; | ||
|
||
public void setup(VersionInfoHandler versionInfoHandler) { | ||
final VersionInfo versionInfo = versionInfoHandler.getVersionInfo(); | ||
final String tag = versionInfo.getTag(); | ||
infoContainer.setVisible(false); | ||
if(tag != null){ | ||
releaseVersion.setText(tag); | ||
} else { | ||
releaseVersion.setText(versionInfo.getVersion() +" (" + versionInfo.getRevision() + ")"); | ||
infoContainer.setVisible(true); | ||
infoText.setText("This is not a release version!\nNo update checks will be performed"); | ||
} | ||
buildJvm.setText(versionInfo.getBuildJvm()); | ||
buildTime.setText(versionInfo.getBuildTime()); | ||
runtimeVersion.setText(System.getProperty("java.version")); | ||
} | ||
|
||
public void clickGithubLink(MouseEvent mouseEvent) { | ||
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { | ||
try { | ||
Desktop.getDesktop().browse(new URI("https://github.com/patschuh/KafkaEsque")); | ||
} catch (IOException | URISyntaxException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} | ||
} |
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
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
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
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,38 @@ | ||
package at.esque.kafka.handlers; | ||
|
||
import javafx.beans.property.SimpleStringProperty; | ||
import javafx.beans.property.StringProperty; | ||
|
||
public class UpdateInfo { | ||
private StringProperty tag = new SimpleStringProperty(); | ||
private StringProperty releasePage = new SimpleStringProperty(); | ||
|
||
public UpdateInfo(String tag, String releasePage) { | ||
this.tag.set(tag); | ||
this.releasePage.set(releasePage); | ||
} | ||
|
||
public String getTag() { | ||
return tag.get(); | ||
} | ||
|
||
public StringProperty tagProperty() { | ||
return tag; | ||
} | ||
|
||
public void setTag(String tag) { | ||
this.tag.set(tag); | ||
} | ||
|
||
public String getReleasePage() { | ||
return releasePage.get(); | ||
} | ||
|
||
public StringProperty releasePageProperty() { | ||
return releasePage; | ||
} | ||
|
||
public void setReleasePage(String releasePage) { | ||
this.releasePage.set(releasePage); | ||
} | ||
} |
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,94 @@ | ||
package at.esque.kafka.handlers; | ||
|
||
import javafx.beans.property.SimpleStringProperty; | ||
import javafx.beans.property.StringProperty; | ||
import org.gradle.util.VersionNumber; | ||
|
||
public class VersionInfo { | ||
private StringProperty name = new SimpleStringProperty(); | ||
private StringProperty version = new SimpleStringProperty(); | ||
private StringProperty revision = new SimpleStringProperty(); | ||
private StringProperty tag = new SimpleStringProperty(); | ||
private StringProperty buildTime = new SimpleStringProperty(); | ||
private StringProperty buildJvm = new SimpleStringProperty(); | ||
|
||
|
||
public String getName() { | ||
return name.get(); | ||
} | ||
|
||
public StringProperty nameProperty() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name.set(name); | ||
} | ||
|
||
public String getVersion() { | ||
return version.get(); | ||
} | ||
|
||
public StringProperty versionProperty() { | ||
return version; | ||
} | ||
|
||
public void setVersion(String version) { | ||
this.version.set(version); | ||
} | ||
|
||
public String getRevision() { | ||
return revision.get(); | ||
} | ||
|
||
public StringProperty revisionProperty() { | ||
return revision; | ||
} | ||
|
||
public void setRevision(String revision) { | ||
this.revision.set(revision); | ||
} | ||
|
||
public String getTag() { | ||
return tag.get(); | ||
} | ||
|
||
public StringProperty tagProperty() { | ||
return tag; | ||
} | ||
|
||
public void setTag(String tag) { | ||
this.tag.set(tag); | ||
} | ||
|
||
public String getBuildTime() { | ||
return buildTime.get(); | ||
} | ||
|
||
public StringProperty buildTimeProperty() { | ||
return buildTime; | ||
} | ||
|
||
public void setBuildTime(String buildTime) { | ||
this.buildTime.set(buildTime); | ||
} | ||
|
||
public String getBuildJvm() { | ||
return buildJvm.get(); | ||
} | ||
|
||
public StringProperty buildJvmProperty() { | ||
return buildJvm; | ||
} | ||
|
||
public void setBuildJvm(String buildJvm) { | ||
this.buildJvm.set(buildJvm); | ||
} | ||
|
||
public VersionNumber releaseVersion(){ | ||
if(tag.get() == null){ | ||
return null; | ||
} | ||
return VersionNumber.parse(tag.get().substring(1)); | ||
} | ||
} |
Oops, something went wrong.