Use PopupButton in browse action


Is there any way to use simple PopupButton as component
in brwser action ?
Now I use ItemTrackingAction class for create custom action in browse.
I’d like to use PopupButton , bacause I have many action which I want to group.


You can add your actions to PopupButton using addAction() method. For instance,

private PopupButton popupButton;

public void init(Map<String, Object> params) {
    popupButton.addAction(new ItemTrackingAction("demoAction")
            .withCaption("Demo Caption")
            .withHandler(actionPerformedEvent -> showNotification("Handler is invoked")));

Or if you want to use declarative way:


<popupButton id="popupButton"
             caption="My Actions">
        <action id="firstAction"
                caption="First Action"
        <action id="secondAction"
                caption="Second Action"

Code in controller:

public void firstActionHandler() {
    // do something

public void secondActionHandler() {
    // do something

You can see live example in our Sampler application: popup sample.
Documentation about PopupButton: PopupButton - CUBA Platform. Developer’s Manual


I have other question. Cuba studio crates browse window automagically with buttonsPanel section.
Is there any way to add PopupButton component with empty actions to buttonsPanel while this process ?

You can add PopupButton to buttonsPanel from screen controller class or declaratively in XML.

(Upd.) You can change template in CUBA Studio that generates table in the browse screen. If you use windows you can find template for table in the following path:


Open table.xml

Find buttonsPanel element and put popupButton

<buttonsPanel id="buttonsPanel"
        <%tableActions.each { action ->%>
            <button id="${action}Btn" action="${tableId}.${action}"/>                
		<popupButton id="popupButton"/>