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 28d70e5b7a..25506cbcc2 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 5a1c892201..074279e7cc 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 0000000000..3d7cf2514a 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 0000000000..dd04302fc1 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 0000000000..6242e61944 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 0000000000..2d4c9b2620 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 0000000000..a4734fb91c 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 5658a318dc..d02d41abf4 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 8cbd876a22..11d84d53c6 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 9d5a8a9fe9..a8342d3b43 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 61912d31c9..f0696de3df 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 6ed80f9d04..e1461903ae 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/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index 9aaa4f6fb8..aac6850767 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -8,14 +8,18 @@ import com.fr.design.gui.icontainer.UIEastResizableContainer; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; import com.fr.general.Inter; +import com.fr.stable.StringUtils; +import com.fr.third.fr.pdf.kernel.utils.CompareTool; import javax.swing.*; import javax.swing.border.EmptyBorder; import java.awt.*; import java.awt.event.*; import java.util.*; +import java.util.List; public class EastRegionContainerPane extends UIEastResizableContainer { private static EastRegionContainerPane THIS; @@ -446,7 +450,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public JComponent generateContentPane() { JComponent contentPane = new JPanel(); - JButton testBtn = new JButton(name); + UIButton testBtn = new UIButton(name); testBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -616,11 +620,84 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private static final int MAX_X_SHIFT = 50; private static final int MAX_Y_SHIFT = 50; - private static final String NO_BUTTON = "NoButton"; private static final String UP_BUTTON = "UpButton"; private static final String DOWN_BUTTON = "DownButton"; + private MouseListener mouseListener = new MouseAdapter() { + @Override + public void mouseExited(MouseEvent e) { + setCursor(Cursor.getDefaultCursor()); + if (mouseDownCompCoords == null) { + setBackground(originColor); + } + model = UIConstants.MODEL_NORMAL; + repaint(); + } + @Override + public void mouseClicked(MouseEvent e) { + if (e.getX() >= ARROW_RANGE_START) { + onPop(); + } + } + @Override + public void mouseReleased(MouseEvent e) { + mouseDownCompCoords = null; + if (!getBounds().contains(e.getPoint())) { + setBackground(originColor); + } + } + @Override + public void mousePressed(MouseEvent e) { + if (e.getX() < ARROW_RANGE_START) { + mouseDownCompCoords = e.getPoint(); + } + } + }; + + private MouseMotionListener mouseMotionListener = new MouseMotionListener() { + @Override + public void mouseMoved(MouseEvent e) { + if (e.getX() >= ARROW_RANGE_START) { + setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + model = UIConstants.MODEL_PRESS; + } else if (isMovable) { + setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); + setBackground(Color.pink); + } else { + setCursor(Cursor.getDefaultCursor()); + model = UIConstants.MODEL_NORMAL; + } + repaint(); + } + @Override + public void mouseDragged(MouseEvent e) { + if (isMovable && mouseDownCompCoords != null) { + Point currCoords = e.getLocationOnScreen(); + int x = currCoords.x - mouseDownCompCoords.x; + int y = currCoords.y - mouseDownCompCoords.y; + //屏幕可用区域 + Rectangle screen = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); + + int minY = screen.y; + int maxX = Toolkit.getDefaultToolkit().getScreenSize().width - MAX_X_SHIFT; + int maxY = Toolkit.getDefaultToolkit().getScreenSize().height - MAX_Y_SHIFT; + if (x < MIN_X) { + x = MIN_X; + } else if (x > maxX) { + x = maxX; + } + if (y < minY) { + y = minY; + } else if (y > maxY) { + y = maxY; + } + // 移动到屏幕边缘时,需要校正位置 + parentDialog.setLocation(x, y); + } + } + }; + public PopupToolPane(PropertyItem propertyItem) { this(propertyItem, NO_BUTTON); } @@ -647,94 +724,15 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private void initToolButton(final String buttonType) { this.buttonType = buttonType; - if (buttonType.equals(NO_BUTTON)) { + if (StringUtils.isEmpty(buttonType) || buttonType.equals(NO_BUTTON)) { return; } - - if (buttonType.equals(DOWN_BUTTON)) { - - } else if (buttonType.equals(UP_BUTTON)) { - - } else { + // validate + if (!buttonType.equals(UP_BUTTON) && !buttonType.equals(DOWN_BUTTON)) { throw new IllegalArgumentException("unknown button type: " + buttonType); } - - addMouseMotionListener(new MouseMotionListener() { - @Override - public void mouseMoved(MouseEvent e) { - if (e.getX() >= ARROW_RANGE_START) { - setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - model = UIConstants.MODEL_PRESS; - } else if (isMovable) { - setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); - setBackground(Color.pink); - } else { - setCursor(Cursor.getDefaultCursor()); - model = UIConstants.MODEL_NORMAL; - } - repaint(); - } - - @Override - public void mouseDragged(MouseEvent e) { - if (isMovable && mouseDownCompCoords != null) { - Point currCoords = e.getLocationOnScreen(); - int x = currCoords.x - mouseDownCompCoords.x; - int y = currCoords.y - mouseDownCompCoords.y; - //屏幕可用区域 - Rectangle screen = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); - - int minY = screen.y; - int maxX = Toolkit.getDefaultToolkit().getScreenSize().width - MAX_X_SHIFT; - int maxY = Toolkit.getDefaultToolkit().getScreenSize().height - MAX_Y_SHIFT; - if (x < MIN_X) { - x = MIN_X; - } else if (x > maxX) { - x = maxX; - } - if (y < minY) { - y = minY; - } else if (y > maxY) { - y = maxY; - } - // 移动到屏幕边缘时,需要校正位置 - parentDialog.setLocation(x, y); - } - } - }); - addMouseListener(new MouseAdapter() { - @Override - public void mouseExited(MouseEvent e) { - setCursor(Cursor.getDefaultCursor()); - if (mouseDownCompCoords == null) { - setBackground(originColor); - } - model = UIConstants.MODEL_NORMAL; - repaint(); - } - - @Override - public void mouseClicked(MouseEvent e) { - if (e.getX() >= ARROW_RANGE_START) { - onPop(); - } - } - - @Override - public void mouseReleased(MouseEvent e) { - mouseDownCompCoords = null; - if (!getBounds().contains(e.getPoint())) { - setBackground(originColor); - } - } - @Override - public void mousePressed(MouseEvent e) { - if (e.getX() < ARROW_RANGE_START) { - mouseDownCompCoords = e.getPoint(); - } - } - - }); + addMouseMotionListener(mouseMotionListener); + addMouseListener(mouseListener); } // 触发弹入、弹出 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 0000000000..12d2816276 --- /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 e45ade484a..ddf301fd28 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 f04aa54741..1929452b99 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 a178150921..4ef8d61e16 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());