use of org.freeplane.core.util.collection.SortedComboBoxModel in project freeplane by freeplane.
the class ImportAttributesDialog method createValueSubTrees.
private void createValueSubTrees(final DefaultMutableTreeNode attributeInfo, final AttributeRegistryElement element, final AttributeRegistry currentAttributes) {
final String attributeName = element.getKey().toString();
final SortedComboBoxModel values = element.getValues();
for (int i = 0; i < values.getSize(); i++) {
final Object nextElement = values.getElementAt(i);
if (!currentAttributes.exist(attributeName, nextElement)) {
final TreeNodeInfo treeNodeInfo = new TreeNodeInfo(nextElement.toString());
final DefaultMutableTreeNode valueInfo = new DefaultMutableTreeNode(treeNodeInfo);
attributeInfo.add(valueInfo);
}
}
}
use of org.freeplane.core.util.collection.SortedComboBoxModel in project freeplane by freeplane.
the class AttributeConditionController method getValuesForProperty.
public ComboBoxModel getValuesForProperty(final Object selectedItem, TranslatedObject simpleCond) {
final MapModel map = Controller.getCurrentController().getMap();
final AttributeRegistry registry = AttributeRegistry.getRegistry(map);
try {
final AttributeRegistryElement element = registry.getElement(selectedItem.toString());
final SortedComboBoxModel list = element.getValues();
SortedComboBoxModel linkedList = new SortedComboBoxModel();
for (int i = 0; i < list.getSize(); i++) {
final Object value = list.getElementAt(i);
final TextController textController = TextController.getController();
if (!textController.isFormula(value, null, null)) {
try {
final Object transformedValue = textController.getTransformedObject(value, map.getRootNode(), null);
linkedList.add(transformedValue);
} catch (TransformationException e) {
LogUtils.severe(e);
}
}
}
values.setExtensionList(linkedList);
} catch (NoSuchElementException e) {
values.setExtensionList(null);
}
return values;
}
use of org.freeplane.core.util.collection.SortedComboBoxModel in project freeplane by freeplane.
the class IconRegistry method addIcons.
public void addIcons(final MapModel map) {
final IconRegistry newRegistry = map.getIconRegistry();
final SortedComboBoxModel newMapIcons = newRegistry.mapIcons;
for (final Object uiIcon : newMapIcons) {
mapIcons.add(uiIcon);
}
}
use of org.freeplane.core.util.collection.SortedComboBoxModel in project freeplane by freeplane.
the class AttributeRegistry method exist.
public boolean exist(final String attributeName, final Object element) {
final int index = indexOf(attributeName);
if (index == -1) {
return false;
}
final SortedComboBoxModel values = getElement(index).getValues();
for (int i = 0; i < values.getSize(); i++) {
if (element.equals(values.getElementAt(i))) {
return true;
}
}
return false;
}
use of org.freeplane.core.util.collection.SortedComboBoxModel in project freeplane by freeplane.
the class MAttributeController method performReplaceAtributeName.
@Override
public void performReplaceAtributeName(final String oldName, final String newName) {
if (oldName.equals("") || newName.equals("") || oldName.equals(newName)) {
return;
}
final MapModel map = Controller.getCurrentModeController().getController().getMap();
final AttributeRegistry registry = AttributeRegistry.getRegistry(map);
final int iOld = registry.getElements().indexOf(oldName);
final AttributeRegistryElement oldElement = registry.getElement(iOld);
final SortedComboBoxModel values = oldElement.getValues();
final IActor registryActor = new RegistryAttributeActor(newName, oldElement.isManual(), oldElement.isVisible(), registry, map);
Controller.getCurrentModeController().execute(registryActor, map);
final AttributeRegistryElement newElement = registry.getElement(newName);
for (int i = 0; i < values.getSize(); i++) {
final IActor registryValueActor = new RegistryAttributeValueActor(newElement, values.getElementAt(i).toString(), false);
Controller.getCurrentModeController().execute(registryValueActor, map);
}
final IVisitor replacer = new AttributeRenamer(oldName, newName);
final Iterator iterator = new Iterator(replacer);
ModeController modeController = Controller.getCurrentModeController();
final NodeModel root = modeController.getMapController().getRootNode();
iterator.iterate(root);
final IActor unregistryActor = new UnregistryAttributeActor(oldName, registry, map);
Controller.getCurrentModeController().execute(unregistryActor, map);
}
Aggregations