@Override public void dispose() { super.dispose(); typeChooser.dispose(); valueEditorWrapper.removeAll(); if (valueEditor != null) valueEditor.dispose(); data = null; typeChooser = null; valueEditorWrapper = null; valueEditor = null; style = null; }
@SuppressWarnings("unchecked") private void setType(DataType newType) { if (valueEditor == null || !newType.xml.equals(data.type)) { data.type = newType.xml; if (!newType.javaType.isInstance(data.value)) data.value = newType.decode(""); valueEditorWrapper.removeAll(); if (valueEditor != null) valueEditor.dispose(); JComponent editor = null; valueEditor = newType.createEditor(noExtras, PropertiesSheetStyle.DARK); valueEditor.setValue(data.value); valueEditor.addListener( new UpdateListener() { @Override public void updated() { data.value = valueEditor.getValue(); DynamicEditor.this.updated(); } }); editor = Layout.horizontalBox(style.fieldDimension, valueEditor.getComponents()); valueEditorWrapper.add(editor, BorderLayout.CENTER); valueEditorWrapper.revalidate(); } }