Skip to content

Make Entire Dish Preview clickable #2

@shannah

Description

@shannah

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);
            }
        });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions