private void handleMouseEvent()

in kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/library/LibraryListCell.java [167:224]


    private void handleMouseEvent(MouseEvent me) {
        // Handle cursor
        final Scene scene = getScene();
        
        if (scene == null) {
            return;
        }
        
        // When another window is focused (just like the preview window), 
        // we use default cursor
        if (scene.getWindow() != null && !scene.getWindow().isFocused()) {
            setCursor(Cursor.DEFAULT);
            return;
        }
        
        final LibraryListItem listItem = getItem();
        LibraryItem item = null;
        
        if (listItem != null) {
            item = listItem.getLibItem();
        }
        
        boolean isSection = false;
        if (listItem != null && listItem.getSectionName() != null) {
            isSection = true;
        }

        if (me.getEventType() == MouseEvent.MOUSE_ENTERED) {
            if (isEmpty() || isSection) {
                setCursor(Cursor.DEFAULT);
            } else {
                setCursor(getOpenHandCursor());
            }
        } else if (me.getEventType() == MouseEvent.MOUSE_PRESSED) {
            if (isEmpty() || isSection) {
                setCursor(Cursor.DEFAULT);
            } else {
                setCursor(getClosedHandCursor());
            }
        } else if (me.getEventType() == MouseEvent.MOUSE_RELEASED) {
            if (isEmpty() || isSection) {
                setCursor(Cursor.DEFAULT);
            } else {
                setCursor(getOpenHandCursor());
            }
        } else if (me.getEventType() == MouseEvent.MOUSE_EXITED) {
            setCursor(Cursor.DEFAULT);
        } else if (me.getEventType() == MouseEvent.MOUSE_CLICKED) {
             // On double click ask for addition of the drag able item on Content
            if (me.getClickCount() == 2 && me.getButton() == MouseButton.PRIMARY) {
                if (!isEmpty() && !isSection && item != null) {
                    if (editorController.canPerformInsert(item)) {
                        editorController.performInsert(item);
                    }
                }
            }
        }
    }