Browse Source

Pull request #6728: REPORT-62275&REPORT-62275 表单拖入失败-自动撤销&tab高度弹窗撤销问题

Merge in DESIGN/design from ~FANGLEI/design:release/11.0 to release/11.0

* commit '60edfb2cbdaa50ba950ed4d1a54982de15cd9cbb':
  REPORT-62275&REPORT-61827
  REPORT-62275
  REPORT-61827
  REPORT-62275 表单拖入失败-自动撤销
bugfix/11.0
fanglei 3 years ago
parent
commit
5c51007a5c
  1. 17
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  2. 1
      designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java
  3. 4
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java
  4. 1
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRBorderLayoutAdapter.java
  5. 14
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java
  6. 2
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  7. 1
      designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java
  8. 1
      designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java
  9. 16
      designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java
  10. 10
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

17
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.DesignBanCopyAttrMark;
import com.fr.base.iofile.attr.TemplateIdAttrMark; import com.fr.base.iofile.attr.TemplateIdAttrMark;
import com.fr.base.iofile.attr.TemplateThemeAttrMark; import com.fr.base.iofile.attr.TemplateThemeAttrMark;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeCompatible; import com.fr.base.theme.TemplateThemeCompatible;
import com.fr.base.theme.TemplateThemeConfig;
import com.fr.base.theme.ThemedTemplate; import com.fr.base.theme.ThemedTemplate;
import com.fr.base.vcs.DesignerMode; 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.decision.config.FSConfig;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState; import com.fr.design.DesignState;
@ -70,14 +70,13 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.locale.InterProviderFactory; import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory; 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.CptAndCptxCompatibilityUtil;
import com.fr.nx.app.designer.utils.CptCompileUtil; import com.fr.nx.app.designer.utils.CptCompileUtil;
import com.fr.nx.cptx.entry.metadata.CptxMetadata; import com.fr.nx.cptx.entry.metadata.CptxMetadata;
import com.fr.nx.cptx.utils.CptxFileUtils; import com.fr.nx.cptx.utils.CptxFileUtils;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime; 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.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEvent;
@ -642,6 +641,16 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
fireSuperTargetModified(); fireSuperTargetModified();
} }
public void undoToCurrent() {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
BaseUndoState current = JTemplate.this.getUndoState();
current.applyState();
}
});
}
/** /**
* 模板更新 * 模板更新
*/ */

1
designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java

@ -140,5 +140,4 @@ public interface LayoutAdapter {
default void dragOver(XCreator xCreator, SelectionModel selectionModel, int x, int y) { default void dragOver(XCreator xCreator, SelectionModel selectionModel, int x, int y) {
}; };
} }

4
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java

@ -13,7 +13,7 @@ import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import java.awt.*; import java.awt.LayoutManager;
public abstract class AbstractLayoutAdapter implements LayoutAdapter { public abstract class AbstractLayoutAdapter implements LayoutAdapter {
@ -209,6 +209,4 @@ public abstract class AbstractLayoutAdapter implements LayoutAdapter {
selectionModel.removeCreator(xCreator, xCreator.getWidth(), xCreator.getHeight()); selectionModel.removeCreator(xCreator, xCreator.getWidth(), xCreator.getHeight());
selectionModel.setSelectedCreator(container); selectionModel.setSelectedCreator(container);
} }
} }

1
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) { public ConstraintsGroupModel getLayoutConstraints(XCreator creator) {
return new FRBorderLayoutConstraints(container, creator); return new FRBorderLayoutConstraints(container, creator);
} }
} }

14
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.file.HistoryTemplateListPane;
import com.fr.design.form.layout.FRBorderLayout; import com.fr.design.form.layout.FRBorderLayout;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.ui.util.UIUtil;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -65,17 +64,8 @@ public class FRCardMainBorderLayoutAdapter extends FRBorderLayoutAdapter {
if (minConstraint > value) { if (minConstraint > value) {
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds")); FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds"));
JTemplate<?, ?> jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (jt != null && jt.getUndoManager().canUndo()) { if (jt != null) {
// 自适应布局平分高度导致变矮的场景,优先做撤销 jt.undoToCurrent();
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
jt.undo();
}
});
} else if (container.getBackupBound() != null) {
// 手动拖动导致变矮的场景
container.setSize(container.getBackupBound().getSize());
} }
return true; return true;
} else { } else {

2
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java

@ -1243,5 +1243,5 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
public void dragOver(XCreator xCreator, SelectionModel selectionModel,int x, int y) { public void dragOver(XCreator xCreator, SelectionModel selectionModel,int x, int y) {
frLayoutState.dragOver(xCreator, selectionModel,x,y); frLayoutState.dragOver(xCreator, selectionModel,x,y);
}; }
} }

1
designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java

@ -140,5 +140,4 @@ public class AddingModel {
y + designer.getVerticalScaleValue() - rect.y); y + designer.getVerticalScaleValue() - rect.y);
return added; return added;
} }
} }

1
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.FormDesigner;
import com.fr.design.mainframe.FormSelection; import com.fr.design.mainframe.FormSelection;
import com.fr.design.mainframe.FormSelectionUtils; 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.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;

16
designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java

@ -1,12 +1,11 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.datatransfer.Transferable; import com.fr.design.designer.beans.models.AddingModel;
import com.fr.design.file.HistoryTemplateListPane;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.TransferHandler; import javax.swing.TransferHandler;
import java.awt.datatransfer.Transferable;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.beans.models.AddingModel;
public class DesignerTransferHandler extends TransferHandler { public class DesignerTransferHandler extends TransferHandler {
@ -21,7 +20,14 @@ public class DesignerTransferHandler extends TransferHandler {
protected void exportDone(JComponent source, Transferable data, int action) { protected void exportDone(JComponent source, Transferable data, int action) {
if (!addingModel.isCreatorAdded()) { if (!addingModel.isCreatorAdded()) {
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_CUTED); undoWhenAddingFailed();
}
}
private void undoWhenAddingFailed() {
JTemplate<?, ?> jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (jt != null) {
jt.undoToCurrent();
} }
} }
} }

10
designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

@ -29,20 +29,20 @@ import com.fr.workspace.Workspace;
import com.fr.workspace.base.WorkspaceConstants; import com.fr.workspace.base.WorkspaceConstants;
import com.fr.workspace.connect.WorkspaceConnection; import com.fr.workspace.connect.WorkspaceConnection;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.server.socket.SocketInfoOperator;
import io.socket.client.IO; import io.socket.client.IO;
import io.socket.client.Socket; import io.socket.client.Socket;
import io.socket.emitter.Emitter; import io.socket.emitter.Emitter;
import javax.net.ssl.SSLContext;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.security.KeyStore;
import java.util.Arrays;
import javax.net.ssl.SSLContext;
import javax.swing.*;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.URL; import java.net.URL;
import java.security.KeyStore;
import java.util.Arrays;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;

Loading…
Cancel
Save