Programmatically get list of Portlets deployed in Liferay 7.2 - osgi

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.

Related

XD Plugin API and Components

I am trying to write an XD plugin that dynamically populates an artboard with components, but I don't see any mention of components in the XD plugin API. Is it possible to look through the file and find available components and place them on stage? Better yet, maybe even pull a component from a specific file in the cloud?
Unfortunately, it isn't possible to create symbol instances (that's what components are called in the APIs), yet. Here is the explaining quote from the plugin docs:
It is not currently possible for plugins to create a new component definition or a new SymbolInstance node, aside from using commands.duplicate to clone existing SymbolInstances.
(https://adobexdplatform.com/plugin-docs/reference/scenegraph.html#symbolinstance)
There is a feature request open for it in the official plugin developer forums which you can vote for. According to Steve Kwak (Adobe), however, this seems to be problematic due to the edit context, meaning it may still take a while until we get API access to that.
There, unfortunately, also, as of yet, isn't any way to list the available symbols for a document. For the other asset types, this is possible via the assets module (cf. https://adobexdplatform.com/plugin-docs/reference/assets.html), but not (yet) for symbols.
I hope this helps (although it's probably not the answer you've hoped for).

How to discover pages where portlet appears?

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

Can a Dashboard widget use SQLite data?

I made an iOS app that has my favorite quotes in it by category. I wanted to turn this into a dashboard widget that notifies me of a quote of the day. I've never made a dashboard widget and only read the hello world example on apple site.
Can anyone suggest a good tutorial or help me understand the following:
What is the best way to take my SQLite database of quotes and make it available through a dashboard widget?
Thank you.
Dashboard is, like, really old... it has the look of a technology that's barely clinging to life support.
But if you want to fool around with it anyway, the way to access SQLite from a widget would be to implement a native widget plug-in that uses the SQLite library, exposing methods that your widget JavaScript code can call to fetch the info you need.
Or, as you seem to have done, repackage the data in a different form that you can access more conveniently from widget JavaScript.
I ended up using NerdTools and implemented an awk script to pull a random quote from a text file on my computer. So this was solved a different way.

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.

How can a value be passed directly from a windows application into a field in an open web page?

I have a problem that I feel is best implimented in a stand alone windows application, but needs to pass data to a web page that is already open.
Is it possible to pass the data directly to the web page?
If so, what is the best way to go about it?
(Its my first question, so go easy on me!)
This is not going to be an easy problem to solve, but I think it's possible by hosting the web-page in a browser embedded in a .NET application. This Code-Project article might help
Also this article talks a bit about accessing the DOM through a C# application.
Have you got any requirements on language? And can you add a bit more detail about exactly what you're trying to achieve?
EDIT 1: Watij is a web-application testing framework for Java. You can use it to fill in text-boxes, click buttons etc. I think it might fit your needs and, if it doesn't, it's open-source, so you might be able to hack it to work. There is a whole family of Wati* products - Watin for .NET, Watir for Ruby, etc.
Getting access to external web pages are not permitted due to security credentials.
But you can open and write to a web page via winInet APIs.
Please go through the article
http://www.informit.com/library/content.aspx?b=Visual_C_PlusPlus&seqNum=107

Resources