forked from FR-Global/plugin-event-manager
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.
77 lines
2.9 KiB
77 lines
2.9 KiB
package com.fr.plugin.event.manager.core; |
|
|
|
import com.fr.base.BaseUtils; |
|
import com.fr.design.DesignModelAdapter; |
|
import com.fr.design.actions.JTemplateAction; |
|
import com.fr.design.dialog.FineJOptionPane; |
|
import com.fr.design.dialog.UIDialog; |
|
import com.fr.design.mainframe.DesignerContext; |
|
import com.fr.design.mainframe.JForm; |
|
import com.fr.design.mainframe.WidgetPropertyPane; |
|
import com.fr.form.main.Form; |
|
import com.fr.plugin.event.manager.ui.EventManagerDialog; |
|
import com.fr.plugin.event.manager.ui.EventManagerPane; |
|
import com.fr.plugin.event.manager.ui.FormEventManagerPane; |
|
import com.fr.plugin.event.manager.utils.KeySetUtils; |
|
import com.fr.plugin.transform.ExecuteFunctionRecord; |
|
|
|
import javax.swing.JOptionPane; |
|
import java.awt.event.ActionEvent; |
|
import java.awt.event.WindowAdapter; |
|
import java.awt.event.WindowEvent; |
|
|
|
|
|
/** |
|
* 决策报表下的事件管理器 |
|
* @author Joe |
|
* Created by Joe on 9/3/2020 |
|
*/ |
|
public class FormEventManager extends JTemplateAction<JForm> { |
|
|
|
public FormEventManager(JForm form) { |
|
super(form); |
|
this.setMenuKeySet(KeySetUtils.EVENT_MANAGER); |
|
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); |
|
this.setMnemonic(getMenuKeySet().getMnemonic()); |
|
this.setSmallIcon(BaseUtils.readIcon("/com/fr/plugin/event/manager/images/icon_event_manager.png")); |
|
} |
|
|
|
@Override |
|
@ExecuteFunctionRecord |
|
public void actionPerformed(ActionEvent e) { |
|
JForm jf = getEditingComponent(); |
|
if (jf == null) { |
|
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Plugin_Event_Manager_Alert_No_Target"), |
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.ERROR_MESSAGE); |
|
return; |
|
} |
|
|
|
final Form form = jf.getTarget(); |
|
final EventManagerPane eventManagerPane = initEventManagerPane(form); |
|
UIDialog dialog = new EventManagerDialog(DesignerContext.getDesignerFrame(), eventManagerPane); |
|
|
|
dialog.addWindowListener(new WindowAdapter() { |
|
@Override |
|
public void windowClosed(WindowEvent e) { |
|
eventManagerPane.update(); |
|
// 触发正在编辑的模板改变事件 |
|
DesignModelAdapter.getCurrentModelAdapter().fireTargetModified(); |
|
// 刷新一下右侧面板,避免事件显示不同步 |
|
WidgetPropertyPane.getInstance().refreshDockingView(); |
|
super.windowClosed(e); |
|
} |
|
}); |
|
dialog.setVisible(true); |
|
} |
|
|
|
/** |
|
* 初始化事件管理器面板 |
|
* @param form 当前表单对象 |
|
* @return |
|
*/ |
|
private EventManagerPane initEventManagerPane(Form form) { |
|
FormEventManagerPane eventManagerPane = new FormEventManagerPane(); |
|
eventManagerPane.setTarget(form); |
|
return eventManagerPane; |
|
} |
|
}
|
|
|