- Timestamp:
- 03/10/10 11:23:27 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molgenis4animaldb/handwritten/java/plugin/listplugin/ListPlugin.java
r2689 r2698 8 8 package plugin.listplugin; 9 9 10 import java.io.FileInputStream; 11 import java.io.FileOutputStream; 12 import java.io.ObjectInputStream; 13 import java.io.ObjectOutputStream; 10 14 import java.text.ParseException; 11 15 import java.util.ArrayList; … … 150 154 if (tmpList.get(j) == 0) { 151 155 vis = 0; 156 break; 152 157 } 153 158 } … … 219 224 reload(db); 220 225 } 226 227 if (action.equals("save")) { 228 List<Integer> saveList = new ArrayList<Integer>(); 229 for (int i = 0; i < animalList.size(); i++) { 230 if (animalVisibilityList.get(i) == 1) { 231 saveList.add(animalList.get(i).getId()); 232 } 233 } 234 ObjectOutputStream output = new ObjectOutputStream(new FileOutputStream("animaldb.sav")); 235 output.writeObject(saveList); 236 output.close(); 237 } 238 239 if (action.equals("load")) { 240 ObjectInputStream input = new ObjectInputStream(new FileInputStream("animaldb.sav")); 241 List<Integer> saveList = (ArrayList<Integer>) input.readObject(); 242 input.close(); 243 for (int i = 0; i < animalList.size(); i++) { 244 valueVisibilityMatrix.get(i).set(0, 0); 245 for (int j = 0; j < saveList.size(); j++) { 246 if (animalList.get(i).getId().equals(saveList.get(j))) { 247 valueVisibilityMatrix.get(i).set(0, 1); 248 break; 249 } 250 } 251 } 252 recalculateAnimalVisibilityList(); 253 } 221 254 222 255 } catch (Exception e) { … … 228 261 if (firstTime) { 229 262 firstTime = false; 263 230 264 // Populate animal list 231 265 Query q = db.query(Eventtype.class);
Note: See TracChangeset
for help on using the changeset viewer.