Hi
try to implement an upload of an image via drag and drop. i created a 
dialog with a preview image and a dropping zone. this is a label. with type 
of widget it works fine. i can drop the image form the desktop to my dialog 
and i receive the dropevent. i attached the required handlers to the label 
and this works perfect.
To make it better i shoudl attach the required dnd-handlers to the iimage 
object, so i can drop a new image over the old image. But here i have big 
problems. when i attach the handlers i don't receive the events. i tried to 
create a image-wrapperclass, but i don't get a desired result.. i can not 
see the difference between the label-widget and the image-widget. 
I'm very gratefull for every help...
Thanks for every hint


Here what i made:

this was the warapperimage...

package ch.pmm.coolartsclient.client.widgets.uploadmanager;

import com.google.gwt.event.dom.client.DragEndHandler;
import com.google.gwt.event.dom.client.DragEnterHandler;
import com.google.gwt.event.dom.client.DragHandler;
import com.google.gwt.event.dom.client.DragLeaveHandler;
import com.google.gwt.event.dom.client.DragOverHandler;
import com.google.gwt.event.dom.client.DragStartHandler;
import com.google.gwt.event.dom.client.DropHandler;
import com.google.gwt.event.dom.client.HasAllDragAndDropHandlers;
import com.google.gwt.event.shared.HandlerRegistration;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.events.DropCompleteHandler;

public class DroppableImage extends Img implements 
HasAllDragAndDropHandlers, 
                                                  
com.smartgwt.client.widgets.events.HasDropCompleteHandlers, 
                                                  
com.smartgwt.client.widgets.events.HasDropHandlers, 
                                                  
com.smartgwt.client.widgets.events.HasDropOverHandlers
{
  
  public DroppableImage()
  {
    super();   
  }
  
  public DroppableImage(String sSrc)
  {
    super(sSrc);
  }

  @Override
  public HandlerRegistration addDragEndHandler(DragEndHandler handler)
  {
    System.out.println("Image: addDragEndHandler");
    return null;
  }

  @Override
  public HandlerRegistration addDragEnterHandler(DragEnterHandler handler)
  {
    System.out.println("Image: addDragEnterHandler");
    return null;
  }

  @Override
  public HandlerRegistration addDragLeaveHandler(DragLeaveHandler handler)
  {
    System.out.println("Image: addDragLeaveHandler");
    return null;
  }

  @Override
  public HandlerRegistration addDragHandler(DragHandler handler)
  {
    System.out.println("Image: addDragHandler");
    return null;
  }

  @Override
  public HandlerRegistration addDragOverHandler(DragOverHandler handler)
  {
    System.out.println("Image: addDragOverHandler");
    return null;
  }

  @Override
  public HandlerRegistration addDragStartHandler(DragStartHandler handler)
  {
    System.out.println("Image: addDragStartHandler");
    return null;
  }

  @Override
  public HandlerRegistration addDropHandler(DropHandler handler)
  {
    System.out.println("Image: addDropHandler");
    return null;
  }

  @Override
  public HandlerRegistration addDropCompleteHandler(DropCompleteHandler 
handler)
  {
    System.out.println("Image: addDropCompleteHandler");
    return null;
  }
}

//------------------------------------------------------------------------------------------------------------------------------------------------------
and when i create the image in the DialogClass then i go to over this 
method...



  private void create_oImage(String sSrc) {
    if(sSrc.equals("")) m_oImage = new DroppableImage();
    else m_oImage = new DroppableImage(sSrc);
    
    m_oImage.addDropOverHandler(new DropOverHandler() {      
      @Override
      public void onDropOver(DropOverEvent event)
      {
        System.out.println("Image: Hello DropOverHandler is calling!!!");   
     
      }
    });            
    
    m_oImage.addDropHandler(new DropHandler() {
      
      @Override
      public void onDrop(DropEvent event)
      {
        System.out.println("Image: Hello DropHandler is calling!!!");       
 
      }
    });    
    
    m_oImage.addDropOutHandler(new DropOutHandler() {
      
      @Override
      public void onDropOut(DropOutEvent event)
      {
        System.out.println("image: dropOutHandler");
        
      }
    });
  }



-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to