use of org.freeplane.features.map.MapController in project freeplane by freeplane.
the class ChangeExternalImageAction method actionPerformed.
public void actionPerformed(final ActionEvent arg0) {
final ProgressUtilities progUtil = new ProgressUtilities();
final MapController mapController = Controller.getCurrentModeController().getMapController();
final Collection<NodeModel> nodes = mapController.getSelectedNodes();
final ViewerController vc = (Controller.getCurrentController().getModeController().getExtension(ViewerController.class));
final ExternalResource extRes = (ExternalResource) vc.createExtension(mapController.getSelectedNode());
if (extRes != null) {
URI uri = extRes.getAbsoluteUri(mapController.getSelectedNode().getMap());
for (final NodeModel node : nodes) {
if (progUtil.hasExternalResource(node) && !progUtil.hasExtendedProgressIcon(node)) {
vc.undoableDeactivateHook(node);
vc.paste(uri, node, node.isLeft());
}
}
}
}
use of org.freeplane.features.map.MapController in project freeplane by freeplane.
the class MapBackgroundImageAction method actionPerformed.
public void actionPerformed(final ActionEvent e) {
final Controller controller = Controller.getCurrentController();
final MapController mapController = Controller.getCurrentModeController().getMapController();
final ViewerController vc = controller.getModeController().getExtension(ViewerController.class);
final NodeModel selectedNode = mapController.getSelectedNode();
if (selectedNode == null) {
return;
}
final MapStyle mapStyle = controller.getModeController().getExtension(MapStyle.class);
final URI uri = vc.createURI(selectedNode);
if (uri == null) {
return;
}
final MapModel model = controller.getMap();
mapStyle.setProperty(model, MapStyle.RESOURCES_BACKGROUND_IMAGE, uri.toString());
}
use of org.freeplane.features.map.MapController in project freeplane by freeplane.
the class MNodeStyleController method setMinNodeWidth.
public void setMinNodeWidth(final NodeModel node, final int minNodeWidth) {
final NodeSizeModel sizeModel = createOwnSizeModel(node);
final int oldValue = NodeSizeModel.getMinNodeWidth(node);
final IActor actor = new IActor() {
public void act() {
sizeModel.setMinNodeWidth(minNodeWidth);
final MapController mapController = getModeController().getMapController();
mapController.nodeChanged(node);
}
public String getDescription() {
return "setMinNodeWidth";
}
public void undo() {
sizeModel.setMinNodeWidth(oldValue);
final MapController mapController = getModeController().getMapController();
mapController.nodeChanged(node);
}
};
getModeController().execute(actor, node.getMap());
final int maxWidth = getMaxWidth(node);
if (maxWidth < minNodeWidth) {
setMaxNodeWidth(node, minNodeWidth);
}
}
use of org.freeplane.features.map.MapController in project freeplane by freeplane.
the class AttributeTable method tableChanged.
@Override
public void tableChanged(final TableModelEvent e) {
if (isEditing() && null == getClientProperty(EDITING_STOPPED)) {
removeEditor();
}
int selectedRow = getSelectedRow();
super.tableChanged(e);
if (getParent() == null) {
return;
}
switch(e.getType()) {
case TableModelEvent.DELETE:
if (selectedRow != -1) {
if (e.getFirstRow() <= selectedRow) {
if (e.getLastRow() >= selectedRow && e.getFirstRow() != 0) {
changeSelection(e.getFirstRow() - 1, 0, false, false);
} else if (e.getLastRow() < selectedRow) {
int rowIndex = selectedRow - (e.getLastRow() - e.getFirstRow() + 1);
if (rowIndex < 0) {
rowIndex = 0;
}
if (rowIndex < getRowCount()) {
changeSelection(rowIndex, getSelectedColumn(), false, false);
}
}
}
}
break;
case TableModelEvent.INSERT:
changeSelection(e.getFirstRow(), getSelectedColumn(), false, false);
break;
default:
if (selectedRow > getRowCount() && getRowCount() > 0) {
changeSelection(getRowCount() - 1, getSelectedColumn(), false, false);
}
}
getParent().getParent().invalidate();
final NodeModel node = attributeView.getNode();
MapController mapController = attributeView.getMapView().getModeController().getMapController();
mapController.nodeChanged(node, NodeAttributeTableModel.class, null, null);
}
use of org.freeplane.features.map.MapController in project freeplane by freeplane.
the class MapViewController method close.
public boolean close(final Component mapViewComponent, final boolean force) {
if (mapViewComponent == null) {
return false;
}
MapView mapView = (MapView) mapViewComponent;
final MapController mapController = mapView.getModeController().getMapController();
final boolean closingNotCancelled = mapController.close(mapView.getModel(), force);
if (!closingNotCancelled) {
return false;
}
int index = mapViewVector.indexOf(mapView);
mapController.removeMapChangeListener(mapView);
ResourceController.getResourceController().removePropertyChangeListener(mapView);
mapViewVector.remove(mapView);
if (mapViewVector.isEmpty()) {
/* Keep the current running mode */
changeToMapView((MapView) null);
} else if (mapView == selectedMapView) {
if (index >= mapViewVector.size() || index < 0) {
index = mapViewVector.size() - 1;
}
changeToMapView((mapViewVector.get(index)));
}
mapViewChangeListeners.afterMapViewClose(mapView);
mapView.getRoot().remove();
return true;
}
Aggregations