Search in sources :

Example 1 with CheckListTableEntry

use of alma.acs.gui.widgets.CheckList.CheckListTableEntry in project ACS by ACS-Community.

the class FilterChooserDialog method saveFilters.

/**
	 * Save the filters to a XML files with a given name It create the File
	 * object then call overloaded method
	 * 
	 * @param fileName The name of the xml file
	 */
private void saveFilters(String fileName) {
    if (fileName == null || fileName.length() == 0) {
        throw new IllegalArgumentException("Inavlid file name: " + fileName);
    }
    // Check if the name terminate with xml
    if (!fileName.toUpperCase().endsWith(".XML")) {
        fileName = fileName + ".xml";
    }
    List<CheckListTableEntry> entries = filterList.getEntries();
    FiltersVector filters = new FiltersVector();
    for (CheckListTableEntry entry : entries) {
        filters.addFilter((Filter) entry.getItem(), entry.isActive());
    }
    File f = new File(fileName);
    try {
        filters.saveFilters(f);
        filterFileName = f.getAbsolutePath();
        System.out.println("Saved " + filterFileName);
    } catch (IOException e) {
        System.err.println("Error opening " + fileName);
    }
}
Also used : FiltersVector(com.cosylab.logging.engine.FiltersVector) IOException(java.io.IOException) CheckListTableEntry(alma.acs.gui.widgets.CheckList.CheckListTableEntry) File(java.io.File)

Example 2 with CheckListTableEntry

use of alma.acs.gui.widgets.CheckList.CheckListTableEntry in project ACS by ACS-Community.

the class FilterChooserDialog method applyFilters.

/**
	 * Apply the filters in the table of logs
	 *
	 */
private void applyFilters() {
    FiltersVector newFilters = new FiltersVector();
    for (CheckListTableEntry entry : filterList.getEntries()) {
        newFilters.addFilter((Filter) entry.getItem(), entry.isActive());
    }
    filterable.setFilters(newFilters, false);
}
Also used : FiltersVector(com.cosylab.logging.engine.FiltersVector) CheckListTableEntry(alma.acs.gui.widgets.CheckList.CheckListTableEntry)

Aggregations

CheckListTableEntry (alma.acs.gui.widgets.CheckList.CheckListTableEntry)2 FiltersVector (com.cosylab.logging.engine.FiltersVector)2 File (java.io.File)1 IOException (java.io.IOException)1