XiaXiang
8 years ago
12 changed files with 315 additions and 77 deletions
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 185 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 14 KiB |
@ -0,0 +1,52 @@
|
||||
package com.fr.design.actions.help.AlphaFine; |
||||
|
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.UIDialog; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
|
||||
import java.awt.*; |
||||
import java.awt.event.*; |
||||
|
||||
/** |
||||
* Created by XiaXiang on 2017/5/26. |
||||
*/ |
||||
public class RemindDialog extends UIDialog { |
||||
private RemindPane remindPane; |
||||
private static final int WIDTH = 600; |
||||
private static final int HEIGHT = 400; |
||||
public RemindDialog(Frame parent) { |
||||
super(parent); |
||||
setUndecorated(true); |
||||
setSize(WIDTH, HEIGHT); |
||||
initComponent(); |
||||
GUICoreUtils.centerWindow(this); |
||||
} |
||||
|
||||
private void initComponent() { |
||||
final AlphafineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphafineConfigManager(); |
||||
remindPane = new RemindPane(manager); |
||||
remindPane.navigateButton.addMouseListener(new MouseAdapter() { |
||||
@Override |
||||
public void mouseClicked(MouseEvent e) { |
||||
dispose(); |
||||
manager.setOperateCount(0); |
||||
} |
||||
}); |
||||
this.add(remindPane); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void checkValid() throws Exception { |
||||
|
||||
} |
||||
|
||||
public RemindPane getRemindPane() { |
||||
return remindPane; |
||||
} |
||||
|
||||
public void setRemindPane(RemindPane remindPane) { |
||||
this.remindPane = remindPane; |
||||
} |
||||
} |
@ -0,0 +1,129 @@
|
||||
package com.fr.design.actions.help.AlphaFine; |
||||
|
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.general.IOUtils; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.MouseAdapter; |
||||
import java.awt.event.MouseEvent; |
||||
|
||||
/** |
||||
* Created by XiaXiang on 2017/5/26. |
||||
*/ |
||||
public class RemindPane extends JPanel { |
||||
public static final Font MEDIUM_FONT = new Font("Song_TypeFace", 0, 12); |
||||
public static final Font LARGE_FONT = new Font("Song_TypeFace", 0, 18); |
||||
private UIButton openButton; |
||||
private JPanel backgroundPane; |
||||
private UILabel backgroundLabel; |
||||
private UILabel checkLabel; |
||||
private Icon checkIcon = IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/check.png"); |
||||
private Icon unCheckIcon = IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/uncheck.png"); |
||||
private Icon closeIcon = IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/remind_close.png"); |
||||
private Icon labelIcon = IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/remind.png"); |
||||
private Icon openIcon = IOUtils.readIcon("com/fr/design/mainframe/alphafine/images/open.png"); |
||||
public JComponent navigateButton = new JComponent() { |
||||
protected void paintComponent(Graphics g) { |
||||
closeIcon.paintIcon(this, g, 0, 0); |
||||
} |
||||
}; |
||||
|
||||
public RemindPane(AlphafineConfigManager manager) { |
||||
this.setPreferredSize(new Dimension(600, 400)); |
||||
initUI(manager); |
||||
this.setLayout(getAbsoluteLayout()); |
||||
} |
||||
|
||||
private void initUI(final AlphafineConfigManager manager) { |
||||
openButton = new UIButton() { |
||||
@Override |
||||
public void paintComponent(Graphics g) { |
||||
g.setColor( Color.white ); |
||||
g.fillRect(0, 0, getSize().width, getSize().height); |
||||
super.paintComponent(g); |
||||
} |
||||
}; |
||||
openButton.setContentAreaFilled(false); |
||||
openButton.setForeground(new Color(0x3394F0)); |
||||
openButton.setIcon(openIcon); |
||||
openButton.setFont(LARGE_FONT); |
||||
openButton.set4ToolbarButton(); |
||||
openButton.addMouseListener(new MouseAdapter() { |
||||
@Override |
||||
public void mouseClicked(MouseEvent e) { |
||||
|
||||
|
||||
} |
||||
}); |
||||
backgroundLabel = new UILabel(Inter.getLocText("FR-Designer-Alphafine_No_Remind")); |
||||
backgroundLabel.setFont(MEDIUM_FONT); |
||||
backgroundLabel.setForeground(Color.white); |
||||
checkLabel = new UILabel(); |
||||
checkLabel.setIcon(unCheckIcon); |
||||
checkLabel.addMouseListener(new MouseAdapter() { |
||||
private boolean isCheck = false; |
||||
|
||||
@Override |
||||
public void mouseClicked(MouseEvent e) { |
||||
if (isCheck) { |
||||
checkLabel.setIcon(unCheckIcon); |
||||
manager.setNeedRemind(true); |
||||
isCheck = false; |
||||
} else { |
||||
checkLabel.setIcon(checkIcon); |
||||
manager.setNeedRemind(false); |
||||
isCheck = true; |
||||
} |
||||
} |
||||
}); |
||||
backgroundPane = new JPanel(new BorderLayout()); |
||||
backgroundPane.add(new UILabel(labelIcon), BorderLayout.CENTER); |
||||
add(navigateButton, 0); |
||||
add(checkLabel, 1); |
||||
add(openButton, 2); |
||||
add(backgroundLabel, 3); |
||||
add(backgroundPane, 4); |
||||
} |
||||
|
||||
/** |
||||
* 控件排列用绝对布局 |
||||
* @return |
||||
*/ |
||||
protected LayoutManager getAbsoluteLayout() { |
||||
return new LayoutManager() { |
||||
|
||||
@Override |
||||
public void removeLayoutComponent(Component comp) { |
||||
} |
||||
|
||||
@Override |
||||
public Dimension preferredLayoutSize(Container parent) { |
||||
return parent.getPreferredSize(); |
||||
} |
||||
|
||||
@Override |
||||
public Dimension minimumLayoutSize(Container parent) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void layoutContainer(Container parent) { |
||||
int width = parent.getWidth(); |
||||
int height = parent.getHeight(); |
||||
navigateButton.setBounds((width - 30), 0, 30, 30); |
||||
openButton.setBounds(30, 300, 150, 40); |
||||
backgroundLabel.setBounds(95, 350, 100, 20); |
||||
checkLabel.setBounds(70, 350, 20, 20); |
||||
backgroundPane.setBounds(0, 0, width, height); |
||||
} |
||||
|
||||
@Override |
||||
public void addLayoutComponent(String name, Component comp) { |
||||
} |
||||
}; |
||||
} |
||||
|
||||
} |
@ -1,59 +1,59 @@
|
||||
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()); |
||||
String log = ""; |
||||
//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()); |
||||
String log = ""; |
||||
//TemplateInfoCollector.appendProcess(log); |
||||
|
||||
} |
||||
//同上 |
||||
before(Object v, int r, int c) : onSetValueAt(v, r, c) { |
||||
SourceLocation sl = thisJoinPoint.getSourceLocation(); |
||||
|
||||
//String log = String.format("%s:\n%s\nset value: %s at (%d, %d)\n\n", new Date(), sl, v, r, c); |
||||
String log = ""; |
||||
//TemplateInfoCollector.appendProcess(log); |
||||
|
||||
} |
||||
|
||||
|
||||
} |
||||
//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()); |
||||
// String log = ""; |
||||
// //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()); |
||||
// String log = ""; |
||||
// //TemplateInfoCollector.appendProcess(log); |
||||
// |
||||
// } |
||||
// //同上 |
||||
// before(Object v, int r, int c) : onSetValueAt(v, r, c) { |
||||
// SourceLocation sl = thisJoinPoint.getSourceLocation(); |
||||
// |
||||
// //String log = String.format("%s:\n%s\nset value: %s at (%d, %d)\n\n", new Date(), sl, v, r, c); |
||||
// String log = ""; |
||||
// //TemplateInfoCollector.appendProcess(log); |
||||
// |
||||
// } |
||||
// |
||||
// |
||||
//} |
||||
|
Loading…
Reference in new issue