consider setInput/getInput as method in Effect

Jose Martinez jmartine_1026 at
Fri Apr 21 12:13:31 UTC 2017

Shouldn't the setInput/getInput method be part of the Effect abstract class?  Even if its just there as an abstract method with no default implementation.
I cannot do simple things like this (not that this is simple, but simpler than the alternative):
private void addNewEffect(Node node, Effect myNewEffect) {    Effect effect = node.getEffect();    if (effect != null) {        while (effect.getInput() != null) {            effect = effect.getInput();        }        effect.setInput(myNewEffect);    } else {        node.setEffect(myNewEffect);    }}

Instead I find myself write code like this (and this would not scale well):
    //this works because the two Effects below have been declared as DropShadow and ColorAdjust
    private void refreshEffects() {
        if (destroyed && selected) {
        } else if (!destroyed && selected) {
        } else if (destroyed && !selected) {
        } else if (!destroyed && !selected) {

Case in point:
Maybe there is a good reason for not having setInput/getInput in Effect, as I suspect there is, in that case, sorry for the email (I tried searching for the reason).  One concern might be that some Effects just cannot play well with others.  In that case may I suggest another method in Effect called isChainable().  No matter what is done I can definitely see that this is not easy and can appreciate that some compromises have been made that lead to setInput/getInput not being in Effect.

More information about the openjfx-dev mailing list