Browse Source

Merge remote-tracking branch 'origin/9.0' into 9.0

master
MoMeak 7 years ago
parent
commit
17dd361ba4
  1. 1
      designer_base/src/com/fr/design/extra/LoginWebBridge.java
  2. 7
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  3. 12
      designer_base/src/com/fr/design/extra/WebViewDlgHelper.java
  4. 6
      designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java
  5. 60
      designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogAppendThread.java
  6. 42
      designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogAppender.java
  7. 37
      designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  8. 5
      designer_base/src/com/fr/design/module/DesignModule.java
  9. 4
      designer_base/src/com/fr/env/RemoteEnv.java

1
designer_base/src/com/fr/design/extra/LoginWebBridge.java

@ -327,6 +327,7 @@ public class LoginWebBridge {
DesignerEnvManager.getEnvManager().setBBSName(username); DesignerEnvManager.getEnvManager().setBBSName(username);
DesignerEnvManager.getEnvManager().setBbsUid(uid); DesignerEnvManager.getEnvManager().setBbsUid(uid);
DesignerEnvManager.getEnvManager().setInShowBBsName(username); DesignerEnvManager.getEnvManager().setInShowBBsName(username);
BBSPluginLogin.getInstance().login(new BBSUserInfo(username, ""));
} else if (status.equals(LOGIN_FAILED)) { } else if (status.equals(LOGIN_FAILED)) {
//账号没有QQ授权 //账号没有QQ授权
closeQQWindow(); closeQQWindow();

7
designer_base/src/com/fr/design/extra/PluginWebBridge.java

@ -509,6 +509,13 @@ public class PluginWebBridge {
LoginWebBridge.getHelper().showQQ(); LoginWebBridge.getHelper().showQQ();
} }
//通过QQ登录后通知登录
public void ucsynLogin(long uid, String username){
BBSUserInfo bbsUserInfo = new BBSUserInfo(username, "");
BBSPluginLogin.getInstance().login(bbsUserInfo);
uiLabel.setText(username);
}
/** /**
* 清除用户信息 * 清除用户信息
*/ */

12
designer_base/src/com/fr/design/extra/WebViewDlgHelper.java

@ -80,6 +80,15 @@ public class WebViewDlgHelper {
public static void checkAndCopyMainFile(String indexPath, String mainJsPath){ public static void checkAndCopyMainFile(String indexPath, String mainJsPath){
File file = new File(indexPath); File file = new File(indexPath);
if (!file.exists()) { if (!file.exists()) {
copyMainFile(indexPath, mainJsPath);
}
}
/**
* 將script文件夹中的index.html文件复制到webreport下
*
*/
public static void copyMainFile(String indexPath, String mainJsPath){
try { try {
File mainJsFile = new File(mainJsPath); File mainJsFile = new File(mainJsPath);
int byteread = 0; int byteread = 0;
@ -96,7 +105,6 @@ public class WebViewDlgHelper {
FRContext.getLogger().error(e.getMessage()); FRContext.getLogger().error(e.getMessage());
} }
} }
}
/** /**
* 以关键词打开设计器商店 * 以关键词打开设计器商店
@ -186,7 +194,9 @@ public class WebViewDlgHelper {
try { try {
if (get()) { if (get()) {
String relativePath = "/scripts/store/web/index.html";
IOUtils.unzip(new File(StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE)), installHome); IOUtils.unzip(new File(StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE)), installHome);
copyMainFile(StableUtils.pathJoin(installHome, "index.html"), StableUtils.pathJoin(installHome, relativePath));
// TODO: 2017/4/17 删除之前存放在安装目录下的script // TODO: 2017/4/17 删除之前存放在安装目录下的script
int rv = JOptionPane.showOptionDialog( int rv = JOptionPane.showOptionDialog(
null, null,

6
designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java

@ -37,9 +37,9 @@ public class UIResizableContainer extends JPanel {
private static final int MIN_WIDTH = 165; private static final int MIN_WIDTH = 165;
private static final int ARROW_MARGIN = 15; private static final int ARROW_MARGIN = 15;
private static final int ARROW_MARGIN_VERTICAL = 20; private static final int ARROW_MARGIN_VERTICAL = 7;
private static final int ARROW_RANGE = 35; private static final int ARROW_RANGE = 35;
private static final int ARROW_RANGE_VERTICAL = 40; private static final int ARROW_RANGE_VERTICAL = 25;
private boolean isLeftRightDragEnabled = true; private boolean isLeftRightDragEnabled = true;
private boolean isDownPaneVisible = true ; private boolean isDownPaneVisible = true ;
@ -502,7 +502,7 @@ public class UIResizableContainer extends JPanel {
button = UIConstants.DRAG_LEFT_PRESS; button = UIConstants.DRAG_LEFT_PRESS;
} }
} }
g.drawImage(button, 3, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null); g.drawImage(button, 3, ARROW_MARGIN_VERTICAL, 5, 5, null);
} else { } else {
g.drawImage(UIConstants.DRAG_BAR, 0, 0, toolPaneHeight, getHeight(), null); g.drawImage(UIConstants.DRAG_BAR, 0, 0, toolPaneHeight, getHeight(), null);
if (containerWidth == toolPaneHeight) { if (containerWidth == toolPaneHeight) {

60
designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogAppendThread.java

@ -1,60 +0,0 @@
package com.fr.design.mainframe.loghandler;
import com.fr.general.LogRecordTime;
import com.fr.stable.StringUtils;
import org.apache.log4j.Appender;
import org.apache.log4j.Logger;
import org.apache.log4j.WriterAppender;
import java.io.PipedReader;
import java.io.PipedWriter;
import java.io.Writer;
import java.util.Date;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.LogRecord;
/**
* Created by Administrator on 2017/6/2/0002.
*/
public class DesignerLogAppendThread extends Thread{
PipedReader reader;
public DesignerLogAppendThread() {
Logger root = Logger.getRootLogger();
// 获取子记录器的输出源
Appender appender = root.getAppender("design");
// 定义一个未连接的输入流管道
reader = new PipedReader();
// 定义一个已连接的输出流管理,并连接到reader
Writer writer = null;
try {
writer = new PipedWriter(reader);
// 设置 appender 输出流
((WriterAppender) appender).setWriter(writer);
} catch (Throwable e) {
}
}
public void run() {
// 不间断地扫描输入流
Scanner scanner = new Scanner(reader);
// 将扫描到的字符流打印在屏目
while (scanner.hasNext()) {
try {
Thread.sleep(100);
String log = scanner.nextLine();
if (StringUtils.isEmpty(log)) {
return;
}
LogRecordTime logRecordTime = new LogRecordTime(new Date(),new LogRecord(Level.INFO, log));
DesignerLogHandler.getInstance().printRemoteLog(logRecordTime);
} catch (Throwable e) {
}
}
}
}

42
designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogAppender.java

@ -0,0 +1,42 @@
package com.fr.design.mainframe.loghandler;
import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.Level;
import org.apache.log4j.spi.LoggingEvent;
import java.util.Date;
/**
* Created by Administrator on 2017/7/18 0018.
*/
public class DesignerLogAppender extends AppenderSkeleton {
public DesignerLogAppender() {
this.layout = new org.apache.log4j.PatternLayout("%d{HH:mm:ss} %t %p [%c] %m%n");
}
protected void append(LoggingEvent event) {
this.subAppend(event);
}
public boolean requiresLayout() {
return true;
}
public synchronized void close() {
if (this.closed) {
return;
}
this.closed = true;
}
public void subAppend(LoggingEvent event) {
synchronized (DesignerLogHandler.getInstance()) {
Level level = event.getLevel();
String msg = this.layout.format(event);
DesignerLogHandler.getInstance().printRemoteLog(msg, level, new Date());
}
}
}

37
designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java

@ -6,11 +6,10 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.ComparatorUtils; import com.fr.general.*;
import com.fr.general.FRLogLevel; import com.fr.stable.EnvChangedListener;
import com.fr.general.Inter;
import com.fr.general.LogRecordTime;
import com.fr.stable.xml.LogRecordTimeProvider; import com.fr.stable.xml.LogRecordTimeProvider;
import org.apache.log4j.Level;
import javax.swing.*; import javax.swing.*;
import javax.swing.text.*; import javax.swing.text.*;
@ -31,6 +30,16 @@ public class DesignerLogHandler {
private static final int ERRO_GAP_Y = -40; private static final int ERRO_GAP_Y = -40;
private static final int SERVER_GAP_Y = -20; private static final int SERVER_GAP_Y = -20;
static {
GeneralContext.addEnvChangedListener(new EnvChangedListener() {
@Override
public void envChanged() {
// envchange后需要重新读取webinf里的log4j配置, 重新添加appender
FRLogger.getLogger().addLogAppender(new DesignerLogAppender());
}
});
}
public static DesignerLogHandler getInstance() { public static DesignerLogHandler getInstance() {
return HOLDER.singleton; return HOLDER.singleton;
} }
@ -116,8 +125,8 @@ public class DesignerLogHandler {
return caption; return caption;
} }
public void printRemoteLog(LogRecordTime logRecordTime) { public void printRemoteLog(String message, Level level, Date date) {
logHandlerArea.printStackTrace(logRecordTime); logHandlerArea.printStackTrace(message, level, date);
} }
private class LogHandlerArea extends JPanel { private class LogHandlerArea extends JPanel {
@ -201,6 +210,22 @@ public class DesignerLogHandler {
} }
public void printStackTrace(String message, Level level, Date date) {
int logLevelvalue = level.toInt();
if (logLevelvalue == INFO_INT && showInfo.isSelected()) {
printMessage(message, logLevelvalue, date);
} else if (logLevelvalue == ERRO_INT && showError.isSelected()) {
printMessage(message, logLevelvalue, date);
} else if (logLevelvalue == SERVER_INT && showServer.isSelected()) {
printMessage(message, logLevelvalue, date);
}
}
private void printMessage(String message, int logLevelvalue, Date date) {
printMessage(message, logLevelvalue, date, null);
}
private void printMessage(String messange, int logLevelvalue, Date date, Throwable e) { private void printMessage(String messange, int logLevelvalue, Date date, Throwable e) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
this.log(simpleDateFormat.format(date) + "\n", 0); this.log(simpleDateFormat.format(date) + "\n", 0);

5
designer_base/src/com/fr/design/module/DesignModule.java

@ -12,7 +12,6 @@ import com.fr.design.javascript.JavaScriptImplPane;
import com.fr.design.javascript.ParameterJavaScriptPane; import com.fr.design.javascript.ParameterJavaScriptPane;
import com.fr.design.mainframe.App; import com.fr.design.mainframe.App;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.loghandler.DesignerLogAppendThread;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.ModuleContext; import com.fr.general.ModuleContext;
import com.fr.js.*; import com.fr.js.*;
@ -45,10 +44,6 @@ public abstract class DesignModule extends TopModule {
ActionFactory.registerCellInsertActionClass(actionsForInsertCellElement()); ActionFactory.registerCellInsertActionClass(actionsForInsertCellElement());
ActionFactory.registerFloatInsertActionClass(actionsForInsertFloatElement()); ActionFactory.registerFloatInsertActionClass(actionsForInsertFloatElement());
DesignModuleFactory.registerCreators4Hyperlink(hyperlinkTypes()); DesignModuleFactory.registerCreators4Hyperlink(hyperlinkTypes());
// 将log4j日志输出到设计器日志面板的线程.
DesignerLogAppendThread logTread = new DesignerLogAppendThread();
logTread.start();
} }
public boolean isStarted() { public boolean isStarted() {

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

@ -17,7 +17,6 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.fun.DesignerEnvProcessor;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.loghandler.DesignerLogHandler;
import com.fr.file.CacheManager; import com.fr.file.CacheManager;
import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider; import com.fr.file.DatasourceManagerProvider;
@ -1788,8 +1787,7 @@ public class RemoteEnv extends AbstractEnv {
} }
LogRecordTime[] records = DavXMLUtils.readXMLLogRecords(input); LogRecordTime[] records = DavXMLUtils.readXMLLogRecords(input);
for (LogRecordTime logRecordTime : records) { for (LogRecordTime logRecordTime : records) {
DesignerLogHandler.getInstance().printRemoteLog(logRecordTime); //TODO
} }
} }

Loading…
Cancel
Save