use of org.freeplane.features.mode.mindmapmode.MModeController in project freeplane by freeplane.
the class AutomaticLayoutController method toggle.
@Override
protected IExtension toggle(NodeModel node, IExtension extension) {
extension = super.toggle(node, extension);
final MModeController modeController = (MModeController) Controller.getCurrentModeController();
if (modeController.isUndoAction()) {
return extension;
}
LogicalStyleController.getController().refreshMap(node.getMap());
return extension;
}
use of org.freeplane.features.mode.mindmapmode.MModeController in project freeplane by freeplane.
the class MTextController method editDetails.
public void editDetails(final NodeModel nodeModel, InputEvent e, final boolean editLong) {
final Controller controller = Controller.getCurrentController();
stopEditing();
Controller.getCurrentModeController().setBlocked(true);
String text = DetailTextModel.getDetailTextText(nodeModel);
final boolean isNewNode = text == null;
if (isNewNode) {
final MTextController textController = MTextController.getController();
textController.setDetails(nodeModel, "<html>");
text = "";
}
final EditNodeBase.IEditControl editControl = new EditNodeBase.IEditControl() {
@Override
public void cancel() {
if (isNewNode) {
final String detailText = DetailTextModel.getDetailTextText(nodeModel);
final MModeController modeController = (MModeController) Controller.getCurrentModeController();
if (detailText != null)
modeController.undo();
modeController.resetRedo();
}
stop();
}
@Override
public void ok(final String newText) {
if (HtmlUtils.isEmpty(newText))
if (isNewNode) {
final MModeController modeController = (MModeController) Controller.getCurrentModeController();
modeController.undo();
modeController.resetRedo();
} else {
keepNodePosition();
setDetailsHtmlText(nodeModel, null);
}
else {
keepNodePosition();
setDetailsHtmlText(nodeModel, newText);
}
stop();
}
private void keepNodePosition() {
Controller.getCurrentController().getSelection().keepNodePosition(nodeModel, 0, 0);
}
@Override
public void split(final String newText, final int position) {
}
private void stop() {
Controller.getCurrentModeController().setBlocked(false);
mCurrentEditor = null;
}
@Override
public boolean canSplit() {
return false;
}
@Override
public EditedComponent getEditType() {
return EditedComponent.DETAIL;
}
};
mCurrentEditor = createEditor(nodeModel, editControl, text, false, editLong, true);
final RootPaneContainer frame = (RootPaneContainer) SwingUtilities.getWindowAncestor(controller.getMapViewManager().getMapViewComponent());
mCurrentEditor.show(frame);
}
use of org.freeplane.features.mode.mindmapmode.MModeController in project freeplane by freeplane.
the class AutomaticEdgeColorHook method toggle.
@Override
protected IExtension toggle(NodeModel node, IExtension extension) {
extension = super.toggle(node, extension);
final MModeController modeController = (MModeController) Controller.getCurrentModeController();
if (modeController.isUndoAction()) {
return extension;
}
LogicalStyleController.getController().refreshMap(node.getMap());
return extension;
}
use of org.freeplane.features.mode.mindmapmode.MModeController in project freeplane by freeplane.
the class FButtonBar method dispatchKeyEvent.
public boolean dispatchKeyEvent(final KeyEvent e) {
if (!(Controller.getCurrentModeController() instanceof MModeController))
return false;
if (ownWindowAncestor == null) {
ownWindowAncestor = (JFrame) SwingUtilities.getWindowAncestor(this);
if (ownWindowAncestor == null) {
return false;
}
ownWindowAncestor.addWindowFocusListener(this);
}
final Window windowAncestor = SwingUtilities.getWindowAncestor(e.getComponent());
if (windowAncestor == ownWindowAncestor && ownWindowAncestor.getJMenuBar() != null && ownWindowAncestor.getJMenuBar().isEnabled()) {
processDispatchedKeyEvent(e);
} else {
resetModifiers();
}
if (e.getKeyCode() == KeyEvent.VK_ALT) {
switch(e.getID()) {
case KeyEvent.KEY_PRESSED:
{
final Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
return altPressedEventHidden = !(focusOwner instanceof JRootPane || 0 == (e.getModifiersEx() & ~(KeyEvent.ALT_MASK | KeyEvent.ALT_DOWN_MASK)));
}
case KeyEvent.KEY_RELEASED:
if (altPressedEventHidden) {
altPressedEventHidden = false;
return true;
}
break;
}
}
return false;
}
use of org.freeplane.features.mode.mindmapmode.MModeController in project freeplane by freeplane.
the class MFileManager method createPreferences.
private void createPreferences() {
final MModeController modeController = (MModeController) Controller.getCurrentModeController();
final OptionPanelBuilder optionPanelBuilder = modeController.getOptionPanelBuilder();
optionPanelBuilder.addCreator("Environment/load", new IPropertyControlCreator() {
@Override
public IPropertyControl createControl() {
final Set<String> charsets = Charset.availableCharsets().keySet();
final LinkedList<String> charsetList = new LinkedList<String>(charsets);
charsetList.addFirst("JVMdefault");
final LinkedList<String> charsetTranslationList = new LinkedList<String>(charsets);
charsetTranslationList.addFirst(TextUtils.getText("OptionPanel.default"));
return new ComboProperty("default_charset", charsetList, charsetTranslationList);
}
}, IndexedTree.AS_CHILD);
optionPanelBuilder.addCreator("Environment/files/skip_template_selection", new IPropertyControlCreator() {
@Override
public IPropertyControl createControl() {
final Collection<String> templates = collectAvailableMapTemplates();
ComboProperty comboProperty = new ComboProperty(STANDARD_TEMPLATE, templates, templates);
comboProperty.setEditable(true);
return comboProperty;
}
}, IndexedTree.BEFORE);
}
Aggregations