From e49f8cd9c970b44326be9e498f6c79cae3894c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Mon, 15 Nov 2021 18:40:51 +0800 Subject: [PATCH 01/15] =?UTF-8?q?REPORT-62275=20=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E6=8B=96=E5=85=A5=E5=A4=B1=E8=B4=A5-=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=92=A4=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/designer/beans/LayoutAdapter.java | 3 +++ .../adapters/layout/AbstractLayoutAdapter.java | 3 +++ .../adapters/layout/FRFitLayoutAdapter.java | 8 +++++++- .../adapters/layout/FRNoFixLayoutAdapter.java | 7 +++++++ .../designer/beans/models/AddingModel.java | 8 ++++++++ .../designer/beans/models/SelectionModel.java | 6 +++++- .../design/mainframe/FormCreatorDropTarget.java | 17 +++++++++++++++++ .../com/fr/design/mainframe/FormDesigner.java | 1 + 8 files changed, 51 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java index 438699b86..7686709a3 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java @@ -3,6 +3,7 @@ package com.fr.design.designer.beans; import com.fr.design.beans.GroupModel; import com.fr.design.designer.beans.adapters.layout.DefaultDesignerBaseOperate; import com.fr.design.designer.beans.adapters.layout.DesignerBaseOperate; +import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.treeview.DefaultXCreatorTreeCellRender; @@ -141,4 +142,6 @@ public interface LayoutAdapter { }; + void updateAddingModel(AddingModel model); + } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java index 98b6c8855..a2e9b71ff 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java @@ -4,6 +4,7 @@ import com.fr.design.beans.GroupModel; import com.fr.design.designer.beans.ConstraintsGroupModel; import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.LayoutAdapter; +import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.painters.NullPainter; import com.fr.design.designer.creator.XCreator; @@ -210,5 +211,7 @@ public abstract class AbstractLayoutAdapter implements LayoutAdapter { selectionModel.setSelectedCreator(container); } + public void updateAddingModel(AddingModel model) { + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java index d17e9689e..747479cbb 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java @@ -8,6 +8,7 @@ import com.fr.design.beans.GroupModel; import com.fr.design.designer.beans.ConstraintsGroupModel; import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.LayoutAdapter; +import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; @@ -1243,5 +1244,10 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { public void dragOver(XCreator xCreator, SelectionModel selectionModel,int x, int y) { frLayoutState.dragOver(xCreator, selectionModel,x,y); - }; + } + + @Override + public void updateAddingModel(AddingModel model) { + frLayoutState.updateAddingModel(model); + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java index aaeedfc8d..b278e0ffe 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java @@ -1,5 +1,6 @@ package com.fr.design.designer.beans.adapters.layout; +import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.painters.AbstractPainter; import com.fr.design.designer.beans.painters.FRFitLayoutPainter; @@ -144,6 +145,12 @@ public class FRNoFixLayoutAdapter extends AbstractLayoutAdapter { @Override public void dragStart(XCreator xCreator, SelectionModel selectionModel) { selectionModel.removeCreator(xCreator, xCreator.getWidth(), xCreator.getHeight()); + selectionModel.fireCreatorDeleted(); selectionModel.setSelectedCreator(container); } + + @Override + public void updateAddingModel(AddingModel model) { + model.setNeedUndoWhenAddingFailed(true); + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java index 1926b57b1..c9a9eb330 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java @@ -24,6 +24,7 @@ public class AddingModel { private int currentX; private int currentY; private boolean added; + private boolean needUndoWhenAddingFailed = false; public AddingModel(FormDesigner designer, XCreator xCreator) { this.creator = xCreator; @@ -141,4 +142,11 @@ public class AddingModel { return added; } + public boolean isNeedUndoWhenAddingFailed() { + return needUndoWhenAddingFailed; + } + + public void setNeedUndoWhenAddingFailed(boolean needUndoWhenAddingFailed) { + this.needUndoWhenAddingFailed = needUndoWhenAddingFailed; + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java index 963f60e6c..28456f799 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java @@ -25,7 +25,6 @@ import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormSelection; import com.fr.design.mainframe.FormSelectionUtils; -import com.fr.design.mainframe.share.encrypt.clipboard.impl.EncryptSelectionClipboardHandler; import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.LayoutUtils; import com.fr.general.ComparatorUtils; @@ -585,4 +584,9 @@ public class SelectionModel { selection.setSelectedCreators(rebuildSelection); fireCreatorSelected(); } + + public void fireCreatorDeleted() { + designer.getEditListenerTable().fireCreatorModified(selection.getSelectedCreator(), + DesignerEvent.CREATOR_DELETED); + } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 82befa273..2b9a4f6be 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -18,6 +18,7 @@ import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWParameterLayout; +import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.icon.IconPathConstants; @@ -25,6 +26,7 @@ import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.mod.bean.ChangeItem; import com.fr.design.mod.bean.ContentChangeItem; import com.fr.design.mod.event.TableDataModifyEvent; +import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.ComponentUtils; import com.fr.event.EventDispatcher; import com.fr.form.share.SharableWidgetProvider; @@ -152,6 +154,9 @@ public class FormCreatorDropTarget extends DropTarget { if (creator != null) { creator.setSelected(false); } + if (designer.getAddingModel().isNeedUndoWhenAddingFailed()) { + undoWhenDropFail(); + } } // 取消提示 designer.setPainter(null); @@ -159,6 +164,18 @@ public class FormCreatorDropTarget extends DropTarget { designer.stopAddingState(); } + private void undoWhenDropFail() { + JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + if (jt != null && jt.getUndoManager().canUndo()) { + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + jt.undo(); + } + }); + } + } + private void entering(int x, int y) { // 将要添加的组件图标移动到鼠标下的位置 addingModel.moveTo(x, y); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index 3eb40b6a2..9cf220ff8 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -1210,6 +1210,7 @@ public class FormDesigner extends TargetComponent
implements TreeSelection setTransferHandler(handler); handler.exportAsDrag(this, lastPressEvent, TransferHandler.COPY); XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(xCreator); + parent.getLayoutAdapter().updateAddingModel(addingModel); parent.getLayoutAdapter().dragStart(xCreator, selectionModel); this.setDropTarget(new FormCreatorDropTarget(this)); // 触发状态添加模式事件 From a51db423435c9d8ad5daa6f3fac3e5c6e007e786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Wed, 17 Nov 2021 11:03:43 +0800 Subject: [PATCH 02/15] REPORT-61827 --- .../com/fr/design/mainframe/DesignerTransferHandler.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java b/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java index 38e6f47a4..013d7c2f1 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java @@ -1,12 +1,11 @@ package com.fr.design.mainframe; -import java.awt.datatransfer.Transferable; +import com.fr.design.designer.beans.events.DesignerEvent; +import com.fr.design.designer.beans.models.AddingModel; import javax.swing.JComponent; import javax.swing.TransferHandler; - -import com.fr.design.designer.beans.events.DesignerEvent; -import com.fr.design.designer.beans.models.AddingModel; +import java.awt.datatransfer.Transferable; public class DesignerTransferHandler extends TransferHandler { @@ -20,7 +19,7 @@ public class DesignerTransferHandler extends TransferHandler { } protected void exportDone(JComponent source, Transferable data, int action) { - if (!addingModel.isCreatorAdded()) { + if (!addingModel.isCreatorAdded() && !addingModel.isNeedUndoWhenAddingFailed()) { designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_CUTED); } } From a992039144f20522d64e707de1da6ec46e4bed2c Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Wed, 17 Nov 2021 17:20:27 +0800 Subject: [PATCH 03/15] =?UTF-8?q?REPORT-62554=20=E5=86=8D=E6=89=93?= =?UTF-8?q?=E5=BC=80=E8=AE=BE=E8=AE=A1=E5=99=A8=E6=A8=A1=E6=9D=BF=E4=BC=9A?= =?UTF-8?q?=E7=A9=BA=E7=99=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/app/FormApp.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java index 286890303..29f56d143 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java @@ -73,15 +73,13 @@ class FormApp extends AbstractAppProvider { @Override public JTemplate call() throws Exception { OpenResult result = worker.getResult(); - return (JTemplate) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, - new Object[]{result.getBaseBook(), tplFile, result.getRef()}, classType, BaseJForm.class); + return getJForm(result.getBaseBook(), tplFile, result.getRef()); } }); worker.start(tplFile.getPath()); OpenResult result = worker.getResult(); if (result != null) { - return (JTemplate) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, - new Object[]{result.getBaseBook(), tplFile, new Parameter[0]}, classType, BaseJForm.class); + return getJForm(result.getBaseBook(), tplFile, result.getRef()); } return emptyForm; } else { @@ -90,6 +88,16 @@ class FormApp extends AbstractAppProvider { } } + @Nullable + private JForm getJForm(Form form, FILE file, Parameter[] parameters) { + try { + return new JForm(form, file, parameters); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e, e.getMessage()); + return null; + } + } + @Nullable private Form getForm(FILE tplFile) { ReadXmlTypeLocalManager.setReadXmlType(ReadXmlType.DESIGN); From 15341520dd5dc7688629ec3dbf603b9404d55fca Mon Sep 17 00:00:00 2001 From: shine Date: Thu, 18 Nov 2021 17:33:05 +0800 Subject: [PATCH 04/15] =?UTF-8?q?CHART-21785=20cpt=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E8=83=8C=E6=99=AF=E5=92=8C=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=A2=9C=E8=89=B2=E8=83=8C=E6=99=AF=E4=B8=80?= =?UTF-8?q?=E6=A0=B7=20design?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../utils/gui/AdjustWorkBookDefaultStyleUtils.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java index abae997e3..760fc3c80 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java @@ -18,6 +18,16 @@ public class AdjustWorkBookDefaultStyleUtils { private static final Color TEMPLATE_BACKGROUND = new Color(16, 11, 43); private static final Color CELL_ELEMENT_BORDER = new Color(110, 110, 110); + private static Color currentStoryBack = null; + + public static void setCurrentStoryBack(Color color) { + currentStoryBack = color; + } + + private static Color getCurrentStoryBack() { + return currentStoryBack == null ? TEMPLATE_BACKGROUND : currentStoryBack; + } + public static void adjustCellElement(CellElement cellElement) { if (DesignModeContext.isDuchampMode()) { Style style = cellElement.getStyle(); @@ -33,14 +43,14 @@ public class AdjustWorkBookDefaultStyleUtils { public static void adjustFloatElement(FloatElement floatElement) { if (DesignModeContext.isDuchampMode()) { Style style = floatElement.getStyle(); - style = style.deriveBackground(ColorBackground.getInstance(TEMPLATE_BACKGROUND)); + style = style.deriveBackground(ColorBackground.getInstance(getCurrentStoryBack())); style = style.deriveFRFont(style.getFRFont().applyForeground(Color.WHITE)); floatElement.setStyle(style); } } public static Color adjustBack(Color color) { - return DesignModeContext.isDuchampMode() ? TEMPLATE_BACKGROUND : color; + return DesignModeContext.isDuchampMode() ? getCurrentStoryBack() : color; } } From 0ae062a012093257e24ac28e39dce5d965c7a9ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 18 Nov 2021 17:46:59 +0800 Subject: [PATCH 05/15] REPORT-62275 --- .../designer/beans/adapters/layout/FRNoFixLayoutAdapter.java | 1 - .../com/fr/design/designer/beans/models/SelectionModel.java | 5 ----- .../java/com/fr/design/mainframe/FormCreatorDropTarget.java | 5 +++-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java index b278e0ffe..3f0c61e63 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java @@ -145,7 +145,6 @@ public class FRNoFixLayoutAdapter extends AbstractLayoutAdapter { @Override public void dragStart(XCreator xCreator, SelectionModel selectionModel) { selectionModel.removeCreator(xCreator, xCreator.getWidth(), xCreator.getHeight()); - selectionModel.fireCreatorDeleted(); selectionModel.setSelectedCreator(container); } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java index 28456f799..31bb62531 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java @@ -584,9 +584,4 @@ public class SelectionModel { selection.setSelectedCreators(rebuildSelection); fireCreatorSelected(); } - - public void fireCreatorDeleted() { - designer.getEditListenerTable().fireCreatorModified(selection.getSelectedCreator(), - DesignerEvent.CREATOR_DELETED); - } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 2b9a4f6be..6a0ad0952 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -166,11 +166,12 @@ public class FormCreatorDropTarget extends DropTarget { private void undoWhenDropFail() { JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (jt != null && jt.getUndoManager().canUndo()) { + if (jt != null) { UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { - jt.undo(); + FormUndoState current = (FormUndoState) jt.getUndoState(); + current.applyState(); } }); } From 83682006199e16011c3531ce63b4ba25ee87e7e2 Mon Sep 17 00:00:00 2001 From: yvan Date: Thu, 18 Nov 2021 20:09:58 +0800 Subject: [PATCH 06/15] =?UTF-8?q?REPORT-62680=20=E6=8F=92=E4=BB=B6-?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=AE=A1=E7=90=86-=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E9=87=8C=E6=B2=A1=E6=9C=89=E9=80=82=E9=85=8D=E7=A6=81?= =?UTF-8?q?=E7=94=A8=E6=8F=90=E7=A4=BA=20=E3=80=90=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=8E=9F=E5=9B=A0=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E9=87=8C?= =?UTF-8?q?=E6=B2=A1=E9=80=82=E9=85=8D=20=E3=80=90=E6=94=B9=E5=8A=A8?= =?UTF-8?q?=E6=80=9D=E8=B7=AF=E3=80=911.=20=E9=80=82=E9=85=8D=E4=B8=8B?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E6=8F=90=E7=A4=BA=EF=BC=9B2.=20=E4=B9=8B?= =?UTF-8?q?=E5=89=8D=E6=8A=8Aforbid-reminder=E6=94=BE=E5=88=B0PluginView?= =?UTF-8?q?=E9=87=8C=E8=BF=98=E6=98=AF=E4=B8=8D=E5=90=88=E9=80=82=EF=BC=8C?= =?UTF-8?q?=E6=8D=A2=E6=88=90=E9=80=9A=E8=BF=87xml=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E5=BC=8F=20=E3=80=90review=E5=BB=BA=E8=AE=AE?= =?UTF-8?q?=E3=80=91=E6=97=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/extra/PluginOperateUtils.java | 35 ++++++++++++++----- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java b/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java index d7260f84e..7f68cd8bf 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java @@ -25,6 +25,7 @@ import com.fr.plugin.manage.control.PluginTask; import com.fr.plugin.manage.control.PluginTaskCallback; import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.view.PluginView; +import com.fr.plugin.xml.PluginElementName; import com.fr.stable.StringUtils; import javax.swing.JOptionPane; @@ -91,15 +92,31 @@ public class PluginOperateUtils { public static void setPluginActive(String pluginInfo, JSCallback jsCallback) { - PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); - PluginContext plugin = PluginManager.getContext(pluginMarker); - boolean active = plugin.isActive(); - PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(active, jsCallback); - if (active) { - PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); - } else { - PluginManager.getController().enable(pluginMarker, modifyStatusCallback); - } + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); + PluginContext plugin = PluginManager.getContext(pluginMarker); + boolean active = plugin.isActive(); + PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(active, jsCallback); + if (active) { + // 禁用前提示 + int rv = FineJOptionPane.showConfirmDialog( + null, + plugin.getXml().getElement(PluginElementName.ForbidReminder).getContent(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.WARNING_MESSAGE + ); + if (rv == JOptionPane.OK_OPTION) { + PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); + } + } else { + PluginManager.getController().enable(pluginMarker, modifyStatusCallback); + } + } + }); } public static void uninstallPlugin(final String pluginInfo, final boolean isForce, final JSCallback jsCallback) { From 60edfb2cbdaa50ba950ed4d1a54982de15cd9cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 18 Nov 2021 20:35:43 +0800 Subject: [PATCH 07/15] REPORT-62275&REPORT-61827 --- .../com/fr/design/mainframe/JTemplate.java | 17 +++++++++++++---- .../design/designer/beans/LayoutAdapter.java | 4 ---- .../adapters/layout/AbstractLayoutAdapter.java | 7 +------ .../adapters/layout/FRBorderLayoutAdapter.java | 1 - .../layout/FRCardMainBorderLayoutAdapter.java | 14 ++------------ .../adapters/layout/FRFitLayoutAdapter.java | 6 ------ .../adapters/layout/FRNoFixLayoutAdapter.java | 6 ------ .../designer/beans/models/AddingModel.java | 9 --------- .../mainframe/DesignerTransferHandler.java | 13 ++++++++++--- .../mainframe/FormCreatorDropTarget.java | 18 ------------------ .../com/fr/design/mainframe/FormDesigner.java | 1 - 11 files changed, 26 insertions(+), 70 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index c9b223c52..3bbaf2706 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -7,11 +7,11 @@ import com.fr.base.io.BaseBook; import com.fr.base.iofile.attr.DesignBanCopyAttrMark; import com.fr.base.iofile.attr.TemplateIdAttrMark; import com.fr.base.iofile.attr.TemplateThemeAttrMark; +import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateThemeCompatible; +import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.ThemedTemplate; import com.fr.base.vcs.DesignerMode; -import com.fr.base.theme.TemplateTheme; -import com.fr.base.theme.TemplateThemeConfig; import com.fr.decision.config.FSConfig; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; @@ -70,14 +70,13 @@ import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; +import com.fr.nx.app.designer.toolbar.TemplateTransformer; import com.fr.nx.app.designer.utils.CptAndCptxCompatibilityUtil; import com.fr.nx.app.designer.utils.CptCompileUtil; import com.fr.nx.cptx.entry.metadata.CptxMetadata; import com.fr.nx.cptx.utils.CptxFileUtils; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; -import com.fr.nx.app.designer.toolbar.CompileAction; -import com.fr.nx.app.designer.toolbar.TemplateTransformer; import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; @@ -642,6 +641,16 @@ public abstract class JTemplate> fireSuperTargetModified(); } + public void undoToCurrent() { + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + BaseUndoState current = JTemplate.this.getUndoState(); + current.applyState(); + } + }); + } + /** * 模板更新 */ diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java index 7686709a3..3c0c2bd5f 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java @@ -3,7 +3,6 @@ package com.fr.design.designer.beans; import com.fr.design.beans.GroupModel; import com.fr.design.designer.beans.adapters.layout.DefaultDesignerBaseOperate; import com.fr.design.designer.beans.adapters.layout.DesignerBaseOperate; -import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.treeview.DefaultXCreatorTreeCellRender; @@ -141,7 +140,4 @@ public interface LayoutAdapter { default void dragOver(XCreator xCreator, SelectionModel selectionModel, int x, int y) { }; - - void updateAddingModel(AddingModel model); - } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java index a2e9b71ff..7d287e5a5 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java @@ -4,7 +4,6 @@ import com.fr.design.beans.GroupModel; import com.fr.design.designer.beans.ConstraintsGroupModel; import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.LayoutAdapter; -import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.painters.NullPainter; import com.fr.design.designer.creator.XCreator; @@ -14,7 +13,7 @@ import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.LayoutUtils; import com.fr.general.ComparatorUtils; -import java.awt.*; +import java.awt.LayoutManager; public abstract class AbstractLayoutAdapter implements LayoutAdapter { @@ -210,8 +209,4 @@ public abstract class AbstractLayoutAdapter implements LayoutAdapter { selectionModel.removeCreator(xCreator, xCreator.getWidth(), xCreator.getHeight()); selectionModel.setSelectedCreator(container); } - - public void updateAddingModel(AddingModel model) { - - } } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRBorderLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRBorderLayoutAdapter.java index cbb8f018f..6a9eadf83 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRBorderLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRBorderLayoutAdapter.java @@ -184,5 +184,4 @@ public class FRBorderLayoutAdapter extends AbstractLayoutAdapter { public ConstraintsGroupModel getLayoutConstraints(XCreator creator) { return new FRBorderLayoutConstraints(container, creator); } - } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java index dd9e03c8d..00c0d7751 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java @@ -7,7 +7,6 @@ import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.form.layout.FRBorderLayout; import com.fr.design.mainframe.JTemplate; -import com.fr.design.ui.util.UIUtil; import com.fr.general.ComparatorUtils; import java.awt.BorderLayout; @@ -65,17 +64,8 @@ public class FRCardMainBorderLayoutAdapter extends FRBorderLayoutAdapter { if (minConstraint > value) { FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds")); JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (jt != null && jt.getUndoManager().canUndo()) { - // 自适应布局平分高度导致变矮的场景,优先做撤销 - UIUtil.invokeLaterIfNeeded(new Runnable() { - @Override - public void run() { - jt.undo(); - } - }); - } else if (container.getBackupBound() != null) { - // 手动拖动导致变矮的场景 - container.setSize(container.getBackupBound().getSize()); + if (jt != null) { + jt.undoToCurrent(); } return true; } else { diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java index 747479cbb..9871d1b32 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java @@ -8,7 +8,6 @@ import com.fr.design.beans.GroupModel; import com.fr.design.designer.beans.ConstraintsGroupModel; import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.LayoutAdapter; -import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; @@ -1245,9 +1244,4 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { public void dragOver(XCreator xCreator, SelectionModel selectionModel,int x, int y) { frLayoutState.dragOver(xCreator, selectionModel,x,y); } - - @Override - public void updateAddingModel(AddingModel model) { - frLayoutState.updateAddingModel(model); - } } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java index 3f0c61e63..aaeedfc8d 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java @@ -1,6 +1,5 @@ package com.fr.design.designer.beans.adapters.layout; -import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.painters.AbstractPainter; import com.fr.design.designer.beans.painters.FRFitLayoutPainter; @@ -147,9 +146,4 @@ public class FRNoFixLayoutAdapter extends AbstractLayoutAdapter { selectionModel.removeCreator(xCreator, xCreator.getWidth(), xCreator.getHeight()); selectionModel.setSelectedCreator(container); } - - @Override - public void updateAddingModel(AddingModel model) { - model.setNeedUndoWhenAddingFailed(true); - } } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java index c9a9eb330..b94b21d94 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java @@ -24,7 +24,6 @@ public class AddingModel { private int currentX; private int currentY; private boolean added; - private boolean needUndoWhenAddingFailed = false; public AddingModel(FormDesigner designer, XCreator xCreator) { this.creator = xCreator; @@ -141,12 +140,4 @@ public class AddingModel { y + designer.getVerticalScaleValue() - rect.y); return added; } - - public boolean isNeedUndoWhenAddingFailed() { - return needUndoWhenAddingFailed; - } - - public void setNeedUndoWhenAddingFailed(boolean needUndoWhenAddingFailed) { - this.needUndoWhenAddingFailed = needUndoWhenAddingFailed; - } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java b/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java index 013d7c2f1..e5b11dd9a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java @@ -1,7 +1,7 @@ package com.fr.design.mainframe; -import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.models.AddingModel; +import com.fr.design.file.HistoryTemplateListPane; import javax.swing.JComponent; import javax.swing.TransferHandler; @@ -19,8 +19,15 @@ public class DesignerTransferHandler extends TransferHandler { } protected void exportDone(JComponent source, Transferable data, int action) { - if (!addingModel.isCreatorAdded() && !addingModel.isNeedUndoWhenAddingFailed()) { - designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_CUTED); + if (!addingModel.isCreatorAdded()) { + undoWhenAddingFailed(); + } + } + + private void undoWhenAddingFailed() { + JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + if (jt != null) { + jt.undoToCurrent(); } } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 6a0ad0952..82befa273 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -18,7 +18,6 @@ import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWParameterLayout; -import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.icon.IconPathConstants; @@ -26,7 +25,6 @@ import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.mod.bean.ChangeItem; import com.fr.design.mod.bean.ContentChangeItem; import com.fr.design.mod.event.TableDataModifyEvent; -import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.ComponentUtils; import com.fr.event.EventDispatcher; import com.fr.form.share.SharableWidgetProvider; @@ -154,9 +152,6 @@ public class FormCreatorDropTarget extends DropTarget { if (creator != null) { creator.setSelected(false); } - if (designer.getAddingModel().isNeedUndoWhenAddingFailed()) { - undoWhenDropFail(); - } } // 取消提示 designer.setPainter(null); @@ -164,19 +159,6 @@ public class FormCreatorDropTarget extends DropTarget { designer.stopAddingState(); } - private void undoWhenDropFail() { - JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (jt != null) { - UIUtil.invokeLaterIfNeeded(new Runnable() { - @Override - public void run() { - FormUndoState current = (FormUndoState) jt.getUndoState(); - current.applyState(); - } - }); - } - } - private void entering(int x, int y) { // 将要添加的组件图标移动到鼠标下的位置 addingModel.moveTo(x, y); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index 9cf220ff8..3eb40b6a2 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -1210,7 +1210,6 @@ public class FormDesigner extends TargetComponent implements TreeSelection setTransferHandler(handler); handler.exportAsDrag(this, lastPressEvent, TransferHandler.COPY); XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(xCreator); - parent.getLayoutAdapter().updateAddingModel(addingModel); parent.getLayoutAdapter().dragStart(xCreator, selectionModel); this.setDropTarget(new FormCreatorDropTarget(this)); // 触发状态添加模式事件 From ed0a2090dfec25615df88d308d72eeb91870f694 Mon Sep 17 00:00:00 2001 From: Tommy Date: Fri, 19 Nov 2021 09:49:03 +0800 Subject: [PATCH 08/15] =?UTF-8?q?REPORT-62896=20=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E4=B8=BB=E9=A2=98=E5=BC=95=E5=AF=BC=E8=BF=87=E7=A8=8B=E4=B8=AD?= =?UTF-8?q?=E6=A6=82=E7=8E=87=E6=80=A7=E9=80=80=E5=87=BA=E5=BC=95=E5=AF=BC?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/FormWidgetDetailPane.java | 6 ++--- .../theme/DownloadComponentPackageGuide.java | 27 ++++++++++++------- 2 files changed, 21 insertions(+), 12 deletions(-) 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 7b4e3c2e0..eb7e9e583 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 @@ -140,11 +140,11 @@ public class FormWidgetDetailPane extends FormDockView{ } public void switch2Local() { - cardLayout.show(centerPane, paneList.get(0).getTitle()); + headGroup.setSelectedIndex(0); } - public void swich2Online() { - cardLayout.show(centerPane, paneList.get(1).getTitle()); + public void switch2Online() { + headGroup.setSelectedIndex(ONLINE_TAB); } private UILabel tipLabel(String text) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java index 5d878a3c2..5215f232b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java @@ -29,6 +29,7 @@ import com.fr.design.mainframe.guide.tip.GuideTip; import com.fr.design.mainframe.share.ui.block.OnlineWidgetPackageBlock; import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane; import com.fr.design.mainframe.share.ui.online.OnlineWidgetTabPane; +import com.fr.design.mainframe.share.ui.online.widgetpackage.OnlineWidgetPackagesShowPane; import com.fr.design.mainframe.share.util.DownloadUtils; import com.fr.design.utils.ComponentUtils; import com.fr.form.share.utils.ShareUtils; @@ -102,22 +103,23 @@ public class DownloadComponentPackageGuide { EastRegionContainerPane.getInstance().showContainer(); EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS); OnlineWidgetRepoPane onlineWidgetRepoPane = OnlineWidgetRepoPane.getInstance(); - onlineWidgetRepoPane.setContent(); - OnlineWidgetTabPane tabPane = (OnlineWidgetTabPane) ComponentUtils.findComponentByClass(onlineWidgetRepoPane, OnlineWidgetTabPane.class); - UITabGroup tabGroup = (UITabGroup) ComponentUtils.findComponentByClass(tabPane, UITabGroup.class); - JPanel centerPane = (JPanel) tabPane.getComponent(1); - if (centerPane.getComponentCount() > 0) { + Component onlineWidgetPackagesShowPane = ComponentUtils.findComponentByClass(onlineWidgetRepoPane, OnlineWidgetPackagesShowPane.class); + if (onlineWidgetPackagesShowPane != null) { GuideManager.getInstance().getCurrentGuide().start(); } else { + onlineWidgetRepoPane.setContent(); + OnlineWidgetTabPane tabPane = (OnlineWidgetTabPane) ComponentUtils.findComponentByClass(onlineWidgetRepoPane, OnlineWidgetTabPane.class); + JPanel centerPane = (JPanel) tabPane.getComponent(1); centerPane.addContainerListener(new ContainerAdapter() { @Override public void componentAdded(ContainerEvent e) { - GuideManager.getInstance().getCurrentGuide().start(); + if (e.getChild() instanceof OnlineWidgetPackagesShowPane) { + GuideManager.getInstance().getCurrentGuide().start(); + } } }); } - tabGroup.setSelectedIndex(1); - tabGroup.tabChanged(1); + switch2OnlinePackageBlock(); } else { GuideCreateUtils.showNoNetworkAlert(); GuideManager.getInstance().getCurrentGuide().terminate(); @@ -168,7 +170,7 @@ public class DownloadComponentPackageGuide { @Override public boolean onComplete() { - FormWidgetDetailPane.getInstance().swich2Online(); + FormWidgetDetailPane.getInstance().switch2Online(); return true; } }); @@ -298,4 +300,11 @@ public class DownloadComponentPackageGuide { themeConfirmDialog.dispose(); } } + + private static void switch2OnlinePackageBlock() { + OnlineWidgetTabPane tabPane = (OnlineWidgetTabPane) ComponentUtils.findComponentByClass(OnlineWidgetRepoPane.getInstance(), OnlineWidgetTabPane.class); + UITabGroup tabGroup = (UITabGroup) ComponentUtils.findComponentByClass(tabPane, UITabGroup.class); + tabGroup.setSelectedIndex(1); + tabGroup.tabChanged(1); + } } From dbb9bb6ce7083fb2b0cebbaee3206db3238ff75f Mon Sep 17 00:00:00 2001 From: Tommy Date: Fri, 19 Nov 2021 09:53:52 +0800 Subject: [PATCH 09/15] =?UTF-8?q?REPORT-62896=20=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E5=B8=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/FormWidgetDetailPane.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 eb7e9e583..7e8cd6710 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 @@ -31,6 +31,7 @@ import java.util.List; * Time: 下午8:18 */ public class FormWidgetDetailPane extends FormDockView{ + private static final int LOCAL_TAB = 0; private static final int ONLINE_TAB = 1; private JPanel centerPane; @@ -104,7 +105,7 @@ public class FormWidgetDetailPane extends FormDockView{ cardLayout.show(centerPane, paneList.get(newSelectedIndex).getTitle()); } }; - headGroup.setSelectedIndex(ComponentReuseNotificationInfo.getInstance().isClickedWidgetLib() ? 0 : ONLINE_TAB); + headGroup.setSelectedIndex(ComponentReuseNotificationInfo.getInstance().isClickedWidgetLib() ? LOCAL_TAB : ONLINE_TAB); this.add(headGroup, BorderLayout.NORTH); this.add(centerPane, BorderLayout.CENTER); } @@ -140,7 +141,7 @@ public class FormWidgetDetailPane extends FormDockView{ } public void switch2Local() { - headGroup.setSelectedIndex(0); + headGroup.setSelectedIndex(LOCAL_TAB); } public void switch2Online() { From 3e6b0f874e3928d485c059ac61b8010a2fb30a99 Mon Sep 17 00:00:00 2001 From: yvan Date: Fri, 19 Nov 2021 09:57:10 +0800 Subject: [PATCH 10/15] =?UTF-8?q?REPORT-62680=20=E6=8F=92=E4=BB=B6-?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=AE=A1=E7=90=86-=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E9=87=8C=E6=B2=A1=E6=9C=89=E9=80=82=E9=85=8D=E7=A6=81?= =?UTF-8?q?=E7=94=A8=E6=8F=90=E7=A4=BA=20=E4=BB=A3=E7=A0=81=E8=B4=A8?= =?UTF-8?q?=E9=87=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/extra/PluginOperateUtils.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java b/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java index 7f68cd8bf..7dd2097dc 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java @@ -26,6 +26,7 @@ import com.fr.plugin.manage.control.PluginTaskCallback; import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.view.PluginView; import com.fr.plugin.xml.PluginElementName; +import com.fr.plugin.xml.PluginXmlElement; import com.fr.stable.StringUtils; import javax.swing.JOptionPane; @@ -101,15 +102,21 @@ public class PluginOperateUtils { boolean active = plugin.isActive(); PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(active, jsCallback); if (active) { - // 禁用前提示 - int rv = FineJOptionPane.showConfirmDialog( - null, - plugin.getXml().getElement(PluginElementName.ForbidReminder).getContent(), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), - JOptionPane.OK_CANCEL_OPTION, - JOptionPane.WARNING_MESSAGE - ); - if (rv == JOptionPane.OK_OPTION) { + PluginXmlElement forbidReminder = plugin.getXml().getElement(PluginElementName.ForbidReminder); + if (forbidReminder != null && forbidReminder.getContent() != null) { + // 禁用前提示 + int rv = FineJOptionPane.showConfirmDialog( + null, + forbidReminder.getContent(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.WARNING_MESSAGE + ); + if (rv == JOptionPane.OK_OPTION) { + PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); + } + } else { + // 正常禁用 PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); } } else { From 1b52c54a85171a2e46e2170096c9f66264023d8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 19 Nov 2021 14:35:48 +0800 Subject: [PATCH 11/15] =?UTF-8?q?REPORT-62275=20tab=E9=AB=98=E5=BA=A6?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E6=92=A4=E9=94=80=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/JTemplate.java | 10 ++++++++++ .../layout/FRCardMainBorderLayoutAdapter.java | 13 ++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index d8bc7fb48..f1f72b48c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -581,6 +581,16 @@ public abstract class JTemplate> fireSuperTargetModified(); } + public void undoToCurrent() { + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + BaseUndoState current = JTemplate.this.getUndoState(); + current.applyState(); + } + }); + } + /** * 模板更新 */ diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java index dd9e03c8d..7e30b9840 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java @@ -65,17 +65,8 @@ public class FRCardMainBorderLayoutAdapter extends FRBorderLayoutAdapter { if (minConstraint > value) { FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds")); JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (jt != null && jt.getUndoManager().canUndo()) { - // 自适应布局平分高度导致变矮的场景,优先做撤销 - UIUtil.invokeLaterIfNeeded(new Runnable() { - @Override - public void run() { - jt.undo(); - } - }); - } else if (container.getBackupBound() != null) { - // 手动拖动导致变矮的场景 - container.setSize(container.getBackupBound().getSize()); + if (jt != null) { + jt.undoToCurrent(); } return true; } else { From ccaa4cf79a164a7bc61facc7d9ef7cbf96b3856b Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 19 Nov 2021 14:51:37 +0800 Subject: [PATCH 12/15] =?UTF-8?q?CHART-22020=20=E3=80=90=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E3=80=91=E5=A4=A7=E5=B1=8F=E7=BC=96=E8=BE=91=E5=99=A8?= =?UTF-8?q?-=E7=AC=AC=E4=B8=80=E6=AC=A1=E5=90=AF=E5=8A=A8=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8-=E6=8F=92=E4=BB=B6=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E5=90=8E=EF=BC=8Creportlets=E6=A0=B9?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E6=98=BE=E7=A4=BA=E4=B8=8D=E4=BA=86FVS?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=EF=BC=8C=E5=8F=AA=E6=9C=89=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E6=A0=8F=E7=9A=84=E5=88=B7=E6=96=B0=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E6=89=8D=E8=83=BD=E5=87=BA=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/DesignerFrameFileDealerPane.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index 2925e03a8..a33aa91d5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -34,6 +34,7 @@ import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; +import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.event.Event; @@ -101,6 +102,23 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt return context.contain(PluginModule.ExtraDesign, ShortCut.TEMPLATE_TREE); } }); + GeneralContext.listenPluginRunningChanged(new PluginEventListener() { + @Override + public void on(PluginEvent event) { + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + DesignerFrameFileDealerPane.getInstance().refresh(); + DesignerFrameFileDealerPane.getInstance().stateChange(); + } + }); + } + }, new PluginFilter() { + @Override + public boolean accept(PluginContext context) { + return context.contain(PluginModule.ExtraDesign, App.MARK_STRING); + } + }); } private List otherToolbarStateChangeListeners = new ArrayList<>(); From 07d4884230cb93d9572837a2bb6624e4ffae2072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 19 Nov 2021 16:06:23 +0800 Subject: [PATCH 13/15] =?UTF-8?q?REPORT-62275=20tab=E9=AB=98=E5=BA=A6?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E6=92=A4=E9=94=80=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapters/layout/FRCardMainBorderLayoutAdapter.java | 7 +++++++ .../com/fr/design/designer/beans/models/AddingModel.java | 9 +++++++++ .../com/fr/design/mainframe/FormCreatorDropTarget.java | 4 +++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java index 00c0d7751..13910f7d4 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java @@ -1,12 +1,15 @@ package com.fr.design.designer.beans.adapters.layout; +import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.form.layout.FRBorderLayout; +import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.general.ComparatorUtils; import java.awt.BorderLayout; @@ -67,6 +70,10 @@ public class FRCardMainBorderLayoutAdapter extends FRBorderLayoutAdapter { if (jt != null) { jt.undoToCurrent(); } + + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + AddingModel model = formDesigner.getAddingModel(); + model.setAddedIllegal(true); return true; } else { return false; diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java index b94b21d94..ba0cf5dd0 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java @@ -24,6 +24,7 @@ public class AddingModel { private int currentX; private int currentY; private boolean added; + private boolean addedIllegal = false; // 有时候是添加完成了,但是添加会造成某些控件size不合法,例如tab public AddingModel(FormDesigner designer, XCreator xCreator) { this.creator = xCreator; @@ -140,4 +141,12 @@ public class AddingModel { y + designer.getVerticalScaleValue() - rect.y); return added; } + + public boolean isAddedIllegal() { + return addedIllegal; + } + + public void setAddedIllegal(boolean addedIllegal) { + this.addedIllegal = addedIllegal; + } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 82befa273..2fb7ba0e4 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -144,7 +144,9 @@ public class FormCreatorDropTarget extends DropTarget { designer.getSelectionModel().setSelectedCreators( FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget})); - designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); + if (!addingModel.isAddedIllegal()) { + designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); + } } else { Toolkit.getDefaultToolkit().beep(); // 拖入失败 取消选中 From e125cbe2d900fd50011d85ee4101ac5655a2a733 Mon Sep 17 00:00:00 2001 From: Tommy Date: Fri, 19 Nov 2021 16:56:35 +0800 Subject: [PATCH 14/15] =?UTF-8?q?REPORT-62974=20=E5=BC=95=E5=AF=BC?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=96=87=E5=AD=97=E4=B8=8E=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=AE=9E=E9=99=85=E6=96=87=E5=AD=97=E4=B8=8D=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../guide/creator/layout/UseLayoutAndComponentGuide.java | 2 +- .../guide/creator/theme/DownloadComponentPackageGuide.java | 2 +- .../design/mainframe/guide/creator/theme/ThemeToggleGuide.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java index 78e75d8f2..b4f5647c6 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java @@ -191,7 +191,7 @@ public class UseLayoutAndComponentGuide { Component component = ComponentUtils.findComponentByName(newFormPane.getWindow().getContentPane(), UIDialog.OK_BUTTON); if (component != null) { scene.addClickTarget(component, ClickScene.ClickType.LEFT); - scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Click_Confirm"), GuideTip.Direction.TOP); + scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Click", Toolkit.i18nText("Fine-Design_Report_OK")), GuideTip.Direction.TOP); } return super.prepared(); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java index 5215f232b..2825189aa 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java @@ -272,7 +272,7 @@ public class DownloadComponentPackageGuide { public boolean prepared() { Component target = ComponentUtils.findComponentByClass(themeConfirmDialog.getContentPane(), UIButton.class); scene.addClickTarget(target, ClickScene.ClickType.LEFT); - scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Click_Confirm"), GuideTip.Direction.BOTTOM); + scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Click_Confirm", Toolkit.i18nText("Fine-Design_Basic_Confirm")), GuideTip.Direction.BOTTOM); return super.prepared(); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java index 3ab6234a3..61dffc156 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java @@ -173,7 +173,7 @@ public class ThemeToggleGuide { @Override public boolean prepared() { scene.addClickTarget(ComponentUtils.findComponentByName(themeDialog, TemplateThemeGridPagesPane.COMPLETE_BUTTON), ClickScene.ClickType.LEFT, true); - scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Click_Complete"), BubbleTip.Direction.TOP); + scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Click", Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Close")), BubbleTip.Direction.TOP); return true; } From 19b7fcb536e8ef99218cca5827601eeb6c8ea46e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 19 Nov 2021 17:24:37 +0800 Subject: [PATCH 15/15] =?UTF-8?q?REPORT-62275=20tab=E9=AB=98=E5=BA=A6?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E6=92=A4=E9=94=80=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/FRCardMainBorderLayoutAdapter.java | 8 +++++++- .../designer/beans/models/AddingModel.java | 9 +++++++++ .../design/mainframe/FormCreatorDropTarget.java | 16 +++++++++------- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java index 7e30b9840..13910f7d4 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java @@ -1,13 +1,15 @@ package com.fr.design.designer.beans.adapters.layout; +import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.form.layout.FRBorderLayout; +import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.JTemplate; -import com.fr.design.ui.util.UIUtil; +import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.general.ComparatorUtils; import java.awt.BorderLayout; @@ -68,6 +70,10 @@ public class FRCardMainBorderLayoutAdapter extends FRBorderLayoutAdapter { if (jt != null) { jt.undoToCurrent(); } + + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + AddingModel model = formDesigner.getAddingModel(); + model.setAddedIllegal(true); return true; } else { return false; diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java index c0b6cd400..edc5ca998 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java @@ -24,6 +24,7 @@ public class AddingModel { private int currentX; private int currentY; private boolean added; + private boolean addedIllegal = false; // 有时候是添加完成了,但是添加会造成某些控件size不合法,例如tab public AddingModel(FormDesigner designer, XCreator xCreator) { this.creator = xCreator; @@ -142,4 +143,12 @@ public class AddingModel { y + designer.getVerticalScaleValue() - rect.y); return added; } + + public boolean isAddedIllegal() { + return addedIllegal; + } + + public void setAddedIllegal(boolean addedIllegal) { + this.addedIllegal = addedIllegal; + } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 7a6a73f4b..a2c1ba66c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -27,19 +27,16 @@ import com.fr.design.mod.bean.ContentChangeItem; import com.fr.design.mod.event.TableDataModifyEvent; import com.fr.design.utils.ComponentUtils; import com.fr.event.EventDispatcher; -import com.fr.form.share.editor.SharableEditorProvider; import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.ShareLoader; +import com.fr.form.share.editor.SharableEditorProvider; import com.fr.form.ui.Widget; import com.fr.stable.Constants; import com.fr.stable.StringUtils; -import java.util.Collections; -import java.util.HashMap; import javax.swing.BorderFactory; import javax.swing.JWindow; -import java.util.List; -import java.util.Map; +import javax.swing.SwingUtilities; import java.awt.Color; import java.awt.Component; import java.awt.Point; @@ -49,7 +46,10 @@ import java.awt.dnd.DropTarget; import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDropEvent; import java.awt.dnd.DropTargetEvent; -import javax.swing.SwingUtilities; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * 添加模式下鼠标事件处理器。 @@ -141,7 +141,9 @@ public class FormCreatorDropTarget extends DropTarget { } designer.getSelectionModel().setSelectedCreators( FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget})); - designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); + if (!addingModel.isAddedIllegal()) { + designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); + } tabDragInner.tryDragIn(); } else { Toolkit.getDefaultToolkit().beep();