All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.legyver.fenxlib.widgets.filetree.FileExplorerSkin Maven / Gradle / Ivy

There is a newer version: 3.0.2
Show newest version
package com.legyver.fenxlib.widgets.filetree;

import com.jfoenix.controls.JFXTreeView;
import com.legyver.fenxlib.core.api.event.handlers.ShowContextMenuEventHandler;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.SkinBase;

/**
 * Skin for the {@link BaseFileExplorer}
 */
public class FileExplorerSkin extends SkinBase {
    private final JFXTreeView jfxTreeView;

    /**
     * Construct a skin for the given FileExplorer
     * @param fileExplorer the FileExplorer to skin.
     */
    @SuppressWarnings("unchecked")
    public FileExplorerSkin(BaseFileExplorer fileExplorer) {
        super(fileExplorer);
        jfxTreeView = new JFXTreeView(fileExplorer.getPseudoRoot());
        jfxTreeView.setShowRoot(false);
        fileExplorer.refreshPulseProperty().addListener((observable, oldValue, newValue) -> jfxTreeView.refresh());
        jfxTreeView.setOnContextMenuRequested(new ShowContextMenuEventHandler(jfxTreeView, fileExplorer.getContextMenu()));
        getChildren().add(jfxTreeView);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy