br.com.jarch.faces.help.HelpController Maven / Gradle / Ivy
package br.com.jarch.faces.help;
import br.com.jarch.core.annotation.JArchController;
import br.com.jarch.faces.util.JavaScriptUtils;
import br.com.jarch.util.StringUtils;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;
import java.io.Serializable;
@JArchController
public class HelpController implements Serializable {
@Inject
private Instance helpData;
private String title;
private String body;
private String urlVideo;
private boolean show;
public boolean isShowHelp() {
loadHelp();
return show;
}
public String getTitle() {
return title;
}
public String getBody() {
return body;
}
public String getUrlVideo() {
return urlVideo;
}
public void showDialog() {
JavaScriptUtils.execute("PF('help').show();");
}
private void loadHelp() {
title = "";
body = "";
urlVideo = "";
if (helpData.isResolvable()) {
title = helpData.get().getTitle();
body = helpData.get().getBody();
urlVideo = helpData.get().getUrlVideo();
}
show = !StringUtils.isNullOrEmpty(title)
&& (!StringUtils.isNullOrEmpty(body) || !StringUtils.isNullOrEmpty(urlVideo));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy