Problem with DragDropLayouts Add-on and CustomComponents

Hello everyone,

I am trying to make a CustomComponent consisting of a CssLayout, a Label and an OptionGroup draggable.

I stumbled upon the DragDropLayouts Add-on and tried to achieve what I want with the following excerpt:

[code]
DDAbsoluteLayout root = new DDAbsoluteLayout();
root.setSizeFull();

    QuestionComponent comp = new QuestionComponent();
    comp.setQuestion("The answer to life, the universe and everything?");
    comp.addOption("42");        
    comp.addOption("43");
    root.addComponent(comp);

    root.setDragMode(LayoutDragMode.CLONE);
    root.setDropHandler(new DefaultAbsoluteLayoutDropHandler());
    root.setDragFilter(new DragFilter() {
        public boolean isDraggable(Component component) {
            return component instanceof QuestionComponent;
        }
    });

    this.setContent(root);

[/code]But to make it short - I can’t drag the component. It just marks the contained elements when I drag.
Is it even possible to achieve drag and drop on CustomComponents or is that limited to ‘basic’ components like buttons (as seen in the examples)?

My goal is to make it draggable wherever I click, the contained options should not be usable. So basicly it is supposed to be like an image of the component if you know what I mean.

I will be very thankful for any help.

Greetings, Gordon

P.S.: I’m using Vaadin 7.1.15 with DDLayouts 1.1

Hi,

The first thing I noticed that you are using DDLayouts 1.1 with Vaadin 7.1.x. This won’t work and you will recieve compilation errors when you compile your widgetset as the client side (GWT) implementations of the layouts in Vaadin 7.1 and Vaadin 7.2 has changed. If you are using 7.1 please use the latest 1.0.x series. When you switch to Vaadin 7.2 you will need to upgrade to 1.1. I know it is confusing but there is not much I can do about it as long as the GWT API’s in Vaadin are so unstable :frowning:

But to your real question, I don’t see why your code shouldn’t work (once you switch back to DDLayouts 1.0.x and recompile your widgetset). But if you still are getting this then try to append the application url with ?debug so you get the debug console and check if you can spot any red error messages.

I am beginner in Vaadin my application is in Vaadin 6 i want to redirect to another page when i click to a button but all page have the some URL how can i solve this problem please help me …???

sorry my english is not good

Please don’t hijack the thread with a subject not related to the original subject of this thread.

Instead, post your question as a new question in the forum and you will better get answers. Thank you.

thank you for your reply :frowning:

Thank you for your answer John!

Concerning the versioning problem, I just wasn’t paying attention :smiley:
I had integrated version 1.0.1 originally but when I was searching for possible reasons why my little project isn’t working, I saw there is a newer version but didn’t read the about.

I followed your suggestion to use the debug option and the only thing I found was

Server sent Vaadin 6 style updates for AbsoluteLayoutConnector (7) but this is not a Vaadin 6 Paintable The general information is

Client engine version 7.1.15 Server engine version 7.1.15 Theme version 7.1.15 Widgetset com.vaadin.DefaultWidgetSet Theme evaluation-tool-theme Communication method XHR Heartbeat 300s Layout analyzation did not bring up any problems.

The mentioned LayoutConnector is the one belonging to the DDAbsoluteLayout though, I’m not using any other AbsoluteLayouts.

Thanks for the general information you provided. It helped a lot and I think I know where the problem is.

When you are adding new addons from the Directory to your project you will need to create you own “widgetset”. Vaadin comes bundled with the “com.vaadin.DefaultWidgetSet” which contains all core Vaadin components and that is what you appear to be currently using. But when you add new components like DDLayouts you will need to make your own widgetset with the new components. To do so take a look at the tutorial in Book Of Vaadin about building the widgetset (
https://vaadin.com/book/vaadin7/-/page/clientside.compiling.html
). How you do it depends on what build system you are using.

When you have succeeded in building your own widgetset then the widgetset parameter in the general information should show it instead of the DefaultWidgetset you now see.

I tested creating a similar testcase and it should work fine once you get the widgetset figured out :slight_smile:

Thanks a lot, it works now.
Don’t know why I didn’t think about that myself, I have occasionally used Add-Ons before…