You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.7 KiB
54 lines
1.7 KiB
package com.tptj.demo.hg.menu.handler; |
|
|
|
import com.fr.base.svg.IconUtils; |
|
import com.fr.design.actions.JTemplateAction; |
|
import com.fr.design.dialog.*; |
|
import com.fr.design.mainframe.DesignerContext; |
|
import com.fr.design.mainframe.JTemplate; |
|
import com.fr.intelli.record.Focus; |
|
import com.fr.record.analyzer.EnableMetrics; |
|
import com.fr.report.fit.FitProvider; |
|
|
|
import java.awt.*; |
|
import java.awt.event.ActionEvent; |
|
|
|
/** |
|
* @author 秃破天际 |
|
* @version 10.0 |
|
* Created by 秃破天际 on 2021-05-20 |
|
**/ |
|
@EnableMetrics |
|
public class DemoAction extends JTemplateAction { |
|
private static final Dimension MEDIUM = new Dimension(430, 400); |
|
public DemoAction(JTemplate template) { |
|
super(template); |
|
setName("Demo"); |
|
setSmallIcon(IconUtils.readIcon("com/tptj/demo/hg/menu/resources/image/demo.png")); |
|
} |
|
|
|
@Override |
|
@Focus(id="com.tptj.demo.hg.menu.handler.v10",text = "MenuHandler") |
|
public void actionPerformed(ActionEvent e) { |
|
JTemplate jwb = getEditingComponent(); |
|
if ( null == jwb ) { |
|
return; |
|
} |
|
//当前的模板 |
|
FitProvider wbTpl = (FitProvider) jwb.getTarget(); |
|
if( jwb.isJWorkBook() ){ |
|
//如果是cpt |
|
}else{ |
|
//不是cpt |
|
} |
|
DemoPane pane = new DemoPane(); |
|
UIDialog dialog = pane.showUnsizedWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
|
@Override |
|
public void doOk() { |
|
//做某些操作 从 pane中读取相关的交互结果设置到当前的模板中一般是这样 |
|
jwb.fireTargetModified(); |
|
} |
|
}); |
|
dialog.setSize(MEDIUM); |
|
dialog.setVisible(true); |
|
} |
|
}
|
|
|