Revision db365c2d
b/src/gr/grnet/pithos/web/client/PithosDisclosurePanel.java | ||
---|---|---|
35 | 35 |
|
36 | 36 |
package gr.grnet.pithos.web.client; |
37 | 37 |
|
38 |
import gr.grnet.pithos.web.client.grouptree.GroupTreeView; |
|
39 |
import gr.grnet.pithos.web.client.grouptree.GroupTreeView.Templates; |
|
40 |
|
|
41 |
import com.google.gwt.dom.client.Style; |
|
42 | 38 |
import com.google.gwt.event.logical.shared.CloseEvent; |
43 | 39 |
import com.google.gwt.event.logical.shared.CloseHandler; |
44 | 40 |
import com.google.gwt.event.logical.shared.OpenEvent; |
... | ... | |
46 | 42 |
import com.google.gwt.resources.client.ClientBundle; |
47 | 43 |
import com.google.gwt.resources.client.CssResource; |
48 | 44 |
import com.google.gwt.resources.client.ImageResource; |
49 |
import com.google.gwt.resources.client.CssResource.ImportedWithPrefix; |
|
50 |
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; |
|
51 |
import com.google.gwt.user.client.ui.AbstractImagePrototype; |
|
52 | 45 |
import com.google.gwt.user.client.ui.Composite; |
53 | 46 |
import com.google.gwt.user.client.ui.DisclosurePanel; |
54 | 47 |
import com.google.gwt.user.client.ui.HTML; |
... | ... | |
56 | 49 |
import com.google.gwt.user.client.ui.HasVerticalAlignment; |
57 | 50 |
import com.google.gwt.user.client.ui.HorizontalPanel; |
58 | 51 |
import com.google.gwt.user.client.ui.Image; |
59 |
import com.google.gwt.user.client.ui.IsWidget; |
|
60 | 52 |
import com.google.gwt.user.client.ui.Widget; |
61 | 53 |
|
62 | 54 |
public class PithosDisclosurePanel extends Composite { |
... | ... | |
135 | 127 |
return header; |
136 | 128 |
} |
137 | 129 |
|
138 |
public void add(IsWidget widget) {
|
|
139 |
panel.add(widget);
|
|
130 |
public void setContent(Widget widget) {
|
|
131 |
panel.setContent(widget);
|
|
140 | 132 |
panel.getContent().removeStyleName("content"); |
141 | 133 |
panel.getContent().addStyleName(resources.pithosDisclosurePanelCss().content()); |
142 | 134 |
} |
b/src/gr/grnet/pithos/web/client/grouptree/GroupTreeView.java | ||
---|---|---|
162 | 162 |
tree = new CellTree(model, null, res); |
163 | 163 |
tree.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED); |
164 | 164 |
|
165 |
panel.add(tree);
|
|
165 |
panel.setContent(tree);
|
|
166 | 166 |
|
167 | 167 |
initWidget(panel); |
168 | 168 |
} |
b/src/gr/grnet/pithos/web/client/mysharedtree/MysharedTreeView.java | ||
---|---|---|
50 | 50 |
import com.google.gwt.user.cellview.client.CellTree; |
51 | 51 |
import com.google.gwt.user.cellview.client.HasKeyboardSelectionPolicy.KeyboardSelectionPolicy; |
52 | 52 |
import com.google.gwt.user.cellview.client.TreeNode; |
53 |
import com.google.gwt.user.client.Command; |
|
53 | 54 |
import com.google.gwt.user.client.ui.Composite; |
54 | 55 |
import com.google.gwt.user.client.ui.Tree; |
55 | 56 |
|
... | ... | |
148 | 149 |
|
149 | 150 |
private MysharedTreeViewModel model; |
150 | 151 |
|
152 |
private PithosDisclosurePanel panel; |
|
153 |
|
|
151 | 154 |
private CellTree tree; |
152 | 155 |
|
156 |
private CellTree.Resources res = GWT.create(BasicResources.class); |
|
157 |
|
|
153 | 158 |
public MysharedTreeView(MysharedTreeViewModel viewModel) { |
154 | 159 |
this.model = viewModel; |
155 | 160 |
|
156 |
PithosDisclosurePanel panel = new PithosDisclosurePanel((Resources) GWT.create(Resources.class), "Shared by me", false); |
|
157 |
/* |
|
161 |
panel = new PithosDisclosurePanel((Resources) GWT.create(Resources.class), "Shared by me", false); |
|
162 |
createTree(); |
|
163 |
|
|
164 |
initWidget(panel); |
|
165 |
} |
|
166 |
|
|
167 |
/** |
|
168 |
* |
|
169 |
*/ |
|
170 |
void createTree() { |
|
171 |
/* |
|
158 | 172 |
* Create the tree using the model. We use <code>null</code> as the default |
159 | 173 |
* value of the root node. The default value will be passed to |
160 | 174 |
* CustomTreeModel#getNodeInfo(); |
161 | 175 |
*/ |
162 |
CellTree.Resources res = GWT.create(BasicResources.class); |
|
176 |
if (tree != null) |
|
177 |
tree.removeFromParent(); |
|
163 | 178 |
tree = new CellTree(model, null, res); |
164 | 179 |
tree.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED); |
165 |
|
|
166 |
panel.add(tree); |
|
167 |
initWidget(panel); |
|
168 |
} |
|
180 |
panel.setContent(tree); |
|
181 |
} |
|
169 | 182 |
|
170 | 183 |
|
171 | 184 |
@Override |
... | ... | |
178 | 191 |
} |
179 | 192 |
|
180 | 193 |
public void updateRoot() { |
181 |
TreeNode root = tree.getRootTreeNode(); |
|
182 |
root.setChildOpen(0, true); |
|
183 |
root.setChildOpen(0, false); |
|
194 |
model.initialize(new Command() { |
|
195 |
|
|
196 |
@Override |
|
197 |
public void execute() { |
|
198 |
createTree(); |
|
199 |
} |
|
200 |
}); |
|
184 | 201 |
} |
185 | 202 |
} |
b/src/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeView.java | ||
---|---|---|
157 | 157 |
tree = new CellTree(model, null, res); |
158 | 158 |
tree.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED); |
159 | 159 |
|
160 |
panel.add(tree);
|
|
160 |
panel.setContent(tree);
|
|
161 | 161 |
initWidget(panel); |
162 | 162 |
} |
163 | 163 |
|
Also available in: Unified diff