diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java b/designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java index 28d70e5b7..25506cbcc 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java @@ -28,13 +28,18 @@ public class ContentCellRender implements ListCellRenderer { panel.setBackground(null); panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); titleLabel.setText(" " + model.getName()); - String iconUrl = "/com/fr/design/mainframe/alphafine/images/alphafine" + model.getType().getTypeValue() + ".png"; if (model.hasAction()) { if (isSelected) { + String iconUrl = "/com/fr/design/mainframe/alphafine/images/selected" + model.getType().getTypeValue() + ".png"; panel.setBackground(AlphaFineConstants.BLUE); + titleLabel.setForeground(Color.white); + titleLabel.setIcon(new ImageIcon(IOUtils.readImage(iconUrl))); + } else { + String iconUrl = "/com/fr/design/mainframe/alphafine/images/alphafine" + model.getType().getTypeValue() + ".png"; + titleLabel.setIcon(new ImageIcon(IOUtils.readImage(iconUrl))); + titleLabel.setForeground(AlphaFineConstants.BLACK); } - titleLabel.setIcon(new ImageIcon(IOUtils.readImage(iconUrl))); - titleLabel.setForeground(AlphaFineConstants.BLACK); + } else { titleLabel.setIcon(null); titleLabel.setForeground(AlphaFineConstants.MEDIUM_GRAY); 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 5a1c89220..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; @@ -299,8 +299,12 @@ public class AlphaFineDialog extends UIDialog { leftSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT)); rightSearchResultPane = new JPanel(); rightSearchResultPane.setBackground(Color.white); + UILabel splitLine = new UILabel(); + splitLine.setBackground(AlphaFineConstants.GRAY); + splitLine.setPreferredSize(new Dimension(1, AlphaFineConstants.CONTENT_HEIGHT)); + rightSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH - 1, AlphaFineConstants.CONTENT_HEIGHT)); searchResultPane.add(leftSearchResultPane, BorderLayout.WEST); - rightSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT)); + searchResultPane.add(splitLine, BorderLayout.CENTER); searchResultPane.add(rightSearchResultPane, BorderLayout.EAST); UILabel splitLabel = new UILabel(); splitLabel.setBackground(AlphaFineConstants.GRAY); diff --git a/designer/src/com/fr/design/mainframe/alphafine/images/selected1.png b/designer/src/com/fr/design/mainframe/alphafine/images/selected1.png new file mode 100644 index 000000000..3d7cf2514 Binary files /dev/null and b/designer/src/com/fr/design/mainframe/alphafine/images/selected1.png differ diff --git a/designer/src/com/fr/design/mainframe/alphafine/images/selected2.png b/designer/src/com/fr/design/mainframe/alphafine/images/selected2.png new file mode 100644 index 000000000..dd04302fc Binary files /dev/null and b/designer/src/com/fr/design/mainframe/alphafine/images/selected2.png differ diff --git a/designer/src/com/fr/design/mainframe/alphafine/images/selected3.png b/designer/src/com/fr/design/mainframe/alphafine/images/selected3.png new file mode 100644 index 000000000..6242e6194 Binary files /dev/null and b/designer/src/com/fr/design/mainframe/alphafine/images/selected3.png differ diff --git a/designer/src/com/fr/design/mainframe/alphafine/images/selected4.png b/designer/src/com/fr/design/mainframe/alphafine/images/selected4.png new file mode 100644 index 000000000..2d4c9b262 Binary files /dev/null and b/designer/src/com/fr/design/mainframe/alphafine/images/selected4.png differ diff --git a/designer/src/com/fr/design/mainframe/alphafine/images/selected5.png b/designer/src/com/fr/design/mainframe/alphafine/images/selected5.png new file mode 100644 index 000000000..a4734fb91 Binary files /dev/null and b/designer/src/com/fr/design/mainframe/alphafine/images/selected5.png differ diff --git a/designer_base/src/com/fr/design/DesignerEnvManager.java b/designer_base/src/com/fr/design/DesignerEnvManager.java index 5658a318d..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. @@ -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; } diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index 0e51b4c21..227fc98f6 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -1999,7 +1999,7 @@ FR-Designer_Templates_Content=Templates Contents FR-Designer_AlphaFine_ShowAll=show all FR-Designer_AlphaFine_Latest=Latest FR-Designer_AlphaFine_ShowLess=show less -FR-Designer_Alphafine=AlphaFine +FR-Designer_AlphaFine=AlphaFine FR-Designer-Alphafine_No_Remind= FR-Designer_AlphaFine_NoResult=no results FR-Designer_ConnectionFailed=connection failed diff --git a/designer_base/src/com/fr/design/locale/designer_en_US.properties b/designer_base/src/com/fr/design/locale/designer_en_US.properties index 296dcbe7a..a89f4a1b7 100644 --- a/designer_base/src/com/fr/design/locale/designer_en_US.properties +++ b/designer_base/src/com/fr/design/locale/designer_en_US.properties @@ -1997,7 +1997,7 @@ FR-Designer_Templates_Content=Files'contents FR-Designer_AlphaFine_ShowAll=Show all FR-Designer_AlphaFine_Latest=Recent FR-Designer_AlphaFine_ShowLess=Show less -FR-Designer_Alphafine=AlphaFine +FR-Designer_AlphaFine=AlphaFine FR-Designer-Alphafine_No_Remind=don't remind FR-Designer_AlphaFine_NoResult=No results FR-Designer_ConnectionFailed=Connection failed diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index 1675df05e..63333e51f 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties @@ -1997,7 +1997,7 @@ FR-Designer_AlphaFine_ShowAll=\u663E\u793A\u5168\u90E8 FR-Designer_AlphaFine_Recommend=\u731C\u60A8\u9700\u8981 FR-Designer_AlphaFine_Latest=\u672C\u5730\u5E38\u7528 FR-Designer_AlphaFine_ShowLess=\u6536\u8D77 -FR-Designer_Alphafine=AlphaFine\u667A\u80FD\u641C\u7D22 +FR-Designer_AlphaFine=AlphaFine\u667A\u80FD\u641C\u7D22 FR-Designer-Alphafine_No_Remind=\u4E0D\u518D\u63D0\u793A FR-Designer_AlphaFine_NoResult=\u6682\u65E0\u76F8\u5173\u5185\u5BB9 FR-Designer_ConnectionFailed=\u94FE\u63A5\u5931\u8D25 diff --git a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties index 269d4e2e4..b454e4288 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties @@ -1997,7 +1997,7 @@ FR-Designer_Templates=\u6A21\u677F FR-Designer_Templates_Content=\u6A21\u677F\u5167\u5BB9 FR-Designer_AlphaFine_Latest=\u6700\u8FD1\u5E38\u7528 FR-Designer_AlphaFine_ShowLess=\u6536\u8D77 -FR-Designer_Alphafine=AlphaFine\u667A\u80FD\u641C\u7D22 +FR-Designer_AlphaFine=AlphaFine\u667A\u80FD\u641C\u7D22 FR-Designer_AlphaFine_ShowAll=\u986F\u793A\u5168\u90E8 FR-Designer-Alphafine_No_Remind=\u4E0D\u518D\u63D0\u793A FR-Designer_AlphaFine_NoResult=\u66AB\u7121\u76F8\u95DC\u5167\u5BB9 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..12d281627 --- /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() { diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java index a17815092..4ef8d61e1 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -2181,7 +2181,7 @@ public class RemoteEnv extends AbstractEnv { try { HashMap para = new HashMap(); para.put("op", "plugin"); - para.put("cmd", "get_states"); + para.put("cmd", "get_status"); para.put("current_uid", this.createUserID()); para.put("currentUsername", this.getUser());