plough
7 years ago
9 changed files with 91 additions and 46 deletions
@ -1,48 +1,54 @@
|
||||
package com.fr.design.actions.report; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.IconManager; |
||||
import com.fr.base.iofileattr.WatermarkAttrMark; |
||||
import com.fr.design.actions.JWorkBookAction; |
||||
import com.fr.design.actions.ReportComponentAction; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.mainframe.ReportComponent; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.design.report.WatermarkPane; |
||||
import com.fr.general.IOUtils; |
||||
import com.fr.main.TemplateWorkBook; |
||||
import com.fr.main.impl.WorkBook; |
||||
import com.fr.report.core.ReportUtils; |
||||
import com.fr.report.stable.ReportSettings; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* Created by plough on 2018/5/15. |
||||
*/ |
||||
public class ReportWatermarkAction extends ReportComponentAction<ReportComponent> { |
||||
|
||||
public ReportWatermarkAction(ReportComponent rc) { |
||||
super(rc); |
||||
public class ReportWatermarkAction extends JWorkBookAction { |
||||
public ReportWatermarkAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
this.setMenuKeySet(KeySetUtils.REPORT_WATERMARK); |
||||
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/watermark.png")); |
||||
this.setSearchText(new WatermarkPane()); |
||||
} |
||||
|
||||
/** |
||||
* 执行动作 |
||||
* @return 是否执行成功 |
||||
*/ |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
final ReportComponent reportPane = this.getEditingComponent(); |
||||
if (reportPane == null) { |
||||
return false; |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
final JWorkBook jwb = getEditingComponent(); |
||||
if (jwb == null) { |
||||
return; |
||||
} |
||||
final WorkBook wbTpl = jwb.getTarget(); |
||||
WatermarkAttrMark watermark = ReportUtils.getWatermarkFromIOFile(wbTpl); |
||||
|
||||
final WatermarkPane watermarkPane = new WatermarkPane(); |
||||
ReportSettings reportSettings = (ReportSettings) ReportUtils.getReportSettings(reportPane.getTemplateReport()); |
||||
watermarkPane.populate(reportSettings.getWatermark()); |
||||
watermarkPane.populate(watermark); |
||||
watermarkPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
||||
@Override |
||||
public void doOk() { |
||||
reportSettings.setWatermark(watermarkPane.update()); |
||||
reportPane.fireTargetModified(); |
||||
wbTpl.addAttrMark(watermarkPane.update()); |
||||
jwb.fireTargetModified(); |
||||
} |
||||
}).setVisible(true); |
||||
|
||||
return false; |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue