How to discover pages where portlet appears? - websphere

I want to get programmatically all pages (or one) where portlet is presented on Webspehe portal. Actualy can't find any information about my issue.

The available SPI really was not designed to work back up the chain like this
you can go from layoutcontrol to portletwindow to portletdefinition to portlet
So the ugly way to do this would be to get the content model, loop over all page types, get the layout model for the page, then get the layout controls, from those get the portlet windows, and then go to portlet definition.
The shorter way is to iterate over a full xmlaccess and parse and build the list that way. I did write a whitepaper on how to get the layout controls on the page ftp://public.dhe.ibm.com/software/dw/lotus/Controller_Model_SPI_Final.pdf

Related

Programmatically get list of Portlets deployed in Liferay 7.2

I want to create a custom widgets tab where I want to display a list for available portlets. Is there any way to find out the list?
Thanks in advance.
I don't have an easy answer, but there should be enough information in source code for the MarketplaceAppManager portlet that is used in the Control Panel App Manager to list the apps (bundles).
I looked at the portlet code and I think a good starting place would be the JSPs for that portlet:
/modules/apps/marketplace/marketplace-app-manager-web/src/main/resources/META-INF/resources. Specifically view_modules.jsp seems to be what is responsible for rendering the list.
Looking at these would give you a good idea of what is involved with fetching and displaying them, and a hint at what the level of effort might be to emulate it.

CanJS multiple page app

The tutorials and example I've seen are all single page application.
Can anyone give an idea or point to a resource showing how a multiple page app can be developed with CanJS?
You should be able to create a new page in whatever app framework you are using or even just static pages, and then hookup your new control and view to any element on that new page.
You want to have a separate control for each module, so you might have separate controls even on a single page if you have, for example, a filterable dropdown list, a todo list, and a login. So, in your canjs directory for your app you will have separate sub-directories for each module which will contain your control, view/s, model/s, and observe/s and unit tests. This makes them re-usable, easier to test, and since they are modular if one part of your app breaks it won't take down all functionality. Once you get the hang of that incorporate AMD style loading of your assets with stealJS which is made by Bitovi - the CanJS creators.
https://github.com/bitovi/steal
If you want to manipulate the location.hash without actually changing pages or manaage browser history and client state you should check out can.route:
http://canjs.com/docs/can.route.html

When to use more than one Sammy.js application?

As I'm learning about Sammy.js I read that you can have several Sammy.js applications in the same page, each bound to a different element (i.e. div). I would like to understand why would this be useful.
I read in another post that only forms inside a bound element will trigger the route change, I'm thinking this could be used to modularize your application. Is there another use case beside this? Could you provide an example of how to modularize your application in this way?
We implemented a component similar to Sammy in our Silverlight application some time ago. The similarity is in that both represent a kind of a simple browser that can be bound to a UI region. The approach gave us several benefits:
We had an extensible way to add new content implementations. I mean that we could add plugins to our app that contained new forms/views which the application core had no knowledge about.
We could easily implement composite views, e.g. dashboard that were able to show any view implemented in any module. Including themselves. (A-ha, we had created recursive dashboards that worked until the app hit the memory limit. Kind of Inception. :))
Sammy can be used to reach these goals as well.
However, you must understand that from all Sammy applications running on a page, only one can be bound to the browser location bar. Others will have their location visible only to javascript, or you'll need to render location bars for them on the page.

displaying web pages over web views in collection view using cocoa bindings

I tried sample example given at this link - Collection View Programming Guide
It is simple and it worked. Considering it as a reference I tried a simple application which will show a collection view of web views with some web page displayed over each web view.
The model class has two properties: NSString *pageName, and NSURL *pageURL.
I then followed each and every step written in tutorial above with required modifications but I was caught in the step -
How to bind web view to collection
view item?
In binding tab it shows three possibilities : Editable, Hidden, Tool tip but none of these is working.
Can anyone suggest me way to accomplish my requirement?
Thanks,
Miraaj
WebView does not expose bindings for the URL (one would think it would, but it doesn't). You'll need to make use of NSCollectionViewItem (create a custom subclass) and update your WebView's URL when its represented object is changed.
The quick start guide you referenced does not show how to use a custom collection view item (it shows a very basic case). You'll need to delve a little deeper into the documentation (and online examples) to achieve your goal.
I would offer one thought to consider regarding your overall goal: WebView is a "heavy" object, so keep your performance expectations realistic regarding creating many of these views.

Best practice to manage the path breadcrumbs in Spring without Web flow

I am engaged in a project where I need to show path bread crumbs to the user like
Home (This is linked to home page) >> (page name)
and like
Home >> contacts
and in contacts like
Contacts >> create
Contacts >> edit
etc.
Is there a best practice how to do this in spring without he usage of spring web flow? I am not using spring web flow and simply using the spring MVC.
I'm not sure why you'd have to do this in Spring if you're not using Spring MVC.
Depending on the site's structure and the URL structure, you might want to parse the URL into something readable.
Another option is to have some sort of push/pop mechanism but since browsers have a back button which does not signal the server this is often a recipe for disaster.
I'm not sure there is any universal solution for breadcrumbs. Here are a few variants:
use the URL structure. With spring mvc this is actually a very good option, since it (since 2.5) replies a lot on nice, structured URLs
have each page (view) identify its own path in the breadcrumb (via a request parameter). It's not
place current steps in session. This would break if multiple tabs/windows are used, so you will have to use a windowId.. and essentially roll-out a "crippled" webflow.
This sort of breadcrumbs is sometimes called homeward path navigation.
If you can capture your site layout in XML then an XSL could be used to generate the breadcrumbs. The same XML site layout document could also be used to generate a side navigation menu.
See also: Separating breadcrumb (homeward path) navigation from content using XML/XSL.

Resources