@ -21,7 +21,7 @@ import java.awt.Graphics;
public class FRFixLayoutAdapter extends AbstractLayoutAdapter {
private static final Icon OCCUPIED_ICON = IconUtils . readIcon ( "/com/fr/design/form/images/occupied_layout.png" ) ;
public FRFixLayoutAdapter ( XLayoutContainer container ) {
public FRFixLayoutAdapter ( XLayoutContainer container ) {
super ( container ) ;
}
@ -32,12 +32,11 @@ public class FRFixLayoutAdapter extends AbstractLayoutAdapter {
}
child . setLocation ( component . getX ( ) , component . getY ( ) ) ;
child . setSize ( component . getWidth ( ) , component . getHeight ( ) ) ;
container . remove ( component ) ;
if ( child . shouldScaleCreator ( ) | | child . hasTitleStyle ( ) ) {
XLayoutContainer parentPanel = child . initCreatorWrapper ( 21 ) ;
container . add ( parentPanel , child . toData ( ) . getWidgetName ( ) ) ;
container . replaceXcreator ( parentPanel , ( XCreator ) component ) ;
} else {
container . add ( child , child . toData ( ) . getWidgetName ( ) ) ;
container . replaceXcreator ( child , ( XCreator ) component ) ;
}
if ( child . getBackupRectangle ( ) ! = null & & child . getParent ( ) = = container ) {
Component origin = container . getComponentAt ( child . getBackupRectangle ( ) . x + 5 , child . getBackupRectangle ( ) . y + 5 ) ;
@ -52,15 +51,20 @@ public class FRFixLayoutAdapter extends AbstractLayoutAdapter {
@Override
public void delete ( XCreator creator , int creatorWidth , int creatorHeight ) {
//固定布局下不支持移除占位块组件
if ( creator . acceptType ( XOccupiedLayout . class ) ) {
return ;
}
OccupiedLayout occupiedLayout = new OccupiedLayout ( ) ;
FormDesigner formDesigner = WidgetPropertyPane . getInstance ( ) . getEditingFormDesigner ( ) ;
XOccupiedLayout xoccupiedLayout = new XOccupiedLayout ( occupiedLayout , new Dimension ( ) ) ;
ModelUtil . renameWidgetName ( formDesigner . getTarget ( ) , xoccupiedLayout ) ;
xoccupiedLayout . setLocation ( creator . getX ( ) , creator . getY ( ) ) ;
xoccupiedLayout . setSize ( creatorWidth , creatorHeight ) ;
container . add ( xoccupiedLayout ) ;
container . replaceXcreator ( xoccupiedLayout , creator ) ;
}
@Override
public XCreatorTreeCellRender getLayoutTreeCellRender ( XCreator creator ) {
return new DefaultXCreatorTreeCellRender ( creator ) {