Skip to content

Commit

Permalink
Adds-ons. Themes now installable jars (docs to follow).
Browse files Browse the repository at this point in the history
  • Loading branch information
brett-smith committed Oct 22, 2020
1 parent 4fcf28d commit ad61d4d
Show file tree
Hide file tree
Showing 42 changed files with 1,086 additions and 221 deletions.
2 changes: 2 additions & 0 deletions snake-dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<forkerArgs>
<forkerArg>jvmarg -Dforker.releaseChannel=${snakeRemoteStable}</forkerArg>
<forkerArg>jvmarg -Dforker.betaChannel=${snakeRemoteSnapshot}</forkerArg>
<forkerArg>jvmarg -Djava.system.class.loader=uk.co.bithatch.snake.ui.DynamicClassLoader</forkerArg>
<forkerArg>restart-on 90</forkerArg>
<forkerArg>single-instance</forkerArg>
<forkerArg>install-location ${installer.home}/snake-razer</forkerArg>
Expand Down Expand Up @@ -173,6 +174,7 @@
<forkerArgs>
<forkerArg>jvmarg -Dforker.releaseChannel=${snakeRemoteNoRuntimeStable}</forkerArg>
<forkerArg>jvmarg -Dforker.betaChannel=${snakeRemoteNoRuntimeSnapshot}</forkerArg>
<forkerArg>jvmarg -Djava.system.class.loader=uk.co.bithatch.snake.ui.DynamicClassLoader</forkerArg>
<forkerArg>restart-on 90</forkerArg>
<forkerArg>single-instance</forkerArg>
<forkerArg>install-location ${installer.home}/snake-razer</forkerArg>
Expand Down
1 change: 1 addition & 0 deletions snake-themes/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/bin/
/snake-theme-test/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions snake-ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
<artifactId>icon-generator-javafx</artifactId>
<version>1.2</version>
</dependency>

</dependencies>
<profiles>
<profile>
Expand Down
90 changes: 90 additions & 0 deletions snake-ui/src/main/java/uk/co/bithatch/snake/ui/AbstractAddOn.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package uk.co.bithatch.snake.ui;

import java.io.IOException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;

public abstract class AbstractAddOn implements AddOn {


protected String name;
protected String url;
protected String license;
protected String description;
protected String author;
protected String id;
protected Path archive;
protected URL location;

public AbstractAddOn() {
super();
}

@Override
public URL getLocation() {
return location;
}

@Override
public String getId() {
return id;
}

@Override
public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

@Override
public String getUrl() {
return url;
}

public void setUrl(String url) {
this.url = url;
}

@Override
public String getLicense() {
return license;
}

public void setLicense(String license) {
this.license = license;
}

@Override
public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

@Override
public String getAuthor() {
return author;
}

public void setAuthor(String author) {
this.author = author;
}

public Path getArchive() {
return archive;
}

public void setArchive(Path archive) {
this.archive = archive;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected void onSetDevice() throws Exception {
protected Background createHeaderBackground() {
return new Background(
new BackgroundImage(
new Image(Configuration.getDefault().themeProperty().getValue().getResource("fibre.jpg")
new Image(context.getConfiguration().themeProperty().getValue().getResource("fibre.jpg")
.toExternalForm(), true),
BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER,
new BackgroundSize(100d, 100d, true, true, false, true)));
Expand Down
30 changes: 30 additions & 0 deletions snake-ui/src/main/java/uk/co/bithatch/snake/ui/AddOn.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package uk.co.bithatch.snake.ui;

import java.net.URL;
import java.nio.file.Path;

public interface AddOn {

URL getLocation();

String getId();

String getName();

String getUrl();

String getLicense();

String getDescription();

String getAuthor();

URL getScreenshot();

Path getArchive();

default boolean isSystem() {
return getArchive() == null;
}

}
42 changes: 42 additions & 0 deletions snake-ui/src/main/java/uk/co/bithatch/snake/ui/AddOnDetails.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package uk.co.bithatch.snake.ui;

import java.net.URL;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;

public class AddOnDetails extends AbstractDeviceController {

@FXML
private Label author;
@FXML
private Label addOnType;
@FXML
private Label addOnName;
@FXML
private ImageView screenshot;

@Override
protected void onConfigure() throws Exception {
}

public void setAddOn(AddOn addOn) {
author.textProperty().set(addOn.getAuthor());
addOnType.textProperty().set(addOn.getClass().getSimpleName());
addOnName.textProperty().set(addOn.getName());
URL ss = addOn.getScreenshot();
if (ss == null) {
// screenshot.setImage(new Image(ss, true));
} else
screenshot.setImage(new Image(ss.toExternalForm(), true));
}

@FXML
void evtSelect(ActionEvent evt) {
// context.push(DeviceDetails.class, this, Direction.FROM_RIGHT);
}

}
Loading

0 comments on commit ad61d4d

Please sign in to comment.