This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 8d145e09e147e26376bc5e136387530c27d9aa26 Author: Tony CHEMIT <dev@tchemit.fr> Date: Sun Jan 1 18:16:37 2017 +0100 Improve select widgets (See #4119) --- .../nuiton/jaxx/widgets/select/BeanComboBox.jaxx | 6 +----- .../jaxx/widgets/select/BeanComboBoxHandler.java | 19 +++++++++++------- .../nuiton/jaxx/widgets/select/BeanDoubleList.jaxx | 3 --- .../jaxx/widgets/select/BeanDoubleListHandler.java | 20 ++++++++++++------- .../widgets/select/BeanFilterableComboBox.jaxx | 18 +++++------------ .../select/BeanFilterableComboBoxHandler.java | 20 ++++++++++++------- .../nuiton/jaxx/widgets/select/BeanListHeader.jaxx | 12 +++-------- .../jaxx/widgets/select/BeanListHeaderHandler.java | 23 +++++++++++++--------- 8 files changed, 61 insertions(+), 60 deletions(-) diff --git a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanComboBox.jaxx b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanComboBox.jaxx index 1b281d5..971fa01 100644 --- a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanComboBox.jaxx +++ b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanComboBox.jaxx @@ -78,9 +78,6 @@ <ButtonGroup id='sortGroup' onStateChanged='setReverseSort((Boolean)sortGroup.getSelectedValue())'/> - <!-- ui handler --> - <BeanComboBoxHandler id='handler' genericType='O' constructorParams='this'/> - <String id='selectedToolTipText' javaBean='null'/> <String id='notSelectedToolTipText' javaBean='null'/> @@ -148,8 +145,7 @@ public JaxxDefaultComboBoxModel<O> getComboBoxModel() { return (JaxxDefaultCombo <cell anchor='east' fill='both' insets='0'> <!-- le boutton pour changer le tri --> <JToolBar id='toolbarRight'> - <JToggleButton id='changeDecorator' - onActionPerformed='getHandler().togglePopup()'/> + <JToggleButton id='changeDecorator' onActionPerformed='getHandler().togglePopup()'/> </JToolBar> </cell> </row> diff --git a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanComboBoxHandler.java b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanComboBoxHandler.java index 2f400dc..7b9a064 100644 --- a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanComboBoxHandler.java +++ b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanComboBoxHandler.java @@ -29,6 +29,7 @@ import org.jdesktop.swingx.autocomplete.ObjectToStringConverter; import org.nuiton.decorator.DecoratorUtil; import org.nuiton.decorator.JXPathDecorator; import org.nuiton.decorator.MultiJXPathDecorator; +import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.jaxx.runtime.swing.SwingUtil; import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup; import org.nuiton.jaxx.runtime.swing.renderer.DecoratorListCellRenderer; @@ -58,12 +59,11 @@ import java.util.List; * @author Tony Chemit - dev@tchemit.fr * @see BeanComboBox */ -public class BeanComboBoxHandler<O> implements PropertyChangeListener { +public class BeanComboBoxHandler<O> implements PropertyChangeListener, UIHandler<BeanComboBox<O>> { public static final Log log = LogFactory.getLog(BeanComboBoxHandler.class); - /** ui if the handler */ - protected final BeanComboBox<O> ui; + protected BeanComboBox<O> ui; /** the mutator method on the property of boxed bean in the ui */ protected Method mutator; @@ -79,10 +79,6 @@ public class BeanComboBoxHandler<O> implements PropertyChangeListener { protected boolean init; - public BeanComboBoxHandler(BeanComboBox<O> ui) { - this.ui = ui; - } - protected final FocusListener EDITOR_TEXT_COMP0NENT_FOCUSLISTENER = new FocusListener() { @Override @@ -553,4 +549,13 @@ public class BeanComboBoxHandler<O> implements PropertyChangeListener { isEmpty()); } + @Override + public void beforeInit(BeanComboBox<O> ui) { + this.ui=ui; + } + + @Override + public void afterInit(BeanComboBox<O> ui) { + + } } diff --git a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanDoubleList.jaxx b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanDoubleList.jaxx index 3d99d89..1a28b0b 100644 --- a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanDoubleList.jaxx +++ b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanDoubleList.jaxx @@ -60,9 +60,6 @@ <!-- model --> <BeanDoubleListModel id='model' genericType='O' javaBean='new BeanDoubleListModel<O>()'/> - <!-- handler --> - <BeanDoubleListHandler id='handler' genericType='O' constructorParams='this'/> - <!-- sort index property --> <Integer id='index' javaBean='0'/> diff --git a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanDoubleListHandler.java b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanDoubleListHandler.java index 00559a9..1f3a231 100644 --- a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanDoubleListHandler.java +++ b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanDoubleListHandler.java @@ -27,6 +27,7 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.DecoratorUtil; import org.nuiton.decorator.JXPathDecorator; import org.nuiton.decorator.MultiJXPathDecorator; +import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.jaxx.runtime.swing.SwingUtil; import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup; import org.nuiton.jaxx.runtime.swing.model.JaxxFilterableListModel; @@ -61,23 +62,18 @@ import java.util.function.Predicate; * @see BeanDoubleList * @since 2.5.8 */ -public class BeanDoubleListHandler<O> implements PropertyChangeListener { +public class BeanDoubleListHandler<O> implements PropertyChangeListener, UIHandler<BeanDoubleList<O>> { private static final Log log = LogFactory.getLog(BeanDoubleListHandler.class); /** the mutator method on the property of boxed bean in the ui */ protected Method mutator; - /** ui of the handler */ - protected final BeanDoubleList<O> ui; + protected BeanDoubleList<O> ui; /** the decorator of data */ protected MultiJXPathDecorator<O> decorator; - public BeanDoubleListHandler(BeanDoubleList<O> ui) { - this.ui = ui; - } - private final BeanUIUtil.PopupHandler popupHandler = new BeanUIUtil.PopupHandler() { @Override @@ -547,4 +543,14 @@ public class BeanDoubleListHandler<O> implements PropertyChangeListener { list.setSelectedIndex(0); } } + + @Override + public void beforeInit(BeanDoubleList<O> ui) { + this.ui=ui; + } + + @Override + public void afterInit(BeanDoubleList<O> ui) { + + } } diff --git a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanFilterableComboBox.jaxx b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanFilterableComboBox.jaxx index 587d961..7c29a9e 100644 --- a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanFilterableComboBox.jaxx +++ b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanFilterableComboBox.jaxx @@ -18,8 +18,7 @@ #L% --> -<Table fill='both' insets='0' genericType='O' - implements='org.nuiton.jaxx.runtime.bean.BeanTypeAware<O>' +<Table fill='both' insets='0' genericType='O' implements='org.nuiton.jaxx.runtime.bean.BeanTypeAware<O>' onFocusGained='handler.focusCombo()' onFocusLost='hidePopup()'> <import> @@ -75,14 +74,9 @@ <Integer id="maximumRowCount" javaBean="null"/> <!-- model of sorted property --> - <ButtonGroup id='indexes' - onStateChanged='setIndex((Integer)indexes.getSelectedValue())'/> + <ButtonGroup id='indexes' onStateChanged='setIndex((Integer)indexes.getSelectedValue())'/> - <ButtonGroup id='sortGroup' - onStateChanged='setReverseSort((Boolean)sortGroup.getSelectedValue())'/> - - <!-- ui handler --> - <BeanFilterableComboBoxHandler id='handler' genericType='O' constructorParams='this'/> + <ButtonGroup id='sortGroup' onStateChanged='setReverseSort((Boolean)sortGroup.getSelectedValue())'/> <String id='selectedToolTipText' javaBean='null'/> @@ -93,8 +87,7 @@ <String id='i18nPrefix' javaBean='"entitycombobox.common."'/> <!-- popup to change sorted property--> - <JPopupMenu id='popup' - onPopupMenuWillBecomeInvisible='getChangeDecorator().setSelected(false)' + <JPopupMenu id='popup' onPopupMenuWillBecomeInvisible='getChangeDecorator().setSelected(false)' onPopupMenuCanceled='getChangeDecorator().setSelected(false)'> <JLabel id='popupSortLabel'/> @@ -152,8 +145,7 @@ public JaxxFilterableComboBoxModel<O> getComboBoxModel() { return (JaxxFilterabl <cell anchor='east' fill='both' insets='0'> <!-- le boutton pour changer le tri --> <JToolBar id='toolbarRight'> - <JToggleButton id='changeDecorator' - onActionPerformed='getHandler().togglePopup()'/> + <JToggleButton id='changeDecorator' onActionPerformed='getHandler().togglePopup()'/> </JToolBar> </cell> </row> diff --git a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanFilterableComboBoxHandler.java b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanFilterableComboBoxHandler.java index 2b57c19..32ddffb 100644 --- a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanFilterableComboBoxHandler.java +++ b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanFilterableComboBoxHandler.java @@ -28,6 +28,7 @@ import org.nuiton.decorator.DecoratorUtil; import org.nuiton.decorator.JXPathDecorator; import org.nuiton.decorator.MultiJXPathDecorator; import org.nuiton.jaxx.runtime.JAXXUtil; +import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.jaxx.runtime.swing.SwingUtil; import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup; import org.nuiton.jaxx.runtime.swing.model.JaxxFilterableComboBoxModel; @@ -68,12 +69,11 @@ import java.util.Objects; * @see BeanFilterableComboBox * @since 2.5.12 */ -public class BeanFilterableComboBoxHandler<O> implements PropertyChangeListener { +public class BeanFilterableComboBoxHandler<O> implements PropertyChangeListener, UIHandler<BeanFilterableComboBox<O>> { public static final Log log = LogFactory.getLog(BeanFilterableComboBoxHandler.class); - /** ui if the handler */ - protected final BeanFilterableComboBox<O> ui; + protected BeanFilterableComboBox<O> ui; /** the mutator method on the property of boxed bean in the ui */ protected Method mutator; @@ -83,10 +83,6 @@ public class BeanFilterableComboBoxHandler<O> implements PropertyChangeListener protected boolean init; - public BeanFilterableComboBoxHandler(BeanFilterableComboBox<O> ui) { - this.ui = ui; - } - protected final FocusListener EDITOR_TEXT_COMP0NENT_FOCUSLISTENER = new FocusListener() { @Override public void focusGained(FocusEvent e) { @@ -657,6 +653,16 @@ public class BeanFilterableComboBoxHandler<O> implements PropertyChangeListener isEmpty()); } + @Override + public void beforeInit(BeanFilterableComboBox<O> ui) { + this.ui=ui; + } + + @Override + public void afterInit(BeanFilterableComboBox<O> ui) { + + } + /** Editor for the Combobox of the UI - uses the decorator */ class JAXXFilterableComboBoxEditor implements ComboBoxEditor { diff --git a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanListHeader.jaxx b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanListHeader.jaxx index fcd5728..68be2e2 100644 --- a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanListHeader.jaxx +++ b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanListHeader.jaxx @@ -59,9 +59,6 @@ <ButtonGroup id='sortGroup' onStateChanged='setReverseSort((Boolean)sortGroup.getSelectedValue())'/> - <!-- ui handler --> - <BeanListHeaderHandler id='handler' genericType='O' constructorParams='this'/> - <String id='selectedToolTipText' javaBean='null'/> <String id='notSelectedToolTipText' javaBean='null'/> @@ -71,8 +68,7 @@ <String id='i18nPrefix' javaBean='"beanlist.common."'/> <!-- popup to change sorted property--> - <JPopupMenu id='popup' - onPopupMenuWillBecomeInvisible='getChangeDecorator().setSelected(false)' + <JPopupMenu id='popup' onPopupMenuWillBecomeInvisible='getChangeDecorator().setSelected(false)' onPopupMenuCanceled='getChangeDecorator().setSelected(false)'> <JLabel id='popupSortLabel'/> @@ -106,12 +102,10 @@ public O getSelectedValue() { <JToolBar id='toolbar' constraints='BorderLayout.EAST'> <!-- le boutton pour reinitialiser la valeur sélectionnée --> - <JButton id='resetSelection' - onActionPerformed='getList().getSelectionModel().clearSelection()'/> + <JButton id='resetSelection' onActionPerformed='getList().getSelectionModel().clearSelection()'/> <!-- le boutton pour changer le tri --> - <JToggleButton id='changeDecorator' - onActionPerformed='getHandler().togglePopup()'/> + <JToggleButton id='changeDecorator' onActionPerformed='getHandler().togglePopup()'/> </JToolBar> </JPanel> diff --git a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanListHeaderHandler.java b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanListHeaderHandler.java index 2e0f7d7..8322ad6 100644 --- a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanListHeaderHandler.java +++ b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanListHeaderHandler.java @@ -29,6 +29,7 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.DecoratorUtil; import org.nuiton.decorator.JXPathDecorator; import org.nuiton.decorator.MultiJXPathDecorator; +import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup; import org.nuiton.jaxx.runtime.swing.renderer.DecoratorListCellRenderer; @@ -53,13 +54,11 @@ import java.util.Vector; * @see BeanListHeader * @since 2.2 */ -public class BeanListHeaderHandler<O> implements PropertyChangeListener { +public class BeanListHeaderHandler<O> implements PropertyChangeListener, UIHandler<BeanListHeader<O>> { - public static final Log log = - LogFactory.getLog(BeanListHeaderHandler.class); + public static final Log log = LogFactory.getLog(BeanListHeaderHandler.class); - /** ui if the handler */ - protected final BeanListHeader<O> ui; + protected BeanListHeader<O> ui; /** the decorator of data */ protected MultiJXPathDecorator<O> decorator; @@ -80,10 +79,6 @@ public class BeanListHeaderHandler<O> implements PropertyChangeListener { } }; - public BeanListHeaderHandler(BeanListHeader<O> ui) { - this.ui = ui; - } - /** * Initialise le handler de l'ui * @@ -289,4 +284,14 @@ public class BeanListHeaderHandler<O> implements PropertyChangeListener { JList<O> list = ui.getList(); return list == null ? null : list.getSelectedValue(); } + + @Override + public void beforeInit(BeanListHeader<O> ui) { + this.ui = ui; + } + + @Override + public void afterInit(BeanListHeader<O> ui) { + + } } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.