use of org.freeplane.features.ui.IMapViewManager in project freeplane by freeplane.
the class MapController method canBeUnfoldedOnCurrentView.
public boolean canBeUnfoldedOnCurrentView(final NodeModel node) {
final IMapViewManager mapViewManager = Controller.getCurrentController().getMapViewManager();
final boolean isFolded = mapViewManager.isFoldedOnCurrentView(node) || mapViewManager.hasHiddenChildren(node);
for (int i = 0; i < node.getChildCount(); i++) {
final NodeModel child = node.getChildAt(i);
if (child.hasVisibleContent()) {
if (isFolded)
return true;
} else if (node.getFilterInfo().isAncestor() && canBeUnfoldedOnCurrentView(child)) {
return true;
}
}
return false;
}
use of org.freeplane.features.ui.IMapViewManager in project freeplane by freeplane.
the class EditStylesAction method init.
private void init() {
this.mainController = Controller.getCurrentController();
if (dialog != null) {
Controller.setCurrentController((Controller) dialog.getRootPane().getClientProperty(Controller.class));
return;
}
dialog = new JDialog(UITools.getCurrentFrame());
final WindowConfigurationStorage windowConfigurationStorage = new WindowConfigurationStorage(getKey() + ".dialog");
windowConfigurationStorage.restoreDialogPositions(dialog);
dialog.setModal(true);
dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(final WindowEvent e) {
getModeController().tryToCloseDialog();
}
});
Controller styleDialogController = SModeControllerFactory.getInstance().createController(dialog);
modeController = (SModeController) styleDialogController.getModeController();
final ViewController viewController = styleDialogController.getViewController();
viewController.init(styleDialogController);
dialog.addComponentListener(new ComponentAdapter() {
@Override
public void componentHidden(final ComponentEvent e) {
final WindowConfigurationStorage windowConfigurationStorage = new WindowConfigurationStorage(getKey() + ".dialog");
windowConfigurationStorage.storeDialogPositions(dialog);
final IMapViewManager mapViewManager = modeController.getController().getMapViewManager();
final MapModel map = mapViewManager.getModel();
final IUndoHandler undoHandler = (IUndoHandler) map.getExtension(IUndoHandler.class);
modeController.getMapController().closeWithoutSaving(map);
Controller.setCurrentController(mainController);
super.componentHidden(e);
mainController.getMapViewManager().changeToMapView(currentMapView);
currentMapView = null;
switch(modeController.getStatus()) {
case JOptionPane.OK_OPTION:
if (undoHandler.canUndo()) {
commit();
break;
}
// $FALL-THROUGH$
case JOptionPane.CANCEL_OPTION:
rollback();
}
}
});
}
use of org.freeplane.features.ui.IMapViewManager 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.features.ui.IMapViewManager in project freeplane by freeplane.
the class ImportAttributesDialog method createMapSubTrees.
private void createMapSubTrees(final DefaultMutableTreeNode top) {
top.removeAllChildren();
final TreeNodeInfo topInfo = (TreeNodeInfo) top.getUserObject();
topInfo.setSelected(TreeNodeInfo.NOT_SELECTED);
Controller controller = Controller.getCurrentController();
final IMapViewManager mapViewManager = controller.getMapViewManager();
final MapModel currentMap = controller.getMap();
currentAttributes = AttributeRegistry.getRegistry(currentMap);
final Iterator<Entry<String, MapModel>> iterator = mapViewManager.getMaps().entrySet().iterator();
while (iterator.hasNext()) {
final Entry<String, MapModel> entry = iterator.next();
final String nextmapName = entry.getKey();
final MapModel nextMap = entry.getValue();
if (nextMap == currentMap) {
continue;
}
final TreeNodeInfo treeNodeInfo = new TreeNodeInfo(nextmapName);
final DefaultMutableTreeNode mapInfo = new DefaultMutableTreeNode(treeNodeInfo);
createAttributeSubTrees(mapInfo, AttributeRegistry.getRegistry(nextMap));
if (mapInfo.getChildCount() != 0) {
top.add(mapInfo);
}
}
}
use of org.freeplane.features.ui.IMapViewManager in project freeplane by freeplane.
the class UITools method showInputDialog.
public static String showInputDialog(final NodeModel node, final String message, final String initialValue) {
if (node == null) {
return null;
}
final Controller controller = Controller.getCurrentController();
final IMapViewManager viewController = controller.getMapViewManager();
viewController.scrollNodeToVisible(node);
final Component parentComponent = viewController.getComponent(node);
return JOptionPane.showInputDialog(parentComponent, message, initialValue);
}
Aggregations