use of org.freeplane.features.filter.condition.IElementaryConditionController in project freeplane by freeplane.
the class FilterConditionEditor method setValuesEditor.
private void setValuesEditor() {
final Object selectedProperty = filteredPropertiesComponent.getSelectedItem();
final IElementaryConditionController conditionController = filterController.getConditionFactory().getConditionController(selectedProperty);
final TranslatedObject selectedCondition = (TranslatedObject) elementaryConditions.getSelectedItem();
final boolean canSelectValues = conditionController.canSelectValues(selectedProperty, selectedCondition);
values.setEnabled(canSelectValues);
values.setEditable(false);
values.setModel(conditionController.getValuesForProperty(selectedProperty, selectedCondition));
final ComboBoxEditor valueEditor = conditionController.getValueEditor(selectedProperty, selectedCondition);
values.setEditor(valueEditor != null ? valueEditor : new FixedBasicComboBoxEditor());
setValuesEnterKeyListener();
final ListCellRenderer valueRenderer = conditionController.getValueRenderer(selectedProperty, selectedCondition);
values.setRenderer(valueRenderer != null ? valueRenderer : filterController.getConditionRenderer());
values.setEditable(conditionController.canEditValues(selectedProperty, selectedCondition));
if (values.getModel().getSize() > 0) {
values.setSelectedIndex(0);
}
caseSensitive.setEnabled(canSelectValues && conditionController.isCaseDependent(selectedProperty, selectedCondition));
approximateMatching.setEnabled(canSelectValues && conditionController.supportsApproximateMatching(selectedProperty, selectedCondition));
}
use of org.freeplane.features.filter.condition.IElementaryConditionController in project freeplane by freeplane.
the class FilterConditionEditor method mapChanged.
/**
*/
public void mapChanged(final MapModel newMap) {
if (newMap != null) {
if (lastMap != null && lastMap.get() == newMap) {
return;
}
filteredPropertiesModel.removeAllElements();
final Iterator<IElementaryConditionController> conditionIterator = filterController.getConditionFactory().conditionIterator();
while (conditionIterator.hasNext()) {
final IElementaryConditionController next = conditionIterator.next();
filteredPropertiesModel.addExtensionList(next.getFilteredProperties());
filteredPropertiesModel.setSelectedItem(filteredPropertiesModel.getElementAt(0));
}
} else {
filteredPropertiesComponent.setSelectedIndex(-1);
filteredPropertiesModel.setExtensionList(null);
}
lastMap = new WeakReference<MapModel>(newMap);
}
Aggregations