* commit '283e484661b4d2fc81b8a324f35aa76f57916905': (346 commits) 2 1 无JIRA任务, 冲突修正 2 1 ct fix fix remove unused code fix fix fix .. fix PMD fix REPORT-2600 无jira任务 应用补丁的时候有一个没有删除 移到designer_base pmd REPORT-2213 设计器右上角使用qq登录后,登录界面关不掉 & 这部分的代码质量 REPORT-2335 插件管理界面以及右上角的登录界面,多次点击后,页面无法关闭 ...master
@ -1,13 +1,14 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||||
<module type="JAVA_MODULE" version="4"> |
<module type="JAVA_MODULE" version="4"> |
||||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false"> |
<component name="NewModuleRootManager" inherit-compiler-output="true"> |
||||||
<output url="file://$MODULE_DIR$/../../env/WebReport/WEB-INF/classes" /> |
<exclude-output /> |
||||||
<content url="file://$MODULE_DIR$"> |
<content url="file://$MODULE_DIR$"> |
||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> |
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> |
||||||
</content> |
</content> |
||||||
<orderEntry type="jdk" jdkName="jdk1.8" jdkType="JavaSDK" /> |
<orderEntry type="inheritedJdk" /> |
||||||
<orderEntry type="sourceFolder" forTests="false" /> |
<orderEntry type="sourceFolder" forTests="false" /> |
||||||
<orderEntry type="module" module-name="designer_base" /> |
<orderEntry type="module" module-name="designer_base" /> |
||||||
<orderEntry type="library" name="lib" level="project" /> |
<orderEntry type="module" module-name="designer_form" /> |
||||||
|
<orderEntry type="module" module-name="designer_chart" /> |
||||||
</component> |
</component> |
||||||
</module> |
</module> |
@ -0,0 +1,73 @@ |
|||||||
|
package com.fr.aspectj.designer; |
||||||
|
|
||||||
|
/** |
||||||
|
* 记录模板过程 |
||||||
|
* Created by plough on 2017/3/3. |
||||||
|
*/ |
||||||
|
|
||||||
|
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; |
||||||
|
import com.fr.grid.Grid; |
||||||
|
import org.aspectj.lang.reflect.SourceLocation; |
||||||
|
|
||||||
|
import java.awt.event.ActionEvent; |
||||||
|
import java.awt.event.MouseEvent; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
public aspect TemplateProcessTracker { |
||||||
|
//声明一个pointcut,匹配你需要的方法 |
||||||
|
pointcut onMouseClicked(MouseEvent e) : |
||||||
|
execution(* mouseClicked(MouseEvent)) && args(e); |
||||||
|
pointcut onMousePressed(MouseEvent e) : |
||||||
|
execution(* mousePressed(MouseEvent)) && args(e); |
||||||
|
pointcut onMouseReleased(MouseEvent e) : |
||||||
|
execution(* mouseReleased(MouseEvent)) && args(e); |
||||||
|
pointcut onActionPerformed(ActionEvent e) : |
||||||
|
execution(* actionPerformed(ActionEvent)) && args(e); |
||||||
|
pointcut onSetValueAt(Object v, int r, int c) : |
||||||
|
execution(* setValueAt(java.lang.Object, int, int)) && args(v, r, c); |
||||||
|
pointcut onSetValue4EditingElement(Grid g, Object v) : |
||||||
|
call(* setValue4EditingElement(java.lang.Object)) && target(g) && args(v); |
||||||
|
|
||||||
|
//before表示之前的意思 |
||||||
|
//这整个表示在MouseAdapter的public void mouseXXX(MouseEvent)方法调用之前,你想要执行的代码 |
||||||
|
before(MouseEvent e) : onMouseClicked(e) || onMousePressed(e) || onMouseReleased(e) { |
||||||
|
SourceLocation sl = thisJoinPoint.getSourceLocation();//切面对应的代码位置 |
||||||
|
|
||||||
|
// String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); |
||||||
|
String log = ""; |
||||||
|
TemplateInfoCollector.appendProcess(log); |
||||||
|
} |
||||||
|
//同上 |
||||||
|
before(ActionEvent e) : onActionPerformed(e) { |
||||||
|
SourceLocation sl = thisJoinPoint.getSourceLocation(); |
||||||
|
// !within(LogHandlerBar) 没用, 手动过滤 |
||||||
|
if (e.getSource().toString().contains("javax.swing.Timer")) { |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
//String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); |
||||||
|
String log = ""; |
||||||
|
TemplateInfoCollector.appendProcess(log); |
||||||
|
|
||||||
|
} |
||||||
|
//同上 |
||||||
|
before(Object v, int r, int c) : onSetValueAt(v, r, c) { |
||||||
|
SourceLocation sl = thisJoinPoint.getSourceLocation(); |
||||||
|
|
||||||
|
//String log = String.format("%s:\n%s\nset value: %s at (%d, %d)\n\n", new Date(), sl, v, r, c); |
||||||
|
String log = ""; |
||||||
|
TemplateInfoCollector.appendProcess(log); |
||||||
|
|
||||||
|
} |
||||||
|
//同上 |
||||||
|
before(Grid g, Object v) : onSetValue4EditingElement(g, v) { |
||||||
|
SourceLocation sl = thisJoinPoint.getSourceLocation(); |
||||||
|
|
||||||
|
// String v = "test"; |
||||||
|
//String log = String.format("%s:\n%s\nset value: %s at %s\n\n", new Date(), sl, v, g.getEditingCellElement()); |
||||||
|
String log = ""; |
||||||
|
TemplateInfoCollector.appendProcess(log); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,74 @@ |
|||||||
|
package com.fr.design.mainframe.templateinfo; |
||||||
|
|
||||||
|
import com.fr.base.parameter.ParameterUI; |
||||||
|
import com.fr.main.impl.WorkBook; |
||||||
|
import com.fr.report.cellcase.CellCase; |
||||||
|
import com.fr.report.poly.PolyWorkSheet; |
||||||
|
import com.fr.report.worksheet.WorkSheet; |
||||||
|
|
||||||
|
import java.util.Iterator; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by plough on 2017/3/17. |
||||||
|
*/ |
||||||
|
public class JWorkBookProcessInfo extends TemplateProcessInfo<WorkBook> { |
||||||
|
|
||||||
|
public JWorkBookProcessInfo(WorkBook wb) { |
||||||
|
super(wb); |
||||||
|
} |
||||||
|
|
||||||
|
// 获取模板类型
|
||||||
|
public int getReportType() { |
||||||
|
return template.isElementCaseBook() ? 0 : 1; |
||||||
|
} |
||||||
|
|
||||||
|
// 获取模板格子数
|
||||||
|
public int getCellCount() { |
||||||
|
int cellCount = 0; |
||||||
|
if (template.isElementCaseBook()) { // 如果是普通报表
|
||||||
|
for (int i = 0; i < template.getReportCount(); i++) { |
||||||
|
WorkSheet r = (WorkSheet) template.getReport(i); |
||||||
|
CellCase cc = r.getBlock().getCellCase(); |
||||||
|
for (int j = 0; j < cc.getRowCount(); j++) { |
||||||
|
Iterator iter = cc.getRow(j); |
||||||
|
while (iter.hasNext()) { |
||||||
|
cellCount ++; |
||||||
|
iter.next(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return cellCount; |
||||||
|
} |
||||||
|
// 获取模板悬浮元素个数
|
||||||
|
public int getFloatCount() { |
||||||
|
int chartCount = 0; |
||||||
|
if (template.isElementCaseBook()) { // 如果是普通报表
|
||||||
|
for (int i = 0; i < template.getReportCount(); i++) { |
||||||
|
WorkSheet r = (WorkSheet) template.getReport(i); |
||||||
|
Iterator fiter = r.getBlock().floatIterator(); |
||||||
|
while (fiter.hasNext()) { |
||||||
|
chartCount ++; |
||||||
|
fiter.next(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return chartCount; |
||||||
|
} |
||||||
|
// 获取模板聚合块个数
|
||||||
|
public int getBlockCount() { |
||||||
|
int blockCount = 0; |
||||||
|
if (!template.isElementCaseBook()) { // 如果是聚合报表
|
||||||
|
for (int i = 0; i < template.getReportCount(); i++) { |
||||||
|
PolyWorkSheet r = (PolyWorkSheet) template.getReport(i); |
||||||
|
blockCount += r.getBlockCount(); |
||||||
|
} |
||||||
|
} |
||||||
|
return blockCount; |
||||||
|
} |
||||||
|
// 获取模板控件数
|
||||||
|
public int getWidgetCount() { |
||||||
|
ParameterUI pui = template.getReportParameterAttr().getParameterUI(); |
||||||
|
return pui == null ? 0 : (pui.getAllWidgets().length - 1); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,70 @@ |
|||||||
|
|
||||||
|
apply plugin: 'java' |
||||||
|
tasks.withType(JavaCompile){ |
||||||
|
options.encoding = 'UTF-8' |
||||||
|
} |
||||||
|
//指定构建的jdk版本 |
||||||
|
sourceCompatibility=1.7 |
||||||
|
//指定生成jar包版本 |
||||||
|
version='8.0' |
||||||
|
//生成jar包重命名 |
||||||
|
jar{ |
||||||
|
baseName='fr-designer-core' |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
def srcDir="." |
||||||
|
|
||||||
|
//指定源码路径 |
||||||
|
sourceSets{ |
||||||
|
main{ |
||||||
|
java{ |
||||||
|
srcDirs=["${srcDir}/src"] |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
//获取什么分支名 |
||||||
|
FileTree files =fileTree(dir:'./',include:'build.*.gradle') |
||||||
|
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) |
||||||
|
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) |
||||||
|
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) |
||||||
|
|
||||||
|
//声明外部依赖 |
||||||
|
dependencies{ |
||||||
|
|
||||||
|
compile fileTree(dir:"../../../finereport-lib-stable/${branchName}",include:'**/*.jar') |
||||||
|
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") |
||||||
|
|
||||||
|
testCompile 'junit:junit:4.12' |
||||||
|
} |
||||||
|
//复制非.java文件到classes文件夹下参与打包 |
||||||
|
task copyFile(type:Copy,dependsOn:compileJava){ |
||||||
|
copy{ |
||||||
|
from ("${srcDir}/src"){ |
||||||
|
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' |
||||||
|
} |
||||||
|
into 'build/classes/main' |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
//压缩项目中的js文件 |
||||||
|
task compressJS{ |
||||||
|
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ |
||||||
|
classpath { |
||||||
|
fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar') |
||||||
|
} |
||||||
|
} |
||||||
|
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ |
||||||
|
fileset (dir:"${srcDir}/src"){ |
||||||
|
include (name:'**/*.js') |
||||||
|
include (name:'**/*.css') |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
jar.dependsOn compressJS |
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,89 @@ |
|||||||
|
|
||||||
|
apply plugin: 'java' |
||||||
|
tasks.withType(JavaCompile){ |
||||||
|
options.encoding = 'UTF-8' |
||||||
|
} |
||||||
|
buildscript { |
||||||
|
repositories { |
||||||
|
maven { |
||||||
|
url "http://www.eveoh.nl/files/maven2" |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
dependencies { |
||||||
|
classpath "nl.eveoh:gradle-aspectj:1.2" |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
ext.aspectjVersion = '1.7.4' |
||||||
|
apply plugin: 'aspectj' |
||||||
|
|
||||||
|
repositories { |
||||||
|
mavenCentral() |
||||||
|
} |
||||||
|
|
||||||
|
//指定构建的jdk版本 |
||||||
|
sourceCompatibility=1.7 |
||||||
|
//指定生成jar包版本 |
||||||
|
version='8.0' |
||||||
|
//生成jar包重命名 |
||||||
|
jar{ |
||||||
|
baseName='fr-designer-core' |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
def srcDir="." |
||||||
|
|
||||||
|
//指定源码路径 |
||||||
|
sourceSets{ |
||||||
|
main{ |
||||||
|
java{ |
||||||
|
srcDirs=["${srcDir}/src"] |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
//获取什么分支名 |
||||||
|
FileTree files =fileTree(dir:'./',include:'build.*.gradle') |
||||||
|
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) |
||||||
|
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) |
||||||
|
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) |
||||||
|
|
||||||
|
//声明外部依赖 |
||||||
|
dependencies{ |
||||||
|
|
||||||
|
compile fileTree(dir:"../../../finereport-lib-stable/${branchName}",include:'**/*.jar') |
||||||
|
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") |
||||||
|
|
||||||
|
testCompile 'junit:junit:4.12' |
||||||
|
} |
||||||
|
//复制非.java文件到classes文件夹下参与打包 |
||||||
|
task copyFile(type:Copy,dependsOn:compileJava){ |
||||||
|
copy{ |
||||||
|
from ("${srcDir}/src"){ |
||||||
|
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' |
||||||
|
} |
||||||
|
into 'build/classes/main' |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
//压缩项目中的js文件 |
||||||
|
task compressJS{ |
||||||
|
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ |
||||||
|
classpath { |
||||||
|
fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar') |
||||||
|
} |
||||||
|
} |
||||||
|
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ |
||||||
|
fileset (dir:"${srcDir}/src"){ |
||||||
|
include (name:'**/*.js') |
||||||
|
include (name:'**/*.css') |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
jar.dependsOn compressJS |
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,60 @@ |
|||||||
|
package com.fr.aspectj.designerbase; |
||||||
|
|
||||||
|
/** |
||||||
|
* 记录模板过程 |
||||||
|
* Created by plough on 2017/3/3. |
||||||
|
*/ |
||||||
|
|
||||||
|
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; |
||||||
|
import org.aspectj.lang.reflect.SourceLocation; |
||||||
|
|
||||||
|
import java.awt.event.ActionEvent; |
||||||
|
import java.awt.event.MouseEvent; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
public aspect TemplateProcessTracker { |
||||||
|
//声明一个pointcut,匹配你需要的方法 |
||||||
|
pointcut onMouseClicked(MouseEvent e) : |
||||||
|
execution(* mouseClicked(MouseEvent)) && args(e); |
||||||
|
pointcut onMousePressed(MouseEvent e) : |
||||||
|
execution(* mousePressed(MouseEvent)) && args(e); |
||||||
|
pointcut onMouseReleased(MouseEvent e) : |
||||||
|
execution(* mouseReleased(MouseEvent)) && args(e); |
||||||
|
pointcut onActionPerformed(ActionEvent e) : |
||||||
|
execution(* actionPerformed(ActionEvent)) && args(e); |
||||||
|
pointcut onSetValueAt(Object v, int r, int c) : |
||||||
|
execution(* setValueAt(java.lang.Object, int, int)) && args(v, r, c); |
||||||
|
|
||||||
|
//before表示之前的意思 |
||||||
|
//这整个表示在MouseAdapter的public void mouseXXX(MouseEvent)方法调用之前,你想要执行的代码 |
||||||
|
before(MouseEvent e) : onMouseClicked(e) || onMousePressed(e) || onMouseReleased(e) { |
||||||
|
SourceLocation sl = thisJoinPoint.getSourceLocation();//切面对应的代码位置 |
||||||
|
|
||||||
|
//String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); |
||||||
|
String log = ""; |
||||||
|
TemplateInfoCollector.appendProcess(log); |
||||||
|
} |
||||||
|
//同上 |
||||||
|
before(ActionEvent e) : onActionPerformed(e) { |
||||||
|
SourceLocation sl = thisJoinPoint.getSourceLocation(); |
||||||
|
// !within(LogHandlerBar) 没用, 手动过滤 |
||||||
|
if (e.getSource().toString().contains("javax.swing.Timer")) { |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
//String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); |
||||||
|
String log = ""; |
||||||
|
TemplateInfoCollector.appendProcess(log); |
||||||
|
|
||||||
|
} |
||||||
|
//同上 |
||||||
|
before(Object v, int r, int c) : onSetValueAt(v, r, c) { |
||||||
|
SourceLocation sl = thisJoinPoint.getSourceLocation(); |
||||||
|
|
||||||
|
//String log = String.format("%s:\n%s\nset value: %s at (%d, %d)\n\n", new Date(), sl, v, r, c); |
||||||
|
String log = ""; |
||||||
|
TemplateInfoCollector.appendProcess(log); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -1,37 +1,35 @@ |
|||||||
/* |
/* |
||||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||||
*/ |
*/ |
||||||
package com.fr.design.actions.edit; |
package com.fr.design.actions.edit; |
||||||
|
|
||||||
import java.awt.event.KeyEvent; |
import com.fr.base.BaseUtils; |
||||||
|
import com.fr.design.actions.TemplateComponentAction; |
||||||
import javax.swing.KeyStroke; |
import com.fr.design.designer.TargetComponent; |
||||||
|
import com.fr.general.Inter; |
||||||
import com.fr.base.BaseUtils; |
|
||||||
import com.fr.design.actions.TemplateComponentAction; |
import javax.swing.*; |
||||||
import com.fr.design.designer.TargetComponent; |
import java.awt.event.KeyEvent; |
||||||
import com.fr.general.Inter; |
|
||||||
|
/** |
||||||
/** |
* Copy. |
||||||
* Copy. |
*/ |
||||||
*/ |
public class CopyAction extends TemplateComponentAction { |
||||||
public class CopyAction extends TemplateComponentAction { |
public CopyAction(TargetComponent t) { |
||||||
public CopyAction(TargetComponent t) { |
super(t); |
||||||
super(t); |
|
||||||
|
this.setName(Inter.getLocText("M_Edit-Copy")); |
||||||
this.setName(Inter.getLocText("M_Edit-Copy")); |
this.setMnemonic('C'); |
||||||
this.setMnemonic('C'); |
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); |
||||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); |
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_MASK)); |
||||||
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_MASK)); |
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
public boolean executeActionReturnUndoRecordNeeded() { |
||||||
public boolean executeActionReturnUndoRecordNeeded() { |
TargetComponent tc = getEditingComponent(); |
||||||
TargetComponent tc = getEditingComponent(); |
if (tc != null) { |
||||||
if (tc != null) { |
tc.copy(); |
||||||
tc.copy(); |
} |
||||||
} |
return false; |
||||||
|
} |
||||||
return false; |
|
||||||
} |
|
||||||
} |
} |
@ -1,171 +1,176 @@ |
|||||||
package com.fr.design.actions.server; |
package com.fr.design.actions.server; |
||||||
|
|
||||||
import com.fr.base.BaseUtils; |
import com.fr.base.BaseUtils; |
||||||
import com.fr.base.Env; |
import com.fr.base.Env; |
||||||
import com.fr.base.FRContext; |
import com.fr.base.FRContext; |
||||||
import com.fr.base.ModifiedTable; |
import com.fr.base.ModifiedTable; |
||||||
import com.fr.data.impl.Connection; |
import com.fr.data.impl.Connection; |
||||||
import com.fr.dav.LocalEnv; |
import com.fr.dav.LocalEnv; |
||||||
import com.fr.design.actions.UpdateAction; |
import com.fr.design.actions.UpdateAction; |
||||||
import com.fr.design.data.datapane.connect.ConnectionManagerPane; |
import com.fr.design.data.datapane.connect.ConnectionManagerPane; |
||||||
import com.fr.design.dialog.BasicDialog; |
import com.fr.design.data.datapane.connect.ConnectionShowPane; |
||||||
import com.fr.design.dialog.DialogActionAdapter; |
import com.fr.design.dialog.BasicDialog; |
||||||
import com.fr.design.mainframe.DesignerContext; |
import com.fr.design.dialog.DialogActionAdapter; |
||||||
import com.fr.design.mainframe.DesignerFrame; |
import com.fr.design.mainframe.DesignerContext; |
||||||
import com.fr.design.menu.MenuKeySet; |
import com.fr.design.mainframe.DesignerFrame; |
||||||
import com.fr.file.DatasourceManager; |
import com.fr.design.menu.MenuKeySet; |
||||||
import com.fr.file.DatasourceManagerProvider; |
import com.fr.file.DatasourceManager; |
||||||
import com.fr.general.Inter; |
import com.fr.file.DatasourceManagerProvider; |
||||||
|
import com.fr.general.Inter; |
||||||
import javax.swing.*; |
|
||||||
import java.awt.event.ActionEvent; |
import javax.swing.*; |
||||||
import java.util.HashMap; |
import java.awt.event.ActionEvent; |
||||||
|
import java.util.HashMap; |
||||||
/** |
|
||||||
* DatasourceList Action |
/** |
||||||
*/ |
* DatasourceList Action |
||||||
public class ConnectionListAction extends UpdateAction { |
*/ |
||||||
private static final int BYTENUM = 1444; |
public class ConnectionListAction extends UpdateAction { |
||||||
|
|
||||||
public ConnectionListAction() { |
public ConnectionListAction() { |
||||||
this.setMenuKeySet(DEFINE_DATA_CONNECTION); |
this.setMenuKeySet(DEFINE_DATA_CONNECTION); |
||||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_web/connection.png")); |
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_web/connection.png")); |
||||||
} |
} |
||||||
|
|
||||||
public static final MenuKeySet DEFINE_DATA_CONNECTION = new MenuKeySet() { |
public static final MenuKeySet DEFINE_DATA_CONNECTION = new MenuKeySet() { |
||||||
@Override |
@Override |
||||||
public char getMnemonic() { |
public char getMnemonic() { |
||||||
return 'D'; |
return 'D'; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public String getMenuName() { |
public String getMenuName() { |
||||||
return Inter.getLocText("Server-Define_Data_Connection"); |
return Inter.getLocText("Server-Define_Data_Connection"); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public KeyStroke getKeyStroke() { |
public KeyStroke getKeyStroke() { |
||||||
return null; |
return null; |
||||||
} |
} |
||||||
}; |
}; |
||||||
|
|
||||||
/** |
/** |
||||||
* 执行动作 |
* 执行动作 |
||||||
* |
* |
||||||
* @param evt 事件 |
* @param evt 事件 |
||||||
*/ |
*/ |
||||||
public void actionPerformed(ActionEvent evt) { |
public void actionPerformed(ActionEvent evt) { |
||||||
DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); |
DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); |
||||||
final DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance(); |
final DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance(); |
||||||
final DatasourceManager backupManager = datasourceManager.getBackUpManager(); |
final DatasourceManager backupManager = datasourceManager.getBackUpManager(); |
||||||
final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() { |
final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() { |
||||||
public void complete() { |
public void complete() { |
||||||
populate(datasourceManager); |
populate(datasourceManager); |
||||||
} |
} |
||||||
|
|
||||||
protected void renameConnection(String oldName, String newName) { |
protected void renameConnection(String oldName, String newName) { |
||||||
datasourceManager.getConnectionLocalModifyTable().rename(oldName, newName); |
datasourceManager.getConnectionLocalModifyTable().rename(oldName, newName); |
||||||
} |
} |
||||||
}; |
}; |
||||||
final BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null); |
final BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null); |
||||||
databaseListDialog.addDialogActionListener(new DialogActionAdapter() { |
databaseListDialog.addDialogActionListener(new DialogActionAdapter() { |
||||||
public void doOk() { |
public void doOk() { |
||||||
if (!databaseManagerPane.isNamePermitted()) { |
if (!databaseManagerPane.isNamePermitted()) { |
||||||
databaseListDialog.setDoOKSucceed(false); |
databaseListDialog.setDoOKSucceed(false); |
||||||
return; |
return; |
||||||
} |
} |
||||||
if (!doWithDatasourceManager(datasourceManager, backupManager, databaseManagerPane, databaseListDialog)) { |
if (!doWithDatasourceManager(datasourceManager, backupManager, databaseManagerPane, databaseListDialog)) { |
||||||
//如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面
|
//如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面
|
||||||
return; |
return; |
||||||
} |
} |
||||||
// marks:保存数据
|
// marks:保存数据
|
||||||
writeFile(datasourceManager); |
writeFile(datasourceManager); |
||||||
} |
} |
||||||
|
|
||||||
public void doCancel() { |
public void doCancel() { |
||||||
datasourceManager.synchronizedWithServer(); |
datasourceManager.synchronizedWithServer(); |
||||||
} |
} |
||||||
}); |
}); |
||||||
databaseListDialog.setVisible(true); |
databaseListDialog.setVisible(true); |
||||||
} |
} |
||||||
|
|
||||||
|
|
||||||
private void writeFile(DatasourceManagerProvider datasourceManager) { |
/** |
||||||
Env currentEnv = FRContext.getCurrentEnv(); |
* @param datasourceManager |
||||||
try { |
*/ |
||||||
boolean isSuccess = currentEnv.writeResource(datasourceManager); |
public static void writeFile(DatasourceManagerProvider datasourceManager) { |
||||||
if (!isSuccess) { |
Env currentEnv = FRContext.getCurrentEnv(); |
||||||
throw new RuntimeException(Inter.getLocText("FR-Designer_Already_exist")); |
try { |
||||||
} |
boolean isSuccess = currentEnv.writeResource(datasourceManager); |
||||||
} catch (Exception e) { |
if (!isSuccess) { |
||||||
throw new RuntimeException(Inter.getLocText("FR-Designer_Already_exist")); |
throw new RuntimeException(Inter.getLocText("FR-Designer_Already_exist")); |
||||||
} |
} |
||||||
DesignerContext.getDesignerBean("databasename").refreshBeanElement(); |
} catch (Exception e) { |
||||||
} |
throw new RuntimeException(Inter.getLocText("FR-Designer_Already_exist")); |
||||||
|
} |
||||||
/** |
DesignerContext.getDesignerBean("databasename").refreshBeanElement(); |
||||||
* 是否正常更新完datasourceManager |
} |
||||||
* |
|
||||||
* @param datasourceManager |
/** |
||||||
* @param databaseManagerPane |
* 更新datasourceManager |
||||||
* @return |
* |
||||||
*/ |
* @param datasourceManager datasource管理对象 |
||||||
private boolean doWithDatasourceManager(DatasourceManagerProvider datasourceManager, DatasourceManager backupManager, |
* @param backupManager datasource管理对象备份 |
||||||
ConnectionManagerPane databaseManagerPane, BasicDialog databaseListDialog) { |
* @param connectionShowPane datasource面板 |
||||||
databaseManagerPane.update(datasourceManager); |
* @param databaseListDialog datasource管理对话框 |
||||||
HashMap<String, Connection> modifyDetails = datasourceManager.getConnectionModifyDetails(); |
* @return boolean 是否更新成功 |
||||||
modifyDetails.clear(); |
*/ |
||||||
Env currentEnv = FRContext.getCurrentEnv(); |
public static boolean doWithDatasourceManager(DatasourceManagerProvider datasourceManager, DatasourceManager |
||||||
ModifiedTable localModifiedTable = datasourceManager.checkConnectionModifyTable(backupManager, currentEnv.getUserID()); |
backupManager, ConnectionShowPane connectionShowPane, BasicDialog databaseListDialog) { |
||||||
boolean isFailed = false; |
connectionShowPane.update(datasourceManager); |
||||||
if (currentEnv.isSupportLocalFileOperate() && !((LocalEnv) currentEnv).isNoRemoteUser()) { |
HashMap<String, Connection> modifyDetails = datasourceManager.getConnectionModifyDetails(); |
||||||
//如果是本地,并且有远程用户时则更新自己的修改表
|
modifyDetails.clear(); |
||||||
datasourceManager.updateSelfConnectionTotalModifiedTable(localModifiedTable, ModifiedTable.LOCAL_MODIFIER); |
Env currentEnv = FRContext.getCurrentEnv(); |
||||||
} else { |
ModifiedTable localModifiedTable = datasourceManager.checkConnectionModifyTable(backupManager, currentEnv.getUserID()); |
||||||
if (!currentEnv.isSupportLocalFileOperate()) { |
boolean isFailed = false; |
||||||
//如果是远程,则去取服务器的最新的修改表,检查有没有冲突
|
if (currentEnv.isSupportLocalFileOperate() && !((LocalEnv) currentEnv).isNoRemoteUser()) { |
||||||
ModifiedTable currentServerModifyTable = currentEnv.getDataSourceModifiedTables(DatasourceManager.CONNECTION); |
//如果是本地,并且有远程用户时则更新自己的修改表
|
||||||
if (localModifiedTable.checkModifiedTableConflictWithServer(currentServerModifyTable, currentEnv.getUserID())) { |
datasourceManager.updateSelfConnectionTotalModifiedTable(localModifiedTable, ModifiedTable.LOCAL_MODIFIER); |
||||||
//有冲突,进行提示
|
} else { |
||||||
String title = Inter.getLocText(new String[]{"Select", "Single", "Setting"}); |
if (!currentEnv.isSupportLocalFileOperate()) { |
||||||
int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), localModifiedTable.getWaringMessage(), title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); |
//如果是远程,则去取服务器的最新的修改表,检查有没有冲突
|
||||||
if (returnVal == JOptionPane.YES_OPTION) { |
ModifiedTable currentServerModifyTable = currentEnv.getDataSourceModifiedTables(DatasourceManager.CONNECTION); |
||||||
//点击是,进行相应刷新去冲突
|
if (localModifiedTable.checkModifiedTableConflictWithServer(currentServerModifyTable, currentEnv.getUserID())) { |
||||||
datasourceManager.synchronizedWithServer(backupManager, DatasourceManager.CONNECTION); |
//有冲突,进行提示
|
||||||
//要是有重命名冲突的,则对详细的修改表先进行修改
|
String title = Inter.getLocText(new String[]{"Select", "Single", "Setting"}); |
||||||
datasourceManager.doWithConnectionConflict(localModifiedTable); |
int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), localModifiedTable.getWaringMessage(), title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); |
||||||
localModifiedTable.removeConfilct(); |
if (returnVal == JOptionPane.YES_OPTION) { |
||||||
modifyDetails.clear(); |
//点击是,进行相应刷新去冲突
|
||||||
//更新面板
|
datasourceManager.synchronizedWithServer(backupManager, DatasourceManager.CONNECTION); |
||||||
databaseManagerPane.populate(datasourceManager); |
//要是有重命名冲突的,则对详细的修改表先进行修改
|
||||||
} else { |
datasourceManager.doWithConnectionConflict(localModifiedTable); |
||||||
//更新失败,继续停留页面
|
localModifiedTable.removeConfilct(); |
||||||
isFailed = true; |
modifyDetails.clear(); |
||||||
} |
//更新面板
|
||||||
|
connectionShowPane.populate(datasourceManager); |
||||||
} |
} else { |
||||||
} |
//更新失败,继续停留页面
|
||||||
} |
isFailed = true; |
||||||
//存在请重命名则不能更新
|
} |
||||||
int index = datasourceManager.isConnectionMapContainsRename(); |
|
||||||
if (index != -1) { |
} |
||||||
isFailed = true; |
} |
||||||
databaseManagerPane.setSelectedIndex(index); |
} |
||||||
} |
//存在请重命名则不能更新
|
||||||
databaseListDialog.setDoOKSucceed(!isFailed); |
int index = datasourceManager.isConnectionMapContainsRename(); |
||||||
//如果修改成功,则去远程端增量修改修改表
|
if (index != -1) { |
||||||
if (!isFailed && !currentEnv.isSupportLocalFileOperate()) { |
isFailed = true; |
||||||
currentEnv.writeDataSourceModifiedTables(localModifiedTable, DatasourceManager.CONNECTION); |
connectionShowPane.setSelectedIndex(index); |
||||||
localModifiedTable.clear(); |
} |
||||||
modifyDetails.clear(); |
databaseListDialog.setDoOKSucceed(!isFailed); |
||||||
} |
//如果修改成功,则去远程端增量修改修改表
|
||||||
return !isFailed; |
if (!isFailed && !currentEnv.isSupportLocalFileOperate()) { |
||||||
} |
currentEnv.writeDataSourceModifiedTables(localModifiedTable, DatasourceManager.CONNECTION); |
||||||
|
localModifiedTable.clear(); |
||||||
|
modifyDetails.clear(); |
||||||
public void update() { |
} |
||||||
this.setEnabled(true); |
return !isFailed; |
||||||
} |
} |
||||||
|
|
||||||
|
|
||||||
|
public void update() { |
||||||
|
this.setEnabled(true); |
||||||
|
} |
||||||
} |
} |
@ -1,48 +0,0 @@ |
|||||||
package com.fr.design.beans.location; |
|
||||||
|
|
||||||
import com.fr.base.BaseUtils; |
|
||||||
import com.fr.design.gui.ibutton.UIButton; |
|
||||||
import com.fr.design.icon.IconPathConstants; |
|
||||||
import com.fr.general.Inter; |
|
||||||
|
|
||||||
import javax.swing.*; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by zhouping on 2016/7/24. |
|
||||||
*/ |
|
||||||
public class WidgetForbidWindow extends JWindow { |
|
||||||
|
|
||||||
private static final int WIDTH = 150; |
|
||||||
private static final int HEIGHT = 20; |
|
||||||
|
|
||||||
private UIButton promptButton = new UIButton(Inter.getLocText("FR-Designer_Forbid_Widgets_Intersects"), BaseUtils.readIcon(IconPathConstants.FORBID_ICON_PATH)); |
|
||||||
|
|
||||||
/** |
|
||||||
* 构造函数 |
|
||||||
*/ |
|
||||||
public WidgetForbidWindow() { |
|
||||||
this.add(promptButton); |
|
||||||
|
|
||||||
this.setSize(WIDTH, HEIGHT); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 在指定位置显示窗口, 默认将window的中心点放到指定位置上 |
|
||||||
* |
|
||||||
* @param x x坐标 |
|
||||||
* @param y y坐标 |
|
||||||
* |
|
||||||
*/ |
|
||||||
public void showWindow(int x, int y){ |
|
||||||
this.setLocation(x - WIDTH / 2, y - HEIGHT / 2); |
|
||||||
this.setVisible(true); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 隐藏当前窗口 |
|
||||||
* |
|
||||||
*/ |
|
||||||
public void hideWindow(){ |
|
||||||
this.setVisible(false); |
|
||||||
} |
|
||||||
} |
|
@ -1,128 +1,140 @@ |
|||||||
package com.fr.design.data.datapane.connect; |
package com.fr.design.data.datapane.connect; |
||||||
|
|
||||||
import com.fr.base.Env; |
import com.fr.base.FRContext; |
||||||
import com.fr.base.FRContext; |
import com.fr.data.impl.AbstractDatabaseConnection; |
||||||
import com.fr.data.impl.AbstractDatabaseConnection; |
import com.fr.data.impl.Connection; |
||||||
import com.fr.data.impl.Connection; |
import com.fr.data.impl.NameDatabaseConnection; |
||||||
import com.fr.data.impl.NameDatabaseConnection; |
import com.fr.design.DesignerEnvManager; |
||||||
import com.fr.design.DesignerEnvManager; |
import com.fr.design.actions.server.ConnectionListAction; |
||||||
import com.fr.design.dialog.BasicDialog; |
import com.fr.design.dialog.BasicDialog; |
||||||
import com.fr.design.dialog.DialogActionAdapter; |
import com.fr.design.dialog.DialogActionAdapter; |
||||||
import com.fr.file.DatasourceManager; |
import com.fr.file.DatasourceManager; |
||||||
import com.fr.file.DatasourceManagerProvider; |
import com.fr.file.DatasourceManagerProvider; |
||||||
import com.fr.general.ComparatorUtils; |
import com.fr.general.ComparatorUtils; |
||||||
import com.fr.stable.StringUtils; |
import com.fr.stable.StringUtils; |
||||||
|
|
||||||
import javax.swing.*; |
import javax.swing.*; |
||||||
import java.awt.event.ItemEvent; |
import java.awt.event.ItemEvent; |
||||||
import java.awt.event.ItemListener; |
import java.awt.event.ItemListener; |
||||||
import java.util.ArrayList; |
import java.util.ArrayList; |
||||||
import java.util.List; |
import java.util.Iterator; |
||||||
|
import java.util.List; |
||||||
/** |
|
||||||
* 选择数据连接的下拉框 |
/** |
||||||
* |
* 选择数据连接的下拉框 |
||||||
* @editor zhou |
* |
||||||
* @since 2012-3-28下午3:02:30 |
* @editor zhou |
||||||
*/ |
* @since 2012-3-28下午3:02:30 |
||||||
public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { |
*/ |
||||||
/** |
public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { |
||||||
* |
/** |
||||||
*/ |
* |
||||||
private static final long serialVersionUID = 1L; |
*/ |
||||||
private Class<? extends Connection> cls; // 所取的Connection都是cls及其子类
|
private static final long serialVersionUID = 1L; |
||||||
private java.util.List<String> nameList = new ArrayList<String>(); |
private Class<? extends Connection> cls; // 所取的Connection都是cls及其子类
|
||||||
|
private List<String> nameList = new ArrayList<String>(); |
||||||
public ConnectionComboBoxPanel(Class<? extends Connection> cls) { |
|
||||||
super(); |
public ConnectionComboBoxPanel(Class<? extends Connection> cls) { |
||||||
|
super(); |
||||||
this.cls = cls; |
|
||||||
|
this.cls = cls; |
||||||
// alex:添加item change监听,当改变时改变DesignerEnvManager中的最近选中的数据连接
|
|
||||||
this.itemComboBox.addItemListener(new ItemListener() { |
// alex:添加item change监听,当改变时改变DesignerEnvManager中的最近选中的数据连接
|
||||||
public void itemStateChanged(ItemEvent e) { |
this.itemComboBox.addItemListener(new ItemListener() { |
||||||
String selected = ConnectionComboBoxPanel.this.getSelectedItem(); |
public void itemStateChanged(ItemEvent e) { |
||||||
if (StringUtils.isNotBlank(selected)) { |
String selected = ConnectionComboBoxPanel.this.getSelectedItem(); |
||||||
DesignerEnvManager.getEnvManager().setRecentSelectedConnection(selected); |
if (StringUtils.isNotBlank(selected)) { |
||||||
} |
DesignerEnvManager.getEnvManager().setRecentSelectedConnection(selected); |
||||||
} |
} |
||||||
}); |
} |
||||||
refreshItems(); |
}); |
||||||
} |
refreshItems(); |
||||||
|
} |
||||||
/* |
|
||||||
* 刷新ComboBox.items |
/* |
||||||
*/ |
* 刷新ComboBox.items |
||||||
protected java.util.Iterator<String> items() { |
*/ |
||||||
nameList = new ArrayList<String>(); |
protected Iterator<String> items() { |
||||||
|
nameList = new ArrayList<String>(); |
||||||
DatasourceManagerProvider mgr = DatasourceManager.getProviderInstance(); |
|
||||||
java.util.Iterator<String> nameIt = mgr.getConnectionNameIterator(); |
DatasourceManagerProvider mgr = DatasourceManager.getProviderInstance(); |
||||||
while (nameIt.hasNext()) { |
Iterator<String> nameIt = mgr.getConnectionNameIterator(); |
||||||
String conName = nameIt.next(); |
while (nameIt.hasNext()) { |
||||||
Connection connection = mgr.getConnection(conName); |
String conName = nameIt.next(); |
||||||
filterConnection(connection, conName, nameList); |
Connection connection = mgr.getConnection(conName); |
||||||
} |
filterConnection(connection, conName, nameList); |
||||||
|
} |
||||||
return nameList.iterator(); |
|
||||||
} |
return nameList.iterator(); |
||||||
|
} |
||||||
protected void filterConnection(Connection connection, String conName, List<String> nameList) { |
|
||||||
connection.addConnection(nameList, conName, new Class[]{AbstractDatabaseConnection.class}); |
protected void filterConnection(Connection connection, String conName, List<String> nameList) { |
||||||
} |
connection.addConnection(nameList, conName, new Class[]{AbstractDatabaseConnection.class}); |
||||||
|
} |
||||||
|
|
||||||
public int getConnectionSize() { |
public int getConnectionSize() { |
||||||
return nameList.size(); |
return nameList.size(); |
||||||
} |
} |
||||||
|
|
||||||
public String getConnection(int i) { |
public String getConnection(int i) { |
||||||
return nameList.get(i); |
return nameList.get(i); |
||||||
} |
} |
||||||
|
|
||||||
/* |
/* |
||||||
* 弹出对话框编辑Items |
* 弹出对话框编辑Items |
||||||
*/ |
*/ |
||||||
protected void editItems() { |
protected void editItems() { |
||||||
final ConnectionListPane connectionListPane = new ConnectionListPane(); |
final ConnectionListPane connectionListPane = new ConnectionListPane(); |
||||||
final DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance(); |
final DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance(); |
||||||
connectionListPane.populate(datasourceManager); |
final DatasourceManager backupManager = datasourceManager.getBackUpManager(); |
||||||
BasicDialog connectionListDialog = connectionListPane.showLargeWindow( |
connectionListPane.populate(datasourceManager); |
||||||
SwingUtilities.getWindowAncestor(ConnectionComboBoxPanel.this), new DialogActionAdapter() { |
final BasicDialog connectionListDialog = connectionListPane.showLargeWindow( |
||||||
public void doOk() { |
SwingUtilities.getWindowAncestor(ConnectionComboBoxPanel.this), null); |
||||||
connectionListPane.update(datasourceManager); |
connectionListDialog.addDialogActionListener(new DialogActionAdapter() { |
||||||
// marks:保存数据
|
public void doOk() { |
||||||
Env currentEnv = FRContext.getCurrentEnv(); |
if (!connectionListPane.isNamePermitted()) { |
||||||
try { |
connectionListDialog.setDoOKSucceed(false); |
||||||
currentEnv.writeResource(datasourceManager); |
return; |
||||||
} catch (Exception ex) { |
} |
||||||
FRContext.getLogger().error(ex.getMessage(), ex); |
if (!ConnectionListAction.doWithDatasourceManager(datasourceManager, backupManager, connectionListPane, |
||||||
} |
connectionListDialog)) { |
||||||
} |
//如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面
|
||||||
}); |
return; |
||||||
connectionListDialog.setVisible(true); |
} |
||||||
refreshItems(); |
// marks:保存数据
|
||||||
} |
ConnectionListAction.writeFile(datasourceManager); |
||||||
|
} |
||||||
public void populate(com.fr.data.impl.Connection connection) { |
|
||||||
editButton.setEnabled(FRContext.getCurrentEnv().isRoot()); |
public void doCancel() { |
||||||
if (connection instanceof NameDatabaseConnection) { |
datasourceManager.synchronizedWithServer(); |
||||||
this.setSelectedItem(((NameDatabaseConnection) connection).getName()); |
} |
||||||
} else { |
}); |
||||||
String s = DesignerEnvManager.getEnvManager().getRecentSelectedConnection(); |
connectionListDialog.setVisible(true); |
||||||
if (StringUtils.isNotBlank(s)) { |
refreshItems(); |
||||||
for (int i = 0; i < this.getConnectionSize(); i++) { |
} |
||||||
String t = this.getConnection(i); |
|
||||||
if (ComparatorUtils.equals(s, t)) { |
/** |
||||||
this.setSelectedItem(s); |
* @param connection 数据库链接 |
||||||
break; |
*/ |
||||||
} |
public void populate(Connection connection) { |
||||||
} |
editButton.setEnabled(FRContext.getCurrentEnv().isRoot()); |
||||||
} |
if (connection instanceof NameDatabaseConnection) { |
||||||
// alex:如果这个ComboBox还是没有选中,那么选中第一个
|
this.setSelectedItem(((NameDatabaseConnection) connection).getName()); |
||||||
if (StringUtils.isBlank(this.getSelectedItem()) && this.getConnectionSize() > 0) { |
} else { |
||||||
this.setSelectedItem(this.getConnection(0)); |
String s = DesignerEnvManager.getEnvManager().getRecentSelectedConnection(); |
||||||
} |
if (StringUtils.isNotBlank(s)) { |
||||||
} |
for (int i = 0; i < this.getConnectionSize(); i++) { |
||||||
} |
String t = this.getConnection(i); |
||||||
|
if (ComparatorUtils.equals(s, t)) { |
||||||
|
this.setSelectedItem(s); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
// alex:如果这个ComboBox还是没有选中,那么选中第一个
|
||||||
|
if (StringUtils.isBlank(this.getSelectedItem()) && this.getConnectionSize() > 0) { |
||||||
|
this.setSelectedItem(this.getConnection(0)); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
} |
} |
@ -1,163 +1,163 @@ |
|||||||
package com.fr.design.data.datapane.connect; |
package com.fr.design.data.datapane.connect; |
||||||
|
|
||||||
import com.fr.data.impl.Connection; |
import com.fr.data.impl.Connection; |
||||||
import com.fr.data.impl.JDBCDatabaseConnection; |
import com.fr.data.impl.JDBCDatabaseConnection; |
||||||
import com.fr.data.impl.JNDIDatabaseConnection; |
import com.fr.data.impl.JNDIDatabaseConnection; |
||||||
import com.fr.design.ExtraDesignClassManager; |
import com.fr.design.ExtraDesignClassManager; |
||||||
import com.fr.design.fun.ConnectionProvider; |
import com.fr.design.fun.ConnectionProvider; |
||||||
import com.fr.design.gui.controlpane.JListControlPane; |
import com.fr.design.gui.controlpane.JListControlPane; |
||||||
import com.fr.design.gui.controlpane.NameObjectCreator; |
import com.fr.design.gui.controlpane.NameObjectCreator; |
||||||
import com.fr.design.gui.controlpane.NameableCreator; |
import com.fr.design.gui.controlpane.NameableCreator; |
||||||
import com.fr.file.DatasourceManagerProvider; |
import com.fr.file.DatasourceManagerProvider; |
||||||
import com.fr.general.ComparatorUtils; |
import com.fr.general.ComparatorUtils; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
import com.fr.general.NameObject; |
import com.fr.general.NameObject; |
||||||
import com.fr.stable.ArrayUtils; |
import com.fr.stable.ArrayUtils; |
||||||
import com.fr.stable.Nameable; |
import com.fr.stable.Nameable; |
||||||
import com.fr.stable.StringUtils; |
import com.fr.stable.StringUtils; |
||||||
import com.fr.stable.core.PropertyChangeAdapter; |
import com.fr.stable.core.PropertyChangeAdapter; |
||||||
|
|
||||||
import javax.swing.*; |
import javax.swing.*; |
||||||
import java.util.*; |
import java.util.*; |
||||||
|
|
||||||
/** |
/** |
||||||
* Connection List Pane. |
* Connection List Pane. |
||||||
*/ |
*/ |
||||||
public class ConnectionListPane extends JListControlPane { |
public class ConnectionListPane extends JListControlPane implements ConnectionShowPane { |
||||||
public static final String TITLE_NAME = Inter.getLocText("Server-Define_Data_Connection"); |
public static final String TITLE_NAME = Inter.getLocText("Server-Define_Data_Connection"); |
||||||
private boolean isNamePermitted = true; |
private boolean isNamePermitted = true; |
||||||
private HashMap<String, String> renameMap = new HashMap<String, String>(); |
private HashMap<String, String> renameMap = new HashMap<String, String>(); |
||||||
|
|
||||||
public ConnectionListPane() { |
public ConnectionListPane() { |
||||||
renameMap.clear(); |
renameMap.clear(); |
||||||
this.addEditingListner(new PropertyChangeAdapter() { |
this.addEditingListner(new PropertyChangeAdapter() { |
||||||
public void propertyChange() { |
public void propertyChange() { |
||||||
isNamePermitted = true; |
isNamePermitted = true; |
||||||
String[] allListNames = nameableList.getAllNames(); |
String[] allListNames = nameableList.getAllNames(); |
||||||
allListNames[nameableList.getSelectedIndex()] = StringUtils.EMPTY; |
allListNames[nameableList.getSelectedIndex()] = StringUtils.EMPTY; |
||||||
String tempName = getEditingName(); |
String tempName = getEditingName(); |
||||||
if (StringUtils.isEmpty(tempName)) { |
if (StringUtils.isEmpty(tempName)) { |
||||||
String[] warning = new String[]{"NOT_NULL_Des", "Please_Rename"}; |
String[] warning = new String[]{"NOT_NULL_Des", "Please_Rename"}; |
||||||
String[] sign = new String[]{",", "!"}; |
String[] sign = new String[]{",", "!"}; |
||||||
nameableList.stopEditing(); |
nameableList.stopEditing(); |
||||||
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), Inter.getLocText(warning, sign)); |
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), Inter.getLocText(warning, sign)); |
||||||
setWarnigText(editingIndex); |
setWarnigText(editingIndex); |
||||||
isNamePermitted = false; |
isNamePermitted = false; |
||||||
return; |
return; |
||||||
} |
} |
||||||
if (!ComparatorUtils.equals(tempName, selectedName) |
if (!ComparatorUtils.equals(tempName, selectedName) |
||||||
&& isNameRepeted(new List[]{Arrays.asList(allListNames)}, tempName)) { |
&& isNameRepeted(new List[]{Arrays.asList(allListNames)}, tempName)) { |
||||||
isNamePermitted = false; |
isNamePermitted = false; |
||||||
nameableList.stopEditing(); |
nameableList.stopEditing(); |
||||||
String message = Inter.getLocText(new String[]{"Utils-has_been_existed", "DashBoard-ConnectionList", "Please_Rename"}, new String[]{"", tempName + ",", "!"}); |
String message = Inter.getLocText(new String[]{"Utils-has_been_existed", "DashBoard-ConnectionList", "Please_Rename"}, new String[]{"", tempName + ",", "!"}); |
||||||
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), message); |
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), message); |
||||||
setWarnigText(editingIndex); |
setWarnigText(editingIndex); |
||||||
} |
} |
||||||
if (isNamePermitted && !ComparatorUtils.equals(tempName, selectedName)) { |
if (isNamePermitted && !ComparatorUtils.equals(tempName, selectedName)) { |
||||||
rename(selectedName, tempName); |
rename(selectedName, tempName); |
||||||
} |
} |
||||||
|
|
||||||
} |
} |
||||||
}); |
}); |
||||||
} |
} |
||||||
|
|
||||||
|
|
||||||
protected void rename(String oldName, String newName) { |
protected void rename(String oldName, String newName) { |
||||||
if (renameMap.containsKey(selectedName)) { |
if (renameMap.containsKey(selectedName)) { |
||||||
renameMap.remove(selectedName); |
renameMap.remove(selectedName); |
||||||
} |
} |
||||||
renameMap.put(selectedName, newName); |
renameMap.put(selectedName, newName); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 名字是否允许 |
* 名字是否允许 |
||||||
* |
* |
||||||
* @return 是/否 |
* @return 是/否 |
||||||
*/ |
*/ |
||||||
public boolean isNamePermitted() { |
public boolean isNamePermitted() { |
||||||
return isNamePermitted; |
return isNamePermitted; |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 检查按钮可用状态 Check button enabled. |
* 检查按钮可用状态 Check button enabled. |
||||||
*/ |
*/ |
||||||
public void checkButtonEnabled() { |
public void checkButtonEnabled() { |
||||||
super.checkButtonEnabled(); |
super.checkButtonEnabled(); |
||||||
isNamePermitted = !isContainsRename(); |
isNamePermitted = !isContainsRename(); |
||||||
} |
} |
||||||
|
|
||||||
|
|
||||||
public HashMap<String, String> getRenameMap() { |
public HashMap<String, String> getRenameMap() { |
||||||
return renameMap; |
return renameMap; |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 创建菜单项 |
* 创建菜单项 |
||||||
* |
* |
||||||
* @return 菜单项 |
* @return 菜单项 |
||||||
*/ |
*/ |
||||||
public NameableCreator[] createNameableCreators() { |
public NameableCreator[] createNameableCreators() { |
||||||
NameableCreator[] creators = new NameableCreator[]{new NameObjectCreator( |
NameableCreator[] creators = new NameableCreator[]{new NameObjectCreator( |
||||||
"JDBC", |
"JDBC", |
||||||
"/com/fr/design/images/data/source/jdbcTableData.png", |
"/com/fr/design/images/data/source/jdbcTableData.png", |
||||||
JDBCDatabaseConnection.class, |
JDBCDatabaseConnection.class, |
||||||
DatabaseConnectionPane.JDBC.class |
DatabaseConnectionPane.JDBC.class |
||||||
), new NameObjectCreator( |
), new NameObjectCreator( |
||||||
"JNDI", |
"JNDI", |
||||||
"/com/fr/design/images/data/source/jdbcTableData.png", |
"/com/fr/design/images/data/source/jdbcTableData.png", |
||||||
JNDIDatabaseConnection.class, |
JNDIDatabaseConnection.class, |
||||||
DatabaseConnectionPane.JNDI.class |
DatabaseConnectionPane.JNDI.class |
||||||
)}; |
)}; |
||||||
Set<ConnectionProvider> pluginCreators = ExtraDesignClassManager.getInstance().getArray(ConnectionProvider.XML_TAG); |
Set<ConnectionProvider> pluginCreators = ExtraDesignClassManager.getInstance().getArray(ConnectionProvider.XML_TAG); |
||||||
for (ConnectionProvider provider : pluginCreators) { |
for (ConnectionProvider provider : pluginCreators) { |
||||||
NameObjectCreator creator = new NameObjectCreator( |
NameObjectCreator creator = new NameObjectCreator( |
||||||
provider.nameForConnection(), |
provider.nameForConnection(), |
||||||
provider.iconPathForConnection(), |
provider.iconPathForConnection(), |
||||||
provider.classForConnection(), |
provider.classForConnection(), |
||||||
provider.appearanceForConnection() |
provider.appearanceForConnection() |
||||||
); |
); |
||||||
creators = ArrayUtils.add(creators, creator); |
creators = ArrayUtils.add(creators, creator); |
||||||
} |
} |
||||||
|
|
||||||
return creators; |
return creators; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected String title4PopupWindow() { |
protected String title4PopupWindow() { |
||||||
return TITLE_NAME; |
return TITLE_NAME; |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* Populate. |
* Populate. |
||||||
* |
* |
||||||
* @param datasourceManager the new datasourceManager. |
* @param datasourceManager the new datasourceManager. |
||||||
*/ |
*/ |
||||||
public void populate(DatasourceManagerProvider datasourceManager) { |
public void populate(DatasourceManagerProvider datasourceManager) { |
||||||
Iterator<String> nameIt = datasourceManager.getConnectionNameIterator(); |
Iterator<String> nameIt = datasourceManager.getConnectionNameIterator(); |
||||||
|
|
||||||
List<NameObject> nameObjectList = new ArrayList<NameObject>(); |
List<NameObject> nameObjectList = new ArrayList<NameObject>(); |
||||||
while (nameIt.hasNext()) { |
while (nameIt.hasNext()) { |
||||||
String name = nameIt.next(); |
String name = nameIt.next(); |
||||||
nameObjectList.add(new NameObject(name, datasourceManager.getConnection(name))); |
nameObjectList.add(new NameObject(name, datasourceManager.getConnection(name))); |
||||||
} |
} |
||||||
this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); |
this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* Update. |
* Update. |
||||||
*/ |
*/ |
||||||
public void update(DatasourceManagerProvider datasourceManager) { |
public void update(DatasourceManagerProvider datasourceManager) { |
||||||
// Nameable[]居然不能强转成NameObject[],一定要这么写...
|
// Nameable[]居然不能强转成NameObject[],一定要这么写...
|
||||||
Nameable[] res = this.update(); |
Nameable[] res = this.update(); |
||||||
NameObject[] res_array = new NameObject[res.length]; |
NameObject[] res_array = new NameObject[res.length]; |
||||||
java.util.Arrays.asList(res).toArray(res_array); |
java.util.Arrays.asList(res).toArray(res_array); |
||||||
|
|
||||||
datasourceManager.clearAllConnection(); |
datasourceManager.clearAllConnection(); |
||||||
|
|
||||||
for (int i = 0; i < res_array.length; i++) { |
for (int i = 0; i < res_array.length; i++) { |
||||||
NameObject nameObject = res_array[i]; |
NameObject nameObject = res_array[i]; |
||||||
datasourceManager.putConnection(nameObject.getName(), (Connection) nameObject.getObject()); |
datasourceManager.putConnection(nameObject.getName(), (Connection) nameObject.getObject()); |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
@ -1,78 +1,79 @@ |
|||||||
package com.fr.design.data.datapane.connect; |
package com.fr.design.data.datapane.connect; |
||||||
|
|
||||||
import com.fr.base.FRContext; |
import com.fr.base.FRContext; |
||||||
import com.fr.design.gui.frpane.LoadingBasicPane; |
import com.fr.design.gui.frpane.LoadingBasicPane; |
||||||
import com.fr.design.gui.ilable.UILabel; |
import com.fr.design.gui.ilable.UILabel; |
||||||
import com.fr.design.gui.itextfield.UITextField; |
import com.fr.design.gui.itextfield.UITextField; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
import com.fr.file.DatasourceManagerProvider; |
import com.fr.file.DatasourceManagerProvider; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
import com.fr.stable.project.ProjectConstants; |
import com.fr.stable.project.ProjectConstants; |
||||||
|
|
||||||
import javax.swing.*; |
import javax.swing.*; |
||||||
import java.awt.*; |
import java.awt.*; |
||||||
import java.io.File; |
import java.io.File; |
||||||
import java.util.HashMap; |
import java.util.HashMap; |
||||||
|
|
||||||
public class ConnectionManagerPane extends LoadingBasicPane { |
public class ConnectionManagerPane extends LoadingBasicPane implements ConnectionShowPane { |
||||||
private UITextField connectionTextField; |
private UITextField connectionTextField; |
||||||
private ConnectionListPane connectionListPane; |
private ConnectionListPane connectionListPane; |
||||||
|
|
||||||
protected void initComponents(JPanel container) { |
protected void initComponents(JPanel container) { |
||||||
container.setLayout(FRGUIPaneFactory.createBorderLayout()); |
container.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
|
||||||
JPanel connectionPathPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
JPanel connectionPathPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||||
container.add(connectionPathPane, BorderLayout.NORTH); |
container.add(connectionPathPane, BorderLayout.NORTH); |
||||||
|
|
||||||
connectionPathPane.setBorder(BorderFactory.createEmptyBorder(6, 2, 2, 2)); |
connectionPathPane.setBorder(BorderFactory.createEmptyBorder(6, 2, 2, 2)); |
||||||
|
|
||||||
connectionPathPane.add(new UILabel(Inter.getLocText("FR-Designer_Save_Path") + ":"), BorderLayout.WEST); |
connectionPathPane.add(new UILabel(Inter.getLocText("FR-Designer_Save_Path") + ":"), BorderLayout.WEST); |
||||||
this.connectionTextField = new UITextField(); |
this.connectionTextField = new UITextField(); |
||||||
connectionPathPane.add(connectionTextField, BorderLayout.CENTER); |
connectionPathPane.add(connectionTextField, BorderLayout.CENTER); |
||||||
this.connectionTextField.setEditable(false); |
this.connectionTextField.setEditable(false); |
||||||
connectionListPane = new ConnectionListPane(){ |
connectionListPane = new ConnectionListPane() { |
||||||
protected void rename(String oldName,String newName) { |
protected void rename(String oldName, String newName) { |
||||||
super.rename(oldName,newName); |
super.rename(oldName, newName); |
||||||
renameConnection(oldName,newName); |
renameConnection(oldName, newName); |
||||||
} |
} |
||||||
}; |
}; |
||||||
container.add(connectionListPane, BorderLayout.CENTER); |
container.add(connectionListPane, BorderLayout.CENTER); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected String title4PopupWindow() { |
protected String title4PopupWindow() { |
||||||
return Inter.getLocText("Server-Define_Data_Connection"); |
return Inter.getLocText("Server-Define_Data_Connection"); |
||||||
} |
} |
||||||
|
|
||||||
public HashMap<String, String> getRenameMap() { |
public HashMap<String, String> getRenameMap() { |
||||||
return connectionListPane.getRenameMap(); |
return connectionListPane.getRenameMap(); |
||||||
} |
} |
||||||
|
|
||||||
public void populate(DatasourceManagerProvider datasourceManager) { |
public void populate(DatasourceManagerProvider datasourceManager) { |
||||||
this.connectionTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + ProjectConstants.RESOURCES_NAME |
this.connectionTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + ProjectConstants.RESOURCES_NAME |
||||||
+ File.separator + datasourceManager.fileName()); |
+ File.separator + datasourceManager.fileName()); |
||||||
this.connectionListPane.populate(datasourceManager); |
this.connectionListPane.populate(datasourceManager); |
||||||
} |
} |
||||||
|
|
||||||
public void update(DatasourceManagerProvider datasourceManager) { |
public void update(DatasourceManagerProvider datasourceManager) { |
||||||
this.connectionListPane.update(datasourceManager); |
this.connectionListPane.update(datasourceManager); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 设置选中项 |
* 设置选中项 |
||||||
* |
* |
||||||
* @param index 选中项的序列号 |
* @param index 选中项的序列号 |
||||||
*/ |
*/ |
||||||
public void setSelectedIndex(int index) { |
public void setSelectedIndex(int index) { |
||||||
this.connectionListPane.setSelectedIndex(index); |
this.connectionListPane.setSelectedIndex(index); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 名字是否允许 |
* 名字是否允许 |
||||||
* @return 允许返回true |
* |
||||||
*/ |
* @return 允许返回true |
||||||
public boolean isNamePermitted() { |
*/ |
||||||
return connectionListPane.isNamePermitted(); |
public boolean isNamePermitted() { |
||||||
} |
return connectionListPane.isNamePermitted(); |
||||||
|
} |
||||||
|
|
||||||
} |
} |
@ -0,0 +1,15 @@ |
|||||||
|
package com.fr.design.data.datapane.connect; |
||||||
|
|
||||||
|
import com.fr.file.DatasourceManagerProvider; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by yaoh.wu on 2017/4/22. |
||||||
|
* 数据链接显示面板 |
||||||
|
*/ |
||||||
|
public interface ConnectionShowPane { |
||||||
|
void update(DatasourceManagerProvider datasourceManager); |
||||||
|
|
||||||
|
void populate(DatasourceManagerProvider datasourceManager); |
||||||
|
|
||||||
|
void setSelectedIndex(int index); |
||||||
|
} |
@ -1,32 +1,29 @@ |
|||||||
package com.fr.design.mainframe.bbs; |
package com.fr.design.extra; |
||||||
|
|
||||||
import com.fr.design.dialog.BasicPane; |
|
||||||
import com.fr.design.dialog.UIDialog; |
import com.fr.design.dialog.UIDialog; |
||||||
import com.fr.design.utils.gui.GUICoreUtils; |
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
import com.fr.general.Inter; |
import com.fr.stable.StableUtils; |
||||||
import com.fr.general.SiteCenter; |
|
||||||
import com.fr.general.http.HttpClient; |
|
||||||
import com.fr.stable.StringUtils; |
|
||||||
|
|
||||||
import javax.swing.*; |
import javax.swing.*; |
||||||
import java.awt.*; |
import java.awt.*; |
||||||
|
|
||||||
/** |
/** |
||||||
* Created by zhaohehe on 16/7/26. |
* Created by vito on 2017/5/5. |
||||||
*/ |
*/ |
||||||
public class LoginDialog extends UIDialog { |
public class LoginDialog extends UIDialog { |
||||||
private static final Dimension DEFAULT_SHOP = new Dimension(401, 201); |
private static final Dimension DEFAULT_SHOP = new Dimension(401, 201); |
||||||
|
|
||||||
public LoginDialog(Frame frame, BasicPane pane) { |
public LoginDialog(Frame frame, Component pane) { |
||||||
super(frame); |
super(frame); |
||||||
setUndecorated(true); |
if (StableUtils.getMajorJavaVersion() == 8) { |
||||||
|
setUndecorated(true); |
||||||
|
} |
||||||
JPanel panel = (JPanel) getContentPane(); |
JPanel panel = (JPanel) getContentPane(); |
||||||
panel.setLayout(new BorderLayout()); |
panel.setLayout(new BorderLayout()); |
||||||
add(pane, BorderLayout.CENTER); |
add(pane, BorderLayout.CENTER); |
||||||
setSize(DEFAULT_SHOP); |
setSize(DEFAULT_SHOP); |
||||||
GUICoreUtils.centerWindow(this); |
GUICoreUtils.centerWindow(this); |
||||||
setResizable(false); |
setResizable(false); |
||||||
setTitle(Inter.getLocText("FR-Designer-Plugin_Manager")); |
|
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
@ -1,152 +0,0 @@ |
|||||||
package com.fr.design.extra; |
|
||||||
|
|
||||||
import com.fr.base.FRContext; |
|
||||||
import com.fr.design.DesignerEnvManager; |
|
||||||
import com.fr.design.RestartHelper; |
|
||||||
import com.fr.design.dialog.BasicPane; |
|
||||||
import com.fr.design.gui.frpane.UITabbedPane; |
|
||||||
import com.fr.general.ComparatorUtils; |
|
||||||
import com.fr.general.IOUtils; |
|
||||||
import com.fr.general.Inter; |
|
||||||
import com.fr.general.SiteCenter; |
|
||||||
import com.fr.general.http.HttpClient; |
|
||||||
import com.fr.plugin.PluginVerifyException; |
|
||||||
import com.fr.stable.StableUtils; |
|
||||||
|
|
||||||
import javax.swing.*; |
|
||||||
import java.awt.*; |
|
||||||
import java.io.File; |
|
||||||
import java.net.HttpURLConnection; |
|
||||||
import java.net.URL; |
|
||||||
import java.util.concurrent.ExecutionException; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by zhaohehe on 16/7/27. |
|
||||||
*/ |
|
||||||
public class LoginPane extends BasicPane { |
|
||||||
private static final String LATEST = "latest"; |
|
||||||
|
|
||||||
public LoginPane() { |
|
||||||
setLayout(new BorderLayout()); |
|
||||||
if (StableUtils.getMajorJavaVersion() == 8) { |
|
||||||
String installHome; |
|
||||||
if (StableUtils.isDebug()) { |
|
||||||
URL url = ClassLoader.getSystemResource(""); |
|
||||||
installHome = url.getPath(); |
|
||||||
addPane(installHome); |
|
||||||
} else { |
|
||||||
installHome = StableUtils.getInstallHome(); |
|
||||||
File file = new File(StableUtils.pathJoin(installHome, "scripts")); |
|
||||||
if (!file.exists()) { |
|
||||||
int rv = JOptionPane.showConfirmDialog( |
|
||||||
this, |
|
||||||
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Install"), |
|
||||||
Inter.getLocText("FR-Designer-Plugin_Warning"), |
|
||||||
JOptionPane.OK_CANCEL_OPTION, |
|
||||||
JOptionPane.INFORMATION_MESSAGE |
|
||||||
); |
|
||||||
if (rv == JOptionPane.OK_OPTION) { |
|
||||||
downloadShopScripts(); |
|
||||||
} |
|
||||||
} else { |
|
||||||
addPane(installHome); |
|
||||||
updateShopScripts(); |
|
||||||
} |
|
||||||
} |
|
||||||
} else { |
|
||||||
initTraditionalStore(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private void addPane(String installHome) { |
|
||||||
LoginWebPane webPane = new LoginWebPane(new File(installHome).getAbsolutePath(),LoginPane.this); |
|
||||||
add(webPane, BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return Inter.getLocText("FR-Designer-Plugin_Manager"); |
|
||||||
} |
|
||||||
|
|
||||||
private void downloadShopScripts() { |
|
||||||
new SwingWorker<Boolean, Void>() { |
|
||||||
@Override |
|
||||||
protected Boolean doInBackground() throws Exception { |
|
||||||
String id = "shop_scripts"; |
|
||||||
String username = DesignerEnvManager.getEnvManager().getBBSName(); |
|
||||||
String password = DesignerEnvManager.getEnvManager().getBBSPassword(); |
|
||||||
try { |
|
||||||
PluginHelper.downloadPluginFile(id, username, password, new Process<Double>() { |
|
||||||
@Override |
|
||||||
public void process(Double integer) { |
|
||||||
} |
|
||||||
}); |
|
||||||
} catch (PluginVerifyException e) { |
|
||||||
JOptionPane.showMessageDialog(LoginPane.this, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); |
|
||||||
return false; |
|
||||||
} catch (Exception e) { |
|
||||||
FRContext.getLogger().error(e.getMessage(), e); |
|
||||||
return false; |
|
||||||
} |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected void done() { |
|
||||||
try { |
|
||||||
if (get()) { |
|
||||||
IOUtils.unzip(new File(StableUtils.pathJoin(PluginHelper.DOWNLOAD_PATH, PluginHelper.TEMP_FILE)), StableUtils.getInstallHome()); |
|
||||||
int rv = JOptionPane.showOptionDialog( |
|
||||||
LoginPane.this, |
|
||||||
Inter.getLocText("FR-Designer-Plugin_Shop_Installed"), |
|
||||||
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(); |
|
||||||
} |
|
||||||
} |
|
||||||
} catch (InterruptedException | ExecutionException e) { |
|
||||||
FRContext.getLogger().error(e.getMessage(), e); |
|
||||||
} |
|
||||||
} |
|
||||||
}.execute(); |
|
||||||
} |
|
||||||
|
|
||||||
private void updateShopScripts() { |
|
||||||
new SwingWorker<Void, Void>() { |
|
||||||
@Override |
|
||||||
protected Void doInBackground() throws Exception { |
|
||||||
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("store.version") + "&version=" + PluginStoreConstants.VERSION); |
|
||||||
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { |
|
||||||
if (!ComparatorUtils.equals(httpClient.getResponseText(), LATEST)) { |
|
||||||
int rv = JOptionPane.showConfirmDialog( |
|
||||||
LoginPane.this, |
|
||||||
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Update"), |
|
||||||
Inter.getLocText("FR-Designer-Plugin_Warning"), |
|
||||||
JOptionPane.OK_CANCEL_OPTION, |
|
||||||
JOptionPane.INFORMATION_MESSAGE |
|
||||||
); |
|
||||||
if (rv == JOptionPane.OK_OPTION) { |
|
||||||
downloadShopScripts(); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
return null; |
|
||||||
} |
|
||||||
}.execute(); |
|
||||||
} |
|
||||||
|
|
||||||
private void initTraditionalStore() { |
|
||||||
UITabbedPane tabbedPane = new UITabbedPane(); |
|
||||||
add(tabbedPane, BorderLayout.CENTER); |
|
||||||
PluginInstalledPane installedPane = new PluginInstalledPane(); |
|
||||||
tabbedPane.addTab(installedPane.tabTitle(), installedPane); |
|
||||||
tabbedPane.addTab(Inter.getLocText("FR-Designer-Plugin_Update"), new PluginUpdatePane(tabbedPane)); |
|
||||||
tabbedPane.addTab(Inter.getLocText("FR-Designer-Plugin_All_Plugins"), new PluginFromStorePane(tabbedPane)); |
|
||||||
} |
|
||||||
} |
|
@ -1,145 +0,0 @@ |
|||||||
package com.fr.design.extra; |
|
||||||
|
|
||||||
import com.fr.base.FRContext; |
|
||||||
import com.fr.design.DesignerEnvManager; |
|
||||||
import com.fr.design.RestartHelper; |
|
||||||
import com.fr.design.dialog.BasicPane; |
|
||||||
import com.fr.general.ComparatorUtils; |
|
||||||
import com.fr.general.IOUtils; |
|
||||||
import com.fr.general.Inter; |
|
||||||
import com.fr.general.SiteCenter; |
|
||||||
import com.fr.general.http.HttpClient; |
|
||||||
import com.fr.plugin.PluginVerifyException; |
|
||||||
import com.fr.stable.StableUtils; |
|
||||||
|
|
||||||
import javax.swing.*; |
|
||||||
import java.awt.*; |
|
||||||
import java.io.File; |
|
||||||
import java.net.HttpURLConnection; |
|
||||||
import java.net.URL; |
|
||||||
import java.util.concurrent.ExecutionException; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by zhaohehe on 16/7/28. |
|
||||||
*/ |
|
||||||
public class QQLoginPane extends BasicPane { |
|
||||||
private static final String LATEST = "latest"; |
|
||||||
|
|
||||||
public QQLoginPane() { |
|
||||||
setLayout(new BorderLayout()); |
|
||||||
if (StableUtils.getMajorJavaVersion() == 8) { |
|
||||||
String installHome; |
|
||||||
if (StableUtils.isDebug()) { |
|
||||||
URL url = ClassLoader.getSystemResource(""); |
|
||||||
installHome = url.getPath(); |
|
||||||
addPane(installHome); |
|
||||||
} else { |
|
||||||
installHome = StableUtils.getInstallHome(); |
|
||||||
File file = new File(StableUtils.pathJoin(installHome, "scripts")); |
|
||||||
if (!file.exists()) { |
|
||||||
int rv = JOptionPane.showConfirmDialog( |
|
||||||
this, |
|
||||||
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Install"), |
|
||||||
Inter.getLocText("FR-Designer-Plugin_Warning"), |
|
||||||
JOptionPane.OK_CANCEL_OPTION, |
|
||||||
JOptionPane.INFORMATION_MESSAGE |
|
||||||
); |
|
||||||
if (rv == JOptionPane.OK_OPTION) { |
|
||||||
downloadShopScripts(); |
|
||||||
} |
|
||||||
} else { |
|
||||||
addPane(installHome); |
|
||||||
updateShopScripts(); |
|
||||||
} |
|
||||||
} |
|
||||||
} else { |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private void addPane(String installHome) { |
|
||||||
QQLoginWebPane webPane = new QQLoginWebPane(new File(installHome).getAbsolutePath()); |
|
||||||
add(webPane, BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return Inter.getLocText("FR-Designer-Plugin_Manager"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private void downloadShopScripts() { |
|
||||||
new SwingWorker<Boolean, Void>() { |
|
||||||
@Override |
|
||||||
protected Boolean doInBackground() throws Exception { |
|
||||||
String id = "shop_scripts"; |
|
||||||
String username = DesignerEnvManager.getEnvManager().getBBSName(); |
|
||||||
String password = DesignerEnvManager.getEnvManager().getBBSPassword(); |
|
||||||
try { |
|
||||||
PluginHelper.downloadPluginFile(id, username, password, new Process<Double>() { |
|
||||||
@Override |
|
||||||
public void process(Double integer) { |
|
||||||
} |
|
||||||
}); |
|
||||||
} catch (PluginVerifyException e) { |
|
||||||
JOptionPane.showMessageDialog(QQLoginPane.this, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); |
|
||||||
return false; |
|
||||||
} catch (Exception e) { |
|
||||||
FRContext.getLogger().error(e.getMessage(), e); |
|
||||||
return false; |
|
||||||
} |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected void done() { |
|
||||||
|
|
||||||
try { |
|
||||||
if (get()) { |
|
||||||
IOUtils.unzip(new File(StableUtils.pathJoin(PluginHelper.DOWNLOAD_PATH, PluginHelper.TEMP_FILE)), StableUtils.getInstallHome()); |
|
||||||
int rv = JOptionPane.showOptionDialog( |
|
||||||
QQLoginPane.this, |
|
||||||
Inter.getLocText("FR-Designer-Plugin_Shop_Installed"), |
|
||||||
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(); |
|
||||||
} |
|
||||||
} |
|
||||||
} catch (InterruptedException | ExecutionException e) { |
|
||||||
FRContext.getLogger().error(e.getMessage(), e); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
}.execute(); |
|
||||||
} |
|
||||||
|
|
||||||
private void updateShopScripts() { |
|
||||||
new SwingWorker<Void, Void>() { |
|
||||||
@Override |
|
||||||
protected Void doInBackground() throws Exception { |
|
||||||
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("store.version") + "&version=" + PluginStoreConstants.VERSION); |
|
||||||
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { |
|
||||||
if (!ComparatorUtils.equals(httpClient.getResponseText(), LATEST)) { |
|
||||||
int rv = JOptionPane.showConfirmDialog( |
|
||||||
QQLoginPane.this, |
|
||||||
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Update"), |
|
||||||
Inter.getLocText("FR-Designer-Plugin_Warning"), |
|
||||||
JOptionPane.OK_CANCEL_OPTION, |
|
||||||
JOptionPane.INFORMATION_MESSAGE |
|
||||||
); |
|
||||||
if (rv == JOptionPane.OK_OPTION) { |
|
||||||
downloadShopScripts(); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
return null; |
|
||||||
} |
|
||||||
}.execute(); |
|
||||||
} |
|
||||||
} |
|
@ -1,131 +0,0 @@ |
|||||||
package com.fr.design.extra; |
|
||||||
|
|
||||||
import com.fr.design.DesignerEnvManager; |
|
||||||
import com.fr.design.dialog.UIDialog; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.general.FRLogger; |
|
||||||
import com.fr.general.SiteCenter; |
|
||||||
import javafx.scene.web.WebEngine; |
|
||||||
import org.json.JSONObject; |
|
||||||
import netscape.javascript.JSObject; |
|
||||||
|
|
||||||
import javax.swing.*; |
|
||||||
import java.awt.*; |
|
||||||
import java.io.IOException; |
|
||||||
import java.net.URI; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by lp on 2016/8/10. |
|
||||||
*/ |
|
||||||
public class QQLoginWebBridge { |
|
||||||
|
|
||||||
private static com.fr.design.extra.QQLoginWebBridge helper; |
|
||||||
private WebEngine webEngine; |
|
||||||
private static String LOGINSUCCESS = "ok"; |
|
||||||
private static String LOGINFAILED = "failed"; |
|
||||||
private UIDialog uiDialog; |
|
||||||
private UILabel uiLabel; |
|
||||||
private UILabel pluginuiLabel; |
|
||||||
private UIDialog qqDialog; |
|
||||||
private String username; |
|
||||||
|
|
||||||
|
|
||||||
private QQLoginWebBridge() { |
|
||||||
} |
|
||||||
|
|
||||||
public static com.fr.design.extra.QQLoginWebBridge getHelper() { |
|
||||||
if (helper != null) { |
|
||||||
return helper; |
|
||||||
} |
|
||||||
synchronized (com.fr.design.extra.QQLoginWebBridge.class) { |
|
||||||
if (helper == null) { |
|
||||||
helper = new com.fr.design.extra.QQLoginWebBridge(); |
|
||||||
} |
|
||||||
return helper; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public void setEngine(WebEngine webEngine) { |
|
||||||
this.webEngine = webEngine; |
|
||||||
} |
|
||||||
|
|
||||||
public void setDialogHandle(UIDialog uiDialog) { |
|
||||||
this.uiDialog = uiDialog; |
|
||||||
} |
|
||||||
|
|
||||||
public void setQQDialogHandle(UIDialog uiDialog) { |
|
||||||
this.qqDialog = uiDialog; |
|
||||||
} |
|
||||||
|
|
||||||
public void setUILabel(UILabel uiLabel) { |
|
||||||
this.uiLabel = uiLabel; |
|
||||||
} |
|
||||||
|
|
||||||
public void setUILabelInPlugin(UILabel uiLabel) { |
|
||||||
this.pluginuiLabel = uiLabel; |
|
||||||
} |
|
||||||
|
|
||||||
public void setLoginlabel() { |
|
||||||
username = DesignerEnvManager.getEnvManager().getBBSName(); |
|
||||||
} |
|
||||||
|
|
||||||
private static JSObject window; |
|
||||||
|
|
||||||
public static com.fr.design.extra.QQLoginWebBridge getHelper(WebEngine webEngine) { |
|
||||||
getHelper(); |
|
||||||
helper.setEngine(webEngine); |
|
||||||
return helper; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 关闭QQ授权窗口 |
|
||||||
*/ |
|
||||||
public void closeQQWindow() { |
|
||||||
if (qqDialog != null) { |
|
||||||
qqDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); |
|
||||||
qqDialog.setVisible(false); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 关闭父窗口 |
|
||||||
*/ |
|
||||||
public void closeParentWindow() { |
|
||||||
if (uiDialog != null) { |
|
||||||
uiDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); |
|
||||||
uiDialog.setVisible(false); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 获取用户信息 |
|
||||||
* @param userInfo |
|
||||||
*/ |
|
||||||
public void getLoginInfo(String userInfo) { |
|
||||||
JSONObject jo = new JSONObject(userInfo); |
|
||||||
String status = jo.get("status").toString(); |
|
||||||
if (status.equals(LOGINSUCCESS)) { |
|
||||||
String username = jo.get("username").toString(); |
|
||||||
int uid = Integer.parseInt(jo.get("uid") == null ? "" : jo.get("uid").toString()); |
|
||||||
closeQQWindow(); |
|
||||||
closeParentWindow(); |
|
||||||
pluginuiLabel.setText(username); |
|
||||||
DesignerEnvManager.getEnvManager().setBBSName(username); |
|
||||||
DesignerEnvManager.getEnvManager().setBbsUid(uid); |
|
||||||
DesignerEnvManager.getEnvManager().setInShowBBsName(username); |
|
||||||
}else if (status.equals(LOGINFAILED)){ |
|
||||||
//账号没有QQ授权
|
|
||||||
closeQQWindow(); |
|
||||||
try { |
|
||||||
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("QQ_binding"))); |
|
||||||
}catch (Exception exp) { |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public void openUrlAtLocalWebBrowser(WebEngine eng, String url) { |
|
||||||
if (url.indexOf("qqLogin.html") > 0) { |
|
||||||
return; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,36 +0,0 @@ |
|||||||
package com.fr.design.extra; |
|
||||||
|
|
||||||
import javafx.scene.web.WebEngine; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by vito on 2016/9/28. |
|
||||||
*/ |
|
||||||
public class ReuseWebBridge { |
|
||||||
public static ReuseWebBridge helper; |
|
||||||
private WebEngine webEngine; |
|
||||||
|
|
||||||
public static ReuseWebBridge getHelper() { |
|
||||||
if (helper != null) { |
|
||||||
return helper; |
|
||||||
} |
|
||||||
synchronized (ReuseWebBridge.class) { |
|
||||||
if (helper == null) { |
|
||||||
helper = new ReuseWebBridge(); |
|
||||||
} |
|
||||||
return helper; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public static ReuseWebBridge getHelper(WebEngine webEngine) { |
|
||||||
getHelper(); |
|
||||||
helper.setEngine(webEngine); |
|
||||||
return helper; |
|
||||||
} |
|
||||||
|
|
||||||
private ReuseWebBridge() { |
|
||||||
} |
|
||||||
|
|
||||||
public void setEngine(WebEngine webEngine) { |
|
||||||
this.webEngine = webEngine; |
|
||||||
} |
|
||||||
} |
|
@ -1,54 +0,0 @@ |
|||||||
package com.fr.design.extra; |
|
||||||
|
|
||||||
import javafx.application.Platform; |
|
||||||
import javafx.embed.swing.JFXPanel; |
|
||||||
import javafx.event.EventHandler; |
|
||||||
import javafx.scene.Scene; |
|
||||||
import javafx.scene.layout.BorderPane; |
|
||||||
import javafx.scene.web.WebEngine; |
|
||||||
import javafx.scene.web.WebEvent; |
|
||||||
import javafx.scene.web.WebView; |
|
||||||
import netscape.javascript.JSObject; |
|
||||||
|
|
||||||
import javax.swing.*; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by vito on 2016/9/28. |
|
||||||
*/ |
|
||||||
public class ReuseWebPane extends JFXPanel { |
|
||||||
private WebEngine webEngine; |
|
||||||
|
|
||||||
public ReuseWebPane(final String mainJs) { |
|
||||||
Platform.setImplicitExit(false); |
|
||||||
Platform.runLater(new Runnable() { |
|
||||||
@Override |
|
||||||
public void run() { |
|
||||||
BorderPane root = new BorderPane(); |
|
||||||
Scene scene = new Scene(root); |
|
||||||
ReuseWebPane.this.setScene(scene); |
|
||||||
WebView webView = new WebView(); |
|
||||||
webEngine = webView.getEngine(); |
|
||||||
webEngine.load("file:///" + mainJs); |
|
||||||
webEngine.setOnAlert(new EventHandler<WebEvent<String>>() { |
|
||||||
@Override |
|
||||||
public void handle(WebEvent<String> event) { |
|
||||||
showAlert(event.getData()); |
|
||||||
} |
|
||||||
}); |
|
||||||
JSObject obj = (JSObject) webEngine.executeScript("window"); |
|
||||||
obj.setMember("ReuseHelper", ReuseWebBridge.getHelper(webEngine)); |
|
||||||
webView.setContextMenuEnabled(false);//屏蔽右键
|
|
||||||
root.setCenter(webView); |
|
||||||
} |
|
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
private void showAlert(final String message) { |
|
||||||
SwingUtilities.invokeLater(new Runnable() { |
|
||||||
@Override |
|
||||||
public void run() { |
|
||||||
JOptionPane.showMessageDialog(ReuseWebPane.this, message); |
|
||||||
} |
|
||||||
}); |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,41 @@ |
|||||||
|
package com.fr.design.fun; |
||||||
|
|
||||||
|
import com.fr.form.ui.Widget; |
||||||
|
import com.fr.stable.fun.mark.Mutable; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* 报表工具栏设计器端拓展,用于配置按钮额外属性 |
||||||
|
* Created by harry on 2016-12-23. |
||||||
|
*/ |
||||||
|
public interface ExtraButtonToolBarProvider extends Mutable { |
||||||
|
|
||||||
|
String XML_TAG = "ExtraButtonToolBarProvider"; |
||||||
|
|
||||||
|
int CURRENT_LEVEL = 1; |
||||||
|
|
||||||
|
/** |
||||||
|
* 用于添加属性面板 |
||||||
|
* |
||||||
|
* @param centerPane 面板 |
||||||
|
*/ |
||||||
|
void updateCenterPane(JPanel centerPane); |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新界面 |
||||||
|
* |
||||||
|
* @param widget 控件 |
||||||
|
* @param card 卡片布局 |
||||||
|
* @param centerPane 面板 |
||||||
|
*/ |
||||||
|
void populate(Widget widget, CardLayout card, JPanel centerPane); |
||||||
|
|
||||||
|
/** |
||||||
|
* 保存界面设置 |
||||||
|
* |
||||||
|
* @param widget 控件 |
||||||
|
*/ |
||||||
|
void update(Widget widget); |
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
package com.fr.design.fun.impl; |
||||||
|
|
||||||
|
import com.fr.design.fun.ExtraButtonToolBarProvider; |
||||||
|
import com.fr.stable.fun.impl.AbstractProvider; |
||||||
|
import com.fr.stable.fun.mark.API; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by harry on 2016-12-23. |
||||||
|
*/ |
||||||
|
@API(level = ExtraButtonToolBarProvider.CURRENT_LEVEL) |
||||||
|
public abstract class AbstractExtraButtonToolBarProvider extends AbstractProvider implements ExtraButtonToolBarProvider { |
||||||
|
public int currentAPILevel() { |
||||||
|
return ExtraButtonToolBarProvider.CURRENT_LEVEL; |
||||||
|
} |
||||||
|
|
||||||
|
public String mark4Provider() { |
||||||
|
return getClass().getName(); |
||||||
|
} |
||||||
|
} |
After Width: | Height: | Size: 248 B |
After Width: | Height: | Size: 250 B |
After Width: | Height: | Size: 264 B |
After Width: | Height: | Size: 264 B |
After Width: | Height: | Size: 265 B |
After Width: | Height: | Size: 257 B |
After Width: | Height: | Size: 272 B |
After Width: | Height: | Size: 273 B |
@ -1 +1 @@ |
|||||||
΅±Η°Φ΅ |
当前值 |
@ -1 +1 @@ |
|||||||
当前的页数。 |
当前的页数。 |
@ -1 +1 @@ |
|||||||
总页数。 |
总页数。 |
@ -1 +1 @@ |
|||||||
使用权限时保存角色的参数 |
使用权限时保存角色的参数 |
@ -1 +1 @@ |
|||||||
使用权限时保存用户名的参数 |
使用权限时保存用户名的参数 |
@ -1,3 +1 @@ |
|||||||
使用权限时,$fr_userposition就是部门角色, |
使用权限时,$fr_userposition就是部门角色,格式如:{"jobTitle":"销售经理","departments":"销售"},部门角色是以部门和职务组成的数组。 |
||||||
格式如:{"departments":"销售","jobTitle":"销售经理"}, |
|
||||||
部门角色是以部门和职务组成的数组。 |
|
@ -1 +1 @@ |
|||||||
NOFILTER是一个与任意值比较都为true的参数。 |
NOFILTER是一个与任意值比较都为true的参数。 |
@ -1 +1 @@ |
|||||||
空值的参数。 |
空值的参数。 |
@ -1,3 +1 @@ |
|||||||
contextPath是指绝对路径的服务器别名,即虚拟目录. |
contextPath是指绝对路径的服务器别名,即虚拟目录.假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,contextPath是/WebReport |
||||||
假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt, |
|
||||||
contextPath是/WebReport |
|
@ -1 +1 @@ |
|||||||
当前报表。 |
当前报表。 |
@ -1,3 +1 @@ |
|||||||
表单名字 |
表单名字假如访问:http://localhost:8080/WebReport/ReportServer?formlet=Form1.frm,formName就是Form1.frm |
||||||
假如访问:http://localhost:8080/WebReport/ReportServer?formlet=Form1.frm, |
|
||||||
formName就是Form1.frm |
|
@ -1 +1 @@ |
|||||||
提交入库事件的返回信息。
fr_submitinfo.success记录成功与否
fr_submitinfo.failinfo简单记录出错信息
|
提交入库事件的返回信息。fr_submitinfo.success记录成功与否fr_submitinfo.failinfo简单记录出错信息 |
@ -1,3 +1 @@ |
|||||||
报表名字 |
报表名字假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,reportName就是WorkBook1.cpt |
||||||
假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt, |
|
||||||
reportName就是WorkBook1.cpt |
|