PDA

View Full Version : [CLOSED] RC2 - Drag and Drop TreePanel and TreeGrid broken



fother
1 Jul 2009, 8:50 AM
try drang and drop.. always you will see the window "Just-In-Time Debugging"
"Just-In-Time Debugging" its a Microsoft program that allow debug javascript.

tested in hosted mode win vista

in the class AsyncTreePanelExample add this code


new TreePanelDragSource(tree);

TreePanelDropTarget target = new TreePanelDropTarget(tree);
target.setAllowDropOnLeaf(true);
target.setAllowSelfAsSource(true);
target.setFeedback(Feedback.BOTH);


code example complete


public class AsyncTreePanelExample extends LayoutContainer {

private TreeLoader<FileModel> loader;
private TreePanel<FileModel> tree;

@Override
protected void onRender(Element parent, int index) {
super.onRender(parent, index);

setLayout(new FlowLayout(10));

final FileServiceAsync service = (FileServiceAsync) Registry.get(Examples.FILE_SERVICE);

// data proxy
RpcProxy<List<FileModel>> proxy = new RpcProxy<List<FileModel>>() {
@Override
protected void load(Object loadConfig, AsyncCallback<List<FileModel>> callback) {
service.getFolderChildren((FileModel) loadConfig, callback);
}
};

// tree loader
loader = new BaseTreeLoader<FileModel>(proxy) {
@Override
public boolean hasChildren(FileModel parent) {
return parent instanceof FolderModel;
}
};

// trees store
TreeStore<FileModel> store = new TreeStore<FileModel>(loader);
store.setKeyProvider(new ModelKeyProvider<FileModel>() {
public String getKey(FileModel model) {
return model.getName();
}
});
store.setStoreSorter(new StoreSorter<FileModel>() {

@Override
public int compare(Store<FileModel> store, FileModel m1, FileModel m2, String property) {
boolean m1Folder = m1 instanceof FolderModel;
boolean m2Folder = m2 instanceof FolderModel;

if (m1Folder && !m2Folder) {
return -1;
} else if (!m1Folder && m2Folder) {
return 1;
}

return m1.getName().compareTo(m2.getName());
}
});

tree = new TreePanel<FileModel>(store);
tree.setStateful(true);
tree.setDisplayProperty("name");

tree.setIconProvider(new ModelIconProvider<FileModel>() {

public AbstractImagePrototype getIcon(FileModel model) {
if (!(model instanceof FolderModel)) {
String ext = model.getName().substring(model.getName().lastIndexOf(".") + 1);

// new feature, using image paths rather than style names
if ("xml".equals(ext)) {
return IconHelper.createPath("samples/images/icons/page_white_code.png");
} else if ("java".equals(ext)) {
return IconHelper.createPath("samples/images/icons/page_white_cup.png");
} else if ("html".equals(ext)) {
return IconHelper.createPath("samples/images/icons/html.png");
} else {
return IconHelper.createPath("samples/images/icons/page_white.png");
}
}
return null;
}
});

new TreePanelDragSource(tree);

TreePanelDropTarget target = new TreePanelDropTarget(tree);
target.setAllowDropOnLeaf(true);
target.setAllowSelfAsSource(true);
target.setFeedback(Feedback.BOTH);

ContentPanel cp = new ContentPanel();
cp.setHeading("Async TreePanel");
cp.setLayout(new FitLayout());
cp.add(tree);
cp.setSize(315, 400);

ToolTipConfig config = new ToolTipConfig();
config.setTitle("Example Information");
config.setShowDelay(1);
config.setText("In this example state has been enabled for the tree. When enabled, the expand state of the tree is "
+ "saved and restored using the StateManager. Try refreshing the browser after expanding some nodes in the "
+ "tree. Notice that this works with asynchronous loading of nodes.");

ToolButton btn = new ToolButton("x-tool-help");
btn.setToolTip(config);

cp.getHeader().addTool(btn);

add(cp);
}
}

fother
1 Jul 2009, 9:57 AM
this problem appears too in RC2

fother
7 Jul 2009, 2:43 PM
this problem appears too in release..

remove this line


tree.setStateful(true);


how to reproduce the error

select the items

gxt
samples
client
images


drag the V scroll to the end and drop

try...

if the "Just-In-Time Debugging" window dont appear, select one item..

drag the V scrool to the begin and drop try several times

fother
7 Jul 2009, 2:46 PM
this problem appears too with the TreeGrid

sven
7 Jul 2009, 2:59 PM
I am still unable to reproduce this. Can you please provide some proper other testcase that demonstrates this?

sven
7 Jul 2009, 3:26 PM
Was able to reproduce it, thanks for reporting.

sven
10 Jul 2009, 7:48 AM
Fixed in SVN.

fother
6 Aug 2009, 9:06 AM
I test in hosted mode.. win vista.. using the code example that I post..
now in gxt 2.0.1 isnt possible more reorder... you click to drag.. but when you drop the item dont reorder...

sven
6 Aug 2009, 9:10 AM
Works fine: http://www.extjs.com/examples/explorer.html#reorderingtree

fother
6 Aug 2009, 9:11 AM
yes this example work fine... :)

but you need test with my test case (that can be wrong too)
my test case use async call..

you can provide my test case too?

sven
6 Aug 2009, 9:12 AM
The issue is, again ;), inyour code. The issue is fixed. I really suggest to use the help forum. You should setup a brakepoint to actually check what is going on.

fother
6 Aug 2009, 9:16 AM
its easy remove the store sort :))