BrightSide Workbench Full Report + Source Code
IssueImpl.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2011 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 package org.turro.dossier.util;
19 
20 import org.turro.string.Strings;
21 import org.turro.dossier.entity.Dossier;
22 import org.turro.dossier.entity.Issue;
23 import org.turro.dossier.zul.menu.DossierMenu;
24 import org.turro.elephant.util.Images;
25 import org.turro.i18n.I_;
26 import org.turro.plugin.dossier.IDossier;
27 import org.turro.plugin.dossier.IIssue;
28 import org.turro.related.AbstractAddRelated;
29 import org.turro.related.IAddRelated;
30 import org.turro.related.RelatedNew;
31 import org.zkoss.zk.ui.HtmlBasedComponent;
32 
37 public class IssueImpl extends AbstractAddRelated implements IIssue {
38 
39  private String path, description;
40  private IDossier dossier;
41 
42  @Override
43  public String getDescription() {
44  return description;
45  }
46 
47  @Override
48  public IDossier getDossier() {
49  return dossier;
50  }
51 
52  @Override
53  public String getPath() {
54  return path;
55  }
56 
57  @Override
58  public void setDescription(String description) {
59  this.description = description;
60  }
61 
62  @Override
63  public void setDossier(IDossier dossier) {
64  this.dossier = dossier;
65  }
66 
67  @Override
68  public void setPath(String path) {
69  this.path = path;
70  }
71 
72  @Override
73  protected HtmlBasedComponent getComponent() {
74  RelatedNew rpn = new RelatedNew();
75  rpn.setEntity(this, I_.get("New Issue"), Images.getImage("issue_new"), "issue:new");
76  return rpn;
77  }
78 
79  @Override
80  protected void saveRelation(boolean showForm) {
81  if(Strings.isBlank(path)) return;
82  Dossier d = (Dossier) dossier.getEntity();
83  if(d == null) {
84  ((IAddRelated) dossier).save(false);
85  d = (Dossier) dossier.getEntity();
86  }
87  if(d != null) {
88  Issue issue = Issue.getDefaultIssue();
89  issue.setDossier(d);
90  issue.setDescription(description);
91  issue.getRelated().setRelatedPath(path);
92  DossierMenu.addInformation(issue, null);
93  } else {
94  // problems saving dossier
95  }
96  }
97 
98 }
void setDescription(String description)
Definition: Issue.java:154
static Issue getDefaultIssue()
Definition: Issue.java:503
void setDossier(Dossier dossier)
Definition: Issue.java:162
void setDossier(IDossier dossier)
Definition: IssueImpl.java:63
void setDescription(String description)
Definition: IssueImpl.java:58
void saveRelation(boolean showForm)
Definition: IssueImpl.java:80
HtmlBasedComponent getComponent()
Definition: IssueImpl.java:73
static void addInformation(Issue issue, final Command command)
static String getImage(String image)
Definition: Images.java:36
static String get(String msg)
Definition: I_.java:41
void setRelatedPath(String relatedPath)
void setEntity(IAddRelated entity, String label, String image, String role)
Definition: RelatedNew.java:42