use of org.freeplane.features.mode.Controller 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.mode.Controller in project freeplane by freeplane.
the class MUIFactory method mapChanged.
public void mapChanged(final MapChangeEvent event) {
final Object property = event.getProperty();
if (property.equals(MapStyle.MAP_STYLES)) {
updateMapStyles(event.getMap());
final Controller controller = Controller.getCurrentController();
changeToolbar(controller.getSelection().getSelected());
return;
}
}
use of org.freeplane.features.mode.Controller in project freeplane by freeplane.
the class MUIFactory method changeToolbar.
private void changeToolbar(final NodeModel node) {
final Controller controller = Controller.getCurrentController();
final MNodeStyleController styleController = (MNodeStyleController) controller.getModeController().getExtension(NodeStyleController.class);
selectFontSize(Integer.toString(styleController.getFontSize(node)));
selectFontName(styleController.getFontFamilyName(node));
final LogicalStyleController logicalStyleController = LogicalStyleController.getController();
ignoreChangeEvent = true;
styles.setSelectedItem(logicalStyleController.getFirstStyle(node));
ignoreChangeEvent = false;
}
use of org.freeplane.features.mode.Controller 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.mode.Controller in project freeplane by freeplane.
the class ManageNodeConditionalStylesAction method actionPerformed.
public void actionPerformed(ActionEvent e) {
final Controller controller = Controller.getCurrentController();
final MapModel map = controller.getMap();
final ConditionalStyleModel conditionalStyleModel = getConditionalStyleModel();
Component pane = createConditionalStylePane(map, conditionalStyleModel);
final ModeController modeController = Controller.getCurrentModeController();
modeController.startTransaction();
try {
final int confirmed = JOptionPane.showConfirmDialog(controller.getMapViewManager().getMapViewComponent(), pane, TextUtils.getText(TextUtils.removeMnemonic("ManageNodeConditionalStylesAction.text")), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
if (JOptionPane.OK_OPTION == confirmed) {
modeController.commit();
final IMapSelection selection = controller.getSelection();
final NodeModel selected = selection.getSelected();
modeController.getMapController().nodeChanged(selected, NodeModel.UNKNOWN_PROPERTY, null, null);
for (NodeModel otherSelectedNode : selection.getSelection()) if (selected != otherSelectedNode) {
otherSelectedNode.putExtension(conditionalStyleModel.clone());
modeController.getMapController().nodeChanged(otherSelectedNode, NodeModel.UNKNOWN_PROPERTY, null, null);
}
} else {
modeController.rollback();
}
} catch (RuntimeException ex) {
ex.printStackTrace();
modeController.rollback();
}
}
Aggregations