/** * filters out all non-core savers if only those should be displayed. * * @param list the list of filters to check * @return the filtered list of filters * @see #m_CoreConvertersOnly */ protected Vector<ExtensionFileFilter> filterNonCoreSaverFileFilters( Vector<ExtensionFileFilter> list) { Vector<ExtensionFileFilter> result; int i; ExtensionFileFilter filter; AbstractSaver saver; if (!getCoreConvertersOnly()) { result = list; } else { result = new Vector<ExtensionFileFilter>(); for (i = 0; i < list.size(); i++) { filter = list.get(i); saver = ConverterUtils.getSaverForExtension(filter.getExtensions()[0]); if (ConverterUtils.isCoreFileSaver(saver.getClass().getName())) { result.add(filter); } } } return result; }
/** * filters the list of file filters according to the currently set. * Capabilities * * @param list the filters to check * @return the filtered list of filters */ protected Vector<ExtensionFileFilter> filterSaverFileFilters( Vector<ExtensionFileFilter> list) { Vector<ExtensionFileFilter> result; int i; ExtensionFileFilter filter; AbstractSaver saver; if (m_CapabilitiesFilter == null) { result = list; } else { result = new Vector<ExtensionFileFilter>(); for (i = 0; i < list.size(); i++) { filter = list.get(i); saver = ConverterUtils.getSaverForExtension(filter.getExtensions()[0]); if (saver.getCapabilities().supports(m_CapabilitiesFilter)) { result.add(filter); } } } return result; }
/** * filters out all non-core savers if only those should be displayed. * * @param list the list of filters to check * @return the filtered list of filters * @see #m_CoreConvertersOnly */ protected Vector<ExtensionFileFilter> filterNonCoreSaverFileFilters(Vector<ExtensionFileFilter> list) { Vector<ExtensionFileFilter> result; int i; ExtensionFileFilter filter; AbstractSaver saver; if (!getCoreConvertersOnly()) { result = list; } else { result = new Vector<ExtensionFileFilter>(); for (i = 0; i < list.size(); i++) { filter = list.get(i); saver = ConverterUtils.getSaverForExtension(filter.getExtensions()[0]); if (ConverterUtils.isCoreFileSaver(saver.getClass().getName())) result.add(filter); } } return result; }
/** * filters the list of file filters according to the currently set. * Capabilities * * @param list the filters to check * @return the filtered list of filters */ protected Vector<ExtensionFileFilter> filterSaverFileFilters(Vector<ExtensionFileFilter> list) { Vector<ExtensionFileFilter> result; int i; ExtensionFileFilter filter; AbstractSaver saver; if (m_CapabilitiesFilter == null) { result = list; } else { result = new Vector<ExtensionFileFilter>(); for (i = 0; i < list.size(); i++) { filter = list.get(i); saver = ConverterUtils.getSaverForExtension(filter.getExtensions()[0]); if (saver.getCapabilities().supports(m_CapabilitiesFilter)) result.add(filter); } } return result; }
/** * filters out all non-core savers if only those should be displayed * * @param list the list of filters to check * @return the filtered list of filters * @see #m_CoreConvertersOnly */ protected Vector<ExtensionFileFilter> filterNonCoreSaverFileFilters(Vector<ExtensionFileFilter> list) { Vector<ExtensionFileFilter> result; int i; ExtensionFileFilter filter; AbstractSaver saver; if (!getCoreConvertersOnly()) { result = list; } else { result = new Vector<ExtensionFileFilter>(); for (i = 0; i < list.size(); i++) { filter = list.get(i); saver = ConverterUtils.getSaverForExtension(filter.getExtensions()[0]); if (ConverterUtils.isCoreFileSaver(saver.getClass().getName())) result.add(filter); } } return result; }
/** * filters the list of file filters according to the currently set * Capabilities * * @param list the filters to check * @return the filtered list of filters */ protected Vector<ExtensionFileFilter> filterSaverFileFilters(Vector<ExtensionFileFilter> list) { Vector<ExtensionFileFilter> result; int i; ExtensionFileFilter filter; AbstractSaver saver; if (m_CapabilitiesFilter == null) { result = list; } else { result = new Vector<ExtensionFileFilter>(); for (i = 0; i < list.size(); i++) { filter = list.get(i); saver = ConverterUtils.getSaverForExtension(filter.getExtensions()[0]); if (saver.getCapabilities().supports(m_CapabilitiesFilter)) result.add(filter); } } return result; }
/** * saves the current data into a file */ public void saveFile() { ArffPanel panel; String filename; AbstractSaver saver; // no panel? -> exit panel = getCurrentPanel(); if (panel == null) { return; } filename = panel.getFilename(); if (filename.equals(ArffPanel.TAB_INSTANCES)) { saveFileAs(); } else { saver = ConverterUtils.getSaverForFile(filename); try { saver.setFile(new File(filename)); saver.setInstances(panel.getInstances()); saver.writeBatch(); panel.setChanged(false); setCurrentFilename(filename); } catch (Exception e) { e.printStackTrace(); } } }
/** * saves the current data into a file */ public void saveFile() { ArffPanel panel; String filename; AbstractSaver saver; // no panel? -> exit panel = getCurrentPanel(); if (panel == null) return; filename = panel.getFilename(); if (filename.equals(ArffPanel.TAB_INSTANCES)) { saveFileAs(); } else { saver = ConverterUtils.getSaverForFile(filename); try { saver.setInstances(panel.getInstances()); saver.setFile(new File(filename)); saver.writeBatch(); panel.setChanged(false); setCurrentFilename(filename); } catch (Exception e) { e.printStackTrace(); } } }