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);
}
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;
}
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());
}
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);
}
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));
}
Aggregations