branch develop updated (0c72cbd -> 8d65ee5)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git from 0c72cbd Continue cleaning jaxx-runtime (See #4114) new c45b903 Improve status widgets (See #4119) new 8d145e0 Improve select widgets (See #4119) new 40465d0 Generate generic handler if necessary (fixes #4120) new 749a9d7 Improve hidor widgets (See #4119) new f79f74b Improve font widgets (See #4119) new d33e068 Improve file widgets (See #4119) new 8d65ee5 Improve i18n widgets (See #4119) The 7 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 8d65ee5be2354a5ece07e4c3a926608e09253c8a Author: Tony CHEMIT <dev@tchemit.fr> Date: Sun Jan 1 18:30:01 2017 +0100 Improve i18n widgets (See #4119) commit d33e068c314e4c8180e7f5b28273ff7d00fe8c84 Author: Tony CHEMIT <dev@tchemit.fr> Date: Sun Jan 1 18:28:20 2017 +0100 Improve file widgets (See #4119) commit f79f74b717ab6c986d9f1af87c1ac096b45d1265 Author: Tony CHEMIT <dev@tchemit.fr> Date: Sun Jan 1 18:23:48 2017 +0100 Improve font widgets (See #4119) commit 749a9d7a3b37ae23875db5a185512deac65d4435 Author: Tony CHEMIT <dev@tchemit.fr> Date: Sun Jan 1 18:20:55 2017 +0100 Improve hidor widgets (See #4119) commit 40465d0053884f48e99e00d391ca88f4da2e7571 Author: Tony CHEMIT <dev@tchemit.fr> Date: Sun Jan 1 18:17:56 2017 +0100 Generate generic handler if necessary (fixes #4120) commit 8d145e09e147e26376bc5e136387530c27d9aa26 Author: Tony CHEMIT <dev@tchemit.fr> Date: Sun Jan 1 18:16:37 2017 +0100 Improve select widgets (See #4119) commit c45b9034a872f2ba023b629d797fbdaa72e89779 Author: Tony CHEMIT <dev@tchemit.fr> Date: Sun Jan 1 17:49:24 2017 +0100 Improve status widgets (See #4119) Summary of changes: .../org/nuiton/jaxx/compiler/JAXXCompiler.java | 19 ++++++++- .../jaxx/compiler/finalizers/DefaultFinalizer.java | 37 ++++++----------- .../org/nuiton/jaxx/widgets/file/FileEditor.jaxx | 33 +++------------ .../jaxx/widgets/file/FileEditorHandler.java | 47 +++++++++++++--------- .../org/nuiton/jaxx/widgets/font/FontSizor.jaxx | 8 +--- .../nuiton/jaxx/widgets/font/FontSizorHandler.java | 26 ++++++------ .../org/nuiton/jaxx/widgets/hidor/HidorButton.jaxx | 13 ++---- .../jaxx/widgets/hidor/HidorButtonHandler.java | 47 +++++++++++----------- .../org/nuiton/jaxx/widgets/i18n/I18nEditor.jaxx | 8 ---- .../jaxx/widgets/i18n/I18nEditorHandler.java | 17 ++++---- .../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 ++++++----- .../jaxx/widgets/status/MemoryStatusWidget.jaxx | 13 +----- .../widgets/status/MemoryStatusWidgetHandler.java | 18 +++++---- .../jaxx/widgets/status/StatusMessagePanel.jaxx | 32 ++------------- .../widgets/status/StatusMessagePanelHandler.java | 24 ++++++----- 22 files changed, 201 insertions(+), 262 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 develop in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit c45b9034a872f2ba023b629d797fbdaa72e89779 Author: Tony CHEMIT <dev@tchemit.fr> Date: Sun Jan 1 17:49:24 2017 +0100 Improve status widgets (See #4119) --- .../jaxx/widgets/status/MemoryStatusWidget.jaxx | 13 ++------- .../widgets/status/MemoryStatusWidgetHandler.java | 18 ++++++------ .../jaxx/widgets/status/StatusMessagePanel.jaxx | 32 ++-------------------- .../widgets/status/StatusMessagePanelHandler.java | 24 +++++++++------- 4 files changed, 29 insertions(+), 58 deletions(-) diff --git a/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/MemoryStatusWidget.jaxx b/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/MemoryStatusWidget.jaxx index 76aebb0..c34eb68 100644 --- a/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/MemoryStatusWidget.jaxx +++ b/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/MemoryStatusWidget.jaxx @@ -20,10 +20,7 @@ #L% --> - -<JComponent implements='java.awt.event.ActionListener' - foreground='{Color.BLACK}' - background='{Color.WHITE}'> +<JComponent implements='java.awt.event.ActionListener' foreground='{Color.BLACK}' background='{Color.WHITE}'> <import> java.awt.Color @@ -32,9 +29,7 @@ javax.swing.Timer </import> - <MemoryStatusWidgetHandler id='handler' constructorParams='this'/> - - <javax.swing.Timer id='timer' javaBean='null'/> + <Timer id='timer' javaBean='null'/> <Color id='progressBackground' javaBean='Color.decode("#666699a")'/> <Color id='progressForeground' javaBean='Color.decode("#cccccc")'/> @@ -69,10 +64,6 @@ public void paintComponent(Graphics g) { handler.paintComponent(g); } - -void $afterCompleteSetup() { - handler.$afterCompleteSetup(); -} ]]> </script> </JComponent> diff --git a/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/MemoryStatusWidgetHandler.java b/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/MemoryStatusWidgetHandler.java index 05c07df..f9dadae 100644 --- a/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/MemoryStatusWidgetHandler.java +++ b/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/MemoryStatusWidgetHandler.java @@ -21,6 +21,8 @@ */ package org.nuiton.jaxx.widgets.status; +import org.nuiton.jaxx.runtime.spi.UIHandler; + import javax.swing.JLabel; import java.awt.Dimension; import java.awt.Graphics; @@ -37,7 +39,7 @@ import static org.nuiton.i18n.I18n.t; * @author Tony Chemit - dev@tchemit.fr * @since 2.0 */ -public class MemoryStatusWidgetHandler { +public class MemoryStatusWidgetHandler implements UIHandler<MemoryStatusWidget>{ private final static String memoryTestStr = "99999/99999Mb"; @@ -45,11 +47,7 @@ public class MemoryStatusWidgetHandler { private final LineMetrics lm = new JLabel().getFont().getLineMetrics(memoryTestStr, frc); - protected final MemoryStatusWidget ui; - - public MemoryStatusWidgetHandler(MemoryStatusWidget ui) { - this.ui = ui; - } + protected MemoryStatusWidget ui; public void paintComponent(Graphics g) { Insets insets = new Insets(0, 0, 0, 0); @@ -86,13 +84,17 @@ public class MemoryStatusWidgetHandler { g2.dispose(); } + @Override + public void beforeInit(MemoryStatusWidget ui) { + this.ui = ui; + } - void $afterCompleteSetup() { + @Override + public void afterInit(MemoryStatusWidget ui) { ui.setFont(new JLabel().getFont()); Rectangle2D bounds = ui.getFont().getStringBounds(memoryTestStr, frc); Dimension dim = new Dimension((int) bounds.getWidth(), (int) bounds.getHeight()); ui.setPreferredSize(dim); ui.setMaximumSize(dim); } - } diff --git a/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/StatusMessagePanel.jaxx b/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/StatusMessagePanel.jaxx index e130c64..9ca8d9b 100644 --- a/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/StatusMessagePanel.jaxx +++ b/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/StatusMessagePanel.jaxx @@ -21,8 +21,7 @@ --> -<Table border='{BorderFactory.createBevelBorder(BevelBorder.LOWERED)}' - insets='0' +<Table border='{BorderFactory.createBevelBorder(BevelBorder.LOWERED)}' insets='0' implements='java.awt.event.ActionListener'> <import> @@ -88,33 +87,19 @@ public void addWidget(Component w, int index) { public void init() { handler.init(); } - -void $afterCompleteSetup() { - handler.$afterCompleteSetup(); -} ]]> </script> <Boolean id='showMemoryStatus' javaBean='Boolean.TRUE'/> <Boolean id='showClock' javaBean='Boolean.TRUE'/> - <!-- Deprecated, not used anywhere --> - <Boolean id='showI18n' javaBean='Boolean.FALSE'/> <Boolean id='showBusy' javaBean='Boolean.FALSE'/> <Boolean id='busy' javaBean='Boolean.FALSE'/> - <StatusMessagePanelHandler id='handler' constructorParams='this'/> - <row> <cell anchor='west' fill='both' weightx='1'> <Box constructorParams='0'> - <JProgressBar id='busyWidget' - visible='{isShowBusy()}' - enabled='{isBusy()}' - indeterminate='{isBusy()}' - stringPainted='false' - borderPainted='true'/> - <!--visible='{isBusy() && isShowBusy()}'--> - + <JProgressBar id='busyWidget' visible='{isShowBusy()}' enabled='{isBusy()}' indeterminate='{isBusy()}' + stringPainted='false' borderPainted='true'/> <JLabel id='statusLabel'/> </Box> @@ -122,17 +107,6 @@ void $afterCompleteSetup() { </cell> <cell anchor='east'> <Box id='box' constructorParams='0'> - - <!--JProgressBar id='busyWidget' - visible='{isBusy() && isShowBusy()}' - indeterminate='{isBusy()}' - stringPainted='false' - borderPainted='true'/--> - <!-- -minimumSize='{new Dimension(30,1)}' - maximumSize='{new Dimension(30,30)}' - preferredSize='{new Dimension(30,30)}' - --> <MemoryStatusWidget visible="{ isShowMemoryStatus() }"/> <ClockWidget visible="{ isShowClock() }"/> </Box> diff --git a/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/StatusMessagePanelHandler.java b/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/StatusMessagePanelHandler.java index 7699b3b..bbfbc35 100644 --- a/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/StatusMessagePanelHandler.java +++ b/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/StatusMessagePanelHandler.java @@ -22,6 +22,8 @@ package org.nuiton.jaxx.widgets.status; +import org.nuiton.jaxx.runtime.spi.UIHandler; + import javax.swing.Timer; import java.awt.Color; import java.awt.Dimension; @@ -30,9 +32,9 @@ import java.awt.Dimension; * @author Tony Chemit - dev@tchemit.fr * @since 1.6.0 */ -public class StatusMessagePanelHandler { +public class StatusMessagePanelHandler implements UIHandler<StatusMessagePanel> { - protected final StatusMessagePanel ui; + protected StatusMessagePanel ui; protected Color statusForeground; @@ -40,14 +42,6 @@ public class StatusMessagePanelHandler { protected Timer timer; - public StatusMessagePanelHandler(StatusMessagePanel ui) { - this.ui = ui; - } - - void $afterCompleteSetup() { - init(); - } - public void init() { if (ui.isShowBusy()) { Dimension dim = new Dimension(30, 15); @@ -121,4 +115,14 @@ public class StatusMessagePanelHandler { ui.getStatusLabel().setForeground(statusForeground); } } + + @Override + public void beforeInit(StatusMessagePanel ui) { + this.ui = ui; + } + + @Override + public void afterInit(StatusMessagePanel ui) { + init(); + } } -- 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 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>.
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 40465d0053884f48e99e00d391ca88f4da2e7571 Author: Tony CHEMIT <dev@tchemit.fr> Date: Sun Jan 1 18:17:56 2017 +0100 Generate generic handler if necessary (fixes #4120) --- .../org/nuiton/jaxx/compiler/JAXXCompiler.java | 19 +++++++++-- .../jaxx/compiler/finalizers/DefaultFinalizer.java | 37 +++++++--------------- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/JAXXCompiler.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/JAXXCompiler.java index 6d9572c..8dcfcda 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/JAXXCompiler.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/JAXXCompiler.java @@ -728,9 +728,11 @@ public class JAXXCompiler { " is not empty: " + tagsBeingCompiled); } + compileSecondPass(document.getDocumentElement()); + if (isUseHandler()) { - String handler = getUiHandler(); + String handler = getUIHandlerWithGeneric(); boolean addField = true; try { @@ -776,7 +778,7 @@ public class JAXXCompiler { } } - compileSecondPass(document.getDocumentElement()); + } /*------------------------------------------------------------------------*/ @@ -2029,6 +2031,19 @@ public class JAXXCompiler { return uiHandler; } + public String getUIHandlerWithGeneric() { + String genericType = getGenericType(); + String result = uiHandler; + if (genericType != null) { + int beginIndex = genericType.indexOf(" extends"); + if (beginIndex > -1) { + genericType = genericType.substring(0, beginIndex).trim(); + } + result += "< " + genericType + " >"; + } + return result; + } + public void setUiHandler(String uiHandler) { this.uiHandler = uiHandler; } diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/finalizers/DefaultFinalizer.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/finalizers/DefaultFinalizer.java index d108bc3..1bd0d61 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/finalizers/DefaultFinalizer.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/finalizers/DefaultFinalizer.java @@ -546,9 +546,7 @@ public class DefaultFinalizer extends AbstractFinalizer { addEventHandlers(compiler, javaFile); } - protected void addDataBindings(JAXXCompiler compiler, - JavaFile javaFile, - DataBinding[] bindings) { + protected void addDataBindings(JAXXCompiler compiler, JavaFile javaFile, DataBinding[] bindings) { if (bindings.length < 1) { // no data bindings @@ -580,9 +578,7 @@ public class DefaultFinalizer extends AbstractFinalizer { } } - protected void addJAXXObjectSupport(JAXXCompiler compiler, - CompiledObject root, - JavaFile javaFile) { + protected void addJAXXObjectSupport(JAXXCompiler compiler, CompiledObject root, JavaFile javaFile) { String jaxxContextImplementorClass = compiler.getConfiguration().getJaxxContextClass().getName(); @@ -666,8 +662,7 @@ public class DefaultFinalizer extends AbstractFinalizer { /*---------------------------------------------------------------------------------*/ /*-- Create fields ----------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/ - protected JavaField addJAXXObjectDescriptorField(JAXXCompiler compiler, - JavaFile javaFile) { + protected JavaField addJAXXObjectDescriptorField(JAXXCompiler compiler, JavaFile javaFile) { JavaField field; try { JAXXObjectDescriptor descriptor = compiler.getJAXXObjectDescriptor(); @@ -725,8 +720,7 @@ public class DefaultFinalizer extends AbstractFinalizer { return field; } - protected void addPreviousValuesField(JAXXCompiler compiler, - JavaFile javaFile, CompiledObject root) { + protected void addPreviousValuesField(JAXXCompiler compiler, JavaFile javaFile, CompiledObject root) { boolean superclassIsJAXXObject = javaFile.isSuperclassIsJAXXObject(); @@ -768,8 +762,7 @@ public class DefaultFinalizer extends AbstractFinalizer { /*---------------------------------------------------------------------------------*/ /*-- Create methods ---------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/ - protected void addPropertyChangeSupport(CompiledObject root, - JavaFile javaFile) { + protected void addPropertyChangeSupport(CompiledObject root, JavaFile javaFile) { ClassDescriptor currentClass = root.getObjectClass(); MethodDescriptor firePropertyChange = null; while (firePropertyChange == null && currentClass != null) { @@ -832,19 +825,9 @@ public class DefaultFinalizer extends AbstractFinalizer { continue; } CompiledObjectDecorator decorator = object.getDecorator(); - lastWasMethodCall = decorator.createInitializer(compiler, - root, - object, - body, - lastWasMethodCall - ); + lastWasMethodCall = decorator.createInitializer(compiler, root, object, body, lastWasMethodCall); } - root.getDecorator().createInitializer(compiler, - root, - root, - body, - lastWasMethodCall - ); + root.getDecorator().createInitializer(compiler, root, root, body, lastWasMethodCall); if (compiler.getInitializer().length() > 0) { body.append(compiler.getInitializer()); } @@ -1076,7 +1059,11 @@ public class DefaultFinalizer extends AbstractFinalizer { if (useHandler) { String handler = compiler.getUiHandler(); String handlerType = compiler.getImportedType(handler); - code.append("handler = new ").append(handlerType).append("();").append(eol); + code.append("handler = new ").append(handlerType); + if (compiler.getGenericType() != null) { + code.append("<>"); + } + code.append("();").append(eol); code.append("handler." + METHOD_NAME$BEFORE_INIT + "(this);").append(eol); } -- 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 develop in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 749a9d7a3b37ae23875db5a185512deac65d4435 Author: Tony CHEMIT <dev@tchemit.fr> Date: Sun Jan 1 18:20:55 2017 +0100 Improve hidor widgets (See #4119) --- .../org/nuiton/jaxx/widgets/hidor/HidorButton.jaxx | 13 ++---- .../jaxx/widgets/hidor/HidorButtonHandler.java | 47 +++++++++++----------- 2 files changed, 27 insertions(+), 33 deletions(-) diff --git a/jaxx-widgets-hidor/src/main/java/org/nuiton/jaxx/widgets/hidor/HidorButton.jaxx b/jaxx-widgets-hidor/src/main/java/org/nuiton/jaxx/widgets/hidor/HidorButton.jaxx index c17ec03..11dad92 100644 --- a/jaxx-widgets-hidor/src/main/java/org/nuiton/jaxx/widgets/hidor/HidorButton.jaxx +++ b/jaxx-widgets-hidor/src/main/java/org/nuiton/jaxx/widgets/hidor/HidorButton.jaxx @@ -19,10 +19,9 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. #L% --> -<JToggleButton id='hidor' - text='{myHandler.updateText(isTargetVisible())}' - toolTipText='{myHandler.updateToolTipText(isTargetVisible())}' - icon="{myHandler.updateIcon(isTargetVisible())}" +<JToggleButton id='hidor' text='{handler.updateText(isTargetVisible())}' + toolTipText='{handler.updateToolTipText(isTargetVisible())}' + icon="{handler.updateIcon(isTargetVisible())}" _hideIcon='{SwingUtil.createActionIcon("collapse")}' _showIcon='{SwingUtil.createActionIcon("expand")}' onActionPerformed='setTargetVisible(!targetVisible)'> @@ -33,8 +32,6 @@ static org.nuiton.i18n.I18n.t </import> - <HidorButtonHandler id='myHandler' constructorParams='this'/> - <Boolean id='targetVisible' javaBean='null'/> <String id='hideText' javaBean='""'/> @@ -53,10 +50,6 @@ public JComponent getTarget() { return target; } -void $afterCompleteSetup() { - myHandler.$afterCompleteSetup(); -} - public void setTarget(JComponent target) { JComponent oldValue = this.target; this.target = target; diff --git a/jaxx-widgets-hidor/src/main/java/org/nuiton/jaxx/widgets/hidor/HidorButtonHandler.java b/jaxx-widgets-hidor/src/main/java/org/nuiton/jaxx/widgets/hidor/HidorButtonHandler.java index 929ae19..1a9a3aa 100644 --- a/jaxx-widgets-hidor/src/main/java/org/nuiton/jaxx/widgets/hidor/HidorButtonHandler.java +++ b/jaxx-widgets-hidor/src/main/java/org/nuiton/jaxx/widgets/hidor/HidorButtonHandler.java @@ -23,6 +23,7 @@ package org.nuiton.jaxx.widgets.hidor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.spi.UIHandler; import javax.swing.Icon; import javax.swing.JComponent; @@ -33,29 +34,11 @@ import javax.swing.JComponent; * @author Tony Chemit - dev@tchemit.fr * @since 2.0 */ -public class HidorButtonHandler { +public class HidorButtonHandler implements UIHandler<HidorButton> { - private static final Log log = - LogFactory.getLog(HidorButtonHandler.class); + private static final Log log = LogFactory.getLog(HidorButtonHandler.class); - protected final HidorButton ui; - - public HidorButtonHandler(HidorButton ui) { - this.ui = ui; - } - - void $afterCompleteSetup() { - - ui.addPropertyChangeListener("targetVisible", evt -> { - if (log.isDebugEnabled()) { - log.debug("target visible changed <" + evt.getOldValue() + ":" + evt.getNewValue() + ">"); - } - boolean newValue = (Boolean) evt.getNewValue(); - if (ui.target != null) { - ui.target.setVisible(newValue); - } - }); - } + protected HidorButton ui; public void setTarget(JComponent target) { JComponent oldValue = ui.target; @@ -80,7 +63,25 @@ public class HidorButtonHandler { } protected Icon updateIcon(boolean c) { - String key = c ? "hideIcon" : "showIcon"; - return (Icon) ui.getClientProperty(key); + return (Icon) ui.getClientProperty(c ? "hideIcon" : "showIcon"); + } + + @Override + public void beforeInit(HidorButton ui) { + this.ui = ui; + } + + @Override + public void afterInit(HidorButton ui) { + + ui.addPropertyChangeListener("targetVisible", evt -> { + if (log.isDebugEnabled()) { + log.debug("target visible changed <" + evt.getOldValue() + ":" + evt.getNewValue() + ">"); + } + boolean newValue = (Boolean) evt.getNewValue(); + if (ui.target != null) { + ui.target.setVisible(newValue); + } + }); } } -- 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 develop in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit f79f74b717ab6c986d9f1af87c1ac096b45d1265 Author: Tony CHEMIT <dev@tchemit.fr> Date: Sun Jan 1 18:23:48 2017 +0100 Improve font widgets (See #4119) --- .../org/nuiton/jaxx/widgets/font/FontSizor.jaxx | 8 +------ .../nuiton/jaxx/widgets/font/FontSizorHandler.java | 26 ++++++++++------------ 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/jaxx-widgets-font/src/main/java/org/nuiton/jaxx/widgets/font/FontSizor.jaxx b/jaxx-widgets-font/src/main/java/org/nuiton/jaxx/widgets/font/FontSizor.jaxx index d7c1779..44b420f 100644 --- a/jaxx-widgets-font/src/main/java/org/nuiton/jaxx/widgets/font/FontSizor.jaxx +++ b/jaxx-widgets-font/src/main/java/org/nuiton/jaxx/widgets/font/FontSizor.jaxx @@ -21,8 +21,6 @@ --> <JPanel layout='{new BorderLayout()}'> - <FontSizorHandler id='handler' constructorParams='this'/> - <!-- default size of font --> <Float id='defaultFontSize' javaBean='12f'/> @@ -45,11 +43,7 @@ boolean updateDefaultSizeEnabled(Float fontSize, Float defaultFontSize, boolean public void setCallBack(Runnable action) { handler.setCallBack(action); } - -void $afterCompleteSetup() { - handler.$afterCompleteSetup(); -} - ]]> +]]> </script> <JToolBar floatable='false' borderPainted='false' diff --git a/jaxx-widgets-font/src/main/java/org/nuiton/jaxx/widgets/font/FontSizorHandler.java b/jaxx-widgets-font/src/main/java/org/nuiton/jaxx/widgets/font/FontSizorHandler.java index e84f1b8..50447dc 100644 --- a/jaxx-widgets-font/src/main/java/org/nuiton/jaxx/widgets/font/FontSizorHandler.java +++ b/jaxx-widgets-font/src/main/java/org/nuiton/jaxx/widgets/font/FontSizorHandler.java @@ -22,6 +22,7 @@ package org.nuiton.jaxx.widgets.font; import org.nuiton.jaxx.runtime.binding.SimpleJAXXObjectBinding; +import org.nuiton.jaxx.runtime.spi.UIHandler; /** * Handler of ui {@link FontSizor}. @@ -29,13 +30,9 @@ import org.nuiton.jaxx.runtime.binding.SimpleJAXXObjectBinding; * @author Tony Chemit - dev@tchemit.fr * @since 2.0 */ -public class FontSizorHandler { +public class FontSizorHandler implements UIHandler<FontSizor> { - protected final FontSizor ui; - - public FontSizorHandler(FontSizor ui) { - this.ui = ui; - } + protected FontSizor ui; public static final String BINDING_FONT_SIZE_CALL_BACK = "fontSize.callBack"; @@ -47,13 +44,8 @@ public class FontSizorHandler { } } - boolean updateDefaultSizeEnabled(Float fontSize, - Float defaultFontSize, - boolean enabled) { - if (fontSize == null || defaultFontSize == null) { - return false; - } - return !fontSize.equals(defaultFontSize) && enabled; + boolean updateDefaultSizeEnabled(Float fontSize, Float defaultFontSize, boolean enabled) { + return !(fontSize == null || defaultFontSize == null) && !fontSize.equals(defaultFontSize) && enabled; } public void setCallBack(final Runnable action) { @@ -68,7 +60,13 @@ public class FontSizorHandler { ui.applyDataBinding(BINDING_FONT_SIZE_CALL_BACK); } - void $afterCompleteSetup() { + @Override + public void beforeInit(FontSizor ui) { + this.ui = ui; + } + + @Override + public void afterInit(FontSizor ui) { ui.registerDataBinding(new SimpleJAXXObjectBinding(ui, BINDING_DEFAULT_FONT_SIZE_CALL_BACK, true, "defaultFontSize") { @Override -- 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 develop in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit d33e068c314e4c8180e7f5b28273ff7d00fe8c84 Author: Tony CHEMIT <dev@tchemit.fr> Date: Sun Jan 1 18:28:20 2017 +0100 Improve file widgets (See #4119) --- .../org/nuiton/jaxx/widgets/file/FileEditor.jaxx | 33 +++------------ .../jaxx/widgets/file/FileEditorHandler.java | 47 +++++++++++++--------- 2 files changed, 32 insertions(+), 48 deletions(-) diff --git a/jaxx-widgets-file/src/main/java/org/nuiton/jaxx/widgets/file/FileEditor.jaxx b/jaxx-widgets-file/src/main/java/org/nuiton/jaxx/widgets/file/FileEditor.jaxx index 1de590b..a6d37ea 100644 --- a/jaxx-widgets-file/src/main/java/org/nuiton/jaxx/widgets/file/FileEditor.jaxx +++ b/jaxx-widgets-file/src/main/java/org/nuiton/jaxx/widgets/file/FileEditor.jaxx @@ -29,8 +29,6 @@ java.io.File </import> - <FileEditorHandler id='handler' constructorParams='this'/> - <Boolean id='acceptAllFileFilterUsed' javaBean='Boolean.TRUE'/> <Boolean id='directoryEnabled' javaBean='Boolean.TRUE'/> @@ -61,12 +59,6 @@ public void setSelectedFilePath(String startPath) { setSelectedFile(startPath == null ? null : new File(startPath)); } -/**public void setSelectedFile(String startPath) { - this.selectedFile = null; - setStartPath(startPath); - fireActionEvent(); -}*/ - public File getSelectedFile() { if (selectedFile == null) { if (StringUtils.isNotEmpty(startPath)) { @@ -82,30 +74,15 @@ public void setDialogOwner(JDialog dialogOwner) { ]]></script> - <JToolBar id='toolbar' - floatable='false' - borderPainted='false' - visible='{isShowReset()}' + <JToolBar id='toolbar' floatable='false' borderPainted='false' visible='{isShowReset()}' constraints='BorderLayout.WEST'> - <JButton id='resetButton' - actionIcon='fileeditor-reset' - toolTipText='fileeditor.action.reset.tip' - focusable='false' - focusPainted='false' - enabled='{isEnabled()}' - onActionPerformed='setSelectedFile(null)'/> + <JButton id='resetButton' actionIcon='fileeditor-reset' toolTipText='fileeditor.action.reset.tip' focusable='false' + focusPainted='false' enabled='{isEnabled()}' onActionPerformed='setSelectedFile(null)'/> </JToolBar> - - <JTextField id='pathField' - constraints='BorderLayout.CENTER' - enabled='{isEnabled()}' - text='{getStartPath()}' + <JTextField id='pathField' constraints='BorderLayout.CENTER' enabled='{isEnabled()}' text='{getStartPath()}' onKeyReleased='setSelectedFilePath(pathField.getText())'/> - <JButton id='boutonXslLocation' - constraints='BorderLayout.EAST' - enabled='{isEnabled()}' - actionIcon='open' + <JButton id='boutonXslLocation' constraints='BorderLayout.EAST' enabled='{isEnabled()}' actionIcon='open' onActionPerformed='handler.openLocation()'/> </BaseActionPanel> diff --git a/jaxx-widgets-file/src/main/java/org/nuiton/jaxx/widgets/file/FileEditorHandler.java b/jaxx-widgets-file/src/main/java/org/nuiton/jaxx/widgets/file/FileEditorHandler.java index 5410324..1afac6e 100644 --- a/jaxx-widgets-file/src/main/java/org/nuiton/jaxx/widgets/file/FileEditorHandler.java +++ b/jaxx-widgets-file/src/main/java/org/nuiton/jaxx/widgets/file/FileEditorHandler.java @@ -23,6 +23,7 @@ package org.nuiton.jaxx.widgets.file; import com.google.common.io.Files; import org.apache.commons.lang3.StringUtils; +import org.nuiton.jaxx.runtime.spi.UIHandler; import javax.swing.JDialog; import javax.swing.JFileChooser; @@ -30,13 +31,13 @@ import javax.swing.filechooser.FileFilter; import java.io.File; /** @author Sylvain Lletellier */ -public class FileEditorHandler { +public class FileEditorHandler implements UIHandler<FileEditor> { public static final String SEPARATOR_REGEX = "\\s*,\\s*"; public static File lastSelectedPath; - protected final FileEditor view; + protected FileEditor ui; /** * To set the dialog (see https://forge.nuiton.org/issues/2578). @@ -45,18 +46,11 @@ public class FileEditorHandler { */ protected JDialog dialogOwner; - public FileEditorHandler(FileEditor view) { - this.view = view; - if (lastSelectedPath == null) { - lastSelectedPath = new File(System.getProperty("user.home")); - } - } - public void openLocation() { // use last selected file - File startFile = view.getSelectedFile(); - String startPath = view.getStartPath(); + File startFile = ui.getSelectedFile(); + String startPath = ui.getStartPath(); if (startFile == null && StringUtils.isNotEmpty(startPath)) { // else filed start path @@ -68,21 +62,21 @@ public class FileEditorHandler { } JFileChooser fc = new JFileChooser(startFile); - fc.setDialogTitle(view.getTitle()); - fc.setAcceptAllFileFilterUsed(view.getAcceptAllFileFilterUsed()); + fc.setDialogTitle(ui.getTitle()); + fc.setAcceptAllFileFilterUsed(ui.getAcceptAllFileFilterUsed()); // TODO sletellier 14/06/2012 : activate multi selection // boolean multiSelectionEnabled = view.isMultiSelectionEnabled(); // fc.setMultiSelectionEnabled(multiSelectionEnabled); // used to enable directory selection - boolean directoryEnabled = view.isDirectoryEnabled(); + boolean directoryEnabled = ui.isDirectoryEnabled(); if (directoryEnabled) { fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); } // used to enable file selection - boolean fileEnabled = view.isFileEnabled(); + boolean fileEnabled = ui.isFileEnabled(); if (fileEnabled) { if (directoryEnabled) { @@ -92,12 +86,12 @@ public class FileEditorHandler { } else { fc.setFileSelectionMode(JFileChooser.FILES_ONLY); } - String extsAsString = view.getExts(); + String extsAsString = ui.getExts(); if (extsAsString != null) { // extentions can be separted by comma String[] exts = extsAsString.split(SEPARATOR_REGEX); - String extsDescription = view.getExtsDescription(); + String extsDescription = ui.getExtsDescription(); String[] descs = new String[0]; if (extsDescription != null) { @@ -128,7 +122,7 @@ public class FileEditorHandler { if (hackDialog) { dialogOwner.setAlwaysOnTop(false); } - int returnVal = fc.showOpenDialog(view); + int returnVal = fc.showOpenDialog(ui); if (hackDialog) { dialogOwner.setAlwaysOnTop(true); } @@ -146,8 +140,8 @@ public class FileEditorHandler { } public void setSelectedFile(File file) { - view.setSelectedFile(file); - view.setStartPath(file.getPath()); + ui.setSelectedFile(file); + ui.setStartPath(file.getPath()); File dir = file; if (dir.exists()) { if (!dir.isDirectory()) { @@ -161,6 +155,19 @@ public class FileEditorHandler { this.dialogOwner = dialogOwner; } + @Override + public void beforeInit(FileEditor ui) { + this.ui = ui; + if (lastSelectedPath == null) { + lastSelectedPath = new File(System.getProperty("user.home")); + } + } + + @Override + public void afterInit(FileEditor ui) { + + } + public static class ExtentionFileFiler extends FileFilter { protected final String ext; protected final String desciption; -- 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 develop in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 8d65ee5be2354a5ece07e4c3a926608e09253c8a Author: Tony CHEMIT <dev@tchemit.fr> Date: Sun Jan 1 18:30:01 2017 +0100 Improve i18n widgets (See #4119) --- .../java/org/nuiton/jaxx/widgets/i18n/I18nEditor.jaxx | 8 -------- .../org/nuiton/jaxx/widgets/i18n/I18nEditorHandler.java | 17 ++++++++++------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/jaxx-widgets-i18n/src/main/java/org/nuiton/jaxx/widgets/i18n/I18nEditor.jaxx b/jaxx-widgets-i18n/src/main/java/org/nuiton/jaxx/widgets/i18n/I18nEditor.jaxx index dd53525..bec0fc1 100644 --- a/jaxx-widgets-i18n/src/main/java/org/nuiton/jaxx/widgets/i18n/I18nEditor.jaxx +++ b/jaxx-widgets-i18n/src/main/java/org/nuiton/jaxx/widgets/i18n/I18nEditor.jaxx @@ -46,8 +46,6 @@ static org.nuiton.i18n.I18n.n </import> - <I18nEditorHandler id='handler' constructorParams='this'/> - <String id='selectedToolTipText' javaBean='null'/> <String id='notSelectedToolTipText' javaBean='null'/> @@ -104,12 +102,6 @@ public static final String SHOW_POPUP_TEXT_PROPERTY = "showPopupText"; public static final String POPUP_BORDER_PROPERTY = "popupBorder"; public static final String POPUP_VISIBLE_PROPERTY = "popupVisible"; - - -void $afterCompleteSetup() { - handler.$afterCompleteSetup(); -} - @Override public void propertyChange(PropertyChangeEvent evt) { handler.propertyChange(evt); diff --git a/jaxx-widgets-i18n/src/main/java/org/nuiton/jaxx/widgets/i18n/I18nEditorHandler.java b/jaxx-widgets-i18n/src/main/java/org/nuiton/jaxx/widgets/i18n/I18nEditorHandler.java index 9c623bc..0250daa 100644 --- a/jaxx-widgets-i18n/src/main/java/org/nuiton/jaxx/widgets/i18n/I18nEditorHandler.java +++ b/jaxx-widgets-i18n/src/main/java/org/nuiton/jaxx/widgets/i18n/I18nEditorHandler.java @@ -24,6 +24,7 @@ package org.nuiton.jaxx.widgets.i18n; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.i18n.I18n; +import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup; import javax.swing.Icon; @@ -48,15 +49,11 @@ import java.util.Locale; * @author Tony Chemit - dev@tchemit.fr * @since 2.0 */ -public class I18nEditorHandler implements PropertyChangeListener, ActionListener { +public class I18nEditorHandler implements PropertyChangeListener, ActionListener, UIHandler<I18nEditor> { private static final Log log = LogFactory.getLog(I18nEditorHandler.class); - protected final I18nEditor ui; - - public I18nEditorHandler(I18nEditor ui) { - this.ui = ui; - } + protected I18nEditor ui; public static final String DEFAULT_SELECTED_TOOLTIP = I18n.n("i18neditor.selected"); @@ -237,7 +234,13 @@ public class I18nEditorHandler implements PropertyChangeListener, ActionListener } }; - void $afterCompleteSetup() { + @Override + public void beforeInit(I18nEditor ui) { + this.ui = ui; + } + + @Override + public void afterInit(I18nEditor ui) { ui.addPropertyChangeListener(this); } } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm