plough
8 years ago
9 changed files with 358 additions and 2 deletions
@ -0,0 +1,73 @@
|
||||
package com.fr.aspectj.designer; |
||||
|
||||
/** |
||||
* 记录模板过程 |
||||
* Created by plough on 2017/3/3. |
||||
*/ |
||||
|
||||
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; |
||||
import org.aspectj.lang.reflect.SourceLocation; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.MouseEvent; |
||||
import java.util.Date; |
||||
|
||||
public aspect TemplateProcessTracker { |
||||
//声明一个pointcut,匹配你需要的方法 |
||||
pointcut onMouseClicked(MouseEvent e) : |
||||
execution(* mouseClicked(MouseEvent)) && args(e); |
||||
pointcut onMousePressed(MouseEvent e) : |
||||
execution(* mousePressed(MouseEvent)) && args(e); |
||||
pointcut onMouseReleased(MouseEvent e) : |
||||
execution(* mouseReleased(MouseEvent)) && args(e); |
||||
pointcut onActionPerformed(ActionEvent e) : |
||||
execution(* actionPerformed(ActionEvent)) && args(e); |
||||
pointcut onSetValueAt(Object v, int r, int c) : |
||||
execution(* setValueAt(java.lang.Object, int, int)) && args(v, r, c); |
||||
pointcut onSetValue4EditingElement(Object v) : |
||||
execution(* setValue4EditingElement(java.lang.Object)) && args(v); |
||||
|
||||
//before表示之前的意思 |
||||
//这整个表示在MouseAdapter的public void mouseXXX(MouseEvent)方法调用之前,你想要执行的代码 |
||||
before(MouseEvent e) : onMouseClicked(e) || onMousePressed(e) || onMouseReleased(e) { |
||||
SourceLocation sl = thisJoinPoint.getSourceLocation();//切面对应的代码位置 |
||||
|
||||
String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); |
||||
TemplateInfoCollector.appendProcess(log); |
||||
} |
||||
//同上 |
||||
before(ActionEvent e) : onActionPerformed(e) { |
||||
SourceLocation sl = thisJoinPoint.getSourceLocation(); |
||||
// !within(LogHandlerBar) 没用, 手动过滤 |
||||
if (e.getSource().toString().contains("javax.swing.Timer")) { |
||||
return; |
||||
} |
||||
|
||||
String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); |
||||
TemplateInfoCollector.appendProcess(log); |
||||
|
||||
} |
||||
//同上 |
||||
before(Object v, int r, int c) : onSetValueAt(v, r, c) { |
||||
SourceLocation sl = thisJoinPoint.getSourceLocation(); |
||||
// !within(LogHandlerBar) 没用, 手动过滤 |
||||
// if (e.getSource().toString().contains("javax.swing.Timer")) { |
||||
// return; |
||||
// } |
||||
|
||||
String log = String.format("%s:\n%s\nset value: %s at (%d, %d)\n\n", new Date(), sl, v, r, c); |
||||
TemplateInfoCollector.appendProcess(log); |
||||
|
||||
} |
||||
//同上 |
||||
before(Object v) : onSetValue4EditingElement(v) { |
||||
SourceLocation sl = thisJoinPoint.getSourceLocation(); |
||||
|
||||
// String v = "test"; |
||||
String log = String.format("%s:\n%s\nset value: %s\n\n", new Date(), sl, v); |
||||
TemplateInfoCollector.appendProcess(log); |
||||
|
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,61 @@
|
||||
package com.fr.aspectj.designerbase; |
||||
|
||||
/** |
||||
* 记录模板过程 |
||||
* Created by plough on 2017/3/3. |
||||
*/ |
||||
|
||||
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; |
||||
import org.aspectj.lang.reflect.SourceLocation; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.MouseEvent; |
||||
import java.util.Date; |
||||
|
||||
public aspect TemplateProcessTracker { |
||||
//声明一个pointcut,匹配你需要的方法 |
||||
pointcut onMouseClicked(MouseEvent e) : |
||||
execution(* mouseClicked(MouseEvent)) && args(e); |
||||
pointcut onMousePressed(MouseEvent e) : |
||||
execution(* mousePressed(MouseEvent)) && args(e); |
||||
pointcut onMouseReleased(MouseEvent e) : |
||||
execution(* mouseReleased(MouseEvent)) && args(e); |
||||
pointcut onActionPerformed(ActionEvent e) : |
||||
execution(* actionPerformed(ActionEvent)) && args(e); |
||||
pointcut onSetValueAt(Object v, int r, int c) : |
||||
execution(* setValueAt(java.lang.Object, int, int)) && args(v, r, c); |
||||
|
||||
//before表示之前的意思 |
||||
//这整个表示在MouseAdapter的public void mouseXXX(MouseEvent)方法调用之前,你想要执行的代码 |
||||
before(MouseEvent e) : onMouseClicked(e) || onMousePressed(e) || onMouseReleased(e) { |
||||
SourceLocation sl = thisJoinPoint.getSourceLocation();//切面对应的代码位置 |
||||
|
||||
String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); |
||||
TemplateInfoCollector.appendProcess(log); |
||||
} |
||||
//同上 |
||||
before(ActionEvent e) : onActionPerformed(e) { |
||||
SourceLocation sl = thisJoinPoint.getSourceLocation(); |
||||
// !within(LogHandlerBar) 没用, 手动过滤 |
||||
if (e.getSource().toString().contains("javax.swing.Timer")) { |
||||
return; |
||||
} |
||||
|
||||
String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); |
||||
TemplateInfoCollector.appendProcess(log); |
||||
|
||||
} |
||||
//同上 |
||||
before(Object v, int r, int c) : onSetValueAt(v, r, c) { |
||||
SourceLocation sl = thisJoinPoint.getSourceLocation(); |
||||
// !within(LogHandlerBar) 没用, 手动过滤 |
||||
// if (e.getSource().toString().contains("javax.swing.Timer")) { |
||||
// return; |
||||
// } |
||||
|
||||
String log = String.format("%s:\n%s\nset value: %s at (%d, %d)\n\n", new Date(), sl, v, r, c); |
||||
TemplateInfoCollector.appendProcess(log); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,71 @@
|
||||
//package com.fr.design.mainframe.templateinfo; |
||||
// |
||||
//import org.aspectj.lang.reflect.SourceLocation; |
||||
// |
||||
//import java.awt.event.ActionEvent; |
||||
//import java.awt.event.MouseEvent; |
||||
//import java.util.Date; |
||||
// |
||||
///** |
||||
// * 记录模板过程 |
||||
// * Created by plough on 2017/2/27. |
||||
// */ |
||||
//public aspect TemplateProcessTracker { |
||||
// //声明一个pointcut,匹配你需要的方法 |
||||
// pointcut onMouseClicked(MouseEvent e) : |
||||
// execution(* mouseClicked(MouseEvent)) && args(e); |
||||
// pointcut onMousePressed(MouseEvent e) : |
||||
// execution(* mousePressed(MouseEvent)) && args(e); |
||||
// pointcut onMouseReleased(MouseEvent e) : |
||||
// execution(* mouseReleased(MouseEvent)) && args(e); |
||||
// pointcut onActionPerformed(ActionEvent e) : |
||||
// execution(* actionPerformed(ActionEvent)) && args(e); |
||||
// pointcut onSetValueAt(Object v, int r, int c) : |
||||
// execution(* setValueAt(Object, int, int)) && args(v, r, c); |
||||
// pointcut onSetValue4EditingElement(Object v) : |
||||
// execution(* setValue4EditingElement(Object)) && args(v); |
||||
// |
||||
// //before表示之前的意思 |
||||
// //这整个表示在MouseAdapter的public void mouseXXX(MouseEvent)方法调用之前,你想要执行的代码 |
||||
// before(MouseEvent e) : onMouseClicked(e) || onMousePressed(e) || onMouseReleased(e) { |
||||
// SourceLocation sl = thisJoinPoint.getSourceLocation();//切面对应的代码位置 |
||||
// |
||||
// String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); |
||||
// TemplateInfoCollector.appendProcess(log); |
||||
// } |
||||
// //同上 |
||||
// before(ActionEvent e) : onActionPerformed(e) { |
||||
// SourceLocation sl = thisJoinPoint.getSourceLocation(); |
||||
// // !within(LogHandlerBar) 没用, 手动过滤 |
||||
// if (e.getSource().toString().contains("javax.swing.Timer")) { |
||||
// return; |
||||
// } |
||||
// |
||||
// String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); |
||||
// TemplateInfoCollector.appendProcess(log); |
||||
// |
||||
// } |
||||
// //同上 |
||||
// before(Object v, int r, int c) : onSetValueAt(v, r, c) { |
||||
// SourceLocation sl = thisJoinPoint.getSourceLocation(); |
||||
// // !within(LogHandlerBar) 没用, 手动过滤 |
||||
//// if (e.getSource().toString().contains("javax.swing.Timer")) { |
||||
//// return; |
||||
//// } |
||||
// |
||||
// String log = String.format("%s:\n%s\nset value: %s at (%d, %d)\n\n", new Date(), sl, v, r, c); |
||||
// TemplateInfoCollector.appendProcess(log); |
||||
// |
||||
// } |
||||
// //同上 |
||||
// before(Object v) : onSetValue4EditingElement(v) { |
||||
// SourceLocation sl = thisJoinPoint.getSourceLocation(); |
||||
// |
||||
//// String v = "test"; |
||||
// String log = String.format("%s:\n%s\nset value: %s\n\n", new Date(), sl, v); |
||||
// TemplateInfoCollector.appendProcess(log); |
||||
// |
||||
// } |
||||
// |
||||
// |
||||
//} |
@ -0,0 +1,56 @@
|
||||
package com.fr.aspectj.designerchart; |
||||
|
||||
/** |
||||
* Created by plough on 2017/3/3. |
||||
*/ |
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; |
||||
import org.aspectj.lang.reflect.SourceLocation; |
||||
|
||||
import javax.swing.event.ListSelectionEvent; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.MouseEvent; |
||||
import java.util.Date; |
||||
|
||||
public aspect TemplateProcessTracker { |
||||
//声明一个pointcut,匹配你需要的方法 |
||||
pointcut onMouseClicked(MouseEvent e) : |
||||
execution(* mouseClicked(MouseEvent)) && args(e); |
||||
pointcut onMousePressed(MouseEvent e) : |
||||
execution(* mousePressed(MouseEvent)) && args(e); |
||||
pointcut onMouseReleased(MouseEvent e) : |
||||
execution(* mouseReleased(MouseEvent)) && args(e); |
||||
pointcut onActionPerformed(ActionEvent e) : |
||||
execution(* actionPerformed(ActionEvent)) && args(e); |
||||
pointcut onChartUpdate(Chart c) : |
||||
execution(* update(Chart)) && args(c); |
||||
|
||||
//before表示之前的意思 |
||||
//这整个表示在MouseAdapter的public void mouseXXX(MouseEvent)方法调用之前,你想要执行的代码 |
||||
before(MouseEvent e) : onMouseClicked(e) || onMousePressed(e) || onMouseReleased(e) { |
||||
SourceLocation sl = thisJoinPoint.getSourceLocation();//切面对应的代码位置 |
||||
|
||||
String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); |
||||
TemplateInfoCollector.appendProcess(log); |
||||
} |
||||
//同上 |
||||
before(ActionEvent e) : onActionPerformed(e) { |
||||
SourceLocation sl = thisJoinPoint.getSourceLocation(); |
||||
// !within(LogHandlerBar) 没用, 手动过滤 |
||||
if (e.getSource().toString().contains("javax.swing.Timer")) { |
||||
return; |
||||
} |
||||
|
||||
String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); |
||||
TemplateInfoCollector.appendProcess(log); |
||||
|
||||
} |
||||
//同上 |
||||
before(Chart c) : onChartUpdate(c) { |
||||
SourceLocation sl = thisJoinPoint.getSourceLocation(); |
||||
String log = String.format("%s:\n%s\n插入新图表:%s\n\n", new Date(), sl, c.getChartName()); |
||||
TemplateInfoCollector.appendProcess(log); |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,60 @@
|
||||
package com.fr.aspectj.designerform; |
||||
|
||||
/** |
||||
* Created by plough on 2017/3/3. |
||||
*/ |
||||
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; |
||||
import org.aspectj.lang.reflect.SourceLocation; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.MouseEvent; |
||||
import java.util.Date; |
||||
|
||||
public aspect TemplateProcessTracker { |
||||
//声明一个pointcut,匹配你需要的方法 |
||||
pointcut onMouseClicked(MouseEvent e) : |
||||
execution(* mouseClicked(MouseEvent)) && args(e); |
||||
pointcut onMousePressed(MouseEvent e) : |
||||
execution(* mousePressed(MouseEvent)) && args(e); |
||||
pointcut onMouseReleased(MouseEvent e) : |
||||
execution(* mouseReleased(MouseEvent)) && args(e); |
||||
pointcut onActionPerformed(ActionEvent e) : |
||||
execution(* actionPerformed(ActionEvent)) && args(e); |
||||
pointcut onSetValueAt(Object v, int r, int c) : |
||||
execution(* setValueAt(java.lang.Object, int, int)) && args(v, r, c); |
||||
|
||||
//before表示之前的意思 |
||||
//这整个表示在MouseAdapter的public void mouseXXX(MouseEvent)方法调用之前,你想要执行的代码 |
||||
before(MouseEvent e) : onMouseClicked(e) || onMousePressed(e) || onMouseReleased(e) { |
||||
SourceLocation sl = thisJoinPoint.getSourceLocation();//切面对应的代码位置 |
||||
|
||||
String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); |
||||
TemplateInfoCollector.appendProcess(log); |
||||
} |
||||
//同上 |
||||
before(ActionEvent e) : onActionPerformed(e) { |
||||
SourceLocation sl = thisJoinPoint.getSourceLocation(); |
||||
// !within(LogHandlerBar) 没用, 手动过滤 |
||||
if (e.getSource().toString().contains("javax.swing.Timer")) { |
||||
return; |
||||
} |
||||
|
||||
String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); |
||||
TemplateInfoCollector.appendProcess(log); |
||||
|
||||
} |
||||
//同上 |
||||
before(Object v, int r, int c) : onSetValueAt(v, r, c) { |
||||
SourceLocation sl = thisJoinPoint.getSourceLocation(); |
||||
// !within(LogHandlerBar) 没用, 手动过滤 |
||||
// if (e.getSource().toString().contains("javax.swing.Timer")) { |
||||
// return; |
||||
// } |
||||
|
||||
String log = String.format("%s:\n%s\nset value: %s at (%d, %d)\n\n", new Date(), sl, v, r, c); |
||||
TemplateInfoCollector.appendProcess(log); |
||||
|
||||
} |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue