forked from fanruan/design
zheng
7 years ago
6410 changed files with 371972 additions and 378850 deletions
@ -1,8 +1,7 @@
|
||||
designer/bin |
||||
designer_base/bin |
||||
designer_chart/bin |
||||
designer_form/bin |
||||
*.iml |
||||
designer_base/src/com/fr/design/locale/.idea |
||||
.idea/ |
||||
.DS_Store |
||||
.classpath |
||||
.project |
||||
|
||||
|
||||
|
@ -1,75 +0,0 @@
|
||||
apply plugin: "java" |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = "UTF-8" |
||||
} |
||||
|
||||
def basicDir="../" |
||||
def libDir="${basicDir}/lib" |
||||
|
||||
task appletJar<<{ |
||||
ant{ |
||||
mkdir(dir:"./tmp") |
||||
mkdir(dir:"build/classes/main") |
||||
copy(todir:"build/classes/"){ |
||||
fileset(dir:"${basicDir}/chart/build/classes/main") |
||||
fileset(dir:"${basicDir}/report/build/classes/main") |
||||
fileset(dir:"${basicDir}/platform/build/classes/main") |
||||
} |
||||
unjar(src:"${libDir}/fr-core-9.0.jar",dest:"./tmp") |
||||
unjar(src:"${libDir}/fr-third-9.0.jar",dest:"./tmp") |
||||
unjar(src:"${libDir}/servlet-api.jar",dest:"./tmp") |
||||
jar(jarfile:"build/libs/fr-applet-9.0.jar"){ |
||||
fileset(dir:"build/classes"){ |
||||
exclude(name:"*.*") |
||||
exclude(name:"bin/*.*") |
||||
exclude(name:"classes/**") |
||||
exclude(name:"com/fr/schedule/**") |
||||
exclude(name:"com/fr/cell/**") |
||||
exclude(name:"com/fr/dialog/**") |
||||
exclude(name:"com/fr/view/**") |
||||
exclude(name:"com/fr/web/**") |
||||
exclude(name:"com/fr/fs/**") |
||||
exclude(name:"com/fr/design/**") |
||||
exclude(name:"com/fr/start/**") |
||||
exclude(name:"com/fr/process/**") |
||||
} |
||||
fileset(dir:"./tmp"){ |
||||
include(name:"javax/mail/**") |
||||
include(name:"javax/servlet/**") |
||||
include(name:"org/freehep/**") |
||||
include(name:"com/fr/third/JAI/**") |
||||
include(name:"com/fr/third/antlr/**") |
||||
include(name:"com/fr/third/javax/**") |
||||
include(name:"com/sun/xml/**") |
||||
include(name:"javax/xml/**") |
||||
|
||||
} |
||||
fileset(dir:"build/classes"){ |
||||
include(name:"com/fr/web/*.class") |
||||
include(name:"com/fr/web/attr/*.class") |
||||
} |
||||
} |
||||
delete(dir:"./tmp") |
||||
def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" |
||||
def keystore="frapplet.store" |
||||
def keycert="fr.cert" |
||||
def keypassword="123456" |
||||
def keyalias="fr" |
||||
|
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") |
||||
} |
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") |
||||
} |
||||
|
||||
exec(executable:"${jdk6home}/bin/jarsigner"){ |
||||
arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-9.0.jar' ${keyalias}") |
||||
} |
||||
delete(file:"${keystore}") |
||||
delete(file:"${keycert}") |
||||
delete(dir:"build/classes") |
||||
|
||||
} |
||||
|
||||
} |
@ -1,75 +0,0 @@
|
||||
apply plugin: "java" |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = "UTF-8" |
||||
} |
||||
|
||||
def basicDir="../" |
||||
def libDir="${basicDir}/lib" |
||||
|
||||
task appletJar<<{ |
||||
ant{ |
||||
mkdir(dir:"./tmp") |
||||
mkdir(dir:"build/classes/main") |
||||
copy(todir:"build/classes/"){ |
||||
fileset(dir:"${basicDir}/chart/build/classes/main") |
||||
fileset(dir:"${basicDir}/report/build/classes/main") |
||||
fileset(dir:"${basicDir}/platform/build/classes/main") |
||||
} |
||||
unjar(src:"${libDir}/fr-core-9.0.jar",dest:"./tmp") |
||||
unjar(src:"${libDir}/fr-third-9.0.jar",dest:"./tmp") |
||||
unjar(src:"${libDir}/servlet-api.jar",dest:"./tmp") |
||||
jar(jarfile:"build/libs/fr-applet-9.0.jar"){ |
||||
fileset(dir:"build/classes"){ |
||||
exclude(name:"*.*") |
||||
exclude(name:"bin/*.*") |
||||
exclude(name:"classes/**") |
||||
exclude(name:"com/fr/schedule/**") |
||||
exclude(name:"com/fr/cell/**") |
||||
exclude(name:"com/fr/dialog/**") |
||||
exclude(name:"com/fr/view/**") |
||||
exclude(name:"com/fr/web/**") |
||||
exclude(name:"com/fr/fs/**") |
||||
exclude(name:"com/fr/design/**") |
||||
exclude(name:"com/fr/start/**") |
||||
exclude(name:"com/fr/process/**") |
||||
} |
||||
fileset(dir:"./tmp"){ |
||||
include(name:"javax/mail/**") |
||||
include(name:"javax/servlet/**") |
||||
include(name:"org/freehep/**") |
||||
include(name:"com/fr/third/JAI/**") |
||||
include(name:"com/fr/third/antlr/**") |
||||
include(name:"com/fr/third/javax/**") |
||||
include(name:"com/sun/xml/**") |
||||
include(name:"javax/xml/**") |
||||
|
||||
} |
||||
fileset(dir:"build/classes"){ |
||||
include(name:"com/fr/web/*.class") |
||||
include(name:"com/fr/web/attr/*.class") |
||||
} |
||||
} |
||||
delete(dir:"./tmp") |
||||
def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" |
||||
def keystore="frapplet.store" |
||||
def keycert="fr.cert" |
||||
def keypassword="123456" |
||||
def keyalias="fr" |
||||
|
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") |
||||
} |
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") |
||||
} |
||||
|
||||
exec(executable:"${jdk6home}/bin/jarsigner"){ |
||||
arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-9.0.jar' ${keyalias}") |
||||
} |
||||
delete(file:"${keystore}") |
||||
delete(file:"${keycert}") |
||||
delete(dir:"build/classes") |
||||
|
||||
} |
||||
|
||||
} |
@ -1,75 +0,0 @@
|
||||
apply plugin: "java" |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = "UTF-8" |
||||
} |
||||
|
||||
def basicDir="../" |
||||
|
||||
task appletJar<<{ |
||||
ant{ |
||||
delete(dir:"build/classes") |
||||
mkdir(dir:"./tmp") |
||||
mkdir(dir:"build/classes/main") |
||||
copy(todir:"build/classes/"){ |
||||
fileset(dir:"${basicDir}/chart/build/classes/main") |
||||
fileset(dir:"${basicDir}/report/build/classes/main") |
||||
fileset(dir:"${basicDir}/platform/build/classes/main") |
||||
} |
||||
unjar(src:"${basicDir}/lib-core/fine-core-10.0.jar",dest:"./tmp") |
||||
unjar(src:"${basicDir}/lib-core/fine-third-10.0.jar",dest:"./tmp") |
||||
unjar(src:"${basicDir}/lib-other/server/servlet-api.jar",dest:"./tmp") |
||||
jar(jarfile:"build/libs/fine-applet-10.0.jar"){ |
||||
fileset(dir:"build/classes"){ |
||||
exclude(name:"*.*") |
||||
exclude(name:"bin/*.*") |
||||
exclude(name:"classes/**") |
||||
exclude(name:"com/fr/schedule/**") |
||||
exclude(name:"com/fr/cell/**") |
||||
exclude(name:"com/fr/dialog/**") |
||||
exclude(name:"com/fr/view/**") |
||||
exclude(name:"com/fr/web/**") |
||||
exclude(name:"com/fr/fs/**") |
||||
exclude(name:"com/fr/design/**") |
||||
exclude(name:"com/fr/start/**") |
||||
exclude(name:"com/fr/process/**") |
||||
} |
||||
fileset(dir:"./tmp"){ |
||||
include(name:"javax/mail/**") |
||||
include(name:"javax/servlet/**") |
||||
include(name:"org/freehep/**") |
||||
include(name:"com/fr/third/JAI/**") |
||||
include(name:"com/fr/third/antlr/**") |
||||
include(name:"com/fr/third/javax/**") |
||||
include(name:"com/sun/xml/**") |
||||
include(name:"javax/xml/**") |
||||
|
||||
} |
||||
fileset(dir:"build/classes"){ |
||||
include(name:"com/fr/web/*.class") |
||||
include(name:"com/fr/web/attr/*.class") |
||||
} |
||||
} |
||||
delete(dir:"./tmp") |
||||
def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" |
||||
def keystore="frapplet.store" |
||||
def keycert="fr.cert" |
||||
def keypassword="123456" |
||||
def keyalias="fr" |
||||
|
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") |
||||
} |
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") |
||||
} |
||||
|
||||
exec(executable:"${jdk6home}/bin/jarsigner"){ |
||||
arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fine-applet-10.0.jar' ${keyalias}") |
||||
} |
||||
delete(file:"${keystore}") |
||||
delete(file:"${keycert}") |
||||
delete(dir:"build/classes") |
||||
|
||||
} |
||||
|
||||
} |
@ -1,86 +0,0 @@
|
||||
apply plugin: "java" |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = "UTF-8" |
||||
} |
||||
|
||||
def basicDir="../../" |
||||
def libDir="${basicDir}/finereport-lib-stable" |
||||
//获取什么分支名 |
||||
FileTree files =fileTree(dir:"./",include:"build.*.gradle") |
||||
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ("\\")) |
||||
def branchName=buildDir.substring(buildDir.lastIndexOf ("\\")+1) |
||||
|
||||
task appletJar<<{ |
||||
|
||||
ant{ |
||||
mkdir(dir:"./tmp") |
||||
mkdir(dir:"build/classes/") |
||||
copy(todir:"build/classes/"){ |
||||
fileset(dir:"${basicDir}/finereport-core-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-chart-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-report-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-platform-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-performance-stable/${branchName}/build/classes/main") |
||||
|
||||
} |
||||
unjar(src:"${libDir}/${branchName}/3rd.jar",dest:"./tmp") |
||||
unjar(src:"${libDir}/${branchName}/servlet-api.jar",dest:"./tmp") |
||||
jar(jarfile:"build/libs/fr-applet-8.0.jar"){ |
||||
fileset(dir:"build/classes"){ |
||||
exclude(name:"*.*") |
||||
exclude(name:"bin/*.*") |
||||
exclude(name:"classes/**") |
||||
exclude(name:"com/fr/schedule/**") |
||||
exclude(name:"com/fr/cell/**") |
||||
exclude(name:"com/fr/dialog/**") |
||||
exclude(name:"com/fr/view/**") |
||||
exclude(name:"com/fr/web/**") |
||||
exclude(name:"com/fr/fs/**") |
||||
exclude(name:"com/fr/design/**") |
||||
exclude(name:"com/fr/start/**") |
||||
exclude(name:"com/fr/process/**") |
||||
} |
||||
fileset(dir:"./tmp"){ |
||||
include(name:"javax/mail/**") |
||||
include(name:"javax/servlet/**") |
||||
include(name:"org/freehep/**") |
||||
include(name:"com/fr/third/JAI/**") |
||||
include(name:"com/fr/third/antlr/**") |
||||
include(name:"com/fr/third/javax/**") |
||||
include(name:"com/sun/xml/**") |
||||
include(name:"javax/xml/**") |
||||
|
||||
} |
||||
fileset(dir:"build/classes"){ |
||||
include(name:"com/fr/web/*.class") |
||||
include(name:"com/fr/web/attr/*.class") |
||||
} |
||||
} |
||||
delete(dir:"./tmp") |
||||
def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" |
||||
def keystore="frapplet.store" |
||||
def keycert="fr.cert" |
||||
def keypassword="123456" |
||||
def keyalias="fr" |
||||
|
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") |
||||
} |
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") |
||||
} |
||||
|
||||
exec(executable:"${jdk6home}/bin/jarsigner"){ |
||||
arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-8.0.jar' ${keyalias}") |
||||
} |
||||
delete(file:"${keystore}") |
||||
delete(file:"${keycert}") |
||||
delete(dir:"build/classes") |
||||
|
||||
} |
||||
|
||||
} |
@ -1,86 +0,0 @@
|
||||
apply plugin: "java" |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = "UTF-8" |
||||
} |
||||
|
||||
def basicDir="../../" |
||||
def libDir="${basicDir}/finereport-lib-stable" |
||||
//获取什么分支名 |
||||
FileTree files =fileTree(dir:"./",include:"build.*.gradle") |
||||
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ("\\")) |
||||
def branchName=buildDir.substring(buildDir.lastIndexOf ("\\")+1) |
||||
|
||||
task appletJar<<{ |
||||
|
||||
ant{ |
||||
mkdir(dir:"./tmp") |
||||
mkdir(dir:"build/classes/") |
||||
copy(todir:"build/classes/"){ |
||||
fileset(dir:"${basicDir}/finereport-core-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-chart-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-report-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-platform-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-performance-stable/${branchName}/build/classes/main") |
||||
|
||||
} |
||||
unjar(src:"${libDir}/${branchName}/3rd.jar",dest:"./tmp") |
||||
unjar(src:"${libDir}/${branchName}/servlet-api.jar",dest:"./tmp") |
||||
jar(jarfile:"build/libs/fr-applet-8.0.jar"){ |
||||
fileset(dir:"build/classes"){ |
||||
exclude(name:"*.*") |
||||
exclude(name:"bin/*.*") |
||||
exclude(name:"classes/**") |
||||
exclude(name:"com/fr/schedule/**") |
||||
exclude(name:"com/fr/cell/**") |
||||
exclude(name:"com/fr/dialog/**") |
||||
exclude(name:"com/fr/view/**") |
||||
exclude(name:"com/fr/web/**") |
||||
exclude(name:"com/fr/fs/**") |
||||
exclude(name:"com/fr/design/**") |
||||
exclude(name:"com/fr/start/**") |
||||
exclude(name:"com/fr/process/**") |
||||
} |
||||
fileset(dir:"./tmp"){ |
||||
include(name:"javax/mail/**") |
||||
include(name:"javax/servlet/**") |
||||
include(name:"org/freehep/**") |
||||
include(name:"com/fr/third/JAI/**") |
||||
include(name:"com/fr/third/antlr/**") |
||||
include(name:"com/fr/third/javax/**") |
||||
include(name:"com/sun/xml/**") |
||||
include(name:"javax/xml/**") |
||||
|
||||
} |
||||
fileset(dir:"build/classes"){ |
||||
include(name:"com/fr/web/*.class") |
||||
include(name:"com/fr/web/attr/*.class") |
||||
} |
||||
} |
||||
delete(dir:"./tmp") |
||||
def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" |
||||
def keystore="frapplet.store" |
||||
def keycert="fr.cert" |
||||
def keypassword="123456" |
||||
def keyalias="fr" |
||||
|
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") |
||||
} |
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") |
||||
} |
||||
|
||||
exec(executable:"${jdk6home}/bin/jarsigner"){ |
||||
arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-8.0.jar' ${keyalias}") |
||||
} |
||||
delete(file:"${keystore}") |
||||
delete(file:"${keycert}") |
||||
delete(dir:"build/classes") |
||||
|
||||
} |
||||
|
||||
} |
@ -1,86 +0,0 @@
|
||||
apply plugin: "java" |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = "UTF-8" |
||||
} |
||||
|
||||
def basicDir="../../" |
||||
def libDir="${basicDir}/finereport-lib-stable" |
||||
//获取什么分支名 |
||||
FileTree files =fileTree(dir:"./",include:"build.*.gradle") |
||||
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ("\\")) |
||||
def branchName=buildDir.substring(buildDir.lastIndexOf ("\\")+1) |
||||
|
||||
task appletJar<<{ |
||||
|
||||
ant{ |
||||
mkdir(dir:"${libDir}/tmp-${branchName}") |
||||
mkdir(dir:"build/classes/") |
||||
copy(todir:"build/classes/"){ |
||||
fileset(dir:"${basicDir}/finereport-core-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-chart-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-report-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-platform-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-performance-stable/${branchName}/build/classes/main") |
||||
|
||||
} |
||||
unjar(src:"${libDir}/${branchName}/3rd.jar",dest:"${libDir}/tmp-${branchName}") |
||||
unjar(src:"${libDir}/branchName/servlet-api.jar",dest:"${libDir}/tmp-${branchName}") |
||||
jar(jarfile:"build/libs/fr-applet-8.0.jar"){ |
||||
fileset(dir:"build/classes"){ |
||||
exclude(name:"*.*") |
||||
exclude(name:"bin/*.*") |
||||
exclude(name:"classes/**") |
||||
exclude(name:"com/fr/schedule/**") |
||||
exclude(name:"com/fr/cell/**") |
||||
exclude(name:"com/fr/dialog/**") |
||||
exclude(name:"com/fr/view/**") |
||||
exclude(name:"com/fr/web/**") |
||||
exclude(name:"com/fr/fs/**") |
||||
exclude(name:"com/fr/design/**") |
||||
exclude(name:"com/fr/start/**") |
||||
exclude(name:"com/fr/process/**") |
||||
} |
||||
fileset(dir:"${libDir}/tmp-${branchName}"){ |
||||
include(name:"javax/mail/**") |
||||
include(name:"javax/servlet/**") |
||||
include(name:"org/freehep/**") |
||||
include(name:"com/fr/third/JAI/**") |
||||
include(name:"com/fr/third/antlr/**") |
||||
include(name:"com/fr/third/javax/**") |
||||
include(name:"com/sun/xml/**") |
||||
include(name:"javax/xml/**") |
||||
|
||||
} |
||||
fileset(dir:"build/classes"){ |
||||
include(name:"com/fr/web/*.class") |
||||
include(name:"com/fr/web/attr/*.class") |
||||
} |
||||
} |
||||
delete(dir:"${libDir}/tmp-${branchName}") |
||||
def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" |
||||
def keystore="frapplet.store" |
||||
def keycert="fr.cert" |
||||
def keypassword="123456" |
||||
def keyalias="fr" |
||||
|
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") |
||||
} |
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") |
||||
} |
||||
|
||||
exec(executable:"${jdk6home}/bin/jarsigner"){ |
||||
arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-8.0.jar' ${keyalias}") |
||||
} |
||||
delete(file:"${keystore}") |
||||
delete(file:"${keycert}") |
||||
delete(dir:"build/classes") |
||||
|
||||
} |
||||
|
||||
} |
@ -1,75 +0,0 @@
|
||||
apply plugin: "java" |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = "UTF-8" |
||||
} |
||||
|
||||
def basicDir="../" |
||||
def libDir="${basicDir}/lib" |
||||
|
||||
task appletJar<<{ |
||||
ant{ |
||||
mkdir(dir:"./tmp") |
||||
mkdir(dir:"build/classes/main") |
||||
copy(todir:"build/classes/"){ |
||||
fileset(dir:"${basicDir}/core/build/classes/main") |
||||
fileset(dir:"${basicDir}/chart/build/classes/main") |
||||
fileset(dir:"${basicDir}/report/build/classes/main") |
||||
fileset(dir:"${basicDir}/platform/build/classes/main") |
||||
} |
||||
unjar(src:"${libDir}/3rd.jar",dest:"./tmp") |
||||
unjar(src:"${libDir}/servlet-api.jar",dest:"./tmp") |
||||
jar(jarfile:"build/libs/fr-applet-8.0.jar"){ |
||||
fileset(dir:"build/classes"){ |
||||
exclude(name:"*.*") |
||||
exclude(name:"bin/*.*") |
||||
exclude(name:"classes/**") |
||||
exclude(name:"com/fr/schedule/**") |
||||
exclude(name:"com/fr/cell/**") |
||||
exclude(name:"com/fr/dialog/**") |
||||
exclude(name:"com/fr/view/**") |
||||
exclude(name:"com/fr/web/**") |
||||
exclude(name:"com/fr/fs/**") |
||||
exclude(name:"com/fr/design/**") |
||||
exclude(name:"com/fr/start/**") |
||||
exclude(name:"com/fr/process/**") |
||||
} |
||||
fileset(dir:"./tmp"){ |
||||
include(name:"javax/mail/**") |
||||
include(name:"javax/servlet/**") |
||||
include(name:"org/freehep/**") |
||||
include(name:"com/fr/third/JAI/**") |
||||
include(name:"com/fr/third/antlr/**") |
||||
include(name:"com/fr/third/javax/**") |
||||
include(name:"com/sun/xml/**") |
||||
include(name:"javax/xml/**") |
||||
|
||||
} |
||||
fileset(dir:"build/classes"){ |
||||
include(name:"com/fr/web/*.class") |
||||
include(name:"com/fr/web/attr/*.class") |
||||
} |
||||
} |
||||
delete(dir:"./tmp") |
||||
def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" |
||||
def keystore="frapplet.store" |
||||
def keycert="fr.cert" |
||||
def keypassword="123456" |
||||
def keyalias="fr" |
||||
|
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") |
||||
} |
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") |
||||
} |
||||
|
||||
exec(executable:"${jdk6home}/bin/jarsigner"){ |
||||
arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-8.0.jar' ${keyalias}") |
||||
} |
||||
delete(file:"${keystore}") |
||||
delete(file:"${keycert}") |
||||
delete(dir:"build/classes") |
||||
|
||||
} |
||||
|
||||
} |
@ -1,76 +0,0 @@
|
||||
apply plugin: "java" |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = "UTF-8" |
||||
} |
||||
|
||||
def basicDir="../" |
||||
def libDir="${basicDir}/lib" |
||||
|
||||
task appletJar<<{ |
||||
ant{ |
||||
mkdir(dir:"./tmp") |
||||
mkdir(dir:"build/classes/main") |
||||
copy(todir:"build/classes/"){ |
||||
fileset(dir:"${basicDir}/core/build/classes/main") |
||||
fileset(dir:"${basicDir}/chart/build/classes/main") |
||||
fileset(dir:"${basicDir}/report/build/classes/main") |
||||
fileset(dir:"${basicDir}/platform/build/classes/main") |
||||
fileset(dir:"${basicDir}/performance/build/classes/main") |
||||
} |
||||
unjar(src:"${libDir}/3rd.jar",dest:"./tmp") |
||||
unjar(src:"${libDir}/servlet-api.jar",dest:"./tmp") |
||||
jar(jarfile:"build/libs/fr-applet-8.0.jar"){ |
||||
fileset(dir:"build/classes"){ |
||||
exclude(name:"*.*") |
||||
exclude(name:"bin/*.*") |
||||
exclude(name:"classes/**") |
||||
exclude(name:"com/fr/schedule/**") |
||||
exclude(name:"com/fr/cell/**") |
||||
exclude(name:"com/fr/dialog/**") |
||||
exclude(name:"com/fr/view/**") |
||||
exclude(name:"com/fr/web/**") |
||||
exclude(name:"com/fr/fs/**") |
||||
exclude(name:"com/fr/design/**") |
||||
exclude(name:"com/fr/start/**") |
||||
exclude(name:"com/fr/process/**") |
||||
} |
||||
fileset(dir:"./tmp"){ |
||||
include(name:"javax/mail/**") |
||||
include(name:"javax/servlet/**") |
||||
include(name:"org/freehep/**") |
||||
include(name:"com/fr/third/JAI/**") |
||||
include(name:"com/fr/third/antlr/**") |
||||
include(name:"com/fr/third/javax/**") |
||||
include(name:"com/sun/xml/**") |
||||
include(name:"javax/xml/**") |
||||
|
||||
} |
||||
fileset(dir:"build/classes"){ |
||||
include(name:"com/fr/web/*.class") |
||||
include(name:"com/fr/web/attr/*.class") |
||||
} |
||||
} |
||||
delete(dir:"./tmp") |
||||
def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" |
||||
def keystore="frapplet.store" |
||||
def keycert="fr.cert" |
||||
def keypassword="123456" |
||||
def keyalias="fr" |
||||
|
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") |
||||
} |
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") |
||||
} |
||||
|
||||
exec(executable:"${jdk6home}/bin/jarsigner"){ |
||||
arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-8.0.jar' ${keyalias}") |
||||
} |
||||
delete(file:"${keystore}") |
||||
delete(file:"${keycert}") |
||||
delete(dir:"build/classes") |
||||
|
||||
} |
||||
|
||||
} |
@ -1,86 +0,0 @@
|
||||
apply plugin: "java" |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = "UTF-8" |
||||
} |
||||
|
||||
def basicDir="../../" |
||||
def libDir="${basicDir}/finereport-lib-stable" |
||||
//获取什么分支名 |
||||
FileTree files =fileTree(dir:"./",include:"build.*.gradle") |
||||
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ("\\")) |
||||
def branchName=buildDir.substring(buildDir.lastIndexOf ("\\")+1) |
||||
|
||||
task appletJar<<{ |
||||
|
||||
ant{ |
||||
mkdir(dir:"./tmp") |
||||
mkdir(dir:"build/classes/") |
||||
copy(todir:"build/classes/"){ |
||||
fileset(dir:"${basicDir}/finereport-core-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-chart-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-report-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-platform-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-performance-stable/${branchName}/build/classes/main") |
||||
|
||||
} |
||||
unjar(src:"${libDir}/${branchName}/3rd.jar",dest:"./tmp") |
||||
unjar(src:"${libDir}/${branchName}/servlet-api.jar",dest:"./tmp") |
||||
jar(jarfile:"build/libs/fr-applet-8.0.jar"){ |
||||
fileset(dir:"build/classes"){ |
||||
exclude(name:"*.*") |
||||
exclude(name:"bin/*.*") |
||||
exclude(name:"classes/**") |
||||
exclude(name:"com/fr/schedule/**") |
||||
exclude(name:"com/fr/cell/**") |
||||
exclude(name:"com/fr/dialog/**") |
||||
exclude(name:"com/fr/view/**") |
||||
exclude(name:"com/fr/web/**") |
||||
exclude(name:"com/fr/fs/**") |
||||
exclude(name:"com/fr/design/**") |
||||
exclude(name:"com/fr/start/**") |
||||
exclude(name:"com/fr/process/**") |
||||
} |
||||
fileset(dir:"./tmp"){ |
||||
include(name:"javax/mail/**") |
||||
include(name:"javax/servlet/**") |
||||
include(name:"org/freehep/**") |
||||
include(name:"com/fr/third/JAI/**") |
||||
include(name:"com/fr/third/antlr/**") |
||||
include(name:"com/fr/third/javax/**") |
||||
include(name:"com/sun/xml/**") |
||||
include(name:"javax/xml/**") |
||||
|
||||
} |
||||
fileset(dir:"build/classes"){ |
||||
include(name:"com/fr/web/*.class") |
||||
include(name:"com/fr/web/attr/*.class") |
||||
} |
||||
} |
||||
delete(dir:"./tmp") |
||||
def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" |
||||
def keystore="frapplet.store" |
||||
def keycert="fr.cert" |
||||
def keypassword="123456" |
||||
def keyalias="fr" |
||||
|
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") |
||||
} |
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") |
||||
} |
||||
|
||||
exec(executable:"${jdk6home}/bin/jarsigner"){ |
||||
arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-8.0.jar' ${keyalias}") |
||||
} |
||||
delete(file:"${keystore}") |
||||
delete(file:"${keycert}") |
||||
delete(dir:"build/classes") |
||||
|
||||
} |
||||
|
||||
} |
@ -1,85 +0,0 @@
|
||||
apply plugin: "java" |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = "UTF-8" |
||||
} |
||||
def basicDir="../../" |
||||
def libDir="${basicDir}/finereport-lib-stable/master" |
||||
//获取什么分支名 |
||||
FileTree files =fileTree(dir:"./",include:"build.*.gradle") |
||||
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ("\\")) |
||||
def branchName=buildDir.substring(buildDir.lastIndexOf ("\\")+1) |
||||
|
||||
task appletJar<<{ |
||||
|
||||
ant{ |
||||
mkdir(dir:"${libDir}/tmp-${branchName}") |
||||
mkdir(dir:"build/classes/") |
||||
copy(todir:"build/classes/"){ |
||||
fileset(dir:"${basicDir}/finereport-core-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-chart-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-report-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-platform-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-performance-stable/${branchName}/build/classes/main") |
||||
|
||||
} |
||||
unjar(src:"${libDir}/3rd.jar",dest:"${libDir}/tmp-${branchName}") |
||||
unjar(src:"${libDir}/${branchName}/servlet-api.jar",dest:"${libDir}/tmp-${branchName}") |
||||
jar(jarfile:"build/libs/fr-applet-8.0.jar"){ |
||||
fileset(dir:"build/classes"){ |
||||
exclude(name:"*.*") |
||||
exclude(name:"bin/*.*") |
||||
exclude(name:"classes/**") |
||||
exclude(name:"com/fr/schedule/**") |
||||
exclude(name:"com/fr/cell/**") |
||||
exclude(name:"com/fr/dialog/**") |
||||
exclude(name:"com/fr/view/**") |
||||
exclude(name:"com/fr/web/**") |
||||
exclude(name:"com/fr/fs/**") |
||||
exclude(name:"com/fr/design/**") |
||||
exclude(name:"com/fr/start/**") |
||||
exclude(name:"com/fr/process/**") |
||||
} |
||||
fileset(dir:"${libDir}/tmp-${branchName}"){ |
||||
include(name:"javax/mail/**") |
||||
include(name:"javax/servlet/**") |
||||
include(name:"org/freehep/**") |
||||
include(name:"com/fr/third/JAI/**") |
||||
include(name:"com/fr/third/antlr/**") |
||||
include(name:"com/fr/third/javax/**") |
||||
include(name:"com/sun/xml/**") |
||||
include(name:"javax/xml/**") |
||||
|
||||
} |
||||
fileset(dir:"build/classes"){ |
||||
include(name:"com/fr/web/*.class") |
||||
include(name:"com/fr/web/attr/*.class") |
||||
} |
||||
} |
||||
delete(dir:"${libDir}/tmp-${branchName}") |
||||
def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" |
||||
def keystore="frapplet.store" |
||||
def keycert="fr.cert" |
||||
def keypassword="123456" |
||||
def keyalias="fr" |
||||
|
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") |
||||
} |
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") |
||||
} |
||||
|
||||
exec(executable:"${jdk6home}/bin/jarsigner"){ |
||||
arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-8.0.jar' ${keyalias}") |
||||
} |
||||
delete(file:"${keystore}") |
||||
delete(file:"${keycert}") |
||||
delete(dir:"build/classes") |
||||
|
||||
} |
||||
|
||||
} |
@ -1,45 +0,0 @@
|
||||
|
||||
apply plugin: 'java' |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = 'UTF-8' |
||||
} |
||||
//指定构建的jdk版本 |
||||
sourceCompatibility=1.8 |
||||
|
||||
//jar包版本 |
||||
version='10.0' |
||||
//jar包名称 |
||||
jar{ |
||||
baseName='fine-report-designer' |
||||
} |
||||
|
||||
def srcDir="." |
||||
def baseDir=".." |
||||
|
||||
//获取什么分支名 |
||||
FileTree files =fileTree(dir:'./',include:'build.*.gradle') |
||||
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) |
||||
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) |
||||
|
||||
//输出jar名称 |
||||
FileTree f=fileTree(dir:"${baseDir}/design/designer_base/build/libs",include:"**/*.jar"); |
||||
f.each{File file-> |
||||
println "----------${file.path}" |
||||
} |
||||
task unjars { |
||||
ant{ |
||||
unjar(dest:"build/classes/main"){ |
||||
fileset(dir:"${baseDir}/design/designer_base/build/libs"){ |
||||
include(name:'fr-*.jar') |
||||
} |
||||
fileset(dir:"${baseDir}/design/designer_chart/build/libs"){ |
||||
include(name:'fr-*.jar') |
||||
} |
||||
fileset(dir:"${baseDir}/design/designer_form/build/libs"){ |
||||
include(name:'fr-*.jar') |
||||
} |
||||
} |
||||
|
||||
} |
||||
} |
||||
jar.dependsOn unjars |
@ -0,0 +1,5 @@
|
||||
*.iml |
||||
.idea/ |
||||
.DS_Store |
||||
.classpath |
||||
.project |
@ -0,0 +1,104 @@
|
||||
apply plugin: 'java' |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = 'UTF-8' |
||||
} |
||||
buildscript { |
||||
repositories { |
||||
maven { |
||||
url "https://maven.eveoh.nl/content/repositories/releases" |
||||
} |
||||
} |
||||
|
||||
dependencies { |
||||
classpath "nl.eveoh:gradle-aspectj:1.6" |
||||
} |
||||
} |
||||
|
||||
repositories { |
||||
mavenCentral() |
||||
} |
||||
|
||||
project.ext { |
||||
aspectjVersion = '1.8.4' |
||||
} |
||||
|
||||
apply plugin: 'aspectj' |
||||
|
||||
//指定构建的jdk版本 |
||||
sourceCompatibility=1.8 |
||||
//指定生成jar包版本 |
||||
version='10.0' |
||||
//生成jar包重命名 |
||||
jar{ |
||||
baseName='fr-designer-core' |
||||
} |
||||
|
||||
|
||||
def srcDir="." |
||||
def baseDir=".." |
||||
ant{ |
||||
delete(dir:"src/main") |
||||
mkdir(dir:"src/main/java") |
||||
move(todir:"src/main/java"){ |
||||
fileset(dir:"src",includes:"com/**") |
||||
} |
||||
} |
||||
//指定源码路径 |
||||
//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:"../${baseDir}/lib-other",include:'**/*.jar') |
||||
compile fileTree(dir:"../${baseDir}/lib-core",include:'**/*.jar') |
||||
compile fileTree(dir:"../${baseDir}/lib-design",include:'**/*.jar') |
||||
compile fileTree(dir:"../${baseDir}",include:"**/build/libs/*.jar",exclude:"bi/**/*.jar") |
||||
testCompile 'junit:junit:4.12' |
||||
} |
||||
|
||||
//输出依赖报 |
||||
FileTree f=fileTree(dir:"../${baseDir}/lib-design",include:"**/*.jar"); |
||||
f.each{File file-> |
||||
println "----------${file.path}" |
||||
} |
||||
//复制非.java文件到classes文件夹下参与打包 |
||||
task copyFile(type:Copy,dependsOn:compileJava){ |
||||
copy{ |
||||
from ("${srcDir}/src/main/java"){ |
||||
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:"../${baseDir}/lib4build",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/main/java"){ |
||||
include (name:'**/*.js') |
||||
include (name:'**/*.css') |
||||
} |
||||
|
||||
} |
||||
} |
||||
jar.dependsOn compressJS |
||||
|
||||
|
||||
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<parent> |
||||
<groupId>com.fr.report</groupId> |
||||
<artifactId>design</artifactId> |
||||
<version>10.0-FEATURE-SNAPSHOT</version> |
||||
</parent> |
||||
<groupId>com.fr.report</groupId> |
||||
<artifactId>designer-base</artifactId> |
||||
<version>10.0-FEATURE-SNAPSHOT</version> |
||||
</project> |
@ -0,0 +1,149 @@
|
||||
package com.fr.design; |
||||
|
||||
import com.fr.base.Parameter; |
||||
import com.fr.base.io.IOFile; |
||||
import com.fr.data.TableDataSource; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.design.mainframe.JTemplateProvider; |
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.stable.js.WidgetName; |
||||
|
||||
import java.util.Iterator; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 当前的设计器模式 |
||||
* |
||||
* @author zhou |
||||
* @since 2012-7-26上午11:24:54 |
||||
*/ |
||||
public abstract class DesignModelAdapter<T extends IOFile, S extends JTemplateProvider> { |
||||
|
||||
private static DesignModelAdapter<?, ?> currentModelAdapter; |
||||
protected S jTemplate; |
||||
|
||||
public DesignModelAdapter(S jTemplate) { |
||||
this.jTemplate = jTemplate; |
||||
setCurrentModelAdapter(this); |
||||
} |
||||
|
||||
public S getjTemplate() { |
||||
return jTemplate; |
||||
} |
||||
|
||||
public void setjTemplate(S jTemplate) { |
||||
this.jTemplate = jTemplate; |
||||
} |
||||
|
||||
public T getBook() { |
||||
return (T) ((JTemplate) jTemplate).getTarget(); |
||||
} |
||||
|
||||
public static void setCurrentModelAdapter(DesignModelAdapter<?, ?> model) { |
||||
currentModelAdapter = model; |
||||
} |
||||
|
||||
public static DesignModelAdapter<?, ?> getCurrentModelAdapter() { |
||||
return currentModelAdapter; |
||||
} |
||||
|
||||
/** |
||||
* 响应目标改变事件. |
||||
*/ |
||||
public void fireTargetModified() { |
||||
((JTemplate) this.jTemplate).fireTargetModified(); |
||||
} |
||||
|
||||
public String[] getFloatNames() { |
||||
return new String[0]; |
||||
} |
||||
|
||||
public Parameter[] getParameters() { |
||||
return new Parameter[0]; |
||||
} |
||||
|
||||
// 报表参数
|
||||
public Parameter[] getReportParameters() { |
||||
return new Parameter[0]; |
||||
} |
||||
|
||||
/** |
||||
* 数据源参数 |
||||
* |
||||
* @return |
||||
*/ |
||||
public Parameter[] getTableDataParameters() { |
||||
return new Parameter[0]; |
||||
} |
||||
|
||||
/** |
||||
* 重命名数据集 |
||||
* |
||||
* @param oldName 旧名字 |
||||
* @param newName 新名字 |
||||
* @param isNeedFireModified 是否需要触发保存 |
||||
* @return 重命名成功返回True |
||||
*/ |
||||
public boolean renameTableData(String oldName, String newName, boolean isNeedFireModified) { |
||||
if (!ComparatorUtils.equals(oldName, newName)) { |
||||
TableDataSource tds = getBook(); |
||||
boolean b; |
||||
b = tds.renameTableData(oldName, newName); |
||||
if (!b) { |
||||
return b; |
||||
} |
||||
if (isNeedFireModified) { |
||||
fireTargetModified(); |
||||
} |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
/** |
||||
* 重命名TableData后的一些操作 |
||||
* |
||||
* @param oldName 旧名字 |
||||
* @param newName 新名字. |
||||
* @return 返回是否名字一样. |
||||
*/ |
||||
public boolean renameTableData(String oldName, String newName) { |
||||
return renameTableData(oldName, newName, true); |
||||
} |
||||
|
||||
/** |
||||
* 重命名tabledata |
||||
* |
||||
* @param map 新名字 |
||||
*/ |
||||
public void renameTableData(Map<String, String> map) { |
||||
if (map.isEmpty()) { |
||||
return; |
||||
} |
||||
Iterator<String> iterator = map.keySet().iterator(); |
||||
while (iterator.hasNext()) { |
||||
String key = iterator.next(); |
||||
renameTableData(key, map.get(key)); |
||||
} |
||||
} |
||||
|
||||
public abstract Widget[] getLinkableWidgets() ; |
||||
|
||||
public abstract List<WidgetName> getWidgetsName(); |
||||
|
||||
/** |
||||
* 环境改变. |
||||
*/ |
||||
public abstract void envChanged(); |
||||
|
||||
/** |
||||
* 参数改变. |
||||
*/ |
||||
public abstract void parameterChanged(); |
||||
|
||||
/** |
||||
* 控件配置改变. |
||||
*/ |
||||
public abstract void widgetConfigChanged(); |
||||
} |
@ -0,0 +1,73 @@
|
||||
package com.fr.design; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.Env; |
||||
import com.fr.base.FRContext; |
||||
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; |
||||
import com.fr.env.RemoteEnv; |
||||
|
||||
/** |
||||
* Created by IntelliJ IDEA. |
||||
* Author : daisy |
||||
* Version: 6.5.6 |
||||
* Date: 13-12-24 |
||||
* Time: 上午9:36 |
||||
* 记录现在设计器的设计状态 |
||||
*/ |
||||
public class DesignState { |
||||
|
||||
//菜单的几种情况
|
||||
//Jwrok
|
||||
|
||||
//worksheet
|
||||
public static final int WORK_SHEET = 0; |
||||
//polyDesogner
|
||||
public static final int POLY_SHEET = 1; |
||||
//参数面板
|
||||
public static final int PARAMETER_PANE = 2; |
||||
|
||||
|
||||
//From
|
||||
public static final int JFORM = 4; |
||||
|
||||
|
||||
//是不是在远程
|
||||
public static final int REMOTE = 8; |
||||
|
||||
//设计状态
|
||||
private int designState = -1; |
||||
private boolean isRoot = true;//默认是管理员登陆
|
||||
private boolean isAuthority = false; |
||||
|
||||
public DesignState(ToolBarMenuDockPlus plus) { |
||||
designState = plus.getMenuState(); |
||||
Env env = FRContext.getCurrentEnv(); |
||||
if (env != null && env instanceof RemoteEnv) { |
||||
designState += REMOTE; |
||||
} |
||||
isRoot = env != null && env.isRoot(); |
||||
isAuthority = BaseUtils.isAuthorityEditing(); |
||||
} |
||||
|
||||
public int getDesignState() { |
||||
return designState; |
||||
} |
||||
|
||||
/** |
||||
* 是否是管理员 |
||||
* @return 是管理员返回true |
||||
*/ |
||||
public boolean isRoot() { |
||||
return this.isRoot; |
||||
} |
||||
|
||||
/** |
||||
* 是否处于权限编辑状态 |
||||
* @return 是则返回true |
||||
*/ |
||||
public boolean isAuthority() { |
||||
return isAuthority; |
||||
} |
||||
|
||||
|
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,11 @@
|
||||
package com.fr.design.Exception; |
||||
|
||||
public class ValidationException extends Exception { |
||||
|
||||
public ValidationException() { |
||||
} |
||||
|
||||
public ValidationException(String msg) { |
||||
super(msg); |
||||
} |
||||
} |
@ -0,0 +1,41 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions; |
||||
|
||||
import javax.swing.JCheckBoxMenuItem; |
||||
|
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.imenu.UICheckBoxMenuItem; |
||||
|
||||
/** |
||||
* check box |
||||
*/ |
||||
public abstract class CheckBoxAction extends UpdateAction { |
||||
public UICheckBoxMenuItem createMenuItem() { |
||||
Object object = this.getValue(UICheckBoxMenuItem.class.getName()); |
||||
if (object == null) { |
||||
object = createCheckBoxMenuItem(this); |
||||
this.putValue(UICheckBoxMenuItem.class.getName(), object); |
||||
} |
||||
|
||||
// isSelected.
|
||||
((JCheckBoxMenuItem) object).setSelected(this.isSelected()); |
||||
|
||||
return (UICheckBoxMenuItem) object; |
||||
} |
||||
|
||||
|
||||
|
||||
public abstract boolean isSelected(); |
||||
|
||||
|
||||
public boolean isRadioSelect() { |
||||
return false; |
||||
} |
||||
|
||||
public void setSelected(boolean isSelected) { |
||||
UIButton button = (UIButton) this.createToolBarComponent(); |
||||
button.setSelected(isSelected); |
||||
} |
||||
} |
@ -0,0 +1,57 @@
|
||||
/* |
||||
* Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
|
||||
package com.fr.design.actions; |
||||
|
||||
import com.fr.design.gui.controlpane.NameObjectCreator; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* Created by IntelliJ IDEA. |
||||
* Author : daisy |
||||
* Version: 6.5.6 |
||||
* Date: 14-2-26 |
||||
* Time: 上午10:47 |
||||
*/ |
||||
public abstract class HyperlinkPluginAction extends UpdateAction { |
||||
public static final String XML_TAG = "hyperlinkType"; |
||||
|
||||
public HyperlinkPluginAction() { |
||||
this.setName(this.getDisplayName()); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 名字 |
||||
* |
||||
* @return |
||||
*/ |
||||
public abstract String getDisplayName(); |
||||
|
||||
/** |
||||
* 得到超级链接的声明类 |
||||
* |
||||
* @return |
||||
*/ |
||||
public abstract Class getHyperlinkClass(); |
||||
|
||||
/** |
||||
* 得到相应面板的类 |
||||
* |
||||
* @return |
||||
*/ |
||||
public abstract Class getUpdateHyperlinkPaneClass(); |
||||
|
||||
public NameObjectCreator getHyperlinkCreator() { |
||||
return new NameObjectCreator(getDisplayName(), getHyperlinkClass(), getUpdateHyperlinkPaneClass()); |
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* @param e 动作 |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
} |
||||
} |
@ -0,0 +1,46 @@
|
||||
/* |
||||
* Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
|
||||
package com.fr.design.actions; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
|
||||
/** |
||||
* Created by IntelliJ IDEA. |
||||
* Author : daisy |
||||
* Version: 6.5.6 |
||||
* Date: 14-2-28 |
||||
* Time: 上午9:44 |
||||
*/ |
||||
public abstract class MenuAction extends UpdateAction { |
||||
|
||||
public MenuAction() { |
||||
this.setName(getDisplayName()); |
||||
this.setMnemonic(getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/bindColumn.png")); |
||||
} |
||||
|
||||
/** |
||||
* 名字 |
||||
* |
||||
* @return |
||||
*/ |
||||
public abstract String getDisplayName(); |
||||
|
||||
public char getMnemonic() { |
||||
return '\0'; |
||||
} |
||||
|
||||
/** |
||||
* 图标 |
||||
* |
||||
* @return |
||||
*/ |
||||
public String getIconPath() { |
||||
return StringUtils.EMPTY; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,84 @@
|
||||
package com.fr.design.actions; |
||||
|
||||
import javax.swing.SwingUtilities; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.data.DesignTableDataManager; |
||||
import com.fr.data.TableDataSource; |
||||
import com.fr.design.data.datapane.ReportTableDataPane; |
||||
import com.fr.design.data.datapane.TableDataTreePane; |
||||
import com.fr.design.data.tabledata.ResponseDataSourceChange; |
||||
import com.fr.design.DesignModelAdapter; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/* |
||||
* richer:包括报表和表单的数据集 && 图表的数据集 |
||||
*/ |
||||
public class TableDataSourceAction extends TemplateComponentAction<JTemplate<?, ?>> implements ResponseDataSourceChange { |
||||
public TableDataSourceAction(JTemplate<?, ?> t) { |
||||
super(t); |
||||
this.setMenuKeySet(KeySetUtils.TEMPLATE_TABLE_DATA_SOURCE); |
||||
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_web/datasource.png")); |
||||
} |
||||
|
||||
/** |
||||
* 执行动作 |
||||
* |
||||
* @return 是否执行成功 |
||||
*/ |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
final TableDataSource tds = this.getEditingComponent().getTarget(); |
||||
|
||||
final ReportTableDataPane tableDataPane = new ReportTableDataPane() { |
||||
public void complete() { |
||||
populate(tds); |
||||
} |
||||
}; |
||||
BasicDialog reportTableDataDialog = tableDataPane.showLargeWindow(SwingUtilities.getWindowAncestor(this.getEditingComponent()), null); |
||||
reportTableDataDialog.addDialogActionListener(new DialogActionAdapter() { |
||||
|
||||
@Override |
||||
public void doOk() { |
||||
DesignModelAdapter.getCurrentModelAdapter().renameTableData(tableDataPane.getDsNameChangedMap()); |
||||
tableDataPane.update(tds); |
||||
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); |
||||
TableDataSourceAction.this.getEditingComponent().fireTargetModified(); |
||||
fireDSChanged(tableDataPane.getDsNameChangedMap()); |
||||
} |
||||
}); |
||||
reportTableDataDialog.setVisible(true); |
||||
return false; |
||||
} |
||||
|
||||
// TODO ALEX_SEP 同JWorkBookAction,也不知道这个undo该如何处理
|
||||
|
||||
/** |
||||
* 撤销 |
||||
*/ |
||||
public void prepare4Undo() { |
||||
} |
||||
|
||||
/** |
||||
* 响应数据集改变 |
||||
*/ |
||||
public void fireDSChanged() { |
||||
fireDSChanged(new HashMap<String, String>()); |
||||
} |
||||
|
||||
/** |
||||
* 响应数据集改变 |
||||
* |
||||
* @param map 地图 |
||||
*/ |
||||
public void fireDSChanged(Map<String, String> map) { |
||||
DesignTableDataManager.fireDSChanged(map); |
||||
} |
||||
} |
@ -0,0 +1,15 @@
|
||||
package com.fr.design.actions; |
||||
|
||||
import com.fr.design.gui.ibutton.UIToggleButton; |
||||
|
||||
/** |
||||
* 具有ToggleButton属性的action,继承这个类的action就会有 |
||||
* |
||||
* @author zhou |
||||
* |
||||
*/ |
||||
|
||||
public interface ToggleButtonUpdateAction { |
||||
|
||||
public abstract UIToggleButton createToolBarComponent(); |
||||
} |
@ -0,0 +1,559 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions; |
||||
|
||||
import com.fr.base.NameStyle; |
||||
import com.fr.base.ScreenResolution; |
||||
import com.fr.base.Style; |
||||
import com.fr.design.actions.core.ActionFactory; |
||||
import com.fr.design.constants.UIConstants; |
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.imenu.*; |
||||
import com.fr.design.menu.ShortCut; |
||||
import com.fr.design.selection.SelectionListener; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.stable.pinyin.PinyinFormat; |
||||
import com.fr.stable.pinyin.PinyinHelper; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.border.Border; |
||||
import javax.swing.border.TitledBorder; |
||||
import java.awt.*; |
||||
import java.awt.event.ComponentEvent; |
||||
import java.beans.PropertyChangeListener; |
||||
import java.util.HashMap; |
||||
import java.util.Iterator; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* An UpdateAction functions allows actions to have an efficient transient state, |
||||
* it's update method is called every time the action is about to be displayed |
||||
* in UI - allowing the action to poll whatever information it wishes to update its state |
||||
* before being displayed |
||||
* As a regular Swing Action object - it stores the name, icon, and enabled state for a single action. |
||||
* <p/> |
||||
* For example, a 'cut' action my be enabled or disabled based on the state of the selection |
||||
* in a text component. Just before the edit menu is displayed, the cut action is given the |
||||
* opportunity to update itself, and will appear in the menu with the correct state. |
||||
* august:不需要考虑UpdateAction的持久化,难道需要持久化吗? 又不像以前那样保存docking的大小布局 |
||||
* 如果是ToggleButton,就额外继承ToggleButtonUpdateAction接口 |
||||
*/ |
||||
public abstract class UpdateAction extends ShortCut implements Action { |
||||
|
||||
/** |
||||
* Specifies whether action is enabled; the default is true. |
||||
*/ |
||||
private boolean enabled = true; |
||||
|
||||
/** |
||||
* Contains the array of key bindings. |
||||
* august:关键词key,是Action里面的final常量,如:Action.NAME、Action.SMALL_ICON等等 |
||||
*/ |
||||
private Map<String, Object> componentMap; |
||||
|
||||
private String searchText = StringUtils.EMPTY; |
||||
|
||||
|
||||
|
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public UpdateAction() { |
||||
//设置默认的small icon,必须有一个默认的图片,这样菜单整体美观.
|
||||
this.putValue(Action.SMALL_ICON, UIConstants.BLACK_ICON); |
||||
} |
||||
|
||||
/** |
||||
* Returns true if the action is enabled. |
||||
* |
||||
* @return true if the action is enabled, false otherwise |
||||
* @see Action#isEnabled |
||||
*/ |
||||
@Override |
||||
public boolean isEnabled() { |
||||
return enabled; |
||||
} |
||||
|
||||
/** |
||||
* Enables or disables the action. |
||||
* |
||||
* @param newValue true to enable the action, false to |
||||
* disable it |
||||
* @see Action#setEnabled |
||||
*/ |
||||
@Override |
||||
public void setEnabled(boolean newValue) { |
||||
boolean oldValue = this.enabled; |
||||
|
||||
if (oldValue != newValue) { |
||||
this.enabled = newValue; |
||||
|
||||
//循环遍历所有的Enable属性.
|
||||
Iterator<Object> valueIt = this.componentMap.values().iterator(); |
||||
while (valueIt.hasNext()) { |
||||
Object valueObject = valueIt.next(); |
||||
if (valueObject instanceof JComponent) { |
||||
((JComponent) valueObject).setEnabled(this.enabled); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Returns the name for the action, used for a menu or button. |
||||
* |
||||
* @return the name for the action. |
||||
*/ |
||||
public String getName() { |
||||
return (String) this.getValue(Action.NAME); |
||||
} |
||||
|
||||
/** |
||||
* Sets the name for the action, used for a menu or button. |
||||
* |
||||
* @param name the name for the action. |
||||
*/ |
||||
public void setName(String name) { |
||||
this.putValue(Action.NAME, name); |
||||
} |
||||
|
||||
/** |
||||
* Returns the smallIcon property setting. |
||||
* |
||||
* @return The small icon for the action. |
||||
*/ |
||||
public Icon getSmallIcon() { |
||||
return (Icon) this.getValue(Action.SMALL_ICON); |
||||
} |
||||
|
||||
/** |
||||
* Sets the smallIcon property. The smallIcon may be displayed as a menu item's icon or |
||||
* possibly as the icon for a button. This icon should be 16x16 pixels in size. |
||||
* |
||||
* @param smallIcon The small icon for the action. |
||||
*/ |
||||
public void setSmallIcon(Icon smallIcon) { |
||||
this.putValue(Action.SMALL_ICON, smallIcon); |
||||
} |
||||
|
||||
public void setSmallIcon(Icon[] smallIcon, boolean white) { |
||||
this.putValue(Action.SMALL_ICON, smallIcon); |
||||
} |
||||
|
||||
/** |
||||
* Returns the mnemonic property setting. |
||||
* |
||||
* @return The mnemonic character for the action. |
||||
*/ |
||||
public char getMnemonic() { |
||||
Integer n = (Integer) this.getValue(Action.MNEMONIC_KEY); |
||||
return n == null ? '\0' : (char) n.intValue(); |
||||
} |
||||
|
||||
/** |
||||
* Sets the mnemonic property. The mnemonic character is the 'hotkey' for the menu item |
||||
* or button displaying the action. This *must* be a character in the 'name' property, |
||||
* or it will have no effect. |
||||
* |
||||
* @param mnemonic The mnemonic character for the action |
||||
*/ |
||||
public void setMnemonic(char mnemonic) { |
||||
this.putValue(Action.MNEMONIC_KEY, new Integer(mnemonic)); |
||||
} |
||||
|
||||
/** |
||||
* Returns the key used for storing a <code>KeyStroke</code> to be used as the |
||||
* accelerator for the action. |
||||
* |
||||
* @return the key as the accelerator for the action. |
||||
*/ |
||||
public KeyStroke getAccelerator() { |
||||
return (KeyStroke) this.getValue(Action.ACCELERATOR_KEY); |
||||
} |
||||
|
||||
/** |
||||
* Sets the key used for storing a <code>KeyStroke</code> to be used as the |
||||
* accelerator for the action. |
||||
* |
||||
* @param accelerator the key as the accelerator for the action. |
||||
*/ |
||||
public void setAccelerator(KeyStroke accelerator) { |
||||
this.putValue(Action.ACCELERATOR_KEY, accelerator); |
||||
} |
||||
|
||||
/** |
||||
* update enable |
||||
*/ |
||||
public void update() { |
||||
} |
||||
|
||||
/** |
||||
* Gets the <code>Object</code> associated with the specified key. |
||||
* |
||||
* @param key a string containing the specified <code>key</code> |
||||
* @return the binding <code>Object</code> stored with this key; if there |
||||
* are no keys, it will return <code>null</code> |
||||
* @see Action#getValue |
||||
*/ |
||||
@Override |
||||
public Object getValue(String key) { |
||||
if (componentMap == null) { |
||||
return null; |
||||
} |
||||
return componentMap.get(key); |
||||
} |
||||
|
||||
/** |
||||
* Sets the <code>Value</code> associated with the specified key. |
||||
* |
||||
* @param key the <code>String</code> that identifies the stored object |
||||
* @param newValue the <code>Object</code> to store using this key |
||||
* @see Action#putValue |
||||
*/ |
||||
@Override |
||||
public void putValue(String key, Object newValue) { |
||||
if (componentMap == null) { |
||||
componentMap = new HashMap<String, Object>(); |
||||
} |
||||
|
||||
|
||||
if (newValue == null) { |
||||
componentMap.remove(key); |
||||
} else { |
||||
componentMap.put(key, newValue); |
||||
} |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public synchronized void removePropertyChangeListener(PropertyChangeListener listener) { |
||||
} |
||||
|
||||
/** |
||||
* Gets menu item. |
||||
* |
||||
* @return the created menu item. |
||||
*/ |
||||
public UIMenuItem createMenuItem() { |
||||
Object object = this.getValue(UIMenuItem.class.getName()); |
||||
if (object == null && !(object instanceof UIMenuItem)) { |
||||
UIMenuItem menuItem = new UIMenuItem(this); |
||||
// 设置名字用作单元测
|
||||
menuItem.setName(getName()); |
||||
object = menuItem; |
||||
|
||||
this.putValue(UIMenuItem.class.getName(), object); |
||||
} |
||||
return (UIMenuItem) object; |
||||
} |
||||
|
||||
public UIMenuEastAttrItem createMenuItemEastAttr() { |
||||
UIMenuEastAttrItem menuItem = new UIMenuEastAttrItem(this); |
||||
// 设置名字用作单元测
|
||||
menuItem.setName(getName()); |
||||
this.putValue(UIMenuItem.class.getName(), menuItem); |
||||
return menuItem; |
||||
} |
||||
|
||||
/** |
||||
* Gets component on toolbar. |
||||
* |
||||
* @return the created components on toolbar. |
||||
*/ |
||||
public JComponent createToolBarComponent() { |
||||
Object object = this.getValue(UIButton.class.getName()); |
||||
if (!(object instanceof AbstractButton)) { |
||||
UIButton button = null; |
||||
button = new UIButton(); |
||||
// 添加一个名字作为自动化测试用
|
||||
button.setName(getName()); |
||||
button.set4ToolbarButton(); |
||||
|
||||
//设置属性.
|
||||
Integer mnemonicInteger = (Integer) this.getValue(Action.MNEMONIC_KEY); |
||||
if (mnemonicInteger != null) { |
||||
button.setMnemonic((char) mnemonicInteger.intValue()); |
||||
} |
||||
|
||||
button.setIcon((Icon) this.getValue(Action.SMALL_ICON)); |
||||
button.addActionListener(this); |
||||
|
||||
button.registerKeyboardAction(this, this.getAccelerator(), JComponent.WHEN_IN_FOCUSED_WINDOW); |
||||
|
||||
this.putValue(UIButton.class.getName(), button); |
||||
button.setText(StringUtils.EMPTY); |
||||
button.setEnabled(this.isEnabled()); |
||||
|
||||
//peter:产生tooltip
|
||||
button.setToolTipText(ActionFactory.createButtonToolTipText(this)); |
||||
object = button; |
||||
} |
||||
|
||||
return (JComponent) object; |
||||
} |
||||
|
||||
/** |
||||
* Equals |
||||
*/ |
||||
@Override |
||||
public boolean equals(Object object) { |
||||
if (object == this) { |
||||
return true; |
||||
} |
||||
if (!(object instanceof UpdateAction)) { |
||||
return false; |
||||
} |
||||
return ComparatorUtils.equals(((UpdateAction) object).getName(), this.getName()); |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
int hash = 5; |
||||
hash = 59 * hash + (this.enabled ? 1 : 0); |
||||
return hash; |
||||
} |
||||
|
||||
/* |
||||
* Add this ShortCut into JPopupMenu |
||||
*/ |
||||
@Override |
||||
public void intoJPopupMenu(JPopupMenu menu) { |
||||
update(); |
||||
if (menu instanceof UIPopupEastAttrMenu){ |
||||
menu.add(this.createMenuItemEastAttr()); |
||||
return; |
||||
} |
||||
menu.add(this.createMenuItem()); |
||||
} |
||||
|
||||
/* |
||||
* Add this ShortCut into JToolBar |
||||
*/ |
||||
@Override |
||||
public void intoJToolBar(JToolBar toolBar) { |
||||
update(); |
||||
|
||||
toolBar.add(this.createToolBarComponent()); |
||||
} |
||||
|
||||
public abstract static class ComponentRemoveEvent extends ComponentEvent { |
||||
|
||||
private static int EVENT_DELETE= 3001; |
||||
|
||||
public ComponentRemoveEvent(Component source) { |
||||
super(source, EVENT_DELETE); |
||||
} |
||||
|
||||
public abstract void release(SelectionListener listener); |
||||
} |
||||
|
||||
/** |
||||
* 全局style的菜单 |
||||
*/ |
||||
public static class UseMenuItem extends UIMenuItem { |
||||
|
||||
private NameStyle nameStyle; |
||||
private SelectionListener listener; |
||||
|
||||
public UseMenuItem(Action action) { |
||||
super(action); |
||||
setPreferredSize(new Dimension(80, 20)); |
||||
} |
||||
|
||||
public UseMenuItem(String text, Icon icon) { |
||||
super(text, icon); |
||||
} |
||||
|
||||
protected void processEvent(AWTEvent e) { |
||||
if (e instanceof ComponentRemoveEvent) { |
||||
((ComponentRemoveEvent) e).release(listener); |
||||
return; |
||||
} |
||||
super.processEvent(e); |
||||
} |
||||
|
||||
public void setSelectionListener(SelectionListener listener) { |
||||
this.listener = listener; |
||||
} |
||||
|
||||
@Override |
||||
public void paintComponent(Graphics g) { |
||||
super.paintComponent(g); |
||||
|
||||
if (nameStyle == null) { |
||||
return; |
||||
} |
||||
|
||||
Style.paintBackground((Graphics2D) g, nameStyle, getWidth() - 1, getHeight() - 1); |
||||
|
||||
Style.paintContent((Graphics2D) g, nameStyle.getName(), nameStyle, getWidth() - 1, getHeight() - 1, ScreenResolution.getScreenResolution()); |
||||
|
||||
Style.paintBorder((Graphics2D) g, nameStyle, getWidth() - 1, getHeight() - 1); |
||||
} |
||||
|
||||
public NameStyle getNameStyle() { |
||||
return this.nameStyle; |
||||
} |
||||
|
||||
public void setNameStyle(NameStyle nameStyle) { |
||||
this.nameStyle = nameStyle; |
||||
} |
||||
|
||||
@Override |
||||
public Dimension getMinimumSize() { |
||||
return getPreferredSize(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Gets menu item. |
||||
* |
||||
* @return the created menu item. |
||||
*/ |
||||
public UseMenuItem createUseMenuItem() { |
||||
Object object = this.getValue(UseMenuItem.class.getName()); |
||||
if (object == null && !(object instanceof UseMenuItem)) { |
||||
object = new UseMenuItem(this); |
||||
this.putValue(UseMenuItem.class.getName(), object); |
||||
} |
||||
return (UseMenuItem) object; |
||||
} |
||||
|
||||
public static UICheckBoxMenuItem createCheckBoxMenuItem(UpdateAction action) { |
||||
UICheckBoxMenuItem menuItem = new UICheckBoxMenuItem(action.getName()); |
||||
|
||||
// 设置属性.
|
||||
Integer mnemonicInteger = (Integer) action |
||||
.getValue(Action.MNEMONIC_KEY); |
||||
if (mnemonicInteger != null) { |
||||
menuItem.setMnemonic((char) mnemonicInteger.intValue()); |
||||
} |
||||
menuItem.setIcon((Icon) action.getValue(Action.SMALL_ICON)); |
||||
// if(menuItem.isSelected()){
|
||||
// menuItem.setIcon(FRSwingConstants.YES_ICON);
|
||||
// }
|
||||
menuItem.addActionListener(action); |
||||
menuItem.setToolTipText((String) action.getValue(Action.LONG_DESCRIPTION)); |
||||
menuItem.setAccelerator((KeyStroke) action.getValue(Action.ACCELERATOR_KEY)); |
||||
|
||||
return menuItem; |
||||
} |
||||
|
||||
public void setSearchText(JPanel panel) { |
||||
this.searchText = getComponentTexts(panel, "_", new StringBuffer(), new StringBuffer(), new StringBuffer()); |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 获取搜索匹配字符串 |
||||
* @return |
||||
*/ |
||||
public String getSearchText() { |
||||
return searchText; |
||||
} |
||||
|
||||
/** |
||||
* 遍历面板中所有控件,获取text用于alphafine的action搜索,考虑分词,拼音,首字母检索 |
||||
* @param panel |
||||
* @param separator |
||||
* @param text |
||||
* @param pinyin |
||||
* @param shortPinyin |
||||
* @return |
||||
*/ |
||||
public String getComponentTexts(JPanel panel, String separator, StringBuffer text, StringBuffer pinyin, StringBuffer shortPinyin) { |
||||
Border border = panel.getBorder(); |
||||
if (border instanceof TitledBorder) { |
||||
String title = ((TitledBorder) border).getTitle(); |
||||
text.append(title).append(separator); |
||||
pinyin.append(PinyinHelper.convertToPinyinString(title, "", PinyinFormat.WITHOUT_TONE)).append(separator); |
||||
shortPinyin.append(PinyinHelper.getShortPinyin(title)).append(separator); |
||||
} |
||||
Component[] components = panel.getComponents(); |
||||
for (Component component : components) { |
||||
if (component instanceof JPanel) { |
||||
getComponentTexts((JPanel) component, separator, text, pinyin, shortPinyin); |
||||
} else if (component instanceof JScrollPane) { |
||||
Component childComponent = ((JScrollPane) component).getViewport().getView(); |
||||
if (childComponent instanceof JPanel) { |
||||
getComponentTexts((JPanel) childComponent, separator, text, pinyin, shortPinyin); |
||||
} |
||||
} else if (component instanceof JLabel) { |
||||
String title = ((JLabel) component).getText(); |
||||
handleSearchText(separator, text, pinyin, shortPinyin, title); |
||||
|
||||
} else if (component instanceof JCheckBox) { |
||||
String title = ((JCheckBox) component).getText(); |
||||
handleSearchText(separator, text, pinyin, shortPinyin, title); |
||||
|
||||
} else if (component instanceof JButton) { |
||||
String title = ((JButton) component).getText(); |
||||
handleSearchText(separator, text, pinyin, shortPinyin, title); |
||||
|
||||
} else if (component instanceof JRadioButton) { |
||||
String title = ((JRadioButton) component).getText(); |
||||
handleSearchText(separator, text, pinyin, shortPinyin, title); |
||||
|
||||
} else if (component instanceof JComboBox) { |
||||
for (int i = 0; i < ((JComboBox) component).getItemCount(); i++) { |
||||
Object componentName = ((JComboBox) component).getItemAt(i); |
||||
if (componentName instanceof String && StringUtils.isNotBlank(String.valueOf(componentName))) { |
||||
String title = String.valueOf(componentName); |
||||
text.append(title); |
||||
handleSearchText(separator, text, pinyin, shortPinyin, title); |
||||
} |
||||
} |
||||
} else if (component instanceof JTabbedPane) { |
||||
getTabPaneTexts((JTabbedPane) component, separator, text, pinyin, shortPinyin); |
||||
} |
||||
} |
||||
return String.valueOf(text.append(pinyin).append(shortPinyin)); |
||||
} |
||||
|
||||
/** |
||||
* 递归遍历tabbedPane |
||||
* @param component |
||||
* @param separator |
||||
* @param text |
||||
* @param pinyin |
||||
* @param shortPinyin |
||||
*/ |
||||
private synchronized void getTabPaneTexts(JTabbedPane component, String separator, StringBuffer text, StringBuffer pinyin, StringBuffer shortPinyin) { |
||||
for (int i = 0; i < component.getTabCount(); i++) { |
||||
String title = component.getTitleAt(i); |
||||
handleSearchText(separator, text, pinyin, shortPinyin, title); |
||||
Component tabComponent = component.getComponentAt(i); |
||||
if (tabComponent instanceof JPanel) { |
||||
getComponentTexts((JPanel) tabComponent, separator, text, pinyin, shortPinyin); |
||||
} else if (tabComponent instanceof JTabbedPane) { |
||||
getTabPaneTexts((JTabbedPane) tabComponent, separator, text, pinyin, shortPinyin); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 将text,pinyin,pinyin首字母拼接到一起 |
||||
* @param separator |
||||
* @param text |
||||
* @param pinyin |
||||
* @param shortPinyin |
||||
* @param title |
||||
*/ |
||||
private void handleSearchText(String separator, StringBuffer text, StringBuffer pinyin, StringBuffer shortPinyin, String title) { |
||||
if (StringUtils.isBlank(title)) { |
||||
return; |
||||
} |
||||
text.append(title).append(separator); |
||||
pinyin.append(PinyinHelper.convertToPinyinString(title, "", PinyinFormat.WITHOUT_TONE)); |
||||
shortPinyin.append(PinyinHelper.getShortPinyin(title)).append(separator); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,41 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit; |
||||
|
||||
import java.awt.event.KeyEvent; |
||||
|
||||
import javax.swing.KeyStroke; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.TemplateComponentAction; |
||||
import com.fr.design.designer.TargetComponent; |
||||
import com.fr.general.Inter; |
||||
|
||||
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; |
||||
|
||||
/** |
||||
* Cut. |
||||
*/ |
||||
public class CutAction extends TemplateComponentAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public CutAction(TargetComponent t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("M_Edit-Cut")); |
||||
this.setMnemonic('T'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/cut.png")); |
||||
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
TargetComponent editPane = getEditingComponent(); |
||||
if (editPane == null) { |
||||
return false; |
||||
} |
||||
return editPane.cut(); |
||||
} |
||||
} |
@ -0,0 +1,41 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit; |
||||
|
||||
import java.awt.event.KeyEvent; |
||||
|
||||
import javax.swing.KeyStroke; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.TemplateComponentAction; |
||||
import com.fr.design.designer.TargetComponent; |
||||
import com.fr.general.Inter; |
||||
|
||||
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; |
||||
|
||||
/** |
||||
* Paste. |
||||
*/ |
||||
public class PasteAction extends TemplateComponentAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public PasteAction(TargetComponent t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("M_Edit-Paste")); |
||||
this.setMnemonic('P'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/paste.png")); |
||||
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER)); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
TargetComponent tc = getEditingComponent(); |
||||
if (tc == null) { |
||||
return false; |
||||
} |
||||
return tc.paste(); |
||||
} |
||||
} |
@ -0,0 +1,59 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.actions.TemplateComponentActionInterface; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
|
||||
/** |
||||
* Redo. |
||||
*/ |
||||
public class RedoAction extends UpdateAction implements TemplateComponentActionInterface<JTemplate<?, ?>> { |
||||
private JTemplate<?, ?> t; |
||||
|
||||
public RedoAction(JTemplate<?, ?> t) { |
||||
this.t = t; |
||||
this.setMenuKeySet(KeySetUtils.REDO); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/redo.png")); |
||||
this.setAccelerator(getMenuKeySet().getKeyStroke()); |
||||
} |
||||
|
||||
@Override |
||||
public JTemplate<?, ?> getEditingComponent() { |
||||
return t; |
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* @param e 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
JTemplate<?, ?> uncComponent = getEditingComponent(); |
||||
if (uncComponent != null) { |
||||
uncComponent.redo(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* update enable |
||||
*/ |
||||
@Override |
||||
public void update() { |
||||
JTemplate<?, ?> undoComponent = getEditingComponent(); |
||||
if (DesignerEnvManager.getEnvManager().isSupportUndo()) { |
||||
this.setEnabled(undoComponent != null && undoComponent.canRedo()); |
||||
} else { |
||||
this.setEnabled(false); |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,60 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.actions.TemplateComponentActionInterface; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
|
||||
/** |
||||
* Undo. |
||||
*/ |
||||
public class UndoAction extends UpdateAction implements TemplateComponentActionInterface<JTemplate<?,?>> { |
||||
private JTemplate<?, ?> t; |
||||
|
||||
public UndoAction(JTemplate<?, ?> t) { |
||||
this.t = t; |
||||
this.setMenuKeySet(KeySetUtils.UNDO); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/undo.png")); |
||||
this.setAccelerator(getMenuKeySet().getKeyStroke()); |
||||
} |
||||
|
||||
@Override |
||||
public JTemplate<?, ?> getEditingComponent() { |
||||
return t; |
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* @param e 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
JTemplate<?, ?> undoComponent = getEditingComponent(); |
||||
if (undoComponent != null) { |
||||
undoComponent.undo(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* update enable |
||||
*/ |
||||
@Override |
||||
public void update() { |
||||
JTemplate<?, ?> undoComponent = getEditingComponent(); |
||||
if (DesignerEnvManager.getEnvManager().isSupportUndo()) { |
||||
this.setEnabled(undoComponent != null && undoComponent.canUndo()); |
||||
} else { |
||||
this.setEnabled(false); |
||||
} |
||||
|
||||
|
||||
} |
||||
} |
@ -0,0 +1,29 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.file; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
import com.fr.design.actions.JTemplateAction; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.general.Inter; |
||||
|
||||
/** |
||||
* Close Report. |
||||
*/ |
||||
public class CloseTemplateAction extends JTemplateAction<JTemplate<?, ?>> { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public CloseTemplateAction(JTemplate<?, ?> jt) { |
||||
super(jt); |
||||
|
||||
this.setName(Inter.getLocText("M-Close_Template")); |
||||
this.setMnemonic('C'); |
||||
} |
||||
|
||||
public void actionPerformed(ActionEvent evt) { |
||||
// this.getEditingComponent().unlockTemplate();
|
||||
} |
||||
} |
@ -0,0 +1,22 @@
|
||||
package com.fr.design.actions.file; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.mainframe.TemplatePane; |
||||
import com.fr.general.Inter; |
||||
|
||||
|
||||
public class EditEnvAction extends UpdateAction { |
||||
|
||||
|
||||
public EditEnvAction() { |
||||
this.setName(Inter.getLocText("M-Others") + "..."); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
TemplatePane.getInstance().editItems(); |
||||
|
||||
} |
||||
} |
@ -0,0 +1,32 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.file; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
|
||||
/** |
||||
* Exit. |
||||
*/ |
||||
public class ExitDesignerAction extends UpdateAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public ExitDesignerAction() { |
||||
this.setMenuKeySet(KeySetUtils.EXIT_DESIGNER); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* @param e 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
DesignerContext.getDesignerFrame().exit(); |
||||
} |
||||
} |
@ -0,0 +1,78 @@
|
||||
package com.fr.design.actions.file; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
import java.util.List; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.gui.imenu.UIMenu; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.design.menu.MenuDef; |
||||
import com.fr.file.FILEFactory; |
||||
|
||||
/** |
||||
* Open Resent MenuDef. |
||||
*/ |
||||
public class OpenRecentReportMenuDef extends MenuDef { |
||||
public OpenRecentReportMenuDef() { |
||||
this.setMenuKeySet(KeySetUtils.RECENT_OPEN); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setIconPath("/com/fr/base/images/cell/blank.gif"); |
||||
initMenuDef(); |
||||
} |
||||
|
||||
private void initMenuDef() { |
||||
DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager(); |
||||
List<String> list = designerEnvManager.getRecentOpenedFilePathList(); |
||||
for (int i = 0; i < list.size(); i++) { |
||||
this.addShortCut(new OpenRecentReportAction(list.get(i))); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 更新菜单 |
||||
*/ |
||||
public void updateMenu() { |
||||
UIMenu createdMenu = this.createJMenu(); |
||||
createdMenu.removeAll(); |
||||
this.clearShortCuts(); |
||||
initMenuDef(); |
||||
int menuCount = this.getShortCutCount(); |
||||
for (int i = 0; i < menuCount; i++) { |
||||
Object object = this.getShortCut(i); |
||||
if (!(object instanceof OpenRecentReportAction)) { |
||||
return; |
||||
} |
||||
OpenRecentReportAction openResentReportAction = (OpenRecentReportAction) object; |
||||
openResentReportAction.update(); |
||||
if (openResentReportAction.isEnabled()) { |
||||
createdMenu.add(openResentReportAction.createMenuItem()); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public static class OpenRecentReportAction extends UpdateAction { |
||||
public OpenRecentReportAction() { |
||||
} |
||||
|
||||
public OpenRecentReportAction(String cptName) { |
||||
this.setName(cptName); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/oem/logo.png")); |
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* @param e 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
DesignerContext.getDesignerFrame().openTemplate(FILEFactory.createFILE(this.getPath())); |
||||
} |
||||
|
||||
public String getPath() { |
||||
return this.getName(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,45 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.file; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.file.FILE; |
||||
import com.fr.file.FILEChooserPane; |
||||
|
||||
|
||||
/** |
||||
* Open Template. |
||||
*/ |
||||
public class OpenTemplateAction extends UpdateAction { |
||||
|
||||
public OpenTemplateAction() { |
||||
this.setMenuKeySet(KeySetUtils.OPEN_TEMPLATE); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/buttonicon/open.png")); |
||||
this.setAccelerator(getMenuKeySet().getKeyStroke()); |
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* @param evt 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent evt) { |
||||
FILEChooserPane fileChooser = FILEChooserPane.getInstance(true, true); |
||||
|
||||
if (fileChooser.showOpenDialog(DesignerContext.getDesignerFrame()) |
||||
== FILEChooserPane.OK_OPTION) { |
||||
final FILE file = fileChooser.getSelectedFILE(); |
||||
if (file == null) {//选择的文件不能是 null
|
||||
return; |
||||
} |
||||
DesignerContext.getDesignerFrame().openTemplate(file); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,49 @@
|
||||
package com.fr.design.actions.file; |
||||
|
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.file.HistoryTemplateListPane; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.DesignerFrame; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
|
||||
public class PreferenceAction extends UpdateAction { |
||||
public PreferenceAction() { |
||||
this.setMenuKeySet(KeySetUtils.PREFERENCE); |
||||
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSearchText(new PreferencePane()); |
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* |
||||
* @param e 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
final DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); |
||||
|
||||
final PreferencePane preferencePane = new PreferencePane(); |
||||
preferencePane.populate(DesignerEnvManager.getEnvManager()); |
||||
|
||||
BasicDialog basicDialog = preferencePane.showWindow(designerFrame); |
||||
basicDialog.addDialogActionListener(new DialogActionAdapter() { |
||||
public void doOk() { |
||||
preferencePane.update(DesignerEnvManager.getEnvManager()); |
||||
DesignerEnvManager.loadLogSetting(); |
||||
DesignerEnvManager.getEnvManager().saveXMLFile(); |
||||
JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); |
||||
jt.refreshToolArea(); |
||||
preferencePane.showRestartDialog(); |
||||
} |
||||
}); |
||||
|
||||
basicDialog.setVisible(true); |
||||
} |
||||
} |
@ -0,0 +1,679 @@
|
||||
package com.fr.design.actions.file; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.ServerConfig; |
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.RestartHelper; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.editor.editor.IntegerEditor; |
||||
import com.fr.design.gui.frpane.UITabbedPane; |
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.ibutton.UIColorButton; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.ActionLabel; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.general.FRLevel; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
import java.awt.event.KeyAdapter; |
||||
import java.awt.event.KeyEvent; |
||||
import java.awt.event.MouseAdapter; |
||||
import java.awt.event.MouseEvent; |
||||
import java.io.File; |
||||
import java.util.ArrayList; |
||||
import java.util.Locale; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 选项对话框 |
||||
* |
||||
* @editor zhou |
||||
* @since 2012-3-28下午3:39:48 |
||||
*/ |
||||
public class PreferencePane extends BasicPane { |
||||
private static final int MAX_UNDO_LIMIT_5 = 5; |
||||
private static final int MAX_UNDO_LIMIT_10 = 10; |
||||
private static final int MAX_UNDO_LIMIT_15 = 15; |
||||
private static final int MAX_UNDO_LIMIT_20 = 20; |
||||
private static final int MAX_UNDO_LIMIT_50 = 50; |
||||
private static final int SELECTED_INDEX_4 = 4; |
||||
private static final int SELECTED_INDEX_5 = 5; |
||||
|
||||
private static final String TYPE = "pressed"; |
||||
private static final String DISPLAY_TYPE = "+"; |
||||
private static final String BACK_SLASH = "BACK_SLASH"; |
||||
private static final String DISPLAY_BACK_SLASH = "\\"; |
||||
private static final String SLASH = "SLASH"; |
||||
private static final String DISPLAY_SLASH = "/"; |
||||
private static final String CONTROL = "CONTROL"; |
||||
private static final String DISPLAY_CONTROL = "ctrl"; |
||||
private static final String OPEN_BRACKET = "OPEN_BRACKET"; |
||||
private static final String DISPLAY_OPEN_BRACKET = "{"; |
||||
private static final String CLOSE_BRACKET = "CLOSE_BRACKET"; |
||||
private static final String DISPLAY_CLOSE_BRACKET = "}"; |
||||
private static final String COMMA = "COMMA"; |
||||
private static final String DISPLAY_COMMA = ","; |
||||
private static final String PERIOD = "PERIOD"; |
||||
private static final String DISPLAY_PERIOD = "."; |
||||
private static final String SEMICOLON = "SEMICOLON"; |
||||
private static final String DISPLAY_SEMICOLON = ";"; |
||||
private static final String QUOTE = "QUOTE"; |
||||
private static final String DISPLAY_QUOTE = "'"; |
||||
private static final String EQUALS = "EQUALS"; |
||||
private static final String DISPLAY_EQUALS = "+"; |
||||
private static final String MINUS = "MINUS"; |
||||
private static final String DISPLAY_MINUS = "-"; |
||||
|
||||
private static final FRLevel[] LOG = {FRLevel.SEVERE, FRLevel.WARNING, FRLevel.INFO, FRLevel.DEBUG}; |
||||
private static java.util.List<String> LANGUAGE = new ArrayList<>(); |
||||
|
||||
private static int designerEnvLanguageIndex; // 打开设置对话框时,设计器使用的语言
|
||||
private boolean languageChanged; // 是否修改了设计器语言设置
|
||||
//设置是否支持undo
|
||||
private UICheckBox supportUndoCheckBox; |
||||
//设置最大撤销次数
|
||||
private UIComboBox maxUndoLimit; |
||||
//是非支持自动计算父格
|
||||
private UICheckBox supportDefaultParentCalculateCheckBox; |
||||
|
||||
//是否自动转化为公式
|
||||
private UICheckBox supportStringToFormulaBox; |
||||
private UICheckBox defaultStringToFormulaBox; |
||||
|
||||
private UILabel shortCutLabel; |
||||
private KeyStroke shortCutKeyStore = null; |
||||
private UIColorButton gridLineColorTBButton; |
||||
|
||||
|
||||
private UIColorButton paginationLineColorTBButton; |
||||
|
||||
private UICheckBox supportCellEditorDefCheckBox; |
||||
private UICheckBox isDragPermitedCheckBox; |
||||
|
||||
private UITextField logExportDirectoryField; |
||||
|
||||
private UIComboBox logLevelComboBox, languageComboBox, pageLengthComboBox, reportLengthComboBox; |
||||
private IntegerEditor portEditor; |
||||
private UITextField jdkHomeTextField; |
||||
private UICheckBox oracleSpace; |
||||
private UICheckBox joinProductImprove; |
||||
|
||||
public PreferencePane() { |
||||
this.initComponents(); |
||||
this.initLanguageItems(); |
||||
} |
||||
|
||||
// 语言选项
|
||||
private void initLanguageItems() { |
||||
LANGUAGE.clear(); |
||||
Map<Locale, String> map = Inter.getSupportLocaleMap(); |
||||
LANGUAGE.add(Inter.getLocText("FR-Designer_Language_Default")); |
||||
for(Locale locale : map.keySet()){ |
||||
LANGUAGE.add(getLocaledLanguage(map.get(locale), locale)); |
||||
} |
||||
} |
||||
|
||||
protected void initComponents() { |
||||
JPanel contentPane = this; |
||||
contentPane.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
|
||||
UITabbedPane jtabPane = new UITabbedPane(); |
||||
JPanel generalPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); |
||||
jtabPane.addTab(Inter.getLocText("FR-Designer_General"), generalPane); |
||||
JPanel advancePane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); |
||||
jtabPane.addTab(Inter.getLocText("FR-Designer_Advanced"), advancePane); |
||||
contentPane.add(jtabPane, BorderLayout.NORTH); |
||||
|
||||
|
||||
createFunctionPane(generalPane); |
||||
createEditPane(generalPane); |
||||
createGuiOfGridPane(generalPane); |
||||
createColorSettingPane(generalPane); |
||||
|
||||
// ConfPane
|
||||
JPanel confLocationPane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane(); |
||||
advancePane.add(confLocationPane); |
||||
|
||||
createLogPane(advancePane); |
||||
|
||||
createLanPane(generalPane); |
||||
|
||||
createLengthPane(advancePane); |
||||
|
||||
createServerPane(advancePane); |
||||
|
||||
createJdkHomePane(advancePane); |
||||
|
||||
String[] message = new String[]{"Display", "Oracle_All_Tables"}; |
||||
String[] sign = new String[]{"Oracle"}; |
||||
JPanel oraclePane = FRGUIPaneFactory.createTitledBorderPane("Oracle" + Inter.getLocText("FR-Designer_Oracle_All_Tables")); |
||||
oracleSpace = new UICheckBox(Inter.getLocText(message, sign)); |
||||
oraclePane.add(oracleSpace); |
||||
|
||||
JPanel improvePane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Product_improve")); |
||||
joinProductImprove = new UICheckBox(Inter.getLocText("FR-Designer_Join_Product_improve")); |
||||
improvePane.add(joinProductImprove); |
||||
|
||||
JPanel spaceUpPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
spaceUpPane.add(oraclePane, BorderLayout.NORTH); |
||||
spaceUpPane.add(improvePane, BorderLayout.SOUTH); |
||||
advancePane.add(spaceUpPane); |
||||
} |
||||
|
||||
private static String getLocaledLanguage(String key, Locale locale){ |
||||
StringBuilder sb = new StringBuilder(); |
||||
sb.append(Inter.getLocText(key)).append("("); |
||||
sb.append(Inter.getLocText(key, locale)).append(")"); |
||||
return sb.toString(); |
||||
} |
||||
|
||||
private void createFunctionPane(JPanel generalPane) { |
||||
JPanel functionPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Preference-Function")); |
||||
generalPane.add(functionPane); |
||||
|
||||
//添加supportUndo选择项
|
||||
supportUndoCheckBox = new UICheckBox(Inter.getLocText("Preference-Support_Undo")); |
||||
functionPane.add(supportUndoCheckBox); |
||||
//添加maxUndoLimit
|
||||
//String[] undoTimes = {"最大撤销次数","5次","10次","15次","20次","50次"};
|
||||
String[] undoTimes = {Inter.getLocText("FR-Designer_max_undo_limit"), MAX_UNDO_LIMIT_5 + Inter.getLocText("FR-Designer_time(s)"), MAX_UNDO_LIMIT_10 + Inter.getLocText("FR-Designer_time(s)") |
||||
, MAX_UNDO_LIMIT_15 + Inter.getLocText("FR-Designer_time(s)"), MAX_UNDO_LIMIT_20 + Inter.getLocText("FR-Designer_time(s)"), MAX_UNDO_LIMIT_50 + Inter.getLocText("FR-Designer_time(s)")}; |
||||
maxUndoLimit = new UIComboBox(undoTimes); |
||||
functionPane.add(maxUndoLimit); |
||||
|
||||
//不支持撤销则不能选择撤销可缓存,也不能设置最大撤销次数
|
||||
supportUndoCheckBox.addActionListener(new ActionListener() { |
||||
public void actionPerformed(ActionEvent e) { |
||||
maxUndoLimit.setEnabled(supportUndoCheckBox.isSelected()); |
||||
} |
||||
}); |
||||
|
||||
|
||||
//添加supportDefaultParentCalculate选择项
|
||||
supportDefaultParentCalculateCheckBox = new UICheckBox( |
||||
Inter.getLocText("Preference-Support_Default_Parent_Calculate")); |
||||
functionPane.add(supportDefaultParentCalculateCheckBox); |
||||
} |
||||
|
||||
private void createEditPane(JPanel generalPane) { |
||||
//samuel:编辑器设置
|
||||
JPanel editPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText(new String[]{"Editor", "Set"})); |
||||
generalPane.add(editPane); |
||||
|
||||
//设置是否支持将字符串编辑为公式
|
||||
supportStringToFormulaBox = new UICheckBox(Inter.getLocText("FR-Designer_Surport_String_To_Formula")); |
||||
editPane.add(supportStringToFormulaBox); |
||||
|
||||
//是否默认转化
|
||||
defaultStringToFormulaBox = new UICheckBox(Inter.getLocText("FR-Designer_Always")); |
||||
|
||||
editPane.add(defaultStringToFormulaBox); |
||||
//不支持转化则不能默认执行
|
||||
supportStringToFormulaBox.addActionListener(new ActionListener() { |
||||
public void actionPerformed(ActionEvent e) { |
||||
defaultStringToFormulaBox.setEnabled(supportStringToFormulaBox.isSelected()); |
||||
} |
||||
}); |
||||
JPanel keyStrokePane = new JPanel(new BorderLayout()); |
||||
keyStrokePane.add(new UILabel(Inter.getLocText("Support-Auto_Complete_Shortcut") + ":"), BorderLayout.WEST); |
||||
shortCutLabel = new UILabel(); |
||||
keyStrokePane.add(shortCutLabel, BorderLayout.CENTER); |
||||
editPane.add(keyStrokePane); |
||||
shortCutLabel.addMouseListener(new MouseAdapter() { |
||||
@Override |
||||
public void mouseClicked(MouseEvent e) { |
||||
if (e.getClickCount() > 1) { |
||||
final KeyStrokePane basicPane = new KeyStrokePane(shortCutLabel.getText()); |
||||
BasicDialog dlg = basicPane.showSmallWindow(SwingUtilities.getWindowAncestor(PreferencePane.this), new DialogActionAdapter() { |
||||
@Override |
||||
public void doOk() { |
||||
shortCutLabel.setText(basicPane.getText()); |
||||
} |
||||
}); |
||||
dlg.setVisible(true); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private class KeyStrokePane extends BasicPane { |
||||
private UILabel label; |
||||
|
||||
public KeyStrokePane(String text) { |
||||
setLayout(new BorderLayout()); |
||||
setFocusable(true); |
||||
requestFocusInWindow(); |
||||
label = new UILabel(text); |
||||
add(GUICoreUtils.createBorderLayoutPane( |
||||
new UILabel(Inter.getLocText("Support-Current_Auto_Complete_Shortcut") + ":"), |
||||
BorderLayout.WEST, |
||||
label, |
||||
BorderLayout.CENTER), |
||||
BorderLayout.NORTH); |
||||
addKeyListener(new KeyAdapter() { |
||||
@Override |
||||
public void keyReleased(KeyEvent e) { |
||||
int modifier = e.getModifiers(); |
||||
if (modifier == 0) { |
||||
return; |
||||
} |
||||
int keyCode = e.getKeyCode(); |
||||
shortCutKeyStore = KeyStroke.getKeyStroke(keyCode, modifier); |
||||
String str = shortCutKeyStore.toString(); |
||||
label.setText(getDisplayShortCut(str)); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
public String getText() { |
||||
return label.getText(); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return "KeyStroke"; |
||||
} |
||||
|
||||
} |
||||
|
||||
private void createGuiOfGridPane(JPanel generalPane) { |
||||
// GridPane
|
||||
JPanel guiOfGridPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Preference-Setting_Grid")); |
||||
generalPane.add(guiOfGridPane); |
||||
|
||||
supportCellEditorDefCheckBox = new UICheckBox(Inter.getLocText("Preference-Support_Cell_Editor_Definition")); |
||||
guiOfGridPane.add(supportCellEditorDefCheckBox); |
||||
|
||||
isDragPermitedCheckBox = new UICheckBox(Inter.getLocText("Preference-Is_Drag_Permited")); |
||||
guiOfGridPane.add(isDragPermitedCheckBox); |
||||
} |
||||
|
||||
private void createColorSettingPane(JPanel generalPane) { |
||||
// Color Setting Pane
|
||||
JPanel colorSettingPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Preference-Setting_Colors")); |
||||
generalPane.add(colorSettingPane); |
||||
|
||||
new UILabel(Inter.getLocText("Preference-Grid_Line_Color")); |
||||
|
||||
new UILabel(Inter.getLocText("Preference-Pagination_Line_Color")); |
||||
|
||||
gridLineColorTBButton = new UIColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/foreground.png")); |
||||
gridLineColorTBButton.setEnabled(this.isEnabled()); |
||||
|
||||
paginationLineColorTBButton = new UIColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/foreground.png")); |
||||
paginationLineColorTBButton.setEnabled(this.isEnabled()); |
||||
|
||||
JPanel leftPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
||||
leftPane.add(new UILabel(Inter.getLocText("Preference-Grid_Line_Color") + ":")); |
||||
leftPane.add(gridLineColorTBButton); |
||||
JPanel rightPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
||||
rightPane.add(new UILabel(Inter.getLocText("Preference-Pagination_Line_Color") + ":")); |
||||
rightPane.add(paginationLineColorTBButton); |
||||
colorSettingPane.add(leftPane); |
||||
colorSettingPane.add(rightPane); |
||||
} |
||||
|
||||
private void createLogPane(JPanel advancePane) { |
||||
//richer:选择导出log文件的目录.
|
||||
JPanel logPane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane(); |
||||
advancePane.add(logPane); |
||||
JPanel logExportPane = FRGUIPaneFactory.createTitledBorderPane("log" + Inter.getLocText("FR-Designer_Export_Setting")); |
||||
logPane.add(logExportPane); |
||||
UILabel logLabel = new UILabel(Inter.getLocText("FR-Designer_Select_Export_Log_Directory") + ":"); |
||||
logExportPane.add(logLabel, BorderLayout.WEST); |
||||
logExportDirectoryField = new UITextField(24); |
||||
logExportPane.add(logExportDirectoryField, BorderLayout.CENTER); |
||||
UIButton chooseDirBtn = new UIButton("..."); |
||||
logExportPane.add(chooseDirBtn, BorderLayout.EAST); |
||||
chooseDirBtn.setPreferredSize(new Dimension(25, 25)); |
||||
chooseDirBtn.addActionListener(new ActionListener() { |
||||
public void actionPerformed(ActionEvent evt) { |
||||
JFileChooser fileChooser = new JFileChooser(); |
||||
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); |
||||
int saveValue = fileChooser.showOpenDialog(DesignerContext.getDesignerFrame()); |
||||
if (saveValue == JFileChooser.APPROVE_OPTION) { |
||||
File selectedFile = fileChooser.getSelectedFile(); |
||||
logExportDirectoryField.setText(selectedFile.getAbsolutePath()); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
JPanel logLevelPane = FRGUIPaneFactory.createTitledBorderPane("log" + Inter.getLocText("FR-Designer_Level_Setting")); |
||||
logPane.add(logLevelPane); |
||||
logLevelComboBox = new UIComboBox(LOG); |
||||
logLevelPane.add(logLevelComboBox); |
||||
logLevelComboBox.addActionListener(new ActionListener() { |
||||
public void actionPerformed(ActionEvent e) { |
||||
|
||||
ServerConfig.getInstance().setServerLogLevel(((FRLevel) logLevelComboBox.getSelectedItem()).getLevel()); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void createLanPane(JPanel generalPane) { |
||||
// ben:选择版本语言;
|
||||
JPanel languageAndDashBoard_pane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane(); |
||||
JPanel LanguagePane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Choose_Language")); |
||||
generalPane.add(languageAndDashBoard_pane); |
||||
languageAndDashBoard_pane.add(LanguagePane); |
||||
languageComboBox = new UIComboBox(LANGUAGE.toArray()); |
||||
languageComboBox.setFont(FRFont.getInstance("Dialog", Font.PLAIN, 12));//为了在中文系统中显示韩文
|
||||
ActionLabel languageLabel = new ActionLabel(Inter.getLocText("FR-Designer_Designer_Language")); |
||||
languageLabel.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
final LocalePane localePane = new LocalePane(); |
||||
BasicDialog dlg = localePane.showLargeWindow(SwingUtilities.getWindowAncestor(PreferencePane.this), new DialogActionAdapter() { |
||||
@Override |
||||
public void doOk() { |
||||
localePane.save(); |
||||
} |
||||
}); |
||||
dlg.setVisible(true); |
||||
} |
||||
}); |
||||
UILabel noticeLabel = new UILabel(Inter.getLocText("FR-Designer_Work_After_Restart_Designer"));//sail:提示重启后生效
|
||||
double p = TableLayout.PREFERRED; |
||||
double rowSize[] = {p}; |
||||
double columnSize[] = {p, p, p}; |
||||
Component[][] components = { |
||||
{languageLabel, languageComboBox, noticeLabel}, |
||||
}; |
||||
languageComboBox.addItemListener(new ItemListener() { |
||||
@Override |
||||
public void itemStateChanged(ItemEvent e) { |
||||
//Inter.fr = ResourceBundle.getBundle("com/fr/general/locale/fr", Locale.US);
|
||||
} |
||||
}); |
||||
JPanel choosePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||
LanguagePane.add(choosePane); |
||||
} |
||||
|
||||
private String getDisplayShortCut(String shotrCut) { |
||||
return shotrCut.replace(TYPE, DISPLAY_TYPE).replace(BACK_SLASH, DISPLAY_BACK_SLASH).replace(SLASH, DISPLAY_SLASH) |
||||
.replace(CONTROL, DISPLAY_CONTROL).replace(OPEN_BRACKET, DISPLAY_OPEN_BRACKET).replace(CLOSE_BRACKET, DISPLAY_CLOSE_BRACKET) |
||||
.replace(COMMA, DISPLAY_COMMA).replace(PERIOD, DISPLAY_PERIOD).replace(SEMICOLON, DISPLAY_SEMICOLON).replace(QUOTE, DISPLAY_QUOTE) |
||||
.replace(EQUALS, DISPLAY_EQUALS).replace(MINUS, DISPLAY_MINUS); |
||||
} |
||||
|
||||
|
||||
private KeyStroke convert2KeyStroke(String ks) { |
||||
return KeyStroke.getKeyStroke(ks.replace(DISPLAY_TYPE, TYPE)); |
||||
} |
||||
|
||||
|
||||
private void createLengthPane(JPanel advancePane) { |
||||
double p = TableLayout.PREFERRED; |
||||
double rowSize[] = {p}; |
||||
|
||||
// 长度单位选择
|
||||
JPanel lengthPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Setting-Ruler-Units")); |
||||
advancePane.add(lengthPane); |
||||
pageLengthComboBox = new UIComboBox(new String[]{Inter.getLocText("FR-Designer_PageSetup-mm"), Inter.getLocText("FR-Designer_Unit_CM"), Inter.getLocText("FR-Designer_Unit_INCH")}); |
||||
pageLengthComboBox.setPreferredSize(new Dimension(80, 20)); |
||||
pageLengthComboBox.setMinimumSize(new Dimension(80, 20)); |
||||
reportLengthComboBox = new UIComboBox(new String[]{Inter.getLocText("FR-Designer_PageSetup-mm"), Inter.getLocText("FR-Designer_Unit_CM"), Inter.getLocText("FR-Designer_Unit_INCH"), Inter.getLocText("FR-Designer_Unit_PT")}); |
||||
reportLengthComboBox.setPreferredSize(new Dimension(80, 20)); |
||||
reportLengthComboBox.setMinimumSize(new Dimension(80, 20)); |
||||
UILabel pagelengthLabel = new UILabel(Inter.getLocText("FR-Designer_Page-Setup-Scale-Units") + ":"); |
||||
UILabel reportLengthLabel = new UILabel(Inter.getLocText("FR-Designer_Report-Design-Ruler-Units") + ":"); |
||||
Component[][] lengthComponents = { |
||||
{pagelengthLabel, pageLengthComboBox, reportLengthLabel, reportLengthComboBox}, |
||||
}; |
||||
JPanel chooseLengthPane = TableLayoutHelper.createTableLayoutPane(lengthComponents, rowSize, new double[]{p, p, p, p}); |
||||
lengthPane.add(chooseLengthPane); |
||||
} |
||||
|
||||
private void createServerPane(JPanel advancePane) { |
||||
double p = TableLayout.PREFERRED; |
||||
double rowSize[] = {p}; |
||||
double columnSize[] = {p, p, p}; |
||||
|
||||
JPanel serverPortPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Web_Preview_Port_Setting")); |
||||
advancePane.add(serverPortPane); |
||||
portEditor = new IntegerEditor(); |
||||
portEditor.setPreferredSize(new Dimension(80, 20)); |
||||
portEditor.setMinimumSize(new Dimension(80, 20)); |
||||
UILabel notiJlabel = new UILabel(Inter.getLocText("FR-Designer_Work_After_Restart_Designer")); |
||||
UILabel serverPortLabel = new UILabel(Inter.getLocText("FR-Designer_Web_Preview_Port") + ":"); |
||||
Component[][] portComponents = { |
||||
{serverPortLabel, portEditor, notiJlabel}, |
||||
}; |
||||
JPanel choosePortPane = TableLayoutHelper.createTableLayoutPane(portComponents, rowSize, columnSize); |
||||
serverPortPane.add(choosePortPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
private void createJdkHomePane(JPanel advancePane) { |
||||
double p = TableLayout.PREFERRED; |
||||
double rowSize[] = {p}; |
||||
double columnSize[] = {p, p, p}; |
||||
|
||||
JPanel serverPortPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Preference-JDK_Home")); |
||||
advancePane.add(serverPortPane); |
||||
jdkHomeTextField = new UITextField(); |
||||
UIButton chooseBtn = new UIButton("..."); |
||||
chooseBtn.setPreferredSize(new Dimension(20, 20)); |
||||
JPanel panel = GUICoreUtils.createBorderLayoutPane( |
||||
jdkHomeTextField, BorderLayout.CENTER, |
||||
chooseBtn, BorderLayout.EAST |
||||
); |
||||
chooseBtn.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
JFileChooser fileChooser = new JFileChooser(); |
||||
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); |
||||
int returnValue = fileChooser.showOpenDialog(PreferencePane.this); |
||||
if (returnValue == JFileChooser.APPROVE_OPTION) { |
||||
File file = fileChooser.getSelectedFile(); |
||||
jdkHomeTextField.setText(file.getAbsolutePath()); |
||||
} |
||||
} |
||||
}); |
||||
panel.setPreferredSize(new Dimension(300, 20)); |
||||
UILabel notiJlabel = new UILabel(Inter.getLocText("FR-Designer_Work_After_Restart_Designer")); |
||||
UILabel serverPortLabel = new UILabel(Inter.getLocText("Preference-JDK_Home") + ":"); |
||||
Component[][] portComponents = { |
||||
{serverPortLabel, panel, notiJlabel}, |
||||
}; |
||||
JPanel choosePortPane = TableLayoutHelper.createTableLayoutPane(portComponents, rowSize, columnSize); |
||||
serverPortPane.add(choosePortPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText("M_Window-Preference"); |
||||
} |
||||
|
||||
/** |
||||
* The method of populate. |
||||
* |
||||
* @param designerEnvManager |
||||
*/ |
||||
public void populate(DesignerEnvManager designerEnvManager) { |
||||
if (designerEnvManager == null) { |
||||
return; |
||||
} |
||||
|
||||
supportUndoCheckBox.setSelected(designerEnvManager.isSupportUndo()); |
||||
if (designerEnvManager.isSupportUndo()) { |
||||
maxUndoLimit.setSelectedIndex(chooseCase(designerEnvManager.getUndoLimit())); |
||||
} else { |
||||
maxUndoLimit.setEnabled(false); |
||||
} |
||||
|
||||
supportDefaultParentCalculateCheckBox.setSelected(designerEnvManager.isSupportDefaultParentCalculate()); |
||||
|
||||
supportStringToFormulaBox.setSelected(designerEnvManager.isSupportStringToFormula()); |
||||
|
||||
shortCutLabel.setText(getDisplayShortCut(designerEnvManager.getAutoCompleteShortcuts())); |
||||
shortCutKeyStore = convert2KeyStroke(designerEnvManager.getAutoCompleteShortcuts()); |
||||
|
||||
if (supportStringToFormulaBox.isSelected()) { |
||||
defaultStringToFormulaBox.setEnabled(true); |
||||
defaultStringToFormulaBox.setSelected(designerEnvManager.isDefaultStringToFormula()); |
||||
} else { |
||||
defaultStringToFormulaBox.setEnabled(false); |
||||
defaultStringToFormulaBox.setSelected(false); |
||||
} |
||||
|
||||
supportCellEditorDefCheckBox.setSelected(designerEnvManager.isSupportCellEditorDef()); |
||||
|
||||
isDragPermitedCheckBox.setSelected(designerEnvManager.isDragPermited()); |
||||
|
||||
gridLineColorTBButton.setColor(designerEnvManager.getGridLineColor()); |
||||
paginationLineColorTBButton.setColor(designerEnvManager.getPaginationLineColor()); |
||||
|
||||
this.logExportDirectoryField.setText(designerEnvManager.getLogLocation()); |
||||
|
||||
this.logLevelComboBox.setSelectedItem(FRLevel.getByLevel(ServerConfig.getInstance().getServerLogLevel())); |
||||
|
||||
this.languageComboBox.setSelectedItem(LANGUAGE.get(designerEnvManager.getLanguage())); |
||||
designerEnvLanguageIndex = designerEnvManager.getLanguage(); |
||||
this.pageLengthComboBox.setSelectedIndex(designerEnvManager.getPageLengthUnit()); |
||||
this.reportLengthComboBox.setSelectedIndex(designerEnvManager.getReportLengthUnit()); |
||||
|
||||
this.portEditor.setValue(new Integer(designerEnvManager.getJettyServerPort())); |
||||
|
||||
this.jdkHomeTextField.setText(designerEnvManager.getJdkHome()); |
||||
|
||||
this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace()); |
||||
this.joinProductImprove.setSelected(designerEnvManager.isJoinProductImprove()); |
||||
} |
||||
|
||||
private int chooseCase(int sign) { |
||||
switch (sign) { |
||||
case 0: |
||||
return 0; |
||||
case MAX_UNDO_LIMIT_5: |
||||
return 1; |
||||
case MAX_UNDO_LIMIT_10: |
||||
return 2; |
||||
case MAX_UNDO_LIMIT_15: |
||||
return 3; |
||||
case MAX_UNDO_LIMIT_20: |
||||
return SELECTED_INDEX_4; |
||||
case MAX_UNDO_LIMIT_50: |
||||
return SELECTED_INDEX_5; |
||||
default: |
||||
return 1; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* The method of update. |
||||
*/ |
||||
public void update(DesignerEnvManager designerEnvManager) { |
||||
if (designerEnvManager == null) { |
||||
return; |
||||
} |
||||
|
||||
designerEnvManager.setLogLocation(this.logExportDirectoryField.getText()); |
||||
|
||||
designerEnvManager.setSupportUndo(supportUndoCheckBox.isSelected()); |
||||
|
||||
designerEnvManager.setSupportDefaultParentCalculate(supportDefaultParentCalculateCheckBox.isSelected()); |
||||
|
||||
designerEnvManager.setSupportStringToFormula(supportStringToFormulaBox.isSelected()); |
||||
|
||||
designerEnvManager.setDefaultStringToFormula(defaultStringToFormulaBox.isSelected()); |
||||
|
||||
designerEnvManager.setSupportCellEditorDef(supportCellEditorDefCheckBox.isSelected()); |
||||
|
||||
designerEnvManager.setAutoCompleteShortcuts(shortCutKeyStore != null ? shortCutKeyStore.toString().replace(TYPE, DISPLAY_TYPE) : shortCutLabel.getText()); |
||||
|
||||
designerEnvManager.setDragPermited(isDragPermitedCheckBox.isSelected()); |
||||
|
||||
designerEnvManager.setGridLineColor(gridLineColorTBButton.getColor()); |
||||
|
||||
designerEnvManager.setPaginationLineColor(paginationLineColorTBButton.getColor()); |
||||
|
||||
designerEnvManager.setLanguage(getLanguageInt()); |
||||
|
||||
designerEnvManager.setPageLengthUnit((short) pageLengthComboBox.getSelectedIndex()); |
||||
designerEnvManager.setReportLengthUnit((short) reportLengthComboBox.getSelectedIndex()); |
||||
|
||||
designerEnvManager.setJettyServerPort(portEditor.getValue().intValue()); |
||||
|
||||
designerEnvManager.setJdkHome(jdkHomeTextField.getText()); |
||||
|
||||
designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected()); |
||||
designerEnvManager.setJoinProductImprove(this.joinProductImprove.isSelected()); |
||||
// designerEnvManager.setAutoBackUp(this.autoBackUp.isSelected());
|
||||
|
||||
designerEnvManager.setUndoLimit(maxUndoLimit.getSelectedIndex() * SELECTED_INDEX_5); |
||||
if (maxUndoLimit.getSelectedIndex() == SELECTED_INDEX_5) { |
||||
designerEnvManager.setUndoLimit(MAX_UNDO_LIMIT_50); |
||||
} |
||||
|
||||
ServerConfig.getInstance().setServerLogLevel(((FRLevel) logLevelComboBox.getSelectedItem()).getLevel()); |
||||
|
||||
} |
||||
|
||||
/* |
||||
* 得到所选语言的int值 |
||||
*/ |
||||
private int getLanguageInt() { |
||||
int l = 0; |
||||
String lang = (String) this.languageComboBox.getSelectedItem(); |
||||
for (int i = 0; i < LANGUAGE.size(); i++) { |
||||
if (ComparatorUtils.equals(lang, LANGUAGE.get(i))) { |
||||
l = i; |
||||
break; |
||||
} |
||||
} |
||||
return l; |
||||
} |
||||
|
||||
|
||||
// 如果语言设置改变了,则显示重启对话框
|
||||
public void showRestartDialog() { |
||||
if (!languageChanged) { |
||||
return; |
||||
} |
||||
int rv = JOptionPane.showOptionDialog( |
||||
null, |
||||
Inter.getLocText("FR-Designer_Language_Change_Successful"), |
||||
Inter.getLocText("FR-Designer-Plugin_Warning"), |
||||
JOptionPane.YES_NO_OPTION, |
||||
JOptionPane.INFORMATION_MESSAGE, |
||||
null, |
||||
new String[]{Inter.getLocText("FR-Designer-Basic_Restart_Designer"), Inter.getLocText("FR-Designer-Basic_Restart_Designer_Later")}, |
||||
null |
||||
); |
||||
if (rv == JOptionPane.OK_OPTION) { |
||||
RestartHelper.restart(); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public BasicDialog showWindow(Window window) { |
||||
return showWindow(window, new DialogActionAdapter() { |
||||
@Override |
||||
public void doOk() { |
||||
if (languageComboBox.getSelectedIndex() != designerEnvLanguageIndex) { |
||||
languageChanged = true; |
||||
} else { |
||||
languageChanged = false; |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,48 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.file; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.JTemplateAction; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
|
||||
/** |
||||
* Save as file |
||||
*/ |
||||
public class SaveAsTemplateAction extends JTemplateAction<JTemplate<?, ?>> { |
||||
|
||||
public SaveAsTemplateAction(JTemplate<?, ?> dPane) { |
||||
super(dPane); |
||||
this.setMenuKeySet(KeySetUtils.SAVE_AS_TEMPLATE); |
||||
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/saveAs.png")); |
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* @param e 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
JTemplate<?, ?> jt = this.getEditingComponent(); |
||||
// kunsnat: 保存前停止编辑状态,保存属性.
|
||||
jt.stopEditing(); |
||||
jt.saveAsTemplate(); |
||||
this.setEnabled(true); |
||||
|
||||
jt.requestFocus(); |
||||
} |
||||
|
||||
@Override |
||||
public void update() { |
||||
super.update(); |
||||
|
||||
// this.setEnabled(!this.getEditingComponent().isSaved());
|
||||
// 另存为按钮应该一直可用使用
|
||||
this.setEnabled(true); |
||||
} |
||||
} |
@ -0,0 +1,129 @@
|
||||
package com.fr.design.actions.file; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.Env; |
||||
import com.fr.base.FRContext; |
||||
import com.fr.dav.LocalEnv; |
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.data.DesignTableDataManager; |
||||
import com.fr.design.data.tabledata.ResponseDataSourceChange; |
||||
import com.fr.design.dialog.InformationWarnPane; |
||||
import com.fr.design.file.HistoryTemplateListPane; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.design.mainframe.TemplatePane; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.design.menu.MenuDef; |
||||
import com.fr.design.menu.SeparatorDef; |
||||
import com.fr.env.RemoteEnv; |
||||
import com.fr.env.SignIn; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.GeneralContext; |
||||
import com.fr.general.Inter; |
||||
import com.fr.stable.EnvChangedListener; |
||||
import com.fr.stable.ProductConstants; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.util.HashMap; |
||||
import java.util.Iterator; |
||||
import java.util.Map; |
||||
import java.util.logging.Level; |
||||
|
||||
|
||||
public class SwitchExistEnv extends MenuDef { |
||||
|
||||
public SwitchExistEnv() { |
||||
this.setMenuKeySet(KeySetUtils.SWITCH_ENV); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setHasScrollSubMenu(true); |
||||
initMenuDef(); |
||||
JTemplate<?, ?> t = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); |
||||
if(t != null) { |
||||
GeneralContext.addEnvWillChangedListener(t.getFullPathName(), new EnvChangedListener() { |
||||
public void envChanged() { |
||||
SwitchExistEnv.this.clearShortCuts(); |
||||
initMenuDef(); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
private void initMenuDef() { |
||||
//ButtonGroup group = new ButtonGroup();
|
||||
Iterator<String> nameIt = DesignerEnvManager.getEnvManager().getEnvNameIterator(); |
||||
while (nameIt.hasNext()) { |
||||
String name = nameIt.next(); |
||||
this.setIconPath("com/fr/design/images/m_file/switch.png"); |
||||
this.addShortCut(new GetExistEnvAction(name)); |
||||
} |
||||
this.addShortCut(SeparatorDef.DEFAULT); |
||||
this.addShortCut(new EditEnvAction()); |
||||
} |
||||
|
||||
public static class GetExistEnvAction extends UpdateAction implements ResponseDataSourceChange { |
||||
public GetExistEnvAction() { |
||||
|
||||
} |
||||
|
||||
public GetExistEnvAction(String envName) { |
||||
this.setName(envName); |
||||
Env env = DesignerEnvManager.getEnvManager().getEnv(envName); |
||||
if (env instanceof LocalEnv) { |
||||
this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/data/bind/localconnect.png")); |
||||
} else if (env instanceof RemoteEnv) { |
||||
this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/data/bind/distanceconnect.png")); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 响应数据集改变 |
||||
*/ |
||||
public void fireDSChanged() { |
||||
fireDSChanged(new HashMap<String, String>()); |
||||
} |
||||
|
||||
/** |
||||
* 响应数据集改变 |
||||
* |
||||
* @param map 数据集 |
||||
*/ |
||||
public void fireDSChanged(Map<String, String> map) { |
||||
DesignTableDataManager.fireDSChanged(map); |
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* |
||||
* @param e 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); |
||||
Env selectedEnv = envManager.getEnv(this.getName()); |
||||
try { |
||||
if (selectedEnv instanceof RemoteEnv && !((RemoteEnv) selectedEnv).testServerConnection()) { |
||||
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"})); |
||||
return; |
||||
} |
||||
String remoteVersion = selectedEnv.getDesignerVersion(); |
||||
if (StringUtils.isBlank(remoteVersion) || ComparatorUtils.compare(remoteVersion, ProductConstants.DESIGNER_VERSION) < 0) { |
||||
String infor = Inter.getLocText("Server-version-tip"); |
||||
String moreInfo = Inter.getLocText("Server-version-tip-moreInfo"); |
||||
FRLogger.getLogger().log(Level.WARNING, infor); |
||||
new InformationWarnPane(infor, moreInfo, Inter.getLocText("Tooltips")).show(); |
||||
return; |
||||
} |
||||
SignIn.signIn(selectedEnv); |
||||
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshToolArea(); |
||||
fireDSChanged(); |
||||
} catch (Exception em) { |
||||
FRContext.getLogger().error(em.getMessage(), em); |
||||
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"})); |
||||
TemplatePane.getInstance().editItems(); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,95 @@
|
||||
package com.fr.design.actions.file; |
||||
|
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.design.utils.DesignUtils; |
||||
import com.fr.file.FILE; |
||||
import com.fr.file.FileNodeFILE; |
||||
import com.fr.general.GeneralUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.general.web.ParameterConstants; |
||||
import com.fr.stable.project.ProjectConstants; |
||||
|
||||
import javax.swing.*; |
||||
import java.util.Map; |
||||
|
||||
public final class WebPreviewUtils { |
||||
|
||||
public static void onWorkbookPreview(JTemplate<?, ?> jt) { |
||||
actionPerformed(jt, jt.getPreviewType().parametersForPreview(), ParameterConstants.REPORTLET); |
||||
} |
||||
|
||||
public static void onFormPreview(JTemplate<?, ?> jt) { |
||||
actionPerformed(jt, null, ParameterConstants.FORMLET); |
||||
} |
||||
|
||||
public static void actionPerformed(JTemplate<?, ?> jt, Map<String, Object> map, String actionType) { |
||||
if (jt == null) { |
||||
return; |
||||
} |
||||
|
||||
DesignerContext.getDesignerFrame().refreshToolbar(); |
||||
|
||||
jt.stopEditing(); |
||||
/* |
||||
* alex:如果没有保存,先保存到Env |
||||
* |
||||
* 如果保存失败,不执行下面的WebPreview |
||||
*/ |
||||
if (!jt.isSaved() && !jt.saveTemplate2Env()) { |
||||
return; |
||||
} |
||||
|
||||
FILE currentTemplate = jt.getEditingFILE(); |
||||
// carl:是否是保存在运行环境下的模板,不是就不能被预览
|
||||
if (currentTemplate instanceof FileNodeFILE) { |
||||
browseUrl(currentTemplate, map, actionType, jt); |
||||
} else { |
||||
// 说明模板没有保存在报表运行环境下面,提示用户
|
||||
int selVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Web_Preview_Message"), |
||||
Inter.getLocText("Preview_ToolTips"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); |
||||
|
||||
if (JOptionPane.OK_OPTION == selVal) { |
||||
if (!jt.saveAsTemplate2Env()) { |
||||
return; |
||||
} |
||||
currentTemplate = jt.getEditingFILE(); |
||||
browseUrl(currentTemplate, map, actionType, jt); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private static void browseUrl(FILE currentTemplate, Map<String, Object> map, String actionType, JTemplate<?, ?> jt) { |
||||
if (!(currentTemplate instanceof FileNodeFILE)) { |
||||
return; |
||||
} |
||||
|
||||
if (currentTemplate.exists()) { |
||||
String path = currentTemplate.getPath(); |
||||
if (path.startsWith(ProjectConstants.REPORTLETS_NAME)) { |
||||
path = path.substring(ProjectConstants.REPORTLETS_NAME.length() + 1); |
||||
|
||||
java.util.List<String> parameterNameList = new java.util.ArrayList<String>(); |
||||
java.util.List<String> parameterValueList = new java.util.ArrayList<String>(); |
||||
|
||||
parameterNameList.add(actionType); |
||||
parameterValueList.add(path); |
||||
if (map != null) { |
||||
for (String key : map.keySet()) { |
||||
parameterNameList.add(key); |
||||
parameterValueList.add(GeneralUtils.objectToString(map.get(key))); |
||||
} |
||||
} |
||||
DesignUtils.visitEnvServerByParameters(parameterNameList.toArray(new String[parameterNameList.size()]), parameterValueList.toArray(new String[parameterValueList.size()])); |
||||
} |
||||
} else { |
||||
int selVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Web_Preview_Message"), |
||||
Inter.getLocText("Preview_ToolTips"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); |
||||
if (JOptionPane.OK_OPTION == selVal) { |
||||
if (!jt.saveAsTemplate()) { |
||||
return; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,53 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.help; |
||||
|
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* help about. |
||||
*/ |
||||
public class AboutAction extends UpdateAction { |
||||
public AboutAction() { |
||||
this.setMenuKeySet(ABOUT); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+"..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* @param evt 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent evt) { |
||||
AboutPane aboutPane = new AboutPane(); |
||||
AboutDialog aboutDailog = new AboutDialog(DesignerContext.getDesignerFrame(), aboutPane); |
||||
aboutDailog.setVisible(true); |
||||
} |
||||
|
||||
public static final MenuKeySet ABOUT = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'S'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("M_Help-About_Software"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,100 @@
|
||||
package com.fr.design.actions.help; |
||||
|
||||
import java.awt.BorderLayout; |
||||
import java.awt.Dimension; |
||||
import java.awt.Frame; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.awt.event.KeyEvent; |
||||
import java.awt.event.WindowAdapter; |
||||
import java.awt.event.WindowEvent; |
||||
|
||||
import javax.swing.AbstractAction; |
||||
import javax.swing.ActionMap; |
||||
import javax.swing.InputMap; |
||||
import javax.swing.JComponent; |
||||
import javax.swing.JDialog; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.KeyStroke; |
||||
|
||||
import com.fr.design.gui.frpane.UITabbedPane; |
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.general.Inter; |
||||
import com.fr.stable.ProductConstants; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
|
||||
/** |
||||
* Dialog displaying information about the application. |
||||
*/ |
||||
public class AboutDialog extends JDialog implements ActionListener { |
||||
/** |
||||
* Construct a new AboutDialog. |
||||
*/ |
||||
public AboutDialog() { |
||||
} |
||||
|
||||
public AboutDialog(Frame parent, JPanel aboutPanel) { |
||||
super(parent, true); |
||||
|
||||
this.setTitle(ProductConstants.PRODUCT_NAME); |
||||
this.setResizable(false); |
||||
JPanel defaultPane=FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
this.setContentPane(defaultPane); |
||||
|
||||
okButton = new UIButton(Inter.getLocText("OK")); |
||||
okButton.addActionListener(this); |
||||
|
||||
tabbedPane = new UITabbedPane(); |
||||
sysPane = new SystemInfoPane(); |
||||
|
||||
tabbedPane.addTab(Inter.getLocText("About"), aboutPanel); |
||||
tabbedPane.addTab(Inter.getLocText("System"), sysPane); |
||||
|
||||
buttonPanel = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); |
||||
buttonPanel.add(okButton); |
||||
|
||||
defaultPane.add(tabbedPane, BorderLayout.CENTER); |
||||
defaultPane.add(buttonPanel, BorderLayout.SOUTH); |
||||
|
||||
addWindowListener(new WindowAdapter() { |
||||
public void windowClosing(WindowEvent e) { |
||||
dialogExit(); |
||||
} |
||||
}); |
||||
|
||||
//esp.
|
||||
InputMap inputMapAncestor = defaultPane.getInputMap( |
||||
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); |
||||
ActionMap actionMap = defaultPane.getActionMap(); |
||||
|
||||
//transfer focus to CurrentEditor
|
||||
inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "dialogExit"); |
||||
actionMap.put("dialogExit", new AbstractAction() { |
||||
public void actionPerformed(ActionEvent evt) { |
||||
dialogExit(); |
||||
} |
||||
}); |
||||
|
||||
this.getRootPane().setDefaultButton(okButton); |
||||
|
||||
this.setSize(new Dimension(660, 600)); |
||||
GUICoreUtils.centerWindow(this); |
||||
} |
||||
|
||||
public void dialogExit() { |
||||
this.dispose(); |
||||
} |
||||
|
||||
/** |
||||
* Called when the ok button is clicked. |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
this.dialogExit(); |
||||
} |
||||
|
||||
private SystemInfoPane sysPane; |
||||
private JPanel buttonPanel; |
||||
private UITabbedPane tabbedPane; |
||||
private UIButton okButton; |
||||
} |
@ -0,0 +1,262 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.help; |
||||
|
||||
import com.fr.base.FRContext; |
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.gui.ilable.ActionLabel; |
||||
import com.fr.design.gui.ilable.BoldFontTextLabel; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.GeneralUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.general.SiteCenter; |
||||
import com.fr.stable.ProductConstants; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.stable.bridge.StableFactory; |
||||
import com.fr.start.BBSGuestPaneProvider; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.datatransfer.Clipboard; |
||||
import java.awt.datatransfer.StringSelection; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.awt.event.MouseAdapter; |
||||
import java.awt.event.MouseEvent; |
||||
import java.net.URI; |
||||
import java.util.Locale; |
||||
|
||||
public class AboutPane extends JPanel { |
||||
private static final String FINEREPORT = "FineReport"; |
||||
private static final int DEFAULT_GAP = 12; |
||||
private static final String COPYRIGHT_LABEL = "\u00A9 "; |
||||
private static final String BUILD_PREFIX = " "; |
||||
|
||||
public AboutPane() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
|
||||
//center panel
|
||||
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
this.add(centerPane, BorderLayout.CENTER); |
||||
|
||||
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); |
||||
centerPane.add(contentPane, BorderLayout.NORTH); |
||||
|
||||
BoxCenterAlignmentCopyablePane buildCopyPane = new BoxCenterAlignmentCopyablePane( |
||||
getBuildTitle(), |
||||
GeneralUtils.readFullBuildNO(), |
||||
new String[]{ |
||||
Inter.getLocText("FR-Designer-Basic_Copy_Build_NO"), |
||||
Inter.getLocText("FR-Designer-Basic_Copy_Build_NO_OK") |
||||
}); |
||||
contentPane.add(buildCopyPane); |
||||
|
||||
BoxCenterAligmentPane boxCenterAlignmentPane = new BoxCenterAligmentPane(getCopyRight()); |
||||
contentPane.add(boxCenterAlignmentPane); |
||||
|
||||
boxCenterAlignmentPane = new BoxCenterAligmentPane(Inter.getLocText("About-All_Rights_Reserved")); |
||||
contentPane.add(boxCenterAlignmentPane); |
||||
|
||||
contentPane.add(new BoxCenterAlignmentCopyablePane( |
||||
Inter.getLocText("FR-Designer-Basic_Activation_Key"), |
||||
DesignerEnvManager.getEnvManager().getActivationKey(), |
||||
new String[]{ |
||||
Inter.getLocText("FR-Designer-Basic_Copy_Activation_Key"), |
||||
Inter.getLocText("FR-Designer-Basic_Activation_Key_Copy_OK") |
||||
})); |
||||
|
||||
if (shouldShowPhoneAndQQ()) { |
||||
if (ComparatorUtils.equals(ProductConstants.APP_NAME, FINEREPORT)) { |
||||
boxCenterAlignmentPane = new BoxCenterAligmentPane(Inter.getLocText("FR-Designer_Service_Phone") + ProductConstants.COMPARE_TELEPHONE); |
||||
contentPane.add(boxCenterAlignmentPane); |
||||
} |
||||
boxCenterAlignmentPane = new BoxCenterAligmentPane("QQ:" + SiteCenter.getInstance().acquireUrlByKind("help.qq")); |
||||
contentPane.add(boxCenterAlignmentPane); |
||||
} |
||||
|
||||
BoxCenterAligmentPane actionLabel = getURLActionLabel(SiteCenter.getInstance().acquireUrlByKind("website." + FRContext.getLocale(), ProductConstants.WEBSITE_URL)); |
||||
BoxCenterAligmentPane emailLabel = getEmailActionLabel(SiteCenter.getInstance().acquireUrlByKind("support.email", ProductConstants.SUPPORT_EMAIL)); |
||||
|
||||
contentPane.add(actionLabel); |
||||
contentPane.add(emailLabel); |
||||
if (shouldShowThanks()) { |
||||
addThankPane(contentPane); |
||||
} |
||||
} |
||||
|
||||
// 是否显示服务电话和 qq
|
||||
private boolean shouldShowPhoneAndQQ() { |
||||
return !FRContext.getLocale().equals(Locale.US); |
||||
} |
||||
|
||||
// 是否显示鸣谢面板
|
||||
private boolean shouldShowThanks() { |
||||
Locale[] hideLocales = {Locale.US, Locale.KOREA, Locale.JAPAN}; |
||||
for (Locale loc : hideLocales) { |
||||
if (FRContext.getLocale().equals(loc)) { |
||||
return false; |
||||
} |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
//添加鸣谢面板
|
||||
private void addThankPane(JPanel contentPane) { |
||||
BBSGuestPaneProvider pane = StableFactory.getMarkedInstanceObjectFromClass(BBSGuestPaneProvider.XML_TAG, BBSGuestPaneProvider.class); |
||||
if (pane == null) { |
||||
return; |
||||
} |
||||
|
||||
contentPane.add(Box.createVerticalStrut(DEFAULT_GAP)); |
||||
contentPane.add((Component) pane); |
||||
} |
||||
|
||||
private String append(String... strs) { |
||||
StringBuilder sb = new StringBuilder(); |
||||
for (String str : strs) { |
||||
sb.append(str); |
||||
} |
||||
|
||||
return sb.toString(); |
||||
} |
||||
|
||||
private String getCopyRight() { |
||||
return append(Inter.getLocText("FR-Designer_About_CopyRight"), COPYRIGHT_LABEL, |
||||
ProductConstants.HISTORY, StringUtils.BLANK, SiteCenter.getInstance().acquireUrlByKind("company.name", ProductConstants.COMPANY_NAME)); |
||||
} |
||||
|
||||
private String getBuildTitle() { |
||||
return append(ProductConstants.APP_NAME, Inter.getLocText("FR-Designer_About_Version"), |
||||
StringUtils.BLANK, ProductConstants.RELEASE_VERSION, BUILD_PREFIX); |
||||
} |
||||
|
||||
private BoxCenterAligmentPane getEmailActionLabel(final String mailTo) { |
||||
ActionLabel emailLabel = new ActionLabel(mailTo); |
||||
|
||||
emailLabel.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
try { |
||||
Desktop.getDesktop().mail(new URI(mailTo)); |
||||
} catch (Exception ignore) { |
||||
|
||||
} |
||||
} |
||||
}); |
||||
|
||||
return new BoxCenterAligmentPane(emailLabel); |
||||
} |
||||
|
||||
private BoxCenterAligmentPane getURLActionLabel(final String url) { |
||||
ActionLabel actionLabel = new ActionLabel(url); |
||||
actionLabel.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
try { |
||||
Desktop.getDesktop().browse(new URI(url)); |
||||
} catch (Exception exp) { |
||||
|
||||
} |
||||
} |
||||
}); |
||||
|
||||
return new BoxCenterAligmentPane(actionLabel); |
||||
} |
||||
|
||||
class UserLabel extends BoldFontTextLabel { |
||||
public UserLabel(String text) { |
||||
super(text); |
||||
|
||||
if (text != null && text.length() > 30) { |
||||
ToolTipManager manager = ToolTipManager.sharedInstance(); |
||||
manager.registerComponent(this); |
||||
} |
||||
} |
||||
|
||||
public String getToolTipText(MouseEvent e) { |
||||
return this.getText(); |
||||
} |
||||
|
||||
public Point getToolTipLocation(MouseEvent e) { |
||||
return new Point(0, 0); |
||||
} |
||||
} |
||||
|
||||
class BoxCenterAligmentPane extends JPanel { |
||||
|
||||
private UILabel textLabel; |
||||
|
||||
public BoxCenterAligmentPane(String text) { |
||||
this(new UILabel(text)); |
||||
} |
||||
|
||||
public BoxCenterAligmentPane(UILabel label) { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
|
||||
JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
||||
this.add(centerPane, BorderLayout.CENTER); |
||||
|
||||
this.textLabel = label; |
||||
centerPane.add(textLabel); |
||||
} |
||||
|
||||
public void setFont(Font font) { |
||||
super.setFont(font); |
||||
|
||||
if (textLabel != null) { |
||||
textLabel.setFont(font); |
||||
} |
||||
} |
||||
} |
||||
|
||||
class BoxCenterAlignmentCopyablePane extends JPanel { |
||||
|
||||
private UILabel label; |
||||
private UILabel textField; |
||||
private UILabel lastLabel; |
||||
|
||||
public BoxCenterAlignmentCopyablePane(String title, String copyText, final String[] descriptions) { |
||||
setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
||||
this.label = new UILabel(title); |
||||
this.textField = new UILabel(copyText); |
||||
textField.setBackground(null); |
||||
textField.setBorder(null); |
||||
|
||||
centerPane.add(label); |
||||
centerPane.add(textField); |
||||
textField.addMouseListener(new MouseAdapter() { |
||||
@Override |
||||
public void mouseClicked(MouseEvent e) { |
||||
if (e.getClickCount() == 2) { |
||||
StringSelection selection = new StringSelection(textField.getText()); |
||||
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); |
||||
clipboard.setContents(selection, selection); |
||||
lastLabel.setText(descriptions[1]); |
||||
lastLabel.setForeground(Color.RED); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
this.lastLabel = new UILabel(descriptions[0]); |
||||
lastLabel.setForeground(Color.lightGray); |
||||
centerPane.add(lastLabel); |
||||
|
||||
add(centerPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
public void setFont(Font font) { |
||||
super.setFont(font); |
||||
|
||||
if (textField != null) { |
||||
textField.setFont(font); |
||||
} |
||||
if (label != null) { |
||||
label.setFont(font); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,57 @@
|
||||
package com.fr.design.actions.help; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.DesignerFrame; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* Created by IntelliJ IDEA. |
||||
* Author : daisy |
||||
* Version: 6.5.6 |
||||
* Date: 14-3-18 |
||||
* Time: 上午9:09 |
||||
*/ |
||||
public class FeedBackAction extends UpdateAction { |
||||
|
||||
public FeedBackAction() { |
||||
this.setMenuKeySet(FEED_BACK); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_help/feedback.png")); |
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* @param e 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
final DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); |
||||
FeedBackPane feedBackPane = new FeedBackPane(); |
||||
BasicDialog basicDialog =feedBackPane.showWindow(designerFrame,false); |
||||
feedBackPane.setFeedbackDialog(basicDialog); |
||||
basicDialog.setVisible(true); |
||||
} |
||||
|
||||
public static final MenuKeySet FEED_BACK = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("product_feedback"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,350 @@
|
||||
/* |
||||
* Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
|
||||
package com.fr.design.actions.help; |
||||
|
||||
import com.fr.base.FRContext; |
||||
import com.fr.base.FeedBackInfo; |
||||
import com.fr.design.constants.LayoutConstants; |
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.icontainer.UIScrollPane; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itextarea.UITextArea; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.Inter; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.design.utils.DesignUtils; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.border.Border; |
||||
import javax.swing.border.EmptyBorder; |
||||
import javax.swing.border.MatteBorder; |
||||
import javax.swing.plaf.ColorUIResource; |
||||
import javax.swing.text.AttributeSet; |
||||
import javax.swing.text.BadLocationException; |
||||
import javax.swing.text.PlainDocument; |
||||
import java.awt.*; |
||||
import java.awt.event.*; |
||||
import java.util.Date; |
||||
import java.util.concurrent.CancellationException; |
||||
|
||||
/** |
||||
* Created by IntelliJ IDEA. |
||||
* Author : daisy |
||||
* Version: 6.5.6 |
||||
* Date: 14-3-18 |
||||
* Time: 上午9:50 |
||||
*/ |
||||
public class FeedBackPane extends BasicPane { |
||||
|
||||
private static final Dimension DIALOG_SIZE = new Dimension(660, 600); |
||||
private static final Dimension TEXT_AREA_SIZE = new Dimension(585, 180); |
||||
private static final int TEXT_FIELD_WIDTH = 160; |
||||
private static final int TEXT_FIELD_HEIGHT = 21; |
||||
private static final int GAP = 5; |
||||
private static final ColorUIResource BORDER_COLOR = new ColorUIResource(168, 172, 180); |
||||
private static final Border TIP_BORDER = BorderFactory.createEmptyBorder(10, 4, 4, 4); |
||||
private static final Border DIALOG_BORDER = BorderFactory.createEmptyBorder(0, 6, 4, 6); |
||||
private static final Border INNER_LEFT_BORDER = BorderFactory.createEmptyBorder(15, 18, 0, 0); |
||||
private static final Border TEXT_AREA_BORDER = BorderFactory.createEmptyBorder(0, 13, 0, 15); |
||||
private static final Border SEND_BORDER = BorderFactory.createEmptyBorder(10, 0, 10, 0); |
||||
private static final int DETAIL_TEXT_MAX_LENGTH = 400; |
||||
private static final int QQ_MAX_LENGTH = 15; |
||||
private static final int EMAIL_MAX_LENGTH = 40; |
||||
private static final int TEL_MAX_LENGTH = 11; |
||||
private static final String ALLOWED_INTEGER_TYPE = "0123456789"; |
||||
private SwingWorker worker; |
||||
private JDialog dlg = new JDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Send"), true); |
||||
private UIButton ok = new UIButton(Inter.getLocText("OK")); |
||||
private UIButton cancle = new UIButton(Inter.getLocText("Cancel")); |
||||
private int ifHasBeenWriten = 0; |
||||
private UITextArea detailField; |
||||
private boolean isSendSuccessful = false; |
||||
private UITextField qq = new UITextField() { |
||||
public Dimension getPreferredSize() { |
||||
return new Dimension(TEXT_FIELD_WIDTH, TEXT_FIELD_HEIGHT); |
||||
} |
||||
}; |
||||
protected UITextField email = new UITextField() { |
||||
public Dimension getPreferredSize() { |
||||
return new Dimension(TEXT_FIELD_WIDTH, TEXT_FIELD_HEIGHT); |
||||
} |
||||
}; |
||||
protected UITextField phone = new UITextField() { |
||||
public Dimension getPreferredSize() { |
||||
return new Dimension(TEXT_FIELD_WIDTH, TEXT_FIELD_HEIGHT); |
||||
} |
||||
}; |
||||
private UIButton sendButton = null; |
||||
|
||||
private BasicDialog feedbackDialog = null; |
||||
private JOptionPane send = null; |
||||
|
||||
public FeedBackPane() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
initDetailArea(); |
||||
UILabel tip = new UILabel(Inter.getLocText("feedback_info")); |
||||
tip.setBorder(TIP_BORDER); |
||||
this.add(tip, BorderLayout.NORTH); |
||||
UIScrollPane scrollPane = new UIScrollPane(initDetailPane()); |
||||
scrollPane.setBorder(new MatteBorder(1, 1, 1, 1, BORDER_COLOR)); |
||||
this.add(scrollPane, BorderLayout.CENTER); |
||||
this.add(getSendButton(), BorderLayout.SOUTH); |
||||
sendButton.setEnabled(false); |
||||
this.setBorder(DIALOG_BORDER); |
||||
initDocument(); |
||||
} |
||||
|
||||
public void setFeedbackDialog(BasicDialog dialog) { |
||||
feedbackDialog = dialog; |
||||
} |
||||
|
||||
public Dimension getPreferredSize() { |
||||
return DIALOG_SIZE; |
||||
} |
||||
|
||||
|
||||
private void initDocument() { |
||||
LimitedDocument qqLimited = new LimitedDocument(QQ_MAX_LENGTH); |
||||
qqLimited.setAllowChar(ALLOWED_INTEGER_TYPE); |
||||
qq.setDocument(qqLimited); |
||||
email.setDocument(new LimitedDocument(EMAIL_MAX_LENGTH)); |
||||
LimitedDocument phoneLimited = new LimitedDocument(TEL_MAX_LENGTH); |
||||
phoneLimited.setAllowChar(ALLOWED_INTEGER_TYPE); |
||||
phone.setDocument(phoneLimited); |
||||
} |
||||
|
||||
|
||||
private void initDetailArea() { |
||||
detailField = new UITextArea() { |
||||
public Dimension getPreferredSize() { |
||||
return TEXT_AREA_SIZE; |
||||
} |
||||
}; |
||||
this.detailField.setForeground(Color.gray); |
||||
this.detailField.setText(Inter.getLocText("feedback_tip")); |
||||
detailField.addKeyListener(new KeyAdapter() { |
||||
|
||||
@Override |
||||
public void keyPressed(KeyEvent e) { |
||||
if (ifHasBeenWriten == 0) { |
||||
detailField.setText(StringUtils.EMPTY); |
||||
detailField.setDocument(new LimitedDocument(DETAIL_TEXT_MAX_LENGTH)); |
||||
ifHasBeenWriten = 1; |
||||
} |
||||
} |
||||
|
||||
public void keyReleased(KeyEvent e) { |
||||
if (ifHasBeenWriten == 0) { |
||||
detailField.setText(StringUtils.EMPTY); |
||||
detailField.setDocument(new LimitedDocument(DETAIL_TEXT_MAX_LENGTH)); |
||||
ifHasBeenWriten = 1; |
||||
} |
||||
detailField.setForeground(Color.black); |
||||
String text = detailField.getText(); |
||||
// 判断在中文输入状态是否还包含提示符 要删掉
|
||||
String tip = Inter.getLocText("feedback_tip"); |
||||
if (text.contains(tip)) { |
||||
text = text.substring(0, text.indexOf(tip)); |
||||
detailField.setText(text); |
||||
} |
||||
sendButton.setEnabled(!(ifHasBeenWriten == 0 || ComparatorUtils.equals(detailField.getText().trim(), StringUtils.EMPTY))); |
||||
} |
||||
}); |
||||
|
||||
detailField.addMouseListener(new MouseAdapter() { |
||||
@Override |
||||
public void mousePressed(MouseEvent e) { |
||||
if (ifHasBeenWriten == 0) { |
||||
detailField.setText(StringUtils.EMPTY); |
||||
detailField.setDocument(new LimitedDocument(DETAIL_TEXT_MAX_LENGTH)); |
||||
ifHasBeenWriten = 1; |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private JPanel initDetailPane() { |
||||
double p = TableLayout.PREFERRED; |
||||
UILabel info = new UILabel(Inter.getLocText("detail_description") + ":"); |
||||
info.setBorder(INNER_LEFT_BORDER); |
||||
JPanel contactPane = getContactPane(); |
||||
contactPane.setBorder(INNER_LEFT_BORDER); |
||||
UILabel contact = new UILabel(Inter.getLocText("contact_info") + ":"); |
||||
contact.setBorder(INNER_LEFT_BORDER); |
||||
JPanel jPanel = new JPanel(); |
||||
jPanel.add(detailField); |
||||
jPanel.setBorder(TEXT_AREA_BORDER); |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{info}, |
||||
new Component[]{jPanel}, |
||||
new Component[]{contact}, |
||||
new Component[]{contactPane}, |
||||
}; |
||||
double[] rowSize = {p, p, p, p}; |
||||
double[] columnSize = {p}; |
||||
int[][] rowCount = {{1}, {1}, {1}, {1}}; |
||||
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); |
||||
} |
||||
|
||||
|
||||
protected JPanel getContactPane() { |
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel("QQ:", SwingConstants.RIGHT), qq}, |
||||
new Component[]{new UILabel(Inter.getLocText("email") + ":", SwingConstants.RIGHT), email}, |
||||
new Component[]{new UILabel(Inter.getLocText("mobile_number") + ":", SwingConstants.RIGHT), phone} |
||||
}; |
||||
double[] rowSize = {p, p, p}; |
||||
double[] columnSize = {p, p}; |
||||
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; |
||||
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); |
||||
} |
||||
|
||||
private JPanel getSendButton() { |
||||
JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
JPanel buttonsPane = new JPanel(new FlowLayout(FlowLayout.LEFT, GAP, 0)); |
||||
controlPane.add(buttonsPane, BorderLayout.EAST); |
||||
sendButton = new UIButton(Inter.getLocText("Send")); |
||||
buttonsPane.add(sendButton); |
||||
buttonsPane.setBorder(SEND_BORDER); |
||||
sendButton.addActionListener(new ActionListener() { |
||||
|
||||
public void actionPerformed(ActionEvent evt) { |
||||
doWithSendPane(); |
||||
} |
||||
}); |
||||
controlPane.setBorder(new EmptyBorder(0, 0, GAP, 0)); |
||||
return controlPane; |
||||
} |
||||
|
||||
|
||||
private void doWithSendPane() { |
||||
Object[] options = new Object[]{ok, cancle}; |
||||
send = new JOptionPane(Inter.getLocText("sending"), |
||||
JOptionPane.INFORMATION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, options, options[0]); |
||||
ok.setEnabled(false); |
||||
ok.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
if (isSendSuccessful) { |
||||
dlg.dispose(); |
||||
feedbackDialog.dispose(); |
||||
} else { |
||||
ok.setEnabled(false); |
||||
send.setMessage(Inter.getLocText("sending")); |
||||
setWorker(send); |
||||
worker.execute(); |
||||
} |
||||
} |
||||
}); |
||||
cancle.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
worker.cancel(true); |
||||
dlg.dispose(); |
||||
} |
||||
}); |
||||
|
||||
dlg.setContentPane(send); |
||||
dlg.pack(); |
||||
dlg.setLocationRelativeTo(DesignerContext.getDesignerFrame()); |
||||
setWorker(send); |
||||
worker.execute(); |
||||
dlg.setVisible(true); |
||||
|
||||
|
||||
} |
||||
|
||||
|
||||
private void setWorker(final JOptionPane send) { |
||||
worker = new SwingWorker<Boolean, Void>() { |
||||
@Override |
||||
protected Boolean doInBackground() throws Exception { |
||||
FeedBackInfo feedBackInfo = new FeedBackInfo(new Date(), qq.getText(), email.getText(), phone.getText(), detailField.getText()); |
||||
try { |
||||
return DesignUtils.sendFeedBack(feedBackInfo); |
||||
} catch (Exception e) { |
||||
FRLogger.getLogger().error(e.getMessage()); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
public void done() { |
||||
try { |
||||
boolean model = get(); |
||||
ok.setEnabled(true); |
||||
cancle.setEnabled(!model); |
||||
if (model) { |
||||
//发送成功
|
||||
isSendSuccessful = true; |
||||
send.setMessage(Inter.getLocText("HJS-Send_Successfully") + "!"); |
||||
} else { |
||||
isSendSuccessful = false; |
||||
String[] message = new String[]{"HJS-Send_Failed", "try_resending"}; |
||||
String[] operator = new String[]{",", ""}; |
||||
send.setMessage(Inter.getLocText(message, operator)); |
||||
} |
||||
} catch (Exception e) { |
||||
isSendSuccessful = false; |
||||
if (!(e instanceof CancellationException)) { |
||||
FRContext.getLogger().error(e.getMessage(), e); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText("product_feedback"); |
||||
} |
||||
|
||||
|
||||
private class LimitedDocument extends PlainDocument { |
||||
private static final long serialVersionUID = 1L; |
||||
private int maxLength = -1;// 允许的最大长度
|
||||
private String allowCharAsString = null;// 允许的字符串格式(0123456789)
|
||||
|
||||
public LimitedDocument(int maxLength) { |
||||
super(); |
||||
this.maxLength = maxLength; |
||||
} |
||||
|
||||
public void insertString(int offset, String str, AttributeSet attrSet) throws BadLocationException { |
||||
if (str == null) { |
||||
return; |
||||
} |
||||
if (allowCharAsString != null && str.length() == 1) { |
||||
if (allowCharAsString.indexOf(str) == -1) { |
||||
Toolkit.getDefaultToolkit().beep();// 发出一个警告声
|
||||
return;// 不是所要求的字符格式,就直接返回,不进行下面的添加
|
||||
} |
||||
} |
||||
char[] charVal = str.toCharArray(); |
||||
String strOldValue = getText(0, getLength()); |
||||
char[] tmp = strOldValue.toCharArray(); |
||||
if (maxLength != -1 && (tmp.length + charVal.length > maxLength)) { |
||||
Toolkit.getDefaultToolkit().beep();// 发出一个警告声
|
||||
return;// 长度大于指定的长度maxLength,也直接返回,不进行下面的添加
|
||||
} |
||||
super.insertString(offset, str, attrSet); |
||||
} |
||||
|
||||
public void setAllowChar(String str) { |
||||
allowCharAsString = str; |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,76 @@
|
||||
/* |
||||
* Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
|
||||
package com.fr.design.actions.help; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.FRContext; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.Inter; |
||||
import com.fr.general.SiteCenter; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.io.IOException; |
||||
import java.net.URI; |
||||
import java.net.URISyntaxException; |
||||
|
||||
/** |
||||
* Created by IntelliJ IDEA. |
||||
* Author : daisy |
||||
* Version: 6.5.6 |
||||
* Date: 14-3-18 |
||||
* Time: 上午9:21 |
||||
*/ |
||||
public class ForumAction extends UpdateAction { |
||||
public ForumAction() { |
||||
this.setMenuKeySet(FORUM); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_help/product_forum.png")); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 动作 |
||||
* @param e 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
String url = SiteCenter.getInstance().acquireUrlByKind("bbs"); |
||||
if (StringUtils.isEmpty(url)) { |
||||
FRContext.getLogger().info("The URL is empty!"); |
||||
return; |
||||
} |
||||
try { |
||||
Desktop.getDesktop().browse(new URI(url)); |
||||
} catch (IOException exp) { |
||||
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser")); |
||||
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); |
||||
} catch (URISyntaxException exp) { |
||||
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); |
||||
} catch (Exception exp) { |
||||
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); |
||||
FRContext.getLogger().error("Can not open the browser for URL: " + url); |
||||
} |
||||
} |
||||
|
||||
public static final MenuKeySet FORUM = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("Forum"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,63 @@
|
||||
/* |
||||
* Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
|
||||
package com.fr.design.actions.help; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.FRContext; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.Inter; |
||||
import com.fr.stable.ProductConstants; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.io.IOException; |
||||
import java.net.URI; |
||||
import java.net.URISyntaxException; |
||||
|
||||
/** |
||||
* Created with IntelliJ IDEA. |
||||
* User: wikky |
||||
* Date: 14-6-20 |
||||
* Time: 上午10:01 |
||||
* To change this template use File | Settings | File Templates. |
||||
*/ |
||||
public class SupportQQAction extends UpdateAction { |
||||
|
||||
public SupportQQAction(){ |
||||
this.setMenuKeySet(SUPPORT_QQ); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_help/support_qq.png")); |
||||
} |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
try { |
||||
Desktop.getDesktop().browse(new URI(ProductConstants.SUPPORT_QQ)); |
||||
} catch (IOException exp) { |
||||
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser")); |
||||
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); |
||||
} catch (URISyntaxException exp) { |
||||
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); |
||||
} |
||||
} |
||||
|
||||
public static final MenuKeySet SUPPORT_QQ = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("Support_QQ"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,69 @@
|
||||
package com.fr.design.actions.help; |
||||
|
||||
import java.awt.BorderLayout; |
||||
import java.util.Arrays; |
||||
import java.util.Enumeration; |
||||
import java.util.Properties; |
||||
|
||||
import javax.swing.JPanel; |
||||
import javax.swing.JScrollPane; |
||||
import javax.swing.JTable; |
||||
import javax.swing.table.DefaultTableModel; |
||||
import javax.swing.table.TableColumnModel; |
||||
|
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.general.Inter; |
||||
import com.fr.stable.ProductConstants; |
||||
|
||||
public class SystemInfoPane extends JPanel { |
||||
public SystemInfoPane() { |
||||
super(FRGUIPaneFactory.createBorderLayout()); |
||||
|
||||
DefaultTableModel tableModel = new DefaultTableModel(); |
||||
JTable table = new JTable(tableModel) { |
||||
public boolean isCellEditable(int row, int column) { |
||||
return false; |
||||
} |
||||
}; |
||||
tableModel.addColumn(Inter.getLocText("Property")); |
||||
tableModel.addColumn(Inter.getLocText("Value")); |
||||
|
||||
Properties properties = System.getProperties(); |
||||
Object[] keys = new Object[properties.size()]; |
||||
|
||||
int index = 0; |
||||
Enumeration enumeration = properties.propertyNames(); |
||||
while (enumeration.hasMoreElements()) { |
||||
keys[index++] = enumeration.nextElement(); |
||||
} |
||||
Arrays.sort(keys); |
||||
|
||||
for (int i = 0; i < keys.length; i++) { |
||||
Object[] tableRowData = new Object[2]; |
||||
String keyValue = keys[i].toString(); |
||||
// james:屏蔽掉exe4j的内容
|
||||
if (keyValue.indexOf("exe4j") != -1) { |
||||
continue; |
||||
} |
||||
// james:这个也是exe4j的东东
|
||||
if ("install4j.exeDir".equals(keyValue)) { |
||||
continue; |
||||
} |
||||
|
||||
if(keyValue.indexOf("FineReport") != -1){ |
||||
keys[i] = keyValue.replaceAll("FineReport", ProductConstants.APP_NAME); |
||||
} |
||||
|
||||
tableRowData[0] = keys[i]; |
||||
tableRowData[1] = properties.getProperty((String) keys[i]); |
||||
tableModel.addRow(tableRowData); |
||||
} |
||||
|
||||
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
||||
TableColumnModel columnModel = table.getColumnModel(); |
||||
columnModel.getColumn(0).setPreferredWidth(160); |
||||
columnModel.getColumn(1).setPreferredWidth(240); |
||||
|
||||
add(new JScrollPane(table), BorderLayout.CENTER); |
||||
} |
||||
} |
@ -0,0 +1,101 @@
|
||||
package com.fr.design.actions.help; |
||||
|
||||
import java.awt.Desktop; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.KeyEvent; |
||||
import java.io.File; |
||||
import java.io.IOException; |
||||
import java.net.URI; |
||||
import java.util.Locale; |
||||
|
||||
import javax.swing.KeyStroke; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.FRContext; |
||||
import com.fr.base.Utils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.general.SiteCenter; |
||||
import com.fr.general.http.HttpClient; |
||||
import com.fr.stable.OperatingSystem; |
||||
import com.fr.stable.ProductConstants; |
||||
import com.fr.stable.StableUtils; |
||||
|
||||
public class TutorialAction extends UpdateAction { |
||||
|
||||
public TutorialAction() { |
||||
this.setMenuKeySet(HELP_TUTORIAL); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/help.png")); |
||||
this.setAccelerator(getMenuKeySet().getKeyStroke()); |
||||
} |
||||
|
||||
private void nativeExcuteMacInstallHomePrograms(String appName) { |
||||
String installHome = StableUtils.getInstallHome(); |
||||
if(installHome == null) { |
||||
FRContext.getLogger().error("Can not find the install home, please check it."); |
||||
} else { |
||||
String appPath = StableUtils.pathJoin(new String[]{installHome, "bin", appName}); |
||||
if(!(new File(appPath)).exists()) { |
||||
FRContext.getLogger().error(appPath + " can not be found."); |
||||
} |
||||
|
||||
String cmd = "open " + appPath; |
||||
Runtime runtime = Runtime.getRuntime(); |
||||
|
||||
try { |
||||
runtime.exec(cmd); |
||||
} catch (IOException e) { |
||||
FRContext.getLogger().error(e.getMessage(), e); |
||||
} |
||||
|
||||
} |
||||
} |
||||
/** |
||||
* 动作 |
||||
* @param evt 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent evt) { |
||||
String helpURL = SiteCenter.getInstance().acquireUrlByKind("help." + FRContext.getLocale()); |
||||
|
||||
if (helpURL != null) { |
||||
HttpClient client = new HttpClient(helpURL); |
||||
if(client.getResponseCode() != -1) { |
||||
try { |
||||
Desktop.getDesktop().browse(new URI(helpURL)); |
||||
return; |
||||
} catch (Exception e) { |
||||
//出了异常的话, 依然打开本地教程
|
||||
} |
||||
} |
||||
} |
||||
|
||||
if (OperatingSystem.isMacOS()) { |
||||
nativeExcuteMacInstallHomePrograms("helptutorial.app"); |
||||
} |
||||
else { |
||||
Utils.nativeExcuteInstallHomePrograms("helptutorial.exe"); |
||||
} |
||||
} |
||||
|
||||
public static final MenuKeySet HELP_TUTORIAL = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'T'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("FR-Designer_COMMUNITY_HELP"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0); |
||||
} |
||||
}; |
||||
|
||||
} |
@ -0,0 +1,46 @@
|
||||
package com.fr.design.actions.help; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.Inter; |
||||
import com.fr.start.StartServer; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.ActionEvent; |
||||
|
||||
|
||||
public class WebDemoAction extends UpdateAction { |
||||
public WebDemoAction() { |
||||
this.setMenuKeySet(PRODUCT_DEMO); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_help/demo.png")); |
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* @param evt 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent evt) { |
||||
StartServer.browserDemoURL(); |
||||
} |
||||
|
||||
public static final MenuKeySet PRODUCT_DEMO = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'D'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("FR-Product_Demo"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
} |
@ -0,0 +1,87 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.server; |
||||
|
||||
|
||||
import com.fr.config.Configuration; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.formula.FunctionManagerPane; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.file.FunctionConfig; |
||||
import com.fr.general.IOUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.transaction.Configurations; |
||||
import com.fr.transaction.Worker; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.ActionEvent; |
||||
|
||||
|
||||
/** |
||||
* FunctionManager. |
||||
*/ |
||||
public class FunctionManagerAction extends UpdateAction { |
||||
public FunctionManagerAction() { |
||||
this.setMenuKeySet(FUNCTION_MANAGER); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+"..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/function.png")); |
||||
this.setSearchText(new FunctionManagerPane()); |
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* @param evt 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent evt) { |
||||
final FunctionManagerPane functionManagerPane = new FunctionManagerPane(); |
||||
BasicDialog functionManagerDialog = |
||||
functionManagerPane.showWindow( |
||||
DesignerContext.getDesignerFrame(),null); |
||||
final FunctionConfig functionManager = FunctionConfig.getInstance(); |
||||
functionManagerDialog.addDialogActionListener(new DialogActionAdapter() { |
||||
public void doOk() { |
||||
Configurations.update(new Worker() { |
||||
@Override |
||||
public void run() { |
||||
functionManagerPane.update(functionManager); |
||||
} |
||||
|
||||
@Override |
||||
public Class<? extends Configuration>[] targets() { |
||||
return new Class[]{FunctionConfig.class}; |
||||
} |
||||
}); |
||||
|
||||
} |
||||
}); |
||||
FunctionConfig mirror = functionManager.mirror(); |
||||
functionManagerPane.populate(mirror); |
||||
functionManagerDialog.setVisible(true); |
||||
} |
||||
|
||||
public void update() { |
||||
this.setEnabled(true); |
||||
} |
||||
|
||||
public static final MenuKeySet FUNCTION_MANAGER = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'F'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("M_Server-Function_Manager"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,96 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.server; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.ParameterConfig; |
||||
import com.fr.config.Configuration; |
||||
import com.fr.config.ServerPreferenceConfig; |
||||
import com.fr.design.DesignModelAdapter; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.DesignerFrame; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.design.parameter.ParameterManagerPane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.transaction.Configurations; |
||||
import com.fr.transaction.Worker; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.ActionEvent; |
||||
|
||||
|
||||
/** |
||||
* Parameter dialog |
||||
*/ |
||||
public class GlobalParameterAction extends UpdateAction { |
||||
public GlobalParameterAction() { |
||||
this.setMenuKeySet(GLOBAL_PARAMETER); |
||||
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/p.png")); |
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* |
||||
* @param e 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
final DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); |
||||
final ParameterManagerPane parameterManagerPane = new ParameterManagerPane(); |
||||
|
||||
final BasicDialog parameterManagerDialog = parameterManagerPane.showWindow(designerFrame); |
||||
|
||||
//marks:读取服务器配置信息
|
||||
parameterManagerPane.populate(ParameterConfig.getInstance().getGlobalParameters()); |
||||
parameterManagerDialog.addDialogActionListener(new DialogActionAdapter() { |
||||
public void doOk() { |
||||
Configurations.update(new Worker() { |
||||
@Override |
||||
public void run() { |
||||
//apply new parameter list.
|
||||
parameterManagerPane.update(); |
||||
DesignModelAdapter<?, ?> model = DesignModelAdapter.getCurrentModelAdapter(); |
||||
if (model != null) { |
||||
model.parameterChanged(); |
||||
} |
||||
parameterManagerDialog.setDoOKSucceed(!parameterManagerPane.isContainsRename()); |
||||
} |
||||
|
||||
@Override |
||||
public Class<? extends Configuration>[] targets() { |
||||
return new Class[]{ServerPreferenceConfig.class}; |
||||
} |
||||
}); |
||||
|
||||
} |
||||
}); |
||||
parameterManagerDialog.setModal(true); |
||||
parameterManagerDialog.setVisible(true); |
||||
} |
||||
|
||||
public void update() { |
||||
this.setEnabled(true); |
||||
} |
||||
|
||||
public static final MenuKeySet GLOBAL_PARAMETER = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'G'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("M_Server-Global_Parameters"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,188 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.server; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.TableData; |
||||
import com.fr.config.Configuration; |
||||
import com.fr.design.DesignModelAdapter; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.data.DesignTableDataManager; |
||||
import com.fr.design.data.datapane.TableDataTreePane; |
||||
import com.fr.design.data.tabledata.ResponseDataSourceChange; |
||||
import com.fr.design.data.tabledata.tabledatapane.TableDataManagerPane; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.DesignerFrame; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.file.ProcedureConfig; |
||||
import com.fr.file.TableDataConfig; |
||||
import com.fr.general.Inter; |
||||
import com.fr.locale.InterProviderFactory; |
||||
import com.fr.transaction.Configurations; |
||||
import com.fr.transaction.Worker; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* Global TableData. |
||||
*/ |
||||
public class GlobalTableDataAction extends UpdateAction implements ResponseDataSourceChange { |
||||
//private static TableDataManagerPane globalTableDataPane = new TableDataManagerPane();
|
||||
|
||||
public GlobalTableDataAction() { |
||||
this.setMenuKeySet(SERVER_TABLEDATA); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/data/dock/serverdatabase.png")); |
||||
} |
||||
|
||||
public static final MenuKeySet SERVER_TABLEDATA = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'S'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("DS-Server_TableData"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
/** |
||||
* 动作 |
||||
* |
||||
* @param evt 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent evt) { |
||||
final DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); |
||||
final TableDataConfig tableDataConfig = TableDataConfig.getInstance(); |
||||
final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() { |
||||
public void complete() { |
||||
|
||||
TableDataConfig mirror = tableDataConfig.mirror(); |
||||
populate(mirror); |
||||
} |
||||
|
||||
protected void renameConnection(final String oldName, final String newName) { |
||||
Configurations.update(new Worker() { |
||||
@Override |
||||
public void run() { |
||||
tableDataConfig.renameTableData(oldName, newName); |
||||
} |
||||
|
||||
@Override |
||||
public Class<? extends Configuration>[] targets() { |
||||
return new Class[]{TableDataConfig.class, ProcedureConfig.class}; |
||||
} |
||||
}); |
||||
} |
||||
}; |
||||
final BasicDialog globalTableDataDialog = globalTableDataPane.showLargeWindow(designerFrame, null); |
||||
|
||||
globalTableDataDialog.addDialogActionListener(new DialogActionAdapter() { |
||||
|
||||
@Override |
||||
public void doOk() { |
||||
Configurations.update(new Worker() { |
||||
@Override |
||||
public void run() { |
||||
if (!globalTableDataPane.isNamePermitted()) { |
||||
globalTableDataDialog.setDoOKSucceed(false); |
||||
return; |
||||
} |
||||
|
||||
DesignTableDataManager.clearGlobalDs(); |
||||
globalTableDataPane.update(tableDataConfig); |
||||
if (!doWithDatasourceManager(tableDataConfig, globalTableDataPane, globalTableDataDialog)) { |
||||
//如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面
|
||||
return; |
||||
} |
||||
// 刷新共有数据集
|
||||
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); |
||||
fireDSChanged(globalTableDataPane.getDsChangedNameMap()); |
||||
} |
||||
|
||||
@Override |
||||
public Class<? extends Configuration>[] targets() { |
||||
return new Class[]{TableDataConfig.class}; |
||||
} |
||||
}); |
||||
|
||||
} |
||||
}); |
||||
globalTableDataDialog.setVisible(true); |
||||
} |
||||
|
||||
/** |
||||
* 是否正常更新完datasourceManager |
||||
* |
||||
* @param datasourceManager |
||||
* @param tableDataManagerPane |
||||
* @param databaseListDialog |
||||
* @return |
||||
*/ |
||||
private boolean doWithDatasourceManager(TableDataConfig datasourceManager, TableDataManagerPane tableDataManagerPane, BasicDialog databaseListDialog) { |
||||
boolean isFailed = false; |
||||
//
|
||||
//存在请重命名则不能更新
|
||||
int index = isTableDataMapContainsRename(datasourceManager); |
||||
if (index != -1) { |
||||
isFailed = true; |
||||
tableDataManagerPane.setSelectedIndex(index); |
||||
} |
||||
databaseListDialog.setDoOKSucceed(!isFailed); |
||||
return !isFailed; |
||||
} |
||||
|
||||
/** |
||||
* 是否包含重命名key |
||||
* |
||||
* @return 包含则返回序列 ,若返回-1则说明不包含重命名key |
||||
*/ |
||||
public int isTableDataMapContainsRename(TableDataConfig datasourceManager) { |
||||
Map<String, TableData> tableDataMap = datasourceManager.getTableDatas(); |
||||
String rename = InterProviderFactory.getProvider().getLocText("FR-Engine_Please_Rename") + "!"; |
||||
if (tableDataMap.containsKey(rename)) { |
||||
return datasourceManager.getTableDataIndex(rename); |
||||
} |
||||
//todo 这边同上面和远程修改数据集属性有关先屏蔽
|
||||
// for (int i = tableDataRenameIndex; i >= 1; i--) {
|
||||
// rename = InterProviderFactory.getProvider().getLocText("FR-Engine_Please_Rename") + i + "!";
|
||||
// if (nameTableDataMap.map.containsKey(rename)) {
|
||||
// return nameTableDataMap.map.indexOf(rename);
|
||||
// }
|
||||
// }
|
||||
return -1; |
||||
} |
||||
|
||||
public void update() { |
||||
this.setEnabled(true); |
||||
} |
||||
|
||||
/** |
||||
* 响应数据集改变 |
||||
*/ |
||||
public void fireDSChanged() { |
||||
fireDSChanged(new HashMap<String, String>()); |
||||
} |
||||
|
||||
/** |
||||
* 响应数据集改变 |
||||
* |
||||
* @param map 对应集 |
||||
*/ |
||||
public void fireDSChanged(Map<String, String> map) { |
||||
DesignTableDataManager.fireDSChanged(map); |
||||
} |
||||
} |
@ -0,0 +1,44 @@
|
||||
package com.fr.design.actions.server; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.design.utils.DesignUtils; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.ActionEvent; |
||||
|
||||
public class PlatformManagerAction extends UpdateAction { |
||||
public PlatformManagerAction() { |
||||
this.setMenuKeySet(PLATEFORM_MANAGER); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/server/platform_16_16.png")); |
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* @param evt 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent evt) { |
||||
DesignUtils.visitEnvServer(); |
||||
} |
||||
|
||||
public static final MenuKeySet PLATEFORM_MANAGER = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'P'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("M_Server-Platform_Manager"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,69 @@
|
||||
package com.fr.design.actions.server; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.config.Configuration; |
||||
import com.fr.design.DesignModelAdapter; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.data.DesignTableDataManager; |
||||
import com.fr.design.data.datapane.TableDataTreePane; |
||||
import com.fr.design.data.tabledata.tabledatapane.ProcedureManagerPane; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.DesignerFrame; |
||||
import com.fr.file.ProcedureConfig; |
||||
import com.fr.general.Inter; |
||||
import com.fr.transaction.Configurations; |
||||
import com.fr.transaction.Worker; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
public class ProcedureListAction extends UpdateAction { |
||||
public ProcedureListAction() { |
||||
this.setName(Inter.getLocText("Datasource-Stored_Procedure") + "(P)" + "..."); |
||||
this.setMnemonic('P'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/data/store_procedure.png")); |
||||
} |
||||
|
||||
/** |
||||
* 事件触发操作 |
||||
* |
||||
* @param evt 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent evt) { |
||||
DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); |
||||
|
||||
final ProcedureConfig procedureConfig = ProcedureConfig.getInstance(); |
||||
final ProcedureManagerPane databaseManagerPane = new ProcedureManagerPane() { |
||||
public void complete() { |
||||
|
||||
ProcedureConfig mirror = procedureConfig.mirror(); |
||||
populate(mirror); |
||||
} |
||||
}; |
||||
BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null); |
||||
databaseListDialog.addDialogActionListener(new DialogActionAdapter() { |
||||
public void doOk() { |
||||
Configurations.update(new Worker() { |
||||
@Override |
||||
public void run() { |
||||
DesignTableDataManager.clearGlobalDs(); |
||||
databaseManagerPane.update(procedureConfig); |
||||
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); |
||||
} |
||||
|
||||
@Override |
||||
public Class<? extends Configuration>[] targets() { |
||||
return new Class[]{ProcedureConfig.class}; |
||||
} |
||||
}); |
||||
|
||||
} |
||||
}); |
||||
databaseListDialog.setVisible(true); |
||||
} |
||||
|
||||
public void update() { |
||||
this.setEnabled(true); |
||||
} |
||||
} |
@ -0,0 +1,97 @@
|
||||
package com.fr.design.actions.tabledata; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.data.datapane.TableDataNameObjectCreator; |
||||
import com.fr.design.actions.UpdateAction; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* Created by IntelliJ IDEA. |
||||
* Author : daisy |
||||
* Version: 6.5.6 |
||||
* Date: 13-12-19 |
||||
* Time: 下午5:21 |
||||
*/ |
||||
public abstract class TableDataAction extends UpdateAction { |
||||
public static final String XML_TAG_TEMPLATE = "template_tabledata_Type"; |
||||
public static final String XML_TAG_SERVER = "server_tabledata_Type"; |
||||
|
||||
public TableDataAction() { |
||||
this.setName(this.getDisplayName()); |
||||
this.setSmallIcon(BaseUtils.readIcon(this.getIconPath())); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 名字 |
||||
* |
||||
* @return |
||||
*/ |
||||
public abstract String getDisplayName(); |
||||
|
||||
/** |
||||
* 图标 |
||||
* |
||||
* @return |
||||
*/ |
||||
public abstract String getIconPath(); |
||||
|
||||
/** |
||||
* 后缀 |
||||
* |
||||
* @return |
||||
*/ |
||||
public abstract String getPrefix(); |
||||
|
||||
|
||||
/** |
||||
* 得到TableData的声明类 |
||||
* |
||||
* @return |
||||
*/ |
||||
public abstract Class getTableDataClass(); |
||||
|
||||
/** |
||||
* 得到相应面板的类 |
||||
* |
||||
* @return |
||||
*/ |
||||
public abstract Class getUpdateTableDataPaneClass(); |
||||
|
||||
/** |
||||
* 用于初始化的类。诺是不需要初始化,则不需要实现 |
||||
* |
||||
* @return |
||||
*/ |
||||
public Class getClass4Init() { |
||||
return null; |
||||
} |
||||
|
||||
/** |
||||
* 该菜单后面是否需要插入分割符 |
||||
* |
||||
* @return 是则返回true |
||||
*/ |
||||
public boolean isNeedInsertSeparator() { |
||||
return false; |
||||
} |
||||
|
||||
public TableDataNameObjectCreator getTableDataCreator() { |
||||
if (this.getClass4Init() == null) { |
||||
return new TableDataNameObjectCreator(this); |
||||
} else { |
||||
return new TableDataNameObjectCreator(this, getClass4Init()); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 动作 |
||||
* @param e 动作 |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,41 @@
|
||||
package com.fr.design.beans; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
|
||||
/** |
||||
* Update Pane |
||||
*/ |
||||
public abstract class BasicBeanPane<T> extends BasicPane { |
||||
|
||||
|
||||
|
||||
/** |
||||
* Populate. |
||||
*/ |
||||
public abstract void populateBean(T ob); |
||||
|
||||
/** |
||||
* Update. |
||||
*/ |
||||
public abstract T updateBean(); |
||||
|
||||
public void updateBean(T ob) { |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 更新权限工具栏面板 |
||||
*/ |
||||
public void populateAuthority() { |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 仅用来处理图表设计器的地图面板 |
||||
* @param mapType 地图类型 |
||||
*/ |
||||
public void dealWidthMap(String mapType){ |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,32 @@
|
||||
package com.fr.design.beans; |
||||
|
||||
import com.fr.stable.StringUtils; |
||||
|
||||
/** |
||||
* |
||||
* @author zhou |
||||
* @since 2012-5-30下午12:12:42 |
||||
*/ |
||||
public abstract class FurtherBasicBeanPane<T> extends BasicBeanPane<T> { |
||||
/** |
||||
* 是否是指定类型 |
||||
* @param ob 对象 |
||||
* @return 是否是指定类型 |
||||
*/ |
||||
public abstract boolean accept(Object ob); |
||||
|
||||
/** |
||||
* title应该是一个属性,不只是对话框的标题时用到,与其他组件结合时,也会用得到 |
||||
* @return 绥化狂标题 |
||||
*/ |
||||
@Deprecated |
||||
public String title4PopupWindow(){ |
||||
return StringUtils.EMPTY; |
||||
} |
||||
|
||||
/** |
||||
* 重置 |
||||
*/ |
||||
public abstract void reset(); |
||||
|
||||
} |
@ -0,0 +1,56 @@
|
||||
package com.fr.design.beans; |
||||
|
||||
import javax.swing.table.TableCellEditor; |
||||
import javax.swing.table.TableCellRenderer; |
||||
|
||||
/** |
||||
* richer:属性和事件分组 |
||||
* @since 6.5.3 |
||||
*/ |
||||
public interface GroupModel { |
||||
/** |
||||
* 该属性所属的分类,普通属性分为基本属性和其它,事件属性根据事件名称不同进行分类 |
||||
*/ |
||||
String getGroupName(); |
||||
|
||||
/** |
||||
* 总共的属性行数 |
||||
*/ |
||||
int getRowCount(); |
||||
|
||||
/** |
||||
* 获取属性表中第row行的渲染器 |
||||
* @param row |
||||
*/ |
||||
TableCellRenderer getRenderer(int row); |
||||
|
||||
/** |
||||
* 获取属性表中第row行的编辑器 |
||||
* @param row |
||||
*/ |
||||
TableCellEditor getEditor(int row); |
||||
|
||||
/** |
||||
* 获取属性表中第row行第column列的值 |
||||
* @param row |
||||
* @param column |
||||
* @return 表格中的值 |
||||
*/ |
||||
Object getValue(int row, int column); |
||||
|
||||
/** |
||||
* 设置属性表中第row行第column列的值为value |
||||
* @param value |
||||
* @param row |
||||
* @param column |
||||
* @return 设置成功则返回true,否则返回false |
||||
*/ |
||||
boolean setValue(Object value, int row, int column); |
||||
|
||||
/** |
||||
* 改行是否可编辑 |
||||
* @param row |
||||
* @return 第row行可编辑返回true,否则返回false |
||||
*/ |
||||
boolean isEditable(int row); |
||||
} |
@ -0,0 +1,393 @@
|
||||
package com.fr.design.beans.location; |
||||
|
||||
import java.awt.*; |
||||
|
||||
import com.fr.base.GraphHelper; |
||||
import com.fr.design.scrollruler.ScrollRulerComponent; |
||||
import com.fr.stable.ArrayUtils; |
||||
import com.fr.third.org.hsqldb.lib.Collection; |
||||
|
||||
public class Absorptionline { |
||||
//箭头线前段为4px的等边三角形,给定了一个点的坐标,计算一下剩下两个点的坐标偏移量
|
||||
//而且箭头分为四个朝向,故有四组坐标(2根号3 约为 3)
|
||||
// 1.(x,y)(x+2,y±2根号3)(x-2,y±2根号3)
|
||||
// 2.(x,y)(x±2根号3,y-2)(x±2根号3,y+2)
|
||||
private static int RECTANGLE_OFFSET_X = 2; |
||||
private static int RECTANGLE_OFFSET_Y = 3; |
||||
private static int WIDGET_DISTANCE_MIN = 8; |
||||
//控件周围八个拖拽框的大小
|
||||
private static int RESIZE_BOX_SIZE = 5; |
||||
|
||||
private static Absorptionline lineInX = new Absorptionline(null, null, null, true); |
||||
private static Absorptionline lineInY = new Absorptionline(null, null, null, false); |
||||
|
||||
private static Absorptionline lineEquidistant = new Absorptionline(null, null, null, true); |
||||
|
||||
private Color lineColor = new Color(228, 225, 199); |
||||
private Color midLineColor = new Color(196, 227, 237); |
||||
private Color equidistantLineColor = new Color(0xff, 0x0d, 0x7b); |
||||
|
||||
private Integer x1; |
||||
private Integer x2; |
||||
private Integer middle; |
||||
private int[] verticalLines; |
||||
private int[] horizontalLines; |
||||
|
||||
private int top; |
||||
private int left; |
||||
private int bottom; |
||||
private int right; |
||||
private Rectangle equidistantStart; |
||||
|
||||
private boolean trans; |
||||
|
||||
/** |
||||
* 创建X轴连接线 |
||||
* |
||||
* @param x x坐标 |
||||
* |
||||
* @return X轴的连接线 |
||||
* |
||||
* @date 2015-2-12-下午2:45:49 |
||||
* |
||||
*/ |
||||
public static Absorptionline createXAbsorptionline(int x) { |
||||
lineInX.x1 = x; |
||||
lineInX.x2 = lineInX.middle = null; |
||||
lineInX.horizontalLines = lineInX.verticalLines = null; |
||||
return lineInX; |
||||
} |
||||
|
||||
/** |
||||
* 创建X中轴连接线 |
||||
* |
||||
* @param x x坐标 |
||||
* |
||||
* @return X中轴的连接线 |
||||
* |
||||
* @date 2015-2-12-下午2:45:49 |
||||
* |
||||
*/ |
||||
public static Absorptionline createXMidAbsorptionline(int x) { |
||||
lineInX.middle = x; |
||||
lineInX.x1 = lineInX.x2 = null; |
||||
lineInX.horizontalLines = lineInX.verticalLines = null; |
||||
return lineInX; |
||||
} |
||||
|
||||
/** |
||||
* 创建Y轴连接线 |
||||
* |
||||
* @param y y坐标 |
||||
* |
||||
* @return Y轴的连接线 |
||||
* |
||||
* @date 2015-2-12-下午2:45:49 |
||||
* |
||||
*/ |
||||
public static Absorptionline createYAbsorptionline(int y) { |
||||
lineInY.x1 = y; |
||||
lineInY.x2 = lineInY.middle = null; |
||||
lineInY.horizontalLines = lineInY.verticalLines = null; |
||||
return lineInY; |
||||
} |
||||
|
||||
/** |
||||
* 创建Y中轴连接线 |
||||
* |
||||
* @param y y坐标 |
||||
* |
||||
* @return Y中轴的连接线 |
||||
* |
||||
* @date 2015-2-12-下午2:45:49 |
||||
* |
||||
*/ |
||||
public static Absorptionline createYMidAbsorptionline(int y) { |
||||
lineInY.middle = y; |
||||
lineInY.x1 = lineInY.x2 = null; |
||||
lineInY.horizontalLines = lineInY.verticalLines = null; |
||||
return lineInY; |
||||
} |
||||
|
||||
/** |
||||
* 创建等距线 |
||||
* @return 等距线 |
||||
*/ |
||||
public static Absorptionline createEquidistantAbsorptionline(Rectangle equidistantStart, int top, int left, int bottom, int right) { |
||||
lineEquidistant.equidistantStart = equidistantStart; |
||||
lineEquidistant.top = top; |
||||
lineEquidistant.left = left; |
||||
lineEquidistant.bottom = bottom; |
||||
lineEquidistant.right = right; |
||||
return lineEquidistant; |
||||
} |
||||
|
||||
private Absorptionline(Integer x1, Integer x2, Integer middleInX, boolean trans) { |
||||
this.x1 = x1; |
||||
this.x2 = x2; |
||||
this.middle = middleInX; |
||||
this.trans = trans; |
||||
} |
||||
|
||||
public void setFirstLine(Integer x) { |
||||
this.x1 = x; |
||||
} |
||||
|
||||
public void setMidLine(Integer x) { |
||||
this.middle = x; |
||||
} |
||||
|
||||
public void setSecondLine(Integer x) { |
||||
this.x2 = x; |
||||
} |
||||
|
||||
/** |
||||
* 是否相关参数都已设置完毕 |
||||
* |
||||
* @return 相关参数都已设置完毕 |
||||
* |
||||
* @date 2015-2-12-下午2:44:46 |
||||
* |
||||
*/ |
||||
public boolean isFull() { |
||||
return x1 != null && x2 != null && middle != null; |
||||
} |
||||
|
||||
public int[] getVerticalLines() { |
||||
return verticalLines; |
||||
} |
||||
|
||||
public void setVerticalLines(int[] verticalLines) { |
||||
this.verticalLines = verticalLines; |
||||
} |
||||
|
||||
public int[] getHorizontalLines() { |
||||
return horizontalLines; |
||||
} |
||||
|
||||
public void setHorizontalLines(int[] horizontalLines) { |
||||
this.horizontalLines = horizontalLines; |
||||
} |
||||
|
||||
public void paint(Graphics g, ScrollRulerComponent designer) { |
||||
g = g.create(); |
||||
if (trans) { |
||||
|
||||
for (int i = 0; i < ArrayUtils.getLength(verticalLines); i++) { |
||||
g.setColor(lineColor); |
||||
GraphHelper.drawLine(g, verticalLines[i] - designer.getHorizontalValue(), 0, verticalLines[i] - designer.getHorizontalValue(), |
||||
designer.getDesignerHeight()); |
||||
} |
||||
|
||||
if (x1 != null) { |
||||
g.setColor(lineColor); |
||||
GraphHelper.drawLine(g, x1 - designer.getHorizontalValue(), 0, x1 - designer.getHorizontalValue(), |
||||
designer.getDesignerHeight()); |
||||
} |
||||
if (x2 != null) { |
||||
g.setColor(lineColor); |
||||
GraphHelper.drawLine(g, x2 - designer.getHorizontalValue(), 0, x2 - designer.getHorizontalValue(), |
||||
designer.getDesignerWidth()); |
||||
} |
||||
if (middle != null) { |
||||
g.setColor(midLineColor); |
||||
GraphHelper.drawLine(g, middle - designer.getHorizontalValue(), 0, middle |
||||
- designer.getHorizontalValue(), designer.getDesignerHeight()); |
||||
} |
||||
} else { |
||||
for (int i = 0; i < ArrayUtils.getLength(horizontalLines); i++) { |
||||
g.setColor(lineColor); |
||||
GraphHelper.drawLine(g, 0, horizontalLines[i] - designer.getVerticalValue(), |
||||
designer.getDesignerWidth(), horizontalLines[i] - designer.getVerticalValue()); |
||||
} |
||||
|
||||
if (x1 != null) { |
||||
|
||||
g.setColor(lineColor); |
||||
GraphHelper.drawLine(g, 0, x1 - designer.getVerticalValue(), designer.getDesignerWidth(), x1 |
||||
- designer.getVerticalValue()); |
||||
} |
||||
if (x2 != null) { |
||||
g.setColor(lineColor); |
||||
GraphHelper.drawLine(g, 0, x2 - designer.getVerticalValue(), designer.getDesignerWidth(), x2 |
||||
- designer.getVerticalValue()); |
||||
} |
||||
if (middle != null) { |
||||
g.setColor(midLineColor); |
||||
GraphHelper.drawLine(g, 0, middle - designer.getVerticalValue(), designer.getDesignerWidth(), middle |
||||
- designer.getVerticalValue()); |
||||
} |
||||
|
||||
} |
||||
//画等距线
|
||||
if (equidistantStart != null) { |
||||
g.setColor(equidistantLineColor); |
||||
if (top > 0) { |
||||
paintTopEquidistantLine(g); |
||||
} |
||||
if (left > 0) { |
||||
paintLeftEquidistantLine(g); |
||||
} |
||||
if (bottom > 0) { |
||||
paintBottomEquidistantLine(g); |
||||
} |
||||
if (right > 0) { |
||||
paintRightEquidistantLine(g); |
||||
} |
||||
} |
||||
} |
||||
|
||||
//朝向上方的等距线
|
||||
private void paintTopEquidistantLine(Graphics g){ |
||||
int x[] = { |
||||
equidistantStart.x + equidistantStart.width / 2, |
||||
equidistantStart.x + equidistantStart.width / 2 - RECTANGLE_OFFSET_X, |
||||
equidistantStart.x + equidistantStart.width / 2 + RECTANGLE_OFFSET_X |
||||
}; |
||||
int[] y1, y2; |
||||
if (equidistantStart.y - top > WIDGET_DISTANCE_MIN) { |
||||
y1 = new int[] { |
||||
top, |
||||
top + RECTANGLE_OFFSET_Y, |
||||
top + RECTANGLE_OFFSET_Y |
||||
}; |
||||
y2 = new int[]{ |
||||
equidistantStart.y - RESIZE_BOX_SIZE, |
||||
equidistantStart.y - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y, |
||||
equidistantStart.y - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y |
||||
}; |
||||
} |
||||
else{ |
||||
y1 = new int[] { |
||||
top, |
||||
top - RECTANGLE_OFFSET_Y, |
||||
top - RECTANGLE_OFFSET_Y |
||||
}; |
||||
y2 = new int[] { |
||||
equidistantStart.y, |
||||
equidistantStart.y + RECTANGLE_OFFSET_Y, |
||||
equidistantStart.y + RECTANGLE_OFFSET_Y |
||||
}; |
||||
} |
||||
g.fillPolygon(x, y1, 3); |
||||
g.fillPolygon(x, y2, 3); |
||||
GraphHelper.drawLine(g, |
||||
equidistantStart.x + equidistantStart.width / 2, top, |
||||
equidistantStart.x + equidistantStart.width / 2, equidistantStart.y - RESIZE_BOX_SIZE); |
||||
} |
||||
//朝向左侧的等距线
|
||||
private void paintLeftEquidistantLine(Graphics g){ |
||||
int y[] = { |
||||
equidistantStart.y + equidistantStart.height / 2, |
||||
equidistantStart.y + equidistantStart.height / 2 - RECTANGLE_OFFSET_X, |
||||
equidistantStart.y + equidistantStart.height / 2 + RECTANGLE_OFFSET_X, |
||||
}; |
||||
int[] x1, x2; |
||||
if (equidistantStart.x - left > WIDGET_DISTANCE_MIN) { |
||||
x1 = new int[] { |
||||
left, |
||||
left + RECTANGLE_OFFSET_Y, |
||||
left + RECTANGLE_OFFSET_Y, |
||||
}; |
||||
|
||||
x2 = new int[] { |
||||
equidistantStart.x - RESIZE_BOX_SIZE, |
||||
equidistantStart.x - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y, |
||||
equidistantStart.x - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y |
||||
}; |
||||
} |
||||
else{ |
||||
x1 = new int[] { |
||||
left, |
||||
left - RECTANGLE_OFFSET_Y, |
||||
left - RECTANGLE_OFFSET_Y, |
||||
}; |
||||
x2 = new int[] { |
||||
equidistantStart.x, |
||||
equidistantStart.x + RECTANGLE_OFFSET_Y, |
||||
equidistantStart.x + RECTANGLE_OFFSET_Y |
||||
}; |
||||
} |
||||
g.fillPolygon(x1, y, 3); |
||||
g.fillPolygon(x2, y, 3); |
||||
GraphHelper.drawLine(g, |
||||
left, equidistantStart.y + equidistantStart.height / 2, |
||||
equidistantStart.x, equidistantStart.y + equidistantStart.height / 2); |
||||
} |
||||
//朝向下方的等距线
|
||||
private void paintBottomEquidistantLine(Graphics g) { |
||||
int x[] = { |
||||
equidistantStart.x + equidistantStart.width / 2, |
||||
equidistantStart.x + equidistantStart.width / 2 + RECTANGLE_OFFSET_X, |
||||
equidistantStart.x + equidistantStart.width / 2 - RECTANGLE_OFFSET_X, |
||||
}; |
||||
int[] y1, y2; |
||||
if (bottom - equidistantStart.y + equidistantStart.height > WIDGET_DISTANCE_MIN) { |
||||
y1 = new int[] { |
||||
equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE, |
||||
equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y, |
||||
equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y, |
||||
}; |
||||
y2 = new int[] { |
||||
bottom, |
||||
bottom - RECTANGLE_OFFSET_Y, |
||||
bottom - RECTANGLE_OFFSET_Y |
||||
}; |
||||
} |
||||
else{ |
||||
y1 = new int[] { |
||||
equidistantStart.y + equidistantStart.height, |
||||
equidistantStart.y + equidistantStart.height - RECTANGLE_OFFSET_Y, |
||||
equidistantStart.y + equidistantStart.height - RECTANGLE_OFFSET_Y, |
||||
}; |
||||
y2 = new int[] { |
||||
bottom, |
||||
bottom + RECTANGLE_OFFSET_Y, |
||||
bottom + RECTANGLE_OFFSET_Y |
||||
}; |
||||
} |
||||
g.fillPolygon(x, y1, 3); |
||||
g.fillPolygon(x, y2, 3); |
||||
GraphHelper.drawLine(g, |
||||
equidistantStart.x + equidistantStart.width / 2, equidistantStart.y + equidistantStart.height, |
||||
equidistantStart.x + equidistantStart.width / 2, bottom); |
||||
} |
||||
//朝向右侧的等距线
|
||||
private void paintRightEquidistantLine(Graphics g){ |
||||
int y[] = { |
||||
equidistantStart.y + equidistantStart.height / 2, |
||||
equidistantStart.y + equidistantStart.height / 2 - RECTANGLE_OFFSET_X, |
||||
equidistantStart.y + equidistantStart.height / 2 + RECTANGLE_OFFSET_X |
||||
}; |
||||
int[] x1, x2; |
||||
if(right - equidistantStart.x > WIDGET_DISTANCE_MIN) { |
||||
x1 = new int[]{ |
||||
right, |
||||
right - RECTANGLE_OFFSET_Y, |
||||
right - RECTANGLE_OFFSET_Y |
||||
}; |
||||
x2 = new int[]{ |
||||
equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE, |
||||
equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y, |
||||
equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y |
||||
}; |
||||
} |
||||
else{ |
||||
x1 = new int[]{ |
||||
right, |
||||
right + RECTANGLE_OFFSET_Y, |
||||
right + RECTANGLE_OFFSET_Y |
||||
}; |
||||
x2 = new int[]{ |
||||
equidistantStart.x + equidistantStart.width, |
||||
equidistantStart.x + equidistantStart.width - RECTANGLE_OFFSET_Y, |
||||
equidistantStart.x + equidistantStart.width - RECTANGLE_OFFSET_Y |
||||
}; |
||||
} |
||||
g.fillPolygon(x1, y, 3); |
||||
g.fillPolygon(x2, y, 3); |
||||
GraphHelper.drawLine(g, |
||||
equidistantStart.x + equidistantStart.width, equidistantStart.y + equidistantStart.height / 2, |
||||
right, equidistantStart.y + equidistantStart.height / 2); |
||||
} |
||||
} |
@ -0,0 +1,557 @@
|
||||
/* |
||||
* Copyright(c) 2001-2011, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.beans.location; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.util.ArrayList; |
||||
|
||||
/** |
||||
* Created by IntelliJ IDEA. |
||||
* |
||||
* @author: Richer |
||||
* @since : 6.5.5 Date: 11-7-1 Time: 下午2:22 |
||||
*/ |
||||
public class MoveUtils { |
||||
|
||||
public static final int SORPTION_UNIT = 5; |
||||
private static final int EQUIDISTANTLINE_UNIT = 4; |
||||
|
||||
private static ArrayList<EquidistantLine> equidistantLines = new ArrayList<>(); |
||||
|
||||
private MoveUtils() { |
||||
|
||||
} |
||||
|
||||
public interface RectangleDesigner { |
||||
|
||||
/** |
||||
* 获取块边界的迭代器 |
||||
* |
||||
* @return 块边界的迭代器 |
||||
* |
||||
* @date 2015-2-12-下午2:43:47 |
||||
* |
||||
*/ |
||||
RectangleIterator createRectangleIterator(); |
||||
|
||||
/** |
||||
* 设置X轴的线 |
||||
* |
||||
* @param line 连接线 |
||||
* |
||||
* @date 2015-2-12-下午2:44:04 |
||||
* |
||||
*/ |
||||
void setXAbsorptionline(Absorptionline line); |
||||
|
||||
/** |
||||
* 设置Y轴的线 |
||||
* |
||||
* @param line 连接线 |
||||
* |
||||
* @date 2015-2-12-下午2:44:04 |
||||
* |
||||
*/ |
||||
void setYAbsorptionline(Absorptionline line); |
||||
|
||||
/** |
||||
* 获取当前选中块的垂直线数组 |
||||
* |
||||
* @return 块的垂直线数组 |
||||
* |
||||
*/ |
||||
int[] getVerticalLine(); |
||||
|
||||
/** |
||||
* 获取当前选中块的水平线数组 |
||||
* |
||||
* @return 块的水平线数组 |
||||
* |
||||
*/ |
||||
int[] getHorizontalLine(); |
||||
|
||||
/** |
||||
* 设置designer内部组件是否重叠的标志位 |
||||
* @param isIntersects 是否重叠 |
||||
*/ |
||||
void setWidgetsIntersected(boolean isIntersects); |
||||
|
||||
/** |
||||
* 获取designer内部组件是否重叠的标志位 |
||||
* @return 重叠 |
||||
*/ |
||||
boolean isWidgetsIntersected(); |
||||
|
||||
/** |
||||
* 获取designer相对屏幕的位置 |
||||
* @return 位置 |
||||
*/ |
||||
Point getDesignerLocationOnScreen(); |
||||
|
||||
/** |
||||
* 设置等距线 |
||||
* @param line 吸附线 |
||||
*/ |
||||
void setEquidistantLine(Absorptionline line); |
||||
|
||||
/** |
||||
* 获取设计器垂直滚动条的值 |
||||
* @return 滚动条的值 |
||||
*/ |
||||
int getDesignerScrollVerticalValue(); |
||||
|
||||
/** |
||||
* 获取设计器水平滚动条的值 |
||||
* @return 滚动条的值 |
||||
*/ |
||||
int getDesignerScrollHorizontalValue(); |
||||
} |
||||
|
||||
public interface RectangleIterator { |
||||
|
||||
/** |
||||
* 是否存在下一个块 |
||||
* |
||||
* @return 是否存在下一个块 |
||||
* |
||||
* @date 2015-2-12-下午2:41:32 |
||||
* |
||||
*/ |
||||
boolean hasNext(); |
||||
|
||||
/** |
||||
* 获取下一个块的bounds |
||||
* |
||||
* @return 下一个块的bounds |
||||
* |
||||
* @date 2015-2-12-下午2:41:55 |
||||
* |
||||
*/ |
||||
Rectangle nextRectangle(); |
||||
|
||||
/** |
||||
* 获取块的垂直线数组 |
||||
* |
||||
* @return 块的垂直线数组 |
||||
* |
||||
* @date 2015-2-12-下午2:42:27 |
||||
* |
||||
*/ |
||||
int[] getVerticalLine(); |
||||
|
||||
/** |
||||
* 获取块的水平线数组 |
||||
* |
||||
* @return 块的水平线数组 |
||||
* |
||||
* @date 2015-2-12-下午2:42:27 |
||||
* |
||||
*/ |
||||
int[] getHorizontalLine(); |
||||
} |
||||
|
||||
private static class PlacePointing { |
||||
public PlacePointing(int x) { |
||||
this.palce = x; |
||||
} |
||||
|
||||
private boolean isFind() { |
||||
return direction != -1; |
||||
} |
||||
|
||||
private int palce; |
||||
private int direction = -1; |
||||
} |
||||
|
||||
private static void findX(PlacePointing px, Rectangle bounds, int left, int right, int width) { |
||||
if (px.isFind()) { |
||||
return; |
||||
} |
||||
if (Math.abs(bounds.x + bounds.width / 2 - (left + right) / 2) <= SORPTION_UNIT) { |
||||
px.palce = bounds.x + bounds.width / 2 - width / 2; |
||||
px.direction = SwingConstants.CENTER; |
||||
} |
||||
int x1 = bounds.x; |
||||
if (Math.abs(x1 - left) <= SORPTION_UNIT) { |
||||
px.palce = x1; |
||||
px.direction = SwingConstants.LEFT; |
||||
} |
||||
if (Math.abs(x1 - right) <= SORPTION_UNIT) { |
||||
px.palce = x1 - width; |
||||
px.direction = SwingConstants.RIGHT; |
||||
} |
||||
int x2 = bounds.x + bounds.width; |
||||
if (Math.abs(x2 - left) <= SORPTION_UNIT) { |
||||
px.palce = x2; |
||||
px.direction = SwingConstants.LEFT; |
||||
} |
||||
if (Math.abs(x2 - right) <= SORPTION_UNIT) { |
||||
px.palce = x2 - width; |
||||
px.direction = SwingConstants.RIGHT; |
||||
} |
||||
if (Math.abs(bounds.x + bounds.width / 2 - left) <= SORPTION_UNIT) { |
||||
px.palce = bounds.x + bounds.width / 2; |
||||
px.direction = SwingConstants.LEFT; |
||||
} |
||||
if (Math.abs(bounds.x + bounds.width / 2 - right) <= SORPTION_UNIT) { |
||||
px.palce = bounds.x + bounds.width / 2 - width; |
||||
px.direction = SwingConstants.RIGHT; |
||||
} |
||||
} |
||||
|
||||
private static void findY(PlacePointing py, Rectangle bounds, int top, int bottom, int height) { |
||||
if (py.isFind()) { |
||||
return; |
||||
} |
||||
|
||||
if (Math.abs(bounds.y + bounds.height / 2 - (top + bottom) / 2) <= SORPTION_UNIT) { |
||||
py.palce = bounds.y + bounds.height / 2 - height / 2; |
||||
py.direction = SwingConstants.CENTER; |
||||
} |
||||
int y1 = bounds.y; |
||||
if (Math.abs(y1 - top) <= SORPTION_UNIT) { |
||||
py.palce = y1; |
||||
py.direction = SwingConstants.TOP; |
||||
} |
||||
if (Math.abs(y1 - bottom) <= SORPTION_UNIT) { |
||||
py.palce = y1 - height; |
||||
py.direction = SwingConstants.BOTTOM; |
||||
} |
||||
int y2 = bounds.y + bounds.height; |
||||
if (Math.abs(y2 - top) <= SORPTION_UNIT) { |
||||
py.palce = y2; |
||||
py.direction = SwingConstants.TOP; |
||||
} |
||||
if (Math.abs(y2 - bottom) <= SORPTION_UNIT) { |
||||
py.palce = y2 - height; |
||||
py.direction = SwingConstants.BOTTOM; |
||||
} |
||||
if (Math.abs(bounds.y + bounds.height / 2 - top) <= SORPTION_UNIT) { |
||||
py.palce = bounds.y + bounds.height / 2; |
||||
py.direction = SwingConstants.TOP; |
||||
} |
||||
if (Math.abs(bounds.y + bounds.height / 2 - bottom) <= SORPTION_UNIT) { |
||||
py.palce = bounds.y + bounds.height / 2 - height; |
||||
py.direction = SwingConstants.BOTTOM; |
||||
} |
||||
} |
||||
|
||||
private static void findEquidistantLine(Rectangle bounds, int left, int top, int height, int width) { |
||||
//最近的距离与坐标
|
||||
EquidistantLine equidistantLineInfo = new EquidistantLine(0, 0, 0); |
||||
//等距线从各边中点画出,先要判断是不是在范围内
|
||||
int topMiddleX = left + width / 2; |
||||
int leftMiddleY = top + height / 2; |
||||
if ((topMiddleX > bounds.getX()) && (topMiddleX < (bounds.getX() + bounds.getWidth()))){ |
||||
//当前操作rec在bounds的下方
|
||||
if (top > (bounds.getY() + bounds.getHeight())){ |
||||
equidistantLineInfo.setDistance(top - (bounds.y + bounds.height)); |
||||
equidistantLineInfo.setReference(bounds.y + bounds.height); |
||||
equidistantLineInfo.setDirection(SwingConstants.TOP); |
||||
} |
||||
//当前操作rec在bounds上方
|
||||
if ((top + height) < bounds.getY()){ |
||||
equidistantLineInfo.setDistance(bounds.y - (top + height)); |
||||
equidistantLineInfo.setReference(bounds.y); |
||||
equidistantLineInfo.setDirection(SwingConstants.BOTTOM); |
||||
} |
||||
} else if ((leftMiddleY > bounds.getY()) && (leftMiddleY < (bounds.getY() + bounds.getHeight()))) { |
||||
//当前操作rec在bounds的右侧
|
||||
if (left > (bounds.getX() + bounds.getWidth())){ |
||||
equidistantLineInfo.setDistance(left - (bounds.x + bounds.width)); |
||||
equidistantLineInfo.setReference(bounds.x + bounds.width); |
||||
equidistantLineInfo.setDirection(SwingConstants.LEFT); |
||||
} |
||||
//当前操作rec在bounds的左侧
|
||||
if ((left + width) < bounds.getX()){ |
||||
equidistantLineInfo.setDistance(bounds.x - (left + width)); |
||||
equidistantLineInfo.setReference(bounds.x); |
||||
equidistantLineInfo.setDirection(SwingConstants.RIGHT); |
||||
} |
||||
} |
||||
if(equidistantLineInfo.getDistance() > 0) { |
||||
equidistantLines.add(equidistantLineInfo); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 吸附 |
||||
* |
||||
* @param x x坐标 |
||||
* @param y y坐标 |
||||
* @param width 宽度 |
||||
* @param height 高度 |
||||
* @param designer 块设计器 |
||||
* |
||||
* @return 吸附后坐标 |
||||
* |
||||
* @date 2015-2-12-下午2:39:16 |
||||
* |
||||
*/ |
||||
public static Point sorption(int x, int y, int width, int height, RectangleDesigner designer, boolean isParameterLayout) { |
||||
|
||||
int left = x, top = y, bottom = top + height, right = left + width; |
||||
|
||||
Rectangle operatingRectangle = new Rectangle(x, y, width, height); |
||||
|
||||
equidistantLines.clear(); |
||||
|
||||
PlacePointing px = new PlacePointing(x); |
||||
PlacePointing py = new PlacePointing(y); |
||||
|
||||
PlacePointing pEquidistantX = new PlacePointing(x); |
||||
PlacePointing pEquidistantY = new PlacePointing(y); |
||||
|
||||
RectangleIterator iterator = designer.createRectangleIterator(); |
||||
|
||||
java.util.List<Rectangle> cacheRecs = new ArrayList<Rectangle>(); |
||||
while (iterator.hasNext()) { |
||||
Rectangle bounds = iterator.nextRectangle(); |
||||
cacheRecs.add(bounds); |
||||
findX(px, bounds, left, right, width); |
||||
findY(py, bounds, top, bottom, height); |
||||
|
||||
if (!isParameterLayout) { |
||||
findEquidistantLine(bounds, left, top, height, width); |
||||
} |
||||
} |
||||
|
||||
createXAbsorptionline(px, designer, width, cacheRecs); |
||||
createYAbsorptionline(py, designer, height, cacheRecs); |
||||
operatingRectangle.x = px.palce; |
||||
operatingRectangle.y = py.palce; |
||||
createEquidistantLine(pEquidistantX, pEquidistantY, operatingRectangle, designer); |
||||
Point sorptionPoint = new Point(px.palce,py.palce); |
||||
if (!px.isFind()){ |
||||
sorptionPoint.x = pEquidistantX.palce; |
||||
} |
||||
if (!py.isFind()){ |
||||
sorptionPoint.y = pEquidistantY.palce; |
||||
} |
||||
return sorptionPoint; |
||||
} |
||||
|
||||
|
||||
private static void createXAbsorptionline(PlacePointing px, RectangleDesigner designer, int width, java.util.List<Rectangle> cacheRecs) { |
||||
Absorptionline line = null; |
||||
RectangleIterator iterator = designer.createRectangleIterator(); |
||||
int[] selfVertical = designer.getVerticalLine(); |
||||
if (px.direction == SwingConstants.CENTER) { |
||||
line = Absorptionline.createXMidAbsorptionline(px.palce + width / 2); |
||||
int left = px.palce; |
||||
int right = px.palce + width; |
||||
for (Rectangle bounds : cacheRecs) { |
||||
if (bounds.x == left || bounds.x + bounds.width == left) { |
||||
line.setFirstLine(left); |
||||
} |
||||
if (bounds.x == right || bounds.x + bounds.width == right) { |
||||
line.setSecondLine(right); |
||||
} |
||||
updateVerticalLine(selfVertical, iterator, line); |
||||
if (line.isFull()) { |
||||
break; |
||||
} |
||||
} |
||||
} else if (px.direction == SwingConstants.LEFT || px.direction == SwingConstants.RIGHT) { |
||||
int left = px.direction == SwingConstants.LEFT ? px.palce + width : px.palce; |
||||
line = Absorptionline.createXAbsorptionline(px.direction == SwingConstants.LEFT ? px.palce : px.palce + width); |
||||
int middle = px.palce + width / 2; |
||||
for (Rectangle bounds : cacheRecs) { |
||||
if (bounds.x == left || bounds.x + bounds.width == left) { |
||||
line.setSecondLine(left); |
||||
} |
||||
if (bounds.x + bounds.width / 2 == middle) { |
||||
line.setMidLine(middle); |
||||
} |
||||
updateVerticalLine(selfVertical, iterator, line); |
||||
if (line.isFull()) { |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
designer.setXAbsorptionline(line); |
||||
} |
||||
|
||||
private static void createYAbsorptionline(PlacePointing py, RectangleDesigner designer, int height, java.util.List<Rectangle> cacheRecs) { |
||||
Absorptionline line = null; |
||||
RectangleIterator iterator = designer.createRectangleIterator(); |
||||
int[] selfHorizontal = designer.getHorizontalLine(); |
||||
if (py.direction == SwingConstants.CENTER) { |
||||
line = Absorptionline.createYMidAbsorptionline(py.palce + height / 2); |
||||
int top = py.palce; |
||||
int bottom = py.palce + height; |
||||
for (Rectangle bounds : cacheRecs) { |
||||
if (bounds.y == top || bounds.y + bounds.height == top) { |
||||
line.setFirstLine(top); |
||||
} |
||||
if (bounds.y == bottom || bounds.y + bounds.height == bottom) { |
||||
line.setSecondLine(bottom); |
||||
} |
||||
updateHorizontalLine(selfHorizontal, iterator, line); |
||||
if (line.isFull()) { |
||||
break; |
||||
} |
||||
} |
||||
} else if (py.direction == SwingConstants.TOP || py.direction == SwingConstants.BOTTOM) { |
||||
int top = py.direction == SwingConstants.TOP ? py.palce + height : py.palce; |
||||
line = Absorptionline.createYAbsorptionline(py.direction == SwingConstants.TOP ? py.palce : py.palce + height); |
||||
int middle = py.palce + height / 2; |
||||
for (Rectangle bounds : cacheRecs) { |
||||
if (bounds.y == top || bounds.y + bounds.height == top) { |
||||
line.setSecondLine(top); |
||||
} |
||||
if (bounds.y + bounds.height / 2 == middle) { |
||||
line.setMidLine(middle); |
||||
} |
||||
updateHorizontalLine(selfHorizontal, iterator, line); |
||||
if (line.isFull()) { |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
designer.setYAbsorptionline(line); |
||||
} |
||||
|
||||
private static void createEquidistantLine(PlacePointing px, PlacePointing py, Rectangle operatingRectangle, RectangleDesigner designer){ |
||||
processEquidistantLinesList(px, py, operatingRectangle); |
||||
Absorptionline line = null; |
||||
if(equidistantLines.size() > 0) { |
||||
int top = -1; |
||||
int left = -1; |
||||
int bottom = -1; |
||||
int right = -1; |
||||
for(int i = 0; i < equidistantLines.size(); i++){ |
||||
if (equidistantLines.get(i).getDirection() == SwingConstants.TOP){ |
||||
top = equidistantLines.get(i).getReference(); |
||||
} |
||||
if (equidistantLines.get(i).getDirection() == SwingConstants.LEFT){ |
||||
left = equidistantLines.get(i).getReference(); |
||||
} |
||||
if (equidistantLines.get(i).getDirection() == SwingConstants.BOTTOM){ |
||||
bottom = equidistantLines.get(i).getReference(); |
||||
} |
||||
if (equidistantLines.get(i).getDirection() == SwingConstants.RIGHT){ |
||||
right = equidistantLines.get(i).getReference(); |
||||
} |
||||
} |
||||
operatingRectangle.x -= designer.getDesignerScrollHorizontalValue(); |
||||
operatingRectangle.y -= designer.getDesignerScrollVerticalValue(); |
||||
line = Absorptionline.createEquidistantAbsorptionline(operatingRectangle, |
||||
top - designer.getDesignerScrollVerticalValue(), |
||||
left - designer.getDesignerScrollHorizontalValue(), |
||||
bottom - designer.getDesignerScrollVerticalValue(), |
||||
right - designer.getDesignerScrollHorizontalValue()); |
||||
} |
||||
designer.setEquidistantLine(line); |
||||
} |
||||
|
||||
private static void processEquidistantLinesList(PlacePointing pEquidistantX, PlacePointing pEquidistantY, Rectangle operatingRectangle){ |
||||
EquidistantLine[] equidistantLines1 = new EquidistantLine[EQUIDISTANTLINE_UNIT]; |
||||
//先按方向处理,只保留四个方向上距离最近
|
||||
for(int count = 0; count < equidistantLines.size(); count++){ |
||||
for (int direction = 0; direction < EQUIDISTANTLINE_UNIT; direction++){ |
||||
if(equidistantLines.get(count).getDirection() == (direction + 1)){//direction 1,2,3,4 分别对应top,left,bottom,right
|
||||
if(equidistantLines1[direction] != null |
||||
&& equidistantLines1[direction].getDistance() > equidistantLines.get(count).getDistance() |
||||
|| equidistantLines1[direction] == null) { |
||||
equidistantLines1[direction] = equidistantLines.get(count); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
equidistantLines.clear(); |
||||
//找list中横纵分别等距的组合
|
||||
if (equidistantLines1[0] != null && equidistantLines1[2] != null){//top, bottom
|
||||
int offset = equidistantLines1[0].getDistance() - equidistantLines1[2].getDistance(); |
||||
if (Math.abs(offset) <= SORPTION_UNIT * 2){ |
||||
pEquidistantY.direction = SwingConstants.TOP; |
||||
equidistantLines.add(equidistantLines1[0]); |
||||
equidistantLines.add(equidistantLines1[2]); |
||||
pEquidistantY.palce = operatingRectangle.y - offset / 2; |
||||
operatingRectangle.y = pEquidistantY.palce; |
||||
} |
||||
} |
||||
if (equidistantLines1[1] != null && equidistantLines1[3] != null){//left, right
|
||||
int offset = equidistantLines1[1].getDistance() - equidistantLines1[3].getDistance(); |
||||
if (Math.abs(offset) <= SORPTION_UNIT * 2){ |
||||
pEquidistantX.direction = SwingConstants.LEFT; |
||||
equidistantLines.add(equidistantLines1[1]); |
||||
equidistantLines.add(equidistantLines1[3]); |
||||
pEquidistantX.palce = operatingRectangle.x - offset / 2; |
||||
operatingRectangle.x = pEquidistantX.palce; |
||||
} |
||||
} |
||||
} |
||||
|
||||
//更新纵向行列线
|
||||
private static void updateVerticalLine(int[] selfVertical, RectangleIterator iterator, Absorptionline line){ |
||||
int[] targetArray = iterator.getVerticalLine(); |
||||
if (intersectArrays(targetArray, selfVertical)){ |
||||
line.setVerticalLines(targetArray); |
||||
} |
||||
} |
||||
|
||||
//更新横向行列线
|
||||
private static void updateHorizontalLine(int[] selfHorizontal, RectangleIterator iterator, Absorptionline line){ |
||||
int[] targetArray = iterator.getHorizontalLine(); |
||||
if (intersectArrays(targetArray, selfHorizontal)){ |
||||
line.setHorizontalLines(targetArray); |
||||
} |
||||
} |
||||
|
||||
//检测两个数组是否有相交的部分
|
||||
private static boolean intersectArrays(int[] targetArray, int[] selfArray){ |
||||
for (int i : targetArray) { |
||||
for (int j : selfArray) { |
||||
if(i == j){ |
||||
return true; |
||||
} |
||||
} |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
private static class EquidistantLine{ |
||||
//与操作rectangle的距离
|
||||
private int distance; |
||||
//参考rectangle的位置
|
||||
private int reference; |
||||
//等距线的方向
|
||||
private int direction; |
||||
|
||||
EquidistantLine(int distance, int reference, int direction){ |
||||
this.distance = distance; |
||||
this.reference = reference; |
||||
this.direction = direction; |
||||
} |
||||
|
||||
public void setDistance(int distance){ |
||||
this.distance = distance; |
||||
} |
||||
|
||||
public int getDistance(){ |
||||
return this.distance; |
||||
} |
||||
|
||||
public void setReference(int reference){ |
||||
this.reference = reference; |
||||
} |
||||
|
||||
public int getReference(){ |
||||
return this.reference; |
||||
} |
||||
|
||||
public void setDirection(int direction){ |
||||
this.direction = direction; |
||||
} |
||||
|
||||
public int getDirection(){ |
||||
return this.direction; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,50 @@
|
||||
package com.fr.design.border; |
||||
|
||||
import java.awt.Color; |
||||
import java.awt.Component; |
||||
import java.awt.Graphics; |
||||
import java.awt.Graphics2D; |
||||
import java.awt.RenderingHints; |
||||
import java.awt.geom.RoundRectangle2D; |
||||
|
||||
import javax.swing.border.LineBorder; |
||||
|
||||
import com.fr.base.GraphHelper; |
||||
|
||||
public class UIRoundedBorder extends LineBorder { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
private int roundedCorner; |
||||
private int lineStyle; |
||||
|
||||
public UIRoundedBorder(Color color) { |
||||
super(color); |
||||
} |
||||
|
||||
public UIRoundedBorder(Color color, int thickness){ |
||||
super(color, thickness); |
||||
} |
||||
|
||||
public UIRoundedBorder(Color color, int thickness, int roundedCorners){ |
||||
super(color, thickness, true); |
||||
this.roundedCorner = roundedCorners; |
||||
} |
||||
|
||||
public UIRoundedBorder(int lineStyle, Color color, int roundedCorners){ |
||||
super(color, GraphHelper.getLineStyleSize(lineStyle), true); |
||||
this.lineStyle = lineStyle; |
||||
this.roundedCorner = roundedCorners; |
||||
} |
||||
|
||||
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height){ |
||||
Color oldColor = g.getColor(); |
||||
|
||||
Graphics2D g2d = (Graphics2D)g; |
||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
||||
g2d.setColor(lineColor); |
||||
GraphHelper.draw(g2d, new RoundRectangle2D.Double(x, y, width - 1, height-1, roundedCorner, roundedCorner),lineStyle); |
||||
g2d.setColor(oldColor); |
||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); |
||||
} |
||||
} |
@ -0,0 +1,30 @@
|
||||
package com.fr.design.border; |
||||
|
||||
import com.fr.design.constants.UIConstants; |
||||
|
||||
import java.awt.Color; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.border.TitledBorder; |
||||
|
||||
public class UITitledBorder extends TitledBorder { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
public static UITitledBorder createBorderWithTitle(String title) { |
||||
return new UITitledBorder(title); |
||||
} |
||||
|
||||
private UITitledBorder(String title) { |
||||
super(null, title, 4, 2, null, new Color(1, 159, 222)); |
||||
init(title); |
||||
} |
||||
|
||||
private void init(String title){ |
||||
UIRoundedBorder roundedborder = new UIRoundedBorder(UIConstants.TITLED_BORDER_COLOR, 1, 10); |
||||
this.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0), roundedborder)); |
||||
|
||||
this.setTitle(title); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,15 @@
|
||||
/** |
||||
* |
||||
*/ |
||||
package com.fr.design.cell; |
||||
|
||||
/** |
||||
* 悬浮元素 |
||||
* |
||||
* @author focus |
||||
* @time 2014年11月17日下午10:44:10 |
||||
* @version |
||||
*/ |
||||
public interface FloatElementsProvider { |
||||
|
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue