use of org.freeplane.view.swing.map.MapView in project freeplane by freeplane.
the class UserInputListenerFactory method createMapActions.
private void createMapActions(final Entry mapsMenuEntry) {
final IMapViewManager mapViewManager = Controller.getCurrentController().getMapViewManager();
final ViewController viewController = Controller.getCurrentController().getViewController();
final List<? extends Component> mapViewVector = viewController.getMapViewVector();
if (mapViewVector == null) {
return;
}
EntryAccessor entryAccessor = new EntryAccessor();
for (final Component mapView : mapViewVector) {
final String displayName = mapView.getName();
Entry actionEntry = new Entry();
final MapsMenuAction action = new MapsMenuAction(displayName);
actionEntry.setName(action.getKey());
modeController.addActionIfNotAlreadySet(action);
entryAccessor.setAction(actionEntry, action);
final MapView currentMapView = (MapView) mapViewManager.getMapViewComponent();
if (currentMapView != null) {
if (mapView == currentMapView) {
actionEntry.setAttribute("selected", true);
}
}
mapsMenuEntry.addChild(actionEntry);
}
}
use of org.freeplane.view.swing.map.MapView in project freeplane by freeplane.
the class MapViewDockingWindows method createTitle.
private String createTitle(Component mapViewComponent) {
MapView mapView = (MapView) mapViewComponent;
String name = mapView.getName();
String title;
if (mapView.getModel().isSaved() || mapView.getModel().isReadOnly())
title = name;
else
title = name + " *";
return title;
}
use of org.freeplane.view.swing.map.MapView in project freeplane by freeplane.
the class MapViewDockingWindows method selectMap.
private void selectMap(final int tabIndexChange) {
final Controller controller = Controller.getCurrentController();
MapView mapView = (MapView) controller.getMapViewManager().getMapViewComponent();
if (mapView != null) {
AbstractTabWindow tabWindow = (AbstractTabWindow) SwingUtilities.getAncestorOfClass(AbstractTabWindow.class, mapView);
if (tabWindow != null) {
final DockingWindow selectedWindow = tabWindow.getSelectedWindow();
final int childWindowIndex = tabWindow.getChildWindowIndex(selectedWindow);
final int childWindowCount = tabWindow.getChildWindowCount();
final int nextWindowIndex = (childWindowIndex + childWindowCount + tabIndexChange) % childWindowCount;
final View nextWindow = (View) tabWindow.getChildWindow(nextWindowIndex);
final Component nextMapView = getContainedMapView(nextWindow);
Controller.getCurrentController().getMapViewManager().changeToMapView(nextMapView);
}
}
}
use of org.freeplane.view.swing.map.MapView in project freeplane by freeplane.
the class MapViewDockingWindows method setTitle.
public void setTitle() {
if (loadingLayoutFromObjectInpusStream)
return;
for (Component mapViewComponent : mapViews) {
if (mapViewComponent instanceof MapView) {
MapView mapView = (MapView) mapViewComponent;
String name = mapView.getName();
String title;
if (mapView.getModel().isSaved())
title = name;
else
title = name + " *";
View containingDockedWindow = getContainingDockedWindow(mapViewComponent);
containingDockedWindow.getViewProperties().setTitle(title);
}
}
}
use of org.freeplane.view.swing.map.MapView in project freeplane by freeplane.
the class MapViewDockingWindows method focusMapViewLater.
public void focusMapViewLater(final MapView mapView) {
Timer timer = new Timer(40, new ActionListener() {
int retryCount = 5;
public void actionPerformed(final ActionEvent event) {
final Timer eventTimer = (Timer) event.getSource();
focusMapLater(mapView, eventTimer);
}
private void focusMapLater(final MapView mapView, final Timer eventTimer) {
if (mapView.isShowing() && Controller.getCurrentController().getMapViewManager().getMapViewComponent() == mapView) {
final NodeView selected = mapView.getSelected();
if (selected != null) {
final Frame frame = JOptionPane.getFrameForComponent(mapView);
if (frame.isFocused())
selected.requestFocusInWindow();
else
frame.addWindowFocusListener(new WindowAdapter() {
@Override
public void windowGainedFocus(WindowEvent e) {
frame.removeWindowFocusListener(this);
selected.requestFocusInWindow();
retryCount = 2;
eventTimer.start();
}
});
}
}
if (retryCount > 1) {
retryCount--;
eventTimer.start();
}
}
});
timer.setRepeats(false);
timer.start();
}
Aggregations