Search in sources :

Example 1 with ShapeConfigurationModel

use of org.freeplane.features.nodestyle.ShapeConfigurationModel in project freeplane by freeplane.

the class MNodeStyleController method setShape.

public void setShape(final NodeModel node, final Shape shape) {
    final ShapeConfigurationModel oldShape = NodeStyleModel.getShapeConfiguration(node);
    setShapeConfiguration(node, oldShape.withShape(shape));
}
Also used : ShapeConfigurationModel(org.freeplane.features.nodestyle.ShapeConfigurationModel)

Example 2 with ShapeConfigurationModel

use of org.freeplane.features.nodestyle.ShapeConfigurationModel in project freeplane by freeplane.

the class MNodeStyleController method setUniformShape.

public void setUniformShape(NodeModel node, boolean uniform) {
    final ShapeConfigurationModel oldShape = NodeStyleModel.getShapeConfiguration(node);
    setShapeConfiguration(node, oldShape.withUniform(uniform));
}
Also used : ShapeConfigurationModel(org.freeplane.features.nodestyle.ShapeConfigurationModel)

Example 3 with ShapeConfigurationModel

use of org.freeplane.features.nodestyle.ShapeConfigurationModel in project freeplane by freeplane.

the class NodeViewFactory method newMainView.

MainView newMainView(final NodeView node) {
    ShapeConfigurationModel shapeConfiguration = shapeConfiguration(node);
    final MainView oldView = node.getMainView();
    if (oldView != null && oldView.getShapeConfiguration().equals(shapeConfiguration))
        return oldView;
    final ModeController modeController = node.getMap().getModeController();
    final MainView view;
    switch(shapeConfiguration.getShape()) {
        case fork:
            view = new ForkMainView();
            break;
        case bubble:
            view = new BubbleMainView(shapeConfiguration);
            break;
        case oval:
            view = new OvalMainView(shapeConfiguration);
            break;
        case rectangle:
            view = new RectangleMainView(shapeConfiguration);
            break;
        case wide_hexagon:
            view = new WideHexagonMainView(shapeConfiguration);
            break;
        case narrow_hexagon:
            view = new NarrowHexagonMainView(shapeConfiguration);
            break;
        default:
            System.err.println("Tried to create a NodeView of unknown Style " + String.valueOf(shapeConfiguration.getShape()));
            view = new ForkMainView();
    }
    NodeTooltipManager toolTipManager = NodeTooltipManager.getSharedInstance(modeController);
    toolTipManager.registerComponent(view);
    return view;
}
Also used : ShapeConfigurationModel(org.freeplane.features.nodestyle.ShapeConfigurationModel) ModeController(org.freeplane.features.mode.ModeController)

Example 4 with ShapeConfigurationModel

use of org.freeplane.features.nodestyle.ShapeConfigurationModel in project freeplane by freeplane.

the class NodeViewFactory method shapeConfiguration.

private ShapeConfigurationModel shapeConfiguration(NodeView node) {
    final ModeController modeController = node.getMap().getModeController();
    final NodeModel model = node.getModel();
    ShapeConfigurationModel shapeConfiguration = NodeStyleController.getController(modeController).getShapeConfiguration(model);
    if (shapeConfiguration.getShape().equals(NodeStyleModel.Shape.combined)) {
        if (node.isFolded()) {
            shapeConfiguration = shapeConfiguration.withShape(NodeStyleModel.Shape.bubble);
        } else {
            shapeConfiguration = ShapeConfigurationModel.FORK;
        }
    } else
        while (shapeConfiguration.getShape().equals(NodeStyleModel.Shape.as_parent)) {
            NodeView parent = node.getParentView();
            if (parent == null)
                shapeConfiguration = ShapeConfigurationModel.DEFAULT_ROOT_OVAL;
            else if (parent.getParentView() == null)
                shapeConfiguration = ShapeConfigurationModel.FORK;
            else
                shapeConfiguration = parent.getMainView().getShapeConfiguration();
        }
    return shapeConfiguration;
}
Also used : ShapeConfigurationModel(org.freeplane.features.nodestyle.ShapeConfigurationModel) NodeModel(org.freeplane.features.map.NodeModel) ModeController(org.freeplane.features.mode.ModeController)

Example 5 with ShapeConfigurationModel

use of org.freeplane.features.nodestyle.ShapeConfigurationModel in project freeplane by freeplane.

the class FModeControllerFactory method createModeController.

