开发者

Calling firePropteryChange() on my bean does nothing if I set it to the same value

开发者 https://www.devze.com 2023-02-03 01:05 出处:网络
I have a bean with a field \"fftLength\". When I call public void setfftLength(String fftLength) { String oldfftLength = this.fftLength;

I have a bean with a field "fftLength". When I call

    public void setfftLength(String fftLength) 
{
    String oldfftLength = this.fftLength;
    this.fftLength = fftLength;
    changeSupport.firePropertyChange("fftLength", oldfftLength, fftLength);
}

I expect my GUI object to reflect the change. I bind it with using JGoodies Binding.

The problem is that I have this weird corner case where I need to call the setter with the same value because my model and view go out of sync. When I call the setter with the same value nothing happens, which I guess is because usually this would be a wasted operation. Is there a way to force the bean to update even though I am setting the sam开发者_JAVA百科e value?


The correct is answer is that I should never let me model and view get out of sync. I talked about it with another engineer and that was the conclusion. There definitely is not a way to force the bean to update even though I am setting the same value. I fixed my problem by thinking a couple layers higher above in my code. I had an order of operation problem that was screwing me and I just didn't see it till after I spoke with the other engineer :)

0

精彩评论

暂无评论...
验证码 换一张
取 消