From 323171db3251a9eccf84d57daca7ac44c1df670c Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 31 Jul 2023 17:04:10 +0800 Subject: [PATCH 01/11] =?UTF-8?q?REPORT-87551=20=E5=AF=B9=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E8=BF=9B=E8=A1=8C=E9=87=8D=E5=91=BD=E5=90=8D=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E7=89=88=E6=9C=AC=E7=AE=A1=E7=90=86=E4=BB=8D=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=EF=BC=8C=E4=BD=86=E6=98=AF=E6=AF=8F=E4=B8=AA=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=86=85=E5=AE=B9=E9=83=BD=E6=98=AF=E4=B8=80=E6=A0=B7?= =?UTF-8?q?=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/vcs/common/VcsHelper.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index 07007604d..15787348f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -255,13 +255,17 @@ public class VcsHelper implements JTemplateActionListener { VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class); String oldPath = oldName.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY); List oldVcsEntities = operator.getVersions(oldPath); - + String replaceName = newName.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY); for (VcsEntity oldVcsEntity : oldVcsEntities) { - operator.saveVersion(oldVcsEntity.getUsername(), newName.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY), oldVcsEntity.getCommitMsg(), oldVcsEntity.getVersion()); - operator.deleteVersion(oldPath, oldVcsEntity.getVersion()); + if (!VcsHelper.getInstance().isLegacyMode()) { + operator.renameVersion(oldVcsEntity, replaceName); + } else { + operator.saveVersion(oldVcsEntity.getUsername(), replaceName, oldVcsEntity.getCommitMsg(), oldVcsEntity.getVersion()); + operator.deleteVersion(oldPath, oldVcsEntity.getVersion()); + } } - FineLoggerFactory.getLogger().debug("moveVcs success. from {} to {}", oldName, newName); - if (GcConfig.getInstance().isGcEnable()) { + FineLoggerFactory.getLogger().debug("moveVcs success. from {} to {}", oldName, replaceName); + if (GcConfig.getInstance().isGcEnable() && VcsHelper.getInstance().isLegacyMode()) { operator.gc(); } } From f025058d0ea1444f2c59250d867a0f24a3b58dee Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 31 Jul 2023 18:11:07 +0800 Subject: [PATCH 02/11] =?UTF-8?q?REPORT-101740=20=E3=80=90=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E7=AE=A1=E7=90=86=E4=B8=89=E6=9C=9F=E3=80=91=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E4=B8=AD=E5=BF=83=E6=89=93=E5=BC=80=E8=A2=AB=E9=94=81?= =?UTF-8?q?=E5=AE=9A=E7=9A=84=E6=A8=A1=E6=9D=BF=EF=BC=8C=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/vcs/ui/VcsCenterPane.java | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java index 9efb268a0..20b31d9c2 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java @@ -6,6 +6,7 @@ import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; +import com.fr.design.lock.LockInfoUtils; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.vcs.VcsOperatorWorker; @@ -15,6 +16,7 @@ import com.fr.design.mainframe.vcs.common.VcsCloseTemplateHelper; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.report.entity.VcsEntity; +import com.fr.report.lock.LockInfoOperator; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; @@ -25,10 +27,13 @@ import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JOptionPane; import javax.swing.JTable; +import javax.swing.SwingWorker; +import javax.swing.UIManager; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.ExecutionException; /** @@ -148,12 +153,39 @@ public class VcsCenterPane extends VcsNewPane { if (o instanceof VcsTableEntity) { VcsEntity entity = ((VcsTableEntity) o).getEntity(); saveSettingAndCloseDialog(); - DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(getTemplateTruePath(entity.getFilename()), false))); + showTemplate(entity.getFilename(), new FileNode(getTemplateTruePath(entity.getFilename()), false)); } } }); } + private void showTemplate(String filename, FileNode node) { + new SwingWorker() { + @Override + protected Boolean doInBackground() throws Exception { + String selectedFilePath = getTemplateTruePath(filename); + String lock = node.getLock(); + return LockInfoUtils.isCompatibleOperator() + || LockInfoUtils.unableGetLockInfo() + || WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(selectedFilePath) + ? (lock != null && !lock.equals(node.getUserID())) + : WorkContext.getCurrent().get(LockInfoOperator.class).isTplLocked(selectedFilePath); + } + @Override + protected void done() { + try { + if (!get()) { + DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(node)); + } else { + FineJOptionPane.showMessageDialog(VcsCenterPane.this, Toolkit.i18nText("Fine-Design_Vcs_Open_Lock_Tip"), UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.ERROR_MESSAGE); + } + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + } + }.execute(); + } + private void initManagerListener() { manager.addMouseListener(new MouseAdapter() { @Override From 612c4a6fe0ef2ed604453ea32d18bd38dd43f23a Mon Sep 17 00:00:00 2001 From: Carlson Date: Tue, 1 Aug 2023 09:55:21 +0800 Subject: [PATCH 03/11] =?UTF-8?q?REPORT-79271=20feat:FVS=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E5=8D=95=E5=85=83=E6=A0=BC=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=9D=A5=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/chart/gui/data/NormalChartDataPane.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java index 86f7e4da8..c4b1e69b3 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java @@ -7,7 +7,6 @@ import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.chart.gui.ChartDataPane; -import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.van.chart.designer.AbstractVanChartScrollPane; @@ -68,9 +67,7 @@ public class NormalChartDataPane extends DataContentsPane { label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH,ChartDataPane.LABEL_HEIGHT)); northPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label1, null})); northPane.setBorder(BorderFactory.createEmptyBorder(0,5,0,8)); - if (ChartEditContext.normalMode()) { - this.add(northPane, BorderLayout.NORTH); - } + this.add(northPane, BorderLayout.NORTH); this.add(cardPane, BorderLayout.CENTER); } From b59f1ccce489e0d44aff1f72a6233bc7b6803e59 Mon Sep 17 00:00:00 2001 From: "Leo.Qin" Date: Tue, 1 Aug 2023 10:02:52 +0800 Subject: [PATCH 04/11] =?UTF-8?q?REPORT-101800=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=A0=BC=E5=86=85=E5=AE=B9=E7=9A=84=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=EF=BC=8C=E5=8D=95=E5=85=83=E6=A0=BC=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E4=BC=9A=E6=B8=85=E7=A9=BA=20=E3=80=90=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=8E=9F=E5=9B=A0=E3=80=91=E7=BC=96=E8=BE=91=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E6=96=B0=E7=9A=84=E5=8D=95=E5=85=83=E6=A0=BC=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E5=AF=B9=E5=8D=95=E5=85=83=E6=A0=BC=E5=B1=9E=E6=80=A7=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E4=BF=AE=E6=94=B9=EF=BC=8C=E4=B9=8B=E5=89=8D=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=20getCellElements=20=E6=8B=BF=E5=88=B0?= =?UTF-8?q?=E7=9A=84=E5=B9=B6=E4=B8=8D=E6=98=AF=E5=AE=9E=E9=99=85=E6=AD=A3?= =?UTF-8?q?=E5=9C=A8=E7=BC=96=E8=BE=91=E7=9A=84=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=EF=BC=8C=E6=8B=BF=E5=88=B0=E7=9A=84=E6=98=AF=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E6=89=8B=E5=8A=A8=E5=88=9B=E5=BB=BA=E7=9A=84=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?(=E5=8D=95=E5=85=83=E6=A0=BC=E5=86=85=E5=AE=B9=E4=B8=BAnull)?= =?UTF-8?q?=EF=BC=8C=E5=90=8E=E7=BB=AD=E5=AF=B9=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E6=9B=B4=E6=96=B0=E6=97=B6=EF=BC=8C=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=A0=BC=E7=9A=84=E5=86=85=E5=AE=B9=E8=A2=AB=E8=A6=86?= =?UTF-8?q?=E7=9B=96=E6=9B=B4=E6=96=B0=E4=B8=BAnull=E3=80=82=20=E3=80=90?= =?UTF-8?q?=E6=94=B9=E5=8A=A8=E6=80=9D=E8=B7=AF=E3=80=91=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E7=BC=96=E8=BE=91=E7=9A=84=E6=89=80=E6=9C=89?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=A0=BC=E5=9D=87=E4=BD=BF=E7=94=A8=20getAll?= =?UTF-8?q?CellElements?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/grid/selection/CellSelection.java | 4 ---- .../src/main/java/com/fr/quickeditor/CellQuickEditor.java | 2 +- .../com/fr/quickeditor/cellquick/CellDSColumnEditor.java | 6 +++--- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java index b5419cf39..4d5fe8a62 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java @@ -815,10 +815,6 @@ public class CellSelection extends Selection { return cellElements; } - public Set getCellElements() { - return cellElements; - } - @Override public void populatePropertyPane(ElementCasePane ePane) { CellElementPropertyPane.getInstance().reInit(ePane); diff --git a/designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java index 7c3c15876..4419392f9 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java @@ -442,7 +442,7 @@ public abstract class CellQuickEditor extends QuickEditor { CellSelection cs = (CellSelection) tc.getSelection(); TemplateElementCase editingElementCase = tc.getEditingElementCase(); - Set allCellElements = cs.getCellElements(); + Set allCellElements = cs.getAllCellElements(editingElementCase); Style oldStyle = cellElement == null ? Style.DEFAULT_STYLE : cellElement.getStyle(); Style style = formatPane.update(oldStyle); for (TemplateCellElement cellElement : allCellElements) { diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index e9917d2c2..f93cbfc3d 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -241,7 +241,7 @@ public class CellDSColumnEditor extends CellQuickEditor { dataPane.update(cellElement); CellSelection selection = (CellSelection) tc.getSelection(); - Set allCellElements = selection.getCellElements(); + Set allCellElements = selection.getAllCellElements(tc.getEditingElementCase()); groupPane.update(allCellElements); } @@ -319,7 +319,7 @@ public class CellDSColumnEditor extends CellQuickEditor { @Override public void itemStateChanged(ItemEvent e) { CellSelection selection = (CellSelection) tc.getSelection(); - Set allCellElements = selection.getCellElements(); + Set allCellElements = selection.getAllCellElements(tc.getEditingElementCase()); if (e == null || e.getStateChange() == ItemEvent.DESELECTED) { //分组-高级-自定义点确定的时候传进来null的e,但是这时候应该触发保存 groupPane.update(allCellElements); @@ -351,7 +351,7 @@ public class CellDSColumnEditor extends CellQuickEditor { if (!selectedOneCell) { // 只有在批量操作的时候才需要判断是否隐藏条件面板 CellSelection selection = (CellSelection) tc.getSelection(); - boolean sameDSName = checkSameDSName(selection.getCellElements()); + boolean sameDSName = checkSameDSName(selection.getAllCellElements(tc.getEditingElementCase())); conditionPane.setVisible(sameDSName); } else { conditionPane.setVisible(true); From 9ef4cb3b40ec2de48905b1280d41f1ec52a29ec8 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 1 Aug 2023 13:42:13 +0800 Subject: [PATCH 05/11] =?UTF-8?q?REPORT-101740=20=E3=80=90=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E7=AE=A1=E7=90=86=E4=B8=89=E6=9C=9F=E3=80=91=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E4=B8=AD=E5=BF=83=E6=89=93=E5=BC=80=E8=A2=AB=E9=94=81?= =?UTF-8?q?=E5=AE=9A=E7=9A=84=E6=A8=A1=E6=9D=BF=EF=BC=8C=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/file/TemplateTreePane.java | 17 ++++++++++++----- .../design/mainframe/vcs/ui/VcsCenterPane.java | 7 ++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index 58d9b0e88..8da6b7a3b 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -239,11 +239,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { String reportPath = reportletsTree.getSelectedTemplatePath(); final String selectedFilePath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, reportPath); String lock = node.getLock(); - boolean showLockInfo = LockInfoUtils.isCompatibleOperator() - || LockInfoUtils.unableGetLockInfo() - || WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(selectedFilePath) - ? (lock != null && !lock.equals(node.getUserID())) - : WorkContext.getCurrent().get(LockInfoOperator.class).isTplLocked(selectedFilePath); + boolean showLockInfo = needShowLockInfo(lock, selectedFilePath, node); if (showLockInfo) { UserInfo userInfo = WorkContext.getCurrent().get(LockInfoOperator.class).getUserInfo(selectedFilePath); node.setLock(UUID.randomUUID().toString()); @@ -257,6 +253,17 @@ public class TemplateTreePane extends JPanel implements FileOperations { DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(selectedFilePath, false))); } + /** + * 是否需要展示锁定信息 + */ + public static boolean needShowLockInfo(String lock, String selectedFilePath, FileNode node) { + return LockInfoUtils.isCompatibleOperator() + || LockInfoUtils.unableGetLockInfo() + || WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(selectedFilePath) + ? (lock != null && !lock.equals(node.getUserID())) + : WorkContext.getCurrent().get(LockInfoOperator.class).isTplLocked(selectedFilePath); + } + private void checkDevelopForBiddenTemplate(String selectedFilePath) { JTemplate template = getOpenedTemplate(selectedFilePath); if (template != null && template.isForbidden()) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java index 20b31d9c2..080edb4a2 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java @@ -4,6 +4,7 @@ import com.fr.base.svg.IconUtils; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.file.TemplateTreePane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.lock.LockInfoUtils; @@ -165,11 +166,7 @@ public class VcsCenterPane extends VcsNewPane { protected Boolean doInBackground() throws Exception { String selectedFilePath = getTemplateTruePath(filename); String lock = node.getLock(); - return LockInfoUtils.isCompatibleOperator() - || LockInfoUtils.unableGetLockInfo() - || WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(selectedFilePath) - ? (lock != null && !lock.equals(node.getUserID())) - : WorkContext.getCurrent().get(LockInfoOperator.class).isTplLocked(selectedFilePath); + return TemplateTreePane.needShowLockInfo(lock, selectedFilePath, node); } @Override protected void done() { From 22a75e42c8070238c48bdcf2283360ce8e0d7438 Mon Sep 17 00:00:00 2001 From: Carlson Date: Tue, 1 Aug 2023 15:52:09 +0800 Subject: [PATCH 06/11] =?UTF-8?q?REPORT-79271=20feat:=E8=80=83=E8=99=91?= =?UTF-8?q?=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/mode/ChartEditContext.java | 27 +++++++++++++++++++ .../chart/mode/ChartEditSupportDataType.java | 13 +++++++++ .../chart/gui/data/NormalChartDataPane.java | 5 +++- 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditSupportDataType.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java b/designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java index 51fe2f816..2aa862292 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java @@ -13,8 +13,28 @@ public class ChartEditContext { private static ChartEditMode current = ChartEditMode.NORMAL; + private static ChartEditSupportDataType supportDataType = ChartEditSupportDataType.BOTH; + + /** + * 切换图表编辑模式 + * @param mode 图表编辑模式 + */ public static void switchTo(ChartEditMode mode) { + if (mode == ChartEditMode.NORMAL) { + switchTo(mode, ChartEditSupportDataType.BOTH); + } else if (mode == ChartEditMode.DUCHAMP) { + switchTo(mode, ChartEditSupportDataType.TABLE_DATA); + } + } + + /** + * 切换图表编辑模式 + * @param mode 图表编辑模式 + * @param type 图表支持的数据来源 + */ + public static void switchTo(ChartEditMode mode, ChartEditSupportDataType type) { current = mode; + supportDataType = type; } public static boolean duchampMode() { @@ -33,4 +53,11 @@ public class ChartEditContext { public static boolean supportTheme() { return !DesignModeContext.isDuchampMode(); } + + /** + * 当前模式下是否支持单元格数据来源 + */ + public static boolean supportReportData() { + return supportDataType == ChartEditSupportDataType.REPORT || supportDataType == ChartEditSupportDataType.BOTH; + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditSupportDataType.java b/designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditSupportDataType.java new file mode 100644 index 000000000..5c8236133 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditSupportDataType.java @@ -0,0 +1,13 @@ +package com.fr.design.mainframe.chart.mode; + +/** + * @author Carlson + * @version 11.0 + * Created by Carlson on 2023/8/1 14:25 + * @description 图表数据来源,兼容用 + **/ +public enum ChartEditSupportDataType { + TABLE_DATA, // 数据集数据 + REPORT, // 单元格数据 + BOTH // 包含二者 +} diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java index c4b1e69b3..ba1701710 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java @@ -7,6 +7,7 @@ import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.van.chart.designer.AbstractVanChartScrollPane; @@ -67,7 +68,9 @@ public class NormalChartDataPane extends DataContentsPane { label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH,ChartDataPane.LABEL_HEIGHT)); northPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label1, null})); northPane.setBorder(BorderFactory.createEmptyBorder(0,5,0,8)); - this.add(northPane, BorderLayout.NORTH); + if (ChartEditContext.supportReportData()) { + this.add(northPane, BorderLayout.NORTH); + } this.add(cardPane, BorderLayout.CENTER); } From 0c4d4294887ee33f577956ba647c58862b4ddd48 Mon Sep 17 00:00:00 2001 From: Carlson Date: Wed, 2 Aug 2023 10:29:30 +0800 Subject: [PATCH 07/11] =?UTF-8?q?REPORT-79271=20feat:=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E5=A4=84=E7=90=86=E8=B0=83=E6=95=B4=E4=B8=BA=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/mode/ChartEditContext.java | 45 ++++++++++++------- .../chart/mode/ChartEditSupportDataType.java | 13 ------ 2 files changed, 29 insertions(+), 29 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditSupportDataType.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java b/designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java index 2aa862292..30ff6c891 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java @@ -3,6 +3,9 @@ package com.fr.design.mainframe.chart.mode; import com.fr.common.annotations.Open; import com.fr.design.base.mode.DesignModeContext; +import java.util.HashSet; +import java.util.Set; + /** * @author shine * @version 10.0 @@ -13,28 +16,21 @@ public class ChartEditContext { private static ChartEditMode current = ChartEditMode.NORMAL; - private static ChartEditSupportDataType supportDataType = ChartEditSupportDataType.BOTH; + private static final Set features = new HashSet<>(); + + /** + * 功能点枚举 + */ + public enum DuchampFeature { + SUPPORT_REPORT_DATA + } /** * 切换图表编辑模式 * @param mode 图表编辑模式 */ public static void switchTo(ChartEditMode mode) { - if (mode == ChartEditMode.NORMAL) { - switchTo(mode, ChartEditSupportDataType.BOTH); - } else if (mode == ChartEditMode.DUCHAMP) { - switchTo(mode, ChartEditSupportDataType.TABLE_DATA); - } - } - - /** - * 切换图表编辑模式 - * @param mode 图表编辑模式 - * @param type 图表支持的数据来源 - */ - public static void switchTo(ChartEditMode mode, ChartEditSupportDataType type) { current = mode; - supportDataType = type; } public static boolean duchampMode() { @@ -54,10 +50,27 @@ public class ChartEditContext { return !DesignModeContext.isDuchampMode(); } + /** + * 注册功能点 + */ + public static void addDuchampFeature(DuchampFeature feature) { + features.add(feature); + } + + /** + * 移除功能点 + */ + public static void removeDuchampFeature(DuchampFeature feature) { + features.remove(feature); + } + /** * 当前模式下是否支持单元格数据来源 */ public static boolean supportReportData() { - return supportDataType == ChartEditSupportDataType.REPORT || supportDataType == ChartEditSupportDataType.BOTH; + if (normalMode()) { + return true; + } + return features.contains(DuchampFeature.SUPPORT_REPORT_DATA); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditSupportDataType.java b/designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditSupportDataType.java deleted file mode 100644 index 5c8236133..000000000 --- a/designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditSupportDataType.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fr.design.mainframe.chart.mode; - -/** - * @author Carlson - * @version 11.0 - * Created by Carlson on 2023/8/1 14:25 - * @description 图表数据来源,兼容用 - **/ -public enum ChartEditSupportDataType { - TABLE_DATA, // 数据集数据 - REPORT, // 单元格数据 - BOTH // 包含二者 -} From 9ad3ea3549e1d1160b46f3257516017bc2ed2ab5 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" <3166887LjL> Date: Wed, 2 Aug 2023 15:00:28 +0800 Subject: [PATCH 08/11] =?UTF-8?q?REPORT-101409=20=E3=80=90=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E7=AE=A1=E7=90=86=E4=B8=89=E6=9C=9F=E3=80=91=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=97=A0=E6=9D=83=E9=99=90=E7=9A=84=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=A4=B1=E8=B4=A5=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/vcs/ui/VcsCenterPane.java | 6 ---- .../design/mainframe/vcs/ui/VcsNewPane.java | 36 +++++++++++++++---- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java index 080edb4a2..4ca132ea5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java @@ -241,12 +241,6 @@ public class VcsCenterPane extends VcsNewPane { return TITLE; } - - private String getTemplateTruePath(String filename) { - return StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, filename); - } - - @Override protected String getDeleteTip(int size) { return Toolkit.i18nText("Fine-Design_Vcs_Delete_Select_All_Version"); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java index b924228fd..0ffa32ef1 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java @@ -4,6 +4,7 @@ import com.fr.base.svg.IconUtils; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.MultiTemplateTabPane; +import com.fr.design.file.TemplateTreePane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; @@ -16,19 +17,20 @@ import com.fr.design.mainframe.vcs.common.VcsCacheFileNodeFile; import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; +import com.fr.file.filetree.FileNodes; import com.fr.io.utils.ResourceIOUtils; +import com.fr.report.InconsistentLockException; import com.fr.report.entity.VcsEntity; +import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; +import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; +import com.fr.workspace.resource.WorkResource; import com.fr.workspace.server.vcs.VcsFileUtils; import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.v2.VcsTaskResult; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.JTable; -import javax.swing.SwingWorker; +import javax.swing.*; import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -179,9 +181,12 @@ public class VcsNewPane extends RecyclePane { @Override protected VcsTaskResult doInBackground() throws Exception { String path = VcsHelper.getInstance().getFilePath(entity); - if (!ResourceIOUtils.exist(path)) { + if (!WorkContext.getCurrent().get(WorkResource.class).exist(path)) { return new VcsTaskResult(false, new FileNotFoundException()); } + if (checkLock(entity.getFilename())) { + return new VcsTaskResult(false, new InconsistentLockException()); + } //step1.设置还原的用户名 entity.setUsername(VcsHelper.getInstance().getCurrentUsername()); //step2.rollback到指定版本 @@ -206,7 +211,11 @@ public class VcsNewPane extends RecyclePane { } DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(filePath, false))); } else { - FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit")); + if (result.getException() instanceof FileNotFoundException) { + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit")); + } else { + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Vcs_Open_Lock_Tip"), UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.ERROR_MESSAGE); + } } } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); @@ -215,6 +224,19 @@ public class VcsNewPane extends RecyclePane { }.execute(); } + private boolean checkLock(String filename) { + String selectedFilePath = getTemplateTruePath(filename); + FileNode node = new FileNode(getTemplateTruePath(filename), false); + String lock = node.getLock(); + return TemplateTreePane.needShowLockInfo(lock, selectedFilePath, node); + } + + /** + * 获取模板的路径 + */ + public String getTemplateTruePath(String filename) { + return StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, filename); + } private void initDeleteListener() { delete.addMouseListener(new MouseAdapter() { From 8c13453363af4835d211f855ff4a7e3899376bfe Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" <3166887LjL> Date: Wed, 2 Aug 2023 15:04:19 +0800 Subject: [PATCH 09/11] =?UTF-8?q?REPORT-101409=20=E3=80=90=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E7=AE=A1=E7=90=86=E4=B8=89=E6=9C=9F=E3=80=91=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=97=A0=E6=9D=83=E9=99=90=E7=9A=84=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=A4=B1=E8=B4=A5=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java index 0ffa32ef1..8e5e22c47 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java @@ -30,7 +30,12 @@ import com.fr.workspace.server.vcs.VcsFileUtils; import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.v2.VcsTaskResult; -import javax.swing.*; +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.JOptionPane; +import javax.swing.JTable; +import javax.swing.SwingWorker; +import javax.swing.UIManager; import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; From 77632dba9fd91e42b0756b5b99b2b2015ca33c6c Mon Sep 17 00:00:00 2001 From: vito Date: Thu, 3 Aug 2023 14:13:41 +0800 Subject: [PATCH 10/11] =?UTF-8?q?REPORT-102243=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E5=AF=8C=E6=96=87=E6=9C=AC=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8=E8=87=AA=E5=AE=9A=E4=B9=89=E6=A0=B7=E5=BC=8F=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/jxbrowser/MimeType.java | 11 +++++------ .../jxbrowser/NxInterceptRequestCallback.java | 14 ++++++++++---- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/jxbrowser/MimeType.java b/designer-base/src/main/java/com/fr/design/jxbrowser/MimeType.java index c843dfebd..654de0d72 100644 --- a/designer-base/src/main/java/com/fr/design/jxbrowser/MimeType.java +++ b/designer-base/src/main/java/com/fr/design/jxbrowser/MimeType.java @@ -83,21 +83,20 @@ public enum MimeType { * 如果没有,尝试使用 Files.probeContentType 检测 * 如果没有,默认返回 text/html * - * @param url url路径 + * @param resourcePath 资源路径 * @return MimeType */ - public static String parseMimeType(String url) { - if (StringUtils.isBlank(url)) { + public static String parseMimeType(String resourcePath) { + if (StringUtils.isBlank(resourcePath)) { return HTML.mimeType; } - String finalPath = url.split("\\?")[0]; Optional mimeType = Arrays.stream(values()) - .filter(type -> finalPath.endsWith(type.suffix)) + .filter(type -> resourcePath.endsWith(type.suffix)) .findFirst(); if (mimeType.isPresent()) { return mimeType.get().mimeType; } else { - return getFileMimeType(finalPath); + return getFileMimeType(resourcePath); } } diff --git a/designer-base/src/main/java/com/fr/design/jxbrowser/NxInterceptRequestCallback.java b/designer-base/src/main/java/com/fr/design/jxbrowser/NxInterceptRequestCallback.java index ada7b2fff..58d45a61f 100644 --- a/designer-base/src/main/java/com/fr/design/jxbrowser/NxInterceptRequestCallback.java +++ b/designer-base/src/main/java/com/fr/design/jxbrowser/NxInterceptRequestCallback.java @@ -20,6 +20,7 @@ import com.teamdev.jxbrowser.net.callback.InterceptUrlRequestCallback; import org.jetbrains.annotations.NotNull; import java.io.InputStream; +import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.nio.charset.StandardCharsets; import java.util.Map; @@ -80,8 +81,9 @@ public class NxInterceptRequestCallback implements InterceptUrlRequestCallback { protected Optional generateFileProtocolUrlRequestJob(Params params, String path) { try { - InputStream inputStream = getResourceStream(path); - String mimeType = MimeType.parseMimeType(path); + String resourcePath = getResourcePath(path); + InputStream inputStream = getResourceStream(resourcePath); + String mimeType = MimeType.parseMimeType(resourcePath); byte[] bytes; if (isHtml(mimeType)) { String text = IOUtils.inputStream2String(inputStream, EncodeConstants.ENCODING_UTF_8); @@ -104,7 +106,11 @@ public class NxInterceptRequestCallback implements InterceptUrlRequestCallback { * @return 输入流 * @throws Exception IO异常 */ - private InputStream getResourceStream(String path) throws Exception { + private InputStream getResourceStream(String path) { + return IOUtils.readResource(path); + } + + private static String getResourcePath(String path) throws UnsupportedEncodingException { int index = path.indexOf("="); if (index > 0) { path = path.substring(index + 1); @@ -115,7 +121,7 @@ public class NxInterceptRequestCallback implements InterceptUrlRequestCallback { // 通过自定义协议之后的url会自动encode一些中文字符,这里做一个decode,否则会导致路径访问失败 path = URLDecoder.decode(path, StandardCharsets.UTF_8.name()); } - return IOUtils.readResource(path); + return path; } private boolean isHtml(String mimeType) { From 3a7fce0b20dcd86a7679fe898ff03b368905fa67 Mon Sep 17 00:00:00 2001 From: vito Date: Thu, 3 Aug 2023 15:24:49 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/fr/design/jxbrowser/MimeTypeTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/designer-base/src/test/java/com/fr/design/jxbrowser/MimeTypeTest.java b/designer-base/src/test/java/com/fr/design/jxbrowser/MimeTypeTest.java index 6a5fcf7f4..abfdb6fcf 100644 --- a/designer-base/src/test/java/com/fr/design/jxbrowser/MimeTypeTest.java +++ b/designer-base/src/test/java/com/fr/design/jxbrowser/MimeTypeTest.java @@ -13,9 +13,10 @@ public class MimeTypeTest { @Test public void getMimeType() { Assert.assertEquals("text/html", MimeType.parseMimeType("http://a.html")); - Assert.assertEquals("text/html", MimeType.parseMimeType("http://a.html?a=ji")); - Assert.assertEquals("text/html", MimeType.parseMimeType("http://a.xml?a=ji")); - Assert.assertEquals("image/jpeg", MimeType.parseMimeType("http://a.jpg?a=ji")); - Assert.assertEquals("image/jpeg", MimeType.parseMimeType("http://a.jpeg?a=ji")); + Assert.assertEquals("truetype", + MimeType.parseMimeType("emb://com/fr/web/ui/resources?path=/com/fr/web/ui/font/iconfont.ttf")); + Assert.assertEquals("font/woff", + MimeType.parseMimeType("http://a.html?path=com/fr/ui/a.woff")); + // 对资源来说不存在http://a.jpg?a=ji这种情况,之前多虑了 } } \ No newline at end of file