use of org.freeplane.features.mode.Controller in project freeplane by freeplane.
the class ReportGenerator method publish.
@Override
public synchronized void publish(final LogRecord record) {
final Controller controller = Controller.getCurrentController();
if (controller == null) {
// ReportGenerator is not available during controller initialization
return;
}
final ViewController viewController = controller.getViewController();
if (out == null) {
out = new ByteArrayOutputStream();
setOutputStream(out);
}
if (!isLoggable(record)) {
return;
}
if (!(disabled || isRunning || reportCollected)) {
reportCollected = true;
viewController.invokeLater(new SubmitStarter());
}
viewController.invokeLater(new Runnable() {
@SuppressWarnings("serial")
public void run() {
try {
errorCounter++;
if (TextUtils.getRawText("internal_error_tooltip", null) != null) {
if (logButton == null) {
final ImageIcon errorIcon = new ImageIcon(ResourceController.getResourceController().getResource("/images/icons/messagebox_warning.png"));
logButton = new JButton() {
@Override
public Dimension getPreferredSize() {
Dimension preferredSize = super.getPreferredSize();
preferredSize.height = getIcon().getIconHeight();
return preferredSize;
}
};
logButton.addActionListener(new LogOpener());
logButton.setIcon(errorIcon);
String tooltip = TextUtils.getText("internal_error_tooltip");
logButton.setToolTipText(tooltip);
viewController.addStatusComponent("internal_error", logButton);
}
logButton.setText(TextUtils.format("errornumber", errorCounter));
}
} catch (Exception e) {
}
}
});
super.publish(record);
}
use of org.freeplane.features.mode.Controller in project freeplane by freeplane.
the class MNodeMotionListener method adjustNodeIndices.
private void adjustNodeIndices(final NodeView nodeV) {
NodeModel[] selectedsBackup = null;
final NodeModel node = nodeV.getModel();
if (FreeNode.isFreeNode(node)) {
selectedsBackup = adjustNodeIndexBackupSelection(nodeV, selectedsBackup);
} else {
final MapView map = nodeV.getMap();
final NodeModel[] siblingNodes = node.getParentNode().getChildren().toArray(new NodeModel[] {});
for (NodeModel sibling : siblingNodes) {
if (FreeNode.isFreeNode(sibling)) {
final NodeView siblingV = map.getNodeView(sibling);
selectedsBackup = adjustNodeIndexBackupSelection(siblingV, selectedsBackup);
}
}
}
if (selectedsBackup != null) {
final ModeController modeController = nodeV.getMap().getModeController();
final Controller controller = modeController.getController();
controller.getSelection().replaceSelection(selectedsBackup);
}
}
use of org.freeplane.features.mode.Controller in project freeplane by freeplane.
the class MNodeMotionListener method getNodeShiftYChange.
/**
*/
private int getNodeShiftYChange(final Point dragNextPoint, final NodeModel node) {
final Controller controller = Controller.getCurrentController();
final MapView mapView = ((MapView) controller.getMapViewManager().getMapViewComponent());
final int shiftYChange = (int) ((dragNextPoint.y - dragStartingPoint.y) / mapView.getZoom());
return shiftYChange;
}
use of org.freeplane.features.mode.Controller 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.features.mode.Controller in project freeplane by freeplane.
the class NodeSelector method selectSingleNode.
public void selectSingleNode(MouseEvent e) {
final NodeView nodeV = getRelatedNodeView(e);
final Controller controller = Controller.getCurrentController();
if (!((MapView) controller.getMapViewManager().getMapViewComponent()).isSelected(nodeV)) {
controller.getSelection().selectAsTheOnlyOneSelected(nodeV.getModel());
}
}
Aggregations