本文整理汇总了Java中com.kotcrab.vis.ui.widget.file.FileChooser.setSelectionMode方法的典型用法代码示例。如果您正苦于以下问题:Java FileChooser.setSelectionMode方法的具体用法?Java FileChooser.setSelectionMode怎么用?Java FileChooser.setSelectionMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.kotcrab.vis.ui.widget.file.FileChooser
的用法示例。
在下文中一共展示了FileChooser.setSelectionMode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: pickAtlasPath
import com.kotcrab.vis.ui.widget.file.FileChooser; //导入方法依赖的package包/类
@LmlAction("pickAtlasPath") void pickAtlasPath() {
FileHandle dir = FileUtils.obtainIfExists(edtAtlasPath.getText());
final FileChooser fileChooser = new FileChooser(dir, FileChooser.Mode.OPEN);
fileChooser.setIconProvider(new AppIconProvider(fileChooser));
fileChooser.setSelectionMode(FileChooser.SelectionMode.FILES);
fileChooser.setFileTypeFilter(new FileUtils.FileTypeFilterBuilder(true)
.rule("Texture atlas (*.json;*.pack;*.atlas)", "json", "pack", "atlas").get());
fileChooser.setListener(new FileChooserAdapter() {
@Override
public void selected (Array<FileHandle> file) {
FileHandle chosenFile = file.first();
edtAtlasPath.setText(chosenFile.path());
}
});
stage.addActor(fileChooser.fadeIn());
}
示例5: pickOutputDir
import com.kotcrab.vis.ui.widget.file.FileChooser; //导入方法依赖的package包/类
@LmlAction("pickOutputDir") void pickOutputDir() {
FileHandle dir = FileUtils.obtainIfExists(edtOutputDir.getText());
if (dir == null && FileUtils.fileExists(edtAtlasPath.getText())) {
dir = FileUtils.obtainIfExists(edtAtlasPath.getText()).parent();
}
FileChooser fileChooser = new FileChooser(dir, FileChooser.Mode.OPEN);
fileChooser.setIconProvider(new AppIconProvider(fileChooser));
fileChooser.setSelectionMode(FileChooser.SelectionMode.DIRECTORIES);
fileChooser.setListener(new FileChooserAdapter() {
@Override
public void selected (Array<FileHandle> file) {
FileHandle chosenFile = file.first();
edtOutputDir.setText(chosenFile.path());
}
});
stage.addActor(fileChooser.fadeIn());
}
示例6: openProject
import com.kotcrab.vis.ui.widget.file.FileChooser; //导入方法依赖的package包/类
@LmlAction("openProject") public void openProject() {
final ProjectModel project = getProject();
FileHandle dir = fileChooserHistory.getLastDir(FileChooserHistory.Type.PROJECT);
if (FileUtils.fileExists(project.getProjectFile())) {
dir = project.getProjectFile().parent();
}
final FileChooser fileChooser = new FileChooser(dir, FileChooser.Mode.OPEN);
fileChooser.setIconProvider(new AppIconProvider(fileChooser));
fileChooser.setSelectionMode(FileChooser.SelectionMode.FILES);
fileChooser.setFileTypeFilter(new FileUtils.FileTypeFilterBuilder(true)
.rule(getString("projectFileDescription", AppConstants.PROJECT_FILE_EXT), AppConstants.PROJECT_FILE_EXT).get());
fileChooser.setListener(new FileChooserAdapter() {
@Override
public void selected (Array<FileHandle> file) {
FileHandle chosenFile = file.first();
loadProject(chosenFile);
}
});
getStage().addActor(fileChooser.fadeIn());
}
示例7: pickOutputDir
import com.kotcrab.vis.ui.widget.file.FileChooser; //导入方法依赖的package包/类
@LmlAction("pickOutputDir") public void pickOutputDir() {
final PackModel pack = getSelectedPack();
if (pack == null) return;
FileHandle dir = FileUtils.obtainIfExists(pack.getOutputDir());
if (dir == null) {
dir = fileChooserHistory.getLastDir(FileChooserHistory.Type.OUTPUT_DIR);
}
FileChooser fileChooser = new FileChooser(dir, FileChooser.Mode.OPEN);
fileChooser.setIconProvider(new AppIconProvider(fileChooser));
fileChooser.setSelectionMode(FileChooser.SelectionMode.DIRECTORIES);
fileChooser.setListener(new FileChooserAdapter() {
@Override
public void selected (Array<FileHandle> file) {
FileHandle chosenFile = file.first();
fileChooserHistory.putLastDir(FileChooserHistory.Type.OUTPUT_DIR, chosenFile);
pack.setOutputDir(chosenFile.file().getAbsolutePath());
}
});
getStage().addActor(fileChooser.fadeIn());
}
示例8: init
import com.kotcrab.vis.ui.widget.file.FileChooser; //导入方法依赖的package包/类
@Override
public void init () {
FileChooser.setDefaultPrefsName("com.kotcrab.vis.editor");
FileChooser.setSaveLastDirectory(true);
chooser = new FileChooser(Mode.OPEN);
chooser.setSelectionMode(SelectionMode.FILES_AND_DIRECTORIES);
chooser.setFileDeleter(new JNAFileDeleter());
chooser.setListener(new FileChooserListener() {
@Override
public void selected (Array<FileHandle> files) {
if (listener != null) listener.selected(files);
}
@Override
public void canceled () {
if (listener != null) listener.canceled();
}
});
}
示例9: 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
示例10: saveProjectAs
import com.kotcrab.vis.ui.widget.file.FileChooser; //导入方法依赖的package包/类
@LmlAction("saveProjectAs") public void saveProjectAs() {
final ProjectModel project = getProject();
FileHandle projectFile = project.getProjectFile();
FileHandle dir = fileChooserHistory.getLastDir(FileChooserHistory.Type.PROJECT);
if (FileUtils.fileExists(projectFile)) {
dir = projectFile.parent();
}
FileChooser fileChooser = new FileChooser(dir, FileChooser.Mode.SAVE);
fileChooser.setIconProvider(new AppIconProvider(fileChooser));
fileChooser.setSelectionMode(FileChooser.SelectionMode.FILES);
fileChooser.setFileTypeFilter(new FileUtils.FileTypeFilterBuilder(true)
.rule(getString("projectFileDescription", AppConstants.PROJECT_FILE_EXT), AppConstants.PROJECT_FILE_EXT).get());
fileChooser.setListener(new FileChooserAdapter() {
@Override
public void selected (Array<FileHandle> file) {
FileHandle chosenFile = file.first();
fileChooserHistory.putLastDir(FileChooserHistory.Type.PROJECT, chosenFile.parent());
if (chosenFile.extension().length() == 0) {
chosenFile = Gdx.files.getFileHandle(chosenFile.path()+"."+AppConstants.PROJECT_FILE_EXT, chosenFile.type());
}
getProject().setProjectFile(chosenFile);
projectSerializer.saveProject(project, chosenFile);
}
});
getStage().addActor(fileChooser.fadeIn());
if (FileUtils.fileExists(projectFile)) { fileChooser.setSelectedFiles(projectFile); }
}
示例11: process
import com.kotcrab.vis.ui.widget.file.FileChooser; //导入方法依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Actor actor, final String rawAttributeData) {
final FileChooser fileChooser = new FileChooser(Mode.OPEN);
fileChooser.setSelectionMode(getSelectionMode());
FileChooserListenerLmlAttribute.addFileChooserListener(parser, rawAttributeData, fileChooser);
actor.addListener(new PopupAttacher(fileChooser, actor));
}
示例12: showOpenAreaFileChooser
import com.kotcrab.vis.ui.widget.file.FileChooser; //导入方法依赖的package包/类
public void showOpenAreaFileChooser() {
final FileChooser regionFileChooser = new FileChooser(FileChooser.Mode.OPEN);
regionFileChooser.setSelectionMode(FileChooser.SelectionMode.FILES);
regionFileChooser.setFileFilter(new FileExtensionFilter("json"));
regionFileChooser.setListener(new FileChooserAdapter() {
@Override
public void selected(Array<FileHandle> files) {
HelixEditor.getInstance().loadAreaAction(files.get(0).nameWithoutExtension());
}
});
stage.addActor(regionFileChooser.fadeIn());
}
示例13: exportUIImages
import com.kotcrab.vis.ui.widget.file.FileChooser; //导入方法依赖的package包/类
protected void exportUIImages() {
FileChooser fileChooser = new FileChooser(Mode.OPEN);
fileChooser.setSize(Gdx.graphics.getWidth() * 0.7f, Gdx.graphics.getHeight() * 0.7f);
fileChooser.setViewMode(ViewMode.LIST);
fileChooser.setSelectionMode(SelectionMode.DIRECTORIES);
getStage().addActor(fileChooser);
fileChooser.setListener(new FileChooserListener() {
@Override
public void selected(Array<FileHandle> files) {
try {
// fileChooser.setTitle("Select the file to export the
// project texts");
ImageUtils.unpackAtlas(
new File(Ctx.project.getAssetPath() + Project.UI_PATH + "/1/ui.atlas"),
files.get(0).file());
Message.showMsg(getStage(), "UI Atlas images exported sucessfully.", 4);
} catch (Exception e) {
Message.showMsg(getStage(), "There was a problem exporting images from UI Atlas.", 4);
EditorLogger.printStackTrace(e);
}
}
@Override
public void canceled() {
}
});
}
示例14: exportTSV
import com.kotcrab.vis.ui.widget.file.FileChooser; //导入方法依赖的package包/类
private void exportTSV() {
FileChooser fileChooser = new FileChooser(Mode.SAVE);
fileChooser.setSize(Gdx.graphics.getWidth() * 0.7f, Gdx.graphics.getHeight() * 0.7f);
fileChooser.setViewMode(ViewMode.LIST);
fileChooser.setSelectionMode(SelectionMode.FILES);
getStage().addActor(fileChooser);
fileChooser.setListener(new FileChooserListener() {
@Override
public void selected(Array<FileHandle> files) {
try {
// fileChooser.setTitle("Select the file to export the
// project texts");
I18NUtils.exportTSV(Ctx.project.getAssetPath() + Project.MODEL_PATH,
files.get(0).file().getAbsolutePath(), Ctx.project.getChapter().getId(), "default");
Message.showMsg(getStage(), files.get(0).file().getName() + " exported sucessfully.", 4);
} catch (IOException e) {
Message.showMsg(getStage(), "There was a problem generating the .tsv file.", 4);
EditorLogger.printStackTrace(e);
}
}
@Override
public void canceled() {
}
});
}
示例15: importTSV
import com.kotcrab.vis.ui.widget.file.FileChooser; //导入方法依赖的package包/类
private void importTSV() {
FileChooser fileChooser = new FileChooser(Mode.OPEN);
fileChooser.setSize(Gdx.graphics.getWidth() * 0.7f, Gdx.graphics.getHeight() * 0.7f);
fileChooser.setViewMode(ViewMode.LIST);
fileChooser.setSelectionMode(SelectionMode.FILES);
getStage().addActor(fileChooser);
fileChooser.setListener(new FileChooserListener() {
@Override
public void selected(Array<FileHandle> files) {
try {
// chooser.setTitle("Select the .tsv file to import");
I18NUtils.importTSV(Ctx.project.getAssetPath() + Project.MODEL_PATH,
files.get(0).file().getAbsolutePath(), Ctx.project.getChapter().getId(), "default");
// Reload texts
Ctx.project.getI18N().load(Ctx.project.getChapter().getId());
Message.showMsg(getStage(), files.get(0).file().getName() + " imported sucessfully.", 4);
} catch (IOException e) {
Message.showMsg(getStage(), "There was a problem importing the .tsv file.", 4);
EditorLogger.printStackTrace(e);
}
}
@Override
public void canceled() {
}
});
}