本文整理汇总了Java中com.kotcrab.vis.ui.widget.file.FileChooser.setMultiSelectionEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java FileChooser.setMultiSelectionEnabled方法的具体用法?Java FileChooser.setMultiSelectionEnabled怎么用?Java FileChooser.setMultiSelectionEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.kotcrab.vis.ui.widget.file.FileChooser
的用法示例。
在下文中一共展示了FileChooser.setMultiSelectionEnabled方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addInputFiles
import com.kotcrab.vis.ui.widget.file.FileChooser; //导入方法依赖的package包/类
@LmlAction("addInputFiles") void addInputFiles() {
final FileChooser fileChooser = new FileChooser(FileChooser.Mode.OPEN);
fileChooser.setIconProvider(new AppIconProvider(fileChooser));
fileChooser.setSelectionMode(FileChooser.SelectionMode.FILES_AND_DIRECTORIES);
fileChooser.setMultiSelectionEnabled(true);
fileChooser.setFileTypeFilter(new FileUtils.FileTypeFilterBuilder(true)
.rule("Image files", "png", "jpg", "jpeg").get()); //TODO localize
fileChooser.setListener(new FileChooserAdapter() {
@Override
public void selected (Array<FileHandle> files) {
PackModel pack = getSelectedPack();
for (FileHandle file : files) {
pack.addInputFile(file, InputFile.Type.Input);
}
}
});
stage.addActor(fileChooser.fadeIn());
}
示例2: addIgnoreFiles
import com.kotcrab.vis.ui.widget.file.FileChooser; //导入方法依赖的package包/类
@LmlAction("addIgnoreFiles") void addIgnoreFiles() {
final FileChooser fileChooser = new FileChooser(FileChooser.Mode.OPEN);
fileChooser.setIconProvider(new AppIconProvider(fileChooser));
fileChooser.setSelectionMode(FileChooser.SelectionMode.FILES);
fileChooser.setMultiSelectionEnabled(true);
fileChooser.setFileTypeFilter(new FileUtils.FileTypeFilterBuilder(true)
.rule("Image files", "png", "jpg", "jpeg").get()); //TODO localize
fileChooser.setListener(new FileChooserAdapter() {
@Override
public void selected (Array<FileHandle> files) {
PackModel pack = getSelectedPack();
for (FileHandle file : files) {
pack.addInputFile(file, InputFile.Type.Ignore);
}
}
});
stage.addActor(fileChooser.fadeIn());
}
示例3: initiateFromFilePicker
import com.kotcrab.vis.ui.widget.file.FileChooser; //导入方法依赖的package包/类
public void initiateFromFilePicker() {
FileHandle rootDir = null;
if (sourceFile != null) {
rootDir = sourceFile.parent();
}
final FileChooser fileChooser = new FileChooser(rootDir, FileChooser.Mode.OPEN);
fileChooser.setIconProvider(new AppIconProvider(fileChooser));
fileChooser.setSelectionMode(FileChooser.SelectionMode.FILES);
fileChooser.setFileTypeFilter(new FileUtils.FileTypeFilterBuilder(true)
.rule("PNG or 9-Patch", "png", "9.png").get());
fileChooser.setMultiSelectionEnabled(false);
fileChooser.setListener(new FileChooserAdapter() {
@Override
public void selected (Array<FileHandle> files) {
FileHandle file = files.first();
initiateWithSourceFile(file);
}
});
Stage stage = interfaceService.getCurrentController().getStage();
stage.addActor(fileChooser.fadeIn());
if (sourceFile != null && FileUtils.fileExists(sourceFile)) {
fileChooser.setSelectedFiles(sourceFile);
}
}
示例4: showFilePicker
import com.kotcrab.vis.ui.widget.file.FileChooser; //导入方法依赖的package包/类
@LmlAction("showFilePicker") void showFilePicker() {
final FileChooser fileChooser = new FileChooser(inputFile.getFileHandle().parent(), FileChooser.Mode.OPEN);
fileChooser.setIconProvider(new AppIconProvider(fileChooser));
if (inputFile.isDirectory()) {
fileChooser.setSelectionMode(FileChooser.SelectionMode.DIRECTORIES);
} else {
fileChooser.setSelectionMode(FileChooser.SelectionMode.FILES);
fileChooser.setFileTypeFilter(new FileUtils.FileTypeFilterBuilder(true)
.rule("Image files", "png", "jpg", "jpeg").get()); //TODO localize
}
fileChooser.setMultiSelectionEnabled(false);
fileChooser.setListener(new FileChooserAdapter() {
@Override
public void selected (Array<FileHandle> files) {
FileHandle file = files.first();
if (file.equals(inputFile.getFileHandle())) return;
InputFile newInputFile = modelUtils.changeInputFileHandle(modelService.getProject().getSelectedPack(), InputFilePropertiesDialogController.this.inputFile, file);
if (newInputFile != null) {
InputFilePropertiesDialogController.this.inputFile = newInputFile;
mapDataFromModel();
}
}
});
stage.addActor(fileChooser.fadeIn());
if (FileUtils.fileExists(inputFile.getFileHandle())) { fileChooser.setSelectedFiles(inputFile.getFileHandle()); }
}
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:30,代码来源:InputFilePropertiesDialogController.java
示例5: addFileChooserListener
import com.kotcrab.vis.ui.widget.file.FileChooser; //导入方法依赖的package包/类
/** @param parser parses the attribute.
* @param rawAttributeData attribute value.
* @param fileChooser will have a listener set. */
protected static void addFileChooserListener(final LmlParser parser, final String rawAttributeData,
final FileChooser fileChooser) {
final ActorConsumer<?, FileHandle> action = parser.parseAction(rawAttributeData, MockUpFileHandle.INSTANCE);
if (action != null) {
// Handling single file:
fileChooser.setMultiSelectionEnabled(false);
fileChooser.setListener(new FileChooserAdapter() {
@Override
public void selected(final Array<FileHandle> file) {
if (GdxArrays.isNotEmpty(file)) {
action.consume(file.first());
}
}
@Override
public void canceled() {
action.consume(null);
}
});
} else {
// Handling multiple files:
final ActorConsumer<?, Array<FileHandle>> directoryAction = parser.parseAction(rawAttributeData,
MockUpFileHandle.EMPTY_ARRAY);
if (directoryAction == null) {
parser.throwError(
"File chooser attribute needs a reference to an action consuming a FileHandle or Array<FileHandle>. Action not found for: "
+ rawAttributeData);
}
fileChooser.setMultiSelectionEnabled(true);
fileChooser.setListener(new FileChooserListener() {
@Override
public void selected(final Array<FileHandle> files) {
directoryAction.consume(files);
}
@Override
public void canceled() {
directoryAction.consume(GdxArrays.newArray(FileHandle.class));
}
});
}
}