Browse Source

Pull request #1765: REPORT-34222 报表设计器给容器插件开个复制粘贴的接口

Merge in DESIGN/design from ~HADES/design:release/10.0 to release/10.0

* commit 'c931a99aa0f5d5de6f84b5f9c68ac924a39b0f5f':
  REPORT-34222 加泛型参数
  REPORT-34222 加个泛型参数
  REPORT-34222 报表设计器给容器插件开个复制粘贴的接口
feature/big-screen
Hades 4 years ago
parent
commit
b920f8c517
  1. 7
      designer-base/src/main/java/com/fr/design/fun/FormWidgetOptionProvider.java
  2. 5
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormWidgetOptionProvider.java
  3. 26
      designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java

7
designer-base/src/main/java/com/fr/design/fun/FormWidgetOptionProvider.java

@ -16,4 +16,11 @@ public interface FormWidgetOptionProvider extends ParameterWidgetOptionProvider
*/ */
boolean isContainer(); boolean isContainer();
/**
* 如果是布局容器要实现粘贴到容器中的操作
* @param t
* @param <T> 泛型参数 表示选中的组件 一般为FormSelection
*/
<T> void paste2Container(T t);
} }

5
designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormWidgetOptionProvider.java

@ -25,4 +25,9 @@ public abstract class AbstractFormWidgetOptionProvider extends AbstractProvider
public boolean isContainer() { public boolean isContainer() {
return false; return false;
} }
@Override
public <T> void paste2Container(T t) {
// do nothing
}
} }

26
designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java

@ -1,6 +1,7 @@
package com.fr.design.designer.beans.models; package com.fr.design.designer.beans.models;
import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.base.clipboard.ClipboardFilter; import com.fr.design.base.clipboard.ClipboardFilter;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.LayoutAdapter;
@ -19,11 +20,13 @@ import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.form.util.FormDesignerUtils; import com.fr.design.form.util.FormDesignerUtils;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
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.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.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import java.awt.LayoutManager; import java.awt.LayoutManager;
@ -31,6 +34,7 @@ import java.awt.Rectangle;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Set;
/** /**
* 该model保存当前选择的组件和剪切版信息 * 该model保存当前选择的组件和剪切版信息
@ -43,6 +47,7 @@ public class SelectionModel {
private FormDesigner designer; private FormDesigner designer;
private FormSelection selection; private FormSelection selection;
private Rectangle hotspotBounds; private Rectangle hotspotBounds;
private FormWidgetOptionProvider provider;
public SelectionModel(FormDesigner designer) { public SelectionModel(FormDesigner designer) {
this.designer = designer; this.designer = designer;
@ -256,9 +261,30 @@ public class SelectionModel {
//绝对布局 //绝对布局
Rectangle rec = selection.getSelctionBounds(); Rectangle rec = selection.getSelctionBounds();
FormSelectionUtils.paste2Container(designer, container, clipboard, rec.x + DELTA_X_Y, rec.y + DELTA_X_Y); FormSelectionUtils.paste2Container(designer, container, clipboard, rec.x + DELTA_X_Y, rec.y + DELTA_X_Y);
} else if (isExtraContainer(container)) {
provider.paste2Container(selection);
} }
} }
/**
* 扩展的容器布局
* @param container
* @return
*/
private boolean isExtraContainer(XLayoutContainer container) {
if (container != null) {
Set<FormWidgetOptionProvider> set = ExtraDesignClassManager.getInstance().getArray(FormWidgetOptionProvider.XML_TAG);
for (FormWidgetOptionProvider provider : set) {
if (provider.isContainer() && ComparatorUtils.equals(provider.appearanceForWidget(), selection.getSelectedCreator().getParent().getClass())) {
this.provider = provider;
return true;
}
}
}
return false;
}
/** /**
* 删除当前所有选择的组件 * 删除当前所有选择的组件
*/ */

Loading…
Cancel
Save