Commit 2641f1a0 authored by Stefan Schuhbaeck's avatar Stefan Schuhbaeck
Browse files

remove dependency to log4j. Add Logging Facade

parent 83475864
package org.vadere.gui.compileScripts; package org.vadere.gui.compileScripts;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger; import org.vadere.util.logging.Logger;
/** /**
* @author Benedikt Zoennchen * @author Benedikt Zoennchen
...@@ -10,7 +10,7 @@ import org.apache.log4j.Logger; ...@@ -10,7 +10,7 @@ import org.apache.log4j.Logger;
*/ */
public class ClassListGenerator { public class ClassListGenerator {
private static Logger log = LogManager.getLogger(ClassListGenerator.class); private static Logger log = Logger.getLogger(ClassListGenerator.class);
public static void main(String... args) { public static void main(String... args) {
......
package org.vadere.gui.components.control; package org.vadere.gui.components.control;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.vadere.gui.components.model.IDefaultModel; import org.vadere.gui.components.model.IDefaultModel;
import org.vadere.util.logging.Logger;
import java.awt.*; import java.awt.*;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
/** /**
* Updates the viewport in the model if the viewport of the JScrollpane changes (pixel coordinates). * Updates the viewport in the model if the viewport of the JScrollpane changes (pixel coordinates).
* *
*/ */
public class JViewportChangeListener implements ChangeListener { public class JViewportChangeListener implements ChangeListener {
private Logger logger = LogManager.getLogger(JViewportChangeListener.class); private Logger logger = Logger.getLogger(JViewportChangeListener.class);
private final JScrollBar verticalScrollBar; private final JScrollBar verticalScrollBar;
private final IDefaultModel defaultModel; private final IDefaultModel defaultModel;
......
package org.vadere.gui.components.control.simulation; package org.vadere.gui.components.control.simulation;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.vadere.gui.components.model.DefaultSimulationConfig; import org.vadere.gui.components.model.DefaultSimulationConfig;
import org.vadere.gui.components.model.SimulationModel; import org.vadere.gui.components.model.SimulationModel;
import org.vadere.gui.components.utils.Resources; import org.vadere.gui.components.utils.Resources;
...@@ -10,6 +8,7 @@ import org.vadere.gui.onlinevisualization.view.IRendererChangeListener; ...@@ -10,6 +8,7 @@ import org.vadere.gui.onlinevisualization.view.IRendererChangeListener;
import org.vadere.gui.postvisualization.PostVisualisation; import org.vadere.gui.postvisualization.PostVisualisation;
import org.vadere.gui.postvisualization.utils.ImageGenerator; import org.vadere.gui.postvisualization.utils.ImageGenerator;
import org.vadere.gui.postvisualization.view.ImageSizeDialog; import org.vadere.gui.postvisualization.view.ImageSizeDialog;
import org.vadere.util.logging.Logger;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
...@@ -23,7 +22,7 @@ import javax.imageio.ImageIO; ...@@ -23,7 +22,7 @@ import javax.imageio.ImageIO;
import javax.swing.*; import javax.swing.*;
public class ActionGeneratePNG extends AbstractAction implements IRendererChangeListener { public class ActionGeneratePNG extends AbstractAction implements IRendererChangeListener {
private static Logger logger = LogManager.getLogger(ActionGeneratePNG.class); private static Logger logger = Logger.getLogger(ActionGeneratePNG.class);
private static Resources resources = Resources.getInstance("global"); private static Resources resources = Resources.getInstance("global");
private ImageGenerator generator; private ImageGenerator generator;
private final SimulationModel<? extends DefaultSimulationConfig> model; private final SimulationModel<? extends DefaultSimulationConfig> model;
......
package org.vadere.gui.components.control.simulation; package org.vadere.gui.components.control.simulation;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.vadere.gui.components.model.DefaultSimulationConfig; import org.vadere.gui.components.model.DefaultSimulationConfig;
import org.vadere.gui.components.model.SimulationModel; import org.vadere.gui.components.model.SimulationModel;
import org.vadere.gui.components.utils.Resources; import org.vadere.gui.components.utils.Resources;
...@@ -9,6 +8,7 @@ import org.vadere.gui.components.view.SimulationRenderer; ...@@ -9,6 +8,7 @@ import org.vadere.gui.components.view.SimulationRenderer;
import org.vadere.gui.onlinevisualization.view.IRendererChangeListener; import org.vadere.gui.onlinevisualization.view.IRendererChangeListener;
import org.vadere.gui.postvisualization.PostVisualisation; import org.vadere.gui.postvisualization.PostVisualisation;
import org.vadere.gui.postvisualization.utils.SVGGenerator; import org.vadere.gui.postvisualization.utils.SVGGenerator;
import org.vadere.util.logging.Logger;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.io.File; import java.io.File;
...@@ -19,7 +19,7 @@ import java.util.prefs.Preferences; ...@@ -19,7 +19,7 @@ import java.util.prefs.Preferences;
import javax.swing.*; import javax.swing.*;
public class ActionGenerateSVG extends AbstractAction implements IRendererChangeListener { public class ActionGenerateSVG extends AbstractAction implements IRendererChangeListener {
private static Logger logger = LogManager.getLogger(ActionGenerateSVG.class); private static Logger logger = Logger.getLogger(ActionGenerateSVG.class);
private static Resources resources = Resources.getInstance("global"); private static Resources resources = Resources.getInstance("global");
private final SVGGenerator svgGenerator; private final SVGGenerator svgGenerator;
private final SimulationModel<? extends DefaultSimulationConfig> model; private final SimulationModel<? extends DefaultSimulationConfig> model;
......
package org.vadere.gui.components.control.simulation; package org.vadere.gui.components.control.simulation;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.vadere.gui.components.model.DefaultSimulationConfig; import org.vadere.gui.components.model.DefaultSimulationConfig;
import org.vadere.gui.components.model.SimulationModel; import org.vadere.gui.components.model.SimulationModel;
import org.vadere.gui.components.utils.Resources; import org.vadere.gui.components.utils.Resources;
...@@ -9,8 +8,7 @@ import org.vadere.gui.components.view.SimulationRenderer; ...@@ -9,8 +8,7 @@ import org.vadere.gui.components.view.SimulationRenderer;
import org.vadere.gui.onlinevisualization.view.IRendererChangeListener; import org.vadere.gui.onlinevisualization.view.IRendererChangeListener;
import org.vadere.gui.postvisualization.PostVisualisation; import org.vadere.gui.postvisualization.PostVisualisation;
import org.vadere.gui.postvisualization.utils.TikzGenerator; import org.vadere.gui.postvisualization.utils.TikzGenerator;
import org.vadere.util.logging.Logger;
import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.io.File; import java.io.File;
...@@ -18,8 +16,10 @@ import java.text.SimpleDateFormat; ...@@ -18,8 +16,10 @@ import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.prefs.Preferences; import java.util.prefs.Preferences;
import javax.swing.*;
public class ActionGenerateTikz extends AbstractAction implements IRendererChangeListener { public class ActionGenerateTikz extends AbstractAction implements IRendererChangeListener {
private static Logger logger = LogManager.getLogger(ActionGenerateTikz.class); private static Logger logger = Logger.getLogger(ActionGenerateTikz.class);
private static Resources resources = Resources.getInstance("global"); private static Resources resources = Resources.getInstance("global");
private final TikzGenerator tikzGenerator; private final TikzGenerator tikzGenerator;
private final SimulationModel<? extends DefaultSimulationConfig> model; private final SimulationModel<? extends DefaultSimulationConfig> model;
......
package org.vadere.gui.components.control.simulation; package org.vadere.gui.components.control.simulation;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.vadere.gui.components.control.DefaultSelectionMode; import org.vadere.gui.components.control.DefaultSelectionMode;
import org.vadere.gui.components.control.DrawVoronoiDiagramMode; import org.vadere.gui.components.control.DrawVoronoiDiagramMode;
import org.vadere.gui.components.model.DefaultSimulationConfig; import org.vadere.gui.components.model.DefaultSimulationConfig;
import org.vadere.gui.components.model.SimulationModel; import org.vadere.gui.components.model.SimulationModel;
import org.vadere.util.logging.Logger;
import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import javax.swing.*;
public class ActionSwapSelectionMode extends ActionVisualization { public class ActionSwapSelectionMode extends ActionVisualization {
private static Logger logger = LogManager.getLogger(ActionSwapSelectionMode.class); private static Logger logger = Logger.getLogger(ActionSwapSelectionMode.class);
public ActionSwapSelectionMode(final String name, final SimulationModel<? extends DefaultSimulationConfig> model) { public ActionSwapSelectionMode(final String name, final SimulationModel<? extends DefaultSimulationConfig> model) {
super(name, model); super(name, model);
......
package org.vadere.gui.components.model; package org.vadere.gui.components.model;
import javax.swing.*; import org.vadere.gui.components.control.DefaultSelectionMode;
import org.vadere.gui.components.control.IMode;
import org.apache.log4j.LogManager; import org.vadere.gui.components.control.IScaleChangeListener;
import org.apache.log4j.Logger; import org.vadere.gui.components.control.IViewportChangeListener;
import org.vadere.gui.components.control.*; import org.vadere.gui.components.control.ViewportChangeEvent;
import org.vadere.gui.components.view.ISelectScenarioElementListener; import org.vadere.gui.components.view.ISelectScenarioElementListener;
import org.vadere.state.scenario.ScenarioElement; import org.vadere.state.scenario.ScenarioElement;
import org.vadere.state.types.ScenarioElementType; import org.vadere.state.types.ScenarioElementType;
import org.vadere.util.geometry.shapes.VPoint; import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.geometry.shapes.VShape; import org.vadere.util.geometry.shapes.VShape;
import org.vadere.util.logging.Logger;
import org.vadere.util.voronoi.VoronoiDiagram; import org.vadere.util.voronoi.VoronoiDiagram;
import java.awt.*; import java.awt.*;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.util.*; import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Observable;
import java.util.Optional;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.stream.Stream; import java.util.stream.Stream;
import java.util.stream.StreamSupport; import java.util.stream.StreamSupport;
import javax.swing.*;
public abstract class DefaultModel<T extends DefaultConfig> extends Observable implements IDefaultModel<T> { public abstract class DefaultModel<T extends DefaultConfig> extends Observable implements IDefaultModel<T> {
// private static final int BORDER_WIDTH = 20; // private static final int BORDER_WIDTH = 20;
// private static final int BORDER_HEIGHT = 20; // private static final int BORDER_HEIGHT = 20;
private static Logger log = LogManager.getLogger(DefaultModel.class); private static Logger log = Logger.getLogger(DefaultModel.class);
private IMode mouseSelectionMode; private IMode mouseSelectionMode;
......
package org.vadere.gui.components.utils; package org.vadere.gui.components.utils;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.log4j.Priority;
import org.jcodec.api.awt.SequenceEncoder; import org.jcodec.api.awt.SequenceEncoder;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.vadere.gui.postvisualization.PostVisualisation; import org.vadere.gui.postvisualization.PostVisualisation;
import org.vadere.gui.postvisualization.utils.IRecorder; import org.vadere.gui.postvisualization.utils.IRecorder;
import org.vadere.util.logging.Logger;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
...@@ -20,7 +19,7 @@ import java.util.prefs.Preferences; ...@@ -20,7 +19,7 @@ import java.util.prefs.Preferences;
import javax.swing.*; import javax.swing.*;
public class Recorder implements IRecorder { public class Recorder implements IRecorder {
private static Logger logger = LogManager.getLogger(Recorder.class); private static Logger logger = Logger.getLogger(Recorder.class);
private SequenceEncoder enc; private SequenceEncoder enc;
private static Resources resources = Resources.getInstance("global"); private static Resources resources = Resources.getInstance("global");
...@@ -64,7 +63,7 @@ public class Recorder implements IRecorder { ...@@ -64,7 +63,7 @@ public class Recorder implements IRecorder {
try { try {
enc.finish(); enc.finish();
} catch (IndexOutOfBoundsException error) { } catch (IndexOutOfBoundsException error) {
logger.log(Priority.DEBUG, "Nothing recorded! " + error.getMessage()); logger.debug( "Nothing recorded! %s" , error.getMessage());
} }
logger.info(this + " stop recording"); logger.info(this + " stop recording");
} }
......
package org.vadere.gui.components.utils; package org.vadere.gui.components.utils;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import javax.imageio.ImageIO; import org.vadere.util.logging.Logger;
import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
...@@ -16,6 +14,9 @@ import java.util.HashMap; ...@@ -16,6 +14,9 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
import javax.imageio.ImageIO;
import javax.swing.*;
/** /**
* The Resource class is for loading, changing, adding and manipulating properties in the * The Resource class is for loading, changing, adding and manipulating properties in the
* property file [applicationName]_config.properties. The global_config.properties file * property file [applicationName]_config.properties. The global_config.properties file
...@@ -26,7 +27,7 @@ import java.util.Properties; ...@@ -26,7 +27,7 @@ import java.util.Properties;
*/ */
public class Resources { public class Resources {
private static Logger logger = LogManager.getLogger(Resources.class); private static Logger logger = Logger.getLogger(Resources.class);
private Properties properties = null; private Properties properties = null;
......
...@@ -3,8 +3,6 @@ package org.vadere.gui.components.view; ...@@ -3,8 +3,6 @@ package org.vadere.gui.components.view;
import com.jgoodies.forms.layout.CellConstraints; import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout; import com.jgoodies.forms.layout.FormLayout;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rsyntaxtextarea.SyntaxConstants; import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
import org.fife.ui.rsyntaxtextarea.Theme; import org.fife.ui.rsyntaxtextarea.Theme;
...@@ -18,6 +16,7 @@ import org.vadere.state.attributes.Attributes; ...@@ -18,6 +16,7 @@ import org.vadere.state.attributes.Attributes;
import org.vadere.state.scenario.Pedestrian; import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.ScenarioElement; import org.vadere.state.scenario.ScenarioElement;
import org.vadere.state.util.StateJsonConverter; import org.vadere.state.util.StateJsonConverter;
import org.vadere.util.logging.Logger;
import java.awt.*; import java.awt.*;
import java.io.IOException; import java.io.IOException;
...@@ -33,7 +32,7 @@ import javax.swing.event.DocumentListener; ...@@ -33,7 +32,7 @@ import javax.swing.event.DocumentListener;
public class ScenarioElementView extends JPanel implements ISelectScenarioElementListener { public class ScenarioElementView extends JPanel implements ISelectScenarioElementListener {
private static final long serialVersionUID = -1567362675580536991L; private static final long serialVersionUID = -1567362675580536991L;
private static Logger logger = LogManager.getLogger(ScenarioElementView.class); private static Logger logger = Logger.getLogger(ScenarioElementView.class);
private JTextArea txtrTextfiletextarea; private JTextArea txtrTextfiletextarea;
private IDefaultModel panelModel; private IDefaultModel panelModel;
private DocumentListener documentListener; private DocumentListener documentListener;
......
...@@ -3,8 +3,6 @@ package org.vadere.gui.components.view; ...@@ -3,8 +3,6 @@ package org.vadere.gui.components.view;
import com.jgoodies.forms.layout.CellConstraints; import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout; import com.jgoodies.forms.layout.FormLayout;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.vadere.gui.components.control.simulation.ActionSetDensityColor; import org.vadere.gui.components.control.simulation.ActionSetDensityColor;
import org.vadere.gui.components.control.simulation.ActionSetObstacleColor; import org.vadere.gui.components.control.simulation.ActionSetObstacleColor;
import org.vadere.gui.components.control.simulation.ActionSetPedestrianColor; import org.vadere.gui.components.control.simulation.ActionSetPedestrianColor;
...@@ -19,9 +17,9 @@ import org.vadere.gui.components.utils.Messages; ...@@ -19,9 +17,9 @@ import org.vadere.gui.components.utils.Messages;
import org.vadere.gui.components.utils.Resources; import org.vadere.gui.components.utils.Resources;
import org.vadere.gui.components.utils.SwingUtils; import org.vadere.gui.components.utils.SwingUtils;
import org.vadere.gui.postvisualization.PostVisualisation; import org.vadere.gui.postvisualization.PostVisualisation;
import org.vadere.gui.postvisualization.control.*; import org.vadere.gui.postvisualization.control.ActionCloseSettingDialog;
import org.vadere.util.logging.Logger;
import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
...@@ -29,11 +27,13 @@ import java.util.List; ...@@ -29,11 +27,13 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.prefs.Preferences; import java.util.prefs.Preferences;
import javax.swing.*;
/** /**
* @author Benedikt Zoennchen * @author Benedikt Zoennchen
*/ */
public class SettingsDialog extends JDialog { public class SettingsDialog extends JDialog {
private static Logger logger = LogManager.getLogger(SettingsDialog.class); private static Logger logger = Logger.getLogger(SettingsDialog.class);
private static Resources resources = Resources.getInstance("global"); private static Resources resources = Resources.getInstance("global");
private DefaultSimulationConfig config; private DefaultSimulationConfig config;
......
package org.vadere.gui.components.view; package org.vadere.gui.components.view;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Stroke;
import java.awt.geom.Path2D;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.util.Collection;
import java.util.stream.Stream;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.vadere.util.visualization.ColorHelper;
import org.vadere.gui.components.model.SimulationModel; import org.vadere.gui.components.model.SimulationModel;
import org.vadere.gui.components.utils.CLGaussianCalculator; import org.vadere.gui.components.utils.CLGaussianCalculator;
import org.vadere.gui.components.utils.Resources; import org.vadere.gui.components.utils.Resources;
...@@ -22,10 +9,19 @@ import org.vadere.state.scenario.Agent; ...@@ -22,10 +9,19 @@ import org.vadere.state.scenario.Agent;
import org.vadere.util.geometry.shapes.VPoint; import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.geometry.shapes.VRectangle; import org.vadere.util.geometry.shapes.VRectangle;
import org.vadere.util.geometry.shapes.VTriangle; import org.vadere.util.geometry.shapes.VTriangle;
import org.vadere.util.logging.Logger;
import org.vadere.util.visualization.ColorHelper;
import java.awt.*;
import java.awt.geom.Path2D;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.util.Collection;
import java.util.stream.Stream;
public abstract class SimulationRenderer extends DefaultRenderer { public abstract class SimulationRenderer extends DefaultRenderer {
private static Logger logger = LogManager.getLogger(SimulationRenderer.class); private static Logger logger = Logger.getLogger(SimulationRenderer.class);
private static Resources resources = Resources.getInstance("postvisualization"); private static Resources resources = Resources.getInstance("postvisualization");
private static double MAX_POTENTIAL = 1000.0; private static double MAX_POTENTIAL = 1000.0;
......
package org.vadere.gui.onlinevisualization.control; package org.vadere.gui.onlinevisualization.control;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.vadere.gui.components.control.simulation.ActionVisualization; import org.vadere.gui.components.control.simulation.ActionVisualization;
import org.vadere.gui.components.model.DefaultSimulationConfig; import org.vadere.gui.components.model.DefaultSimulationConfig;
import org.vadere.gui.components.model.SimulationModel; import org.vadere.gui.components.model.SimulationModel;
import org.vadere.util.logging.Logger;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import javax.swing.*; import javax.swing.*;
public class ActionShowMesh extends ActionVisualization { public class ActionShowMesh extends ActionVisualization {
private static Logger logger = LogManager.getLogger(ActionShowMesh.class); private static Logger logger = Logger.getLogger(ActionShowMesh.class);
public ActionShowMesh(final String name, Icon icon, final SimulationModel<? extends DefaultSimulationConfig> model) { public ActionShowMesh(final String name, Icon icon, final SimulationModel<? extends DefaultSimulationConfig> model) {
super(name, icon, model); super(name, icon, model);
......
package org.vadere.gui.onlinevisualization.control; package org.vadere.gui.onlinevisualization.control;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.vadere.gui.components.model.DefaultSimulationConfig; import org.vadere.gui.components.model.DefaultSimulationConfig;
import org.vadere.gui.components.model.SimulationModel; import org.vadere.gui.components.model.SimulationModel;
import org.vadere.gui.components.utils.Messages; import org.vadere.gui.components.utils.Messages;
import org.vadere.gui.components.view.SimulationRenderer; import org.vadere.gui.components.view.SimulationRenderer;
import org.vadere.gui.onlinevisualization.view.IRendererChangeListener; import org.vadere.gui.onlinevisualization.view.IRendererChangeListener;