Search in sources :

Example 6 with TextController

use of org.freeplane.features.text.TextController in project freeplane by freeplane.

the class FModeControllerFactory method createModeController.

public static FModeController createModeController() {
    final Controller controller = Controller.getCurrentController();
    modeController = new FModeController(controller);
    final UserInputListenerFactory userInputListenerFactory = new UserInputListenerFactory(modeController);
    modeController.setUserInputListenerFactory(userInputListenerFactory);
    controller.addModeController(modeController);
    controller.selectModeForBuild(modeController);
    new FMapController(modeController);
    UrlManager.install(new UrlManager());
    MapIO.install(modeController);
    new IconController(modeController).install(modeController);
    NodeStyleController.install(new NodeStyleController(modeController));
    EdgeController.install(new EdgeController(modeController));
    new TextController(modeController).install(modeController);
    LinkController.install(new LinkController(modeController));
    CloudController.install(new CloudController(modeController));
    ClipboardController.install(new ClipboardController());
    LocationController.install(new LocationController());
    LogicalStyleController.install(new LogicalStyleController(modeController));
    MapStyle.install(true);
    NodeStyleController.getController().addShapeGetter(new Integer(0), new IPropertyHandler<ShapeConfigurationModel, NodeModel>() {

        public ShapeConfigurationModel getProperty(final NodeModel node, final ShapeConfigurationModel currentValue) {
            return ShapeConfigurationModel.FORK;
        }
    });
    modeController.addAction(new CenterAction());
    modeController.addAction(new OpenPathAction());
    userInputListenerFactory.setNodePopupMenu(new JPopupMenu());
    final FreeplaneToolBar toolBar = new FreeplaneToolBar("main_toolbar", SwingConstants.HORIZONTAL);
    FrameController frameController = (FrameController) controller.getViewController();
    UIComponentVisibilityDispatcher.install(frameController, toolBar, "toolbarVisible");
    userInputListenerFactory.addToolBar("/main_toolbar", ViewController.TOP, toolBar);
    userInputListenerFactory.addToolBar("/filter_toolbar", FilterController.TOOLBAR_SIDE, FilterController.getCurrentFilterController().getFilterToolbar());
    userInputListenerFactory.addToolBar("/status", ViewController.BOTTOM, controller.getViewController().getStatusBar());
    NodeHistory.install(modeController);
    return modeController;
}
Also used : OpenPathAction(org.freeplane.features.map.filemode.OpenPathAction) ShapeConfigurationModel(org.freeplane.features.nodestyle.ShapeConfigurationModel) UrlManager(org.freeplane.features.url.UrlManager) ClipboardController(org.freeplane.features.clipboard.ClipboardController) EdgeController(org.freeplane.features.edge.EdgeController) TextController(org.freeplane.features.text.TextController) LinkController(org.freeplane.features.link.LinkController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) UserInputListenerFactory(org.freeplane.view.swing.ui.UserInputListenerFactory) LocationController(org.freeplane.features.nodelocation.LocationController) FMapController(org.freeplane.features.map.filemode.FMapController) ClipboardController(org.freeplane.features.clipboard.ClipboardController) FModeController(org.freeplane.features.mode.filemode.FModeController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) EdgeController(org.freeplane.features.edge.EdgeController) ViewController(org.freeplane.features.ui.ViewController) CloudController(org.freeplane.features.cloud.CloudController) LinkController(org.freeplane.features.link.LinkController) FilterController(org.freeplane.features.filter.FilterController) LocationController(org.freeplane.features.nodelocation.LocationController) FrameController(org.freeplane.features.ui.FrameController) IconController(org.freeplane.features.icon.IconController) Controller(org.freeplane.features.mode.Controller) TextController(org.freeplane.features.text.TextController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) FMapController(org.freeplane.features.map.filemode.FMapController) JPopupMenu(javax.swing.JPopupMenu) IconController(org.freeplane.features.icon.IconController) CenterAction(org.freeplane.features.map.filemode.CenterAction) NodeModel(org.freeplane.features.map.NodeModel) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) CloudController(org.freeplane.features.cloud.CloudController) FModeController(org.freeplane.features.mode.filemode.FModeController) FreeplaneToolBar(org.freeplane.core.ui.components.FreeplaneToolBar) FrameController(org.freeplane.features.ui.FrameController)

Example 7 with TextController

use of org.freeplane.features.text.TextController in project freeplane by freeplane.

the class AttributeTableCellRenderer method getTableCellRendererComponent.

@Override
public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) {
    final Component rendererComponent = super.getTableCellRendererComponent(table, value, hasFocus, isSelected, row, column);
    final AttributeTable attributeTable = (AttributeTable) table;
    zoom = attributeTable.getZoom();
    final IAttributeTableModel attributeTableModel = (IAttributeTableModel) table.getModel();
    final String originalText = value == null ? null : value.toString();
    String text = originalText;
    Icon icon;
    if (column == 1 && value != null) {
        try {
            // evaluate values only
            final TextController textController = TextController.getController();
            Object transformedObject = textController.getTransformedObject(value, attributeTableModel.getNode(), null);
            text = transformedObject.toString();
            if (transformedObject instanceof HighlightedTransformedObject && TextController.isMarkTransformedTextSet()) {
                setBorder(BorderFactory.createLineBorder(Color.GREEN));
            }
        } catch (Exception e) {
            text = TextUtils.format("MainView.errorUpdateText", originalText, e.getLocalizedMessage());
            setBorder(BorderFactory.createLineBorder(Color.RED));
        }
        if (value instanceof URI) {
            icon = ((AttributeTable) table).getLinkIcon((URI) value);
        } else {
            icon = null;
        }
    } else {
        icon = null;
    }
    final Icon scaledIcon;
    final IconFactory iconFactory = IconFactory.getInstance();
    if (icon != null && iconFactory.canScaleIcon(icon)) {
        final int fontSize = getFont().getSize();
        scaledIcon = iconFactory.getScaledIcon(icon, new Quantity<LengthUnits>(fontSize, LengthUnits.px));
    } else
        scaledIcon = icon;
    if (scaledIcon != getIcon()) {
        setIcon(scaledIcon);
    }
    setText(text);
    if (text != originalText) {
        final String toolTip = HtmlUtils.isHtmlNode(originalText) ? text : HtmlUtils.plainToHTML(originalText);
        setToolTipText(toolTip);
    } else {
        final int prefWidth = getPreferredSize().width;
        final int width = table.getColumnModel().getColumn(column).getWidth();
        if (prefWidth > width) {
            final String toolTip = HtmlUtils.isHtmlNode(text) ? text : HtmlUtils.plainToHTML(text);
            setToolTipText(toolTip);
        } else {
            setToolTipText(null);
        }
    }
    setOpaque(hasFocus);
    return rendererComponent;
}
Also used : TextController(org.freeplane.features.text.TextController) Quantity(org.freeplane.core.util.Quantity) URI(java.net.URI) HighlightedTransformedObject(org.freeplane.features.text.HighlightedTransformedObject) IAttributeTableModel(org.freeplane.features.attribute.IAttributeTableModel) HighlightedTransformedObject(org.freeplane.features.text.HighlightedTransformedObject) Icon(javax.swing.Icon) Component(java.awt.Component) IconFactory(org.freeplane.features.icon.factory.IconFactory)

Example 8 with TextController

use of org.freeplane.features.text.TextController in project freeplane by freeplane.

the class DetailsViewMouseListener method mouseClicked.

