Skip to content

Commit 07effc0

Browse files
author
Dominick Leppich
committed
Merge pull request 'Migrate Riot/Tag Frontend Plugin to usual Gui Module' (#7) from dl/maven-rework into develop
Reviewed-on: https://gitea.intranda.com/goobi-workflow/goobi-plugin-step-ocr-selector/pulls/7
2 parents ef19e07 + 46a12fd commit 07effc0

File tree

19 files changed

+130
-842
lines changed

19 files changed

+130
-842
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ target/
88
bin/
99
build/
1010
node_modules/
11+
tags.js
1112

1213
# Eclipse
1314
.project

frontend-dev/Gruntfile.js

Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 17 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,28 @@
11
package de.intranda.goobi.plugins;
22

3-
import java.io.IOException;
4-
import java.io.InputStream;
5-
import java.nio.file.Files;
6-
import java.nio.file.Path;
7-
import java.nio.file.StandardCopyOption;
8-
import java.util.HashMap;
9-
10-
import org.goobi.beans.Step;
11-
import org.goobi.production.enums.PluginGuiType;
12-
import org.goobi.production.enums.PluginType;
13-
import org.goobi.production.enums.StepReturnValue;
14-
import org.goobi.production.plugin.interfaces.IRestGuiPlugin;
15-
163
import de.intranda.goobi.plugins.ocrselector.Routes;
174
import lombok.Data;
185
import lombok.extern.log4j.Log4j;
196
import net.xeoh.plugins.base.annotations.PluginImplementation;
7+
import org.goobi.beans.Step;
8+
import org.goobi.production.enums.PluginGuiType;
9+
import org.goobi.production.enums.PluginType;
10+
import org.goobi.production.enums.StepReturnValue;
11+
import org.goobi.production.plugin.interfaces.IGuiPlugin;
12+
import org.goobi.production.plugin.interfaces.IRestPlugin;
13+
import org.goobi.production.plugin.interfaces.IStepPlugin;
2014
import spark.Service;
2115

16+
import java.util.HashMap;
17+
2218
@Log4j
2319
@Data
2420
@PluginImplementation
25-
public class OcrSelector implements IRestGuiPlugin {
21+
public class OcrSelector implements IRestPlugin, IGuiPlugin, IStepPlugin {
2622
private Step step;
2723
private String returnPath;
2824
private String title = "intranda_step_ocrselector";
2925

30-
@Override
31-
public void extractAssets(Path assetsDir) {
32-
String[] paths = new String[] { "css/style.css", "js/app.js", "js/riot.min.js", "js/tags.js", "js/ugh.js" };
33-
for (String p : paths) {
34-
extractFile(p, assetsDir);
35-
}
36-
}
37-
38-
private void extractFile(String filePath, Path assetsDir) {
39-
Path out = assetsDir.resolve("plugins").resolve(title).resolve(filePath);
40-
try (InputStream is = getClass().getClassLoader().getResourceAsStream("/frontend/" + filePath)) {
41-
if (!Files.exists(out.getParent())) {
42-
Files.createDirectories(out.getParent());
43-
}
44-
if (is != null) {
45-
Files.copy(is, out, StandardCopyOption.REPLACE_EXISTING);
46-
}
47-
} catch (IOException e) {
48-
// TODO Auto-generated catch block
49-
log.error(e);
50-
}
51-
}
52-
5326
@Override
5427
public String cancel() {
5528
return "/uii/" + returnPath;
@@ -67,7 +40,7 @@ public String finish() {
6740

6841
@Override
6942
public String getPagePath() {
70-
return "/uii/guiPlugin.xhtml";
43+
return "/uii/guiPluginNew.xhtml";
7144
}
7245

7346
@Override
@@ -97,12 +70,16 @@ public PluginType getType() {
9770

9871
@Override
9972
public String[] getJsPaths() {
100-
return new String[] { "js/riot.min.js", "js/tags.js", "js/app.js", "js/ugh.js" };
73+
return new String[] { "riot.min.js", "tags.js", "app.js", "ugh.js" };
74+
}
75+
76+
@Override
77+
public String[] getCssPaths() {
78+
return new String[] { "style.css" };
10179
}
10280

10381
@Override
10482
public void initRoutes(Service http) {
10583
Routes.initRoutes(http);
106-
10784
}
10885
}

0 commit comments

Comments
 (0)