View Javadoc
1   package fr.ifremer.tutti.ui.swing.util.attachment;
2   
3   /*
4    * #%L
5    * Tutti :: UI
6    * $Id:$
7    * $HeadURL:$
8    * %%
9    * Copyright (C) 2012 - 2015 Ifremer
10   * %%
11   * This program is free software: you can redistribute it and/or modify
12   * it under the terms of the GNU General Public License as
13   * published by the Free Software Foundation, either version 3 of the
14   * License, or (at your option) any later version.
15   * 
16   * This program is distributed in the hope that it will be useful,
17   * but WITHOUT ANY WARRANTY; without even the implied warranty of
18   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19   * GNU General Public License for more details.
20   * 
21   * You should have received a copy of the GNU General Public
22   * License along with this program.  If not, see
23   * <http://www.gnu.org/licenses/gpl-3.0.html>.
24   * #L%
25   */
26  
27  import fr.ifremer.adagio.core.dao.referential.ObjectTypeCode;
28  import fr.ifremer.tutti.persistence.entities.data.Attachment;
29  import fr.ifremer.tutti.persistence.entities.data.AttachmentBean;
30  import fr.ifremer.tutti.persistence.entities.data.Attachments;
31  import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
32  import org.nuiton.util.beans.Binder;
33  import org.nuiton.util.beans.BinderFactory;
34  
35  /**
36   * Created on 3/7/15.
37   *
38   * @author Tony Chemit - chemit@codelutin.com
39   * @since 3.15
40   */
41  public class AttachmentItemModel extends AbstractTuttiBeanUIModel<Attachment, AttachmentItemModel> {
42  
43      private static final long serialVersionUID = 1L;
44  
45      private final Attachment editObject = new AttachmentBean();
46  
47      protected static Binder<AttachmentItemModel, Attachment> toBeanBinder =
48              BinderFactory.newBinder(AttachmentItemModel.class,
49                                      Attachment.class);
50  
51      protected static Binder<Attachment, AttachmentItemModel> fromBeanBinder =
52              BinderFactory.newBinder(Attachment.class, AttachmentItemModel.class);
53  
54      public AttachmentItemModel() {
55          super(fromBeanBinder, toBeanBinder);
56      }
57  
58      @Override
59      protected Attachment newEntity() {
60          return Attachments.newAttachment();
61      }
62  
63      public String getName() {
64          return editObject.getName();
65      }
66  
67      public void setName(String name) {
68          editObject.setName(name);
69      }
70  
71      public Integer getObjectId() {
72          return editObject.getObjectId();
73      }
74  
75      public void setObjectId(Integer objectId) {
76          editObject.setObjectId(objectId);
77      }
78  
79      public String getComment() {
80          return editObject.getComment();
81      }
82  
83      public void setComment(String comment) {
84          editObject.setComment(comment);
85      }
86  
87      public ObjectTypeCode getObjectType() {
88          return editObject.getObjectType();
89      }
90  
91      public void setObjectType(ObjectTypeCode objectType) {
92          editObject.setObjectType(objectType);
93      }
94  
95      public String getPath() {
96          return editObject.getPath();
97      }
98  
99      public void setPath(String path) {
100         editObject.setPath(path);
101     }
102 }