cancel
Showing results for 
Search instead for 
Did you mean: 

Refreshing properties panel after new aspect applied

jpotts
World-Class Innovator
World-Class Innovator
I have an action that I've added to the space details action list. The action adds an aspect to the space and sets some aspect properties. The action functions properly.

However, when the aspect is first applied, the properties panel does not refresh itself with the new aspect properties. If I close and expand the properties section or close out of the document details and return, the aspect properties are shown.

On subsequent action invocations, the properties list shows the changed values. The problem only occurs when the aspect is added for the first time.

The action is configuration is:
<action id="portal_enable">      <evaluator>com.somedomain.web.action.evaluator.PortalEnableEvaluator</evaluator>
  <label-id>enablePortal</label-id>
  <image>/images/icons/shortcut.gif</image>
  <action-listener>#{PortalSettingsBean.setActive}</action-listener>
  <params>
    <param name="id">#{actionContext.id}</param>
    <param name="active">true</param>              
  </params>
</action>

The portion of the setActive method that adds the aspect is:

FacesContext context = FacesContext.getCurrentInstance();
tx = Repository.getUserTransaction(context);
tx.begin();

Map<QName, Serializable> properties = nodeService.getProperties(ref);
properties.put(SomeModel.PROP_ACTIVE, activeFlag);
                
if (activeFlag) {
  properties.put(SomeModel.PROP_PUBLISH_DATE, new Date());
}

// if the aspect has already been added, set the properties
if (node.hasAspect(SomeModel.ASPECT_PORTAL)) {
    nodeService.setProperties(ref, properties);
  } else {
    // otherwise, add the aspect and set the properties
    nodeService.addAspect(ref, SomeModel.ASPECT_PORTAL, properties);
  }                 

String msg = Application.getMessage(fc, MSG_SUCCESS_PORTAL_SET_ACTIVE);
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
String formId = Utils.getParentForm(fc, event.getComponent()).getClientId(fc);
fc.addMessage(formId + ':' + getPropertiesPanelId(), facesMsg);

// commit the transaction
tx.commit();

this.browseBean.getActionSpace().reset();

if (logger.isDebugEnabled()) logger.debug("Ran portal enable/disable action");

Is there a method I can call to force the properties panel to repaint or refresh itself?
2 REPLIES 2

kevinr
Star Contributor
Star Contributor
The method you are calling:

this.browseBean.getActionSpace().reset();
should work and your code looks find to me. This is the same method we call when anything is modified in the properties screen - such as categories or versioning settings.

Thanks,

Kevin

jpotts
World-Class Innovator
World-Class Innovator
Right, I got that call by looking at the source so I was surprised it didn't behave as expected.

I've opened a support issue so we can drill down on this further and get it resolved.