use of com.lightdev.app.shtm.TextResources in project freeplane by freeplane.
the class MTextController method createSHTMLPanel.
/**
* Note: when creating an SHTMLPanel using this method, you must make sure to attach
* a FreeplaneToSHTMLPropertyChangeAdapter to the panel (see for example EditNodeWYSIWYG.HTMLDialog.createEditorPanel(String))
* @param purpose
* @return
*/
public SHTMLPanel createSHTMLPanel(String purpose) {
SHTMLPanel.setResources(new TextResources() {
public String getString(String pKey) {
if (pKey.equals("approximate_search_threshold")) {
return new Double(StringMatchingStrategy.APPROXIMATE_MATCHING_MINPROB).toString();
}
pKey = "simplyhtml." + pKey;
String resourceString = ResourceController.getResourceController().getText(pKey, null);
if (resourceString == null) {
resourceString = ResourceController.getResourceController().getProperty(pKey);
}
return resourceString;
}
});
com.lightdev.app.shtm.ScaledStyleSheet.FONT_SCALE_FACTOR = UITools.FONT_SCALE_FACTOR;
SHTMLPanel.setActionBuilder(new ActionBuilder() {
public void initActions(SHTMLPanel panel) {
panel.addAction("editLink", new SHTMLEditLinkAction((SHTMLPanelImpl) panel));
panel.addAction("setLinkByFileChooser", new SHTMLSetLinkByFileChooserAction((SHTMLPanelImpl) panel));
}
});
final SHTMLPanel shtmlPanel = SHTMLPanel.createSHTMLPanel();
shtmlPanel.setOpenHyperlinkHandler(new ActionListener() {
public void actionPerformed(ActionEvent pE) {
try {
UrlManager.getController().loadURL(new URI(pE.getActionCommand()));
} catch (Exception e) {
LogUtils.warn(e);
}
}
});
final JEditorPane editorPane = shtmlPanel.getEditorPane();
editorPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, false);
fireEditorPaneCreated(editorPane, purpose);
return shtmlPanel;
}
Aggregations