Skip to content

Commit

Permalink
Fix obsoleted API
Browse files Browse the repository at this point in the history
Signed-off-by: avpinchuk <alexander.v.pinchuk@gmail.com>
  • Loading branch information
avpinchuk committed Oct 25, 2022
1 parent 041723a commit b1a721f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
import com.sun.jsftemplating.annotation.UIComponentFactory;
import com.sun.jsftemplating.component.factory.ComponentFactoryBase;
import com.sun.jsftemplating.layout.descriptors.LayoutComponent;

import jakarta.el.ExpressionFactory;
import jakarta.el.ValueExpression;
import jakarta.faces.component.UIComponent;
import jakarta.faces.context.FacesContext;

Expand Down Expand Up @@ -56,9 +57,11 @@ public UIComponent create(FacesContext context, LayoutComponent descriptor, UICo

// Default to primary button
if (descriptor.getOption("primary") == null) {
// Use ValueBinding vs. property so we don't set the local value
// flag which will hide any future VB that is set on the component
comp.setValueBinding("primary", context.getApplication().createValueBinding("#{true}"));
// Use ValueExpression vs. property so we don't set the local value
// flag which will hide any future VE that is set on the component
ExpressionFactory factory = context.getApplication().getExpressionFactory();
ValueExpression valueExpression = factory.createValueExpression(context.getELContext(), "#{true}", Object.class);
comp.setValueExpression("primary", valueExpression);
}

// Set all the attributes / properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import com.sun.jsftemplating.util.MessageUtil;
import com.sun.jsftemplating.util.Util;

import jakarta.el.ExpressionFactory;
import jakarta.faces.component.NamingContainer;
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.UIViewRoot;
Expand Down Expand Up @@ -1364,7 +1365,8 @@ public static class MethodBindingDataSource implements DataSource {
*/
@Override
public Object getValue(FacesContext ctx, LayoutElement desc, UIComponent component, String key) {
return ctx.getApplication().createMethodBinding(key, ACTION_ARGS);
ExpressionFactory factory = ctx.getApplication().getExpressionFactory();
return factory.createMethodExpression(ctx.getELContext(), key, null, ACTION_ARGS);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@
import com.sun.jsftemplating.layout.descriptors.handler.Handler;
import com.sun.jsftemplating.util.LogUtil;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Produces;
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.UIViewRoot;
import jakarta.faces.context.FacesContext;
import jakarta.faces.event.ActionEvent;
import jakarta.faces.event.ActionListener;
import jakarta.inject.Named;

/**
* <p>
Expand Down Expand Up @@ -61,6 +64,9 @@ public CommandActionListener() {
* This delegates to {@link #getInstance(FacesContext)}.
* </p>
*/
@Produces
@ApplicationScoped
@Named("lfCommand")
public static CommandActionListener getInstance() {
return getInstance(FacesContext.getCurrentInstance());
}
Expand Down
10 changes: 0 additions & 10 deletions jsftemplating/src/main/resources/META-INF/faces-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,4 @@
</renderer>
</render-kit>

<managed-bean>
<description>
The "invokeCommandHandlers" ActionListener in this managed bean
capable of dispatching "command" handlers.
</description>
<managed-bean-name>lfCommand</managed-bean-name>
<managed-bean-class>com.sun.jsftemplating.layout.event.CommandActionListener</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>

</faces-config>

0 comments on commit b1a721f

Please sign in to comment.