Fangjie Hu
8 years ago
34 changed files with 2891 additions and 1135 deletions
@ -0,0 +1,86 @@
|
||||
apply plugin: "java" |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = "UTF-8" |
||||
} |
||||
sourceCompatibility=1.7 |
||||
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}/3rd.jar",dest:"${libDir}/tmp-${branchName}") |
||||
unjar(src:"${libDir}/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") |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,35 @@
|
||||
package com.fr.design.mainframe.bbs; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.dialog.UIDialog; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.general.SiteCenter; |
||||
import com.fr.general.http.HttpClient; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by zhaohehe on 16/7/26. |
||||
*/ |
||||
public class LoginDialog extends UIDialog { |
||||
private static final Dimension DEFAULT_SHOP = new Dimension(404, 234); |
||||
|
||||
public LoginDialog(Frame frame, BasicPane pane) { |
||||
super(frame); |
||||
setUndecorated(true); |
||||
JPanel panel = (JPanel) getContentPane(); |
||||
panel.setLayout(new BorderLayout()); |
||||
add(pane, BorderLayout.CENTER); |
||||
setSize(DEFAULT_SHOP); |
||||
GUICoreUtils.centerWindow(this); |
||||
setResizable(false); |
||||
setTitle(Inter.getLocText("FR-Designer-Plugin_Manager")); |
||||
} |
||||
|
||||
@Override |
||||
public void checkValid() throws Exception { |
||||
} |
||||
} |
@ -0,0 +1,70 @@
|
||||
|
||||
apply plugin: 'java' |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = 'UTF-8' |
||||
} |
||||
//指定构建的jdk版本 |
||||
sourceCompatibility=1.8 |
||||
//指定生成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',include:'**/*.jar') |
||||
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/*.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,8 @@
|
||||
package com.fr.design.extra; |
||||
|
||||
/** |
||||
* Created by lp on 2016/8/16. |
||||
*/ |
||||
public interface LoginContextListener { |
||||
void showLoginContext(); |
||||
} |
@ -0,0 +1,143 @@
|
||||
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/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 { |
||||
} |
||||
} |
||||
|
||||
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(); |
||||
} |
||||
} |
@ -0,0 +1,188 @@
|
||||
package com.fr.design.extra; |
||||
|
||||
import com.fr.base.FRContext; |
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.dialog.UIDialog; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.SiteCenter; |
||||
import com.fr.general.http.HttpClient; |
||||
import com.fr.stable.EncodeConstants; |
||||
import com.fr.stable.StringUtils; |
||||
import javafx.scene.web.WebEngine; |
||||
|
||||
import java.io.UnsupportedEncodingException; |
||||
import java.net.HttpURLConnection; |
||||
import java.net.URI; |
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.net.URLEncoder; |
||||
|
||||
/** |
||||
* Created by zhaohehe on 16/8/1. |
||||
*/ |
||||
public class LoginWebBridge { |
||||
|
||||
private static final String LOGIN_SUCCESS_FLAG = "http://bbs.finereport.com"; |
||||
private static final String LOGININ = "0"; |
||||
private static final String LOGIN_INFO_EMPTY = "-1"; |
||||
private static final String DISCONNECTED = "-2"; |
||||
private static final String UNKNOWN_ERROR = "-3"; |
||||
private static final int TIME_OUT = 10000; |
||||
|
||||
private static com.fr.design.extra.LoginWebBridge helper; |
||||
private UIDialog uiDialog; |
||||
private UILabel uiLabel; |
||||
|
||||
private boolean testConnection() { |
||||
HttpClient client = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("bbs.test")); |
||||
return client.isServerAlive(); |
||||
} |
||||
|
||||
public static com.fr.design.extra.LoginWebBridge getHelper() { |
||||
if (helper != null) { |
||||
return helper; |
||||
} |
||||
synchronized (com.fr.design.extra.LoginWebBridge.class) { |
||||
if (helper == null) { |
||||
helper = new com.fr.design.extra.LoginWebBridge(); |
||||
} |
||||
return helper; |
||||
} |
||||
} |
||||
|
||||
public static com.fr.design.extra.LoginWebBridge getHelper(WebEngine webEngine) { |
||||
getHelper(); |
||||
helper.setEngine(webEngine); |
||||
return helper; |
||||
} |
||||
|
||||
private WebEngine webEngine; |
||||
|
||||
private LoginWebBridge() { |
||||
} |
||||
|
||||
public void setEngine(WebEngine webEngine) { |
||||
this.webEngine = webEngine; |
||||
} |
||||
|
||||
public void setDialogHandle(UIDialog uiDialog) { |
||||
this.uiDialog = uiDialog; |
||||
} |
||||
|
||||
public void setUILabel(UILabel uiLabel) { |
||||
this.uiLabel = uiLabel; |
||||
} |
||||
|
||||
/** |
||||
* 注册页面 |
||||
*/ |
||||
public void registerHref() { |
||||
try { |
||||
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.default"))); |
||||
}catch (Exception e) { |
||||
FRContext.getLogger().info(e.getMessage()); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 忘记密码 |
||||
*/ |
||||
public void forgetHref() { |
||||
try { |
||||
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.default"))); |
||||
}catch (Exception e) { |
||||
FRContext.getLogger().info(e.getMessage()); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 登录操作的回调 |
||||
* @param username |
||||
* @param password |
||||
* @return |
||||
*/ |
||||
public String defaultLogin(String username, String password) { |
||||
if (!StringUtils.isNotBlank(username) && !StringUtils.isNotBlank(password)) { |
||||
return LOGIN_INFO_EMPTY; |
||||
} |
||||
if (!testConnection()) { |
||||
return DISCONNECTED; |
||||
} |
||||
if (login(username, password)) { |
||||
updateUserInfo(username, password); |
||||
loginSuccess(username); |
||||
return LOGININ; |
||||
}else { |
||||
return UNKNOWN_ERROR; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 关闭窗口 |
||||
*/ |
||||
public void closeWindow() { |
||||
if (uiDialog != null) { |
||||
uiDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); |
||||
uiDialog.setVisible(false); |
||||
} |
||||
} |
||||
|
||||
public void updateUserInfo(String username,String password) { |
||||
DesignerEnvManager.getEnvManager().setBBSName(username); |
||||
DesignerEnvManager.getEnvManager().setBBSPassword(password); |
||||
} |
||||
|
||||
/** |
||||
* 关闭窗口并且重新赋值 |
||||
* @param username |
||||
*/ |
||||
public void loginSuccess(String username) { |
||||
closeWindow(); |
||||
uiLabel.setText(username); |
||||
} |
||||
|
||||
/** |
||||
* 弹出QQ授权页面 |
||||
*/ |
||||
public void showQQ() { |
||||
SwingUtilities.invokeLater(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
//弹出qq登录的窗口
|
||||
QQLoginPane managerPane = new QQLoginPane(); |
||||
UIDialog qqlog = new QQLoginDialog(DesignerContext.getDesignerFrame(),managerPane); |
||||
QQLoginWebBridge.getHelper().setDialogHandle(uiDialog); |
||||
QQLoginWebBridge.getHelper().setQQDialogHandle(qqlog); |
||||
QQLoginWebBridge.getHelper().setUILabel(uiLabel); |
||||
qqlog.setVisible(true); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
public boolean login(String username, String password) { |
||||
if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(password)) { |
||||
try { |
||||
username = URLEncoder.encode(username, EncodeConstants.ENCODING_GBK); |
||||
password = URLEncoder.encode(password, EncodeConstants.ENCODING_GBK); |
||||
} catch (UnsupportedEncodingException e) { |
||||
FRLogger.getLogger().error(e.getMessage()); |
||||
} |
||||
String url = SiteCenter.getInstance().acquireUrlByKind("bbs.login") + "&username=" + username + "&password=" + password; |
||||
HttpClient client = new HttpClient(url); |
||||
client.setTimeout(TIME_OUT); |
||||
if (client.getResponseCodeNoException() == HttpURLConnection.HTTP_OK) { |
||||
try { |
||||
String res = client.getResponseText(EncodeConstants.ENCODING_GBK); |
||||
if (res.contains(LOGIN_SUCCESS_FLAG)) { |
||||
return true; |
||||
} |
||||
} catch (Exception e) { |
||||
FRLogger.getLogger().error(e.getMessage()); |
||||
} |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,61 @@
|
||||
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 zhaohehe on 16/7/26. |
||||
*/ |
||||
public class LoginWebPane extends JFXPanel { |
||||
|
||||
private WebEngine webEngine; |
||||
private LoginPane loginPane; |
||||
|
||||
public LoginWebPane(final String installHome,LoginPane loginPane) { |
||||
this.loginPane = loginPane; |
||||
Platform.setImplicitExit(false); |
||||
Platform.runLater(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
BorderPane root = new BorderPane(); |
||||
Scene scene = new Scene(root); |
||||
LoginWebPane.this.setScene(scene); |
||||
WebView webView = new WebView(); |
||||
webEngine = webView.getEngine(); |
||||
webEngine.load("file:///" + installHome + "/scripts/store/web/login.html"); |
||||
webEngine.setOnAlert(new EventHandler<WebEvent<String>>() { |
||||
@Override |
||||
public void handle(WebEvent<String> event) { |
||||
showAlert(event.getData()); |
||||
} |
||||
}); |
||||
JSObject obj = (JSObject) webEngine.executeScript("window"); |
||||
obj.setMember("LoginHelper", LoginWebBridge.getHelper(webEngine)); |
||||
webView.setContextMenuEnabled(false);//屏蔽右键
|
||||
root.setCenter(webView); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
public void setEngine(WebEngine webEngine) { |
||||
this.webEngine = webEngine; |
||||
} |
||||
|
||||
private void showAlert(final String message) { |
||||
SwingUtilities.invokeLater(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
JOptionPane.showMessageDialog(LoginWebPane.this, message); |
||||
} |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,34 @@
|
||||
package com.fr.design.extra; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.dialog.UIDialog; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by zhaohehe on 16/7/28. |
||||
*/ |
||||
public class QQLoginDialog extends UIDialog { |
||||
private static final Dimension DEFAULT_SHOP = new Dimension(700, 500); |
||||
|
||||
public QQLoginDialog(Frame frame, BasicPane pane) { |
||||
super(frame); |
||||
setUndecorated(true); |
||||
JPanel panel = (JPanel) getContentPane(); |
||||
panel.setLayout(new BorderLayout()); |
||||
add(pane, BorderLayout.CENTER); |
||||
setSize(DEFAULT_SHOP); |
||||
GUICoreUtils.centerWindow(this); |
||||
setResizable(false); |
||||
setTitle(Inter.getLocText("FR-Designer-Plugin_Manager")); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void checkValid() throws Exception { |
||||
} |
||||
|
||||
} |
@ -0,0 +1,145 @@
|
||||
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(); |
||||
} |
||||
} |
@ -0,0 +1,105 @@
|
||||
package com.fr.design.extra; |
||||
|
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.dialog.UIDialog; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import javafx.scene.web.WebEngine; |
||||
import org.json.JSONObject; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* 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 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 setLoginlabel() { |
||||
username = DesignerEnvManager.getEnvManager().getBBSName(); |
||||
} |
||||
|
||||
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(); |
||||
closeQQWindow(); |
||||
closeParentWindow(); |
||||
uiLabel.setText(username); |
||||
DesignerEnvManager.getEnvManager().setBBSName(username); |
||||
}else if (status.equals(LOGINFAILED)){ |
||||
//账号没有QQ授权
|
||||
closeQQWindow(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,55 @@
|
||||
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 zhaohehe on 16/7/28. |
||||
*/ |
||||
public class QQLoginWebPane extends JFXPanel { |
||||
|
||||
private WebEngine webEngine; |
||||
|
||||
public QQLoginWebPane(final String installHome) { |
||||
Platform.setImplicitExit(false); |
||||
Platform.runLater(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
BorderPane root = new BorderPane(); |
||||
Scene scene = new Scene(root); |
||||
QQLoginWebPane.this.setScene(scene); |
||||
WebView webView = new WebView(); |
||||
webEngine = webView.getEngine(); |
||||
webEngine.load("file:///" + installHome + "/scripts/store/web/qqLogin.html"); |
||||
webEngine.setOnAlert(new EventHandler<WebEvent<String>>() { |
||||
@Override |
||||
public void handle(WebEvent<String> event) { |
||||
showAlert(event.getData()); |
||||
} |
||||
}); |
||||
JSObject obj = (JSObject) webEngine.executeScript("window"); |
||||
obj.setMember("QQLoginHelper", QQLoginWebBridge.getHelper(webEngine)); |
||||
webView.setContextMenuEnabled(false);//屏蔽右键
|
||||
root.setCenter(webView); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void showAlert(final String message) { |
||||
SwingUtilities.invokeLater(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
JOptionPane.showMessageDialog(QQLoginWebPane.this, message); |
||||
} |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,28 @@
|
||||
package com.fr.design.extra; |
||||
|
||||
import java.util.ArrayList; |
||||
|
||||
/** |
||||
* Created by lp on 2016/8/16. |
||||
*/ |
||||
public class UserLoginContext { |
||||
private static ArrayList<LoginContextListener> fireLoginContextListener = new ArrayList<LoginContextListener>(); |
||||
|
||||
/** |
||||
* 触发登录框弹出的监听器 |
||||
*/ |
||||
public static void fireLoginContextListener() { |
||||
for (LoginContextListener l : fireLoginContextListener) { |
||||
l.showLoginContext(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 添加一个弹出登录框的监听事件 |
||||
* |
||||
* @param l 登录框弹出监听事件 |
||||
*/ |
||||
public static void addLoginContextListener(LoginContextListener l) { |
||||
fireLoginContextListener.add(l); |
||||
} |
||||
} |
@ -0,0 +1,37 @@
|
||||
package com.fr.design.extra.exe; |
||||
|
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.extra.Process; |
||||
|
||||
/** |
||||
* Created by lp on 2016/8/16. |
||||
*/ |
||||
public class GetLoginInfoExecutor implements Executor { |
||||
private String result = "[]"; |
||||
|
||||
@Override |
||||
public String getTaskFinishMessage() { |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public Command[] getCommands() { |
||||
return new Command[]{ |
||||
new Command() { |
||||
@Override |
||||
public String getExecuteMessage() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void run(Process<String> process) { |
||||
String username = DesignerEnvManager.getEnvManager().getBBSName(); |
||||
if (username == null) { |
||||
}else { |
||||
result = username; |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,66 @@
|
||||
|
||||
apply plugin: 'java' |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = 'UTF-8' |
||||
} |
||||
//指定构建的jdk版本 |
||||
sourceCompatibility=1.8 |
||||
//指定生成jar包的版本 |
||||
version='8.0' |
||||
|
||||
def srcDir="." |
||||
|
||||
//对生成的jar包进行重命名 |
||||
|
||||
jar{ |
||||
baseName='fr-designer-chart' |
||||
} |
||||
|
||||
sourceSets{ |
||||
main{ |
||||
java{ |
||||
srcDirs=["${srcDir}/src"] |
||||
} |
||||
} |
||||
} |
||||
FileTree files =fileTree(dir:'./',include:'build.gradle') |
||||
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) |
||||
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) |
||||
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) |
||||
|
||||
//指定外部依赖 |
||||
dependencies{ |
||||
compile fileTree(dir:'../../../finereport-lib-stable',include:'**/*.jar') |
||||
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/*.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,83 @@
|
||||
|
||||
apply plugin: 'java' |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = 'UTF-8' |
||||
} |
||||
//指定构建的jdk版本 |
||||
sourceCompatibility=1.8 |
||||
//指定生成的jar包版本 |
||||
version='8.0' |
||||
|
||||
def srcDir="." |
||||
|
||||
|
||||
//指明生成jar包的名字 |
||||
jar{ |
||||
baseName='fr-designer-report' |
||||
} |
||||
//源码所在位置 |
||||
sourceSets{ |
||||
main{ |
||||
java{ |
||||
srcDirs=["${srcDir}/src", |
||||
"${srcDir}/../designer/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',include:'**/*.jar') |
||||
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar")//,exclude:"finereport-design-stable/${branchName}/build/libs/*.jar") |
||||
|
||||
testCompile 'junit:junit:4.12' |
||||
} |
||||
|
||||
//指明无法编译文件所在路径 |
||||
def dataContent ={def dir -> |
||||
copySpec{ |
||||
from ("${dir}"){ |
||||
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' |
||||
} |
||||
} |
||||
} |
||||
|
||||
//将非.java文件复制到classes文件夹下 参与打包 |
||||
task copyFile(type:Copy,dependsOn:compileJava){ |
||||
copy{ |
||||
with dataContent.call("${srcDir}/src") |
||||
with dataContent.call("${srcDir}/../designer/src") |
||||
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') |
||||
|
||||
} |
||||
fileset (dir:"${srcDir}/../designer/src"){ |
||||
include (name:'**/*.js') |
||||
include (name:'**/*.css') |
||||
} |
||||
|
||||
} |
||||
} |
||||
jar.dependsOn compressJS |
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1 +1 @@
|
||||
package com.fr.design.gui.core;
import javax.swing.Icon;
import com.fr.base.BaseUtils;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WCardLayout;
import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.WHorizontalBoxLayout;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.form.ui.container.WVerticalBoxLayout;
import com.fr.general.Inter;
/**
* Author : Shockway
* Date: 13-6-17
* Time: 上午10:40
*/
public class FormWidgetOption extends WidgetOption {
/**
* 返回名字
* @return 名字
*/
@Override
public String optionName() {
return null;
}
/**
* 返回图标
* @return 图标
*/
@Override
public Icon optionIcon() {
return null;
}
/**
* 组件类
* @return 类
*/
@Override
public Class<? extends Widget> widgetClass() {
return null;
}
/**
* 返回组件
* @return 控件
*/
@Override
public Widget createWidget() {
return null;
}
/*
* 表单容器
*/
public static WidgetOption[] getFormContainerInstance() {
return new WidgetOption[] { ABSOLUTELAYOUTCONTAINER, BORDERLAYOUTCONTAINER, HORIZONTALBOXLAYOUTCONTAINER, VERTICALBOXLAYOUTCONTAINER,
CARDLAYOUTCONTAINER, FITLAYOUTCONTAINER };
}
/**
* 表单工具栏上的布局
* @return 控件
*/
public static WidgetOption[] getFormLayoutInstance() {
return new WidgetOption[] {CARDLAYOUTCONTAINER/*, ABSOLUTELAYOUTCONTAINER*/};
}
public static final WidgetOption ABSOLUTELAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_AbsoluteLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_absolute.png"),
WAbsoluteLayout.class);
public static final WidgetOption BORDERLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_BorderLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_border.png"),
WBorderLayout.class);
public static final WidgetOption CARDLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_CardLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/card_layout_16.png"),
WCardLayout.class);
public static final WidgetOption HORIZONTALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_Layout-HBox"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_h_16.png"),
WHorizontalBoxLayout.class);
public static final WidgetOption VERTICALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_VerticalBoxLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"),
WVerticalBoxLayout.class);
public static final WidgetOption FITLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"),
BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"),
WFitLayout.class);
public static final WidgetOption PARAMETERCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_Para-Body"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_parameter.png"),
WParameterLayout.class);
public static final WidgetOption ELEMENTCASE = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_Form-Report"), BaseUtils.readIcon("/com/fr/web/images/form/resources/report_16.png"),
ElementCaseEditor.class);
} |
||||
package com.fr.design.gui.core;
import javax.swing.Icon;
import com.fr.base.BaseUtils;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WCardLayout;
import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.WHorizontalBoxLayout;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.form.ui.container.WVerticalBoxLayout;
import com.fr.general.Inter;
/**
* Author : Shockway
* Date: 13-6-17
* Time: 上午10:40
*/
public class FormWidgetOption extends WidgetOption {
/**
* 返回名字
* @return 名字
*/
@Override
public String optionName() {
return null;
}
/**
* 返回图标
* @return 图标
*/
@Override
public Icon optionIcon() {
return null;
}
/**
* 组件类
* @return 类
*/
@Override
public Class<? extends Widget> widgetClass() {
return null;
}
/**
* 返回组件
* @return 控件
*/
@Override
public Widget createWidget() {
return null;
}
/*
* 表单容器
*/
public static WidgetOption[] getFormContainerInstance() {
return new WidgetOption[] { ABSOLUTELAYOUTCONTAINER, BORDERLAYOUTCONTAINER, HORIZONTALBOXLAYOUTCONTAINER, VERTICALBOXLAYOUTCONTAINER,
CARDLAYOUTCONTAINER, FITLAYOUTCONTAINER };
}
/**
* 表单工具栏上的布局
* @return 控件
*/
public static WidgetOption[] getFormLayoutInstance() {
return new WidgetOption[] {CARDLAYOUTCONTAINER, ABSOLUTELAYOUTCONTAINER};
}
public static final WidgetOption ABSOLUTELAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_AbsoluteLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_absolute.png"),
WAbsoluteLayout.class);
public static final WidgetOption BORDERLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_BorderLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_border.png"),
WBorderLayout.class);
public static final WidgetOption CARDLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_CardLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/card_layout_16.png"),
WCardLayout.class);
public static final WidgetOption HORIZONTALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_Layout-HBox"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_h_16.png"),
WHorizontalBoxLayout.class);
public static final WidgetOption VERTICALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_VerticalBoxLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"),
WVerticalBoxLayout.class);
public static final WidgetOption FITLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"),
BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"),
WFitLayout.class);
public static final WidgetOption PARAMETERCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_Para-Body"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_parameter.png"),
WParameterLayout.class);
public static final WidgetOption ELEMENTCASE = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_Form-Report"), BaseUtils.readIcon("/com/fr/web/images/form/resources/report_16.png"),
ElementCaseEditor.class);
} |
Loading…
Reference in new issue