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));
}
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));
}
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;
}
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;
}
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;
}
Aggregations