JavaDoc soweit fertig
This commit is contained in:
parent
80d132516e
commit
a585f903e6
|
@ -1,19 +1,21 @@
|
||||||
import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
|
|
||||||
import model.Line;
|
import model.Line;
|
||||||
|
import model.Point;
|
||||||
import model.LineModel;
|
import model.LineModel;
|
||||||
import nu.pattern.OpenCV;
|
|
||||||
import org.apache.commons.io.IOUtils;
|
|
||||||
import presenter.Presenter;
|
import presenter.Presenter;
|
||||||
|
import presenter.algorithms.advanced.LeastMedianOfSquaresEstimator;
|
||||||
import presenter.algorithms.advanced.RepeatedMedianEstimator;
|
import presenter.algorithms.advanced.RepeatedMedianEstimator;
|
||||||
|
import presenter.algorithms.advanced.TheilSenEstimator;
|
||||||
|
import presenter.algorithms.naiv.NaivLeastMedianOfSquaresEstimator;
|
||||||
|
import presenter.algorithms.naiv.NaivRepeatedMedianEstimator;
|
||||||
|
import presenter.algorithms.naiv.NaivTheilSenEstimator;
|
||||||
|
import presenter.algorithms.util.IntersectionComputer;
|
||||||
import presenter.generator.DatasetGenerator;
|
import presenter.generator.DatasetGenerator;
|
||||||
import view.MainFrame;
|
import view.MainFrame;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.File;
|
import java.util.ArrayList;
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import static nu.pattern.OpenCV.loadShared;
|
import static nu.pattern.OpenCV.loadShared;
|
||||||
|
@ -27,6 +29,10 @@ import static nu.pattern.OpenCV.loadShared;
|
||||||
*/
|
*/
|
||||||
public class App {
|
public class App {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Schriftart wird neu gesetzt
|
||||||
|
* @param f Schriftart
|
||||||
|
*/
|
||||||
private static void setUIFont(javax.swing.plaf.FontUIResource f) {
|
private static void setUIFont(javax.swing.plaf.FontUIResource f) {
|
||||||
java.util.Enumeration<Object> keys = UIManager.getDefaults().keys();
|
java.util.Enumeration<Object> keys = UIManager.getDefaults().keys();
|
||||||
while (keys.hasMoreElements()) {
|
while (keys.hasMoreElements()) {
|
||||||
|
@ -38,6 +44,10 @@ public class App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Das LookAndFeel wird neu gesetzt.
|
||||||
|
* @param view View Klasse
|
||||||
|
*/
|
||||||
private static void setLookAndFeel(JFrame view) {
|
private static void setLookAndFeel(JFrame view) {
|
||||||
String[] laf = {"com.jtattoo.plaf.aluminium.AluminiumLookAndFeel",
|
String[] laf = {"com.jtattoo.plaf.aluminium.AluminiumLookAndFeel",
|
||||||
"com.jtattoo.plaf.acryl.AcrylLookAndFeel",
|
"com.jtattoo.plaf.acryl.AcrylLookAndFeel",
|
||||||
|
@ -60,36 +70,9 @@ public class App {
|
||||||
SwingUtilities.updateComponentTreeUI(view);
|
SwingUtilities.updateComponentTreeUI(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
/**
|
||||||
nu.pattern.OpenCV.loadShared();
|
* Die Methode rechnet für gegebene Größen die Algorithmen durch und gibt jeweils die benötigte Zeit
|
||||||
System.loadLibrary(org.opencv.core.Core.NATIVE_LIBRARY_NAME);
|
*/
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
|
|
||||||
final String[] options = {"Normal", "Benchmark"};
|
|
||||||
String chosen = (String) JOptionPane.showInputDialog(null,
|
|
||||||
"Bitte wählen Sie eine Ansicht!",
|
|
||||||
"Ausführungsoptionen",
|
|
||||||
JOptionPane.QUESTION_MESSAGE,
|
|
||||||
null,
|
|
||||||
options,
|
|
||||||
options[0]);
|
|
||||||
if (chosen == "Normal"){
|
|
||||||
final Presenter presenter = new Presenter(new LineModel(), null);
|
|
||||||
SwingUtilities.invokeLater(() -> {
|
|
||||||
//JFrame.setDefaultLookAndFeelDecorated(true);
|
|
||||||
MainFrame view = new MainFrame();
|
|
||||||
setLookAndFeel(view);
|
|
||||||
setUIFont(new javax.swing.plaf.FontUIResource(new Font("Verdana", Font.PLAIN, 12)));
|
|
||||||
view.setPresenter(presenter);
|
|
||||||
view.setActionListeners();
|
|
||||||
presenter.setView(view);
|
|
||||||
});} else {
|
|
||||||
benchmark();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void benchmark() {
|
public static void benchmark() {
|
||||||
int[] sizes = {50, 500, 1000, 3000, 5000, 10000};
|
int[] sizes = {50, 500, 1000, 3000, 5000, 10000};
|
||||||
|
|
||||||
|
@ -97,27 +80,56 @@ public class App {
|
||||||
System.out.println("---- Datasetgröße: " + sizes[i] + " ----");
|
System.out.println("---- Datasetgröße: " + sizes[i] + " ----");
|
||||||
DatasetGenerator generator = new DatasetGenerator();
|
DatasetGenerator generator = new DatasetGenerator();
|
||||||
LinkedList<Line> lines = generator.generateDataCloud(sizes[i]);
|
LinkedList<Line> lines = generator.generateDataCloud(sizes[i]);
|
||||||
// IntersectionComputer computer = new IntersectionComputer(lines);
|
IntersectionComputer computer = new IntersectionComputer(lines);
|
||||||
// ArrayList<Point> points = computer.compute();
|
ArrayList<Point> points = computer.compute();
|
||||||
|
|
||||||
//algorithms
|
NaivLeastMedianOfSquaresEstimator naivLms = new NaivLeastMedianOfSquaresEstimator(lines);
|
||||||
//NaivLeastMedianOfSquaresEstimator naivLms = new NaivLeastMedianOfSquaresEstimator(lines);
|
naivLms.run();
|
||||||
//naivLms.run();
|
|
||||||
|
|
||||||
// NaivRepeatedMedianEstimator naivRm = new NaivRepeatedMedianEstimator(lines);
|
NaivRepeatedMedianEstimator naivRm = new NaivRepeatedMedianEstimator(lines);
|
||||||
// naivRm.run();
|
naivRm.run();
|
||||||
//
|
|
||||||
// NaivTheilSenEstimator naivTs = new NaivTheilSenEstimator(lines);
|
|
||||||
// naivTs.run();
|
|
||||||
|
|
||||||
// LeastMedianOfSquaresEstimator lms = new LeastMedianOfSquaresEstimator(lines,points);
|
NaivTheilSenEstimator naivTs = new NaivTheilSenEstimator(lines);
|
||||||
// lms.run();
|
naivTs.run();
|
||||||
|
|
||||||
|
LeastMedianOfSquaresEstimator lms = new LeastMedianOfSquaresEstimator(lines,points);
|
||||||
|
lms.run();
|
||||||
|
|
||||||
RepeatedMedianEstimator rm = new RepeatedMedianEstimator(lines);
|
RepeatedMedianEstimator rm = new RepeatedMedianEstimator(lines);
|
||||||
rm.run();
|
rm.run();
|
||||||
|
|
||||||
// TheilSenEstimator ts = new TheilSenEstimator(lines,points);
|
TheilSenEstimator ts = new TheilSenEstimator(lines,points);
|
||||||
// ts.run();
|
ts.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Laden der native Library für OpenCV
|
||||||
|
*/
|
||||||
|
static {
|
||||||
|
nu.pattern.OpenCV.loadShared();
|
||||||
|
System.loadLibrary(org.opencv.core.Core.NATIVE_LIBRARY_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maim Methode
|
||||||
|
* @param args
|
||||||
|
*/
|
||||||
|
public static void main(String[] args) {
|
||||||
|
if (args.length > 0 && args[0] == "--benchmark"){
|
||||||
|
benchmark();
|
||||||
|
} else {
|
||||||
|
final Presenter presenter = new Presenter(new LineModel(), null);
|
||||||
|
SwingUtilities.invokeLater(() -> {
|
||||||
|
//JFrame.setDefaultLookAndFeelDecorated(true);
|
||||||
|
MainFrame view = new MainFrame();
|
||||||
|
setLookAndFeel(view);
|
||||||
|
setUIFont(new javax.swing.plaf.FontUIResource(new Font("SansSerif", Font.PLAIN, 12)));
|
||||||
|
|
||||||
|
view.setPresenter(presenter);
|
||||||
|
view.setActionListeners();
|
||||||
|
presenter.setView(view);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,9 @@ public class MainFrame extends JFrame {
|
||||||
private JTabbedPane tabbedPane;
|
private JTabbedPane tabbedPane;
|
||||||
private EvaluationPanel evaluationPanel;
|
private EvaluationPanel evaluationPanel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konstruktor
|
||||||
|
*/
|
||||||
public MainFrame() {
|
public MainFrame() {
|
||||||
super();
|
super();
|
||||||
initializeComponents();
|
initializeComponents();
|
||||||
|
@ -86,6 +89,9 @@ public class MainFrame extends JFrame {
|
||||||
* visualisierungs methoden
|
* visualisierungs methoden
|
||||||
******************************************************************************************************************/
|
******************************************************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt den Dialog für die duale Darstellung
|
||||||
|
*/
|
||||||
public void createDualityDialog() {
|
public void createDualityDialog() {
|
||||||
arrangement = new DualityPanel();
|
arrangement = new DualityPanel();
|
||||||
arrangementDialog = new JDialog();
|
arrangementDialog = new JDialog();
|
||||||
|
@ -113,24 +119,47 @@ public class MainFrame extends JFrame {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visualisiert das Ergebnis des LMS-Schätzers
|
||||||
|
* @param m Steigung
|
||||||
|
* @param b y-Achsenabschnitt
|
||||||
|
*/
|
||||||
public void visualizeLMS(double m, double b) {
|
public void visualizeLMS(double m, double b) {
|
||||||
plotLMS = new PlotPanel();
|
plotLMS = new PlotPanel();
|
||||||
lmsPanel.setPlotPanel(plotLMS);
|
lmsPanel.setPlotPanel(plotLMS);
|
||||||
createPlot(m, b, plotLMS, lmsPanel, "LMS");
|
createPlot(m, b, plotLMS, lmsPanel, "LMS");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visualisiert das Ergebnis des RM-Schätzers
|
||||||
|
* @param m Steigung
|
||||||
|
* @param b y-Achsenabschnitt
|
||||||
|
*/
|
||||||
public void visualizeRM(double m, double b) {
|
public void visualizeRM(double m, double b) {
|
||||||
plotRM = new PlotPanel();
|
plotRM = new PlotPanel();
|
||||||
rmPanel.setPlotPanel(plotRM);
|
rmPanel.setPlotPanel(plotRM);
|
||||||
createPlot(m, b, plotRM, rmPanel, "RM");
|
createPlot(m, b, plotRM, rmPanel, "RM");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visualisiert das Ergebnis des TS-Schätzers
|
||||||
|
* @param m Steigung
|
||||||
|
* @param b y-Achsenabschnitt
|
||||||
|
*/
|
||||||
public void visualizeTS(double m, double b) {
|
public void visualizeTS(double m, double b) {
|
||||||
plotTS = new PlotPanel();
|
plotTS = new PlotPanel();
|
||||||
tsPanel.setPlotPanel(plotTS);
|
tsPanel.setPlotPanel(plotTS);
|
||||||
createPlot(m, b, plotTS, tsPanel, "TS");
|
createPlot(m, b, plotTS, tsPanel, "TS");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt den Plot zu einer Eingabe von Punkten und der Lösung eines Schätzers (m,b)
|
||||||
|
* @param m Steigung
|
||||||
|
* @param b y-Achsenabschnitt
|
||||||
|
* @param plot Plot
|
||||||
|
* @param panel Panel auf dem der Plot plaziert wird
|
||||||
|
* @param name Bezeichnung der Gerade
|
||||||
|
*/
|
||||||
public void createPlot(double m, double b, PlotPanel plot, JPanel panel, String name) {
|
public void createPlot(double m, double b, PlotPanel plot, JPanel panel, String name) {
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
plot.clear();
|
plot.clear();
|
||||||
|
@ -140,19 +169,26 @@ public class MainFrame extends JFrame {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visualisierung des Import-Prozesses
|
||||||
|
* @param progress akteulle Prozentzahl (0-100)
|
||||||
|
*/
|
||||||
public void showImportProgress(Integer progress) {
|
public void showImportProgress(Integer progress) {
|
||||||
progressBar.setValue(progress);
|
progressBar.setValue(progress);
|
||||||
progressBar.setStringPainted(true);
|
progressBar.setStringPainted(true);
|
||||||
progressDialog.setVisible(true);
|
progressDialog.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeigt den Evaluations-Dialog an (ggf. wird dieser erzeugt)
|
||||||
|
*/
|
||||||
public void showEvauluationDialog() {
|
public void showEvauluationDialog() {
|
||||||
if (evaluationDialog == null) {
|
if (evaluationDialog == null) {
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
evaluationDialog = new JDialog();
|
evaluationDialog = new JDialog();
|
||||||
evaluationDialog.setTitle("evaluation");
|
evaluationDialog.setTitle("evaluation");
|
||||||
evaluationDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
evaluationDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||||
evaluationDialog.setSize(new Dimension(1800, 800));
|
evaluationDialog.setSize(new Dimension(1500, 800));
|
||||||
evaluationDialog.setLocationRelativeTo(null);
|
evaluationDialog.setLocationRelativeTo(null);
|
||||||
|
|
||||||
evaluationPanel = new EvaluationPanel(this);
|
evaluationPanel = new EvaluationPanel(this);
|
||||||
|
@ -169,6 +205,12 @@ public class MainFrame extends JFrame {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt der Evaluations-Tabelle eine Spalte mit Daten hinzu
|
||||||
|
* @param res Daten der Spalte
|
||||||
|
* @param col Spalte
|
||||||
|
* @param isApprCol <code>true</code>, falls es sich um die Überschirften der Approximationsgüten handelt
|
||||||
|
*/
|
||||||
public void appendEvalResult(Object[] res, int col, boolean isApprCol) {
|
public void appendEvalResult(Object[] res, int col, boolean isApprCol) {
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
Object[] tmp = Arrays.asList(res).subList(2, res.length).toArray();
|
Object[] tmp = Arrays.asList(res).subList(2, res.length).toArray();
|
||||||
|
@ -183,6 +225,10 @@ public class MainFrame extends JFrame {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt der Evaluations-Tabelle eine Zeile mit Daten hinzu
|
||||||
|
* @param res Daten der Spalte
|
||||||
|
*/
|
||||||
public void appendEvalResult(Object[] res) {
|
public void appendEvalResult(Object[] res) {
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
Object[] tmp = Arrays.asList(res).subList(1, res.length).toArray();
|
Object[] tmp = Arrays.asList(res).subList(1, res.length).toArray();
|
||||||
|
@ -192,6 +238,11 @@ public class MainFrame extends JFrame {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visualisiert die Ausgleichsgerade zu gegebenen Algorithmen
|
||||||
|
* @param res Steigungen und y-Achsenabschnitte
|
||||||
|
* @param alg Kodierung der Alg.
|
||||||
|
*/
|
||||||
public void drawLineResult(Object[] res, int alg) {
|
public void drawLineResult(Object[] res, int alg) {
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
Object[] result = Arrays.asList(res).subList(2, res.length).toArray();
|
Object[] result = Arrays.asList(res).subList(2, res.length).toArray();
|
||||||
|
@ -201,6 +252,10 @@ public class MainFrame extends JFrame {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visualisiert die Ausgleichsgerade zu einem gegebenen Algorithmus
|
||||||
|
* @param res Steigungen und y-Achsenabschnitte
|
||||||
|
*/
|
||||||
public void drawLineResults(Object[] res) {
|
public void drawLineResults(Object[] res) {
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
Object[] result = Arrays.asList(res).subList(1, res.length).toArray();
|
Object[] result = Arrays.asList(res).subList(1, res.length).toArray();
|
||||||
|
@ -220,6 +275,10 @@ public class MainFrame extends JFrame {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Evaluations-Datensätze werden Visualisiert
|
||||||
|
* @param lines Liste der Geraden
|
||||||
|
*/
|
||||||
public void addEvalDataset(LinkedList<Line> lines) {
|
public void addEvalDataset(LinkedList<Line> lines) {
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
evaluationPanel.setDualPoints(lines);
|
evaluationPanel.setDualPoints(lines);
|
||||||
|
@ -232,6 +291,10 @@ public class MainFrame extends JFrame {
|
||||||
/*******************************************************************************************************************
|
/*******************************************************************************************************************
|
||||||
* init GUI
|
* init GUI
|
||||||
******************************************************************************************************************/
|
******************************************************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Titel der Komponenten
|
||||||
|
*/
|
||||||
private void setTitles() {
|
private void setTitles() {
|
||||||
this.setTitle("Algorithmen zur Berechnung von Ausgleichgeraden");
|
this.setTitle("Algorithmen zur Berechnung von Ausgleichgeraden");
|
||||||
importButton.setText("Import");
|
importButton.setText("Import");
|
||||||
|
@ -240,12 +303,18 @@ public class MainFrame extends JFrame {
|
||||||
arrangementButton.setText("Dualraum");
|
arrangementButton.setText("Dualraum");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt die einzelnen Seiten dem TabbedPane hinzu
|
||||||
|
*/
|
||||||
private void setupTabbedPane() {
|
private void setupTabbedPane() {
|
||||||
tabbedPane.add("Least Median of Squares", lmsPanel);
|
tabbedPane.add("Least Median of Squares", lmsPanel);
|
||||||
tabbedPane.add("Repeated Median", rmPanel);
|
tabbedPane.add("Repeated Median", rmPanel);
|
||||||
tabbedPane.add("Theil-Sen", tsPanel);
|
tabbedPane.add("Theil-Sen", tsPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Komponenten werden in Container gesetzt
|
||||||
|
*/
|
||||||
private void addComponents() {
|
private void addComponents() {
|
||||||
toolBar.add(arrangementButton);
|
toolBar.add(arrangementButton);
|
||||||
toolBar.add(importButton);
|
toolBar.add(importButton);
|
||||||
|
@ -267,9 +336,11 @@ public class MainFrame extends JFrame {
|
||||||
|
|
||||||
this.add(toolBar, BorderLayout.NORTH);
|
this.add(toolBar, BorderLayout.NORTH);
|
||||||
this.add(splitpane, BorderLayout.CENTER);
|
this.add(splitpane, BorderLayout.CENTER);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konfiguration des SplitPane
|
||||||
|
*/
|
||||||
private void setupSplitPane() {
|
private void setupSplitPane() {
|
||||||
splitpane.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
|
splitpane.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
|
||||||
splitpane.setResizeWeight(.5d);
|
splitpane.setResizeWeight(.5d);
|
||||||
|
@ -278,14 +349,19 @@ public class MainFrame extends JFrame {
|
||||||
splitpane.setRightComponent(tabbedPane);
|
splitpane.setRightComponent(tabbedPane);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fenster Funktionalität wird gesetzt
|
||||||
|
*/
|
||||||
private void setCloseOperations() {
|
private void setCloseOperations() {
|
||||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
progressDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
progressDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Größen der Komponenten werden gesetzt
|
||||||
|
*/
|
||||||
private void setDimensions() {
|
private void setDimensions() {
|
||||||
this.setPreferredSize(new Dimension(1600,1050));
|
this.setSize(new Dimension(1500, 800));
|
||||||
this.setMinimumSize(new Dimension(1024, 768));
|
|
||||||
this.setResizable(true);
|
this.setResizable(true);
|
||||||
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||||
this.setMaximizedBounds(env.getMaximumWindowBounds());
|
this.setMaximizedBounds(env.getMaximumWindowBounds());
|
||||||
|
@ -298,11 +374,17 @@ public class MainFrame extends JFrame {
|
||||||
progressDialog.setUndecorated(true);
|
progressDialog.setUndecorated(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzen der Layouts
|
||||||
|
*/
|
||||||
private void setLayouts() {
|
private void setLayouts() {
|
||||||
this.setLayout(new BorderLayout());
|
this.setLayout(new BorderLayout());
|
||||||
toolBar.setLayout(new FlowLayout(FlowLayout.LEFT));
|
toolBar.setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialisierung der Komponenten
|
||||||
|
*/
|
||||||
private void initializeComponents() {
|
private void initializeComponents() {
|
||||||
//panels
|
//panels
|
||||||
toolBar = new JToolBar();
|
toolBar = new JToolBar();
|
||||||
|
@ -330,6 +412,9 @@ public class MainFrame extends JFrame {
|
||||||
pack();
|
pack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Icons werden passend gesetzt
|
||||||
|
*/
|
||||||
private void setIcons() {
|
private void setIcons() {
|
||||||
try {
|
try {
|
||||||
ClassLoader classLoader = getClass().getClassLoader();
|
ClassLoader classLoader = getClass().getClassLoader();
|
||||||
|
@ -340,7 +425,6 @@ public class MainFrame extends JFrame {
|
||||||
Image imgExport = ImageIO.read(classLoader.getResource("export.png")).getScaledInstance(16, 16, Image.SCALE_SMOOTH);
|
Image imgExport = ImageIO.read(classLoader.getResource("export.png")).getScaledInstance(16, 16, Image.SCALE_SMOOTH);
|
||||||
Image imgFrame = ImageIO.read(classLoader.getResource("frame.png")).getScaledInstance(32, 23, Image.SCALE_SMOOTH);
|
Image imgFrame = ImageIO.read(classLoader.getResource("frame.png")).getScaledInstance(32, 23, Image.SCALE_SMOOTH);
|
||||||
|
|
||||||
|
|
||||||
importButton.setIcon(new ImageIcon(imgImport));
|
importButton.setIcon(new ImageIcon(imgImport));
|
||||||
exportButton.setIcon(new ImageIcon(imgExport));
|
exportButton.setIcon(new ImageIcon(imgExport));
|
||||||
generateButton.setIcon(new ImageIcon(imgGenerate));
|
generateButton.setIcon(new ImageIcon(imgGenerate));
|
||||||
|
@ -354,8 +438,10 @@ public class MainFrame extends JFrame {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Funktionalitäten werden hinzugefügt
|
||||||
|
*/
|
||||||
public void setActionListeners() {
|
public void setActionListeners() {
|
||||||
|
|
||||||
//action listener für MenuItems
|
//action listener für MenuItems
|
||||||
menu.addActionListeners();
|
menu.addActionListeners();
|
||||||
|
|
||||||
|
@ -370,6 +456,9 @@ public class MainFrame extends JFrame {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Funktionalitäten werden aktiviert.
|
||||||
|
*/
|
||||||
public void enableFunctionality() {
|
public void enableFunctionality() {
|
||||||
this.getLmsPanel().getStartButton().setEnabled(true);
|
this.getLmsPanel().getStartButton().setEnabled(true);
|
||||||
this.getRmPanel().getStartButton().setEnabled(true);
|
this.getRmPanel().getStartButton().setEnabled(true);
|
||||||
|
@ -378,6 +467,9 @@ public class MainFrame extends JFrame {
|
||||||
this.getExportButton().setEnabled(true);
|
this.getExportButton().setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Funktionalitäten werden deaktiviert.
|
||||||
|
*/
|
||||||
public void disableFunctionality() {
|
public void disableFunctionality() {
|
||||||
this.getLmsPanel().getStartButton().setEnabled(false);
|
this.getLmsPanel().getStartButton().setEnabled(false);
|
||||||
this.getRmPanel().getStartButton().setEnabled(false);
|
this.getRmPanel().getStartButton().setEnabled(false);
|
||||||
|
@ -389,22 +481,39 @@ public class MainFrame extends JFrame {
|
||||||
/*******************************************************************************************************************
|
/*******************************************************************************************************************
|
||||||
* log Methode
|
* log Methode
|
||||||
******************************************************************************************************************/
|
******************************************************************************************************************/
|
||||||
|
/**
|
||||||
|
* @param s Text der ausgegeben wird
|
||||||
|
*/
|
||||||
public void log(String s) {
|
public void log(String s) {
|
||||||
SwingUtilities.invokeLater(() -> output.appendParagraph(s));
|
SwingUtilities.invokeLater(() -> output.appendParagraph(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param s Fehlertext der ausgegeben wird
|
||||||
|
*/
|
||||||
public void logError(String s) {
|
public void logError(String s) {
|
||||||
SwingUtilities.invokeLater(() -> output.appendParagraphRed(s));
|
SwingUtilities.invokeLater(() -> output.appendParagraphRed(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param s Text der in grüner Farbe ausgegeben wird
|
||||||
|
*/
|
||||||
public void logSuccess(String s) {
|
public void logSuccess(String s) {
|
||||||
SwingUtilities.invokeLater(() -> output.appendParagraphGreen(s));
|
SwingUtilities.invokeLater(() -> output.appendParagraphGreen(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param s Text der als Überschrift ausgegeben wird
|
||||||
|
*/
|
||||||
public void logHeading(String s) {
|
public void logHeading(String s) {
|
||||||
SwingUtilities.invokeLater(() -> output.appendParagraphWithHeading(s));
|
SwingUtilities.invokeLater(() -> output.appendParagraphWithHeading(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ausgabe einer Tabelle
|
||||||
|
* @param heading Überschrift
|
||||||
|
* @param rows Zeilen mit Text
|
||||||
|
*/
|
||||||
public void createTable(List<String> heading, List<List<String>> rows) {
|
public void createTable(List<String> heading, List<List<String>> rows) {
|
||||||
SwingUtilities.invokeLater(() -> output.logTable(heading, rows));
|
SwingUtilities.invokeLater(() -> output.logTable(heading, rows));
|
||||||
}
|
}
|
||||||
|
@ -413,139 +522,59 @@ public class MainFrame extends JFrame {
|
||||||
* Getter und Setter Methoden
|
* Getter und Setter Methoden
|
||||||
******************************************************************************************************************/
|
******************************************************************************************************************/
|
||||||
|
|
||||||
public Boolean getLmsIsComplete() {
|
/**
|
||||||
return lmsIsComplete;
|
* @return liefert den Button, zum visualisieren des dualen Raums zurück
|
||||||
}
|
*/
|
||||||
|
|
||||||
public void setLmsIsComplete(Boolean lmsIsComplete) {
|
|
||||||
this.lmsIsComplete = lmsIsComplete;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getRmIsComplete() {
|
|
||||||
return rmIsComplete;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRmIsComplete(Boolean rmIsComplete) {
|
|
||||||
this.rmIsComplete = rmIsComplete;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getTsIsComplete() {
|
|
||||||
return tsIsComplete;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTsIsComplete(Boolean tsIsComplete) {
|
|
||||||
this.tsIsComplete = tsIsComplete;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JButton getArrangementButton() {
|
public JButton getArrangementButton() {
|
||||||
return arrangementButton;
|
return arrangementButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setArrangementButton(JButton arrangementButton) {
|
/**
|
||||||
this.arrangementButton = arrangementButton;
|
* @return liefert das Panel zum visualisieren des LMS-Schätzers
|
||||||
}
|
*/
|
||||||
|
|
||||||
public JButton getImportButton() {
|
|
||||||
return importButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setImportButton(JButton importButton) {
|
|
||||||
this.importButton = importButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JToolBar getToolBar() {
|
|
||||||
return toolBar;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setToolBar(JToolBar toolBar) {
|
|
||||||
this.toolBar = toolBar;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JDialog getArrangementDialog() {
|
|
||||||
return arrangementDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setArrangementDialog(JDialog arrangementDialog) {
|
|
||||||
this.arrangementDialog = arrangementDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InfoPanel getOutput() {
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOutput(InfoPanel output) {
|
|
||||||
this.output = output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MenuBar getMenu() {
|
|
||||||
return menu;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TabPanel getLmsPanel() {
|
public TabPanel getLmsPanel() {
|
||||||
return lmsPanel;
|
return lmsPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSplitPane getSplitpane() {
|
/**
|
||||||
return splitpane;
|
* @return liefert das Panel zum visualisieren des RM-Schätzers
|
||||||
}
|
*/
|
||||||
|
|
||||||
public void setSplitpane(JSplitPane splitpane) {
|
|
||||||
this.splitpane = splitpane;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JScrollPane getScrollPane() {
|
|
||||||
return scrollPane;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setScrollPane(JScrollPane scrollPane) {
|
|
||||||
this.scrollPane = scrollPane;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TabPanel getRmPanel() {
|
public TabPanel getRmPanel() {
|
||||||
return rmPanel;
|
return rmPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRmPanel(TabPanel rmPanel) {
|
/**
|
||||||
this.rmPanel = rmPanel;
|
* @return liefert die Instanz des Presenters zurück
|
||||||
}
|
*/
|
||||||
|
|
||||||
public PlotPanel getPlotLMS() {
|
|
||||||
return plotLMS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPlotLMS(PlotPanel plotLMS) {
|
|
||||||
this.plotLMS = plotLMS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AbstractPresenter getPresenter() {
|
public AbstractPresenter getPresenter() {
|
||||||
return presenter;
|
return presenter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param presenter Presenter Instanz
|
||||||
|
*/
|
||||||
public void setPresenter(AbstractPresenter presenter) {
|
public void setPresenter(AbstractPresenter presenter) {
|
||||||
this.presenter = presenter;
|
this.presenter = presenter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return liefert den Dialog zum visualisieren des Import-Fortschrits
|
||||||
|
*/
|
||||||
public JDialog getProgressDialog() {
|
public JDialog getProgressDialog() {
|
||||||
return progressDialog;
|
return progressDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProgressDialog(JDialog progressDialog) {
|
/**
|
||||||
this.progressDialog = progressDialog;
|
* @return liefert das Panel zum visualisieren des TS-Schätzers
|
||||||
}
|
*/
|
||||||
|
|
||||||
public TabPanel getTsPanel() {
|
public TabPanel getTsPanel() {
|
||||||
return tsPanel;
|
return tsPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTsPanel(TabPanel tsPanel) {
|
/**
|
||||||
this.tsPanel = tsPanel;
|
* @return liefert den Button, exportieren zurück
|
||||||
}
|
*/
|
||||||
|
|
||||||
public JButton getExportButton() {
|
public JButton getExportButton() {
|
||||||
return exportButton;
|
return exportButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExportButton(JButton exportButton) {
|
|
||||||
this.exportButton = exportButton;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,10 @@ public class MenuBar {
|
||||||
private JMenuItem aboutItem;
|
private JMenuItem aboutItem;
|
||||||
private JMenuItem importPicture;
|
private JMenuItem importPicture;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konstruktor
|
||||||
|
* @param view View
|
||||||
|
*/
|
||||||
public MenuBar(MainFrame view) {
|
public MenuBar(MainFrame view) {
|
||||||
this.menuBar = new JMenuBar();
|
this.menuBar = new JMenuBar();
|
||||||
this.view = view;
|
this.view = view;
|
||||||
|
@ -67,6 +71,9 @@ public class MenuBar {
|
||||||
menuBar.add(aboutMenu);
|
menuBar.add(aboutMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt den Komponenten Funktionalitäten hinzu
|
||||||
|
*/
|
||||||
public void addActionListeners() {
|
public void addActionListeners() {
|
||||||
this.exitItem.addActionListener(e -> {
|
this.exitItem.addActionListener(e -> {
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
|
@ -90,6 +97,9 @@ public class MenuBar {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return liefert die MenuBar Instanz zurück
|
||||||
|
*/
|
||||||
public JMenuBar getMenuBar() {
|
public JMenuBar getMenuBar() {
|
||||||
return menuBar;
|
return menuBar;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,10 @@ public class DualityVisualizerListener implements ActionListener {
|
||||||
|
|
||||||
private Presenter presenter;
|
private Presenter presenter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konstruktor
|
||||||
|
* @param presenter Presenter
|
||||||
|
*/
|
||||||
public DualityVisualizerListener(Presenter presenter) {
|
public DualityVisualizerListener(Presenter presenter) {
|
||||||
this.presenter = presenter;
|
this.presenter = presenter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,11 @@ public class ExportDataListener implements ActionListener {
|
||||||
private Presenter presenter;
|
private Presenter presenter;
|
||||||
private Container component;
|
private Container component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konstruktor
|
||||||
|
* @param presenter Presenter
|
||||||
|
* @param component visuelle Elternkomponente
|
||||||
|
*/
|
||||||
public ExportDataListener(Presenter presenter, Container component) {
|
public ExportDataListener(Presenter presenter, Container component) {
|
||||||
this.presenter = presenter;
|
this.presenter = presenter;
|
||||||
this.component = component;
|
this.component = component;
|
||||||
|
|
|
@ -23,15 +23,17 @@ public class GenerateDataListener implements ActionListener {
|
||||||
private Presenter presenter;
|
private Presenter presenter;
|
||||||
private JDialog dialog;
|
private JDialog dialog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konstruktor
|
||||||
|
* @param presenter Presenter
|
||||||
|
*/
|
||||||
public GenerateDataListener(Presenter presenter) {
|
public GenerateDataListener(Presenter presenter) {
|
||||||
this.presenter = presenter;
|
this.presenter = presenter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
|
|
||||||
if (dialog == null || !dialog.isVisible()) {
|
if (dialog == null || !dialog.isVisible()) {
|
||||||
dialog = new JDialog();
|
dialog = new JDialog();
|
||||||
dialog.setTitle("generiere Datensatz");
|
dialog.setTitle("generiere Datensatz");
|
||||||
|
|
|
@ -22,6 +22,11 @@ public class ImportDataListener implements ActionListener {
|
||||||
private Presenter presenter;
|
private Presenter presenter;
|
||||||
private Container component;
|
private Container component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konstruktor
|
||||||
|
* @param presenter Presenter
|
||||||
|
* @param component visuelle Elternkomponente
|
||||||
|
*/
|
||||||
public ImportDataListener(Presenter presenter, Container component) {
|
public ImportDataListener(Presenter presenter, Container component) {
|
||||||
this.presenter = presenter;
|
this.presenter = presenter;
|
||||||
this.component = component;
|
this.component = component;
|
||||||
|
|
|
@ -21,6 +21,11 @@ public class PictureImportListener implements ActionListener {
|
||||||
private Presenter presenter;
|
private Presenter presenter;
|
||||||
private Container component;
|
private Container component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konstruktor
|
||||||
|
* @param presenter Presenter
|
||||||
|
* @param component visuelle Elternkomponente
|
||||||
|
*/
|
||||||
public PictureImportListener(Presenter presenter, Container component) {
|
public PictureImportListener(Presenter presenter, Container component) {
|
||||||
this.presenter = presenter;
|
this.presenter = presenter;
|
||||||
this.component = component;
|
this.component = component;
|
||||||
|
|
|
@ -21,6 +21,11 @@ public class StartAlgorithmListener implements ActionListener {
|
||||||
private Presenter presenter;
|
private Presenter presenter;
|
||||||
private TabPanel tabPanel;
|
private TabPanel tabPanel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konstruktor
|
||||||
|
* @param presenter Presenter
|
||||||
|
* @param tabPanel Algorithmus Visualisierungskomponente
|
||||||
|
*/
|
||||||
public StartAlgorithmListener(Presenter presenter, TabPanel tabPanel) {
|
public StartAlgorithmListener(Presenter presenter, TabPanel tabPanel) {
|
||||||
this.presenter = presenter;
|
this.presenter = presenter;
|
||||||
this.tabPanel = tabPanel;
|
this.tabPanel = tabPanel;
|
||||||
|
|
|
@ -19,6 +19,9 @@ public class AboutPanel extends JPanel {
|
||||||
private JPanel contentPane;
|
private JPanel contentPane;
|
||||||
private ImageIcon image;
|
private ImageIcon image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konstruktor
|
||||||
|
*/
|
||||||
public AboutPanel() {
|
public AboutPanel() {
|
||||||
super();
|
super();
|
||||||
this.setSize(new Dimension(410, 400));
|
this.setSize(new Dimension(410, 400));
|
||||||
|
|
|
@ -44,10 +44,12 @@ public class DualityPanel extends JPanel {
|
||||||
private ValueAxis range;
|
private ValueAxis range;
|
||||||
private Double delta = 1d;
|
private Double delta = 1d;
|
||||||
|
|
||||||
|
|
||||||
private Boolean ctrlPressed = false;
|
private Boolean ctrlPressed = false;
|
||||||
private Boolean shiftPressed = false;
|
private Boolean shiftPressed = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konstruktor
|
||||||
|
*/
|
||||||
public DualityPanel() {
|
public DualityPanel() {
|
||||||
super();
|
super();
|
||||||
this.setPreferredSize(new Dimension(800, 800));
|
this.setPreferredSize(new Dimension(800, 800));
|
||||||
|
@ -55,6 +57,15 @@ public class DualityPanel extends JPanel {
|
||||||
this.setLayout(new BorderLayout());
|
this.setLayout(new BorderLayout());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hilfsmethode um die Parameter im einem Schritt zu setzen
|
||||||
|
* @param lines Liste der Geraden
|
||||||
|
* @param points Liste der Schnittpunkte
|
||||||
|
* @param xmin minimale x-Koordinate
|
||||||
|
* @param xmax maximale x-Koordinate
|
||||||
|
* @param ymin minimale y-Koordinate
|
||||||
|
* @param ymax maximale y-Koordinate
|
||||||
|
*/
|
||||||
public void setPrameters(LinkedList<Line> lines, ArrayList<Point> points, Double xmin, Double xmax, Double ymin, Double ymax) {
|
public void setPrameters(LinkedList<Line> lines, ArrayList<Point> points, Double xmin, Double xmax, Double ymin, Double ymax) {
|
||||||
this.lines = new LinkedList<>(lines);
|
this.lines = new LinkedList<>(lines);
|
||||||
this.points = new LinkedList<>(points);
|
this.points = new LinkedList<>(points);
|
||||||
|
@ -64,6 +75,9 @@ public class DualityPanel extends JPanel {
|
||||||
this.rangeMax = ymax;
|
this.rangeMax = ymax;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Die Methode erzeugt ein Arrangement von Geraden.
|
||||||
|
*/
|
||||||
public void createArrangement() {
|
public void createArrangement() {
|
||||||
dataset = new XYSeriesCollection();
|
dataset = new XYSeriesCollection();
|
||||||
|
|
||||||
|
@ -135,6 +149,10 @@ public class DualityPanel extends JPanel {
|
||||||
this.add(panel, BorderLayout.CENTER);
|
this.add(panel, BorderLayout.CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hilfmethode für die Zoom-Funktion im Panel
|
||||||
|
* @param component Komponente
|
||||||
|
*/
|
||||||
public void addKeyListener(JComponent component) {
|
public void addKeyListener(JComponent component) {
|
||||||
component.addKeyListener(new KeyListener() {
|
component.addKeyListener(new KeyListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -160,10 +178,15 @@ public class DualityPanel extends JPanel {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zoom-Funktionalität für das Panel
|
||||||
|
* @param chartPanel
|
||||||
|
*/
|
||||||
protected void addZooming(ChartPanel chartPanel) {
|
protected void addZooming(ChartPanel chartPanel) {
|
||||||
|
|
||||||
chartPanel.addMouseWheelListener(new MouseWheelListener() {
|
chartPanel.addMouseWheelListener(new MouseWheelListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void mouseWheelMoved(MouseWheelEvent e) {
|
public void mouseWheelMoved(MouseWheelEvent e) {
|
||||||
|
|
||||||
Double min;
|
Double min;
|
||||||
|
@ -188,13 +211,20 @@ public class DualityPanel extends JPanel {
|
||||||
if (e.getScrollType() != MouseWheelEvent.WHEEL_UNIT_SCROLL)
|
if (e.getScrollType() != MouseWheelEvent.WHEEL_UNIT_SCROLL)
|
||||||
return;
|
return;
|
||||||
if (e.getWheelRotation() < 0)
|
if (e.getWheelRotation() < 0)
|
||||||
increaseZoom((ChartPanel) e.getComponent(), true, x, y);
|
increaseZoom((ChartPanel) e.getComponent());
|
||||||
else
|
else
|
||||||
decreaseZoom((ChartPanel) e.getComponent(), true, x, y);
|
decreaseZoom((ChartPanel) e.getComponent());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bewegung im Panel
|
||||||
|
* @param val Bewegung
|
||||||
|
* @param min minimale Wert
|
||||||
|
* @param max maximale Wert
|
||||||
|
* @return aktuell Sichtbare Teil des Panels
|
||||||
|
*/
|
||||||
private DateRange move(Double val, Double min, Double max) {
|
private DateRange move(Double val, Double min, Double max) {
|
||||||
Double minimum = min;
|
Double minimum = min;
|
||||||
Double maximum = max;
|
Double maximum = max;
|
||||||
|
@ -206,17 +236,30 @@ public class DualityPanel extends JPanel {
|
||||||
return new DateRange(minimum, maximum);
|
return new DateRange(minimum, maximum);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void increaseZoom(JComponent chart, boolean saveAction, Double x, Double y) {
|
/**
|
||||||
|
* Reinzoomen
|
||||||
|
* @param chart chart
|
||||||
|
*/
|
||||||
|
public synchronized void increaseZoom(JComponent chart) {
|
||||||
ChartPanel ch = (ChartPanel) chart;
|
ChartPanel ch = (ChartPanel) chart;
|
||||||
zoomChartAxis(ch, true, x, y);
|
zoomChartAxis(ch, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void decreaseZoom(JComponent chart, boolean saveAction, Double x, Double y) {
|
/**
|
||||||
|
* Rauszoomen
|
||||||
|
* @param chart chart
|
||||||
|
*/
|
||||||
|
public synchronized void decreaseZoom(JComponent chart) {
|
||||||
ChartPanel ch = (ChartPanel) chart;
|
ChartPanel ch = (ChartPanel) chart;
|
||||||
zoomChartAxis(ch, false, x, y);
|
zoomChartAxis(ch, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void zoomChartAxis(ChartPanel chartP, boolean increase, Double x, Double y) {
|
/**
|
||||||
|
* Zoom
|
||||||
|
* @param chartP
|
||||||
|
* @param increase
|
||||||
|
*/
|
||||||
|
private void zoomChartAxis(ChartPanel chartP, boolean increase) {
|
||||||
int width = chartP.getMaximumDrawWidth() - chartP.getMinimumDrawWidth();
|
int width = chartP.getMaximumDrawWidth() - chartP.getMinimumDrawWidth();
|
||||||
int height = chartP.getMaximumDrawHeight() - chartP.getMinimumDrawWidth();
|
int height = chartP.getMaximumDrawHeight() - chartP.getMinimumDrawWidth();
|
||||||
if (increase) {
|
if (increase) {
|
||||||
|
@ -229,6 +272,9 @@ public class DualityPanel extends JPanel {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Datensatz leeren
|
||||||
|
*/
|
||||||
public void clear() {
|
public void clear() {
|
||||||
if (dataset != null)
|
if (dataset != null)
|
||||||
dataset.removeAllSeries();
|
dataset.removeAllSeries();
|
||||||
|
|
|
@ -10,6 +10,8 @@ import javax.swing.*;
|
||||||
import javax.swing.border.TitledBorder;
|
import javax.swing.border.TitledBorder;
|
||||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||||
import javax.swing.filechooser.FileSystemView;
|
import javax.swing.filechooser.FileSystemView;
|
||||||
|
import javax.swing.plaf.FontUIResource;
|
||||||
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
import javax.swing.table.DefaultTableModel;
|
import javax.swing.table.DefaultTableModel;
|
||||||
import javax.swing.table.JTableHeader;
|
import javax.swing.table.JTableHeader;
|
||||||
import javax.swing.table.TableColumn;
|
import javax.swing.table.TableColumn;
|
||||||
|
@ -59,6 +61,10 @@ public class EvaluationPanel extends JPanel {
|
||||||
private PlotPanel plotPanel;
|
private PlotPanel plotPanel;
|
||||||
private String[] selections = {"Approximationsgüte", "Least Median of Squares", "Repeated-Median", "Theil-Sen"};
|
private String[] selections = {"Approximationsgüte", "Least Median of Squares", "Repeated-Median", "Theil-Sen"};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konstruktor
|
||||||
|
* @param view View
|
||||||
|
*/
|
||||||
public EvaluationPanel(MainFrame view) {
|
public EvaluationPanel(MainFrame view) {
|
||||||
super();
|
super();
|
||||||
this.view = view;
|
this.view = view;
|
||||||
|
@ -71,6 +77,9 @@ public class EvaluationPanel extends JPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialisiere die Komponenten
|
||||||
|
*/
|
||||||
private void init() {
|
private void init() {
|
||||||
datasetCountLabel = new JLabel("Größe des Datensatzes");
|
datasetCountLabel = new JLabel("Größe des Datensatzes");
|
||||||
Integer[] choice = {50, 100, 200, 500, 1000, 1500};
|
Integer[] choice = {50, 100, 200, 500, 1000, 1500};
|
||||||
|
@ -116,6 +125,9 @@ public class EvaluationPanel extends JPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hinzufügen der Komponenten zum ContentPane
|
||||||
|
*/
|
||||||
private void addComponents() {
|
private void addComponents() {
|
||||||
evalTypeOne.setSelected(true);
|
evalTypeOne.setSelected(true);
|
||||||
lms.setSelected(true);
|
lms.setSelected(true);
|
||||||
|
@ -144,10 +156,8 @@ public class EvaluationPanel extends JPanel {
|
||||||
comp.add(algorithmPanel);
|
comp.add(algorithmPanel);
|
||||||
comp.add(datasetCount);
|
comp.add(datasetCount);
|
||||||
|
|
||||||
|
|
||||||
comp.setBorder(new TitledBorder("Konfiguration"));
|
comp.setBorder(new TitledBorder("Konfiguration"));
|
||||||
|
|
||||||
|
|
||||||
//Tabelle
|
//Tabelle
|
||||||
model.setColumnIdentifiers(selections);
|
model.setColumnIdentifiers(selections);
|
||||||
table.setDragEnabled(true);
|
table.setDragEnabled(true);
|
||||||
|
@ -176,8 +186,17 @@ public class EvaluationPanel extends JPanel {
|
||||||
|
|
||||||
TableColumn tm = table.getColumnModel().getColumn(0);
|
TableColumn tm = table.getColumnModel().getColumn(0);
|
||||||
tm.setCellRenderer(new ColorColumnRenderer(Color.lightGray, Color.blue));
|
tm.setCellRenderer(new ColorColumnRenderer(Color.lightGray, Color.blue));
|
||||||
|
for (int i=1;i<4;i++){
|
||||||
|
DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer();
|
||||||
|
rightRenderer.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||||
|
rightRenderer.setFont(new FontUIResource("Courier", Font.PLAIN, 12));
|
||||||
|
table.getColumnModel().getColumn(i).setCellRenderer(rightRenderer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hinzufügen der Listener
|
||||||
|
*/
|
||||||
private void addListener() {
|
private void addListener() {
|
||||||
start.addActionListener(e -> {
|
start.addActionListener(e -> {
|
||||||
int type;
|
int type;
|
||||||
|
@ -201,7 +220,6 @@ public class EvaluationPanel extends JPanel {
|
||||||
chooser.setMultiSelectionEnabled(false);
|
chooser.setMultiSelectionEnabled(false);
|
||||||
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
||||||
|
|
||||||
|
|
||||||
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
|
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
|
||||||
//System.out.println ("Datei "+chooser.getSelectedFile()+ " ausgewählt.");
|
//System.out.println ("Datei "+chooser.getSelectedFile()+ " ausgewählt.");
|
||||||
file = chooser.getSelectedFile();
|
file = chooser.getSelectedFile();
|
||||||
|
@ -290,7 +308,6 @@ public class EvaluationPanel extends JPanel {
|
||||||
|
|
||||||
|
|
||||||
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
|
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
|
||||||
//System.out.println ("Datei "+chooser.getSelectedFile()+ " ausgewählt.");
|
|
||||||
file = chooser.getSelectedFile();
|
file = chooser.getSelectedFile();
|
||||||
String filename = file.getAbsolutePath().contains(".csv") ? file.getAbsolutePath() : file.getAbsolutePath().concat(".csv");
|
String filename = file.getAbsolutePath().contains(".csv") ? file.getAbsolutePath() : file.getAbsolutePath().concat(".csv");
|
||||||
File withExtension = new File(filename);
|
File withExtension = new File(filename);
|
||||||
|
@ -305,8 +322,15 @@ public class EvaluationPanel extends JPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addColumn(Object[] data, int col, boolean b) {
|
/**
|
||||||
if (b) {
|
* Fügt der Tabelle eine Spalte hinzu
|
||||||
|
*
|
||||||
|
* @param data Daten der Spalte
|
||||||
|
* @param col Spalte
|
||||||
|
* @param isLabel <code>true</code>, falls es sich um die Approximations Überschriften handelt
|
||||||
|
*/
|
||||||
|
public void addColumn(Object[] data, int col, boolean isLabel) {
|
||||||
|
if (isLabel) {
|
||||||
addBlankRows(data.length);
|
addBlankRows(data.length);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < data.length; i++) {
|
for (int i = 0; i < data.length; i++) {
|
||||||
|
@ -317,6 +341,10 @@ public class EvaluationPanel extends JPanel {
|
||||||
this.revalidate();
|
this.revalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt der Tabelle eine Zeile hinzu
|
||||||
|
* @param data Daten der Zeile
|
||||||
|
*/
|
||||||
public void addRow(Object[] data) {
|
public void addRow(Object[] data) {
|
||||||
addBlankRows(1);
|
addBlankRows(1);
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
|
@ -328,6 +356,10 @@ public class EvaluationPanel extends JPanel {
|
||||||
this.revalidate();
|
this.revalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visualisierung der Ausgleichsgeraden
|
||||||
|
* @param alg Steigung und y-Achsenabschnitt der Geraden, bestimmt durch die Schätzer
|
||||||
|
*/
|
||||||
public void drawLines(ArrayList<Double[]> alg) {
|
public void drawLines(ArrayList<Double[]> alg) {
|
||||||
Paint[] color = {Color.ORANGE, Color.RED, Color.MAGENTA};
|
Paint[] color = {Color.ORANGE, Color.RED, Color.MAGENTA};
|
||||||
String[] name = {"LMS", "RM", "TS"};
|
String[] name = {"LMS", "RM", "TS"};
|
||||||
|
@ -340,6 +372,11 @@ public class EvaluationPanel extends JPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visualisierung der Ausgleichsgerade
|
||||||
|
* @param results Steigung und y-Achsenabschnitt der Gerade, bestimmt durch die Schätzer
|
||||||
|
* @param alg identifizierung des Alg.
|
||||||
|
*/
|
||||||
public void drawLines(Object[] results, int alg) {
|
public void drawLines(Object[] results, int alg) {
|
||||||
String[] castedResults = Arrays.copyOf(results, results.length, String[].class);
|
String[] castedResults = Arrays.copyOf(results, results.length, String[].class);
|
||||||
Paint[] color = {Color.ORANGE, Color.RED, Color.MAGENTA};
|
Paint[] color = {Color.ORANGE, Color.RED, Color.MAGENTA};
|
||||||
|
@ -355,6 +392,10 @@ public class EvaluationPanel extends JPanel {
|
||||||
plotPanel.addLineToPlot(nM, nB, Color.BLACK, nName[alg]);
|
plotPanel.addLineToPlot(nM, nB, Color.BLACK, nName[alg]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visualisierung der dualen Geraden (Eingabemenge)
|
||||||
|
* @param points Liste der Geraden
|
||||||
|
*/
|
||||||
public void setDualPoints(LinkedList<Line> points) {
|
public void setDualPoints(LinkedList<Line> points) {
|
||||||
plotPanel = new PlotPanel();
|
plotPanel = new PlotPanel();
|
||||||
plotPanel.setBorder(new TitledBorder("Plot"));
|
plotPanel.setBorder(new TitledBorder("Plot"));
|
||||||
|
@ -364,6 +405,10 @@ public class EvaluationPanel extends JPanel {
|
||||||
plotPanel.revalidate();
|
plotPanel.revalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hilfsmethode
|
||||||
|
* @param n Anzahl der leeren Zeilen
|
||||||
|
*/
|
||||||
private void addBlankRows(int n) {
|
private void addBlankRows(int n) {
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
String[] tmp = {"", "", "", "",};
|
String[] tmp = {"", "", "", "",};
|
||||||
|
@ -371,11 +416,17 @@ public class EvaluationPanel extends JPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hilfsmethode
|
||||||
|
* @param val Anzahl der Zeilen die noch hinzugefügt werden
|
||||||
|
*/
|
||||||
public void setCurrentRow(int val) {
|
public void setCurrentRow(int val) {
|
||||||
this.currentRowOfTypes += val;
|
this.currentRowOfTypes += val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Kodierung welche Algorithmen ausgewählt wurden
|
||||||
|
*/
|
||||||
private int checkSelection() {
|
private int checkSelection() {
|
||||||
if (lms.isSelected() && rm.isSelected() && ts.isSelected()) {
|
if (lms.isSelected() && rm.isSelected() && ts.isSelected()) {
|
||||||
return 6;
|
return 6;
|
||||||
|
|
|
@ -18,6 +18,9 @@ public class InfoPanel extends JPanel {
|
||||||
private JScrollPane scrollPane;
|
private JScrollPane scrollPane;
|
||||||
private StringBuilder content;
|
private StringBuilder content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konstruktor
|
||||||
|
*/
|
||||||
public InfoPanel() {
|
public InfoPanel() {
|
||||||
this.setBorder(new TitledBorder("Ausgabekanal"));
|
this.setBorder(new TitledBorder("Ausgabekanal"));
|
||||||
this.setLayout(new BorderLayout());
|
this.setLayout(new BorderLayout());
|
||||||
|
@ -33,35 +36,47 @@ public class InfoPanel extends JPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt eine Text dem Panel als Paragraph hinzu
|
||||||
|
* @param p Übergebener Text
|
||||||
|
*/
|
||||||
public void appendParagraph(String p) {
|
public void appendParagraph(String p) {
|
||||||
|
|
||||||
content.append("<p>" + p + "</p>");
|
content.append("<p>" + p + "</p>");
|
||||||
|
|
||||||
output.setText(content.toString());
|
output.setText(content.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt eine Überschrift dem Panel hinzu
|
||||||
|
* @param h1 Überschrift
|
||||||
|
*/
|
||||||
public void appendParagraphWithHeading(String h1) {
|
public void appendParagraphWithHeading(String h1) {
|
||||||
|
|
||||||
content.append("<h1>" + h1 + "</h1>");
|
content.append("<h1>" + h1 + "</h1>");
|
||||||
|
|
||||||
output.setText(content.toString());
|
output.setText(content.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt einen Text in roter Schrift als Paragraph dem Panel hinzu
|
||||||
|
* @param p Text
|
||||||
|
*/
|
||||||
public void appendParagraphRed(String p) {
|
public void appendParagraphRed(String p) {
|
||||||
|
|
||||||
content.append("<p style=\" color:red \"><em><strong>" + p + "</strong></em></p>");
|
content.append("<p style=\" color:red \"><em><strong>" + p + "</strong></em></p>");
|
||||||
|
|
||||||
output.setText(content.toString());
|
output.setText(content.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt einen Text in grüner Schrift als Paragraph dem Panel hinzu
|
||||||
|
* @param p Text
|
||||||
|
*/
|
||||||
public void appendParagraphGreen(String p) {
|
public void appendParagraphGreen(String p) {
|
||||||
|
|
||||||
content.append("<p style=\" color:green \"><em><strong>" + p + "</strong></em></p>");
|
content.append("<p style=\" color:green \"><em><strong>" + p + "</strong></em></p>");
|
||||||
|
|
||||||
output.setText(content.toString());
|
output.setText(content.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt eine Tabelle mit Werten dem Panel hinzu
|
||||||
|
* @param heading Überschriften
|
||||||
|
* @param rows Liste von Daten pro Zeile
|
||||||
|
*/
|
||||||
public void logTable(List<String> heading, List<List<String>> rows) {
|
public void logTable(List<String> heading, List<List<String>> rows) {
|
||||||
content.append("<center>");
|
content.append("<center>");
|
||||||
content.append("<table style=\" width:80%; border: 1px solid black; \">");
|
content.append("<table style=\" width:80%; border: 1px solid black; \">");
|
||||||
|
|
|
@ -37,12 +37,19 @@ public class PlotPanel extends JPanel {
|
||||||
private XYLineAndShapeRenderer renderer;
|
private XYLineAndShapeRenderer renderer;
|
||||||
private Shape diamond;
|
private Shape diamond;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konstruktor
|
||||||
|
*/
|
||||||
public PlotPanel() {
|
public PlotPanel() {
|
||||||
super();
|
super();
|
||||||
this.setLayout(new BorderLayout());
|
this.setLayout(new BorderLayout());
|
||||||
seriesCount = 1;
|
seriesCount = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugen des Plots
|
||||||
|
* @param points Liste der Geraden
|
||||||
|
*/
|
||||||
public void createPlot(LinkedList<Line> points) {
|
public void createPlot(LinkedList<Line> points) {
|
||||||
if (!points.isEmpty()) {
|
if (!points.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
|
@ -86,11 +93,21 @@ public class PlotPanel extends JPanel {
|
||||||
this.add(panel, BorderLayout.CENTER);
|
this.add(panel, BorderLayout.CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Leeren des Datensatzes
|
||||||
|
*/
|
||||||
public void clear() {
|
public void clear() {
|
||||||
if (datapoints != null)
|
if (datapoints != null)
|
||||||
datapoints.removeAllSeries();
|
datapoints.removeAllSeries();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt eine Gerade zum Plot hinzu
|
||||||
|
* @param m Steigung
|
||||||
|
* @param b y-Achsenabschnitt
|
||||||
|
* @param color Farbe
|
||||||
|
* @param name Bezeichner
|
||||||
|
*/
|
||||||
public void addLineToPlot(double m, double b, Paint color, String name) {
|
public void addLineToPlot(double m, double b, Paint color, String name) {
|
||||||
|
|
||||||
XYSeries linesA = new XYSeries(name);
|
XYSeries linesA = new XYSeries(name);
|
||||||
|
@ -104,13 +121,15 @@ public class PlotPanel extends JPanel {
|
||||||
renderer.setBaseSeriesVisible(true);
|
renderer.setBaseSeriesVisible(true);
|
||||||
renderer.setSeriesLinesVisible(seriesCount, true);
|
renderer.setSeriesLinesVisible(seriesCount, true);
|
||||||
seriesCount++;
|
seriesCount++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt eine Gerade zum Plot hinzu
|
||||||
|
* @param m Steigung
|
||||||
|
* @param b y-Achsenabschnitt
|
||||||
|
* @param name Bezeichner
|
||||||
|
*/
|
||||||
public void addLineToPlot(double m, double b, String name) {
|
public void addLineToPlot(double m, double b, String name) {
|
||||||
|
|
||||||
|
|
||||||
XYSeries linesA = new XYSeries(name);
|
XYSeries linesA = new XYSeries(name);
|
||||||
linesA.add(min.doubleValue(), min * m + b);
|
linesA.add(min.doubleValue(), min * m + b);
|
||||||
linesA.add(max.doubleValue(), max * m + b);
|
linesA.add(max.doubleValue(), max * m + b);
|
||||||
|
@ -123,6 +142,10 @@ public class PlotPanel extends JPanel {
|
||||||
renderer.setSeriesLinesVisible(seriesCount, true);
|
renderer.setSeriesLinesVisible(seriesCount, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wandelt die Daten in ein passendes Format um
|
||||||
|
* @param points Liste der Geraden
|
||||||
|
*/
|
||||||
private void convertData(LinkedList<Line> points) {
|
private void convertData(LinkedList<Line> points) {
|
||||||
datapoints = new XYSeriesCollection();
|
datapoints = new XYSeriesCollection();
|
||||||
ArrayList<Double> coordinates = new ArrayList<>();
|
ArrayList<Double> coordinates = new ArrayList<>();
|
||||||
|
|
|
@ -19,6 +19,9 @@ public class LMSPanel extends TabPanel {
|
||||||
|
|
||||||
private GridBagConstraints gbc;
|
private GridBagConstraints gbc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konstruktor
|
||||||
|
*/
|
||||||
public LMSPanel() {
|
public LMSPanel() {
|
||||||
super();
|
super();
|
||||||
this.labels = new JLabel[2];
|
this.labels = new JLabel[2];
|
||||||
|
@ -64,6 +67,11 @@ public class LMSPanel extends TabPanel {
|
||||||
continer.add(this.input[row], gbc);
|
continer.add(this.input[row], gbc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hilftmethode um einen Botton an die passende Stelle zu platzieren
|
||||||
|
* @param row Zeile
|
||||||
|
* @param button Button
|
||||||
|
*/
|
||||||
private void addButton(int row, JButton button) {
|
private void addButton(int row, JButton button) {
|
||||||
JPanel buttonPanel = new JPanel();
|
JPanel buttonPanel = new JPanel();
|
||||||
buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
|
buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
@ -79,7 +87,10 @@ public class LMSPanel extends TabPanel {
|
||||||
continer.add(buttonPanel, gbc);
|
continer.add(buttonPanel, gbc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert die Eingaben in Form eines Feldes zurück. Die Parameter werden für den Alg. benötigt.
|
||||||
|
* @return Eingabe
|
||||||
|
*/
|
||||||
public String[] getInput() {
|
public String[] getInput() {
|
||||||
String[] input = new String[3];
|
String[] input = new String[3];
|
||||||
input[0] = this.input[0].getText();
|
input[0] = this.input[0].getText();
|
||||||
|
@ -93,12 +104,4 @@ public class LMSPanel extends TabPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNumeric(String str) {
|
|
||||||
try {
|
|
||||||
double d = Double.parseDouble(str);
|
|
||||||
} catch (NumberFormatException nfe) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,9 @@ public class RMPanel extends TabPanel {
|
||||||
private JPanel continer;
|
private JPanel continer;
|
||||||
private GridBagConstraints gbc;
|
private GridBagConstraints gbc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konstruktor
|
||||||
|
*/
|
||||||
public RMPanel() {
|
public RMPanel() {
|
||||||
super();
|
super();
|
||||||
this.labels = new JLabel();
|
this.labels = new JLabel();
|
||||||
|
@ -72,7 +75,10 @@ public class RMPanel extends TabPanel {
|
||||||
continer.add(this.input, gbc);
|
continer.add(this.input, gbc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert die Eingabe zurück. Der Parameter wird für den Alg. benötigt.
|
||||||
|
* @return Eingabe
|
||||||
|
*/
|
||||||
public String getInput() {
|
public String getInput() {
|
||||||
String input = "";
|
String input = "";
|
||||||
input = this.input.getText();
|
input = this.input.getText();
|
||||||
|
@ -82,18 +88,4 @@ public class RMPanel extends TabPanel {
|
||||||
JOptionPane.showMessageDialog(this, "Bitte geben Sie numerische Werte als Parameter an.", "Fehler bei der Eingabe", JOptionPane.ERROR_MESSAGE);
|
JOptionPane.showMessageDialog(this, "Bitte geben Sie numerische Werte als Parameter an.", "Fehler bei der Eingabe", JOptionPane.ERROR_MESSAGE);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInput(JTextField input) {
|
|
||||||
this.input = input;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public boolean isNumeric(String str) {
|
|
||||||
try {
|
|
||||||
double d = Double.parseDouble(str);
|
|
||||||
} catch (NumberFormatException nfe) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,9 @@ public class TSPanel extends TabPanel {
|
||||||
private JPanel continer;
|
private JPanel continer;
|
||||||
private GridBagConstraints gbc;
|
private GridBagConstraints gbc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konstruktor
|
||||||
|
*/
|
||||||
public TSPanel() {
|
public TSPanel() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,9 @@ public abstract class TabPanel extends JPanel {
|
||||||
|
|
||||||
private JButton startButton;
|
private JButton startButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konstruktor
|
||||||
|
*/
|
||||||
public TabPanel() {
|
public TabPanel() {
|
||||||
super();
|
super();
|
||||||
this.centerPanel = new JPanel(new BorderLayout());
|
this.centerPanel = new JPanel(new BorderLayout());
|
||||||
|
@ -38,17 +41,23 @@ public abstract class TabPanel extends JPanel {
|
||||||
this.add(northPanel, BorderLayout.NORTH);
|
this.add(northPanel, BorderLayout.NORTH);
|
||||||
|
|
||||||
this.startButton = new JButton("Start");
|
this.startButton = new JButton("Start");
|
||||||
this.startButton.setFont(new Font("Verdana", Font.PLAIN, 16));
|
this.startButton.setFont(new Font("SansSerif", Font.PLAIN, 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt in eine Zeile ein Überschrift(JLabel) und eine Eingabekomponente(JTextField)
|
||||||
|
* @param row Zeile
|
||||||
|
* @param name Überschrift
|
||||||
|
* @param value Standardwert
|
||||||
|
*/
|
||||||
protected void addTextfieldAndInput(int row, String name, Double value) {
|
protected void addTextfieldAndInput(int row, String name, Double value) {
|
||||||
//muss nicht obligatorisch implementiert werden
|
//muss nicht obligatorisch implementiert werden
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotPanel getPlotPanel() {
|
/**
|
||||||
return plotPanel;
|
* Hilftmethode um den Plotpanel erst bei Vorhandenen Ergebnissen hinzufügen zu können
|
||||||
}
|
* @param plotPanel Plotpanel
|
||||||
|
*/
|
||||||
public void setPlotPanel(PlotPanel plotPanel) {
|
public void setPlotPanel(PlotPanel plotPanel) {
|
||||||
this.plotPanel = plotPanel;
|
this.plotPanel = plotPanel;
|
||||||
if (this.centerPanel.getComponents().length > 0)
|
if (this.centerPanel.getComponents().length > 0)
|
||||||
|
@ -60,27 +69,38 @@ public abstract class TabPanel extends JPanel {
|
||||||
this.revalidate();
|
this.revalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return gibt den Startbutton zurück
|
||||||
|
*/
|
||||||
public JButton getStartButton() {
|
public JButton getStartButton() {
|
||||||
return startButton;
|
return startButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStartButton(JButton startButton) {
|
/**
|
||||||
this.startButton = startButton;
|
* @return gibt das obere Panel zurück
|
||||||
}
|
*/
|
||||||
|
|
||||||
public JPanel getNorthPanel() {
|
public JPanel getNorthPanel() {
|
||||||
return northPanel;
|
return northPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNorthPanel(JPanel northPanel) {
|
/**
|
||||||
this.northPanel = northPanel;
|
* @return gibt das untere Panel zurück
|
||||||
}
|
*/
|
||||||
|
|
||||||
public JPanel getCenterPanel() {
|
public JPanel getCenterPanel() {
|
||||||
return centerPanel;
|
return centerPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCenterPanel(JPanel centerPanel) {
|
/**
|
||||||
this.centerPanel = centerPanel;
|
* Hilfmethode zum prüfen ob die Eingabe numerisch ist.
|
||||||
|
* @param str Eingabe
|
||||||
|
* @return <code>true</code>, falls es sich bei der Eingabe um numerische Werte handelt
|
||||||
|
*/
|
||||||
|
public boolean isNumeric(String str) {
|
||||||
|
try {
|
||||||
|
double d = Double.parseDouble(str);
|
||||||
|
} catch (NumberFormatException nfe) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue