Using the New Feature Of The Timeline Component

From Documentation
DocumentationSmall Talks2008SeptemberUsing the New Feature Of The Timeline Component
Using the New Feature Of The Timeline Component

Author
Gu Wei Xing, Software developer in NanTong of JiangSu province, China.
Date
Sep 26, 2008
Version
Applicable to zk-timeline1.2_2.



Hide or show the message bubble. It’s very simple.

  • Show the message bubble for a Bandinfo object.
  b1.setBubbleVisible(true);


  • Hide the message bubble for a Bandinfo object.
		
  b1.setBubbleVisible(false);


  • Catch the OccurEventSelectEvent.

After hide the message bubble the OccurEventSelectEvent would be sent back when user click the title of a OccurEvent in a band.So you can catch this event like the following codes. First,you should implement an EventListener interface.

  public  class OccurEventSelectListener implements EventListener {
	public boolean isAsap() {
		return true;
	}
	public void onEvent(Event event) throws UiException {
		OccurEventSelectEvent oese=(OccurEventSelectEvent)event;
		//TODO: edit the next code by yourself.
	System.out.println(oese.getOccurEvent().toString());
	}
  }


Second,new a OccurEventSelectListener and add this listener to the bandinfo object. That’a all.

  <zscript><![CDATA[
	b1.addEventListener("onOccurEventSelect", new OccurEventSelectListener());
	b2.addEventListener("onOccurEventSelect", new OccurEventSelectListener());
  ]]></zscript>

The example:

Pass center visible date in BandScrollEvent.

This feature contribute by hengsin at users.sourceforge.net.Now the BandScrollEvent contains a “center” property.It point the current center date position to where the band scroll .

  • Implement an EventListener.
  public class BandScrollListener implements EventListener {
	  public boolean isAsap() {
		  // TODO Auto-generated method stub
		  return true;
	  }    
	  public void onEvent(Event event) {
		  // TODO Auto-generated method stub
		  BandScrollEvent e = (BandScrollEvent) event;
		  //TODO: edit the next code by yourself.
		  System.out.println("The center date is:"+e.getCenter());
	  }
  }


  • Add a BandScrollListener to the band.
  b1.addEventListener("onBandScroll",new BandScrollListener());

Here is the Example :

Dowload

Summary

Hope you enjoy this component. I look forward to your feedback.


Ruler.gif


Gu Wei Xing is a software developer in NanTong of JiangSu province, China. He loves Java software development and Flash programming. He is also the host developer of the timeline project for ZK.forge.




Copyright © Gu Wei Xing. This article is licensed under GNU Free Documentation License.