@ -10,6 +10,7 @@ import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer ;
import com.fr.design.designer.creator.XWAbsoluteLayout ;
import com.fr.design.designer.creator.XWFitLayout ;
import com.fr.design.designer.creator.XWParameterLayout ;
import com.fr.design.designer.creator.XWScaleLayout ;
import com.fr.design.designer.creator.XWTitleLayout ;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout ;
@ -60,6 +61,11 @@ public class FormSelectionUtils {
* /
public static void paste2Container ( FormDesigner designer , XLayoutContainer parent ,
FormSelection clipboard , int x , int y ) {
clipboard = filterFormSelection ( clipboard , parent ) ;
if ( clipboard . isEmpty ( ) ) {
Toolkit . getDefaultToolkit ( ) . beep ( ) ;
return ;
}
LayoutAdapter adapter = parent . getLayoutAdapter ( ) ;
if ( parent instanceof XWAbsoluteLayout ) {
//绝对布局
@ -77,6 +83,27 @@ public class FormSelectionUtils {
Toolkit . getDefaultToolkit ( ) . beep ( ) ;
}
private static FormSelection filterFormSelection ( FormSelection clipboard , XLayoutContainer parent ) {
FormSelection newSelection = new FormSelection ( ) ;
for ( XCreator xCreator : clipboard . getSelectedCreators ( ) ) {
if ( parent . acceptType ( XWParameterLayout . class ) ) {
if ( xCreator . canEnterIntoParaPane ( ) ) {
newSelection . addSelectedCreator ( xCreator ) ;
}
} else if ( parent . acceptType ( XWAbsoluteLayout . class ) ) {
if ( xCreator . canEnterIntoAbsolutePane ( ) ) {
newSelection . addSelectedCreator ( xCreator ) ;
}
} else if ( parent . acceptType ( XWFitLayout . class ) ) {
if ( xCreator . canEnterIntoAdaptPane ( ) ) {
newSelection . addSelectedCreator ( xCreator ) ;
}
}
}
return newSelection ;
}
private static boolean isExtraContainer ( XLayoutContainer parent ) {
if ( parent ! = null ) {
Set < FormWidgetOptionProvider > set = ExtraDesignClassManager . getInstance ( ) . getArray ( FormWidgetOptionProvider . XML_TAG ) ;