use of org.freeplane.features.ui.IMapViewManager in project freeplane by freeplane.
the class MapController method newMap.
/**
*@throws XMLException
* @deprecated -- use MapIO
*/
@Deprecated
public boolean newMap(final URL url) throws FileNotFoundException, XMLParseException, IOException, URISyntaxException, XMLException {
final IMapViewManager mapViewManager = Controller.getCurrentController().getMapViewManager();
if (mapViewManager.tryToChangeToMapView(url))
return false;
try {
if (AddOnsController.getController().installIfAppropriate(url))
return false;
Controller.getCurrentController().getViewController().setWaitingCursor(true);
final MapModel newModel = new MapModel();
UrlManager.getController().loadCatchExceptions(url, newModel);
newModel.setReadOnly(true);
newModel.setSaved(true);
fireMapCreated(newModel);
newMapView(newModel);
return true;
} finally {
Controller.getCurrentController().getViewController().setWaitingCursor(false);
}
}
use of org.freeplane.features.ui.IMapViewManager in project freeplane by freeplane.
the class AEditStylesAction method init.
protected void init() {
this.controller = Controller.getCurrentController();
if (dialog != null) {
Controller.setCurrentController((Controller) dialog.getRootPane().getClientProperty(Controller.class));
return;
}
dialog = new JDialog(Controller.getCurrentController().getViewController().getJFrame());
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 controller = SModeControllerFactory.getInstance().createController(dialog);
modeController = (SModeController) controller.getModeController();
final ViewController viewController = controller.getViewController();
viewController.init(controller);
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);
mapViewManager.close(true);
Controller.setCurrentController(AEditStylesAction.this.controller);
super.componentHidden(e);
switch(modeController.getStatus()) {
case JOptionPane.OK_OPTION:
if (undoHandler.canUndo()) {
commit();
break;
}
case JOptionPane.CANCEL_OPTION:
rollback();
}
}
});
}
use of org.freeplane.features.ui.IMapViewManager in project freeplane by freeplane.
the class SModeController method tryToCloseDialog.
void tryToCloseDialog() {
final IMapViewManager mapViewManager = getController().getMapViewManager();
final MapModel map = mapViewManager.getModel();
final IUndoHandler undoHandler = (IUndoHandler) map.getExtension(IUndoHandler.class);
final Window dialog = ((DialogController) getController().getViewController()).getDialog();
if (!undoHandler.canUndo()) {
dialog.setVisible(false);
return;
}
final String text = TextUtils.getText("save_unsaved_styles");
final String title = TextUtils.getText("SaveAction.text");
final int returnVal = JOptionPane.showOptionDialog(dialog, text, title, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
if ((returnVal == JOptionPane.CANCEL_OPTION) || (returnVal == JOptionPane.CLOSED_OPTION)) {
return;
}
setStatus(returnVal == JOptionPane.YES_OPTION ? JOptionPane.OK_OPTION : JOptionPane.CANCEL_OPTION);
dialog.setVisible(false);
Controller.getCurrentModeController().getUserInputListenerFactory().getMenuBuilder(RibbonBuilder.class).setEnabled(true);
}
use of org.freeplane.features.ui.IMapViewManager in project freeplane by freeplane.
the class NodeHistory method go.
private void go(final boolean back) {
final NodeHolder lastNodeHolder = currentNodeHolder;
if (back) {
if (canGoBack()) {
nodeIterator.previous();
nodeIterator.previous();
currentNodeHolder = nodeIterator.next();
} else {
backAction.setEnabled(false);
return;
}
} else {
if (canGoForward()) {
currentNodeHolder = nodeIterator.next();
} else {
forwardAction.setEnabled(false);
return;
}
}
if (lastNodeHolder.equals(currentNodeHolder)) {
go(back);
return;
}
final NodeModel toBeSelected = currentNodeHolder.getNode();
if (removed(toBeSelected)) {
currentNodeHolder = lastNodeHolder;
go(back);
return;
}
boolean changeModule = false;
MapView newModule = null;
if (lastNodeHolder.getHoldMapView() != currentNodeHolder.getHoldMapView()) {
changeModule = true;
newModule = currentNodeHolder.getMapView();
if (newModule == null) {
nodeIterator.remove();
go(back);
return;
}
}
final boolean fChangeModule = changeModule;
final MapView newView;
if (fChangeModule) {
newView = newModule;
final Controller controller = newView.getModeController().getController();
final IMapViewManager mapViewManager = controller.getMapViewManager();
final boolean res = mapViewManager.changeToMapView(newView);
if (!res) {
LogUtils.warn("Can't change to map mapView " + newView);
return;
}
} else {
newView = currentNodeHolder.getHoldMapView();
}
if (!toBeSelected.isRoot()) {
newView.getModeController().getMapController().setFolded(toBeSelected.getParentNode(), false);
}
newView.getModeController().getMapController().select(toBeSelected);
}
use of org.freeplane.features.ui.IMapViewManager in project freeplane by freeplane.
the class EditNoteInDialogAction method actionPerformed.
/*
* (non-Javadoc)
* @see
* freeplane.controller.actions.ActorXml#act(freeplane.controller.actions.
* generated.instance.XmlAction)
*/
public void actionPerformed(final ActionEvent arg0) {
final Controller controller = Controller.getCurrentController();
final NodeModel nodeModel = controller.getSelection().getSelected();
final IMapViewManager viewController = controller.getMapViewManager();
final Component node = viewController.getComponent(nodeModel);
node.requestFocus();
edit(nodeModel);
}
Aggregations