public class MyLoggerHyperLinkListener implements ScriptLoggerHyperLinkListener { @Override public void visitHyperLink(String linkID) { // get the associated elemet from the linkID and do something with it } }
public class MyLoggerHyperLinkListener implements ScriptLoggerHyperLinkListener<TreeElement> { @Override public void visitHyperLink(TreeElement element) { // do something with the tree element } }Note that you are not required to specify the type of the Object used for the
ScriptLoggerHyperLinkListener
, If you don't do it, you will have this method to implement:public class MyLoggerHyperLinkListener implements ScriptLoggerHyperLinkListener { @Override public void visitHyperLink(Object o) { // do something with the Object } }
GroovyScriptWrapper<Script> wrapper = new GroovyScriptWrapper<Script>() { }; ScriptLogger logger = new DefaultSwingScriptLogger(); LinkIndexConverter converter = new MyLinkIndexConverter();; logger.registerLinkIndexConverter(converter); ScriptLoggerHyperLinkListener linkListener = new MyLoggerHyperLinkListener(); logger.registerHyperLinkListener(linkListener); wrapper.setScriptLogger(logger);With the following HyperLinkListener:
public class MyLoggerHyperLinkListener implements ScriptLoggerHyperLinkListener<TreeElement> { @Override public void visitHyperLink(TreeElement element) { // do something with the tree element } }
Copyright 2019-2020 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence