use of org.freeplane.features.styles.MapStyle in project freeplane by freeplane.
the class MapProxy method getBackgroundColor.
// MapRO: R
public Color getBackgroundColor() {
// see MapBackgroundColorAction
final MapStyle mapStyle = (MapStyle) Controller.getCurrentModeController().getExtension(MapStyle.class);
final MapStyleModel model = (MapStyleModel) mapStyle.getMapHook();
if (model != null) {
return model.getBackgroundColor();
} else {
final String colorPropertyString = ResourceController.getResourceController().getProperty(MapStyle.RESOURCES_BACKGROUND_COLOR);
final Color defaultBgColor = ColorUtils.stringToColor(colorPropertyString);
return defaultBgColor;
}
}
use of org.freeplane.features.styles.MapStyle in project freeplane by freeplane.
the class SetBooleanMapPropertyAction method actionPerformed.
public void actionPerformed(ActionEvent e) {
final Controller controller = Controller.getCurrentController();
final NodeModel node = controller.getSelection().getSelected();
final ModeController modeController = controller.getModeController();
final MapStyle mapStyleController = MapStyle.getController(modeController);
final MapModel map = node.getMap();
final String value = mapStyleController.getPropertySetDefault(map, propertyName);
boolean set = !Boolean.parseBoolean(value);
mapStyleController.setProperty(map, propertyName, Boolean.toString(set));
setSelected(set);
}
use of org.freeplane.features.styles.MapStyle in project freeplane by freeplane.
the class MapBackgroundColorAction method actionPerformed.
public void actionPerformed(final ActionEvent e) {
final Controller controller = Controller.getCurrentController();
MapStyle mapStyle = (MapStyle) controller.getModeController().getExtension(MapStyle.class);
final MapStyleModel model = (MapStyleModel) mapStyle.getMapHook();
final Color oldBackgroundColor;
final String colorPropertyString = ResourceController.getResourceController().getProperty(MapStyle.RESOURCES_BACKGROUND_COLOR);
final Color defaultBgColor = ColorUtils.stringToColor(colorPropertyString);
if (model != null) {
oldBackgroundColor = model.getBackgroundColor();
} else {
oldBackgroundColor = defaultBgColor;
}
final Color actionColor = ColorTracker.showCommonJColorChooserDialog(controller.getSelection().getSelected(), TextUtils.getText("choose_map_background_color"), oldBackgroundColor, defaultBgColor);
mapStyle.setBackgroundColor(model, actionColor);
}
use of org.freeplane.features.styles.MapStyle in project freeplane by freeplane.
the class MapBackgroundClearAction method actionPerformed.
public void actionPerformed(final ActionEvent e) {
final Controller controller = Controller.getCurrentController();
final MapStyle mapStyle = controller.getModeController().getExtension(MapStyle.class);
final MapModel model = controller.getMap();
mapStyle.setProperty(model, MapStyle.RESOURCES_BACKGROUND_IMAGE, null);
}
use of org.freeplane.features.styles.MapStyle in project freeplane by freeplane.
the class CopyMapStylesAction method actionPerformed.
public void actionPerformed(final ActionEvent e) {
final Controller controller = Controller.getCurrentController();
final ModeController modeController = controller.getModeController();
final MFileManager fileManager = MFileManager.getController(modeController);
final JFileChooser fileChooser = fileManager.getFileChooser(true);
fileChooser.setMultiSelectionEnabled(false);
final int returnVal = fileChooser.showOpenDialog(controller.getMapViewManager().getMapViewComponent());
if (returnVal != JFileChooser.APPROVE_OPTION) {
return;
}
File file = fileChooser.getSelectedFile();
if (!file.exists()) {
return;
}
try {
final URL url = Compat.fileToUrl(file);
final MapModel map = controller.getMap();
MapStyle mapStyleController = MapStyle.getController(modeController);
mapStyleController.copyStyle(url, map, true);
} catch (MalformedURLException e1) {
e1.printStackTrace();
}
}
Aggregations