Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public final class UICore {
public static final String P_FORMAT_CODE = "locale.format.code";

public static final String CONFIRM_CLOSE = "weasis.confirm.closing";
public static final String CONFIRM_DELETE_MEASUREMENT = "weasis.confirm.delete.measurement";
public static final String LINUX_WINDOWS_DECORATION = "weasis.linux.windows.decoration";
public static final String USE_SYSTEM_FILE_CHOOSER = "weasis.use.system.file.chooser";
private static final Logger LOGGER = LoggerFactory.getLogger(UICore.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@
import javax.swing.JOptionPane;
import org.weasis.core.Messages;
import org.weasis.core.api.gui.util.ActionW;
import org.weasis.core.api.gui.util.GuiUtils;
import org.weasis.core.api.image.util.MeasurableLayer;
import org.weasis.core.api.media.data.ImageElement;
import org.weasis.core.api.service.UICore;
import org.weasis.core.ui.editor.image.Canvas;
import org.weasis.core.ui.editor.image.MeasureToolBar;
import org.weasis.core.ui.editor.image.ViewCanvas;
Expand Down Expand Up @@ -561,14 +563,17 @@ public void deleteSelectedGraphics(Canvas canvas, Boolean warningMessage) {
List<Graphic> list = getSelectedGraphics();
if (!list.isEmpty()) {
int response = 0;
if (warningMessage) {
boolean confirmPref = GuiUtils.getUICore()
.getSystemPreferences()
.getBooleanProperty(UICore.CONFIRM_DELETE_MEASUREMENT, true);
if (warningMessage && confirmPref) {
response =
JOptionPane.showConfirmDialog(
canvas.getJComponent(),
String.format(Messages.getString("AbstractLayerModel.del_conf"), list.size()),
Messages.getString("AbstractLayerModel.del_graphs"),
JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE);
JOptionPane.showConfirmDialog(
canvas.getJComponent(),
String.format(Messages.getString("AbstractLayerModel.del_conf"), list.size()),
Messages.getString("AbstractLayerModel.del_graphs"),
JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE);
}
if (Objects.equals(response, 0)) {
list.forEach(Graphic::fireRemoveAction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public class GeneralSetting extends AbstractItemDialogPage {
private final JCheckBox checkboxConfirmClosing =
new JCheckBox(Messages.getString("GeneralSetting.closingConfirmation"));

private final JCheckBox checkboxConfirmDeleteMeasurement =
new JCheckBox("Confirm delete measurement");

private final JPanel menuPanel = new JPanel();

public GeneralSetting(PreferenceDialog dialog) {
Expand Down Expand Up @@ -60,6 +63,7 @@ public GeneralSetting(PreferenceDialog dialog) {

private void jbInit() {
add(GuiUtils.getFlowLayoutPanel(0, ITEM_SEPARATOR_LARGE, checkboxConfirmClosing));
add(GuiUtils.getFlowLayoutPanel(0, ITEM_SEPARATOR_LARGE, checkboxConfirmDeleteMeasurement));
add(GuiUtils.boxVerticalStrut(BLOCK_SEPARATOR));

add(GuiUtils.boxYLastElement(LAST_FILLER_HEIGHT));
Expand All @@ -74,6 +78,8 @@ public JPanel getMenuPanel() {
protected void initialize() {
WProperties preferences = GuiUtils.getUICore().getSystemPreferences();
checkboxConfirmClosing.setSelected(preferences.getBooleanProperty(UICore.CONFIRM_CLOSE, false));
checkboxConfirmDeleteMeasurement.setSelected(
preferences.getBooleanProperty(UICore.CONFIRM_DELETE_MEASUREMENT, true));
}

@Override
Expand All @@ -85,13 +91,21 @@ public void closeAdditionalWindow() {
GuiUtils.getUICore()
.getSystemPreferences()
.putBooleanProperty(UICore.CONFIRM_CLOSE, checkboxConfirmClosing.isSelected());

GuiUtils.getUICore()
.getSystemPreferences()
.putBooleanProperty(UICore.CONFIRM_DELETE_MEASUREMENT, checkboxConfirmDeleteMeasurement.isSelected());
}


@Override
public void resetToDefaultValues() {
GuiUtils.getUICore()
.getSystemPreferences()
.resetProperty(UICore.CONFIRM_CLOSE, Boolean.FALSE.toString());
GuiUtils.getUICore()
.getSystemPreferences()
.resetProperty(UICore.CONFIRM_DELETE_MEASUREMENT, Boolean.TRUE.toString());
initialize();
}
}