You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Erik de Hair (JIRA)" <ji...@apache.org> on 2017/09/26 08:22:00 UTC

[jira] [Updated] (ISIS-1739) DisableXxx() method is always called while hideXxx() returns true

     [ https://issues.apache.org/jira/browse/ISIS-1739?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Erik de Hair updated ISIS-1739:
-------------------------------
    Description: 
I have a contributed action that must be rendered on the first parameter's page (OrderAbstract) on top of the page but shouldn't be rendered on the other parameter's page.

public Blob downloadDealerQuotationAsPdf(final OrderAbstract order, final Contact recipient){
     Blob quotation = ...
     return quotation;
}
public String disableDownloadDealerQuotationAsPdf(final OrderAbstract order, final Contact recipient){
     if(order.getOrderLines().isEmpty()){
         return "No orderline added yet");
     }
     return null;
}
public boolean hideDownloadDealerQuotationAsPdf(final OrderAbstract order, final Contact recipient) {
     return order == null || !order.getCompany().hasDealer();
}

As far as I can see the disableXXX method wouldn't be called in Apache Isis 1.14.x when the Contact page was rendered, because this was suppressed by the fact that the action was already hidden by the hiddenXXX method. But now they're both called but when rendering the
Contact page it will fail due to a NPE on the first line of the disableXXX method so I have to change this method to

public String disableDownloadDealerQuotationAsPdf(final OrderAbstract order, final Contact recipient){
     if(order == null){
         return "Some dummy reason";
     }
     // actual disable conditions
     ...
}

  was:
I have a contributed action that must be rendered on the first parameter's page (OrderAbstract) on top of the page but shouldn't be rendered on the other parameter's page.

{{public Blob downloadDealerQuotationAsPdf(final OrderAbstract order, final Contact recipient){
     Blob quotation = ...
     return quotation;
}
public String disableDownloadDealerQuotationAsPdf(final OrderAbstract order, final Contact recipient){
     if(order.getOrderLines().isEmpty()){
         return "No orderline added yet");
     }
     return null;
}
public boolean hideDownloadDealerQuotationAsPdf(final OrderAbstract order, final Contact recipient) {
     return order == null || !order.getCompany().hasDealer();
}}}

As far as I can see the disableXXX method wouldn't be called in Apache Isis 1.14.x when the Contact page was rendered, because this was suppressed by the fact that the action was already hidden by the hiddenXXX method. But now they're both called but when rendering the
Contact page it will fail due to a NPE on the first line of the disableXXX method so I have to change this method to

{{public String disableDownloadDealerQuotationAsPdf(final OrderAbstract order, final Contact recipient){
     if(order == null){
         return "Some dummy reason";
     }
     // actual disable conditions
     ...
}}}


> DisableXxx() method is always called while hideXxx() returns true
> -----------------------------------------------------------------
>
>                 Key: ISIS-1739
>                 URL: https://issues.apache.org/jira/browse/ISIS-1739
>             Project: Isis
>          Issue Type: Bug
>          Components: Core: Viewer: Wicket
>    Affects Versions: 1.15.0
>            Reporter: Erik de Hair
>
> I have a contributed action that must be rendered on the first parameter's page (OrderAbstract) on top of the page but shouldn't be rendered on the other parameter's page.
> public Blob downloadDealerQuotationAsPdf(final OrderAbstract order, final Contact recipient){
>      Blob quotation = ...
>      return quotation;
> }
> public String disableDownloadDealerQuotationAsPdf(final OrderAbstract order, final Contact recipient){
>      if(order.getOrderLines().isEmpty()){
>          return "No orderline added yet");
>      }
>      return null;
> }
> public boolean hideDownloadDealerQuotationAsPdf(final OrderAbstract order, final Contact recipient) {
>      return order == null || !order.getCompany().hasDealer();
> }
> As far as I can see the disableXXX method wouldn't be called in Apache Isis 1.14.x when the Contact page was rendered, because this was suppressed by the fact that the action was already hidden by the hiddenXXX method. But now they're both called but when rendering the
> Contact page it will fail due to a NPE on the first line of the disableXXX method so I have to change this method to
> public String disableDownloadDealerQuotationAsPdf(final OrderAbstract order, final Contact recipient){
>      if(order == null){
>          return "Some dummy reason";
>      }
>      // actual disable conditions
>      ...
> }



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)