Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2011 Michael Ruflin, Andr´┐Ż Locher, Claudia von Bastian. This file is part of Tatool. Tatool is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Tatool is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Tatool. If not, see <http://www.gnu.org/licenses/>. /
 
 package ch.tatool.core.executable;
 
 import static ch.tatool.core.display.swing.ExecutionDisplayUtils.getDisplay;
 
 import java.awt.Color;
 import java.util.Map;
 
 
Executable element that displays generic content in the different regions. Executable finish can either be triggered through a timeout or through a user input or both.

Author(s):
Michael Ruflin
 
 public class GenericContentExecutable extends BlockingAWTExecutable {

Contains the panels to display.
 
 	private Map<RegionJPanelcontents;

Background color to use for the display.
 
 	private Color backgroundColor = null;

Contains the timeout duration.
 
     private long displayDuration = 0;
    
    
Whether the element should also finish upon user input.
 
     private boolean finishOnInput = false;
     
     // runtime variables
     private TimeoutHandler timeoutHandler;
     private Color origColor// store the previous color
     
 		 = new HashMap<RegionJPanel>();
 	}
 	
 		this();
 		setLocalId(id);
 	}
 	
 	
 	protected void startExecutionAWT() {
 		// initialize the view
 		
 		// set the defined background color
 		if ( != null) {
 		}
 		
 		RegionsContainer regionsContainer = ContainerUtils.getRegionsContainer();
 		// add all defined content panels
 		for (Region region : .keySet()) {
 			JPanel panel = .get(region);
 			regionsContainer.setRegionContent(regionpanelfalse);
 		}
         
 		// setup the timer (if applicable)
 		if ( > 0) {
 		}
         
		// check whether the user is allowed to finish by hitting a button
			// action panel
			ActionPanelListener myListener = new ActionPanelListener() {
				public void actionTriggered(ActionPanel sourceObject actionValue) {
					}
				}
			};
			KeyActionPanel actionPanel = new KeyActionPanel();
			actionPanel.addKey(.""null);
			actionPanel.addActionPanelListener(myListener);
			actionPanel.enableActionPanel();
		}
		// display the information
		regionsContainer.setAllContentVisibility(true);
		// start the timer (if applicable)
		if ( != null) {
		}
	}
	private void doCleanup() {
		// cancel / clear timeout handler
		if ( != null) {
		}
		// revert color
		if ( != null) {
			 = null;
		}
		// remove added panels
		RegionsContainer regionsContainer = ContainerUtils.getRegionsContainer();
		for (Region region : .keySet()) {
			regionsContainer.removeRegionContent(region);
		}
	}
	protected void cancelExecutionAWT() {
	}
	public void addContent(Region regionJPanel panel) {
		.put(regionpanel);
	}
	}
	public void setBackgroundColor(Color backgroundColor) {
		this. = backgroundColor;
	}
	public long getDisplayDuration() {
	}
	public void setDisplayDuration(long displayDuration) {
		this. = displayDuration;
	}
	public boolean isFinishOnInput() {
	}
	public void setFinishOnInput(boolean finishOnInput) {
		this. = finishOnInput;
	}
New to GrepCode? Check out our FAQ X