<commit_before>package org.minimalj.frontend.vaadin.toolkit;

import java.text.NumberFormat;
import java.util.Locale;

import javax.swing.UIManager;

import org.minimalj.frontend.toolkit.ClientToolkit.ConfirmDialogType;
import org.minimalj.frontend.toolkit.ClientToolkit.DialogListener;
import org.minimalj.frontend.toolkit.ClientToolkit.DialogListener.DialogResult;

import com.vaadin.event.Action;
import com.vaadin.event.ShortcutAction;
import com.vaadin.event.ShortcutAction.KeyCode;
import com.vaadin.terminal.gwt.server.WebApplicationContext;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.NativeButton;
import com.vaadin.ui.Panel;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
import com.vaadin.ui.themes.Reindeer;

/**
 * Based on https://vaadin.com/directory#addon/confirmdialog
 *
 */
public class VaadinConfirmDialog extends Window {
    private static final long serialVersionUID = 1L;

	private static final double MIN_WIDTH = 20d;
    private static final double MAX_WIDTH = 40d;
    private static final double MIN_HEIGHT = 1d;
    private static final double MAX_HEIGHT = 30d;
    private static final double BUTTON_HEIGHT = 2.5;

	private final DialogListener listener;
	private Button buttonYes, buttonNo, buttonOk, buttonCancel;
	private int focusIndex;
	
	public VaadinConfirmDialog(Window window, String message, String title, ConfirmDialogType type, DialogListener listener) {
		this.listener = listener;
		
   	    WebApplicationContext context = (WebApplicationContext) window.getApplication().getContext();
        Locale locale = context.getBrowser().getLocale();
		
		setCaption(title);
		
        addListener(new Window.CloseListener() {
            private static final long serialVersionUID = 1L;<commit_msg>VaadinConfirmDialog: temp check in to compile with maven to work<commit_after>package org.minimalj.frontend.vaadin.toolkit;

import java.text.NumberFormat;
import java.util.Locale;

import javax.swing.UIManager;

import org.minimalj.frontend.toolkit.ClientToolkit.ConfirmDialogType;
import org.minimalj.frontend.toolkit.ClientToolkit.DialogListener;
import org.minimalj.frontend.toolkit.ClientToolkit.DialogListener.DialogResult;

import com.vaadin.event.Action;
import com.vaadin.event.ShortcutAction;
import com.vaadin.event.ShortcutAction.KeyCode;
import com.vaadin.terminal.gwt.server.WebApplicationContext;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.NativeButton;
import com.vaadin.ui.Panel;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
import com.vaadin.ui.themes.Reindeer;

/**
 * Based on https://vaadin.com/directory#addon/confirmdialog
 *
 */
public class VaadinConfirmDialog extends Window {
    private static final long serialVersionUID = 1L;

	private static final double MIN_WIDTH = 20d;
    private static final double MAX_WIDTH = 40d;
    private static final double MIN_HEIGHT = 1d;
    private static final double MAX_HEIGHT = 30d;
    private static final double BUTTON_HEIGHT = 2.5;

	private final DialogListener listener;
	private Button buttonYes, buttonNo, buttonOk, buttonCancel;
	private int focusIndex;
	
	public VaadinConfirmDialog(Window window, String message, String title, ConfirmDialogType type, DialogListener listener) {
		this.listener = listener;
		
   	    WebApplicationContext context = (WebApplicationContext) window.getApplication().getContext();
        Locale locale = Locale.getDefault(); // TODO: context.getBrowser().getLocale(); does not compile with jdk, but with eclipse
		
		setCaption(title);
		
        addListener(new Window.CloseListener() {
            private static final long serialVersionUID = 1L;
{'fraction_non_alphanumeric': 0.08900523560209424, 'fraction_numerical': 0.005484916479680878, 'mean_word_length': 4.988059701492538, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6820289', 'n_tokens_mistral': 1262, 'n_tokens_neox': 1162, 'n_words': 278}