<commit_before>package de.saxsys.jfx.mvvmfx.fx_root_example;

import de.saxsys.jfx.mvvm.api.ViewModel;
import javafx.beans.binding.Bindings;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ReadOnlyBooleanProperty;
import javafx.beans.property.ReadOnlyStringProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;

import java.util.concurrent.Callable;

public class LabeledTextFieldViewModel implements ViewModel {
    private StringProperty labelText = new SimpleStringProperty("default");
    
    private BooleanProperty buttonDisabled = new SimpleBooleanProperty();
    
    private StringProperty inputText = new SimpleStringProperty("");
    
    public LabeledTextFieldViewModel(){
        buttonDisabled.bind(Bindings.createBooleanBinding(new Callable<Boolean>() {
            @Override
            public Boolean call() throws Exception {
                final String text = inputText.get();
                return text != null && text.isEmpty();
            }
        }, inputText));
    }
    
    public void changeLabel(){
         labelText.set(inputText.get());
        inputText.set("");
    }
    
    public ReadOnlyStringProperty labelTextProperty(){
        return labelText;
    }
    
    public ReadOnlyBooleanProperty buttonDisabledProperty(){
        return buttonDisabled;
    }
    
    public StringProperty inputTextProperty(){
        return inputText;<commit_msg>Fix wrong boolean binding in fx-root example<commit_after>package de.saxsys.jfx.mvvmfx.fx_root_example;

import de.saxsys.jfx.mvvm.api.ViewModel;
import javafx.beans.binding.Bindings;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ReadOnlyBooleanProperty;
import javafx.beans.property.ReadOnlyStringProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;

import java.util.concurrent.Callable;

public class LabeledTextFieldViewModel implements ViewModel {
    private StringProperty labelText = new SimpleStringProperty("default");
    
    private BooleanProperty buttonDisabled = new SimpleBooleanProperty();
    
    private StringProperty inputText = new SimpleStringProperty("");
    
    public LabeledTextFieldViewModel(){
        buttonDisabled.bind(Bindings.createBooleanBinding(new Callable<Boolean>() {
            @Override
            public Boolean call() throws Exception {
                final String text = inputText.get();
                return text == null || text.isEmpty();
            }
        }, inputText));
    }
    
    public void changeLabel(){
         labelText.set(inputText.get());
        inputText.set("");
    }
    
    public ReadOnlyStringProperty labelTextProperty(){
        return labelText;
    }
    
    public ReadOnlyBooleanProperty buttonDisabledProperty(){
        return buttonDisabled;
    }
    
    public StringProperty inputTextProperty(){
        return inputText;
{'fraction_non_alphanumeric': 0.0848228794280143, 'fraction_numerical': 0.0, 'mean_word_length': 3.4224137931034484, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3409248', 'n_tokens_mistral': 768, 'n_tokens_neox': 764, 'n_words': 163}