View Javadoc
1   package org.argeo.connect.ui.util;
2   
3   import org.eclipse.swt.widgets.Composite;
4   
5   /**
6    * Use this class rather than Composite as parent for the inner Control of the
7    * CTabFolder to provide lazy loading abilities
8    */
9   public abstract class LazyCTabControl extends Composite {
10  	private static final long serialVersionUID = -3381279482510581039L;
11  
12  	public LazyCTabControl(Composite parent, int style) {
13  		super(parent, style);
14  	}
15  
16  	@Override
17  	public void setVisible(boolean visible) {
18  		// Creates the child controls if needed before showing the tab to avoid
19  		// moving content
20  		if (visible) {
21  			if (this.getChildren().length == 0)
22  				createPartControl(this);
23  			refreshPartControl();
24  		}
25  		super.setVisible(visible);
26  	}
27  
28  	public abstract void createPartControl(Composite parent);
29  
30  	public abstract void refreshPartControl();
31  }