gt:         jTextFieldOptionsProxy = new javax.swing.JTextField();
context: /*
   * Copyright (C) 2016 phramusca ( https://github.com/phramusca/JaMuz/ )
   *
   * This program 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.
   *
   * This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
   */
  package jamuz.gui;
  
  import jamuz.Jamuz;
  import jamuz.Machine;
  import jamuz.Option;
  import jamuz.process.merge.StatSource;
  import jamuz.process.sync.Device;
  import jamuz.utils.Inter;
  import jamuz.utils.Swing;
  import java.awt.Frame;
  import java.awt.event.ActionEvent;
  import java.awt.event.KeyEvent;
  import java.text.MessageFormat;
  import javax.swing.AbstractAction;
  import javax.swing.ActionMap;
  import javax.swing.DefaultListModel;
  import javax.swing.InputMap;
  import javax.swing.JComponent;
  import javax.swing.JLabel;
  import javax.swing.JOptionPane;
  import javax.swing.JTextField;
  import javax.swing.KeyStroke;
  
  /**
   *
   * @author phramusca ( https://github.com/phramusca/JaMuz/ )
   */
  public class DialogOptions extends javax.swing.JDialog {
  
  	/**
  	 * A return status code - returned if Cancel button has been pressed
  	 */
  	public static final int RET_CANCEL = 0;
  	/**
  	 * A return status code - returned if OK button has been pressed
  	 */
  	public static final int RET_OK = 1;
  
  	private static String machineName;
  	private static Machine selOptions;
  	
  	/**
  	 * Creates new form NewOkCancelDialog
  	 * @param parent
  	 * @param modal
  	 * @param myMachineName
  	 */
  	public DialogOptions(java.awt.Frame parent, boolean modal, String myMachineName) {
  		super(parent, modal);
  		initComponents();
  		machineName=myMachineName;
  
  		// Close the dialog when Esc is pressed
  		String cancelName = "cancel";
  		InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
  		inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), cancelName);
  		ActionMap actionMap = rootPane.getActionMap();
  		actionMap.put(cancelName, new AbstractAction() {
  			@Override
  			public void actionPerformed(ActionEvent e) {
  				doClose(RET_CANCEL);
  			}
  		});
  		
  		displayOptions();
  		displayStatSources();
  		displayDevices();
  	}
  
  	/**
  	 * Displays options and stat sources
  	 */
  	public static void displayOptions() {
  		//Get selected machine name options
  		selOptions = new Machine(machineName);
  		selOptions.read();
  		
          jTextFieldDescription.setText(selOptions.getDescription());
  		
  		jLabelDescription.setText("<html><b>"+Inter.get("Options.Title.Description")+"</b> : "
  				+MessageFormat.format(Inter.get("Options.Comment.Description"), 
  						machineName)+"</html>");  //NOI18N
  
          jButtonOptionSave.setEnabled(true);
  
  		Option option = selOptions.getOption("library.isMaster");
  		setOption("location.library", jTextFieldOptionLocationLibrary, jLabelOptionLocationLibrary);
  		jCheckBoxOptionLibraryIsMaster.setSelected(option.getValue().equals("true"));
  		jCheckBoxOptionLibraryIsMaster.setText(option.getComment());
  		
  		setOption("location.add", jTextFieldOptionLocationAdd, jLabelOptionLocationAdd);
  		setOption("location.ko", jTextFieldOptionLocationKO, jLabelOptionLocationKO);
  		setOption("location.manual", jTextFieldOptionLocationManual, jLabelOptionLocationManual);
  		setOption("location.ok", jTextFieldOptionLocationOK, jLabelOptionLocationOK);
  		setOption("location.transcoded", jTextFieldOptionLocationTranscoded, jLabelOptionLocationTranscoded);
  		setOption("location.mask", jTextFieldOptionMask, jLabelOptionMask);
  		setOption("files.audio", jTextFieldOptionsFilesAudio, jLabelOptionsFilesAudio);
  		setOption("files.convert", jTextFieldOptionsFilesConvert, jLabelOptionsFilesConvert);
  		setOption("files.delete", jTextFieldOptionsFilesDelete, jLabelOptionsFilesDelete);
  		setOption("files.image", jTextFieldOptionsFilesImage, jLabelOptionsFilesImage);
  		setOption("log.count", jTextFieldOptionsLogCount, jLabelOptionsLogCount);
  		setOption("log.level", jTextFieldOptionsLogLevel, jLabelOptionsLogLevel);
  		setOption("log.limit", jTextFieldOptionsLogLimit, jLabelOptionsLogLimit);
  		setOption("network.proxy", jTextFieldOptionsProxy, jLabelOptionsProxy);
  	}
  	
  	/**
  	 *
  	 */
  	public static void displayStatSources() {
  		//Show stat source list for selected machine
  		DefaultListModel listModel=(DefaultListModel) jListStatSources.getModel();
  		listModel.clear();
  		//TODO: Order by name
  		selOptions.getStatSources(true).stream().forEach((statSource) -> {
  			listModel.addElement(statSource);
  		});
  	}
  	
  	/**
  	 *
  	 */
  	public static void displayDevices() {
  		//Show device list for selected machine
  		DefaultListModel devicesModel=(DefaultListModel) jListDevices.getModel();
  		devicesModel.clear();
  		selOptions.getDevices(true).stream().forEach((device) -> {
  			devicesModel.addElement(device);
  		});
  	}
  	
  	private static void setOption(String id, JTextField textField, JLabel jLabel) {
  		Option option = selOptions.getOption(id);
  		textField.setText(option.getValue());
  		jLabel.setText(option.getComment());
  	}
  	
  	/**
  	 * @return the return status of this dialog - one of RET_OK or RET_CANCEL
  	 */
  	public int getReturnStatus() {
  		return returnStatus;
  	}
  
  	/**
  	 * This method is called from within the constructor to initialize the form.
  	 * WARNING: Do NOT modify this code. The content of this method is always
  	 * regenerated by the Form Editor.
  	 */
  	@SuppressWarnings("unchecked")
      // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
      private void initComponents() {
  
          jTabbedPane1 = new javax.swing.JTabbedPane();
          jPanelMachineAndLibrary = new javax.swing.JPanel();
          jPanel5 = new javax.swing.JPanel();
          jTextFieldDescription = new javax.swing.JTextField();
          jLabelDescription = new javax.swing.JLabel();
          jPanel3 = new javax.swing.JPanel();
          jTextFieldOptionLocationLibrary = new javax.swing.JTextField();
          jButtonOptionSelectFolder = new javax.swing.JButton();
          jLabelOptionLocationLibrary = new javax.swing.JLabel();
          jCheckBoxOptionLibraryIsMaster = new javax.swing.JCheckBox();
          jPanelCheckLocations = new javax.swing.JPanel();
          jPanel7 = new javax.swing.JPanel();
          jTextFieldOptionLocationAdd = new javax.swing.JTextField();
          jButtonOptionSelectFolderNew = new javax.swing.JButton();
          jLabelOptionLocationAdd = new javax.swing.JLabel();
          jPanel8 = new javax.swing.JPanel();
          jTextFieldOptionLocationManual = new javax.swing.JTextField();
          jButtonOptionSelectFolderManual = new javax.swing.JButton();
          jLabelOptionLocationManual = new javax.swing.JLabel();
          jPanel9 = new javax.swing.JPanel();
          jTextFieldOptionLocationOK = new javax.swing.JTextField();
          jButtonOptionSelectFolderOK = new javax.swing.JButton();
          jLabelOptionLocationOK = new javax.swing.JLabel();
          jPanel17 = new javax.swing.JPanel();
          jTextFieldOptionLocationKO = new javax.swing.JTextField();
          jButtonOptionSelectFolderKO = new javax.swing.JButton();
          jLabelOptionLocationKO = new javax.swing.JLabel();
          jPanel21 = new javax.swing.JPanel();
          jTextFieldOptionLocationTranscoded = new javax.swing.JTextField();
          jButtonOptionSelectFolderTranscoded = new javax.swing.JButton();
          jLabelOptionLocationTranscoded = new javax.swing.JLabel();
          jPanelCheckOptions = new javax.swing.JPanel();
          jPanel10 = new javax.swing.JPanel();
          jTextFieldOptionMask = new javax.swing.JTextField();
          jLabelOptionMask = new javax.swing.JLabel();
          jPanel16 = new javax.swing.JPanel();
          jTextFieldOptionsFilesAudio = new javax.swing.JTextField();
          jLabelOptionsFilesAudio = new javax.swing.JLabel();
          jPanel18 = new javax.swing.JPanel();
          jTextFieldOptionsFilesImage = new javax.swing.JTextField();
          jLabelOptionsFilesImage = new javax.swing.JLabel();
          jPanel19 = new javax.swing.JPanel();
          jTextFieldOptionsFilesConvert = new javax.swing.JTextField();
          jLabelOptionsFilesConvert = new javax.swing.JLabel();
          jPanel20 = new javax.swing.JPanel();
          jTextFieldOptionsFilesDelete = new javax.swing.JTextField();
          jLabelOptionsFilesDelete = new javax.swing.JLabel();
          jPanelSourceAndDevices = new javax.swing.JPanel();
          jSplitPane1 = new javax.swing.JSplitPane();
          jPanelStatSources = new javax.swing.JPanel();
          jScrollPaneStatSouces = new javax.swing.JScrollPane();
          jListStatSources = new javax.swing.JList();
          jButtonStatSouceAdd = new javax.swing.JButton();
          jButtonStatSouceEdit = new javax.swing.JButton();
          jButtonStatSouceDel = new javax.swing.JButton();
          jPanelStatSources1 = new javax.swing.JPanel();
          jScrollPaneStatSouces1 = new javax.swing.JScrollPane();
          jListDevices = new javax.swing.JList();
          jButtonDeviceAdd = new javax.swing.JButton();
          jButtonDeviceEdit = new javax.swing.JButton();
          jButtonDeviceDel = new javax.swing.JButton();
          jPanelProxyAndLog = new javax.swing.JPanel();
          jPanel12 = new javax.swing.JPanel();
          jTextFieldOptionsLogLimit = new javax.swing.JTextField();
          jLabelOptionsLogLimit = new javax.swing.JLabel();
          jPanel13 = new javax.swing.JPanel();
          jTextFieldOptionsLogLevel = new javax.swing.JTextField();
          jLabelOptionsLogLevel = new javax.swing.JLabel();
          jPanel14 = new javax.swing.JPanel();
          jTextFieldOptionsLogCount = new javax.swing.JTextField();
          jLabelOptionsLogCount = new javax.swing.JLabel();
          jPanel15 = new javax.swing.JPanel();
  