Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/** Copyright 2014 Robin Stumm ([email protected], http://dermetfan.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License. */
package net.dermetfan.gdx.scenes.scene2d.ui;
import java.io.File;
import java.io.FileFilter;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.badlogic.gdx.scenes.scene2d.ui.Button.ButtonStyle;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle;
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane.ScrollPaneStyle;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Tree;
import com.badlogic.gdx.scenes.scene2d.ui.Tree.Node;
import com.badlogic.gdx.scenes.scene2d.ui.Tree.TreeStyle;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.scenes.scene2d.utils.Selection;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Json;
import com.badlogic.gdx.utils.Json.Serializable;
import com.badlogic.gdx.utils.JsonValue;
import com.badlogic.gdx.utils.Pools;
import net.dermetfan.utils.Function;
/** A {@link FileChooser} that uses a {@link Tree}. DO NOT FORGET TO {@link #add(FileHandle) ADD ROOTS}!
* @author dermetfan */
public class TreeFileChooser extends FileChooser {
/** @see #fileNode(FileHandle, Label.LabelStyle, Function) */
public static Node fileNode(FileHandle file, LabelStyle labelStyle) {
return fileNode(file, labelStyle, null);
}
/** @see #fileNode(FileHandle, FileFilter, Label.LabelStyle, Function) */
public static Node fileNode(FileHandle file, LabelStyle labelStyle, Function nodeConsumer) {
return fileNode(file, null, labelStyle, nodeConsumer);
}
/** @see #fileNode(FileHandle, FileFilter, Label.LabelStyle, Function) */
public static Node fileNode(FileHandle file, FileFilter filter, final LabelStyle labelStyle) {
return fileNode(file, filter, labelStyle, null);
}
/** passes an Accessor that creates labels representing the file name (with slash if it's a folder) using the given label style to {@link #fileNode(FileHandle, FileFilter, net.dermetfan.utils.Function, net.dermetfan.utils.Function)} (labelSupplier)
* @param labelStyle the {@link LabelStyle} to use for created labels
* @see #fileNode(FileHandle, FileFilter, Function, Function) */
public static Node fileNode(FileHandle file, FileFilter filter, final LabelStyle labelStyle, Function nodeConsumer) {
return fileNode(file, filter, new Function