branch feature/3931 updated (dffa443 -> be0a793)
This is an automated email from the git hooks/post-receive script. New change to branch feature/3931 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git from dffa443 add remove (just in case) (refs #3931) new be0a793 [BeanDoubleList] extract and expose the method to recompute the buton states (refs #3931) The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit be0a7936ccaa6da175146a752ad45e1744b0386b Author: Kevin Morin <morin@codelutin.com> Date: Mon Apr 25 17:48:29 2016 +0200 [BeanDoubleList] extract and expose the method to recompute the buton states (refs #3931) Summary of changes: .../swing/editor/bean/BeanDoubleListHandler.java | 44 ++++++++++++---------- 1 file changed, 25 insertions(+), 19 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/3931 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit be0a7936ccaa6da175146a752ad45e1744b0386b Author: Kevin Morin <morin@codelutin.com> Date: Mon Apr 25 17:48:29 2016 +0200 [BeanDoubleList] extract and expose the method to recompute the buton states (refs #3931) --- .../swing/editor/bean/BeanDoubleListHandler.java | 44 ++++++++++++---------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanDoubleListHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanDoubleListHandler.java index ac3c6b3..d8bff37 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanDoubleListHandler.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanDoubleListHandler.java @@ -175,26 +175,8 @@ public class BeanDoubleListHandler<O> implements PropertyChangeListener { selectedList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { - ListSelectionModel source = (ListSelectionModel) e.getSource(); if (!e.getValueIsAdjusting()) { - - List<O> selectedItems = (List<O>) Lists.newArrayList(selectedList.getSelectedValues()); - boolean removeEnabled = uiModel.computeRemoveEnabled(selectedItems); - - int minSelectionIndex = source.getMinSelectionIndex(); - int maxSelectionIndex = source.getMaxSelectionIndex(); - - boolean oneSelection = minSelectionIndex == maxSelectionIndex; - - boolean upEnabled = removeEnabled && - oneSelection && - minSelectionIndex > 0; - uiModel.setSelectedUpEnabled(upEnabled); - - boolean downEnabled = removeEnabled && - oneSelection && - minSelectionIndex + 1 < uiModel.getSelectedListSize(); - uiModel.setSelectedDownEnabled(downEnabled); + recomputeButtonStates(); } } }); @@ -271,6 +253,30 @@ public class BeanDoubleListHandler<O> implements PropertyChangeListener { ui.processDataBinding(BeanDoubleList.BINDING_SELECTED_LIST_COMPONENT_POPUP_MENU); } + public void recomputeButtonStates() { + JList selectedList = ui.getSelectedList(); + BeanDoubleListModel<O> uiModel = ui.getModel(); + + List<O> selectedItems = (List<O>) Lists.newArrayList(selectedList.getSelectedValues()); + boolean removeEnabled = uiModel.computeRemoveEnabled(selectedItems); + + ListSelectionModel selectionModel = selectedList.getSelectionModel(); + int minSelectionIndex = selectionModel.getMinSelectionIndex(); + int maxSelectionIndex = selectionModel.getMaxSelectionIndex(); + + boolean oneSelection = minSelectionIndex == maxSelectionIndex; + + boolean upEnabled = removeEnabled && + oneSelection && + minSelectionIndex > 0; + uiModel.setSelectedUpEnabled(upEnabled); + + boolean downEnabled = removeEnabled && + oneSelection && + minSelectionIndex + 1 < uiModel.getSelectedListSize(); + uiModel.setSelectedDownEnabled(downEnabled); + } + public void setUniverse(List<O> selection) { ui.getModel().setUniverse(selection); sortData(); -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm