/** returns the album with the given id */ public void selectSubAlbum(int a_Id) { for (int i = 0; i < getChildCount(); i++) { Album ab = ((Album) getChild(i)); if (ab.m_ID == a_Id) { ab.select(); m_Container.getTree().ensureSelected(ab); } } }
public void setAlbum(Album a_Album) { clearView(); m_Album = a_Album; Item last = null; for (Item item : a_Album.getItems()) { if (a_Album.isManualSort()) { addDropZone(a_Album, item, true); } addToView(item); item.showing(); last = item; } if (a_Album.isManualSort() && (last != null)) { addDropZone(a_Album, last, false); } Loading.getInstance().endLoading(); }
/* * Adds the albums in the json response TreeItem. */ private void addAlbums(JSONValue jsonValue) { JSONArray jsonArray = (JSONArray) jsonValue; Set<Integer> allAlbums = new HashSet<Integer>(m_IDtoAlbum.keySet()); for (int i = 0; i < jsonArray.size(); ++i) { JSONObject jso = (JSONObject) jsonArray.get(i); int id = Utils.extractId(jso.get("id")); if (m_IDtoAlbum.containsKey(id)) { m_IDtoAlbum.get(id).updateValues(jso); } else { Album album = new Album(jso, m_Container); m_IDtoAlbum.put(id, album); addItem(album); } allAlbums.remove(id); } for (Integer id : allAlbums) { Album a = m_IDtoAlbum.remove(id); a.cleanup(); removeItem(a); } }
@Override public void dropFiles(File[] aFile) { if (m_Album != null) { m_Album.uploadFiles(aFile); } }