use of org.cytoscape.filter.internal.filters.model.CompositeFilter in project cytoscape-impl by cytoscape.
the class TopoFilterPanel method buildCMBmodel.
private void buildCMBmodel() {
// Create an empty filter, add to the top of the filter list in the combobox
CompositeFilter emptyFilter = new CompositeFilter("None");
Vector<CompositeFilter> tmpVect = new Vector<CompositeFilter>();
tmpVect.add(emptyFilter);
Vector<CompositeFilter> allFilters = modelLocator.getFilters();
tmpVect.addAll(allFilters);
PassFilterWidestStringComboBoxModel pfwscbm = new PassFilterWidestStringComboBoxModel(tmpVect);
cmbPassFilter.setModel(pfwscbm);
if (theFilter.getPassFilter() != null) {
cmbPassFilter.setSelectedIndex(0);
cmbPassFilter.setSelectedItem(theFilter.getPassFilter());
}
}
use of org.cytoscape.filter.internal.filters.model.CompositeFilter in project cytoscape-impl by cytoscape.
the class FilterSettingPanel method updateNegationStatus.
// user Clicked CheckBox_Not left-side of the child filter
private void updateNegationStatus(JCheckBox _chk) {
int widgetGridY = (new Integer(_chk.getName())).intValue();
int childIndex = widgetGridY / 2;
CyFilter childFilter = theFilter.getChildren().get(childIndex);
if (childFilter instanceof CompositeFilter) {
CompositeFilter tmpFilter = (CompositeFilter) childFilter;
theFilter.setNotTable(tmpFilter, new Boolean(_chk.isSelected()));
} else {
// it is an AtomiCFilter
childFilter.setNegation(_chk.isSelected());
}
// Update the selection on screen
doSelection();
}
use of org.cytoscape.filter.internal.filters.model.CompositeFilter in project cytoscape-impl by cytoscape.
the class FilterSettingPanel method updateSelectionType.
private void updateSelectionType() {
boolean selectNode = false;
boolean selectEdge = false;
List<CyFilter> childFilters = theFilter.getChildren();
for (int i = 0; i < childFilters.size(); i++) {
CyFilter child = childFilters.get(i);
if (child instanceof AtomicFilter) {
AtomicFilter tmp = (AtomicFilter) child;
if (tmp.getIndexType() == QuickFind.INDEX_NODES) {
selectNode = true;
}
if (tmp.getIndexType() == QuickFind.INDEX_EDGES) {
selectEdge = true;
}
} else if (child instanceof CompositeFilter) {
CompositeFilter tmp = (CompositeFilter) child;
if (tmp.getAdvancedSetting().isNodeChecked()) {
selectNode = true;
}
if (tmp.getAdvancedSetting().isEdgeChecked()) {
selectEdge = true;
}
}
}
// end of for loop
theFilter.getAdvancedSetting().setNode(selectNode);
theFilter.getAdvancedSetting().setEdge(selectEdge);
}
use of org.cytoscape.filter.internal.filters.model.CompositeFilter in project cytoscape-impl by cytoscape.
the class FilterApp method loadDefaultFilters.
private Collection<CompositeFilter> loadDefaultFilters() {
Collection<CompositeFilter> filters = null;
InputStream is = null;
try {
// Load global filters from CyProperty.DEFAULT_PROPS_CONFIG_DIR directory.
final File file = getGlobalFilterFile();
if (file.exists()) {
try {
is = new FileInputStream(file);
} catch (Exception e) {
logger.error("Cannot load default filter from config directory.", e);
}
}
// If there is no global filters, load a default one
if (is == null) {
// note: "/" works for both Mac and Windows, File.separator does not work on Windows
String fileName = "/" + FilterUtil.DEFAULT_FILE_NAME;
try {
is = getClass().getResourceAsStream(fileName);
} catch (Exception e) {
logger.error("Cannot load default filters from jar.", e);
}
}
if (is != null)
filters = reader.read(is);
else
logger.warn("could not find resource: " + file.getAbsolutePath());
} finally {
if (is != null) {
try {
is.close();
} catch (IOException ioe) {
}
is = null;
}
}
return filters;
}
use of org.cytoscape.filter.internal.filters.model.CompositeFilter in project cytoscape-impl by cytoscape.
the class FilterApp method saveGlobalFilters.
private void saveGlobalFilters() {
// Get current global filters
Set<CompositeFilter> globalFilters = new LinkedHashSet<CompositeFilter>();
for (CompositeFilter cf : modelLocator.getFilters()) {
if (cf.getAdvancedSetting().isGlobalChecked())
globalFilters.add(cf);
}
// Save global filters in the CyProperty.DEFAULT_PROPS_CONFIG_DIR directory
final File file = getGlobalFilterFile();
writer.saveGlobalPropFile(globalFilters, file);
}
Aggregations