Browse Source

REPORT-63322 决策报表及聚合报表,无法拖动组件

【问题原因】
在某些场景下,组件可能会被破坏或无法被当前设计器解析,从而出现
异常。若拖拽时的异常不被处理,会导致无法完成整个swing拖拽过程,
从而影响后续其他所有的组件拖拽。

【改动思路】
同产品以及交互讨论,新增了一个错误提示信息,当拖拽组件出现
异常时,提示用户,同时终结当前的拖拽。
bugfix/10.0
Starryi 3 years ago
parent
commit
afe4c1e5b5
  1. 22
      designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java

22
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.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
@ -31,12 +32,15 @@ import com.fr.form.share.SharableWidgetProvider;
import com.fr.form.share.ShareLoader; import com.fr.form.share.ShareLoader;
import com.fr.form.share.editor.SharableEditorProvider; import com.fr.form.share.editor.SharableEditorProvider;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JOptionPane;
import javax.swing.JWindow; import javax.swing.JWindow;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Point; import java.awt.Point;
@ -318,6 +322,24 @@ public class FormCreatorDropTarget extends DropTarget {
*/ */
@Override @Override
public synchronized void drop(DropTargetDropEvent dtde) { public synchronized void drop(DropTargetDropEvent dtde) {
try {
dropXCreator(dtde);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
if (addingModel.getXCreator().isShared()) {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Drag_Component_Error_Info"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"),
JOptionPane.ERROR_MESSAGE,
UIManager.getIcon("OptionPane.errorIcon")
);
}
dtde.rejectDrop();
}
}
private void dropXCreator(DropTargetDropEvent dtde) {
Point loc = dtde.getLocation(); Point loc = dtde.getLocation();
this.adding(designer.getRelativeX(loc.x), designer.getRelativeY(loc.y)); this.adding(designer.getRelativeX(loc.x), designer.getRelativeY(loc.y));
// 放到事件末尾执行 // 放到事件末尾执行

Loading…
Cancel
Save