use of org.freeplane.features.map.MapController in project freeplane by freeplane.
the class NodeTooltipManager method getSharedInstance.
public static NodeTooltipManager getSharedInstance(ModeController modeController) {
{
final NodeTooltipManager instance = modeController.getExtension(NodeTooltipManager.class);
if (instance != null) {
return instance;
}
}
final NodeTooltipManager instance = new NodeTooltipManager();
final int maxWidth = ResourceController.getResourceController().getIntProperty("toolTipManager.max_tooltip_width", Integer.MAX_VALUE);
NodeTooltip.setMaximumWidth(maxWidth);
setTooltipDelays(instance);
UIManager.put("PopupMenu.consumeEventOnClose", Boolean.FALSE);
ResourceController.getResourceController().addPropertyChangeListener(new IFreeplanePropertyListener() {
public void propertyChanged(final String propertyName, final String newValue, final String oldValue) {
if (propertyName.startsWith(TOOL_TIP_MANAGER)) {
setTooltipDelays(instance);
}
}
});
IMapChangeListener mapChangeListener = new AMapChangeListenerAdapter() {
@Override
public void onNodeDeleted(NodeModel parent, NodeModel child, int index) {
instance.hideTipWindow();
}
@Override
public void onNodeInserted(NodeModel parent, NodeModel child, int newIndex) {
instance.hideTipWindow();
}
@Override
public void onNodeMoved(NodeModel oldParent, int oldIndex, NodeModel newParent, NodeModel child, int newIndex) {
instance.hideTipWindow();
}
};
MapController mapController = modeController.getMapController();
mapController.addMapChangeListener(mapChangeListener);
INodeSelectionListener nodeSelectionListener = new INodeSelectionListener() {
public void onSelect(NodeModel node) {
NodeView view = (NodeView) SwingUtilities.getAncestorOfClass(NodeView.class, instance.insideComponent);
if (view != null && node.equals(view.getModel()))
return;
instance.hideTipWindow();
}
public void onDeselect(NodeModel node) {
}
};
mapController.addNodeSelectionListener(nodeSelectionListener);
modeController.addExtension(NodeTooltipManager.class, instance);
return instance;
}
use of org.freeplane.features.map.MapController in project freeplane by freeplane.
the class NodeIdHighLighter method deHighlight.
public void deHighlight() {
if (originallySelectedNode == null)
return;
final Controller controller = Controller.getCurrentController();
if (controller == null)
return;
final MapController mapController = controller.getModeController().getMapController();
mapController.displayNode(originallySelectedNode);
mapController.select(originallySelectedNode);
foldOriginallyFolded(mapController);
originallySelectedNode = null;
pane.setToolTipText(null);
}
use of org.freeplane.features.map.MapController in project freeplane by freeplane.
the class NodeIdHighLighter method handle.
private boolean handle(SyntaxDocument doc, Token token) {
final Matcher matcher = nodeIdPattern.matcher(token.getText(doc));
if (matcher.matches()) {
String id = matcher.group(1);
final NodeModel node = Controller.getCurrentController().getMap().getNodeForID(id);
if (node != null) {
final MapController mapController = Controller.getCurrentModeController().getMapController();
final NodeModel selectedNode = mapController.getSelectedNode();
if (node.equals(selectedNode)) {
return true;
}
NodeModel originallySelectedNode = this.originallySelectedNode;
if (originallySelectedNode == null)
originallySelectedNode = mapController.getSelectedNode();
else {
deHighlight();
}
this.originallySelectedNode = originallySelectedNode;
mapController.displayNode(node, nodesOriginallyFolded);
mapController.select(node);
pane.setToolTipText(node.getText());
return true;
} else {
pane.setToolTipText(//
"<html><body bgcolor='#CC0000'>" + TextUtils.format(getResourceKey("node_is_not_defined"), id) + "</body></html>");
}
} else {
deHighlight();
}
return false;
}
use of org.freeplane.features.map.MapController in project freeplane by freeplane.
the class MNodeStyleController method setBorderWidthMatchesEdgeWidth.
public void setBorderWidthMatchesEdgeWidth(final NodeModel node, final Boolean borderWidthMatchesEdgeWidth) {
final Boolean oldBorderWidthMatchesEdgeWidth = NodeBorderModel.getBorderWidthMatchesEdgeWidth(node);
final IActor actor = new IActor() {
public void act() {
NodeBorderModel.setBorderWidthMatchesEdgeWidth(node, borderWidthMatchesEdgeWidth);
final MapController mapController = getModeController().getMapController();
mapController.nodeChanged(node);
}
public String getDescription() {
return "setBorderWidthMatchesEdgeWidth";
}
public void undo() {
NodeBorderModel.setBorderWidthMatchesEdgeWidth(node, oldBorderWidthMatchesEdgeWidth);
final MapController mapController = getModeController().getMapController();
mapController.nodeChanged(node);
}
};
getModeController().execute(actor, node.getMap());
}
use of org.freeplane.features.map.MapController in project freeplane by freeplane.
the class MNodeStyleController method setBorderColor.
public void setBorderColor(final NodeModel node, final Color borderColor) {
final Color oldBorderColor = NodeBorderModel.getBorderColor(node);
final IActor actor = new IActor() {
public void act() {
NodeBorderModel.setBorderColor(node, borderColor);
final MapController mapController = getModeController().getMapController();
mapController.nodeChanged(node);
}
public String getDescription() {
return "setBorderColor";
}
public void undo() {
NodeBorderModel.setBorderColor(node, oldBorderColor);
final MapController mapController = getModeController().getMapController();
mapController.nodeChanged(node);
}
};
getModeController().execute(actor, node.getMap());
}
Aggregations