j2sNative references moved to Platform
[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  * in the process of creating XML.
32  */
33 public class StructureViewerModel
34 {
35   private int x;
36
37   private int y;
38
39   private int width;
40
41   private int height;
42
43   private boolean alignWithPanel;
44
45   private boolean colourWithAlignPanel;
46
47   private boolean colourByViewer;
48
49   private String stateData = "";
50
51   private String viewId;
52
53   // CHIMERA or JMOL (for projects from Jalview 2.9 on)
54   private String type;
55
56   private Map<File, StructureData> fileData = new HashMap<File, StructureData>();
57
58   public class StructureData
59   {
60     private String filePath;
61
62     private String pdbId;
63     
64     private List<SequenceI> seqList;
65
66     // TODO and possibly a list of chains?
67
68     /**
69      * Constructor given structure file path and id.
70      * 
71      * Curiously, only called by Jalview2XML.
72      * 
73      * @param pdbFile
74      * @param id
75      */
76     public StructureData(String pdbFile, String id)
77     {
78       this.filePath = pdbFile;
79       this.pdbId = id;
80       this.seqList = new ArrayList<SequenceI>();
81     }
82
83     public String getFilePath()
84     {
85       return filePath;
86     }
87
88     protected void setFilePath(String filePath)
89     {
90       this.filePath = filePath;
91     }
92
93     public String getPdbId()
94     {
95       return pdbId;
96     }
97
98     protected void setPdbId(String pdbId)
99     {
100       this.pdbId = pdbId;
101     }
102
103     public List<SequenceI> getSeqList()
104     {
105       return seqList;
106     }
107
108     protected void setSeqList(List<SequenceI> seqList)
109     {
110       this.seqList = seqList;
111     }
112   }
113
114   public StructureViewerModel(int x, int y, int width, int height,
115           boolean alignWithPanel, boolean colourWithAlignPanel,
116           boolean colourByViewer, String viewId, String type)
117   {
118     this.x = x;
119     this.y = y;
120     this.width = width;
121     this.height = height;
122     this.alignWithPanel = alignWithPanel;
123     this.colourWithAlignPanel = colourWithAlignPanel;
124     this.colourByViewer = colourByViewer;
125     this.viewId = viewId;
126     this.type = type;
127   }
128
129   public int getX()
130   {
131     return x;
132   }
133
134   protected void setX(int x)
135   {
136     this.x = x;
137   }
138
139   public int getY()
140   {
141     return y;
142   }
143
144   protected void setY(int y)
145   {
146     this.y = y;
147   }
148
149   public int getWidth()
150   {
151     return width;
152   }
153
154   protected void setWidth(int width)
155   {
156     this.width = width;
157   }
158
159   public int getHeight()
160   {
161     return height;
162   }
163
164   public void setHeight(int height)
165   {
166     this.height = height;
167   }
168
169   public boolean isAlignWithPanel()
170   {
171     return alignWithPanel;
172   }
173
174   public void setAlignWithPanel(boolean alignWithPanel)
175   {
176     this.alignWithPanel = alignWithPanel;
177   }
178
179   public boolean isColourWithAlignPanel()
180   {
181     return colourWithAlignPanel;
182   }
183
184   public void setColourWithAlignPanel(boolean colourWithAlignPanel)
185   {
186     this.colourWithAlignPanel = colourWithAlignPanel;
187   }
188
189   public boolean isColourByViewer()
190   {
191     return colourByViewer;
192   }
193
194   public void setColourByViewer(boolean colourByViewer)
195   {
196     this.colourByViewer = colourByViewer;
197   }
198
199   public String getStateData()
200   {
201     return stateData;
202   }
203
204   public void setStateData(String stateData)
205   {
206     this.stateData = stateData;
207   }
208
209   public Map<File, StructureData> getFileData()
210   {
211     return fileData;
212   }
213
214   protected void setFileData(Map<File, StructureData> fileData)
215   {
216     this.fileData = fileData;
217   }
218
219   public String getViewId()
220   {
221     return this.viewId;
222   }
223
224   public String getType()
225   {
226     return this.type;
227   }
228 }