public static FModeController createModeController() {
    final Controller controller = Controller.getCurrentController();
    modeController = new FModeController(controller);
    final UserInputListenerFactory userInputListenerFactory = new UserInputListenerFactory(modeController);
    modeController.setUserInputListenerFactory(userInputListenerFactory);
    controller.addModeController(modeController);
    controller.selectModeForBuild(modeController);
    new FMapController(modeController);
    UrlManager.install(new UrlManager());
    MapIO.install(modeController);
    new IconController(modeController).install(modeController);
    NodeStyleController.install(new NodeStyleController(modeController));
    EdgeController.install(new EdgeController(modeController));
    new TextController(modeController).install(modeController);
    LinkController.install(new LinkController(modeController));
    CloudController.install(new CloudController(modeController));
    ClipboardController.install(new ClipboardController());
    LocationController.install(new LocationController());
    LogicalStyleController.install(new LogicalStyleController(modeController));
    MapStyle.install(true);
    NodeStyleController.getController().addShapeGetter(new Integer(0), new IPropertyHandler<ShapeConfigurationModel, NodeModel>() {

        public ShapeConfigurationModel getProperty(final NodeModel node, final ShapeConfigurationModel currentValue) {
            return ShapeConfigurationModel.FORK;
        }
    });
    modeController.addAction(new CenterAction());
    modeController.addAction(new OpenPathAction());
    userInputListenerFactory.setNodePopupMenu(new JPopupMenu());
    final FreeplaneToolBar toolBar = new FreeplaneToolBar("main_toolbar", SwingConstants.HORIZONTAL);
    FrameController frameController = (FrameController) controller.getViewController();
    UIComponentVisibilityDispatcher.install(frameController, toolBar, "toolbarVisible");
    userInputListenerFactory.addToolBar("/main_toolbar", ViewController.TOP, toolBar);
    userInputListenerFactory.addToolBar("/filter_toolbar", FilterController.TOOLBAR_SIDE, FilterController.getCurrentFilterController().getFilterToolbar());
    userInputListenerFactory.addToolBar("/status", ViewController.BOTTOM, controller.getViewController().getStatusBar());
    NodeHistory.install(modeController);
    return modeController;
}
Also used : OpenPathAction(org.freeplane.features.map.filemode.OpenPathAction) ShapeConfigurationModel(org.freeplane.features.nodestyle.ShapeConfigurationModel) UrlManager(org.freeplane.features.url.UrlManager) ClipboardController(org.freeplane.features.clipboard.ClipboardController) EdgeController(org.freeplane.features.edge.EdgeController) TextController(org.freeplane.features.text.TextController) LinkController(org.freeplane.features.link.LinkController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) UserInputListenerFactory(org.freeplane.view.swing.ui.UserInputListenerFactory) LocationController(org.freeplane.features.nodelocation.LocationController) FMapController(org.freeplane.features.map.filemode.FMapController) ClipboardController(org.freeplane.features.clipboard.ClipboardController) FModeController(org.freeplane.features.mode.filemode.FModeController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) EdgeController(org.freeplane.features.edge.EdgeController) ViewController(org.freeplane.features.ui.ViewController) CloudController(org.freeplane.features.cloud.CloudController) LinkController(org.freeplane.features.link.LinkController) FilterController(org.freeplane.features.filter.FilterController) LocationController(org.freeplane.features.nodelocation.LocationController) FrameController(org.freeplane.features.ui.FrameController) IconController(org.freeplane.features.icon.IconController) Controller(org.freeplane.features.mode.Controller) TextController(org.freeplane.features.text.TextController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) FMapController(org.freeplane.features.map.filemode.FMapController) JPopupMenu(javax.swing.JPopupMenu) IconController(org.freeplane.features.icon.IconController) CenterAction(org.freeplane.features.map.filemode.CenterAction) NodeModel(org.freeplane.features.map.NodeModel) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) CloudController(org.freeplane.features.cloud.CloudController) FModeController(org.freeplane.features.mode.filemode.FModeController) FreeplaneToolBar(org.freeplane.core.ui.components.FreeplaneToolBar) FrameController(org.freeplane.features.ui.FrameController)

Aggregations

ShapeConfigurationModel (org.freeplane.features.nodestyle.ShapeConfigurationModel)10 NodeModel (org.freeplane.features.map.NodeModel)3 ModeController (org.freeplane.features.mode.ModeController)3 Insets (java.awt.Insets)1 JPopupMenu (javax.swing.JPopupMenu)1 FreeplaneToolBar (org.freeplane.core.ui.components.FreeplaneToolBar)1 IActor (org.freeplane.core.undo.IActor)1 ClipboardController (org.freeplane.features.clipboard.ClipboardController)1 CloudController (org.freeplane.features.cloud.CloudController)1 EdgeController (org.freeplane.features.edge.EdgeController)1 FilterController (org.freeplane.features.filter.FilterController)1 IconController (org.freeplane.features.icon.IconController)1 LinkController (org.freeplane.features.link.LinkController)1 CenterAction (org.freeplane.features.map.filemode.CenterAction)1 FMapController (org.freeplane.features.map.filemode.FMapController)1 OpenPathAction (org.freeplane.features.map.filemode.OpenPathAction)1 Controller (org.freeplane.features.mode.Controller)1 FModeController (org.freeplane.features.mode.filemode.FModeController)1 LocationController (org.freeplane.features.nodelocation.LocationController)1 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)1