@Override
public void mouseClicked(MouseEvent e) {
    final ModeController mc = Controller.getCurrentController().getModeController();
    if (Compat.isMacOsX()) {
        final JPopupMenu popupmenu = mc.getUserInputListenerFactory().getNodePopupMenu();
        if (popupmenu.isShowing()) {
            return;
        }
    }
    final NodeView nodeView = nodeSelector.getRelatedNodeView(e);
    if (nodeView == null)
        return;
    final NodeModel model = nodeView.getModel();
    TextController controller = TextController.getController();
    if (eventFromHideDisplayArea(e)) {
        final IMapSelection selection = Controller.getCurrentController().getSelection();
        selection.keepNodePosition(model, 0.0f, 0.0f);
        controller.setDetailsHidden(model, !DetailTextModel.getDetailText(model).isHidden());
    } else {
        nodeSelector.extendSelection(e);
        if (canEdit(controller) && isEditingStartEvent(e)) {
            final boolean editLong = e.isAltDown();
            if (!editLong)
                ((MTextController) controller).getEventQueue().activate(e);
            ((MTextController) controller).editDetails(model, e, editLong);
        } else
            super.mouseClicked(e);
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IMapSelection(org.freeplane.features.map.IMapSelection) TextController(org.freeplane.features.text.TextController) MTextController(org.freeplane.features.text.mindmapmode.MTextController) ModeController(org.freeplane.features.mode.ModeController) MTextController(org.freeplane.features.text.mindmapmode.MTextController) NodeView(org.freeplane.view.swing.map.NodeView) JPopupMenu(javax.swing.JPopupMenu)

Example 9 with TextController

use of org.freeplane.features.text.TextController in project freeplane by freeplane.

the class AttributeCompareCondition method checkNode.

/*
	 * (non-Javadoc)
	 * @see
	 * freeplane.controller.filter.condition.Condition#checkNode(freeplane.modes
	 * .MindMapNode)
	 */
public boolean checkNode(final NodeModel node) {
    final IAttributeTableModel attributes = NodeAttributeTableModel.getModel(node);
    final TextController textController = TextController.getController();
    for (int i = 0; i < attributes.getRowCount(); i++) {
        if (attribute.equals(AttributeConditionController.ANY_ATTRIBUTE_NAME_OR_VALUE_OBJECT)) {
            if (checkContent(attributes.getValueAt(i, 0)))
                return true;
        } else if (!attributes.getValueAt(i, 0).equals(attribute)) {
            continue;
        }
        final Object originalContent = attributes.getValueAt(i, 1);
        final Object content = textController.getTransformedObjectNoFormattingNoThrow(originalContent, node, null);
        if (checkContent(content))
            return true;
    }
    return false;
}
Also used : TextController(org.freeplane.features.text.TextController)

Example 10 with TextController

use of org.freeplane.features.text.TextController in project freeplane by freeplane.

the class AttributeMatchesCondition method checkNode.

/*
	 * (non-Javadoc)
	 * @see
	 * freeplane.controller.filter.condition.Condition#checkNode(freeplane.modes
	 * .MindMapNode)
	 */
public boolean checkNode(final NodeModel node) {
    final IAttributeTableModel attributes = NodeAttributeTableModel.getModel(node);
    final TextController textController = TextController.getController();
    for (int i = 0; i < attributes.getRowCount(); i++) {
        if (attribute.equals(AttributeConditionController.ANY_ATTRIBUTE_NAME_OR_VALUE_OBJECT)) {
            if (checkText(attributes.getValueAt(i, 0).toString()))
                return true;
        } else if (!attributes.getValueAt(i, 0).equals(attribute)) {
            continue;
        }
        final Object originalContent = attributes.getValueAt(i, 1);
        String text = textController.getTransformedTextNoThrow(originalContent, node, null);
        if (checkText(text))
            return true;
    }
    return false;
}
Also used : TextController(org.freeplane.features.text.TextController)

Aggregations

TextController (org.freeplane.features.text.TextController)17 NodeModel (org.freeplane.features.map.NodeModel)6 ModeController (org.freeplane.features.mode.ModeController)6 Component (java.awt.Component)4 JPopupMenu (javax.swing.JPopupMenu)3 IconController (org.freeplane.features.icon.IconController)3 LinkController (org.freeplane.features.link.LinkController)3 Controller (org.freeplane.features.mode.Controller)3 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)3 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)3 FocusEvent (java.awt.event.FocusEvent)2 FocusListener (java.awt.event.FocusListener)2 Icon (javax.swing.Icon)2 FreeplaneToolBar (org.freeplane.core.ui.components.FreeplaneToolBar)2 ClipboardController (org.freeplane.features.clipboard.ClipboardController)2 CloudController (org.freeplane.features.cloud.CloudController)2 EdgeController (org.freeplane.features.edge.EdgeController)2 FilterController (org.freeplane.features.filter.FilterController)2 MapController (org.freeplane.features.map.MapController)2 MMapController (org.freeplane.features.map.mindmapmode.MMapController)2