Search in sources :

Example 56 with MapModel

use of org.freeplane.features.map.MapModel in project freeplane by freeplane.

the class SetBooleanMapPropertyAction method actionPerformed.

public void actionPerformed(ActionEvent e) {
    final Controller controller = Controller.getCurrentController();
    final NodeModel node = controller.getSelection().getSelected();
    final ModeController modeController = controller.getModeController();
    final MapStyle mapStyleController = MapStyle.getController(modeController);
    final MapModel map = node.getMap();
    final String value = mapStyleController.getPropertySetDefault(map, propertyName);
    boolean set = !Boolean.parseBoolean(value);
    mapStyleController.setProperty(map, propertyName, Boolean.toString(set));
    setSelected(set);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) ModeController(org.freeplane.features.mode.ModeController) MapModel(org.freeplane.features.map.MapModel) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController)

Example 57 with MapModel

use of org.freeplane.features.map.MapModel in project freeplane by freeplane.

the class ManageMapConditionalStylesAction method getConditionalStyleModel.

@Override
public ConditionalStyleModel getConditionalStyleModel() {
    final Controller controller = Controller.getCurrentController();
    final MapModel map = controller.getMap();
    final MapStyleModel styleModel = MapStyleModel.getExtension(map);
    final ConditionalStyleModel conditionalStyleModel = styleModel.getConditionalStyleModel();
    return conditionalStyleModel;
}
Also used : MapStyleModel(org.freeplane.features.styles.MapStyleModel) ConditionalStyleModel(org.freeplane.features.styles.ConditionalStyleModel) MapModel(org.freeplane.features.map.MapModel) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) Controller(org.freeplane.features.mode.Controller)

Example 58 with MapModel

use of org.freeplane.features.map.MapModel in project freeplane by freeplane.

the class ManageNodeConditionalStylesAction method actionPerformed.

public void actionPerformed(ActionEvent e) {
    final Controller controller = Controller.getCurrentController();
    final MapModel map = controller.getMap();
    final ConditionalStyleModel conditionalStyleModel = getConditionalStyleModel();
    Component pane = createConditionalStylePane(map, conditionalStyleModel);
    final ModeController modeController = Controller.getCurrentModeController();
    modeController.startTransaction();
    try {
        final int confirmed = JOptionPane.showConfirmDialog(controller.getMapViewManager().getMapViewComponent(), pane, TextUtils.getText(TextUtils.removeMnemonic("ManageNodeConditionalStylesAction.text")), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
        if (JOptionPane.OK_OPTION == confirmed) {
            modeController.commit();
            final IMapSelection selection = controller.getSelection();
            final NodeModel selected = selection.getSelected();
            modeController.getMapController().nodeChanged(selected, NodeModel.UNKNOWN_PROPERTY, null, null);
            for (NodeModel otherSelectedNode : selection.getSelection()) if (selected != otherSelectedNode) {
                otherSelectedNode.putExtension(conditionalStyleModel.clone());
                modeController.getMapController().nodeChanged(otherSelectedNode, NodeModel.UNKNOWN_PROPERTY, null, null);
            }
        } else {
            modeController.rollback();
        }
    } catch (RuntimeException ex) {
        ex.printStackTrace();
        modeController.rollback();
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IMapSelection(org.freeplane.features.map.IMapSelection) ConditionalStyleModel(org.freeplane.features.styles.ConditionalStyleModel) MapModel(org.freeplane.features.map.MapModel) ModeController(org.freeplane.features.mode.ModeController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController) Component(java.awt.Component)

Example 59 with MapModel

use of org.freeplane.features.map.MapModel in project freeplane by freeplane.

the class HeadlessMapViewController method changeToMap.

private void changeToMap(final MapModel nextMap, String mapViewDisplayName) {
    MapModel oldMap = currentMap;
    for (IMapSelectionListener mapSelectionListener : mapSelectionListeners) mapSelectionListener.beforeMapChange(oldMap, nextMap);
    currentKey = mapViewDisplayName;
    currentMap = nextMap;
    for (IMapSelectionListener mapSelectionListener : mapSelectionListeners) mapSelectionListener.afterMapChange(oldMap, nextMap);
}
Also used : IMapSelectionListener(org.freeplane.features.map.IMapSelectionListener) MapModel(org.freeplane.features.map.MapModel)

Example 60 with MapModel

use of org.freeplane.features.map.MapModel in project freeplane by freeplane.

the class HeadlessMapViewController method changeToMapView.

public boolean changeToMapView(String mapViewDisplayName) {
    if (mapViewDisplayName != null && maps.containsKey(mapViewDisplayName)) {
        final MapModel nextMap = maps.get(mapViewDisplayName);
        changeToMap(nextMap, mapViewDisplayName);
        return true;
    } else
        return false;
}
Also used : MapModel(org.freeplane.features.map.MapModel)

Aggregations

MapModel (org.freeplane.features.map.MapModel)143 NodeModel (org.freeplane.features.map.NodeModel)47 ModeController (org.freeplane.features.mode.ModeController)35 Controller (org.freeplane.features.mode.Controller)31 IActor (org.freeplane.core.undo.IActor)27 MMapModel (org.freeplane.features.map.mindmapmode.MMapModel)16 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)16 IUndoHandler (org.freeplane.core.undo.IUndoHandler)15 AttributeRegistry (org.freeplane.features.attribute.AttributeRegistry)14 IStyle (org.freeplane.features.styles.IStyle)14 File (java.io.File)13 MMapController (org.freeplane.features.map.mindmapmode.MMapController)13 URL (java.net.URL)12 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)11 MapStyleModel (org.freeplane.features.styles.MapStyleModel)10 IMapViewManager (org.freeplane.features.ui.IMapViewManager)10 MapController (org.freeplane.features.map.MapController)9 URI (java.net.URI)8 ResourceController (org.freeplane.core.resources.ResourceController)8 IOException (java.io.IOException)7