void updateFileBrowser(File file, AjaxRequestTarget target) { if(file.isDirectory()) { directoryClicked(file, target); } else if(file.isFile()) { fileClicked(file, target); } }
private boolean isSubfile(File root, File selection) { if(selection == null || "".equals(selection.getPath())) return false; if(selection.equals(root)) return true; return isSubfile(root, selection.getParentFile()); }
@Override protected void pathItemClicked(File file, AjaxRequestTarget target) { updateFileBrowser(file, target); } };
if(selection != null && selection.exists()) { for (File root : roots) { if(isSubfile(root, selection.getAbsoluteFile())) { selectionRoot = root; break; setDefaultModel(file); add(choice); add(breadcrumbs); add(fileTable);
@Override public void onSubmit(AjaxRequestTarget target, Form<?> form) { File file = null; textField.processInput(); String input = textField.getConvertedInput(); if (input != null && !input.equals("")) { file = new File(input); } GeoServerFileChooser chooser = new GeoServerFileChooser( dialog.getContentId(), new Model<File>(file)) { private static final long serialVersionUID = -7096642192491726498L; protected void fileClicked( File file, AjaxRequestTarget target) { // clear the raw input of the field won't show the new model // value textField.clearInput(); textField.setModelObject(file.getAbsolutePath()); target.add(textField); dialog.close(target); }; }; chooser.setFileTableHeight(null); chooser.setFilter(fileFilter); dialog.setContent(chooser); dialog.setTitle(windowTitle); dialog.show(target); } };
@Override public void onSubmit(AjaxRequestTarget target, Form form) { File file = null; textField.processInput(); String input = textField.getConvertedInput(); if (input != null && !input.equals("")) { file = new File(input); } GeoServerFileChooser chooser = new GeoServerFileChooser(modal.getContentId(), new Model(file)) { protected void fileClicked( File file, AjaxRequestTarget target) { // clear the raw input of the field won't show the new model // value textField.clearInput(); textField.setModelObject(file.getAbsolutePath()); target.add(textField); dialog.close(target); }; }; chooser.setFileTableHeight(null); modal.setContent(chooser); modal.setTitle(windowTitle); modal.show(target); } };
if (selection != null && selection.exists()) { for (File root : roots) { if (isSubfile(root, selection.getAbsoluteFile())) { selectionRoot = root; break; setDefaultModel(file); add(choice); add(breadcrumbs); add(fileTable);
@Override public void onSubmit(AjaxRequestTarget target, Form form) { File file = null; textField.processInput(); String input = (String) textField.getConvertedInput(); if (input != null && !input.equals("")) { file = new File(input); } GeoServerFileChooser chooser = new GeoServerFileChooser(dialog.getContentId(), new Model(file)) { protected void fileClicked(File file, AjaxRequestTarget target) { // clear the raw input of the field won't show the new model value textField.clearInput(); textField.setModelObject(file.getAbsolutePath()); target.addComponent(textField); dialog.close(target); }; }; chooser.setFileTableHeight(null); chooser.setFilter(fileFilter); dialog.setContent(chooser); dialog.setTitle(windowTitle); dialog.show(target); }
void updateFileBrowser(File file, AjaxRequestTarget target) { if (file.isDirectory()) { directoryClicked(file, target); } else if (file.isFile()) { fileClicked(file, target); } }
@Override protected void pathItemClicked(File file, AjaxRequestTarget target) { updateFileBrowser(file, target); }
private boolean isSubfile(File root, File selection) { if (selection == null || "".equals(selection.getPath())) return false; if (selection.equals(root)) return true; return isSubfile(root, selection.getParentFile()); }
@Override protected void linkNameClicked(File file, AjaxRequestTarget target) { updateFileBrowser(file, target); }
@Override protected void linkNameClicked(File file, AjaxRequestTarget target) { updateFileBrowser(file, target); } };
@Override protected void onUpdate(AjaxRequestTarget target) { File selection = choice.getModelObject(); breadcrumbs.setRootFile(selection); updateFileBrowser(selection, target); } });
@Override protected void onUpdate(AjaxRequestTarget target) { File selection = (File) choice.getModelObject(); breadcrumbs.setRootFile(selection); updateFileBrowser(selection, target); }