use of org.freeplane.view.swing.map.MapView in project freeplane by freeplane.
the class AttributeTable method columnWidthChanged.
public void columnWidthChanged(final ColumnWidthChangeEvent event) {
final float zoom = getZoom();
final int col = event.getColumnNumber();
final AttributeTableLayoutModel layoutModel = (AttributeTableLayoutModel) event.getSource();
final int width = layoutModel.getColumnWidth(col);
getColumnModel().getColumn(col).setPreferredWidth((int) (width * zoom));
final MapView map = attributeView.getMapView();
final NodeModel node = attributeView.getNode();
map.getModeController().getMapController().nodeChanged(node);
}
use of org.freeplane.view.swing.map.MapView in project freeplane by freeplane.
the class DefaultMapMouseListener method mousePressed.
public void mousePressed(final MouseEvent e) {
final MapView mapView = MapView.getMapView(e.getComponent());
if (mapView != null)
mapView.select();
if (e.isPopupTrigger()) {
handlePopup(e);
} else if (e.getButton() == MouseEvent.BUTTON1) {
if (mapView != null) {
mapView.setMoveCursor(true);
originX = e.getX();
originY = e.getY();
}
}
e.consume();
}
use of org.freeplane.view.swing.map.MapView in project freeplane by freeplane.
the class DefaultMapMouseListener method mouseClicked.
public void mouseClicked(final MouseEvent e) {
final Object source = e.getSource();
if (!(source instanceof MapView))
return;
final MapView map = (MapView) source;
final Controller controller = map.getModeController().getController();
final IMapSelection selection = controller.getSelection();
if (selection != null) {
final NodeModel selected = selection.getSelected();
if (selected != null)
controller.getMapViewManager().getComponent(selected).requestFocusInWindow();
}
}
use of org.freeplane.view.swing.map.MapView in project freeplane by freeplane.
the class DefaultMapMouseListener method mouseDragged.
/**
*/
public void mouseDragged(final MouseEvent e) {
final JComponent component = (JComponent) e.getComponent();
final MapView mapView = MapView.getMapView(component);
if (mapView == null)
return;
if (originX >= 0) {
final int dx = originX - e.getX();
final int dy = originY - e.getY();
final Rectangle visibleRect = component.getVisibleRect();
final Rectangle r = new Rectangle(e.getX(), e.getY(), 1, 1);
final boolean isEventPointVisible = visibleRect.contains(r);
if (isEventPointVisible)
mapView.scrollBy(dx, dy);
else {
mapView.scrollBy(dx / 3, dy / 3);
originX += dx / 3;
originY += dy / 3;
}
}
}
use of org.freeplane.view.swing.map.MapView in project freeplane by freeplane.
the class MapViewDockingWindows method afterViewChange.
public void afterViewChange(final Component pOldMap, final Component pNewMap) {
if (pNewMap == null) {
return;
}
if (!loadingLayoutFromObjectInpusStream) {
for (int i = 0; i < mapViews.size(); ++i) {
if (mapViews.get(i) == pNewMap) {
View dockedView = getContainingDockedWindow(pNewMap);
if (dockedView.isMinimized())
dockedView.restore();
else
dockedView.restoreFocus();
focusMapViewLater((MapView) pNewMap);
return;
}
}
addDockedWindow(pNewMap);
} else if (mapViews.contains(pNewMap))
return;
mapViews.add(pNewMap);
}
Aggregations