|
|
|
@ -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(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|