From c3ce3949aaf88a55e6ca12b77970919ca4aefe96 Mon Sep 17 00:00:00 2001 From: Yvan Date: Mon, 27 Jul 2020 15:01:23 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=8E=9F=E6=9C=AC=E8=BE=93=E5=87=BA=E7=9A=84?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E9=87=8C=EF=BC=8CWARN=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E4=B8=A5=E9=87=8D=EF=BC=8CERROR=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E5=AF=B9=E5=BA=94=E8=AD=A6=E5=91=8A=202.=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=90=8E=EF=BC=8CERROR=E6=A0=87=E7=AD=BE=E5=AF=B9?= =?UTF-8?q?=E5=BA=94=E4=B8=A5=E9=87=8D=EF=BC=8CWARN=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E8=AD=A6=E5=91=8A=EF=BC=8C=E5=B9=B6=E7=9B=B8?= =?UTF-8?q?=E5=BA=94=E7=9A=84=E4=BF=AE=E6=94=B9=E5=85=B6=E9=85=8D=E8=89=B2?= =?UTF-8?q?=E5=92=8C=E8=AE=A1=E6=95=B0=203.=E6=B7=BB=E5=8A=A0=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E5=B8=B8=E9=87=8F=EF=BC=8C=E4=BD=BF=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=9B=B4=E7=AC=A6=E5=90=88=E5=B8=86=E8=BD=AF=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../loghandler/DesignerLogHandler.java | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java index b935eb11e..1d67c47df 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java @@ -8,6 +8,7 @@ import com.fr.design.ui.util.UIUtil; import com.fr.general.ComparatorUtils; import com.fr.general.log.Log4jConfig; import com.fr.log.FineLoggerFactory; +import com.fr.stable.StringUtils; import com.fr.third.apache.log4j.Level; import com.fr.third.apache.log4j.spi.LoggingEvent; import com.fr.third.apache.log4j.spi.ThrowableInformation; @@ -53,12 +54,14 @@ public class DesignerLogHandler { private static final int SERVER_GAP_Y = -20; - private static final String ERROR_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert") + ":"; + private static final String ERROR_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Seriously") + ":"; - private static final String WARN_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Seriously") + ":"; + private static final String WARN_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert") + ":"; private static final String NORMAL_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Normal") + ":"; + private static final String ACTION_MAP_KEY = "clear"; + public static DesignerLogHandler getInstance() { return HOLDER.singleton; @@ -223,14 +226,14 @@ public class DesignerLogHandler { InputMap inputMap = resultPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), DefaultEditorKit.copyAction); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER), DefaultEditorKit.selectAllAction); - inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_L, DEFAULT_MODIFIER), "clear"); + inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_L, DEFAULT_MODIFIER), ACTION_MAP_KEY); ActionMap actionMap = resultPane.getActionMap(); - actionMap.put("clear", new AbstractAction() { + actionMap.put(ACTION_MAP_KEY, new AbstractAction() { @Override public void actionPerformed(ActionEvent evt) { - resultPane.setText(""); + resultPane.setText(StringUtils.EMPTY); caption.clearMessage(); } }); @@ -293,10 +296,10 @@ public class DesignerLogHandler { SimpleAttributeSet attrSet = new SimpleAttributeSet(); if (style == DesignerLogger.ERROR_INT) { - StyleConstants.setForeground(attrSet, new Color(247, 148, 29)); + StyleConstants.setForeground(attrSet, Color.RED); StyleConstants.setBold(attrSet, true); } else if (style == DesignerLogger.WARN_INT) { - StyleConstants.setForeground(attrSet, Color.red); + StyleConstants.setForeground(attrSet, new Color(247, 148, 29)); StyleConstants.setBold(attrSet, true); } else if (style == DesignerLogger.INFO_INT) { StyleConstants.setForeground(attrSet, Color.black); @@ -330,9 +333,9 @@ public class DesignerLogHandler { LogMessageBar.getInstance().setMessage(message); if (level == DesignerLogger.INFO_INT && showInfo.isSelected()) { caption.infoAdd(); - } else if (level == DesignerLogger.ERROR_INT && showError.isSelected()) { + } else if (level == DesignerLogger.WARN_INT && showError.isSelected()) { caption.errorAdd(); - } else if (level == DesignerLogger.WARN_INT && showServer.isSelected()) { + } else if (level == DesignerLogger.ERROR_INT && showServer.isSelected()) { caption.serverAdd(); } } @@ -343,7 +346,7 @@ public class DesignerLogHandler { this.copy.setEnabled(true); this.clear.setEnabled(true); - if (ComparatorUtils.equals(this.jTextArea.getText(), "")) { + if (ComparatorUtils.equals(this.jTextArea.getText(), StringUtils.EMPTY)) { this.selectAll.setEnabled(false); this.clear.setEnabled(false); } @@ -367,7 +370,7 @@ public class DesignerLogHandler { } else if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.copy.getText())) { LogHandlerArea.this.jTextArea.copy(); } else if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.clear.getText())) { - LogHandlerArea.this.jTextArea.setText(""); + LogHandlerArea.this.jTextArea.setText(StringUtils.EMPTY); caption.clearMessage(); } }