Revision 3ca8cd89 web_client/src/gr/grnet/pithos/web/client/foldertree/Folder.java

b/web_client/src/gr/grnet/pithos/web/client/foldertree/Folder.java
59 59

  
60 60
    private long bytesUsed = 0;
61 61

  
62
    private Folder parent = null;
63
    
62 64
    private Set<Folder> subfolders = new LinkedHashSet<Folder>();
63 65
    /*
64 66
     * The name of the container that this folder belongs to. If this folder is container, this field equals name
......
124 126
        if (header != null)
125 127
            bytesUsed = Long.valueOf(header);
126 128

  
129
        subfolders.clear(); //This is necessary in case we update a pre-existing Folder so that stale subfolders won't show up
127 130
        JSONValue json = JSONParser.parseStrict(response.getText());
128 131
        JSONArray array = json.isArray();
129 132
        if (array != null) {
......
133 136
                    String contentType = unmarshallString(o, "content_type");
134 137
                    if (o.containsKey("subdir") || (contentType != null && (contentType.startsWith("application/directory") || contentType.startsWith("application/folder")))) {
135 138
                        Folder f = new Folder();
136
                        f.populate(o, container);
139
                        f.populate(this, o, container);
137 140
                        subfolders.add(f);
138 141
                    }
139 142
                    else {
140 143
                        File file = new File();
141
                        file.populate(o, container);
144
                        file.populate(this, o, container);
142 145
                        files.add(file);
143 146
                    }
144 147
                }
......
146 149
        }
147 150
    }
148 151

  
149
    public void populate(JSONObject o, String aContainer) {
152
    public void populate(Folder parent, JSONObject o, String aContainer) {
153
        this.parent = parent;
150 154
        String path = null;
151 155
        if (o.containsKey("subdir")) {
152 156
            path = unmarshallString(o, "subdir");
......
204 208
    public Set<File> getFiles() {
205 209
        return files;
206 210
    }
211

  
212
    public Folder getParent() {
213
        return parent;
214
    }
207 215
}

Also available in: Unified diff