/** * Returns the hyperlink settings that are in effect for this control. * * @return current hyperlinks settings */ public HyperlinkSettings getHyperlinkSettings() { return model.getHyperlinkSettings(); }
/** * Returns the hyperlink settings that are in effect for this control. * * @return current hyperlinks settings */ public HyperlinkSettings getHyperlinkSettings() { return model.getHyperlinkSettings(); }
private void processTextSegment(Paragraph p, boolean expandURLs, Node textNode) { String text = getNodeText(textNode); NamedNodeMap atts = textNode.getAttributes(); Node font = atts.getNamedItem("font"); //$NON-NLS-1$ Node color = atts.getNamedItem("color"); //$NON-NLS-1$ boolean wrapAllowed=true; Node nowrap = atts.getNamedItem("nowrap"); //$NON-NLS-1$ if (nowrap != null) { String value = nowrap.getNodeValue(); if (value != null && value.equalsIgnoreCase("true")) //$NON-NLS-1$ wrapAllowed = false; } String fontId = null; String colorId = null; if (font != null) { fontId = "f." + font.getNodeValue(); //$NON-NLS-1$ } if (color != null) { colorId = "c." + color.getNodeValue(); //$NON-NLS-1$ } p.parseRegularText(text, expandURLs, wrapAllowed, getHyperlinkSettings(), fontId, colorId); }
private void processTextSegment(Paragraph p, boolean expandURLs, Node textNode) { String text = getNodeText(textNode); NamedNodeMap atts = textNode.getAttributes(); Node font = atts.getNamedItem("font"); //$NON-NLS-1$ Node color = atts.getNamedItem("color"); //$NON-NLS-1$ boolean wrapAllowed=true; Node nowrap = atts.getNamedItem("nowrap"); //$NON-NLS-1$ if (nowrap != null) { String value = nowrap.getNodeValue(); if (value != null && value.equalsIgnoreCase("true")) //$NON-NLS-1$ wrapAllowed = false; } String fontId = null; String colorId = null; if (font != null) { fontId = "f." + font.getNodeValue(); //$NON-NLS-1$ } if (color != null) { colorId = "c." + color.getNodeValue(); //$NON-NLS-1$ } p.parseRegularText(text, expandURLs, wrapAllowed, getHyperlinkSettings(), fontId, colorId); }
private void processSubnodes(Vector<Paragraph> plist, NodeList children, boolean expandURLs) { for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child.getNodeType() == Node.TEXT_NODE) { // Make an implicit paragraph String text = getSingleNodeText(child); if (text != null && !isIgnorableWhiteSpace(text, true)) { Paragraph p = new Paragraph(true); p.parseRegularText(text, expandURLs, true, getHyperlinkSettings(), null); plist.add(p); } } else if (child.getNodeType() == Node.ELEMENT_NODE) { String tag = child.getNodeName().toLowerCase(); if (tag.equals("p")) { //$NON-NLS-1$ Paragraph p = processParagraph(child, expandURLs); if (p != null) plist.add(p); } else if (tag.equals("li")) { //$NON-NLS-1$ Paragraph p = processListItem(child, expandURLs); if (p != null) plist.add(p); } } } }
private void processSubnodes(Vector<Paragraph> plist, NodeList children, boolean expandURLs) { for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child.getNodeType() == Node.TEXT_NODE) { // Make an implicit paragraph String text = getSingleNodeText(child); if (text != null && !isIgnorableWhiteSpace(text, true)) { Paragraph p = new Paragraph(true); p.parseRegularText(text, expandURLs, true, getHyperlinkSettings(), null); plist.add(p); } } else if (child.getNodeType() == Node.ELEMENT_NODE) { String tag = child.getNodeName().toLowerCase(); if (tag.equals("p")) { //$NON-NLS-1$ Paragraph p = processParagraph(child, expandURLs); if (p != null) plist.add(p); } else if (tag.equals("li")) { //$NON-NLS-1$ Paragraph p = processListItem(child, expandURLs); if (p != null) plist.add(p); } } } }
public void parseRegularText(String regularText, boolean convertURLs) { reset(); if (regularText == null) return; regularText = getNormalizedText(regularText); Paragraph p = new Paragraph(true); paragraphs.add(p); int pstart = 0; for (int i = 0; i < regularText.length(); i++) { char c = regularText.charAt(i); if (p == null) { p = new Paragraph(true); paragraphs.add(p); } if (c == '\n') { String text = regularText.substring(pstart, i); pstart = i + 1; p.parseRegularText(text, convertURLs, true, getHyperlinkSettings(), null); p = null; } } if (p != null) { // no new line String text = regularText.substring(pstart); p.parseRegularText(text, convertURLs, true, getHyperlinkSettings(), null); } }
public void parseRegularText(String regularText, boolean convertURLs) { reset(); if (regularText == null) return; regularText = getNormalizedText(regularText); Paragraph p = new Paragraph(true); paragraphs.add(p); int pstart = 0; for (int i = 0; i < regularText.length(); i++) { char c = regularText.charAt(i); if (p == null) { p = new Paragraph(true); paragraphs.add(p); } if (c == '\n') { String text = regularText.substring(pstart, i); pstart = i + 1; p.parseRegularText(text, convertURLs, true, getHyperlinkSettings(), null); p = null; } } if (p != null) { // no new line String text = regularText.substring(pstart); p.parseRegularText(text, convertURLs, true, getHyperlinkSettings(), null); } }
getHyperlinkSettings(), null); } else if (name.equalsIgnoreCase("a")) { //$NON-NLS-1$ segment = processHyperlinkSegment(child, getHyperlinkSettings()); } else if (name.equalsIgnoreCase("span")) { //$NON-NLS-1$ processTextSegment(p, expandURLs, child); String fontId = BOLD_FONT_ID; p.parseRegularText(text, expandURLs, true, getHyperlinkSettings(), fontId); } else if (name.equalsIgnoreCase("br")) { //$NON-NLS-1$ segment = new BreakSegment();
getHyperlinkSettings(), null); } else if (name.equalsIgnoreCase("a")) { //$NON-NLS-1$ segment = processHyperlinkSegment(child, getHyperlinkSettings()); } else if (name.equalsIgnoreCase("span")) { //$NON-NLS-1$ processTextSegment(p, expandURLs, child); String fontId = BOLD_FONT_ID; p.parseRegularText(text, expandURLs, true, getHyperlinkSettings(), fontId); } else if (name.equalsIgnoreCase("br")) { //$NON-NLS-1$ segment = new BreakSegment();
private void activateLink(IHyperlinkSegment link, int stateMask) { setCursor(model.getHyperlinkSettings().getBusyCursor()); if (listeners != null) { int size = listeners.size(); HyperlinkEvent e = new HyperlinkEvent(this, link.getHref(), link .getText(), stateMask); Object [] listenerList = listeners.getListeners(); for (int i = 0; i < size; i++) { IHyperlinkListener listener = (IHyperlinkListener) listenerList[i]; listener.linkActivated(e); } } if (!isDisposed() && model.linkExists(link)) { setCursor(model.getHyperlinkSettings().getHyperlinkCursor()); } }
private void activateLink(IHyperlinkSegment link, int stateMask) { setCursor(model.getHyperlinkSettings().getBusyCursor()); if (listeners != null) { int size = listeners.size(); HyperlinkEvent e = new HyperlinkEvent(this, link.getHref(), link .getText(), stateMask); Object [] listenerList = listeners.getListeners(); for (int i = 0; i < size; i++) { IHyperlinkListener listener = (IHyperlinkListener) listenerList[i]; listener.linkActivated(e); } } if (!isDisposed() && model.linkExists(link)) { setCursor(model.getHyperlinkSettings().getHyperlinkCursor()); } }
enterLink(linkUnder, e.stateMask); paintLinkHover(entered, true); setCursor(model.getHyperlinkSettings().getHyperlinkCursor()); setCursor(model.getHyperlinkSettings().getTextCursor()); else setCursor(null);
enterLink(linkUnder, e.stateMask); paintLinkHover(entered, true); setCursor(model.getHyperlinkSettings().getHyperlinkCursor()); setCursor(model.getHyperlinkSettings().getTextCursor()); else setCursor(null);