From 02b4a2b1ff28620dd8b43633e144de16013d1bd2 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 12 Oct 2021 14:12:25 +0800 Subject: [PATCH 1/7] =?UTF-8?q?REPORT-60561=20=E5=85=A8=E5=B1=80=E8=87=AA?= =?UTF-8?q?=E9=80=82=E5=BA=94-=E6=A0=B7=E5=BC=8F=E7=BB=86=E8=8A=82?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/report/fit/BaseFitAttrPane.java | 40 ++++++---- .../fit/menupane/ReportFitAttrAction.java | 23 +----- .../fr/design/actions/FormFitAttrAction.java | 78 ------------------- .../main/java/com/fr/design/fit/NewJForm.java | 13 ++-- .../java/com/fr/design/mainframe/JForm.java | 10 +-- .../fr/design/webattr/ServerFitAttrPane.java | 12 +++ 6 files changed, 50 insertions(+), 126 deletions(-) delete mode 100644 designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java diff --git a/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java b/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java index 940e29cb1..dbf078b68 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java @@ -16,7 +16,6 @@ import com.fr.general.ComparatorUtils; import com.fr.report.fit.ReportFitAttr; import javax.swing.*; -import javax.swing.border.EmptyBorder; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -32,6 +31,7 @@ import static com.fr.design.i18n.Toolkit.i18nText; public abstract class BaseFitAttrPane extends BasicBeanPane { protected JPanel contentJPanel; + protected UILabel belowSetLabel; protected UIComboBox itemChoose; protected java.util.List fitAttrModelList = new ArrayList<>(); @@ -40,6 +40,7 @@ public abstract class BaseFitAttrPane extends BasicBeanPane { public JPanel attrJPanel; public FitPreviewPane previewJPanel; public FitAttrModel fitAttrModel; + private static final int BELOW_SET_COMPONENT_HSPACE = 8; protected BaseFitAttrPane() { @@ -96,7 +97,7 @@ public abstract class BaseFitAttrPane extends BasicBeanPane { } attrJPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - attrJPanel.setBorder(new EmptyBorder(0, 100, 10, 100)); + attrJPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0)); contentJPanel.add(attrJPanel); } @@ -135,9 +136,18 @@ public abstract class BaseFitAttrPane extends BasicBeanPane { protected void initPreviewJPanel() { previewJPanel = new FitPreviewPane(); + previewJPanel.setBorder(BorderFactory.createEmptyBorder(0, getPreviewJPanelLeft(), 0, 0)); contentJPanel.add(previewJPanel); } + private int getPreviewJPanelLeft() { + int left = 0; + if (belowSetLabel.getPreferredSize() != null) { + left = belowSetLabel.getPreferredSize().width + BELOW_SET_COMPONENT_HSPACE; + } + return left; + } + protected int getStateInPC(int index) { FitType[] fitTypes = fitAttrModel.getFitTypes(); return fitTypes[index].getState(); @@ -179,7 +189,7 @@ public abstract class BaseFitAttrPane extends BasicBeanPane { @Override protected String title4PopupWindow() { - return i18nText("Fine-Designer_PC_Element_Case_Fit_Attr"); + return i18nText("Fine-Designer_PC_Fit_Attr"); } protected abstract String[] getItemNames(); @@ -187,29 +197,26 @@ public abstract class BaseFitAttrPane extends BasicBeanPane { protected void initComponents() { this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - contentJPanel = new JPanel(); - contentJPanel.setLayout(FRGUIPaneFactory.createCenterFlowLayout()); + contentJPanel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(false, FlowLayout.LEFT, 0, 0); this.add(contentJPanel); initItemChoose(); + initPrompt(); } private void initItemChoose() { - JPanel chooseJPanel = new JPanel(); - chooseJPanel.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); + JPanel chooseJPanel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); ItemListener itemListener = getItemListener(); itemChoose = new UIComboBox(getItemNames()); itemChoose.addItemListener(itemListener); - UILabel belowSetLabel = new UILabel(i18nText("Fine-Design_Report_Blow_Set")); + belowSetLabel = new UILabel(i18nText("Fine-Design_Report_Blow_Set")); + JPanel hSpaceLabel = new JPanel(); + hSpaceLabel.setSize(BELOW_SET_COMPONENT_HSPACE, 0); JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[]{ - belowSetLabel, itemChoose}, FlowLayout.LEFT, 0, 0); + belowSetLabel, hSpaceLabel, itemChoose}, FlowLayout.LEFT); chooseJPanel.add(buttonPane); - chooseJPanel.setPreferredSize(new Dimension(500, 50)); - JPanel jPanel = new JPanel(); - jPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); - jPanel.add(chooseJPanel, BorderLayout.WEST); - - contentJPanel.add(jPanel); + chooseJPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); + contentJPanel.add(chooseJPanel); } @@ -220,6 +227,9 @@ public abstract class BaseFitAttrPane extends BasicBeanPane { } + protected void initPrompt() { + } + protected void refresh() { validate(); repaint(); diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java index 7f66596a9..99943f7a5 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java @@ -34,22 +34,6 @@ public class ReportFitAttrAction extends JTemplateAction { return null; } }; - private static final MenuKeySet REPORT_FIT_ATTR_ELEMENTCASE = new MenuKeySet() { - @Override - public char getMnemonic() { - return 'T'; - } - - @Override - public String getMenuName() { - return Toolkit.i18nText("Fine-Designer_PC_Element_Case_Fit_Attr"); - } - - @Override - public KeyStroke getKeyStroke() { - return null; - } - }; public ReportFitAttrAction(JTemplate jTemplate) { super(jTemplate); @@ -57,12 +41,7 @@ public class ReportFitAttrAction extends JTemplateAction { } private void initMenuStyle() { - JTemplate jTemplate = getEditingComponent(); - if (jTemplate.isJWorkBook()) { - this.setMenuKeySet(REPORT_FIT_ATTR); - } else { - this.setMenuKeySet(REPORT_FIT_ATTR_ELEMENTCASE); - } + this.setMenuKeySet(REPORT_FIT_ATTR); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon("/com/fr/design/images/reportfit/fit"); diff --git a/designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java b/designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java deleted file mode 100644 index 30f8b3c60..000000000 --- a/designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.fr.design.actions; - -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.dialog.UIDialog; -import com.fr.design.fit.DesignerUIModeConfig; -import com.fr.design.fit.NewJForm; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.JTemplate; -import com.fr.design.menu.MenuKeySet; -import com.fr.design.report.fit.menupane.TemplateFitAttrPane; -import com.fr.report.fit.FitProvider; -import com.fr.report.fit.ReportFitAttr; - -import javax.swing.KeyStroke; -import java.awt.event.ActionEvent; - -/** - * Created by Administrator on 2015/7/6 0006. - */ -public class FormFitAttrAction extends JTemplateAction { - private static final MenuKeySet REPORT_FIT_ATTR_ELEMENTCASE = new MenuKeySet() { - @Override - public char getMnemonic() { - return 'T'; - } - - @Override - public String getMenuName() { - return DesignerUIModeConfig.getInstance().newUIMode() ? - com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_PC_Adaptive_Attr") : - com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_PC_Element_Case_Fit_Attr"); - } - - @Override - public KeyStroke getKeyStroke() { - return null; - } - }; - - public FormFitAttrAction(JTemplate jTemplate) { - super(jTemplate); - initMenuStyle(); - } - - private void initMenuStyle() { - this.setMenuKeySet(REPORT_FIT_ATTR_ELEMENTCASE); - this.setName(getMenuKeySet().getMenuKeySetName() + "..."); - this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(DesignerUIModeConfig.getInstance().newUIMode() ? - "/com/fr/design/images/reportfit/fit.png" : - "/com/fr/design/images/reportfit/fit"); - } - - @Override - public void actionPerformed(ActionEvent e) { - final JTemplate jwb = getEditingComponent(); - if (jwb == null) { - return; - } - final FitProvider wbTpl = (FitProvider) jwb.getTarget(); - ReportFitAttr fitAttr = wbTpl.getReportFitAttr(); - TemplateFitAttrPane templateFitAttrPane = new TemplateFitAttrPane(); - showFitDialog(fitAttr, jwb, wbTpl, templateFitAttrPane); - } - - private void showFitDialog(ReportFitAttr fitAttr, final JTemplate jwb, final FitProvider wbTpl, final BasicBeanPane attrPane) { - attrPane.populateBean(fitAttr); - UIDialog dialog = attrPane.showMediumWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { - @Override - public void doOk() { - wbTpl.setReportFitAttr(attrPane.updateBean()); - jwb.fireTargetModified(); - } - }); - dialog.setVisible(true); - } -} diff --git a/designer-form/src/main/java/com/fr/design/fit/NewJForm.java b/designer-form/src/main/java/com/fr/design/fit/NewJForm.java index fe192b59b..e058d2a65 100644 --- a/designer-form/src/main/java/com/fr/design/fit/NewJForm.java +++ b/designer-form/src/main/java/com/fr/design/fit/NewJForm.java @@ -2,6 +2,7 @@ package com.fr.design.fit; import com.fr.base.DynamicUnitList; import com.fr.base.Parameter; +import com.fr.design.actions.FormMobileAttrAction; import com.fr.design.actions.TemplateParameterAction; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.LayoutAdapter; @@ -13,7 +14,6 @@ import com.fr.design.fit.common.AdaptiveSwitchUtil; import com.fr.design.fit.common.LayoutTool; import com.fr.form.fit.NewFormMarkAttr; import com.fr.design.fit.common.TemplateTool; -import com.fr.design.actions.FormFitAttrAction; import com.fr.design.actions.NewFormMobileAttrAction; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.preview.DeveloperPreview; @@ -86,7 +86,7 @@ public class NewJForm extends JForm { Rectangle rectangle = LayoutTool.getAbsoluteBodySize(this); if (!isNewJFrom() && (rectangle.width != bodyWidth || rectangle.height != bodyHeight)) { TemplateTool.onlyChangeAbsoluteBodySize(bodyHeight, bodyWidth, this); - } else if(isNewJFrom()){ + } else if (isNewJFrom()) { if (rectangle.width > bodyWidth && rectangle.height > bodyHeight) { TemplateTool.onlyChangeAbsoluteBodySize(rectangle.height, rectangle.width, this); } else if (rectangle.width > bodyWidth) { @@ -123,9 +123,9 @@ public class NewJForm extends JForm { @Override public ShortCut[] shortcut4TemplateMenu() { if (this.index == FORM_TAB) { - return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new NewFormMobileAttrAction(this), new FormFitAttrAction(this)}, new ShortCut[0]); + return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new NewFormMobileAttrAction(this), getReportFitAttrAction()}, new ShortCut[0]); } else { - return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new NewFormMobileAttrAction(this), new FormFitAttrAction(this)}, this.getElementCaseDesign().shortcut4TemplateMenu()); + return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new NewFormMobileAttrAction(this), getReportFitAttrAction()}, this.getElementCaseDesign().shortcut4TemplateMenu()); } } @@ -177,7 +177,8 @@ public class NewJForm extends JForm { private void processColumnAbsorbingEffect(XWTitleLayout xwTitleLayout, DynamicUnitList columnUnitList, Dimension bound) { int temp = 0; - int resolution = DesignerUIModeConfig.getInstance().getScreenResolution();; + int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); + ; int difference = 0; int i = 0; while (true) { @@ -201,7 +202,7 @@ public class NewJForm extends JForm { private void processRowAbsorbingEffect(XWTitleLayout xwTitleLayout, DynamicUnitList rowUnitList, Dimension bound) { int temp = hasTitle(xwTitleLayout) ? TITLE_HEIGHT : 0; - int resolution =DesignerUIModeConfig.getInstance().getScreenResolution(); + int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); int difference = 0; int i = 0; while (true) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 784a3b690..955c9c2ef 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -598,7 +598,7 @@ public class JForm extends JTemplate implements BaseJForm implements BaseJForm implements BaseJForm Date: Tue, 12 Oct 2021 14:15:51 +0800 Subject: [PATCH 2/7] =?UTF-8?q?REPORT-60561=20=E5=85=A8=E5=B1=80=E8=87=AA?= =?UTF-8?q?=E9=80=82=E5=BA=94-=E6=A0=B7=E5=BC=8F=E7=BB=86=E8=8A=82?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-form/src/main/java/com/fr/design/fit/NewJForm.java | 2 -- .../main/java/com/fr/design/webattr/ServerFitAttrPane.java | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/fit/NewJForm.java b/designer-form/src/main/java/com/fr/design/fit/NewJForm.java index e058d2a65..736e55bc6 100644 --- a/designer-form/src/main/java/com/fr/design/fit/NewJForm.java +++ b/designer-form/src/main/java/com/fr/design/fit/NewJForm.java @@ -2,7 +2,6 @@ package com.fr.design.fit; import com.fr.base.DynamicUnitList; import com.fr.base.Parameter; -import com.fr.design.actions.FormMobileAttrAction; import com.fr.design.actions.TemplateParameterAction; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.LayoutAdapter; @@ -178,7 +177,6 @@ public class NewJForm extends JForm { private void processColumnAbsorbingEffect(XWTitleLayout xwTitleLayout, DynamicUnitList columnUnitList, Dimension bound) { int temp = 0; int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); - ; int difference = 0; int i = 0; while (true) { diff --git a/designer-realize/src/main/java/com/fr/design/webattr/ServerFitAttrPane.java b/designer-realize/src/main/java/com/fr/design/webattr/ServerFitAttrPane.java index 48b2a88eb..059d9ad64 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/ServerFitAttrPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/ServerFitAttrPane.java @@ -3,7 +3,6 @@ package com.fr.design.webattr; import com.fr.config.Configuration; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.report.fit.BaseFitAttrPane; import com.fr.design.report.fit.FitAttrModel; import com.fr.general.ComparatorUtils; @@ -12,8 +11,7 @@ import com.fr.report.fit.ReportFitConfig; import com.fr.transaction.Configurations; import com.fr.transaction.Worker; -import javax.swing.*; -import java.awt.*; +import java.awt.Color; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; From 4da64a9955c6bd78dc2bac0404cfb7088e7556cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Tue, 12 Oct 2021 23:32:29 +0800 Subject: [PATCH 3/7] REPORT-58012 --- .../design/data/DesignTableDataManager.java | 40 +++++++++---------- .../com/fr/design/data/NameChangeBean.java | 27 +++++++++++++ 2 files changed, 47 insertions(+), 20 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/data/NameChangeBean.java diff --git a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java index ab86a0d6f..f7eb9bacc 100644 --- a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java +++ b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java @@ -47,9 +47,11 @@ import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; @@ -71,8 +73,8 @@ public abstract class DesignTableDataManager { * 其实globalDsCache没有绝对的必要,只是为了操作方便。如果没有它,那么每次清空服务器数据集或者存储过程的时候,还要去遍历找一下, * 这个操作可能比较复杂 。 从减少代码复杂度的角度看,还是很有必要的 */ - private static java.util.Map globalDsCache = new java.util.HashMap(); - private static java.util.Map dsNameChangedMap = new HashMap(); + private static Map globalDsCache = new java.util.HashMap(); + private static Set dsNameChangedSet = new LinkedHashSet<>(); private static List globalDsListeners = new ArrayList<>(); private static Map> dsListenersMap = new ConcurrentHashMap<>(); @@ -123,7 +125,7 @@ public abstract class DesignTableDataManager { public static void envChange() { columnCache.clear(); dsListenersMap.clear(); - dsNameChangedMap.clear(); + dsNameChangedSet.clear(); clearGlobalDs(); } @@ -136,17 +138,17 @@ public abstract class DesignTableDataManager { public static void fireDSChanged(Map dsNameChangedMap) { clearGlobalDs(); if (!dsNameChangedMap.isEmpty()) { - setDsNameChangedMap(dsNameChangedMap); + setDsNameChangedSet(dsNameChangedMap); } fireDsChanged(); dsNameChangedMap.clear(); } - private static void setDsNameChangedMap(Map map) { + private static void setDsNameChangedSet(Map map) { Iterator iterator = map.keySet().iterator(); while (iterator.hasNext()) { String key = (String) iterator.next(); - dsNameChangedMap.put(key, map.get(key)); + dsNameChangedSet.add(new NameChangeBean(key, map.get(key))); } } @@ -157,23 +159,21 @@ public abstract class DesignTableDataManager { * @return 是则返回true */ public static boolean isDsNameChanged(String oldDsName) { - return dsNameChangedMap.containsKey(oldDsName); - } - - public static String getChangedDsNameByOldDsName(String oldDsName) { - String changeName; - - if (isDsNameChanged(oldDsName)) { - changeName = dsNameChangedMap.get(oldDsName); - } else { - changeName = StringUtils.EMPTY; + for (NameChangeBean bean : dsNameChangedSet) { + if (ComparatorUtils.equals(oldDsName, bean.getOldName())) { + return true; + } } + return false; + } - if (StringUtils.isNotEmpty(changeName)) { - return getChangedDsNameByOldDsName(changeName); - } else { - return oldDsName; + public static String getChangedDsNameByOldDsName(String dsName) { + for (NameChangeBean bean : dsNameChangedSet) { + if (ComparatorUtils.equals(dsName, bean.getOldName())) { + dsName = bean.getChangedName(); + } } + return dsName; } public static void addGlobalDsChangeListener(ChangeListener l) { diff --git a/designer-base/src/main/java/com/fr/design/data/NameChangeBean.java b/designer-base/src/main/java/com/fr/design/data/NameChangeBean.java new file mode 100644 index 000000000..2d4caf44e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/data/NameChangeBean.java @@ -0,0 +1,27 @@ +package com.fr.design.data; + +public class NameChangeBean { + private String oldName; + private String changedName; + + public NameChangeBean(String oldName, String changedName) { + this.oldName = oldName; + this.changedName = changedName; + } + + public String getOldName() { + return oldName; + } + + public void setOldName(String oldName) { + this.oldName = oldName; + } + + public String getChangedName() { + return changedName; + } + + public void setChangedName(String changedName) { + this.changedName = changedName; + } +} From fe948e7d4982468e576f13b312bf907e006b9de9 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Wed, 13 Oct 2021 10:05:55 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=EF=BC=8C=20?= =?UTF-8?q?feature/x=20=E5=90=88=20release/11.0=20=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/actions/FormFitAttrAction.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java diff --git a/designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java b/designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java deleted file mode 100644 index e69de29bb..000000000 From 181acfb3c0dcabc9cbd3e43564a531014de0b5aa Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 12 Oct 2021 17:45:11 +0800 Subject: [PATCH 5/7] =?UTF-8?q?REPORT-59089=20=E3=80=90=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E3=80=91=E4=B8=BB=E9=A2=98=E6=AF=94=E8=BE=83?= =?UTF-8?q?=E5=A4=9A=E6=9C=89=E6=BB=9A=E5=8A=A8=E6=9D=A1=EF=BC=8C=E5=8F=B3?= =?UTF-8?q?=E4=BE=A7=E4=B8=BB=E9=A2=98=E7=9A=84=E5=8B=BE=E9=80=89=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E6=9C=89=E7=82=B9=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 调整下宽度和主题列表实现 【改动思路】 同上 --- .../mainframe/theme/TemplateThemeGridControlPane.java | 4 ++-- .../mainframe/theme/TemplateThemeGridPagesPane.java | 5 ----- .../fr/design/mainframe/theme/TemplateThemeGridPane.java | 9 ++++++++- .../theme/dialog/TemplateThemeGridPagesDialog.java | 4 +--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridControlPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridControlPane.java index 6e04cb06f..f721923e9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridControlPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridControlPane.java @@ -52,7 +52,7 @@ import static com.fr.design.i18n.Toolkit.i18nText; * Created by Starryi on 2021/8/13 */ public class TemplateThemeGridControlPane extends BasicPane { - public static final int CONTENT_WIDTH = TemplateThemeGridPane.CONTENT_WIDTH + 10; + public static final int CONTENT_WIDTH = TemplateThemeGridPane.CONTENT_WIDTH + 20; public static final int CONTENT_HEIGHT = TemplateThemeGridPane.CONTENT_HEIGHT + 37; private final RemoveThemeAction removeAction; private final UIButton setTheme4NewTemplateButton; @@ -92,7 +92,7 @@ public class TemplateThemeGridControlPane extends Basic private void initializePane() { setLayout(FRGUIPaneFactory.createBorderLayout()); - setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); + setBorder(BorderFactory.createEmptyBorder(5, 10, 0, 10)); setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT)); add(createActionsContainer(), BorderLayout.NORTH); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java index 855e2bf78..fa8207696 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java @@ -34,7 +34,6 @@ import java.awt.CardLayout; import java.awt.Color; import java.awt.Component; import java.awt.Container; -import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; @@ -286,16 +285,12 @@ public class TemplateThemeGridPagesPane extends JPanel { } public static class TemplateThemeManagingPane extends TemplateThemeGridPagePane { - public static final int CONTENT_WIDTH = TemplateThemeGridControlPane.CONTENT_WIDTH + 4; - public static final int CONTENT_HEIGHT = TemplateThemeGridControlPane.CONTENT_HEIGHT + 10; - private final UITabbedPane tabbedPane; private final TemplateThemeGridControlPane formThemesManagerPane; private final TemplateThemeGridControlPane reportThemesManagerPane; public TemplateThemeManagingPane() { setLayout(FRGUIPaneFactory.createBorderLayout()); - setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT)); tabbedPane = new UITabbedPane(); add(tabbedPane, BorderLayout.CENTER); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPane.java index 3b9cb7bdc..2af4950f5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPane.java @@ -8,6 +8,8 @@ import com.fr.design.event.ChangeEvent; import com.fr.design.event.ChangeListener; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.widget.FRWidgetFactory; +import com.fr.design.widget.WidgetBoundsPaneFactory; import com.fr.stable.StringUtils; import javax.swing.BorderFactory; @@ -68,7 +70,12 @@ public class TemplateThemeGridPane extends BasicPane { contentListPane.setLayout(new GridLayout(0, BLOCK_COUNT_ROW_LINE, BLOCK_GAP, BLOCK_GAP)); fillContentListPane(); - UIScrollPane scrollPane = new UIScrollPane(contentListPane); + JPanel wrapper1 = FRGUIPaneFactory.createBorderLayout_S_Pane(); + wrapper1.add(contentListPane, BorderLayout.NORTH); + JPanel wrapper2 = FRGUIPaneFactory.createBorderLayout_S_Pane(); + wrapper2.add(wrapper1, BorderLayout.WEST); + + UIScrollPane scrollPane = new UIScrollPane(wrapper2); scrollPane.setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT)); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java index 9711e8e8a..917f078d5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java @@ -1,7 +1,5 @@ package com.fr.design.mainframe.theme.dialog; -import com.fr.base.theme.TemplateTheme; -import com.fr.base.theme.TemplateThemeConfig; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; @@ -16,7 +14,7 @@ import javax.swing.JPanel; * Created by Starryi on 2021/8/13 */ public class TemplateThemeGridPagesDialog extends TemplateThemeDialog implements TemplateThemeGridPagesPane.PageChangeListener { - public static final int CONTENT_WIDTH = TemplateThemeGridPane.CONTENT_WIDTH + 40; + public static final int CONTENT_WIDTH = TemplateThemeGridPane.CONTENT_WIDTH + 48; public static final int CONTENT_HEIGHT = TemplateThemeGridPane.CONTENT_HEIGHT + 37; protected TemplateThemeGridPagesPane overallPane; From 844e1790406f2af2028b8f7d33cd8e60dc2f65d6 Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 13 Oct 2021 17:07:45 +0800 Subject: [PATCH 6/7] =?UTF-8?q?REPORT-60812=20=E3=80=90=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E3=80=91=E4=B8=BB=E9=A2=98=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E7=9A=84=E6=A1=86=E6=A1=86=E6=98=BE=E7=A4=BA=E6=9C=89=E7=82=B9?= =?UTF-8?q?=E5=87=BA=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 调整设计器Tab组件边框颜色 【改动思路】 同上 --- .../fr/design/gui/frpane/UITabbedPane.java | 12 +++++++++++ .../fr/design/gui/frpane/UITabbedPaneUI.java | 21 ++++++++++++++----- .../theme/TemplateThemeGridPagesPane.java | 1 + 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java index c1021321b..fd2fcc375 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java @@ -21,6 +21,8 @@ public class UITabbedPane extends JTabbedPane{ private String classPath; //panel对象的类名 private String tabName; //Tab名称 private int tabSize = 0; + private Color tabBorderColor; + public UITabbedPane() { super(); } @@ -93,6 +95,16 @@ public class UITabbedPane extends JTabbedPane{ public int getTabSize(){ return tabSize; } + + public Color getTabBorderColor() { + return tabBorderColor; + } + + public void setTabBorderColor(Color tabBorderColor) { + this.tabBorderColor = tabBorderColor; + repaint(); + } + @Override /** * 获取UI对象 diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java b/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java index 5798a864b..d31107c2c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java @@ -31,9 +31,20 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI { private int addX = -1; private int addY = -1; private int rollover = -1; - private Color tabBorderColor = new Color(143, 160, 183); + private final Color DEFAULT_TAB_BORDER_COLOR = new Color(143, 160, 183); private Color[] tabSelectedColor = {UIConstants.NORMAL_BLUE, UIConstants.NORMAL_BLUE, UIConstants.NORMAL_BLUE}; + public Color getTabBorderColor() { + Color color = null; + if (tabPane instanceof UITabbedPane) { + color = ((UITabbedPane) tabPane).getTabBorderColor(); + } + if (color == null) { + color = DEFAULT_TAB_BORDER_COLOR; + } + return color; + } + /** * 创建UI对象 * @@ -252,9 +263,9 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI { private void drawUITabBorder(Graphics g, int tabPlacement, int x, int y, int w, int h, boolean isSelected, boolean isEnabled, boolean isRollover) { if (!isEnabled) { - drawUITabBorder(g, tabBorderColor, x, y, w, h, tabPlacement); + drawUITabBorder(g, getTabBorderColor(), x, y, w, h, tabPlacement); } else if (isSelected || isRollover) { - drawSelectedUITabBorder(g, tabBorderColor, x, y, w, h, tabPlacement); + drawSelectedUITabBorder(g, getTabBorderColor(), x, y, w, h, tabPlacement); if (isRollover && canClose()) { closeX = x + w - closeIcon.getIconWidth() - 3; closeY = 0; @@ -269,7 +280,7 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI { closeIcon.paintIcon(tabPane, g, closeX, closeY); } } else { - drawUITabBorder(g, tabBorderColor, x, y, w, h, tabPlacement); + drawUITabBorder(g, getTabBorderColor(), x, y, w, h, tabPlacement); } } @@ -322,7 +333,7 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI { } private void drawUIContentBorder(Graphics g, int x, int y, int w, int h) { - g.setColor(tabBorderColor); + g.setColor(getTabBorderColor()); g.drawRect(x, y, w - 3, h - 3); // Shadow g.setColor(new Color(204, 204, 204)); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java index fa8207696..40838dbd8 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java @@ -293,6 +293,7 @@ public class TemplateThemeGridPagesPane extends JPanel { setLayout(FRGUIPaneFactory.createBorderLayout()); tabbedPane = new UITabbedPane(); + tabbedPane.setTabBorderColor(new Color(0xE0E0E1)); add(tabbedPane, BorderLayout.CENTER); formThemesManagerPane = TemplateThemeGridControlPane.createFormThemesManagerPane(); From cfca5143a51e766d3f2e333d38ae462698bb6370 Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 13 Oct 2021 10:10:48 +0800 Subject: [PATCH 7/7] =?UTF-8?q?REPORT-60717=20=E3=80=90=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E3=80=91=E8=AE=BE=E7=BD=AE=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=86=85=E8=BE=B9=E8=B7=9D=E5=90=8E=E8=BE=B9=E6=A1=86=E7=BA=BF?= =?UTF-8?q?=E6=98=BE=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 【问题原因】 报表块/图表块内边距优化后,标题和body的分界线左右两侧 也出现了边距,分界线需要向外扩展 【改动思路】 同上 --- .../theme/preview/ComponentPreviewPane.java | 57 ++++++++++--------- .../creator/XBorderStyleWidgetCreator.java | 33 +---------- .../designer/creator/XWTitleLayout.java | 33 +++++++++++ 3 files changed, 65 insertions(+), 58 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java index 20e418960..cfd2781aa 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java @@ -90,6 +90,37 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th } + @Override + protected void paintBorder(Graphics g) { + super.paintBorder(g); + + paintSeparator((Graphics2D) g); + } + + private void paintSeparator(Graphics2D g2d) { + Border border = getBorder(); + if (border instanceof LineBorder && titlePane != null) { + Border containerBorder = container.getBorder(); + Insets insets = containerBorder.getBorderInsets(container); + int y = titlePane.getHeight() + insets.top; + + Color oldColor = g2d.getColor(); + Stroke oldStroke = g2d.getStroke(); + + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + Color lineColor = ((LineBorder) border).getLineColor(); + int thickness = ((LineBorder) border).getThickness(); + g2d.setColor(lineColor); + g2d.setStroke(new BasicStroke(thickness * 2)); + g2d.drawLine(0, y, getWidth(), y); + + g2d.setStroke(oldStroke); + g2d.setColor(oldColor); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); + } + } + @Override public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; @@ -144,7 +175,6 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th data.setInsetImagePadding(titlePacker.getInsetImagePadding()); data.setInsetRelativeTextLeft(titlePacker.isInsetRelativeTextLeft()); data.setInsetRelativeTextRight(titlePacker.isInsetRelativeTextRight()); - this.setBorder(new BottomLineBorder(componentStyle.getStyle().getColor(), componentStyle.getStyle().getBorder())); } public Label getData(){ @@ -172,31 +202,6 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th } - public static class BottomLineBorder extends LineBorder { - - private BottomLineBorder(Color color, int thickness) { - super(color, thickness); - } - - @Override - public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { - Graphics2D g2d = (Graphics2D) g; - - Color oldColor = g2d.getColor(); - Stroke oldStroke = g2d.getStroke(); - - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - - g2d.setColor(getLineColor()); - g2d.setStroke(new BasicStroke(getThickness() * 2)); - g2d.drawLine(0, height, width, height); - - g2d.setStroke(oldStroke); - g2d.setColor(oldColor); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); - } - } - private static class Utils { private static void paintBackground(Graphics2D g2d, Background background, Shape shape, float opacity) { diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java index 60434f2cb..f99864c62 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java @@ -273,12 +273,7 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ parentCreator.setBorder(border); // 容器绘制完整边框 bodyCreator.setBorder(BorderFactory.createEmptyBorder()); // body不绘制边框 - titleCreator.setBorder(BorderFactory.createEmptyBorder()); // title绘制底部边框 - if (border instanceof LineBorder) { - Color color = ((LineBorder) border).getLineColor(); - int thickness = ((LineBorder) border).getThickness(); - titleCreator.setBorder(new BottomLineBorder(color, thickness)); - } + titleCreator.setBorder(BorderFactory.createEmptyBorder()); // title不绘制边框 if (bodyCreator instanceof XBorderStyleWidgetCreator) { XBorderStyleWidgetCreator styledBodyXCreator = (XBorderStyleWidgetCreator) bodyCreator; @@ -407,32 +402,6 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ } - // 适用于标题栏的底部边框 - public static class BottomLineBorder extends LineBorder { - - private BottomLineBorder(Color color, int thickness) { - super(color, thickness); - } - - @Override - public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { - Graphics2D g2d = (Graphics2D)g; - - Color oldColor = g2d.getColor(); - Stroke oldStroke = g2d.getStroke(); - - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - - g2d.setColor(getLineColor()); - g2d.setStroke(new BasicStroke(getThickness() * 2)); - g2d.drawLine(0, height, width, height); - - g2d.setStroke(oldStroke); - g2d.setColor(oldColor); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); - } - } - public static class NoBackgroundPaneUI extends BasicPanelUI { @Override public void update(Graphics g, JComponent c) { diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java index 7655095b1..d4757c184 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java @@ -15,6 +15,8 @@ import com.fr.form.ui.container.WTitleLayout; import com.fr.general.Background; import com.fr.general.ComparatorUtils; +import javax.swing.border.Border; +import javax.swing.border.LineBorder; import java.awt.*; import java.awt.event.ContainerEvent; import java.awt.geom.Rectangle2D; @@ -187,6 +189,37 @@ public class XWTitleLayout extends DedicateLayoutContainer { } + @Override + protected void paintBorder(Graphics g) { + super.paintBorder(g); + paintSeparator((Graphics2D) g); + } + + private void paintSeparator(Graphics2D g2d) { + Border border = getBorder(); + XCreator titleCreator = getTitleCreator(); + if (border instanceof LineBorder && titleCreator != null) { + int height = titleCreator.getHeight(); + Insets paddingInsets = getInsets(); + int y = height + paddingInsets.top; + + Color oldColor = g2d.getColor(); + Stroke oldStroke = g2d.getStroke(); + + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + Color lineColor = ((LineBorder) border).getLineColor(); + int thickness = ((LineBorder) border).getThickness(); + g2d.setColor(lineColor); + g2d.setStroke(new BasicStroke(thickness * 2)); + g2d.drawLine(0, y, getWidth(), y); + + g2d.setStroke(oldStroke); + g2d.setColor(oldColor); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); + } + } + @Override public void paintBackground(Graphics2D g2d) { if (getComponentCount() > 1) {