/**
* OLAT - Online Learning and Training<br>
* http://www.olat.org
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br>
* University of Zurich, Switzerland.
* <p>
*/
package com.xyz.demoextension;
import java.util.Locale;
import org.olat.core.extensions.Extension;
import org.olat.core.extensions.ExtensionElement;
import org.olat.core.extensions.action.ActionExtension;
import org.olat.core.extensions.helpers.ExtensionElements;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.translator.Translator;
import org.olat.core.util.Util;
import org.olat.home.HomeMainController;
/**
* Description:<br>
* Simple example for an olat extension
*
* @author guido
*/
public class HelloWorldExtension implements Extension {
private ExtensionElements elements = new ExtensionElements();
public HelloWorldExtension() {
//we like to have a link in the testing tab menu
//elements.putExtensionElement(TestingMainController.class.getName(), new ActionExtension() {
elements.putExtensionElement(HomeMainController.class.getName(), new ActionExtension() {
//the "alt" text for the link
public String getDescription(Locale loc) {
Translator translator = Util.createPackageTranslator(this.getClass(), loc);
return translator.translate("helloWorld.description");
}
//the link text
public String getActionText(Locale loc) {
Translator translator = Util.createPackageTranslator(this.getClass(), loc);
return translator.translate("helloWorld.action");
}
//the controller the link creates clicking on it
public Controller createController(UserRequest ureq, WindowControl wControl, Object arg) {
Controller controller = new HelloWorldController(ureq, wControl);
return controller;
}
});
}
/**
* @see org.olat.core.extensions.Extension#getExtensionFor(java.lang.String)
*/
public ExtensionElement getExtensionFor(String extensionPoint) {
return elements.getExtensionElement(extensionPoint);
}
}