BrightSide Workbench Full Report + Source Code
PrintDocumentAction.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2015 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.turro.financials.document.action;
20 
21 import org.turro.action.AbstractAction;
22 import org.turro.command.Context;
23 import org.turro.financials.document.DocumentReport;
24 import org.turro.financials.entity.Document;
25 import org.turro.i18n.I_;
26 
31 public class PrintDocumentAction extends AbstractAction {
32 
33  private final boolean sendMail;
34 
35  public PrintDocumentAction(boolean send) {
36  this.sendMail = send;
37  }
38 
39  @Override
40  public Object execute(Context context) {
41  Document doc = (Document) context.get("entity");
42  DocumentReport dr = new DocumentReport();
43  dr.setDocument(doc);
44  dr.setSendToParticipants(sendMail);
45  dr.doPrint();
46  return null;
47  }
48 
49  @Override
50  public String getLabel() {
51  if(sendMail) {
52  return I_.get("Send documents");
53  } else {
54  return I_.get("Print");
55  }
56  }
57 
58  @Override
59  public String getImage() {
60  if(sendMail) {
61  return "/_zul/images/mail_send.png";
62  } else {
63  return "/_zul/images/printer.png";
64  }
65  }
66 
67 }
void setSendToParticipants(boolean sendToParticipants)
static String get(String msg)
Definition: I_.java:41