Hyperlink Event"
From Documentation
Line 4: | Line 4: | ||
* '''onHyperlink''' | * '''onHyperlink''' | ||
− | *: This event is fired when a user clicks | + | *: This event is fired when a user clicks a hyperlink in a cell. When a corresponding event listener is invoked, a <javadoc directory="zss">org.zkoss.zss.ui.event.HyperlinkEvent</javadoc> object is passed as an argument. |
= Event Monitor Example = | = Event Monitor Example = | ||
− | + | The [[ZK_Spreadsheet_Essentials_3/Working_with_Spreadsheet/Handling_Events/Mouse_Event#Event Monitor Example| Event Monitor]] application's screenshot when we click the link http://www.zkoss.org in A7. | |
[[File:zss-essentials-events-hyperlink.png | center]] | [[File:zss-essentials-events-hyperlink.png | center]] | ||
− | <source lang='java' high=' | + | <source lang='java' high='4, 11'> |
public class EventsComposer extends SelectorComposer<Component>{ | public class EventsComposer extends SelectorComposer<Component>{ | ||
+ | //omitted codes... | ||
@Listen("onCellHyperlink = spreadsheet") | @Listen("onCellHyperlink = spreadsheet") | ||
Line 21: | Line 22: | ||
info.append("Hyperlink ").append(event.getType()) | info.append("Hyperlink ").append(event.getType()) | ||
− | .append(" on : ").append(Ranges.getCellReference(event.getRow(),event.getColumn())) | + | .append(" on : ") |
+ | .append(Ranges.getCellReference(event.getRow(),event.getColumn())) | ||
.append(", address : ").append(event.getAddress()); | .append(", address : ").append(event.getAddress()); | ||
− | + | //show info... | |
− | |||
− | |||
} | } | ||
} | } | ||
</source> | </source> | ||
+ | * Line 11: We can get the clicked hyperlink address. |
Revision as of 07:24, 9 July 2013
- onHyperlink
- This event is fired when a user clicks a hyperlink in a cell. When a corresponding event listener is invoked, a HyperlinkEvent object is passed as an argument.
Event Monitor Example
The Event Monitor application's screenshot when we click the link http://www.zkoss.org in A7.
public class EventsComposer extends SelectorComposer<Component>{
//omitted codes...
@Listen("onCellHyperlink = spreadsheet")
public void onCellHyperlink(CellHyperlinkEvent event){
StringBuilder info = new StringBuilder();
info.append("Hyperlink ").append(event.getType())
.append(" on : ")
.append(Ranges.getCellReference(event.getRow(),event.getColumn()))
.append(", address : ").append(event.getAddress());
//show info...
}
}
- Line 11: We can get the clicked hyperlink address.