org.apache.pivot.wtk.Dialog Java Examples
The following examples show how to use
org.apache.pivot.wtk.Dialog.
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: OpenConnection.java From GeoTriples with Apache License 2.0 | 4 votes |
private void openShapeFile(){ final FileBrowserSheet fileBrowserSheet = new FileBrowserSheet(); fileBrowserSheet.setName("Select a shapefile"); fileBrowserSheet.setDisabledFileFilter(new Filter<File>() { @Override public boolean include(File file) { return (file.isFile() && !file.getName().endsWith(".shp")); } }); fileBrowserSheet.setMode(org.apache.pivot.wtk.FileBrowserSheet.Mode.OPEN); fileBrowserSheet.open(OpenConnection.this, new SheetCloseListener() { @Override public void sheetClosed(Sheet sheet) { if (sheet.getResult()) { Sequence<File> selectedFiles = fileBrowserSheet .getSelectedFiles(); ListView listView = new ListView(); listView.setListData(new ArrayList<File>(selectedFiles)); listView.setSelectMode(ListView.SelectMode.NONE); listView.getStyles().put("backgroundColor", null); /*Alert.alert(MessageType.INFO, "You selected the shapefile:","Successfully Load", listView, OpenConnection.this,null);*/ try { url = selectedFiles.get(0).getCanonicalPath(); } catch (IOException e) { System.out.println(e.getMessage()); e.printStackTrace(); System.exit(13); } // connection=con; //set connection con = new ShapefileConnection(url); if (con == null) { Alert.alert(MessageType.ERROR, "Error opening shapefile. Aborting..","Error",null, OpenConnection.this, new DialogCloseListener() { @Override public void dialogClosed(Dialog dialog, boolean modal) { OpenConnection.this.close(false); System.exit(13); } }); } isConnected=true; close(true); } else { /*Alert.alert(MessageType.ERROR, "You didn't select any shapefile.", OpenConnection.this, new DialogCloseListener() { @Override public void dialogClosed(Dialog dialog, boolean modal) { //System.exit(13); } });*/ close(false); } } }); }