Hyperlink Event"

From Documentation
m (correct highlight (via JWB))
 
(15 intermediate revisions by the same user not shown)
Line 3: Line 3:
  
  
* '''onHyperlink'''
+
{{ZSS EE}}
*: This event is fired when a user clicks on a cell that contains a hyperlink. When a corresponding event listener is invoked, a <javadoc directory="zss">org.zkoss.zss.ui.event.HyperlinkEvent</javadoc> object is passed as an argument.
+
= Overview =
 +
There is only one hyperlink event that ZK Spreadsheet supports.
  
 +
== onCellHyperlink ==
 +
This event is fired when a user clicks a hyperlink in a cell. A browser will open the specified hyperlink and send the event to a server. When a corresponding event listener is invoked, a <javadoc directory="zss">org.zkoss.zss.ui.event.CellHyperlinkEvent</javadoc> object is passed as an argument.
  
 
= Event Monitor Example =
 
= Event Monitor Example =
 +
 +
The [[ZK_Spreadsheet_Essentials_3/Working_with_Spreadsheet/Handling_Events/Cell_Clicking_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]]
 +
 +
 +
<source lang='java' highlight='4, 11'>
 +
public class EventsComposer extends SelectorComposer<Component>{
 +
//omitted codes...
 +
 +
@Listen("onCellHyperlink = #ss")
 +
public void onCellHyperlink(CellHyperlinkEvent event){
 +
StringBuilder info = new StringBuilder();
 +
 +
info.append("Hyperlink ").append(event.getType())
 +
.append(" on : ")
 +
.append(Ranges.getCellRefString(event.getRow(),event.getColumn()))
 +
.append(", address : ").append(event.getAddress());
 +
 +
//show info...
 +
}
 +
 +
}
 +
</source>
 +
* Line 11: We can get the clicked hyperlink address.
 +
 +
 +
 +
 +
{{ZKSpreadsheetEssentialsPageFooter}}

Latest revision as of 12:53, 19 January 2022



Available in ZK Spreadsheet EE only

Overview

There is only one hyperlink event that ZK Spreadsheet supports.

onCellHyperlink

This event is fired when a user clicks a hyperlink in a cell. A browser will open the specified hyperlink and send the event to a server. When a corresponding event listener is invoked, a CellHyperlinkEvent 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.

Zss-essentials-events-hyperlink.png


public class EventsComposer extends SelectorComposer<Component>{
	//omitted codes...

	@Listen("onCellHyperlink = #ss")
	public void onCellHyperlink(CellHyperlinkEvent event){
		StringBuilder info = new StringBuilder();
		
		info.append("Hyperlink ").append(event.getType())
			.append(" on : ")
			.append(Ranges.getCellRefString(event.getRow(),event.getColumn()))
			.append(", address : ").append(event.getAddress());
		
		//show info...
	}		

}
  • Line 11: We can get the clicked hyperlink address.



All source code listed in this book is at Github.


Last Update : 2022/01/19

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.