[ 
https://issues.apache.org/jira/browse/PIVOT-458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12857722#action_12857722
 ] 

Dirk Moebius commented on PIVOT-458:
------------------------------------

Excuse me, Greg, I'm not very good in explaining this.

I see it this way:

A MenuButton is -first and foremost- a button, that has a menu attached. Like 
all buttons, pressing the button invokes the action. Furthermore, it has a menu 
attached. You can invoke the menu by clicking the triangle, or -optionally- 
have it shown every time you click the button.

If the MenuButton would not fire an action when it is clicked it wouldn't be a 
menu _button_. It would be a menu only.

Those two facts apply to ListButton as well. The difference is: A ListButton 
has a selection state, while the MenuButton has not. (More exactly: the 
_submenu_ of the MenuButton has a selection state, but the MenuButton itself 
has not!). Clicking the button of a ListButton invokes the action that is 
attached to the current selection state. Clicking the button of a MenuButton 
simply invokes its action, no matter what. So with ListButton, a user can 
_customize_ which action should be invoked if single-clicked, whereas with 
MenuButton you cannot customize the "main action" that is to be invoked if 
single-clicked. The "main action" in a MenuButton is always the action that is 
described by the button's label. The "main action" in a ListButton is the 
action, that the user selected.

Usecase:

Suppose you have a TableView with some data with multi-select on. Above the 
table is a toolbar of buttons, which are supposed to perform some operations on 
the selected rows. There's a MenuButton displaying "Add selected". If you click 
the MenuButton, the selected table rows are added to some other model entity. 
But the MenuButton's menu also has menu items for "Add at top", "Add at 
bottom", "Replace existing entries". The user can invoke one of these 4 
actions. The "Add selected" action is the default action. But this action won't 
be _replaced_ if the user chooses another entry of MenuButton's menu. Had I 
used a ListButton, the latest selected action would replace the default action 
"Add selected", but that is not intended.


> ListButton: show popup only on triangle click
> ---------------------------------------------
>
>                 Key: PIVOT-458
>                 URL: https://issues.apache.org/jira/browse/PIVOT-458
>             Project: Pivot
>          Issue Type: Improvement
>          Components: wtk-terra
>            Reporter: Dirk Moebius
>            Priority: Minor
>         Attachments: listbutton-popup.patch, menubutton-popup.patch
>
>
> I found this to be a requirement in my application: if the user clicks the 
> label part of a LinkButton, the button should fire immediately without 
> showing the popup, thus invoking the action with the currently selected 
> entry. If the user clicks the triangle part, the popup should be shown.
> I patched LinkButton to add a new boolean property called 
> "showPopupOnTriggerClickOnly" to TerraListButtonSkin (I couldn't think of a 
> better name, sorry). If set to true, the ListButton popup will only show up 
> if the user clicks the triangle, but not if the user clicks the rest of the 
> button. However, ButtonPressListeners fire as usual, if the user clicks any 
> part of the button. If the property is false, the behavior is as it was 
> before. The default value of the property is false.
> I tested the patch in my application and ComponentExplorer and it works good.
> It would be nice if you integrate the patch. Otherwise I'd still have the 
> option to write a custom skin, but I think this patch could be interesting to 
> other developers as well.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to