branch develop updated (03fe50d -> 7335e3b)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository jmexico. See http://git.codelutin.com/jmexico.git from 03fe50d fixes #7861: Update guava to 19.0 new 95453fe fixes #7873: display factor description in tooltip new 7335e3b fixes #7873: display factor description in tooltip The 2 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 7335e3bbe7eac7b2237e635645b4dc83d4b076ef Author: Eric Chatellier <chatellier@codelutin.com> Date: Thu Jan 7 17:26:28 2016 +0100 fixes #7873: display factor description in tooltip commit 95453fe5598f6fb1dc2a719f9fb800bee9c0a498 Author: Eric Chatellier <chatellier@codelutin.com> Date: Thu Jan 7 17:24:32 2016 +0100 fixes #7873: display factor description in tooltip Summary of changes: ...esignTable.java => FactorNameCellRenderer.java} | 47 ++++++++++------- .../editor/InputDesignEditorHandler.java | 5 +- .../editor/MexicoDecoratorProvider.java | 61 ---------------------- 3 files changed, 29 insertions(+), 84 deletions(-) copy jmexico-editor/src/main/java/fr/reseaumexico/editor/{InputDesignTable.java => FactorNameCellRenderer.java} (50%) delete mode 100644 jmexico-editor/src/main/java/fr/reseaumexico/editor/MexicoDecoratorProvider.java -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jmexico. See http://git.codelutin.com/jmexico.git commit 95453fe5598f6fb1dc2a719f9fb800bee9c0a498 Author: Eric Chatellier <chatellier@codelutin.com> Date: Thu Jan 7 17:24:32 2016 +0100 fixes #7873: display factor description in tooltip --- .../editor/FactorNameCellRenderer.java | 60 +++++++++++++++++++++ .../editor/InputDesignEditorHandler.java | 5 +- .../editor/MexicoDecoratorProvider.java | 61 ---------------------- 3 files changed, 61 insertions(+), 65 deletions(-) diff --git a/jmexico-editor/src/main/java/fr/reseaumexico/editor/FactorNameCellRenderer.java b/jmexico-editor/src/main/java/fr/reseaumexico/editor/FactorNameCellRenderer.java new file mode 100644 index 0000000..7eddfc5 --- /dev/null +++ b/jmexico-editor/src/main/java/fr/reseaumexico/editor/FactorNameCellRenderer.java @@ -0,0 +1,60 @@ +/* + * #%L + * JMexico :: Swing Editor + * %% + * Copyright (C) 2016 Réseau Mexico, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ +package fr.reseaumexico.editor; + +import java.awt.Component; + +import javax.swing.JTable; +import javax.swing.table.DefaultTableCellRenderer; + +import org.apache.commons.lang3.StringUtils; + +import fr.reseaumexico.model.Factor; + +/** + * Factor cell renderer for editor table. + * + * Handle factor name and fctor description as tooltip. + * + * @author Eric Chatellier + */ +public class FactorNameCellRenderer extends DefaultTableCellRenderer { + + /** serialVersionUID. */ + private static final long serialVersionUID = 8036762402104794846L; + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasfocus, int row, int column) { + + Factor factor = (Factor)value; + + String factorTxt = factor.getName(); + if (StringUtils.isEmpty(factorTxt)) { + // fallback on id + factorTxt = factor.getId(); + } + + setToolTipText(factor.getDescription()); + + return this; + } +} diff --git a/jmexico-editor/src/main/java/fr/reseaumexico/editor/InputDesignEditorHandler.java b/jmexico-editor/src/main/java/fr/reseaumexico/editor/InputDesignEditorHandler.java index 88c209e..cdb2b94 100644 --- a/jmexico-editor/src/main/java/fr/reseaumexico/editor/InputDesignEditorHandler.java +++ b/jmexico-editor/src/main/java/fr/reseaumexico/editor/InputDesignEditorHandler.java @@ -90,10 +90,7 @@ public class InputDesignEditorHandler { JXTable table = ui.getInputDesignTable(); // table renderer - table.setDefaultRenderer( - Factor.class, - new DecoratorProviderTableCellRenderer( - new MexicoDecoratorProvider())); + table.setDefaultRenderer(Factor.class, new FactorNameCellRenderer()); table.setDefaultRenderer(Object.class, new FactorValueCellRenderer(ui)); // cell editor diff --git a/jmexico-editor/src/main/java/fr/reseaumexico/editor/MexicoDecoratorProvider.java b/jmexico-editor/src/main/java/fr/reseaumexico/editor/MexicoDecoratorProvider.java deleted file mode 100644 index 6522861..0000000 --- a/jmexico-editor/src/main/java/fr/reseaumexico/editor/MexicoDecoratorProvider.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * #%L - * JMexico :: Swing Editor - * %% - * Copyright (C) 2011 - 2015 Réseau Mexico, Codelutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -package fr.reseaumexico.editor; - -import fr.reseaumexico.model.Factor; -import org.apache.commons.lang3.StringUtils; -import org.nuiton.util.decorator.Decorator; -import org.nuiton.util.decorator.DecoratorProvider; - -/** - * @author sletellier - letellier@codelutin.com - * @author tchemit - chemit@codelutin.com - * @since 0.1 - */ -public class MexicoDecoratorProvider extends DecoratorProvider { - - @Override - protected void loadDecorators() { - registerDecorator(new Decorator<Factor>(Factor.class) { - - private static final long serialVersionUID = 1L; - - @Override - public String toString(Object bean) { - String result = null; - if (bean != null) { - Factor f = (Factor) bean; - if (StringUtils.isNotEmpty(f.getName())) { - - // use name - result = f.getName(); - } else { - - // fallback on id - result = f.getId(); - } - } - return result; - } - }); - } -} -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jmexico. See http://git.codelutin.com/jmexico.git commit 7335e3bbe7eac7b2237e635645b4dc83d4b076ef Author: Eric Chatellier <chatellier@codelutin.com> Date: Thu Jan 7 17:26:28 2016 +0100 fixes #7873: display factor description in tooltip --- .../src/main/java/fr/reseaumexico/editor/FactorNameCellRenderer.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jmexico-editor/src/main/java/fr/reseaumexico/editor/FactorNameCellRenderer.java b/jmexico-editor/src/main/java/fr/reseaumexico/editor/FactorNameCellRenderer.java index 7eddfc5..e7bc896 100644 --- a/jmexico-editor/src/main/java/fr/reseaumexico/editor/FactorNameCellRenderer.java +++ b/jmexico-editor/src/main/java/fr/reseaumexico/editor/FactorNameCellRenderer.java @@ -52,6 +52,7 @@ public class FactorNameCellRenderer extends DefaultTableCellRenderer { // fallback on id factorTxt = factor.getId(); } + setText(factorTxt); setToolTipText(factor.getDescription()); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm