@Override
  public void handleSelection(PartialDisc pdSelected) {

    PartialDisc pdRealRootElement = radialHierarchy.getRealRootElement();
    PartialDisc pdCurrentRootElement = radialHierarchy.getCurrentRootElement();

    if (pdSelected != pdRealRootElement && pdSelected.hasChildren()) {

      pdCurrentRootElement.setPDDrawingStrategyChildren(
          radialHierarchy.getDrawingStrategyManager().getDefaultDrawingStrategy(),
          iDisplayedHierarchyDepth);

      if (pdSelected == pdCurrentRootElement) {
        radialHierarchy.setCurrentSelectedElement(pdSelected);
        drawingController.setDrawingState(EDrawingStateType.ANIMATION_PARENT_ROOT_ELEMENT);
      } else {
        radialHierarchy.setCurrentSelectedElement(pdSelected);
        drawingController.setDrawingState(EDrawingStateType.ANIMATION_NEW_ROOT_ELEMENT);
      }
      radialHierarchy.setDisplayListDirty();
    } else {
      radialHierarchy.setNewSelection(SelectionType.SELECTION, pdSelected);
      radialHierarchy.setDisplayListDirty();
    }
  }
  @Override
  public void handleAlternativeSelection(PartialDisc pdSelected) {

    PartialDisc pdCurrentRootElement = radialHierarchy.getCurrentRootElement();

    if (pdSelected != pdCurrentRootElement
        && pdSelected.hasChildren()
        && pdSelected.getCurrentDepth() > 1) {

      pdCurrentRootElement.setPDDrawingStrategyChildren(
          radialHierarchy.getDrawingStrategyManager().getDefaultDrawingStrategy(),
          iDisplayedHierarchyDepth);

      radialHierarchy.setCurrentSelectedElement(pdSelected);
      drawingController.setDrawingState(EDrawingStateType.ANIMATION_POP_OUT_DETAIL_OUTSIDE);
      radialHierarchy.setDisplayListDirty();
    }
  }
Exemplo n.º 3
0
  @Override
  protected void handlePickingEvents(
      PickingType pickingType, PickingMode pickingMode, int externalID, Pick pick) {
    if (detailLevel == EDetailLevel.VERY_LOW) {
      return;
    }
    switch (pickingType) {
      case RAD_HIERARCHY_PDISC_SELECTION:
        PartialDisc pdPickedElement = hashPartialDiscs.get(externalID);

        switch (pickingMode) {
          case CLICKED:
            if (pdPickedElement != null) drawingController.handleSelection(pdPickedElement);
            break;

          case MOUSE_OVER:
            if (pdPickedElement != null) drawingController.handleMouseOver(pdPickedElement);
            break;

          case RIGHT_CLICKED:
            if (pdPickedElement != null) {
              // Prevent handling of non genetic data in context
              // menu
              if (!dataDomain.getDataDomainID().equals("org.caleydo.datadomain.genetic")) break;

              if (!pdPickedElement.hasChildren()) {
                AContextMenuItem menuItem =
                    new BookmarkMenuItem(
                        "Bookmark "
                            + dataDomain.getRecordLabel(dataDomain.getRecordIDType(), externalID),
                        dataDomain.getRecordIDType(),
                        externalID);
                getContextMenuCreator().addContextMenuItem(menuItem);
              } else {
                AContextMenuItem menuItem = new DetailOutsideItem(externalID);
                getContextMenuCreator().addContextMenuItem(menuItem);
              }

              break;
            }
            drawingController.handleAlternativeSelection(pdPickedElement);
            break;

          default:
            return;
        }
        break;

      case RAD_HIERARCHY_SLIDER_SELECTION:
        switch (pickingMode) {
          case CLICKED:
            if (externalID == iUpwardNavigationSliderID) {
              if (upwardNavigationSlider.handleSliderSelection(pickingType)) {
                updateHierarchyAccordingToNavigationSlider();
                setDisplayListDirty();
              }
            }
            break;

          default:
            return;
        }
        break;

      case RAD_HIERARCHY_SLIDER_BUTTON_SELECTION:
        switch (pickingMode) {
          case CLICKED:
            if (externalID == iUpwardNavigationSliderButtonID) {
              if (upwardNavigationSlider.handleSliderSelection(pickingType)) {
                updateHierarchyAccordingToNavigationSlider();
                setDisplayListDirty();
              }
            }
            break;

          default:
            return;
        }
        break;

      case RAD_HIERARCHY_SLIDER_BODY_SELECTION:
        switch (pickingMode) {
          case CLICKED:
            if (externalID == iUpwardNavigationSliderBodyID) {
              if (upwardNavigationSlider.handleSliderSelection(pickingType)) {
                updateHierarchyAccordingToNavigationSlider();
                setDisplayListDirty();
              }
            }
            break;

          default:
            return;
        }
        break;
      default:
        break;
    }
  }