From b0436d5a819a8b2063ff32ed6b0d82fb69939d01 Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Wed, 7 Jul 2021 16:36:20 +0800 Subject: [PATCH 01/12] =?UTF-8?q?REPORT-53949=20UISpinner=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=84=A6=E7=82=B9=E5=90=8E=E6=89=8D=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E8=B0=83=E6=95=B4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/gui/ispinner/UISpinner.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java b/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java index 454b1e5b99..9d10da3a72 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java +++ b/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java @@ -58,6 +58,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver * Spinner内的数字文本框长度 */ private int numberFieldColumns; + private boolean hasTextFieldFocus = false; public UISpinner() { @@ -318,7 +319,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver @Override public void mouseWheelMoved(MouseWheelEvent e) { - if (isEnabled() && e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) { + if (hasTextFieldFocus && isEnabled() && e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) { setValue(value - e.getWheelRotation()); } } @@ -330,8 +331,14 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver textField.getDocument().removeDocumentListener(docListener); textField.getDocument().addDocumentListener(docListener); textField.addFocusListener(new FocusAdapter() { + @Override + public void focusGained(FocusEvent e) { + hasTextFieldFocus = true; + } + @Override public void focusLost(FocusEvent e) { + hasTextFieldFocus = false; textField.getDocument().removeDocumentListener(docListener); textField.setValue(value); textField.getDocument().addDocumentListener(docListener); From f788999a9ce31db7187999f81d88eefa145eb5a6 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Thu, 8 Jul 2021 10:25:07 +0800 Subject: [PATCH 02/12] =?UTF-8?q?REPORT-54392=20=E9=87=8A=E6=94=BE?= =?UTF-8?q?=E6=9C=80=E8=BF=91=E6=89=93=E5=BC=80=E8=A1=A8=E5=8D=95=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=E5=86=85=E5=AD=98=E5=AE=9E=E7=8E=B0=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/file/Releasable.java | 5 -- .../design/designer/creator/XElementCase.java | 8 +++- .../gui/controlpane/EventPropertyPane.java | 9 +--- .../design/mainframe/FormParaWidgetPane.java | 12 +---- .../mainframe/FormWidgetDetailPane.java | 8 +--- .../java/com/fr/design/mainframe/JForm.java | 48 ++++++++++++++----- .../design/mainframe/WidgetPropertyPane.java | 28 +---------- .../fr/design/mainframe/XCreateGather.java | 7 +++ .../widget/ui/FormWidgetCardPane.java | 15 +----- 9 files changed, 55 insertions(+), 85 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/file/Releasable.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/XCreateGather.java diff --git a/designer-base/src/main/java/com/fr/design/file/Releasable.java b/designer-base/src/main/java/com/fr/design/file/Releasable.java deleted file mode 100644 index cb78789e6f..0000000000 --- a/designer-base/src/main/java/com/fr/design/file/Releasable.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.fr.design.file; - -public interface Releasable { - void releaseResources(); -} diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java index 4729be0b5b..7ed22c52dd 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java @@ -1,6 +1,7 @@ package com.fr.design.designer.creator; import com.fr.base.BaseUtils; +import com.fr.base.Releasable; import com.fr.design.ExtraDesignClassManager; import com.fr.design.designer.properties.mobile.ElementCasePropertyUI; import com.fr.design.form.util.XCreatorConstants; @@ -32,7 +33,7 @@ import java.beans.IntrospectionException; import java.beans.PropertyDescriptor; import java.util.Set; -public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider { +public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider , Releasable { private UILabel imageLable; private FormDesigner designer; private static BufferedImage DEFAULT_BACKGROUND; @@ -352,4 +353,9 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme public boolean isSupportShared() { return true; } + + @Override + public void releaseResources() { + imageLable.setIcon(null); + } } diff --git a/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java b/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java index 834b6b4a87..2a67f61ae4 100644 --- a/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java @@ -2,7 +2,6 @@ package com.fr.design.gui.controlpane; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.properties.EventPropertyTable; -import com.fr.design.file.Releasable; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.FormDesigner; import com.fr.design.widget.EventCreator; @@ -14,7 +13,7 @@ import com.fr.stable.Nameable; /** * Created by kerry on 5/17/21 */ -public class EventPropertyPane extends UIListGroupControlPane implements Releasable { +public class EventPropertyPane extends UIListGroupControlPane { private XCreator creator; private FormDesigner designer; @@ -25,12 +24,6 @@ public class EventPropertyPane extends UIListGroupControlPane implements Releasa this.designer = designer; } - @Override - public void releaseResources() { - creator = null; - designer = null; - this.removeAll(); - } /** * 刷新 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 d8b604e195..b8f3ff6380 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,7 +7,6 @@ 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.Releasable; import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.gui.core.FormWidgetOption; import com.fr.design.gui.core.UserDefinedWidgetOption; @@ -57,7 +56,7 @@ import java.awt.event.MouseEvent; /** * @author null */ -public class FormParaWidgetPane extends JPanel implements Releasable { +public class FormParaWidgetPane extends JPanel { private static FormParaWidgetPane THIS; private final static int BORDER = 5; private final static int WIDGET_WIDTHGAP = 4; @@ -120,15 +119,6 @@ public class FormParaWidgetPane extends JPanel implements Releasable { return THIS; } - public static FormParaWidgetPane getInstance(){ - return THIS; - } - - @Override - public void releaseResources() { - designer = null; - } - public FormParaWidgetPane() { setLayout(new FlowLayout(FlowLayout.LEFT)); DesignerContext.getDesignerFrame().getCenterTemplateCardPane().addComponentListener(new ComponentAdapter() { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index 60a63a0cc5..d792f0eca2 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -2,7 +2,6 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.design.dialog.BasicPane; -import com.fr.design.file.Releasable; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; @@ -31,7 +30,7 @@ import java.util.List; * Date: 14-7-8 * Time: 下午8:18 */ -public class FormWidgetDetailPane extends FormDockView implements Releasable { +public class FormWidgetDetailPane extends FormDockView{ private static final int ONLINE_TAB = 1; private JPanel centerPane; @@ -62,11 +61,6 @@ public class FormWidgetDetailPane extends FormDockView implements Releasable { private static FormWidgetDetailPane singleton = new FormWidgetDetailPane(); } - @Override - public void releaseResources() { - setEditingFormDesigner(null); - } - public String getViewTitle() { return Toolkit.i18nText("Fine-Design_Form_Widget_Tree_And_Table"); } 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 856494401b..08969c91a0 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 @@ -3,6 +3,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.PaperSize; import com.fr.base.Parameter; +import com.fr.base.Releasable; import com.fr.base.extension.FileExtension; import com.fr.base.iofile.attr.ExtendSharableAttrMark; import com.fr.base.vcs.DesignerMode; @@ -26,6 +27,7 @@ import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XComponent; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; +import com.fr.design.designer.creator.XElementCase; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWAbsoluteBodyLayout; import com.fr.design.designer.creator.XWParameterLayout; @@ -72,6 +74,7 @@ import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.editor.SharableEditorProvider; import com.fr.form.share.utils.ShareUtils; import com.fr.form.ui.AbstractBorderStyleWidget; +import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WLayout; @@ -110,14 +113,13 @@ import java.util.Iterator; import java.util.List; import javax.swing.tree.TreePath; -public class JForm extends JTemplate implements BaseJForm
{ +public class JForm extends JTemplate implements BaseJForm, Releasable { private static final String FORM_CARD = "FORM"; private static final String ELEMENTCASE_CARD = "ELEMENTCASE"; private static final String[] CARDNAME = new String[]{FORM_CARD, ELEMENTCASE_CARD}; private static final int TOOLBARPANEDIMHEIGHT_FORM = 60; - //当前使用的表单设计器 - private static FormDesigner currentFormDesign; + //表单设计器 private FormDesigner formDesign; //格子设计器 @@ -712,7 +714,7 @@ public class JForm extends JTemplate implements BaseJForm implements BaseJForm implements BaseJForm Date: Thu, 8 Jul 2021 16:02:51 +0800 Subject: [PATCH 03/12] =?UTF-8?q?REPORT-53175=E3=80=9010.0.18=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E4=B8=BA?= =?UTF-8?q?=E6=A0=87=E9=A2=98/=E8=83=8C=E6=99=AF/=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 把诸如是否已展示/是否已点击/上次选择的目录等设计器交互历史相关的需持久化数据 从ServerPreferenceConfig中抽离,放到单独的文件中存储,不要和服务器配置 数据混淆 --- .../env/utils/DesignerInteractionHistory.java | 148 ++++++++++++++++++ .../beans/location/AccessDirection.java | 31 ++-- .../gui/xpane/BorderLineAndImagePane.java | 16 +- .../main/java/com/fr/start/MainDesigner.java | 4 + 4 files changed, 181 insertions(+), 18 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/env/utils/DesignerInteractionHistory.java diff --git a/designer-base/src/main/java/com/fr/env/utils/DesignerInteractionHistory.java b/designer-base/src/main/java/com/fr/env/utils/DesignerInteractionHistory.java new file mode 100644 index 0000000000..45cebca48b --- /dev/null +++ b/designer-base/src/main/java/com/fr/env/utils/DesignerInteractionHistory.java @@ -0,0 +1,148 @@ +package com.fr.env.utils; + +import com.fr.common.annotations.Compatible; +import com.fr.general.IOUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.EncodeConstants; +import com.fr.stable.ProductConstants; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLReadable; +import com.fr.stable.xml.XMLTools; +import com.fr.stable.xml.XMLWriter; +import com.fr.stable.xml.XMLableReader; +import com.fr.third.javax.xml.stream.XMLStreamException; + +import java.io.BufferedWriter; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; + +/** + * @author Starryi + * @version 10.0.18 + * Created by Starryi on 2021/7/7 + * 设计器访问和获取关键历史交互信息的持久化工具,该关键历史交互信息, + * 如用户是否点击过某按钮,是否查看过某弹窗信息,上次选择过的文件所在目录等 + */ +@Compatible +public class DesignerInteractionHistory implements XMLReadable, XMLWriter { + + private static final String FILE_NAME = "designer.ix.history.info"; + private static final String ROOT_TAG = "History"; + + private static DesignerInteractionHistory history; + public static DesignerInteractionHistory getInstance() { + if (history == null) { + history = new DesignerInteractionHistory(); + + readXMLFile(history, history.getHistoryFile()); + } + + return history; + } + + private File getHistoryFile() { + return new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), FILE_NAME)); + } + + private static void readXMLFile(XMLReadable xmlReadable, File xmlFile) { + if (xmlFile == null || !xmlFile.exists()) { + return; + } + String charset = EncodeConstants.ENCODING_UTF_8; + try { + String decodeContent = getFileContent(xmlFile); + InputStream xmlInputStream = new ByteArrayInputStream(decodeContent.getBytes(charset)); + InputStreamReader inputStreamReader = new InputStreamReader(xmlInputStream, charset); + + XMLableReader xmlReader = XMLableReader.createXMLableReader(inputStreamReader); + + if (xmlReader != null) { + xmlReader.readXMLObject(xmlReadable); + } + xmlInputStream.close(); + } catch (IOException | XMLStreamException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + + } + + private static String getFileContent(File xmlFile) throws FileNotFoundException, UnsupportedEncodingException { + InputStream encodeInputStream = new FileInputStream(xmlFile); + return IOUtils.inputStream2String(encodeInputStream); + } + + private static void writeContentToFile(String fileContent, File file) { + try (FileOutputStream fos = new FileOutputStream(file); + OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8); + BufferedWriter bw = new BufferedWriter(osw)) { + bw.write(fileContent); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + + public void saveXMLFile() { + File xmlFile = this.getHistoryFile(); + try { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + XMLTools.writeOutputStreamXML(this, out); + out.flush(); + out.close(); + String fileContent = new String(out.toByteArray(), StandardCharsets.UTF_8); + writeContentToFile(fileContent, xmlFile); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + + + private static final String HAS_SHOWN_SHIFT_DRAG_RESIZING_TOOLTIP = "hasShownShiftDragResizingTooltip"; + private static final String LAST_SELECTED_BORDER_IMAGE_DIR = "lastSelectedBorderImageDir"; + + // 是否已展示过按下Shift键可锁定比例拖拽尺寸的Tooltip + private boolean hasShownShiftDragResizingTooltip = false; + // 用户上次通过文件选择器选择的边框图片所在目录 + private String lastSelectedBorderImageDir = StringUtils.EMPTY; + + public boolean isHasShownShiftDragResizingTooltip() { + return hasShownShiftDragResizingTooltip; + } + + public void setHasShownShiftDragResizingTooltip(boolean shown) { + this.hasShownShiftDragResizingTooltip = shown; + } + + public String getLastSelectedBorderImageDir() { + return lastSelectedBorderImageDir; + } + + public void setLastSelectedBorderImageDir(String dirPath) { + this.lastSelectedBorderImageDir = dirPath; + } + + @Override + public void writeXML(XMLPrintWriter writer) { + writer.startTAG(ROOT_TAG) + .attr(HAS_SHOWN_SHIFT_DRAG_RESIZING_TOOLTIP, isHasShownShiftDragResizingTooltip()) + .attr(LAST_SELECTED_BORDER_IMAGE_DIR, getLastSelectedBorderImageDir()) + .end(); + } + + @Override + public void readXML(XMLableReader reader) { + setHasShownShiftDragResizingTooltip(reader.getAttrAsBoolean(HAS_SHOWN_SHIFT_DRAG_RESIZING_TOOLTIP, false)); + setLastSelectedBorderImageDir(reader.getAttrAsString(LAST_SELECTED_BORDER_IMAGE_DIR, StringUtils.EMPTY)); + } +} diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java b/designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java index adb0c6017b..eae04d9987 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java @@ -3,17 +3,19 @@ */ package com.fr.design.designer.beans.location; -import com.fr.config.ServerPreferenceConfig; -import com.fr.config.utils.ConfigReadUtils; import com.fr.design.beans.location.Absorptionline; import com.fr.design.beans.location.MoveUtils; -import com.fr.design.designer.creator.*; +import com.fr.design.designer.creator.XCreatorUtils; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWAbsoluteLayout; +import com.fr.design.designer.creator.XWBorderLayout; +import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormSelection; import com.fr.design.utils.ComponentUtils; +import com.fr.env.utils.DesignerInteractionHistory; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; -import com.fr.form.ui.container.WParameterLayout; import java.awt.*; @@ -196,15 +198,24 @@ public abstract class AccessDirection implements Direction { // 设置当前形状 formEditor.setCursor(Cursor.getPredefinedCursor(type)); - FormSelection selection = formEditor.getSelectionModel().getSelection(); + // 显示/改变Tooltip + showTooltip(formEditor); + } + } + + private void showTooltip(FormDesigner formEditor) { + // 显示拖拽改变组件尺寸相关的提示信息 + int cursorType = formEditor.getCursor().getType(); + if (Cursor.SW_RESIZE_CURSOR <= cursorType && cursorType <= Cursor.E_RESIZE_CURSOR) { + FormSelection selection = formEditor.getSelectionModel().getSelection(); boolean canLockAspectRatioOnlyByShift = !selection.isCreatorAspectRatioLockedInAbsLayout(formEditor) && selection.isCreatorInAbsLayout(formEditor); - ServerPreferenceConfig config = ServerPreferenceConfig.getInstance(); - if (canLockAspectRatioOnlyByShift && !config.isHasShownLockedAspectRatioResizingToolTip()) { + DesignerInteractionHistory history = DesignerInteractionHistory.getInstance(); + if (canLockAspectRatioOnlyByShift && !history.isHasShownShiftDragResizingTooltip()) { formEditor.setToolTipText(getTooltip()); - config.setHasShownLockedAspectRatioResizingToolTip(true); + history.setHasShownShiftDragResizingTooltip(true); } - } - } + } + } public String getTooltip() { return null; diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java index ca8b5abebd..9444ec1f8f 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java @@ -5,7 +5,6 @@ import com.fr.base.Style; import com.fr.base.Utils; import com.fr.base.background.ImageBackground; import com.fr.base.background.ImageFileBackground; -import com.fr.config.ServerPreferenceConfig; import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.UIConstants; import com.fr.design.designer.IntervalConstants; @@ -27,6 +26,7 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.backgroundpane.ImagePreviewPane; import com.fr.design.style.background.image.ImageFileChooser; +import com.fr.env.utils.DesignerInteractionHistory; import com.fr.form.ui.LayoutBorderStyle; import com.fr.general.Background; import com.fr.general.IOUtils; @@ -179,14 +179,14 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { } private void initImageFileChooserDirectory() { - ServerPreferenceConfig config = ServerPreferenceConfig.getInstance(); - String lastUsedBorderImagesDirPath = config.getLastUsedBorderImagesDir(); - File lastUsedBorderImagesDir = StringUtils.isNotEmpty(lastUsedBorderImagesDirPath) ? new File(lastUsedBorderImagesDirPath) : null; + DesignerInteractionHistory history = DesignerInteractionHistory.getInstance(); + String lastUsedBorderImageDirPath = history.getLastSelectedBorderImageDir(); + File lastUsedBorderImageDir = StringUtils.isNotEmpty(lastUsedBorderImageDirPath) ? new File(lastUsedBorderImageDirPath) : null; File inbuiltBorderImagesDir = new File(StableUtils.pathJoin(ProjectLibrary.getInstance().getLibHome(), ProjectConstants.ASSETS_NAME, "border_images")); - if (lastUsedBorderImagesDir!= null && lastUsedBorderImagesDir.exists()) { - imageFileChooser.setCurrentDirectory(lastUsedBorderImagesDir); + if (lastUsedBorderImageDir!= null && lastUsedBorderImageDir.exists()) { + imageFileChooser.setCurrentDirectory(lastUsedBorderImageDir); } else if (inbuiltBorderImagesDir.exists()) { imageFileChooser.setCurrentDirectory(inbuiltBorderImagesDir); } @@ -232,9 +232,9 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { int returnVal = imageFileChooser.showOpenDialog(DesignerContext.getDesignerFrame()); if (returnVal == JFileChooser.APPROVE_OPTION) { - ServerPreferenceConfig config = ServerPreferenceConfig.getInstance(); + DesignerInteractionHistory history = DesignerInteractionHistory.getInstance(); File selectedDirectory = imageFileChooser.getSelectedFile().getParentFile(); - config.setLastUsedBorderImagesDir(selectedDirectory.getPath()); + history.setLastSelectedBorderImageDir(selectedDirectory.getPath()); } ImgChooseWrapper.getInstance(imagePreviewPane, imageFileChooser, DEFAULT_IMAGE_LAYOUT_STYLE, new ChangeListener() { diff --git a/designer-realize/src/main/java/com/fr/start/MainDesigner.java b/designer-realize/src/main/java/com/fr/start/MainDesigner.java index 5c8c57987b..dd49f1b1ae 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -42,6 +42,7 @@ import com.fr.design.monitor.DesignerLifecycleMonitorContext; import com.fr.design.share.SharableManager; import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.env.utils.DesignerInteractionHistory; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.Listener; @@ -512,6 +513,9 @@ public class MainDesigner extends BaseDesigner { InformationCollector collector = InformationCollector.getInstance(); collector.collectStopTime(); collector.saveXMLFile(); + + DesignerInteractionHistory historyCollector = DesignerInteractionHistory.getInstance(); + historyCollector.saveXMLFile(); } } From abff5e2d022a30aaeda5a4d6881adb7c30480fee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Fri, 9 Jul 2021 10:04:03 +0800 Subject: [PATCH 04/12] =?UTF-8?q?CHART-19824=20=E5=9B=BE=E8=A1=A8=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E9=9D=A2=E6=9D=BF=E4=BA=A4=E4=BA=92=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/ChartTypeButtonPane.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 778f779a07..f2bea52278 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -111,15 +111,10 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen northPane.setLayout(new BorderLayout()); northPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); - JPanel addPanel = new JPanel(); - addPanel.setLayout(new BorderLayout()); - addPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 3)); - addPanel.add(addButton, BorderLayout.CENTER); - JPanel button = new JPanel(); - button.setPreferredSize(new Dimension(95, 20)); - button.setLayout(new GridLayout(1, 4, 0, 0)); - button.add(addPanel); + button.setPreferredSize(new Dimension(89, 20)); + button.setLayout(new GridLayout(1, 4, 3, 0)); + button.add(addButton); button.add(copyButton); button.add(moveForwardButton); button.add(moveBackButton); @@ -135,14 +130,11 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); configButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png")); copyButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); - copyButton.setBorderPainted(false); copyButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Action_Copy")); moveForwardButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/left.png")); moveForwardButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_HF_Move_Left")); - moveForwardButton.setBorderPainted(false); moveBackButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/right.png")); moveBackButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_HF_Move_Right")); - moveBackButton.setBorderPainted(false); initAddButton(); initConfigButton(); initMoveButton(); @@ -312,7 +304,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } private String getCopyChartName() { - String chartName = "CopyOf" + editingCollection.getChartName(editingCollection.getSelectedIndex()); + String chartName = editingCollection.getChartName(editingCollection.getSelectedIndex()) + "_Copy"; if (!nameRepeated(chartName)) { return chartName; } From 0703562439dd39729908757d7f9d7ee54f68d51f Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 9 Jul 2021 17:50:34 +0800 Subject: [PATCH 05/12] =?UTF-8?q?REPORT-55089=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=8D=E7=94=A8-=E7=8E=B0=E5=9C=A8=E9=94=81=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E5=9C=A8=E5=AE=BD=E9=AB=98=E5=80=BC=E4=B9=8B=E9=97=B4?= =?UTF-8?q?=EF=BC=8C=E9=94=81=E5=AE=9A=E6=97=B6=EF=BC=8C=E6=8B=96=E6=8B=BD?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=BB=84=E4=BB=B6=E5=A4=A7=E5=B0=8F=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E5=AE=BD=E5=BA=A6=E5=80=BC=E4=BC=9A=E5=8F=98=E5=8C=96?= =?UTF-8?q?=E6=88=90=E4=B8=80=E4=B8=AA=E5=BE=88=E9=95=BF=E7=9A=84=E5=B0=8F?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 因为尺寸比例锁定,所以宽度设置控件和高度设置控件的显示内容做了关联:当宽度设置控件发生变化后,会自动修改高度控制的显示只, 反之亦然。因为上述关联,导致拖拽结束后,重新设置面板上尺寸显示值时,高度设置控件的值后更细,联动宽度控件的值,所以宽度控件 的值被修改,显示错误 【改动思路】 populate中设置宽度和高度值时,先临时关闭比例锁定 【review建议】 --- .../design/widget/ui/designer/component/WidgetBoundPane.java | 4 ++++ 1 file changed, 4 insertions(+) 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 e963bf7130..bfcaeb60e7 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 @@ -104,6 +104,10 @@ public class WidgetBoundPane extends BasicPane { public void populate() { Rectangle bounds = new Rectangle(creator.getBounds()); + if (ratioLockedButton != null) { + // 临时禁止尺寸比例锁定,关掉widthSpinner/heightSpinner之间的数值关联,以更新其高度和宽度值 + ratioLockedButton.setLocked(false); + } width.setValue(bounds.width); height.setValue(bounds.height); if (ratioLockedButton != null) { From 5cfbe3fec415f92f2c3044f0bdc1d1d1ea3b6dbb Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 9 Jul 2021 18:45:33 +0800 Subject: [PATCH 06/12] =?UTF-8?q?REPORT-55071=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E6=A0=87=E9=A2=98=E5=A1=AB?= =?UTF-8?q?=E5=85=85=E9=80=89=E6=8B=A9=E6=B8=90=E5=8F=98=E8=89=B2=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E8=AE=BE=E7=BD=AE=E9=9D=A2=E6=9D=BF=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E7=BA=B5=E5=90=91=E6=BB=9A=E5=8A=A8=E6=9D=A1=EF=BC=8C=E9=81=AE?= =?UTF-8?q?=E6=8C=A1=E4=BD=8F=E4=BA=86=E6=B8=90=E5=8F=98=E8=89=B2=E5=8F=B3?= =?UTF-8?q?=E4=BE=A7=E9=A2=9C=E8=89=B2=E9=80=89=E6=8B=A9=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 渐变条的默认宽度超过了右侧栏设置项的宽度,导致渐变条右侧被截断 【改动思路】 提供可继承的方法,使得右侧栏实例化渐变条时能控制其宽度 【review建议】 --- .../fr/design/gui/style/BackgroundSpecialPane.java | 7 ++++++- .../design/gui/xpane/BorderLineAndImagePane.java | 2 +- .../com/fr/design/gui/xpane/LayoutStylePane.java | 14 +++++++++++--- .../fr/design/gui/xpane/TitleInsetImagePane.java | 2 +- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java b/designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java index 7fa2664235..ee05a8b59e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java @@ -39,7 +39,7 @@ public class BackgroundSpecialPane extends BackgroundPane{ fireStateChanged(); } }); - GradientBackgroundQuickPane gradientPane = new GradientBackgroundQuickPane(); + GradientBackgroundQuickPane gradientPane = createGradientBackgroundQuickPane(); gradientPane.registerChangeListener(new UIObserverListener() { @Override public void doChange() { @@ -68,4 +68,9 @@ public class BackgroundSpecialPane extends BackgroundPane{ return kinds.toArray(new BackgroundQuickPane[kinds.size()]); } + + protected GradientBackgroundQuickPane createGradientBackgroundQuickPane() { + // 使用默认的150宽度构建渐变条 + return new GradientBackgroundQuickPane(); + } } diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java index 9444ec1f8f..27c045459d 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java @@ -62,7 +62,7 @@ import java.net.URISyntaxException; * 可配置图片类型边框的样式设置面板 */ public class BorderLineAndImagePane extends JPanel implements UIObserver { - private final int SETTING_LABEL_WIDTH = 60; + private final int SETTING_LABEL_WIDTH = LayoutStylePane.SETTING_LABEL_WIDTH; private final Style DEFAULT_IMAGE_LAYOUT_STYLE = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_DEFAULT); private final String TWEAK_NINE_POINT_HELP_URL = ""; diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java index 265de1aba7..ee1de8f7e8 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java @@ -24,6 +24,7 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane; import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.WidgetTitle; import com.fr.general.Background; @@ -51,7 +52,7 @@ public class LayoutStylePane extends BasicBeanPane { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Shadow") }; private static final Dimension BUTTON_SIZE = new Dimension(20, 20); - private static final int SETTING_LABEL_WIDTH = 60; + public static final int SETTING_LABEL_WIDTH = 60; protected LayoutBorderStyle style = new LayoutBorderStyle(); @@ -124,7 +125,7 @@ public class LayoutStylePane extends BasicBeanPane { borderStyleCombo = new UIComboBox(BORDER_STYLE); borderLineAndImagePane = new BorderLineAndImagePane(); cornerSpinner = new UISpinner(0,1000,1,0); - backgroundPane = new BackgroundSpecialPane(); + backgroundPane = new LayoutBackgroundSpecialPane(); backgroundOpacityPane = new UIPercentDragPane(); } @@ -229,7 +230,7 @@ public class LayoutStylePane extends BasicBeanPane { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right") }); - titleBackgroundPane = new BackgroundSpecialPane(); + titleBackgroundPane = new LayoutBackgroundSpecialPane(); titleBackgroundOpacityPane = new UIPercentDragPane(); } @@ -499,4 +500,11 @@ public class LayoutStylePane extends BasicBeanPane { g2d.setColor(oldColor); } } + + protected static class LayoutBackgroundSpecialPane extends BackgroundSpecialPane { + @Override + protected GradientBackgroundQuickPane createGradientBackgroundQuickPane() { + return new GradientBackgroundQuickPane(140); + } + } } diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java index 1a207a0b3e..e3b3c00f48 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java @@ -40,7 +40,7 @@ import java.awt.event.ActionListener; * Created by Starryi on 2021/7/3 */ public class TitleInsetImagePane extends JPanel implements UIObserver { - private final int SETTING_LABEL_WIDTH = 60; + private final int SETTING_LABEL_WIDTH = LayoutStylePane.SETTING_LABEL_WIDTH; private final int DELETE_BUTTON_SIZE = 24; private final int IMAGE_PREVIEW_SIZE = 145; private final Style DEFAULT_IMAGE_LAYOUT_STYLE = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_DEFAULT); From 4bad4e373444e6929240285dd45f3937f927cbba Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 9 Jul 2021 19:17:14 +0800 Subject: [PATCH 07/12] =?UTF-8?q?REPORT-55090=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=8D=E7=94=A8-=E6=A0=87=E9=A2=98=E5=9B=BE=E6=A1=88?= =?UTF-8?q?=E7=9A=84=E5=9B=BE=E7=89=87=E9=A2=84=E8=A7=88=E5=9B=BE=EF=BC=8C?= =?UTF-8?q?=E5=92=8C=E4=BA=A4=E4=BA=92=E6=96=87=E6=A1=A3=E9=87=8C=E5=AE=9A?= =?UTF-8?q?=E7=9A=84=E6=82=AC=E6=B5=AE=E6=97=B6=E5=87=BA=E7=8E=B0=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=8C=89=E9=92=AE=E5=92=8C=E4=B8=8D=E9=80=8F=E6=98=8E?= =?UTF-8?q?=E9=81=AE=E7=BD=A9=E9=A2=84=E6=9C=9F=E6=95=88=E6=9E=9C=E4=B8=8D?= =?UTF-8?q?=E5=90=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 插图图片按钮的交互和样式不对,需要重新实现 【改动思路】 【review建议】 --- .../design/gui/xpane/TitleInsetImagePane.java | 69 ++++++++++++++++--- 1 file changed, 61 insertions(+), 8 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java index e3b3c00f48..b7161cbfb1 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java @@ -33,6 +33,10 @@ import javax.swing.plaf.basic.BasicButtonUI; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.geom.RoundRectangle2D; /** * @author Starryi @@ -89,6 +93,28 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { deletableImagePreviewPane.add(imageDeleteButton, 0); deletableImagePreviewPane.add(imagePreviewPane, 1); + imageDeleteButton.setVisible(false); + imageDeleteButton.setEnabled(false); + deletableImagePreviewPane.addMouseListener(new MouseAdapter() { + @Override + public void mouseEntered(MouseEvent e) { + super.mouseEntered(e); + imageDeleteButton.setVisible(true); + imageDeleteButton.setEnabled(true); + } + + @Override + public void mouseExited(MouseEvent e) { + super.mouseExited(e); + int x = e.getX(); + int y = e.getY(); + if (x <= 0 || getWidth() <= x || y <= 0 || y >= getHeight()) { + imageDeleteButton.setVisible(false); + imageDeleteButton.setEnabled(false); + } + } + }); + return TableLayoutHelper.createCommonTableLayoutPane( new JComponent[][]{ {null, deletableImagePreviewPane}, @@ -110,15 +136,11 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { private void initComponents() { imageChooseButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_choose_inset.png")); - imageDeleteButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_delete_inset.png")); - imageDeleteButton.setUI(new BasicButtonUI()); - imageDeleteButton.setOpaque(true); - imageDeleteButton.setBorderPainted(false); - imageDeleteButton.setBorder(null); - imageDeleteButton.setFocusPainted(false); - imageDeleteButton.setContentAreaFilled(true); + imageDeleteButton = new OpaqueColorButton( + IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_delete_inset.png"), + new Color(51, 51, 52, 178), + 2); imageDeleteButton.setPreferredSize(new Dimension(DELETE_BUTTON_SIZE, DELETE_BUTTON_SIZE)); - imageDeleteButton.setBackground(new Color(51, 51, 51)); imagePreviewPane = new ImagePreviewPane(); imagePreviewPane.setImageStyle(DEFAULT_IMAGE_LAYOUT_STYLE); @@ -255,4 +277,35 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { public boolean shouldResponseChangeListener() { return true; } + + private static class OpaqueColorButton extends UIButton { + private final Color color; + private final int radius; + + public OpaqueColorButton(Icon icon, Color color, int radius) { + super(icon); + setUI(new BasicButtonUI()); + setOpaque(true); + setBorderPainted(false); + setBorder(null); + setFocusPainted(false); + setContentAreaFilled(false); + this.color = color; + this.radius = radius; + } + + @Override + public void paint(Graphics g) { + Graphics2D g2d = (Graphics2D) g; + Color oldColor = g2d.getColor(); + + Shape shape = new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), radius, radius); + g2d.clip(shape); + g2d.setColor(color); + g2d.fillRect(0, 0, getWidth(), getHeight()); + + g2d.setColor(oldColor); + super.paint(g); + } + } } From 43efd3c46f5b152362ffdb70f5b68abb704054fa Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 9 Jul 2021 19:26:02 +0800 Subject: [PATCH 08/12] =?UTF-8?q?REPORT-53175=E3=80=9010.0.18=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E4=B8=BA?= =?UTF-8?q?=E6=A0=87=E9=A2=98/=E8=83=8C=E6=99=AF/=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 子功能: 设计器绝对布局内可锁定组件宽高比例 绝对布局未锁定尺寸比例,但其内部子组件锁定了尺寸比例,此时 改变绝对布局的尺寸,其内部组件应该保持原有的尺寸比例. 根据规则, 其内部组件选择宽度和高度中较小的缩放比例,缩放其尺寸. --- .../java/com/fr/design/designer/creator/XWAbsoluteLayout.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java index 60197ba12c..72bb2cb032 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -203,6 +203,10 @@ public class XWAbsoluteLayout extends XLayoutContainer { double percentH = ((double) backupBound.height / (double) currentBound.height); for (int index = 0, n = this.getComponentCount(); index < n; index++) { XCreator creator = (XCreator) this.getComponent(index); + if (creator.toData().isAspectRatioLocked()) { + double percent = Math.min(percentW, percentH); + percentW = percentH = percent; + } BoundsWidget wgt = (BoundsWidget) layout.getBoundsWidget(creator.toData()); // 用当前的显示大小计算后调正具体位置 Rectangle wgtBound = creator.getBounds(); From 0e6cffac44b92354f0ba30adba207cdbd1dda021 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 12 Jul 2021 09:55:50 +0800 Subject: [PATCH 09/12] =?UTF-8?q?REPORT-54122=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=BB=84=E4=BB=B6=E9=80=89=E4=B8=AD=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=8F=B3=E4=BE=A7=E5=BC=B9=E7=AA=97=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/images/control/edit_lock.png | Bin 0 -> 255 bytes .../fr/design/images/control/edit_unlock.png | Bin 0 -> 220 bytes .../designer/creator/SelectedBorderIcon.java | 47 ----- .../fr/design/designer/creator/XCreator.java | 22 +- .../design/designer/ui/PopupControlPanel.java | 193 ++++++++++++++++++ .../designer/ui/SelectedPopupDialog.java | 36 ++++ .../fr/design/mainframe/FormDesignerUI.java | 5 +- 7 files changed, 247 insertions(+), 56 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/edit_lock.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/edit_unlock.png delete mode 100644 designer-form/src/main/java/com/fr/design/designer/creator/SelectedBorderIcon.java create mode 100644 designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java create mode 100644 designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java diff --git a/designer-base/src/main/resources/com/fr/design/images/control/edit_lock.png b/designer-base/src/main/resources/com/fr/design/images/control/edit_lock.png new file mode 100644 index 0000000000000000000000000000000000000000..6168d9a98ea8b35b5b03f8610c79af1c2fdcba55 GIT binary patch literal 255 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9F5M?jcysy3fAP;jHC zi(`mI@7oCrxtJV9T;HEiN}6zV$H_$b{FCmxGhE(eqgSYx!I!2Hgh z*-1+!8Ce4u%@?p{JuvzHE%?W&5Z!=d4Cmx_Ft96pXJhc?N%-+sqGD!sxk4n<61(L8 zFDICMxvw`VCGBt0S%>?ta~L-~WGI>R?V_V`^wNX!8<-UC9BE&2cYT96!?ET7NArt? QK$kIiy85}Sb4q9e0M}Gd*#H0l literal 0 HcmV?d00001 diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/SelectedBorderIcon.java b/designer-form/src/main/java/com/fr/design/designer/creator/SelectedBorderIcon.java deleted file mode 100644 index fe2d839b96..0000000000 --- a/designer-form/src/main/java/com/fr/design/designer/creator/SelectedBorderIcon.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.fr.design.designer.creator; - -import com.fr.design.form.util.XCreatorConstants; -import com.fr.general.IOUtils; -import java.awt.AlphaComposite; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.Rectangle; - -/** - * @author hades - * @version 10.0 - * Created by hades on 2021/06/30 - */ -public class SelectedBorderIcon { - - private static final Image EDIT_ICON = IOUtils.readImage("/com/fr/design/images/control/show_edit.png"); - private static final Image SETTING_ICON = IOUtils.readImage("/com/fr/design/images/control/show_setting.png"); - private static final float ALPHA = 0.7F; - private static final int TIP_WIDTH = 20; - private static final int TIP_HEIGHT = 40; - private static final int ARC_VALUE = 4; - // 组件到整个提示之间的空隙 - private static final int CREATOR_TO_TIP_GAP = 5; - // icon在整个提示背景下缩进 - private static final int TIP_ICON_GAP = 2; - - /** - * 在bounds范围的右上角绘制特定图标 - * - * @param g - * @param bounds - */ - public void paint(Graphics g, Rectangle bounds) { - Graphics2D g2d = (Graphics2D) g; - AlphaComposite alphaComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, ALPHA); - g2d.setColor(XCreatorConstants.EDIT_COLOR); - g2d.setComposite(alphaComposite); - g2d.fillRoundRect(bounds.x + bounds.width + CREATOR_TO_TIP_GAP, bounds.y, TIP_WIDTH, TIP_HEIGHT, ARC_VALUE, ARC_VALUE); - g2d.drawImage(EDIT_ICON, bounds.x + bounds.width + CREATOR_TO_TIP_GAP + TIP_ICON_GAP, bounds.y + TIP_ICON_GAP, EDIT_ICON.getWidth(null), EDIT_ICON.getHeight(null), null); - g2d.drawImage(SETTING_ICON, bounds.x + bounds.width + CREATOR_TO_TIP_GAP + TIP_ICON_GAP, bounds.y + CREATOR_TO_TIP_GAP + EDIT_ICON.getHeight(null), SETTING_ICON.getWidth(null), SETTING_ICON.getHeight(null), null); - g2d.setColor(Color.WHITE); - g2d.drawLine(bounds.x + bounds.width + CREATOR_TO_TIP_GAP + TIP_ICON_GAP, bounds.y + TIP_WIDTH, bounds.x + bounds.width + CREATOR_TO_TIP_GAP + TIP_ICON_GAP + EDIT_ICON.getWidth(null), bounds.y + TIP_WIDTH); - } -} diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index 7220eafe8b..7f76eb3852 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -11,6 +11,7 @@ import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.events.DesignerEditor; import com.fr.design.designer.beans.models.SelectionModel; +import com.fr.design.designer.ui.SelectedPopupDialog; import com.fr.design.fun.ShareWidgetUIProcessor; import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.gui.imenu.UIPopupMenu; @@ -25,6 +26,7 @@ import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WTitleLayout; +import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; @@ -70,7 +72,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo private boolean isHelpBtnOnFocus = false;//焦点是否在帮助按钮上 // 当前组件是否处在选中状态 private boolean selected; - private SelectedBorderIcon selectedBorderIcon = new SelectedBorderIcon(); + private SelectedPopupDialog popup; private static final int SHORTS_SEPARATOR_POS = 4; // 弹出菜单分割的位置 public XCreator(Widget ob, Dimension initSize) { @@ -764,15 +766,20 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo } /** - * 绘制选中时右上边框图标 + * 选中时右侧展示小弹窗 * - * @param g + * @param designer * @param bounds */ - public void paintSelectedBorderIcon(Graphics g, Rectangle bounds) { - if (selected) { - selectedBorderIcon.paint(g, bounds); + public void showSelectedPopup(FormDesigner designer, Rectangle bounds, boolean accept) { + if (popup == null) { + popup = new SelectedPopupDialog(this, designer); } + int extraX = (int) ((bounds.x + bounds.width + SelectedPopupDialog.OFFSET_X) * designer.getScale()); + int extraY = (int) (bounds.y * designer.getScale()); + popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY); + popup.setVisible(selected && accept); + popup.setRelativeBounds(bounds); } /** @@ -818,6 +825,9 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public void setSelected(boolean selected) { this.selected = selected; + if (popup != null && !selected) { + popup.setVisible(false); + } } } diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java b/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java new file mode 100644 index 0000000000..a2e8992083 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java @@ -0,0 +1,193 @@ +package com.fr.design.designer.ui; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.CoverReportPane; +import com.fr.design.mainframe.EditingMouseListener; +import com.fr.design.mainframe.FormDesigner; +import com.fr.general.IOUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.ArrayUtils; +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.Insets; +import java.awt.LayoutManager; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import javax.swing.AbstractButton; +import javax.swing.Icon; +import javax.swing.JButton; +import javax.swing.JPanel; +import javax.swing.JToggleButton; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/7/8 + */ +public class PopupControlPanel extends JPanel { + + private static final int ARC_VALUE = 4; + private static final Color FILLED_COLOR = new Color(60, 63, 65); + private static final int V_GAP = 10; + private static final int H_GAP = 2; + + private Dimension defaultDimension = new Dimension(20, 60); + private Rectangle rectangle; + private final JButton editButton; + private final JButton settingButton; + private final JToggleButton toggleButton; + private final XCreator creator; + private final UILabel firstLabel; + private final UILabel secondLabel; + + public PopupControlPanel(XCreator creator, FormDesigner designer) { + FineLoggerFactory.getLogger().error("shared: {}", creator.isShared()); + if (creator.isShared()) { + defaultDimension = new Dimension(20, 85); + } + setLayout(getCustomLayout()); + this.creator = creator; + editButton = createNormalButton(IOUtils.readIcon("/com/fr/design/images/control/show_edit.png"), Toolkit.i18nText("Fine-Design_Form_Edit_Widget")); + editButton.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + int x = rectangle.x + rectangle.width / 2; + int y = rectangle.y + rectangle.height / 2; + XCreator childCreator = PopupControlPanel.this.creator.getEditingChildCreator(); + MouseListener[] listeners = designer.getMouseListeners(); + if (ArrayUtils.isNotEmpty(listeners) && listeners[0] instanceof EditingMouseListener) { + childCreator.respondClick(((EditingMouseListener) listeners[0]), new MouseEvent(childCreator, MouseEvent.MOUSE_CLICKED, e.getWhen(), e.getModifiers(), x, y, 2, false)); + } + } + }); + settingButton = createNormalButton(IOUtils.readIcon("/com/fr/design/images/control/show_setting.png"), Toolkit.i18nText("Fine-Design_Share_Help_Settings")); + + settingButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + CoverReportPane.showShareConfig(creator.toData()); + } + }); + toggleButton = new JToggleButton(IOUtils.readIcon("/com/fr/design/images/control/edit_lock.png")); + initButtonStyle(toggleButton); + toggleButton.setSelectedIcon(IOUtils.readIcon("com/fr/design/images/control/edit_unlock.png")); + toggleButton.setToolTipText(Toolkit.i18nText("Fine-Design_Form_Lock_Widget_Ratio")); + toggleButton.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + JToggleButton toggleBtn = (JToggleButton) e.getSource(); + String toolTipText = toggleBtn.isSelected() ? Toolkit.i18nText("Fine-Design_Form_UnLock_Widget_Ratio") : Toolkit.i18nText("Fine-Design_Form_Lock_Widget_Ratio"); + toggleBtn.setToolTipText(toolTipText); + } + }); + + firstLabel = createLabel(); + secondLabel = createLabel(); + + add(editButton); + add(toggleButton); + add(settingButton); + add(firstLabel); + add(secondLabel); + } + + protected LayoutManager getCustomLayout() { + return new LayoutManager() { + + @Override + public void removeLayoutComponent(Component comp) { + } + + @Override + public Dimension preferredLayoutSize(Container parent) { + return defaultDimension; + } + + @Override + public Dimension minimumLayoutSize(Container parent) { + return null; + } + + @Override + public void layoutContainer(Container parent) { + int width = parent.getPreferredSize().width; + int buttonWidth = editButton.getPreferredSize().width; + int buttonHeight = editButton.getPreferredSize().height; + int x = (width - buttonWidth) / 2; + editButton.setBounds(x, V_GAP, buttonWidth, buttonHeight); + firstLabel.setBounds(x, V_GAP + editButton.getHeight() + V_GAP / 2, buttonWidth, buttonHeight); + toggleButton.setBounds(x, V_GAP * 2 + editButton.getHeight(), buttonWidth, buttonHeight); + if (creator.isShared()) { + secondLabel.setBounds(x, V_GAP * 2 + editButton.getHeight() + toggleButton.getHeight() + V_GAP / 2, buttonWidth, buttonHeight); + settingButton.setBounds(x, V_GAP * 3 + editButton.getHeight() + toggleButton.getHeight(), buttonWidth, buttonHeight); + } + } + + @Override + public void addLayoutComponent(String name, Component comp) { + } + }; + } + + private JButton createNormalButton(Icon icon, String toolTipText) { + JButton button = new JButton(icon); + initButtonStyle(button); + button.setToolTipText(toolTipText); + return button; + } + + private void initButtonStyle(AbstractButton button) { + button.setBorderPainted(false); + button.setBorder(null); + button.setMargin(new Insets(0, 0, 0, 0)); + button.setContentAreaFilled(false); + } + + private UILabel createLabel() { + return new UILabel() { + @Override + public void paint(Graphics g) { + super.paint(g); + Graphics2D g2d = (Graphics2D) g; + g2d.setColor(Color.WHITE); + g2d.drawLine(H_GAP, 0, toggleButton.getWidth() - H_GAP, 0); + + } + }; + } + + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + int w = this.getWidth(); + int h = this.getHeight(); + Graphics2D g2d = (Graphics2D) g; + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2d.setColor(FILLED_COLOR); + g2d.fillRoundRect(0, 0, w - 1, h - 1, ARC_VALUE, ARC_VALUE); + g2d.setColor(Color.WHITE); + g2d.drawRoundRect(0, 0, w - 1, h - 1, ARC_VALUE, ARC_VALUE); + } + + public Dimension getDefaultDimension() { + return defaultDimension; + } + + public void setRelativeBounds(Rectangle rectangle) { + this.rectangle = rectangle; + } + +} diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java new file mode 100644 index 0000000000..e7de926793 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java @@ -0,0 +1,36 @@ +package com.fr.design.designer.ui; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.FormDesigner; +import java.awt.Rectangle; +import javax.swing.JDialog; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/7/09 + */ +public class SelectedPopupDialog extends JDialog { + + /** + * 弹窗的相对组件的偏移 + */ + public static final int OFFSET_X = 5; + + private final PopupControlPanel controlPanel; + + public SelectedPopupDialog(XCreator creator, FormDesigner designer) { + super(DesignerContext.getDesignerFrame()); + this.setUndecorated(true); + this.setModal(false); + controlPanel = new PopupControlPanel(creator, designer); + this.getContentPane().add(controlPanel); + this.setSize(controlPanel.getDefaultDimension()); + } + + public void setRelativeBounds(Rectangle rectangle) { + this.controlPanel.setRelativeBounds(rectangle); + } + +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java index 8df27c19fe..c49902c8d9 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java @@ -13,6 +13,7 @@ import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWFitLayout; +import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.utils.ComponentUtils; @@ -325,9 +326,7 @@ public class FormDesignerUI extends ComponentUI { } creator.paintBorder(g, creatorBounds); // 拖拽时不绘制 - if (!designer.getStateModel().isDragging()) { - creator.paintSelectedBorderIcon(g, creatorBounds); - } + creator.showSelectedPopup(designer, creatorBounds, !designer.getStateModel().isDragging() && creator.acceptType(XWTitleLayout.class)); } } From cc92aac234c731dd818c0f43b2993c0c87d4b6f4 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 12 Jul 2021 09:58:06 +0800 Subject: [PATCH 10/12] =?UTF-8?q?REPORT-54122=20fix=20=E6=97=A0=E7=94=A8im?= =?UTF-8?q?port?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/designer/creator/XCreator.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index 7f76eb3852..80bf1b51d8 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -26,7 +26,6 @@ import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WTitleLayout; -import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; From f144baf9cabe638ce3025cb6c3f248b1576bad23 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 12 Jul 2021 10:05:36 +0800 Subject: [PATCH 11/12] =?UTF-8?q?REPORT-54122=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=BB=84=E4=BB=B6=E9=80=89=E4=B8=AD=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=8F=B3=E4=BE=A7=E5=BC=B9=E7=AA=97=E6=94=B9=E8=BF=9B=20?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=97=A0=E7=94=A8=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/designer/ui/PopupControlPanel.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java b/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java index a2e8992083..b8133d3dac 100644 --- a/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java +++ b/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java @@ -7,7 +7,6 @@ import com.fr.design.mainframe.CoverReportPane; import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.FormDesigner; import com.fr.general.IOUtils; -import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import java.awt.Color; import java.awt.Component; @@ -54,7 +53,6 @@ public class PopupControlPanel extends JPanel { private final UILabel secondLabel; public PopupControlPanel(XCreator creator, FormDesigner designer) { - FineLoggerFactory.getLogger().error("shared: {}", creator.isShared()); if (creator.isShared()) { defaultDimension = new Dimension(20, 85); } From d1e2aa982b3e3d0d9d8dddd5626a9c004d36fd10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Mon, 12 Jul 2021 10:54:35 +0800 Subject: [PATCH 12/12] =?UTF-8?q?CHART-19488=20=E6=97=A5=E6=9C=9F=E8=BD=B4?= =?UTF-8?q?=E7=9A=84=E6=97=A5=E6=9C=9F=E6=8E=A7=E4=BB=B6=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E6=88=90=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=85=AC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/designer/style/axis/VanChartTimeAxisPane.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java index f960b4aff7..1a0b78982f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java @@ -293,7 +293,7 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane { DateEditor dateEditor = (DateEditor)minValueField.getCurrentEditor(); String dateString = dateEditor.getUIDatePickerFormat().format(datetmp); timeAxis.setCustomMinValue(StringUtils.isNotEmpty(dateString)); - timeAxis.setMinValue(BaseFormula.createFormulaBuilder().build(dateString)); + timeAxis.setMinValue(createDataFormula(dateString)); } } else { timeAxis.setCustomMinValue(false); @@ -308,7 +308,7 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane { DateEditor dateEditor = (DateEditor)maxValueField.getCurrentEditor(); String dateString = dateEditor.getUIDatePickerFormat().format(datetmp); timeAxis.setCustomMaxValue(StringUtils.isNotEmpty(dateString)); - timeAxis.setMaxValue(BaseFormula.createFormulaBuilder().build(dateString)); + timeAxis.setMaxValue(createDataFormula(dateString)); } } else { timeAxis.setCustomMaxValue(false); @@ -332,6 +332,11 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane { checkBoxUse(); } + private BaseFormula createDataFormula(String dateString) { + String formulaString = "\"" + dateString + "\""; + return BaseFormula.createFormulaBuilder().build(formulaString); + } + public void populate(VanChartTimeAxis timeAxis){ // 最小值 if (timeAxis.isCustomMinValue() && timeAxis.getMinValue() != null) {