/** Dispose this controller. The controller should clear all existing bindings. */ public void dispose() { element.dispose(); labelController.dispose(); tooltipController.dispose(); editorController.dispose(); fxForm.skinProperty().removeListener(changeListener); ((FXFormSkin) fxForm.getSkin()).removeElement(element); }
public ElementController(FXForm fxForm, Element element) { this.element = element; this.fxForm = fxForm; labelController = new LabelController(fxForm, element); tooltipController = new TooltipController(fxForm, element); editorController = createEditorController(fxForm, element); changeListener = new ChangeListener<Skin<?>>() { public void changed( ObservableValue<? extends Skin<?>> observableValue, Skin<?> skin, Skin<?> skin1) { ((FXFormSkin) skin).removeElement(getElement()); updateSkin((FXFormSkin) skin1); } }; fxForm.skinProperty().addListener(changeListener); updateSkin((FXFormSkin) fxForm.getSkin()); }