Initial Data Commit
This commit is contained in:
parent
0f56755b6a
commit
ad432c45fb
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>KorrekturHelper</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,7 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
|
||||
org.eclipse.jdt.core.compiler.compliance=17
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=17
|
|
@ -0,0 +1,4 @@
|
|||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
|
@ -0,0 +1,43 @@
|
|||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>de.tuDortmund.cs.rvs.pingger</groupId>
|
||||
<artifactId>KorrekturHelper</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>KorrekturHelper</name>
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-jlink-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<goal>jlink</goal>
|
||||
<compress>2</compress>
|
||||
<noHeaderFiles>true</noHeaderFiles>
|
||||
<noManPages>true</noManPages>
|
||||
<output>${project.build.directory}/jlink_output</output>
|
||||
<addModules>
|
||||
<addModule>java.compiler</addModule>
|
||||
<addModule>java.datatransfer</addModule>
|
||||
<addModule>java.desktop</addModule>
|
||||
<addModule>java.instrument</addModule>
|
||||
<addModule>java.logging</addModule>
|
||||
<addModule>java.management</addModule>
|
||||
<addModule>java.naming</addModule>
|
||||
<addModule>java.prefs</addModule>
|
||||
<addModule>java.rmi</addModule>
|
||||
<addModule>java.scripting</addModule>
|
||||
<addModule>java.sql</addModule>
|
||||
<addModule>java.xml</addModule>
|
||||
<addModule>jdk.compiler</addModule>
|
||||
<addModule>jdk.unsupported</addModule>
|
||||
</addModules>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,60 @@
|
|||
package de.tuDortmund.cs.rvs.pingger.korrekturHelper;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
|
||||
/**
|
||||
* @author Pingger
|
||||
*/
|
||||
public abstract class AbstractNode extends JPanel implements Node
|
||||
{
|
||||
private static final long serialVersionUID = 2766238124985613235L;
|
||||
/** Content-Panel */
|
||||
protected final JPanel content;
|
||||
private final JPanel sub;
|
||||
/** Sub-Nodes */
|
||||
protected final LinkedHashSet<Node> subNodes = new LinkedHashSet<>();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public AbstractNode()
|
||||
{
|
||||
super(true);
|
||||
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
|
||||
|
||||
content = new JPanel(new BorderLayout(), true);
|
||||
sub = new JPanel(true);
|
||||
sub.setLayout(new BoxLayout(sub, BoxLayout.Y_AXIS));
|
||||
sub.setBorder(new EmptyBorder(0, 8, 8, 0));
|
||||
|
||||
add(content);
|
||||
add(sub);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSubNode(Node n)
|
||||
{
|
||||
subNodes.add(n);
|
||||
sub.add(n.getComponent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getComponent()
|
||||
{ return this; }
|
||||
|
||||
@Override
|
||||
public LinkedHashSet<Node> getSubNodes()
|
||||
{ return subNodes; }
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
subNodes.forEach(Node::reset);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package de.tuDortmund.cs.rvs.pingger.korrekturHelper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
|
||||
public class CheckboxNode extends AbstractNode
|
||||
{
|
||||
private final JCheckBox cbx;
|
||||
private final String message;
|
||||
|
||||
private final BigDecimal points;
|
||||
|
||||
public CheckboxNode(String configString)
|
||||
{
|
||||
if (configString.contains("\n"))
|
||||
{ throw new IllegalArgumentException("Bad config! Found line feed!"); }
|
||||
var spl = configString.split("\t");
|
||||
if (spl.length != 3)
|
||||
{ throw new IllegalArgumentException("Bad Config String! Expected 2 \\t"); }
|
||||
if (!"[]".equals(spl[0]))
|
||||
{ throw new IllegalArgumentException("Not a [] Node"); }
|
||||
points = new BigDecimal(spl[1]);
|
||||
message = spl[2];
|
||||
cbx = new JCheckBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal achievedPoints(MathContext mc)
|
||||
{
|
||||
return cbx.isSelected() ? points : BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisibleInResultHtml()
|
||||
{ return cbx.isSelected(); }
|
||||
|
||||
@Override
|
||||
public BigDecimal maximumPoints()
|
||||
{
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toConfigString()
|
||||
{
|
||||
return "[]\t" + (points.signum() > 0 ? "+" : "") + points.toPlainString() + "\t" + message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toResultHtml()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,118 @@
|
|||
package de.tuDortmund.cs.rvs.pingger.korrekturHelper;
|
||||
|
||||
import java.awt.Font;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
|
||||
/**
|
||||
* @author Pingger
|
||||
*/
|
||||
public class HeaderNode extends AbstractNode
|
||||
{
|
||||
private static final String[] configStyles = { "", "#", "##", "###", "####", "#####", "######", "*", "_" };
|
||||
private static final String[] htmlStyles = { "", "h1", "h2", "h3", "h4", "h5", "h6", "b", "i" };
|
||||
private static final long serialVersionUID = -5511548087337263042L;
|
||||
|
||||
private static int indexOf(String[] array, String elem)
|
||||
{
|
||||
for (var i = 0; i < array.length; i++)
|
||||
{
|
||||
if (elem.equals(array[i]))
|
||||
{ return i; }
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** Additional CSS */
|
||||
protected final String css;
|
||||
|
||||
/** Text to display */
|
||||
protected final String message;
|
||||
|
||||
/** type of header (h#, b, i) */
|
||||
protected final int style;
|
||||
|
||||
/**
|
||||
* Load from config String
|
||||
*
|
||||
* @param config the config String
|
||||
*/
|
||||
public HeaderNode(String config)
|
||||
{
|
||||
if (config.contains("\n"))
|
||||
{ throw new IllegalArgumentException("Bad config! Found line feed!"); }
|
||||
var spl = config.split("\t");
|
||||
if (spl.length < 3 || spl.length > 4)
|
||||
{ throw new IllegalArgumentException("Bad Config String! Expected 2 or 3 \\t"); }
|
||||
if (!"!header".equals(spl[0]))
|
||||
{ throw new IllegalArgumentException("Not a !header Node"); }
|
||||
style = indexOf(configStyles, spl[1]);
|
||||
if (style == -1)
|
||||
{ throw new IllegalArgumentException("Bad Style!"); }
|
||||
message = spl[2];
|
||||
if (spl.length == 3)
|
||||
{
|
||||
css = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
css = spl[3];
|
||||
}
|
||||
var lbl = new JLabel(message);
|
||||
switch (style)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
lbl.setFont(new Font(lbl.getFont().getFontName(), Font.PLAIN,
|
||||
(int) (lbl.getFont().getSize() * (1.0 + (6 - style) / 6))));
|
||||
break;
|
||||
|
||||
case 7:
|
||||
lbl.setFont(new Font(lbl.getFont().getFontName(), Font.BOLD, lbl.getFont().getSize()));
|
||||
break;
|
||||
|
||||
case 8:
|
||||
lbl.setFont(new Font(lbl.getFont().getFontName(), Font.ITALIC, lbl.getFont().getSize()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal achievedPoints(MathContext mc)
|
||||
{
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisibleInResultHtml()
|
||||
{ return subNodes.stream().anyMatch(Node::isVisibleInResultHtml); }
|
||||
|
||||
@Override
|
||||
public BigDecimal maximumPoints()
|
||||
{
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toConfigString()
|
||||
{
|
||||
return "!header\t" + configStyles[style] + "\t" + message + (css == null ? "" : "\t" + css);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toResultHtml()
|
||||
{
|
||||
return (style == 0 ? "" : "<" + htmlStyles[style] + (css == null ? "" : " style=\"" + css + "\"") + ">") + message
|
||||
+ (style == 0 ? "" : "</" + htmlStyles[style] + ">");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package de.tuDortmund.cs.rvs.pingger.korrekturHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class KorrekturHelper
|
||||
{
|
||||
|
||||
public static void main(String[] args) throws IOException
|
||||
{
|
||||
var in = KorrekturHelper.class.getClassLoader()
|
||||
.getResourceAsStream("de/tuDortmund/cs/rvs/pingger/korrekturHelper/Test.schema");
|
||||
in.transferTo(System.out);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package de.tuDortmund.cs.rvs.pingger.korrekturHelper;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
/**
|
||||
* @author Pingger
|
||||
*/
|
||||
public interface Node
|
||||
{
|
||||
/**
|
||||
* @param mc the {@link MathContext}
|
||||
* @return the achieved Points
|
||||
*/
|
||||
BigDecimal achievedPoints(MathContext mc);
|
||||
|
||||
/**
|
||||
* Adds a Sub-Node to this Node
|
||||
*
|
||||
* @param n the Sub-Node to add
|
||||
*/
|
||||
void addSubNode(Node n);
|
||||
|
||||
/**
|
||||
* @return the AWT-Component for Displaying
|
||||
*/
|
||||
Component getComponent();
|
||||
|
||||
/**
|
||||
* @return all Sub-Nodes
|
||||
*/
|
||||
LinkedHashSet<Node> getSubNodes();
|
||||
|
||||
/**
|
||||
* @return whether this Element should be visible in the Result HTML
|
||||
*/
|
||||
boolean isVisibleInResultHtml();
|
||||
|
||||
/**
|
||||
* @return the maximum Points
|
||||
*/
|
||||
BigDecimal maximumPoints();
|
||||
|
||||
/**
|
||||
* Resets this Element and all sub-elements to their defaults
|
||||
*/
|
||||
void reset();
|
||||
|
||||
/**
|
||||
* @return this Node as a Config-String (with which this Node can be correctly
|
||||
* parsed again using the Constructor)
|
||||
*/
|
||||
String toConfigString();
|
||||
|
||||
/**
|
||||
* @return the current Result-HTML
|
||||
*/
|
||||
String toResultHtml();
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
:base 0.0
|
||||
:fullPts color: #0f0;
|
||||
:fullPtsText
|
||||
:noPts color: #f00;
|
||||
:noPtsText
|
||||
:partialPts color: #fb0;
|
||||
:partialPtsText
|
||||
!header # Test-Schema
|
||||
[] -0.5 Punktabzug
|
||||
[] +0.5 Bonus-Punkt
|
||||
!header ## Sub-Header zum versteck-Test
|
||||
[] -0.5 Punktabzug (uncheck um Sub-Header zu verstecken)
|
||||
!header ## Sub-Header für Punkte
|
||||
\ 1.0 Element existiert | Element existiert nicht
|
||||
\ 2 Anderes Element existiert | Anderes Element fehlt
|
||||
\ 1.5 Beispiel | fehlt
|
||||
[] -0.5 Punktabzug weil is so.
|
||||
!header ## Sub-Header für Punkte Multiline
|
||||
\\ 5.0
|
||||
5.0 Volle Punkte
|
||||
2.5 Halbe Punkte
|
||||
50% Halbe Punkte in Prozent
|
||||
1/3 Ein Drittel Punkte als Bruch
|
||||
0 Null Punkte
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,24 @@
|
|||
:base 0.0
|
||||
:fullPts color: #0f0;
|
||||
:fullPtsText
|
||||
:noPts color: #f00;
|
||||
:noPtsText
|
||||
:partialPts color: #fb0;
|
||||
:partialPtsText
|
||||
!header # Test-Schema
|
||||
[] -0.5 Punktabzug
|
||||
[] +0.5 Bonus-Punkt
|
||||
!header ## Sub-Header zum versteck-Test
|
||||
[] -0.5 Punktabzug (uncheck um Sub-Header zu verstecken)
|
||||
!header ## Sub-Header für Punkte
|
||||
\ 1.0 Element existiert | Element existiert nicht
|
||||
\ 2 Anderes Element existiert | Anderes Element fehlt
|
||||
\ 1.5 Beispiel | fehlt
|
||||
[] -0.5 Punktabzug weil is so.
|
||||
!header ## Sub-Header für Punkte Multiline
|
||||
\\ 5.0
|
||||
5.0 Volle Punkte
|
||||
2.5 Halbe Punkte
|
||||
50% Halbe Punkte in Prozent
|
||||
1/3 Ein Drittel Punkte als Bruch
|
||||
0 Null Punkte
|
Loading…
Reference in New Issue