Search in sources :

Example 41 with Controller

use of org.freeplane.features.mode.Controller 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 42 with Controller

use of org.freeplane.features.mode.Controller in project freeplane by freeplane.

the class MUIFactory method mapChanged.

public void mapChanged(final MapChangeEvent event) {
    final Object property = event.getProperty();
    if (property.equals(MapStyle.MAP_STYLES)) {
        updateMapStyles(event.getMap());
        final Controller controller = Controller.getCurrentController();
        changeToolbar(controller.getSelection().getSelected());
        return;
    }
}
Also used : LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController)

Example 43 with Controller

use of org.freeplane.features.mode.Controller in project freeplane by freeplane.

the class MUIFactory method changeToolbar.

private void changeToolbar(final NodeModel node) {
    final Controller controller = Controller.getCurrentController();
    final MNodeStyleController styleController = (MNodeStyleController) controller.getModeController().getExtension(NodeStyleController.class);
    selectFontSize(Integer.toString(styleController.getFontSize(node)));
    selectFontName(styleController.getFontFamilyName(node));
    final LogicalStyleController logicalStyleController = LogicalStyleController.getController();
    ignoreChangeEvent = true;
    styles.setSelectedItem(logicalStyleController.getFirstStyle(node));
    ignoreChangeEvent = false;
}
Also used : MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController)

Example 44 with Controller

use of org.freeplane.features.mode.Controller 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 45 with Controller

use of org.freeplane.features.mode.Controller 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)

Aggregations

Controller (org.freeplane.features.mode.Controller)135 ModeController (org.freeplane.features.mode.ModeController)78 ResourceController (org.freeplane.core.resources.ResourceController)63 NodeModel (org.freeplane.features.map.NodeModel)44 MapController (org.freeplane.features.map.MapController)37 LinkController (org.freeplane.features.link.LinkController)32 MapModel (org.freeplane.features.map.MapModel)31 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)30 MMapController (org.freeplane.features.map.mindmapmode.MMapController)27 TextController (org.freeplane.features.text.TextController)24 ViewController (org.freeplane.features.ui.ViewController)22 IconController (org.freeplane.features.icon.IconController)20 Component (java.awt.Component)18 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)18 FilterController (org.freeplane.features.filter.FilterController)16 FormatController (org.freeplane.features.format.FormatController)15 ScannerController (org.freeplane.features.format.ScannerController)15 IMapSelection (org.freeplane.features.map.IMapSelection)15 MTextController (org.freeplane.features.text.mindmapmode.MTextController)14 IMapViewManager (org.freeplane.features.ui.IMapViewManager)14