本文整理汇总了Java中javax.faces.event.ComponentSystemEvent类的典型用法代码示例。如果您正苦于以下问题:Java ComponentSystemEvent类的具体用法?Java ComponentSystemEvent怎么用?Java ComponentSystemEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ComponentSystemEvent类属于javax.faces.event包,在下文中一共展示了ComponentSystemEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processEvent
import javax.faces.event.ComponentSystemEvent; //导入依赖的package包/类
public void processEvent(ComponentSystemEvent event)
throws AbortProcessingException
{
boolean inContextAtMethodInvocation = _inContext;
if (!inContextAtMethodInvocation)
{
_setupContextChange();
}
try
{
super.processEvent(event);
}
finally
{
if (!inContextAtMethodInvocation)
{
_tearDownContextChange();
}
}
}
示例2: checkCart
import javax.faces.event.ComponentSystemEvent; //导入依赖的package包/类
public void checkCart(ComponentSystemEvent event) {
if (logger.isDebugEnabled()) logger.debug("in check cart");
FacesContext fc = FacesContext.getCurrentInstance();
ConfigurableNavigationHandler nav = (ConfigurableNavigationHandler) fc.getApplication().getNavigationHandler();
if (this.cart.isEmpty()) {
if (logger.isDebugEnabled()) logger.debug("go direct to logout");
HttpServletRequest req = (HttpServletRequest) FacesContext
.getCurrentInstance().getExternalContext().getRequest();
HttpServletResponse res = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
try {
res.sendRedirect("finish-logout.xhtml");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
示例3: loadGuest
import javax.faces.event.ComponentSystemEvent; //导入依赖的package包/类
public void loadGuest(ComponentSystemEvent evt) {
if (null == this.publicGuestId) {
this.guest = Guest.nullGuest();
addMessage(SEVERITY_ERROR,
"No guest id provided!");
return;
}
if (null == this.guest) {
this.guest = this.service.findByPublicId(this.publicGuestId)
.orElseGet(() -> {
addMessage(SEVERITY_ERROR,
"Cannot find guest " + this.publicGuestId);
return Guest.nullGuest();
});
}
}
示例4: processEvent
import javax.faces.event.ComponentSystemEvent; //导入依赖的package包/类
/**
* Dario D'Urzo <br>
* Dynamically add custom css to manage non-sticky footer. In this way, only
* if fixed attribute is "non-sticky" the system load the correct css that
* manages all style aspect of this functionlity.
*
* This is also cross-theme.
*/
@Override
public void processEvent(ComponentSystemEvent event) throws AbortProcessingException {
if (event instanceof PostAddToViewEvent) {
if ("non-sticky".equals(getFixed()) || ("bottom".equals(getPosition()) && (!isSticky()))) {
AddResourcesListener.addExtCSSResource("sticky-footer-navbar.css");
/*UIOutput resource = new UIOutput();
resource.getAttributes().put("name", "css/sticky-footer-navbar.css");
resource.getAttributes().put("library", C.BSF_LIBRARY);
resource.getAttributes().put("target", "head");
resource.setRendererType("javax.faces.resource.Stylesheet");
FacesContext.getCurrentInstance().getViewRoot().addComponentResource(FacesContext.getCurrentInstance(),
resource);*/
}
}
super.processEvent(event);
}
示例5: validateInformation
import javax.faces.event.ComponentSystemEvent; //导入依赖的package包/类
/**
* Validate the password
* @param event
*/
public void validateInformation(ComponentSystemEvent event) {
FacesContext fc = FacesContext.getCurrentInstance();
UIComponent components = event.getComponent();
// get password
UIInput uiInputPassword = (UIInput) components.findComponent("password");
String pwd = uiInputPassword.getLocalValue() == null ? ""
: uiInputPassword.getLocalValue().toString();
// get confirm password
UIInput uiInputConfirmPassword = (UIInput) components.findComponent("confirmPassword");
String confirmPassword = uiInputConfirmPassword.getLocalValue() == null ? ""
: uiInputConfirmPassword.getLocalValue().toString();
if (pwd.isEmpty() || confirmPassword.isEmpty()) {
// Do not take any action.
// The required="true" in the XHTML file will catch this and produce an error message.
return;
}
if (!pwd.equals(confirmPassword)) {
message = "Passwords must match!";
} else {
message = "";
}
}
示例6: validateInformation
import javax.faces.event.ComponentSystemEvent; //导入依赖的package包/类
/**
* Make sure the two password are equal when the event is received
* @param event the event to listen for
*/
public void validateInformation(ComponentSystemEvent event) {
FacesContext fc = FacesContext.getCurrentInstance();
UIComponent components = event.getComponent();
// Get password
UIInput uiInputPassword = (UIInput) components.findComponent("password");
String pwd = uiInputPassword.getLocalValue() == null ? ""
: uiInputPassword.getLocalValue().toString();
// Get confirm password
UIInput uiInputConfirmPassword = (UIInput) components.findComponent("confirmPassword");
String confirmPassword = uiInputConfirmPassword.getLocalValue() == null ? ""
: uiInputConfirmPassword.getLocalValue().toString();
if (pwd.isEmpty() || confirmPassword.isEmpty()) {
// Do not take any action.
// The required="true" in the XHTML file will catch this and produce an error message.
return;
}
if (!pwd.equals(confirmPassword)) {
statusMessage = "Passwords must match!";
} else {
statusMessage = "";
}
}
示例7: validatePassword
import javax.faces.event.ComponentSystemEvent; //导入依赖的package包/类
public void validatePassword(ComponentSystemEvent event) {
FacesContext fc = FacesContext.getCurrentInstance();
UIComponent components = event.getComponent();
// get password
UIInput uiInputPassword = (UIInput) components.findComponent("newPassword");
String password = uiInputPassword.getLocalValue() == null ? ""
: uiInputPassword.getLocalValue().toString();
String passwordId = uiInputPassword.getClientId();
// get confirm password
UIInput uiInputConfirmPassword = (UIInput) components.findComponent("newConfirmPassword");
String confirmPassword = uiInputConfirmPassword.getLocalValue() == null ? ""
: uiInputConfirmPassword.getLocalValue().toString();
// Let required="true" do its job.
if (password.isEmpty() || confirmPassword.isEmpty()) {
return;
}
if (!password.equals(confirmPassword)) {
FacesMessage msg = new FacesMessage(bundle.getString("resetpassword.error.notmatch"));
msg.setSeverity(FacesMessage.SEVERITY_ERROR);
fc.addMessage(passwordId, msg);
fc.renderResponse();
}
}
示例8: preRender
import javax.faces.event.ComponentSystemEvent; //导入依赖的package包/类
public void preRender(ComponentSystemEvent event) {
if (! FacesContext.getCurrentInstance().isPostback()) {
this.attributes = new ArrayList<ScaleAttribute>();
for (ScaleAttribute attr : this.scaleUser.getAttributes()) {
this.attributes.add(new ScaleAttribute(attr.getName(),attr.getLabel(),attr.getValue()));
}
this.saveResult.reset();
} else {
}
}
示例9: initReservationMessage
import javax.faces.event.ComponentSystemEvent; //导入依赖的package包/类
/**
* Adds a message if a reservation is indicated via get parameters
*
* @param evt the event
*/
public void initReservationMessage(ComponentSystemEvent evt) {
if (isBlank(publicGuestId) || isBlank(reservationNumber)) {
return;
}
FacesMessage message = new FacesMessage(format("Room %s is booked for %s; Reservation number %s",
roomNumber, publicGuestId, reservationNumber));
getCurrentInstance().addMessage(null, message);
}
示例10: loadRoom
import javax.faces.event.ComponentSystemEvent; //导入依赖的package包/类
public void loadRoom(ComponentSystemEvent evt) {
if (null == this.roomId) {
this.room = Room.nullValue();
addMessage(SEVERITY_WARN, "No room id provided!");
return;
}
if (null == this.room) {
this.room = this.service.findRoomById(this.roomId)
.orElseGet(() -> {
addMessage(SEVERITY_WARN, "Cannot find room " + this.roomId);
return Room.nullValue();
});
}
}
示例11: renderAttribute
import javax.faces.event.ComponentSystemEvent; //导入依赖的package包/类
public void renderAttribute(ComponentSystemEvent event) {
// Replace dummy component id with real one
String dummyId = event.getComponent().getAttributes().get("aid").toString();
String clientId = event.getComponent().getClientId();
GluuAttribute attribute = this.attributeToIds.get(dummyId);
this.attributeIds.put(attribute, clientId);
}
示例12: processEvent
import javax.faces.event.ComponentSystemEvent; //导入依赖的package包/类
@Override
public void processEvent(ComponentSystemEvent componentEvent) {
final UIComponent listener = componentEvent.getComponent();
final FacesContext facesContext = FacesContext.getCurrentInstance();
final String listenerId = Components.getFullyQualifiedComponentId(facesContext, listener);
provider.getMap(facesContext).add((String) listener.getAttributes().get(attribute), listenerId);
}
示例13: init
import javax.faces.event.ComponentSystemEvent; //导入依赖的package包/类
public void init(ComponentSystemEvent e){
log.info("call init");
log.info("flag @"+ flag);
if(!FacesContext.getCurrentInstance().isPostback()){
//initialized some data...but avoid loading in postback request
}
if("page2".equals(flag)){
ConfigurableNavigationHandler handler=(ConfigurableNavigationHandler)
FacesContext.getCurrentInstance().getApplication().getNavigationHandler();
handler.performNavigation("page2");
}
}
示例14: loadFile
import javax.faces.event.ComponentSystemEvent; //导入依赖的package包/类
public void loadFile(ComponentSystemEvent event) {
// TODO: The post-back check will become unnecessary in JSF 2.2,
// when the <f:viewAction action="#{editMediaFileBean.loadFile}" onPostback="false" />
// is introduced.
if (!FacesContext.getCurrentInstance().isPostback()) {
this.mediaFile = mediaFileEJB.findById(videoId);
if ( mediaFile.getUserProvidedMetadata() != null ) {
this.metaData = mediaFile.getUserProvidedMetadata();
} else {
this.metaData = new MediaFileUserProvidedMetaData();
}
this.thumbnailOffsetMs = mediaFile.getThumbnailData().getThumbnailOffsetMs();
}
}
示例15: validateSpeakers
import javax.faces.event.ComponentSystemEvent; //导入依赖的package包/类
/**
* Validate that at least 1 speaker is assigned to the talk.
*
* @param event
* the validation event
*/
public void validateSpeakers(ComponentSystemEvent event) {
if (talk.getSpeakers().isEmpty()) {
FacesContext facesContext = FacesContext.getCurrentInstance();
facesContext.addMessage("talkForm:speakers",
new FacesMessage(FacesMessage.SEVERITY_ERROR, "must be selected.",
"At least one speaker must be selected."));
facesContext.validationFailed();
}
}