Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDTabSheet loses tabs #86

Open
ariordan opened this issue Jun 9, 2017 · 0 comments
Open

DDTabSheet loses tabs #86

ariordan opened this issue Jun 9, 2017 · 0 comments

Comments

@ariordan
Copy link

ariordan commented Jun 9, 2017

When transferring a tab between two DDtabSheets using DefaultTabSheetDropHandler, it is possible to lose the dragged tab. This occurs when HorizontalDropLocation (location) is null, which occurs when the tab is dragged over the content of the other tabsheet, rather then the tabsheet tabs.

There are two possible solutions to this issue:

1: do not perform the drag when location is null


protected void handleDropFromLayout(DragAndDropEvent event) {
    ....
    // cancel drag if location is null
    if (location == null) {
        return;
    }

    if(source instanceof ComponentContainer) {
        source.removeComponent(c);
    } else if(source instanceof SingleComponentContainer) {
        ((SingleComponentContainer)source).setContent((Component)null);
    }
    ....
}

2: append the tab to the end of the target tabsheets tab list


protected void handleDropFromLayout(DragAndDropEvent event) {
    ...
    if(location == HorizontalDropLocation.LEFT) {
        tabSheet.addTab(c, idx);
    } else if(location == HorizontalDropLocation.RIGHT) {
        tabSheet.addTab(c, idx + 1);

    // add tab to end of tab list if location is null
    } else {
        tabSheet.addTab(c);
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant