Browse Source

merge

master
hzzz 7 years ago
parent
commit
a1fdd0b66e
  1. 4
      designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java
  2. 7
      designer-base/src/com/fr/design/remote/action/RemoteDesignAuthorityManagerAction.java
  3. 105
      designer-base/src/com/fr/design/utils/DesignUtils.java
  4. 2
      designer-base/src/com/fr/env/DesignAuthorityConfigurable.java
  5. 1350
      designer-base/src/com/fr/env/RemoteEnv.java
  6. 2
      designer-base/src/com/fr/env/RemoteEnvUtils.java
  7. 2
      designer-base/src/com/fr/env/SignIn.java
  8. 8
      designer-form/src/com/fr/design/mainframe/widget/accessibles/AccessibleBodyWatermarkEditor.java
  9. 8
      designer-realize/src/com/fr/design/actions/report/ReportWatermarkAction.java

4
designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java

@ -47,7 +47,7 @@ public class DesignerSocketIO {
static {
EventDispatcher.listen(EnvEvents.AFTER_SIGN_OUT, new Listener<Null>() {
@Override
public void on(Event<Null> event, Null param) {
public void on(Event event, Null param) {
if (socketIO.isPresent()) {
socketIO.get().close();
socketIO = Optional.absent();
@ -56,7 +56,7 @@ public class DesignerSocketIO {
});
EventDispatcher.listen(EnvEvents.AFTER_SIGN_IN, new Listener<Null>() {
@Override
public void on(Event<Null> event, Null param) {
public void on(Event event, Null param) {
updateSocket();
}
});

7
designer-base/src/com/fr/design/remote/action/RemoteDesignAuthorityManagerAction.java

@ -48,11 +48,8 @@ public class RemoteDesignAuthorityManagerAction extends UpdateAction {
public void doOk() {
DesignAuthority[] authorities = managerPane.update();
if (!FRContext.getCurrentEnv().isLocalEnv()) {
try {
((RemoteEnv) FRContext.getCurrentEnv()).updateAuthorities(authorities);
} catch (Exception exception) {
FRContext.getLogger().error(exception.getMessage());
}
boolean success = ((RemoteEnv) FRContext.getCurrentEnv()).updateAuthorities(authorities);
FRContext.getLogger().info("update remote design authority: " + success);
}
}

105
designer-base/src/com/fr/design/utils/DesignUtils.java

@ -1,11 +1,11 @@
package com.fr.design.utils;
import com.fr.base.BaseUtils;
import com.fr.base.ServerConfig;
import com.fr.base.Env;
import com.fr.base.EnvException;
import com.fr.base.FRContext;
import com.fr.base.FeedBackInfo;
import com.fr.base.ServerConfig;
import com.fr.base.Utils;
import com.fr.base.remote.RemoteDeziConstants;
import com.fr.dav.DavXMLUtils;
@ -23,6 +23,7 @@ import com.fr.general.FRLogger;
import com.fr.general.GeneralContext;
import com.fr.general.Inter;
import com.fr.general.http.HttpClient;
import com.fr.security.JwtUtils;
import com.fr.stable.ArrayUtils;
import com.fr.stable.CodeUtils;
import com.fr.stable.EncodeConstants;
@ -30,8 +31,11 @@ import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.start.StartServer;
import javax.swing.*;
import java.awt.*;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.Desktop;
import java.awt.Font;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
@ -74,7 +78,8 @@ public class DesignUtils {
/**
* 通过端口是否被占用判断设计器有没有启动
* s
* s
*
* @return 启动了返回true
*/
public static boolean isStarted() {
@ -120,11 +125,12 @@ public class DesignUtils {
}
/**
*建立监听端口
* @param startPort 端口
* @param suffixs 文件后缀
* 建立监听端口
*
* @param startPort 端口
* @param suffixs 文件后缀
*/
public static void creatListeningServer(final int startPort,final String[] suffixs) {
public static void creatListeningServer(final int startPort, final String[] suffixs) {
Thread serverSocketThread = new Thread() {
public void run() {
ServerSocket serverSocket = null;
@ -146,7 +152,7 @@ public class DesignUtils {
String path = f.getAbsolutePath();
boolean isMatch = false;
for(int i= 0; i<suffixs.length;i++){
for (int i = 0; i < suffixs.length; i++) {
isMatch = isMatch || path.endsWith(suffixs[i]);
}
if (isMatch) {
@ -209,18 +215,18 @@ public class DesignUtils {
// 更新CurrentEnv于FRContext & DesignerEnvManager
FRContext.setCurrentEnv(env);
refreshDesignerFrame(env);
// 当换了运行环境,重置服务器,让它下次预览时重启
if (env instanceof LocalEnv && !ComparatorUtils.equals(env.getPath(), oldEnvPath)) {
StartServer.currentEnvChanged();
}
}
public static void refreshDesignerFrame(Env env) {
final Env run_env = env;
// 刷新DesignerFrame里面的面板
SwingUtilities.invokeLater(new Runnable() {
@ -233,7 +239,7 @@ public class DesignUtils {
}
});
}
/**
* p:初始化look and feel, 把一切放到这个里面.可以让多个地方调用.
*/
@ -256,55 +262,55 @@ public class DesignUtils {
}
}
}
private static boolean isTextField(String key){
return key.startsWith("TextField.") || key.startsWith("PasswordField.");
private static boolean isTextField(String key) {
return key.startsWith("TextField.") || key.startsWith("PasswordField.");
}
private static FRFont getCurrentLocaleFont(){
private static FRFont getCurrentLocaleFont() {
FRFont guiFRFont;
Locale defaultLocale = Locale.getDefault();
if (isDisplaySimSun(defaultLocale)) {
guiFRFont = getNamedFont("SimSun");
} else if(isDisplayDialog(defaultLocale)) {
} else if (isDisplayDialog(defaultLocale)) {
guiFRFont = getNamedFont("Dialog");
} else {
guiFRFont = getNamedFont("Tahoma");
}
//先初始化的设计器locale, 后初始化lookandfeel.如果顺序改了, 这边也要调整.
Locale designerLocale = FRContext.getLocale();
String file = Inter.getLocText("FR-Designer_File");
char displayChar = file.charAt(0);
if (!guiFRFont.canDisplay(displayChar)) {
//如果不能用默认的语言显示字体, 比如想在英文系统里用中文设计器
//默认语言(中文:宋体, 英文:Tahoma, 其他:Dialog)
guiFRFont = getNamedFont("SimSun");
if (!guiFRFont.canDisplay(displayChar)) {
//如果不能用默认的语言显示字体, 比如想在英文系统里用中文设计器
//默认语言(中文:宋体, 英文:Tahoma, 其他:Dialog)
guiFRFont = getNamedFont("SimSun");
if (!guiFRFont.canDisplay(displayChar)) {
//比如想在中文或英文系统里用韩文设计器
guiFRFont = getNamedFont("Dialog");
if(!guiFRFont.canDisplay(displayChar)) {
if (!guiFRFont.canDisplay(displayChar)) {
FRContext.getLogger().error(Inter.getLocText("FR-Base_SimSun_Not_Found"));
}
}
}
}
}
return guiFRFont;
}
private static FRFont getNamedFont(String name){
return FRFont.getInstance(name, Font.PLAIN, 12);
private static FRFont getNamedFont(String name) {
return FRFont.getInstance(name, Font.PLAIN, 12);
}
private static boolean isDisplaySimSun(Locale defaultLocale){
return ComparatorUtils.equals(defaultLocale, Locale.SIMPLIFIED_CHINESE);
private static boolean isDisplaySimSun(Locale defaultLocale) {
return ComparatorUtils.equals(defaultLocale, Locale.SIMPLIFIED_CHINESE);
}
private static boolean isDisplayDialog(Locale defaultLocale){
return ComparatorUtils.equals(defaultLocale, Locale.TRADITIONAL_CHINESE)
|| ComparatorUtils.equals(defaultLocale, Locale.JAPANESE)
|| ComparatorUtils.equals(defaultLocale, Locale.JAPAN)
private static boolean isDisplayDialog(Locale defaultLocale) {
return ComparatorUtils.equals(defaultLocale, Locale.TRADITIONAL_CHINESE)
|| ComparatorUtils.equals(defaultLocale, Locale.JAPANESE)
|| ComparatorUtils.equals(defaultLocale, Locale.JAPAN)
|| ComparatorUtils.equals(defaultLocale, Locale.KOREAN)
|| ComparatorUtils.equals(defaultLocale, Locale.KOREA);
}
@ -313,7 +319,7 @@ public class DesignUtils {
* 访问服务器环境-空参数
*/
public static void visitEnvServer() {
visitEnvServerByParameters(StringUtils.EMPTY, new String[] {}, new String[] {});
visitEnvServerByParameters(StringUtils.EMPTY, new String[]{}, new String[]{});
}
/**
@ -342,8 +348,11 @@ public class DesignUtils {
if (Utils.isEmbeddedParameter(postfixOfUri)) {
String time = Calendar.getInstance().getTime().toString().replaceAll(" ", "");
boolean isUserPrivilege = ((RemoteEnv) FRContext.getCurrentEnv()).writePrivilegeMap(time, postfixOfUri);
postfixOfUri = isUserPrivilege ? postfixOfUri + "&fr_check_url=" + time + "&id=" + FRContext.getCurrentEnv().getUserID(): postfixOfUri ;
postfixOfUri = isUserPrivilege ? postfixOfUri + "&fr_check_url=" + time + "&id=" + FRContext.getCurrentEnv().getUserID() : postfixOfUri;
}
// 加参数给远程设计校验权限。
String design = JwtUtils.createDefaultJWT(FRContext.getCurrentEnv().getUser());
postfixOfUri = postfixOfUri + "&design=" + design;
String urlPath = getWebBrowserPath();
Desktop.getDesktop().browse(new URI(urlPath + postfixOfUri));
@ -474,10 +483,10 @@ public class DesignUtils {
private static InputStream postBytes2ServerB(byte[] bytes) throws Exception {
HttpClient client = new HttpClient("http://114.215.175.35:8080/WebReport/product_advice.jsp");
HttpClient client = new HttpClient("http://114.215.175.35:8080/WebReport/product_advice.jsp");
client.asGet();
client.setContent(bytes);
return execute4InputStream(client);
client.setContent(bytes);
return execute4InputStream(client);
}
@ -486,8 +495,8 @@ public class DesignUtils {
*/
private static ByteArrayInputStream execute4InputStream(HttpClient client) throws Exception {
int statusCode = client.getResponseCode();
if(statusCode != HttpURLConnection.HTTP_OK){
throw new EnvException("Method failed: " + statusCode);
if (statusCode != HttpURLConnection.HTTP_OK) {
throw new EnvException("Method failed: " + statusCode);
}
InputStream in = client.getResponseStream();
if (in == null) {

2
designer-base/src/com/fr/env/DesignAuthorityConfigurable.java vendored

@ -6,5 +6,5 @@ public interface DesignAuthorityConfigurable {
DesignAuthority[] getAuthorities();
boolean updateAuthorities(DesignAuthority[] authorities) throws Exception;
boolean updateAuthorities(DesignAuthority[] authorities);
}

1350
designer-base/src/com/fr/env/RemoteEnv.java vendored

File diff suppressed because it is too large Load Diff

2
designer-base/src/com/fr/env/RemoteEnvUtils.java vendored

@ -3,6 +3,7 @@ package com.fr.env;
import com.fr.base.FRContext;
import com.fr.general.IOUtils;
import com.fr.report.DesignAuthority;
import com.fr.report.util.AuthorityXMLUtils;
import com.fr.stable.EncodeConstants;
import com.fr.third.org.apache.http.HttpEntity;
import com.fr.third.org.apache.http.client.methods.CloseableHttpResponse;
@ -13,7 +14,6 @@ import com.fr.third.org.apache.http.entity.InputStreamEntity;
import com.fr.third.org.apache.http.impl.client.CloseableHttpClient;
import com.fr.third.org.apache.http.impl.client.HttpClients;
import com.fr.third.org.apache.http.util.EntityUtils;
import com.fr.web.utils.AuthorityXMLUtils;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;

2
designer-base/src/com/fr/env/SignIn.java vendored

@ -25,7 +25,7 @@ public class SignIn {
static {
EventDispatcher.listen(EnvEvents.CONNECTION_ERROR, new Listener<Null>() {
@Override
public void on(Event<Null> event, Null param) {
public void on(Event event, Null param) {
if (JOptionPane.showConfirmDialog(null, Inter.getLocText("FR-Remote_Connect2Server_Again"), UIManager.getString("OptionPane.titleText"), JOptionPane.YES_NO_OPTION)
== JOptionPane.OK_OPTION) {
try {

8
designer-form/src/com/fr/design/mainframe/widget/accessibles/AccessibleBodyWatermarkEditor.java

@ -7,6 +7,9 @@ import com.fr.design.mainframe.widget.editors.ITextComponent;
import com.fr.design.mainframe.widget.renderer.WatermarkRenderer;
import com.fr.design.mainframe.widget.wrappers.WatermarkWrapper;
import com.fr.design.report.WatermarkPane;
import com.fr.plugin.ExtraClassManager;
import com.fr.stable.ReportFunctionProcessor;
import com.fr.stable.fun.FunctionProcessor;
import javax.swing.SwingUtilities;
import java.awt.Dimension;
@ -40,6 +43,11 @@ public class AccessibleBodyWatermarkEditor extends UneditableAccessibleEditor {
public void doOk() {
setValue(watermarkPane.update());
fireStateChanged();
// 功能点
FunctionProcessor processor = ExtraClassManager.getInstance().getFunctionProcessor();
if (processor != null) {
processor.recordFunction(ReportFunctionProcessor.WATERMARK);
}
}
});
watermarkPane.populate((WatermarkAttr) getValue());

8
designer-realize/src/com/fr/design/actions/report/ReportWatermarkAction.java

@ -9,7 +9,10 @@ import com.fr.design.mainframe.JWorkBook;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.report.WatermarkPane;
import com.fr.main.impl.WorkBook;
import com.fr.plugin.ExtraClassManager;
import com.fr.report.core.ReportUtils;
import com.fr.stable.ReportFunctionProcessor;
import com.fr.stable.fun.FunctionProcessor;
import java.awt.event.ActionEvent;
@ -42,6 +45,11 @@ public class ReportWatermarkAction extends JWorkBookAction {
public void doOk() {
wbTpl.addAttrMark(watermarkPane.update());
jwb.fireTargetModified();
// 功能点
FunctionProcessor processor = ExtraClassManager.getInstance().getFunctionProcessor();
if (processor != null) {
processor.recordFunction(ReportFunctionProcessor.WATERMARK);
}
}
}).setVisible(true);
}

Loading…
Cancel
Save