use of org.freeplane.features.icon.IconController in project freeplane by freeplane.
the class DefaultNodeMouseMotionListener method mouseClicked.
public void mouseClicked(final MouseEvent e) {
final ModeController mc = Controller.getCurrentController().getModeController();
if (Compat.isMacOsX()) {
final JPopupMenu popupmenu = mc.getUserInputListenerFactory().getNodePopupMenu();
if (popupmenu.isShowing()) {
return;
}
}
final MainView component = (MainView) e.getComponent();
NodeView nodeView = component.getNodeView();
if (nodeView == null)
return;
final NodeModel node = nodeView.getModel();
final boolean plainEvent = Compat.isPlainEvent(e);
final boolean inside = nodeSelector.isInside(e);
final MapController mapController = mc.getMapController();
if (e.getButton() == 1) {
if (plainEvent) {
UIIcon uiIcon = component.getUIIconAt(e.getPoint());
if (uiIcon != null) {
final IconController iconController = mc.getExtension(IconController.class);
if (iconController.onIconClicked(node, uiIcon))
return;
} else if (component.isClickableLink(e.getX())) {
LinkController.getController(mc).loadURL(node, e);
e.consume();
return;
}
final String link = component.getLink(e.getPoint());
if (link != null) {
doubleClickTimer.start(new Runnable() {
public void run() {
loadLink(node, link);
}
});
e.consume();
return;
}
if (inside && e.getClickCount() == 1 && ResourceController.getResourceController().getBooleanProperty(FOLD_ON_CLICK_INSIDE)) {
if (!nodeSelector.shouldSelectOnClick(e)) {
doubleClickTimer.start(new Runnable() {
public void run() {
mapController.toggleFolded(node);
}
});
}
}
} else if (Compat.isShiftEvent(e)) {
if (isInFoldingRegion(e)) {
if (!mapController.showNextChild(node))
mapController.fold(node);
e.consume();
}
}
}
final boolean inFoldingRegion = isInFoldingRegion(e);
if ((plainEvent && inFoldingRegion || (inFoldingRegion || inside) && Compat.isCtrlShiftEvent(e)) && !nodeSelector.shouldSelectOnClick(e)) {
doubleClickTimer.cancel();
mapController.toggleFolded(node);
e.consume();
return;
}
if (inside && e.getButton() == 1 && !e.isAltDown())
nodeSelector.extendSelection(e);
}
Aggregations