Commit e707b27c by Fernando Martínez Santiago

Merge branch 'fernando_branch' of http://scm.ujaen.es/softuno/pictogram into fernando_branch

parents df59edfa 2c261c44
......@@ -119,11 +119,17 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular
PCBcontext.getPcbdb().addPicto(pic);
}
private boolean empty_category(int pic_cat) {return this.pictos.get(pic_cat)==null;}
private int find_picto_index(int pic_cat, int pic_id) {
LinkedList<Picto> pictos_cat=this.pictos.get(pic_cat);
int index=-1;
for (int i=0; i<pictos_cat.size() && index==-1; i++)
Log.d("Vocabulary BORRA 2.1",pic_cat+" "+pic_id);
for (int i=0; i<pictos_cat.size() && index==-1; i++) {
Log.d("Vocabulary BORRA 2.15",i+":"+pictos_cat.get(i).get_id());
if (pictos_cat.get(i).get_id()==pic_id) index=i;
}
Log.d("Vocabulary BORRA 2.2",pic_cat+" "+pic_id+" "+index);
return index;
}
/**
......@@ -144,7 +150,7 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular
*/
public void modifyAttsPicto(int pic_cat, int pic_id, JSONObject attrs) {
Log.d("Vocabulary MOD BORRA 2",pic_cat+"---"+pic_id);
Picto picto=this.pictos.get(pic_cat).get(find_picto_index(pic_cat, pic_id));
picto.set_json_attr(attrs);
PCBcontext.getPcbdb().modifyPicto(pic_id, attrs.toString());
......@@ -190,7 +196,10 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular
* @return
*/
private boolean isVisibleCategory(int id) {
if (empty_category(id)) return false;
boolean visible=false;
for (Picto picto : this.pictos.get(id)) {
visible=picto.is_enabled();
if (visible) break;
......@@ -289,7 +298,7 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular
}
case update:{
Log.d("Vocabulary.java", "Entra en el case update. Picto cat: " + picto_cat + " y picto_id: " + picto_id);
Log.d("Vocabulary.java", "Update cat" + picto_cat + ". icto_id: " + picto_id);
modifyAttsPicto(picto_cat, picto_id, args);
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment