@Override void bindItem(Property newItem) { tfKey.textProperty().bindBidirectional(newItem.keyProperty()); if (newItem.getValue().matches("#[0-9a-fA-F]{6}")) { cpColor.setVisible(true); tfValue.setVisible(false); cpColor.setValue(Color.web(newItem.getValue())); newItem.valueProperty().bindBidirectional(cpColor.valueProperty(), colorConverter); } else { cpColor.setVisible(false); tfValue.setVisible(true); tfValue.textProperty().bindBidirectional(newItem.valueProperty()); } }
@Override void unbindItem(Property currentItem) { tfKey.textProperty().unbindBidirectional(currentItem.keyProperty()); tfValue.textProperty().unbindBidirectional(currentItem.valueProperty()); currentItem.valueProperty().unbindBidirectional(cpColor.valueProperty()); }