Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Select a tab while drag&drop

    I would like to get the following scenario:
    The user has a TabSet with two Tabs: say Department and Persons. He drags a person from the second Tab which displays persons list. Then, he drag-over the TabBar to the title of the first (Department), which is not selected yet.
    Now, I would like the TabSet (or TabBar) to select Department tab and allow user drop a Person here.
    Is it doable? Any hints?
    MichalG

    #2
    Should be a standard drag and drop interaction - add some drop-related event handlers to the TabSet (dropOver, etc) which call selectTab if the mouse hovers over a particular tab for a moment.

    Comment


      #3
      I also think that this should be a standard drag&drop interaction for TabSets.

      Meantime I ended with this code:
      Code:
              //the following drop handling let the user select a tab while drag&drop
              this.setCanAcceptDrop(true);
              this.addDropMoveHandler(new DropMoveHandler() {
      
                  public void onDropMove(DropMoveEvent event) {
                      TabSet thisTS = (TabSet) event.getSource();
                      for (Tab tab : thisTS.getTabs()) {
                          StatefulCanvas liveWidget = (StatefulCanvas) tab.getTabCanvas();
                          if (event.getX() > liveWidget.getPageLeft() && event.getX() < liveWidget.getPageRight()
                                  && event.getY() > liveWidget.getPageTop() && event.getY() < liveWidget.getPageBottom()) {
                              thisTS.selectTab(tab);
                          }
                      }
                      event.cancel();
                  }
              });
      Corrections or improvements are welcome.

      Thanks,
      MichalG

      Comment

      Working...
      X