Hello,
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) {
selectedEffect.setInput(destroyedEffect);
imageView.setEffect(selectedEffect);
} else if (!destroyed && selected) {
selectedEffect.setInput(null);
imageView.setEffect(selectedEffect);
} else if (destroyed && !selected) {
destroyedEffect.setInput(null);
imageView.setEffect(destroyedEffect);
} else if (!destroyed && !selected) {
imageView.setEffect(null);
}
}
Case in point: http://stackoverflow.com/a/32020458/1490322
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.
thanksjose