PDA

View Full Version : Drop into GridRow, not into de GridPanel


pjesus
01-19-2009, 04:43 AM
Hi community.

I'm trying some drag an drop experiences, and I was wondering if is possible to make a row in a grid or editor grid as a drop target.

Lets see some code:

My DragSource

final ContentPanel cp = new ContentPanel();
cp.setCollapsible(true);
cp.setHeading("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus vitae tellus vitae quam accumsan congue. Quisque quis mauris.".substring(0, 15) + "...");
cp.addText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus vitae tellus vitae quam accumsan congue. Quisque quis mauris.");
cp.setWidth(200);
cp.setScrollMode(Scroll.AUTO);
cp.setIconStyle("icon-pdf");
cp.setBodyStyleName("warn-window");

new Resizable(cp);

DragSource source = new DragSource(cp) {
@Override
protected void onDragStart(DNDEvent event) {
event.data = cp;
event.status.update("Drag Name: BLAH BLAH BLAH<br/> Drag Description: BLAH BLAH BLAH");
Log.debug("pumba");
}
};
source.setGroup("test");


My DropTarget

EditorGrid<BeanModel> grid = new EditorGrid<BeanModel>(store, getColumnModel());
grid.setAutoExpandColumn("text");
grid.setBorders(true);
grid.setLoadMask(true);
grid.getView().setForceFit(false);
grid.setTrackMouseOver(true);

GridDropTarget target2 = new GridDropTarget(grid){

protected void onDragDrop(DNDEvent e) {
super.onDragDrop(e);
Log.debug("allright");
}
};
target2.setAllowSelfAsSource(false);
target2.setGroup("test");


The GridDropTarget only makes the grid panel "dropable" and implements the feedback actions "automatically", am I right?

I have three questions.

First, in the drop event can I know if the drop was made over a ROW?
Second, can i make a ROW as drop target?
Third, can i make a CELL as drop target?

If any of my questions as no answer I think this is a good "add on" to GXT.

Sorry my English

Regards

Paulo Jesus

gslender
01-19-2009, 04:54 PM
Have a look at the source of GridDropTarget, and in particular showFeedback(DNDEvent event)

pjesus
01-20-2009, 03:24 AM
Hi @gslender

That's exactly what I was looking for.

Thank You.

I will post some code after try the drop into ROW.

Congrats for all the good work ;)

Paulo Jesus