Search in sources :

Example 16 with MapStyleModel

use of org.freeplane.features.styles.MapStyleModel in project freeplane by freeplane.

the class DefaultStyleRenderer method getTableCellRendererComponent.

public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    final MapStyleModel styles = ((ConditionalStyleTable) table).getStyles();
    final NodeModel styleNode = styles.getStyleNode((IStyle) value);
    if (styleNode == null) {
        value = MapStyleModel.DEFAULT_STYLE;
    }
    return renderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) MapStyleModel(org.freeplane.features.styles.MapStyleModel)

Example 17 with MapStyleModel

use of org.freeplane.features.styles.MapStyleModel in project freeplane by freeplane.

the class ManageMapConditionalStylesAction method getConditionalStyleModel.

@Override
public ConditionalStyleModel getConditionalStyleModel() {
    final Controller controller = Controller.getCurrentController();
    final MapModel map = controller.getMap();
    final MapStyleModel styleModel = MapStyleModel.getExtension(map);
    final ConditionalStyleModel conditionalStyleModel = styleModel.getConditionalStyleModel();
    return conditionalStyleModel;
}
Also used : MapStyleModel(org.freeplane.features.styles.MapStyleModel) ConditionalStyleModel(org.freeplane.features.styles.ConditionalStyleModel) MapModel(org.freeplane.features.map.MapModel) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) Controller(org.freeplane.features.mode.Controller)

Example 18 with MapStyleModel

use of org.freeplane.features.styles.MapStyleModel in project freeplane by freeplane.

the class RedefineStyleAction method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    final NodeModel node = Controller.getCurrentController().getSelection().getSelected();
    final IStyle style = LogicalStyleController.getController().getFirstStyle(node);
    final MapStyleModel extension = MapStyleModel.getExtension(node.getMap());
    final NodeModel styleNode = extension.getStyleNode(style);
    if (styleNode == null)
        return;
    Controller.getCurrentModeController().undoableCopyExtensions(LogicalStyleKeys.NODE_STYLE, node, styleNode);
    Controller.getCurrentModeController().undoableRemoveExtensions(LogicalStyleKeys.NODE_STYLE, node, node);
    LogicalStyleController.getController().refreshMap(node.getMap());
}
Also used : IStyle(org.freeplane.features.styles.IStyle) NodeModel(org.freeplane.features.map.NodeModel) MapStyleModel(org.freeplane.features.styles.MapStyleModel)

Example 19 with MapStyleModel

use of org.freeplane.features.styles.MapStyleModel in project freeplane by freeplane.

the class DeleteUserStyleAction method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    final ModeController modeController = Controller.getCurrentModeController();
    final Controller controller = modeController.getController();
    final NodeModel selected = controller.getSelection().getSelected();
    if (selected.depth() < 2) {
        UITools.errorMessage(TextUtils.getText("can_not_delete_style_group"));
        return;
    }
    final MapModel map = selected.getMap();
    final MapStyleModel styleModel = MapStyleModel.getExtension(map);
    final NodeModel styleNodeGroup = styleModel.getStyleNodeGroup(selected);
    if (!((StyleTranslatedObject) styleNodeGroup.getUserObject()).getObject().equals("styles.user-defined")) {
        UITools.errorMessage(TextUtils.getText("can_not_delete_predefined_style"));
        return;
    }
    final MMapController mapController = (MMapController) modeController.getMapController();
    mapController.deleteNode(selected);
    final IActor actor = new IActor() {

        public void undo() {
            styleModel.addStyleNode(selected);
        }

        public String getDescription() {
            return "DeleteStyle";
        }

        public void act() {
            styleModel.removeStyleNode(selected);
        }
    };
    Controller.getCurrentModeController().execute(actor, map);
}
Also used : StyleTranslatedObject(org.freeplane.features.styles.StyleTranslatedObject) NodeModel(org.freeplane.features.map.NodeModel) MapStyleModel(org.freeplane.features.styles.MapStyleModel) MMapController(org.freeplane.features.map.mindmapmode.MMapController) IActor(org.freeplane.core.undo.IActor) ModeController(org.freeplane.features.mode.ModeController) MapModel(org.freeplane.features.map.MapModel) MMapController(org.freeplane.features.map.mindmapmode.MMapController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController)

Example 20 with MapStyleModel

use of org.freeplane.features.styles.MapStyleModel in project freeplane by freeplane.

the class AttributeTable method updateComponentFontAndColors.

private void updateComponentFontAndColors(final JComponent c) {
    final NodeView nodeView = attributeView.getNodeView();
    final MapView mapView = nodeView.getMap();
    final ModeController modeController = mapView.getModeController();
    final NodeStyleController style = (NodeStyleController) modeController.getExtension(NodeStyleController.class);
    final MapStyleModel model = MapStyleModel.getExtension(mapView.getModel());
    final NodeModel attributeStyleNode = model.getStyleNodeSafe(MapStyleModel.ATTRIBUTE_STYLE);
    final Font font = style.getFont(attributeStyleNode);
    c.setFont(font.deriveFont(UITools.FONT_SCALE_FACTOR * font.getSize2D()));
    if (!SwingUtilities.isDescendingFrom(this, nodeView)) {
        return;
    }
    final Color backgroundColor = NodeStyleModel.getBackgroundColor(attributeStyleNode);
    if (backgroundColor != null) {
        c.setOpaque(true);
        c.setBackground(backgroundColor);
    } else {
        c.setBackground(nodeView.getBackgroundColor());
        c.setOpaque(false);
    }
    c.setForeground(style.getColor(attributeStyleNode));
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) MapStyleModel(org.freeplane.features.styles.MapStyleModel) Color(java.awt.Color) MapView(org.freeplane.view.swing.map.MapView) ModeController(org.freeplane.features.mode.ModeController) NodeView(org.freeplane.view.swing.map.NodeView) Font(java.awt.Font)

Aggregations

MapStyleModel (org.freeplane.features.styles.MapStyleModel)48 NodeModel (org.freeplane.features.map.NodeModel)39 IStyle (org.freeplane.features.styles.IStyle)30 Color (java.awt.Color)10 MapModel (org.freeplane.features.map.MapModel)10 Controller (org.freeplane.features.mode.Controller)6 LengthUnits (org.freeplane.core.ui.LengthUnits)5 IActor (org.freeplane.core.undo.IActor)5 MMapController (org.freeplane.features.map.mindmapmode.MMapController)5 StyleTranslatedObject (org.freeplane.features.styles.StyleTranslatedObject)4 ModeController (org.freeplane.features.mode.ModeController)3 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)3 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)3 MapStyle (org.freeplane.features.styles.MapStyle)3 Font (java.awt.Font)2 ArrayList (java.util.ArrayList)2 DashVariant (org.freeplane.features.DashVariant)2 ConditionalStyleModel (org.freeplane.features.styles.ConditionalStyleModel)2 MapView (org.freeplane.view.swing.map.MapView)2 NodeView (org.freeplane.view.swing.map.NodeView)2