Search in sources :

Example 46 with Controller

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);
}
Also used : ImageIcon(javax.swing.ImageIcon) ViewController(org.freeplane.features.ui.ViewController) JButton(javax.swing.JButton) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Dimension(java.awt.Dimension) ResourceController(org.freeplane.core.resources.ResourceController) ViewController(org.freeplane.features.ui.ViewController) Controller(org.freeplane.features.mode.Controller) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Example 47 with Controller

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);
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) MapView(org.freeplane.view.swing.map.MapView) ModeController(org.freeplane.features.mode.ModeController) NodeView(org.freeplane.view.swing.map.NodeView) MTextController(org.freeplane.features.text.mindmapmode.MTextController) ResourceController(org.freeplane.core.resources.ResourceController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MapController(org.freeplane.features.map.MapController) LocationController(org.freeplane.features.nodelocation.LocationController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController) MLocationController(org.freeplane.features.nodelocation.mindmapmode.MLocationController)

Example 48 with Controller

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;
}
Also used : MapView(org.freeplane.view.swing.map.MapView) MTextController(org.freeplane.features.text.mindmapmode.MTextController) ResourceController(org.freeplane.core.resources.ResourceController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MapController(org.freeplane.features.map.MapController) LocationController(org.freeplane.features.nodelocation.LocationController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController) MLocationController(org.freeplane.features.nodelocation.mindmapmode.MLocationController) Point(java.awt.Point)

Example 49 with Controller

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();
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IMapSelection(org.freeplane.features.map.IMapSelection) MapView(org.freeplane.view.swing.map.MapView) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController) LinkController(org.freeplane.features.link.LinkController)

Example 50 with Controller

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());
    }
}
Also used : NodeView(org.freeplane.view.swing.map.NodeView) Controller(org.freeplane.features.mode.Controller) ResourceController(org.freeplane.core.resources.ResourceController)

Aggregations

Controller (org.freeplane.features.mode.Controller)152 ModeController (org.freeplane.features.mode.ModeController)92 ResourceController (org.freeplane.core.resources.ResourceController)69 NodeModel (org.freeplane.features.map.NodeModel)46 MapController (org.freeplane.features.map.MapController)41 MapModel (org.freeplane.features.map.MapModel)34 LinkController (org.freeplane.features.link.LinkController)32 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)32 TextController (org.freeplane.features.text.TextController)27 MMapController (org.freeplane.features.map.mindmapmode.MMapController)24 ViewController (org.freeplane.features.ui.ViewController)23 IconController (org.freeplane.features.icon.IconController)22 Component (java.awt.Component)19 FilterController (org.freeplane.features.filter.FilterController)17 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)17 FormatController (org.freeplane.features.format.FormatController)16 ScannerController (org.freeplane.features.format.ScannerController)16 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)15 File (java.io.File)14 MTextController (org.freeplane.features.text.mindmapmode.MTextController)14