use of org.freeplane.features.text.mindmapmode.EditNodeDialog in project freeplane by freeplane.
the class FormulaTextTransformer method createEditor.
public EditNodeBase createEditor(final NodeModel node, final EditNodeBase.IEditControl editControl, String text, final boolean editLong) {
MTextController textController = MTextController.getController();
if (textController.isTextFormattingDisabled(node))
return null;
final KeyEvent firstKeyEvent = textController.getEventQueue().getFirstEvent();
if (firstKeyEvent != null) {
if (firstKeyEvent.getKeyChar() == '=') {
text = "=";
} else {
return null;
}
}
if (text.startsWith("=")) {
JEditorPane textEditor = new JEditorPane();
textEditor.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true);
final JRestrictedSizeScrollPane scrollPane = new JRestrictedSizeScrollPane(textEditor);
scrollPane.setMinimumSize(new Dimension(0, 60));
final EditNodeDialog editNodeDialog = new FormulaEditor(node, text, firstKeyEvent, editControl, false, textEditor);
editNodeDialog.setTitle(TextUtils.getText("formula_editor"));
textEditor.setContentType("text/groovy");
final String fontName = ResourceController.getResourceController().getProperty(FormulaEditor.GROOVY_EDITOR_FONT);
final int fontSize = ResourceController.getResourceController().getIntProperty(FormulaEditor.GROOVY_EDITOR_FONT_SIZE);
textEditor.setFont(new Font(fontName, Font.PLAIN, fontSize));
return editNodeDialog;
}
return null;
}
use of org.freeplane.features.text.mindmapmode.EditNodeDialog in project freeplane by freeplane.
the class LatexRenderer method createEditor.
public EditNodeBase createEditor(NodeModel node, IEditControl editControl, String text, boolean editLong) {
MTextController textController = MTextController.getController();
if (// Format=Text!
textController.isTextFormattingDisabled(node))
return null;
final KeyEvent firstKeyEvent = textController.getEventQueue().getFirstEvent();
String nodeFormat = textController.getNodeFormat(node);
final String latexText = getLatexNode(text, nodeFormat, TargetMode.FOR_EDITOR);
// this option has been added to work around bugs in JSyntaxPane with Chinese characters
if (ResourceController.getResourceController().getBooleanProperty(LATEX_EDITOR_DISABLE))
return null;
if (latexText != null) {
JEditorPane textEditor = new JEditorPane();
textEditor.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true);
final JRestrictedSizeScrollPane scrollPane = new JRestrictedSizeScrollPane(textEditor);
scrollPane.setMinimumSize(new Dimension(0, 60));
final EditNodeDialog editNodeDialog = new LatexEditor(node, latexText, firstKeyEvent, editControl, false, textEditor);
editNodeDialog.setTitle(TextUtils.getText("latex_editor"));
textEditor.setContentType("text/latex");
final String fontName = ResourceController.getResourceController().getProperty(LATEX_EDITOR_FONT);
final int fontSize = ResourceController.getResourceController().getIntProperty(LATEX_EDITOR_FONT_SIZE);
textEditor.setFont(new Font(fontName, Font.PLAIN, fontSize));
return editNodeDialog;
}
return null;
}
Aggregations