1b789483802f8a116107fd642389d12fe229c3e6
[jalview.git] / src / jalview / datamodel / StructureViewerModel.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $$Year-Rel$$ The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3
10  * of the License, or (at your option) any later version.
11  *  
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  */
21 package jalview.datamodel;
22
23 import java.io.File;
24 import java.util.ArrayList;
25 import java.util.HashMap;
26 import java.util.List;
27 import java.util.Map;
28
29 /**
30  * A data bean to hold stored data about a structure viewer.
31  */
32 public class StructureViewerModel
33 {
34   private int x;
35
36   private int y;
37
38   private int width;
39
40   private int height;
41
42   private boolean alignWithPanel;
43
44   private boolean colourWithAlignPanel;
45
46   private boolean colourByViewer;
47
48   private String stateData = "";
49
50   private String viewId;
51
52   // CHIMERA or JMOL (for projects from Jalview 2.9 on)
53   private String type;
54
55   private Map<File, StructureData> fileData = new HashMap<File, StructureData>();
56
57   public class StructureData
58   {
59     private String filePath;
60
61     private String pdbId;
62
63     private List<SequenceI> seqList;
64
65     // TODO and possibly a list of chains?
66
67     /**
68      * Constructor given structure file path and id.
69      * 
70      * @param pdbFile
71      * @param id
72      */
73     public StructureData(String pdbFile, String id)
74     {
75       this.filePath = pdbFile;
76       this.pdbId = id;
77       this.seqList = new ArrayList<SequenceI>();
78     }
79
80     public String getFilePath()
81     {
82       return filePath;
83     }
84
85     protected void setFilePath(String filePath)
86     {
87       this.filePath = filePath;
88     }
89
90     public String getPdbId()
91     {
92       return pdbId;
93     }
94
95     protected void setPdbId(String pdbId)
96     {
97       this.pdbId = pdbId;
98     }
99
100     public List<SequenceI> getSeqList()
101     {
102       return seqList;
103     }
104
105     protected void setSeqList(List<SequenceI> seqList)
106     {
107       this.seqList = seqList;
108     }
109   }
110
111   public StructureViewerModel(int x, int y, int width, int height,
112           boolean alignWithPanel, boolean colourWithAlignPanel,
113           boolean colourByViewer, String viewId, String type)
114   {
115     this.x = x;
116     this.y = y;
117     this.width = width;
118     this.height = height;
119     this.alignWithPanel = alignWithPanel;
120     this.colourWithAlignPanel = colourWithAlignPanel;
121     this.colourByViewer = colourByViewer;
122     this.viewId = viewId;
123     this.type = type;
124   }
125
126   public int getX()
127   {
128     return x;
129   }
130
131   protected void setX(int x)
132   {
133     this.x = x;
134   }
135
136   public int getY()
137   {
138     return y;
139   }
140
141   protected void setY(int y)
142   {
143     this.y = y;
144   }
145
146   public int getWidth()
147   {
148     return width;
149   }
150
151   protected void setWidth(int width)
152   {
153     this.width = width;
154   }
155
156   public int getHeight()
157   {
158     return height;
159   }
160
161   public void setHeight(int height)
162   {
163     this.height = height;
164   }
165
166   public boolean isAlignWithPanel()
167   {
168     return alignWithPanel;
169   }
170
171   public void setAlignWithPanel(boolean alignWithPanel)
172   {
173     this.alignWithPanel = alignWithPanel;
174   }
175
176   public boolean isColourWithAlignPanel()
177   {
178     return colourWithAlignPanel;
179   }
180
181   public void setColourWithAlignPanel(boolean colourWithAlignPanel)
182   {
183     this.colourWithAlignPanel = colourWithAlignPanel;
184   }
185
186   public boolean isColourByViewer()
187   {
188     return colourByViewer;
189   }
190
191   public void setColourByViewer(boolean colourByViewer)
192   {
193     this.colourByViewer = colourByViewer;
194   }
195
196   public String getStateData()
197   {
198     return stateData;
199   }
200
201   public void setStateData(String stateData)
202   {
203     this.stateData = stateData;
204   }
205
206   public Map<File, StructureData> getFileData()
207   {
208     return fileData;
209   }
210
211   protected void setFileData(Map<File, StructureData> fileData)
212   {
213     this.fileData = fileData;
214   }
215
216   public String getViewId()
217   {
218     return this.viewId;
219   }
220
221   public String getType()
222   {
223     return this.type;
224   }
225 }