// Path: modules/core/src/main/java/de/tobifleig/lxc/Configuration.java
// public class Configuration {
// 
//     /**
//      * the backing Hashmap
//      */
//     private static final HashMap<String, String> map = new HashMap<String, String>();
// 
//     /**
//      * private constructor
//      */
//     private Configuration() {
//     }
// 
//     /**
//      * Reads a Setting, returns its value as long.
//      *
//      * @param setting the setting to read
//      * @return the saved value, or 0 (default)
//      */
//     public static long getLongSetting(String setting) {
//         long ret = 0;
//         try {
//             ret = Long.parseLong(map.get(setting));
//         } catch (Exception ex) {
//         }
//         return ret;
//     }
// 
//     /**
//      * Reads a Settings, returns its value as String
//      *
//      * @param setting the setting to read
//      * @return the saved value, or null (default)
//      */
//     public static String getStringSetting(String setting) {
//         String ret = null;
//         try {
//             ret = map.get(setting);
//         } catch (Exception ex) {
//         }
//         return ret;
//     }
// 
//     /**
//      * Puts a long-setting.
//      * overrides previous stored settings
//      *
//      * @param setting the key
//      * @param value the value
//      */
//     public static void putLongSetting(String setting, long value) {
//         putStringSetting(setting, String.valueOf(value));
//     }
// 
//     /**
//      * Puts a String-setting.
//      * overrides previous stored settings
//      *
//      * @param setting the key
//      * @param value the value
//      */
//     public static void putStringSetting(String setting, String value) {
//         map.put(setting, value);
//     }
// 
//     /**
//      * Returns true, if the given setting is contained in this configuration.
//      *
//      * @param setting the key
//      * @return true, if set
//      */
//     public static boolean containsKey(String setting) {
//         return map.containsKey(setting);
//     }
// 
//     /**
//      * Returns an Iterator over all keys contained in this configuration.
//      *
//      * @return an Iterator over all keys contained in this configuration
//      */
//     public static Iterator<String> getKeyIterator() {
//         return map.keySet().iterator();
//     }
// }


import de.tobifleig.lxc.Configuration;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.io.File;
import javax.swing.*;
/*
 * Copyright 2009, 2010, 2011, 2012, 2013, 2014 Tobias Fleig (tobifleig gmail com)
 *
 * All rights reserved.
 *
 * This file is part of LanXchange.
 *
 * LanXchange is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * LanXchange is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with LanXchange. If not, see <http://www.gnu.org/licenses/>.
 */
package de.tobifleig.lxc.plaf.swing;


/**
 * Options-Dialog.
 * Created by the NetBeans-GuiBuilder.
 *
 * @author Tobias Fleig <tobifleig googlemail com>
 */
public class OptionsDialog extends javax.swing.JDialog {

    private static final long serialVersionUID = 1L;

    /**
     * Creates new form LXCOptionsDialog
     *
     * @param parent
     * @param modal
     */
    public OptionsDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        addWindowListener(new WindowAdapter() {

            @Override
            public void windowClosing(java.awt.event.WindowEvent e) {
                setVisible(false);
            }
        });
        // close help window on ESC
        getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel");
        getRootPane().getActionMap().put("cancel", new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {
                setVisible(false);
            }
        });
    }

    /**
     * Displays this dialog and block until it is closed.
     */
    public void showAndWait() {
        // Read settings:
// Path: modules/core/src/main/java/de/tobifleig/lxc/Configuration.java
// public class Configuration {
// 
//     /**
//      * the backing Hashmap
//      */
//     private static final HashMap<String, String> map = new HashMap<String, String>();
// 
//     /**
//      * private constructor
//      */
//     private Configuration() {
//     }
// 
//     /**
//      * Reads a Setting, returns its value as long.
//      *
//      * @param setting the setting to read
//      * @return the saved value, or 0 (default)
//      */
//     public static long getLongSetting(String setting) {
//         long ret = 0;
//         try {
//             ret = Long.parseLong(map.get(setting));
//         } catch (Exception ex) {
//         }
//         return ret;
//     }
// 
//     /**
//      * Reads a Settings, returns its value as String
//      *
//      * @param setting the setting to read
//      * @return the saved value, or null (default)
//      */
//     public static String getStringSetting(String setting) {
//         String ret = null;
//         try {
//             ret = map.get(setting);
//         } catch (Exception ex) {
//         }
//         return ret;
//     }
// 
//     /**
//      * Puts a long-setting.
//      * overrides previous stored settings
//      *
//      * @param setting the key
//      * @param value the value
//      */
//     public static void putLongSetting(String setting, long value) {
//         putStringSetting(setting, String.valueOf(value));
//     }
// 
//     /**
//      * Puts a String-setting.
//      * overrides previous stored settings
//      *
//      * @param setting the key
//      * @param value the value
//      */
//     public static void putStringSetting(String setting, String value) {
//         map.put(setting, value);
//     }
// 
//     /**
//      * Returns true, if the given setting is contained in this configuration.
//      *
//      * @param setting the key
//      * @return true, if set
//      */
//     public static boolean containsKey(String setting) {
//         return map.containsKey(setting);
//     }
// 
//     /**
//      * Returns an Iterator over all keys contained in this configuration.
//      *
//      * @return an Iterator over all keys contained in this configuration
//      */
//     public static Iterator<String> getKeyIterator() {
//         return map.keySet().iterator();
//     }
// }


// Path: modules/swing/src/main/java/de/tobifleig/lxc/plaf/swing/OptionsDialog.java
import de.tobifleig.lxc.Configuration;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.io.File;
import javax.swing.*;

/*
 * Copyright 2009, 2010, 2011, 2012, 2013, 2014 Tobias Fleig (tobifleig gmail com)
 *
 * All rights reserved.
 *
 * This file is part of LanXchange.
 *
 * LanXchange is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * LanXchange is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with LanXchange. If not, see <http://www.gnu.org/licenses/>.
 */
package de.tobifleig.lxc.plaf.swing;


/**
 * Options-Dialog.
 * Created by the NetBeans-GuiBuilder.
 *
 * @author Tobias Fleig <tobifleig googlemail com>
 */
public class OptionsDialog extends javax.swing.JDialog {

    private static final long serialVersionUID = 1L;

    /**
     * Creates new form LXCOptionsDialog
     *
     * @param parent
     * @param modal
     */
    public OptionsDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        addWindowListener(new WindowAdapter() {

            @Override
            public void windowClosing(java.awt.event.WindowEvent e) {
                setVisible(false);
            }
        });
        // close help window on ESC
        getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel");
        getRootPane().getActionMap().put("cancel", new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {
                setVisible(false);
            }
        });
    }

    /**
     * Displays this dialog and block until it is closed.
     */
    public void showAndWait() {
        // Read settings:
        if (!Configuration.containsKey("defaulttarget") || "unset".equals(Configuration.getStringSetting("defaulttarget"))) {