use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.
the class ControlGroupChangeListener method propertyChange.
public void propertyChange(final PropertyChangeEvent evt) {
if (internalChange) {
return;
}
final boolean enabled;
if (evt.getSource().equals(mSet)) {
enabled = mSet.getBooleanValue();
} else {
assert properties.contains(evt.getSource());
enabled = true;
}
final IMapSelection selection = Controller.getCurrentController().getSelection();
final Collection<NodeModel> nodes = selection.getSelection();
if (enabled)
internalChange = true;
for (final NodeModel node : nodes) {
applyValue(enabled, node, evt);
}
if (enabled && !mSet.getBooleanValue())
mSet.setValue(true);
internalChange = false;
setStyle(selection.getSelected());
}
use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.
the class NewSummaryAction method addNewSummaryNodeStartEditing.
private boolean addNewSummaryNodeStartEditing() {
final ModeController modeController = Controller.getCurrentModeController();
final IMapSelection selection = modeController.getController().getSelection();
final List<NodeModel> sortedSelection = selection.getSortedSelection(false);
final NodeModel firstNode = sortedSelection.get(0);
final NodeModel lastNode = sortedSelection.get(sortedSelection.size() - 1);
final boolean isLeft = firstNode.isLeft();
// different sides
if (isLeft != lastNode.isLeft()) {
return false;
}
final NodeModel parentNode = firstNode.getParentNode();
if (parentNode == null)
return false;
final NodeModel lastParent = lastNode.getParentNode();
if (lastParent == null)
return false;
if (parentNode.equals(lastParent))
return addNewSummaryNodeStartEditing(firstNode, lastNode);
else {
final NodeRelativePath nodeRelativePath = new NodeRelativePath(firstNode, lastNode);
NodeModel commonAncestor = nodeRelativePath.commonAncestor();
if (commonAncestor == firstNode || commonAncestor == lastNode)
return false;
final NodeModel newFirstNode = nodeRelativePath.beginPathElement(1);
final NodeModel newLastNode = nodeRelativePath.endPathElement(1);
return addNewSummaryNodeStartEditing(newFirstNode, newLastNode);
}
}
use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.
the class MoveSelectedNodeAction method actionPerformed.
public void actionPerformed(final ActionEvent e) {
final IMapSelection selection = Controller.getCurrentController().getSelection();
final Component mapView = Controller.getCurrentController().getMapViewManager().getMapViewComponent();
final JRootPane rootPane = SwingUtilities.getRootPane(mapView);
if (!rootPane.isValid()) {
rootPane.revalidate();
}
if (ResourceController.getResourceController().getBooleanProperty(MOVE_SLOWLY_PROPERTY))
selection.slowlyMoveNodeTo(selection.getSelected(), nodePosition);
else
selection.moveNodeTo(selection.getSelected(), nodePosition);
}
use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.
the class ApplicationViewController method removeSplitPane.
@Override
public void removeSplitPane() {
saveSplitPanePosition();
mMindMapComponent = null;
mSplitPane.setLeftComponent(null);
mSplitPane.setRightComponent(null);
mSplitPane.setLeftComponent(mapPane);
setSplitPaneLayoutManager();
final Controller controller = Controller.getCurrentModeController().getController();
final IMapSelection selection = controller.getSelection();
if (selection == null) {
return;
}
final NodeModel node = selection.getSelected();
EventQueue.invokeLater(new Runnable() {
public void run() {
final Component component = controller.getMapViewManager().getComponent(node);
if (component != null) {
component.requestFocus();
}
}
});
}
use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.
the class ControllerProxy method selectMultipleNodes.
public void selectMultipleNodes(final Collection<Node> toSelect) {
final IMapSelection selection = Controller.getCurrentController().getSelection();
final Iterator<Node> it = toSelect.iterator();
if (!it.hasNext()) {
return;
}
selection.selectAsTheOnlyOneSelected(((NodeProxy) it.next()).getDelegate());
while (it.hasNext()) {
final NodeModel nodeModel = ((NodeProxy) it.next()).getDelegate();
Controller.getCurrentController().getSelection().toggleSelected(nodeModel);
}
}
Aggregations