Search in sources :

Example 21 with Controller

use of org.freeplane.features.mode.Controller in project freeplane by freeplane.

the class ManualBugReporter method openBugTracker.

private void openBugTracker(final String log, final String hash) {
    final String option = showBugReportDialog(log, hash);
    if (!BugReportDialogManager.ALLOWED.equals(option)) {
        return;
    }
    try {
        final ResourceController resourceController = ResourceController.getResourceController();
        final String location = resourceController.getProperty("bugTrackerLocation");
        final Controller controller = Controller.getCurrentController();
        controller.getViewController().openDocument(new URL(location));
    } catch (final MalformedURLException ex) {
        UITools.errorMessage(TextUtils.getText("url_error") + "\n" + ex);
        LogUtils.warn(ex);
    } catch (final Exception ex) {
        UITools.errorMessage(ex);
        LogUtils.warn(ex);
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) ResourceController(org.freeplane.core.resources.ResourceController) ResourceController(org.freeplane.core.resources.ResourceController) Controller(org.freeplane.features.mode.Controller) URL(java.net.URL) MalformedURLException(java.net.MalformedURLException)

Example 22 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 (viewController == null) {
        // ReportGenerator is not available during controller initialization
        return;
    }
    if (out == null) {
        out = new ByteArrayOutputStream();
        AccessController.doPrivileged(new PrivilegedAction<Void>() {

            @Override
            public Void run() {
                setOutputStream(out);
                return null;
            }
        });
    }
    if (!isLoggable(record)) {
        return;
    }
    if (!(isReportGenerationInProgress)) {
        isReportGenerationInProgress = true;
        viewController.invokeLater(new Runnable() {

            @Override
            @SuppressWarnings("serial")
            public void run() {
                try {
                    errorCounter++;
                    if (TextUtils.getRawText("internal_error_tooltip", null) != null) {
                        if (logButton == null) {
                            final Icon errorIcon = ResourceController.getResourceController().getIcon("messagebox_warning_icon");
                            logButton = new JButton() {

                                @Override
                                public Dimension getPreferredSize() {
                                    Dimension preferredSize = super.getPreferredSize();
                                    preferredSize.height = Math.max(getIcon().getIconHeight(), getFont().getSize());
                                    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));
                        final JComponent statusBar = viewController.getStatusBar();
                        if (!statusBar.isVisible())
                            UIComponentVisibilityDispatcher.dispatcher(statusBar).setVisible(true);
                    }
                } catch (Exception e) {
                }
                runSubmitAfterTimeout();
            }
        });
    }
    if (!isDisabled)
        super.publish(record);
}
Also used : JButton(javax.swing.JButton) JComponent(javax.swing.JComponent) 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) AccessController(java.security.AccessController) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ViewController(org.freeplane.features.ui.ViewController) Icon(javax.swing.Icon)

Example 23 with Controller

use of org.freeplane.features.mode.Controller in project freeplane by freeplane.

the class NodeIdHighLighter method deHighlight.

public void deHighlight() {
    if (originallySelectedNode == null)
        return;
    final Controller controller = Controller.getCurrentController();
    if (controller == null)
        return;
    final MapController mapController = controller.getModeController().getMapController();
    mapController.displayNode(originallySelectedNode);
    mapController.select(originallySelectedNode);
    foldOriginallyFolded(mapController);
    originallySelectedNode = null;
    pane.setToolTipText(null);
}
Also used : MapController(org.freeplane.features.map.MapController) Controller(org.freeplane.features.mode.Controller) MapController(org.freeplane.features.map.MapController)

Example 24 with Controller

use of org.freeplane.features.mode.Controller in project freeplane by freeplane.

the class UITools method setDialogLocationUnder.

public static void setDialogLocationUnder(final JDialog dialog, final NodeModel node) {
    final Controller controller = Controller.getCurrentController();
    final IMapViewManager viewController = controller.getMapViewManager();
    final JComponent c = (JComponent) viewController.getComponent(node);
    final int x = 0;
    final int y = c.getHeight();
    final Point location = new Point(x, y);
    SwingUtilities.convertPointToScreen(location, c);
    UITools.setBounds(dialog, location.x, location.y, dialog.getWidth(), dialog.getHeight());
}
Also used : IMapViewManager(org.freeplane.features.ui.IMapViewManager) JComponent(javax.swing.JComponent) Point(java.awt.Point) Controller(org.freeplane.features.mode.Controller) ResourceController(org.freeplane.core.resources.ResourceController) ModeController(org.freeplane.features.mode.ModeController) Point(java.awt.Point)

Example 25 with Controller

use of org.freeplane.features.mode.Controller in project freeplane by freeplane.

the class UITools method showConfirmDialog.

public static int showConfirmDialog(final NodeModel node, final Object message, final String title, final int optionType, final int messageType) {
    final Controller controller = Controller.getCurrentController();
    final IMapViewManager viewController = controller.getMapViewManager();
    final Component parentComponent;
    if (node == null) {
        parentComponent = getCurrentRootComponent();
    } else {
        viewController.scrollNodeToVisible(node);
        parentComponent = viewController.getComponent(node);
    }
    return JOptionPane.showConfirmDialog(parentComponent, message, title, optionType, messageType);
}
Also used : IMapViewManager(org.freeplane.features.ui.IMapViewManager) Controller(org.freeplane.features.mode.Controller) ResourceController(org.freeplane.core.resources.ResourceController) ModeController(org.freeplane.features.mode.ModeController) Component(java.awt.Component) JComponent(javax.swing.JComponent) JTextComponent(javax.swing.text.JTextComponent)

Aggregations

Controller (org.freeplane.features.mode.Controller)135 ModeController (org.freeplane.features.mode.ModeController)78 ResourceController (org.freeplane.core.resources.ResourceController)63 NodeModel (org.freeplane.features.map.NodeModel)44 MapController (org.freeplane.features.map.MapController)37 LinkController (org.freeplane.features.link.LinkController)32 MapModel (org.freeplane.features.map.MapModel)31 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)30 MMapController (org.freeplane.features.map.mindmapmode.MMapController)27 TextController (org.freeplane.features.text.TextController)24 ViewController (org.freeplane.features.ui.ViewController)22 IconController (org.freeplane.features.icon.IconController)20 Component (java.awt.Component)18 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)18 FilterController (org.freeplane.features.filter.FilterController)16 FormatController (org.freeplane.features.format.FormatController)15 ScannerController (org.freeplane.features.format.ScannerController)15 IMapSelection (org.freeplane.features.map.IMapSelection)15 MTextController (org.freeplane.features.text.mindmapmode.MTextController)14 IMapViewManager (org.freeplane.features.ui.IMapViewManager)14