11.3.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit d609f8c4 authored by Benedikt Zoennchen's avatar Benedikt Zoennchen

Merge branch 'dev/bugfix' into 'develop'

Dev/bugfix

Following Issue's have been fixed with this patch:
- issue #34 JComboCheckBox NullPointerException on dropdown (OS: Windows)
- issue #30 Predefined Attributes for outputprocessors
- issue #26 Quicksave feature ist komisch
- issue #23 Undo/Redo Funktionalität unzuverlässig
- issue #16 Topography creator: esc sollte einen Zeichenvorgang abbrechen
- issue #9 Postvis: Photo und Video Export

See merge request !21
parents 7e27a232 a6475449
VadereGui/resources/icons/stop_record.png

5.84 KB | W: | H:

VadereGui/resources/icons/stop_record.png

884 Bytes | W: | H:

VadereGui/resources/icons/stop_record.png
VadereGui/resources/icons/stop_record.png
VadereGui/resources/icons/stop_record.png
VadereGui/resources/icons/stop_record.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -11,8 +11,6 @@ import org.vadere.gui.postvisualization.PostVisualisation; ...@@ -11,8 +11,6 @@ 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 javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
...@@ -21,6 +19,9 @@ import java.text.SimpleDateFormat; ...@@ -21,6 +19,9 @@ import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.prefs.Preferences; import java.util.prefs.Preferences;
import javax.imageio.ImageIO;
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 = LogManager.getLogger(ActionGeneratePNG.class);
private static Resources resources = Resources.getInstance("postvisualization"); private static Resources resources = Resources.getInstance("postvisualization");
...@@ -40,21 +41,32 @@ public class ActionGeneratePNG extends AbstractAction implements IRendererChange ...@@ -40,21 +41,32 @@ public class ActionGeneratePNG extends AbstractAction implements IRendererChange
ImageSizeDialog imageSizeDialog = new ImageSizeDialog(model); ImageSizeDialog imageSizeDialog = new ImageSizeDialog(model);
if (imageSizeDialog.getState() == ImageSizeDialog.State.Ok) { if (imageSizeDialog.getState() == ImageSizeDialog.State.Ok) {
BufferedImage bi = generator.generateImage(imageSizeDialog.getImageBound()); JFileChooser fileChooser = new JFileChooser(Preferences.userNodeForPackage(PostVisualisation.class).get("PostVis.snapshotDirectory.path", "."));
Date todaysDate = new java.util.Date(); Date todaysDate = new java.util.Date();
SimpleDateFormat formatter = new SimpleDateFormat(resources.getProperty("View.dataFormat")); SimpleDateFormat formatter = new SimpleDateFormat(resources.getProperty("View.dataFormat"));
String formattedDate = formatter.format(todaysDate); String formattedDate = formatter.format(todaysDate);
File outputfile = new File(
Preferences.userNodeForPackage(PostVisualisation.class).get("PostVis.snapshotDirectory.path", ".") File outputFile = new File("pv_snapshot_" + formattedDate + ".png");
+ System.getProperty("file.separator") + "pv_snapshot_" + formattedDate + ".png"); fileChooser.setSelectedFile(outputFile);
try {
ImageIO.write(bi, "png", outputfile); int returnVal = fileChooser.showDialog(null, "Save");
logger.info("generate new png: " + outputfile.getAbsolutePath());
} catch (IOException e1) { if (returnVal == JFileChooser.APPROVE_OPTION) {
logger.error(e1.getMessage());
e1.printStackTrace(); outputFile = fileChooser.getSelectedFile().toString().endsWith(".png") ? fileChooser.getSelectedFile()
: new File(fileChooser.getSelectedFile().toString() + ".png");
BufferedImage bi = generator.generateImage(imageSizeDialog.getImageBound());
try {
ImageIO.write(bi, "png", outputFile);
logger.info("generate new png: " + outputFile.getAbsolutePath());
} catch (IOException e1) {
logger.error(e1.getMessage());
e1.printStackTrace();
}
} }
} }
} }
......
...@@ -8,17 +8,16 @@ import org.vadere.gui.components.utils.Resources; ...@@ -8,17 +8,16 @@ import org.vadere.gui.components.utils.Resources;
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;
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.SVGGenerator; import org.vadere.gui.postvisualization.utils.SVGGenerator;
import org.vadere.gui.postvisualization.view.PostvisualizationRenderer;
import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.io.File; import java.io.File;
import java.text.SimpleDateFormat; 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 ActionGenerateSVG extends AbstractAction implements IRendererChangeListener { public class ActionGenerateSVG extends AbstractAction implements IRendererChangeListener {
private static Logger logger = LogManager.getLogger(ActionGenerateSVG.class); private static Logger logger = LogManager.getLogger(ActionGenerateSVG.class);
private static Resources resources = Resources.getInstance("postvisualization"); private static Resources resources = Resources.getInstance("postvisualization");
...@@ -37,10 +36,21 @@ public class ActionGenerateSVG extends AbstractAction implements IRendererChange ...@@ -37,10 +36,21 @@ public class ActionGenerateSVG extends AbstractAction implements IRendererChange
Date todaysDate = new java.util.Date(); Date todaysDate = new java.util.Date();
SimpleDateFormat formatter = new SimpleDateFormat(resources.getProperty("View.dataFormat")); SimpleDateFormat formatter = new SimpleDateFormat(resources.getProperty("View.dataFormat"));
String formattedDate = formatter.format(todaysDate); String formattedDate = formatter.format(todaysDate);
File outputfile = new File(
Preferences.userNodeForPackage(PostVisualisation.class).get("PostVis.snapshotDirectory.path", ".") JFileChooser fileChooser = new JFileChooser(Preferences.userNodeForPackage(PostVisualisation.class).get("PostVis.snapshotDirectory.path", "."));
+ System.getProperty("file.separator") + "pv_snapshot_" + formattedDate + ".svg"); File outputFile = new File("pv_snapshot_" + formattedDate + ".svg");
svgGenerator.generateSVG(outputfile);
fileChooser.setSelectedFile(outputFile);
int returnVal = fileChooser.showDialog(null, "Save");
if (returnVal == JFileChooser.APPROVE_OPTION) {
outputFile = fileChooser.getSelectedFile().toString().endsWith(".svg") ? fileChooser.getSelectedFile()
: new File(fileChooser.getSelectedFile().toString() + ".svg");
svgGenerator.generateSVG(outputFile);
}
} }
@Override @Override
......
package org.vadere.gui.postvisualization.control; package org.vadere.gui.postvisualization.control;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.vadere.gui.components.utils.Resources;
import org.vadere.gui.postvisualization.PostVisualisation;
import org.vadere.gui.postvisualization.utils.ImageGenerator;
import org.vadere.gui.postvisualization.view.ImageSizeDialog;
import org.vadere.gui.postvisualization.view.PostvisualizationRenderer;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
...@@ -11,14 +19,6 @@ import java.util.prefs.Preferences; ...@@ -11,14 +19,6 @@ import java.util.prefs.Preferences;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.swing.*; import javax.swing.*;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.vadere.gui.components.utils.Resources;
import org.vadere.gui.postvisualization.PostVisualisation;
import org.vadere.gui.postvisualization.utils.ImageGenerator;
import org.vadere.gui.postvisualization.view.ImageSizeDialog;
import org.vadere.gui.postvisualization.view.PostvisualizationRenderer;
public class ActionGeneratePNG extends ActionVisualization { public class ActionGeneratePNG extends ActionVisualization {
private static Logger logger = LogManager.getLogger(ActionGeneratePNG.class); private static Logger logger = LogManager.getLogger(ActionGeneratePNG.class);
private static Resources resources = Resources.getInstance("postvisualization"); private static Resources resources = Resources.getInstance("postvisualization");
...@@ -35,21 +35,32 @@ public class ActionGeneratePNG extends ActionVisualization { ...@@ -35,21 +35,32 @@ public class ActionGeneratePNG extends ActionVisualization {
ImageSizeDialog imageSizeDialog = new ImageSizeDialog(model); ImageSizeDialog imageSizeDialog = new ImageSizeDialog(model);
if (imageSizeDialog.getState() == ImageSizeDialog.State.Ok) { if (imageSizeDialog.getState() == ImageSizeDialog.State.Ok) {
BufferedImage bi = generator.generateImage(imageSizeDialog.getImageBound()); JFileChooser fileChooser = new JFileChooser(Preferences.userNodeForPackage(PostVisualisation.class).get("PostVis.snapshotDirectory.path", "."));
Date todaysDate = new java.util.Date(); Date todaysDate = new java.util.Date();
SimpleDateFormat formatter = new SimpleDateFormat(resources.getProperty("View.dataFormat")); SimpleDateFormat formatter = new SimpleDateFormat(resources.getProperty("View.dataFormat"));
String formattedDate = formatter.format(todaysDate); String formattedDate = formatter.format(todaysDate);
File outputfile = new File(
Preferences.userNodeForPackage(PostVisualisation.class).get("PostVis.snapshotDirectory.path", ".") File outputFile = new File("pv_snapshot_" + formattedDate + ".png");
+ System.getProperty("file.separator") + "pv_snapshot_" + formattedDate + ".png"); fileChooser.setSelectedFile(outputFile);
try {
ImageIO.write(bi, "png", outputfile); int returnVal = fileChooser.showDialog(null, "Save");
logger.info("generate new png: " + outputfile.getAbsolutePath());
} catch (IOException e1) { if (returnVal == JFileChooser.APPROVE_OPTION) {
logger.error(e1.getMessage());
e1.printStackTrace(); outputFile = fileChooser.getSelectedFile().toString().endsWith(".png") ? fileChooser.getSelectedFile()
: new File(fileChooser.getSelectedFile().toString() + ".png");
BufferedImage bi = generator.generateImage(imageSizeDialog.getImageBound());
try {
ImageIO.write(bi, "png", outputFile);
logger.info("generate new png: " + outputFile.getAbsolutePath());
} catch (IOException e1) {
logger.error(e1.getMessage());
e1.printStackTrace();
}
} }
} }
} }
......
package org.vadere.gui.postvisualization.control; package org.vadere.gui.postvisualization.control;
import java.awt.event.ActionEvent;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.prefs.Preferences;
import javax.swing.Icon;
import org.apache.log4j.LogManager; import org.apache.log4j.LogManager;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.vadere.gui.components.utils.Resources; import org.vadere.gui.components.utils.Resources;
...@@ -15,6 +7,14 @@ import org.vadere.gui.postvisualization.PostVisualisation; ...@@ -15,6 +7,14 @@ import org.vadere.gui.postvisualization.PostVisualisation;
import org.vadere.gui.postvisualization.utils.SVGGenerator; import org.vadere.gui.postvisualization.utils.SVGGenerator;
import org.vadere.gui.postvisualization.view.PostvisualizationRenderer; import org.vadere.gui.postvisualization.view.PostvisualizationRenderer;
import java.awt.event.ActionEvent;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.prefs.Preferences;
import javax.swing.*;
public class ActionGenerateSVG extends ActionVisualization { public class ActionGenerateSVG extends ActionVisualization {
private static Logger logger = LogManager.getLogger(ActionGenerateSVG.class); private static Logger logger = LogManager.getLogger(ActionGenerateSVG.class);
private static Resources resources = Resources.getInstance("postvisualization"); private static Resources resources = Resources.getInstance("postvisualization");
...@@ -30,9 +30,19 @@ public class ActionGenerateSVG extends ActionVisualization { ...@@ -30,9 +30,19 @@ public class ActionGenerateSVG extends ActionVisualization {
Date todaysDate = new java.util.Date(); Date todaysDate = new java.util.Date();
SimpleDateFormat formatter = new SimpleDateFormat(resources.getProperty("View.dataFormat")); SimpleDateFormat formatter = new SimpleDateFormat(resources.getProperty("View.dataFormat"));
String formattedDate = formatter.format(todaysDate); String formattedDate = formatter.format(todaysDate);
File outputfile = new File(
Preferences.userNodeForPackage(PostVisualisation.class).get("PostVis.snapshotDirectory.path", ".") JFileChooser fileChooser = new JFileChooser(Preferences.userNodeForPackage(PostVisualisation.class).get("PostVis.snapshotDirectory.path", "."));
+ System.getProperty("file.separator") + "pv_snapshot_" + formattedDate + ".svg"); File outputFile = new File("pv_snapshot_" + formattedDate + ".svg");
svgGenerator.generateSVG(outputfile);
fileChooser.setSelectedFile(outputFile);
int returnVal = fileChooser.showDialog(null, "Save");
if (returnVal == JFileChooser.APPROVE_OPTION) {
outputFile = fileChooser.getSelectedFile().toString().endsWith(".svg") ? fileChooser.getSelectedFile()
: new File(fileChooser.getSelectedFile().toString() + ".svg");
svgGenerator.generateSVG(outputFile);
}
} }
} }
...@@ -2,6 +2,8 @@ package org.vadere.gui.postvisualization.utils; ...@@ -2,6 +2,8 @@ package org.vadere.gui.postvisualization.utils;
import org.apache.log4j.LogManager; import org.apache.log4j.LogManager;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.apache.log4j.Priority;
import org.apache.log4j.lf5.LogLevel;
import org.jcodec.api.awt.SequenceEncoder; import org.jcodec.api.awt.SequenceEncoder;
import org.vadere.gui.components.utils.Resources; import org.vadere.gui.components.utils.Resources;
import org.vadere.gui.postvisualization.PostVisualisation; import org.vadere.gui.postvisualization.PostVisualisation;
...@@ -17,6 +19,8 @@ import java.util.Date; ...@@ -17,6 +19,8 @@ import java.util.Date;
import java.util.Observable; import java.util.Observable;
import java.util.prefs.Preferences; import java.util.prefs.Preferences;
import javax.swing.*;
public class MovRecorder implements IRecorder { public class MovRecorder implements IRecorder {
private static Logger logger = LogManager.getLogger(MovRecorder.class); private static Logger logger = LogManager.getLogger(MovRecorder.class);
private static Resources resources = Resources.getInstance("postvisualization"); private static Resources resources = Resources.getInstance("postvisualization");
...@@ -61,7 +65,11 @@ public class MovRecorder implements IRecorder { ...@@ -61,7 +65,11 @@ public class MovRecorder implements IRecorder {
@Override @Override
public synchronized void stopRecording() throws IOException { public synchronized void stopRecording() throws IOException {
enc.finish(); try {
enc.finish();
} catch (IndexOutOfBoundsException error) {
logger.log(Priority.DEBUG, "Nothing recorded! " + error.getMessage());
}
logger.info(this + " stop recording"); logger.info(this + " stop recording");
} }
...@@ -77,15 +85,25 @@ public class MovRecorder implements IRecorder { ...@@ -77,15 +85,25 @@ public class MovRecorder implements IRecorder {
Date todaysDate = new java.util.Date(); Date todaysDate = new java.util.Date();
SimpleDateFormat formatter = new SimpleDateFormat(resources.getProperty("View.dataFormat")); SimpleDateFormat formatter = new SimpleDateFormat(resources.getProperty("View.dataFormat"));
String formattedDate = formatter.format(todaysDate); String formattedDate = formatter.format(todaysDate);
try { JFileChooser fileChooser = new JFileChooser(Preferences.userNodeForPackage(PostVisualisation.class).get("PostVis.snapshotDirectory.path", "."));
this.enc = new SequenceEncoder(new File( File outputFile = new File("pv_snapshot_" + formattedDate + ".mov");
Preferences.userNodeForPackage(PostVisualisation.class).get("PostVis.snapshotDirectory.path", ".") fileChooser.setSelectedFile(outputFile);
+ System.getProperty("file.separator") + "pv_snapshot_" + formattedDate + ".mov"));
} catch (IOException e) { int returnVal = fileChooser.showDialog(null, "Save");
e.printStackTrace();
logger.error(e.getMessage()); if (returnVal == JFileChooser.APPROVE_OPTION) {
outputFile = fileChooser.getSelectedFile().toString().endsWith(".mov") ? fileChooser.getSelectedFile()
: new File(fileChooser.getSelectedFile().toString() + ".mov");
try {
this.enc = new SequenceEncoder(outputFile);
} catch (IOException e) {
e.printStackTrace();
logger.error(e.getMessage());
}
logger.info(this + " start recording");
} }
logger.info(this + " start recording");
} }
@Override @Override
......
...@@ -3,8 +3,6 @@ package org.vadere.gui.postvisualization.view; ...@@ -3,8 +3,6 @@ package org.vadere.gui.postvisualization.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 javax.swing.*;
import org.vadere.gui.components.control.IViewportChangeListener; import org.vadere.gui.components.control.IViewportChangeListener;
import org.vadere.gui.components.control.JViewportChangeListener; import org.vadere.gui.components.control.JViewportChangeListener;
import org.vadere.gui.components.control.PanelResizeListener; import org.vadere.gui.components.control.PanelResizeListener;
...@@ -14,7 +12,18 @@ import org.vadere.gui.components.utils.Resources; ...@@ -14,7 +12,18 @@ 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.components.view.ScenarioElementView; import org.vadere.gui.components.view.ScenarioElementView;
import org.vadere.gui.postvisualization.PostVisualisation; import org.vadere.gui.postvisualization.PostVisualisation;
import org.vadere.gui.postvisualization.control.*; import org.vadere.gui.postvisualization.control.ActionGeneratePNG;
import org.vadere.gui.postvisualization.control.ActionGenerateSVG;
import org.vadere.gui.postvisualization.control.ActionOpenFile;
import org.vadere.gui.postvisualization.control.ActionPause;
import org.vadere.gui.postvisualization.control.ActionPlay;
import org.vadere.gui.postvisualization.control.ActionRecording;
import org.vadere.gui.postvisualization.control.ActionRemoveFloorFieldFile;
import org.vadere.gui.postvisualization.control.ActionShowPotentialField;
import org.vadere.gui.postvisualization.control.ActionStop;
import org.vadere.gui.postvisualization.control.ActionSwapSelectionMode;
import org.vadere.gui.postvisualization.control.ActionVisualization;
import org.vadere.gui.postvisualization.control.Player;
import org.vadere.gui.postvisualization.model.PostvisualizationModel; import org.vadere.gui.postvisualization.model.PostvisualizationModel;
import org.vadere.gui.projectview.control.ActionDeselect; import org.vadere.gui.projectview.control.ActionDeselect;
import org.vadere.simulator.projects.Scenario; import org.vadere.simulator.projects.Scenario;
...@@ -31,6 +40,8 @@ import java.text.MessageFormat; ...@@ -31,6 +40,8 @@ import java.text.MessageFormat;
import java.util.Observer; import java.util.Observer;
import java.util.prefs.Preferences; import java.util.prefs.Preferences;
import javax.swing.*;
/** /**
* Main Window of the new post visualization. * Main Window of the new post visualization.
* *
...@@ -319,7 +330,7 @@ public class PostvisualizationWindow extends JPanel implements Observer { ...@@ -319,7 +330,7 @@ public class PostvisualizationWindow extends JPanel implements Observer {
// deselect selected element on esc // deselect selected element on esc
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "deselect"); getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "deselect");
getActionMap().put("deselect", new ActionDeselect(model, this)); getActionMap().put("deselect", new ActionDeselect(model, this, null));
} }
public JMenuBar getMenu() { public JMenuBar getMenu() {
......
package org.vadere.gui.projectview.control; package org.vadere.gui.projectview.control;
import javax.swing.*;
import org.vadere.gui.components.model.IDefaultModel; import org.vadere.gui.components.model.IDefaultModel;
import org.vadere.gui.topographycreator.control.ActionSelectSelectShape;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import javax.swing.*;
public class ActionDeselect extends AbstractAction { public class ActionDeselect extends AbstractAction {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private final IDefaultModel panelModel; private final IDefaultModel panelModel;
private JPanel jpanel; private JPanel jpanel;
private ActionSelectSelectShape selectSelectShape;
public ActionDeselect(final IDefaultModel panelModel, JPanel jpanel) { public ActionDeselect(final IDefaultModel panelModel, JPanel jpanel, ActionSelectSelectShape selectSelectShape) {
this.panelModel = panelModel; this.panelModel = panelModel;
this.jpanel = jpanel; this.jpanel = jpanel;
this.selectSelectShape = selectSelectShape;
} }
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
panelModel.deselectSelectedElement(); panelModel.deselectSelectedElement();
//Reset to select mode
if (selectSelectShape != null) {
selectSelectShape.actionPerformed(e);
}
jpanel.repaint(); jpanel.repaint();
} }
} }
package org.vadere.gui.topographycreator.control; package org.vadere.gui.topographycreator.control;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.log4j.Priority;
import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import javax.swing.AbstractAction; import javax.swing.*;
import javax.swing.ImageIcon; import javax.swing.undo.CannotRedoException;
import javax.swing.undo.UndoManager; import javax.swing.undo.UndoManager;
/** /**
...@@ -15,6 +20,7 @@ public class ActionRedo extends AbstractAction { ...@@ -15,6 +20,7 @@ public class ActionRedo extends AbstractAction {
private static final long serialVersionUID = 4975524648404524891L; private static final long serialVersionUID = 4975524648404524891L;
private final UndoManager undoManager; private final UndoManager undoManager;
private final TopographyAction action; private final TopographyAction action;
private static Logger logger = LogManager.getLogger(ActionRedo.class);
public ActionRedo(final String name, final ImageIcon icon, final UndoManager undoManager, public ActionRedo(final String name, final ImageIcon icon, final UndoManager undoManager,
final TopographyAction action) { final TopographyAction action) {
...@@ -25,7 +31,12 @@ public class ActionRedo extends AbstractAction { ...@@ -25,7 +31,12 @@ public class ActionRedo extends AbstractAction {
@Override @Override
public void actionPerformed(ActionEvent arg0) { public void actionPerformed(ActionEvent arg0) {
undoManager.redo(); try {
undoManager.redo();
} catch (CannotRedoException e) {
logger.log(Priority.DEBUG, "Cannot redo! List of edits is empty!");
Toolkit.getDefaultToolkit().beep();
}
action.actionPerformed(arg0); action.actionPerformed(arg0);
} }
} }
package org.vadere.gui.topographycreator.control; package org.vadere.gui.topographycreator.control;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.log4j.Priority;
import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import javax.swing.AbstractAction; import javax.swing.*;
import javax.swing.ImageIcon; import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoManager; import javax.swing.undo.UndoManager;