public EditBasicIngredientDialog(java.awt.Frame parent, boolean modal, EditBasicIngredientDelegate delegate, BasicIngredient model) {
	super(parent, modal);
	initComponents();

	this.delegate = delegate;
	this.model = model;
	this.defaultModel = new BasicIngredient(model);

	supplierParent.removeAll();
	List suppliers = new ArrayList();
	suppliers.add("");
	suppliers.addAll(Database.driver().getSuppliersAlphabetically().values());
	supplierBox = new AutocompleteCombobox(suppliers);
	supplierParent.add(supplierBox, BorderLayout.CENTER);
	supplierParent.add(addSupplier, BorderLayout.EAST);

	setLocationRelativeTo(null);
	setTitle("Ingrediënt wijzigen");
	
	notesOutlet.setFont(new Font(notesOutlet.getFont().getName(), Font.PLAIN, Utilities.fontSize()));

	supplierOutlet.setModel(ComboBoxModelFactory.createSupplierComboBoxModel(Database.driver().getSuppliersAlphabetically().values().toArray()));

	dp = new DatePicker(new Date(), new SimpleDateFormat("dd/MM/yyyy"));
	datePanel.add(dp, BorderLayout.CENTER);

	AcceleratorAdder.addAccelerator(save, KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), new KeyAction() {
	    @Override
	    public void actionPerformed(ActionEvent e) {
		saveActionPerformed(e);
	    }
	});

	AcceleratorAdder.addAccelerator(cancel, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), new KeyAction() {
	    @Override
	    public void actionPerformed(ActionEvent e) {
		cancelActionPerformed(e);
	    }
	});

	loadModel();

	TextFieldAutoHighlighter.installHighlighter(taxesOutlet);
	TextFieldAutoHighlighter.installHighlighter(lossOutlet);
	TextFieldAutoHighlighter.installHighlighter(pricePerWeightOutlet);
	TextFieldAutoHighlighter.installHighlighter(pricePerUnitOutlet);
	TextFieldAutoHighlighter.installHighlighter(weightPerUnitOutlet);

	packagingOutlet.setInputVerifier(new AbstractValidator(this, packagingOutlet, "Dit veld mag niet leeg zijn!") {

	    @Override
	    protected boolean validationCriteria(JComponent c) {
		return !packagingOutlet.getText().isEmpty();
	    }
	});
	
//	weightPerUnitOutlet.setInputVerifier(new AbstractValidator(this, weightPerUnitOutlet, "Vul een geldig gewicht per eenheid in.") {
//
//	    @Override
//	    protected boolean validationCriteria(JComponent c) {
//		try{
//		    Double.parseDouble(weightPerUnitOutlet.getText());
//		    return true;
//		} catch (Exception e){
//		    return false;
//		}
//	    }
//	});
//	
//	pricePerUnitOutlet.setInputVerifier(new AbstractValidator(this, pricePerUnitOutlet, "Vul een geldige eenheidsprijs in.") {
//
//	    @Override
//	    protected boolean validationCriteria(JComponent c) {
//		try{
//		    Double.parseDouble(pricePerUnitOutlet.getText());
//		    return true;
//		} catch (Exception e){
//		    return false;
//		}
//	    }
//	});
//	
//	pricePerWeightOutlet.setInputVerifier(new AbstractValidator(this, pricePerWeightOutlet, "Vul een geldige prijs per kg in.") {
//
//	    @Override
//	    protected boolean validationCriteria(JComponent c) {
//		try{
//		    Double.parseDouble(pricePerWeightOutlet.getText());
//		    return true;
//		} catch (Exception e){
//		    return false;
//		}
//	    }
//	});
	
	ingredientOutlet.setInputVerifier(new AbstractValidator(this, ingredientOutlet, "De naam moet uniek en niet leeg zijn!") {

	    @Override
	    protected boolean validationCriteria(JComponent c) {
		try{
		    if (ingredientOutlet.getText().isEmpty()) {
			return false;
		    }
		    if (!ingredientOutlet.getText().equalsIgnoreCase(defaultModel.getName())) {
			List<Ingredient> ingrs = database.Database.driver().getIngredients();
			for (Ingredient ingredient : ingrs) {
			    if (ingredient.getName().equalsIgnoreCase(ingredientOutlet.getText())) {
				return false;
			    }
			}
		    }
		    return true;
		} catch(Exception e){
		    return false;
		}
	    }
	});
	lossOutlet.setInputVerifier(new AbstractValidator(this, lossOutlet, "Gelieve een geldige waarde tussen 0.0 en 100.0 (%) in te voeren.") {

	    @Override
	    protected boolean validationCriteria(JComponent c) {
		try{
		    double d = Double.parseDouble(lossOutlet.getText());
		    return d>=0 && d<100;
		} catch (Exception e){
		    return false;
		}
	    }
	});
	taxesOutlet.setInputVerifier(new AbstractValidator(this, taxesOutlet, "Gelieve een geldige, positieve waarde in te geven.") {

	    @Override
	    protected boolean validationCriteria(JComponent c) {
		try{
		    double d = Double.parseDouble(taxesOutlet.getText());
		    return d>=0;
		} catch (Exception e){
		    return false;
		}
	    }
	});
	
	detail.add(new JXTitledPanel("Details", fixedFields), BorderLayout.NORTH);
	detail.add(new JXTitledPanel("Opmerkingen", stretchableFields), BorderLayout.CENTER);
	
	/*
	 * Hide the unformatted fields
	 */
	grossPriceOutlet.setVisible(false);
	netPriceOutlet.setVisible(false);

	ingredientOutlet.requestFocus();
    }