You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Hector Fabio Meza <he...@smartools.com.co> on 2017/05/01 19:38:37 UTC

Programatically accessing the "recent objects" list

Hi, 

I was wondering if there's a way to access the "recent objects" list
that appears a a drop-down list in the lower part of the UI. I'd like to
place actions on each screen that allows the user to go back to the
screen they were before the current one (for example in a master-detail
kind of situation). 

I suppose that list is related to the BookmarkService but couldn't find
a method for retrieving the last visited object. 

Thank you. 

-- 
Hector Fabio Meza

R&D LEAD SMARTOOLS 
(57) 300 2254455 [1] 
Skype: hectorf.meza 
www.smartools.com.co [2] 

 

Links:
------
[1] tel:%2857%29%20300%206815404
[2] http://www.smartools.com.co/

Re: Programatically accessing the "recent objects" list

Posted by Hector Fabio Meza <he...@smartools.com.co>.
Hi, Dan 

Thanks a lot, your idea worked perfectly, and I'm now able to access the
list in the Breadcrumb model. 

I still have an issue, but I'm not sure if there's a way to go around it
without modifying the original code. 

In my app I have several view models (annotated with @XMLRootElement)
that act as an entry point for objects. Instead of having a menu option
to list and one to create, the view model shows a list, some filters and
the "create" action. It would be very useful to be able to have a
"return to view model" action in my entities. 

The issue is that the BreadcrumbModel implementation specifically
ignores view models, so they're not getting stored in the list of
EntityModels. 

I tried to work around this problem by creating my own implementation of
BreadcrumbModel that doesn't ignore ViewModels, then creating a copy of
AuthenticatedWebSessionForIsis with this new model and finally
overriding getWebSessionClass() in my IsisWicketApplication subclass to
use my new class, but this hack ended up breaking the application with a
"Cannot instantiate the configured sign in page" error, caused by
org.apache.wicket.RestartResponseException. 

Is there another way to plug a custom BreadcrumbModel class or
AuthenticatedWebSession class into Isis so I can have ViewModels stored
in the Breadcrumb list? If it can't be done, I guess I could manually
store the ViewModel in the Scratchpad so the entities can access it and
send the user back to it, but I like how breadcrumbs work automatically
behind the scenes. 

El 2017-05-01 16:12, Dan Haywood escribió:

> Hi Hector, 
> 
> There isn't any formal API, but you could create a little service easily enough.  Take a look at BreadcrumbPanel... 
> 
> Something like 
> 
> public interface RecentObjectService { 
> List<Object> recentObjects(); 
> } 
> 
> @DomainService(nature=DOMAIN) 
> public class RecentObjectServiceUsingWicket implements RecentObjectService { 
> 
> @Programmatic 
> public List<Object> recentObjects() { 
> final BreadcrumbModelProvider session = (BreadcrumbModelProvider) org.apache.wicket.Session.get(); 
> final BreadcrumbModel breadcrumbModel = session.getBreadcrumbModel(); 
> final List<EntityModel> entities = breadcrumbModel.getList(); 
> return entities.stream().map(x -> x.getObject().getObject()).collect(Collectors.toList()) 
> } 
> } 
> 
> HTH 
> Dan 
> 
> On Mon, 1 May 2017 at 21:38 Hector Fabio Meza <he...@smartools.com.co> wrote: 
> 
>> Hi, 
>> 
>> I was wondering if there's a way to access the "recent objects" list that appears a a drop-down list in the lower part of the UI. I'd like to place actions on each screen that allows the user to go back to the screen they were before the current one (for example in a master-detail kind of situation). 
>> 
>> I suppose that list is related to the BookmarkService but couldn't find a method for retrieving the last visited object. 
>> 
>> Thank you. 
>> 
>> -- 
>> Hector Fabio Meza
>> 
>> R&D LEAD SMARTOOLS 
>> (57) 300 2254455 [1] 
>> Skype: hectorf.meza 
>> www.smartools.com.co [2]

-- 
Hector Fabio Meza

R&D LEAD SMARTOOLS 
(57) 300 2254455 [1] 
Skype: hectorf.meza 
www.smartools.com.co [2] 

 

Links:
------
[1] tel:%2857%29%20300%206815404
[2] http://www.smartools.com.co/

Re: Programatically accessing the "recent objects" list

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Hector,

There isn't any formal API, but you could create a little service easily
enough.  Take a look at BreadcrumbPanel...

Something like

public interface RecentObjectService {
    List<Object> recentObjects();
}


@DomainService(nature=DOMAIN)
public class RecentObjectServiceUsingWicket implements RecentObjectService {

    @Programmatic
    public List<Object> recentObjects() {
        final BreadcrumbModelProvider session = (BreadcrumbModelProvider)
org.apache.wicket.Session.get();
        final BreadcrumbModel breadcrumbModel =
session.getBreadcrumbModel();
        final List<EntityModel> entities = breadcrumbModel.getList();
        return entities.stream().map(x ->
x.getObject().getObject()).collect(Collectors.toList())
    }
}

HTH
Dan


On Mon, 1 May 2017 at 21:38 Hector Fabio Meza <he...@smartools.com.co>
wrote:

> Hi,
>
> I was wondering if there's a way to access the "recent objects" list that
> appears a a drop-down list in the lower part of the UI. I'd like to place
> actions on each screen that allows the user to go back to the screen they
> were before the current one (for example in a master-detail kind of
> situation).
>
> I suppose that list is related to the BookmarkService but couldn't find a
> method for retrieving the last visited object.
>
> Thank you.
>
>
> --
>
> *Hector Fabio Meza*
> *R&D Lead smartools*
> (57) 300 2254455 <%2857%29%20300%206815404>
> Skype: hectorf.meza
> www.smartools.com.co
>
>