when comparing a property with a string value using isEqualTo always returns true regardless of the string

153 Views Asked by At

I'm trying to compare the value of a property to a String using isEqualsTo. This value always returns true, regardless of the string I'm comparing the property to. I have a model that has a messageType, this message type is a string and it could be CLOSED or WARNING.

I have the following model:

class MessageModel {
    @FXObservable String messageType
}

This is my view

MessageModel model

      String CLOSED = 'CLOSED'
        String WARNING = 'WARNING'

    if (model.messageTypeProperty().isEqualTo(CLOSED)) {
                image.setImage(new Image("/com/pppp/ddd/img/messageLock.png"))
            } else if (model.messageTypeProperty().isEqualTo(WARNING)) {
                image.setImage(new Image("/com/pppp/ddd/img/messageWarning.png"))
            }

This doesn't work, it always returns true on the first IF.

Any help would be appreciated!

0

There are 0 best solutions below