Hi Jonathan,
although I only use actions with Dialogs, I like the concept.
What I wouldn't miss though is the @ActionProxy annotation. I think it
could be easily replaced with a builder API (similar to
Dialogs.create()...). Instead of
public class ActionMapDemo extends Application {
public ActionMapDemo() {
ActionMap.register(this);
Action action11 = ActionMap.action("action11");
Button actionButton = ActionUtils.createButton(action11);
}
@ActionProxy(
text="Action 1.1",
graphic="start.png",
accelerator="ctrl+shift+T")
private void action11() {
System.out.println( "Action 1.1 is executed");
}
}
I would rather write something like
public class ActionMapDemo extends Application {
private final Action action11 = Actions.text("Action 1.1")
.graphic(imagePath)
.accelerator("ctrl+shift+T")
.action(this::action11);
public ActionMapDemo() {
Button actionButton = ActionUtils.createButton(action11);
}
private void action11() {
System.out.println( "Action 1.1 is executed");
}
}
They key point here is that lambdas make it easy enough to turn a
method into an Action. You could get rid of annotation processing,
global register of actions and gain more type-safety, since the
builder API can accept any types, not just string constants.
Just my 2 cents.
Tomas
> --
> You received this message because you are subscribed to the Google Groups
> "ControlsFX" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
controlsfx-de...@googlegroups.com.
> To post to this group, send email to
control...@googlegroups.com.
> Visit this group at
http://groups.google.com/group/controlsfx-dev.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/controlsfx-dev/150afb2d-8b6e-46c3-be93-12eceaf6ed6b%40email.android.com.
>
> For more options, visit
https://groups.google.com/d/optout.