Writing the Guestbook Admin App
Step 1 of 5
Because the Guestbook and Guestbook Admin applications should be bundled
together, you’ll create the new application manually inside the
project, rather than by using a wizard. If you disagree with this design
decision, you can create a separate project for Guestbook Admin; the project
template you’d use is panel-app. For now, however, it’s better to go through
the process manually to learn how it all works:
com.liferay.docs.guestbook.portletpackage in the
guestbook-webproject and select New → Class.
Name the class
Click Browse next to the Superclass and search for
MVCPortlet. Click it and select OK.
You now have your Guestbook Admin application’s portlet class. For an administrative application, however, you need at least one more component.
As described in the product menu tutorial, there are three sections of the product menu as illustrated below.
Each section is called a panel category. A panel category can hold various menu items called panel apps. In the illustration above, the Sites menu is open to reveal its panel apps and categories (yes, you can nest them).
The most natural place for the Guestbook Admin portlet is in the Content panel category with Liferay DXP’s other content-based apps. This integrates it nicely in the spot where site administrators expect it to be. This also means you don’t have to create a new category for it: you can just create the panel entry, which is what you’ll do next. If you’d like to learn more about panel categories and apps after this, see the product menu tutorial and the control menu tutorial.
Follow these steps to create the panel entry for the Guestbook Admin portlet:
Add the dependency you need to extend Liferay DXP’s panel categories and apps. To do this, open
build.gradlefile and add this dependency:
compileOnly group: "com.liferay", name: "com.liferay.application.list.api", version: "2.0.0"
guestbook-weband select Gradle → Refresh Gradle Project.
guestbook-webproject and select New → Package. Name the package
com.liferay.docs.guestbook.application.listand click Finish.
Right-click your new package and select New → Class. Name the class
GuestbookAdminPanelApp. Click Browse next to Superclass, search for
BasePanelApp, select it, and click OK. Then click Finish.
Great! You’ve created the classes you need, and you’re ready to begin working on them.