@ -6,7 +6,10 @@ import com.fr.design.DesignState;
import com.fr.design.designer.TargetComponent ;
import com.fr.design.designer.beans.AdapterBus ;
import com.fr.design.designer.beans.Painter ;
import com.fr.design.designer.beans.actions.CopyAction ;
import com.fr.design.designer.beans.actions.CutAction ;
import com.fr.design.designer.beans.actions.FormDeleteAction ;
import com.fr.design.designer.beans.actions.PasteAction ;
import com.fr.design.designer.beans.adapters.layout.FRParameterLayoutAdapter ;
import com.fr.design.designer.beans.events.CreatorEventListenerTable ;
import com.fr.design.designer.beans.events.DesignerEditListener ;
@ -43,7 +46,6 @@ import com.fr.form.ui.container.WFitLayout;
import com.fr.general.ComparatorUtils ;
import com.fr.general.FRLogger ;
import com.fr.general.Inter ;
import com.fr.plugin.ExtraClassManager ;
import com.fr.stable.ArrayUtils ;
import com.fr.stable.bridge.StableFactory ;
@ -69,7 +71,6 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
protected static final ArrayList < String > NAME_ARRAY_LIST = new ArrayList < String > (
Arrays . asList ( new String [ ] { Inter . getLocText ( "M_Edit-Cut" ) , Inter . getLocText ( "M_Edit-Copy" ) , Inter . getLocText ( "M_Edit-Delete" ) } )
) ;
private static final int BORDER_WIDTH = 6 ;
//底层容器的默认大小
protected static final Dimension LARGE_PREFERRED_SIZE = new Dimension ( WBorderLayout . DEFAULT_WIDTH , WBorderLayout . DEFAULT_HEIGHT ) ;
private int paraHeight = 0 ;
@ -81,7 +82,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
private XLayoutContainer paraComponent ;
private boolean drawLineMode ;
private FormArea formArea ;
private ConnectorHelper C onnectorHelper;
private ConnectorHelper c onnectorHelper;
private boolean isReportBlockEditing = false ;
//组件重叠
@ -104,7 +105,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
// 编辑状态的事件表
private CreatorEventListenerTable edit ;
protected Action [ ] designer_a ctions ;
protected Action [ ] designerA ctions ;
private FormDesignerModeForSpecial < ? > desigerMode ;
private Action switchAction ;
private FormElementCaseContainerProvider elementCaseContainer ;
@ -214,6 +215,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 是否有查询按钮
*
* @return 有无查询按钮
* /
public boolean isWithQueryButton ( ) {
@ -223,6 +225,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 加入参数到参数面板
*
* @param parameter 参数
* @return 是否加入
* /
@ -256,6 +259,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 加入参数到参数面板 , 有查询按钮
*
* @param parameter 参数
* @return 是否加入
* /
@ -357,6 +361,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 自动添加组件
*
* @param xCreator 组件
* @param x 横坐标
* @param y 纵坐标
@ -375,6 +380,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 在参数很多时 , 全部添加的时候 , 可以向下一次排版 , 若去掉就会在参数面板堆到一起
*
* @param creator 组件
* @param x 长度
* @param y 长度
@ -425,6 +431,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 返回根节点父容器
*
* @return 父容器
* /
public Component getTopContainer ( ) {
@ -437,6 +444,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 返回参数界面高度
*
* @return para高度
* /
public int getParaHeight ( ) {
@ -445,6 +453,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 重置para的高度
*
* @param height 高度
* /
public void setParaHeight ( int height ) {
@ -472,6 +481,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 切换
*
* @param elementCaseContainer 容器
* /
public void switchTab ( FormElementCaseContainerProvider elementCaseContainer ) {
@ -524,6 +534,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 增加监听事件
*
* @param listener 界面组件编辑事件
* /
public void addDesignerEditListener ( DesignerEditListener listener ) {
@ -539,13 +550,13 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 表单则判断参数面板是否为绝对布局
*
* @return 是则返回true
* /
public boolean hasWAbsoluteLayout ( ) {
if ( paraComponent ! = null & & paraComponent . acceptType ( XWParameterLayout . class ) ) {
return true ;
}
else {
} else {
if ( this . getSelectionModel ( ) . getSelection ( ) . getSelectedCreator ( ) . getParent ( ) ! = null
& & ( ( XLayoutContainer ) this . getSelectionModel ( ) . getSelection ( ) . getSelectedCreator ( ) . getParent ( ) ) . acceptType ( XWAbsoluteLayout . class ) ) {
return true ;
@ -556,6 +567,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 设置是否为报表块编辑
*
* @param isEditing 是否为报表块编辑
* /
public void setReportBlockEditing ( boolean isEditing ) {
@ -564,6 +576,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 是否为报表块编辑
*
* @return 是否为报表块编辑
* /
public boolean isReportBlockEditing ( ) {
@ -580,6 +593,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 是否重命名控件
*
* @param creator 组件
* @param newName 新的组件名
* @return 组件名有变化 , 且不和其他一样返回true
@ -598,6 +612,12 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
return true ;
}
public void showMessageDialog ( String message ) {
JOptionPane . showMessageDialog ( this , message , Inter . getLocText ( "FR-Designer_Alert" ) , JOptionPane . WARNING_MESSAGE ) ;
FormSelectionUtils . rebuildSelection ( this ) ;
repaint ( ) ;
}
/ * *
* 保存参数界面的宽度
*
@ -609,6 +629,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 更新界面布局 , 重绘
*
* @param proxy 动态代理类
* @param method 接口方法
* @param args 参数
@ -654,6 +675,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 增加组件事件
*
* @param h 动态代理
* /
public void addInvocationHandler ( InvocationHandler h ) {
@ -741,16 +763,14 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 更新边框线状态
*
* @param e 鼠标事件
* /
public void updateDrawLineMode ( MouseEvent e ) {
Point p = ConnectorHelper . getNearWidgetPoint ( e ) ;
if ( p = = null ) {
XComponent comp = getComponentAt ( e ) ;
if ( comp = = rootComponent ) {
Point p = connectorHelper . getNearWidgetPoint ( e ) ;
if ( p = = null & & getComponentAt ( e ) = = rootComponent ) {
p = new Point ( e . getX ( ) + formArea . getHorizontalValue ( ) , e . getY ( ) + formArea . getVerticalValue ( ) ) ;
}
}
stateModel . startDrawLine ( p ) ;
}
@ -841,6 +861,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 是否是报表的参数面板
*
* @return 否 ( 表单的 )
* /
public boolean isFormParaDesigner ( ) {
@ -849,6 +870,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 是否为底层容器
*
* @param comp 组件
* @return 是则返回true
* /
@ -941,6 +963,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 拖拽准备
*
* @param xCreator 组件
* /
public void startDraggingBean ( XCreator xCreator ) {
@ -954,6 +977,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 拖拽时相关处理
*
* @param xCreator 组件
* @param lastPressEvent 鼠标事件
* @param x 坐标x
@ -978,6 +1002,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 改变组件值
*
* @param e 组件选择事件
* /
@Override
@ -1024,6 +1049,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 是否支持权限编辑
*
* @return 是则返回true
* /
public boolean isSupportAuthority ( ) {
@ -1049,6 +1075,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 是否含有action名
*
* @param name action名
* @return 有则返回true
* /
@ -1058,6 +1085,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 显示组件
*
* @param comp 组件
* /
public void makeVisible ( XCreator comp ) {
@ -1088,16 +1116,16 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 返回复制粘贴删除等动作
* 鼠标右键菜单
*
* @return 同上
* /
public Action [ ] getActions ( ) {
if ( designer_actions = = null ) {
//先把复制粘贴按钮去掉,只留下删除
// designer_actions = new Action[]{new CutAction(this), new CopyAction(this), new PasteAction(this),
// new FormDeleteAction(this)};
designer_actions = new Action [ ] { new FormDeleteAction ( this ) } ;
if ( designerActions = = null ) {
designerActions = new Action [ ] { new CutAction ( this ) , new CopyAction ( this ) , new PasteAction ( this ) ,
new FormDeleteAction ( this ) } ;
}
return designer_a ctions ;
return designerActions ;
}
protected Border getOuterBorder ( ) {
@ -1120,6 +1148,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 返回表单区域
*
* @return 表单区域
* /
public FormArea getArea ( ) {
@ -1128,6 +1157,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 设置上层区域
*
* @param formArea 表单区域
* /
public void setParent ( FormArea formArea ) {
@ -1136,6 +1166,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 绘制组件根节点
*
* @param clipg 图形
* /
public void paintContent ( Graphics clipg ) {
@ -1157,14 +1188,16 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 返回连线类
*
* @return ConnectorHelper类
* /
public ConnectorHelper getDrawLineHelper ( ) {
return C onnectorHelper;
return c onnectorHelper;
}
/ * *
* 是否画线模式
*
* @return 是则返回true
* /
public boolean isDrawLineMode ( ) {
@ -1173,6 +1206,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 设置DrawLineMode
*
* @param mode 是or或
* /
public void setDrawLineMode ( boolean mode ) {
@ -1199,6 +1233,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 返回表单控件权限编辑pane
*
* @return 同上
* /
public AuthorityEditPane createAuthorityEditPane ( ) {
@ -1249,6 +1284,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 粘贴
*
* @return 否
* /
@Override
@ -1259,6 +1295,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 剪切
*
* @return 否
* /
@Override
@ -1273,6 +1310,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 工具栏菜单
*
* @return 同上
* /
@Override
@ -1286,6 +1324,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 模版菜单
*
* @return 同上
* /
@Override
@ -1295,6 +1334,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 权限菜单
*
* @return 同上
* /
public ShortCut [ ] shortCuts4Authority ( ) {
@ -1304,6 +1344,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 返回ToolBarDef
*
* @return 同上
* /
@Override
@ -1313,10 +1354,12 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/ * *
* 返回工具栏按钮组件
*
* @return 同上
* /
public JComponent [ ] toolBarButton4Form ( ) {
return new JComponent [ 0 ] ;
return new JComponent [ ] { new CutAction ( this ) . createToolBarComponent ( ) , new CopyAction ( this ) . createToolBarComponent ( ) , new PasteAction ( this ) . createToolBarComponent ( ) ,
new FormDeleteAction ( this ) . createToolBarComponent ( ) } ;
}