Java Code Examples for com.kotcrab.vis.ui.widget.file.FileChooser#setIconProvider()
The following examples show how to use
com.kotcrab.vis.ui.widget.file.FileChooser#setIconProvider() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PackInputFilesController.java From gdx-texture-packer-gui with Apache License 2.0 | 6 votes |
@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()); }
Example 2
Source File: PackInputFilesController.java From gdx-texture-packer-gui with Apache License 2.0 | 6 votes |
@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()); }
Example 3
Source File: NinePatchToolController.java From gdx-texture-packer-gui with Apache License 2.0 | 6 votes |
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); } }
Example 4
Source File: TextureUnpackerDialogController.java From gdx-texture-packer-gui with Apache License 2.0 | 6 votes |
@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()); }
Example 5
Source File: TextureUnpackerDialogController.java From gdx-texture-packer-gui with Apache License 2.0 | 6 votes |
@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()); }
Example 6
Source File: GlobalActions.java From gdx-texture-packer-gui with Apache License 2.0 | 6 votes |
@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) { final FileHandle chosenFile = file.first(); commonDialogs.checkUnsavedChanges(new Runnable() { @Override public void run() { loadProject(chosenFile); } }); } }); getStage().addActor(fileChooser.fadeIn()); }
Example 7
Source File: GlobalActions.java From gdx-texture-packer-gui with Apache License 2.0 | 6 votes |
@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()); }
Example 8
Source File: InputFilePropertiesDialogController.java From gdx-texture-packer-gui with Apache License 2.0 | 5 votes |
@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()); } }
Example 9
Source File: GlobalActions.java From gdx-texture-packer-gui with Apache License 2.0 | 5 votes |
@LmlAction("saveProjectAs") public void saveProjectAs() { resetViewFocus(); 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); } }