daniel 8 years ago
parent
commit
74f3d05704
  1. 6
      designer/src/com/fr/design/mainframe/CellElementPropertyPane.java
  2. 1
      designer/src/com/fr/design/mainframe/templateinfo/JWorkBookProcessInfo.java
  3. 12
      designer/src/com/fr/design/webattr/EditToolBar.java
  4. 20
      designer_base/build.master.gradle
  5. 89
      designer_base/build.master.gradle.bak
  6. 23
      designer_base/build.release.gradle
  7. 70
      designer_base/src/com/fr/design/actions/edit/CopyAction.java
  8. 7
      designer_base/src/com/fr/design/beans/location/WidgetForbidWindow.java
  9. 3
      designer_base/src/com/fr/design/extra/PluginHelper.java
  10. 15
      designer_base/src/com/fr/design/locale/designer.properties
  11. 14
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  12. 19
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  13. 19
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  14. 20
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  15. 20
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  16. 67
      designer_base/src/com/fr/design/mainframe/BaseJForm.java
  17. 111
      designer_base/src/com/fr/design/mainframe/JTemplate.java
  18. 43
      designer_base/src/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java
  19. 20
      designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDockPlus.java
  20. 73
      designer_base/src/com/fr/design/parameter/ParameterDesignerProvider.java
  21. 3
      designer_base/src/com/fr/design/style/color/ColorSelectConfigManager.java
  22. 303
      designer_base/src/com/fr/design/utils/ComponentUtils.java
  23. 2
      designer_base/src/com/fr/env/RemoteEnv.java
  24. 20
      designer_chart/build.master.gradle
  25. 85
      designer_chart/build.master.gradle.bak
  26. 20
      designer_chart/build.release.gradle
  27. 74
      designer_chart/src/com/fr/design/chart/axis/MinMaxValuePane.java
  28. 2
      designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java
  29. 2
      designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  30. 17
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/AbstractReportDataContentPane.java
  31. 15
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java
  32. 17
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/PiePlotReportDataContentPane.java
  33. 22
      designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java
  34. 13
      designer_chart/src/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java
  35. 21
      designer_form/build.master.gradle
  36. 22
      designer_form/build.master.gradle.bak
  37. 21
      designer_form/build.release.gradle
  38. 2
      designer_form/src/com/fr/design/designer/beans/ConnectorCreator.java
  39. 177
      designer_form/src/com/fr/design/designer/beans/LayoutAdapter.java
  40. 59
      designer_form/src/com/fr/design/designer/beans/actions/CopyAction.java
  41. 361
      designer_form/src/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java
  42. 2
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java
  43. 26
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java
  44. 4
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  45. 211
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java
  46. 7
      designer_form/src/com/fr/design/designer/beans/location/AccessDirection.java
  47. 2
      designer_form/src/com/fr/design/designer/beans/location/Inner.java
  48. 272
      designer_form/src/com/fr/design/designer/beans/models/AddingModel.java
  49. 760
      designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java
  50. 920
      designer_form/src/com/fr/design/designer/beans/models/StateModel.java
  51. 187
      designer_form/src/com/fr/design/designer/beans/painters/AbstractPainter.java
  52. 182
      designer_form/src/com/fr/design/designer/creator/DedicateLayoutContainer.java
  53. 435
      designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java
  54. 23
      designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java
  55. 23
      designer_form/src/com/fr/design/designer/creator/XWFitLayout.java
  56. 2
      designer_form/src/com/fr/design/designer/creator/XWScaleLayout.java
  57. 2
      designer_form/src/com/fr/design/designer/creator/XWTitleLayout.java
  58. 6
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  59. 338
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java
  60. 4
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java
  61. 1388
      designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java
  62. 172
      designer_form/src/com/fr/design/mainframe/ConnectorHelper.java
  63. 1239
      designer_form/src/com/fr/design/mainframe/EditingMouseListener.java
  64. 17
      designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java
  65. 245
      designer_form/src/com/fr/design/mainframe/FormDesigner.java
  66. 584
      designer_form/src/com/fr/design/mainframe/FormSelection.java
  67. 363
      designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java
  68. 1589
      designer_form/src/com/fr/design/mainframe/JForm.java
  69. 3
      designer_form/src/com/fr/design/mainframe/MobileParaWidgetTable.java
  70. 692
      designer_form/src/com/fr/design/mainframe/MobileWidgetTable.java
  71. 736
      designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java
  72. 8
      designer_form/src/com/fr/design/mainframe/templateinfo/JFormProcessInfo.java

6
designer/src/com/fr/design/mainframe/CellElementPropertyPane.java

@ -108,8 +108,10 @@ public class CellElementPropertyPane extends DockingView {
} }
public void reInit(ElementCasePane ePane) { public void reInit(ElementCasePane ePane) {
this.add(titlePane, BorderLayout.NORTH); if (titlePane.getParent() == null) { // 如果处于隐藏状态,则让其显示
this.add(cellElementEditPane, BorderLayout.CENTER); this.add(titlePane, BorderLayout.NORTH);
this.add(cellElementEditPane, BorderLayout.CENTER);
}
cellElementEditPane.populate(ePane); cellElementEditPane.populate(ePane);
} }

1
designer_base/src/com/fr/design/mainframe/templateinfo/JWorkBookProcessInfo.java → designer/src/com/fr/design/mainframe/templateinfo/JWorkBookProcessInfo.java

@ -1,6 +1,5 @@
package com.fr.design.mainframe.templateinfo; package com.fr.design.mainframe.templateinfo;
import com.fr.base.io.IOFile;
import com.fr.base.parameter.ParameterUI; import com.fr.base.parameter.ParameterUI;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
import com.fr.report.cellcase.CellCase; import com.fr.report.cellcase.CellCase;

12
designer/src/com/fr/design/webattr/EditToolBar.java

@ -329,15 +329,16 @@ public class EditToolBar extends BasicPane {
private JavaScriptActionPane javaScriptPane; private JavaScriptActionPane javaScriptPane;
private ExportToolBarProvider[] exportToolBarProviders; private ExportToolBarProvider[] exportToolBarProviders;
private ChangeListener changeListener = new ChangeListener() { private ActionListener actionListener = new ActionListener() {
public void stateChanged(ChangeEvent e) { @Override
public void actionPerformed(ActionEvent e) {
if (isVerify.isSelected()) { if (isVerify.isSelected()) {
failSubmit.setVisible(true); failSubmit.setVisible(true);
} else { } else {
failSubmit.setVisible(false); failSubmit.setVisible(false);
failSubmit.setSelected(false);
} }
} }
}; };
public ButtonPane() { public ButtonPane() {
@ -481,7 +482,7 @@ public class EditToolBar extends BasicPane {
submitPane.add(isVerify); submitPane.add(isVerify);
submitPane.add(failSubmit); submitPane.add(failSubmit);
submitPane.add(isCurSheet); submitPane.add(isCurSheet);
isVerify.addChangeListener(changeListener); isVerify.addActionListener(actionListener);
return submitPane; return submitPane;
} }
@ -573,6 +574,9 @@ public class EditToolBar extends BasicPane {
card.show(centerPane, "submit"); card.show(centerPane, "submit");
Submit submit = ((Submit) widget); Submit submit = ((Submit) widget);
this.isVerify.setSelected(submit.isVerify()); this.isVerify.setSelected(submit.isVerify());
if (!submit.isVerify()) {
this.failSubmit.setVisible(false);
}
this.failSubmit.setSelected(submit.isFailVerifySubmit()); this.failSubmit.setSelected(submit.isFailVerifySubmit());
this.isCurSheet.setSelected(submit.isOnlySubmitSelect()); this.isCurSheet.setSelected(submit.isOnlySubmitSelect());
} }

20
designer_base/build.master.gradle

@ -1,8 +1,26 @@
apply plugin: 'java'
tasks.withType(JavaCompile){ tasks.withType(JavaCompile){
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
buildscript {
repositories {
maven {
url "http://www.eveoh.nl/files/maven2"
}
}
dependencies {
classpath "nl.eveoh:gradle-aspectj:1.2"
}
}
ext.aspectjVersion = '1.7.4'
apply plugin: 'aspectj'
repositories {
mavenCentral()
}
//jdk版本 //jdk版本
sourceCompatibility=1.7 sourceCompatibility=1.7
//jar包版本 //jar包版本

89
designer_base/build.master.gradle.bak

@ -0,0 +1,89 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
options.encoding = 'UTF-8'
}
buildscript {
repositories {
maven {
url "http://www.eveoh.nl/files/maven2"
}
}
dependencies {
classpath "nl.eveoh:gradle-aspectj:1.2"
}
}
ext.aspectjVersion = '1.7.4'
apply plugin: 'aspectj'
repositories {
mavenCentral()
}
//jdk版本
sourceCompatibility=1.7
//jar包版本
version='8.0'
//jar包重命名
jar{
baseName='fr-designer-core'
}
def srcDir="."
//
sourceSets{
main{
java{
srcDirs=["${srcDir}/src"]
}
}
}
//
FileTree files =fileTree(dir:'./',include:'build.*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\'))
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
//
dependencies{
compile fileTree(dir:"../../../finereport-lib-stable/${branchName}",include:'**/*.jar')
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar")
testCompile 'junit:junit:4.12'
}
//.java文件到classes文件夹下参与打包
task copyFile(type:Copy,dependsOn:compileJava){
copy{
from ("${srcDir}/src"){
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html'
}
into 'build/classes/main'
}
}
//js文件
task compressJS{
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){
classpath {
fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar')
}
}
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/src"){
include (name:'**/*.js')
include (name:'**/*.css')
}
}
}
jar.dependsOn compressJS

23
designer_base/build.release.gradle

@ -1,8 +1,29 @@
apply plugin: 'java'
tasks.withType(JavaCompile){ tasks.withType(JavaCompile){
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
buildscript {
repositories {
maven {
url "http://www.eveoh.nl/files/maven2"
}
}
dependencies {
classpath "nl.eveoh:gradle-aspectj:1.2"
}
}
ext.aspectjVersion = '1.7.4'
apply plugin: 'aspectj'
repositories {
mavenCentral()
}
//jdk版本 //jdk版本
sourceCompatibility=1.8 sourceCompatibility=1.8
//jar包版本 //jar包版本

70
designer_base/src/com/fr/design/actions/edit/CopyAction.java

@ -1,37 +1,35 @@
/* /*
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved.
*/ */
package com.fr.design.actions.edit; package com.fr.design.actions.edit;
import java.awt.event.KeyEvent; import com.fr.base.BaseUtils;
import com.fr.design.actions.TemplateComponentAction;
import javax.swing.KeyStroke; import com.fr.design.designer.TargetComponent;
import com.fr.general.Inter;
import com.fr.base.BaseUtils;
import com.fr.design.actions.TemplateComponentAction; import javax.swing.*;
import com.fr.design.designer.TargetComponent; import java.awt.event.KeyEvent;
import com.fr.general.Inter;
/**
/** * Copy.
* Copy. */
*/ public class CopyAction extends TemplateComponentAction {
public class CopyAction extends TemplateComponentAction { public CopyAction(TargetComponent t) {
public CopyAction(TargetComponent t) { super(t);
super(t);
this.setName(Inter.getLocText("M_Edit-Copy"));
this.setName(Inter.getLocText("M_Edit-Copy")); this.setMnemonic('C');
this.setMnemonic('C'); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_MASK));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_MASK)); }
}
@Override
@Override public boolean executeActionReturnUndoRecordNeeded() {
public boolean executeActionReturnUndoRecordNeeded() { TargetComponent tc = getEditingComponent();
TargetComponent tc = getEditingComponent(); if (tc != null) {
if (tc != null) { tc.copy();
tc.copy(); }
} return false;
}
return false;
}
} }

7
designer_base/src/com/fr/design/beans/location/WidgetForbidWindow.java

@ -22,7 +22,6 @@ public class WidgetForbidWindow extends JWindow {
*/ */
public WidgetForbidWindow() { public WidgetForbidWindow() {
this.add(promptButton); this.add(promptButton);
this.setSize(WIDTH, HEIGHT); this.setSize(WIDTH, HEIGHT);
} }
@ -31,18 +30,16 @@ public class WidgetForbidWindow extends JWindow {
* *
* @param x x坐标 * @param x x坐标
* @param y y坐标 * @param y y坐标
*
*/ */
public void showWindow(int x, int y){ public void showWindow(int x, int y) {
this.setLocation(x - WIDTH / 2, y - HEIGHT / 2); this.setLocation(x - WIDTH / 2, y - HEIGHT / 2);
this.setVisible(true); this.setVisible(true);
} }
/** /**
* 隐藏当前窗口 * 隐藏当前窗口
*
*/ */
public void hideWindow(){ public void hideWindow() {
this.setVisible(false); this.setVisible(false);
} }
} }

3
designer_base/src/com/fr/design/extra/PluginHelper.java

@ -7,6 +7,7 @@ import com.fr.design.extra.plugindependence.DownLoadDependenceUI;
import com.fr.general.*; import com.fr.general.*;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.plugin.Plugin; import com.fr.plugin.Plugin;
import com.fr.plugin.PluginConfigManager;
import com.fr.stable.plugin.PluginConstants; import com.fr.stable.plugin.PluginConstants;
import com.fr.plugin.PluginLoader; import com.fr.plugin.PluginLoader;
import com.fr.plugin.PluginManagerHelper; import com.fr.plugin.PluginManagerHelper;
@ -225,6 +226,8 @@ public class PluginHelper {
} }
// 删除放解压文件的临时文件夹 // 删除放解压文件的临时文件夹
StableUtils.deleteFile(new File(TEMP_PATH)); StableUtils.deleteFile(new File(TEMP_PATH));
PluginConfigManager.getProviderInstance().pushNewPlugin(plugin);
PluginConfigManager.getProviderInstance().syncPluginConfig();
new SwingWorker<String, Void>() { new SwingWorker<String, Void>() {
@Override @Override

15
designer_base/src/com/fr/design/locale/designer.properties

@ -91,7 +91,6 @@ FR-Designer_DS-Dictionary=
FR-Designer_Data-confusion= FR-Designer_Data-confusion=
FR-Designer_Data_Type= FR-Designer_Data_Type=
FR-Designer_Double_Click_Edit_OR_Clear= FR-Designer_Double_Click_Edit_OR_Clear=
FR-Designer_Edit_Button_ToolBar=
FR-Designer_Email= FR-Designer_Email=
FR-Designer_Enabled= FR-Designer_Enabled=
FR-Designer_End-Date= FR-Designer_End-Date=
@ -101,6 +100,7 @@ FR-Designer_FS_Close_Other_Templates=
FR-Designer_File= FR-Designer_File=
FR-Designer_Filter_Conditions= FR-Designer_Filter_Conditions=
FR-Designer_Finish-Modify-Share= FR-Designer_Finish-Modify-Share=
FR-Designer_Fit=
FR-Designer_Fit-App= FR-Designer_Fit-App=
FR-Designer_Font-Family= FR-Designer_Font-Family=
FR-Designer_Font-Size= FR-Designer_Font-Size=
@ -162,7 +162,6 @@ FR-Designer_Refresh_Parameter_In_SQL=
FR-Designer_Reg_Expressions= FR-Designer_Reg_Expressions=
FR-Designer_Reg_Max_Length= FR-Designer_Reg_Max_Length=
FR-Designer_Reg_Min_Length= FR-Designer_Reg_Min_Length=
FR-Designer_Remove_Button_ToolBar=
FR-Designer_ReportColumns-Columns= FR-Designer_ReportColumns-Columns=
FR-Designer_Return-Date= FR-Designer_Return-Date=
FR-Designer_RichText= FR-Designer_RichText=
@ -543,14 +542,14 @@ FR-Designer_Left_Display=Left
FR-Designer_About_Version=Version FR-Designer_About_Version=Version
FR-Designer_About_CopyRight=Copy Right FR-Designer_About_CopyRight=Copy Right
FR-Designer_Service_Phone=Service Phone FR-Designer_Service_Phone=Service Phone
FR-Designer_Allow_Blank=Allow Blank FR-Designer_Allow_Null=Allow null
FR-Designer_PageSetup_Page=Page FR-Designer_PageSetup_Page=Page
FR-Designer_Custom_Job_Description=Description FR-Designer_Custom_Job_Description=Description
FR-Designer_Property=Property FR-Designer_Property=Property
FR-Designer_ClassName=Class Name FR-Designer_ClassName=Class Name
FR-Designer_Polyblock_Edit=Polyblock Edit FR-Designer_Polyblock_Edit=Polyblock Edit
FR-Designer_Function_Description_Area_Text=The class must inherit 'com.fr.script.AbstractFunction'. The compiled class should be copied to\nJ2EE server '{R1}WEB-INF{R2}classes' directory.\nAdd the source code(.java file) into the same folder if need.\nExample: {R3}classes} FR-Designer_Function_Description_Area_Text=The class must inherit 'com.fr.script.AbstractFunction'. The compiled class should be copied to\nJ2EE server '{R1}' directory.\nAdd the source code(.java file) into the same folder if need.\nExample: {R2}}
FR-Designer_PageSetup_Horizontal=Horizontal FR-Designer_PageSetup_Horizontal=Horizontal
FR-Designer_PageSetup_Vertical=Vertical FR-Designer_PageSetup_Vertical=Vertical
FR-Designer_Gradient_Direction=Gradient Direction FR-Designer_Gradient_Direction=Gradient Direction
@ -564,6 +563,10 @@ FR-Designer_Show_As_Download=Display the binary content using download link
FR-Designer_File_Name_For_Download=File Name For Download FR-Designer_File_Name_For_Download=File Name For Download
FR-Designer_No=No FR-Designer_No=No
FR-Designer_Pagination=Page Break FR-Designer_Pagination=Page Break
FR-Designer-Move_Tab_First=move to first
FR-Designer-Move_Tab_End=move to end
FR-Designer-Move_Tab_Next=move to next
FR-Designer-Move_Tab_Prev=move to previous
FR-Designer_DS_TableData=Data Set FR-Designer_DS_TableData=Data Set
FR-Designer_Parameter-Formula=Formula FR-Designer_Parameter-Formula=Formula
FR-Designer_Plugin_Should_Update_Please_Contact_Developer=Plugin version is too low, and is not compatible with current API. Please contact the developer to update. FR-Designer_Plugin_Should_Update_Please_Contact_Developer=Plugin version is too low, and is not compatible with current API. Please contact the developer to update.
@ -585,3 +588,7 @@ FR-Designer-Move_Tab_First=move to first
FR-Designer-Move_Tab_End=move to end FR-Designer-Move_Tab_End=move to end
FR-Designer-Move_Tab_Next=move to next FR-Designer-Move_Tab_Next=move to next
FR-Designer-Move_Tab_Prev=move to previous FR-Designer-Move_Tab_Prev=move to previous
FR-Designer_AxisReversed=AxisValue
FR-Designer_Logarithmic=Logarithmic
FR-Designer_Chart_Log_Base=Log Base
FR-Designer_Chart_F_Radar_Axis=Chart_F_Radar_Axis

14
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -91,7 +91,6 @@ FR-Designer_DS-Dictionary=Data Dictionary
FR-Designer_Data-confusion=Data Confusion FR-Designer_Data-confusion=Data Confusion
FR-Designer_Data_Type=Data type FR-Designer_Data_Type=Data type
FR-Designer_Double_Click_Edit_OR_Clear=Double Click to Edit or Clear FR-Designer_Double_Click_Edit_OR_Clear=Double Click to Edit or Clear
FR-Designer_Edit_Button_ToolBar=Edit Button ToolBar
FR-Designer_Email=Mail FR-Designer_Email=Mail
FR-Designer_Enabled=Enabled FR-Designer_Enabled=Enabled
FR-Designer_End-Date=End Date FR-Designer_End-Date=End Date
@ -164,7 +163,6 @@ FR-Designer_Refresh_Parameter_In_SQL=Whether to refresh parameters in the SQL
FR-Designer_Reg_Expressions=Regular expressions FR-Designer_Reg_Expressions=Regular expressions
FR-Designer_Reg_Max_Length=max length FR-Designer_Reg_Max_Length=max length
FR-Designer_Reg_Min_Length=min length FR-Designer_Reg_Min_Length=min length
FR-Designer_Remove_Button_ToolBar=Remove Button ToolBar
FR-Designer_ReportColumns-Columns=Multi-columns/lines FR-Designer_ReportColumns-Columns=Multi-columns/lines
FR-Designer_Return-Date=Return Date FR-Designer_Return-Date=Return Date
FR-Designer_RichText=Insert Rich Text FR-Designer_RichText=Insert Rich Text
@ -544,14 +542,14 @@ FR-Designer_Left_Display=Left
FR-Designer_About_Version=Version FR-Designer_About_Version=Version
FR-Designer_About_CopyRight=Copy Right FR-Designer_About_CopyRight=Copy Right
FR-Designer_Service_Phone=Service Phone FR-Designer_Service_Phone=Service Phone
FR-Designer_Allow_Blank=Allow Null FR-Designer_Allow_Null=Allow null
FR-Designer_PageSetup_Page=Page FR-Designer_PageSetup_Page=Page
FR-Designer_Custom_Job_Description=Description FR-Designer_Custom_Job_Description=Description
FR-Designer_Property=Property FR-Designer_Property=Property
FR-Designer_ClassName=Class Name FR-Designer_ClassName=Class Name
FR-Designer_Polyblock_Edit=Aggregation block edition FR-Designer_Polyblock_Edit=Aggregation block edition
FR-Designer_Function_Description_Area_Text=The class must inherit 'com.fr.script.AbstractFunction'. The compiled class files should be copied to\nJ2EE server '{R1}WEB-INF{R2}classes' directory.\nAdd the source code(.java file) into the same folder if need.\nExample: {R3}classes FR-Designer_Function_Description_Area_Text=The class must inherit 'com.fr.script.AbstractFunction'. The compiled class should be copied to\nJ2EE server '{R1}' directory.\nAdd the source code(.java file) into the same folder if need.\nExample: {R2}}
FR-Designer_PageSetup_Horizontal=Horizontal FR-Designer_PageSetup_Horizontal=Horizontal
FR-Designer_PageSetup_Vertical=Vertical FR-Designer_PageSetup_Vertical=Vertical
FR-Designer_Gradient_Direction=Gradient Direction FR-Designer_Gradient_Direction=Gradient Direction
@ -565,6 +563,10 @@ FR-Designer_Show_As_Download=Display the binary content using download link
FR-Designer_File_Name_For_Download=File Name For Download FR-Designer_File_Name_For_Download=File Name For Download
FR-Designer_No=No FR-Designer_No=No
FR-Designer_Pagination=Page Break FR-Designer_Pagination=Page Break
FR-Designer-Move_Tab_First=move to first
FR-Designer-Move_Tab_End=move to end
FR-Designer-Move_Tab_Next=move to next
FR-Designer-Move_Tab_Prev=move to previous
FR-Designer_DS_TableData=Data Set FR-Designer_DS_TableData=Data Set
FR-Designer_Parameter-Formula=Formula FR-Designer_Parameter-Formula=Formula
FR-Designer_Plugin_Should_Update_Please_Contact_Developer=Plugin version is too low, and is not compatible with current API. Please contact the developer to update. FR-Designer_Plugin_Should_Update_Please_Contact_Developer=Plugin version is too low, and is not compatible with current API. Please contact the developer to update.
@ -586,3 +588,7 @@ FR-Designer-Move_Tab_First=move to first
FR-Designer-Move_Tab_End=move to end FR-Designer-Move_Tab_End=move to end
FR-Designer-Move_Tab_Next=move to next FR-Designer-Move_Tab_Next=move to next
FR-Designer-Move_Tab_Prev=move to previous FR-Designer-Move_Tab_Prev=move to previous
FR-Designer_AxisReversed=Axis in reverse order
FR-Designer_Logarithmic=Log scale
FR-Designer_Chart_Log_Base=Log Base
FR-Designer_Chart_F_Radar_Axis=Value Axis

19
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -91,7 +91,6 @@ FR-Designer_DS-Dictionary=\u30C7\u30FC\u30BF\u5B57\u5178
FR-Designer_Data-confusion=\u30C7\u30FC\u30BF\u6DF7\u4EA4 FR-Designer_Data-confusion=\u30C7\u30FC\u30BF\u6DF7\u4EA4
FR-Designer_Data_Type=\u30C7\u30FC\u30BF\u30BF\u30A4\u30D7 FR-Designer_Data_Type=\u30C7\u30FC\u30BF\u30BF\u30A4\u30D7
FR-Designer_Double_Click_Edit_OR_Clear=\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u7DE8\u96C6\u307E\u305F\u306F\u30AF\u30EA\u30A2\u3059\u308B FR-Designer_Double_Click_Edit_OR_Clear=\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u7DE8\u96C6\u307E\u305F\u306F\u30AF\u30EA\u30A2\u3059\u308B
FR-Designer_Edit_Button_ToolBar=\u30DC\u30BF\u30F3\u306B\u3042\u308B\u30C4\u30FC\u30EB\u6B04\u7DE8\u96C6
FR-Designer_Email=\u30E1\u30FC\u30EB FR-Designer_Email=\u30E1\u30FC\u30EB
FR-Designer_Enabled=\u4F7F\u7528\u53EF\u80FD FR-Designer_Enabled=\u4F7F\u7528\u53EF\u80FD
FR-Designer_End-Date=\u7D42\u4E86\u65E5\u671F FR-Designer_End-Date=\u7D42\u4E86\u65E5\u671F
@ -163,7 +162,6 @@ FR-Designer_Refresh_Parameter_In_SQL=SQL\u4E2D\u306E\u30D1\u30E9\u30E1\u30FC\u30
FR-Designer_Reg_Expressions=\u6B63\u5247\u8868\u73FE\u5F0F FR-Designer_Reg_Expressions=\u6B63\u5247\u8868\u73FE\u5F0F
FR-Designer_Reg_Max_Length=\u6700\u5927\u9577\u3055 FR-Designer_Reg_Max_Length=\u6700\u5927\u9577\u3055
FR-Designer_Reg_Min_Length=\u6700\u5C0F\u9577\u3055 FR-Designer_Reg_Min_Length=\u6700\u5C0F\u9577\u3055
FR-Designer_Remove_Button_ToolBar=\u30DC\u30BF\u30F3\u304C\u3042\u308B\u30C4\u30FC\u30EB\u30D0\u30FC\u3092\u30EA\u30E0\u30FC\u30D6
FR-Designer_ReportColumns-Columns=\u6BB5\u7D44\u307F FR-Designer_ReportColumns-Columns=\u6BB5\u7D44\u307F
FR-Designer_Return-Date=\u65E5\u671F\u306B\u623B\u308B FR-Designer_Return-Date=\u65E5\u671F\u306B\u623B\u308B
FR-Designer_RichText=\u30EA\u30C3\u30C1\u6587\u66F8\u633F\u5165 FR-Designer_RichText=\u30EA\u30C3\u30C1\u6587\u66F8\u633F\u5165
@ -518,14 +516,14 @@ FR-Designer_Left_Display=\u5DE6\u8868\u793A
FR-Designer_About_Version=\u30D0\u30FC\u30B8\u30E7\u30F3 FR-Designer_About_Version=\u30D0\u30FC\u30B8\u30E7\u30F3
FR-Designer_About_CopyRight=\u8457\u4F5C\u6A29\u6240\u6709 FR-Designer_About_CopyRight=\u8457\u4F5C\u6A29\u6240\u6709
FR-Designer_Service_Phone=\u30B5\u30FC\u30D3\u30B9\u96FB\u8A71\uFF1A FR-Designer_Service_Phone=\u30B5\u30FC\u30D3\u30B9\u96FB\u8A71\uFF1A
FR-Designer_Allow_Blank=\u7A7A\u6B04\u3042\u308A FR-Designer_Allow_Null=\u7A7A\u6B04\u3042\u308A
FR-Designer_PageSetup_Page=\u30DA\u30FC\u30B8 FR-Designer_PageSetup_Page=\u30DA\u30FC\u30B8
FR-Designer_Custom_Job_Description=\u8A18\u8FF0 FR-Designer_Custom_Job_Description=\u8A18\u8FF0
FR-Designer_Property=\u5C5E\u6027 FR-Designer_Property=\u5C5E\u6027
FR-Designer_ClassName=\u985E\u540D FR-Designer_ClassName=\u985E\u540D
FR-Designer_Polyblock_Edit=\u30A2\u30B0\u30EA\u30B2\u30FC\u30B7\u30E7\u30F3\u30D6\u30ED\u30C3\u30AF\u7DE8\u96C6 FR-Designer_Polyblock_Edit=\u30A2\u30B0\u30EA\u30B2\u30FC\u30B7\u30E7\u30F3\u30D6\u30ED\u30C3\u30AF\u7DE8\u96C6
FR-Designer_Function_Description_Area_Text=\u3053\u306E\u30AF\u30E9\u30B9\u306F\u7D99\u627F\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059"com.fr.script.AbstractFunction"\u3002\u3092\u7D99\u627F\u3059\u3079\u304D\u3067\u3059\u3002\u30B3\u30F3\u30D1\u30A4\u30EB\u5F8C\u306E\u985E\u30D5\u30A1\u30A4\u30EB\u3092\nJ2EE\u30B5\u30FC\u30D0\u30FC "{R1}WEB-INF{R2}classes" \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3002\u306B\u30B3\u30D4\u30FC\u3057\u3066\u3001class\u306B\u5BFE\u5FDC\u3059\u308Bjava\u30D5\u30A1\u30A4\u30EB\u3082\u5F53\u76EE\u6B21\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\u3002\n\u4F8B\u3048\u3070\uFF1A{R3}classes FR-Designer_Function_Description_Area_Text=\u3053\u306E\u30AF\u30E9\u30B9\u306F\u7D99\u627F\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059"com.fr.script.AbstractFunction"\u3002\u3092\u7D99\u627F\u3059\u3079\u304D\u3067\u3059\u3002\u30B3\u30F3\u30D1\u30A4\u30EB\u5F8C\u306E\u985E\u30D5\u30A1\u30A4\u30EB\u3092\nJ2EE\u30B5\u30FC\u30D0\u30FC "{R1}" \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3002\u306B\u30B3\u30D4\u30FC\u3057\u3066\u3001class\u306B\u5BFE\u5FDC\u3059\u308Bjava\u30D5\u30A1\u30A4\u30EB\u3082\u5F53\u76EE\u6B21\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\u3002\n\u4F8B\u3048\u3070\uFF1A{R2}
FR-Designer_PageSetup_Horizontal=\u6A2A\u65B9\u5411 FR-Designer_PageSetup_Horizontal=\u6A2A\u65B9\u5411
FR-Designer_PageSetup_Vertical=\u7E26\u65B9\u5411 FR-Designer_PageSetup_Vertical=\u7E26\u65B9\u5411
FR-Designer_Gradient_Direction=\u65B9\u5411\u3092\u5F90\u3005\u306B\u5909\u5316 FR-Designer_Gradient_Direction=\u65B9\u5411\u3092\u5F90\u3005\u306B\u5909\u5316
@ -539,6 +537,10 @@ FR-Designer_Show_As_Download=\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u30EA\u30F3\u3
FR-Designer_File_Name_For_Download=\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u30D5\u30A1\u30A4\u30EB\u540D FR-Designer_File_Name_For_Download=\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u30D5\u30A1\u30A4\u30EB\u540D
FR-Designer_No=\u3044\u3044\u3048 FR-Designer_No=\u3044\u3044\u3048
FR-Designer_Pagination=\u30DA\u30FC\u30B8\u30F3\u30B0 FR-Designer_Pagination=\u30DA\u30FC\u30B8\u30F3\u30B0
FR-Designer-Move_Tab_First=
FR-Designer-Move_Tab_End=
FR-Designer-Move_Tab_Next=
FR-Designer-Move_Tab_Prev=
FR-Designer_DS_TableData=\u30C7\u30FC\u30BF\u30BD\u30FC\u30B9 FR-Designer_DS_TableData=\u30C7\u30FC\u30BF\u30BD\u30FC\u30B9
FR-Designer_Parameter-Formula=\u6570\u5F0F FR-Designer_Parameter-Formula=\u6570\u5F0F
FR-Designer_Background_Null= FR-Designer_Background_Null=
@ -552,7 +554,8 @@ FR-Designer_Background_Image_Select=
FR-Designer_Initial_Background_Tips= FR-Designer_Initial_Background_Tips=
FR-Designer_Mouse_Move_Tips= FR-Designer_Mouse_Move_Tips=
FR-Designer_Mouse_Click_Tips= FR-Designer_Mouse_Click_Tips=
FR-Designer-Move_Tab_First= FR-Designer_Plugin_Should_Update_Please_Contact_Developer=
FR-Designer-Move_Tab_End= FR-Designer_AxisReversed=\u8EF8\u9006\u9806
FR-Designer-Move_Tab_Next= FR-Designer_Logarithmic=\u5BFE\u6570\u76EE\u76DB\u308A
FR-Designer-Move_Tab_Prev= FR-Designer_Chart_Log_Base=\u5E95\u6570
FR-Designer_Chart_F_Radar_Axis=\u5782\u76F4\u8EF8

19
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -91,7 +91,6 @@ FR-Designer_DS-Dictionary=\uB370\uC774\uD130\uC0AC\uC804
FR-Designer_Data-confusion=\uB370\uC774\uD130\uD63C\uD569 FR-Designer_Data-confusion=\uB370\uC774\uD130\uD63C\uD569
FR-Designer_Data_Type=\uB370\uC774\uD130\uC720\uD615 FR-Designer_Data_Type=\uB370\uC774\uD130\uC720\uD615
FR-Designer_Double_Click_Edit_OR_Clear=\uB354\uBE14\uD074\uB9AD\uD558\uC5EC\uD3B8\uC9D1\uB610\uB294\uD074\uB9AC\uC5B4\uC2E4\uD589 FR-Designer_Double_Click_Edit_OR_Clear=\uB354\uBE14\uD074\uB9AD\uD558\uC5EC\uD3B8\uC9D1\uB610\uB294\uD074\uB9AC\uC5B4\uC2E4\uD589
FR-Designer_Edit_Button_ToolBar=\uD0A4\uAC00\uC788\uB294\uD234\uBC14\uD3B8\uC9D1
FR-Designer_Email=\uBA54\uC77C FR-Designer_Email=\uBA54\uC77C
FR-Designer_Enabled=\uC0AC\uC6A9\uAC00\uB2A5 FR-Designer_Enabled=\uC0AC\uC6A9\uAC00\uB2A5
FR-Designer_End-Date=\uC885\uB8CC\uB0A0\uC9DC FR-Designer_End-Date=\uC885\uB8CC\uB0A0\uC9DC
@ -163,7 +162,6 @@ FR-Designer_Refresh_Parameter_In_SQL=SQL\uC758\uB9E4\uAC1C\uBCC0\uC218\uB97C\uC0
FR-Designer_Reg_Expressions=\uC815\uADDC\uD45C\uD604\uC2DD FR-Designer_Reg_Expressions=\uC815\uADDC\uD45C\uD604\uC2DD
FR-Designer_Reg_Max_Length=\uCD5C\uB300\uAE38\uC774 FR-Designer_Reg_Max_Length=\uCD5C\uB300\uAE38\uC774
FR-Designer_Reg_Min_Length=\uCD5C\uC18C\uAE38\uC774 FR-Designer_Reg_Min_Length=\uCD5C\uC18C\uAE38\uC774
FR-Designer_Remove_Button_ToolBar=\uD0A4\uAC00\uC788\uB294\uD234\uBC14\uC81C\uAC70
FR-Designer_ReportColumns-Columns=\uC140\uB098\uB204\uAE30 FR-Designer_ReportColumns-Columns=\uC140\uB098\uB204\uAE30
FR-Designer_Return-Date=\uB0A0\uC9DC\uB3CC\uC544\uAC00\uAE30 FR-Designer_Return-Date=\uB0A0\uC9DC\uB3CC\uC544\uAC00\uAE30
FR-Designer_RichText=\uB9AC\uCE58\uD14D\uC2A4\uD2B8\uBC15\uC2A4\uC0BD\uC785 FR-Designer_RichText=\uB9AC\uCE58\uD14D\uC2A4\uD2B8\uBC15\uC2A4\uC0BD\uC785
@ -514,7 +512,7 @@ FR-Designer_Left_Display=\uC67C\uCABD\uBCF4\uC774\uAE30
FR-Designer_About_Version=\uBC84\uC804 FR-Designer_About_Version=\uBC84\uC804
FR-Designer_About_CopyRight=\uD310\uAD8C\uC18C\uC720 FR-Designer_About_CopyRight=\uD310\uAD8C\uC18C\uC720
FR-Designer_Service_Phone=\uC11C\uBE44\uC2A4\uC804\uD654\uFF1A FR-Designer_Service_Phone=\uC11C\uBE44\uC2A4\uC804\uD654\uFF1A
FR-Designer_Allow_Blank=\uBE48\uCE78\uD5C8\uC6A9 FR-Designer_Allow_Null=\uBE48\uCE78\uD5C8\uC6A9
FR-Designer_PageSetup_Page=\uC6F9\uD398\uC774\uC9C0 FR-Designer_PageSetup_Page=\uC6F9\uD398\uC774\uC9C0
FR-Designer_Custom_Job_Description=\uC124\uBA85 FR-Designer_Custom_Job_Description=\uC124\uBA85
FR-Designer_Property=\uC18D\uC131 FR-Designer_Property=\uC18D\uC131
@ -522,7 +520,7 @@ FR-Designer_ClassName=\uD074\uB798\uC2A4\uB124\uC784
FR-Designer_Template_Web_Attributes=\uD15C\uD50C\uB9BF \uC6F9 \uC18D\uC131 FR-Designer_Template_Web_Attributes=\uD15C\uD50C\uB9BF \uC6F9 \uC18D\uC131
FR-Designer_Polyblock_Edit=\uCDE8\uD569\uBE14\uB7ED\uD3B8\uC9D1 FR-Designer_Polyblock_Edit=\uCDE8\uD569\uBE14\uB7ED\uD3B8\uC9D1
FR-Designer_Function_Description_Area_Text=\uD574\uB2F9\uD074\uB798\uC2A4\uB294\uACC4\uC2B9\uD574\uC57C\uD55C\uB2E4."com.fr.script.AbstractFunction".\uCEF4\uD30C\uC77C\uD6C4\uC758\uD074\uB798\uC2A4\uD30C\uC77C\uC744~\uB85C\uBCF5\uC0AC\nJ2EE\uC11C\uBC84 "{R1}WEB-INF{R2}classes" \uB514\uB809\uD130\uB9AC, \uD544\uC694\uC2DC class \uC0C1\uC751\uD558\uB294 java\uC18C\uC2A4\uD30C\uC77C\uB3C4\uD574\uB2F9\uB514\uB809\uD130\uB9AC\uD558\uB2E8\uC5D0\uB450\uC5B4\uD3B8\uC9D1\uBC0F\uCC3E\uC544\uBCF4\uAE30\uB97C\uD560\uC218\uC788\uC2B5\uB2C8\uB2E4.\n\uC608: {R3}classes FR-Designer_Function_Description_Area_Text=\uD574\uB2F9\uD074\uB798\uC2A4\uB294\uACC4\uC2B9\uD574\uC57C\uD55C\uB2E4."com.fr.script.AbstractFunction".\uCEF4\uD30C\uC77C\uD6C4\uC758\uD074\uB798\uC2A4\uD30C\uC77C\uC744~\uB85C\uBCF5\uC0AC\nJ2EE\uC11C\uBC84 "{R1}" \uB514\uB809\uD130\uB9AC, \uD544\uC694\uC2DC class \uC0C1\uC751\uD558\uB294 java\uC18C\uC2A4\uD30C\uC77C\uB3C4\uD574\uB2F9\uB514\uB809\uD130\uB9AC\uD558\uB2E8\uC5D0\uB450\uC5B4\uD3B8\uC9D1\uBC0F\uCC3E\uC544\uBCF4\uAE30\uB97C\uD560\uC218\uC788\uC2B5\uB2C8\uB2E4.\n\uC608: {R2}
FR-Designer_PageSetup_Horizontal=\uAC00\uB85C FR-Designer_PageSetup_Horizontal=\uAC00\uB85C
FR-Designer_PageSetup_Vertical=\uC138\uB85C FR-Designer_PageSetup_Vertical=\uC138\uB85C
FR-Designer_Gradient_Direction=\uADF8\uB77C\uB370\uC774\uC158 \uBC29\uD5A5 FR-Designer_Gradient_Direction=\uADF8\uB77C\uB370\uC774\uC158 \uBC29\uD5A5
@ -536,6 +534,10 @@ FR-Designer_Show_As_Download=\uB2E4\uC6B4\uB85C\uB4DC\uB9C1\uD06C\uB85C2\uC9C4\u
FR-Designer_File_Name_For_Download=\uB2E4\uC6B4\uB85C\uB4DC\uD30C\uC77C\uBA85 FR-Designer_File_Name_For_Download=\uB2E4\uC6B4\uB85C\uB4DC\uD30C\uC77C\uBA85
FR-Designer_No=\uC544\uB2C8\uC624 FR-Designer_No=\uC544\uB2C8\uC624
FR-Designer_Pagination=\uD398\uC774\uC9C0\uB098\uB204\uAE30 FR-Designer_Pagination=\uD398\uC774\uC9C0\uB098\uB204\uAE30
FR-Designer-Move_Tab_First=
FR-Designer-Move_Tab_End=
FR-Designer-Move_Tab_Next=
FR-Designer-Move_Tab_Prev=
FR-Designer_DS_TableData=\uB370\uC774\uD130\uC138\uD2B8 FR-Designer_DS_TableData=\uB370\uC774\uD130\uC138\uD2B8
FR-Designer_Parameter-Formula=\uC218\uC2DD FR-Designer_Parameter-Formula=\uC218\uC2DD
FR-Designer_Background_Null= FR-Designer_Background_Null=
@ -549,7 +551,8 @@ FR-Designer_Background_Image_Select=
FR-Designer_Initial_Background_Tips= FR-Designer_Initial_Background_Tips=
FR-Designer_Mouse_Move_Tips= FR-Designer_Mouse_Move_Tips=
FR-Designer_Mouse_Click_Tips= FR-Designer_Mouse_Click_Tips=
FR-Designer-Move_Tab_First= FR-Designer_Plugin_Should_Update_Please_Contact_Developer=
FR-Designer-Move_Tab_End= FR-Designer_AxisReversed=\uCD95\uC5ED\uC21C
FR-Designer-Move_Tab_Next= FR-Designer_Logarithmic=\uB85C\uADF8\uB208\uAE08
FR-Designer-Move_Tab_Prev= FR-Designer_Chart_Log_Base=\uAE30\uC218
FR-Designer_Chart_F_Radar_Axis=\uAC12\uCD95

20
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -91,7 +91,6 @@ FR-Designer_DS-Dictionary=\u6570\u636E\u5B57\u5178
FR-Designer_Data-confusion=\u6570\u636E\u6DF7\u6DC6 FR-Designer_Data-confusion=\u6570\u636E\u6DF7\u6DC6
FR-Designer_Data_Type=\u6570\u636E\u7C7B\u578B FR-Designer_Data_Type=\u6570\u636E\u7C7B\u578B
FR-Designer_Double_Click_Edit_OR_Clear=\u53CC\u51FB\u8FDB\u884C\u7F16\u8F91\u6216\u6E05\u9664 FR-Designer_Double_Click_Edit_OR_Clear=\u53CC\u51FB\u8FDB\u884C\u7F16\u8F91\u6216\u6E05\u9664
FR-Designer_Edit_Button_ToolBar=\u7F16\u8F91\u6309\u94AE\u6240\u5728\u5DE5\u5177\u680F
FR-Designer_Email=\u90AE\u4EF6 FR-Designer_Email=\u90AE\u4EF6
FR-Designer_Enabled=\u53EF\u7528 FR-Designer_Enabled=\u53EF\u7528
FR-Designer_End-Date=\u7ED3\u675F\u65E5\u671F FR-Designer_End-Date=\u7ED3\u675F\u65E5\u671F
@ -164,7 +163,6 @@ FR-Designer_Refresh_Parameter_In_SQL=\u662F\u5426\u5237\u65B0SQL\u4E2D\u7684\u53
FR-Designer_Reg_Expressions=\u6B63\u5219\u8868\u8FBE\u5F0F FR-Designer_Reg_Expressions=\u6B63\u5219\u8868\u8FBE\u5F0F
FR-Designer_Reg_Max_Length=\u6700\u5927\u957F\u5EA6 FR-Designer_Reg_Max_Length=\u6700\u5927\u957F\u5EA6
FR-Designer_Reg_Min_Length=\u6700\u5C0F\u957F\u5EA6 FR-Designer_Reg_Min_Length=\u6700\u5C0F\u957F\u5EA6
FR-Designer_Remove_Button_ToolBar=\u79FB\u9664\u6309\u94AE\u6240\u5728\u5DE5\u5177\u680F
FR-Designer_ReportColumns-Columns=\u5206\u680F FR-Designer_ReportColumns-Columns=\u5206\u680F
FR-Designer_Return-Date=\u8FD4\u56DE\u65E5\u671F FR-Designer_Return-Date=\u8FD4\u56DE\u65E5\u671F
FR-Designer_RichText=\u63D2\u5165\u5BCC\u6587\u672C FR-Designer_RichText=\u63D2\u5165\u5BCC\u6587\u672C
@ -548,14 +546,14 @@ FR-Designer_Left_Display=\u5DE6\u5C55\u793A
FR-Designer_About_Version=\u7248\u672C FR-Designer_About_Version=\u7248\u672C
FR-Designer_About_CopyRight=\u7248\u6743\u6240\u6709 FR-Designer_About_CopyRight=\u7248\u6743\u6240\u6709
FR-Designer_Service_Phone=\u670D\u52A1\u7535\u8BDD\uFF1A FR-Designer_Service_Phone=\u670D\u52A1\u7535\u8BDD\uFF1A
FR-Designer_Allow_Blank=\u5141\u8BB8\u4E3A\u7A7A FR-Designer_Allow_Null=\u5141\u8BB8\u4E3A\u7A7A
FR-Designer_PageSetup_Page=\u9875\u9762 FR-Designer_PageSetup_Page=\u9875\u9762
FR-Designer_Custom_Job_Description=\u63CF\u8FF0 FR-Designer_Custom_Job_Description=\u63CF\u8FF0
FR-Designer_Property=\u5C5E\u6027 FR-Designer_Property=\u5C5E\u6027
FR-Designer_ClassName=\u7C7B\u540D FR-Designer_ClassName=\u7C7B\u540D
FR-Designer_Polyblock_Edit=\u805A\u5408\u5757\u7F16\u8F91 FR-Designer_Polyblock_Edit=\u805A\u5408\u5757\u7F16\u8F91
FR-Designer_Function_Description_Area_Text=\u8BE5\u7C7B\u5FC5\u987B\u7EE7\u627F"com.fr.script.AbstractFunction"\u3002\u5E94\u5C06\u7F16\u8BD1\u540E\u7684\u7C7B\u6587\u4EF6\u62F7\u8D1D\u5230\nJ2EE\u670D\u52A1\u5668 "{R1}WEB-INF{R2}classes" \u76EE\u5F55\uFF0C\u5982\u679C\u5FC5\u8981\u7684\u8BDD\u5C06class\u5BF9\u5E94\u7684java\u6E90\u6587\u4EF6\u4E5F\u653E\u7F6E\u5230\u8BE5\u76EE\u5F55\u4E0B\u65B9\u4FBF\u7F16\u8F91\u548C\u67E5\u770B\u3002\n\u4F8B\u5982\uFF1A{R3}classes FR-Designer_Function_Description_Area_Text=\u8BE5\u7C7B\u5FC5\u987B\u7EE7\u627F"com.fr.script.AbstractFunction"\u3002\u5E94\u5C06\u7F16\u8BD1\u540E\u7684\u7C7B\u6587\u4EF6\u62F7\u8D1D\u5230\nJ2EE\u670D\u52A1\u5668 "{R1}" \u76EE\u5F55\uFF0C\u5982\u679C\u5FC5\u8981\u7684\u8BDD\u5C06class\u5BF9\u5E94\u7684java\u6E90\u6587\u4EF6\u4E5F\u653E\u7F6E\u5230\u8BE5\u76EE\u5F55\u4E0B\u65B9\u4FBF\u7F16\u8F91\u548C\u67E5\u770B\u3002\n\u4F8B\u5982\uFF1A{R2}
FR-Designer_PageSetup_Horizontal=\u6A2A\u5411 FR-Designer_PageSetup_Horizontal=\u6A2A\u5411
FR-Designer_PageSetup_Vertical=\u7EB5\u5411 FR-Designer_PageSetup_Vertical=\u7EB5\u5411
FR-Designer_Gradient_Direction=\u6E10\u53D8\u65B9\u5411 FR-Designer_Gradient_Direction=\u6E10\u53D8\u65B9\u5411
@ -569,12 +567,16 @@ FR-Designer_Show_As_Download=\u7528\u4E0B\u8F7D\u94FE\u63A5\u663E\u793A\u4E8C\u8
FR-Designer_File_Name_For_Download=\u4E0B\u8F7D\u6587\u4EF6\u540D FR-Designer_File_Name_For_Download=\u4E0B\u8F7D\u6587\u4EF6\u540D
FR-Designer_No=\u5426 FR-Designer_No=\u5426
FR-Designer_Pagination=\u5206\u9875 FR-Designer_Pagination=\u5206\u9875
FR-Designer-Move_Tab_First=\u79FB\u52A8\u5230\u9996\u4F4D
FR-Designer-Move_Tab_End=\u79FB\u52A8\u5230\u672B\u5C3E
FR-Designer-Move_Tab_Next=\u5F80\u540E\u79FB\u52A8
FR-Designer-Move_Tab_Prev=\u5F80\u524D\u79FB\u52A8
FR-Designer_DS_TableData=\u6570\u636E\u96C6 FR-Designer_DS_TableData=\u6570\u636E\u96C6
FR-Designer_Parameter-Formula=\u516C\u5F0F FR-Designer_Parameter-Formula=\u516C\u5F0F
FR-Designer_Plugin_Should_Update_Please_Contact_Developer=\u63D2\u4EF6\u7248\u672C\u8FC7\u4F4E, \u5B58\u5728API\u4E0D\u517C\u5BB9, \u8BF7\u8054\u7CFB\u5F00\u53D1\u8005\u5347\u7EA7\u63D2\u4EF6 FR-Designer_Plugin_Should_Update_Please_Contact_Developer=\u63D2\u4EF6\u7248\u672C\u8FC7\u4F4E, \u5B58\u5728API\u4E0D\u517C\u5BB9, \u8BF7\u8054\u7CFB\u5F00\u53D1\u8005\u5347\u7EA7\u63D2\u4EF6
FR-Designer_WidgetOrder=\u63A7\u4EF6\u987A\u5E8F FR-Designer_WidgetOrder=\u63A7\u4EF6\u987A\u5E8F
FR-Designer_Mobile_Form_Analysis_Annotation=\u6CE8\u91CA\uFF1A\u53EF\u4EE5\u901A\u8FC7\u8BE5\u5C5E\u6027\u63A7\u5236\u8868\u5355\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\u3002 FR-Designer_Mobile_Form_Analysis_Annotation=\u6CE8\u91CA\uFF1A\u53EF\u4EE5\u901A\u8FC7\u8BE5\u5C5E\u6027\u63A7\u5236\u8868\u5355\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\u3002
FR-Designer_Mobile_Report_Analysis_Annotation=\u6CE8\u91CA\: \u53EF\u4EE5\u901A\u8FC7\u8BE5\u5C5E\u6027\u63A7\u5236\u62A5\u8868\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\uFF0C\u53EA\u652F\u6301\u5206\u9875\u9884\u89C8\uFF0C\u586B\u62A5\u9884\u89C8\u65F6\u5C5E\u6027\u65E0\u6548\u3002 FR-Designer_Mobile_Report_Analysis_Annotation=\u6CE8\u91CA: \u53EF\u4EE5\u901A\u8FC7\u8BE5\u5C5E\u6027\u63A7\u5236\u62A5\u8868\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\uFF0C\u53EA\u652F\u6301\u5206\u9875\u9884\u89C8\uFF0C\u586B\u62A5\u9884\u89C8\u65F6\u5C5E\u6027\u65E0\u6548\u3002
FR-Designer_Background_Null=\u6CA1\u6709\u80CC\u666F FR-Designer_Background_Null=\u6CA1\u6709\u80CC\u666F
FR-Designer_Background_Color=\u989C\u8272 FR-Designer_Background_Color=\u989C\u8272
FR-Designer_Background_Texture=\u7EB9\u7406 FR-Designer_Background_Texture=\u7EB9\u7406
@ -586,7 +588,7 @@ FR-Designer_Background_Image_Select=\u9009\u62E9\u56FE\u7247
FR-Designer_Initial_Background_Tips=\u6309\u94AE\u7684\u521D\u59CB\u80CC\u666F FR-Designer_Initial_Background_Tips=\u6309\u94AE\u7684\u521D\u59CB\u80CC\u666F
FR-Designer_Mouse_Move_Tips=\u9F20\u6807\u79FB\u52A8\u5230\u6309\u94AE\u4E0A\u7684\u80CC\u666F\uFF0C\u82E5\u65E0\u5219\u4E0D\u6539\u53D8\u80CC\u666F FR-Designer_Mouse_Move_Tips=\u9F20\u6807\u79FB\u52A8\u5230\u6309\u94AE\u4E0A\u7684\u80CC\u666F\uFF0C\u82E5\u65E0\u5219\u4E0D\u6539\u53D8\u80CC\u666F
FR-Designer_Mouse_Click_Tips=\u9F20\u6807\u70B9\u51FB\u6309\u94AE\u65F6\u80CC\u666F\uFF0C\u82E5\u65E0\u5219\u4E0D\u6539\u53D8\u80CC\u666F FR-Designer_Mouse_Click_Tips=\u9F20\u6807\u70B9\u51FB\u6309\u94AE\u65F6\u80CC\u666F\uFF0C\u82E5\u65E0\u5219\u4E0D\u6539\u53D8\u80CC\u666F
FR-Designer-Move_Tab_First=\u79FB\u52A8\u5230\u9996\u4F4D FR-Designer_AxisReversed=\u8F74\u9006\u5E8F
FR-Designer-Move_Tab_End=\u79FB\u52A8\u5230\u672B\u5C3E FR-Designer_Logarithmic=\u5BF9\u6570\u523B\u5EA6
FR-Designer-Move_Tab_Next=\u5F80\u540E\u79FB\u52A8 FR-Designer_Chart_Log_Base=\u5E95\u6570
FR-Designer-Move_Tab_Prev=\u5F80\u524D\u79FB\u52A8 FR-Designer_Chart_F_Radar_Axis=\u503C\u8F74

20
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -91,7 +91,6 @@ FR-Designer_DS-Dictionary=\u8CC7\u6599\u5B57\u5178
FR-Designer_Data-confusion=\u8CC7\u6599\u6DF7\u6DC6 FR-Designer_Data-confusion=\u8CC7\u6599\u6DF7\u6DC6
FR-Designer_Data_Type=\u8CC7\u6599\u985E\u578B FR-Designer_Data_Type=\u8CC7\u6599\u985E\u578B
FR-Designer_Double_Click_Edit_OR_Clear=\u96D9\u64CA\u9032\u884C\u7DE8\u8F2F\u6216\u6E05\u9664 FR-Designer_Double_Click_Edit_OR_Clear=\u96D9\u64CA\u9032\u884C\u7DE8\u8F2F\u6216\u6E05\u9664
FR-Designer_Edit_Button_ToolBar=\u7DE8\u8F2F\u6309\u9215\u6240\u5728\u5DE5\u5177\u6B04
FR-Designer_Email=\u90F5\u4EF6 FR-Designer_Email=\u90F5\u4EF6
FR-Designer_Enabled=\u53EF\u7528 FR-Designer_Enabled=\u53EF\u7528
FR-Designer_End-Date=\u7D50\u675F\u65E5\u671F FR-Designer_End-Date=\u7D50\u675F\u65E5\u671F
@ -163,7 +162,6 @@ FR-Designer_Refresh_Parameter_In_SQL=\u5728SQL\u4E2D\u91CD\u65B0\u6574\u7406\u76
FR-Designer_Reg_Expressions=\u6B63\u5247\u8868\u9054\u5F0F FR-Designer_Reg_Expressions=\u6B63\u5247\u8868\u9054\u5F0F
FR-Designer_Reg_Max_Length=\u6700\u5927\u9577\u5EA6 FR-Designer_Reg_Max_Length=\u6700\u5927\u9577\u5EA6
FR-Designer_Reg_Min_Length=\u6700\u5C0F\u9577\u5EA6 FR-Designer_Reg_Min_Length=\u6700\u5C0F\u9577\u5EA6
FR-Designer_Remove_Button_ToolBar=\u79FB\u9664\u6309\u9215\u6240\u5728\u5DE5\u5177\u6B04
FR-Designer_ReportColumns-Columns=\u5831\u8868\u6B04\u4F4D FR-Designer_ReportColumns-Columns=\u5831\u8868\u6B04\u4F4D
FR-Designer_Return-Date=\u8FD4\u56DE\u65E5\u671F FR-Designer_Return-Date=\u8FD4\u56DE\u65E5\u671F
FR-Designer_RichText= RTF FR-Designer_RichText= RTF
@ -536,14 +534,14 @@ FR-Designer_Left_Display=\u5DE6\u986F\u793A
FR-Designer_About_Version=\u7248\u672C FR-Designer_About_Version=\u7248\u672C
FR-Designer_About_CopyRight=\u7248\u6B0A\u6240\u6709 FR-Designer_About_CopyRight=\u7248\u6B0A\u6240\u6709
FR-Designer_Service_Phone=\u670D\u52D9\u96FB\u8A71\uFF1A FR-Designer_Service_Phone=\u670D\u52D9\u96FB\u8A71\uFF1A
FR-Designer_Allow_Blank=\u5141\u8A31\u70BA\u7A7A\u767D FR-Designer_Allow_Null=\u5141\u8A31\u70BA\u7A7A\u767D
FR-Designer_PageSetup_Page=\u9801\u9762 FR-Designer_PageSetup_Page=\u9801\u9762
FR-Designer_Custom_Job_Description=\u63CF\u8FF0 FR-Designer_Custom_Job_Description=\u63CF\u8FF0
FR-Designer_Property=\u5C6C\u6027 FR-Designer_Property=\u5C6C\u6027
FR-Designer_ClassName=\u985E\u540D FR-Designer_ClassName=\u985E\u540D
FR-Designer_Polyblock_Edit=\u805A\u5408\u584A\u7DE8\u8F2F FR-Designer_Polyblock_Edit=\u805A\u5408\u584A\u7DE8\u8F2F
FR-Designer_Function_Description_Area_Text=\u8A72\u985E\u5FC5\u9808\u7E7C\u627F"com.fr.script.AbstractFunction"\u3002\u61C9\u5C07\u7DE8\u8B6F\u5F8C\u7684\u985E\u6A94\u6848\u62F7\u8C9D\u5230\nJ2EE\u4F3A\u670D\u5668 "{R1}WEB-INF{R2}classes" \u76EE\u9304\uFF0C\u5982\u679C\u5FC5\u8981\u7684\u8A71\u5C07class\u5C0D\u61C9\u7684java\u539F\u59CB\u6A94\u6848\u4E5F\u653E\u7F6E\u5230\u8A72\u76EE\u9304\u4E0B\u65B9\u4FBF\u7DE8\u8F2F\u548C\u67E5\u770B\u3002\n\u4F8B\u5982\uFF1A{R3}classes FR-Designer_Function_Description_Area_Text=\u8A72\u985E\u5FC5\u9808\u7E7C\u627F"com.fr.script.AbstractFunction"\u3002\u61C9\u5C07\u7DE8\u8B6F\u5F8C\u7684\u985E\u6A94\u6848\u62F7\u8C9D\u5230\nJ2EE\u4F3A\u670D\u5668 "{R1}" \u76EE\u9304\uFF0C\u5982\u679C\u5FC5\u8981\u7684\u8A71\u5C07class\u5C0D\u61C9\u7684java\u539F\u59CB\u6A94\u6848\u4E5F\u653E\u7F6E\u5230\u8A72\u76EE\u9304\u4E0B\u65B9\u4FBF\u7DE8\u8F2F\u548C\u67E5\u770B\u3002\n\u4F8B\u5982\uFF1A{R2}
FR-Designer_PageSetup_Horizontal=\u6A2A\u5411 FR-Designer_PageSetup_Horizontal=\u6A2A\u5411
FR-Designer_PageSetup_Vertical=\u7E31\u5411 FR-Designer_PageSetup_Vertical=\u7E31\u5411
FR-Designer_Gradient_Direction=\u6F38\u8B8A\u65B9\u5411 FR-Designer_Gradient_Direction=\u6F38\u8B8A\u65B9\u5411
@ -557,9 +555,13 @@ FR-Designer_Show_As_Download=\u7528\u4E0B\u8F09\u93C8\u63A5\u986F\u793A\u4E8C\u9
FR-Designer_File_Name_For_Download=\u4E0B\u8F09\u6A94\u6848\u540D FR-Designer_File_Name_For_Download=\u4E0B\u8F09\u6A94\u6848\u540D
FR-Designer_No=\u5426 FR-Designer_No=\u5426
FR-Designer_Pagination=\u5206\u9801 FR-Designer_Pagination=\u5206\u9801
FR-Designer-Move_Tab_First=\u79FB\u52D5\u5230\u9996\u4F4D
FR-Designer-Move_Tab_End=\u79FB\u52D5\u5230\u672B\u5C3E
FR-Designer-Move_Tab_Next=\u5F80\u5F8C\u79FB\u52D5
FR-Designer-Move_Tab_Prev=\u5F80\u524D\u79FB\u52D5
FR-Designer_DS_TableData=\u8CC7\u6599\u96C6 FR-Designer_DS_TableData=\u8CC7\u6599\u96C6
FR-Designer_Parameter-Formula=\u516C\u5F0F FR-Designer_Parameter-Formula=\u516C\u5F0F
FR-Designer_Plugin_Should_Update_Please_Contact_Developer=\u63D2\u4EF6\u7248\u672C\u904E\u4F4E, \u5B58\u5728API\u4E0D\u517C\u5BB9, \u8ACB\u806F\u7E6B\u958B\u767C\u8005\u5347\u7D1A\u63D2\u4EF6 FR-Designer_Plugin_Should_Update_Please_Contact_Developer=\u633F\u4EF6\u7248\u672C\u904E\u4F4E\uFF0C\u5B58\u5728API\u4E0D\u76F8\u5BB9\uFF0C\u8ACB\u806F\u7CFB\u958B\u767C\u8005\u965E\u7D1A\u633F\u4EF6
FR-Designer_WidgetOrder=\u63A7\u4EF6\u9806\u5E8F FR-Designer_WidgetOrder=\u63A7\u4EF6\u9806\u5E8F
FR-Designer_Mobile_Form_Analysis_Annotation=\u6CE8\u91CB\uFF1A\u53EF\u4EE5\u901A\u904E\u8A72\u5C6C\u6027\u63A7\u5236\u8868\u55AE\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\u3002 FR-Designer_Mobile_Form_Analysis_Annotation=\u6CE8\u91CB\uFF1A\u53EF\u4EE5\u901A\u904E\u8A72\u5C6C\u6027\u63A7\u5236\u8868\u55AE\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\u3002
FR-Designer_Mobile_Report_Analysis_Annotation=\u6CE8\u91CB\uFF1A\u53EF\u4EE5\u901A\u904E\u8A72\u5C6C\u6027\u63A7\u5236\u5831\u8868\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\uFF0C\u53EA\u652F\u6301\u5206\u9801\u9810\u89BD\uFF0C\u586B\u5831\u9810\u89BD\u6642\u5C6C\u6027\u7121\u6548\u3002 FR-Designer_Mobile_Report_Analysis_Annotation=\u6CE8\u91CB\uFF1A\u53EF\u4EE5\u901A\u904E\u8A72\u5C6C\u6027\u63A7\u5236\u5831\u8868\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\uFF0C\u53EA\u652F\u6301\u5206\u9801\u9810\u89BD\uFF0C\u586B\u5831\u9810\u89BD\u6642\u5C6C\u6027\u7121\u6548\u3002
@ -574,7 +576,7 @@ FR-Designer_Background_Image_Select=
FR-Designer_Initial_Background_Tips= FR-Designer_Initial_Background_Tips=
FR-Designer_Mouse_Move_Tips= FR-Designer_Mouse_Move_Tips=
FR-Designer_Mouse_Click_Tips= FR-Designer_Mouse_Click_Tips=
FR-Designer-Move_Tab_First=\u79FB\u52D5\u5230\u9996\u4F4D FR-Designer_AxisReversed=\u8EF8\u9006\u5E8F
FR-Designer-Move_Tab_End=\u79FB\u52D5\u5230\u672B\u5C3E FR-Designer_Logarithmic=\u5C0D\u6578\u523B\u5EA6
FR-Designer-Move_Tab_Next=\u5F80\u5F8C\u79FB\u52D5 FR-Designer_Chart_Log_Base=\u5E95\u6578
FR-Designer-Move_Tab_Prev=\u5F80\u524D\u79FB\u52D5 FR-Designer_Chart_F_Radar_Axis=\u503C\u8EF8

67
designer_base/src/com/fr/design/mainframe/BaseJForm.java

@ -1 +1,66 @@
package com.fr.design.mainframe; import javax.swing.JComponent; import com.fr.form.FormElementCaseContainerProvider; /** * Author : Shockway * Date: 13-7-15 * Time: 上午10:28 */ public interface BaseJForm extends JTemplateProvider{ public static final String XML_TAG = "JForm"; public static final int FORM_TAB = 0; public static final int ELEMENTCASE_TAB = 1; public static final int ELEMENTCASE_CHANGE_TAB = 2; /** * 刷新所有控件 */ public void refreshAllNameWidgets(); /** * 刷新参数 */ public void populateParameter(); /** * 刷新选中的控件 */ public void refreshSelectedWidget(); /** * 获取当前的Target */ public Object getTarget(); /** * 执行撤销 * * @param o 之前保存的状态 */ public void applyUndoState4Form(BaseUndoState o); /** * 获取当前编辑的组件 */ public JComponent getEditingPane(); /** * 只在Form和ElementCase之间切换 * @param index 切换位置 */ public void tabChanged(int index); /** * 在Form和ElementCase, 以及ElementCase和ElementCase之间切换 * @param index 切换位置 * @param ecContainer ElementCase所在container */ public void tabChanged(int index, FormElementCaseContainerProvider ecContainer); } package com.fr.design.mainframe;
import javax.swing.JComponent;
import com.fr.form.FormElementCaseContainerProvider;
/**
* Author : Shockway
* Date: 13-7-15
* Time: 上午10:28
*/
public interface BaseJForm extends JTemplateProvider {
String XML_TAG = "JForm";
int FORM_TAB = 0;
int ELEMENTCASE_TAB = 1;
int ELEMENTCASE_CHANGE_TAB = 2;
/**
* 刷新所有控件
*/
void refreshAllNameWidgets();
/**
* 刷新参数
*/
void populateParameter();
/**
* 刷新选中的控件
*/
void refreshSelectedWidget();
/**
* 获取当前的Target
*/
Object getTarget();
/**
* 执行撤销
*
* @param o 之前保存的状态
*/
void applyUndoState4Form(BaseUndoState o);
/**
* 获取当前编辑的组件
*/
JComponent getEditingPane();
/**
* 只在Form和ElementCase之间切换
*
* @param index 切换位置
*/
void tabChanged(int index);
/**
* 在Form和ElementCase, 以及ElementCase和ElementCase之间切换
*
* @param index 切换位置
* @param ecContainer ElementCase所在container
*/
void tabChanged(int index, FormElementCaseContainerProvider ecContainer);
}

111
designer_base/src/com/fr/design/mainframe/JTemplate.java

@ -85,7 +85,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
public JTemplate(T t, String defaultFileName) { public JTemplate(T t, String defaultFileName) {
this(t, new MemFILE(newTemplateNameByIndex(defaultFileName)), true); this(t, new MemFILE(newTemplateNameByIndex(defaultFileName)), true);
initForCollect(); openTime = System.currentTimeMillis();
} }
public JTemplate(T t, FILE file) { public JTemplate(T t, FILE file) {
@ -111,14 +111,15 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
// 为收集模版信息作准备 // 为收集模版信息作准备
private void initForCollect() { private void initForCollect() {
if (template.getTemplateID() == null) { template.initTemplateID(); // 为新模板设置 templateID 属性
template.initTemplateID(); // 为新模板设置 templateID 属性
}
if (openTime == 0) { if (openTime == 0) {
openTime = System.currentTimeMillis(); openTime = System.currentTimeMillis();
} }
} }
private void collectInfo() { // 执行收集操作 private void collectInfo() { // 执行收集操作
if (openTime == 0) { // 旧模板,不收集数据
return;
}
long saveTime = System.currentTimeMillis(); // 保存模板的时间点 long saveTime = System.currentTimeMillis(); // 保存模板的时间点
tic.collectInfo(template, this, openTime, saveTime); tic.collectInfo(template, this, openTime, saveTime);
openTime = saveTime; // 更新 openTime,准备下一次计算 openTime = saveTime; // 更新 openTime,准备下一次计算
@ -371,7 +372,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
} }
protected boolean accept(Object o){ protected boolean accept(Object o){
return true; return true;
} }
private void fireSuperTargetModified() { private void fireSuperTargetModified() {
@ -487,15 +488,15 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
collectInfo(); collectInfo();
return this.saveFile(); return this.saveFile();
} }
private boolean isCancelOperation(int operation){ private boolean isCancelOperation(int operation){
return operation == FILEChooserPane.CANCEL_OPTION || return operation == FILEChooserPane.CANCEL_OPTION ||
operation == FILEChooserPane.JOPTIONPANE_CANCEL_OPTION; operation == FILEChooserPane.JOPTIONPANE_CANCEL_OPTION;
} }
private boolean isOkOperation(int operation){ private boolean isOkOperation(int operation){
return operation == FILEChooserPane.JOPTIONPANE_OK_OPTION || return operation == FILEChooserPane.JOPTIONPANE_OK_OPTION ||
operation == FILEChooserPane.OK_OPTION; operation == FILEChooserPane.OK_OPTION;
} }
private boolean saveAsTemplate(boolean isShowLoc) { private boolean saveAsTemplate(boolean isShowLoc) {
@ -512,8 +513,8 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
if (isCancelOperation(chooseResult)) { if (isCancelOperation(chooseResult)) {
fileChooser = null; fileChooser = null;
return false; return false;
} }
if (isOkOperation(chooseResult)) { if (isOkOperation(chooseResult)) {
if (!FRContext.getCurrentEnv().hasFileFolderAllow(fileChooser.getSelectedFILE().getPath()) ) { if (!FRContext.getCurrentEnv().hasFileFolderAllow(fileChooser.getSelectedFILE().getPath()) ) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_No-Privilege") + "!", Inter.getLocText("FR-Designer_Message"), JOptionPane.WARNING_MESSAGE); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_No-Privilege") + "!", Inter.getLocText("FR-Designer_Message"), JOptionPane.WARNING_MESSAGE);
@ -523,40 +524,40 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
mkNewFile(editingFILE); mkNewFile(editingFILE);
fileChooser = null; fileChooser = null;
} }
return saveNewFile(editingFILE, oldName); return saveNewFile(editingFILE, oldName);
} }
protected boolean saveNewFile(FILE editingFILE, String oldName){ protected boolean saveNewFile(FILE editingFILE, String oldName){
this.editingFILE = editingFILE; this.editingFILE = editingFILE;
boolean result = this.saveFile(); boolean result = this.saveFile();
if (result) { if (result) {
DesignerFrameFileDealerPane.getInstance().refresh(); DesignerFrameFileDealerPane.getInstance().refresh();
initForCollect(); // 如果是旧模板另存为新模板,则添加 templateID initForCollect(); // 如果保存新模板(新建模板直接保存,或者另存为),则添加 templateID
collectInfo(); collectInfo();
} }
//更换最近打开 //更换最近打开
DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(oldName, this.getFullPathName()); DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(oldName, this.getFullPathName());
return result; return result;
} }
protected void mkNewFile(FILE file){ protected void mkNewFile(FILE file){
try { try {
file.mkfile(); file.mkfile();
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
} }
} }
/** /**
* 将模板另存为可以分享出去的混淆后内置数据集模板 * 将模板另存为可以分享出去的混淆后内置数据集模板
* *
* @return 是否另存成功 * @return 是否另存成功
* *
*/ */
public boolean saveShareFile(){ public boolean saveShareFile(){
return true; return true;
} }
public Widget getSelectElementCase(){ public Widget getSelectElementCase(){
return new NoneWidget(); return new NoneWidget();
@ -761,7 +762,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
public void revert() { public void revert() {
} }
private int getVersionCompare(String versionString){ private int getVersionCompare(String versionString){
if (StringUtils.isBlank(versionString)) { if (StringUtils.isBlank(versionString)) {
return 0; return 0;
@ -771,7 +772,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
return ComparatorUtils.compare(versionString.substring(0, len), ProductConstants.DESIGNER_VERSION.substring(0, len)); return ComparatorUtils.compare(versionString.substring(0, len), ProductConstants.DESIGNER_VERSION.substring(0, len));
} }
private int getVersionCompareHBB(String versionString){ private int getVersionCompareHBB(String versionString){
if (StringUtils.isBlank(versionString)) { if (StringUtils.isBlank(versionString)) {
return 0; return 0;
@ -779,17 +780,17 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
return ComparatorUtils.compare(versionString, "HBB"); return ComparatorUtils.compare(versionString, "HBB");
} }
private boolean isHigherThanCurrent(String versionString) { private boolean isHigherThanCurrent(String versionString) {
return getVersionCompare(versionString) > 0; return getVersionCompare(versionString) > 0;
} }
private boolean isLowerThanCurrent(String versionString) { private boolean isLowerThanCurrent(String versionString) {
return getVersionCompare(versionString) < 0; return getVersionCompare(versionString) < 0;
} }
private boolean isLowerThanHBB(String versionString) { private boolean isLowerThanHBB(String versionString) {
return getVersionCompareHBB(versionString) < 0; return getVersionCompareHBB(versionString) < 0;
} }
/** /**
@ -799,7 +800,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
public boolean isNewDesigner() { public boolean isNewDesigner() {
String xmlDesignerVersion = getTarget().getXMLDesignerVersion(); String xmlDesignerVersion = getTarget().getXMLDesignerVersion();
if (isLowerThanHBB(xmlDesignerVersion)) { if (isLowerThanHBB(xmlDesignerVersion)) {
String info = Inter.getLocText("FR-Designer_open-new-form-tip"); String info = Inter.getLocText("FR-Designer_open-new-form-tip");
String moreInfo = Inter.getLocText("FR-Designer_Server-version-tip-moreInfo"); String moreInfo = Inter.getLocText("FR-Designer_Server-version-tip-moreInfo");
new InformationWarnPane(info, moreInfo, Inter.getLocText("FR-Designer_Tooltips")).show(); new InformationWarnPane(info, moreInfo, Inter.getLocText("FR-Designer_Tooltips")).show();
return true; return true;
@ -853,13 +854,13 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
* @return 是则返回true * @return 是则返回true
*/ */
public abstract boolean isJWorkBook(); public abstract boolean isJWorkBook();
/** /**
* 返回当前支持的超链界面pane * 返回当前支持的超链界面pane
* @return 超链连接界面 * @return 超链连接界面
*/ */
public HyperlinkGroupPane getHyperLinkPane() { public HyperlinkGroupPane getHyperLinkPane() {
return new HyperlinkGroupPane(); return new HyperlinkGroupPane();
} }
/** /**
@ -914,29 +915,29 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
public void requestGridFocus() { public void requestGridFocus() {
} }
/** /**
* 创建内置sql提交的pane * 创建内置sql提交的pane
* *
* @return 内置sql提交的pane * @return 内置sql提交的pane
* *
* *
* @date 2014-10-14-下午7:39:27 * @date 2014-10-14-下午7:39:27
*/ */
public DBManipulationPane createDBManipulationPane(){ public DBManipulationPane createDBManipulationPane(){
return new DBManipulationPane(); return new DBManipulationPane();
} }
/** /**
* 创建控件事件里内置sql提交的pane * 创建控件事件里内置sql提交的pane
* *
* @return 内置sql提交的pane * @return 内置sql提交的pane
* *
* *
* @date 2014-10-14-下午7:39:27 * @date 2014-10-14-下午7:39:27
*/ */
public DBManipulationPane createDBManipulationPaneInWidget(){ public DBManipulationPane createDBManipulationPaneInWidget(){
return new DBManipulationInWidgetEventPane(); return new DBManipulationInWidgetEventPane();
} }
/** /**
@ -964,15 +965,15 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
public void styleChange(){ public void styleChange(){
} }
/** /**
* 创建分享模板的按钮, 目前只有jworkbook实现了 * 创建分享模板的按钮, 目前只有jworkbook实现了
* *
* @return 分享模板按钮 * @return 分享模板按钮
* *
*/ */
public UIButton[] createShareButton(){ public UIButton[] createShareButton(){
return new UIButton[0]; return new UIButton[0];
} }
/** /**

43
designer_base/src/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java

@ -5,6 +5,7 @@ import com.fr.base.io.IOFile;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.env.RemoteEnv;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
@ -15,9 +16,7 @@ import org.json.JSONObject;
import java.io.*; import java.io.*;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Calendar;
import java.util.HashMap;
/** /**
* 做模板的过程和耗时收集辅助类 * 做模板的过程和耗时收集辅助类
@ -32,6 +31,7 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable {
private static final int VALID_WIDGET_COUNT = 5; // 有效报表模板的控件数 private static final int VALID_WIDGET_COUNT = 5; // 有效报表模板的控件数
private static final int COMPLETE_DAY_COUNT = 15; // 判断模板是否完成的天数 private static final int COMPLETE_DAY_COUNT = 15; // 判断模板是否完成的天数
private static final int ONE_THOUSAND = 1000; private static final int ONE_THOUSAND = 1000;
static final long serialVersionUID = 2007L;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private TemplateInfoCollector() { private TemplateInfoCollector() {
@ -70,18 +70,28 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable {
} catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {
// 如果之前没有存储过,则创建新对象 // 如果之前没有存储过,则创建新对象
instance = new TemplateInfoCollector(); instance = new TemplateInfoCollector();
} catch (Exception ex) { } catch (InvalidClassException ex) {
// 如果 TemplateInfoCollecor 类结构有改动,则放弃之前收集的数据(下次保存时覆盖)
// 这种情况主要在开发、测试过程中遇到,正式上线后不应该出现
FRLogger.getLogger().info(ex.getMessage());
FRLogger.getLogger().info("use a new instance");
instance = new TemplateInfoCollector();
}
catch (Exception ex) {
FRLogger.getLogger().error(ex.getMessage(), ex); FRLogger.getLogger().error(ex.getMessage(), ex);
} }
} }
return instance; return instance;
} }
private static boolean shouldCollectInfo() { private boolean shouldCollectInfo() {
if (FRContext.getCurrentEnv() instanceof RemoteEnv) { // 远程设计不收集数据
return false;
}
return DesignerEnvManager.getEnvManager().isJoinProductImprove() && FRContext.isChineseEnv(); return DesignerEnvManager.getEnvManager().isJoinProductImprove() && FRContext.isChineseEnv();
} }
public static void appendProcess(String log) { public void appendProcess(String log) {
if (!shouldCollectInfo()) { if (!shouldCollectInfo()) {
return; return;
} }
@ -113,7 +123,14 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable {
private void saveInfo() { private void saveInfo() {
try { try {
ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(getInfoFile())); ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(getInfoFile()));
FRLogger.getLogger().info("writing: " + instance.templateInfoList); String log = "";
int count = 1;
for (String key : templateInfoList.keySet()) {
String createTime = ((HashMap)templateInfoList.get(key).get("consumingMap")).get("create_time").toString();
log += (count + ". id: " + key + " " + createTime + "\n" + templateInfoList.get(key).toString() + "\n");
count ++;
}
FRLogger.getLogger().info("writing tplInfo: \n" + log);
os.writeObject(instance); os.writeObject(instance);
os.close(); os.close();
} catch (Exception ex) { } catch (Exception ex) {
@ -225,7 +242,9 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable {
if (sendSingleTemplateInfo(consumingUrl, jsonConsumingMap) && sendSingleTemplateInfo(processUrl, jsonProcessMap)) { if (sendSingleTemplateInfo(consumingUrl, jsonConsumingMap) && sendSingleTemplateInfo(processUrl, jsonProcessMap)) {
// 清空记录 // 清空记录
FRLogger.getLogger().info("successfully send " + templateInfo.get("templateID")); FRLogger.getLogger().info("successfully send " + templateInfo.get("templateID"));
templateInfoList.remove(templateInfo.get("templateID")); removeFromTemplateInfoList(templateInfo.get("templateID"));
} else {
FRLogger.getLogger().info("send template info failed, will try next time, " + templateInfo.get("templateID"));
} }
} }
saveInfo(); saveInfo();
@ -277,12 +296,16 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable {
} }
// 删除测试模板 // 删除测试模板
for (String key : testTemplateKeys) { for (String key : testTemplateKeys) {
templateInfoList.remove(key); removeFromTemplateInfoList(key);
// System.out.println(key + " is removed...");
} }
return completeTemplatesInfo; return completeTemplatesInfo;
} }
private void removeFromTemplateInfoList(String key) {
templateInfoList.remove(key);
FRLogger.getLogger().info(key + " is removed...");
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private boolean isTestTemplate(HashMap<String, Object> templateInfo) { private boolean isTestTemplate(HashMap<String, Object> templateInfo) {
HashMap<String, Object> processMap = (HashMap<String, Object>) templateInfo.get("processMap"); HashMap<String, Object> processMap = (HashMap<String, Object>) templateInfo.get("processMap");

20
designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDockPlus.java

@ -12,52 +12,52 @@ public interface ToolBarMenuDockPlus {
* *
* @return 工具 * @return 工具
*/ */
public ToolBarDef[] toolbars4Target(); ToolBarDef[] toolbars4Target();
/** /**
* 文件菜单的子菜单 * 文件菜单的子菜单
* *
* @return 子菜单 * @return 子菜单
*/ */
public ShortCut[] shortcut4FileMenu(); ShortCut[] shortcut4FileMenu();
/** /**
* 目标的菜单 * 目标的菜单
* *
* @return 菜单 * @return 菜单
*/ */
public MenuDef[] menus4Target(); MenuDef[] menus4Target();
/** /**
* 表单的工具栏 * 表单的工具栏
* *
* @return 表单工具栏 * @return 表单工具栏
*/ */
public JPanel[] toolbarPanes4Form(); JPanel[] toolbarPanes4Form();
/** /**
* 表单的工具按钮 * 表单的工具按钮
* *
* @return 工具按钮 * @return 工具按钮
*/ */
public JComponent[] toolBarButton4Form(); JComponent[] toolBarButton4Form();
/** /**
* 权限细粒度状态下的工具面板 * 权限细粒度状态下的工具面板
* *
* @return 工具面板 * @return 工具面板
*/ */
public JComponent toolBar4Authority(); JComponent toolBar4Authority();
public int getMenuState(); int getMenuState();
public int getToolBarHeight(); int getToolBarHeight();
/** /**
* 导出菜单的子菜单 目前用于图表设计器 * 导出菜单的子菜单 目前用于图表设计器
* *
* @return 子菜单 * @return 子菜单
*/ */
public ShortCut[] shortcut4ExportMenu(); ShortCut[] shortcut4ExportMenu();
} }

73
designer_base/src/com/fr/design/parameter/ParameterDesignerProvider.java

@ -1 +1,72 @@
package com.fr.design.parameter; import com.fr.base.Parameter; import com.fr.base.parameter.ParameterUI; import com.fr.design.mainframe.AuthorityEditPane; import javax.swing.*; import java.awt.*; /** * 参数设计界面接口 */ public interface ParameterDesignerProvider { public void addListener(ParaDefinitePane paraDefinitePane); public Component createWrapper(); public void setDesignHeight(int height); public Dimension getDesignSize(); public Dimension getPreferredSize(); public void populate(ParameterUI p); public void refreshAllNameWidgets(); public void refresh4TableData(String oldName, String newName); public void refreshParameter(ParaDefinitePane paraDefinitePane); public boolean isWithQueryButton(); public java.util.List<String> getAllXCreatorNameList(); public boolean isWithoutParaXCreator(Parameter[] ps); public boolean isBlank(); public ParameterUI getParaTarget(); public boolean addingParameter2Editor(Parameter parameter, int index); public boolean addingParameter2EditorWithQueryButton(Parameter parameter, int index); public void addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex); public JPanel[] toolbarPanes4Form(); public JComponent[] toolBarButton4Form(); public void initBeforeUpEdit(); public void populateParameterPropertyPane(ParaDefinitePane p); public void initWidgetToolbarPane(); public AuthorityEditPane getAuthorityEditPane(); public JPanel getEastUpPane(); public JPanel getEastDownPane(); public boolean isSupportAuthority(); public void removeSelection(); public ParameterBridge getParaComponent(); } package com.fr.design.parameter;
import com.fr.base.Parameter;
import com.fr.base.parameter.ParameterUI;
import com.fr.design.mainframe.AuthorityEditPane;
import javax.swing.*;
import java.awt.*;
/**
* 参数设计界面接口
*/
public interface ParameterDesignerProvider {
void addListener(ParaDefinitePane paraDefinitePane);
Component createWrapper();
void setDesignHeight(int height);
Dimension getDesignSize();
Dimension getPreferredSize();
void populate(ParameterUI p);
void refreshAllNameWidgets();
void refresh4TableData(String oldName, String newName);
void refreshParameter(ParaDefinitePane paraDefinitePane);
boolean isWithQueryButton();
java.util.List<String> getAllXCreatorNameList();
boolean isWithoutParaXCreator(Parameter[] ps);
boolean isBlank();
ParameterUI getParaTarget();
boolean addingParameter2Editor(Parameter parameter, int index);
boolean addingParameter2EditorWithQueryButton(Parameter parameter, int index);
void addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex);
JPanel[] toolbarPanes4Form();
JComponent[] toolBarButton4Form();
void initBeforeUpEdit();
void populateParameterPropertyPane(ParaDefinitePane p);
void initWidgetToolbarPane();
AuthorityEditPane getAuthorityEditPane();
JPanel getEastUpPane();
JPanel getEastDownPane();
boolean isSupportAuthority();
void removeSelection();
ParameterBridge getParaComponent();
}

3
designer_base/src/com/fr/design/style/color/ColorSelectConfigManager.java

@ -84,6 +84,9 @@ public class ColorSelectConfigManager extends XMLFileManager implements ColorSel
* @param color 颜色 * @param color 颜色
*/ */
public void addToColorQueue(Color color) { public void addToColorQueue(Color color) {
if(color == null){
return;
}
// 过滤重复的最近使用颜色 // 过滤重复的最近使用颜色
// 因为有个后进先出的问题,最近使用的颜色需要放到最前面所以没用set // 因为有个后进先出的问题,最近使用的颜色需要放到最前面所以没用set
if (colors.contains(color)) { if (colors.contains(color)) {

303
designer_base/src/com/fr/design/utils/ComponentUtils.java

@ -1,151 +1,154 @@
package com.fr.design.utils; package com.fr.design.utils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.util.ArrayList; import java.util.ArrayList;
/** /**
* 工具类提供常用的工具方法 * 工具类提供常用的工具方法
*/ */
public class ComponentUtils { public class ComponentUtils {
public static boolean isComponentVisible(Component comp) { private ComponentUtils() {
if (!comp.isVisible() && !isRootComponent(comp)) { }
return false;
} public static boolean isComponentVisible(Component comp) {
Component parent = comp.getParent(); if (!comp.isVisible() && !isRootComponent(comp)) {
return false;
return parent == null || isComponentVisible(parent); }
Component parent = comp.getParent();
}
return parent == null || isComponentVisible(parent);
/**
* 获取component所在的容器的绝对位置 }
*/
public static Rectangle getRelativeBounds(Component component) { /**
Rectangle bounds = new Rectangle(0, 0, component.getWidth(), component.getHeight()); * 获取component所在的容器的绝对位置
Container parent = component.getParent(); */
public static Rectangle getRelativeBounds(Component component) {
while (parent != null) { Rectangle bounds = new Rectangle(0, 0, component.getWidth(), component.getHeight());
bounds.x += component.getX(); Container parent = component.getParent();
bounds.y += component.getY();
component = parent; while (parent != null) {
parent = component.getParent(); bounds.x += component.getX();
} bounds.y += component.getY();
component = parent;
return bounds; parent = component.getParent();
} }
/** return bounds;
* 恢复双缓冲状态dbcomponents保存着初始状态为启动双缓冲的组件 }
*/
public static void resetBuffer(ArrayList<JComponent> dbcomponents) { /**
for (JComponent jcomponent : dbcomponents) { * 恢复双缓冲状态dbcomponents保存着初始状态为启动双缓冲的组件
jcomponent.setDoubleBuffered(true); */
} public static void resetBuffer(ArrayList<JComponent> dbcomponents) {
} for (JComponent jcomponent : dbcomponents) {
jcomponent.setDoubleBuffered(true);
/** }
* 禁止双缓冲状态并将初始状态为启动双缓冲的组件保存到dbcomponents中 }
*/
public static void disableBuffer(Component comp, ArrayList<JComponent> dbcomponents) { /**
if ((comp instanceof JComponent) && comp.isDoubleBuffered()) { * 禁止双缓冲状态并将初始状态为启动双缓冲的组件保存到dbcomponents中
JComponent jcomponent = (JComponent) comp; */
public static void disableBuffer(Component comp, ArrayList<JComponent> dbcomponents) {
dbcomponents.add(jcomponent); if ((comp instanceof JComponent) && comp.isDoubleBuffered()) {
jcomponent.setDoubleBuffered(false); JComponent jcomponent = (JComponent) comp;
}
dbcomponents.add(jcomponent);
if (comp instanceof Container) { jcomponent.setDoubleBuffered(false);
Container container = (Container) comp; }
int count = container.getComponentCount();
if (comp instanceof Container) {
if (count > 0) { Container container = (Container) comp;
for (int i = 0; i < count; i++) { int count = container.getComponentCount();
Component component = container.getComponent(i);
if (count > 0) {
disableBuffer(component, dbcomponents); for (int i = 0; i < count; i++) {
} Component component = container.getComponent(i);
}
} disableBuffer(component, dbcomponents);
} }
}
public static int indexOfComponent(Container container, Component target) { }
int count = container.getComponentCount(); }
for (int i = 0; i < count; i++) { public static int indexOfComponent(Container container, Component target) {
Component child = container.getComponent(i); int count = container.getComponentCount();
if (child == target) { for (int i = 0; i < count; i++) {
return i; Component child = container.getComponent(i);
}
} if (child.equals(target)) {
return i;
return -1; }
} }
/** return -1;
* 计算组件root相对于其顶层容器的可见区域 }
*/
public static Rectangle computeVisibleRectRel2Root(Component root) { /**
Container container = findAncestorScrollPane(root); * 计算组件root相对于其顶层容器的可见区域
*/
if (container == null) { public static Rectangle computeVisibleRectRel2Root(Component root) {
return getRelativeBounds(root); Container container = findAncestorScrollPane(root);
} else {
// 如果是JScrollPane的子组件,需要计算其viewport与改组件的交叉的可见区域 if (container == null) {
return getBoundsRel2Parent(root, container); return getRelativeBounds(root);
} } else {
} // 如果是JScrollPane的子组件,需要计算其viewport与改组件的交叉的可见区域
return getBoundsRel2Parent(root, container);
/** }
* 计算组件root相对于其顶层容器的可见区域 }
*/
public static Rectangle computeVisibleRect(JComponent root) { /**
Rectangle root_bounds = ComponentUtils.getRelativeBounds(root); * 计算组件root相对于其顶层容器的可见区域
Rectangle rect = computeVisibleRectRel2Root(root); */
rect.x -= root_bounds.x; public static Rectangle computeVisibleRect(JComponent root) {
rect.y -= root_bounds.y; Rectangle rootBounds = ComponentUtils.getRelativeBounds(root);
Rectangle rect = computeVisibleRectRel2Root(root);
return rect; rect.x -= rootBounds.x;
} rect.y -= rootBounds.y;
private static Rectangle getBoundsRel2Parent(Component child, Container parent) { return rect;
Rectangle cRect = getRelativeBounds(child); }
Rectangle pRect = getRelativeBounds(parent);
Rectangle bounds = new Rectangle(); private static Rectangle getBoundsRel2Parent(Component child, Container parent) {
Rectangle2D.intersect(cRect, pRect, bounds); Rectangle cRect = getRelativeBounds(child);
Rectangle pRect = getRelativeBounds(parent);
return bounds; Rectangle bounds = new Rectangle();
} Rectangle2D.intersect(cRect, pRect, bounds);
public static Container findAncestorScrollPane(Component p) { return bounds;
if ((p == null) || !(p instanceof Container)) { }
return null;
} public static Container findAncestorScrollPane(Component p) {
if ((p == null) || !(p instanceof Container)) {
Container c = p.getParent(); return null;
}
return findAncestorScrollPane(c);
} Container c = p.getParent();
public static boolean isRootComponent(Component root) { return findAncestorScrollPane(c);
Container parent = root.getParent(); }
return parent == null;
} public static boolean isRootComponent(Component root) {
Container parent = root.getParent();
public static boolean isChildOf(Component component, Class parent) { return parent == null;
Container container = component.getParent(); }
if (container != null) {
if (ComparatorUtils.equals(container.getClass(), parent)) { public static boolean isChildOf(Component component, Class parent) {
return true; Container container = component.getParent();
} else { if (container != null) {
return isChildOf(container, parent); if (ComparatorUtils.equals(container.getClass(), parent)) {
} return true;
} } else {
return false; return isChildOf(container, parent);
} }
}
return false;
}
} }

2
designer_base/src/com/fr/env/RemoteEnv.java vendored

@ -55,7 +55,7 @@ import java.util.Timer;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public class RemoteEnv implements Env { public class RemoteEnv extends AbstractEnv {
private static final int TIME_OUT = 30 * 1000; private static final int TIME_OUT = 30 * 1000;
private static final int PLAIN_SOCKET_PORT = 80; private static final int PLAIN_SOCKET_PORT = 80;
private static final int SSL_PORT = 443; private static final int SSL_PORT = 443;

20
designer_chart/build.master.gradle

@ -1,8 +1,26 @@
apply plugin: 'java'
tasks.withType(JavaCompile){ tasks.withType(JavaCompile){
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
buildscript {
repositories {
maven {
url "http://www.eveoh.nl/files/maven2"
}
}
dependencies {
classpath "nl.eveoh:gradle-aspectj:1.2"
}
}
ext.aspectjVersion = '1.7.4'
apply plugin: 'aspectj'
repositories {
mavenCentral()
}
//jdk版本 //jdk版本
sourceCompatibility=1.7 sourceCompatibility=1.7
//jar包的版本 //jar包的版本

85
designer_chart/build.master.gradle.bak

@ -0,0 +1,85 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
options.encoding = 'UTF-8'
}
buildscript {
repositories {
maven {
url "http://www.eveoh.nl/files/maven2"
}
}
dependencies {
classpath "nl.eveoh:gradle-aspectj:1.2"
}
}
ext.aspectjVersion = '1.7.4'
apply plugin: 'aspectj'
repositories {
mavenCentral()
}
//jdk版本
sourceCompatibility=1.7
//jar包的版本
version='8.0'
def srcDir="."
//jar包进行重命名
jar{
baseName='fr-designer-chart'
}
sourceSets{
main{
java{
srcDirs=["${srcDir}/src"]
}
}
}
FileTree files =fileTree(dir:'./',include:'build.*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\'))
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
//
dependencies{
compile fileTree(dir:"../../../finereport-lib-stable/${branchName}",include:'**/*.jar')
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar")
testCompile 'junit:junit:4.12'
}
//.java classes文件夹下参与打包
task copyFile(type:Copy,dependsOn:compileJava){
copy{
from ("${srcDir}/src"){
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html'
}
into 'build/classes/main'
}
}
//js文件
task compressJS{
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){
classpath {
fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar')
}
}
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/src"){
include (name:'**/*.js')
include (name:'**/*.css')
}
}
}
jar.dependsOn compressJS

20
designer_chart/build.release.gradle

@ -1,8 +1,26 @@
apply plugin: 'java'
tasks.withType(JavaCompile){ tasks.withType(JavaCompile){
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
buildscript {
repositories {
maven {
url "http://www.eveoh.nl/files/maven2"
}
}
dependencies {
classpath "nl.eveoh:gradle-aspectj:1.2"
}
}
ext.aspectjVersion = '1.7.4'
apply plugin: 'aspectj'
repositories {
mavenCentral()
}
//jdk版本 //jdk版本
sourceCompatibility=1.8 sourceCompatibility=1.8
//jar包的版本 //jar包的版本

74
designer_chart/src/com/fr/design/chart/axis/MinMaxValuePane.java

@ -31,45 +31,53 @@ public class MinMaxValuePane extends JPanel {
protected UITextField secUnitField; protected UITextField secUnitField;
public MinMaxValuePane() { public MinMaxValuePane() {
minCheckBox = new UICheckBox(Inter.getLocText(new String[]{"Custom", "Min_Value"})); minCheckBox = new UICheckBox(Inter.getLocText(new String[]{"Custom", "Min_Value"}));
minValueField = new UITextField(6); minValueField = new UITextField(6);
maxCheckBox = new UICheckBox(Inter.getLocText(new String[]{"Custom", "Max_Value"})); maxCheckBox = new UICheckBox(Inter.getLocText(new String[]{"Custom", "Max_Value"}));
maxValueField = new UITextField(6); maxValueField = new UITextField(6);
isCustomMainUnitBox = new UICheckBox(Inter.getLocText("FR-Chart_MainGraduationUnit")); isCustomMainUnitBox = new UICheckBox(Inter.getLocText("FR-Chart_MainGraduationUnit"));
mainUnitField = new UITextField(6); mainUnitField = new UITextField(6);
isCustomSecUnitBox = new UICheckBox(Inter.getLocText("FR-Chart_SecondGraduationUnit")); isCustomSecUnitBox = new UICheckBox(Inter.getLocText("FR-Chart_SecondGraduationUnit"));
secUnitField = new UITextField(6); secUnitField = new UITextField(6);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = { p, f }; double[] columnSize = {p, f};
double[] rowSize = { p, p, p, p, p, p, p, p};
Component[][] components = getPanelComponents(); Component[][] components = getPanelComponents();
JPanel panel = TableLayoutHelper.createTableLayoutPane(components ,rowSize,columnSize); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, getRowSize(p), columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(panel,BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
addComponentListener(components);
}
for(int i = 0; i < components.length; i+=2) { protected double[] getRowSize(double p) {
((UICheckBox)components[i][0]).addActionListener(new ActionListener() { return new double[]{p, p, p, p};
}
@Override protected void addComponentListener(Component[][] components) {
public void actionPerformed(ActionEvent e) { for (int i = 0; i < components.length; i++) {
checkBoxUse(); addListener((UICheckBox) components[i][0]);
} ChartSwingUtils.addListener((UICheckBox) components[i][0], (UITextField) components[i][1]);
});
ChartSwingUtils.addListener((UICheckBox)components[i][0], (UITextField)components[i+1][0]);
} }
} }
protected void addListener(UICheckBox checkBox) {
checkBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkBoxUse();
}
});
}
protected Component[][] getPanelComponents() { protected Component[][] getPanelComponents() {
return new Component[][]{ return new Component[][]{
new Component[]{minCheckBox}, new Component[]{minCheckBox, minValueField},
new Component[]{minValueField}, new Component[]{maxCheckBox, maxValueField},
new Component[]{maxCheckBox}, new Component[]{isCustomMainUnitBox, mainUnitField},
new Component[]{maxValueField}, new Component[]{isCustomSecUnitBox, secUnitField},
new Component[]{isCustomMainUnitBox},
new Component[]{mainUnitField},
new Component[]{isCustomSecUnitBox},
new Component[]{secUnitField},
}; };
} }
@ -104,7 +112,7 @@ public class MinMaxValuePane extends JPanel {
if(axis.getMinValue() != null) { if(axis.getMinValue() != null) {
minValueField.setText(axis.getMinValue().toString()); minValueField.setText(axis.getMinValue().toString());
} }
} }
// 最大值 // 最大值
if (axis.isCustomMaxValue()) { if (axis.isCustomMaxValue()) {
@ -112,7 +120,7 @@ public class MinMaxValuePane extends JPanel {
if(axis.getMaxValue() != null) { if(axis.getMaxValue() != null) {
maxValueField.setText(axis.getMaxValue().toString()); maxValueField.setText(axis.getMaxValue().toString());
} }
} }
// 主次刻度单位 // 主次刻度单位
if (axis.isCustomMainUnit()) { if (axis.isCustomMainUnit()) {
@ -120,7 +128,7 @@ public class MinMaxValuePane extends JPanel {
if(axis.getMainUnit() != null) { if(axis.getMainUnit() != null) {
mainUnitField.setText(axis.getMainUnit().toString()); mainUnitField.setText(axis.getMainUnit().toString());
} }
} }
if(axis.isCustomSecUnit()) { if(axis.isCustomSecUnit()) {
isCustomSecUnitBox.setSelected(true); isCustomSecUnitBox.setSelected(true);

2
designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java

@ -45,7 +45,7 @@ public class ChartHyperPoplinkPane extends BasicBeanPane<ChartHyperPoplink> {
ChartCollection cc = createChartCollection(); ChartCollection cc = createChartCollection();
chartComponent = new ChartComponent(); chartComponent = new ChartComponent();
chartComponent.setPreferredSize(new Dimension(220, 170));// 在单元格弹出时 需要调整保证属性表的大小. chartComponent.setPreferredSize(new Dimension(200, 170));// 在单元格弹出时 需要调整保证属性表的大小.
chartComponent.setSupportEdit(false); chartComponent.setSupportEdit(false);
chartComponent.populate(cc); chartComponent.populate(cc);

2
designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java

@ -79,7 +79,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
eastPane.setLayout(new BorderLayout()); eastPane.setLayout(new BorderLayout());
eastPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 15)); eastPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 5));
JPanel button = new JPanel(); JPanel button = new JPanel();
button.setPreferredSize(new Dimension(45, 20)); button.setPreferredSize(new Dimension(45, 20));
button.setLayout(new GridLayout(1, 2, 5, 0)); button.setLayout(new GridLayout(1, 2, 5, 0));

17
designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/AbstractReportDataContentPane.java

@ -3,6 +3,8 @@ package com.fr.design.mainframe.chart.gui.data.report;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartdata.NormalReportDataDefinition;
import com.fr.chart.chartdata.SeriesDefinition;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
@ -16,6 +18,7 @@ import com.fr.stable.StableUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import java.awt.*; import java.awt.*;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -95,6 +98,20 @@ public abstract class AbstractReportDataContentPane extends BasicBeanPane<ChartC
return seriesPane.updateBean(); return seriesPane.updateBean();
} }
protected List getEntryList(NormalReportDataDefinition seriesList) {
List list = new ArrayList();
for (int i = 0; i < seriesList.size(); i++) {
SeriesDefinition seriesEntry = (SeriesDefinition) seriesList.get(i);
Object[] nameAndValue = new Object[2];
nameAndValue[0] = seriesEntry.getSeriesName();
nameAndValue[1] = seriesEntry.getValue();
if (nameAndValue[0] != null || nameAndValue[1] != null) {
list.add(nameAndValue);
}
}
return list;
}
/** /**
* 界面标题: * 界面标题:
*/ */

15
designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java

@ -18,7 +18,6 @@ import javax.swing.*;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import java.awt.*; import java.awt.*;
import java.util.ArrayList;
import java.util.List; import java.util.List;
public class CategoryPlotReportDataContentPane extends AbstractReportDataContentPane { public class CategoryPlotReportDataContentPane extends AbstractReportDataContentPane {
@ -113,20 +112,6 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent
filterPane.populateBean(collection); filterPane.populateBean(collection);
} }
private List getEntryList(NormalReportDataDefinition seriesList) {
List list = new ArrayList();
for (int i = 0; i < seriesList.size(); i++) {
SeriesDefinition seriesEntry = (SeriesDefinition) seriesList.get(i);
Object[] nameAndValue = new Object[2];
nameAndValue[0] = seriesEntry.getSeriesName();
nameAndValue[1] = seriesEntry.getValue();
if (nameAndValue[0] != null && nameAndValue[1] != null) {
list.add(nameAndValue);
}
}
return list;
}
public void updateBean(ChartCollection collection) { public void updateBean(ChartCollection collection) {
collection.getSelectedChart().setFilterDefinition(new NormalReportDataDefinition()); collection.getSelectedChart().setFilterDefinition(new NormalReportDataDefinition());

17
designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/PiePlotReportDataContentPane.java

@ -10,7 +10,6 @@ import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane;
import com.fr.general.Inter; import com.fr.general.Inter;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -25,7 +24,7 @@ public class PiePlotReportDataContentPane extends AbstractReportDataContentPane
public PiePlotReportDataContentPane(ChartDataPane parent) { public PiePlotReportDataContentPane(ChartDataPane parent) {
initEveryPane(); initEveryPane();
this.add(new BoldFontTextLabel(Inter.getLocText("Data_Filter")), "0,4,2,4"); this.add(new BoldFontTextLabel(Inter.getLocText("FR-Chart-Data_Filter")), "0,4,2,4");
this.add(filterPane = new ChartDataFilterPane(new PiePlot(), parent), "0,6,2,4"); this.add(filterPane = new ChartDataFilterPane(new PiePlot(), parent), "0,6,2,4");
} }
@ -51,20 +50,6 @@ public class PiePlotReportDataContentPane extends AbstractReportDataContentPane
filterPane.populateBean(collection); filterPane.populateBean(collection);
} }
private List getEntryList(NormalReportDataDefinition seriesList) {
List list = new ArrayList();
for(int i = 0; i < seriesList.size(); i++) {
SeriesDefinition seriesEntry = (SeriesDefinition)seriesList.get(i);
Object[] nameAndValue = new Object[2];
nameAndValue[0] = seriesEntry.getSeriesName();
nameAndValue[1] = seriesEntry.getValue();
if(nameAndValue[0] != null && nameAndValue[1] != null) {
list.add(nameAndValue);
}
}
return list;
}
public void updateBean(ChartCollection collection) { public void updateBean(ChartCollection collection) {
collection.getSelectedChart().setFilterDefinition(new NormalReportDataDefinition()); collection.getSelectedChart().setFilterDefinition(new NormalReportDataDefinition());

22
designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java

@ -77,17 +77,17 @@ public class ChartTextAttrPane extends BasicPane {
public void populate(FRFont frFont) { public void populate(FRFont frFont) {
UIObserverListener listener = fontNameComboBox == null ? null : fontNameComboBox.getUiObserverListener(); UIObserverListener listener = fontNameComboBox == null ? null : fontNameComboBox.getUiObserverListener();
removeAllComboBoxListener(); removeAllComboBoxListener();
if (frFont == null) {
return; if (frFont != null) {
} fontNameComboBox.setSelectedItem(frFont.getFamily());
fontNameComboBox.setSelectedItem(frFont.getFamily()); bold.setSelected(frFont.isBold());
bold.setSelected(frFont.isBold()); italic.setSelected(frFont.isItalic());
italic.setSelected(frFont.isItalic()); if(fontSizeComboBox != null) {
if(fontSizeComboBox != null) { fontSizeComboBox.setSelectedItem(frFont.getSize());
fontSizeComboBox.setSelectedItem(frFont.getSize()); }
} if (fontColor != null) {
if (fontColor != null) { fontColor.setColor(frFont.getForeground());
fontColor.setColor(frFont.getForeground()); }
} }
//更新结束后,注册监听器 //更新结束后,注册监听器

13
designer_chart/src/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java

@ -72,7 +72,7 @@ public class ChartValuePane extends ChartAxisUsePane<Axis>{
axisLineStylePane = new ChartAxisLineStylePane(); axisLineStylePane = new ChartAxisLineStylePane();
zeroPane = aliagnZero4Second(); zeroPane = aliagnZero4Second();
axisReversed = new UICheckBox(Inter.getLocText("AxisReversed")); axisReversed = new UICheckBox(Inter.getLocText("FR-Designer_AxisReversed"));
unitCombox = new UIComboBox(ChartConstants.UNIT_I18N_VALUES); unitCombox = new UIComboBox(ChartConstants.UNIT_I18N_VALUES);
formatPane = new FormatPane(); formatPane = new FormatPane();
axisLabelPane = new ChartAxisLabelPane(); axisLabelPane = new ChartAxisLabelPane();
@ -151,11 +151,10 @@ public class ChartValuePane extends ChartAxisUsePane<Axis>{
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = { LayoutConstants.CHART_ATTR_TOMARGIN,p,f}; double[] columnSize = { LayoutConstants.CHART_ATTR_TOMARGIN,p,f};
double[] rowSize = { p, p, p}; double[] rowSize = { p, p};
Component[][] component = new Component[][]{ Component[][] component = new Component[][]{
new Component[]{null,initMinMaxValue(),null}, new Component[]{null,initMinMaxValue(),null},
new Component[]{null, addLogarithmicPane2ValuePane(), null}, new Component[]{null, addLogarithmicPane2ValuePane(), addLogText()},
new Component[]{null, null, addLogText()},
}; };
return TableLayoutHelper.createTableLayoutPane(component, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(component, rowSize, columnSize);
} }
@ -172,8 +171,8 @@ public class ChartValuePane extends ChartAxisUsePane<Axis>{
// 返回对数相关界面. 百分比 没有此界面. // 返回对数相关界面. 百分比 没有此界面.
protected JPanel addLogarithmicPane2ValuePane() { protected JPanel addLogarithmicPane2ValuePane() {
JPanel labelLogPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); JPanel labelLogPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
labelLogPane.add(logBox = new UICheckBox(Inter.getLocText("Logarithmic")+":")); labelLogPane.add(logBox = new UICheckBox(Inter.getLocText("FR-Designer_Logarithmic")+":"));
labelLogPane.add(new UILabel(Inter.getLocText("Chart_Log_Base"))); labelLogPane.add(new UILabel(Inter.getLocText("FR-Designer_Chart_Log_Base")));
logBaseField = new UITextField(4); logBaseField = new UITextField(4);
logBaseField.setText("10"); logBaseField.setText("10");
@ -222,7 +221,7 @@ public class ChartValuePane extends ChartAxisUsePane<Axis>{
* @return 返回标题. * @return 返回标题.
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText("Chart_F_Radar_Axis"); return Inter.getLocText("FR-Designer_Chart_F_Radar_Axis");
} }
@Override @Override

21
designer_form/build.master.gradle

@ -1,8 +1,27 @@
apply plugin: 'java'
tasks.withType(JavaCompile){ tasks.withType(JavaCompile){
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
buildscript {
repositories {
maven {
url "http://www.eveoh.nl/files/maven2"
}
}
dependencies {
classpath "nl.eveoh:gradle-aspectj:1.2"
}
}
ext.aspectjVersion = '1.7.4'
apply plugin: 'aspectj'
repositories {
mavenCentral()
}
//jdk版本 //jdk版本
sourceCompatibility=1.7 sourceCompatibility=1.7
//jar包版本 //jar包版本

22
designer_form/build.master.gradle.bak

@ -3,6 +3,26 @@ apply plugin: 'java'
tasks.withType(JavaCompile){ tasks.withType(JavaCompile){
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
buildscript {
repositories {
maven {
url "http://www.eveoh.nl/files/maven2"
}
}
dependencies {
classpath "nl.eveoh:gradle-aspectj:1.2"
}
}
ext.aspectjVersion = '1.7.4'
apply plugin: 'aspectj'
repositories {
mavenCentral()
}
//jdk版本 //jdk版本
sourceCompatibility=1.7 sourceCompatibility=1.7
//jar包版本 //jar包版本
@ -47,7 +67,7 @@ def dataContent ={def dir ->
} }
} }
} }
FileTree f1=fileTree(dir:'../../../'include:"finereport-*-stable/${branchName}/build/libs/*.jar") FileTree f1=fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/build/libs/*.jar")
f1.each{File file-> f1.each{File file->
println "----------${file.path}" println "----------${file.path}"
} }

21
designer_form/build.release.gradle

@ -1,10 +1,27 @@
apply plugin: 'java'
tasks.withType(JavaCompile){ tasks.withType(JavaCompile){
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
buildscript {
repositories {
maven {
url "http://www.eveoh.nl/files/maven2"
}
}
dependencies {
classpath "nl.eveoh:gradle-aspectj:1.2"
}
}
ext.aspectjVersion = '1.7.4'
apply plugin: 'aspectj'
repositories {
mavenCentral()
}
//jdk版本 //jdk版本
sourceCompatibility=1.8 sourceCompatibility=1.7
//jar包版本 //jar包版本
version='8.0' version='8.0'

2
designer_form/src/com/fr/design/designer/beans/ConnectorCreator.java

@ -6,7 +6,7 @@ import java.util.ArrayList;
import java.util.PriorityQueue; import java.util.PriorityQueue;
import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.widget.BoundsWidget; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
public class ConnectorCreator { public class ConnectorCreator {

177
designer_form/src/com/fr/design/designer/beans/LayoutAdapter.java

@ -1,85 +1,94 @@
package com.fr.design.designer.beans; package com.fr.design.designer.beans;
import com.fr.design.beans.GroupModel; import com.fr.design.beans.GroupModel;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
/** /**
* 该接口是LayoutManager的BeanInfo类标准Java平台没有提供布局管理器的BeanInfo类 * 该接口是LayoutManager的BeanInfo类标准Java平台没有提供布局管理器的BeanInfo类
* 对于界面设计工具来说还需一些特殊的行为 * 对于界面设计工具来说还需一些特殊的行为
* @since 6.5.3 *
*/ * @since 6.5.3
public interface LayoutAdapter { */
public interface LayoutAdapter {
/**
* 在添加组件状态时当鼠标移动到某个容器上方时如果该容器有布局管理器则会调用该布局 /**
* 管理适配器的accept来决定当前位置是否可以放置并提供特殊的标识比如红色区域标识 * 在添加组件状态时当鼠标移动到某个容器上方时如果该容器有布局管理器则会调用该布局
* 如在BorderLayout中如果某个方位已经放置了组件则此时应该返回false标识该区域不可以 * 管理适配器的accept来决定当前位置是否可以放置并提供特殊的标识比如红色区域标识
* 放置 * 如在BorderLayout中如果某个方位已经放置了组件则此时应该返回false标识该区域不可以
*@param creator 组件 * 放置
*@param x 添加的位置x该位置是相对于container的 *
*@param y 添加的位置y该位置是相对于container的 * @param creator 组件
*@return 是否可以放置 * @param x 添加的位置x该位置是相对于container的
*/ * @param y 添加的位置y该位置是相对于container的
boolean accept(XCreator creator, int x, int y); * @return 是否可以放置
*/
/** boolean accept(XCreator creator, int x, int y);
* 有的控件在拖拽调整大小后需要根据自身内容重新计算下当前的尺寸是否合适如果不合适就需要重新fix一下
* @param creator 组件 /**
*/ * 有的控件在拖拽调整大小后需要根据自身内容重新计算下当前的尺寸是否合适如果不合适就需要重新fix一下
void fix(XCreator creator); *
* @param creator 组件
/** */
* 组件的ComponentAdapter在添加组件时如果发现布局管理器不为空会继而调用该布局管理器的 void fix(XCreator creator);
* addComp方法来完成组件的具体添加在该方法内布局管理器可以提供额外的功能
* @param creator 被添加的新组件 /**
* @param x 添加的位置x该位置是相对于container的 * 组件的ComponentAdapter在添加组件时如果发现布局管理器不为空会继而调用该布局管理器的
* @param y 添加的位置y该位置是相对于container的 * addComp方法来完成组件的具体添加在该方法内布局管理器可以提供额外的功能
* @return 是否添加成功成功返回true否则false *
*/ * @param creator 被添加的新组件
boolean addBean(XCreator creator, int x, int y); * @param x 添加的位置x该位置是相对于container的
* @param y 添加的位置y该位置是相对于container的
/** * @return 是否添加成功成功返回true否则false
* 返回该布局管理适配器的Painter为容器提供放置位置的标识 */
*/ boolean addBean(XCreator creator, int x, int y);
HoverPainter getPainter();
/**
/** * 返回该布局管理适配器的Painter为容器提供放置位置的标识
* 显示parent的字组件child解决CardLayout中显示某个非显示组件的特殊情况 */
* @param child 组件 HoverPainter getPainter();
*/
void showComponent(XCreator child); /**
* 显示parent的字组件child解决CardLayout中显示某个非显示组件的特殊情况
void addNextComponent(XCreator dragged); *
* @param child 组件
/** */
* 组件叠放顺序前插入 void showComponent(XCreator child);
* @param target 目标组件
* @param added 插入组件 void addNextComponent(XCreator dragged);
*/
void addBefore(XCreator target, XCreator added); /**
* 组件叠放顺序前插入
/** *
* 组件叠放顺序后插入 * @param target 目标组件
* @param target 目标组件 * @param added 插入组件
* @param added 放置组件 */
*/ void addBefore(XCreator target, XCreator added);
void addAfter(XCreator target, XCreator added);
/**
/** * 组件叠放顺序后插入
* 能否放置更多组件 *
* @return 能则返回true * @param target 目标组件
*/ * @param added 放置组件
boolean canAcceptMoreComponent(); */
void addAfter(XCreator target, XCreator added);
ConstraintsGroupModel getLayoutConstraints(XCreator creator);
/**
GroupModel getLayoutProperties(); * 能否放置更多组件
*
/** * @return 能则返回true
* 删除组件 */
* @param creator 组件 boolean canAcceptMoreComponent();
* @param initWidth 组件之前宽度
* @param initHeight 组件之前高度 ConstraintsGroupModel getLayoutConstraints(XCreator creator);
*/
void removeBean(XCreator creator, int initWidth, int initHeight); GroupModel getLayoutProperties();
/**
* 删除组件
*
* @param creator 组件
* @param initWidth 组件之前宽度
* @param initHeight 组件之前高度
*/
void removeBean(XCreator creator, int initWidth, int initHeight);
} }

59
designer_form/src/com/fr/design/designer/beans/actions/CopyAction.java

@ -1,31 +1,30 @@
package com.fr.design.designer.beans.actions; package com.fr.design.designer.beans.actions;
import java.awt.event.InputEvent; import com.fr.base.BaseUtils;
import java.awt.event.KeyEvent; import com.fr.design.mainframe.FormDesigner;
import com.fr.general.Inter;
import javax.swing.KeyStroke;
import javax.swing.*;
import com.fr.base.BaseUtils; import java.awt.event.InputEvent;
import com.fr.general.Inter; import java.awt.event.KeyEvent;
import com.fr.design.mainframe.FormDesigner;
public class CopyAction extends FormEditAction {
public class CopyAction extends FormEditAction {
public CopyAction(FormDesigner t) {
public CopyAction(FormDesigner t) { super(t);
super(t); this.setName(Inter.getLocText("M_Edit-Copy"));
this.setName(Inter.getLocText("M_Edit-Copy")); this.setMnemonic('C');
this.setMnemonic('C'); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK)); }
}
@Override
@Override public boolean executeActionReturnUndoRecordNeeded() {
public boolean executeActionReturnUndoRecordNeeded() { FormDesigner tc = getEditingComponent();
FormDesigner tc = getEditingComponent(); if (tc != null) {
if (tc != null) { tc.copy();
tc.copy(); }
} return false;
return false; }
}
} }

361
designer_form/src/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java

@ -1,174 +1,189 @@
package com.fr.design.designer.beans.adapters.layout; package com.fr.design.designer.beans.adapters.layout;
import java.awt.LayoutManager; import com.fr.design.beans.GroupModel;
import com.fr.design.designer.beans.ConstraintsGroupModel;
import com.fr.general.ComparatorUtils; import com.fr.design.designer.beans.HoverPainter;
import com.fr.design.beans.GroupModel; import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.ConstraintsGroupModel; import com.fr.design.designer.beans.painters.NullPainter;
import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.beans.painters.NullPainter; import com.fr.design.designer.creator.XWidgetCreator;
import com.fr.design.designer.creator.XCreator; import com.fr.design.utils.ComponentUtils;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.design.designer.creator.XWidgetCreator; import com.fr.general.ComparatorUtils;
import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils; import java.awt.*;
public abstract class AbstractLayoutAdapter implements LayoutAdapter { public abstract class AbstractLayoutAdapter implements LayoutAdapter {
protected XLayoutContainer container; protected XLayoutContainer container;
protected LayoutManager layout; protected LayoutManager layout;
public AbstractLayoutAdapter(XLayoutContainer container) { public AbstractLayoutAdapter(XLayoutContainer container) {
this.container = container; this.container = container;
this.layout = container.getLayout(); this.layout = container.getLayout();
} }
/** /**
* 是否使用控件备份大小 * 是否使用控件备份大小
* @param xCreator 控件 *
* @return 所在容器相同且支持备份的话返回true * @param xCreator 控件
*/ * @return 所在容器相同且支持备份的话返回true
public boolean whetherUseBackupSize(XCreator xCreator) { */
Class clazz = container.getClass(); public boolean whetherUseBackupSize(XCreator xCreator) {
Class bkClazz = null; Class clazz = container.getClass();
if(xCreator.getBackupParent() != null) { Class bkClazz = null;
bkClazz = xCreator.getBackupParent().getClass(); if (xCreator.getBackupParent() != null) {
} bkClazz = xCreator.getBackupParent().getClass();
return ComparatorUtils.equals(bkClazz, clazz) }
&& supportBackupSize(); return ComparatorUtils.equals(bkClazz, clazz)
} && supportBackupSize();
}
/**
* 是否支持用备份大小 /**
* @return * 是否支持用备份大小
*/ *
public boolean supportBackupSize() { * @return
return false; */
} public boolean supportBackupSize() {
return false;
/** }
* 有的控件在拖拽调整大小后需要根据自身内容重新计算下当前的尺寸是否合适如果不合适就需要重新fix一下
* @param creator 组件 /**
*/ * 有的控件在拖拽调整大小后需要根据自身内容重新计算下当前的尺寸是否合适如果不合适就需要重新fix一下
public void fix(XCreator creator) { *
} * @param creator 组件
*/
/** public void fix(XCreator creator) {
* 显示parent的字组件child解决CardLayout中显示某个非显示组件的特殊情况 }
* @param child 组件
*/ /**
@Override * 显示parent的字组件child解决CardLayout中显示某个非显示组件的特殊情况
public void showComponent(XCreator child) { *
child.setVisible(true); * @param child 组件
} */
@Override
/** public void showComponent(XCreator child) {
* 组件的ComponentAdapter在添加组件时如果发现布局管理器不为空会继而调用该布局管理器的 child.setVisible(true);
* addComp方法来完成组件的具体添加在该方法内布局管理器可以提供额外的功能 }
* @param creator 被添加的新组件
* @param x 添加的位置x该位置是相对于container的 /**
* @param y 添加的位置y该位置是相对于container的 * 组件的ComponentAdapter在添加组件时如果发现布局管理器不为空会继而调用该布局管理器的
* @return 是否添加成功成功返回true否则false * addComp方法来完成组件的具体添加在该方法内布局管理器可以提供额外的功能
*/ *
@Override * @param creator 被添加的新组件
public boolean addBean(XCreator creator, int x, int y) { * @param x 添加的位置x该位置是相对于container的
if (!accept(creator, x, y)) { * @param y 添加的位置y该位置是相对于container的
return false; * @return 是否添加成功成功返回true否则false
} */
addComp(creator, x, y); @Override
((XWidgetCreator) creator).recalculateChildrenSize(); public boolean addBean(XCreator creator, int x, int y) {
return true; if (!accept(creator, x, y)) {
} return false;
}
/** addComp(creator, x, y);
* 删除组件 ((XWidgetCreator) creator).recalculateChildrenSize();
* @param creator 组件 return true;
* @param initWidth 组件之前宽度 }
* @param initHeight 组件之前高度
*/ /**
public void removeBean(XCreator creator, int creatorWidth, int creatorHeight) { * 删除组件
delete(creator, creatorWidth, creatorHeight); *
} * @param creator 组件
* @param creatorWidth
protected void delete(XCreator creator, int creatorWidth, int creatorHeight) { * @param creatorHeight
} */
public void removeBean(XCreator creator, int creatorWidth, int creatorHeight) {
protected abstract void addComp(XCreator creator, int x, int y); delete(creator, creatorWidth, creatorHeight);
}
/**
* 增加下一个组件 protected void delete(XCreator creator, int creatorWidth, int creatorHeight) {
* @param dragged 组件 }
*/
@Override protected abstract void addComp(XCreator creator, int x, int y);
public void addNextComponent(XCreator dragged) {
container.add(dragged); /**
LayoutUtils.layoutRootContainer(container); * 增加下一个组件
} *
* @param dragged 组件
/** */
* 目标控件位置插入组件 @Override
* @param target 目标 public void addNextComponent(XCreator dragged) {
* @param added 增加组件 container.add(dragged);
*/ LayoutUtils.layoutRootContainer(container);
@Override }
public void addBefore(XCreator target, XCreator added) {
int index = ComponentUtils.indexOfComponent(container, target); /**
* 目标控件位置插入组件
if (index == -1) { *
container.add(added, 0); * @param target 目标
} else { * @param added 增加组件
container.add(added, index); */
} @Override
public void addBefore(XCreator target, XCreator added) {
LayoutUtils.layoutRootContainer(container); int index = ComponentUtils.indexOfComponent(container, target);
}
if (index == -1) {
/** container.add(added, 0);
* 插在目标组件后面 } else {
* @param target 目标 container.add(added, index);
* @param added 增加组件 }
*/
@Override LayoutUtils.layoutRootContainer(container);
public void addAfter(XCreator target, XCreator added) { }
int index = ComponentUtils.indexOfComponent(container, target);
/**
if (index == -1) { * 插在目标组件后面
container.add(added); *
} else { * @param target 目标
index++; * @param added 增加组件
*/
if (index >= container.getComponentCount()) { @Override
container.add(added); public void addAfter(XCreator target, XCreator added) {
} else { int index = ComponentUtils.indexOfComponent(container, target);
container.add(added, index);
} if (index == -1) {
} container.add(added);
} else {
LayoutUtils.layoutRootContainer(container); index++;
}
if (index >= container.getComponentCount()) {
@Override container.add(added);
public HoverPainter getPainter() { } else {
return new NullPainter(container); container.add(added, index);
} }
}
/**
* 是否能接收更多的组件 LayoutUtils.layoutRootContainer(container);
* @return 能则返回true }
*/
@Override @Override
public boolean canAcceptMoreComponent() { public HoverPainter getPainter() {
return true; return new NullPainter(container);
} }
@Override /**
public ConstraintsGroupModel getLayoutConstraints(XCreator creator) { * 是否能接收更多的组件
return null; *
} * @return 能则返回true
*/
@Override @Override
public GroupModel getLayoutProperties() { public boolean canAcceptMoreComponent() {
return null; return true;
} }
@Override
public ConstraintsGroupModel getLayoutConstraints(XCreator creator) {
return null;
}
@Override
public GroupModel getLayoutProperties() {
return null;
}
public XLayoutContainer getContainer() {
return this.container;
}
} }

2
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java

@ -12,8 +12,8 @@ import com.fr.design.designer.properties.FRAbsoluteLayoutPropertiesGroupModel;
import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout;
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.form.ui.widget.BoundsWidget;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter { public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {

26
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java

@ -640,11 +640,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter {
* 又通过ComponentUtils.getRelativeBounds()方法获取到了绝对坐标 * 又通过ComponentUtils.getRelativeBounds()方法获取到了绝对坐标
* 再次计算相对坐标所以将y值重新变成绝对坐标 * 再次计算相对坐标所以将y值重新变成绝对坐标
* */ * */
if (currentCreator.getBackupParent().getLocation().y == WBorderLayout.DEFAULT_SIZE) { y = y + WCardMainBorderLayout.TAB_HEIGHT + this.getParaEditorYOffset();
y = y + WCardMainBorderLayout.TAB_HEIGHT + WBorderLayout.DEFAULT_SIZE;
} else {
y = y + WCardMainBorderLayout.TAB_HEIGHT;
}
int tempX = x - rect.x; int tempX = x - rect.x;
int tempY = y - rect.y; int tempY = y - rect.y;
int containerX = container.getX(); int containerX = container.getX();
@ -675,6 +671,26 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter {
return position; return position;
} }
/**
* 获取因为参数面板导致的Y坐标偏移
*
* @return 参数面板导致的Y坐标偏移
*/
protected int getParaEditorYOffset() {
int offset = 0;
if (container.getParent() != null) {
Component components[] = container.getParent().getComponents();
for (Component component : components) {
if (component instanceof XWParameterLayout) {
offset = component.getY() + component.getHeight();
break;
}
}
}
return offset;
}
/** /**
* 组件交叉区域进行插入时调整受到变动的其他组件,之前是交叉区域插入也按照三等分逻辑后面测试中发现有bug改为和bi一样的鼠标所在侧平分 * 组件交叉区域进行插入时调整受到变动的其他组件,之前是交叉区域插入也按照三等分逻辑后面测试中发现有bug改为和bi一样的鼠标所在侧平分
* 默认左上角右下角区域是垂直方向插入组件 * 默认左上角右下角区域是垂直方向插入组件

4
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java

@ -28,8 +28,8 @@ import com.fr.design.utils.ComponentUtils;
import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.form.ui.widget.BoundsWidget;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
/** /**
* 自适应布局的容器适配器 * 自适应布局的容器适配器
@ -1026,7 +1026,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
setAdjustedSize(tabLayout, offset, isHor); setAdjustedSize(tabLayout, offset, isHor);
for (int m = 0; m < tabLayout.getComponentCount(); m++) { for (int m = 0; m < tabLayout.getComponentCount(); m++) {
XCreator childCreator = tabLayout.getXCreator(m); XCreator childCreator = tabLayout.getXCreator(m);
BoundsWidget wgt = tabLayout.toData().getBoundsWidget(childCreator.toData()); BoundsWidget wgt = (BoundsWidget) tabLayout.toData().getBoundsWidget(childCreator.toData());
wgt.setBounds(tabLayout.getComponent(m).getBounds()); wgt.setBounds(tabLayout.getComponent(m).getBounds());
} }
adjustCreatorsSize(percent, tabLayout, isHor); adjustCreatorsSize(percent, tabLayout, isHor);

211
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java

@ -1,108 +1,105 @@
/** /**
* *
*/ */
package com.fr.design.designer.beans.adapters.layout; package com.fr.design.designer.beans.adapters.layout;
import com.fr.design.beans.GroupModel; import com.fr.design.beans.GroupModel;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.creator.XWidgetCreator; import com.fr.design.designer.creator.XWidgetCreator;
import com.fr.design.designer.creator.cardlayout.XWCardLayout; import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; 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.designer.properties.FRTabFitLayoutPropertiesGroupModel; import com.fr.design.designer.properties.FRTabFitLayoutPropertiesGroupModel;
import com.fr.design.utils.ComponentUtils; import com.fr.design.mainframe.widget.editors.ParameterEditor;
import com.fr.form.ui.LayoutBorderStyle; import com.fr.design.utils.ComponentUtils;
import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.form.ui.container.WBorderLayout;
import com.fr.general.ComparatorUtils; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.general.ComparatorUtils;
import java.awt.*;
import java.awt.*;
/**
* tab布局tabFit适配器 /**
* * tab布局tabFit适配器
* @author focus *
* @date 2014-6-24 * @author focus
*/ * @date 2014-6-24
public class FRTabFitLayoutAdapter extends FRFitLayoutAdapter { */
//标题栏高度对tab布局内部组件的y坐标造成了偏移 public class FRTabFitLayoutAdapter extends FRFitLayoutAdapter {
private static int TAB_HEIGHT = 40;
/**
/** * 构造函数
* 构造函数 *
* * @param container XWTabFitLayout容器
* @param container XWTabFitLayout容器 */
*/ public FRTabFitLayoutAdapter(XLayoutContainer container) {
public FRTabFitLayoutAdapter(XLayoutContainer container) { super(container);
super(container); }
}
/**
/** * 返回布局自身属性方便一些特有设置在layout刷新时处理
* 返回布局自身属性方便一些特有设置在layout刷新时处理 */
*/ @Override
@Override public GroupModel getLayoutProperties() {
public GroupModel getLayoutProperties() { XWTabFitLayout xfl = (XWTabFitLayout) container;
XWTabFitLayout xfl = (XWTabFitLayout) container; return new FRTabFitLayoutPropertiesGroupModel(xfl);
return new FRTabFitLayoutPropertiesGroupModel(xfl); }
}
/**
/** * 组件的ComponentAdapter在添加组件时如果发现布局管理器不为空会继而调用该布局管理器的
* 组件的ComponentAdapter在添加组件时如果发现布局管理器不为空会继而调用该布局管理器的 * addComp方法来完成组件的具体添加在该方法内布局管理器可以提供额外的功能
* addComp方法来完成组件的具体添加在该方法内布局管理器可以提供额外的功能 *
* * @param creator 被添加的新组件
* @param creator 被添加的新组件 * @param x 添加的位置x该位置是相对于container的
* @param x 添加的位置x该位置是相对于container的 * @param y 添加的位置y该位置是相对于container的
* @param y 添加的位置y该位置是相对于container的 * @return 是否添加成功成功返回true否则false
* @return 是否添加成功成功返回true否则false */
*/ @Override
@Override public boolean addBean(XCreator creator, int x, int y) {
public boolean addBean(XCreator creator, int x, int y) { // 经过accept判断后,container会被改变,先备份
// 经过accept判断后,container会被改变,先备份 XLayoutContainer backUpContainer = container;
XLayoutContainer backUpContainer = container; Rectangle rect = ComponentUtils.getRelativeBounds(container);
Rectangle rect = ComponentUtils.getRelativeBounds(container); int posX = x - rect.x;
int posY = y - rect.y;
int posX = x - rect.x; if (!accept(creator, posX, posY)) {
int posY = y - rect.y; return false;
if (!accept(creator, posX, posY)) { }
return false; // posX,posY是新拖入组件相对于容器的位置,若在tab布局的边缘,则需要把新组件添加到l
} // 父层自适应布局中,这时候的添加位置就是tab布局所在的位置
// posX,posY是新拖入组件相对于容器的位置,若在tab布局的边缘,则需要把新组件添加到 if (this.intersectsEdge(posX, posY, backUpContainer)) {
// 父层自适应布局中,这时候的添加位置就是tab布局所在的位置 if (!ComparatorUtils.equals(backUpContainer.getOuterLayout(), backUpContainer.getBackupParent())) {
if (this.intersectsEdge(posX, posY, backUpContainer)) { XWTabFitLayout tabLayout = (XWTabFitLayout) backUpContainer;
if (!ComparatorUtils.equals(backUpContainer.getOuterLayout(), backUpContainer.getBackupParent())) { y = adjustY(y, tabLayout);
XWTabFitLayout tabLayout = (XWTabFitLayout) backUpContainer; }
y = adjustY(y, tabLayout); addComp(creator, x, y);
} ((XWidgetCreator) creator).recalculateChildrenSize();
addComp(creator, x, y); return true;
((XWidgetCreator) creator).recalculateChildrenSize(); }
return true; // 如果不在边缘,容器为本自适应布局,增加组件的位置就是相对于容器的位置
} addComp(creator, posX, posY);
// 如果不在边缘,容器为本自适应布局,增加组件的位置就是相对于容器的位置 ((XWidgetCreator) creator).recalculateChildrenSize();
addComp(creator, posX, posY); return true;
((XWidgetCreator) creator).recalculateChildrenSize(); }
return true;
} // tab布局的纵坐标受到tab高度以及参数面板高度的影响,判断的上边界取得是里面XWTabFitLayout的上边界,
// 实际计算的时候的纵坐标用了外层的CardMainBorerLayout,需要将tab高度和参数面板高度减掉
// tab布局的纵坐标受到tab高度的影响,判断的上边界取得是里面XWTabFitLayout的上边界, // 将y值变为相对坐标以实现获取到鼠标drop位置的控件
// 实际计算的时候的纵坐标用了外层的CardMainBorerLayout,需要将tab高度减掉 // TODO 可以直接在这边将x,y都变成相对坐标,这样在后面判断拖进来的新控件放置方式的时候就不用再判断了
//将y值变为相对坐标以实现获取到鼠标drop位置的控件 private int adjustY(int y, XWTabFitLayout tabLayout) {
//TODO 可以直接在这边将x,y都变成相对坐标,这样在后面判断拖进来的新控件放置方式的时候就不用再判断了 XWCardLayout cardLayout = (XWCardLayout) tabLayout.getBackupParent();
private int adjustY(int y, XWTabFitLayout tabLayout) { LayoutBorderStyle style = cardLayout.toData().getBorderStyle();
XWCardLayout cardLayout = (XWCardLayout) tabLayout.getBackupParent(); y = y - this.getParaEditorYOffset();
LayoutBorderStyle style = cardLayout.toData().getBorderStyle(); if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) {
if (container.getLocation().y == WBorderLayout.DEFAULT_SIZE) { y = y - WCardMainBorderLayout.TAB_HEIGHT;
y = y - WBorderLayout.DEFAULT_SIZE; }
} return y;
if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) { }
y = y - WCardMainBorderLayout.TAB_HEIGHT;
} protected Rectangle getLayoutBound(XWCardMainBorderLayout mainLayout) {
return y; return ComponentUtils.getRelativeBounds(mainLayout);
} }
protected Rectangle getLayoutBound(XWCardMainBorderLayout mainLayout) {
return ComponentUtils.getRelativeBounds(mainLayout);
}
} }

7
designer_form/src/com/fr/design/designer/beans/location/AccessDirection.java

@ -3,18 +3,17 @@
*/ */
package com.fr.design.designer.beans.location; package com.fr.design.designer.beans.location;
import java.awt.*;
import com.fr.design.beans.location.Absorptionline; import com.fr.design.beans.location.Absorptionline;
import com.fr.design.beans.location.MoveUtils; import com.fr.design.beans.location.MoveUtils;
import com.fr.design.designer.creator.*; import com.fr.design.designer.creator.*;
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.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.form.main.Form;
import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WParameterLayout;
import com.fr.form.ui.widget.BoundsWidget;
import java.awt.*;
/** /**
* @author richer * @author richer

2
designer_form/src/com/fr/design/designer/beans/location/Inner.java

@ -9,8 +9,8 @@ import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormSelection; import com.fr.design.mainframe.FormSelection;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.widget.BoundsWidget;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import java.awt.*; import java.awt.*;
import java.awt.Rectangle; import java.awt.Rectangle;

272
designer_form/src/com/fr/design/designer/beans/models/AddingModel.java

@ -1,133 +1,141 @@
package com.fr.design.designer.beans.models; package com.fr.design.designer.beans.models;
import java.awt.Rectangle; import java.awt.Rectangle;
import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.adapters.component.CompositeComponentAdapter; import com.fr.design.designer.beans.adapters.component.CompositeComponentAdapter;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
/** /**
* 添加状态下的model * 添加状态下的model
*/ */
public class AddingModel { public class AddingModel {
// 当前要添加的组件 // 当前要添加的组件
private XCreator creator; private XCreator creator;
// 记录当前鼠标的位置信息 // 记录当前鼠标的位置信息
private int current_x; private int currentX;
private int current_y; private int currentY;
private boolean added; private boolean added;
public AddingModel(FormDesigner designer, XCreator xCreator) { public AddingModel(FormDesigner designer, XCreator xCreator) {
String creatorName = getXCreatorName(designer, xCreator); String creatorName = getXCreatorName(designer, xCreator);
this.creator = xCreator; this.creator = xCreator;
instantiateCreator(designer, creatorName); instantiateCreator(designer, creatorName);
// 初始的时候隐藏该组件的图标 // 初始的时候隐藏该组件的图标
current_x = -this.creator.getWidth(); currentY = -this.creator.getWidth();
current_y = -this.creator.getHeight(); currentX = -this.creator.getHeight();
} }
/** /**
* 待说明 * 待说明
* @param designer 设计器 *
* @param creatorName 组件名 * @param designer 设计器
*/ * @param creatorName 组件名
public void instantiateCreator(FormDesigner designer, String creatorName) { */
creator.toData().setWidgetName(creatorName); public void instantiateCreator(FormDesigner designer, String creatorName) {
ComponentAdapter adapter = new CompositeComponentAdapter(designer, creator); creator.toData().setWidgetName(creatorName);
adapter.initialize(); ComponentAdapter adapter = new CompositeComponentAdapter(designer, creator);
creator.addNotify(); adapter.initialize();
creator.putClientProperty(AdapterBus.CLIENT_PROPERTIES, adapter); creator.addNotify();
} creator.putClientProperty(AdapterBus.CLIENT_PROPERTIES, adapter);
}
public AddingModel(XCreator xCreator, int x, int y) {
this.creator = xCreator; public AddingModel(XCreator xCreator, int x, int y) {
this.creator.backupCurrentSize(); this.creator = xCreator;
this.creator.backupParent(); this.creator.backupCurrentSize();
this.creator.setSize(xCreator.initEditorSize()); this.creator.backupParent();
current_x = x - (xCreator.getWidth() / 2); this.creator.setSize(xCreator.initEditorSize());
current_y = y - (xCreator.getHeight() / 2); currentX = x - (xCreator.getWidth() / 2);
} currentY = y - (xCreator.getHeight() / 2);
}
/**
* 隐藏当前组件的图标 /**
*/ * 隐藏当前组件的图标
public void reset() { */
current_x = -this.creator.getWidth(); public void reset() {
current_y = -this.creator.getHeight(); currentX = -this.creator.getWidth();
} currentY = -this.creator.getHeight();
}
public String getXCreatorName(FormDesigner designer,XCreator x){
String def= x.createDefaultName(); public String getXCreatorName(FormDesigner designer, XCreator x) {
if (x.acceptType(XWParameterLayout.class)) { String def = x.createDefaultName();
return def; if (x.acceptType(XWParameterLayout.class)) {
} return def;
int i = 0; }
while (designer.getTarget().isNameExist(def + i)) { int i = 0;
i++; while (designer.getTarget().isNameExist(def + i)) {
} i++;
return def+i; }
} return def + i;
}
public int getCurrentX() {
return current_x; public int getCurrentX() {
} return currentX;
}
public int getCurrentY() {
return current_y; public int getCurrentY() {
} return currentY;
}
/**
* 移动组件图标到鼠标事件发生的位置 /**
* @param x 坐标 * 移动组件图标到鼠标事件发生的位置
* @param y 坐标 *
*/ * @param x 坐标
public void moveTo(int x, int y) { * @param y 坐标
current_x = x - (this.creator.getWidth() / 2); */
current_y = y - (this.creator.getHeight() / 2); public void moveTo(int x, int y) {
} currentX = x - (this.creator.getWidth() / 2);
currentY = y - (this.creator.getHeight() / 2);
public XCreator getXCreator() { }
return this.creator;
} public XCreator getXCreator() {
return this.creator;
/** }
* 当前组件是否已经添加到某个容器中
* @return 是返回true /**
*/ * 当前组件是否已经添加到某个容器中
public boolean isCreatorAdded() { *
return added; * @return 是返回true
} */
public boolean isCreatorAdded() {
/** return added;
* 加入容器 }
* @param designer 设计器
* @param container 容器 /**
* @param x 坐标 * 加入容器
* @param y 坐标 *
* @return 成功返回true * @param designer 设计器
*/ * @param container 容器
public boolean add2Container(FormDesigner designer, XLayoutContainer container, int x, int y) { * @param x 坐标
//考虑不同布局嵌套的情况,获取顶层容器 * @param y 坐标
XLayoutContainer xLayoutContainer = container.getTopLayout(); * @return 成功返回true
if(xLayoutContainer != null && xLayoutContainer.acceptType(XWAbsoluteLayout.class)){ */
container = xLayoutContainer; public boolean add2Container(FormDesigner designer, XLayoutContainer container, int x, int y) {
} //考虑不同布局嵌套的情况,获取顶层容器
XLayoutContainer xLayoutContainer = container.getTopLayout();
Rectangle rect = ComponentUtils.getRelativeBounds(container); if (xLayoutContainer != null && xLayoutContainer.acceptType(XWAbsoluteLayout.class)) {
if(!ComparatorUtils.equals(container.getOuterLayout(), container.getBackupParent())){ container = xLayoutContainer;
return added = container.getLayoutAdapter().addBean(creator, x + designer.getArea().getHorizontalValue(), y + designer.getArea().getVerticalValue()); }
}
return added = container.getLayoutAdapter().addBean(creator, Rectangle rect = ComponentUtils.getRelativeBounds(container);
x + designer.getArea().getHorizontalValue() - rect.x, if (!ComparatorUtils.equals(container.getOuterLayout(), container.getBackupParent())) {
y + designer.getArea().getVerticalValue() - rect.y); added = container.getLayoutAdapter().addBean(creator,
} x + designer.getArea().getHorizontalValue(),
y + designer.getArea().getVerticalValue());
return added;
}
added = container.getLayoutAdapter().addBean(creator,
x + designer.getArea().getHorizontalValue() - rect.x,
y + designer.getArea().getVerticalValue() - rect.y);
return added;
}
} }

760
designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java

@ -1,328 +1,434 @@
package com.fr.design.designer.beans.models; package com.fr.design.designer.beans.models;
import java.awt.LayoutManager; import com.fr.design.designer.beans.AdapterBus;
import java.awt.Rectangle; import com.fr.design.designer.beans.LayoutAdapter;
import java.awt.Toolkit; import com.fr.design.designer.beans.events.DesignerEvent;
import java.awt.event.MouseEvent; import com.fr.design.designer.beans.location.Direction;
import java.util.ArrayList; import com.fr.design.designer.beans.location.Location;
import com.fr.design.designer.creator.*;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.designer.beans.location.Direction; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.designer.beans.location.Location; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.designer.creator.XCreator; import com.fr.design.mainframe.FormSelection;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.mainframe.FormSelectionUtils;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.utils.ComponentUtils;
import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.design.designer.creator.XWParameterLayout; import com.fr.stable.ArrayUtils;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.mainframe.FormDesigner; import java.awt.*;
import com.fr.design.mainframe.FormSelection; import java.awt.event.MouseEvent;
import com.fr.design.mainframe.FormSelectionUtils; import java.util.ArrayList;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.stable.ArrayUtils; /**
* 该model保存当前选择的组件和剪切版信息
/** */
* 该model保存当前选择的组件和剪切版信息 public class SelectionModel {
*/ //被粘贴组件在所选组件位置处往下、往右各错开20像素。执行多次粘贴时,在上一次粘贴的位置处错开20像素。
public class SelectionModel { private static final int DELTA_X_Y = 20; //粘贴时候的偏移距离
private static final int DELTA_X_Y = 20; //粘贴时候的偏移距离 private static final double OFFSET_RELATIVE = 0.80;
private static FormSelection CLIP_BOARD = new FormSelection(); private static FormSelection clipboard = new FormSelection();
private FormDesigner designer; private FormDesigner designer;
private FormSelection selection; private FormSelection selection;
private Rectangle hotspot_bounds; private Rectangle hotspotBounds;
public SelectionModel(FormDesigner designer) { public SelectionModel(FormDesigner designer) {
this.designer = designer; this.designer = designer;
selection = new FormSelection(); selection = new FormSelection();
} }
/** /**
* 重置清空formSelction以及选择区域 * 重置清空formSelction以及选择区域
*/ */
public void reset() { public void reset() {
selection.reset(); selection.reset();
hotspot_bounds = null; hotspotBounds = null;
} }
/** /**
* formSelction是否为空 * formSelction是否为空
* @return 是否为空 *
*/ * @return 是否为空
public static boolean isEmpty(){ */
return CLIP_BOARD.isEmpty(); public static boolean isEmpty() {
} return clipboard.isEmpty();
}
/**
* 鼠标点击一下所选中的单个组件按下Ctrl或者shift键时鼠标可以进行多选 /**
* @param e 鼠标事件 * 鼠标点击一下所选中的单个组件按下Ctrl或者shift键时鼠标可以进行多选
*/ *
public void selectACreatorAtMouseEvent(MouseEvent e) { * @param e 鼠标事件
if (!e.isControlDown() && !e.isShiftDown()) { */
// 如果Ctrl或者Shift键盘没有按下,则清除已经选择的组件 public void selectACreatorAtMouseEvent(MouseEvent e) {
selection.reset(); if (!e.isControlDown() && !e.isShiftDown()) {
} // 如果Ctrl或者Shift键盘没有按下,则清除已经选择的组件
selection.reset();
// 获取e所在的组件 }
XCreator comp = designer.getComponentAt(e); // 获取e所在的组件
XCreator comp = designer.getComponentAt(e);
//布局组件的顶层布局如不可编辑,要获取其顶层布局
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer(comp).getTopLayout(); //布局组件的顶层布局如不可编辑,要获取其顶层布局
if(topLayout != null && !topLayout.isEditable()){ XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer(comp).getTopLayout();
comp = topLayout; if (topLayout != null && !topLayout.isEditable()) {
} comp = topLayout;
}
// 如果父层是scale和title两个专属容器,返回其父层,组件本身是不让被选中的
if (comp != designer.getRootComponent() && comp != designer.getParaComponent()) { // 如果父层是scale和title两个专属容器,返回其父层,组件本身是不让被选中的
XCreator parentContainer = (XCreator) comp.getParent(); if (comp != designer.getRootComponent() && comp != designer.getParaComponent()) {
comp = parentContainer.isDedicateContainer() ? parentContainer : comp; XCreator parentContainer = (XCreator) comp.getParent();
} comp = parentContainer.isDedicateContainer() ? parentContainer : comp;
if (selection.removeSelectedCreator(comp) || selection.addSelectedCreator(comp)) { }
designer.getEditListenerTable().fireCreatorModified(comp, DesignerEvent.CREATOR_SELECTED); if (selection.removeSelectedCreator(comp) || selection.addSelectedCreator(comp)) {
designer.repaint(); designer.getEditListenerTable().fireCreatorModified(comp, DesignerEvent.CREATOR_SELECTED);
} designer.repaint();
} }
}
/**
* 将所选组件剪切到剪切板上 /**
*/ * 将所选组件剪切到剪切板上
public void cutSelectedCreator2ClipBoard() { */
if (hasSelectionComponent()) { public void cutSelectedCreator2ClipBoard() {
selection.cut2ClipBoard(CLIP_BOARD); if (hasSelectionComponent()) {
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_CUTED); selection.cut2ClipBoard(clipboard);
designer.repaint(); designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_CUTED);
} designer.repaint();
} }
}
/**
* 复制当前选中的组件到剪切板 /**
*/ * 复制当前选中的组件到剪切板
public void copySelectedCreator2ClipBoard() { */
if (!selection.isEmpty()) { public void copySelectedCreator2ClipBoard() {
selection.copy2ClipBoard(CLIP_BOARD); if (!selection.isEmpty()) {
} selection.copy2ClipBoard(clipboard);
} }
}
/**
* 从剪切板粘帖组件 /**
* @return * 从剪切板粘帖组件
*/ *
public boolean pasteFromClipBoard() { * @return
if (!CLIP_BOARD.isEmpty()) { */
XLayoutContainer parent = null; public boolean pasteFromClipBoard() {
if (!hasSelectionComponent()) { if (!clipboard.isEmpty()) {
FormSelectionUtils.paste2Container(designer, designer.getRootComponent(),CLIP_BOARD, DELTA_X_Y, DELTA_X_Y); if (!hasSelectedPasteSource()) {
} else { //未选
parent = XCreatorUtils.getParentXLayoutContainer(selection.getSelectedCreator()); unselectedPaste();
if (parent != null) { } else {
Rectangle rec = selection.getSelctionBounds(); //已选
FormSelectionUtils.paste2Container(designer, parent,CLIP_BOARD, rec.x + DELTA_X_Y, rec.y + DELTA_X_Y); selectedPaste();
} }
} } else {
} else { Toolkit.getDefaultToolkit().beep();
Toolkit.getDefaultToolkit().beep(); }
} return false;
return false; }
}
public FormSelection getSelection() {
public FormSelection getSelection() { return selection;
return selection; }
}
/**
/** * 粘贴时未选择组件
* 删除当前所有选择的组件 */
*/ private void unselectedPaste() {
public void deleteSelection() { if (designer.getClass().equals(FormDesigner.class)) {
XCreator[] roots = selection.getSelectedCreators(); if (selection.getSelectedCreator() instanceof XWFitLayout) {
if (selection.getSelectedCreator().getClass().equals(XWTabFitLayout.class)) {
if (roots.length > 0) { Rectangle rec = selection.getRelativeBounds();
for (XCreator creator : roots) { //Tab布局
if(creator.acceptType(XWParameterLayout.class)){ FormSelectionUtils.paste2Container(designer, (XLayoutContainer) selection.getSelectedCreator(),
designer.removeParaComponent(); clipboard,
} rec.x + rec.width / 2,
rec.y + DELTA_X_Y);
removeCreatorFromContainer(creator, creator.getWidth(), creator.getHeight()); } else {
creator.removeAll(); Rectangle rec = selection.getRelativeBounds();
// 清除被选中的组件 //自适应布局
selection.reset(); FormSelectionUtils.paste2Container(designer, designer.getRootComponent(),
} clipboard,
setSelectedCreator(designer.getRootComponent()); rec.x + rec.width / 2,
// 触发事件 rec.y + DELTA_X_Y);
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_DELETED); }
designer.repaint(); } else {
} //绝对布局
} //编辑器外面还有两层容器,使用designer.getRootComponent()获取到的是编辑器中层的容器,不是编辑器表层
//当前选择的就是编辑器表层
/** FormSelectionUtils.paste2Container(designer, (XLayoutContainer) selection.getSelectedCreator(),
* 从选择组件中删除某组件 clipboard,
* DELTA_X_Y,
* @param creator 组件 DELTA_X_Y);
* @param creatorWidth 组件之前宽度 }
* @param creatorHeight 组件之前高度 } else {
*/ //cpt本地组件复用,编辑器就一层,是最底层,使用designer.getRootComponent()就可以获取到
public void removeCreator(XCreator creator, int creatorWidth, int creatorHeight) { //使用selection.getSelectedCreator()也应该是可以获取到的。
selection.removeCreator(creator); FormSelectionUtils.paste2Container(designer, designer.getRootComponent(),
removeCreatorFromContainer(creator, creatorWidth, creatorHeight); clipboard,
designer.repaint(); DELTA_X_Y,
} DELTA_X_Y);
}
/** }
* 设置选择区域
*/ /**
public void setHotspotBounds(Rectangle rect) { * 粘贴时选择组件
hotspot_bounds = rect; */
} private void selectedPaste() {
XLayoutContainer container = null;
/** //获取到编辑器的表层容器(已选的组件的父容器就是表层容器)
* 获得当前选择区域 container = XCreatorUtils.getParentXLayoutContainer(selection.getSelectedCreator());
*/ if (container != null && selection.getSelectedCreator().getParent() instanceof XWFitLayout) {
public Rectangle getHotspotBounds() { //自适应布局
return hotspot_bounds; Rectangle selectionRec = selection.getRelativeBounds();
} Rectangle containerRec = ComponentUtils.getRelativeBounds(container);
//计算自适应布局位置
private void removeCreatorFromContainer(XCreator creator, int creatorWidth, int creatorHeight) { int positionX = selectionRec.x - containerRec.x + selectionRec.width / 2;
XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(creator); int positionY = (int) (selectionRec.y - containerRec.y + selectionRec.height * OFFSET_RELATIVE);
if (parent == null) {
return; FormSelectionUtils.paste2Container(designer, container, clipboard, positionX, positionY);
} } else if (container != null && selection.getSelectedCreator().getParent() instanceof XWAbsoluteLayout) {
boolean changeCreator = creator.shouldScaleCreator() || creator.hasTitleStyle(); //绝对布局
if (parent.acceptType(XWFitLayout.class) && changeCreator) { Rectangle rec = selection.getSelctionBounds();
creator = (XCreator) creator.getParent(); FormSelectionUtils.paste2Container(designer, container, clipboard, rec.x + DELTA_X_Y, rec.y + DELTA_X_Y);
} }
parent.getLayoutAdapter().removeBean(creator, creatorWidth, creatorHeight); }
// 删除其根组件,同时就删除了同时被选择的叶子组件
parent.remove(creator); /**
LayoutManager layout = parent.getLayout(); * 删除当前所有选择的组件
*/
if (layout != null) { public void deleteSelection() {
// 刷新组件容器的布局 XCreator[] roots = selection.getSelectedCreators();
LayoutUtils.layoutContainer(parent);
} if (roots.length > 0) {
} for (XCreator creator : roots) {
if (creator.acceptType(XWParameterLayout.class)) {
/** designer.removeParaComponent();
* 是否有组件被选择如果所选组件是最底层容器也视为无选择 }
* @return 是则返回true removeCreatorFromContainer(creator, creator.getWidth(), creator.getHeight());
*/ creator.removeAll();
public boolean hasSelectionComponent() { // 清除被选中的组件
return !selection.isEmpty() && selection.getSelectedCreator().getParent() != null; selection.reset();
} }
setSelectedCreator(designer.getRootComponent());
/** FormSelectionUtils.rebuildSelection(designer);
* 移动组件至指定位置 // 触发事件
* @param x 坐标x designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_DELETED);
* @param y 坐标y designer.repaint();
*/ }
public void move(int x, int y) { }
for (XCreator creator : selection.getSelectedCreators()) {
creator.setLocation(creator.getX() + x, creator.getY() + y); /**
LayoutAdapter layoutAdapter = AdapterBus.searchLayoutAdapter(designer, creator); * 从选择组件中删除某组件
if (layoutAdapter != null) { *
layoutAdapter.fix(creator); * @param creator 组件
} * @param creatorWidth 组件之前宽度
} * @param creatorHeight 组件之前高度
designer.getEditListenerTable().fireCreatorModified(selection.getSelectedCreator(), */
DesignerEvent.CREATOR_SELECTED); public void removeCreator(XCreator creator, int creatorWidth, int creatorHeight) {
} selection.removeCreator(creator);
removeCreatorFromContainer(creator, creatorWidth, creatorHeight);
/** designer.repaint();
* 释放捕获 }
*/
public void releaseDragging() { /**
designer.setPainter(null); * 设置选择区域
selection.fixCreator(designer); */
designer.getEditListenerTable().fireCreatorModified(selection.getSelectedCreator(), public void setHotspotBounds(Rectangle rect) {
DesignerEvent.CREATOR_RESIZED); hotspotBounds = rect;
} }
public Direction getDirectionAt(MouseEvent e) { /**
Direction dir; * 获得当前选择区域
if (e.isControlDown() || e.isShiftDown()) { */
XCreator creator = designer.getComponentAt(e.getX(), e.getY(), selection.getSelectedCreators()); public Rectangle getHotspotBounds() {
if (creator != designer.getRootComponent() && selection.addedable(creator)) { return hotspotBounds;
return Location.add; }
}
} private void removeCreatorFromContainer(XCreator creator, int creatorWidth, int creatorHeight) {
if (hasSelectionComponent()) { XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(creator);
int x = e.getX() + designer.getArea().getHorizontalValue(); if (parent == null) {
int y = e.getY() + designer.getArea().getVerticalValue(); return;
dir = getDirection(selection.getRelativeBounds(), x, y); }
if (selection.size() == 1) { boolean changeCreator = creator.shouldScaleCreator() || creator.hasTitleStyle();
if (!ArrayUtils.contains(selection.getSelectedCreator().getDirections(), dir.getActual())) { if (parent.acceptType(XWFitLayout.class) && changeCreator) {
dir = Location.outer; creator = (XCreator) creator.getParent();
} }
} parent.getLayoutAdapter().removeBean(creator, creatorWidth, creatorHeight);
} else { // 删除其根组件,同时就删除了同时被选择的叶子组件
dir = Location.outer; parent.remove(creator);
} LayoutManager layout = parent.getLayout();
if (designer.getDesignerMode().isFormParameterEditor() && dir == Location.outer) { if (layout != null) {
dir = designer.getLoc2Root(e); // 刷新组件容器的布局
} LayoutUtils.layoutContainer(parent);
return dir; }
} }
private Direction getDirection(Rectangle bounds, int x, int y) { /**
if (x < (bounds.x - XCreatorConstants.RESIZE_BOX_SIZ)) { * 是否有组件被选择如果所选组件是最底层容器也视为无选择
return Location.outer; *
} else if ((x >= (bounds.x - XCreatorConstants.RESIZE_BOX_SIZ)) && (x <= bounds.x)) { * @return 是则返回true
if (y < (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) { * yaoh.wu 不应该通过判断是否是最底层容器来判断是否选择了组件
return Location.outer; * 而是应该判断选择的容器是否是编辑器的最表层容器,也就是点击空白地方选择的容器
} else if ((y >= (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) && (y <= bounds.y)) { * 但是直接判断选择的容器是否是编辑器最表层类型又会引发拖动时选不上的情况
return Location.left_top; * 因此通过判断父容器来实现
} else if ((y > bounds.y) && (y < (bounds.y + bounds.height))) { * <p>
return Location.left; * 举例frm组件复用 绝对布局情况下不选择时有三层容器
} else if ((y >= (bounds.y + bounds.height)) * 底层@see {@link com.fr.design.designer.creator.XWBorderLayout}
&& (y <= (bounds.y + bounds.height + XCreatorConstants.RESIZE_BOX_SIZ))) { * 中层@see {@link XWFitLayout}
return Location.left_bottom; * 表层@see {@link com.fr.design.designer.creator.XWAbsoluteBodyLayout}
} else { * <p>
return Location.outer; * 但是编辑窗口的最外层其实是表层@see {@link com.fr.design.designer.creator.XWAbsoluteBodyLayout},
} * 其他两层不是靠添加组件就可以编辑的
} else if ((x > bounds.x) && (x < (bounds.x + bounds.width))) { */
if (y < (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) { public boolean hasSelectedPasteSource() {
return Location.outer; XCreator selectionXCreator = selection.getSelectedCreator();
} else if ((y >= (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) && (y <= bounds.y)) { if (designer.getClass().equals(FormDesigner.class)) {
return Location.top; //frm本地组件复用
} else if ((y > bounds.y) && (y < (bounds.y + bounds.height))) { if (selectionXCreator != null) {
return Location.inner; //选中的是否是tab布局编辑器本身
} else if ((y >= (bounds.y + bounds.height)) boolean tabEditor = selectionXCreator.getClass().equals(XWCardMainBorderLayout.class)
&& (y <= (bounds.y + bounds.height + XCreatorConstants.RESIZE_BOX_SIZ))) { || selectionXCreator.getClass().equals(XWCardLayout.class)
return Location.bottom; || selectionXCreator.getClass().equals(XWTabFitLayout.class);
} else { //选中的是否是frm绝对布局编辑器本身
return Location.outer; boolean absoluteEditor = selectionXCreator.getClass().equals(XWAbsoluteBodyLayout.class);
} //选中是否是frm绝对画布块编辑器本身
} else if ((x >= (bounds.x + bounds.width)) boolean absoluteCanvas = selectionXCreator.getClass().equals(XWAbsoluteLayout.class);
&& (x <= (bounds.x + bounds.width + XCreatorConstants.RESIZE_BOX_SIZ))) { //选中的是否是相对布局编辑器本身
if (y < (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) { boolean relativeEditor = selectionXCreator.getClass().equals(XWFitLayout.class);
return Location.outer;
} else if ((y >= (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) && (y <= bounds.y)) { return !(tabEditor || absoluteEditor || absoluteCanvas || relativeEditor);
return Location.right_top; } else {
} else if ((y > bounds.y) && (y < (bounds.y + bounds.height))) { return false;
return Location.right; }
} else if ((y >= (bounds.y + bounds.height)) } else {
&& (y <= (bounds.y + bounds.height + XCreatorConstants.RESIZE_BOX_SIZ))) { //cpt本地组件复用,selection.getSelectedCreator().getParent()=@XWParameterLayout instanceof @XWAbsoluteLayout
return Location.right_bottom; return selectionXCreator != null && selectionXCreator.getParent() != null;
} else { }
return Location.outer; }
}
} else { /**
return Location.outer; * 是否有组件被选择如果所选组件是最底层容器也视为无选择
} *
} * @return 是则返回true
*/
private void fireCreatorSelected() { public boolean hasSelectionComponent() {
designer.getEditListenerTable().fireCreatorModified(selection.getSelectedCreator(), return !selection.isEmpty() && selection.getSelectedCreator().getParent() != null;
DesignerEvent.CREATOR_SELECTED); }
}
/**
public void setSelectedCreator(XCreator rootComponent) { * 移动组件至指定位置
selection.setSelectedCreator(rootComponent); *
fireCreatorSelected(); * @param x 坐标x
} * @param y 坐标y
*/
public void setSelectedCreators(ArrayList<XCreator> rebuildSelection) { public void move(int x, int y) {
selection.setSelectedCreators(rebuildSelection); for (XCreator creator : selection.getSelectedCreators()) {
fireCreatorSelected(); creator.setLocation(creator.getX() + x, creator.getY() + y);
} LayoutAdapter layoutAdapter = AdapterBus.searchLayoutAdapter(designer, creator);
if (layoutAdapter != null) {
layoutAdapter.fix(creator);
}
}
designer.getEditListenerTable().fireCreatorModified(selection.getSelectedCreator(),
DesignerEvent.CREATOR_SELECTED);
}
/**
* 释放捕获
*/
public void releaseDragging() {
designer.setPainter(null);
selection.fixCreator(designer);
designer.getEditListenerTable().fireCreatorModified(selection.getSelectedCreator(),
DesignerEvent.CREATOR_RESIZED);
}
public Direction getDirectionAt(MouseEvent e) {
Direction dir;
if (e.isControlDown() || e.isShiftDown()) {
XCreator creator = designer.getComponentAt(e.getX(), e.getY(), selection.getSelectedCreators());
if (creator != designer.getRootComponent() && selection.addedable(creator)) {
return Location.add;
}
}
if (hasSelectionComponent()) {
int x = e.getX() + designer.getArea().getHorizontalValue();
int y = e.getY() + designer.getArea().getVerticalValue();
dir = getDirection(selection.getRelativeBounds(), x, y);
if (selection.size() == 1 && !ArrayUtils.contains(selection.getSelectedCreator().getDirections(), dir
.getActual())) {
dir = Location.outer;
}
} else {
dir = Location.outer;
}
if (designer.getDesignerMode().isFormParameterEditor() && dir == Location.outer) {
dir = designer.getLoc2Root(e);
}
return dir;
}
private Direction getDirection(Rectangle bounds, int x, int y) {
if (x < (bounds.x - XCreatorConstants.RESIZE_BOX_SIZ)) {
return Location.outer;
} else if ((x >= (bounds.x - XCreatorConstants.RESIZE_BOX_SIZ)) && (x <= bounds.x)) {
if (y < (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) {
return Location.outer;
} else if ((y >= (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) && (y <= bounds.y)) {
return Location.left_top;
} else if ((y > bounds.y) && (y < (bounds.y + bounds.height))) {
return Location.left;
} else if ((y >= (bounds.y + bounds.height))
&& (y <= (bounds.y + bounds.height + XCreatorConstants.RESIZE_BOX_SIZ))) {
return Location.left_bottom;
} else {
return Location.outer;
}
} else if ((x > bounds.x) && (x < (bounds.x + bounds.width))) {
if (y < (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) {
return Location.outer;
} else if ((y >= (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) && (y <= bounds.y)) {
return Location.top;
} else if ((y > bounds.y) && (y < (bounds.y + bounds.height))) {
return Location.inner;
} else if ((y >= (bounds.y + bounds.height))
&& (y <= (bounds.y + bounds.height + XCreatorConstants.RESIZE_BOX_SIZ))) {
return Location.bottom;
} else {
return Location.outer;
}
} else if ((x >= (bounds.x + bounds.width))
&& (x <= (bounds.x + bounds.width + XCreatorConstants.RESIZE_BOX_SIZ))) {
if (y < (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) {
return Location.outer;
} else if ((y >= (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) && (y <= bounds.y)) {
return Location.right_top;
} else if ((y > bounds.y) && (y < (bounds.y + bounds.height))) {
return Location.right;
} else if ((y >= (bounds.y + bounds.height))
&& (y <= (bounds.y + bounds.height + XCreatorConstants.RESIZE_BOX_SIZ))) {
return Location.right_bottom;
} else {
return Location.outer;
}
} else {
return Location.outer;
}
}
private void fireCreatorSelected() {
designer.getEditListenerTable().fireCreatorModified(selection.getSelectedCreator(),
DesignerEvent.CREATOR_SELECTED);
}
public void setSelectedCreator(XCreator rootComponent) {
selection.setSelectedCreator(rootComponent);
fireCreatorSelected();
}
public void setSelectedCreators(ArrayList<XCreator> rebuildSelection) {
selection.setSelectedCreators(rebuildSelection);
fireCreatorSelected();
}
} }

920
designer_form/src/com/fr/design/designer/beans/models/StateModel.java

@ -1,446 +1,476 @@
package com.fr.design.designer.beans.models; package com.fr.design.designer.beans.models;
import java.awt.Component; import com.fr.design.beans.location.Absorptionline;
import java.awt.Cursor; import com.fr.design.designer.beans.AdapterBus;
import java.awt.Graphics; import com.fr.design.designer.beans.HoverPainter;
import java.awt.Point; import com.fr.design.designer.beans.LayoutAdapter;
import java.awt.Rectangle; import com.fr.design.designer.beans.events.DesignerEvent;
import java.awt.Toolkit; import com.fr.design.designer.beans.location.Direction;
import java.awt.event.MouseEvent; import com.fr.design.designer.beans.location.Location;
import java.util.ArrayList; import com.fr.design.designer.creator.*;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.beans.location.Absorptionline; import com.fr.design.mainframe.FormSelectionUtils;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.utils.ComponentUtils;
import com.fr.design.mainframe.FormSelectionUtils;
import com.fr.design.designer.beans.AdapterBus; import java.awt.*;
import com.fr.design.designer.beans.HoverPainter; import java.awt.event.MouseEvent;
import com.fr.design.designer.beans.LayoutAdapter; import java.util.ArrayList;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.beans.location.Direction; /**
import com.fr.design.designer.beans.location.Location; * 普通模式下的状态model
import com.fr.design.designer.creator.XConnector; */
import com.fr.design.designer.creator.XCreator; public class StateModel {
import com.fr.design.designer.creator.XCreatorUtils; // 对应的selection model
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteLayout; private SelectionModel selectionModel;
import com.fr.design.utils.ComponentUtils; // 当前鼠标进入拖拽区域的位置类型
private Direction driection;
/**
* 普通模式下的状态model // 当前拖拽的起始位置
*/ private int currentX;
public class StateModel { private int currentY;
// 对应的selection model
//拖拽组件原始位置大小备份
private SelectionModel selectionModel; private Rectangle selectedPositionBackup;
// 当前鼠标进入拖拽区域的位置类型
private Direction driection; private Point startPoint = new Point();
private Point currentPoint = new Point();
// 当前拖拽的起始位置
private int current_x; private Absorptionline lineInX;
private int current_y; private Absorptionline lineInY;
//等距线
private Point startPoint = new Point(); private Absorptionline lineEquidistant;
private Point currentPoint = new Point();
// 当前是否处于拖拽选择状态
private Absorptionline lineInX; private boolean selecting;
private Absorptionline lineInY; private boolean dragging;
//等距线
private Absorptionline lineEquidistant; private boolean addable;
// 当前是否处于拖拽选择状态 private FormDesigner designer;
private boolean selecting;
private boolean dragging; public StateModel(FormDesigner designer) {
this.designer = designer;
private boolean addable; selectionModel = designer.getSelectionModel();
}
private FormDesigner designer;
/**
public StateModel(FormDesigner designer) { * 返回direction
this.designer = designer; *
selectionModel = designer.getSelectionModel(); * @return direction方向
} */
public Direction getDirection() {
/** return driection;
* 返回direction }
* @return direction方向
*/ /**
public Direction getDirection() { * 是否有组件正被选中
return driection; *
} * @return true 如果至少一个组件被选中
*/
/** public boolean isSelecting() {
* 是否有组件正被选中 return selecting;
* }
* @return true 如果至少一个组件被选中
*/ /**
public boolean isSelecting() { * 是否能拖拽
return selecting; *
} * @return 非outer且选中为空
*/
/** public boolean dragable() {
*是否能拖拽 return ((driection != Location.outer) && !selecting);
* @return 非outer且选中为空 }
*/
public boolean dragable() { /**
return ((driection != Location.outer) && !selecting); * 拖拽中是否可以转换为添加模式
} * 如果拖拽组件只有一个鼠标当前所在位置的最底层表单容器与这个组件的容器不同
* 如果拖拽组件为多个鼠标当前所在位置的最底层表单容器除了要求要跟这些组件的容器不同外还必须是绝对定位布局
/** */
* 拖拽中是否可以转换为添加模式 private void checkAddable(MouseEvent e) {
* 如果拖拽组件只有一个鼠标当前所在位置的最底层表单容器与这个组件的容器不同 addable = false;
* 如果拖拽组件为多个鼠标当前所在位置的最底层表单容器除了要求要跟这些组件的容器不同外还必须是绝对定位布局 designer.setPainter(null);
*/
private void checkAddable(MouseEvent e) { if (driection != Location.inner) {
addable = false; return;
designer.setPainter(null); }
if (driection != Location.inner) { XCreator comp = designer.getComponentAt(e.getX(), e.getY(), selectionModel.getSelection().getSelectedCreators());
return; XLayoutContainer container = XCreatorUtils.getHotspotContainer(comp);
} XCreator creator = selectionModel.getSelection().getSelectedCreator();
Component creatorContainer = XCreatorUtils.getParentXLayoutContainer(creator);
XCreator comp = designer.getComponentAt(e.getX(), e.getY(), selectionModel.getSelection().getSelectedCreators()); if (creatorContainer != null && creatorContainer != container
XLayoutContainer container = XCreatorUtils.getHotspotContainer(comp); && (selectionModel.getSelection().size() == 1 || container instanceof XWAbsoluteLayout)) {
XCreator creator = selectionModel.getSelection().getSelectedCreator(); HoverPainter painter = AdapterBus.getContainerPainter(designer, container);
Component creatorContainer = XCreatorUtils.getParentXLayoutContainer(creator); designer.setPainter(painter);
if (creatorContainer != null && creatorContainer != container if (painter != null) {
&& (selectionModel.getSelection().size() == 1 || container instanceof XWAbsoluteLayout)) { Rectangle rect = ComponentUtils.getRelativeBounds(container);
HoverPainter painter = AdapterBus.getContainerPainter(designer, container); rect.x -= designer.getArea().getHorizontalValue();
designer.setPainter(painter); rect.y -= designer.getArea().getVerticalValue();
if (painter != null) { painter.setRenderingBounds(rect);
Rectangle rect = ComponentUtils.getRelativeBounds(container); painter.setHotspot(new Point(e.getX(), e.getY()));
rect.x -= designer.getArea().getHorizontalValue(); painter.setCreator(creator);
rect.y -= designer.getArea().getVerticalValue(); }
painter.setRenderingBounds(rect); addable = true;
painter.setHotspot(new Point(e.getX(), e.getY())); }
painter.setCreator(creator); }
}
addable = true; /**
} * @param container 容器
} * @param mouseX 鼠标释放位置X
* @param mouseY 鼠标释放位置Y
private boolean addBean(XLayoutContainer container, int x, int y) { * @return 是否成功
LayoutAdapter adapter = container.getLayoutAdapter(); */
Rectangle r = ComponentUtils.getRelativeBounds(container); private boolean addBean(XLayoutContainer container, int mouseX, int mouseY) {
if (selectionModel.getSelection().size() == 1) { LayoutAdapter adapter = container.getLayoutAdapter();
return adapter.addBean(selectionModel.getSelection().getSelectedCreator(), x Rectangle rectangleContainer = ComponentUtils.getRelativeBounds(container);
+ designer.getArea().getHorizontalValue() - r.x, y + designer.getArea().getVerticalValue() - r.y); if (selectionModel.getSelection().size() == 1) {
} return adapter.addBean(selectionModel.getSelection().getSelectedCreator(),
for (XCreator creator : selectionModel.getSelection().getSelectedCreators()) { mouseX + designer.getArea().getHorizontalValue() - rectangleContainer.x,
adapter.addBean(creator, x + designer.getArea().getHorizontalValue() - r.x, y + designer.getArea().getVerticalValue()- r.y); mouseY + designer.getArea().getVerticalValue() - rectangleContainer.y);
} }
return true; for (XCreator creator : selectionModel.getSelection().getSelectedCreators()) {
} adapter.addBean(creator,
mouseX + designer.getArea().getHorizontalValue() - rectangleContainer.x,
private void adding(int x, int y) { mouseY + designer.getArea().getVerticalValue() - rectangleContainer.y);
// 当前鼠标所在的组件 }
XCreator hoveredComponent = designer.getComponentAt(x, y, selectionModel.getSelection().getSelectedCreators()); return true;
}
// 获取该组件所在的焦点容器
XLayoutContainer container = XCreatorUtils.getHotspotContainer(hoveredComponent); /**
* @param mouseReleasedX 鼠标释放位置X
boolean success = false; * @param mouseReleasedY 鼠标释放位置Y
*/
if (container != null) { private void adding(int mouseReleasedX, int mouseReleasedY) {
// 如果是容器,则调用其acceptComponent接受组件 // 当前鼠标所在的组件
success = addBean(container, x, y); XCreator hoveredComponent = designer.getComponentAt(mouseReleasedX, mouseReleasedY, selectionModel.getSelection().getSelectedCreators());
}
// 获取该组件所在的焦点容器
if (success) { XLayoutContainer container = XCreatorUtils.getHotspotContainer(hoveredComponent);
FormSelectionUtils.rebuildSelection(designer);
designer.getEditListenerTable().fireCreatorModified( boolean success = false;
selectionModel.getSelection().getSelectedCreator(), DesignerEvent.CREATOR_ADDED);
} else { if (container != null) {
Toolkit.getDefaultToolkit().beep(); // 如果是容器,则调用其acceptComponent接受组件
} success = addBean(container, mouseReleasedX, mouseReleasedY);
}
// 取消提示
designer.setPainter(null); if (success) {
} FormSelectionUtils.rebuildSelection(designer);
designer.getEditListenerTable().fireCreatorModified(
/** selectionModel.getSelection().getSelectedCreator(), DesignerEvent.CREATOR_ADDED);
*是否拖拽 } else {
* @return dragging状态 selectionModel.getSelection().setSelectionBounds(selectedPositionBackup, designer);
*/ Toolkit.getDefaultToolkit().beep();
public boolean isDragging() { }
return dragging; // 取消提示
} designer.setPainter(null);
}
/**
*是否可以开始画线 /**
* @return startPoint不为空返回true * 是否拖拽
*/ *
public boolean prepareForDrawLining() { * @return dragging状态
return startPoint != null; */
} public boolean isDragging() {
return dragging;
/** }
*设置开始位置
* @param p point位置 /**
*/ * 是否可以开始画线
public void setStartPoint(Point p) { *
this.startPoint = p; * @return startPoint不为空返回true
} */
public boolean prepareForDrawLining() {
/** return startPoint != null;
*返回开始位置 }
* @return 点位置
*/ /**
public Point getStartPoint() { * 设置开始位置
return startPoint; *
} * @param p point位置
*/
/** public void setStartPoint(Point p) {
*返回当前点位置 this.startPoint = p;
* @return 点位置 }
*/
public Point getEndPoint() { /**
return currentPoint; * 返回开始位置
} *
* @return 点位置
/** */
*当前选中组件 public Point getStartPoint() {
* @param e 鼠标事件 return startPoint;
*/ }
public void startSelecting(MouseEvent e) {
selecting = true; /**
selectionModel.setHotspotBounds(new Rectangle()); * 返回当前点位置
current_x = getMouseXY(e).x; *
current_y = getMouseXY(e).y; * @return 点位置
} */
public Point getEndPoint() {
/** return currentPoint;
*当前鼠标的xy }
* @param e 鼠标事件
*/ /**
public void startResizing(MouseEvent e) { * 当前选中组件
if (!selectionModel.getSelection().isEmpty()) { *
driection.backupBounds(designer); * @param e 鼠标事件
} */
current_x = getMouseXY(e).x; public void startSelecting(MouseEvent e) {
current_y = getMouseXY(e).y; selecting = true;
} selectionModel.setHotspotBounds(new Rectangle());
currentX = getMouseXY(e).x;
/** currentY = getMouseXY(e).y;
*起始点开始DrawLine }
* @param p 点位置
*/ /**
public void startDrawLine(Point p) { * 当前鼠标的xy
this.startPoint = p; *
if(p != null) { * @param e 鼠标事件
try { */
designer.setCursor(XConnector.connectorCursor); public void startResizing(MouseEvent e) {
} catch (Exception e) { if (!selectionModel.getSelection().isEmpty()) {
} driection.backupBounds(designer);
} else { }
designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); currentX = getMouseXY(e).x;
} currentY = getMouseXY(e).y;
} }
/** /**
*鼠标释放时所在的区域及圈中的组件 * 起始点开始DrawLine
* @param e 鼠标事件 *
*/ * @param p 点位置
public void selectCreators(MouseEvent e) { */
int x = getMouseXY(e).x; public void startDrawLine(Point p) {
int y = getMouseXY(e).y; this.startPoint = p;
if (p != null) {
Rectangle bounds = createCurrentBounds(x, y); try {
designer.setCursor(XConnector.connectorCursor);
if ((x != current_x) || (y != current_y)) { } catch (Exception e) {
selectionModel.setSelectedCreators(getHotspotCreators(bounds, designer.getRootComponent())); }
} } else {
selectionModel.setHotspotBounds(null); designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
} }
}
/**
*画所在区域线 /**
* @param e 鼠标事件 * 鼠标释放时所在的区域及圈中的组件
*/ *
public void drawLine(MouseEvent e) { * @param e 鼠标事件
designer.getDrawLineHelper().setDrawLine(true); */
Point p = designer.getDrawLineHelper().getNearWidgetPoint(e); public void selectCreators(MouseEvent e) {
if (p != null) { int x = getMouseXY(e).x;
currentPoint = p; int y = getMouseXY(e).y;
} else {
currentPoint.x = e.getX() + designer.getArea().getHorizontalValue(); Rectangle bounds = createCurrentBounds(x, y);
currentPoint.y = e.getY() + designer.getArea().getVerticalValue();
} if ((x != currentX) || (y != currentY)) {
} selectionModel.setSelectedCreators(getHotspotCreators(bounds, designer.getRootComponent()));
}
private Rectangle createCurrentBounds(int x, int y) { selectionModel.setHotspotBounds(null);
Rectangle bounds = new Rectangle(); }
bounds.x = Math.min(x, current_x); /**
bounds.y = Math.min(y, current_y); * 画所在区域线
bounds.width = Math.max(x, current_x) - bounds.x; *
bounds.height = Math.max(y, current_y) - bounds.y; * @param e 鼠标事件
*/
return bounds; public void drawLine(MouseEvent e) {
} designer.getDrawLineHelper().setDrawLine(true);
Point p = designer.getDrawLineHelper().getNearWidgetPoint(e);
private ArrayList<XCreator> getHotspotCreators(Rectangle selection, XCreator root) { if (p != null) {
ArrayList<XCreator> creators = new ArrayList<XCreator>(); currentPoint = p;
} else {
if (!root.isVisible() && !designer.isRoot(root)) { currentPoint.x = e.getX() + designer.getArea().getHorizontalValue();
return creators; currentPoint.y = e.getY() + designer.getArea().getVerticalValue();
} }
}
if (root instanceof XLayoutContainer) {
XLayoutContainer container = (XLayoutContainer) root; private Rectangle createCurrentBounds(int x, int y) {
int count = container.getXCreatorCount(); Rectangle bounds = new Rectangle();
Rectangle clipped = new Rectangle(selection);
bounds.x = Math.min(x, currentX);
for (int i = count - 1; i >= 0; i--) { bounds.y = Math.min(y, currentY);
XCreator child = container.getXCreator(i); bounds.width = Math.max(x, currentX) - bounds.x;
bounds.height = Math.max(y, currentY) - bounds.y;
if (selection.contains(child.getBounds())) {
creators.add(child); return bounds;
} else { }
clipped.x = selection.x - child.getX();
clipped.y = selection.y - child.getY(); private ArrayList<XCreator> getHotspotCreators(Rectangle selection, XCreator root) {
creators.addAll(getHotspotCreators(clipped, child)); ArrayList<XCreator> creators = new ArrayList<>();
}
} if (!root.isVisible() && !designer.isRoot(root)) {
} return creators;
}
return creators;
} if (root instanceof XLayoutContainer) {
XLayoutContainer container = (XLayoutContainer) root;
int count = container.getXCreatorCount();
/** Rectangle clipped = new Rectangle(selection);
*重置model
*/ for (int i = count - 1; i >= 0; i--) {
public void resetModel() { XCreator child = container.getXCreator(i);
dragging = false;
selecting = false; if (selection.contains(child.getBounds())) {
} creators.add(child);
} else {
/** clipped.x = selection.x - child.getX();
*重置 clipped.y = selection.y - child.getY();
*/ creators.addAll(getHotspotCreators(clipped, child));
public void reset() { }
driection = Location.outer; }
dragging = false; }
selecting = false;
} return creators;
}
/**
*取消拖拽
*/ /**
public void draggingCancel() { * 重置model
designer.repaint(); */
reset(); public void resetModel() {
} dragging = false;
selecting = false;
/** }
*设置可拉伸方向
* @param dir 拉伸方向 /**
*/ * 重置
public void setDirection(Direction dir) { */
if(driection != dir) { public void reset() {
this.driection = dir; driection = Location.outer;
driection.updateCursor(designer); dragging = false;
} selecting = false;
} }
/** /**
*x吸附线赋值 * 取消拖拽
* @param line 线 */
*/ public void draggingCancel() {
public void setXAbsorptionline(Absorptionline line) { designer.repaint();
this.lineInX = line; reset();
} }
/** /**
*y吸附线赋值 * 设置可拉伸方向
* @param line 线 *
*/ * @param dir 拉伸方向
public void setYAbsorptionline(Absorptionline line) { */
this.lineInY = line; public void setDirection(Direction dir) {
} if (driection != dir) {
this.driection = dir;
/** driection.updateCursor(designer);
* 等距线赋值 }
* @param line 线 }
*/
public void setEquidistantLine(Absorptionline line){ /**
this.lineEquidistant = line; * x吸附线赋值
} *
* @param line 线
/** */
*画吸附线 public void setXAbsorptionline(Absorptionline line) {
* @param g Graphics类 this.lineInX = line;
*/ }
public void paintAbsorptionline(Graphics g) {
if(lineInX != null) { /**
lineInX.paint(g,designer.getArea()); * y吸附线赋值
} *
if(lineInY != null) { * @param line 线
lineInY.paint(g,designer.getArea()); */
} public void setYAbsorptionline(Absorptionline line) {
if(lineEquidistant != null){ this.lineInY = line;
lineEquidistant.paint(g,designer.getArea()); }
}
} /**
* 等距线赋值
/** *
*拖拽 * @param line 线
* @param e 鼠标事件 */
*/ public void setEquidistantLine(Absorptionline line) {
public void dragging(MouseEvent e) { this.lineEquidistant = line;
checkAddable(e); }
setDependLinePainter(e);
driection.drag(getMouseXY(e).x-current_x, getMouseXY(e).y-current_y, designer); /**
this.dragging = true; * 画吸附线
} *
* @param g Graphics类
// 拖拽时画依附线用到的painter */
private void setDependLinePainter(MouseEvent e){ public void paintAbsorptionline(Graphics g) {
XCreator comp = designer.getComponentAt(e.getX(), e.getY(), selectionModel.getSelection().getSelectedCreators()); if (lineInX != null) {
XLayoutContainer container = XCreatorUtils.getHotspotContainer(comp); lineInX.paint(g, designer.getArea());
XCreator creator = selectionModel.getSelection().getSelectedCreator(); }
HoverPainter painter = AdapterBus.getContainerPainter(designer, container); if (lineInY != null) {
designer.setPainter(painter); lineInY.paint(g, designer.getArea());
if (painter != null) { }
painter.setHotspot(new Point(e.getX(), e.getY())); if (lineEquidistant != null) {
painter.setCreator(creator); lineEquidistant.paint(g, designer.getArea());
} }
} }
/** /**
*释放捕获 * 拖拽
* @param e 鼠标事件 *
*/ * @param e 鼠标事件
public void releaseDragging(MouseEvent e) { */
this.dragging = false; public void dragging(MouseEvent e) {
if (addable) { //进入dragging状态时备份组件大小和位置
adding(e.getX(), e.getY()); if (!dragging) {
} else if (!selectionModel.getSelection().isEmpty()) { selectedPositionBackup = selectionModel.getSelection().getRelativeBounds();
selectionModel.releaseDragging(); }
} checkAddable(e);
designer.repaint(); setDependLinePainter(e);
} driection.drag(getMouseXY(e).x - currentX, getMouseXY(e).y - currentY, designer);
this.dragging = true;
/** }
*改变选择区域
* // 拖拽时画依附线用到的painter
* @param e 鼠标事件 private void setDependLinePainter(MouseEvent e) {
*/ XCreator comp = designer.getComponentAt(e.getX(), e.getY(), selectionModel.getSelection().getSelectedCreators());
public void changeSelection(MouseEvent e) { XLayoutContainer container = XCreatorUtils.getHotspotContainer(comp);
Rectangle bounds = createCurrentBounds(getMouseXY(e).x, getMouseXY(e).y); XCreator creator = selectionModel.getSelection().getSelectedCreator();
selectionModel.setHotspotBounds(bounds); HoverPainter painter = AdapterBus.getContainerPainter(designer, container);
} designer.setPainter(painter);
if (painter != null) {
/** painter.setHotspot(new Point(e.getX(), e.getY()));
*返回鼠标所在的xy 考虑滚动条的值 painter.setCreator(creator);
* }
* @param e 鼠标事件 }
* @return xy值
*/ /**
public Point getMouseXY(MouseEvent e) { * 释放捕获
Point p1 = new Point(e.getX() + designer.getArea().getHorizontalValue(), e.getY() *
+ designer.getArea().getVerticalValue()); * @param e 鼠标事件
return p1; */
} public void releaseDragging(MouseEvent e) {
this.dragging = false;
if (addable) {
adding(e.getX(), e.getY());
} else if (!selectionModel.getSelection().isEmpty()) {
selectionModel.releaseDragging();
}
designer.repaint();
}
/**
* 改变选择区域
*
* @param e 鼠标事件
*/
public void changeSelection(MouseEvent e) {
Rectangle bounds = createCurrentBounds(getMouseXY(e).x, getMouseXY(e).y);
selectionModel.setHotspotBounds(bounds);
}
/**
* 返回鼠标所在的xy 考虑滚动条的值
*
* @param e 鼠标事件
* @return xy值
*/
public Point getMouseXY(MouseEvent e) {
Point p1 = new Point(e.getX() + designer.getArea().getHorizontalValue(), e.getY()
+ designer.getArea().getVerticalValue());
return p1;
}
} }

187
designer_form/src/com/fr/design/designer/beans/painters/AbstractPainter.java

@ -1,93 +1,96 @@
package com.fr.design.designer.beans.painters; package com.fr.design.designer.beans.painters;
import java.awt.Color; import java.awt.Color;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.Stroke; import java.awt.Stroke;
import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.HoverPainter;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.general.Inter; import com.fr.general.Inter;
public abstract class AbstractPainter implements HoverPainter { public abstract class AbstractPainter implements HoverPainter {
protected Point hotspot; protected Point hotspot;
protected Rectangle hotspot_bounds; protected Rectangle hotspot_bounds;
protected XLayoutContainer container; protected XLayoutContainer container;
protected XCreator creator; protected XCreator creator;
/** /**
* 构造函数 * 构造函数
* @param container 容器 *
*/ * @param container 容器
public AbstractPainter(XLayoutContainer container) { */
this.container = container; public AbstractPainter(XLayoutContainer container) {
} this.container = container;
}
@Override
public void setHotspot(Point p) { @Override
hotspot = p; public void setHotspot(Point p) {
} hotspot = p;
}
/**
* 画初始区域 /**
* @param g 画图类 * 画初始区域
* @param startX 起始x位置 *
* @param startY 起始y位置 * @param g 画图类
*/ * @param startX 起始x位置
public void paint(Graphics g, int startX, int startY) { * @param startY 起始y位置
if(hotspot_bounds != null){ */
drawHotspot(g, hotspot_bounds.x, hotspot_bounds.y, hotspot_bounds.width, hotspot_bounds.height, Color.lightGray, true, false); public void paint(Graphics g, int startX, int startY) {
} if (hotspot_bounds != null) {
} drawHotspot(g, hotspot_bounds.x, hotspot_bounds.y, hotspot_bounds.width, hotspot_bounds.height, Color.lightGray, true, false);
}
/** }
* 设置边界
* @param rect 位置 /**
*/ * 设置边界
@Override *
public void setRenderingBounds(Rectangle rect) { * @param rect 位置
hotspot_bounds = rect; */
} @Override
public void setRenderingBounds(Rectangle rect) {
@Override hotspot_bounds = rect;
public void setCreator(XCreator component) { }
this.creator = component;
} @Override
public void setCreator(XCreator component) {
protected void drawHotspot(Graphics g, int x, int y, int width, int height, boolean accept) { this.creator = component;
Color bColor = accept ? XCreatorConstants.LAYOUT_HOTSPOT_COLOR : XCreatorConstants.LAYOUT_FORBIDDEN_COLOR; }
drawHotspot(g, x, y, width, height, bColor, accept, false);
} protected void drawHotspot(Graphics g, int x, int y, int width, int height, boolean accept) {
Color bColor = accept ? XCreatorConstants.LAYOUT_HOTSPOT_COLOR : XCreatorConstants.LAYOUT_FORBIDDEN_COLOR;
/** drawHotspot(g, x, y, width, height, bColor, accept, false);
* 自适应布局那边渲染提示要画整个背景不是画边框 }
*/
protected void drawRegionBackground(Graphics g, int x, int y, int width, int height, Color bColor, boolean accept) { /**
drawHotspot(g, x, y, width, height, bColor, accept, true); * 自适应布局那边渲染提示要画整个背景不是画边框
} */
protected void drawRegionBackground(Graphics g, int x, int y, int width, int height, Color bColor, boolean accept) {
protected void drawHotspot(Graphics g, int x, int y, int width, int height, Color bColor, boolean accept, boolean drawBackground) { drawHotspot(g, x, y, width, height, bColor, accept, true);
Graphics2D g2d = (Graphics2D) g; }
Color color = g2d.getColor();
Stroke backup = g2d.getStroke(); protected void drawHotspot(Graphics g, int x, int y, int width, int height, Color bColor, boolean accept, boolean drawBackground) {
// 设置线条的样式 Graphics2D g2d = (Graphics2D) g;
g2d.setStroke(XCreatorConstants.STROKE); Color color = g2d.getColor();
g2d.setColor(bColor); Stroke backup = g2d.getStroke();
if (!accept) { // 设置线条的样式
g2d.drawString(Inter.getLocText("Cannot-Add_To_This_Area") + "!", x + width / 3, y + height / 2); g2d.setStroke(XCreatorConstants.STROKE);
} else if (drawBackground) { g2d.setColor(bColor);
g2d.fillRect(x, y, width, height); if (!accept) {
} else { g2d.drawString(Inter.getLocText("Cannot-Add_To_This_Area") + "!", x + width / 3, y + height / 2);
g2d.drawRect(x, y, width, height); } else if (drawBackground) {
} g2d.fillRect(x, y, width, height);
g2d.setStroke(backup); } else {
g2d.setColor(color); g2d.drawRect(x, y, width, height);
} }
g2d.setStroke(backup);
g2d.setColor(color);
}
} }

182
designer_form/src/com/fr/design/designer/creator/DedicateLayoutContainer.java

@ -1,88 +1,96 @@
/** /**
* *
*/ */
package com.fr.design.designer.creator; package com.fr.design.designer.creator;
import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WLayout;
import java.awt.*; import java.awt.*;
import java.beans.IntrospectionException; import java.beans.IntrospectionException;
import java.util.ArrayList; import java.util.ArrayList;
/** /**
* 一些控件专属的容器如标题容器sclae容器 * 一些控件专属的容器如标题容器sclae容器
* @author jim *
* @date 2014-11-7 * @author jim
*/ * @date 2014-11-7
public abstract class DedicateLayoutContainer extends XLayoutContainer { */
public abstract class DedicateLayoutContainer extends XLayoutContainer {
public DedicateLayoutContainer(WLayout widget, Dimension initSize) {
super(widget, initSize); public DedicateLayoutContainer(WLayout widget, Dimension initSize) {
} super(widget, initSize);
}
/**
* 得到属性名 /**
* @return 属性名 * 得到属性名
* @throws IntrospectionException *
*/ * @return 属性名
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { * @throws IntrospectionException
return new CRPropertyDescriptor[0]; */
} public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return new CRPropertyDescriptor[0];
/** }
* 返回容器图标
* /**
* @return * 返回容器图标
*/ *
@Override * @return
public String getIconPath() { */
if(this.getXCreator(XWScaleLayout.INDEX) != null){ @Override
return this.getXCreator(XWScaleLayout.INDEX).getIconPath(); public String getIconPath() {
} if (this.getXCreator(XWScaleLayout.INDEX) != null) {
return "/com/fr/web/images/form/resources/text_field_16.png"; return this.getXCreator(XWScaleLayout.INDEX).getIconPath();
} }
return "/com/fr/web/images/form/resources/text_field_16.png";
}
/**
* 控件树不显示此组件
* @param path 控件树list /**
*/ * 控件树不显示此组件
public void notShowInComponentTree(ArrayList<Component> path) { *
path.remove(path.size()-1); * @param path 控件树list
} */
public void notShowInComponentTree(ArrayList<Component> path) {
/** path.remove(path.size() - 1);
* 重置组件的名称 }
* @param name 名称
*/ /**
public void resetCreatorName(String name) { * 重置组件的名称
super.resetCreatorName(name); *
XCreator child = getXCreator(XWScaleLayout.INDEX); * @param name 名称
child.toData().setWidgetName(name); */
} public void resetCreatorName(String name) {
super.resetCreatorName(name);
/** XCreator child = getXCreator(XWScaleLayout.INDEX);
* 返回对应属性表的组件scale和title返回其子组件 //实现WTitleLayout的SetWidgetName
* @return 组件 child.toData().setWidgetName(name);
*/ }
public XCreator getPropertyDescriptorCreator() {
return getXCreator(XWScaleLayout.INDEX); /**
} * 返回对应属性表的组件scale和title返回其子组件
*
/** * @return 组件
* 是否作为控件树的叶子节点 */
* @return 是则返回true public XCreator getPropertyDescriptorCreator() {
*/ return getXCreator(XWScaleLayout.INDEX);
public boolean isComponentTreeLeaf() { }
return true;
} /**
* 是否作为控件树的叶子节点
/** *
* 是否为sclae和title专属容器 * @return 是则返回true
* @return 是则返回true */
*/ public boolean isComponentTreeLeaf() {
public boolean isDedicateContainer() { return true;
return true; }
}
/**
* 是否为sclae和title专属容器
*
* @return 是则返回true
*/
public boolean isDedicateContainer() {
return true;
}
} }

435
designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java

@ -30,12 +30,12 @@ import java.util.List;
* @since 6.5.3 * @since 6.5.3
*/ */
public abstract class XLayoutContainer extends XBorderStyleWidgetCreator implements ContainerListener, ParameterBridge { public abstract class XLayoutContainer extends XBorderStyleWidgetCreator implements ContainerListener, ParameterBridge {
// 布局内部组件默认最小宽度36,最小高度21 // 布局内部组件默认最小宽度36,最小高度21
public static int MIN_WIDTH = 36; public static int MIN_WIDTH = 36;
public static int MIN_HEIGHT = 21; public static int MIN_HEIGHT = 21;
protected static final Dimension LARGEPREFERREDSIZE = new Dimension(200, 200); protected static final Dimension LARGEPREFERREDSIZE = new Dimension(200, 200);
protected boolean isRefreshing; protected boolean isRefreshing;
protected int default_Length = 5; // 取指定点坐在的组件,默认为5保证取四侧相邻的组件时x、y在组件内非边框上 protected int default_Length = 5; // 取指定点坐在的组件,默认为5保证取四侧相邻的组件时x、y在组件内非边框上
@ -45,6 +45,7 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
protected boolean editable = false; protected boolean editable = false;
//鼠标移动到布局画出编辑层 //鼠标移动到布局画出编辑层
protected boolean isMouseEnter = false; protected boolean isMouseEnter = false;
public void setMouseEnter(boolean mouseEnter) { public void setMouseEnter(boolean mouseEnter) {
isMouseEnter = mouseEnter; isMouseEnter = mouseEnter;
} }
@ -55,12 +56,13 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
} }
/** /**
* 得到属性名 * 得到属性名
*
* @return 属性名 * @return 属性名
* @throws IntrospectionException * @throws IntrospectionException
*/ */
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return new CRPropertyDescriptor[] { return new CRPropertyDescriptor[]{
new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter
.getLocText("FR-Designer_Form-Widget_Name")), .getLocText("FR-Designer_Form-Widget_Name")),
new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass( new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass(
@ -68,19 +70,20 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
Inter.getLocText("FR-Engine_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") Inter.getLocText("FR-Engine_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() { .setPropertyChangeListener(new PropertyChangeAdapter() {
@Override @Override
public void propertyChange() { public void propertyChange() {
initStyle(); initStyle();
} }
}), }),
new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class) new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class)
.setI18NName(Inter.getLocText("FR-Designer_Layout-Padding")) .setI18NName(Inter.getLocText("FR-Designer_Layout-Padding"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
}; };
} }
/** /**
* 控件名属性 * 控件名属性
*
* @return * @return
* @throws IntrospectionException * @throws IntrospectionException
*/ */
@ -91,6 +94,7 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
/** /**
* 边距属性 * 边距属性
*
* @return * @return
* @throws IntrospectionException * @throws IntrospectionException
*/ */
@ -101,47 +105,50 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
} }
/** /**
* 返回对应的wlayout * 返回对应的wlayout
*
* @return wlayout控件 * @return wlayout控件
*/ */
public WLayout toData() { public WLayout toData() {
return (WLayout) data; return (WLayout) data;
} }
@Override @Override
protected void initXCreatorProperties() { protected void initXCreatorProperties() {
super.initXCreatorProperties(); super.initXCreatorProperties();
initBorderStyle(); initBorderStyle();
this.initLayoutManager(); this.initLayoutManager();
this.convert(); this.convert();
} }
@Override @Override
protected JComponent initEditor() { protected JComponent initEditor() {
return this; return this;
} }
/** /**
* 当前组件zorder位置替换新的控件 * 当前组件zorder位置替换新的控件
* @param widget 控件 *
* @param oldcreator 旧组件 * @param widget 控件
* @return 组件 * @param oldcreator 旧组件
*/ * @return 组件
public XCreator replace(Widget widget, XCreator oldcreator) { */
int i = this.getComponentZOrder(oldcreator); public XCreator replace(Widget widget, XCreator oldcreator) {
if (i != -1) { int i = this.getComponentZOrder(oldcreator);
this.toData().replace(widget, oldcreator.toData()); if (i != -1) {
this.convert(); this.toData().replace(widget, oldcreator.toData());
XCreator creator = (XCreator) this.getComponent(i); this.convert();
creator.setSize(oldcreator.getSize()); XCreator creator = (XCreator) this.getComponent(i);
return creator; creator.setSize(oldcreator.getSize());
} return creator;
return null; }
} return null;
}
/**
* 初始化时默认的组件大小 /**
* @return 默认Dimension * 初始化时默认的组件大小
*
* @return 默认Dimension
*/ */
public Dimension initEditorSize() { public Dimension initEditorSize() {
return LARGEPREFERREDSIZE; return LARGEPREFERREDSIZE;
@ -172,7 +179,8 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
/** /**
* 设计界面中有组件添加时要通知WLayout容器重新paint * 设计界面中有组件添加时要通知WLayout容器重新paint
* @param e 待说明 *
* @param e 待说明
*/ */
@Override @Override
public void componentAdded(ContainerEvent e) { public void componentAdded(ContainerEvent e) {
@ -188,7 +196,8 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
/** /**
* 设计界面中有组件添加时要通知WLayout容器重新paint * 设计界面中有组件添加时要通知WLayout容器重新paint
* @param e 待说明 *
* @param e 待说明
*/ */
@Override @Override
public void componentRemoved(ContainerEvent e) { public void componentRemoved(ContainerEvent e) {
@ -203,6 +212,7 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
/** /**
* 根据widget的属性值来获取 * 根据widget的属性值来获取
*
* @param wgt * @param wgt
* @return * @return
*/ */
@ -226,30 +236,32 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
public int getXCreatorCount() { public int getXCreatorCount() {
return getComponentCount(); return getComponentCount();
} }
public XCreator getXCreator(int i) { public XCreator getXCreator(int i) {
return (XCreator) getComponent(i); return (XCreator) getComponent(i);
} }
/** /**
* 该组件是否可以拖入参数面板 * 该组件是否可以拖入参数面板
*
* @return 是则返回true * @return 是则返回true
*/ */
public boolean canEnterIntoParaPane(){ public boolean canEnterIntoParaPane() {
return false; return false;
} }
/** /**
* 是否作为控件树的叶子节点 * 是否作为控件树的叶子节点
* @return 是则返回true *
*/ * @return 是则返回true
public boolean isComponentTreeLeaf() { */
return false; public boolean isComponentTreeLeaf() {
} return false;
}
public List<String> getAllXCreatorNameList(XCreator xCreator, List<String> namelist){ public List<String> getAllXCreatorNameList(XCreator xCreator, List<String> namelist) {
for (int i = 0; i < ((XLayoutContainer)xCreator).getXCreatorCount(); i++) { for (int i = 0; i < ((XLayoutContainer) xCreator).getXCreatorCount(); i++) {
XCreator creatorSon = ((XLayoutContainer)xCreator).getXCreator(i); XCreator creatorSon = ((XLayoutContainer) xCreator).getXCreator(i);
creatorSon.getAllXCreatorNameList(creatorSon, namelist); creatorSon.getAllXCreatorNameList(creatorSon, namelist);
} }
return namelist; return namelist;
@ -257,19 +269,20 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
/** /**
* 是否有查询按钮 * 是否有查询按钮
* @param xCreator 控件或容器 *
* @return 有无查询按钮 * @param xCreator 控件或容器
* @return 有无查询按钮
*/ */
public boolean SearchQueryCreators(XCreator xCreator) { public boolean SearchQueryCreators(XCreator xCreator) {
for (int i = 0; i < ((XLayoutContainer)xCreator).getXCreatorCount(); i++) { for (int i = 0; i < ((XLayoutContainer) xCreator).getXCreatorCount(); i++) {
XCreator creatorSon = ((XLayoutContainer)xCreator).getXCreator(i); XCreator creatorSon = ((XLayoutContainer) xCreator).getXCreator(i);
if(creatorSon.SearchQueryCreators(creatorSon)){ if (creatorSon.SearchQueryCreators(creatorSon)) {
return true; return true;
} }
} }
return false; return false;
} }
public FRLayoutManager getFRLayout() { public FRLayoutManager getFRLayout() {
LayoutManager layout = getLayout(); LayoutManager layout = getLayout();
if (layout instanceof FRLayoutManager) { if (layout instanceof FRLayoutManager) {
@ -279,111 +292,120 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
return null; return null;
} }
public abstract LayoutAdapter getLayoutAdapter(); public abstract LayoutAdapter getLayoutAdapter();
public int getIndexOfChild(Object child) { public int getIndexOfChild(Object child) {
int count = getComponentCount(); int count = getComponentCount();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
Component comp = getComponent(i); Component comp = getComponent(i);
if (comp == child) { if (comp == child) {
return i; return i;
} }
} }
return -1; return -1;
} }
/** /**
* 主要为自适应用 * 主要为自适应用
* 返回指定point的上方组件 * 返回指定point的上方组件
* @param x x位置 *
* @param y y位置 * @param x x位置
* @return 指定位置的组件 * @param y y位置
*/ * @return 指定位置的组件
public Component getTopComp(int x, int y) { */
return this.getComponentAt(x, y-default_Length); public Component getTopComp(int x, int y) {
} return this.getComponentAt(x, y - default_Length);
}
/**
* 主要为自适应用 /**
* 返回指定point的左方组件 * 主要为自适应用
* @param x x位置 * 返回指定point的左方组件
* @param y y位置 *
* @return 指定位置的组件 * @param x x位置
*/ * @param y y位置
public Component getLeftComp(int x, int y) { * @return 指定位置的组件
return this.getComponentAt(x-default_Length, y); */
} public Component getLeftComp(int x, int y) {
return this.getComponentAt(x - default_Length, y);
/** }
* 返回指定point的右方组件
* @param x x位置 /**
* @param y y位置 * 返回指定point的右方组件
* @param w 宽度 *
* @return 指定位置的组件 * @param x x位置
*/ * @param y y位置
public Component getRightComp(int x, int y, int w) { * @param w 宽度
return this.getComponentAt(x+w+default_Length, y); * @return 指定位置的组件
} */
public Component getRightComp(int x, int y, int w) {
/** return this.getComponentAt(x + w + default_Length, y);
* 返回指定point的下方组件 }
* @param x x位置
* @param y y位置 /**
* @param h 高度 * 返回指定point的下方组件
* @return 指定位置的组件 *
*/ * @param x x位置
public Component getBottomComp(int x, int y, int h) { * @param y y位置
return this.getComponentAt(x, y+h+default_Length); * @param h 高度
} * @return 指定位置的组件
*/
/** public Component getBottomComp(int x, int y, int h) {
* 返回指定point的上方且是右侧的组件 return this.getComponentAt(x, y + h + default_Length);
* @param x x位置 }
* @param y y位置
* @param w 宽度 /**
* @return 指定位置的组件 * 返回指定point的上方且是右侧的组件
*/ *
public Component getRightTopComp(int x, int y, int w) { * @param x x位置
return this.getComponentAt(x+w-default_Length, y-default_Length); * @param y y位置
} * @param w 宽度
* @return 指定位置的组件
/** */
* 返回指定point的左方且是下侧的组件 public Component getRightTopComp(int x, int y, int w) {
* @param x x位置 return this.getComponentAt(x + w - default_Length, y - default_Length);
* @param y y位置 }
* @param h 高度
* @return 指定位置的组件 /**
*/ * 返回指定point的左方且是下侧的组件
public Component getBottomLeftComp(int x, int y, int h) { *
return this.getComponentAt(x-default_Length, y+h-default_Length); * @param x x位置
} * @param y y位置
* @param h 高度
/** * @return 指定位置的组件
* 返回指定point的右方且是下侧的组件 */
* @param x x位置 public Component getBottomLeftComp(int x, int y, int h) {
* @param y y位置 return this.getComponentAt(x - default_Length, y + h - default_Length);
* @param h 高度 }
* @param w 宽度
* @return 指定位置的组件 /**
*/ * 返回指定point的右方且是下侧的组件
public Component getBottomRightComp(int x, int y, int h, int w) { *
return this.getComponentAt(x+w+default_Length, y+h-default_Length); * @param x x位置
} * @param y y位置
* @param h 高度
/** * @param w 宽度
* 返回指定point的下方且是右侧的组件 * @return 指定位置的组件
* @param x x位置 */
* @param y y位置 public Component getBottomRightComp(int x, int y, int h, int w) {
* @param h 高度 return this.getComponentAt(x + w + default_Length, y + h - default_Length);
* @param w 宽度 }
* @return 指定位置的组件
*/ /**
public Component getRightBottomComp(int x, int y, int h, int w) { * 返回指定point的下方且是右侧的组件
return this.getComponentAt(x+w-default_Length, y+h+default_Length); *
} * @param x x位置
* @param y y位置
* @param h 高度
* @param w 宽度
* @return 指定位置的组件
*/
public Component getRightBottomComp(int x, int y, int h, int w) {
return this.getComponentAt(x + w - default_Length, y + h + default_Length);
}
/** /**
* 是否延迟展示报表内容也就是说是否要等点击了查询之后才执行报表 * 是否延迟展示报表内容也就是说是否要等点击了查询之后才执行报表
*
* @return 如果是true则表示点击之后才开始计算false则表示会根据参数默认值直接计算报表并展现 * @return 如果是true则表示点击之后才开始计算false则表示会根据参数默认值直接计算报表并展现
*/ */
public boolean isDelayDisplayContent() { public boolean isDelayDisplayContent() {
@ -392,18 +414,20 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
/** /**
* 是否显示参数界面 * 是否显示参数界面
*
* @return 显示参数界面则返回true否则返回false * @return 显示参数界面则返回true否则返回false
*/ */
public boolean isDisplay() { public boolean isDisplay() {
return false; return false;
} }
public Background getDataBackground(){ public Background getDataBackground() {
return toData().getBackground(); return toData().getBackground();
} }
/** /**
* 获取参数界面的宽度 * 获取参数界面的宽度
*
* @return 宽度 * @return 宽度
*/ */
public int getDesignWidth() { public int getDesignWidth() {
@ -412,83 +436,82 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
/** /**
* 获取参数面板的对齐方式 * 获取参数面板的对齐方式
*
* @return 左中右三种对齐方式 * @return 左中右三种对齐方式
*/ */
public int getPosition() { public int getPosition() {
return 0; return 0;
} }
/** /**
* 切换到非添加状态 * 切换到非添加状态
* *
* @param designer 表单设计器 * @param designer 表单设计器
*/ */
public void stopAddingState(FormDesigner designer){ public void stopAddingState(FormDesigner designer) {
return; }
}
/**
/** * 寻找最近的为自适应布局的父容器
* 寻找最近的为自适应布局的父容器 *
* * @return 布局容器
* @return 布局容器 * @date 2014-12-30-下午3:15:28
* */
* public XLayoutContainer findNearestFit() {
* @date 2014-12-30-下午3:15:28 //一层一层网上找, 找到最近的fit那一层就return
* XLayoutContainer parent = this.getBackupParent();
*/ return parent == null ? null : parent.findNearestFit();
public XLayoutContainer findNearestFit(){ }
//一层一层网上找, 找到最近的fit那一层就return
XLayoutContainer parent = this.getBackupParent();
return parent == null ? null : parent.findNearestFit();
}
/** /**
* 获取容器所有内部组件横坐标值 * 获取容器所有内部组件横坐标值
* *
* @return 横坐标数组 * @return 横坐标数组
*/ */
public int[] getHors(){ public int[] getHors() {
return ArrayUtils.EMPTY_INT_ARRAY; return ArrayUtils.EMPTY_INT_ARRAY;
} }
/** /**
* 获取容器所有内部组件纵坐标值 * 获取容器所有内部组件纵坐标值
* *
* @return 纵坐标数组 * @return 纵坐标数组
*/ */
public int[] getVeris(){ public int[] getVeris() {
return ArrayUtils.EMPTY_INT_ARRAY; return ArrayUtils.EMPTY_INT_ARRAY;
} }
public void setDelayDisplayContent(boolean delayPlaying){ public void setDelayDisplayContent(boolean delayPlaying) {
} }
public void setPosition(int align){ public void setPosition(int align) {
} }
public void setDisplay(boolean showWindow){ public void setDisplay(boolean showWindow) {
} }
public void setBackground(Background background){ public void setBackground(Background background) {
} }
/** /**
* 布局是否可编辑不可则显示编辑蒙层 * 布局是否可编辑不可则显示编辑蒙层
*
* @return 可否编辑 * @return 可否编辑
*/ */
public boolean isEditable(){ public boolean isEditable() {
return this.editable; return this.editable;
} }
/** /**
* 设置布局是否可编辑不可则显示编辑蒙层 * 设置布局是否可编辑不可则显示编辑蒙层
*
* @param isEditable 可否编辑 * @param isEditable 可否编辑
*/ */
public void setEditable(boolean isEditable){ public void setEditable(boolean isEditable) {
this.editable = isEditable; this.editable = isEditable;
} }
} }

23
designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -8,6 +8,7 @@ import java.awt.event.ContainerEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.beans.IntrospectionException; import java.beans.IntrospectionException;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
@ -16,6 +17,7 @@ import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRAbsoluteLayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRAbsoluteLayoutAdapter;
import com.fr.design.designer.beans.location.Direction; import com.fr.design.designer.beans.location.Direction;
import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.form.layout.FRAbsoluteLayout; import com.fr.design.form.layout.FRAbsoluteLayout;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
import com.fr.design.mainframe.*; import com.fr.design.mainframe.*;
@ -23,7 +25,7 @@ import com.fr.form.ui.Connector;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.widget.BoundsWidget; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.general.FRScreen; import com.fr.general.FRScreen;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -154,8 +156,15 @@ public class XWAbsoluteLayout extends XLayoutContainer {
if (xCreator.acceptType(XWAbsoluteLayout.class)){ if (xCreator.acceptType(XWAbsoluteLayout.class)){
((XWAbsoluteLayout) xCreator).updateBoundsWidget(); ((XWAbsoluteLayout) xCreator).updateBoundsWidget();
} }
BoundsWidget boundsWidget = layout.getBoundsWidget(xCreator.toData()); // 如果子组件时tab布局,则tab布局内部的组件的wiget也要更新,否则保存后重新打开大小不对
Rectangle rectangle = dealWidgetBound(xCreator.getBounds()); ArrayList<?> childrenList = xCreator.getTargetChildrenList();
if(!childrenList.isEmpty()){
for(int i=0; i<childrenList.size(); i++){
XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList.get(i);
tabLayout.updateBoundsWidget();
}
}
BoundsWidget boundsWidget = (BoundsWidget) layout.getBoundsWidget(xCreator.toData()); Rectangle rectangle = dealWidgetBound(xCreator.getBounds());
} }
private Rectangle calculateBound(Rectangle rec, double pw, double ph){ private Rectangle calculateBound(Rectangle rec, double pw, double ph){
@ -179,7 +188,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
double percentH = ((double) backupBound.height / (double) currentBound.height); double percentH = ((double) backupBound.height / (double) currentBound.height);
for (int index = 0, n = this.getComponentCount(); index < n; index++){ for (int index = 0, n = this.getComponentCount(); index < n; index++){
XCreator creator = (XCreator) this.getComponent(index); XCreator creator = (XCreator) this.getComponent(index);
BoundsWidget wgt = layout.getBoundsWidget(creator.toData()); BoundsWidget wgt = (BoundsWidget) layout.getBoundsWidget(creator.toData());
// 用当前的显示大小计算后调正具体位置 // 用当前的显示大小计算后调正具体位置
Rectangle wgtBound = creator.getBounds(); Rectangle wgtBound = creator.getBounds();
Rectangle rec = calculateBound(wgtBound, percentW, percentH); Rectangle rec = calculateBound(wgtBound, percentW, percentH);
@ -211,7 +220,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
rec.y = (int)(rec.y / prevContainerPercent * containerPercent); rec.y = (int)(rec.y / prevContainerPercent * containerPercent);
rec.height = (int)(rec.height / prevContainerPercent * containerPercent); rec.height = (int)(rec.height / prevContainerPercent * containerPercent);
rec.width = (int)(rec.width / prevContainerPercent * containerPercent); rec.width = (int)(rec.width / prevContainerPercent * containerPercent);
BoundsWidget wgt = toData().getBoundsWidget(creator.toData()); BoundsWidget wgt = (BoundsWidget) toData().getBoundsWidget(creator.toData());
wgt.setBounds(rec); wgt.setBounds(rec);
creator.setBounds(rec); creator.setBounds(rec);
creator.updateChildBound(minHeight); creator.updateChildBound(minHeight);
@ -467,7 +476,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
XCreator xCreator = (XCreator) getComponent(i); XCreator xCreator = (XCreator) getComponent(i);
Rectangle rectangle = xCreator.getBounds(); Rectangle rectangle = xCreator.getBounds();
xCreator.setBounds((int) (rectangle.x * percent), rectangle.y, (int) (rectangle.width * percent), rectangle.height); xCreator.setBounds((int) (rectangle.x * percent), rectangle.y, (int) (rectangle.width * percent), rectangle.height);
BoundsWidget widget = toData().getBoundsWidget(xCreator.toData()); BoundsWidget widget = (BoundsWidget) toData().getBoundsWidget(xCreator.toData());
widget.setBounds(xCreator.getBounds()); widget.setBounds(xCreator.getBounds());
} }
} }
@ -483,7 +492,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
XCreator xCreator = (XCreator) getComponent(i); XCreator xCreator = (XCreator) getComponent(i);
Rectangle rectangle = xCreator.getBounds(); Rectangle rectangle = xCreator.getBounds();
xCreator.setBounds(rectangle.x, (int) (rectangle.y * percent), rectangle.width, (int) (rectangle.height * percent)); xCreator.setBounds(rectangle.x, (int) (rectangle.y * percent), rectangle.width, (int) (rectangle.height * percent));
BoundsWidget widget = toData().getBoundsWidget(xCreator.toData()); BoundsWidget widget = (BoundsWidget) toData().getBoundsWidget(xCreator.toData());
widget.setBounds(xCreator.getBounds()); widget.setBounds(xCreator.getBounds());
} }
} }

23
designer_form/src/com/fr/design/designer/creator/XWFitLayout.java

@ -23,8 +23,8 @@ import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WBodyLayoutType; import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.widget.BoundsWidget;
import com.fr.general.FRScreen; import com.fr.general.FRScreen;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -351,7 +351,7 @@ public class XWFitLayout extends XLayoutContainer {
} }
for (int i=0, size=comps.size(); i<size; i++) { for (int i=0, size=comps.size(); i<size; i++) {
XCreator creator = (XCreator) comps.get(i); XCreator creator = (XCreator) comps.get(i);
BoundsWidget widget = toData().getBoundsWidget(creator.toData()); BoundsWidget widget = (BoundsWidget) toData().getBoundsWidget(creator.toData());
Rectangle rec = widget.getBounds(); Rectangle rec = widget.getBounds();
Rectangle backRec = widget.getBackupBounds(); Rectangle backRec = widget.getBackupBounds();
if (backRec.x<x) { if (backRec.x<x) {
@ -415,7 +415,7 @@ public class XWFitLayout extends XLayoutContainer {
protected void modifyEdgemostCreator(boolean isHor) { protected void modifyEdgemostCreator(boolean isHor) {
for (int i=0, size=this.getComponentCount(); i<size; i++) { for (int i=0, size=this.getComponentCount(); i<size; i++) {
XCreator creator = (XCreator) this.getComponent(i); XCreator creator = (XCreator) this.getComponent(i);
BoundsWidget widget = toData().getBoundsWidget(creator.toData()); BoundsWidget widget = (BoundsWidget) toData().getBoundsWidget(creator.toData());
Rectangle rec = widget.getBackupBounds(); Rectangle rec = widget.getBackupBounds();
if (isHor && notHasRightCreator(rec)) { if (isHor && notHasRightCreator(rec)) {
creator.setSize(creator.getWidth()+needAddWidth, creator.getHeight()); creator.setSize(creator.getWidth()+needAddWidth, creator.getHeight());
@ -480,7 +480,7 @@ public class XWFitLayout extends XLayoutContainer {
} }
for (int i=0, size=comps.size(); i<size; i++) { for (int i=0, size=comps.size(); i<size; i++) {
XCreator creator = (XCreator) comps.get(i); XCreator creator = (XCreator) comps.get(i);
BoundsWidget widget = toData().getBoundsWidget(creator.toData()); BoundsWidget widget = (BoundsWidget) toData().getBoundsWidget(creator.toData());
Rectangle rec = widget.getBounds(); Rectangle rec = widget.getBounds();
Rectangle backRec = widget.getBackupBounds(); Rectangle backRec = widget.getBackupBounds();
if (backRec.y < y) { if (backRec.y < y) {
@ -519,7 +519,7 @@ public class XWFitLayout extends XLayoutContainer {
for (int i=0; i<size; i++) { for (int i=0; i<size; i++) {
Component comp = this.getComponent(i); Component comp = this.getComponent(i);
XCreator creator = (XCreator) comp; XCreator creator = (XCreator) comp;
BoundsWidget widget = toData().getBoundsWidget(creator.toData()); BoundsWidget widget = (BoundsWidget) toData().getBoundsWidget(creator.toData());
Rectangle rec = widget.getBackupBounds(); Rectangle rec = widget.getBackupBounds();
//rec.x小于x,右侧大于x //rec.x小于x,右侧大于x
boolean isLowX = rec.x<x && x<rec.x+rec.width; boolean isLowX = rec.x<x && x<rec.x+rec.width;
@ -535,7 +535,7 @@ public class XWFitLayout extends XLayoutContainer {
for (int i=0,size=this.getComponentCount(); i<size; i++) { for (int i=0,size=this.getComponentCount(); i<size; i++) {
Component comp = this.getComponent(i); Component comp = this.getComponent(i);
XCreator creator = (XCreator) comp; XCreator creator = (XCreator) comp;
BoundsWidget widget = toData().getBoundsWidget(creator.toData()); BoundsWidget widget = (BoundsWidget) toData().getBoundsWidget(creator.toData());
Rectangle rec = widget.getBackupBounds(); Rectangle rec = widget.getBackupBounds();
boolean isLowY = rec.y<y && y<rec.y+rec.height; boolean isLowY = rec.y<y && y<rec.y+rec.height;
if (isLowY || rec.y==y) { if (isLowY || rec.y==y) {
@ -574,7 +574,7 @@ public class XWFitLayout extends XLayoutContainer {
public XCreator getCreatorAt(int x, int y) { public XCreator getCreatorAt(int x, int y) {
for (int i=0,size=this.getComponentCount(); i<size; i++) { for (int i=0,size=this.getComponentCount(); i<size; i++) {
XCreator creator = (XCreator) this.getComponent(i); XCreator creator = (XCreator) this.getComponent(i);
BoundsWidget widget = toData().getBoundsWidget(creator.toData()); BoundsWidget widget = (BoundsWidget) toData().getBoundsWidget(creator.toData());
Rectangle rec = widget.getBackupBounds(); Rectangle rec = widget.getBackupBounds();
boolean isCurrent = rec.x<=x && x<rec.x+rec.width && rec.y<=y && y<rec.y+rec.height; boolean isCurrent = rec.x<=x && x<rec.x+rec.width && rec.y<=y && y<rec.y+rec.height;
if (isCurrent) { if (isCurrent) {
@ -591,7 +591,7 @@ public class XWFitLayout extends XLayoutContainer {
for (int i=0, size=this.getComponentCount(); i<size; i++) { for (int i=0, size=this.getComponentCount(); i<size; i++) {
Component comp = this.getComponent(i); Component comp = this.getComponent(i);
XCreator creator = (XCreator) comp; XCreator creator = (XCreator) comp;
BoundsWidget widget = toData().getBoundsWidget(creator.toData()); BoundsWidget widget = (BoundsWidget) toData().getBoundsWidget(creator.toData());
widget.setBackupBounds(widget.getBounds()); widget.setBackupBounds(widget.getBounds());
} }
} }
@ -736,7 +736,7 @@ public class XWFitLayout extends XLayoutContainer {
int containerHeight = 0; int containerHeight = 0;
for (int index=0, n=this.getComponentCount(); index<n; index++) { for (int index=0, n=this.getComponentCount(); index<n; index++) {
XCreator creator = (XCreator) this.getComponent(index); XCreator creator = (XCreator) this.getComponent(index);
BoundsWidget wgt = layout.getBoundsWidget(creator.toData()); BoundsWidget wgt = (BoundsWidget) layout.getBoundsWidget(creator.toData());
// 用当前的显示大小计算后调正具体位置 // 用当前的显示大小计算后调正具体位置
Rectangle wgtBound = dealWidgetBound(creator.getBounds()); Rectangle wgtBound = dealWidgetBound(creator.getBounds());
Rectangle rec = recalculateWidgetBounds(wgtBound, hors, veris); Rectangle rec = recalculateWidgetBounds(wgtBound, hors, veris);
@ -759,6 +759,7 @@ public class XWFitLayout extends XLayoutContainer {
//如果子组件是绝对布局,则内部的widget也要更新 //如果子组件是绝对布局,则内部的widget也要更新
if (creator.acceptType(XWAbsoluteLayout.class)){ if (creator.acceptType(XWAbsoluteLayout.class)){
((XWAbsoluteLayout) creator).updateBoundsWidget(); ((XWAbsoluteLayout) creator).updateBoundsWidget();
creator.setBackupBound(creator.getBounds());
} }
} }
layout.setContainerHeight(containerHeight); layout.setContainerHeight(containerHeight);
@ -814,7 +815,7 @@ public class XWFitLayout extends XLayoutContainer {
WFitLayout wlayout = this.toData(); WFitLayout wlayout = this.toData();
XWidgetCreator xwc = ((XWidgetCreator) e.getChild()); XWidgetCreator xwc = ((XWidgetCreator) e.getChild());
Widget wgt = xwc.toData(); Widget wgt = xwc.toData();
BoundsWidget bw = wlayout.getBoundsWidget(wgt); BoundsWidget bw = (BoundsWidget) wlayout.getBoundsWidget(wgt);
wlayout.removeWidget(bw); wlayout.removeWidget(bw);
updateBoundsWidget(); updateBoundsWidget();
((FRFitLayoutAdapter)getLayoutAdapter()).updateCreatorBackBound(); ((FRFitLayoutAdapter)getLayoutAdapter()).updateCreatorBackBound();
@ -992,7 +993,7 @@ public class XWFitLayout extends XLayoutContainer {
int val = toData().getCompInterval()/2; int val = toData().getCompInterval()/2;
for (int i=0, len=this.getComponentCount(); i<len; i++) { for (int i=0, len=this.getComponentCount(); i<len; i++) {
XCreator creator = (XCreator) this.getComponent(i); XCreator creator = (XCreator) this.getComponent(i);
BoundsWidget widget = toData().getBoundsWidget(creator.toData()); BoundsWidget widget = (BoundsWidget) toData().getBoundsWidget(creator.toData());
Rectangle rec = widget.getBounds(); Rectangle rec = widget.getBounds();
Dimension d = new Dimension(this.getBackupBound().width, this.getBackupBound().height); Dimension d = new Dimension(this.getBackupBound().width, this.getBackupBound().height);
Rectangle bound = dealBound(rec, d, val, percent); Rectangle bound = dealBound(rec, d, val, percent);

2
designer_form/src/com/fr/design/designer/creator/XWScaleLayout.java

@ -12,7 +12,7 @@ import com.fr.design.designer.beans.adapters.layout.FRScaleLayoutAdapter;
import com.fr.design.form.layout.FRScaleLayout; import com.fr.design.form.layout.FRScaleLayout;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WScaleLayout; import com.fr.form.ui.container.WScaleLayout;
import com.fr.form.ui.widget.BoundsWidget; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
/** /**
* 自适应布局中添加组件时部分控件如数字文本下拉等需要保持控件默认高度21 用此容器来实现 * 自适应布局中添加组件时部分控件如数字文本下拉等需要保持控件默认高度21 用此容器来实现

2
designer_form/src/com/fr/design/designer/creator/XWTitleLayout.java

@ -11,8 +11,8 @@ import com.fr.form.ui.Label;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.WidgetTitle; import com.fr.form.ui.WidgetTitle;
import com.fr.form.ui.container.WTitleLayout; import com.fr.form.ui.container.WTitleLayout;
import com.fr.form.ui.widget.BoundsWidget;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import java.awt.*; import java.awt.*;
import java.awt.event.ContainerEvent; import java.awt.event.ContainerEvent;

6
designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java

@ -19,8 +19,8 @@ import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.form.ui.widget.BoundsWidget;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.general.Inter; import com.fr.general.Inter;
/** /**
@ -154,7 +154,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout{
tabLayout.getHeight()); tabLayout.getHeight());
for (int m = 0; m < tabLayout.getComponentCount(); m++) { for (int m = 0; m < tabLayout.getComponentCount(); m++) {
XCreator childCreator = tabLayout.getXCreator(m); XCreator childCreator = tabLayout.getXCreator(m);
BoundsWidget wgt = tabLayout.toData() BoundsWidget wgt = (BoundsWidget) tabLayout.toData()
.getBoundsWidget(childCreator.toData()); .getBoundsWidget(childCreator.toData());
wgt.setBounds(tabLayout.getComponent(m).getBounds()); wgt.setBounds(tabLayout.getComponent(m).getBounds());
} }
@ -189,7 +189,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout{
tabLayout.getHeight() + offset); tabLayout.getHeight() + offset);
for (int m = 0; m < tabLayout.getComponentCount(); m++) { for (int m = 0; m < tabLayout.getComponentCount(); m++) {
XCreator childCreator = tabLayout.getXCreator(m); XCreator childCreator = tabLayout.getXCreator(m);
BoundsWidget wgt = tabLayout.toData() BoundsWidget wgt = (BoundsWidget) tabLayout.toData()
.getBoundsWidget(childCreator.toData()); .getBoundsWidget(childCreator.toData());
wgt.setBounds(tabLayout.getComponent(m).getBounds()); wgt.setBounds(tabLayout.getComponent(m).getBounds());
} }

338
designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java

@ -1,5 +1,5 @@
/** /**
* *
*/ */
package com.fr.design.designer.creator.cardlayout; package com.fr.design.designer.creator.cardlayout;
@ -25,114 +25,109 @@ import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout;
/** /**
*
*
* @date: 2014-11-25-下午3:11:14 * @date: 2014-11-25-下午3:11:14
*/ */
public class XWCardTagLayout extends XWHorizontalBoxLayout { public class XWCardTagLayout extends XWHorizontalBoxLayout {
private static final int MIN_SIZE = 1; private static final int MIN_SIZE = 1;
private String tagName = "Tab"; private String tagName = "Tab";
private boolean switchingTab = false; private boolean switchingTab = false;
//增加一个tabNameIndex防止tabFitLayout重名 //增加一个tabNameIndex防止tabFitLayout重名
private int tabFitIndex = 0; private int tabFitIndex = 0;
private CardSwitchButton currentCard; private CardSwitchButton currentCard;
public CardSwitchButton getCurrentCard() { public CardSwitchButton getCurrentCard() {
return currentCard; return currentCard;
} }
public void setCurrentCard(CardSwitchButton currentCard) { public void setCurrentCard(CardSwitchButton currentCard) {
this.currentCard = currentCard; this.currentCard = currentCard;
} }
public int getTabFitIndex() { public int getTabFitIndex() {
return tabFitIndex; return tabFitIndex;
} }
public void setTabFitIndex(int tabFitIndex) { public void setTabFitIndex(int tabFitIndex) {
this.tabFitIndex = tabFitIndex; this.tabFitIndex = tabFitIndex;
} }
public String getTagName() { public String getTagName() {
return tagName; return tagName;
} }
public void setTagName(String tagName) { public void setTagName(String tagName) {
this.tagName = tagName; this.tagName = tagName;
} }
public boolean isSwitchingTab() { public boolean isSwitchingTab() {
return switchingTab; return switchingTab;
} }
public void setSwitchingTab(boolean switchingTab) { public void setSwitchingTab(boolean switchingTab) {
this.switchingTab = switchingTab; this.switchingTab = switchingTab;
} }
private XWCardLayout cardLayout; private XWCardLayout cardLayout;
public XWCardTagLayout(WCardTagLayout widget, Dimension initSize){ public XWCardTagLayout(WCardTagLayout widget, Dimension initSize) {
super(widget, initSize); super(widget, initSize);
} }
/** /**
* 构造函数 * 构造函数
*/ */
public XWCardTagLayout(WCardTagLayout widget, Dimension initSize, XWCardLayout cardLayout) { public XWCardTagLayout(WCardTagLayout widget, Dimension initSize, XWCardLayout cardLayout) {
super(widget, initSize); super(widget, initSize);
this.cardLayout = cardLayout; this.cardLayout = cardLayout;
} }
/** /**
* 添加组件的监听事件 * 添加组件的监听事件
* *
* @param e 事件 * @param e 事件
* * @date 2014-11-25-下午6:20:10
* */
* @date 2014-11-25-下午6:20:10 public void componentAdded(ContainerEvent e) {
* super.componentAdded(e);
*/
public void componentAdded(ContainerEvent e) { if (isSwitchingTab()) {
super.componentAdded(e); return;
}
if (isSwitchingTab()){
return; if (this.cardLayout == null) {
} initCardLayout();
}
if(this.cardLayout == null){
initCardLayout(); int index = this.cardLayout.toData().getWidgetCount();
} //新加一个card
String widgetName = tagName + getTabNameIndex();
int index = this.cardLayout.toData().getWidgetCount(); WTabFitLayout fitLayout = new WTabFitLayout(widgetName, tabFitIndex, currentCard);
//新加一个card fitLayout.setTabNameIndex(getTabNameIndex());
String widgetName = tagName+getTabNameIndex(); XWTabFitLayout tabFitLayout = new XWTabFitLayout(fitLayout, new Dimension());
WTabFitLayout fitLayout = new WTabFitLayout(widgetName,tabFitIndex,currentCard); tabFitLayout.setBackupParent(cardLayout);
fitLayout.setTabNameIndex(getTabNameIndex()); cardLayout.add(tabFitLayout, widgetName);
XWTabFitLayout tabFitLayout = new XWTabFitLayout(fitLayout, new Dimension()); this.cardLayout.toData().setShowIndex(index);
tabFitLayout.setBackupParent(cardLayout); cardLayout.showCard();
cardLayout.add(tabFitLayout, widgetName); }
this.cardLayout.toData().setShowIndex(index);
cardLayout.showCard(); private void initCardLayout() {
} XWCardTitleLayout titleLayout = (XWCardTitleLayout) this.getBackupParent();
XWCardMainBorderLayout borderLayout = (XWCardMainBorderLayout) titleLayout.getBackupParent();
private void initCardLayout(){
XWCardTitleLayout titleLayout = (XWCardTitleLayout)this.getBackupParent(); this.cardLayout = borderLayout.getCardPart();
XWCardMainBorderLayout borderLayout = (XWCardMainBorderLayout)titleLayout.getBackupParent(); }
this.cardLayout = borderLayout.getCardPart();
}
/** /**
* 将WLayout转换为XLayoutContainer * 将WLayout转换为XLayoutContainer
*/ */
public void convert() { public void convert() {
isRefreshing = true; isRefreshing = true;
WCardTagLayout layout = (WCardTagLayout)this.toData(); WCardTagLayout layout = (WCardTagLayout) this.toData();
this.removeAll(); this.removeAll();
for (int i = 0; i < layout.getWidgetCount(); i++) { for (int i = 0; i < layout.getWidgetCount(); i++) {
Widget wgt = layout.getWidget(i); Widget wgt = layout.getWidget(i);
@ -144,82 +139,81 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
} }
isRefreshing = false; isRefreshing = false;
} }
/** /**
* 切换到非添加状态 * 切换到非添加状态
* *
* @return designer 表单设计器 * @return designer 表单设计器
*/ */
public void stopAddingState(FormDesigner designer){ public void stopAddingState(FormDesigner designer) {
designer.stopAddingState(); designer.stopAddingState();
return;
} }
//新增时去tabFitLayout名字中最大的Index+1,防止重名 //新增时去tabFitLayout名字中最大的Index+1,防止重名
private int getTabNameIndex(){ private int getTabNameIndex() {
int tabNameIndex = 0; int tabNameIndex = 0;
WCardLayout layout = this.cardLayout.toData(); WCardLayout layout = this.cardLayout.toData();
int size = layout.getWidgetCount(); int size = layout.getWidgetCount();
if(size < MIN_SIZE){ if (size < MIN_SIZE) {
return tabNameIndex; return tabNameIndex;
} }
for(int i=0;i<size;i++){ for (int i = 0; i < size; i++) {
WTabFitLayout fitLayout = (WTabFitLayout) layout.getWidget(i); WTabFitLayout fitLayout = (WTabFitLayout) layout.getWidget(i);
int tempIndex = fitLayout.getTabNameIndex(); int tempIndex = fitLayout.getTabNameIndex();
tabNameIndex = Math.max(tempIndex, tabNameIndex); tabNameIndex = Math.max(tempIndex, tabNameIndex);
} }
return ++tabNameIndex; return ++tabNameIndex;
} }
/** /**
* 调整tab宽度 * 调整tab宽度
* * <p>
* void * void
*/ */
public void adjustComponentWidth(){ public void adjustComponentWidth() {
} }
/** /**
* 该布局需要隐藏无需对边框进行操作 * 该布局需要隐藏无需对边框进行操作
* @param 边框 *
* * @param
*/ */
public void setBorder(Border border) { public void setBorder(Border border) {
return;
} }
@Override @Override
/** /**
* 该布局隐藏点击该布局时选中相应的tab布局主体 * 该布局隐藏点击该布局时选中相应的tab布局主体
* @param editingMouseListener 监听 * @param editingMouseListener 监听
* @param e 鼠标点击事件 * @param e 鼠标点击事件
* *
*/ */
public void respondClick(EditingMouseListener editingMouseListener, public void respondClick(EditingMouseListener editingMouseListener,
MouseEvent e) { MouseEvent e) {
FormDesigner designer = editingMouseListener.getDesigner(); FormDesigner designer = editingMouseListener.getDesigner();
SelectionModel selectionModel = editingMouseListener.getSelectionModel(); SelectionModel selectionModel = editingMouseListener.getSelectionModel();
XWCardTitleLayout titleLayout = (XWCardTitleLayout) this.getBackupParent(); XWCardTitleLayout titleLayout = (XWCardTitleLayout) this.getBackupParent();
if(titleLayout != null){ if (titleLayout != null) {
XWCardMainBorderLayout mainLayout = (XWCardMainBorderLayout)titleLayout.getBackupParent(); XWCardMainBorderLayout mainLayout = (XWCardMainBorderLayout) titleLayout.getBackupParent();
if(mainLayout != null){ if (mainLayout != null) {
XWCardLayout cardLayout = mainLayout.getCardPart(); XWCardLayout cardLayout = mainLayout.getCardPart();
selectionModel.setSelectedCreator(cardLayout); selectionModel.setSelectedCreator(cardLayout);
} }
} }
if (editingMouseListener.stopEditing()) { if (editingMouseListener.stopEditing()) {
if (this != designer.getRootComponent()) { if (this != designer.getRootComponent()) {
ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, this); ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, this);
editingMouseListener.startEditing(this, adapter.getDesignerEditor(), adapter); editingMouseListener.startEditing(this, adapter.getDesignerEditor(), adapter);
} }
} }
} }
@Override @Override
public XLayoutContainer getTopLayout() { public XLayoutContainer getTopLayout() {
return this.getBackupParent().getTopLayout(); return this.getBackupParent().getTopLayout();
} }
} }

4
designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java

@ -18,7 +18,7 @@ import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.form.ui.widget.BoundsWidget; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -425,7 +425,7 @@ public class XWTabFitLayout extends XWFitLayout {
private void updateCompsWidget(){ private void updateCompsWidget(){
for(int m=0;m<this.getComponentCount();m++){ for(int m=0;m<this.getComponentCount();m++){
XCreator childCreator = this.getXCreator(m); XCreator childCreator = this.getXCreator(m);
BoundsWidget wgt = this.toData().getBoundsWidget(childCreator.toData()); BoundsWidget wgt = (BoundsWidget) this.toData().getBoundsWidget(childCreator.toData());
wgt.setBounds(this.getComponent(m).getBounds()); wgt.setBounds(this.getComponent(m).getBounds());
wgt.setBackupBounds(this.getComponent(m).getBounds()); wgt.setBackupBounds(this.getComponent(m).getBounds());
} }

1388
designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java

File diff suppressed because it is too large Load Diff

172
designer_form/src/com/fr/design/mainframe/ConnectorHelper.java

@ -7,7 +7,7 @@ import java.awt.Rectangle;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import com.fr.form.ui.widget.BoundsWidget; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.design.designer.beans.ConnectorCreator; import com.fr.design.designer.beans.ConnectorCreator;
@ -15,96 +15,96 @@ import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.form.ui.Connector; import com.fr.form.ui.Connector;
public class ConnectorHelper { public class ConnectorHelper {
//这个类是用来画连接线的,暂时用不到 //这个类是用来画连接线的,暂时用不到
public static final int NEAR = 5;
private static double ratio = 0.5;
private final static int ADSORPTION = 15; // 吸附距离
private ArrayList<Point> drawingPoint;
private FormDesigner designer;
private boolean drawing;
public ConnectorHelper(FormDesigner formEditor) { public static final int NEAR = 5;
this.designer = formEditor; private static double ratio = 0.5;
} private final static int ADSORPTION = 15; // 吸附距离
private ArrayList<Point> drawingPoint;
public void resetConnector(Connector connector) { private FormDesigner designer;
ConnectorCreator cc = new ConnectorCreator(designer.getTarget().getContainer(),connector.getStartPoint(),connector.getEndPoint()); private boolean drawing;
connector.addAll(cc.createPointList());
}
public boolean drawLining() {
return this.drawing;
}
public void setDrawLine(boolean d) { public ConnectorHelper(FormDesigner formEditor) {
this.drawing = d; this.designer = formEditor;
} }
private boolean near(Point p1, Point p2) {
return p1.x - p2.x < NEAR && p2.x - p1.x < NEAR && p1.y - p2.y < NEAR && p2.y - p1.y < NEAR;
}
private Point getNearPoint(MouseEvent e, Rectangle r) { public void resetConnector(Connector connector) {
Point p1 = new Point((int) (r.x + r.getWidth() * ratio), r.y); ConnectorCreator cc = new ConnectorCreator(designer.getTarget().getContainer(), connector.getStartPoint(), connector.getEndPoint());
Point p2 = new Point((int) (r.x + r.getWidth()), (int) (r.y + r.getHeight() * ratio)); connector.addAll(cc.createPointList());
Point p3 = new Point((int) (r.x + r.getWidth() * (1 - ratio)), (int) (r.y + r.getHeight())); }
Point p4 = new Point(r.x, (int) (r.y + r.getHeight() * (1 - ratio)));
Point p = new Point(e.getX() + designer.getArea().getHorizontalValue(), e.getY() + designer.getArea().getVerticalValue());
if (near(p, p1)) {
return p1;
} else if (near(p, p2)) {
return p2;
} else if (near(p, p3)) {
return p3;
} else if (near(p, p4)) {
return p4;
}
return null;
}
private ArrayList<Point> createDefalutNode(Point startPoint, Point endPoint) {
long s = System.currentTimeMillis();
ConnectorCreator cc = new ConnectorCreator(designer.getTarget().getContainer(), new Point(startPoint), new Point(endPoint));
ArrayList<Point> p = cc.createPointList();
long e = System.currentTimeMillis();
return p;
}
public void drawAuxiliaryLine(Graphics g) { public boolean drawLining() {
Point startPoint = designer.getStateModel().getStartPoint(); return this.drawing;
Point endPoint = designer.getStateModel().getEndPoint(); }
drawingPoint = createDefalutNode(startPoint, endPoint);
Point[] p = drawingPoint.toArray(new Point[drawingPoint.size()]);
g.setColor(Color.green);
for (int i = 0; i < p.length - 1; i++) {
GraphHelper.drawLine(g, p[i].x - designer.getArea().getHorizontalValue(), p[i].y
- designer.getArea().getVerticalValue(), p[i + 1].x - designer.getArea().getHorizontalValue(),
p[i + 1].y - designer.getArea().getVerticalValue(), Constants.LINE_HAIR);
}
}
public void createDefalutLine() { public void setDrawLine(boolean d) {
if (drawingPoint != null this.drawing = d;
&& drawingPoint.size() > 1 }
&& ConnectorCreator.getMinimumDistance(drawingPoint.get(0), drawingPoint.get(drawingPoint.size() - 1)) > ADSORPTION) {
((XWAbsoluteLayout) designer.getRootComponent()).addConnector(new Connector().addAll(drawingPoint));
}
drawingPoint = null;
}
public Point getNearWidgetPoint(MouseEvent e) { private boolean near(Point p1, Point p2) {
BoundsWidget widget; return p1.x - p2.x < NEAR && p2.x - p1.x < NEAR && p1.y - p2.y < NEAR && p2.y - p1.y < NEAR;
Point p = null; }
for (int i = 0, size = designer.getTarget().getContainer().getWidgetCount(); i < size; i++) {
widget = ((BoundsWidget) designer.getTarget().getContainer().getWidget(i)); private Point getNearPoint(MouseEvent e, Rectangle r) {
if (widget.isVisible()) { Point p1 = new Point((int) (r.x + r.getWidth() * ratio), r.y);
if ((p = getNearPoint(e, widget.getBounds())) != null) { Point p2 = new Point((int) (r.x + r.getWidth()), (int) (r.y + r.getHeight() * ratio));
break; Point p3 = new Point((int) (r.x + r.getWidth() * (1 - ratio)), (int) (r.y + r.getHeight()));
} Point p4 = new Point(r.x, (int) (r.y + r.getHeight() * (1 - ratio)));
} Point p = new Point(e.getX() + designer.getArea().getHorizontalValue(), e.getY() + designer.getArea().getVerticalValue());
} if (near(p, p1)) {
return p; return p1;
} } else if (near(p, p2)) {
return p2;
} else if (near(p, p3)) {
return p3;
} else if (near(p, p4)) {
return p4;
}
return null;
}
private ArrayList<Point> createDefalutNode(Point startPoint, Point endPoint) {
long s = System.currentTimeMillis();
ConnectorCreator cc = new ConnectorCreator(designer.getTarget().getContainer(), new Point(startPoint), new Point(endPoint));
ArrayList<Point> p = cc.createPointList();
long e = System.currentTimeMillis();
return p;
}
public void drawAuxiliaryLine(Graphics g) {
Point startPoint = designer.getStateModel().getStartPoint();
Point endPoint = designer.getStateModel().getEndPoint();
drawingPoint = createDefalutNode(startPoint, endPoint);
Point[] p = drawingPoint.toArray(new Point[drawingPoint.size()]);
g.setColor(Color.green);
for (int i = 0; i < p.length - 1; i++) {
GraphHelper.drawLine(g, p[i].x - designer.getArea().getHorizontalValue(), p[i].y
- designer.getArea().getVerticalValue(), p[i + 1].x - designer.getArea().getHorizontalValue(),
p[i + 1].y - designer.getArea().getVerticalValue(), Constants.LINE_HAIR);
}
}
public void createDefalutLine() {
if (drawingPoint != null
&& drawingPoint.size() > 1
&& ConnectorCreator.getMinimumDistance(drawingPoint.get(0), drawingPoint.get(drawingPoint.size() - 1)) > ADSORPTION) {
((XWAbsoluteLayout) designer.getRootComponent()).addConnector(new Connector().addAll(drawingPoint));
}
drawingPoint = null;
}
public Point getNearWidgetPoint(MouseEvent e) {
BoundsWidget widget;
Point p = null;
for (int i = 0, size = designer.getTarget().getContainer().getWidgetCount(); i < size; i++) {
widget = ((BoundsWidget) designer.getTarget().getContainer().getWidget(i));
if (widget.isVisible()) {
if ((p = getNearPoint(e, widget.getBounds())) != null) {
break;
}
}
}
return p;
}
} }

1239
designer_form/src/com/fr/design/mainframe/EditingMouseListener.java

File diff suppressed because it is too large Load Diff

17
designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java

@ -43,7 +43,7 @@ public class FormCreatorDropTarget extends DropTarget {
* 当前添加模式对应的model * 当前添加模式对应的model
*/ */
private AddingModel addingModel; private AddingModel addingModel;
private final static int GAP = 30; private static final int GAP = 30;
private JWindow promptWindow = new JWindow(); private JWindow promptWindow = new JWindow();
private UIButton promptButton = new UIButton("", BaseUtils.readIcon(IconPathConstants.FORBID_ICON_PATH)); private UIButton promptButton = new UIButton("", BaseUtils.readIcon(IconPathConstants.FORBID_ICON_PATH));
@ -59,10 +59,11 @@ public class FormCreatorDropTarget extends DropTarget {
XCreator hoveredComponent = designer.getComponentAt(x, y); XCreator hoveredComponent = designer.getComponentAt(x, y);
// 获取该组件所在的焦点容器 // 获取该组件所在的焦点容器
XLayoutContainer container = XCreatorUtils.getHotspotContainer(hoveredComponent); XLayoutContainer container = XCreatorUtils.getHotspotContainer(hoveredComponent);
//cardTagLayout里用到
container.stopAddingState(designer);
boolean success = false; boolean success = false;
if (container != null) { if (container != null) {
//XWCardTagLayout 切换添加状态到普通状态
container.stopAddingState(designer);
// 如果是容器,则调用其acceptComponent接受组件 // 如果是容器,则调用其acceptComponent接受组件
AddingModel model = designer.getAddingModel(); AddingModel model = designer.getAddingModel();
@ -129,9 +130,7 @@ public class FormCreatorDropTarget extends DropTarget {
//提示组件是否可以拖入 //提示组件是否可以拖入
promptUser(x, y, container); promptUser(x, y, container);
if (container != null) { if (container != null) {
dealWithContainer(x, y, container); dealWithContainer(x, y, container);
} else { } else {
// 如果鼠标不在任何组件上,则取消提示器 // 如果鼠标不在任何组件上,则取消提示器
designer.setPainter(null); designer.setPainter(null);
@ -197,11 +196,9 @@ public class FormCreatorDropTarget extends DropTarget {
private void promptWidgetForbidEnter(int x, int y, XLayoutContainer container) { private void promptWidgetForbidEnter(int x, int y, XLayoutContainer container) {
container.setBorder(BorderFactory.createLineBorder(Color.RED, Constants.LINE_MEDIUM)); container.setBorder(BorderFactory.createLineBorder(Color.RED, Constants.LINE_MEDIUM));
int screen_X = (int) designer.getArea().getLocationOnScreen().getX(); int screenX = designer.getArea().getLocationOnScreen().x;
int screen_Y = (int) designer.getArea().getLocationOnScreen().getY(); int screenY = designer.getArea().getLocationOnScreen().y;
this.promptWindow.setSize(promptWindow.getPreferredSize()); promptWindow.setLocation(screenX + x + GAP, screenY + y + GAP);
this.promptWindow.setPreferredSize(promptWindow.getPreferredSize());
promptWindow.setLocation(screen_X + x + GAP, screen_Y + y + GAP);
promptWindow.setVisible(true); promptWindow.setVisible(true);
} }

245
designer_form/src/com/fr/design/mainframe/FormDesigner.java

@ -6,7 +6,10 @@ import com.fr.design.DesignState;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.Painter; 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.FormDeleteAction;
import com.fr.design.designer.beans.actions.PasteAction;
import com.fr.design.designer.beans.adapters.layout.FRParameterLayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRParameterLayoutAdapter;
import com.fr.design.designer.beans.events.CreatorEventListenerTable; import com.fr.design.designer.beans.events.CreatorEventListenerTable;
import com.fr.design.designer.beans.events.DesignerEditListener; 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.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.plugin.ExtraClassManager;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
@ -65,11 +67,10 @@ import java.util.List;
/** /**
* 设计界面组件该组件是界面设计工具的核心主要负责的是被设计界面的显示界面设计操作状态的 显示编辑状态的显示等等 * 设计界面组件该组件是界面设计工具的核心主要负责的是被设计界面的显示界面设计操作状态的 显示编辑状态的显示等等
*/ */
public class FormDesigner extends TargetComponent<Form> implements TreeSelectionListener, InvocationHandler, BaseFormDesigner ,ParaDefinitePane{ public class FormDesigner extends TargetComponent<Form> implements TreeSelectionListener, InvocationHandler, BaseFormDesigner, ParaDefinitePane {
protected static final ArrayList<String> NAME_ARRAY_LIST = new ArrayList<String>( 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")}) 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); protected static final Dimension LARGE_PREFERRED_SIZE = new Dimension(WBorderLayout.DEFAULT_WIDTH, WBorderLayout.DEFAULT_HEIGHT);
private int paraHeight = 0; private int paraHeight = 0;
@ -81,7 +82,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
private XLayoutContainer paraComponent; private XLayoutContainer paraComponent;
private boolean drawLineMode; private boolean drawLineMode;
private FormArea formArea; private FormArea formArea;
private ConnectorHelper ConnectorHelper; private ConnectorHelper connectorHelper;
private boolean isReportBlockEditing = false; private boolean isReportBlockEditing = false;
//组件重叠 //组件重叠
@ -104,7 +105,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
// 编辑状态的事件表 // 编辑状态的事件表
private CreatorEventListenerTable edit; private CreatorEventListenerTable edit;
protected Action[] designer_actions; protected Action[] designerActions;
private FormDesignerModeForSpecial<?> desigerMode; private FormDesignerModeForSpecial<?> desigerMode;
private Action switchAction; private Action switchAction;
private FormElementCaseContainerProvider elementCaseContainer; private FormElementCaseContainerProvider elementCaseContainer;
@ -159,7 +160,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
ParameterPropertyPane.getInstance().populateBean(this); ParameterPropertyPane.getInstance().populateBean(this);
} }
public Parameter[] getNoRepeatParas(Parameter[] paras){ public Parameter[] getNoRepeatParas(Parameter[] paras) {
List<Parameter> paraList = new ArrayList<Parameter>(); List<Parameter> paraList = new ArrayList<Parameter>();
java.util.Set set = new java.util.HashSet(); java.util.Set set = new java.util.HashSet();
for (Parameter p : paras) { for (Parameter p : paras) {
@ -171,23 +172,23 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
return paraList.toArray(new Parameter[paraList.size()]); return paraList.toArray(new Parameter[paraList.size()]);
} }
public void setParameterArray(Parameter[] ps){ public void setParameterArray(Parameter[] ps) {
parameterArray = ps; parameterArray = ps;
} }
public Parameter[] getParameterArray(){ public Parameter[] getParameterArray() {
return parameterArray; return parameterArray;
} }
/** /**
* 刷新参数 * 刷新参数
*/ */
public void refreshParameter(){ public void refreshParameter() {
XLayoutContainer rootContainer = this.getParaComponent(); XLayoutContainer rootContainer = this.getParaComponent();
if (rootContainer != null){ if (rootContainer != null) {
java.util.List<String> namelist = new ArrayList<String>(); java.util.List<String> namelist = new ArrayList<String>();
rootContainer.getAllXCreatorNameList(rootContainer,namelist); rootContainer.getAllXCreatorNameList(rootContainer, namelist);
// parameterArray是报表的所有参数, nameList是已经在参数面板添加过控件的参数名 // parameterArray是报表的所有参数, nameList是已经在参数面板添加过控件的参数名
// 与已有的参数列表比较 如果已经存在 就除去 // 与已有的参数列表比较 如果已经存在 就除去
Parameter[] ps = getParameterArray(); Parameter[] ps = getParameterArray();
@ -201,7 +202,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(this).getPreferredSize().height); EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(this).getPreferredSize().height);
} }
private void removeSame(Parameter[] parameters, List<String> namelist){ private void removeSame(Parameter[] parameters, List<String> namelist) {
for (Parameter parameter : parameters) { for (Parameter parameter : parameters) {
for (String name : namelist) { for (String name : namelist) {
if (name.equalsIgnoreCase(parameter.getName())) { if (name.equalsIgnoreCase(parameter.getName())) {
@ -214,20 +215,22 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 是否有查询按钮 * 是否有查询按钮
* @return 有无查询按钮 *
* @return 有无查询按钮
*/ */
public boolean isWithQueryButton(){ public boolean isWithQueryButton() {
XLayoutContainer rootContainer = this.getParaComponent(); XLayoutContainer rootContainer = this.getParaComponent();
return rootContainer != null && rootContainer.SearchQueryCreators(rootContainer); return rootContainer != null && rootContainer.SearchQueryCreators(rootContainer);
} }
/** /**
* 加入参数到参数面板 * 加入参数到参数面板
*
* @param parameter 参数 * @param parameter 参数
* @return 是否加入 * @return 是否加入
*/ */
public void addingParameter2Editor(Parameter parameter){ public void addingParameter2Editor(Parameter parameter) {
if(getParaComponent() == null){ if (getParaComponent() == null) {
addParaPaneTooltips(); addParaPaneTooltips();
return; return;
} }
@ -242,11 +245,11 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
if (!(this.autoAddComponent(xLabel, H_COMPONENT_GAP * (currentIndex % NUM_IN_A_LINE) if (!(this.autoAddComponent(xLabel, H_COMPONENT_GAP * (currentIndex % NUM_IN_A_LINE)
+ FIRST_H_LOCATION, FIRST_V_LOCATION + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE)))) { + FIRST_H_LOCATION, FIRST_V_LOCATION + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE)))) {
return ; return;
} }
if (!(this.autoAddComponent(xCreator, H_COMPONENT_GAP * (currentIndex % NUM_IN_A_LINE) if (!(this.autoAddComponent(xCreator, H_COMPONENT_GAP * (currentIndex % NUM_IN_A_LINE)
+ SECOND_H_LOCATION, FIRST_V_LOCATION + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE)))) { + SECOND_H_LOCATION, FIRST_V_LOCATION + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE)))) {
return ; return;
} }
currentIndex++; currentIndex++;
parameterArray = (Parameter[]) ArrayUtils.removeElement(parameterArray, parameter); parameterArray = (Parameter[]) ArrayUtils.removeElement(parameterArray, parameter);
@ -256,11 +259,12 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 加入参数到参数面板有查询按钮 * 加入参数到参数面板有查询按钮
*
* @param parameter 参数 * @param parameter 参数
* @return 是否加入 * @return 是否加入
*/ */
public void addingParameter2EditorWithQueryButton(Parameter parameter){ public void addingParameter2EditorWithQueryButton(Parameter parameter) {
if(getParaComponent() == null){ if (getParaComponent() == null) {
addParaPaneTooltips(); addParaPaneTooltips();
return; return;
} }
@ -276,12 +280,12 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
if (!(this.autoAddComponent(xLabel, FIRST_H_LOCATION, FIRST_V_LOCATION + V_COMPONENT_GAP if (!(this.autoAddComponent(xLabel, FIRST_H_LOCATION, FIRST_V_LOCATION + V_COMPONENT_GAP
* (currentIndex / NUM_IN_A_LINE)))) { * (currentIndex / NUM_IN_A_LINE)))) {
return ; return;
} }
if (!(this.autoAddComponent(xCreator, SECOND_H_LOCATION, FIRST_V_LOCATION + V_COMPONENT_GAP if (!(this.autoAddComponent(xCreator, SECOND_H_LOCATION, FIRST_V_LOCATION + V_COMPONENT_GAP
* (currentIndex / NUM_IN_A_LINE)))) { * (currentIndex / NUM_IN_A_LINE)))) {
return ; return;
} }
FormSubmitButton formSubmitButton = new FormSubmitButton(); FormSubmitButton formSubmitButton = new FormSubmitButton();
formSubmitButton.setWidgetName("Search"); formSubmitButton.setWidgetName("Search");
@ -289,7 +293,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
xCreator = XCreatorUtils.createXCreator(formSubmitButton); xCreator = XCreatorUtils.createXCreator(formSubmitButton);
if (!(this.autoAddComponent(xCreator, 270, FIRST_V_LOCATION + V_COMPONENT_GAP if (!(this.autoAddComponent(xCreator, 270, FIRST_V_LOCATION + V_COMPONENT_GAP
* (currentIndex / NUM_IN_A_LINE)))) { * (currentIndex / NUM_IN_A_LINE)))) {
return ; return;
} }
currentIndex = currentIndex + NUM_IN_A_LINE - currentIndex % NUM_IN_A_LINE; currentIndex = currentIndex + NUM_IN_A_LINE - currentIndex % NUM_IN_A_LINE;
parameterArray = (Parameter[]) ArrayUtils.removeElement(parameterArray, parameter); parameterArray = (Parameter[]) ArrayUtils.removeElement(parameterArray, parameter);
@ -300,8 +304,8 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 一键添加所有参数 * 一键添加所有参数
*/ */
public void addingAllParameter2Editor(){ public void addingAllParameter2Editor() {
if(getParaComponent() == null){ if (getParaComponent() == null) {
addParaPaneTooltips(); addParaPaneTooltips();
return; return;
} }
@ -350,16 +354,17 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
EastRegionContainerPane.getInstance().refreshDownPane(); EastRegionContainerPane.getInstance().refreshDownPane();
} }
private void addParaPaneTooltips(){ private void addParaPaneTooltips() {
JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),Inter.getLocText("FR-Designer-Form-Please_Drag_ParaPane"), JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer-Form-Please_Drag_ParaPane"),
Inter.getLocText("FR-Designer_Tooltips"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); Inter.getLocText("FR-Designer_Tooltips"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
} }
/** /**
* 自动添加组件 * 自动添加组件
* @param xCreator 组件 *
* @param x 横坐标 * @param xCreator 组件
* @param y 纵坐标 * @param x 横坐标
* @param y 纵坐标
* @return 是否添加成功 * @return 是否添加成功
*/ */
public boolean autoAddComponent(XCreator xCreator, int x, int y) { public boolean autoAddComponent(XCreator xCreator, int x, int y) {
@ -375,10 +380,11 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 在参数很多时全部添加的时候可以向下一次排版若去掉就会在参数面板堆到一起 * 在参数很多时全部添加的时候可以向下一次排版若去掉就会在参数面板堆到一起
*
* @param creator 组件 * @param creator 组件
* @param x 长度 * @param x 长度
* @param y 长度 * @param y 长度
* @param layout 布局 * @param layout 布局
* @return 是否扩展 * @return 是否扩展
*/ */
public boolean prepareForAdd(XCreator creator, int x, int y, XWParameterLayout layout) { public boolean prepareForAdd(XCreator creator, int x, int y, XWParameterLayout layout) {
@ -404,9 +410,9 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 加入参数面板 * 加入参数面板
*/ */
public void addParaComponent(){ public void addParaComponent() {
if (paraComponent != null) { if (paraComponent != null) {
return ; return;
} }
paraHeight = WBorderLayout.DEFAULT_SIZE; paraHeight = WBorderLayout.DEFAULT_SIZE;
paraComponent = new XWParameterLayout(); paraComponent = new XWParameterLayout();
@ -414,7 +420,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
paraComponent.setSize(paraComponent.initEditorSize()); paraComponent.setSize(paraComponent.initEditorSize());
XWBorderLayout formLayoutContainer = (XWBorderLayout) rootComponent.getParent(); XWBorderLayout formLayoutContainer = (XWBorderLayout) rootComponent.getParent();
formLayoutContainer.toData().setNorthSize(paraHeight); formLayoutContainer.toData().setNorthSize(paraHeight);
formLayoutContainer.add(paraComponent,WBorderLayout.NORTH); formLayoutContainer.add(paraComponent, WBorderLayout.NORTH);
//设下northSize,增加para后,重置border大小,这时候para和root的大小会自适应调整 //设下northSize,增加para后,重置border大小,这时候para和root的大小会自适应调整
formLayoutContainer.setSize(formLayoutContainer.getWidth(), formLayoutContainer.getHeight() + paraHeight); formLayoutContainer.setSize(formLayoutContainer.getWidth(), formLayoutContainer.getHeight() + paraHeight);
selectionModel.reset(); selectionModel.reset();
@ -424,30 +430,33 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
} }
/** /**
* 返回根节点父容器 * 返回根节点父容器
* @return 父容器 *
* @return 父容器
*/ */
public Component getTopContainer(){ public Component getTopContainer() {
if(rootComponent != null){ if (rootComponent != null) {
// 返回root所在的父容器,非designer // 返回root所在的父容器,非designer
return LayoutUtils.getTopContainer(rootComponent); return LayoutUtils.getTopContainer(rootComponent);
} }
return XCreatorUtils.createXCreator(this.getTarget().getContainer()); return XCreatorUtils.createXCreator(this.getTarget().getContainer());
} }
/** /**
* 返回参数界面高度 * 返回参数界面高度
* @return para高度 *
* @return para高度
*/ */
public int getParaHeight(){ public int getParaHeight() {
return paraHeight; return paraHeight;
} }
/** /**
* 重置para的高度 * 重置para的高度
* @param height 高度 *
* @param height 高度
*/ */
public void setParaHeight(int height){ public void setParaHeight(int height) {
XWBorderLayout container = (XWBorderLayout) getTopContainer(); XWBorderLayout container = (XWBorderLayout) getTopContainer();
container.toData().setNorthSize(height); container.toData().setNorthSize(height);
container.setSize(container.getWidth(), container.getHeight() + height - getParaHeight()); container.setSize(container.getWidth(), container.getHeight() + height - getParaHeight());
@ -457,7 +466,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 删除参数界面 * 删除参数界面
*/ */
public void removeParaComponent(){ public void removeParaComponent() {
XWBorderLayout formLayoutContainer = (XWBorderLayout) getTopContainer(); XWBorderLayout formLayoutContainer = (XWBorderLayout) getTopContainer();
formLayoutContainer.toData().removeWidget(paraComponent.toData()); formLayoutContainer.toData().removeWidget(paraComponent.toData());
paraHeight = 0; paraHeight = 0;
@ -472,41 +481,42 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 切换 * 切换
* @param elementCaseContainer 容器 *
* @param elementCaseContainer 容器
*/ */
public void switchTab(FormElementCaseContainerProvider elementCaseContainer){ public void switchTab(FormElementCaseContainerProvider elementCaseContainer) {
if(this.switchAction == null){ if (this.switchAction == null) {
return; return;
} }
this.elementCaseContainer = elementCaseContainer; this.elementCaseContainer = elementCaseContainer;
this.switchAction.actionPerformed(null); this.switchAction.actionPerformed(null);
} }
public void setElementCaseContainer(FormElementCaseContainerProvider elementCaseContainer){ public void setElementCaseContainer(FormElementCaseContainerProvider elementCaseContainer) {
this.elementCaseContainer = elementCaseContainer; this.elementCaseContainer = elementCaseContainer;
} }
public FormElementCaseProvider getElementCase(){ public FormElementCaseProvider getElementCase() {
return this.elementCaseContainer.getElementCase(); return this.elementCaseContainer.getElementCase();
} }
public String getElementCaseContainerName(){ public String getElementCaseContainerName() {
return this.elementCaseContainer.getElementCaseContainerName(); return this.elementCaseContainer.getElementCaseContainerName();
} }
public void setElementCase(FormElementCaseProvider elementCase){ public void setElementCase(FormElementCaseProvider elementCase) {
this.elementCaseContainer.setElementCase(elementCase); this.elementCaseContainer.setElementCase(elementCase);
} }
public void setElementCaseBackground(BufferedImage image){ public void setElementCaseBackground(BufferedImage image) {
this.elementCaseContainer.setBackground(image); this.elementCaseContainer.setBackground(image);
} }
public Dimension getElementCaseContainerSize(){ public Dimension getElementCaseContainerSize() {
return this.elementCaseContainer.getSize(); return this.elementCaseContainer.getSize();
} }
public FormElementCaseContainerProvider getElementCaseContainer(){ public FormElementCaseContainerProvider getElementCaseContainer() {
return this.elementCaseContainer; return this.elementCaseContainer;
} }
@ -524,6 +534,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 增加监听事件 * 增加监听事件
*
* @param listener 界面组件编辑事件 * @param listener 界面组件编辑事件
*/ */
public void addDesignerEditListener(DesignerEditListener listener) { public void addDesignerEditListener(DesignerEditListener listener) {
@ -539,15 +550,15 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 表单则判断参数面板是否为绝对布局 * 表单则判断参数面板是否为绝对布局
*
* @return 是则返回true * @return 是则返回true
*/ */
public boolean hasWAbsoluteLayout() { public boolean hasWAbsoluteLayout() {
if (paraComponent != null && paraComponent.acceptType(XWParameterLayout.class)){ if (paraComponent != null && paraComponent.acceptType(XWParameterLayout.class)) {
return true; return true;
} } else {
else{
if (this.getSelectionModel().getSelection().getSelectedCreator().getParent() != null if (this.getSelectionModel().getSelection().getSelectedCreator().getParent() != null
&& ((XLayoutContainer)this.getSelectionModel().getSelection().getSelectedCreator().getParent()).acceptType(XWAbsoluteLayout.class)){ && ((XLayoutContainer) this.getSelectionModel().getSelection().getSelectedCreator().getParent()).acceptType(XWAbsoluteLayout.class)) {
return true; return true;
} }
} }
@ -555,7 +566,8 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
} }
/** /**
* 设置是否为报表块编辑 * 设置是否为报表块编辑
*
* @param isEditing 是否为报表块编辑 * @param isEditing 是否为报表块编辑
*/ */
public void setReportBlockEditing(boolean isEditing) { public void setReportBlockEditing(boolean isEditing) {
@ -564,25 +576,27 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 是否为报表块编辑 * 是否为报表块编辑
*
* @return 是否为报表块编辑 * @return 是否为报表块编辑
*/ */
public boolean isReportBlockEditing() { public boolean isReportBlockEditing() {
return this.isReportBlockEditing; return this.isReportBlockEditing;
} }
public void setWidgetsIntersect(boolean isWidgetsIntersect){ public void setWidgetsIntersect(boolean isWidgetsIntersect) {
this.isWidgetsIntersect = isWidgetsIntersect; this.isWidgetsIntersect = isWidgetsIntersect;
} }
public boolean isWidgetsIntersect(){ public boolean isWidgetsIntersect() {
return this.isWidgetsIntersect; return this.isWidgetsIntersect;
} }
/** /**
* 是否重命名控件 * 是否重命名控件
*
* @param creator 组件 * @param creator 组件
* @param newName 新的组件名 * @param newName 新的组件名
* @return 组件名有变化且不和其他一样返回true * @return 组件名有变化且不和其他一样返回true
*/ */
public boolean renameCreator(XCreator creator, String newName) { public boolean renameCreator(XCreator creator, String newName) {
if (ComparatorUtils.equals(creator.toData().getWidgetName(), newName)) { if (ComparatorUtils.equals(creator.toData().getWidgetName(), newName)) {
@ -598,6 +612,12 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
return true; return true;
} }
public void showMessageDialog(String message) {
JOptionPane.showMessageDialog(this, message, Inter.getLocText("FR-Designer_Alert"), JOptionPane.WARNING_MESSAGE);
FormSelectionUtils.rebuildSelection(this);
repaint();
}
/** /**
* 保存参数界面的宽度 * 保存参数界面的宽度
* *
@ -609,16 +629,17 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 更新界面布局重绘 * 更新界面布局重绘
* @param proxy 动态代理类 *
* @param proxy 动态代理类
* @param method 接口方法 * @param method 接口方法
* @param args 参数 * @param args 参数
* @return 不返回任何对象 * @return 不返回任何对象
*/ */
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if(rootComponent != null){ if (rootComponent != null) {
LayoutUtils.layoutRootContainer(rootComponent); LayoutUtils.layoutRootContainer(rootComponent);
} }
if(paraComponent != null){ if (paraComponent != null) {
LayoutUtils.layoutRootContainer(paraComponent); LayoutUtils.layoutRootContainer(paraComponent);
} }
repaint(); repaint();
@ -654,6 +675,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 增加组件事件 * 增加组件事件
*
* @param h 动态代理 * @param h 动态代理
*/ */
public void addInvocationHandler(InvocationHandler h) { public void addInvocationHandler(InvocationHandler h) {
@ -678,7 +700,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
} }
/** /**
* 设置其UI类为DesignerUI负责渲染 * 设置其UI类为DesignerUI负责渲染
*/ */
@Override @Override
public void updateUI() { public void updateUI() {
@ -741,15 +763,13 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 更新边框线状态 * 更新边框线状态
*
* @param e 鼠标事件 * @param e 鼠标事件
*/ */
public void updateDrawLineMode(MouseEvent e) { public void updateDrawLineMode(MouseEvent e) {
Point p = ConnectorHelper.getNearWidgetPoint(e); Point p = connectorHelper.getNearWidgetPoint(e);
if (p == null) { if (p == null && getComponentAt(e) == rootComponent) {
XComponent comp = getComponentAt(e); p = new Point(e.getX() + formArea.getHorizontalValue(), e.getY() + formArea.getVerticalValue());
if (comp == rootComponent) {
p = new Point(e.getX() + formArea.getHorizontalValue(), e.getY() + formArea.getVerticalValue());
}
} }
stateModel.startDrawLine(p); stateModel.startDrawLine(p);
} }
@ -761,7 +781,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
// 撤销恢复操作都会refreshRoot,这时候的target.getContainer里的widget会和之前不一样,所以不用root判断来取 // 撤销恢复操作都会refreshRoot,这时候的target.getContainer里的widget会和之前不一样,所以不用root判断来取
XLayoutContainer formLayoutContainer = (XLayoutContainer) XCreatorUtils.createXCreator(this.getTarget().getContainer()); XLayoutContainer formLayoutContainer = (XLayoutContainer) XCreatorUtils.createXCreator(this.getTarget().getContainer());
// 布局默认都是1,底层的border改为0,不然没意义 // 布局默认都是1,底层的border改为0,不然没意义
this.getTarget().getContainer().setMargin(new PaddingMargin(0,0,0,0)); this.getTarget().getContainer().setMargin(new PaddingMargin(0, 0, 0, 0));
formLayoutContainer.setBorder(null); formLayoutContainer.setBorder(null);
if (formLayoutContainer.acceptType(XWBorderLayout.class)) { if (formLayoutContainer.acceptType(XWBorderLayout.class)) {
WBorderLayout borderLayout = (WBorderLayout) formLayoutContainer.toData(); WBorderLayout borderLayout = (WBorderLayout) formLayoutContainer.toData();
@ -774,7 +794,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
refreshNorth(northWidget, formLayoutContainer); refreshNorth(northWidget, formLayoutContainer);
refreshCenter(centerWidget, formLayoutContainer); refreshCenter(centerWidget, formLayoutContainer);
} else { } else {
formLayoutContainer.setSize(LARGE_PREFERRED_SIZE); formLayoutContainer.setSize(LARGE_PREFERRED_SIZE);
setRootComponent(formLayoutContainer); setRootComponent(formLayoutContainer);
} }
@ -790,9 +810,9 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
} }
XLayoutContainer northContainer = (XLayoutContainer) XCreatorUtils.createXCreator(northWidget); XLayoutContainer northContainer = (XLayoutContainer) XCreatorUtils.createXCreator(northWidget);
paraHeight = ((XWBorderLayout)formLayoutContainer).toData().getNorthSize(); paraHeight = ((XWBorderLayout) formLayoutContainer).toData().getNorthSize();
paraComponent = northContainer; paraComponent = northContainer;
northContainer.setSize(0,paraHeight); northContainer.setSize(0, paraHeight);
formLayoutContainer.add(northContainer, WBorderLayout.NORTH); formLayoutContainer.add(northContainer, WBorderLayout.NORTH);
} }
@ -841,14 +861,16 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 是否是报表的参数面板 * 是否是报表的参数面板
* @return (表单的) *
* @return (表单的)
*/ */
public boolean isFormParaDesigner(){ public boolean isFormParaDesigner() {
return false; return false;
} }
/** /**
* 是否为底层容器 * 是否为底层容器
*
* @param comp 组件 * @param comp 组件
* @return 是则返回true * @return 是则返回true
*/ */
@ -923,10 +945,10 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
} }
public SelectionModel getSelectionModel() { public SelectionModel getSelectionModel() {
if (paraComponent!=null){ if (paraComponent != null) {
paraComponent.setSize(paraComponent.getWidth(),getParaHeight()); paraComponent.setSize(paraComponent.getWidth(), getParaHeight());
Rectangle rec = rootComponent.getBounds(); Rectangle rec = rootComponent.getBounds();
rootComponent.setBounds(rec.x,getParaHeight(),rec.width,rec.height); rootComponent.setBounds(rec.x, getParaHeight(), rec.width, rec.height);
} }
return selectionModel; return selectionModel;
} }
@ -941,6 +963,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 拖拽准备 * 拖拽准备
*
* @param xCreator 组件 * @param xCreator 组件
*/ */
public void startDraggingBean(XCreator xCreator) { public void startDraggingBean(XCreator xCreator) {
@ -953,11 +976,12 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
} }
/** /**
* 拖拽时相关处理 * 拖拽时相关处理
* @param xCreator 组件 *
* @param xCreator 组件
* @param lastPressEvent 鼠标事件 * @param lastPressEvent 鼠标事件
* @param x 坐标x * @param x 坐标x
* @param y 坐标y * @param y 坐标y
*/ */
public void startDraggingComponent(XCreator xCreator, MouseEvent lastPressEvent, int x, int y) { public void startDraggingComponent(XCreator xCreator, MouseEvent lastPressEvent, int x, int y) {
// 根据所选择的组件的BeanInfo生成相应的AddingModel // 根据所选择的组件的BeanInfo生成相应的AddingModel
@ -978,6 +1002,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 改变组件值 * 改变组件值
*
* @param e 组件选择事件 * @param e 组件选择事件
*/ */
@Override @Override
@ -1024,6 +1049,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 是否支持权限编辑 * 是否支持权限编辑
*
* @return 是则返回true * @return 是则返回true
*/ */
public boolean isSupportAuthority() { public boolean isSupportAuthority() {
@ -1048,7 +1074,8 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
} }
/** /**
* 是否含有action名 * 是否含有action名
*
* @param name action名 * @param name action名
* @return 有则返回true * @return 有则返回true
*/ */
@ -1058,6 +1085,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 显示组件 * 显示组件
*
* @param comp 组件 * @param comp 组件
*/ */
public void makeVisible(XCreator comp) { public void makeVisible(XCreator comp) {
@ -1088,16 +1116,16 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 返回复制粘贴删除等动作 * 返回复制粘贴删除等动作
* 鼠标右键菜单
*
* @return 同上 * @return 同上
*/ */
public Action[] getActions() { public Action[] getActions() {
if (designer_actions == null) { if (designerActions == null) {
//先把复制粘贴按钮去掉,只留下删除 designerActions = new Action[]{new CutAction(this), new CopyAction(this), new PasteAction(this),
// designer_actions = new Action[]{new CutAction(this), new CopyAction(this), new PasteAction(this), new FormDeleteAction(this)};
// new FormDeleteAction(this)};
designer_actions = new Action[]{new FormDeleteAction(this)};
} }
return designer_actions; return designerActions;
} }
protected Border getOuterBorder() { protected Border getOuterBorder() {
@ -1120,6 +1148,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 返回表单区域 * 返回表单区域
*
* @return 表单区域 * @return 表单区域
*/ */
public FormArea getArea() { public FormArea getArea() {
@ -1128,6 +1157,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 设置上层区域 * 设置上层区域
*
* @param formArea 表单区域 * @param formArea 表单区域
*/ */
public void setParent(FormArea formArea) { public void setParent(FormArea formArea) {
@ -1136,14 +1166,15 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 绘制组件根节点 * 绘制组件根节点
*
* @param clipg 图形 * @param clipg 图形
*/ */
public void paintContent(Graphics clipg) { public void paintContent(Graphics clipg) {
rootComponent.paint(clipg); rootComponent.paint(clipg);
} }
public void paintPara(Graphics clipg){ public void paintPara(Graphics clipg) {
if(paraComponent != null){ if (paraComponent != null) {
paraComponent.paint(clipg); paraComponent.paint(clipg);
} }
} }
@ -1157,14 +1188,16 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 返回连线类 * 返回连线类
*
* @return ConnectorHelper类 * @return ConnectorHelper类
*/ */
public ConnectorHelper getDrawLineHelper() { public ConnectorHelper getDrawLineHelper() {
return ConnectorHelper; return connectorHelper;
} }
/** /**
* 是否画线模式 * 是否画线模式
*
* @return 是则返回true * @return 是则返回true
*/ */
public boolean isDrawLineMode() { public boolean isDrawLineMode() {
@ -1173,6 +1206,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 设置DrawLineMode * 设置DrawLineMode
*
* @param mode 是or或 * @param mode 是or或
*/ */
public void setDrawLineMode(boolean mode) { public void setDrawLineMode(boolean mode) {
@ -1199,6 +1233,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 返回表单控件权限编辑pane * 返回表单控件权限编辑pane
*
* @return 同上 * @return 同上
*/ */
public AuthorityEditPane createAuthorityEditPane() { public AuthorityEditPane createAuthorityEditPane() {
@ -1249,6 +1284,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 粘贴 * 粘贴
*
* @return * @return
*/ */
@Override @Override
@ -1259,6 +1295,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 剪切 * 剪切
*
* @return * @return
*/ */
@Override @Override
@ -1273,6 +1310,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 工具栏菜单 * 工具栏菜单
*
* @return 同上 * @return 同上
*/ */
@Override @Override
@ -1286,6 +1324,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 模版菜单 * 模版菜单
*
* @return 同上 * @return 同上
*/ */
@Override @Override
@ -1295,6 +1334,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 权限菜单 * 权限菜单
*
* @return 同上 * @return 同上
*/ */
public ShortCut[] shortCuts4Authority() { public ShortCut[] shortCuts4Authority() {
@ -1304,6 +1344,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 返回ToolBarDef * 返回ToolBarDef
*
* @return 同上 * @return 同上
*/ */
@Override @Override
@ -1313,10 +1354,12 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 返回工具栏按钮组件 * 返回工具栏按钮组件
*
* @return 同上 * @return 同上
*/ */
public JComponent[] toolBarButton4Form() { 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()};
} }

584
designer_form/src/com/fr/design/mainframe/FormSelection.java

@ -8,300 +8,312 @@ import com.fr.base.FRContext;
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;
import com.fr.design.designer.beans.location.Direction; import com.fr.design.designer.beans.location.Direction;
import com.fr.design.designer.creator.XComponent; import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.XCreator;
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.XWParameterLayout;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
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;
public class FormSelection { public class FormSelection {
private ArrayList<XCreator> selection; private ArrayList<XCreator> selection;
private Rectangle backupBounds; private Rectangle backupBounds;
private ArrayList<Rectangle> recs = new ArrayList<Rectangle>(); private ArrayList<Rectangle> recs = new ArrayList<Rectangle>();
public FormSelection() { public FormSelection() {
selection = new ArrayList<XCreator>(); selection = new ArrayList<XCreator>();
} }
/** /**
* 重置选中的组件 * 重置选中的组件
*/ */
public void reset() { public void reset() {
selection.clear(); selection.clear();
} }
/** /**
* 是否没有选中的组件 * 是否没有选中的组件
* @return 为空返回true *
*/ * @return 为空返回true
public boolean isEmpty() { */
return selection.isEmpty(); public boolean isEmpty() {
} return selection.isEmpty();
}
/**
* 选中的组件数量 /**
* @return 选中的组件数量 * 选中的组件数量
*/ *
public int size() { * @return 选中的组件数量
return selection.size(); */
} public int size() {
return selection.size();
/** }
* 去除选中的组件中指定组件
* @param creator 待去除组件 /**
*/ * 去除选中的组件中指定组件
public void removeCreator(XCreator creator) { *
selection.remove(creator); * @param creator 待去除组件
} */
public void removeCreator(XCreator creator) {
/** selection.remove(creator);
* 是否成功删除选择的组件 }
* @param comp 组件
* @return 是则返回true /**
*/ * 是否成功删除选择的组件
public boolean removeSelectedCreator(XCreator comp) { *
if (selection.size() > 1 && selection.contains(comp)) { * @param comp 组件
removeCreator(comp); * @return 是则返回true
return true; */
} public boolean removeSelectedCreator(XCreator comp) {
return false; if (selection.size() > 1 && selection.contains(comp)) {
} removeCreator(comp);
return true;
/** }
* 成功增加选中的组件 return false;
* @param creator 组件 }
* @return 成功增加返回true
*/ /**
public boolean addSelectedCreator(XCreator creator) { * 成功增加选中的组件
if (addedable(creator)) { *
selection.add(creator); * @param creator 组件
return true; * @return 成功增加返回true
} */
return false; public boolean addSelectedCreator(XCreator creator) {
} if (addedable(creator)) {
selection.add(creator);
/** return true;
* 是否是可以增加的 }
* @param creator 组件 return false;
* @return 是则返回true }
*/
public boolean addedable(XCreator creator) { /**
if (selection.isEmpty()) { * 是否是可以增加的
return true; *
} * @param creator 组件
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(creator); * @return 是则返回true
if (!(container instanceof XWAbsoluteLayout)) { */
return false; public boolean addedable(XCreator creator) {
} if (selection.isEmpty()) {
for (XCreator selected : selection) { return true;
if (selected == creator || XCreatorUtils.getParentXLayoutContainer(selected) != container) { }
return false; XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(creator);
} if (!(container instanceof XWAbsoluteLayout)) {
} return false;
return true; }
} for (XCreator selected : selection) {
if (selected == creator || XCreatorUtils.getParentXLayoutContainer(selected) != container) {
/** return false;
* 返回选中的第一个组件为空返回null }
* @return 返回选中组件 }
*/ return true;
public XCreator getSelectedCreator() { }
return !selection.isEmpty() ? selection.get(0) : null;
} /**
* 返回选中的第一个组件为空返回null
/** *
* 返回选中的所有组件 * @return 返回选中组件
* @return 所有组件s */
*/ public XCreator getSelectedCreator() {
public XCreator[] getSelectedCreators() { return !selection.isEmpty() ? selection.get(0) : null;
return selection.toArray(new XCreator[selection.size()]); }
}
/**
public Widget[] getSelectedWidgets() { * 返回选中的所有组件
Widget[] selectWidget = new Widget[selection.size()]; *
for (int i = 0; i < selection.size(); i++) { * @return 所有组件s
selectWidget[i] = selection.get(i).toData(); */
} public XCreator[] getSelectedCreators() {
return selectWidget; return selection.toArray(new XCreator[selection.size()]);
} }
public void setSelectedCreator(XCreator creator) { public Widget[] getSelectedWidgets() {
reset(); Widget[] selectWidget = new Widget[selection.size()];
selection.add(creator); for (int i = 0; i < selection.size(); i++) {
} selectWidget[i] = selection.get(i).toData();
}
public void setSelectedCreators(ArrayList<XCreator> selections) { return selectWidget;
reset(); }
for (XCreator creator : selections) {
if (addedable(creator)) { public void setSelectedCreator(XCreator creator) {
selection.add(creator); reset();
} selection.add(creator);
} }
}
public void setSelectedCreators(ArrayList<XCreator> selections) {
/** reset();
* 是否包含当前控件 for (XCreator creator : selections) {
* @param widget 控件 if (addedable(creator)) {
* @return 是则返回true selection.add(creator);
*/ }
public boolean contains(Widget widget) { }
for (XCreator creator : selection) { }
if (creator.toData() == widget) {
return true; /**
} * 是否包含当前控件
} *
return false; * @param widget 控件
} * @return 是则返回true
*/
public int[] getDirections() { public boolean contains(Widget widget) {
if (this.selection.size() > 1) { for (XCreator creator : selection) {
return Direction.ALL; if (creator.toData() == widget) {
} else if (this.selection.size() == 1) { return true;
return this.selection.get(0).getDirections(); }
} else { }
return new int[0]; return false;
} }
}
public int[] getDirections() {
/** if (this.selection.size() > 1) {
* 备份组件的bound return Direction.ALL;
*/ } else if (this.selection.size() == 1) {
public void backupBounds() { return this.selection.get(0).getDirections();
backupBounds = getRelativeBounds(); } else {
recs.clear(); return new int[0];
for (XComponent comp : selection) { }
recs.add(comp.getBounds()); }
}
} /**
* 备份组件的bound
public Rectangle getBackupBounds() { */
return backupBounds; public void backupBounds() {
} backupBounds = getRelativeBounds();
recs.clear();
public Rectangle getRelativeBounds() { for (XComponent comp : selection) {
Rectangle bounds = getSelctionBounds(); recs.add(comp.getBounds());
XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(selection.get(0)); }
if (parent == null) { }
return bounds;
} public Rectangle getBackupBounds() {
Rectangle rec = ComponentUtils.getRelativeBounds(parent); return backupBounds;
bounds.x += rec.x; }
bounds.y += rec.y;
return bounds; public Rectangle getRelativeBounds() {
} Rectangle bounds = getSelctionBounds();
XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(selection.get(0));
public Rectangle getSelctionBounds() { if (parent == null) {
if(selection.isEmpty()) { return bounds;
return new Rectangle(); }
} Rectangle rec = ComponentUtils.getRelativeBounds(parent);
Rectangle bounds = selection.get(0).getBounds(); bounds.x += rec.x;
for (int i = 1, len = selection.size(); i < len; i++) { bounds.y += rec.y;
bounds = bounds.union(selection.get(i).getBounds()); return bounds;
} }
return bounds;
} public Rectangle getSelctionBounds() {
if (selection.isEmpty()) {
public void setSelectionBounds(Rectangle rec, FormDesigner designer) { return new Rectangle();
XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(selection.get(0)); }
Rectangle backupBounds = new Rectangle(this.backupBounds); Rectangle bounds = selection.get(0).getBounds();
if (parent != null) { for (int i = 1, len = selection.size(); i < len; i++) {
Rectangle r = ComponentUtils.getRelativeBounds(parent); bounds = bounds.union(selection.get(i).getBounds());
rec.x -= r.x; }
rec.y -= r.y; return bounds;
backupBounds.x -= r.x; }
backupBounds.y -= r.y;
} public void setSelectionBounds(Rectangle rec, FormDesigner designer) {
XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(selection.get(0));
int size = selection.size(); Rectangle backupBounds = new Rectangle(this.backupBounds);
if (size == 1) { if (parent != null) {
XCreator creator = selection.get(0); Rectangle r = ComponentUtils.getRelativeBounds(parent);
creator.setBounds(rec); rec.x -= r.x;
if(creator.acceptType(XWParameterLayout.class)){ rec.y -= r.y;
designer.setParaHeight((int)rec.getHeight()); backupBounds.x -= r.x;
backupBounds.y -= r.y;
}
int size = selection.size();
if (size == 1) {
XCreator creator = selection.get(0);
creator.setBounds(rec);
if (creator.acceptType(XWParameterLayout.class)) {
designer.setParaHeight((int) rec.getHeight());
designer.getArea().doLayout(); designer.getArea().doLayout();
} }
LayoutUtils.layoutContainer(creator); LayoutUtils.layoutContainer(creator);
} else if (size > 1) { } else if (size > 1) {
for (int i = 0; i < selection.size(); i++) { for (int i = 0; i < selection.size(); i++) {
Rectangle newBounds = new Rectangle(recs.get(i)); Rectangle newBounds = new Rectangle(recs.get(i));
newBounds.x = rec.x + (newBounds.x - backupBounds.x) * rec.width / backupBounds.width; newBounds.x = rec.x + (newBounds.x - backupBounds.x) * rec.width / backupBounds.width;
newBounds.y = rec.y + (newBounds.y - backupBounds.y) * rec.height / backupBounds.height; newBounds.y = rec.y + (newBounds.y - backupBounds.y) * rec.height / backupBounds.height;
newBounds.width = rec.width * newBounds.width / backupBounds.width; newBounds.width = rec.width * newBounds.width / backupBounds.width;
newBounds.height = rec.height * newBounds.height / backupBounds.height; newBounds.height = rec.height * newBounds.height / backupBounds.height;
XCreator creator = selection.get(i); XCreator creator = selection.get(i);
creator.setBounds(newBounds); creator.setBounds(newBounds);
if(creator.acceptType(XWParameterLayout.class)){ if (creator.acceptType(XWParameterLayout.class)) {
designer.setParaHeight((int)rec.getHeight()); designer.setParaHeight((int) rec.getHeight());
designer.getArea().doLayout(); designer.getArea().doLayout();
} }
} }
LayoutUtils.layoutRootContainer(designer.getRootComponent()); LayoutUtils.layoutRootContainer(designer.getRootComponent());
} }
} }
/** /**
* 调整组件大小 * 调整组件大小
* @param designer 设计界面组件 *
*/ * @param designer 设计界面组件
public void fixCreator(FormDesigner designer) { */
for (XCreator creator : selection) { public void fixCreator(FormDesigner designer) {
LayoutAdapter layoutAdapter = AdapterBus.searchLayoutAdapter(designer, creator); for (XCreator creator : selection) {
if (layoutAdapter != null) { LayoutAdapter layoutAdapter = AdapterBus.searchLayoutAdapter(designer, creator);
creator.setBackupBound(backupBounds); if (layoutAdapter != null) {
layoutAdapter.fix(creator); creator.setBackupBound(backupBounds);
} layoutAdapter.fix(creator);
} }
} }
}
private void removeCreatorFromContainer(XCreator creator) {
XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(creator); private void removeCreatorFromContainer(XCreator creator) {
if (parent == null) { XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(creator);
return; if (parent == null) {
} return;
// 删除其根组件,同时就删除了同时被选择的叶子组件 }
parent.remove(creator); boolean changeCreator = creator.shouldScaleCreator() || creator.hasTitleStyle();
LayoutManager layout = parent.getLayout(); if (parent.acceptType(XWFitLayout.class) && changeCreator) {
creator = (XCreator) creator.getParent();
if (layout != null) { }
// 刷新组件容器的布局 parent.getLayoutAdapter().removeBean(creator, creator.getWidth(), creator.getHeight());
LayoutUtils.layoutContainer(parent); // 删除其根组件,同时就删除了同时被选择的叶子组件
} parent.remove(creator);
} LayoutManager layout = parent.getLayout();
/** if (layout != null) {
* 剪切选中的所有组件 // 刷新组件容器的布局
* @param clipBoard 剪切板 LayoutUtils.layoutContainer(parent);
*/ }
public void cut2ClipBoard(FormSelection clipBoard) { }
clipBoard.reset();
clipBoard.selection.addAll(selection); /**
* 剪切选中的所有组件
for (XCreator creator : selection) { *
removeCreatorFromContainer(creator); * @param clipBoard 剪切板
} */
reset(); public void cut2ClipBoard(FormSelection clipBoard) {
} clipBoard.reset();
clipBoard.selection.addAll(selection);
/**
* 复制选中的所有组件 for (XCreator creator : selection) {
* @param clipBoard 复制板 removeCreatorFromContainer(creator);
*/ }
public void copy2ClipBoard(FormSelection clipBoard) { reset();
clipBoard.reset(); }
for (XCreator root : selection) { /**
try { * 复制选中的所有组件
XCreator creator = XCreatorUtils.createXCreator((Widget) root.toData().clone()); *
creator.setBounds(root.getBounds()); * @param clipBoard 复制板
clipBoard.selection.add(creator); */
} catch (CloneNotSupportedException e) { public void copy2ClipBoard(FormSelection clipBoard) {
FRContext.getLogger().error(e.getMessage(), e); clipBoard.reset();
}
} for (XCreator root : selection) {
} try {
XCreator creator = XCreatorUtils.createXCreator((Widget) root.toData().clone());
creator.setBounds(root.getBounds());
clipBoard.selection.add(creator);
} catch (CloneNotSupportedException e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
}
} }

363
designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java

@ -1,126 +1,239 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.Component; import com.fr.base.FRContext;
import java.awt.Rectangle; import com.fr.design.designer.beans.LayoutAdapter;
import java.awt.Toolkit; import com.fr.design.designer.beans.adapters.layout.AbstractLayoutAdapter;
import java.util.ArrayList; import com.fr.design.designer.beans.events.DesignerEvent;
import java.util.Arrays; import com.fr.design.designer.creator.*;
import java.util.List; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.base.FRContext; import com.fr.general.ComparatorUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.Inter;
import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.events.DesignerEvent; import java.awt.*;
import com.fr.design.designer.creator.XCreator; import java.util.ArrayList;
import com.fr.design.designer.creator.XCreatorUtils; import java.util.Arrays;
import com.fr.design.designer.creator.XLayoutContainer; import java.util.List;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.form.main.ClonedWidgetCreator; public class FormSelectionUtils {
import com.fr.form.ui.Widget;
//组件复制时坐标偏移
public class FormSelectionUtils { private static final int DELAY_X_Y = 20;
public static void paste2Container(FormDesigner designer, XLayoutContainer parent, FormSelection selection, int x, //组件重命名后缀
int y) { private static final String POSTFIX = "_c";
LayoutAdapter adapter = parent.getLayoutAdapter();
if (selection.size() == 1) { private FormSelectionUtils() {
try {
XCreator creator = selection.getSelectedCreator(); }
Widget cloned = new ClonedWidgetCreator(designer.getTarget()).clonedWidgetWithNoRepeatName(creator
.toData()); /**
XCreator clondCreator = XCreatorUtils.createXCreator(cloned, creator.getSize()); * 粘贴到容器
if (adapter.addBean(clondCreator, x + clondCreator.getWidth() / 2, y + clondCreator.getHeight() / 2)) { */
designer.getSelectionModel().getSelection().setSelectedCreator(clondCreator); public static void paste2Container(FormDesigner designer, XLayoutContainer parent,
designer.getEditListenerTable().fireCreatorModified(clondCreator, DesignerEvent.CREATOR_PASTED); FormSelection clipboard, int x, int y) {
return; LayoutAdapter adapter = parent.getLayoutAdapter();
} if (parent instanceof XWAbsoluteLayout) {
} catch (CloneNotSupportedException e) { //绝对布局
FRContext.getLogger().error(e.getMessage(), e); absolutePaste(designer, clipboard, adapter, x, y);
} return;
} else if (selection.size() > 1) { } else if (parent instanceof XWFitLayout) {
if (parent instanceof XWAbsoluteLayout) { //相对布局
designer.getSelectionModel().getSelection().reset(); relativePaste(designer, clipboard, adapter, x, y);
Rectangle rec = selection.getSelctionBounds(); return;
for (XCreator creator : selection.getSelectedCreators()) { }
try { Toolkit.getDefaultToolkit().beep();
Widget cloned = new ClonedWidgetCreator(designer.getTarget()) }
.clonedWidgetWithNoRepeatName(creator.toData());
XCreator clondCreator = XCreatorUtils.createXCreator(cloned, creator.getSize()); /**
// 设置位置,移动20x20,防止被粘帖的组件重叠,照顾表单布局情况下 * 绝对布局粘贴
adapter.addBean(clondCreator, x + creator.getX() - rec.x + clondCreator.getWidth() / 2, y */
+ creator.getY() - rec.y + clondCreator.getHeight() / 2); private static void absolutePaste(FormDesigner designer, FormSelection clipboard, LayoutAdapter adapter, int x, int y) {
designer.getSelectionModel().getSelection().addSelectedCreator(clondCreator);
} catch (CloneNotSupportedException e) { designer.getSelectionModel().getSelection().reset();
FRContext.getLogger().error(e.getMessage(), e); Rectangle rec = clipboard.getSelctionBounds();
} for (XCreator creator : clipboard.getSelectedCreators()) {
} try {
designer.getEditListenerTable().fireCreatorModified( Widget copied = copyWidget(designer, creator);
designer.getSelectionModel().getSelection().getSelectedCreator(), DesignerEvent.CREATOR_PASTED); XCreator copiedCreator = XCreatorUtils.createXCreator(copied, creator.getSize());
return; // 获取位置
} Point point = getPasteLocation((AbstractLayoutAdapter) adapter,
} copiedCreator,
Toolkit.getDefaultToolkit().beep(); x + creator.getX() - rec.x + copiedCreator.getWidth() / 2,
} y + creator.getY() - rec.y + copiedCreator.getHeight() / 2);
if (!adapter.accept(copiedCreator, point.x, point.y)) {
public static void rebuildSelection(FormDesigner designer) { designer.showMessageDialog(Inter.getLocText("FR-Designer_Too_Large_To_Paste"));
ArrayList<XCreator> newSelection = new ArrayList<XCreator>(); return;
List<Widget> widgetList = new ArrayList<Widget>(); }
for (XCreator comp : designer.getSelectionModel().getSelection().getSelectedCreators()) { boolean addSuccess = adapter.addBean(copiedCreator, point.x, point.y);
widgetList.add(comp.toData()); if (addSuccess) {
} designer.getSelectionModel().getSelection().addSelectedCreator(copiedCreator);
designer.getSelectionModel().setSelectedCreators( }
rebuildSelection(designer.getRootComponent(), widgetList, newSelection)); } catch (CloneNotSupportedException e) {
} FRContext.getLogger().error(e.getMessage(), e);
}
public static ArrayList<XCreator> rebuildSelection(XCreator rootComponent, Widget[] selectWidgets) { }
List<Widget> selectionWidget = new ArrayList<Widget>(); rebuildSelection(designer);
if(selectWidgets != null){ designer.getEditListenerTable().fireCreatorModified(
selectionWidget.addAll(Arrays.asList(selectWidgets)); designer.getSelectionModel().getSelection().getSelectedCreator(), DesignerEvent.CREATOR_PASTED);
}
return FormSelectionUtils.rebuildSelection(rootComponent, selectionWidget, new ArrayList<XCreator>()); }
}
/**
private static ArrayList<XCreator> rebuildSelection(XCreator rootComponent, List<Widget> selectionWidget, * 相对布局粘贴
ArrayList<XCreator> newSelection) { */
FormSelectionUtils._rebuild(rootComponent, selectionWidget, newSelection); private static void relativePaste(FormDesigner designer, FormSelection clipboard, LayoutAdapter adapter, int x, int y) {
if (newSelection.isEmpty()) { designer.getSelectionModel().getSelection().reset();
newSelection.add(rootComponent); for (XCreator creator : clipboard.getSelectedCreators()) {
} try {
return newSelection; Widget copied = copyWidget(designer, creator);
} XCreator copiedCreator = XCreatorUtils.createXCreator(copied, creator.getSize());
if (!adapter.accept(copiedCreator, x, y)) {
private static void _rebuild(XCreator root, List<Widget> selectionWidget, List<XCreator> newSelection) { designer.showMessageDialog(Inter.getLocText("FR-Designer_Too_Small_To_Paste"));
if (selectionWidget.isEmpty()) { return;
return; }
} boolean addSuccess = adapter.addBean(copiedCreator, x, y);
for (Widget x : selectionWidget) { if (addSuccess) {
if (ComparatorUtils.equals(x, root.toData())) { designer.getSelectionModel().getSelection().addSelectedCreator(copiedCreator);
if (!newSelection.contains(root)) { }
newSelection.add(root); } catch (CloneNotSupportedException e) {
selectionWidget.remove(x); FRContext.getLogger().error(e.getMessage(), e);
} }
break; }
} rebuildSelection(designer);
} designer.getEditListenerTable().fireCreatorModified(
designer.getSelectionModel().getSelection().getSelectedCreator(), DesignerEvent.CREATOR_PASTED);
int count = root.getComponentCount(); }
for (int i = 0; i < count && !selectionWidget.isEmpty(); i++) {
Component c = root.getComponent(i); /**
if (c instanceof XCreator) { * 组件复用绝对布局获取粘贴组件位置
XCreator creator = (XCreator) c; */
for (Widget x : selectionWidget) { private static Point getPasteLocation(AbstractLayoutAdapter layoutAdapter, XCreator copiedCreator, int x, int y) {
if (ComparatorUtils.equals(x, creator.toData())) { //当宽度为奇数时 设置偏移
newSelection.add(creator); int xoffset = (copiedCreator.getWidth() & 1) == 1 ? 1 : 0;
selectionWidget.remove(x); //当高度为奇数时 设置偏移
break; int yoffset = (copiedCreator.getHeight() & 1) == 1 ? 1 : 0;
}
} if (!layoutAdapter.accept(copiedCreator, x, y)) {
if (c instanceof XLayoutContainer) { XLayoutContainer container = layoutAdapter.getContainer();
_rebuild((XLayoutContainer) c, selectionWidget, newSelection); boolean xOut = x < 0 || x + copiedCreator.getWidth() / 2 + xoffset > container.getWidth();
} else { boolean yOut = y < 0 || y + copiedCreator.getHeight() / 2 + yoffset > container.getHeight();
continue; /*
} * 组件原始位置位于布局的右下角
} * 和布局右下边界线紧挨
} * 粘贴时组件在原始位置向左错开20像素
} * x,y同时越界
*/
if (xOut && yOut) {
//向左偏移
x = container.getWidth() - copiedCreator.getWidth() / 2 - DELAY_X_Y - xoffset;
//紧贴下边界
y = container.getHeight() - copiedCreator.getHeight() / 2 - yoffset;
return new Point(x, y);
}
/*
* 组件原始位置与布局边界距离小于20像素下边界&右边界同时小于或者任意一个边界小于
* 则粘贴时距离小于20像素一侧直接贴近布局边界
* 距离大于20像素的一侧正常错开
* x,y中只有一个越界
*/
if ((xOut || yOut)) {
x = xOut ? container.getWidth() - copiedCreator.getWidth() / 2 - xoffset : x;
y = yOut ? container.getHeight() - copiedCreator.getHeight() / 2 - yoffset : y;
return new Point(x, y);
}
}
return new Point(x, y);
}
/**
* 拷贝组件
*/
private static Widget copyWidget(FormDesigner formDesigner, XCreator xCreator) throws
CloneNotSupportedException {
ArrayList<String> nameSpace = new ArrayList<>();
Widget copied = (Widget) xCreator.toData().clone();
//重命名拷贝的组件
String name = getCopiedName(formDesigner, copied, nameSpace);
if (copied instanceof WTitleLayout) {
XWTitleLayout xwTitleLayout = new XWTitleLayout((WTitleLayout) copied, xCreator.getSize());
xwTitleLayout.resetCreatorName(name);
} else {
copied.setWidgetName(name);
}
return copied;
}
/**
* 组件拷贝命名规则
*/
private static String getCopiedName(FormDesigner formDesigner, Widget copied, ArrayList<String> nameSpace) {
StringBuilder name = new StringBuilder(copied.getWidgetName());
do {
name.append(POSTFIX);
} while (formDesigner.getTarget().isNameExist(name.toString()) || nameSpace.contains(name.toString()));
nameSpace.add(name.toString());
return name.toString();
}
public static void rebuildSelection(FormDesigner designer) {
ArrayList<XCreator> newSelection = new ArrayList<>();
List<Widget> widgetList = new ArrayList<>();
for (XCreator comp : designer.getSelectionModel().getSelection().getSelectedCreators()) {
widgetList.add(comp.toData());
}
designer.getSelectionModel().setSelectedCreators(
rebuildSelection(designer.getRootComponent(), widgetList, newSelection));
}
public static ArrayList<XCreator> rebuildSelection(XCreator rootComponent, Widget[] selectWidgets) {
List<Widget> selectionWidget = new ArrayList<>();
if (selectWidgets != null) {
selectionWidget.addAll(Arrays.asList(selectWidgets));
}
return FormSelectionUtils.rebuildSelection(rootComponent, selectionWidget, new ArrayList<XCreator>());
}
private static ArrayList<XCreator> rebuildSelection(XCreator rootComponent, List<Widget> selectionWidget,
ArrayList<XCreator> newSelection) {
FormSelectionUtils.rebuild(rootComponent, selectionWidget, newSelection);
if (newSelection.isEmpty()) {
newSelection.add(rootComponent);
}
return newSelection;
}
private static void rebuild(XCreator root, List<Widget> selectionWidget, List<XCreator> newSelection) {
if (selectionWidget.isEmpty()) {
return;
}
for (Widget x : selectionWidget) {
if (ComparatorUtils.equals(x, root.toData())) {
if (!newSelection.contains(root)) {
newSelection.add(root);
selectionWidget.remove(x);
}
break;
}
}
int count = root.getComponentCount();
for (int i = 0; i < count && !selectionWidget.isEmpty(); i++) {
Component c = root.getComponent(i);
if (c instanceof XCreator) {
XCreator creator = (XCreator) c;
for (Widget x : selectionWidget) {
if (ComparatorUtils.equals(x, creator.toData())) {
newSelection.add(creator);
selectionWidget.remove(x);
break;
}
}
if (c instanceof XLayoutContainer) {
rebuild((XLayoutContainer) c, selectionWidget, newSelection);
}
}
}
}
} }

1589
designer_form/src/com/fr/design/mainframe/JForm.java

File diff suppressed because it is too large Load Diff

3
designer_form/src/com/fr/design/mainframe/MobileParaWidgetTable.java

@ -305,9 +305,12 @@ class MobileParaWidgetTable extends JTable {
/** /**
* cell改变相应的nametag改变 * cell改变相应的nametag改变
*/ */
private void firePropertyChange(){ private void firePropertyChange(){
((WParameterLayout) designer.getParaComponent().toData()).add2NameTagMap(uiTableTextField.getText(), ((WParameterLayout) designer.getParaComponent().toData()).add2NameTagMap(uiTableTextField.getText(),
cellData[getSelectedRow()][1]); cellData[getSelectedRow()][1]);
((WParameterLayout) designer.getParaComponent().toData()).setNameTagModified(cellData[getSelectedRow()][1],
true);
} }
@Override @Override

692
designer_form/src/com/fr/design/mainframe/MobileWidgetTable.java

@ -1,346 +1,348 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.*; import java.awt.*;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.List; import java.util.List;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JTable; import javax.swing.JTable;
import javax.swing.ListSelectionModel; import javax.swing.ListSelectionModel;
import javax.swing.table.*; import javax.swing.table.*;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itable.GroupRenderer; import com.fr.design.gui.itable.GroupRenderer;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.*; import com.fr.form.ui.container.*;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
/** /**
* MobileWidgetTable类主要显示各种容器的控件列表bodytab绝对布局快不包括参数面板 * MobileWidgetTable类主要显示各种容器的控件列表bodytab绝对布局快不包括参数面板
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
* User: zx * User: zx
* Date: 14-9-15 * Date: 14-9-15
* Time: 下午4:52 * Time: 下午4:52
* Modified by fanglei at 2017/01/23 * Modified by fanglei at 2017/01/23
*/ */
public class MobileWidgetTable extends JTable { public class MobileWidgetTable extends JTable {
private FormDesigner designer; private FormDesigner designer;
private String[][] cellData; private String[][] cellData;
private String[] headers = {Inter.getLocText("Form-Widget_Name")}; private String[] headers = {Inter.getLocText("Form-Widget_Name")};
private static final int WIDGET_TABLE_ROW_HEIGHT = 22; private static final int WIDGET_TABLE_ROW_HEIGHT = 22;
private UILabel moveComponent = new UILabel(); // 作为拖动时候随鼠标移动的那个半透明控件 private UILabel moveComponent = new UILabel(); // 作为拖动时候随鼠标移动的那个半透明控件
private int selectedRow = -1; private int selectedRow = -1;
private int GAP = 11; private static final int GAP = 11;
private boolean draging = false; private boolean draging = false;
private boolean collapsed = false; // 控件列表是否折叠 private boolean collapsed = false; // 控件列表是否折叠
@Override @Override
public TableCellRenderer getCellRenderer(int row, int column) { public TableCellRenderer getCellRenderer(int row, int column) {
//第一行渲染成为标题的样子 //第一行渲染成为标题的样子
if (row == 0) { if (row == 0) {
return new GroupRenderer(); return new GroupRenderer();
} }
return super.getCellRenderer(row, column); return super.getCellRenderer(row, column);
} }
public MobileWidgetTable(FormDesigner designer) { public MobileWidgetTable(FormDesigner designer) {
this.designer = designer; this.designer = designer;
cellData = getData(); cellData = getData();
this.setTableProperties(); this.setTableProperties();
TableModel defaultModel = new BeanTableModel(); TableModel defaultModel = new BeanTableModel();
this.setModel(defaultModel); this.setModel(defaultModel);
this.repaint(); this.repaint();
this.setDefaultRenderer(Object.class,new DefaultTableCellRenderer()); this.setDefaultRenderer(Object.class, new DefaultTableCellRenderer());
refreshData(); refreshData();
this.addMouseListener(mouseAdapter); this.addMouseListener(mouseAdapter);
this.addMouseMotionListener(mouseAdapter); this.addMouseMotionListener(mouseAdapter);
add(moveComponent); add(moveComponent);
} }
private void setTableProperties() { private void setTableProperties() {
JTableHeader header = getTableHeader(); JTableHeader header = getTableHeader();
header.setReorderingAllowed(false); header.setReorderingAllowed(false);
header.setPreferredSize(new Dimension(0, 0)); // 隐藏表头 header.setPreferredSize(new Dimension(0, 0)); // 隐藏表头
GroupRenderer headerRenderer = new GroupRenderer(); GroupRenderer headerRenderer = new GroupRenderer();
headerRenderer.setPreferredSize(new Dimension(0, 0)); //这行代码隐藏表头。因为要实现折叠效果,表头不好监听事件 headerRenderer.setPreferredSize(new Dimension(0, 0)); //这行代码隐藏表头。因为要实现折叠效果,表头不好监听事件
headerRenderer.setHorizontalAlignment(JLabel.LEFT); headerRenderer.setHorizontalAlignment(JLabel.LEFT);
header.setDefaultRenderer(headerRenderer); header.setDefaultRenderer(headerRenderer);
this.setRowHeight(WIDGET_TABLE_ROW_HEIGHT); this.setRowHeight(WIDGET_TABLE_ROW_HEIGHT);
this.setGridColor(new Color(212, 208, 200)); this.setGridColor(new Color(212, 208, 200));
this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
this.setColumnSelectionAllowed(false); this.setColumnSelectionAllowed(false);
this.setRowSelectionAllowed(false); this.setRowSelectionAllowed(false);
this.setFillsViewportHeight(false); this.setFillsViewportHeight(false);
this.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); this.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
} }
private MouseAdapter mouseAdapter = new MouseAdapter() { private MouseAdapter mouseAdapter = new MouseAdapter() {
/** /**
* 鼠标按下时处理的事件设置当前选中的行列 * 鼠标按下时处理的事件设置当前选中的行列
* @param e * @param e
*/ */
@Override @Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
getInstance().setCellSelected(); getInstance().setCellSelected();
if (selectedRow == 0 && !e.isPopupTrigger() && e.getClickCount() == 1 && e.getX() < WIDGET_TABLE_ROW_HEIGHT / 2){ // 如果是点击在第一行 if (selectedRow == 0 && !e.isPopupTrigger() && e.getClickCount() == 1 && e.getX() < WIDGET_TABLE_ROW_HEIGHT / 2) { // 如果是点击在第一行
toggleCollapse(); toggleCollapse();
} }
} }
/** /**
* 鼠标放开时处理的事件如果是正在拖动则执行换位操作重新绘制属性表如果不是则什么也不做 * 鼠标放开时处理的事件如果是正在拖动则执行换位操作重新绘制属性表如果不是则什么也不做
* 所谓的换行就是简单的重新拿到一次表格数据然后重新绘制表格 * 所谓的换行就是简单的重新拿到一次表格数据然后重新绘制表格
* @param e * @param e
*/ */
@Override @Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
if(!draging){ if (!draging) {
return; return;
} }
draging = false; draging = false;
moveComponent.setVisible(false); moveComponent.setVisible(false);
int toIndex = e.getY() < GAP ? 0 : (int)Math.rint((e.getY() - GAP)/WIDGET_TABLE_ROW_HEIGHT) + 1; int toIndex = e.getY() < GAP ? 0 : (int) Math.rint((e.getY() - GAP) / WIDGET_TABLE_ROW_HEIGHT) + 1;
//当鼠标放开时,将选中的容器调整至新的顺序 //当鼠标放开时,将选中的容器调整至新的顺序
((WSortLayout)designer.getSelectionModel().getSelection().getSelectedCreator().toData()).adjustOrder(selectedRow - 1, toIndex - 1); ((WSortLayout) designer.getSelectionModel().getSelection().getSelectedCreator().toData()).adjustOrder(selectedRow - 1, toIndex - 1);
//拿取排序后表格数据,然后重绘表格 //拿取排序后表格数据,然后重绘表格
getInstance().refreshData(); getInstance().refreshData();
getInstance().repaint(); getInstance().repaint();
designer.fireTargetModified(); designer.fireTargetModified();
getInstance().setCellSelected(); getInstance().setCellSelected();
} }
/** /**
* 设置鼠标在属性表区域移动时候的事件 * 设置鼠标在属性表区域移动时候的事件
* @param e * @param e
*/ */
@Override @Override
public void mouseMoved(MouseEvent e) { public void mouseMoved(MouseEvent e) {
int overRow = 0; int overRow = 0;
for (int i = 0;i < getRowCount();i++) { for (int i = 0; i < getRowCount(); i++) {
if (e.getY() > i * WIDGET_TABLE_ROW_HEIGHT && e.getY() <= (i + 1) * WIDGET_TABLE_ROW_HEIGHT){ if (e.getY() > i * WIDGET_TABLE_ROW_HEIGHT && e.getY() <= (i + 1) * WIDGET_TABLE_ROW_HEIGHT) {
overRow = i; //判断鼠标在哪一行 overRow = i; //判断鼠标在哪一行
} }
} }
//如果鼠标移动到当前选中的行上面的时候 //如果鼠标移动到当前选中的行上面的时候
if (overRow == selectedRow && selectedRow > 0) { if (overRow == selectedRow && selectedRow > 0) {
//把当前选中的那一行的光标改成(除了第一列)移动样式MOVE_CURSOR //把当前选中的那一行的光标改成(除了第一列)移动样式MOVE_CURSOR
setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
} else { } else {
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
} }
} }
/** /**
* 鼠标拖动事件如果鼠标当前是<code>MOVE_CURSOR</code>状态则执行开始拖动的代码 * 鼠标拖动事件如果鼠标当前是<code>MOVE_CURSOR</code>状态则执行开始拖动的代码
* 绘制一个<code>moveComponent</code>来跟随鼠标移动 * 绘制一个<code>moveComponent</code>来跟随鼠标移动
* @param e * @param e
*/ */
@Override @Override
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
int width = getColumnModel().getColumn(0).getWidth(); int width = getColumnModel().getColumn(0).getWidth();
//如果当前选中的行的范围是合理的话,就可以拖动 //如果当前选中的行的范围是合理的话,就可以拖动
if (selectedRow < getRowCount() && selectedRow > 0){ if (selectedRow < getRowCount() && selectedRow > 0) {
setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
draging = true; draging = true;
moveComponent.setText(getValueAt(selectedRow,0).toString()); moveComponent.setText(getValueAt(selectedRow, 0).toString());
moveComponent.setLocation(0, e.getY() - GAP); moveComponent.setLocation(0, e.getY() - GAP);
moveComponent.setSize(new Dimension(width, WIDGET_TABLE_ROW_HEIGHT)); moveComponent.setSize(new Dimension(width, WIDGET_TABLE_ROW_HEIGHT));
moveComponent.setVisible(true); moveComponent.setVisible(true);
moveComponent.setForeground(Color.lightGray); moveComponent.setForeground(Color.lightGray);
moveComponent.setBorder(BorderFactory.createLineBorder(Color.lightGray)); moveComponent.setBorder(BorderFactory.createLineBorder(Color.lightGray));
} }
} }
/** /**
* 设置鼠标单击时处理的事件单击控件列表进入控件属性表 * 设置鼠标单击时处理的事件单击控件列表进入控件属性表
* @param e * @param e
*/ */
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if(selectedRow > 0){ if (selectedRow > 0) {
//当前点击的控件的名字 //当前点击的控件的名字
String widgetName = cellData[selectedRow][0]; String widgetName = cellData[selectedRow][0];
if (StringUtils.isNotEmpty(widgetName)){ if (StringUtils.isNotEmpty(widgetName)) {
//当前选择的容器 //当前选择的容器
XCreator selectedContainer = designer.getSelectionModel().getSelection().getSelectedCreator(); XCreator selectedContainer = designer.getSelectionModel().getSelection().getSelectedCreator();
WLayout selectedWidget = (WLayout)selectedContainer.toData(); WLayout selectedWidget = (WLayout) selectedContainer.toData();
//当前选择的容器中的控件数量 //当前选择的容器中的控件数量
int count = selectedWidget.getWidgetCount(); int count = selectedWidget.getWidgetCount();
for (int i = 0;i < count ;i++){ for (int i = 0; i < count; i++) {
XCreator xCreator = (XCreator) selectedContainer.getComponent(i); XCreator xCreator = (XCreator) selectedContainer.getComponent(i);
Widget widget = xCreator.toData(); Widget widget = xCreator.toData();
if (ComparatorUtils.equals(widgetName, widget.getWidgetName())) { if (ComparatorUtils.equals(widgetName, widget.getWidgetName())) {
getEditingDesigner().getSelectionModel().setSelectedCreator(xCreator); getEditingDesigner().getSelectionModel().setSelectedCreator(xCreator);
} }
} }
} }
} else if (selectedRow == 0){ // 如果是点击在第一行 } else if (selectedRow == 0) { // 如果是点击在第一行
if (!e.isPopupTrigger() && e.getClickCount() > 1) { if (!e.isPopupTrigger() && e.getClickCount() > 1) {
toggleCollapse(); toggleCollapse();
} }
} }
} }
/** /**
* 鼠标离开属性表区域事件 * 鼠标离开属性表区域事件
* @param e * @param e
*/ */
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
draging = false; draging = false;
moveComponent.setVisible(false); moveComponent.setVisible(false);
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
} }
}; };
public MobileWidgetTable getInstance(){ public MobileWidgetTable getInstance() {
return this; return this;
} }
public FormDesigner getEditingDesigner(){ public FormDesigner getEditingDesigner() {
return designer; return designer;
} }
/** /**
* 设置当前get到的行列的单元格为选中状态 * 设置当前get到的行列的单元格为选中状态
*/ */
private void setCellSelected() { private void setCellSelected() {
selectedRow = getSelectedRow(); selectedRow = getSelectedRow();
if (selectedRow != -1) { if (selectedRow != -1) {
this.setRowSelectionInterval(selectedRow, selectedRow); this.setRowSelectionInterval(selectedRow, selectedRow);
this.setColumnSelectionInterval(0, 0); this.setColumnSelectionInterval(0, 0);
} }
} }
/** /**
* 切换属性组折叠属性true/false * 切换属性组折叠属性true/false
*/ */
private void toggleCollapse() { private void toggleCollapse() {
this.setCollapsed(!this.isCollapsed()); this.setCollapsed(!this.isCollapsed());
//这里获取表格的父控件是为了当表格被折叠了后,装表格的父控件也要相应的重新布局一下 //这里获取表格的父控件是为了当表格被折叠了后,装表格的父控件也要相应的重新布局一下
//比如折叠之后表格行数应该比原来的少,占用父容器空间应该小点,不重新布局父容器,表格大小不会改变 //比如折叠之后表格行数应该比原来的少,占用父容器空间应该小点,不重新布局父容器,表格大小不会改变
Container parent = MobileWidgetTable.this.getParent(); Container parent = MobileWidgetTable.this.getParent();
if (parent != null) { if (parent != null) {
parent.revalidate(); parent.revalidate();
} }
repaint(); repaint();
} }
/** /**
* 重新get排序后的数据 * 重新get排序后的数据
*/ */
public void refreshData(){ public void refreshData() {
cellData = getData(); cellData = getData();
} }
/** /**
* 获取选中控件的控件列表 * 获取选中控件的控件列表
* *
* @return String[][] 二维数组[0][0]widgetName * @return String[][] 二维数组[0][0]widgetName
*/ */
private String[][] getData(){ private String[][] getData() {
if(designer.isFormParaDesigner()){ if (designer.isFormParaDesigner()) {
return new String[0][0]; return new String[0][0];
} }
//选择的控件 //选择的控件
Widget selectedModel = designer.getSelectionModel().getSelection().getSelectedCreator().toData(); XCreator selectedCreator = designer.getSelectionModel().getSelection().getSelectedCreator();
Widget selectedModel = selectedCreator != null ? selectedCreator.toData() : null;
if(selectedModel == null){
return new String[0][0]; if (selectedModel == null) {
} return new String[0][0];
}
// 选择的控件有两种类型,一种是WLayout,代表容器,一种是Widget,代表控件
if (selectedModel.acceptType(WSortLayout.class)) { // 选择的控件有两种类型,一种是WLayout,代表容器,一种是Widget,代表控件
List<String> mobileWidgetList = ((WSortLayout)selectedModel).getOrderedMobileWidgetList(); if (selectedModel.acceptType(WSortLayout.class)) {
String[][] widgetName = new String[mobileWidgetList.size() + 1][1]; List<String> mobileWidgetList = ((WSortLayout) selectedModel).getOrderedMobileWidgetList();
widgetName[0][0] = Inter.getLocText("FR-Designer_WidgetOrder"); String[][] widgetName = new String[mobileWidgetList.size() + 1][1];
for (int i = 0; i < mobileWidgetList.size(); i++) { widgetName[0][0] = Inter.getLocText("FR-Designer_WidgetOrder");
widgetName[i + 1][0] = mobileWidgetList.get(i); for (int i = 0; i < mobileWidgetList.size(); i++) {
} widgetName[i + 1][0] = mobileWidgetList.get(i);
return widgetName; }
} else { return widgetName;
return new String[0][0]; } else {
} return new String[0][0];
} }
}
public boolean isCollapsed() {
return collapsed; public boolean isCollapsed() {
} return collapsed;
}
public void setCollapsed(boolean collapsed) {
this.collapsed = collapsed; public void setCollapsed(boolean collapsed) {
} this.collapsed = collapsed;
}
/**
* 自定义的tableEditor类 /**
*/ * 自定义的tableEditor类
public class BeanTableModel extends DefaultTableModel { */
public BeanTableModel() { public class BeanTableModel extends DefaultTableModel {
super(cellData,headers); public BeanTableModel() {
} super(cellData, headers);
}
@Override
public int getRowCount() { @Override
if (isCollapsed()) { public int getRowCount() {
return 1; if (isCollapsed()) {
} return 1;
return cellData.length; }
} return cellData.length;
}
@Override
public int getColumnCount() { @Override
return 1; public int getColumnCount() {
} return 1;
}
@Override
public Object getValueAt(int row, int column) { @Override
if (row >= getRowCount() || column >= getColumnCount()) { public Object getValueAt(int row, int column) {
return null; if (row >= getRowCount() || column >= getColumnCount()) {
} return null;
if (row == 0) { }
return (isCollapsed()? "+" : "-") + cellData[row][0]; if (row == 0) {
} return (isCollapsed() ? "+" : "-") + cellData[row][0];
}
return cellData[row][0];
} return cellData[row][0];
}
@Override
public String getColumnName(int column) { @Override
return headers[0]; public String getColumnName(int column) {
} return headers[0];
}
@Override
public void setValueAt(Object aValue, int row, int column) { @Override
if (row >= getRowCount() || column >= getColumnCount()) { public void setValueAt(Object aValue, int row, int column) {
return; if (row >= getRowCount() || column >= getColumnCount()) {
} return;
if (aValue == null) { }
cellData[row] = null; if (aValue == null) {
return; cellData[row] = null;
} return;
cellData[row][0] = aValue.toString(); }
} cellData[row][0] = aValue.toString();
}
/**
* 是否可编辑 /**
* @param row 行号 * 是否可编辑
* @param column 列号 *
* @return 是否可编辑 * @param row 行号
*/ * @param column 列号
public boolean isCellEditable(int row, int column) { * @return 是否可编辑
return false; */
} public boolean isCellEditable(int row, int column) {
return false;
} }
}
} }

736
designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java

@ -1,366 +1,372 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.properties.EventPropertyTable; import com.fr.design.designer.properties.EventPropertyTable;
import com.fr.design.designer.properties.WidgetPropertyTable; import com.fr.design.designer.properties.WidgetPropertyTable;
import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itable.AbstractPropertyTable; import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.LineBorder; import javax.swing.border.LineBorder;
import javax.swing.table.JTableHeader; import javax.swing.table.JTableHeader;
import java.awt.*; import java.awt.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
/** /**
* 控件属性表绘制 * 控件属性表绘制
* Modified by fanglei * Modified by fanglei
*/ */
public class WidgetPropertyPane extends FormDockView implements BaseWidgetPropertyPane { public class WidgetPropertyPane extends FormDockView implements BaseWidgetPropertyPane {
private static final String PARA = "para"; private static final String PARA = "para";
private static final String BODY = "body"; private static final String BODY = "body";
private WidgetPropertyTable propertyTable; // 控件的属性表 private WidgetPropertyTable propertyTable; // 控件的属性表
private EventPropertyTable eventTable; // 控件的事件表 private EventPropertyTable eventTable; // 控件的事件表
private List<AbstractPropertyTable> widgetPropertyTables; // 这个变量应该是保存控件拓展的属性tab private List<AbstractPropertyTable> widgetPropertyTables; // 这个变量应该是保存控件拓展的属性tab
private FormDesigner designer; // 当前designer private FormDesigner designer; // 当前designer
private UIScrollPane psp; // 用来装载属性表table的容器 private UIScrollPane psp; // 用来装载属性表table的容器
private UIScrollPane esp; //用来装载事件table的容器 private UIScrollPane esp; //用来装载事件table的容器
private JPanel wsp; // 装载移动端tab的容器,包括移动端属性表和控件拓展的移动端属性表 private JPanel wsp; // 装载移动端tab的容器,包括移动端属性表和控件拓展的移动端属性表
private MobileParaWidgetTable mobileParaWidgetTable; // 参数面板的移动端属性tab(和body的移动端属性tab区别是没有标签名column) private MobileParaWidgetTable mobileParaWidgetTable; // 参数面板的移动端属性tab(和body的移动端属性tab区别是没有标签名column)
private MobileWidgetTable mobileWidgetTable; // body的移动端属性tab private MobileWidgetTable mobileWidgetTable; // body的移动端属性tab
private UIScrollPane downPanel; // 这个滚动容器是用于装载centerPane的 private UIScrollPane downPanel; // 这个滚动容器是用于装载centerPane的
private JPanel centerPane; // 此centerPane采用的是cardLayout布局,装载着mobileWidgetTable和mobileBodyWidgetTable private JPanel centerPane; // 此centerPane采用的是cardLayout布局,装载着mobileWidgetTable和mobileBodyWidgetTable
private CardLayout cardLayout; // 卡片布局,选中参数面板时显示mobileWidgetTable,选中body时显示mobileBodyWidgetTable private CardLayout cardLayout; // 卡片布局,选中参数面板时显示mobileWidgetTable,选中body时显示mobileBodyWidgetTable
private JTableHeader header;//把表头单独get出来作为一个组件 private JTableHeader header;//把表头单独get出来作为一个组件
public static WidgetPropertyPane getInstance() { public static WidgetPropertyPane getInstance() {
if (HOLDER.singleton == null) { if (HOLDER.singleton == null) {
HOLDER.singleton = new WidgetPropertyPane(); HOLDER.singleton = new WidgetPropertyPane();
} }
return HOLDER.singleton; return HOLDER.singleton;
} }
public static WidgetPropertyPane getInstance(FormDesigner formEditor) { public static WidgetPropertyPane getInstance(FormDesigner formEditor) {
HOLDER.singleton.setEditingFormDesigner(formEditor); HOLDER.singleton.setEditingFormDesigner(formEditor);
HOLDER.singleton.refreshDockingView(); HOLDER.singleton.refreshDockingView();
return HOLDER.singleton; return HOLDER.singleton;
} }
private static class HOLDER { private static class HOLDER {
private static WidgetPropertyPane singleton = new WidgetPropertyPane(); private static WidgetPropertyPane singleton = new WidgetPropertyPane();
} }
private WidgetPropertyPane() { private WidgetPropertyPane() {
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
} }
@Override @Override
public String getViewTitle() { public String getViewTitle() {
return Inter.getLocText("Form-Widget_Property_Table"); return Inter.getLocText("Form-Widget_Property_Table");
} }
@Override @Override
public Icon getViewIcon() { public Icon getViewIcon() {
return BaseUtils.readIcon("/com/fr/design/images/m_report/attributes.png"); return BaseUtils.readIcon("/com/fr/design/images/m_report/attributes.png");
} }
@Override @Override
/** /**
* 绘制属性表tab * 绘制属性表tab
*/ */
public void refreshDockingView() { public void refreshDockingView() {
designer = this.getEditingFormDesigner(); designer = this.getEditingFormDesigner();
removeAll(); removeAll();
if (designer == null) { if (designer == null) {
clearDockingView(); clearDockingView();
return; return;
} }
widgetPropertyTables = new ArrayList<AbstractPropertyTable>(); widgetPropertyTables = new ArrayList<AbstractPropertyTable>();
//依次创建属性表、事件表、移动端表,再将它们整合到TabPane中去 //依次创建属性表、事件表、移动端表,再将它们整合到TabPane中去
this.createPropertyTable(); this.createPropertyTable();
this.createEventTable(); this.createEventTable();
this.createMobileWidgetTable(); this.createMobileWidgetTable();
this.createTabPane(); this.createTabPane();
this.initTables(); this.initTables();
} }
/** /**
* 初始化属性表事件表移动端拓展的属性表 * 初始化属性表事件表移动端拓展的属性表
*/ */
private void initTables() { private void initTables() {
propertyTable.initPropertyGroups(null); propertyTable.initPropertyGroups(null);
eventTable.refresh(); eventTable.refresh();
for (AbstractPropertyTable propertyTable : widgetPropertyTables) { for (AbstractPropertyTable propertyTable : widgetPropertyTables) {
propertyTable.initPropertyGroups(designer); propertyTable.initPropertyGroups(designer);
} }
} }
/** /**
* 创建属性表table * 创建属性表table
*/ */
private void createPropertyTable() { private void createPropertyTable() {
propertyTable = new WidgetPropertyTable(designer); propertyTable = new WidgetPropertyTable(designer);
designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable)); designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable));
propertyTable.setBorder(null); propertyTable.setBorder(null);
psp = new UIScrollPane(propertyTable); // 用来装载属性表table psp = new UIScrollPane(propertyTable); // 用来装载属性表table
psp.setBorder(null); psp.setBorder(null);
} }
/** /**
* 创建事件表事件选项卡不是JTable * 创建事件表事件选项卡不是JTable
*/ */
private void createEventTable() { private void createEventTable() {
eventTable = new EventPropertyTable(designer); eventTable = new EventPropertyTable(designer);
designer.addDesignerEditListener(new EventPropertyDesignerAdapter(eventTable)); designer.addDesignerEditListener(new EventPropertyDesignerAdapter(eventTable));
eventTable.setBorder(null); eventTable.setBorder(null);
esp = new UIScrollPane(eventTable); //用来装载事件table esp = new UIScrollPane(eventTable); //用来装载事件table
esp.setBorder(null); esp.setBorder(null);
} }
/** /**
* 创建移动端控件列表 * 创建移动端控件列表
*/ */
private void createMobileWidgetTable() { private void createMobileWidgetTable() {
//加上表头后,这里不再使用borderLayout布局,而采用BoxLayout布局 //加上表头后,这里不再使用borderLayout布局,而采用BoxLayout布局
wsp = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); wsp = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
wsp.setBorder(null); wsp.setBorder(null);
mobileParaWidgetTable = new MobileParaWidgetTable(designer); mobileParaWidgetTable = new MobileParaWidgetTable(designer);
mobileWidgetTable = new MobileWidgetTable(designer); mobileWidgetTable = new MobileWidgetTable(designer);
designer.addDesignerEditListener(new mobileWidgetDesignerAdapter()); designer.addDesignerEditListener(new mobileWidgetDesignerAdapter());
centerPane = FRGUIPaneFactory.createCardLayout_S_Pane(); centerPane = FRGUIPaneFactory.createCardLayout_S_Pane();
cardLayout = (CardLayout) centerPane.getLayout(); cardLayout = (CardLayout) centerPane.getLayout();
centerPane.add(mobileParaWidgetTable, PARA);// 采用卡片布局的容器必须指定卡片名字,如果没有卡片名字 centerPane.add(mobileParaWidgetTable, PARA);
// 就会出现:Exception in thread "main" java.lang.IllegalArgumentException: // 采用卡片布局的容器必须指定卡片名字,如果没有卡片名字
// cannot add to layout: constraint must be a string // 就会出现:Exception in thread "main" java.lang.IllegalArgumentException:
// 第二个参数代表卡片的名字。后来show方法调用时通过名字找到要显示的卡片 // cannot add to layout: constraint must be a string
centerPane.add(mobileWidgetTable, BODY); //这两句代码,是把JTable放到一个JPanel中去了,表头不会显示, // 第二个参数代表卡片的名字。后来show方法调用时通过名字找到要显示的卡片
//只有放到JScrollPanel中去表头才能正常显示,这就是MobileWidgetTable中定义了表头却没有显示的原因! centerPane.add(mobileWidgetTable, BODY); //这两句代码,是把JTable放到一个JPanel中去了,表头不会显示,
//解决方案:MobileWidgetTable实在无法直接放到JScrollPanel中去的时候,应该把表头get出来单独作为一个组件显示 //只有放到JScrollPanel中去表头才能正常显示,这就是MobileWidgetTable中定义了表头却没有显示的原因!
//解决方案:MobileWidgetTable实在无法直接放到JScrollPanel中去的时候,应该把表头get出来单独作为一个组件显示
if(hasSelectParaPane(designer)){
cardLayout.show(centerPane,PARA); if (hasSelectParaPane(designer)) {
header = mobileParaWidgetTable.getTableHeader(); cardLayout.show(centerPane, PARA);
} else { header = mobileParaWidgetTable.getTableHeader();
cardLayout.show(centerPane,BODY); } else {
header = mobileWidgetTable.getTableHeader(); cardLayout.show(centerPane, BODY);
} header = mobileWidgetTable.getTableHeader();
downPanel = new UIScrollPane(centerPane); }
downPanel.setBorder(new LineBorder(Color.GRAY)); downPanel = new UIScrollPane(centerPane);
downPanel.setBorder(new LineBorder(Color.GRAY));
//获取拓展移动端属性tab
WidgetPropertyUIProvider[] widgetAttrProviders = getExtraPropertyUIProviders(); //获取拓展移动端属性tab
WidgetPropertyUIProvider[] widgetAttrProviders = getExtraPropertyUIProviders();
addWidgetAttr(widgetAttrProviders);
} addWidgetAttr(widgetAttrProviders);
}
/**
* 将属性表事件表移动端控件列表整合到TabPane里面去 /**
*/ * 将属性表事件表移动端控件列表整合到TabPane里面去
private void createTabPane() { */
UITabbedPane tabbedPane = new UITabbedPane(); // tab选项卡容器 private void createTabPane() {
initTabPane(tabbedPane); UITabbedPane tabbedPane = new UITabbedPane(); // tab选项卡容器
add(tabbedPane, BorderLayout.CENTER); initTabPane(tabbedPane);
} add(tabbedPane, BorderLayout.CENTER);
}
/**
* 获取当前控件扩展的属性tab /**
* 来源有两个: * 获取当前控件扩展的属性tab
* 1, 各个控件从各自的Xcreator里扩展例如手机重布局的tab就是从Xcreator中扩展的; * 来源有两个:
* 2, 所有的控件从插件里扩展. * 1, 各个控件从各自的Xcreator里扩展例如手机重布局的tab就是从Xcreator中扩展的;
* * 2, 所有的控件从插件里扩展.
* @return 扩展的tab *
*/ * @return 扩展的tab
private WidgetPropertyUIProvider[] getExtraPropertyUIProviders() { */
FormSelection selection = designer.getSelectionModel().getSelection(); private WidgetPropertyUIProvider[] getExtraPropertyUIProviders() {
WidgetPropertyUIProvider[] embeddedPropertyUIProviders = null; FormSelection selection = designer.getSelectionModel().getSelection();
if (selection != null && selection.getSelectedCreator() != null) { WidgetPropertyUIProvider[] embeddedPropertyUIProviders = null;
embeddedPropertyUIProviders = selection.getSelectedCreator().getWidgetPropertyUIProviders(); if (selection != null && selection.getSelectedCreator() != null) {
} embeddedPropertyUIProviders = selection.getSelectedCreator().getWidgetPropertyUIProviders();
Set<WidgetPropertyUIProvider> set = ExtraDesignClassManager.getInstance().getArray(WidgetPropertyUIProvider.XML_TAG); }
return ArrayUtils.addAll(embeddedPropertyUIProviders, set.toArray(new WidgetPropertyUIProvider[set.size()])); Set<WidgetPropertyUIProvider> set = ExtraDesignClassManager.getInstance().getArray(WidgetPropertyUIProvider.XML_TAG);
} return ArrayUtils.addAll(embeddedPropertyUIProviders, set.toArray(new WidgetPropertyUIProvider[set.size()]));
}
/**
* 判断是将拓展的tab放入属性表还是将原来的tab放入属性表 /**
* @param widgetAttrProviders 拓展的tab * 判断是将拓展的tab放入属性表还是将原来的tab放入属性表
*/ *
private void addWidgetAttr(WidgetPropertyUIProvider[] widgetAttrProviders) { * @param widgetAttrProviders 拓展的tab
if (widgetAttrProviders.length == 0) { // 判断有没有拓展的tab,没有就使用原来的 */
wsp.add(header); private void addWidgetAttr(WidgetPropertyUIProvider[] widgetAttrProviders) {
wsp.add(downPanel); if (widgetAttrProviders.length == 0) { // 判断有没有拓展的tab,没有就使用原来的
} else { wsp.add(header);
for (WidgetPropertyUIProvider widgetAttrProvider : widgetAttrProviders) { wsp.add(downPanel);
AbstractPropertyTable propertyTable = widgetAttrProvider.createWidgetAttrTable(); } else {
widgetPropertyTables.add(propertyTable); for (WidgetPropertyUIProvider widgetAttrProvider : widgetAttrProviders) {
designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable)); AbstractPropertyTable propertyTable = widgetAttrProvider.createWidgetAttrTable();
UIScrollPane uiScrollPane = new UIScrollPane(getExtraBodyTable(propertyTable)); widgetPropertyTables.add(propertyTable);
wsp.add(uiScrollPane); designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable));
} UIScrollPane uiScrollPane = new UIScrollPane(getExtraBodyTable(propertyTable));
} wsp.add(uiScrollPane);
} }
}
/** }
* 如果是body的拓展属性表那么要额外加上一张控件顺序表
* @return /**
*/ * 如果是body的拓展属性表那么要额外加上一张控件顺序表
private Component getExtraBodyTable(AbstractPropertyTable abstractPropertyTable) { *
Widget selection = designer.getSelectionModel().getSelection().getSelectedCreator().toData(); * @return
if (selection.getWidgetName().equals("body")) { */
JPanel jPanel = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); private Component getExtraBodyTable(AbstractPropertyTable abstractPropertyTable) {
jPanel.add(abstractPropertyTable); Widget selection = designer.getSelectionModel().getSelection().getSelectedCreator().toData();
MobileWidgetTable mobileWidgetTable = new MobileWidgetTable(designer); if (selection.getWidgetName().equals("body")) {
jPanel.add(mobileWidgetTable.getTableHeader()); JPanel jPanel = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
jPanel.add(mobileWidgetTable); jPanel.add(abstractPropertyTable);
return jPanel; MobileWidgetTable mobileWidgetTable = new MobileWidgetTable(designer);
} jPanel.add(mobileWidgetTable.getTableHeader());
return abstractPropertyTable; jPanel.add(mobileWidgetTable);
} return jPanel;
}
private void initTabPane(UITabbedPane tabbedPane) { return abstractPropertyTable;
tabbedPane.setOpaque(true); }
tabbedPane.setBorder(null);
tabbedPane.setTabPlacement(SwingConstants.BOTTOM); private void initTabPane(UITabbedPane tabbedPane) {
tabbedPane.addTab(Inter.getLocText("FR-Designer_Properties"), psp); tabbedPane.setOpaque(true);
tabbedPane.addTab(Inter.getLocText("FR-Designer_Event"), esp); tabbedPane.setBorder(null);
tabbedPane.addTab(Inter.getLocText("FR-Widget_Mobile_Terminal"), wsp); tabbedPane.setTabPlacement(SwingConstants.BOTTOM);
} tabbedPane.addTab(Inter.getLocText("FR-Designer_Properties"), psp);
tabbedPane.addTab(Inter.getLocText("FR-Designer_Event"), esp);
// tabbedPane.addTab(Inter.getLocText("FR-Widget_Mobile_Terminal"), wsp);
/** }
* 选中的组件是否在参数面板里
* @param designer 设计器
* @return 是则返回true /**
*/ * 选中的组件是否在参数面板里
public boolean hasSelectParaPane(FormDesigner designer){ *
XCreator xCreator = designer.getSelectionModel().getSelection().getSelectedCreator(); * @param designer 设计器
if(xCreator == null){ * @return 是则返回true
xCreator = designer.getRootComponent(); */
} public boolean hasSelectParaPane(FormDesigner designer) {
XLayoutContainer container = XCreatorUtils.getHotspotContainer(xCreator); XCreator xCreator = designer.getSelectionModel().getSelection().getSelectedCreator();
return xCreator.acceptType(XWParameterLayout.class) || container.acceptType(XWParameterLayout.class); if (xCreator == null) {
} xCreator = designer.getRootComponent();
}
public void setEditingFormDesigner(BaseFormDesigner editor) { XLayoutContainer container = XCreatorUtils.getHotspotContainer(xCreator);
FormDesigner fd = (FormDesigner) editor; //TODO container可能为空,引发空指针异常
super.setEditingFormDesigner(fd); return xCreator.acceptType(XWParameterLayout.class) || container.acceptType(XWParameterLayout.class);
} }
private void clearDockingView() { public void setEditingFormDesigner(BaseFormDesigner editor) {
propertyTable = null; FormDesigner fd = (FormDesigner) editor;
eventTable = null; super.setEditingFormDesigner(fd);
if (widgetPropertyTables != null) { }
widgetPropertyTables.clear();
} private void clearDockingView() {
JScrollPane psp = new JScrollPane(); propertyTable = null;
psp.setBorder(null); eventTable = null;
this.add(psp, BorderLayout.CENTER); if (widgetPropertyTables != null) {
} widgetPropertyTables.clear();
}
/** JScrollPane psp = new JScrollPane();
* 属性表监听界面事件(编辑删除选中改变大小) psp.setBorder(null);
*/ this.add(psp, BorderLayout.CENTER);
private class WidgetPropertyDesignerAdapter implements DesignerEditListener { }
AbstractPropertyTable propertyTable;
/**
WidgetPropertyDesignerAdapter(AbstractPropertyTable propertyTable) { * 属性表监听界面事件(编辑删除选中改变大小)
this.propertyTable = propertyTable; */
} private class WidgetPropertyDesignerAdapter implements DesignerEditListener {
AbstractPropertyTable propertyTable;
@Override
public void fireCreatorModified(DesignerEvent evt) { WidgetPropertyDesignerAdapter(AbstractPropertyTable propertyTable) {
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED this.propertyTable = propertyTable;
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_DELETED }
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) {
propertyTable.initPropertyGroups(designer); @Override
} else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED) { public void fireCreatorModified(DesignerEvent evt) {
repaint(); if (evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED
} || evt.getCreatorEventID() == DesignerEvent.CREATOR_DELETED
} || evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) {
propertyTable.initPropertyGroups(designer);
@Override } else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED) {
public boolean equals(Object o) { repaint();
return o instanceof WidgetPropertyDesignerAdapter && ((WidgetPropertyDesignerAdapter) o).propertyTable == this.propertyTable; }
} }
}
@Override
/** public boolean equals(Object o) {
* 事件表监听界面事件编辑选中 return o instanceof WidgetPropertyDesignerAdapter && ((WidgetPropertyDesignerAdapter) o).propertyTable == this.propertyTable;
*/ }
private class EventPropertyDesignerAdapter implements DesignerEditListener { }
EventPropertyTable propertyTable;
/**
EventPropertyDesignerAdapter(EventPropertyTable eventTable) { * 事件表监听界面事件编辑选中
this.propertyTable = eventTable; */
} private class EventPropertyDesignerAdapter implements DesignerEditListener {
EventPropertyTable propertyTable;
@Override
public void fireCreatorModified(DesignerEvent evt) { EventPropertyDesignerAdapter(EventPropertyTable eventTable) {
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED this.propertyTable = eventTable;
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { }
propertyTable.refresh();
} @Override
} public void fireCreatorModified(DesignerEvent evt) {
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED
@Override || evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) {
public boolean equals(Object o) { propertyTable.refresh();
return o instanceof EventPropertyDesignerAdapter; }
} }
}
@Override
/** public boolean equals(Object o) {
* 移动端属性表监听界面事件改变大小编辑选中增加控件 return o instanceof EventPropertyDesignerAdapter;
*/ }
private class mobileWidgetDesignerAdapter implements DesignerEditListener { }
mobileWidgetDesignerAdapter() { /**
} * 移动端属性表监听界面事件改变大小编辑选中增加控件
*/
/** private class mobileWidgetDesignerAdapter implements DesignerEditListener {
* 响应界面改变事件
* @param evt 事件 mobileWidgetDesignerAdapter() {
*/ }
public void fireCreatorModified(DesignerEvent evt) {
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED /**
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED * 响应界面改变事件
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED *
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_ADDED) { * @param evt 事件
int value = downPanel.getVerticalScrollBar().getValue(); */
if(hasSelectParaPane(getEditingFormDesigner())){ public void fireCreatorModified(DesignerEvent evt) {
cardLayout.show(centerPane,PARA); if (evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED
mobileParaWidgetTable.refreshData(); || evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED
} else { || evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED
cardLayout.show(centerPane,BODY); || evt.getCreatorEventID() == DesignerEvent.CREATOR_ADDED) {
mobileWidgetTable.refreshData(); int value = downPanel.getVerticalScrollBar().getValue();
} if (hasSelectParaPane(getEditingFormDesigner())) {
//出现滚动条 cardLayout.show(centerPane, PARA);
downPanel.doLayout(); mobileParaWidgetTable.refreshData();
//控件列表选中某组件,触发表单中选中控件,选中事件又触发列表刷新,滚动条回到0 } else {
//此处设置滚动条值为刷新前 cardLayout.show(centerPane, BODY);
downPanel.getVerticalScrollBar().setValue(value); mobileWidgetTable.refreshData();
} }
} //出现滚动条
} downPanel.doLayout();
//控件列表选中某组件,触发表单中选中控件,选中事件又触发列表刷新,滚动条回到0
@Override //此处设置滚动条值为刷新前
public Location preferredLocation() { downPanel.getVerticalScrollBar().setValue(value);
return Location.WEST_BELOW; }
} }
}
@Override
public Location preferredLocation() {
return Location.WEST_BELOW;
}
} }

8
designer_base/src/com/fr/design/mainframe/templateinfo/JFormProcessInfo.java → designer_form/src/com/fr/design/mainframe/templateinfo/JFormProcessInfo.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.templateinfo; package com.fr.design.mainframe.templateinfo;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WLayout;
/** /**
* Created by plough on 2017/3/17. * Created by plough on 2017/3/17.
@ -32,11 +32,9 @@ public class JFormProcessInfo extends TemplateProcessInfo<Form> {
public int getWidgetCount() { public int getWidgetCount() {
int widgetCount = 0; int widgetCount = 0;
for (int i = 0; i < template.getContainer().getWidgetCount(); i++) { for (int i = 0; i < template.getContainer().getWidgetCount(); i++) {
WFitLayout wf = (WFitLayout) template.getContainer().getWidget(i); WLayout wl = (WLayout) template.getContainer().getWidget(i);
widgetCount += wf.getWidgetCount(); widgetCount += wl.getWidgetCount();
} }
int a = 1;
int b = 2;
return widgetCount; return widgetCount;
} }
} }
Loading…
Cancel
Save