From c0d3517bc9e3119ca3f0bf0863146dceef535b34 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Fri, 27 Aug 2021 16:29:15 +0800 Subject: [PATCH 01/13] =?UTF-8?q?REPORT-58270=20=E6=96=B0=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E5=A1=AB=E6=8A=A5=E5=89=A5=E7=A6=BB=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/preview/NewWritePreview.java | 39 ------------------- .../com/fr/design/mainframe/JWorkBook.java | 9 +++-- 2 files changed, 5 insertions(+), 43 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/preview/NewWritePreview.java diff --git a/designer-base/src/main/java/com/fr/design/preview/NewWritePreview.java b/designer-base/src/main/java/com/fr/design/preview/NewWritePreview.java deleted file mode 100644 index 8c7e408ff5..0000000000 --- a/designer-base/src/main/java/com/fr/design/preview/NewWritePreview.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.fr.design.preview; - -import com.fr.design.fun.impl.AbstractPreviewProvider; - -import java.util.HashMap; -import java.util.Map; - -/** - * 新前端填报预览 - * by abel 2021/07/08 - */ -public class NewWritePreview extends AbstractPreviewProvider { - @Override - public String nameForPopupItem() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Write_New_Preview"); - } - - @Override - public String iconPathForPopupItem() { - return "com/fr/design/images/buttonicon/writes.png"; - } - - @Override - public String iconPathForLarge() { - return "com/fr/design/images/buttonicon/writeb24.png"; - } - - @Override - public int previewTypeCode() { - return 99; - } - - @Override - public Map parametersForPreview() { - Map map = new HashMap(); - map.put("op", "write_new"); - return map; - } -} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index 3e9ca7629a..327f51747a 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -145,6 +145,7 @@ public class JWorkBook extends JTemplate { super(workBook, fileName); populateReportParameterAttr(); } + public JWorkBook(WorkBook workBook, FILE file, Parameter[] parameters) { super(workBook, file, parameters); populateReportParameterAttr(); @@ -489,7 +490,7 @@ public class JWorkBook extends JTemplate { double creatorWidth = blockCreator.getEditorBounds().width; double areaHeight = polyDezi.polyArea.getHeight(); double areaWidth = polyDezi.polyArea.getWidth(); - if(AssistUtils.equals(creatorWidth,0) || AssistUtils.equals(creatorHeight,0)){ + if (AssistUtils.equals(creatorWidth, 0) || AssistUtils.equals(creatorHeight, 0)) { return resolution; } double time = (areaHeight / creatorHeight) < (areaWidth / creatorWidth) ? (areaHeight / creatorHeight) : (areaWidth / creatorWidth); @@ -506,7 +507,7 @@ public class JWorkBook extends JTemplate { int row = reportPane.getSelection().getSelectedRows()[0]; double rowLength = reportPane.getSelection().getSelectedRows().length; double rowExtent = reportPane.getGrid().getVerticalExtent(); - if(AssistUtils.equals(columnLength,0) || AssistUtils.equals(rowLength,0)){ + if (AssistUtils.equals(columnLength, 0) || AssistUtils.equals(rowLength, 0)) { return resolution; } double time = (columnExtent / columnLength) < (rowExtent / rowLength) ? (columnExtent / columnLength) : (rowExtent / rowLength); @@ -929,7 +930,7 @@ public class JWorkBook extends JTemplate { public PreviewProvider[] supportPreview() { PreviewProvider[] templatePreviews = super.supportPreview(); return ArrayUtils.addAll(new PreviewProvider[]{ - new PagePreview(), new WritePreview(), new ViewPreview(), new MobilePreview(), new NewWritePreview() + new PagePreview(), new WritePreview(), new ViewPreview(), new MobilePreview() }, templatePreviews); } @@ -1212,7 +1213,7 @@ public class JWorkBook extends JTemplate { addExtraChooseFILEFilter(fileChooser); } - protected void addExtraChooseFILEFilter(FILEChooserPane fileChooser){ + protected void addExtraChooseFILEFilter(FILEChooserPane fileChooser) { Set providers = ExtraDesignClassManager.getInstance().getArray(ReportSupportedFileUIProvider.XML_TAG); for (ReportSupportedFileUIProvider provider : providers) { provider.addChooseFileFilter(fileChooser, this.suffix()); From f0d45dcb689e8561e28527a032fc8885e3bb6a91 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Fri, 27 Aug 2021 16:30:30 +0800 Subject: [PATCH 02/13] =?UTF-8?q?REPORT-58270=20=E6=96=B0=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E5=A1=AB=E6=8A=A5=E5=89=A5=E7=A6=BB=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/JWorkBook.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index 327f51747a..5b906e155e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -55,7 +55,6 @@ import com.fr.design.module.DesignModuleFactory; import com.fr.design.parameter.ParameterDefinitePane; import com.fr.design.parameter.ParameterInputPane; import com.fr.design.preview.MobilePreview; -import com.fr.design.preview.NewWritePreview; import com.fr.design.preview.PagePreview; import com.fr.design.preview.ViewPreview; import com.fr.design.preview.WritePreview; From c0a663b3e69d77a1396a937b94925f8d84448d13 Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Fri, 27 Aug 2021 17:59:17 +0800 Subject: [PATCH 03/13] =?UTF-8?q?CHART-20476=20=E5=9B=BE=E8=A1=A8-?= =?UTF-8?q?=E8=B6=85=E9=93=BE=E6=82=AC=E6=B5=AE=E7=AA=97=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/module/ChartHyperlinkGroup.java | 42 +++++++++++-------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java b/designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java index 7611f3300d..378e6a0d79 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java @@ -58,21 +58,26 @@ public class ChartHyperlinkGroup extends BaseHyperlinkGroup { if (template == null) { return false; } + if (template.isJWorkBook() || DesignModeContext.isDuchampMode()) { // 如果是普通报表单元格,那么没有 FormHyperlink 选项 FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); //返回true表示可用,返回false表示不可用 return !ComparatorUtils.equals(clazz, formHyperlink.getClass()); + } else { // 如果是决策报表 - if (template.getEditingReportIndex() == BaseJForm.FORM_TAB) { - // 编辑的是决策报表中的图表,那么没有ChartHyperRelateFloatLink 和 ChartHyperRelateCellLink 选项,有FormHyperlink 选项 - Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class}; - return !ArrayUtils.contains(classes, clazz); - } else if (template.getEditingReportIndex() == BaseJForm.ELEMENTCASE_TAB) { - // 编辑的是决策报表中的报表块,那么没有 ChartHyperPoplink 和 ChartHyperRelateFloatLink - Class[] classes = new Class[]{ChartHyperPoplink.class, ChartHyperRelateFloatLink.class}; - return !ArrayUtils.contains(classes, clazz); + Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class}; + for (Class aClass : classes) { + if (template.getEditingReportIndex() == BaseJForm.FORM_TAB) { + // 编辑的是决策报表中的图表,那么没有ChartHyperRelateFloatLink 和 ChartHyperRelateCellLink 选项,有FormHyperlink 选项 + if (ComparatorUtils.equals(aClass, clazz)) { + return false; + } + } else if (template.getEditingReportIndex() == BaseJForm.ELEMENTCASE_TAB) { + // 编辑的是决策报表中的报表块,那么没有 ChartHyperRelateFloatLink,有ChartHyperRelateCellLink 和 FormHyperlink 选项 + return !ComparatorUtils.equals(clazz, ChartHyperRelateFloatLink.class); + } } } return true; @@ -96,18 +101,21 @@ public class ChartHyperlinkGroup extends BaseHyperlinkGroup { return !ComparatorUtils.equals(object.getClass(), formHyperlink.getClass()); } else { // 如果是决策报表 - if (template.getEditingReportIndex() == BaseJForm.FORM_TAB) { - // 编辑的是决策报表中的图表,那么没有ChartHyperRelateFloatLink 和 ChartHyperRelateCellLink 选项,有FormHyperlink 选项 - Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class}; - return !ArrayUtils.contains(classes, object.getClass()); - } else if (template.getEditingReportIndex() == BaseJForm.ELEMENTCASE_TAB) { - // 编辑的是决策报表中的报表块,那么没有 ChartHyperPoplink 和 ChartHyperRelateFloatLink - Class[] classes = new Class[]{ChartHyperPoplink.class, ChartHyperRelateFloatLink.class}; - return !ArrayUtils.contains(classes, object.getClass()); + Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class}; + for (Class aClass : classes) { + if (template.getEditingReportIndex() == BaseJForm.FORM_TAB) { + // 编辑的是决策报表中的图表,那么没有ChartHyperRelateFloatLink 和 ChartHyperRelateCellLink 选项,有FormHyperlink 选项 + if (ComparatorUtils.equals(aClass, object.getClass())) { + return false; + } + } else if (template.getEditingReportIndex() == BaseJForm.ELEMENTCASE_TAB) { + // 编辑的是决策报表中的报表块,那么没有 ChartHyperRelateFloatLink,有ChartHyperRelateCellLink 和 FormHyperlink 选项 + return !ComparatorUtils.equals(object.getClass(), ChartHyperRelateFloatLink.class); + } } } return true; } }; } -} +} \ No newline at end of file From feed168831a9bce9a36740e63b0a22ff05bc6812 Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Fri, 27 Aug 2021 19:13:42 +0800 Subject: [PATCH 04/13] =?UTF-8?q?REPORT-58260=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8C=85=E5=AE=89=E8=A3=85=E9=80=82=E9=85=8Dzip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/share/util/InstallUtils.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallUtils.java index c25f53f515..610f688a46 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallUtils.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallUtils.java @@ -84,7 +84,7 @@ public class InstallUtils { @Nullable private static Group createComponentGroup(String fileName) { - String groupName = fileName.substring(0, fileName.indexOf(DOT + ReuxUtils.REUS_SUFFIX)); + String groupName = createGroupName(fileName); //有重名分组则加后缀 if (DefaultShareGroupManager.getInstance().getGroup(groupName) != null) { @@ -101,6 +101,15 @@ public class InstallUtils { return DefaultShareGroupManager.getInstance().getGroup(groupName); } + private static String createGroupName(String fileName) { + for (String suffix : ReuxUtils.SUPPORT_REUS_SUFFIX) { + if (fileName.endsWith(suffix)) { + return fileName.substring(0, fileName.indexOf(DOT + suffix)); + } + } + return fileName; + } + private static boolean installReuFile(Group group, File chosenFile, long installTime) { try { if (!group.installModule(chosenFile)) { From 5aa0bc0821ad1648e7fd82707d08b4eb1dbd60ca Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Fri, 27 Aug 2021 19:14:35 +0800 Subject: [PATCH 05/13] =?UTF-8?q?REPORT-58260=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8C=85=E5=AE=89=E8=A3=85=E9=80=82=E9=85=8Dzip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/share/action/InstallComponentAction.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java b/designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java index 05780a6b09..a845759f73 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java @@ -120,7 +120,7 @@ public class InstallComponentAction extends UpdateAction { private boolean containRues(File[] chosenFiles) { for (File file : chosenFiles) { - if (file.getName().endsWith(ReuxUtils.REUS_SUFFIX)) + if (ReuxUtils.isReusFile(file)) return true; } return false; @@ -142,8 +142,7 @@ public class InstallComponentAction extends UpdateAction { return false; } ShareComponentUtils.checkReadMe(); - boolean isReus = chosenFile.getName().endsWith(ReuxUtils.REUS_SUFFIX); - return isReus ? InstallUtils.installReusFile(chosenFile, installTime, failList) : InstallUtils.installReuFile(chosenFile, installTime, failList); + return ReuxUtils.isReusFile(chosenFile) ? InstallUtils.installReusFile(chosenFile, installTime, failList) : InstallUtils.installReuFile(chosenFile, installTime, failList); } private static class InstallBackInfo { From 548cb09197d4990add33ad517bd32ad04d8797b5 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 30 Aug 2021 10:07:00 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E6=97=A0jira=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=B8=8B=E6=97=A5=E5=BF=97=E7=AD=89=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/socketio/DesignerSocketIO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java index 782c7f35d7..0c71e9488f 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java @@ -173,7 +173,7 @@ public class DesignerSocketIO { RemoteDesignConstants.USER_LOCK_ID, connection.getId()); } - FineLoggerFactory.getLogger().error("Available ports: {}, current Protocol: {}", Arrays.toString(ports), currentProtocol); + FineLoggerFactory.getLogger().info("Available ports: {}, current Protocol: {}", Arrays.toString(ports), currentProtocol); return result; } From 7d10c6308e83caba824f283ca67981b29071128f Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 30 Aug 2021 10:07:49 +0800 Subject: [PATCH 07/13] =?UTF-8?q?REPORT-58159=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=8C=89=E9=92=AE-=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E9=80=89=E4=B8=AD-=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=97=A5=E5=BF=97=E6=A1=86=E6=97=A0=E6=B3=95=E7=BD=AE?= =?UTF-8?q?=E4=BA=8E=E8=AE=BE=E8=AE=A1=E5=99=A8=E4=B8=8A=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/loghandler/LogMessageBar.java | 4 ++++ .../main/java/com/fr/design/designer/creator/XCreator.java | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java index dc10d8883c..a80c3e0af1 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java @@ -87,4 +87,8 @@ public class LogMessageBar extends JPanel { } THIS = null; } + + public JFrame getLogFrame() { + return dlg; + } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index 3856dde4b3..c3e29e1237 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -23,6 +23,7 @@ import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.NoSupportAuthorityEdit; import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.mainframe.loghandler.LogMessageBar; import com.fr.design.plugin.DesignerPluginContext; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.Widget; @@ -33,6 +34,7 @@ import com.fr.stable.StringUtils; import javax.swing.BorderFactory; import javax.swing.JComponent; +import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.border.Border; @@ -776,6 +778,10 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo if (popup == null) { popup = new SelectedPopupDialog(this, designer); } + JFrame frame = LogMessageBar.getInstance().getLogFrame(); + if (frame!= null && frame.isActive()) { + return; + } int creatorRightX = (int) ((bounds.x + bounds.width + SelectedPopupDialog.OFFSET_X) * designer.getScale()); int creatorRightY = (int) (bounds.y * designer.getScale()); int formDesignerWidth = designer.getWidth(); From 6f28df6d55cc9a6bc9f4db5e7d290ecde284423f Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 30 Aug 2021 10:36:56 +0800 Subject: [PATCH 08/13] =?UTF-8?q?CHART-20385=E3=80=9011.0=E3=80=91?= =?UTF-8?q?=E5=9B=BE=E4=BE=8B=E4=B8=BB=E9=A2=98=E9=A2=9C=E8=89=B2=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E5=B1=95=E7=A4=BA=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/gui/ColorSelectPaneWithOutTransparent.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ColorSelectPaneWithOutTransparent.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ColorSelectPaneWithOutTransparent.java index 73c9d73390..7acc164323 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ColorSelectPaneWithOutTransparent.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ColorSelectPaneWithOutTransparent.java @@ -3,8 +3,7 @@ package com.fr.design.mainframe.chart.gui; import com.fr.chart.base.ChartConstants; import com.fr.design.style.color.NewColorSelectPane; -import javax.swing.*; -import java.awt.*; +import java.awt.Color; /** * Created by Fangjie on 2016/4/8. @@ -19,11 +18,4 @@ public class ColorSelectPaneWithOutTransparent extends NewColorSelectPane { return ChartConstants.MAP_COLOR_ARRAY; } - protected JPanel getMenuColorPane() { - JPanel menuColorPane = new JPanel(); - menuColorPane.setLayout(new GridLayout(0, 8, 1, 1)); - menuColorPane.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 8)); - - return menuColorPane; - } } From 47c756ba5f4147df6023367ae631b10e2bebfc31 Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Mon, 30 Aug 2021 10:43:41 +0800 Subject: [PATCH 09/13] =?UTF-8?q?REPORT-58296=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=9D=A2=E6=9D=BF=E9=AB=98=E5=BA=A6=E6=B6=88?= =?UTF-8?q?=E5=A4=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/designer/creator/XWParameterLayout.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java index f60aa9846e..fc01aefaa9 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java @@ -108,11 +108,6 @@ public class XWParameterLayout extends XWAbsoluteLayout { return false; } - @Override - public boolean canEnterIntoAdaptPane() { - return false; - } - /** * 该组件是否可以拖拽(表单中参数面板和自适应布局不可以拖拽) * @return 是则返回true From 6a653f3b13a9cad87722a62354786c65b1ba9c84 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 30 Aug 2021 10:52:43 +0800 Subject: [PATCH 10/13] =?UTF-8?q?=E6=97=A0jira=20=E5=8A=A0=E4=B8=AA?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E6=97=B6=E5=A4=84=E7=90=86=20=E9=98=B2?= =?UTF-8?q?=E6=AD=A2=E5=B7=A5=E5=85=B7=E6=A0=8F=E6=AE=8B=E7=95=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/start/module/DesignerWorkspaceActivator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java index 24d9189518..858eca4977 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java @@ -53,6 +53,7 @@ public class DesignerWorkspaceActivator extends Activator { public void on(Event event, Workspace workspace) { PluginClassRefreshManager.getInstance().removePluginListener(); HistoryTemplateListCache.getInstance().stash(); + PluginClassRefreshManager.getInstance().fireTabChange(); } }); From d1bb253b0d7c75f4246ef35c2aa5db7faf10206f Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 30 Aug 2021 10:54:33 +0800 Subject: [PATCH 11/13] =?UTF-8?q?REPORT-57171=20AF=E6=89=93=E4=B8=8D?= =?UTF-8?q?=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/component/AlphaFineDialog.java | 21 ++++++++++++------- .../search/manager/impl/HotIssuesManager.java | 4 +++- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index c708960d7e..e7612c0010 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -57,8 +57,6 @@ import javax.swing.KeyStroke; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; import javax.swing.Timer; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; import java.awt.AWTEvent; import java.awt.BorderLayout; import java.awt.Color; @@ -242,21 +240,28 @@ public class AlphaFineDialog extends UIDialog { if (hotData == null) { hotData = HotIssuesManager.getInstance().getHotIssues(); } - for (int i = 0; i < hotData.length; i++) { - panel.add(new HotIssueJpanel(hotData[i], i + 1)); - } } else { hotData = null; - for (int i = 0; i < AlphaFineConstants.HOT_ITEMS; i++) { - panel.add(new HotIssueJpanel(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Connection_Failed")}, i + 1)); - } } + initHotPane(panel, hotData); hotPane.add(uiLabel, BorderLayout.NORTH); hotPane.add(panel, BorderLayout.CENTER); add(hotPane, BorderLayout.SOUTH); setSize(AlphaFineConstants.FULL_SIZE); } + private void initHotPane(JPanel panel, String[][] hotData) { + if (hotData == null) { + for (int i = 0; i < AlphaFineConstants.HOT_ITEMS; i++) { + panel.add(new HotIssueJpanel(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Connection_Failed")}, i + 1)); + } + } else { + for (int i = 0; i < hotData.length; i++) { + panel.add(new HotIssueJpanel(hotData[i], i + 1)); + } + } + } + /** * 初始化输入框 */ diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java index 6897689b81..749a0a611f 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java @@ -20,6 +20,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.jetbrains.annotations.Nullable; /** @@ -71,6 +72,7 @@ public class HotIssuesManager { * 从热门问题接口获取热门问题 * @return */ + @Nullable public String[][] getHotIssues() { try { @@ -84,7 +86,7 @@ public class HotIssuesManager { } } } catch (Exception e) { - FineLoggerFactory.getLogger().error("hotissues search error: " + e.getMessage()); + FineLoggerFactory.getLogger().error("hotissues search error: " + e.getMessage(), e); return null; } return data; From c26c3aeb22b0f9c858c650396c9c2cffa788fed9 Mon Sep 17 00:00:00 2001 From: Heyman Date: Mon, 30 Aug 2021 11:50:28 +0800 Subject: [PATCH 12/13] =?UTF-8?q?REPORT-55986=20=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8tap=E5=9D=97=20=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E5=9B=BD=E9=99=85=E5=8C=96=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/ui/designer/mobile/TabMobileWidgetDefinePane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java index af591abddd..93e2ee1720 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java @@ -46,7 +46,7 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { public TabMobileWidgetDefinePane(XCreator xCreator) { this.xCreator = xCreator; - contentJPanel = FRGUIPaneFactory.createCenterFlowZeroGapBorderPane(); + contentJPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); scrollPane = new AttrScrollPane() { @Override protected JPanel createContentPane() { @@ -117,7 +117,7 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { //高级 holder.add(advancePane, BorderLayout.CENTER); - contentJPanel.add(holder, BorderLayout.CENTER); + contentJPanel.add(holder, BorderLayout.NORTH); this.add(scrollPane, BorderLayout.CENTER); } From 65dd2c9e55b1390ecec4e0db0dae191ca27a4b68 Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 30 Aug 2021 15:46:09 +0800 Subject: [PATCH 13/13] =?UTF-8?q?REPORT-58366=20=E3=80=90=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E5=88=87=E6=8D=A2=E3=80=91=E4=B8=BB=E9=A2=98=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E7=95=8C=E9=9D=A2-=E7=BB=86=E8=8A=82=E5=AE=9A?= =?UTF-8?q?=E5=88=B6-=E7=BB=84=E4=BB=B6=E6=A0=B7=E5=BC=8F=E3=80=81?= =?UTF-8?q?=E9=85=8D=E8=89=B2=E7=BC=96=E8=BE=91=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=96=87=E5=AD=97=E5=86=85=E5=AE=B9/?= =?UTF-8?q?=E5=AD=97=E4=BD=93/=E5=A4=A7=E5=B0=8F/=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 组件样式面板与主题面板的界面变更与优化: 1. 提示文字样式变更,增强提示效果 2. 将包含边框的组件样式子分类名称修改为外延,明确其含义(原来为背景,易误解) 3. 增加主题列表中主题项的加载图 4. 增加主题操作(删除/保存/另存为/设置为新建模版主题)失败的提示对话框 5. 多线程加载主题数据后,确保只在EDT线程中操作UI 6. 主题单元格样式列表新增RadioButton,强提示用户当前选择的是哪一个单 元格样式 【改动思路】 同上 --- .../mainframe/theme/AsyncThemeFetcher.java | 9 +- .../mainframe/theme/TemplateThemeBlock.java | 72 +++++++++--- .../theme/TemplateThemeManagePane.java | 25 +++- .../theme/TemplateThemeProfilePane.java | 47 +++++--- .../theme/edit/ComponentStyleEditPane.java | 4 +- .../fr/design/gui/xpane/LayoutStylePane.java | 2 +- .../style/ThemedCellStyleListPane.java | 107 ++++++++++++------ 7 files changed, 192 insertions(+), 74 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/AsyncThemeFetcher.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/AsyncThemeFetcher.java index 265043283b..3df87ac658 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/AsyncThemeFetcher.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/AsyncThemeFetcher.java @@ -5,6 +5,7 @@ import com.fr.base.theme.TemplateThemeConfig; import com.fr.concurrent.NamedThreadFactory; import com.fr.module.ModuleContext; +import javax.swing.SwingUtilities; import java.util.concurrent.ExecutorService; /** @@ -48,7 +49,13 @@ public class AsyncThemeFetcher { return; } if (callback != null) { - callback.afterCachedFetch(theme); + // 后续任务不要在工作线程中执行,从而确保只在EDT线程操作UI + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + callback.afterCachedFetch(theme); + } + }); } } }); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java index 933ce2ad31..d014199f35 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java @@ -16,7 +16,6 @@ import com.fr.stable.StringUtils; import javax.swing.BorderFactory; import javax.swing.Icon; -import javax.swing.ImageIcon; import javax.swing.JPanel; import javax.swing.SwingUtilities; import java.awt.BorderLayout; @@ -27,10 +26,10 @@ import java.awt.Graphics2D; import java.awt.Image; import java.awt.Rectangle; import java.awt.RenderingHints; +import java.awt.Toolkit; import java.awt.Window; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.util.concurrent.ExecutorService; /** * @author Starryi @@ -51,7 +50,7 @@ public class TemplateThemeBlock extends JPanel { private final Icon profileIcon = IOUtils.readIcon("/com/fr/design/icon/icon_edit.png"); private final boolean displayTheme4NewTemplateMarker; - private UILabel thumbnailLabel; + private final ThumbnailPane thumbnailPane; // UIButton会影响Block的手势监听,这里使用UILabel代替,点击事件也有Block代为处理 private UILabel profileButton; private boolean selected = false; @@ -67,6 +66,7 @@ public class TemplateThemeBlock extends JPanel { this.displayTheme4NewTemplateMarker = displayTheme4NewTemplateMarker; this.config = config; this.profilePane = profilePane; + this.thumbnailPane = new ThumbnailPane(); initializePane(); addMouseListener(new MouseAdapter() { @@ -100,8 +100,8 @@ public class TemplateThemeBlock extends JPanel { setPreferredSize(new Dimension(getPreferredSize().width, HEIGHT)); setBackground(Color.WHITE); - thumbnailLabel = new UILabel(); - thumbnailLabel.setPreferredSize(new Dimension(getPreferredSize().width, THUMBNAIL_HEIGHT)); + thumbnailPane.setBackground(Color.WHITE); + thumbnailPane.setPreferredSize(new Dimension(getPreferredSize().width, THUMBNAIL_HEIGHT)); JPanel infoPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); infoPane.setBackground(Color.WHITE); @@ -115,23 +115,20 @@ public class TemplateThemeBlock extends JPanel { addProfileButton(infoPane); } - add(thumbnailLabel, BorderLayout.CENTER); + add(thumbnailPane, BorderLayout.CENTER); add(infoPane, BorderLayout.SOUTH); } public void setTheme(T theme) { this.theme = theme; - thumbnailLabel.setIcon(null); + Image image = null; if (theme != null) { ThemeThumbnail thumbnail = theme.getThumbnail(); if (thumbnail != null) { - Image image = thumbnail.getImage(); - if (image != null) { - thumbnailLabel.setIcon(new ImageIcon(image)); - } + image = thumbnail.getImage(); } } - repaint(); + thumbnailPane.setThumbnail(image); } public T getTheme() { @@ -158,7 +155,7 @@ public class TemplateThemeBlock extends JPanel { int y = e.getY(); int profileButtonX = profileButton.getX(); - int profileButtonY = thumbnailLabel.getHeight() + profileButton.getY(); + int profileButtonY = thumbnailPane.getHeight() + profileButton.getY(); boolean inX = profileButtonX <= x && x <= profileButtonX + profileButton.getWidth(); boolean inY = profileButtonY <= y && y <= profileButtonY + profileButton.getHeight(); @@ -205,4 +202,53 @@ public class TemplateThemeBlock extends JPanel { GraphHelper.draw(g, rectangle, Constants.LINE_MEDIUM); } } + + private static class ThumbnailPane extends JPanel { + private static final Image LOADING_IMAGE = Toolkit.getDefaultToolkit().createImage(ThumbnailPane.class.getResource("/com/fr/design/images/mainframe/loading.gif")); + private Image thumbnail = null; + + @Override + public void paint(Graphics g) { + super.paint(g); + Graphics2D g2d = (Graphics2D) g; + paintCenterImage(g2d, thumbnail != null ? thumbnail : LOADING_IMAGE); + } + + private void paintCenterImage(Graphics2D g2d, Image image) { + if (image == null) { + return; + } + + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + int width = getWidth(); + int height = getHeight(); + int imgWidth = image.getWidth(null); + int imgHeight = image.getHeight(null); + + if (width <= 0 || height <= 0 || imgWidth <= 0 || imgHeight <= 0) { + return; + } + + float imgAspect = 1.0F * imgWidth / imgHeight; + + if (1.0F * width / height > 1.0F * imgWidth / imgHeight) { + imgHeight = height; + imgWidth = (int) (1.0F * imgHeight * imgAspect); + } else { + imgWidth = width; + imgHeight = (int) (1.0F * imgWidth / imgAspect); + } + int x = (width - imgWidth) / 2; + int y = (height - imgHeight) / 2; + + g2d.drawImage(image, x, y, imgWidth, imgHeight, null); + } + + public void setThumbnail(Image thumbnail) { + this.thumbnail = thumbnail; + invalidate(); + repaint(); + } + } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java index 8da77c3780..bf93c6345a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java @@ -17,11 +17,13 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.icon.IconPathConstants; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.theme.dialog.TemplateThemeProfileDialog; +import com.fr.design.mainframe.theme.edit.CellStyleListEditPane; import com.fr.design.menu.MenuDef; import com.fr.design.menu.ToolBarDef; import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; +import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; @@ -45,6 +47,8 @@ import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import static com.fr.design.i18n.Toolkit.i18nText; + /** * @author Starryi * @version 1.0 @@ -172,7 +176,16 @@ public class TemplateThemeManagePane extends BasicPane public void actionPerformed(ActionEvent e) { T theme = themeListPane.getSelectedTheme(); if (theme != null) { - config.setThemeName4NewTemplate(theme.getName()); + config.setThemeName4NewTemplate(theme.getName(), new CallBackAdaptor() { + @Override + public void afterRollback() { + super.afterRollback(); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TemplateThemeManagePane.this), + i18nText("Fine-Design_Basic_Template_Theme_Operation_Failed_Tip"), + i18nText("Fine-Design_Basic_Alert"), + JOptionPane.WARNING_MESSAGE); + } + }); } } }); @@ -221,10 +234,14 @@ public class TemplateThemeManagePane extends BasicPane Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Pane_Delete_Tip", theme.getName()), Toolkit.i18nText("Fine-Design_Basic_Delete"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (result == JOptionPane.YES_OPTION) { - Configurations.modify(new WorkerFacade(config.getClass()) { + config.removeTheme(theme.getName(), new CallBackAdaptor() { @Override - public void run() { - config.removeTheme(theme.getName()); + public void afterRollback() { + super.afterRollback(); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TemplateThemeManagePane.this), + i18nText("Fine-Design_Basic_Template_Theme_Operation_Failed_Tip"), + i18nText("Fine-Design_Basic_Alert"), + JOptionPane.WARNING_MESSAGE); } }); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java index cedc63f3f0..0abd6a7bc9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java @@ -7,6 +7,7 @@ import com.fr.base.theme.settings.ThemeThumbnail; import com.fr.base.theme.settings.ThemedCellStyleList; import com.fr.base.theme.settings.ThemedChartStyle; import com.fr.base.theme.settings.ThemedColorScheme; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.UITabbedPane; @@ -34,7 +35,9 @@ import com.fr.transaction.WorkerFacade; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JDialog; +import javax.swing.JOptionPane; import javax.swing.JPanel; +import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; @@ -51,6 +54,8 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.List; +import static com.fr.design.i18n.Toolkit.i18nText; + /** * @author Starryi * @version 1.0 @@ -238,9 +243,12 @@ public abstract class TemplateThemeProfilePane extends JPanel previewLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); previewLabelPane.add(LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Color_Scheme_Preview_Label")), BorderLayout.NORTH); + UILabel tipLabel = LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Color_Scheme_Edit_Tip"), new Color(153, 153, 153)); + tipLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); + JPanel content = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ {LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Color_Scheme_Edit_Label")), colorListPane}, - {null, LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Color_Scheme_Edit_Tip"), new Color(0XC6C6C6), 10)}, + {null, tipLabel}, {previewLabelPane, extendedContainer}, }, rowSize, columnSize, 18, 7); @@ -384,12 +392,7 @@ public abstract class TemplateThemeProfilePane extends boolean canBeSaved = checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, nameTextField, nameErrorLabel, saveButton); if (canBeSaved && theme != null) { theme.setName(nameTextField.getText()); - Configurations.modify(new WorkerFacade(config.getClass()) { - @Override - public void run() { - config.addTheme(theme, true); - } - }.addCallBack(new CallBackAdaptor() { + config.addTheme(theme, true, new CallBackAdaptor() { @Override public void afterCommit() { super.afterCommit(); @@ -397,7 +400,16 @@ public abstract class TemplateThemeProfilePane extends nameTextField.setEnabled(false); saveAsButton.setEnabled(true); } - })); + + @Override + public void afterRollback() { + super.afterRollback(); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TemplateThemeProfilePane.this), + i18nText("Fine-Design_Basic_Template_Theme_Operation_Failed_Tip"), + i18nText("Fine-Design_Basic_Alert"), + JOptionPane.WARNING_MESSAGE); + } + }); } } }); @@ -540,20 +552,23 @@ public abstract class TemplateThemeProfilePane extends newThemeObject.setName(name); newThemeObject.setRemovable(true); newThemeObject.setMutable(true); - T finalNewThemeObject = newThemeObject; - Configurations.modify(new WorkerFacade(config.getClass()) { - @Override - public void run() { - config.addTheme(finalNewThemeObject, true); - } - }.addCallBack(new CallBackAdaptor() { + config.addTheme(newThemeObject, true, new CallBackAdaptor() { @Override public void afterCommit() { super.afterCommit(); exit(); parent.exit(); } - })); + + @Override + public void afterRollback() { + super.afterRollback(); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TemplateThemeProfilePane.this), + i18nText("Fine-Design_Basic_Template_Theme_Operation_Failed_Tip"), + i18nText("Fine-Design_Basic_Alert"), + JOptionPane.WARNING_MESSAGE); + } + }); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ComponentStyleEditPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ComponentStyleEditPane.java index bb78d2fc0b..87a12a9ddf 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ComponentStyleEditPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ComponentStyleEditPane.java @@ -45,7 +45,7 @@ public class ComponentStyleEditPane extends JPanel { new String[] { Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Component_Title"), Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Component_Body"), - Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Component_Background") + Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Component_Integral") }, new JComponent[] { createTabContainer(componentTitleStylePane), createTabContainer(componentBodyStylePane), createTabContainer(componentIntegralStylePane) } ); @@ -119,7 +119,7 @@ public class ComponentStyleEditPane extends JPanel { JPanel tipLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); tipLabelPane.setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0)); - UILabel tipLabel = LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Component_Style_Tip"), new Color(0XC6C6C6), 10); + UILabel tipLabel = LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Component_Style_Tip"), new Color(153, 153, 153)); tipLabelPane.add(tipLabel); container.add(tipLabelPane, BorderLayout.NORTH); diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java index ee4a88409e..09170b8c3b 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java @@ -97,7 +97,7 @@ public class LayoutStylePane extends BasicBeanPane { return null; } this.integralStylePane = new ComponentIntegralStylePane(SETTING_LABEL_WIDTH, supportBorderImage, supportCornerRadius); - return this.createNamedSubStylePane(i18nText("Fine-Design_Form_Widget-Style_Background_Style"), this.integralStylePane); + return this.createNamedSubStylePane(i18nText("Fine-Design_Form_Widget-Style_Integral_Style"), this.integralStylePane); } protected JPanel createNamedSubStylePane(String name, JPanel stylePane) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java index 1ddf279c7a..59a61e2d10 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java @@ -7,18 +7,20 @@ import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.settings.ThemedCellStyle; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerBean; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import javax.swing.BorderFactory; -import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListModel; +import javax.swing.JComponent; import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.ListCellRenderer; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; @@ -28,52 +30,21 @@ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.io.Serializable; import java.util.List; public class ThemedCellStyleListPane extends FurtherBasicBeanPane implements DesignerBean { private static final int LEFT_BORDER = 10; private static final int RIGHT_BORDER = 10; - private DefaultListModel defaultListModel; - private JList styleList; + private final DefaultListModel defaultListModel; + private final JList styleList; private ChangeListener changeListener; public ThemedCellStyleListPane() { defaultListModel = new DefaultListModel<>(); styleList = new JList<>(defaultListModel); - DefaultListCellRenderer render = new DefaultListCellRenderer() { - private Style nameStyle; - - @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - - if (value instanceof Style) { - this.nameStyle = (Style) value; - this.setText(" "); - } - this.setPreferredSize(new Dimension(210, 22)); - return this; - } - - @Override - public void paintComponent(Graphics g) { - super.paintComponent(g); - - if (nameStyle == null) { - return; - } - String text = "abcedfgh"; - if (nameStyle instanceof NameStyle) { - text = ((NameStyle) nameStyle).getName(); - } - Style.paintBackground((Graphics2D) g, nameStyle, getWidth() - 1, getHeight() - 1); - Style.paintContent((Graphics2D) g, text, nameStyle, getWidth() - 1, getHeight() - 1, ScreenResolution.getScreenResolution()); - Style.paintBorder((Graphics2D) g, nameStyle, getWidth() - 1, getHeight() - 1); - } - - }; - styleList.setCellRenderer(render); + styleList.setCellRenderer(new RadioButtonListCellRenderer()); setLayout(FRGUIPaneFactory.createBorderLayout()); add(styleList, BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder(0 ,LEFT_BORDER, 0, RIGHT_BORDER)); @@ -167,4 +138,66 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane imp styleList.setModel(defaultListModel); } + private static class RadioButtonListCellRenderer extends JPanel implements ListCellRenderer, Serializable { + + private final UIRadioButton button; + private final PreviewArea previewArea; + + public RadioButtonListCellRenderer() { + super(); + setLayout(new BorderLayout(20, 0)); + setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + setPreferredSize(new Dimension(getPreferredSize().width, 40)); + button = new UIRadioButton(); + previewArea = new PreviewArea(); + add(button, BorderLayout.WEST); + add(previewArea, BorderLayout.CENTER); + } + + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + button.setSelected(isSelected); + previewArea.setStyle((Style) value); + return this; + } + } + + private static class PreviewArea extends JComponent { + + private String paintText = "Report"; + private Style style = Style.DEFAULT_STYLE; + + public void setStyle(Style style) { + this.style = style; + if (style instanceof NameStyle) { + paintText = ((NameStyle) style).getName(); + } + repaint(); + } + + @Override + public void paintComponent(Graphics g) { + Graphics2D g2d = (Graphics2D) g; + int resolution = ScreenResolution.getScreenResolution(); + + g.clipRect(0, 0, getWidth() - 3, getHeight() - 3); + + if (style == Style.DEFAULT_STYLE) { + // 如果是默认的style,就只写"Report"上去 + Style.paintContent(g2d, paintText, style, getWidth() - 3, getHeight() - 3, resolution); + return; + } + + Style.paintBackground(g2d, style, getWidth() - 3, getHeight() - 3); + + Style.paintContent(g2d, paintText, style, getWidth() - 3, getHeight() - 3, resolution); + + Style.paintBorder(g2d, style, getWidth() - 3, getHeight() - 3); + } + + @Override + public Dimension getMinimumSize() { + return getPreferredSize(); + } + } } \ No newline at end of file