Controle 2 liferay portlets using a link - jsf

I have two liferay portlets designed like this
--------------------- ---------
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
--------------------- ---------
I want to add a link using JSF primefaces in the portlet on the right side, if i click on it, this portlet is minimized, and it's space is taken by the portlet on the left side.
Any leads ?

You might want to start from Inter portlet Communication
I would suggest you use one portlet for this, and minimize using some of JavaScript tools
Also, check primefaces tree nodes and use ajax update to update the second panel.
As far as I know, there is no expanding and shrinking in portlets' world. if those portlets are tightly connected, you might want to consider merging them into one.

Thanks devBinnooh for your answer,
Actually you'r right, it's preferable to use only one portlet because using 2 of them will create a lot of problems (such us communication which i beleive it's not an easy task).
Concerning primefaces i've used the component p:layoutUnit with the property collapsible="true". and it works fine for me.

Related

What's the difference between p:menuitem's url and outcome attributes?

According to the Primefaces 6.2 user guide the attributes stand for
Name | Default | Type | Description
[...]
url | null | String | Url to be navigated when menuitem is clicked
[...]
outcome | null | String | Navigation case outcome
where "outcome" is a synonym of the description for url. I would like to avoid using them wrongly.
The answer is :
outcome refers to a JSF page in your application or a navigation rule defined in your faces-config.xml
url simply opens the given address, which could be on another website.
Using outcome is a great feature, because if the targeted JSF page does not exist, the link is not produced, so you will not have a 404 response when clicking on it.

Liferay URL problems

I am a little confused by Liferay's friendly URL mechanism and utility classes.
Can someone please explain this URL to me in detail?
http://127.0.0.1:8080/web/guest/home
^ ^ ^ ^ ^ ^
Prot. Hostname | | | Layout FriendlyURL
Port | Sitename
???
Part 4 web is a miracle to me and seems to be indicating if the site is staged, public or private?
The next question would be, which UtilClass to use to guarantee that a certain layout exists in that site.
You're right, the web part indicates the the site is public and for private pages ot would be group.
To check if a layout exists get the friendlyUrl of the layout use :
LayoutLocalServiceUtil.getFriendlyURLLayout(long groupId, boolean privateLayout, String friendlyURL)
If this doesn't suit you there are other methods in this class that may.
Liferay Doc: LayoutLocalServiceUtil

Modal RCP Dialog not modal

I'm having some trouble creating a modal Dialog in the e4 workbench.
There is a predefined dialog(org.eclipse.e4.ui.model.application.ui.basic.impl.DialogImpl),
but the problem is that I can't figure out how to make it modal.
Maybe you guys have some clue.
You can set the style for the dialog by using 'styleOverride' in the Persisted State for the dialog. The value of 'styleOverride' is the numeric value of the SWT flags you want to use.
For a application model dialog the style would normally be
SWT.TITLE | SWT.RESIZE | SWT.MAX | SWT.CLOSE | SWT.APPLICATION_MODAL
which has a numeric value of 66672 so you would set this in the persisted state data:
It may be easier to stick with the traditional JFace Dialog as the application model MDialog does not give you any support for buttons etc.

Setting Queue Item Title

I have a dialog workflow that creates an instance of a custom entity that is queue enabled. I then create a queue item and reference this instance but I want to set the Title of the Queue item so that it is descriptive in the default view. However when I go to set the Title field in the 'create' step, it is non-interactive. I can't click on it, edit it or do anything with it. I have made sure the title field is not read-only and I have compared all of the 'titles' field settings to another field (the queue item) and all the properties are the same between the two. Anyone have any idea why this is happening?
Because you can't modify the field. The title of a queueitem will be set through the referenced activity.
If you take a look at the queueitem metadata you will see that the attribute title is marked with
attribute | ... | IsValidForCreate | ... | IsValidForUpdate
title | ... | False | ... | False
This means that although you could technically edit and write this field, the system will not allow it and filter this information out.
So basically you would have to set the title of the referenced activity to a descriptive value.

How to have different secondary menus for groups of pages in Orchard CMS?

I've got to implement navigation using a main menu (easy) but then each menu will lead to a group of pages that have another "submenu" which I've implemented as a menu widget in the before content area.
The main navigation is something like this:
Home | First Group | Some page | Another page | Second Group | Yet another page
When the user clicks Home, Some page, Yet another page, it is taken directly to that page.
If the user clicks any of the "groups" it is taken to the "default page" for that group, and a submenu which is implemented as a menu widget is shown in the before content area. The first group can have 5 pages
Page 1.1 | Page 1.2 | Page 1.3 | Page 1.4 | etc.
The Second Group will have another set of pages.
I've naively set the path properties for the subpages so that they share a common path:
/group-1/page-1-1
/group-1/page-1-2
/group-2/page-1-3
etc.
/group-2/page-2-1
/group-2/page-3-1
etc.
I was expecting to use the Match Path to hide one widget menu in under one path or the other. But the problem is that I can't target a specific Menu or Widget, only content types in general, etc. I can't do something like this:
<Match Path="/group-1/*" ContentType="Widget SOME WAY TO TARGET A SPECIFIC WIDGET!!!">
<!-- SEND THE NEEDED PARTS TO OBLIVION SO THAT ONLY THE CORRECT MENU SHOWS HERE --!>
<Place Parts_Common_Body="-" />
</Match>
I believe that it would be much better to use a layer rule to target a specific path, but I just can't match a layer rule to something like url("/group-1/*"), so that's why I've tried to use the placement info which seems to be the wrong tool.
Is there a way I can extend the layer rules to work with regular expressions, for example? This way I can create really powerful layers and just layout my widgets on the proper layers.
In summary what I want is to have different submenus for different sections of the site. I'm just kind of lost on how to accomplish that, but layer rule seem to be the right tool, only if I could manage to use a little more powerful matching syntax.
I think I'm kind of blind!!!
Straight from the docs:
url("<url path>")
True if the current URL matches the specified path. If you add an asterisk (*) to the end of the path, all pages found in subfolders
under that path will evaluate to true (for example, url("~/home*")).
So adding this rule was enough to create a layer for an entire section of the site:
url("~/group-1*")
I'm almost ashamed of myself...

Resources