use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.
the class PresentationPngExporter method restorePreviousPresentation.
private void restorePreviousPresentation() {
presentationState.restore();
presentationZoomFactor = 1f;
final IMapSelection selectionController = Controller.getCurrentController().getSelection();
selectionController.replaceSelection(selection);
if (!presentationState.isPresentationRunning())
Controller.getCurrentController().getMapViewManager().setZoom(zoom);
ResourceController.getResourceController().setProperty(Slide.PRESENTATION_SLOW_MOTION_KEY, presentationSlowMotionEnabled);
if (spotlightEnabledForExport)
mapViewComponent.putClientProperty(MapView.SPOTLIGHT_ENABLED, null);
selectionController.scrollNodeToVisible(selectionController.getSelected());
}
use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.
the class Slide method scrollMapToSelectedNode.
private void scrollMapToSelectedNode() {
if (placedNodeId == null) {
final Controller controller = Controller.getCurrentController();
final IMapSelection selection = controller.getSelection();
if (selection != null) {
final NodeModel selected = selection.getSelected();
controller.getMapViewManager().scrollNodeToVisible(selected);
}
}
}
use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.
the class Slide method getCurrentPlacedNode.
public NodeModel getCurrentPlacedNode() {
if (placedNodeId != null) {
MapModel map = getMap();
NodeModel currentPlacedNode = map.getNodeForID(placedNodeId);
final IMapSelection selection = Controller.getCurrentController().getSelection();
if (currentPlacedNode != null && currentPlacedNode.hasVisibleContent()) {
return currentPlacedNode;
} else {
return selection.getSelected();
}
} else
return null;
}
use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.
the class SelectionActor method restoreSelection.
private void restoreSelection() {
final Controller controller = Controller.getCurrentController();
if (!map.equals(controller.getMap()))
return;
final IMapSelection selection = controller.getSelection();
if (this.equals(new SelectionActor(selection)))
return;
NodeModel[] nodes = new NodeModel[nodeIDs.length];
int index = 0;
for (String id : nodeIDs) nodes[index++] = map.getNodeForID(id);
selection.replaceSelection(nodes);
}
use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.
the class StyleEditorPanel method addListeners.
private void addListeners() {
final Controller controller = Controller.getCurrentController();
final ModeController modeController = Controller.getCurrentModeController();
final MapController mapController = modeController.getMapController();
mapController.addNodeSelectionListener(new INodeSelectionListener() {
public void onSelect(final NodeModel node) {
final IMapSelection selection = controller.getSelection();
if (selection == null) {
return;
}
if (selection.size() == 1) {
setComponentsEnabled(true);
setStyle(node);
}
}
public void setComponentsEnabled(boolean enabled) {
final Container panel = (Container) getComponent(0);
for (int i = 0; i < panel.getComponentCount(); i++) {
panel.getComponent(i).setEnabled(enabled);
}
}
public void onDeselect(final NodeModel node) {
setComponentsEnabled(false);
}
});
mapController.addNodeChangeListener(new INodeChangeListener() {
public void nodeChanged(final NodeChangeEvent event) {
final IMapSelection selection = controller.getSelection();
if (selection == null) {
return;
}
final NodeModel node = event.getNode();
if (selection.getSelected().equals(node)) {
setStyle(node);
}
}
});
mapController.addMapChangeListener(new AMapChangeListenerAdapter() {
@Override
public void mapChanged(MapChangeEvent event) {
if (!MapStyle.MAP_STYLES.equals(event.getProperty()))
return;
final IMapSelection selection = controller.getSelection();
if (selection == null) {
return;
}
final NodeModel node = selection.getSelected();
setStyle(node);
}
});
}
Aggregations