@Override public void hyperlinkUpdate(final HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { final JEditorPane pane = (JEditorPane) e.getSource(); if (e instanceof HTMLFrameHyperlinkEvent) { final HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e; final HTMLDocument doc = (HTMLDocument) pane.getDocument(); doc.processHTMLFrameHyperlinkEvent(evt); } else { try { pane.setPage(e.getURL()); } catch (final Throwable t) { MessageBox.showError(HtmlViewer.this.getParent(), t.getMessage()); } } } }
/** * */ public HyperlinkListener createHyperLinkListener() { return e -> { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (e instanceof HTMLFrameHyperlinkEvent) { ((HTMLDocument) htmlEditorPane.getDocument()).processHTMLFrameHyperlinkEvent( (HTMLFrameHyperlinkEvent) e); } else { try { htmlEditorPane.setPage(e.getURL()); } catch (IOException ioe) { System.out.println("IOE: " + ioe); } } } }; }
public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { JEditorPane pane = (JEditorPane)e.getSource(); if (e instanceof HTMLFrameHyperlinkEvent) { HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent)e; HTMLDocument doc = (HTMLDocument)pane.getDocument(); doc.processHTMLFrameHyperlinkEvent(evt); } else { try { URL nurl = e.getURL(); if (nurl == null) nurl = new URL(m_baseurl, e.getDescription()); if (jsmooth.Native.isAvailable()) { jsmooth.Native.shellExecute(jsmooth.Native.SHELLEXECUTE_OPEN, nurl.toString(), null, null, jsmooth.Native.SW_NORMAL); } else m_launcher.openURLinBrowser(nurl.toExternalForm()); } catch (Throwable t) { t.printStackTrace(); } } } }
private HyperlinkListener createHyperLinkListener() { return new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (e instanceof HTMLFrameHyperlinkEvent) { ((HTMLDocument) html.getDocument()).processHTMLFrameHyperlinkEvent( (HTMLFrameHyperlinkEvent) e); } else { try { html.setPage(e.getURL()); } catch (IOException ioe) { System.out.println("IOE: " + ioe); } } } } }; }
@Override public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { JEditorPane pane = (JEditorPane)e.getSource(); if (e instanceof HTMLFrameHyperlinkEvent) { HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent)e; HTMLDocument doc = (HTMLDocument)pane.getDocument(); doc.processHTMLFrameHyperlinkEvent(evt); } else { URL url = e.getURL(); if (url != null) { BrowserUtil.browse(url); } } } }
/** * Creates the hyper link listener. * * @return the hyperlink listener */ public HyperlinkListener createHyperLinkListener() { return new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (e instanceof HTMLFrameHyperlinkEvent) { ((HTMLDocument)html.getDocument()).processHTMLFrameHyperlinkEvent( (HTMLFrameHyperlinkEvent)e); } else { try { html.setPage(e.getURL()); } catch (IOException ioe) { System.out.println("IOE: " + ioe); } } } } }; }
@SuppressWarnings("unchecked") public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { JEditorPane pane = (JEditorPane) e.getSource(); if (e instanceof HTMLFrameHyperlinkEvent) { HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e; HTMLDocument doc = (HTMLDocument) pane.getDocument(); doc.processHTMLFrameHyperlinkEvent(evt); } else { try { // history back.push(pane.getPage()); fwd = new Stack(); // move pane.setPage(e.getURL()); backButton.setEnabled(true); fwdButton.setEnabled(false); } catch (Throwable t) { t.printStackTrace(); } } } }
public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (e instanceof HTMLFrameHyperlinkEvent) { ((HTMLDocument)htmlView.getDocument()).processHTMLFrameHyperlinkEvent( (HTMLFrameHyperlinkEvent)e); } else { try { htmlView.setPage(e.getURL()); this.setTitle("JavaShare Mini-Browser: " + e.getURL().toString()); } catch (IOException ioe) { JOptionPane.showMessageDialog(this, "An Error has occured while trying to read this page.", "Mini-Browser Error", JOptionPane.ERROR_MESSAGE); this.dispose(); } } } }
public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() != HyperlinkEvent.EventType.ACTIVATED) return; JEditorPane pane = (JEditorPane) e.getSource(); if (e instanceof HTMLFrameHyperlinkEvent) { HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e; HTMLDocument doc = (HTMLDocument) help.getDocument(); doc.processHTMLFrameHyperlinkEvent(evt); } else { try { help.setPage(e.getURL()); } catch (IOException e2) { help.setText("Error loading " + e.getURL()); } } }
public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { JEditorPane pane = (JEditorPane)e.getSource(); if (e instanceof HTMLFrameHyperlinkEvent) { HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent)e; HTMLDocument doc = (HTMLDocument)pane.getDocument(); doc.processHTMLFrameHyperlinkEvent(evt); } else { URL url = e.getURL(); if (url != null) { BrowserUtil.browse(url); } } } }
public HyperlinkListener createHyperLinkListener() { return new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (e instanceof HTMLFrameHyperlinkEvent) { ((HTMLDocument)html.getDocument()).processHTMLFrameHyperlinkEvent( (HTMLFrameHyperlinkEvent)e); } else { try { html.setPage(e.getURL()); } catch (IOException ioe) { System.out.println("IOE: " + ioe); } } } } }; }
public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { JEditorPane pane = (JEditorPane) e.getSource(); if (e instanceof HTMLFrameHyperlinkEvent) { HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent)e; HTMLDocument doc = (HTMLDocument)pane.getDocument(); doc.processHTMLFrameHyperlinkEvent(evt); } else { try { pane.setPage(e.getURL()); } catch (Throwable t) { t.printStackTrace(); } } } }
/** * used to follow hyperlink events in the editor pane * @param evt a Hyperlink Event */ public void hyperlinkUpdate(HyperlinkEvent evt) { HyperlinkEvent.EventType type = evt.getEventType(); if (type == HyperlinkEvent.EventType.ENTERED) { System.out.println(evt.getURL().toString()); } else if (type == HyperlinkEvent.EventType.EXITED) { System.out.println("Exited"); } else if (type == HyperlinkEvent.EventType.ACTIVATED) { if (evt instanceof HTMLFrameHyperlinkEvent) { HTMLFrameHyperlinkEvent evt1 = (HTMLFrameHyperlinkEvent) evt; HTMLDocument doc = (HTMLDocument) getDocument(); doc.processHTMLFrameHyperlinkEvent(evt1); } else { try { setPage(evt.getURL()); System.out.println(evt.getURL().toString()); } catch (FileNotFoundException fnfe) { setText("Could not open file: <tt>" + evt.getURL() + "</tt>.<hr>"); } catch (Exception e) { e.printStackTrace(); } } } }
public void hyperlinkUpdate(HyperlinkEvent event) { HyperlinkEvent.EventType eventType = event.getEventType(); if (eventType == HyperlinkEvent.EventType.ACTIVATED) { if (event instanceof HTMLFrameHyperlinkEvent) { HTMLFrameHyperlinkEvent linkEvent = (HTMLFrameHyperlinkEvent) event; HTMLDocument document = (HTMLDocument) displayEditorPane .getDocument(); document.processHTMLFrameHyperlinkEvent(linkEvent); } else { showPage(event.getURL(), true); } } }
public RenderErrorPanel() { super(new BorderLayout()); setOpaque(false); myHTMLViewer = new JEditorPane(UIUtil.HTML_MIME, "<HTML><BODY>Render Problems</BODY></HTML>"); myHTMLViewer.setEditable(false); myHyperLinkListener = new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { JEditorPane pane = (JEditorPane)e.getSource(); if (e instanceof HTMLFrameHyperlinkEvent) { HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent)e; HTMLDocument doc = (HTMLDocument)pane.getDocument(); doc.processHTMLFrameHyperlinkEvent(evt); return; } String url = e.getDescription(); if (url.equals(URL_ACTION_CLOSE)) { close(); return; } performClick(url); } } }; myHTMLViewer.addHyperlinkListener(myHyperLinkListener); myHTMLViewer.setMargin(new Insets(3, 3, 3, 3)); myScrollPane = ScrollPaneFactory.createScrollPane(myHTMLViewer); setupStyle(); add(myScrollPane, BorderLayout.CENTER); }
private HyperlinkListener createHyperLinkListener() { return new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (e instanceof HTMLFrameHyperlinkEvent) { ((HTMLDocument)_contentsTxt.getDocument()).processHTMLFrameHyperlinkEvent((HTMLFrameHyperlinkEvent)e); } else { try { gotoURL(e.getURL()); } catch (IOException ex) { // i18n[HtmlViewerPanel.error.processhyperlink=Error processing hyperlink] s_log.error(s_stringMgr.getString("HtmlViewerPanel.error.processhyperlink"), ex); } } } } }; }
public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (e instanceof HTMLFrameHyperlinkEvent) { logger.debug("It is frame hyperlink event..."); final HTMLFrameHyperlinkEvent hyperEvent = (HTMLFrameHyperlinkEvent) e; ((HTMLDocument)wysiwyg.getDocument()).processHTMLFrameHyperlinkEvent(hyperEvent); } else { TextAnnotationPreviewHyperlinkListener.handleMindRaiderHyperlink(e); } } }
public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (e instanceof HTMLFrameHyperlinkEvent) { logger.debug("It is frame hyperlink event..."); final HTMLFrameHyperlinkEvent hyperEvent = (HTMLFrameHyperlinkEvent) e; ((HTMLDocument) previewPane.getDocument()) .processHTMLFrameHyperlinkEvent(hyperEvent); } else { handleMindRaiderHyperlink(e); } } }
/************************************************************************** * Hyperlink Listener * * @param e event */ @Override public void hyperlinkUpdate(HyperlinkEvent e) { // System.out.println("OnlineHelp.hyperlinkUpdate - " + e.getDescription() + " " + e.getURL()); if (e.getEventType() != HyperlinkEvent.EventType.ACTIVATED) return; this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); // if (e instanceof HTMLFrameHyperlinkEvent) { HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent)e; HTMLDocument doc = (HTMLDocument)getDocument(); doc.processHTMLFrameHyperlinkEvent(evt); } else if (e.getURL() == null) // remove # of the reference scrollToReference(e.getDescription().substring(1)); else { try { setPage(e.getURL()); } catch (Throwable t) { System.err.println("Help.hyperlinkUpdate - " + t.toString()); displayError("Error", e.getURL(), t); } } this.setCursor(Cursor.getDefaultCursor()); }
public void hyperlinkUpdate(HyperlinkEvent event) { HyperlinkEvent.EventType eventType = event.getEventType(); if (eventType == HyperlinkEvent.EventType.ACTIVATED) { if (event instanceof HTMLFrameHyperlinkEvent) { HTMLFrameHyperlinkEvent linkEvent = (HTMLFrameHyperlinkEvent) event; HTMLDocument document = (HTMLDocument) jep.getDocument(); document.processHTMLFrameHyperlinkEvent(linkEvent); } else { showPage(event.getURL(), true); } } }
public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { JEditorPane pane = (JEditorPane) e.getSource(); if (e instanceof HTMLFrameHyperlinkEvent) { HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent)e; HTMLDocument doc = (HTMLDocument)pane.getDocument(); doc.processHTMLFrameHyperlinkEvent(evt); } else { try { URL url = e.getURL(); if(url.getFile().endsWith("/")) pane.setPage(e.getURL()); else { JFrame frame = new JFrame(url.toExternalForm()); JEditorPane p = null; frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); p = new JEditorPane(url); p.setEditable(false); p.addHyperlinkListener(this); JScrollPane scroll = new JScrollPane(p); frame.getContentPane().add(scroll); frame.setSize(800,600); frame.setVisible(true); } } catch (Throwable t) { t.printStackTrace(); } } } }
public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (e instanceof HTMLFrameHyperlinkEvent) { HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e; HTMLDocument doc = (HTMLDocument) this.getDocument(); doc.processHTMLFrameHyperlinkEvent(evt); } else { try { setPage(e.getURL()); } catch (Throwable t) { SwingTools.showSimpleErrorMessage("while_following_link", t); } } } }
public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { JEditorPane pane = (JEditorPane) e.getSource(); if (e instanceof HTMLFrameHyperlinkEvent) { HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e; HTMLDocument doc = (HTMLDocument) pane.getDocument(); doc.processHTMLFrameHyperlinkEvent(evt); } else { try { URL target = e.getURL(); if (target == null) { target = new URL(new URL(core.opts.baseURI), e.getDescription()); } if (this == popupForm) { pane.setPage(target); } else { if (popupForm == null) { popupForm = new SwingForm(popupName); popupForm.setSize(700, 500); popupForm.setLocation(this.getX() + 30, this.getY() + 30); } popupForm.jedit.setPage(target); popupForm.setVisible(true); } } catch (Throwable t) { t.printStackTrace(); } } } }
private HyperlinkListener getLinkListener() { return new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (e instanceof HTMLFrameHyperlinkEvent) { ((HTMLDocument)html.getDocument()).processHTMLFrameHyperlinkEvent((HTMLFrameHyperlinkEvent)e); } else { try { currentURL = e.getURL(); String s = currentURL.toString(); int offset = s.indexOf(".html"); if(offset > 0) { // .html is in the string s = s.substring(0, offset + 5); s += "?help"; if(currentURL.getRef() != null) { s += "#" + currentURL.getRef(); } currentURL = new URL(s); HelpDialog.this.setEnabled(true); if(menuDlg != null) { menuDlg.setVisible(false); menuDlg = null; } } html.setPage(currentURL); } catch (IOException e1) { html.setText("Cannot display the page.\n" + e1.getMessage()); } } } } }; }
public HypertextPane() { super(); setEditorKit(new ImmediateLoadingEditorKit()); addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent e) { String asString = urlToText(e.getURL()); if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (asString.indexOf("#")==-1) // TODO no { PlatformFriend.openUrl(asString); } else { if (e instanceof HTMLFrameHyperlinkEvent) { HTMLFrameHyperlinkEvent asHTMLFrameHyperlinkEvent = (HTMLFrameHyperlinkEvent) e; ((HTMLDocument)getDocument()).processHTMLFrameHyperlinkEvent(asHTMLFrameHyperlinkEvent); } if (asString.length()>1) { String numberSignLess = asString.substring(1); scrollToReference(numberSignLess); } } } else if (e.getEventType() == HyperlinkEvent.EventType.ENTERED) { // System.out.println("hyperlink: entered"); setToolTipText(asString); // for some reason, framed content doesn't seem to issue this event } else if (e.getEventType() == HyperlinkEvent.EventType.ENTERED) { // System.out.println("hyperlink: entered"); setToolTipText(null); // TODO figure out how to make it actually dismiss the tooltip sooner, without messing up tooltips elsewhere. ToolTipManager? // for some reason, framed content doesn't seem to issue this event } else { // System.out.println("unmapped hyperlink event type: "+e); } } }); setEditable(false); }
public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { URL newUrl = e.getURL(); // if this is a change from frames to no frames // then zap the whole document - assume that when the orginal url is // selected then reload if (newUrl.equals(_startUrl)) { _jep = new JEditorPane(); load(_startUrl); return; } JEditorPane pane = (JEditorPane) e.getSource(); if (e instanceof HTMLFrameHyperlinkEvent) { HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e; HTMLDocument doc = (HTMLDocument) pane.getDocument(); doc.processHTMLFrameHyperlinkEvent(evt); } else { try { if (_lastUrl == null || !newUrl.equals(_lastUrl)) { // might need to move the line below out of this // condition check pane.setPage(newUrl); _lastUrl = newUrl; _cursor++; if (_cursor < _history.size()) { _history.add(_cursor, newUrl); // System.out.println("Inserting page at "+_cursor+" "+newUrl); // _fwd.setEnabled(true); } else { _history.add(newUrl); // System.out.println("Added page at "+_cursor+" "+newUrl); } } } catch (IOException ex) { pane.setText("<html><body>Unable to load file " + newUrl + "</body></html>"); } } } }
public void hyperlinkUpdate(HyperlinkEvent e) { logger.debugPrintf("hyperlinkUpdate:%s\n",e); try { boolean frameEvent=false; VRL link=null; VRL docVrl=null; if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { // get HTML Pane and stuff: VHTMLEditorPane pane = (VHTMLEditorPane) e.getSource(); HTMLDocument doc = (HTMLDocument) pane.getDocument(); docVrl=new VRL(doc.getBase()); URL url=e.getURL(); if (url!=null) { logger.debugPrintf("hyperlinkUpdate: url=%s\n",url); link=new VRL(url); } else { // resolve (relative) link String uriStr=e.getDescription(); logger.debugPrintf("hyperlinkUpdate: uristr=%s\n",uriStr); link=resolve(docVrl,uriStr); } if (e instanceof HTMLFrameHyperlinkEvent) frameEvent=true; if (super.handleLink(link,false)==false) { if (frameEvent==true) { HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e; doc.processHTMLFrameHyperlinkEvent(evt); super.fireFrameLinkFollowedEvent(docVrl,link); } else { super.fireViewEvent(link,false); } } } } catch(Exception ex) { this.handle(ex); } }