PageRenderTime 27ms CodeModel.GetById 17ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

/webportal/src/main/java/au/org/emii/portal/composer/AnimationFramesComposer.java

http://alageospatialportal.googlecode.com/
Java | 70 lines | 50 code | 12 blank | 8 comment | 5 complexity | f8660a8fda7497bf7fa792d0f0c98173 MD5 | raw file
 1package au.org.emii.portal.composer;
 2
 3import au.org.emii.portal.menu.MapLayer;
 4import org.zkoss.zul.Label;
 5import org.zkoss.zul.Radiogroup;
 6
 7public class AnimationFramesComposer extends UtilityComposer {
 8	
 9	private static final long serialVersionUID = 1L;
10	private MapLayer activeLayer;
11	private Label errorMessage;
12	private Radiogroup selectedFrameRate;
13	
14	// ok button
15	public void onClick$submit() {
16		if (validate()) {
17			String selected = selectedFrameRate.getSelectedItem().getValue();
18			logger.debug("OK clicked - fetching animation for " + selected);				
19			activeLayer.getAnimationSelection().setSelectedTimeStringKey(selected);
20			detach();
21			
22			// show the animation layer now
23			getAnimationControlsComposer().activateAnimation(activeLayer);	
24		}
25		else {
26			errorMessage.setVisible(true);
27		}
28	}
29		
30	// cancel button
31        @Override
32	public void onClick$close() {
33		detach();
34	}
35
36	private boolean validate() {
37		boolean valid;
38		if (selectedFrameRate.getSelectedItem() != null) {
39			valid = true;
40		}
41		else {
42			valid = false;
43		}
44		return valid;	
45	}
46
47        @Override
48	public void afterCompose() {
49		super.afterCompose();
50		//  select the last item in the list (least frames) by default
51		selectedFrameRate.setSelectedIndex(selectedFrameRate.getItemCount() - 1);
52	}
53	
54	public AnimationControlsComposer getAnimationControlsComposer() {
55		return null; /*((MapComposer) Executions.getCurrent()
56				.getDesktop()
57					.getPage("MapZul")
58						.getFellow("mapPortalPage")
59		).getAnimationControlsComposer();*/
60	}
61
62	public MapLayer getActiveLayer() {
63		return activeLayer;
64	}
65
66	public void setActiveLayer(MapLayer activeLayer) {
67		this.activeLayer = activeLayer;
68	}
69
70}