From 88cfa15c8411a1b4c5a2ad0f5d42c5b398d7c494 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 23 Nov 2021 15:59:50 +0800 Subject: [PATCH 001/116] =?UTF-8?q?REPORT-63192=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8-=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=AB=AF=E7=94=9F=E6=88=90=E7=BB=84=E4=BB=B6=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E7=9A=84=E7=B1=BB=E5=9E=8B=E6=94=B9=E4=B8=BA=E5=BF=85?= =?UTF-8?q?=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 1. 整理下目前组件生成面板中必填项的校验规则 2. 将组件类型设置渐入到必填项的校验规则中 【改动思路】 同上 --- .../share/ui/generate/ShareGeneratePane.java | 68 +++--------------- .../share/ui/generate/ShareMainPane.java | 69 +++++++++++++++++-- 2 files changed, 74 insertions(+), 63 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java index f71a504c8..5969cb6c2 100644 --- a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java +++ b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java @@ -5,6 +5,8 @@ import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.event.ChangeEvent; +import com.fr.design.event.ChangeListener; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; @@ -33,15 +35,12 @@ import com.fr.form.share.group.DefaultShareGroupManager; import com.fr.form.share.record.ShareWidgetInfoManager; import com.fr.form.ui.Widget; import com.fr.log.FineLoggerFactory; -import com.fr.stable.StringUtils; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingWorker; import javax.swing.UIManager; import javax.swing.border.Border; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Dimension; @@ -113,57 +112,17 @@ public class ShareGeneratePane extends BasicPane { this.mainPane.add(simplePane, ShareUIUtils.convertStateChange(ItemEvent.DESELECTED)); this.mainPane.add(uploadPane, ShareUIUtils.convertStateChange(ItemEvent.SELECTED)); - simplePane.getNameField().getDocument().addDocumentListener(new DocumentListener() { - - @Override - public void changedUpdate(DocumentEvent e) { - validInput(); - } - - @Override - public void insertUpdate(DocumentEvent e) { - validInput(); - } - + simplePane.addRequiredSettingChangeListener(new ChangeListener() { @Override - public void removeUpdate(DocumentEvent e) { - validInput(); + public void fireChanged(ChangeEvent event) { + checkRequiredSettings(); } }); - simplePane.getDesignerVersionField().getDocument().addDocumentListener(new DocumentListener() { - - @Override - public void changedUpdate(DocumentEvent e) { - validInput(); - } - - @Override - public void insertUpdate(DocumentEvent e) { - validInput(); - } - + uploadPane.addRequiredSettingChangeListener(new ChangeListener() { @Override - public void removeUpdate(DocumentEvent e) { - validInput(); - } - }); - - uploadPane.getNameField().getDocument().addDocumentListener(new DocumentListener() { - - @Override - public void changedUpdate(DocumentEvent e) { - validInput(); - } - - @Override - public void insertUpdate(DocumentEvent e) { - validInput(); - } - - @Override - public void removeUpdate(DocumentEvent e) { - validInput(); + public void fireChanged(ChangeEvent event) { + checkRequiredSettings(); } }); @@ -176,14 +135,9 @@ public class ShareGeneratePane extends BasicPane { return pane; } - private void validInput() { - String name = getSelectMainPane().getNameField().getText().trim(); - boolean isValidName = StringUtils.isNotEmpty(name); - - boolean isValidDesignerVersion = getSelectMainPane().getDesignerVersionField().isValidVersion(); - - boolean isValidInput = isValidName && isValidDesignerVersion; - dialog.setButtonEnabled(isValidInput); + private void checkRequiredSettings() { + boolean isSettingsRequired = getSelectMainPane().checkRequiredSettings(); + dialog.setButtonEnabled(isSettingsRequired); } diff --git a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java index b19dbd659..7bcad336f 100644 --- a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java +++ b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java @@ -5,6 +5,8 @@ import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.event.ChangeEvent; +import com.fr.design.event.ChangeListener; import com.fr.design.extra.LoginWebBridge; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; @@ -62,6 +64,8 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.border.MatteBorder; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.PlainDocument; @@ -142,6 +146,9 @@ public class ShareMainPane extends JPanel { private List effectItemGroups; private final boolean needContentTip; + // 监听必填项 + private ChangeListener requiredSettingChangeListener; + public ShareMainPane(Image shareCover, Rectangle rec, boolean upload, List effectItemGroups, boolean needContentTip) { this.shareCover = shareCover; @@ -410,11 +417,31 @@ public class ShareMainPane extends JPanel { pane.add(parentClassify); pane.add(childClassify); + + UILabel validSymbol = new UILabel(" *"); + pane.add(validSymbol); return pane; } private JPanel createDesignerVersionFiledPane() { designerVersionField.setPreferredSize(new Dimension(TEXT_FIELD_WIDTH, TEXT_FIELD_HEIGHT)); + designerVersionField.getDocument().addDocumentListener(new DocumentListener() { + + @Override + public void changedUpdate(DocumentEvent e) { + notifyRequiredSettingChanged(new ChangeEvent(designerVersionField)); + } + + @Override + public void insertUpdate(DocumentEvent e) { + notifyRequiredSettingChanged(new ChangeEvent(designerVersionField)); + } + + @Override + public void removeUpdate(DocumentEvent e) { + notifyRequiredSettingChanged(new ChangeEvent(designerVersionField)); + } + }); JPanel symbolTextFiled = FRGUIPaneFactory.createBorderLayout_S_Pane(); UILabel validSymbol = new UILabel(" *"); symbolTextFiled.add(designerVersionField, BorderLayout.CENTER); @@ -546,6 +573,23 @@ public class ShareMainPane extends JPanel { nameField.setPlaceholder(Toolkit.i18nText("Fine-Design_Share_Name_Placeholder")); nameField.setPreferredSize(new Dimension(TEXT_FIELD_WIDTH, TEXT_FIELD_HEIGHT)); nameField.setDocument(nameLimited); + nameField.getDocument().addDocumentListener(new DocumentListener() { + + @Override + public void changedUpdate(DocumentEvent e) { + notifyRequiredSettingChanged(new ChangeEvent(nameField)); + } + + @Override + public void insertUpdate(DocumentEvent e) { + notifyRequiredSettingChanged(new ChangeEvent(nameField)); + } + + @Override + public void removeUpdate(DocumentEvent e) { + notifyRequiredSettingChanged(new ChangeEvent(nameField)); + } + }); JPanel symbolTextFiled = FRGUIPaneFactory.createBorderLayout_S_Pane(); UILabel validSymbol = new UILabel(" *"); symbolTextFiled.add(nameField, BorderLayout.CENTER); @@ -672,16 +716,29 @@ public class ShareMainPane extends JPanel { return provider; } - public Group getSelectGroup() { - return (Group) localGroup.getSelectedItem(); + public boolean checkRequiredSettings() { + String name = nameField.getText().trim(); + boolean isNameRequired = StringUtils.isNotEmpty(name); + + boolean isDesignerVersionRequired = designerVersionField.isValidVersion(); + + boolean isClassifyRequired = parentClassify.getSelectedItem() != null && childClassify.getSelectedItem() != null; + + return isNameRequired && isDesignerVersionRequired && isClassifyRequired; + } + + public void addRequiredSettingChangeListener(ChangeListener changeListener) { + this.requiredSettingChangeListener = changeListener; } - public UITextField getNameField() { - return nameField; + private void notifyRequiredSettingChanged(ChangeEvent event) { + if (this.requiredSettingChangeListener != null) { + this.requiredSettingChangeListener.fireChanged(event); + } } - public VersionIntervalField getDesignerVersionField() { - return designerVersionField; + public Group getSelectGroup() { + return (Group) localGroup.getSelectedItem(); } private String classify(Object classify) { From fb67c0901c388166ee42b530c792ed3fb38ee769 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 23 Nov 2021 17:21:18 +0800 Subject: [PATCH 002/116] =?UTF-8?q?REPORT-63194=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8-=E9=80=82=E9=85=8D?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=AD=97=E6=AE=B5=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=A1=86=E8=BE=93=E5=85=A5=E6=97=B6=E4=BC=9A=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E6=B6=88=E5=A4=B1=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 合成文本,如中文等存在输入-删除-替换的机制,参考JTextComponent#replaceInputMethodText() 所以insertString中不能直接return,而应该抛出异常中断后续字符处理,否则在处理中文等合成文本时 会导致原有字符被删除 【改动思路】 同上 --- .../com/fr/design/share/ui/generate/ShareMainPane.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java index 7bcad336f..5639b5957 100644 --- a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java +++ b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java @@ -818,14 +818,17 @@ public class ShareMainPane extends JPanel { @Override public void insertString(int offset, String str, AttributeSet attrSet) throws BadLocationException { if (str == null) { - return; + throw new BadLocationException(null, offset); } int count = str.length(); for (int i = 0; i < count; i++) { char c = str.charAt(i); if (allowCharAsString.indexOf(c) < 0) { java.awt.Toolkit.getDefaultToolkit().beep(); - return; + // REPORT-63194 + // 合成文本,如中文等存在输入-删除-替换的机制 JTextComponent#replaceInputMethodText() + // 所以这里不能直接return,而应该抛出异常中断后续字符处理,否则在处理中文等合成文本时会导致原有字符被删除 + throw new BadLocationException(str, offset); } } super.insertString(offset, str, attrSet); From 1a8a38a8893a4c070afe9d1672c20950e1179e9a Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 24 Nov 2021 15:33:22 +0800 Subject: [PATCH 003/116] =?UTF-8?q?REPORT-63190=E3=80=90=E6=8E=A5=E8=A7=A6?= =?UTF-8?q?=E7=82=B9=E4=BC=98=E5=8C=96=E3=80=91=E8=BD=AE=E6=92=AD=E8=BF=87?= =?UTF-8?q?=E7=A8=8B=E4=B8=AD=E5=88=87=E6=8D=A2=E7=BB=84=E4=BB=B6=E5=8C=85?= =?UTF-8?q?=EF=BC=8C=E5=86=8D=E5=9B=9E=E6=9D=A5=E5=8F=91=E7=8E=B0=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=9C=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../share/ui/block/AbstractOnlineWidgetBlock.java | 4 ++++ .../share/ui/block/OnlineWidgetPackageBlock.java | 3 +++ .../mainframe/share/ui/block/PreviewWidgetBlock.java | 7 ++++++- .../mainframe/share/ui/block/SimpleWidgetBlock.java | 5 +++++ .../ui/online/AbstractOnlineWidgetSelectPane.java | 2 +- .../ui/online/resource/OnlineResourceManager.java | 10 ++++++++-- .../share/ui/online/resource/ResourceLoader.java | 7 +++++++ 7 files changed, 34 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java index 582f353ee..864e5cdda 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java @@ -95,6 +95,10 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock extends JPanel implements MouseListe @Override public void mouseEntered(MouseEvent e) { hover = true; - if (ComponentShareUtil.needShowFirstDragAnimate() && !FormWidgetDetailPane.getInstance().hasTouched() && checkWidget()) { + if (ComponentShareUtil.needShowFirstDragAnimate() && supportFirstDragAnimate() && + !FormWidgetDetailPane.getInstance().hasTouched() && checkWidget()) { schedule(ANIMATE_START_TIME); awtEventListener = event -> { if (!this.isShowing()) { @@ -169,6 +170,10 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe } } + protected boolean supportFirstDragAnimate(){ + return true; + } + protected boolean checkWidget() { return true; } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/SimpleWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/SimpleWidgetBlock.java index cf5e948de..a76220fd5 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/SimpleWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/SimpleWidgetBlock.java @@ -14,4 +14,9 @@ public class SimpleWidgetBlock extends OnlineWidgetBlock { this.removeListener(); this.setFocusable(false); } + + protected boolean supportFirstDragAnimate(){ + return false; + } + } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java index 53239700d..187bcca32 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java @@ -170,7 +170,7 @@ public abstract class AbstractOnlineWidgetSelectPane extends AbstractWidgetSele if (!OnlineShopUtils.testConnection()) { return OnlineWidgetSelectPane.PaneStatue.DISCONNECTED; } - OnlineResourceManager.getInstance().cancelLoad(); + OnlineResourceManager.getInstance().cancelLoad(this); contentPane.removeAll(); scrollPane = createScrollPane(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java index 4e10ff25b..b29ea11db 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe.share.ui.online.resource; import javax.swing.SwingWorker; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; +import java.util.function.Predicate; /** * Created by kerry on 2020-12-10 @@ -25,11 +26,16 @@ public class OnlineResourceManager { private final BlockingQueue loaderBlockingQueue = new ArrayBlockingQueue(100); - public void cancelLoad() { + public void cancelLoad(Object key) { if (swingWorker != null) { swingWorker.cancel(true); } - this.loaderBlockingQueue.clear(); + loaderBlockingQueue.removeIf(new Predicate() { + @Override + public boolean test(ResourceLoader resourceLoader) { + return resourceLoader.checkValid(key); + } + }); } public void addLoader(ResourceLoader loader) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/ResourceLoader.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/ResourceLoader.java index fee705f8a..7aacd2941 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/ResourceLoader.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/ResourceLoader.java @@ -10,4 +10,11 @@ public interface ResourceLoader { */ void load(); + /** + * 检查resource是否属于某分类 + * @param key 分类标识 + * @return boolean + */ + boolean checkValid(Object key); + } From 23ece8197e7460b3d0b94a774b8f391bdfafdf02 Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 24 Nov 2021 15:00:35 +0800 Subject: [PATCH 004/116] =?UTF-8?q?REPORT-63250=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8F=AF=E6=9B=B4=E6=96=B0=E8=A7=86=E8=A7=89=E9=AA=8C=E6=94=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 修改设计器组件商城面板上一些控件的展示效果 【改动思路】 同上 --- .../design/mainframe/share/ui/local/LocalWidgetRepoPane.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java index fd050513b..0d0cff570 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java @@ -119,10 +119,12 @@ public class LocalWidgetRepoPane extends BasicPane { content.add(LabelUtils.createAutoWrapLabel(Toolkit.i18nText("Fine-Design_Share_Upgrade_Tip"), new Color(0x333334)), BorderLayout.CENTER); JPanel actionsPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 0)); + actionsPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, -5)); actionsPane.setOpaque(false); actionsPane.setBackground(null); UIButton cancelUpgradeButton = new UIButton(Toolkit.i18nText("Fine-Design_Share_Upgrade_Cancel")); + cancelUpgradeButton.setRoundBorder(true); cancelUpgradeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -132,6 +134,8 @@ public class LocalWidgetRepoPane extends BasicPane { UIButton startUpgradeButton = new UIButton(Toolkit.i18nText("Fine-Design_Share_Upgrade_All")); startUpgradeButton.setSelected(true); + startUpgradeButton.setRoundBorder(true); + startUpgradeButton.setBorderPainted(false); startUpgradeButton.setForeground(Color.WHITE); startUpgradeButton.addActionListener(new ActionListener() { @Override From 6aa636185daf0bf2a471b433891590b4195ff47b Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 24 Nov 2021 17:26:52 +0800 Subject: [PATCH 005/116] =?UTF-8?q?REPORT-62672=E3=80=90=E6=8E=A5=E8=A7=A6?= =?UTF-8?q?=E7=82=B9=E4=BC=98=E5=8C=96=E3=80=91=E9=83=A8=E5=88=86=E5=9F=8B?= =?UTF-8?q?=E7=82=B9=E6=97=A0=E6=B3=95=E6=A8=A1=E6=8B=9F=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E5=9F=8B=E7=82=B9=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/share/collect/ComponentCollector.java | 3 --- .../share/ui/online/embed/OnlineEmbedFilterSelectPane.java | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java index db9fbe43b..d65f6af9a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java @@ -343,9 +343,6 @@ public class ComponentCollector implements XMLable { } public void clickComponentSetting() { - if (!ComponentShareUtil.needShowEmbedFilterPane()) { - return; - } boolean changed = false; int firstShowReact = ComponentReuseNotificationInfo.getInstance().isWidgetLibHasRefreshed() ? 2 : -1; if (this.firstShowReact != firstShowReact) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java index 3f4cea2a0..be433aa56 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java @@ -40,6 +40,7 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane private static final String CAROUSEL_PREVIEW = "carousel_preview"; private static final int CAROUSE_IMAGE_LOAD_TIMEOUT = 2000; private OnlineShareWidget[] showWidgets; + private static final int NOT_CAROUSE_WIDGET_NUM = 30; private PreviewDialog previewDialog; private JPanel widgetPane; @@ -144,7 +145,7 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane stopCarouse(integer); return; } - if (integer.get() == 0) { + if (integer.get() == NOT_CAROUSE_WIDGET_NUM) { CarouselStateManger.getInstance().stop(); stopCarouse(integer); previewDialog.setVisible(false); From 0c77e8cdf3f2f8c0c9a84e7ad6ef2f409919e91c Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Wed, 24 Nov 2021 17:41:04 +0800 Subject: [PATCH 006/116] =?UTF-8?q?REPORT-63196=20&&=20REPORT-63186=201.?= =?UTF-8?q?=E5=9C=A8=E5=8F=8C=E5=87=BB=E4=B9=8B=E5=90=8E=E4=BD=BF=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E6=A1=86=E6=B6=88=E5=A4=B1=EF=BC=9B=202.=E6=A8=A1?= =?UTF-8?q?=E6=8B=9F=E8=AE=A1=E7=AE=97=E5=9C=A8=E8=AE=A1=E7=AE=97=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E6=97=B6=E5=80=99=E6=8F=90=E7=A4=BA=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FormulaPane.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index b11644e68..dc1e03027 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -46,6 +46,7 @@ import com.fr.parser.BlockIntervalLiteral; import com.fr.parser.ColumnRowRangeInPage; import com.fr.parser.NumberLiteral; import com.fr.parser.SheetIntervalLiteral; +import com.fr.record.analyzer.EnableMetrics; import com.fr.report.core.namespace.SimpleCellValueNameSpace; import com.fr.script.Calculator; import com.fr.script.ScriptConstants; @@ -54,7 +55,6 @@ import com.fr.stable.EncodeConstants; import com.fr.stable.EssentialUtils; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; -import com.fr.stable.UtilEvalError; import com.fr.stable.script.CRAddress; import com.fr.stable.script.ColumnRowRange; import com.fr.stable.script.Expression; @@ -122,6 +122,7 @@ import java.util.Set; * @editor zhou * @since 2012-3-29下午1:50:53 */ +@EnableMetrics public class FormulaPane extends BasicPane implements KeyListener, UIFormula { public static final int DEFUAL_FOMULA_LENGTH = 103; public static final String ELLIPSIS = "..."; @@ -139,6 +140,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { protected static UICheckBox autoCompletionCheck; protected static UICheckBox checkBeforeColse; private JList tipsList; + private JPopupMenu popupMenu; protected DefaultListModel listModel = new DefaultListModel(); private int ifHasBeenWriten = 0; private DefaultListModel functionTypeListModel = new DefaultListModel(); @@ -457,6 +459,9 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { if (ComparatorUtils.equals((String) listModel.getElementAt(index), doublePressContent)) { doubleClickActuator(doublePressContent); } + if (popupMenu != null) { + popupMenu.setVisible(false); + } } } } @@ -616,7 +621,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } private void popTips() { - JPopupMenu popupMenu = new JPopupMenu(); + popupMenu = new JPopupMenu(); JScrollPane tipsScrollPane = new JScrollPane(tipsList); popupMenu.add(tipsScrollPane); tipsScrollPane.setPreferredSize(new Dimension(240, 146)); @@ -792,6 +797,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private final ActionListener calculateActionListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { String formulaText = formulaTextArea.getText().trim(); @@ -819,16 +825,20 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } BaseFormula baseFormula = BaseFormula.createFormulaBuilder().build(formulaText); + Object calResult; try { - Object value = calculator.evalValue(baseFormula); - String objectToString = EssentialUtils.objectToString(value); + calResult = calculator.evalValue(baseFormula); + String objectToString = EssentialUtils.objectToString(calResult); String result = objectToString.length() > DEFUAL_FOMULA_LENGTH ? objectToString.substring(0, DEFUAL_FOMULA_LENGTH - ELLIPSIS.length()) + ELLIPSIS : objectToString; messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Result") + ":" + result; - FineLoggerFactory.getLogger().info("value:{}", value); - } catch (UtilEvalError utilEvalError) { - FineLoggerFactory.getLogger().error(utilEvalError.getMessage(), utilEvalError); + } catch (Exception ce) { + //模拟计算如果出现错误,则抛出错误 + calResult = ce.getMessage(); + FineLoggerFactory.getLogger().error(ce.getMessage(), ce); + messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Error") + ":" + calResult; } + FineLoggerFactory.getLogger().info("value:{}", calResult); } else { messageTips = checkResult.getTips(); } From 568cf34dc65fa13e4efe4d2f2ab8c377732c7827 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 24 Nov 2021 18:37:02 +0800 Subject: [PATCH 007/116] =?UTF-8?q?REPORT-63305=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E8=8E=B7=E5=8F=96=E7=88=B6=E5=AE=B9=E5=99=A8=EF=BC=8C?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E5=AF=B9=E6=8B=93=E5=B1=95=E7=9A=84=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E6=8F=92=E4=BB=B6=E5=85=BC=E5=AE=B9=E5=A4=84=E7=90=86?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/creator/XCreatorUtils.java | 26 +++++++++++++++++++ .../widget/ui/FormSingleWidgetCardPane.java | 7 ++--- .../designer/component/WidgetBoundPane.java | 10 ++----- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java index 2f797efa4..6445e001b 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java @@ -57,6 +57,7 @@ import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTitleLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout; +import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; import com.fr.invoke.Reflect; @@ -68,6 +69,7 @@ import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.StringUtils; import com.fr.third.javax.annotation.Nonnull; +import java.util.Set; import org.jetbrains.annotations.Nullable; import javax.swing.Icon; @@ -375,4 +377,28 @@ public class XCreatorUtils { return xCreator; } + + public static boolean isExtraContainer(XCreator creator) { + Set set = ExtraDesignClassManager.getInstance().getArray(FormWidgetOptionProvider.XML_TAG); + for (FormWidgetOptionProvider provider : set) { + if (provider.isContainer() + && ComparatorUtils.equals(provider.appearanceForWidget(), provider.appearanceForWidget()) + && ComparatorUtils.equals(provider.classForWidget(), creator.toData().getClass())) { + return true; + } + } + return false; + } + + public static XLayoutContainer getParent(XCreator source) { + if (source.acceptType(XWCardTagLayout.class) ) { + return (XLayoutContainer)source.getParent(); + } + XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source); + boolean accept = (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) && !isExtraContainer(source); + if (accept) { + container = null; + } + return container; + } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java index 1fd1a3527..491b42b2b 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java @@ -67,12 +67,9 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane { initDefinePane(); } + @Deprecated public XLayoutContainer getParent(XCreator source) { - XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source); - if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) { - container = null; - } - return container; + return XCreatorUtils.getParent(source); } public WidgetBoundPane createWidgetBoundPane(XCreator xCreator) { diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java index aee83889e..f711eb157 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java @@ -61,15 +61,9 @@ public class WidgetBoundPane extends BasicPane { initBoundPane(); } + @Deprecated public XLayoutContainer getParent(XCreator source) { - if(source.acceptType(XWCardTagLayout.class)){ - return (XLayoutContainer)source.getParent(); - } - XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source); - if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) { - container = null; - } - return container; + return XCreatorUtils.getParent(source); } public void initBoundPane() { From 8de9339eceaf774fe0f497b6845a82daa8b98762 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 25 Nov 2021 11:37:08 +0800 Subject: [PATCH 008/116] =?UTF-8?q?CHART-22038=20=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=EF=BC=8C=E5=AE=89=E8=A3=85ECharts=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E5=9B=BE=E8=A1=A8=E5=9D=97=E6=8F=92=E5=85=A5=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E5=8C=BA=E5=9F=9F=E4=B8=8D=E6=98=BE=E7=A4=BAecharts?= =?UTF-8?q?=E7=9A=84=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/FormParaWidgetPane.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java index 09e02ac67..be752777b 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java @@ -7,6 +7,7 @@ import com.fr.design.constants.UIConstants; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreatorUtils; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.gui.chart.ChartXMLTag; import com.fr.design.gui.core.FormWidgetOption; @@ -19,6 +20,7 @@ import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.module.DesignModuleFactory; +import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.UserDefinedWidgetConfig; import com.fr.form.ui.Widget; @@ -99,6 +101,15 @@ public class FormParaWidgetPane extends JPanel { synchronized (FormParaWidgetPane.class) { THIS = null; } + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (template != null && !template.isJWorkBook()) { + DesignerContext.getDesignerFrame().resetToolkitByPlus(template); + } + } + }); } }, new PluginFilter() { From f8c570a3f1243f41c12236ebbbca8e4481b6ed74 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Thu, 25 Nov 2021 15:32:37 +0800 Subject: [PATCH 009/116] =?UTF-8?q?REPORT-62175=20&&=20REPORT-63204=201.?= =?UTF-8?q?=E5=9F=8B=E7=82=B9=E9=80=82=E9=85=8D=202.=E9=92=88=E5=AF=B9sum(?= =?UTF-8?q?1,)=E7=AD=89=E6=AD=A4=E7=B1=BB=E5=85=AC=E5=BC=8F=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E5=90=88=E6=B3=95=E6=80=A7=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FormulaPane.java | 116 ++++++++++-------- 1 file changed, 62 insertions(+), 54 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index dc1e03027..189b9e042 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -341,13 +341,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { @Override public void focusGained(FocusEvent e) { // 获得焦点时 安装 - if (autoCompletion == null && autoCompletionCheck.isSelected()) { - CompletionProvider provider = createCompletionProvider(); - autoCompletion = new FormulaPaneAutoCompletion(provider); - autoCompletion.setListCellRenderer(new CompletionCellRenderer()); - autoCompletion.install(formulaTextArea); - autoCompletion.installVariableTree(variableTreeAndDescriptionArea); - } + installAutoCompletion(); } @Override @@ -410,6 +404,16 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } } + private void installAutoCompletion() { + if (autoCompletion == null && autoCompletionCheck.isSelected()) { + CompletionProvider provider = createCompletionProvider(); + autoCompletion = new FormulaPaneAutoCompletion(provider); + autoCompletion.setListCellRenderer(new CompletionCellRenderer()); + autoCompletion.install(formulaTextArea); + autoCompletion.installVariableTree(variableTreeAndDescriptionArea); + } + } + protected void extendCheckBoxPane(JPanel checkBoxPane) { @@ -795,58 +799,62 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } }; + private void calculateFormula() { + String formulaText = formulaTextArea.getText().trim(); + String unSupportFormula = containsUnsupportedSimulationFormulas(formulaText); + if (unSupportFormula != null) { + showMessageDialog(Toolkit.i18nText("Fine-Design_Basic_Formula_Unsupported_Formulas") + ":" + unSupportFormula, false); + return; + } - private final ActionListener calculateActionListener = new ActionListener() { + String messageTips; + FormulaCheckResult checkResult = FormulaChecker.check(formulaText); + if (checkResult.grammarValid()) { + messageTips = checkResult.getTips() + NEWLINE; + Map paramsMap = setParamsIfExist(formulaText); + Calculator calculator = Calculator.createCalculator(); + ParameterMapNameSpace parameterMapNameSpace = ParameterMapNameSpace.create(paramsMap); + calculator.pushNameSpace(parameterMapNameSpace); + + JTemplate currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (currentEditingTemplate != null) { + IOFile file = (IOFile) currentEditingTemplate.getTarget(); + calculator.setAttribute(TableDataSource.KEY, file); + calculator.pushNameSpace(TableDataNameSpace.getInstance()); + calculator.pushNameSpace(SimpleCellValueNameSpace.getInstance()); + } - @Override - public void actionPerformed(ActionEvent e) { - String formulaText = formulaTextArea.getText().trim(); - String unSupportFormula = containsUnsupportedSimulationFormulas(formulaText); - if (unSupportFormula != null) { - showMessageDialog(Toolkit.i18nText("Fine-Design_Basic_Formula_Unsupported_Formulas") + ":" + unSupportFormula, false); - return; + BaseFormula baseFormula = BaseFormula.createFormulaBuilder().build(formulaText); + Object calResult; + try { + calResult = calculator.evalValue(baseFormula); + String objectToString = EssentialUtils.objectToString(calResult); + String result = objectToString.length() > DEFUAL_FOMULA_LENGTH ? + objectToString.substring(0, DEFUAL_FOMULA_LENGTH - ELLIPSIS.length()) + ELLIPSIS : objectToString; + messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Result") + ":" + result; + } catch (Exception ce) { + //模拟计算如果出现错误,则抛出错误 + calResult = ce.getMessage(); + FineLoggerFactory.getLogger().error(ce.getMessage(), ce); + messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Error") + ":" + calResult; } + FineLoggerFactory.getLogger().info("value:{}", calResult); + } else { + messageTips = checkResult.getTips(); + } + if (checkResult.isValid()) { + showMessageDialog(messageTips, checkResult.isValid()); + } else { + confirmCheckResult(checkResult, messageTips); + } + } - String messageTips; - FormulaCheckResult checkResult = FormulaChecker.check(formulaText); - if (checkResult.grammarValid()) { - messageTips = checkResult.getTips() + NEWLINE; - Map paramsMap = setParamsIfExist(formulaText); - Calculator calculator = Calculator.createCalculator(); - ParameterMapNameSpace parameterMapNameSpace = ParameterMapNameSpace.create(paramsMap); - calculator.pushNameSpace(parameterMapNameSpace); - - JTemplate currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if (currentEditingTemplate != null) { - IOFile file = (IOFile) currentEditingTemplate.getTarget(); - calculator.setAttribute(TableDataSource.KEY, file); - calculator.pushNameSpace(TableDataNameSpace.getInstance()); - calculator.pushNameSpace(SimpleCellValueNameSpace.getInstance()); - } - BaseFormula baseFormula = BaseFormula.createFormulaBuilder().build(formulaText); - Object calResult; - try { - calResult = calculator.evalValue(baseFormula); - String objectToString = EssentialUtils.objectToString(calResult); - String result = objectToString.length() > DEFUAL_FOMULA_LENGTH ? - objectToString.substring(0, DEFUAL_FOMULA_LENGTH - ELLIPSIS.length()) + ELLIPSIS : objectToString; - messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Result") + ":" + result; - } catch (Exception ce) { - //模拟计算如果出现错误,则抛出错误 - calResult = ce.getMessage(); - FineLoggerFactory.getLogger().error(ce.getMessage(), ce); - messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Error") + ":" + calResult; - } - FineLoggerFactory.getLogger().info("value:{}", calResult); - } else { - messageTips = checkResult.getTips(); - } - if (checkResult.isValid()) { - showMessageDialog(messageTips, checkResult.isValid()); - } else { - confirmCheckResult(checkResult, messageTips); - } + private final ActionListener calculateActionListener = new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + calculateFormula(); } }; From 76b1cc1e02ccf6e042d65b4872ddac265e1a1660 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 25 Nov 2021 15:43:32 +0800 Subject: [PATCH 010/116] =?UTF-8?q?REPORT-63308=E3=80=90=E6=8E=A5=E8=A7=A6?= =?UTF-8?q?=E7=82=B9=E4=BC=98=E5=8C=96=E3=80=91=E8=BD=AE=E6=92=AD=E6=9C=9F?= =?UTF-8?q?=E9=97=B4=E5=9C=A8=E7=BB=84=E4=BB=B6=E4=B8=8A=E5=8F=B3=E9=94=AE?= =?UTF-8?q?=E7=9A=84=E4=BA=A4=E4=BA=92=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/share/ui/block/AbstractOnlineWidgetBlock.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java index 864e5cdda..5c1620ab4 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java @@ -114,7 +114,7 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock Date: Thu, 25 Nov 2021 15:52:56 +0800 Subject: [PATCH 011/116] =?UTF-8?q?CHART-22060=20fix:fvs=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E7=AC=AC=E4=B8=80=E4=B8=AA=E4=B8=8D=E6=98=AF=E8=B7=9F=E9=9A=8F?= =?UTF-8?q?=E4=B8=BB=E9=A2=98default=20=E6=98=AFnormal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java index e6ea1e2e7..9f9a3f13c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java @@ -153,7 +153,7 @@ public class ColorSchemeComboBox extends UIComboBox { if (selectedIndex == itemCount - 2) { return SelectType.COMBINATION_COLOR; } - if (selectedIndex == 0) { + if (selectedIndex == 0 && ChartEditContext.supportTheme()) { return SelectType.DEFAULT; } return SelectType.NORMAL; From ddd7b9fb4aa88bd75cc4f35c737d894dc52d41e5 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 25 Nov 2021 17:21:25 +0800 Subject: [PATCH 012/116] =?UTF-8?q?REPORT-62672=E3=80=90=E6=8E=A5=E8=A7=A6?= =?UTF-8?q?=E7=82=B9=E4=BC=98=E5=8C=96=E3=80=91=E9=83=A8=E5=88=86=E5=9F=8B?= =?UTF-8?q?=E7=82=B9=E6=97=A0=E6=B3=95=E6=A8=A1=E6=8B=9F=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E5=9F=8B=E7=82=B9=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../share/collect/ComponentCollector.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java index d65f6af9a..477673978 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java @@ -343,18 +343,12 @@ public class ComponentCollector implements XMLable { } public void clickComponentSetting() { - boolean changed = false; int firstShowReact = ComponentReuseNotificationInfo.getInstance().isWidgetLibHasRefreshed() ? 2 : -1; if (this.firstShowReact != firstShowReact) { - this.firstShowReact = firstShowReact; - changed = true; + collectFirstShowReact(firstShowReact); } if (this.embededFilterReact == 0 && ComponentReuseNotificationInfo.getInstance().isWidgetLibHasRefreshed()) { - this.embededFilterReact = -1; - changed = true; - } - if (changed) { - saveInfo(); + collectEmbededFilterReact(-1); } } @@ -371,11 +365,16 @@ public class ComponentCollector implements XMLable { return; } if (System.currentTimeMillis() - ComponentReuseNotificationInfo.getInstance().getFirstDragEndTime() <= ONE_MINUTE) { - this.dynamicEffectReact = 1; - saveInfo(); + collectDynamicEffectReactFlag(1); } } + public void collectDynamicEffectReactFlag(int flag) { + this.dynamicEffectReact = flag; + saveInfo(); + } + + public void clearSortType() { sortType = JSONFactory.createJSON(JSON.ARRAY); } From ef86abec5ae2a96c5d27acc2d895c98cbf132453 Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 8 Oct 2021 09:42:58 +0800 Subject: [PATCH 013/116] =?UTF-8?q?REPORT-63310=20=E5=B7=B2=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E7=9A=84=E6=97=A0=E8=BE=B9=E6=A1=86tab=E5=9D=97?= =?UTF-8?q?=E5=9C=A8=E7=BB=9D=E5=AF=B9=E5=B8=83=E5=B1=80=E5=86=85=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E7=BB=84=E4=BB=B6=E5=A4=A7=E5=B0=8F=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90=E4=BA=86=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E9=BB=91=E8=89=B2=E8=BE=B9=E6=A1=86=20&=20REPORT-59963=20?= =?UTF-8?q?=E8=B0=83=E6=95=B4Tab=E5=9D=97=E6=A0=B7=E5=BC=8F=E4=BC=9A?= =?UTF-8?q?=E5=AF=BC=E8=87=B4Tab=E6=A0=87=E9=A2=98=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E8=89=B2=E9=87=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 11.0上修复了一个相同的问题REPORT-59963,需要在10.0 上也提交下 调整Tab块样式导致样式刷新时,标题栏的样式均被初始化 【改动思路】 1. Tab组件虽然在样式面板上没有设置标题样式的设置项,即 TitlePacker,但依然使用了标题样式相关的字段,如背景, 是否显示标题栏等,这些标题相关的字段不能在调整样式时被重置, 所以需要在Tab的StylePane中始终保持 2. Tab组件的样式数据初始化应该在数据模型层完成 --- .../creator/cardlayout/XWCardLayout.java | 18 ------------------ .../gui/xpane/CardTagLayoutStylePane.java | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java index e1d4a416e..578b509ec 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java @@ -62,10 +62,6 @@ public class XWCardLayout extends XLayoutContainer { public static final String DEFAULT_NAME = "cardlayout"; - - //默认蓝色标题背景 - private static final Color TITLE_COLOR = new Color(51, 132, 240); - public XWCardLayout(WCardLayout widget, Dimension initSize) { super(widget, initSize); } @@ -399,24 +395,10 @@ public class XWCardLayout extends XLayoutContainer { @Override public void refreshStylePreviewEffect() { BorderPacker style = toData().getBorderStyle(); - initBorderTitleStyle(style); refreshBorderAndBackgroundStylePreviewEffect(); clearOrShowTitleLayout(ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)); } - private void initBorderTitleStyle(BorderPacker style) { - //初始化默认标题样式 - if (!initFlag) { - return; - } - - style.setType(LayoutBorderStyle.TITLE); - style.setBorder(Constants.LINE_THIN); - TitlePacker widgetTitle = style.getTitle(); - widgetTitle.setBackground(ColorBackground.getInstance(TITLE_COLOR)); - initFlag = false; - } - //隐藏或显示标题部分 protected void clearOrShowTitleLayout(boolean isTitleStyle) { XWCardMainBorderLayout mainLayout = (XWCardMainBorderLayout) this.getBackupParent(); diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java index 37db55102..ab953166c 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java @@ -3,6 +3,8 @@ */ package com.fr.design.gui.xpane; +import com.fr.form.ui.LayoutBorderStyle; + import javax.swing.JPanel; /** @@ -10,6 +12,8 @@ import javax.swing.JPanel; */ public class CardTagLayoutStylePane extends LayoutStylePane { + private LayoutBorderStyle backupStyleFromPopulating = new LayoutBorderStyle(); + @Override protected JPanel createTitleStylePane(){ JPanel panel = super.createTitleStylePane(); @@ -21,4 +25,18 @@ public class CardTagLayoutStylePane extends LayoutStylePane { protected JPanel createBackgroundStylePane(boolean supportCornerRadius) { return super.createBackgroundStylePane(false); } + + @Override + public void populateBean(LayoutBorderStyle style) { + this.backupStyleFromPopulating = style; + super.populateBean(style); + } + + @Override + public LayoutBorderStyle updateBean() { + LayoutBorderStyle style = super.updateBean(); + style.setTitle(backupStyleFromPopulating.getTitle()); + style.setType(backupStyleFromPopulating.getType()); + return style; + } } From 4818c71faef81099ff01127d0d9e788827a6ed84 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 25 Nov 2021 18:40:40 +0800 Subject: [PATCH 014/116] =?UTF-8?q?REPORT-63311=E3=80=90=E6=8E=A5=E8=A7=A6?= =?UTF-8?q?=E7=82=B9=E4=BC=98=E5=8C=96=E3=80=91=E8=BD=AE=E6=92=AD=E6=9C=9F?= =?UTF-8?q?=E9=97=B4=E5=88=87=E6=8D=A2=E7=BB=84=E4=BB=B6=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=EF=BC=8C=E8=BD=AE=E6=92=AD=E5=81=9C=E4=BD=8F?= =?UTF-8?q?=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/online/embed/OnlineEmbedFilterSelectPane.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java index be433aa56..def1056e9 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java @@ -57,8 +57,7 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane Point selectPanePoint = OnlineEmbedFilterSelectPane.this.getLocationOnScreen(); Dimension selectPaneDimension = OnlineEmbedFilterSelectPane.this.getSize(); Rectangle selectPaneRec = new Rectangle(selectPanePoint.x, selectPanePoint.y, selectPaneDimension.width, selectPaneDimension.height); - if (CarouselStateManger.getInstance().running() && - !selectPaneRec.contains(((MouseEvent) event).getLocationOnScreen())) { + if (!selectPaneRec.contains(((MouseEvent) event).getLocationOnScreen())) { CarouselStateManger.getInstance().stop(); } } catch (Exception e) { @@ -173,6 +172,12 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane } if (!CarouselStateManger.getInstance().isSuspend()) { previewDialog.setVisible(true); + //再做一次检查,避免因并发导致的previewDialog始终展示的问题 + if (CarouselStateManger.getInstance().stopped()) { + stopCarouse(integer); + service.shutdown(); + return; + } showCurrentLoadBlock(integer, widgetPane); service.shutdown(); } From 8bfc7697e9e3d355c9162535cc064b7ef3b37ad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 26 Nov 2021 11:37:24 +0800 Subject: [PATCH 015/116] =?UTF-8?q?REPORT-62439=20=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96-=E5=B1=8F=E8=94=BD=E6=B5=B7=E5=A4=96=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E5=86=85=E7=99=BB=E5=BD=95=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/config/DesignerProperties.java | 52 +++++++++++++++++++ .../mainframe/NorthRegionContainerPane.java | 16 +----- .../com/fr/design/os/impl/SupportOSImpl.java | 7 +-- .../fr/start/module/DesignerActivator.java | 13 +++-- 4 files changed, 63 insertions(+), 25 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/config/DesignerProperties.java diff --git a/designer-base/src/main/java/com/fr/design/config/DesignerProperties.java b/designer-base/src/main/java/com/fr/design/config/DesignerProperties.java new file mode 100644 index 000000000..d14c7938a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/config/DesignerProperties.java @@ -0,0 +1,52 @@ +package com.fr.design.config; + +import com.fr.general.IOUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; + +import java.io.BufferedInputStream; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.util.Properties; + +public class DesignerProperties { + private static DesignerProperties holder = null; + private boolean supportLoginEntry = true; + + public DesignerProperties() { + String filePath = StableUtils.pathJoin(StableUtils.getInstallHome(), "/config/config.properties"); + InputStream is = null; + try { + is = new BufferedInputStream(new FileInputStream(filePath)); + Properties ps = new Properties(); + ps.load(is); + this.initProperties(ps); + } catch (FileNotFoundException e) { + // ignore + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e, e.getMessage()); + } finally { + IOUtils.close(is); + } + } + + public static DesignerProperties getInstance() { + if (holder == null) { + holder = new DesignerProperties(); + } + return holder; + } + + private void initProperties(Properties ps) { + String supportLoginEntry = ps.getProperty("supportLoginEntry"); + if (StringUtils.isNotEmpty(supportLoginEntry)) { + this.supportLoginEntry = Boolean.valueOf(supportLoginEntry); + } + } + + public boolean isSupportLoginEntry() { + return supportLoginEntry; + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java index 6802024ea..68d783ba3 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java @@ -2,8 +2,6 @@ package com.fr.design.mainframe; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; -import com.fr.design.ExtraDesignClassManager; -import com.fr.design.fun.TitlePlaceProcessor; import com.fr.design.gui.imenu.UIMenuHighLight; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.loghandler.LogMessageBar; @@ -25,7 +23,6 @@ import javax.swing.JMenuBar; import javax.swing.JPanel; import javax.swing.SwingUtilities; import java.awt.BorderLayout; -import java.awt.Component; import java.awt.FlowLayout; /** @@ -143,17 +140,6 @@ public class NorthRegionContainerPane extends JPanel { northEastPane.removeAll(); northEastPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); northEastPane.add(LogMessageBar.getInstance()); - TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING); - if (processor != null) { - final Component[] bbsLoginPane = {null}; - OSSupportCenter.buildAction(new OSBasedAction() { - @Override - public void execute(Object... objects) { - bbsLoginPane[0] = ad.createBBSLoginPane(); - } - }, SupportOSImpl.USERINFOPANE); - processor.hold(northEastPane, LogMessageBar.getInstance(), bbsLoginPane[0]); - } northEastPane.add(ad.createAlphaFinePane()); if (!DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) { ad.createAlphaFinePane().setVisible(false); @@ -166,7 +152,7 @@ public class NorthRegionContainerPane extends JPanel { public void execute(Object... objects) { northEastPane.add(ad.createBBSLoginPane()); } - }, SupportOSImpl.USERINFOPANE); + }, SupportOSImpl.BBS_USER_LOGIN_PANE); } diff --git a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java index 949d77045..e8871154e 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java @@ -1,6 +1,7 @@ package com.fr.design.os.impl; import com.fr.base.FRContext; +import com.fr.design.config.DesignerProperties; import com.fr.design.jdk.JdkVersion; import com.fr.general.CloudCenter; import com.fr.general.GeneralContext; @@ -22,11 +23,11 @@ import java.util.Locale; public enum SupportOSImpl implements SupportOS { /** - * ARM下屏蔽登录 + * 屏蔽登录入口 */ - USERINFOPANE{ + BBS_USER_LOGIN_PANE { public boolean support(){ - return Arch.getArch() != Arch.ARM; + return Arch.getArch() != Arch.ARM && DesignerProperties.getInstance().isSupportLoginEntry(); } }, /** diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 921d8efe7..477ac8ae3 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -6,10 +6,10 @@ import com.fr.base.MultiFieldParameter; import com.fr.base.passport.FinePassportListenerAdapter; import com.fr.base.passport.FinePassportManager; import com.fr.base.process.ProcessOperator; -import com.fr.chart.chartattr.ChartCollection; -import com.fr.config.MarketConfig; import com.fr.base.theme.migrator.FormThemeConfigMigrator; import com.fr.base.theme.migrator.ReportThemeConfigMigrator; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.config.MarketConfig; import com.fr.decision.update.backup.RecoverManager; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; @@ -29,9 +29,9 @@ import com.fr.design.actions.insert.flot.ImageFloatAction; import com.fr.design.actions.insert.flot.TextBoxFloatAction; import com.fr.design.bridge.DesignToolbarProvider; import com.fr.design.constants.DesignerLaunchStatus; +import com.fr.design.env.DesignerWorkspaceLoader; import com.fr.design.fit.NewJForm; import com.fr.design.fit.common.TemplateTool; -import com.fr.design.env.DesignerWorkspaceLoader; import com.fr.design.form.parameter.FormParaDesigner; import com.fr.design.fun.ElementUIProvider; import com.fr.design.gui.controlpane.NameObjectCreator; @@ -62,7 +62,6 @@ import com.fr.design.mainframe.form.FormECDesignerProvider; import com.fr.design.mainframe.form.FormElementCaseDesigner; import com.fr.design.mainframe.form.FormReportComponentComposite; import com.fr.design.mainframe.guide.GuideRegister; -import com.fr.design.mainframe.guide.collect.GuideCollector; import com.fr.design.mainframe.loghandler.DesignerLogAppender; import com.fr.design.mainframe.share.constants.ShareEntryKey; import com.fr.design.mainframe.socketio.DesignerSocketIO; @@ -131,11 +130,11 @@ import com.fr.task.Once; import com.fr.workspace.WorkContext; import com.fr.xml.ReportXMLUtils; +import java.awt.Image; +import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.List; import java.util.Set; -import java.awt.Image; -import java.awt.image.BufferedImage; /** * Created by juhaoyu on 2018/1/31. @@ -175,7 +174,7 @@ public class DesignerActivator extends Activator implements Prepare { public void execute(Object... objects) { UserInfoPane.getInstance().updateBBSUserInfo(); } - }, SupportOSImpl.USERINFOPANE); + }, SupportOSImpl.BBS_USER_LOGIN_PANE); storePassport(); AlphaFineHelper.switchConfig4Locale(); RecoverManager.register(new RecoverForDesigner()); From ce3ee0989b71376a3ba9449643f9be1a15bc9174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 26 Nov 2021 14:28:10 +0800 Subject: [PATCH 016/116] =?UTF-8?q?REPORT-62439=20=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/NorthRegionContainerPane.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java index 68d783ba3..544dc392a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java @@ -2,6 +2,8 @@ package com.fr.design.mainframe; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.fun.TitlePlaceProcessor; import com.fr.design.gui.imenu.UIMenuHighLight; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.loghandler.LogMessageBar; @@ -23,6 +25,7 @@ import javax.swing.JMenuBar; import javax.swing.JPanel; import javax.swing.SwingUtilities; import java.awt.BorderLayout; +import java.awt.Component; import java.awt.FlowLayout; /** @@ -140,6 +143,17 @@ public class NorthRegionContainerPane extends JPanel { northEastPane.removeAll(); northEastPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); northEastPane.add(LogMessageBar.getInstance()); + TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING); + if (processor != null) { + final Component[] bbsLoginPane = {null}; + OSSupportCenter.buildAction(new OSBasedAction() { + @Override + public void execute(Object... objects) { + bbsLoginPane[0] = ad.createBBSLoginPane(); + } + }, SupportOSImpl. BBS_USER_LOGIN_PANE); + processor.hold(northEastPane, LogMessageBar.getInstance(), bbsLoginPane[0]); + } northEastPane.add(ad.createAlphaFinePane()); if (!DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) { ad.createAlphaFinePane().setVisible(false); From cc7e2b8fdb49c324f0d06c1dfcadedc123fae67f Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 26 Nov 2021 15:59:51 +0800 Subject: [PATCH 017/116] =?UTF-8?q?REPORT-63192=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8-=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=AB=AF=E7=94=9F=E6=88=90=E7=BB=84=E4=BB=B6=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E7=9A=84=E7=B1=BB=E5=9E=8B=E6=94=B9=E4=B8=BA=E5=BF=85?= =?UTF-8?q?=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 监听下必填项设置:组件分类 【改动思路】 同上 --- .../com/fr/design/share/ui/generate/ShareMainPane.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java index 5639b5957..9ac98286e 100644 --- a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java +++ b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java @@ -409,6 +409,15 @@ public class ShareMainPane extends JPanel { childClassify.clearBoxItems(); childClassify.refreshBoxItems(children); } + + notifyRequiredSettingChanged(new ChangeEvent(parentClassify)); + } + }); + + childClassify.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + notifyRequiredSettingChanged(new ChangeEvent(parentClassify)); } }); From 76430cddae7f9d578acf572c3a2a05ed29d0a104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 26 Nov 2021 17:05:36 +0800 Subject: [PATCH 018/116] =?UTF-8?q?CHART-22040=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=A2=9E=E5=8A=A0=E6=8E=92=E5=BA=8F=E7=9A=84=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/style/VanChartFunnelSeriesPane.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java index f2aa328a4..5d8c89607 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java @@ -1,13 +1,13 @@ package com.fr.van.chart.funnel.designer.style; import com.fr.chart.chartattr.Plot; -import com.fr.design.i18n.Toolkit; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; - +import com.fr.plugin.chart.funnel.FunnelSortType; import com.fr.plugin.chart.funnel.VanChartFunnelPlot; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; @@ -51,7 +51,11 @@ public class VanChartFunnelSeriesPane extends VanChartAbstractPlotSeriesPane { private JPanel createFunnelStylePane() { useSameSlantAngle = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Use_Same_Slant_Angle"), Toolkit.i18nText("Fine-Design_Chart_Use_Diff_Slant_Angle")}); - sort = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto_Sort"), Toolkit.i18nText("Fine-Design_Chart_Origin")}); + sort = new UIButtonGroup(new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Ascending_Sort"), + Toolkit.i18nText("Fine-Design_Chart_Descending_Sort"), + Toolkit.i18nText("Fine-Design_Chart_Origin_Sort") + }); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -78,7 +82,7 @@ public class VanChartFunnelSeriesPane extends VanChartAbstractPlotSeriesPane { if(plot instanceof VanChartFunnelPlot){ useSameSlantAngle.setSelectedIndex(((VanChartFunnelPlot) plot).isUseSameSlantAngle() ? 0 : 1); - sort.setSelectedIndex(((VanChartFunnelPlot) plot).isSort() ? 0 : 1); + sort.setSelectedIndex(((VanChartFunnelPlot) plot).getSortType().getSortType()); } } @@ -94,7 +98,7 @@ public class VanChartFunnelSeriesPane extends VanChartAbstractPlotSeriesPane { if(plot instanceof VanChartFunnelPlot){ ((VanChartFunnelPlot) plot).setUseSameSlantAngle(useSameSlantAngle.getSelectedIndex() == 0); - ((VanChartFunnelPlot) plot).setSort(sort.getSelectedIndex() == 0); + ((VanChartFunnelPlot) plot).setSortType(FunnelSortType.parseSortType(sort.getSelectedIndex())); } } } From 18d681ac3600342cdad48a788ea6a02e5c36aad9 Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 26 Nov 2021 15:59:51 +0800 Subject: [PATCH 019/116] =?UTF-8?q?REPORT-63192=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8-=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=AB=AF=E7=94=9F=E6=88=90=E7=BB=84=E4=BB=B6=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E7=9A=84=E7=B1=BB=E5=9E=8B=E6=94=B9=E4=B8=BA=E5=BF=85?= =?UTF-8?q?=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 监听下必填项设置:组件分类 【改动思路】 同上 --- .../com/fr/design/share/ui/generate/ShareMainPane.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java index 5639b5957..9ac98286e 100644 --- a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java +++ b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java @@ -409,6 +409,15 @@ public class ShareMainPane extends JPanel { childClassify.clearBoxItems(); childClassify.refreshBoxItems(children); } + + notifyRequiredSettingChanged(new ChangeEvent(parentClassify)); + } + }); + + childClassify.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + notifyRequiredSettingChanged(new ChangeEvent(parentClassify)); } }); From 6f797af38e5dbc2aaf20b8d3e160258043cefdaf Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 30 Nov 2021 14:54:37 +0800 Subject: [PATCH 020/116] =?UTF-8?q?REPORT-63524=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8-=E5=9F=8B=E7=82=B9?= =?UTF-8?q?=EF=BC=8C=E7=8E=B0=E5=9C=A8=E8=AE=BE=E8=AE=A1=E5=99=A8=E7=AB=AF?= =?UTF-8?q?=E5=BC=B9=E5=87=BA=E5=8F=AF=E6=9B=B4=E6=96=B0=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E6=97=B6=E6=B2=A1=E6=9C=89=E8=A7=A6=E5=8F=91=E5=9F=8B=E7=82=B9?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 将响应获取组件更新信息结果的动作抽离出来 【改动思路】 同上 --- .../share/ui/local/LocalWidgetRepoPane.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java index 0d0cff570..169b4b5e7 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java @@ -393,15 +393,19 @@ public class LocalWidgetRepoPane extends BasicPane { public void onFetchedAfter(boolean success, Map remoteLatestWidgets) { if (success) { List updatableWidgetProviders = LocalWidgetRepoUpdater.getInstance().getUpdatableWidgetProviders(); - updateTipPane.setVisible(updatableWidgetProviders.size() > 0); - if (updatableWidgetProviders.size() > 0) { - refreshAllGroupPane(GroupPane.GroupCreateStrategy.DEFAULT); - } + onRemoteWidgetUpdatesChanged(updatableWidgetProviders.size() > 0); } } }); } + public void onRemoteWidgetUpdatesChanged(boolean hasUpdates) { + updateTipPane.setVisible(hasUpdates); + if (hasUpdates) { + refreshAllGroupPane(GroupPane.GroupCreateStrategy.DEFAULT); + } + } + public void doQuitUpdateComponents() { LocalWidgetRepoUpdater updater = LocalWidgetRepoUpdater.getInstance(); updater.clearUpdate(); From 0ce53a60b463b61088d9038f5b0e62a5aa0f9345 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 30 Nov 2021 15:32:07 +0800 Subject: [PATCH 021/116] =?UTF-8?q?REPORT-62691=2011.0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E4=BA=A7=E5=87=BA=E7=9A=84=E7=BB=84=E4=BB=B6=EF=BC=8C=E5=9C=A8?= =?UTF-8?q?10.0=E4=B8=8B=E6=AD=A3=E5=B8=B8=E5=AE=89=E8=A3=85=EF=BC=8C?= =?UTF-8?q?=E4=BD=86=E5=A4=8D=E7=94=A8=E6=97=B6=E6=A8=A1=E6=9D=BF=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 10.0设计器上对组件版本进行检测,并限制使用不兼容的组件 【改动思路】 同上 --- .../share/ui/block/LocalWidgetBlock.java | 73 ++++++++++++++++++- 1 file changed, 69 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java index 911ff7b77..223e4a66d 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.share.ui.block; +import com.fr.base.FRContext; import com.fr.base.GraphHelper; import com.fr.base.iofile.attr.SharableAttrMark; import com.fr.design.actions.UpdateAction; @@ -37,17 +38,24 @@ import org.jetbrains.annotations.Nullable; import javax.swing.Action; import javax.swing.Icon; +import javax.swing.JOptionPane; import javax.swing.JPanel; +import javax.swing.UIManager; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Cursor; import java.awt.Dimension; +import java.awt.Font; import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.Image; import java.awt.Rectangle; +import java.awt.RenderingHints; import java.awt.dnd.DnDConstants; import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; +import java.awt.font.FontRenderContext; +import java.awt.font.LineMetrics; import java.util.UUID; /** @@ -67,6 +75,7 @@ public class LocalWidgetBlock extends PreviewWidgetBlock private boolean hover; private final Icon markedMode = IOUtils.readIcon("/com/fr/base/images/share/marked.png"); private final Icon unMarkedMode = IOUtils.readIcon("/com/fr/base/images/share/unmarked.png"); + private final Icon incompatibleMarker = IOUtils.readIcon("/com/fr/base/images/share/marker_incompatible.png"); public LocalWidgetBlock(DefaultSharableWidget provider, LocalWidgetSelectPane parentPane) { super(provider); @@ -198,11 +207,24 @@ public class LocalWidgetBlock extends PreviewWidgetBlock Widget creatorSource; String shareId; if (source instanceof LocalWidgetBlock) { - LocalWidgetBlock no = (LocalWidgetBlock) e.getSource(); - if (no == null) { + LocalWidgetBlock widgetBlock = (LocalWidgetBlock) e.getSource(); + if (widgetBlock == null) { return; } - shareId = no.getBindInfo().getId(); + SharableWidgetProvider widget = widgetBlock.getWidget(); + if (widget == null) { + return; + } + if (!widget.isCompatibleWithCurrentEnv()) { + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Share_Drag_And_Make_Incompatible_Component_Tip"), + Toolkit.i18nText("Fine-Design_Basic_Error"), + JOptionPane.ERROR_MESSAGE, + UIManager.getIcon("OptionPane.errorIcon") + ); + return; + } + shareId = widgetBlock.getBindInfo().getId(); creatorSource = getGroup().getElCaseEditorById(shareId); if (creatorSource == null) { ShareUIUtils.showErrorMessageDialog(Toolkit.i18nText("Fine-Design_Share_Drag_Error_Info")); @@ -211,7 +233,7 @@ public class LocalWidgetBlock extends PreviewWidgetBlock creatorSource.setWidgetID(UUID.randomUUID().toString()); ((AbstractBorderStyleWidget) creatorSource).addWidgetAttrMark(new SharableAttrMark(true)); //tab布局WCardMainBorderLayout通过反射出来的大小是960*480 - XCreator xCreator = ShareComponentUtils.createXCreator(creatorSource, shareId, no.getBindInfo()); + XCreator xCreator = ShareComponentUtils.createXCreator(creatorSource, shareId, widgetBlock.getBindInfo()); WidgetToolBarPane.getTarget().startDraggingBean(xCreator); lastPressEvent = null; this.setBorder(null); @@ -221,6 +243,13 @@ public class LocalWidgetBlock extends PreviewWidgetBlock @Override public void paint(Graphics g) { super.paint(g); + Graphics2D g2d = (Graphics2D) g; + + boolean isUnusable = !getWidget().isCompatibleWithCurrentEnv(); + if (isUnusable) { + paintUnusableMask(g2d); + } + //绘制删除标志 if (isEdit) { Icon icon = isMarked ? markedMode : unMarkedMode; @@ -235,6 +264,42 @@ public class LocalWidgetBlock extends PreviewWidgetBlock } } + protected void paintUnusableMask(Graphics2D g2d) { + Color oldColor = g2d.getColor(); + Font oldFont = g2d.getFont(); + + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + Dimension coverDim = getCoverDimension(); + double canvasX = 0; + double canvasY = 0; + double canvasW = coverDim.getWidth(); + double canvasH = coverDim.getHeight(); + + g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.4F)); + GraphHelper.fillRect(g2d, canvasX, canvasY, canvasW, canvasH); + + g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.5F)); + GraphHelper.fillRect(g2d, canvasX, canvasH - 16, canvasW, 16); + + String tipText = Toolkit.i18nText("Fine-Design_Share_Incompatible_Version_Tip"); + Font tipFont = FRContext.getDefaultValues().getFRFont().deriveFont(8.0F); + FontRenderContext frc = g2d.getFontRenderContext(); + double tipTextWidth = GraphHelper.stringWidth(tipText, tipFont, frc); + LineMetrics metrics = tipFont.getLineMetrics(tipText, frc); + double tipTextHeight = metrics.getHeight(); + g2d.setColor(Color.WHITE); + g2d.setFont(tipFont); + GraphHelper.drawString(g2d, tipText, canvasX + (canvasW - tipTextWidth) / 2.0F, canvasY + canvasH - (16 - tipTextHeight) / 2.0F); + + int markerX = (int) (canvasX + (canvasW - incompatibleMarker.getIconWidth()) / 2); + int markerY = (int) (canvasY + (canvasH - incompatibleMarker.getIconHeight()) / 2); + incompatibleMarker.paintIcon(this, g2d, markerX, markerY); + + g2d.setColor(oldColor); + g2d.setFont(oldFont); + } + /** * 由鼠标释放时调用该方法来触发左键点击事件 */ From 99762bf62231dc01547e9481f870db8ac833393a Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 30 Nov 2021 17:20:13 +0800 Subject: [PATCH 022/116] =?UTF-8?q?=20REPORT-63322=20=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E5=8F=8A=E8=81=9A=E5=90=88=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=EF=BC=8C=E6=97=A0=E6=B3=95=E6=8B=96=E5=8A=A8=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 在某些场景下,组件可能会被破坏或无法被当前设计器解析,从而出现 异常。若拖拽时的异常不被处理,会导致无法完成整个swing拖拽过程, 从而影响后续其他所有的组件拖拽。 【改动思路】 同产品以及交互讨论,新增了一个错误提示信息,当拖拽组件出现 异常时,提示用户,同时终结当前的拖拽。 --- .../mainframe/FormCreatorDropTarget.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 6efc496f8..5eb354c6c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -18,6 +18,7 @@ import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWParameterLayout; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.icon.IconPathConstants; @@ -31,12 +32,15 @@ import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.ShareLoader; import com.fr.form.share.editor.SharableEditorProvider; import com.fr.form.ui.Widget; +import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; import com.fr.stable.StringUtils; import javax.swing.BorderFactory; +import javax.swing.JOptionPane; import javax.swing.JWindow; import javax.swing.SwingUtilities; +import javax.swing.UIManager; import java.awt.Color; import java.awt.Component; import java.awt.Point; @@ -316,6 +320,24 @@ public class FormCreatorDropTarget extends DropTarget { */ @Override public synchronized void drop(DropTargetDropEvent dtde) { + + try { + dropXCreator(dtde); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + if (addingModel.getXCreator().isShared()) { + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Drag_Component_Error_Info"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), + JOptionPane.ERROR_MESSAGE, + UIManager.getIcon("OptionPane.errorIcon") + ); + } + dtde.rejectDrop(); + } + } + + private void dropXCreator(DropTargetDropEvent dtde) { Point loc = dtde.getLocation(); this.adding(designer.getRelativeX(loc.x), designer.getRelativeY(loc.y)); // 放到事件末尾执行 From afe4c1e5b59c02838ee3ca871eb5ee6b9ca84fa6 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 30 Nov 2021 17:29:21 +0800 Subject: [PATCH 023/116] =?UTF-8?q?REPORT-63322=20=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E5=8F=8A=E8=81=9A=E5=90=88=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=EF=BC=8C=E6=97=A0=E6=B3=95=E6=8B=96=E5=8A=A8=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 在某些场景下,组件可能会被破坏或无法被当前设计器解析,从而出现 异常。若拖拽时的异常不被处理,会导致无法完成整个swing拖拽过程, 从而影响后续其他所有的组件拖拽。 【改动思路】 同产品以及交互讨论,新增了一个错误提示信息,当拖拽组件出现 异常时,提示用户,同时终结当前的拖拽。 --- .../mainframe/FormCreatorDropTarget.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index a2c1ba66c..c1a08dded 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -18,6 +18,7 @@ import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWParameterLayout; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.icon.IconPathConstants; @@ -31,12 +32,15 @@ import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.ShareLoader; import com.fr.form.share.editor.SharableEditorProvider; import com.fr.form.ui.Widget; +import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; import com.fr.stable.StringUtils; import javax.swing.BorderFactory; +import javax.swing.JOptionPane; import javax.swing.JWindow; import javax.swing.SwingUtilities; +import javax.swing.UIManager; import java.awt.Color; import java.awt.Component; import java.awt.Point; @@ -318,6 +322,24 @@ public class FormCreatorDropTarget extends DropTarget { */ @Override public synchronized void drop(DropTargetDropEvent dtde) { + + try { + dropXCreator(dtde); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + if (addingModel.getXCreator().isShared()) { + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Drag_Component_Error_Info"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), + JOptionPane.ERROR_MESSAGE, + UIManager.getIcon("OptionPane.errorIcon") + ); + } + dtde.rejectDrop(); + } + } + + private void dropXCreator(DropTargetDropEvent dtde) { Point loc = dtde.getLocation(); this.adding(designer.getRelativeX(loc.x), designer.getRelativeY(loc.y)); // 放到事件末尾执行 From 5a407a44914a8fbfa88e9c27aab5629eb0c389cc Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Tue, 30 Nov 2021 18:10:15 +0800 Subject: [PATCH 024/116] =?UTF-8?q?REPORT-60163=20=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E4=BC=98=E5=8C=962.0=201.=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA=202.=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=9F=8B=E7=82=B9=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FormulaPane.java | 16 ++-- .../function/MismatchedCharFunction.java | 9 -- .../function/MismatchedTokenFunction.java | 38 +------- .../function/TranslateTokenUtils.java | 96 +++++++++++++++++++ 4 files changed, 108 insertions(+), 51 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/formula/exception/function/TranslateTokenUtils.java diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index 189b9e042..27018e6e0 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -341,7 +341,9 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { @Override public void focusGained(FocusEvent e) { // 获得焦点时 安装 - installAutoCompletion(); + if (autoCompletion == null && autoCompletionCheck.isSelected()) { + installAutoCompletion(); + } } @Override @@ -405,13 +407,11 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } private void installAutoCompletion() { - if (autoCompletion == null && autoCompletionCheck.isSelected()) { - CompletionProvider provider = createCompletionProvider(); - autoCompletion = new FormulaPaneAutoCompletion(provider); - autoCompletion.setListCellRenderer(new CompletionCellRenderer()); - autoCompletion.install(formulaTextArea); - autoCompletion.installVariableTree(variableTreeAndDescriptionArea); - } + CompletionProvider provider = createCompletionProvider(); + autoCompletion = new FormulaPaneAutoCompletion(provider); + autoCompletion.setListCellRenderer(new CompletionCellRenderer()); + autoCompletion.install(formulaTextArea); + autoCompletion.installVariableTree(variableTreeAndDescriptionArea); } diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java index c25b34f67..69ea0c81a 100644 --- a/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java @@ -35,10 +35,6 @@ public class MismatchedCharFunction implements Function"; } else { String[] tokenNames = (String[]) getFieldValue(exception, "tokenNames"); - return tokenType >= 0 && tokenType < tokenNames.length ? translateToken(tokenNames[tokenType]) : "<" + tokenType + ">"; + return tokenType >= 0 && tokenType < tokenNames.length ? TranslateTokenUtils.translateToken(tokenNames[tokenType]) : "<" + tokenType + ">"; } } - private String translateToken(String token) { - switch (token) { - case ("RPAREN"): - return ")"; - case ("LPAREN"): - return "("; - case ("COMMA"): - return ","; - case ("COLON"): - return ":"; - default: - return token; - } - } private Object getFieldValue(Object object, String fieldName) { try { diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/TranslateTokenUtils.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/TranslateTokenUtils.java new file mode 100644 index 000000000..1df697d07 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/TranslateTokenUtils.java @@ -0,0 +1,96 @@ +package com.fr.design.formula.exception.function; + +import com.fr.design.i18n.Toolkit; + +/** + * @author Hoky + * @date 2021/11/30 + */ +public class TranslateTokenUtils { + public static String translateToken(String token) { + switch (token) { + case ("RPAREN"): + return ")"; + case ("LPAREN"): + return "("; + case ("COMMA"): + return ","; + case ("COLON"): + return ":"; + case ("EOF"): + return Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Mismatched_EOF"); + case ("DOT"): + return "."; + case ("FLOT_NUM"): + return Toolkit.i18nText("Fine-Design_Basic_Formula_Float_Number"); + case ("LOR"): + return "||"; + case ("LAND"): + return "&&"; + case ("EQUAL"): + return "="; + case ("EQUAL2"): + return "="; + case ("NOT_EQUAL"): + return "!="; + case ("NOT_EQUAL2"): + return "!="; + case ("GE"): + return ">="; + case ("LE"): + return "<="; + case ("LT"): + return "<"; + case ("PLUS"): + return "+"; + case ("MINUS"): + return "-"; + case ("STAR"): + return "*"; + case ("DIV"): + return "/"; + case ("MOD"): + return "%"; + case ("POWER"): + return "^"; + case ("LNOT"): + return "!"; + case ("WAVE"): + return "~"; + case ("LBRACK"): + return "["; + case ("SEMI"): + return ";"; + case ("RBRACK"): + return "]"; + case ("LCURLY"): + return "{"; + case ("RCURLY"): + return "}"; + case ("DCOLON"): + return ";"; + case ("INT_NUM"): + return Toolkit.i18nText("Fine-Design_Basic_Formula_Integer"); + case ("CR_ADRESS"): + return "\n"; + case ("SHARP"): + return "#"; + case ("AT"): + return "@"; + case ("QUESTION"): + return "?"; + case ("BOR"): + return "||"; + case ("BAND"): + return "&&"; + case ("Char"): + return Toolkit.i18nText("Fine-Design_Basic_Formula_Character"); + case ("DIGIT"): + return Toolkit.i18nText("Fine-Design_Basic_Formula_Digital"); + case ("XDIGIT"): + return Toolkit.i18nText("Fine-Design_Basic_Formula_Hexadecimal_Digital"); + default: + return token; + } + } +} From 0113bf2e89ab9aa2095337b201a4dfa9ed509271 Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 22 Nov 2021 15:28:16 +0800 Subject: [PATCH 025/116] =?UTF-8?q?REPORT-62689=20=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E7=9A=84=E8=BE=B9=E6=A1=86=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 实现主题单元格样式支持内边框配置 【改动思路】 同上 --- .../cell/CellRectangleStylePreviewPane.java | 79 ++++++++++++++ .../fr/design/cell/CellStylePreviewPane.java | 13 ++- .../com/fr/design/gui/style/BorderPane.java | 103 +++++++++++------- .../theme}/ThemedCellStyleListPane.java | 86 ++++++++------- .../theme/ThemedFeatureController.java | 17 +++ .../theme/edit/CellStyleListEditPane.java | 18 +-- .../theme/edit/cell/CellStyleEditPane.java | 21 +++- .../fr/design/actions/cell/BorderAction.java | 60 +++++++++- .../cell/settingpane/CellStylePane.java | 63 ++++------- .../style/CellPredefinedStyleSettingPane.java | 15 +-- .../settingpane/style/CustomStylePane.java | 27 ++--- .../settingpane/style/NameStyleListPane.java | 54 +++++++++ .../cell/settingpane/style/StylePane.java | 36 +++--- .../com/fr/design/report/ReportStylePane.java | 16 +-- .../java/com/fr/design/style/BorderUtils.java | 98 ++++------------- 15 files changed, 430 insertions(+), 276 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java rename {designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style => designer-base/src/main/java/com/fr/design/mainframe/theme}/ThemedCellStyleListPane.java (64%) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedFeatureController.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/NameStyleListPane.java diff --git a/designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java b/designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java new file mode 100644 index 000000000..bde6b1371 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java @@ -0,0 +1,79 @@ +package com.fr.design.cell; + +import com.fr.report.cell.CellElementBorderSourceFlag; +import com.fr.base.CellBorderStyle; +import com.fr.base.Style; +import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase; +import com.fr.report.cell.TemplateCellElement; + +import javax.swing.JPanel; +import java.awt.Dimension; +import java.awt.GridLayout; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2021/9/3 + */ +public class CellRectangleStylePreviewPane extends JPanel { + private static final int ROW_COUNT = 2; + private static final int COLUMN_COUNT = 2; + + private final TemplateCellElement[][] cellElementGrid = new TemplateCellElement[ROW_COUNT][COLUMN_COUNT]; + private final CellStylePreviewPane[][] cellStylePreviewPaneGrid = new CellStylePreviewPane[ROW_COUNT][COLUMN_COUNT]; + + public CellRectangleStylePreviewPane() { + setLayout(new GridLayout(2, 2)); + + for (int r = 0; r < ROW_COUNT; r++) { + for (int c = 0; c < COLUMN_COUNT; c++) { + CellStylePreviewPane pane = new CellStylePreviewPane(); + TemplateCellElement cellElement = DefaultThemedTemplateCellElementCase.createInstance(c, r); + int flags = CellElementBorderSourceFlag.ALL_BORDER_SOURCE_OUTER; + if (r != 0) { + flags |= CellElementBorderSourceFlag.TOP_BORDER_SOURCE_INNER; + } + if (r != ROW_COUNT - 1) { + flags |= CellElementBorderSourceFlag.BOTTOM_BORDER_SOURCE_INNER; + } + if (c != 0) { + flags |= CellElementBorderSourceFlag.LEFT_BORDER_SOURCE_INNER; + } + if (c != COLUMN_COUNT - 1) { + flags |= CellElementBorderSourceFlag.RIGHT_BORDER_SOURCE_INNER; + } + cellElement.setBorderSourceFlags(flags); + + pane.setStyle(cellElement.getStyle()); + add(pane); + + cellElementGrid[r][c] = cellElement; + cellStylePreviewPaneGrid[r][c] = pane; + } + } + } + + public void setPlainText(String text) { + cellStylePreviewPaneGrid[0][1].setPaintText(text); + cellStylePreviewPaneGrid[1][1].setPaintText(text); + repaint(); + } + + public void setStyle(Style style, CellBorderStyle borderStyle) { + for (int i = 0; i < ROW_COUNT; i++) { + for (int j = 0; j < COLUMN_COUNT; j++) { + CellStylePreviewPane pane = cellStylePreviewPaneGrid[i][j]; + TemplateCellElement cellElement = cellElementGrid[i][j]; + cellElement.setStyle(style, borderStyle); + + pane.setStyle(cellElement.getStyle()); + } + } + repaint(); + } + + @Override + public Dimension getMinimumSize() { + return getPreferredSize(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java b/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java index cb6cfc8d5..885d3e8e1 100644 --- a/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java @@ -33,14 +33,21 @@ public class CellStylePreviewPane extends JPanel { transparentBackgroundHeight = transparentBackgroundImage.getHeight(null); } + public void setPaintText(String paintText) { + this.paintText = paintText; + repaint(); + } + public void setStyle(Style style) { this.style = style; - if (style instanceof NameStyle) { - paintText = ((NameStyle) style).getName(); - } repaint(); } + public void setStyle(NameStyle style) { + paintText = style.getName(); + setStyle(style.getRealStyle()); + } + @Override public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; diff --git a/designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java b/designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java index 2e04b6ce5..fe85d5503 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java @@ -4,7 +4,6 @@ package com.fr.design.gui.style; * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. */ -import com.fr.base.BaseUtils; import com.fr.base.CellBorderStyle; import com.fr.base.Style; import com.fr.design.constants.LayoutConstants; @@ -17,14 +16,20 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.style.color.NewColorSelectBox; - +import com.fr.general.IOUtils; import com.fr.stable.Constants; import com.fr.stable.CoreConstants; -import javax.swing.*; +import javax.swing.Icon; +import javax.swing.JPanel; +import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.GridLayout; import java.util.Arrays; import java.util.HashSet; import java.util.Set; @@ -38,7 +43,6 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse private static final String[] BORDERARRAY = {"currentLineCombo", "currentLineColorPane", "outerToggleButton", "topToggleButton", "leftToggleButton", "bottomToggleButton", "rightToggleButton", "innerToggleButton", "horizontalToggleButton", "verticalToggleButton"}; private static final Set BORDER_SET = new HashSet<>(Arrays.asList(BORDERARRAY)); - private boolean insideMode = false; private UIToggleButton topToggleButton; private UIToggleButton horizontalToggleButton; @@ -50,11 +54,8 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse private UIToggleButton innerToggleButton; private UIToggleButton outerToggleButton; - private LineComboBox currentLineCombo; - private NewColorSelectBox currentLineColorPane; - private JPanel panel; - private JPanel borderPanel; - private JPanel backgroundPanel; + protected LineComboBox currentLineCombo; + protected NewColorSelectBox currentLineColorPane; private BackgroundPane backgroundPane; private GlobalNameListener globalNameListener = null; @@ -81,18 +82,18 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse new Component[]{null, null}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Color") + " ", SwingConstants.LEFT), currentLineColorPane}, new Component[]{null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Out_Border") + " ", SwingConstants.LEFT), outerToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("com/fr/design/images/m_format/out.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/out_white.png")}, false)}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Out_Border") + " ", SwingConstants.LEFT), outerToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("com/fr/design/images/m_format/out.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/out_white.png")}, false)}, new Component[]{null, externalPane}, new Component[]{null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_In_Border") + " ", SwingConstants.LEFT), innerToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("com/fr/design/images/m_format/in.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/in_white.png")}, false)}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_In_Border") + " ", SwingConstants.LEFT), innerToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("com/fr/design/images/m_format/in.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/in_white.png")}, false)}, new Component[]{null, insidePane}, new Component[]{null, null} }; double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p}; double[] columnSize = {p, f}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; - panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); - borderPanel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Border"), 280, 24, panel); + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); + JPanel borderPanel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Border"), 280, 24, panel); this.add(borderPanel, BorderLayout.NORTH); UILabel backgroundFillLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Background_Fill")); @@ -102,7 +103,7 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse JPanel backgroundContainPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{backgroundFillLabel, backgroundPane}}, TableLayoutHelper.FILL_LASTCOLUMN, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); - backgroundPanel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), 280, 24, backgroundContainPane); + JPanel backgroundPanel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), 280, 24, backgroundContainPane); this.add(backgroundPanel, BorderLayout.CENTER); initAllNames(); outerToggleButton.addChangeListener(outerToggleButtonChangeListener); @@ -130,12 +131,12 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse }; private void initButtonsWithIcon() { - topToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/top.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/top_white.png")}, false); - leftToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/left.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/left_white.png")}, false); - bottomToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/bottom.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bottom_white.png")}, false); - rightToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/right.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/right_white.png")}, false); - horizontalToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/horizontal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/horizontal_white.png")}, false); - verticalToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/vertical.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/vertical_white.png")}, false); + topToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/top.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/top_white.png")}, false); + leftToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/left.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/left_white.png")}, false); + bottomToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/bottom.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bottom_white.png")}, false); + rightToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/right.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/right_white.png")}, false); + horizontalToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/horizontal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/horizontal_white.png")}, false); + verticalToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/vertical.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/vertical_white.png")}, false); this.currentLineCombo = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY); this.currentLineColorPane = new NewColorSelectBox(100); } @@ -174,15 +175,15 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse cellBorderStyle.setRightStyle(style.getBorderRight()); cellBorderStyle.setRightColor(style.getBorderRightColor()); this.backgroundPane.populateBean(style.getBackground()); - this.populateBean(cellBorderStyle, false, style.getBorderTop(), style.getBorderTopColor()); + this.populateBean(cellBorderStyle, false); } - public void populateBean(CellBorderStyle cellBorderStyle, boolean insideMode, int currentStyle, Color currentColor) { - this.insideMode = insideMode; + public void populateBean(CellBorderStyle cellBorderStyle, boolean insideMode) { + populateBean(cellBorderStyle, insideMode, true); + } - this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getTopStyle() == Constants.LINE_NONE ? Constants.LINE_THIN : cellBorderStyle.getTopStyle()); - this.currentLineColorPane.setSelectObject(cellBorderStyle.getTopColor()); + public void populateBean(CellBorderStyle cellBorderStyle, boolean insideMode, boolean onlyInspectTop) { this.topToggleButton.setSelected(cellBorderStyle.getTopStyle() != Constants.LINE_NONE); this.bottomToggleButton.setSelected(cellBorderStyle.getBottomStyle() != Constants.LINE_NONE); @@ -195,9 +196,39 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse this.innerToggleButton.setSelected(cellBorderStyle.getInnerBorder() != Constants.LINE_NONE); this.outerToggleButton.setSelected(cellBorderStyle.getOuterBorderStyle() != Constants.LINE_NONE); - this.innerToggleButton.setEnabled(this.insideMode); - this.horizontalToggleButton.setEnabled(this.insideMode); - this.verticalToggleButton.setEnabled(this.insideMode); + this.innerToggleButton.setEnabled(insideMode); + this.horizontalToggleButton.setEnabled(insideMode); + this.verticalToggleButton.setEnabled(insideMode); + + populateLineStyleAndColor(cellBorderStyle, onlyInspectTop); + } + + public void populateLineStyleAndColor(CellBorderStyle cellBorderStyle, boolean onlyInspectTop) { + if (cellBorderStyle.getTopStyle() != Constants.LINE_NONE) { + this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getTopStyle()); + this.currentLineColorPane.setSelectObject(cellBorderStyle.getTopColor()); + } else if (!onlyInspectTop) { + if (cellBorderStyle.getBottomStyle() != Constants.LINE_NONE) { + this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getBottomStyle()); + this.currentLineColorPane.setSelectObject(cellBorderStyle.getBottomColor()); + } else if (cellBorderStyle.getLeftStyle() != Constants.LINE_NONE) { + this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getLeftStyle()); + this.currentLineColorPane.setSelectObject(cellBorderStyle.getLeftColor()); + } else if (cellBorderStyle.getRightStyle() != Constants.LINE_NONE) { + this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getRightStyle()); + this.currentLineColorPane.setSelectObject(cellBorderStyle.getRightColor()); + } else if (cellBorderStyle.getVerticalStyle() != Constants.LINE_NONE) { + this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getVerticalStyle()); + this.currentLineColorPane.setSelectObject(cellBorderStyle.getVerticalColor()); + } else if (cellBorderStyle.getHorizontalStyle() != Constants.LINE_NONE) { + this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getHorizontalStyle()); + this.currentLineColorPane.setSelectObject(cellBorderStyle.getHorizontalColor()); + } + } + + if (this.currentLineCombo.getSelectedLineStyle() == Constants.LINE_NONE) { + this.currentLineCombo.setSelectedLineStyle(Constants.LINE_THIN); + } } @Override @@ -213,7 +244,7 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse if (BORDER_SET.contains(globalNameListener.getGlobalName())) { CellBorderStyle cellBorderStyle = this.update(); style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(), - cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor()); + cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor()); } return style; @@ -253,16 +284,8 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse } cellBorderStyle.setHorizontalStyle(horizontalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); - if (leftToggleButton.isSelected() && bottomToggleButton.isSelected() && rightToggleButton.isSelected() && topToggleButton.isSelected()) { - outerToggleButton.setSelected(true); - } else { - outerToggleButton.setSelected(false); - } - if (verticalToggleButton.isSelected() && horizontalToggleButton.isSelected()) { - innerToggleButton.setSelected(true); - } else { - innerToggleButton.setSelected(false); - } + outerToggleButton.setSelected(leftToggleButton.isSelected() && bottomToggleButton.isSelected() && rightToggleButton.isSelected() && topToggleButton.isSelected()); + innerToggleButton.setSelected(verticalToggleButton.isSelected() && horizontalToggleButton.isSelected()); return cellBorderStyle; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedCellStyleListPane.java similarity index 64% rename from designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java rename to designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedCellStyleListPane.java index 78369ba13..53838d1c7 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedCellStyleListPane.java @@ -1,17 +1,15 @@ -package com.fr.design.mainframe.cell.settingpane.style; +package com.fr.design.mainframe.theme; -import com.fr.base.NameStyle; -import com.fr.base.Style; import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.settings.ThemedCellStyle; import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.cell.CellRectangleStylePreviewPane; import com.fr.design.cell.CellStylePreviewPane; 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.general.ComparatorUtils; @@ -30,18 +28,22 @@ import java.awt.Dimension; import java.io.Serializable; import java.util.List; -public class ThemedCellStyleListPane extends FurtherBasicBeanPane implements DesignerBean { +public class ThemedCellStyleListPane extends FurtherBasicBeanPane implements DesignerBean { private static final int LEFT_BORDER = 10; private static final int RIGHT_BORDER = 10; - private final DefaultListModel defaultListModel; - private final JList styleList; + private final DefaultListModel defaultListModel; + private final JList styleList; private ChangeListener changeListener; public ThemedCellStyleListPane() { + this(false); + } + + public ThemedCellStyleListPane(boolean supportCellRange) { defaultListModel = new DefaultListModel<>(); styleList = new JList<>(defaultListModel); - styleList.setCellRenderer(new RadioButtonListCellRenderer()); + styleList.setCellRenderer(supportCellRange ? new RadioButtonListCellRangeRenderer() : new RadioButtonListCellRenderer()); styleList.setOpaque(false); styleList.setBackground(null); styleList.addListSelectionListener(new ListSelectionListener() { @@ -55,15 +57,8 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane imp setLayout(FRGUIPaneFactory.createBorderLayout()); add(styleList, BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder(0 ,LEFT_BORDER, 0, RIGHT_BORDER)); - - DesignerContext.setDesignerBean("predefinedStyle", this); } - /** - * 添加改变监听 - * - * @param changeListener 监听事件 - */ public void addChangeListener(ChangeListener changeListener) { this.changeListener = changeListener; } @@ -77,7 +72,7 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane imp } @Override - public void populateBean(NameStyle ob) { + public void populateBean(ThemedCellStyle ob) { refreshBeanElement(); if (ob == null) { styleList.setSelectedIndex(0); @@ -92,32 +87,21 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane imp } @Override - public NameStyle updateBean() { + public ThemedCellStyle updateBean() { return styleList.getSelectedValue(); } - /** - * 获取面板标题 - * - * @return 标题 - */ + @Override public String title4PopupWindow() { return Toolkit.i18nText("Fine-Design_Report_Predefined_Style"); } - /** - * 是否可以接纳对象 - * - * @param ob 组件对象 - * @return 是否可以接纳对象 - */ + @Override public boolean accept(Object ob) { - return ob instanceof NameStyle; + return ob instanceof ThemedCellStyle; } - /** - * 刷新组件对象 - */ + @Override public void refreshBeanElement() { defaultListModel.removeAllElements(); JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); @@ -125,16 +109,13 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane imp TemplateTheme theme = template.getTemplateTheme(); List styleList = theme.getCellStyleList().getCellStyleList(); for (ThemedCellStyle themedCellStyle: styleList) { - String name = themedCellStyle.getName(); - Style realStyle = themedCellStyle.getStyle(); - NameStyle nameStyle = NameStyle.getPassiveInstance(name, realStyle); - defaultListModel.addElement(nameStyle); + defaultListModel.addElement(themedCellStyle); } } styleList.setModel(defaultListModel); } - private static class RadioButtonListCellRenderer extends JPanel implements ListCellRenderer, Serializable { + private static class RadioButtonListCellRenderer extends JPanel implements ListCellRenderer, Serializable { private final UIRadioButton button; private final CellStylePreviewPane previewArea; @@ -151,9 +132,36 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane imp } @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + public Component getListCellRendererComponent(JList list, ThemedCellStyle value, int index, boolean isSelected, boolean cellHasFocus) { + button.setSelected(isSelected); + previewArea.setPaintText(value.getName()); + previewArea.setStyle(value.getStyle()); + return this; + } + } + + private static class RadioButtonListCellRangeRenderer extends JPanel implements ListCellRenderer, Serializable { + + private final UIRadioButton button; + private final CellRectangleStylePreviewPane previewArea; + + public RadioButtonListCellRangeRenderer() { + super(); + setLayout(new BorderLayout(5, 0)); + setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); + setPreferredSize(new Dimension(getPreferredSize().width, 80)); + button = new UIRadioButton(); + button.setBorder(BorderFactory.createEmptyBorder()); + previewArea = new CellRectangleStylePreviewPane(); + add(button, BorderLayout.WEST); + add(previewArea, BorderLayout.CENTER); + } + + @Override + public Component getListCellRendererComponent(JList list, ThemedCellStyle value, int index, boolean isSelected, boolean cellHasFocus) { button.setSelected(isSelected); - previewArea.setStyle((Style) value); + previewArea.setPlainText(value.getName()); + previewArea.setStyle(value.getStyle(), value.getCellBorderStyle()); return this; } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedFeatureController.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedFeatureController.java new file mode 100644 index 000000000..2e0fc5c38 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedFeatureController.java @@ -0,0 +1,17 @@ +package com.fr.design.mainframe.theme; + +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.theme.SupportThemedCellInnerBorderFeature; +import com.fr.workspace.server.theme.ThemedCellBorderFeature; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2021/11/26 + */ +public class ThemedFeatureController { + public static boolean isCellStyleSupportInnerBorder() { + ThemedCellBorderFeature controller = WorkContext.getCurrent().get(ThemedCellBorderFeature.class); + return controller instanceof SupportThemedCellInnerBorderFeature; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java index 6b12c37d4..ec0d085b9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java @@ -1,9 +1,7 @@ package com.fr.design.mainframe.theme.edit; -import com.fr.base.Style; import com.fr.base.theme.settings.ThemedCellStyle; import com.fr.base.theme.settings.ThemedCellStyleList; -import com.fr.config.predefined.PredefinedCellStyle; import com.fr.design.actions.UpdateAction; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.FineJOptionPane; @@ -122,7 +120,7 @@ public class CellStyleListEditPane extends JListControlPane { } @Override - public BasicBeanPane createPaneByCreators(NameableCreator creator) { + public BasicBeanPane createPaneByCreators(NameableCreator creator) { CellStyleEditPane stylePane = (CellStyleEditPane) super.createPaneByCreators(creator); stylePane.registerAttrChangeListener(attributeChangeListener); return stylePane; @@ -256,23 +254,15 @@ public class CellStyleListEditPane extends JListControlPane { this(CellStyleEditPane.class); } - public CellStyleNameObjectCreator(Class updatePane) { + public CellStyleNameObjectCreator(Class> updatePane) { super(i18nText("Fine-Design_Predefined_Cell_New_Style"), ThemedCellStyle.class, updatePane); } @Override public Nameable createNameable(UnrepeatedNameHelper helper) { - ThemedCellStyle cellStyle = new ThemedCellStyle(); + ThemedCellStyle cellStyle = ThemedCellStyle.createInstanceUsed4New(); cellStyle.setName(menuName); - cellStyle.setStyle(Style.getInstance()); - cellStyle.setRemovable(true); - cellStyle.setUse4Default(false); - cellStyle.setUse4BigTitle(false); - cellStyle.setUse4SmallTitle(false); - cellStyle.setUse4Header(false); - cellStyle.setUse4MainText(false); - cellStyle.setUse4SupportInfo(false); - cellStyle.setUse4HighlightText(false); + return new NameObject(helper.createUnrepeatedName(this.menuName()), cellStyle); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java index b2d182422..39e4394b8 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java @@ -1,7 +1,7 @@ package com.fr.design.mainframe.theme.edit.cell; import com.fr.base.theme.settings.ThemedCellStyle; -import com.fr.design.cell.CellStylePreviewPane; +import com.fr.design.cell.CellRectangleStylePreviewPane; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.AttrScrollPane; import com.fr.design.dialog.BasicPane; @@ -14,6 +14,7 @@ import com.fr.design.gui.style.AlignmentPane; import com.fr.design.gui.style.BorderPane; import com.fr.design.gui.style.TextFontTippedPane; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.theme.ThemedFeatureController; import com.fr.design.mainframe.theme.ui.BorderUtils; import javax.swing.BorderFactory; @@ -35,7 +36,7 @@ import static com.fr.design.i18n.Toolkit.i18nText; */ public class CellStyleEditPane extends MultiTabPane { private ThemedCellStyle cellStyle; - private CellStylePreviewPane previewArea; + private CellRectangleStylePreviewPane previewArea; private boolean populating; private AttributeChangeListener attributeChangeListener; @@ -74,7 +75,11 @@ public class CellStyleEditPane extends MultiTabPane { for (BasicPane basicPane : paneList) { ((AbstractBasicStylePane) basicPane).populateBean(ob.getStyle()); - previewArea.setStyle(ob.getStyle()); + previewArea.setPlainText(ob.getName()); + previewArea.setStyle(ob.getStyle(), ob.getCellBorderStyle()); + if (ThemedFeatureController.isCellStyleSupportInnerBorder() && basicPane instanceof BorderPane) { + ((BorderPane) basicPane).populateBean(ob.getCellBorderStyle(), true, false); + } } this.populating = false; } @@ -83,6 +88,9 @@ public class CellStyleEditPane extends MultiTabPane { public ThemedCellStyle updateBean() { AbstractBasicStylePane basicStylePane = (AbstractBasicStylePane) paneList.get(tabPane.getSelectedIndex()); this.cellStyle.setStyle(basicStylePane.update(this.cellStyle.getStyle())); + if (ThemedFeatureController.isCellStyleSupportInnerBorder() && basicStylePane instanceof BorderPane) { + this.cellStyle.setCellBorderStyle(((BorderPane) basicStylePane).update()); + } return this.cellStyle; } @@ -108,8 +116,8 @@ public class CellStyleEditPane extends MultiTabPane { jPanel.setLayout(new BorderLayout(0, 4)); JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - previewArea = new CellStylePreviewPane(); - previewArea.setPreferredSize(new Dimension(223, 30)); + previewArea = new CellRectangleStylePreviewPane(); + previewArea.setPreferredSize(new Dimension(223, 60)); previewPane.setBorder(BorderUtils.createTitleBorder(i18nText("Fine-Design_Basic_Preview"))); previewPane.add(previewArea, BorderLayout.CENTER); @@ -135,7 +143,8 @@ public class CellStyleEditPane extends MultiTabPane { } ThemedCellStyle cellStyle = updateBean(); if (cellStyle != null) { - previewArea.setStyle(cellStyle.getStyle()); + previewArea.setPlainText(cellStyle.getName()); + previewArea.setStyle(cellStyle.getStyle(), cellStyle.getCellBorderStyle()); } fireAttrChangeListener(); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/BorderAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/BorderAction.java index a23ec781b..596b61157 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/BorderAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/BorderAction.java @@ -3,17 +3,27 @@ */ package com.fr.design.actions.cell; -import javax.swing.JComponent; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - import com.fr.base.BaseUtils; import com.fr.base.CellBorderStyle; +import com.fr.base.NameStyle; +import com.fr.base.Style; import com.fr.design.actions.ElementCaseAction; import com.fr.design.actions.core.ActionFactory; +import com.fr.design.mainframe.ElementCasePane; import com.fr.design.style.BorderUtils; +import com.fr.grid.selection.CellSelection; +import com.fr.grid.selection.FloatSelection; +import com.fr.grid.selection.Selection; +import com.fr.report.cell.CellElementBorderSourceFlag; +import com.fr.report.cell.FloatElement; +import com.fr.report.cell.StyleProvider; +import com.fr.report.cell.TemplateCellElement; +import com.fr.report.elementcase.TemplateElementCase; -import com.fr.design.mainframe.ElementCasePane; +import javax.swing.JComponent; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.Rectangle; /** * Border. @@ -65,7 +75,45 @@ public class BorderAction extends ElementCaseAction implements ChangeListener { return (JComponent) object; } - public boolean update(ElementCasePane elementCasePane) { + public void resetElementStyleToCustom(StyleProvider provider) { + Style style = provider.getStyle(); + if (style instanceof NameStyle) { + style = ((NameStyle) style).getRealStyle(); + } + provider.setStyle(style); + } + + public void resetSelectedElementsStyleToCustom(ElementCasePane elementCasePane) { + Selection selection = elementCasePane.getSelection(); + TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); + if (selection instanceof FloatSelection) { + FloatSelection floatSelection = (FloatSelection) selection; + FloatElement selectedFloatElement = elementCase.getFloatElement(floatSelection.getSelectedFloatName()); + resetElementStyleToCustom(selectedFloatElement); + } else { + CellSelection cellSelection = (CellSelection) selection; + int cellRectangleCount = cellSelection.getCellRectangleCount(); + for (int rect = 0; rect < cellRectangleCount; rect++) { + Rectangle cellRectangle = cellSelection.getCellRectangle(rect); + for (int j = 0; j < cellRectangle.height; j++) { + for (int i = 0; i < cellRectangle.width; i++) { + int column = i + cellRectangle.x; + int row = j + cellRectangle.y; + TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); + if (cellElement != null) { + resetElementStyleToCustom(cellElement); + cellElement.setBorderSourceFlags(CellElementBorderSourceFlag.INVALID_BORDER_SOURCE); + }; + } + } + } + } + } + + + public boolean update(ElementCasePane elementCasePane) { + resetSelectedElementsStyleToCustom(elementCasePane); + if (oldCellBorderStyle.isNoneBorderStyle()) { //无边框格式 return BorderUtils.updateCellBorderStyle(elementCasePane, oldCellBorderStyle); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java index a678c501a..c28c00de5 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java @@ -1,8 +1,10 @@ package com.fr.design.mainframe.cell.settingpane; +import com.fr.base.CellBorderStyle; import com.fr.base.Style; import com.fr.design.actions.utils.ReportActionUtils; import com.fr.design.constants.UIConstants; +import com.fr.design.gui.style.BorderPane; import com.fr.design.mainframe.cell.settingpane.style.StylePane; import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase; import com.fr.design.style.BorderUtils; @@ -70,51 +72,28 @@ public class CellStylePane extends AbstractCellAttrPane { @Override public void updateBeans() { Object[] selectionCellBorderObjects = BorderUtils.createCellBorderObject(elementCasePane); - if (stylePane.getSelectedIndex() == 0) { - Style s = stylePane.updateBean(); - TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); - int cellRectangleCount = cs.getCellRectangleCount(); - for (int rect = 0; rect < cellRectangleCount; rect++) { - Rectangle cellRectangle = cs.getCellRectangle(rect); - for (int j = 0; j < cellRectangle.height; j++) { - for (int i = 0; i < cellRectangle.width; i++) { - int column = i + cellRectangle.x; - int row = j + cellRectangle.y; - TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); - if (cellElement == null) { - cellElement = DefaultThemedTemplateCellElementCase.createInstance(column, row); - elementCase.addCellElement(cellElement); - } - cellElement.setStyle(s); + TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); + int cellRectangleCount = cs.getCellRectangleCount(); + for (int rect = 0; rect < cellRectangleCount; rect++) { + Rectangle cellRectangle = cs.getCellRectangle(rect); + for (int j = 0; j < cellRectangle.height; j++) { + for (int i = 0; i < cellRectangle.width; i++) { + int column = i + cellRectangle.x; + int row = j + cellRectangle.y; + TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); + if (cellElement == null) { + cellElement = DefaultThemedTemplateCellElementCase.createInstance(column, row); + elementCase.addCellElement(cellElement); } + Style style = stylePane.updateBean(); + cellElement.setStyle(style); } } - } else { - TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); - int cellRectangleCount = cs.getCellRectangleCount(); - for (int rect = 0; rect < cellRectangleCount; rect++) { - Rectangle cellRectangle = cs.getCellRectangle(rect); - for (int j = 0; j < cellRectangle.height; j++) { - for (int i = 0; i < cellRectangle.width; i++) { - int column = i + cellRectangle.x; - int row = j + cellRectangle.y; - TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); - if (cellElement == null) { - cellElement = DefaultThemedTemplateCellElementCase.createInstance(column, row); - elementCase.addCellElement(cellElement); - } - Style style = cellElement.getStyle(); - if (style == null) { - style = Style.DEFAULT_STYLE; - - } - style = stylePane.updateStyle(style); - cellElement.setStyle(style); - } - } - } - // border必须特别处理 - stylePane.updateBorder(selectionCellBorderObjects); + } + // border必须特别处理 + CellBorderStyle cellBorderStyle = stylePane.updateBorderStyle(); + if (cellBorderStyle != null) { + BorderUtils.update(elementCasePane, selectionCellBorderObjects, cellBorderStyle); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CellPredefinedStyleSettingPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CellPredefinedStyleSettingPane.java index 4f38c8baa..bc246da8c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CellPredefinedStyleSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CellPredefinedStyleSettingPane.java @@ -3,15 +3,11 @@ package com.fr.design.mainframe.cell.settingpane.style; import com.fr.base.CellBorderStyle; import com.fr.base.NameStyle; import com.fr.base.Style; -import com.fr.config.predefined.PredefinedCellStyle; -import com.fr.config.predefined.PredefinedCellStyleConfig; -import com.fr.config.predefined.PredefinedStyle; import com.fr.design.actions.utils.ReportActionUtils; import com.fr.design.constants.UIConstants; import com.fr.design.designer.IntervalConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.MultiTabPane; -import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.style.AbstractBasicStylePane; @@ -21,25 +17,20 @@ import com.fr.design.gui.style.FormatPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.ElementCasePane; -import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.predefined.ui.PredefinedStyleSettingPane; import com.fr.design.mainframe.predefined.ui.preview.StyleSettingPreviewPane; import com.fr.design.style.BorderUtils; //import com.fr.predefined.PredefinedPatternStyleManager; -import com.fr.stable.Constants; -import com.fr.stable.StringUtils; import com.fr.third.javax.annotation.Nonnull; import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; -import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.GridLayout; import java.util.ArrayList; import java.util.List; -import java.util.Map; /** * Created by kerry on 2020-09-02 @@ -212,11 +203,9 @@ public class CellPredefinedStyleSettingPane extends PredefinedStyleSettingPane { } public void dealWithBorder() { + dealWithBorder(true); + } + + public void dealWithBorder(boolean onlyInspectTop) { if (reportPane == null) { return; } Object[] fourObjectArray = BorderUtils.createCellBorderObject(reportPane); - if (fourObjectArray != null && fourObjectArray.length % LENGTH_FOUR == 0) { + if (fourObjectArray.length % LENGTH_FOUR == 0) { + CellBorderStyle cellBorderStyle = new CellBorderStyle(); + boolean insideMode = true; if (fourObjectArray.length == LENGTH_FOUR) { - ((BorderPane) paneList.get(ONE_INDEX)).populateBean((CellBorderStyle) fourObjectArray[0], ((Boolean) fourObjectArray[1]).booleanValue(), ((Integer) fourObjectArray[2]).intValue(), - (Color) fourObjectArray[THREE_INDEX]); - } else { - ((BorderPane) paneList.get(ONE_INDEX)).populateBean(new CellBorderStyle(), Boolean.TRUE, Constants.LINE_NONE, - (Color) fourObjectArray[THREE_INDEX]); + cellBorderStyle = (CellBorderStyle) fourObjectArray[0]; + insideMode = (Boolean) fourObjectArray[1]; } + + BorderPane borderPane = (BorderPane) paneList.get(ONE_INDEX); + borderPane.populateBean(cellBorderStyle, insideMode, onlyInspectTop); } } @@ -139,11 +143,8 @@ public class CustomStylePane extends MultiTabPane