Skip to content

Commit

Permalink
Merge #5316 from 4.0 into 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
BalusC committed Oct 1, 2023
2 parents 787c9af + 08997de commit 9e5d4f6
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions impl/src/main/java/com/sun/faces/lifecycle/LifecycleImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,46 +66,18 @@ public class LifecycleImpl extends Lifecycle {

// List for registered PhaseListeners
private List<PhaseListener> listeners = new CopyOnWriteArrayList<>();
private boolean isClientWindowEnabled = false;
private WebConfiguration config;

public LifecycleImpl() {

}

public LifecycleImpl(FacesContext context) {
ExternalContext extContext = context.getExternalContext();
config = WebConfiguration.getInstance(extContext);
context.getApplication().subscribeToEvent(PostConstructApplicationEvent.class, Application.class, new PostConstructApplicationListener());

}

private class PostConstructApplicationListener implements SystemEventListener {

@Override
public boolean isListenerForSource(Object source) {
return source instanceof Application;
}

@Override
public void processEvent(SystemEvent event) throws AbortProcessingException {
postConstructApplicationInitialization();
}

}

private void postConstructApplicationInitialization() {
String optionValue = config.getOptionValue(WebConfiguration.WebContextInitParameter.ClientWindowMode);
isClientWindowEnabled = null != optionValue && !optionValue.equals(WebConfiguration.WebContextInitParameter.ClientWindowMode.getDefaultValue());
}

// ------------------------------------------------------- Lifecycle Methods

@Override
public void attachWindow(FacesContext context) {
if (!isClientWindowEnabled) {
return;
}
if (context == null) {
throw new NullPointerException(MessageUtils.getExceptionMessageString(MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "context"));
}
Expand Down

0 comments on commit 9e5d4f6

Please sign in to comment.