All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.appdapter.gui.trigger.BootstrapTriggerFactory Maven / Gradle / Ivy

Go to download

Appdapter Maven project including Java and Scala, produces jar, not bundle. Excludes concrete SLF4J binding.

The newest version!
/*
 *  Copyright 2011 by The Appdapter Project (www.appdapter.org).
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package org.appdapter.gui.trigger;

import org.appdapter.api.trigger.MutableBox;
import org.appdapter.trigger.bind.jena.TriggerImpl;
import org.appdapter.gui.box.ScreenBoxImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author Stu B. 
 *
 * 	End run factory methods for bootstrap triggers (not read from config).
 * // MBT extends MutableBox,
 */
public class BootstrapTriggerFactory { // > & MutableKnownComponent> {
	static Logger theLogger = LoggerFactory.getLogger(BootstrapTriggerFactory.class);

	// public  , TT extends MutableTrigger & MutableKnownComponent> TT
	 CTT putNewConcreteTriggerOnBox(MutableBox mbox, Class trigClass, String trigName)  {
		CTT trig = null;
		try {
			trig = trigClass.newInstance();
			trig.setShortLabel(trigName);
			mbox.attachTrigger(trig);

		} catch (Throwable t) {
			theLogger.error("Problem building trigger for class " + trigClass + " with name " + trigName, t);
		}
		return trig;
	}
	public , RTT extends TriggerImpl> RTT putTriggerOnBox(MutableBox mbox, Class trigClass, String trigName) {
		return null;
	}
	public , BT extends ScreenBoxImpl> TriggerImpl attachNewTrigger(BT box, Class> trigClass,  String trigName) {
		TriggerImpl trig = null;
		try {
			trig = trigClass.newInstance();
			attachTrigger(box, trig, trigName);
		} catch (Throwable t) {
			theLogger.error("Problem building trigger for class " + trigClass + " with name " + trigName, t);
		}
		return trig;
	}
	
	public , BT extends ScreenBoxImpl> void attachTrigger(BT box, TriggerImpl trigger,  String trigName) {
		trigger.setShortLabel(trigName);	
		box.attachTrigger((BTS) trigger);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy