Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
89ef5bec
by Tony Chemit at 2022-04-19T14:02:37+02:00
6 changed files:
- client/datasource/actions/src/main/i18n/getters/java.getter
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ReportUI.jaxx
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ReportUI.jcss
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ResultTableModel.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/actions/CopyResultToClipboard.java
- + client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/actions/ToggleConfigure.java
Changes:
| ... | ... | @@ -16,7 +16,6 @@ observe.ui.action.close.synchro.tip |
| 16 | 16 | observe.ui.action.config.export.required.write.data
|
| 17 | 17 | observe.ui.action.config.left.datasource.required.write.data
|
| 18 | 18 | observe.ui.action.continue
|
| 19 | -observe.ui.action.copy
|
|
| 20 | 19 | observe.ui.action.copy.to.clipBoard
|
| 21 | 20 | observe.ui.action.do.backup.tip
|
| 22 | 21 | observe.ui.action.goto.next.stage
|
| ... | ... | @@ -26,6 +25,7 @@ observe.ui.action.goto.previous.stage.tip |
| 26 | 25 | observe.ui.action.info.storage.tip
|
| 27 | 26 | observe.ui.choice.cancel
|
| 28 | 27 | observe.ui.choice.replace
|
| 28 | +observe.ui.content.action.configure.tip
|
|
| 29 | 29 | observe.ui.datasource.actions.config.data.sources.equals
|
| 30 | 30 | observe.ui.datasource.editor.actions.activity.pairing
|
| 31 | 31 | observe.ui.datasource.editor.actions.consolidate
|
| ... | ... | @@ -28,8 +28,9 @@ |
| 28 | 28 | |
| 29 | 29 | io.ultreia.java4all.jaxx.widgets.choice.BeanCheckBox
|
| 30 | 30 | |
| 31 | + org.jdesktop.swingx.JXTable
|
|
| 32 | + org.jdesktop.swingx.JXTitledPanel
|
|
| 31 | 33 | java.awt.Dimension
|
| 32 | - |
|
| 33 | 34 | javax.swing.DefaultComboBoxModel
|
| 34 | 35 | javax.swing.JComboBox
|
| 35 | 36 | </import>
|
| ... | ... | @@ -48,52 +49,45 @@ public void destroy() { |
| 48 | 49 | }
|
| 49 | 50 | ]]>
|
| 50 | 51 | </script>
|
| 51 | - |
|
| 52 | 52 | <JPanel id='PENDING_content' layout='{new BorderLayout()}'>
|
| 53 | - |
|
| 54 | - <!-- le paneau du haut qui contient le sélecteur et les actions -->
|
|
| 55 | - <JPanel id='northPanel' constraints='BorderLayout.NORTH' layout='{new BorderLayout()}'>
|
|
| 56 | - |
|
| 57 | - <JPanel id='requestSelectorPane' constraints='BorderLayout.NORTH'>
|
|
| 58 | - |
|
| 59 | - <JToolBar id='toolbar' constraints='BorderLayout.WEST'>
|
|
| 60 | - |
|
| 61 | - <!-- suppression de la sélection du report -->
|
|
| 62 | - <JButton id="resetSelectedReport" onActionPerformed="getHandler().updateSelectedReport(null)"/>
|
|
| 63 | - |
|
| 64 | - </JToolBar>
|
|
| 65 | - |
|
| 66 | - <!-- selecteur de report -->
|
|
| 67 | - <JComboBox id='reportSelector' constraints='BorderLayout.CENTER' onItemStateChanged='getHandler().updateSelectedReportFromEvent(event)'/>
|
|
| 68 | - |
|
| 69 | - <JScrollPane id='reportDescriptionPane' constraints='BorderLayout.SOUTH'>
|
|
| 70 | - <JTextArea id='reportDescription'/>
|
|
| 71 | - </JScrollPane>
|
|
| 72 | - |
|
| 73 | - </JPanel>
|
|
| 74 | - |
|
| 75 | - <!-- selecteur de variables -->
|
|
| 76 | - <JScrollPane id='reportVariableSelectorPane' constraints='BorderLayout.CENTER'>
|
|
| 77 | - <JPanel id='reportVariableSelectorPanel' layout="{new GridLayout(0,1)}"/>
|
|
| 53 | +<!-- <JPanel id='northPanel' constraints='BorderLayout.NORTH' layout='{new GridLayout(1, 2)}'>-->
|
|
| 54 | + <JXTitledPanel id="configurationPane" contentContainer="{configurationPanel}" constraints='BorderLayout.NORTH'>
|
|
| 55 | + <JPanel id="configurationPanel" layout='{new BorderLayout()}'>
|
|
| 56 | + <JPanel id='requestSelectorPane' constraints='BorderLayout.NORTH' layout='{new BorderLayout()}'>
|
|
| 57 | + <JToolBar id='toolbar' constraints='BorderLayout.WEST'>
|
|
| 58 | + <JButton id="resetSelectedReport" onActionPerformed="getHandler().updateSelectedReport(null)"/>
|
|
| 59 | + </JToolBar>
|
|
| 60 | + <JComboBox id='reportSelector' constraints='BorderLayout.CENTER' onItemStateChanged='getHandler().updateSelectedReportFromEvent(event)'/>
|
|
| 61 | + </JPanel>
|
|
| 62 | + <JScrollPane id='reportVariableSelectorPane' constraints='BorderLayout.CENTER'>
|
|
| 63 | + <JPanel id='reportVariableSelectorPanel' layout="{new GridLayout(0,1)}"/>
|
|
| 64 | + </JScrollPane>
|
|
| 65 | + <JScrollPane id='reportDescriptionPane' constraints='BorderLayout.SOUTH'>
|
|
| 66 | + <JTextArea id='reportDescription'/>
|
|
| 67 | + </JScrollPane>
|
|
| 68 | + </JPanel>
|
|
| 69 | + </JXTitledPanel>
|
|
| 70 | +<!-- <JPanel id="copyPane" layout='{new BorderLayout()}'>-->
|
|
| 71 | +<!-- <JPanel id='copyOptions' constraints='BorderLayout.NORTH' beanScope="stepModel" layout="{new GridLayout(0,1)}">-->
|
|
| 72 | +<!-- <BeanCheckBox id='autoCopyToClipboard'/>-->
|
|
| 73 | +<!-- <BeanCheckBox id='copyRowHeaders'/>-->
|
|
| 74 | +<!-- <BeanCheckBox id='copyColumnHeaders'/>-->
|
|
| 75 | +<!-- </JPanel>-->
|
|
| 76 | +<!-- </JPanel>-->
|
|
| 77 | +<!-- </JPanel>-->
|
|
| 78 | + <JXTitledPanel id="resultPanel" constraints='BorderLayout.CENTER' contentContainer="{resultPane}" rightDecoration='{titleRightToolBar}'>
|
|
| 79 | + <JScrollPane id='resultPane'>
|
|
| 80 | + <JXTable id='resultTable'/>
|
|
| 78 | 81 | </JScrollPane>
|
| 79 | - </JPanel>
|
|
| 80 | - |
|
| 81 | - <!-- le tableau des résultats -->
|
|
| 82 | - <JScrollPane id='resultPane' constraints='BorderLayout.CENTER'>
|
|
| 83 | - <JTable id='resultTable'/>
|
|
| 84 | - </JScrollPane>
|
|
| 85 | - |
|
| 86 | - <JPanel id="copyPane" constraints='BorderLayout.SOUTH' layout='{new BorderLayout()}'>
|
|
| 87 | - <JPanel id='copyOptions' constraints='BorderLayout.NORTH' beanScope="stepModel" layout="{new GridLayout(0,1)}">
|
|
| 82 | + <JPopupMenu id='configurePopup' beanScope="stepModel">
|
|
| 88 | 83 | <BeanCheckBox id='autoCopyToClipboard'/>
|
| 89 | 84 | <BeanCheckBox id='copyRowHeaders'/>
|
| 90 | 85 | <BeanCheckBox id='copyColumnHeaders'/>
|
| 91 | - </JPanel>
|
|
| 92 | - <JButton id="copyResultToClipboard" constraints='BorderLayout.CENTER'/>
|
|
| 93 | - |
|
| 94 | - </JPanel>
|
|
| 95 | - |
|
| 86 | + </JPopupMenu>
|
|
| 87 | + <JToolBar id='titleRightToolBar'>
|
|
| 88 | + <JButton id="copyResultToClipboard"/>
|
|
| 89 | + <JToggleButton id='toggleConfigure'/>
|
|
| 90 | + </JToolBar>
|
|
| 91 | + </JXTitledPanel>
|
|
| 96 | 92 | </JPanel>
|
| 97 | - |
|
| 98 | - |
|
| 99 | 93 | </fr.ird.observe.client.datasource.actions.AdminTabUI> |
| ... | ... | @@ -26,6 +26,10 @@ JToolBar { |
| 26 | 26 | opaque:false;
|
| 27 | 27 | }
|
| 28 | 28 | |
| 29 | +BeanCheckBox {
|
|
| 30 | + bean:{stepModel};
|
|
| 31 | +}
|
|
| 32 | + |
|
| 29 | 33 | #reportVariableSelectorPanel {
|
| 30 | 34 | border:{new TitledBorder(t("observe.ui.datasource.editor.actions.report.variables") + " ")};
|
| 31 | 35 | }
|
| ... | ... | @@ -34,19 +38,23 @@ JToolBar { |
| 34 | 38 | border:{new TitledBorder(t("observe.ui.datasource.editor.actions.report.copy.options") + " ")};
|
| 35 | 39 | }
|
| 36 | 40 | |
| 41 | +#resultPanel {
|
|
| 42 | + title:"observe.ui.datasource.editor.actions.report.result";
|
|
| 43 | +}
|
|
| 44 | + |
|
| 37 | 45 | #resultPane {
|
| 38 | - border:{new TitledBorder(t("observe.ui.datasource.editor.actions.report.result") + " ")};
|
|
| 39 | 46 | verticalScrollBarPolicy:{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
|
| 47 | + horizontalScrollBarPolicy:{JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED};
|
|
| 40 | 48 | }
|
| 41 | 49 | |
| 42 | 50 | #resultTable {
|
| 43 | 51 | model:{stepModel.getResultModel()};
|
| 52 | + sortable:false;
|
|
| 44 | 53 | fillsViewportHeight:true;
|
| 45 | 54 | }
|
| 46 | 55 | |
| 47 | -#requestSelectorPane {
|
|
| 48 | - border:{new TitledBorder(t("observe.ui.datasource.editor.actions.report.select") + " ")};
|
|
| 49 | - layout:{new BorderLayout()};
|
|
| 56 | +#configurationPane {
|
|
| 57 | + title:"observe.ui.datasource.editor.actions.report.select";
|
|
| 50 | 58 | }
|
| 51 | 59 | |
| 52 | 60 | #reportSelector {
|
| ... | ... | @@ -25,6 +25,7 @@ import fr.ird.observe.dto.report.DataMatrix; |
| 25 | 25 | import fr.ird.observe.dto.report.Report;
|
| 26 | 26 | import org.apache.logging.log4j.LogManager;
|
| 27 | 27 | import org.apache.logging.log4j.Logger;
|
| 28 | +import org.jdesktop.swingx.JXTable;
|
|
| 28 | 29 | |
| 29 | 30 | import javax.swing.JLabel;
|
| 30 | 31 | import javax.swing.JTable;
|
| ... | ... | @@ -56,14 +57,14 @@ public class ResultTableModel extends AbstractTableModel { |
| 56 | 57 | private boolean withColumnHeader;
|
| 57 | 58 | private boolean withRowHeader;
|
| 58 | 59 | private JTableHeader tableHeader;
|
| 59 | - private JTable table;
|
|
| 60 | + private JXTable table;
|
|
| 60 | 61 | |
| 61 | 62 | public ResultTableModel() {
|
| 62 | 63 | columnNames = new ArrayList<>();
|
| 63 | 64 | rowNames = new ArrayList<>();
|
| 64 | 65 | }
|
| 65 | 66 | |
| 66 | - public void init(JTable table) {
|
|
| 67 | + public void init(JXTable table) {
|
|
| 67 | 68 | |
| 68 | 69 | this.table = table;
|
| 69 | 70 | this.tableHeader = table.getTableHeader();
|
| ... | ... | @@ -71,6 +72,7 @@ public class ResultTableModel extends AbstractTableModel { |
| 71 | 72 | table.setRowSorter(null);
|
| 72 | 73 | table.setCellSelectionEnabled(true);
|
| 73 | 74 | table.setRowSelectionAllowed(true);
|
| 75 | + table.setAutoCreateColumnsFromModel(true);
|
|
| 74 | 76 | TableCellRenderer defaultHeaderRenderer = tableHeader.getDefaultRenderer();
|
| 75 | 77 | |
| 76 | 78 | TableCellRenderer headerRenderer = new TableCellRenderer() {
|
| ... | ... | @@ -95,6 +97,7 @@ public class ResultTableModel extends AbstractTableModel { |
| 95 | 97 | @Override
|
| 96 | 98 | public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
| 97 | 99 | JLabel comp = (JLabel) defaultHeaderRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
| 100 | +// comp.setText(value == null ? "" : value.toString());
|
|
| 98 | 101 | comp.setToolTipText(value == null ? "" : value.toString());
|
| 99 | 102 | comp.setFont(getHeaderFont(table));
|
| 100 | 103 | return comp;
|
| ... | ... | @@ -115,7 +118,14 @@ public class ResultTableModel extends AbstractTableModel { |
| 115 | 118 | };
|
| 116 | 119 | this.table.setDefaultRenderer(Object.class, renderer);
|
| 117 | 120 | this.table.setDefaultRenderer(String.class, renderer);
|
| 118 | - this.tableHeader.setDefaultRenderer(headerRenderer);
|
|
| 121 | +// this.tableHeader.setDefaultRenderer(headerRenderer);
|
|
| 122 | + this.table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
|
|
| 123 | + this.table.setFillsViewportHeight(true);
|
|
| 124 | + this.table.setShowHorizontalLines(true);
|
|
| 125 | + this.table.setColumnSelectionAllowed(true);
|
|
| 126 | + this.table.setRowSelectionAllowed(true);
|
|
| 127 | +// this.table.setCellSelectionEnabled(true);
|
|
| 128 | + this.tableHeader.setReorderingAllowed(true);
|
|
| 119 | 129 | }
|
| 120 | 130 | |
| 121 | 131 | public void populate(Report report, DataMatrix incomingData) {
|
| ... | ... | @@ -142,7 +152,7 @@ public class ResultTableModel extends AbstractTableModel { |
| 142 | 152 | withColumnHeader = !columnNames.isEmpty();
|
| 143 | 153 | withRowHeader = !rowNames.isEmpty();
|
| 144 | 154 | table.setTableHeader(!withColumnHeader ? null : tableHeader);
|
| 145 | - |
|
| 155 | + table.createDefaultColumnsFromModel();
|
|
| 146 | 156 | int nbRows = incomingData.getHeight();
|
| 147 | 157 | int nbCols = incomingData.getWidth();
|
| 148 | 158 | if (withRowHeader) {
|
| ... | ... | @@ -172,9 +182,13 @@ public class ResultTableModel extends AbstractTableModel { |
| 172 | 182 | });
|
| 173 | 183 | columnNames.add(0, "");
|
| 174 | 184 | data.copyData(columnData);
|
| 185 | + } else if (withColumnHeader) {
|
|
| 186 | + |
|
| 175 | 187 | }
|
| 176 | 188 | data.copyData(incomingData);
|
| 177 | 189 | fireTableStructureChanged();
|
| 190 | + table.revalidate();
|
|
| 191 | + table.repaint();
|
|
| 178 | 192 | }
|
| 179 | 193 | |
| 180 | 194 | public void clear() {
|
| ... | ... | @@ -40,7 +40,7 @@ public class CopyResultToClipboard extends AdminTabUIActionSupport<ReportUI> { |
| 40 | 40 | private static final Logger log = LogManager.getLogger(CopyResultToClipboard.class);
|
| 41 | 41 | |
| 42 | 42 | public CopyResultToClipboard() {
|
| 43 | - super(t("observe.ui.action.copy"), t("observe.ui.datasource.editor.actions.synchro.copy.tip"), "report-copy", 'C');
|
|
| 43 | + super(""/*t("observe.ui.action.copy")*/, t("observe.ui.datasource.editor.actions.synchro.copy.tip"), "report-copy", 'C');
|
|
| 44 | 44 | }
|
| 45 | 45 | |
| 46 | 46 | public static void copyReportToClipBoard(Report report, ReportModel stepModel) {
|
| 1 | +package fr.ird.observe.client.datasource.actions.report.actions;
|
|
| 2 | + |
|
| 3 | +/*-
|
|
| 4 | + * #%L
|
|
| 5 | + * ObServe Client :: DataSource :: Actions
|
|
| 6 | + * %%
|
|
| 7 | + * Copyright (C) 2008 - 2022 IRD, Code Lutin, Ultreia.io
|
|
| 8 | + * %%
|
|
| 9 | + * This program is free software: you can redistribute it and/or modify
|
|
| 10 | + * it under the terms of the GNU General Public License as
|
|
| 11 | + * published by the Free Software Foundation, either version 3 of the
|
|
| 12 | + * License, or (at your option) any later version.
|
|
| 13 | + *
|
|
| 14 | + * This program is distributed in the hope that it will be useful,
|
|
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 | + * GNU General Public License for more details.
|
|
| 18 | + *
|
|
| 19 | + * You should have received a copy of the GNU General Public
|
|
| 20 | + * License along with this program. If not, see
|
|
| 21 | + * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 | + * #L%
|
|
| 23 | + */
|
|
| 24 | + |
|
| 25 | +import fr.ird.observe.client.datasource.actions.actions.AdminTabUIActionSupport;
|
|
| 26 | +import fr.ird.observe.client.datasource.actions.report.ReportUI;
|
|
| 27 | +import fr.ird.observe.client.datasource.editor.api.ObserveKeyStrokesEditorApi;
|
|
| 28 | +import org.nuiton.jaxx.runtime.swing.action.MenuAction;
|
|
| 29 | + |
|
| 30 | +import javax.swing.JComponent;
|
|
| 31 | +import javax.swing.JPopupMenu;
|
|
| 32 | +import javax.swing.SwingUtilities;
|
|
| 33 | +import javax.swing.event.PopupMenuEvent;
|
|
| 34 | +import javax.swing.event.PopupMenuListener;
|
|
| 35 | +import java.awt.event.ActionEvent;
|
|
| 36 | + |
|
| 37 | +import static io.ultreia.java4all.i18n.I18n.n;
|
|
| 38 | + |
|
| 39 | +/**
|
|
| 40 | + * Created by tchemit on 03/10/2018.
|
|
| 41 | + *
|
|
| 42 | + * @author Tony Chemit - dev@tchemit.fr
|
|
| 43 | + */
|
|
| 44 | +public class ToggleConfigure extends AdminTabUIActionSupport<ReportUI> {
|
|
| 45 | + |
|
| 46 | + public ToggleConfigure() {
|
|
| 47 | + super("", n("observe.ui.action.configuration.tip"), "generate", ObserveKeyStrokesEditorApi.KEY_STROKE_NAVIGATION_CONFIGURE);
|
|
| 48 | +// setIcon(getContentScaledImage("configure"));
|
|
| 49 | + }
|
|
| 50 | + |
|
| 51 | + @Override
|
|
| 52 | + public void init() {
|
|
| 53 | + super.init();
|
|
| 54 | + ui.getConfigurePopup().addPopupMenuListener(new PopupMenuListener() {
|
|
| 55 | + @Override
|
|
| 56 | + public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
|
|
| 57 | + }
|
|
| 58 | + |
|
| 59 | + @Override
|
|
| 60 | + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
|
|
| 61 | + ui.getToggleConfigure().setSelected(false);
|
|
| 62 | + }
|
|
| 63 | + |
|
| 64 | + @Override
|
|
| 65 | + public void popupMenuCanceled(PopupMenuEvent e) {
|
|
| 66 | + ui.getToggleConfigure().setSelected(false);
|
|
| 67 | + }
|
|
| 68 | + });
|
|
| 69 | + }
|
|
| 70 | + |
|
| 71 | + @Override
|
|
| 72 | + protected void doActionPerformed(ActionEvent e, ReportUI ui) {
|
|
| 73 | + ui.getToggleConfigure().setSelected(true);
|
|
| 74 | + SwingUtilities.invokeLater(() -> {
|
|
| 75 | + JComponent c = ui.getToggleConfigure();
|
|
| 76 | + JPopupMenu p = ui.getConfigurePopup();
|
|
| 77 | + MenuAction.preparePopup(p, c, false);
|
|
| 78 | + });
|
|
| 79 | + }
|
|
| 80 | + |
|
| 81 | +} |