use of org.freeplane.core.ui.components.JRestrictedSizeScrollPane 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.core.ui.components.JRestrictedSizeScrollPane in project freeplane by freeplane.
the class MEdgeController method editEdgeColorConfiguration.
public void editEdgeColorConfiguration(MapModel map) {
final List<Color> oldColors = edgeColorsConfigurationFactory.create(map).colors;
final ColorListEditorPanelBuilder colorListEditorPanelBuilder = new ColorListEditorPanelBuilder(oldColors);
final JComponent panel = colorListEditorPanelBuilder.getPanel();
JScrollPane jscrollpane = new JRestrictedSizeScrollPane(panel);
UITools.setScrollbarIncrement(jscrollpane);
jscrollpane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
jscrollpane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
jscrollpane.setMaximumSize(new Dimension(Integer.MAX_VALUE, 600));
String title = TextUtils.getText("editEdgeColors");
final int status = JOptionPane.showConfirmDialog(UITools.getCurrentFrame(), jscrollpane, title, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
switch(status) {
case JOptionPane.OK_OPTION:
final List<Color> newColors = colorListEditorPanelBuilder.getColors();
edgeColorsConfigurationFactory.setConfiguration(map, new EdgeColorConfiguration(newColors));
break;
default:
}
}
use of org.freeplane.core.ui.components.JRestrictedSizeScrollPane in project freeplane by freeplane.
the class ScriptComboBoxEditor method editScript.
protected void editScript(boolean selectAll) {
JEditorPane textEditor = new JEditorPane();
textEditor.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true);
final JRestrictedSizeScrollPane scrollPane = new JRestrictedSizeScrollPane(textEditor);
scrollPane.setMinimumSize(minimumSize);
textEditor.setContentType("text/groovy");
final String fontName = ResourceController.getResourceController().getProperty(ScriptEditorPanel.GROOVY_EDITOR_FONT);
final int fontSize = ResourceController.getResourceController().getIntProperty(ScriptEditorPanel.GROOVY_EDITOR_FONT_SIZE);
textEditor.setFont(new Font(fontName, Font.PLAIN, fontSize));
textEditor.setText(script);
if (selectAll) {
textEditor.selectAll();
}
String title = TextUtils.getText("plugins/ScriptEditor/window.title");
final JOptionPane optionPane = new JOptionPane(scrollPane, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
final JDialog dialog = optionPane.createDialog(showEditorBtn, title);
dialog.setResizable(true);
if (bounds != null)
dialog.setBounds(bounds);
dialog.setVisible(true);
bounds = dialog.getBounds();
final Integer result = ((Integer) optionPane.getValue());
if (result == null || result != JOptionPane.OK_OPTION)
return;
script = textEditor.getText();
setButtonText();
final ActionEvent actionEvent = new ActionEvent(this, 0, null);
for (final ActionListener l : actionListeners) {
l.actionPerformed(actionEvent);
}
}
use of org.freeplane.core.ui.components.JRestrictedSizeScrollPane 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;
}
use of org.freeplane.core.ui.components.JRestrictedSizeScrollPane in project freeplane by freeplane.
the class ColorListEditorPanelBuilder method main.
/**
* Main method for panel
*/
public static void main(String[] args) {
final List<Color> colorList = new ArrayList<>(100);
for (int i = 0; i < 100; i++) colorList.add(Color.WHITE);
final JComponent panel = new ColorListEditorPanelBuilder(colorList).getPanel();
JScrollPane jscrollpane = new JRestrictedSizeScrollPane(panel);
jscrollpane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
jscrollpane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
jscrollpane.setMaximumSize(new Dimension(Integer.MAX_VALUE, 600));
JOptionPane.showConfirmDialog(null, jscrollpane);
}
Aggregations