private void _saveApp() {

	try{
	    if(_xmlFile == null)
		throw new Exception("_saveApp: _xmlFile is null");

	    if(isValid(true)){

		if(_xmlFile.canWrite()){
		    int result = JOptionPane.showConfirmDialog(this, 
							       "Application file = " + _xmlFile.getName() + " already exists. Loss of data could occur if it is overwritten.\nDo you want to continue?", 
							       "Confirm file overwrite", JOptionPane.YES_NO_OPTION);
		    if(result == JOptionPane.NO_OPTION){
			logPanel.add("Application was not written to disk", LogPanel.WARNING, false);
			return;
		    }
		}

		Document document = _createXML(false);

		// Transform to write out
		FileWriter fwriter = new FileWriter(_xmlFile);

		_transformer.transform(new DOMSource(document), new StreamResult(fwriter));

		logPanel.add("Written application to <strong>" + _xmlFile.getName() + "</strong>", LogPanel.OK, false);
		_enableAll();
		_dataFormat.update();
		_unsavedSettings = false;

	    }else{
		throw new Exception("Invalid parameters; no XML file written");
	    }
	}
	catch(Exception e){
	    logPanel.add(e.toString(), LogPanel.ERROR, false);
	    _showExceptionDialog(e);
	}
    }