BrightSide Workbench Full Report + Source Code
org.turro.financials.document.action.CloneDocumentAction Class Reference
Inheritance diagram for org.turro.financials.document.action.CloneDocumentAction:
Collaboration diagram for org.turro.financials.document.action.CloneDocumentAction:

Public Member Functions

Object execute (Context context)
 
String getLabel ()
 
String getImage ()
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 39 of file CloneDocumentAction.java.

Member Function Documentation

◆ execute()

Object org.turro.financials.document.action.CloneDocumentAction.execute ( Context  context)

Definition at line 42 of file CloneDocumentAction.java.

42  {
43  final Document nd = new Document(),
44  doc = (Document) context.get("entity");
45  InputDialog.getInput(
46  Framework.getCurrent().getPage(),
47  I_.get("Change"),
48  new InputField[]{
49  new InputField("Contract", null, null, 0) {
50  @Override
51  protected HtmlBasedComponent createEditor() {
52  ContractCombobox ccb = new ContractCombobox();
53  ccb.setOnlyActive(true);
54  ccb.setDocumentDefinition(doc.getDocumentDefinition());
55  ccb.setObjectValue(doc.getContract());
56  return ccb;
57  }
58  },
59  new InputField("Date", null, null, 0) {
60  @Override
61  protected HtmlBasedComponent createEditor() {
62  return new DateboxShort((Date) Framework.getAttribute(this, "date"));
63  }
64  },
65  new InputField("Draft", (Boolean) Framework.getAttribute(this, "draft", false), null, 0)
66  }, new Command() {
67  @Override
68  public Object execute(Context context) {
69  InputField[] fields = (InputField[]) context.get("fields");
70  Contract contract = null;
71  Date date = null;
72  Boolean draft = false;
73  if (fields.length > 0) {
74  for (InputField f : fields) {
75  if ("Contract".equals(f.getLabel())) {
76  contract = (Contract) f.getValue();
77  } else if ("Date".equals(f.getLabel())) {
78  date = (Date) f.getValue();
79  Framework.setAttribute(this, "date", date);
80  } else if ("Draft".equals(f.getLabel())) {
81  draft = (Boolean) f.getValue();
82  Framework.setAttribute(this, "draft", draft);
83  }
84  }
85  if (contract != null) {
86  nd.setContract(contract);
87  nd.copyFrom(doc, nd.getContract().getId() != doc.getContract().getId());
88  if (date != null) {
89  nd.setDocumentDate(date);
90  nd.setReceiptDate(date);
91  }
92  if (draft != null) {
93  nd.setDraft(draft);
94  }
95  if (nd.getDocumentDefinition().isAutoNumbered()) {
96  nd.setDocumentNumber("");
97  }
98  FinancialsMenu.showDocument(nd);
99  }
100  }
101  return null;
102  }
103  });
104  return null;
105  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getImage()

String org.turro.financials.document.action.CloneDocumentAction.getImage ( )

Reimplemented from org.turro.action.AbstractAction.

Definition at line 113 of file CloneDocumentAction.java.

113  {
114  return "/_zul/images/document_clone.png";
115  }

◆ getLabel()

String org.turro.financials.document.action.CloneDocumentAction.getLabel ( )

Reimplemented from org.turro.action.AbstractAction.

Definition at line 108 of file CloneDocumentAction.java.

108  {
109  return I_.get("Clone document");
110  }
Here is the call graph for this function:

The documentation for this class was generated from the following file: