use of org.freeplane.features.link.LinkController in project freeplane by freeplane.
the class MapView method paintConnectors.
private void paintConnectors(final NodeView source, final Graphics2D graphics, final HashSet<ConnectorModel> alreadyPaintedConnectors) {
final LinkController linkController = LinkController.getController(getModeController());
final NodeModel node = source.getModel();
final Collection<NodeLinkModel> outLinks = linkController.getLinksFrom(node);
paintConnectors(outLinks, graphics, alreadyPaintedConnectors);
final Collection<NodeLinkModel> inLinks = linkController.getLinksTo(node);
paintConnectors(inLinks, graphics, alreadyPaintedConnectors);
final int nodeViewCount = source.getComponentCount();
for (int i = 0; i < nodeViewCount; i++) {
final Component component = source.getComponent(i);
if (!(component instanceof NodeView)) {
continue;
}
final NodeView child = (NodeView) component;
if (!isPrinting) {
if (!child.isHierarchyVisible())
continue;
final Rectangle bounds = SwingUtilities.convertRectangle(source, child.getBounds(), this);
final JViewport vp = (JViewport) getParent();
final Rectangle viewRect = vp.getViewRect();
viewRect.x -= viewRect.width;
viewRect.y -= viewRect.height;
viewRect.width *= 3;
viewRect.height *= 3;
if (!viewRect.intersects(bounds)) {
continue;
}
}
paintConnectors(child, graphics, alreadyPaintedConnectors);
}
}
use of org.freeplane.features.link.LinkController in project freeplane by freeplane.
the class SetLinkAnchorAction method actionPerformed.
public void actionPerformed(final ActionEvent e) {
/**
* @TODO
*
* -# implement GUID as reliable nodeID
* -# correct tickmark handling in menu (BUG)
* -# set tooltip for mouse-over SetLinkAnchorAction in menu
*/
// get reference to selected node
final Controller controller = Controller.getCurrentController();
final NodeModel node = controller.getSelection().getSelected();
// get file path of selected node
File mindmapFile = node.getMap().getFile();
if (mindmapFile == null) {
UITools.errorMessage(TextUtils.getRawText("map_not_saved"));
return;
}
// set idString variable according to file and node info
final String idString = mindmapFile.toURI().toString() + '#' + node.createID();
// save idString in LinkController
((MLinkController) (LinkController.getController())).setAnchorID(idString);
}
use of org.freeplane.features.link.LinkController 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;
}
use of org.freeplane.features.link.LinkController in project freeplane by freeplane.
the class AttributePopupMenu method make.
/**
*/
private void make() {
final String attributeViewType = table.getAttributeView().getViewType();
final IAttributeTableModel model = table.getAttributeTableModel();
final int rowCount = model.getRowCount();
add(getOptimalWidth());
if (col == 1) {
add(getInsertLink());
add(getInsertFileLink());
add(getInsertNodeLink());
final LinkController linkController = LinkController.getController();
if (linkController instanceof MLinkController && ((MLinkController) linkController).isAnchored())
add(getInsertAnchoredLink());
}
if (attributeViewType.equals(AttributeTableLayoutModel.SHOW_ALL)) {
add(getInsert());
if (row != -1) {
add(getDelete());
if (row != 0) {
add(getUp());
}
if (row != rowCount - 1) {
add(getDown());
}
}
}
}
use of org.freeplane.features.link.LinkController in project freeplane by freeplane.
the class ConnectorColorAction method actionPerformed.
public void actionPerformed(final ActionEvent e) {
final Controller controller = Controller.getCurrentController();
final MLinkController linkController = (MLinkController) LinkController.getController();
final Color selectedColor = linkController.getColor(arrowLink);
final Color color = ColorTracker.showCommonJColorChooserDialog(controller.getSelection().getSelected(), (String) this.getValue(Action.NAME), selectedColor, linkController.getStandardConnectorColor());
if (color != null) {
linkController.setConnectorColor(arrowLink, color);
}
}
Aggregations