Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Entire Dish Preview clickable #2

Open
shannah opened this issue Jan 25, 2021 · 0 comments
Open

Make Entire Dish Preview clickable #2

shannah opened this issue Jan 25, 2021 · 0 comments

Comments

@shannah
Copy link

shannah commented Jan 25, 2021

This might be a bug in CN1's lead component handling, but the DishPreview isn't firing the event when the user clicks on the image. CN1 is having trouble handling the nested lead components (DishPreview's lead component is the nested MultiButton, but MultiButton itself is a container with a lead component).

To work around this problem, create a dummy Button in the DishPreview and set it as the lead component. Then add the actionListener to both the multibutton and the dummy button.

E.g.

Button lead = new Button();
lead.setVisible(false);
add(BorderLayout.SOUTH, lead);
setLeadComponent(lead);
....

$(lead, dishPreview).addActionListener(evt -> {
            evt.consume();
            ActionNode action = viewNode.getInheritedAction(DISH_CLICKED);
            if (action != null) {
                System.out.println("DISH_CLICKED action fired");
                action.fireEvent(entity, DishPreview.this);
            }
        });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant