Browse Source

REPORT-62275 tab高度弹窗撤销问题

zheng-1641779399395
方磊 3 years ago
parent
commit
19b7fcb536
  1. 8
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java
  2. 9
      designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java
  3. 14
      designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java

8
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; 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.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.dialog.FineJOptionPane; 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.FormDesigner;
import com.fr.design.mainframe.JTemplate; 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 com.fr.general.ComparatorUtils;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -68,6 +70,10 @@ public class FRCardMainBorderLayoutAdapter extends FRBorderLayoutAdapter {
if (jt != null) { if (jt != null) {
jt.undoToCurrent(); jt.undoToCurrent();
} }
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
AddingModel model = formDesigner.getAddingModel();
model.setAddedIllegal(true);
return true; return true;
} else { } else {
return false; return false;

9
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 currentX;
private int currentY; private int currentY;
private boolean added; private boolean added;
private boolean addedIllegal = false; // 有时候是添加完成了,但是添加会造成某些控件size不合法,例如tab
public AddingModel(FormDesigner designer, XCreator xCreator) { public AddingModel(FormDesigner designer, XCreator xCreator) {
this.creator = xCreator; this.creator = xCreator;
@ -142,4 +143,12 @@ public class AddingModel {
y + designer.getVerticalScaleValue() - rect.y); y + designer.getVerticalScaleValue() - rect.y);
return added; return added;
} }
public boolean isAddedIllegal() {
return addedIllegal;
}
public void setAddedIllegal(boolean addedIllegal) {
this.addedIllegal = addedIllegal;
}
} }

14
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.mod.event.TableDataModifyEvent;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.form.share.editor.SharableEditorProvider;
import com.fr.form.share.SharableWidgetProvider; 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.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.util.Collections;
import java.util.HashMap;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JWindow; import javax.swing.JWindow;
import java.util.List; import javax.swing.SwingUtilities;
import java.util.Map;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Point; import java.awt.Point;
@ -49,7 +46,10 @@ import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent; import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent; 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( designer.getSelectionModel().setSelectedCreators(
FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget})); FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget}));
if (!addingModel.isAddedIllegal()) {
designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED);
}
tabDragInner.tryDragIn(); tabDragInner.tryDragIn();
} else { } else {
Toolkit.getDefaultToolkit().beep(); Toolkit.getDefaultToolkit().beep();

Loading…
Cancel
Save