|
|
@ -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; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 删除当前所有选择的组件 |
|
|
|
* 删除当前所有选择的组件 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|