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