From fc07b767bb008cd8c995b268a50aabc4f39fd8f5 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Thu, 13 Jul 2017 16:38:18 +0800 Subject: [PATCH 1/4] =?UTF-8?q?placeholder=E6=94=B9=E9=94=99=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/alphafine/component/AlphaFineDialog.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index c2d5a53c4..074279e7c 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -68,7 +68,7 @@ public class AlphaFineDialog extends UIDialog { private static final String DS_NAME = "dsname=\""; private static final String PLUGIN_MARK_SHORT = "k:4 "; private static final String PLUGIN_MARK = "k:shop "; - private static final String PLACE_HOLDER = "AlphaFine"; + private static final String PLACE_HOLDER = Inter.getLocText("FR-Designer_AlphaFine"); private AlphaFineTextField searchTextField; private UIButton closeButton; @@ -168,7 +168,7 @@ public class AlphaFineDialog extends UIDialog { * 初始化输入框 */ private void initSearchTextField() { - searchTextField = new AlphaFineTextField(Inter.getLocText("FR-Designer_AlphaFine")); + searchTextField = new AlphaFineTextField(PLACE_HOLDER); initTextFieldKeyListener(); searchTextField.setFont(AlphaFineConstants.GREATER_FONT); searchTextField.setBackground(Color.white); From 19303658da7de628bc3303f32b056cae45d7679f Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Fri, 14 Jul 2017 10:13:43 +0800 Subject: [PATCH 2/4] =?UTF-8?q?PFC-607=20=E6=8F=92=E4=BB=B6=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=88=A0=E9=99=A4=E6=9B=B4=E6=96=B0=E4=B8=8D=E9=87=8D?= =?UTF-8?q?=E5=90=AF=E6=94=AF=E6=8C=81=20=E8=A7=A3=E5=86=B3SandboxCollecti?= =?UTF-8?q?on=EF=BC=8C=E4=B8=8D=E5=85=B3=E9=97=AD=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E5=B0=B1=E6=97=A0=E6=B3=95GC=E7=9B=B8=E5=85=B3=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82=E6=94=B9=E6=88=90?= =?UTF-8?q?=E4=BA=86=E5=9C=A8=E5=86=85=E9=83=A8=E7=B1=BB=E4=B8=AD=E5=8F=AA?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E4=B8=80=E4=B8=AAID=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E5=85=B7=E4=BD=93=E7=9A=84=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/DesignerEnvManager.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/designer_base/src/com/fr/design/DesignerEnvManager.java b/designer_base/src/com/fr/design/DesignerEnvManager.java index 5658a318d..536574f9c 100644 --- a/designer_base/src/com/fr/design/DesignerEnvManager.java +++ b/designer_base/src/com/fr/design/DesignerEnvManager.java @@ -152,17 +152,19 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { designerEnvManager.setCurEnvName(name); } } + + GeneralContext.addEnvChangedListener(new EnvChangedListener() { + @Override + public void envChanged() { + + designerEnvManager.setCurrentDirectoryPrefix(FILEFactory.ENV_PREFIX); + designerEnvManager.setDialogCurrentDirectory(ProjectConstants.REPORTLETS_NAME); + } + }); + } - GeneralContext.addEnvChangedListener(new EnvChangedListener() { - @Override - public void envChanged() { - - designerEnvManager.setCurrentDirectoryPrefix(FILEFactory.ENV_PREFIX); - designerEnvManager.setDialogCurrentDirectory(ProjectConstants.REPORTLETS_NAME); - } - }); - + return designerEnvManager; } From 1aceeba735c8afb2271cf5874742e5fb78bd1f1b Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 17 Jul 2017 15:42:08 +0800 Subject: [PATCH 3/4] =?UTF-8?q?REPORT-1013=20=E7=94=A8log4j=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=97=A5=E5=BF=97.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/DesignerEnvManager.java | 2 +- .../loghandler/DesignerLogAppendThread.java | 60 +++++++++++++++++++ .../loghandler/DesignerLogHandler.java | 24 ++------ .../com/fr/design/module/DesignModule.java | 6 +- 4 files changed, 70 insertions(+), 22 deletions(-) create mode 100644 designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogAppendThread.java diff --git a/designer_base/src/com/fr/design/DesignerEnvManager.java b/designer_base/src/com/fr/design/DesignerEnvManager.java index 536574f9c..d02d41abf 100644 --- a/designer_base/src/com/fr/design/DesignerEnvManager.java +++ b/designer_base/src/com/fr/design/DesignerEnvManager.java @@ -28,7 +28,7 @@ import java.util.List; import java.util.Map.Entry; import java.util.logging.FileHandler; import java.util.logging.Handler; -import java.util.logging.Level; +import org.apache.log4j.Level; /** * The manager of Designer GUI. diff --git a/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogAppendThread.java b/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogAppendThread.java new file mode 100644 index 000000000..0d374bdfe --- /dev/null +++ b/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogAppendThread.java @@ -0,0 +1,60 @@ +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) { + + } + } + } +} diff --git a/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java b/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java index e45ade484..ddf301fd2 100644 --- a/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java +++ b/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java @@ -18,15 +18,14 @@ import java.awt.*; import java.awt.event.*; import java.text.SimpleDateFormat; import java.util.Date; -import java.util.logging.Handler; import java.util.logging.LogRecord; import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; public class DesignerLogHandler { - protected static final int INFO_INT = FRLogLevel.INFO.intValue(); - protected static final int ERRO_INT = FRLogLevel.ERROR.intValue(); - protected static final int SERVER_INT = FRLogLevel.SEVERE.intValue(); + protected static final int INFO_INT = FRLogLevel.INFO.toInt(); + protected static final int ERRO_INT = FRLogLevel.ERROR.toInt(); + protected static final int SERVER_INT = FRLogLevel.SEVERE.toInt(); private static final int GAP_X = -150; private static final int INFO_GAP_Y = -60; private static final int ERRO_GAP_Y = -40; @@ -91,7 +90,7 @@ public class DesignerLogHandler { @Override public void actionPerformed(ActionEvent e) { JPopupMenu showsetPopup = new JPopupMenu(); - int logLevelvalue = DesignerEnvManager.getEnvManager().getLogLevel().intValue(); + int logLevelvalue = DesignerEnvManager.getEnvManager().getLogLevel().toInt(); if (logLevelvalue <= INFO_INT) { showsetPopup.add(showInfo); showsetPopup.add(showError); @@ -169,21 +168,6 @@ public class DesignerLogHandler { } } }); - - // 写到日志面板上面的Log和日志工具栏 - FRContext.getLogger().addLogHandler(new Handler() { - public void publish(LogRecord logRecord) { - Date date = new Date(); - LogRecordTime logRecordTime = new LogRecordTime(date, logRecord); - printStackTrace(logRecordTime); - } - - public void flush() { - } - - public void close() { - } - }); } private JTextPane initLogJTextArea() { diff --git a/designer_base/src/com/fr/design/module/DesignModule.java b/designer_base/src/com/fr/design/module/DesignModule.java index f04aa5474..1929452b9 100644 --- a/designer_base/src/com/fr/design/module/DesignModule.java +++ b/designer_base/src/com/fr/design/module/DesignModule.java @@ -12,11 +12,11 @@ import com.fr.design.javascript.JavaScriptImplPane; import com.fr.design.javascript.ParameterJavaScriptPane; import com.fr.design.mainframe.App; import com.fr.design.mainframe.DesignerFrame; +import com.fr.design.mainframe.loghandler.DesignerLogAppendThread; import com.fr.general.Inter; import com.fr.general.ModuleContext; import com.fr.js.*; import com.fr.module.TopModule; -import com.fr.stable.ArrayUtils; import com.fr.stable.bridge.StableFactory; import com.fr.stable.plugin.ExtraDesignClassManagerProvider; @@ -45,6 +45,10 @@ public abstract class DesignModule extends TopModule { ActionFactory.registerCellInsertActionClass(actionsForInsertCellElement()); ActionFactory.registerFloatInsertActionClass(actionsForInsertFloatElement()); DesignModuleFactory.registerCreators4Hyperlink(hyperlinkTypes()); + + // 将log4j日志输出到设计器日志面板的线程. + DesignerLogAppendThread logTread = new DesignerLogAppendThread(); + logTread.start(); } public boolean isStarted() { From e2790a4cc8ffb16c10998e2b0343c88c4d70ef19 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 17 Jul 2017 15:45:51 +0800 Subject: [PATCH 4/4] utf8 --- .../loghandler/DesignerLogAppendThread.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogAppendThread.java b/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogAppendThread.java index 0d374bdfe..12d281627 100644 --- a/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogAppendThread.java +++ b/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogAppendThread.java @@ -23,25 +23,25 @@ public class DesignerLogAppendThread extends Thread{ public DesignerLogAppendThread() { Logger root = Logger.getRootLogger(); - // ȡӼ¼Դ + // 获取子记录器的输出源 Appender appender = root.getAppender("design"); - // һδӵܵ + // 定义一个未连接的输入流管道 reader = new PipedReader(); - // һӵӵreader + // 定义一个已连接的输出流管理,并连接到reader Writer writer = null; try { writer = new PipedWriter(reader); - // appender + // 设置 appender 输出流 ((WriterAppender) appender).setWriter(writer); } catch (Throwable e) { } } public void run() { - // ϵɨ + // 不间断地扫描输入流 Scanner scanner = new Scanner(reader); - // ɨ赽ַӡĿ + // 将扫描到的字符流打印在屏目 while (scanner.hasNext()) { try { Thread.sleep(100);