public class DefaultHyperlinkCellClickHandler extends Object implements Spreadsheet.HyperlinkCellClickHandler
Spreadsheet.HyperlinkCellClickHandler interface.
Handles links to cells in either the same or some other sheet, as well as
external URLs.| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultHyperlinkCellClickHandler.HyperlinkOpenStyle
Choose how external links should open
|
| Constructor and Description |
|---|
DefaultHyperlinkCellClickHandler(Spreadsheet spreadsheet) |
DefaultHyperlinkCellClickHandler(Spreadsheet spreadsheet,
DefaultHyperlinkCellClickHandler.HyperlinkOpenStyle openStyle) |
| Modifier and Type | Method and Description |
|---|---|
protected String |
getFirstArgumentFromFormula(org.apache.poi.ss.usermodel.Cell cell)
we parse the formula with a formula/POI trick so we don't have to use
tricky regular expressions that hit terminal runaway evaluation cases
see: https://www.regular-expressions.info/catastrophic.html
Instead, translate
|
String |
getHyperlinkFunctionTarget(org.apache.poi.ss.usermodel.Cell cell)
Should only be called for cells
isHyperlinkFormulaCell(Cell)
returns true. |
protected DefaultHyperlinkCellClickHandler.HyperlinkOpenStyle |
getOpenStyle()
expose for subclasses
|
protected Spreadsheet |
getSpreadsheet()
expose for subclasses
|
static boolean |
isHyperlinkFormulaCell(org.apache.poi.ss.usermodel.Cell cell)
Returns true if the cell contains a hyperlink function.
|
void |
onHyperLinkCellClick(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.Hyperlink hyperlink)
Called when a hyperlink cell has been clicked.
|
protected void |
openExternalLink(String address)
Uses the
DefaultHyperlinkCellClickHandler.HyperlinkOpenStyle to open link addresses. |
void |
setOpenStyle(DefaultHyperlinkCellClickHandler.HyperlinkOpenStyle openStyle) |
public DefaultHyperlinkCellClickHandler(Spreadsheet spreadsheet)
spreadsheet - public DefaultHyperlinkCellClickHandler(Spreadsheet spreadsheet, DefaultHyperlinkCellClickHandler.HyperlinkOpenStyle openStyle)
spreadsheet - openStyle - defaults to DefaultHyperlinkCellClickHandler.HyperlinkOpenStyle.NewTab if nullprotected Spreadsheet getSpreadsheet()
protected DefaultHyperlinkCellClickHandler.HyperlinkOpenStyle getOpenStyle()
public void setOpenStyle(DefaultHyperlinkCellClickHandler.HyperlinkOpenStyle openStyle)
openStyle - the openStyle to set (uses NewTab if null)public void onHyperLinkCellClick(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.Hyperlink hyperlink)
onHyperLinkCellClick in interface Spreadsheet.HyperlinkCellClickHandlercell - hyperlink - may be null, only for Excel link relations, not formulapublic String getHyperlinkFunctionTarget(org.apache.poi.ss.usermodel.Cell cell)
isHyperlinkFormulaCell(Cell)
returns true. Returns the target for tooltip use by default.
The address is inside the first argument:
HYPERLINK("address","friendly name") or
HYPERLINK("#!viewName[/arguments]","friendly name") or
HYPERLINK(D5,"friendly name") or
HYPERLINK([arbitrary formula],"friendly name")
getHyperlinkFunctionTarget in interface Spreadsheet.HyperlinkCellClickHandlercell - Target cell containing a hyperlink functionprotected String getFirstArgumentFromFormula(org.apache.poi.ss.usermodel.Cell cell)
HYPERLINK(arg1[, arg2]) to IF(true, arg1[, arg2])
public static final boolean isHyperlinkFormulaCell(org.apache.poi.ss.usermodel.Cell cell)
cell - Cell to investigateprotected void openExternalLink(String address)
DefaultHyperlinkCellClickHandler.HyperlinkOpenStyle to open link addresses.
Subclass and override to use something else with the address.address - to navigate toCopyright © 2013–2026 Vaadin Ltd. All rights reserved.