use of org.pentaho.gwt.widgets.client.filechooser.RepositoryFile in project pentaho-platform by pentaho.
the class FileDialog method show.
public void show() {
String pathToShow = (path != null) ? path : FileDialog.lastPath;
final SolutionBrowserPanel solutionBrowserPerspective = SolutionBrowserPanel.getInstance();
final FileChooserDialog dialog = new FileChooserDialog(FileChooserMode.OPEN, pathToShow, repositoryFileTree, false, true, title, okText, solutionBrowserPerspective.getSolutionTree().isShowHiddenFiles()) {
@Override
public void hide() {
super.hide();
GlassPane.getInstance().hide();
}
};
dialog.setSubmitOnEnter(MantleApplication.submitOnEnter);
dialog.addFileChooserListener(new FileChooserListener() {
public void fileSelected(RepositoryFile file, String filePath, String fileName, String title) {
dialog.hide();
for (FileChooserListener listener : listeners) {
listener.fileSelected(file, filePath, fileName, title);
}
}
public void fileSelectionChanged(RepositoryFile file, String filePath, String fileName, String title) {
}
public void dialogCanceled() {
}
});
dialog.setFileFilter(new FileFilter() {
public boolean accept(String name, boolean isDirectory, boolean isVisible) {
if (isDirectory && isVisible) {
return true;
}
if (name.indexOf(".") == -1) {
return false;
}
String extension = name.substring(name.lastIndexOf(".") + 1);
for (int i = 0; i < fileTypes.length; i++) {
if (fileTypes[i].trim().equalsIgnoreCase(extension) && isVisible) {
return true;
}
}
return false;
}
});
GlassPane.getInstance().show();
dialog.center();
}
use of org.pentaho.gwt.widgets.client.filechooser.RepositoryFile in project pentaho-platform by pentaho.
the class NewFolderCommand method performOperation.
protected void performOperation() {
if (this.getSolutionPath() != null) {
final SolutionBrowserPanel sbp = SolutionBrowserPanel.getInstance();
if (callback == null) {
setCallback(new ICallback<String>() {
public void onHandle(String path) {
sbp.getSolutionTree().select(path);
}
});
}
sbp.getFile(this.getSolutionPath(), new SolutionFileHandler() {
@Override
public void handle(RepositoryFile repositoryFile) {
NewFolderCommand.this.parentFolder = repositoryFile;
performOperation(true);
}
});
} else {
performOperation(true);
}
}
use of org.pentaho.gwt.widgets.client.filechooser.RepositoryFile in project pentaho-platform by pentaho.
the class OpenFileCommand method performOperation.
protected void performOperation(boolean feedback) {
final IPluginPerspective activePerspective = PerspectiveManager.getInstance().getActivePerspective();
final SolutionBrowserPanel solutionBrowserPerspective = SolutionBrowserPanel.getInstance();
boolean forceReload = false;
if (FileChooserDialog.getIsDirty()) {
forceReload = true;
WaitPopup.getInstance().setVisibleById(true, spinnerId);
FileChooserDialog.setIsDirty(Boolean.FALSE);
}
RepositoryFileTreeManager.getInstance().fetchRepositoryFileTree(new AsyncCallback<RepositoryFileTree>() {
public void onFailure(Throwable caught) {
}
public void onSuccess(RepositoryFileTree tree) {
// TODO Uncomment the line below and delete the line after that once gwtwidets have been branched
WaitPopup.getInstance().setVisibleById(false, spinnerId);
final FileChooserDialog dialog = new FileChooserDialog(FileChooserMode.OPEN, lastPath, tree, false, true, solutionBrowserPerspective.getSolutionTree().isShowHiddenFiles());
dialog.setSubmitOnEnter(MantleApplication.submitOnEnter);
dialog.addFileChooserListener(new FileChooserListener() {
public void dialogCanceled() {
// retain current active perspective
PerspectiveManager.getInstance().setPerspective(activePerspective.getId());
}
@Override
public void fileSelected(RepositoryFile repositoryFile, String filePath, String fileName, String title) {
dialog.hide();
solutionBrowserPerspective.openFile(repositoryFile, openMethod);
}
@Override
public void fileSelectionChanged(RepositoryFile repositoryFile, String filePath, String fileName, String title) {
// TODO Auto-generated method stub
}
});
dialog.center();
}
}, forceReload, null, null, SolutionBrowserPanel.getInstance().getSolutionTree().isShowHiddenFiles());
}
Aggregations