text;
stringlengths
5
32.6k
the word service can mean many specific things, but the general dictionary definition states that it's an act of helpful activity. whether it's an act of kindness from a friend or stranger or a service you pay for, in all instances, you have a need, and the service provides for that need data-driven applications by their nature need access to a service for storing in a well-designed application, the application asks for data, and the service fetches it. the application can then display this data to the user, who reads it or modifies it. application passes it back to the service, and the service stores it. application doesn't need to know anything about how the service does what it it trusts the service to handle storing and retrieving the data, freeing the application to be as robust as it needs to be this is what is called loose coupling, and it's a hallmark of good application if your application's service layer is self-contained, then you can swap it out for a better service layer when something more robust comes along, and you won't have to modify the application to take advantage of it well, something more robust has come along, and it's called service builder. using the object-relational mapping engine provided by hibernate along with a sophisticated code generator, service builder can help you implement your service layer in a fraction of the time it would normally take. just any ordinary service layer service builder also optionally helps you with remote services in multiple protocols, such as json and soap. do something really funky with the database, it gets out of your way and lets you use whatever sql queries you want we'll cover the following topics as you can see, there is a lot to cover, so let's start by describing service;;
"in order to demonstrate how to use service builder, let's create an example portlet project that nose-ster, a fictitious organization, can use to schedule for our example, we'll create a new liferay portlet project for managing and listing these events. we'll define two entities events and the event entity represents a social event that can be scheduled for nose-ster, while the location entity represents a location at which a social since an event must have a location, the event entity will reference a location entity as one of its attributes if you'd like to examine the finished example project, it's a part of our dev guide sdk which you can browse at note if you're looking for a fully-functional portlet application that can manage events, please use liferay's calendar portlet instead. described in this section is only intended to demonstrate how to use service the calendar portlet provides many more features than the simple example application described here. for information about the calendar portlet, please refer to the chapter on liferay's collaboration suite in portlets in our event listing portlet project the event listing portlet and the these portlets will allow users to add, edit, or remove events or locations, display lists of events or locations, search for particular events or locations, and view the details of individual events or figure 4.1 the event listing portlet lets you add and modify nose-ster social events. the portlet relies on its event and location entities and the service infrastructure that liferay service builder builds around them we'll start by creating the location listng portlet and event listing portlet in a new portlet plugin project called the event listing portlet project create the event listing portlet project in your liferay plugins sdk using liferay ide or developer studio, following the example in the creating new create the the location listng portlet and event listing portlet in the project you just created by following the example in the creating now that you've finished creating the example project and portlets, expand your project's docrootweb-infsrc folder and the notice that liferay ide created the we'll add some business logic to these portlet classes after using service builder to create a service layer for our event and location entities the first step in using service builder is to define your model classes and their attributes in a url file in your project's docrootweb-inf in service builder terminology, your model classes events and locations are called entities. we've kept the requirements for our event and location entities fairly simple. events should have the following attributes locations should have the following attributes service builder defines a single file called url for describing once you create the file, you can then define your entities. walk you through the whole process for the entities we've defined above, using liferay ide, which makes it easy. it'll only take seven steps to do it create the url file in your project's docrootweb-inf folder define global information for the service define the columns attributes for each service entity define relationships between entities define a default order for the entity instances to be retrieved from the define finder methods that retrieve objects from the database based on let's start creating our service by using liferay ide to create your to define a service for your portlet project, you must create a url the dtd document type declaration file specifies the format and requirements of the xml to use. url file manually, following the dtd, or you can use liferay ide. liferay ide helps you build the url file piece-by-piece, taking the guesswork out of creating xml that adheres to the dtd. use liferay ide to build the url file to create the url file using liferay ide, select your event-listing-portlet project in the package explorer and then select file url file in your docrootweb-infsrc folder and displays the file in liferay ide also provides a diagram mode and a source mode to give you different perspectives of the service information in your url file. diagram mode is helpful for creating and visualizing relationships between source mode brings up the url file's raw xml content you can switch between these modes as you wish. mode facilitates creating service elements, we'll use it while creating our let's start filling out the global information for our service a service's global information applies to all of its entities, so let's specify select the service builder node in the upper left corner of the overview mode of your url file. view now shows the service builder form in which we can enter our service's the fields include the service's package path, author, and here are the values we'll use for our example service the package path specifies the package in which the service and persistence the package path we defined above ensures that the service classes are generated in the url package under the docrootweb-infservice folder. generated in a package of that name under the docrootweb-infsrc folder. complete file paths for the service and persistence classes are refer to next section, generating the services, for a description of the service builder uses the service namespace in naming the database tables it enter event as the namespace for your example service builder uses the namespace in the following sql scripts it generates in your docrootweb-infsql folder liferay portal uses these scripts to create database tables for all the entities service builder prepends the namespace since our namespace value is event, the names of the database tables created for our entities start with event as their the namespace for each service builder project must be unique. plugins should use separate namespaces and should not use a namespace already used by liferay such as users or groups . liferay's database if you're wondering which namespaces are already in use as the last piece of global information, enter your name as the service's service builder adds annotations with the specified name to all of the generated java classes and interfaces. save your url file to preserve the information you added. add entities for your service's events and locations entities are the heart and soul of a service. entities represent the map between the model objects in java and the fields and tables in your database. entities are defined, service builder handles the mapping automatically, giving you a facility for taking java objects and persisting them. you'll create two entitiesone for events and one for locations here's a summary of the information we'll enter for the event entity and here's what we'll enter for the location entity to create these entities, select the entities node under the service builder node in the outline on the left side of the url editor in in the main part of the view, notice that the entities table is create an entity by clicking on the add entity icon a green plus sign enter event for your entity's name and select both the local service and the remote service options. named location and select the local service and the remote service figure 4.2 adding service entities is easy with liferay ide's overview mode of your url file an entity's name is used to name the database table for persisting instances the actual name of the database table is prefixed with the namespace; for our example, we'll have one database table named eventevent and another named eventlocation setting the local service attribute to true instructs service builder to generate local interfaces for our entity's service. the design of this portlet, however, dictates that we be able to call the service, and it resides in our portlet's.war file. portlet will be deployed to our liferay server. from our liferay server's point of view setting the remote service attribute to true instructs service builder to generate remote interfaces for the service. the default value for remote service we could build a fully-functional event listing application without generating remote services, so we could set local service to true and remote service to false for both of our entities. demonstrate how to use the web services that service builder generates for our entities, we'll set both local service and remote service to true tip suppose you have an existing dao service for an entity built using some you can set local service to false and remote service to true so that the methods of your remote -impl class can call the this enables your entity to integrate with liferay's permission-checking system and provides access to the web service apis this is a very handy, quite powerful, and often now that we've created our event and location entities, let's describe their each entity is described by its columns, which represent an entity's attributes. these attributes map on the one side to fields in a table and on the other side to attributes of a java object. to add attributes for the event entity, you need to drill down to its columns in the overview mode outline of the from the outline, expand the entities node and expand the table of the event entity's columns service builder creates a database field for each column we add to the it maps a database field type appropriate to the java type specified for each column, and it does this across all the databases liferay once service builder runs, it generates a hibernate configuration that handles the object-relational mapping. automatically generates accessor methods in the model class for these the column's name specifies the name used in the getters and setters that are created for the entity's java field. the column's type indicates the java type of this field for the entity. if a column's primary i.e., primary key attribute value is set to true, then the column becomes part of the an entity's primary key is a unique identifier for if only one column has primary set to true, then that column represents the entire primary key for the entity. however, it's possible to use multiple columns as the primary key for in this case, the combination of columns makes up a compound primary similar to the way you used the form table for adding entities, add attribute columns for the entities as follows create each attribute by clicking the add icon. attribute, select its type, and specify whether it is a primary key for the while your cursor is in a column's type field, an option icon click this icon to select the appropriate type for the column. column for each attribute of your event entity. columns for each attribute of your location entity in addition to columns for your entity's primary key and attributes, we recommend including columns for site id and portal instance id. portlet to support the multi-tenancy features of liferay, so that each portal instance and each site in a portal instance can have independent sets of portlet to hold the site's id, add a column called groupid of type long. hold the portal instance's id, add a column called companyid of type long. add both of these columns to your event and location entities lastly, add columns to help audit both of the event and location entities. a column named createdate of type date to note the date an entity instance and add a column named modifieddate of type date to track the last time an entity instance was modified our entities are set with the columns that not only represent their attributes, but also support multi-tenancy and entity auditing. specify the relationship between our event entity and location entity often you'll want to reference one type of entity in the context of another that is, you'll want to relate the entities. this in our example event listing portlet project as we mentioned earlier for the example, each event must have a location. therefore, each event entity must relate to a location entity. that liferay ide's diagram mode for url makes relating entities easy. first, select diagram mode for the url file. relationship option under connections in the palette on the right side of this relationship tool helps you draw relationships between entities click the event entity and move your cursor over the location liferay ide draws a dashed line from the event entity to the cursor. click the location entity to complete drawing the relationship. turns the dashed line into a solid line, with an arrow pointing to the location in diagram mode and look similar to that of the figure below figure 4.3 relating entities is a snap in liferay ide's diagram mode for url switch to source mode in the editor for your url file and note that liferay ide created a column element to hold the id of the location entity now that our entity columns are in place, let's specify the default order in which the entity instances are retrieved from the database often, you want to retrieve multiple instances of a given entity and list them liferay lets you specify the default order of the say you want to return event entities in order by date, earliest to latest, and you want to return location entities alphabetically by name. mode in the editor for your url file. under the event entity node in the outline on the left side of the view. displays a form for ordering the event entity. checkbox to show the form for specifying the ordering. clicking the add icon a green plus sign to the right of the table. date for the column name to use in ordering the event entity. browse icon to the right of the by field and choose the asc option. orders the event entity by ascending date. to specify ordering for location entity instances, follow similar steps but specify name as the column and the last thing do is define the finder methods for retrieving their instances finder methods retrieve entity objects from the database based on specified you'll probably want to create at least one finder method for each entity you create in your services. service builder generates several methods based on each finder you create for an entity. find, remove, and count entity instances based on the finder's parameters for our example, we want to find event and location entities per site. specify these finders using liferay ide's overview mode of url. the finders node under the event entity node in the outline on the left side the ide displays an empty finders table in the main part of the create a new finder by clicking the add icon a green plus sign to the name the finder groupid and enter collection as its we use the java camel-case naming convention in naming finders since the finder's name is used to name the methods service builder creates. ide creates a new groupid node under the finders node in the outline. specify the finder column for this group id node next under the new groupid node, the ide created a finder columns node. finder columns node to specify the columns for our finder's parameters. a new finder column by clicking the add icon a green plus sign and specifying groupid as the column's name. keep in mind that you can specify multiple parameters columns for a finder; this first example is kept simple. follow similar steps to create a finder to retrieve location entities by save the url file to preserve the finders you defined when you run service builder, it generates finder-related methods event and location entities in -persistence and -persistenceimpl classes. the first of these classes is the interface; the second is its implementation. the event and location entity's finder methods are generated in the -persistence classes found in your folder and the -persistenceimpl classes found in your you've created the example service and its event and location entities for the event listing portlet project we've made the source code for the service and the entire event listing portlet project available in the dev guide sdk which you can browse at we've also listed the url content here for your convenience. added some comments to highlight the service's various elements. that, your url file's contents should look similar to this now that you've specified the service for the event listing portlet project, let's build the service by running service builder.";;
to build a service from a url file, you can use liferay ide, liferay developer studio, or use a terminal window. service for the example event listing portlet project you've been developing portletsevent-listing-portlet folder of your plugins sdk note on windows, your liferay portal instance and your plugins sdk must be on the same drive in order to build services. instance is on your c drive, your plugins sdk must also be on your c drive in order for service builder to be able to run successfully using liferay ide or developer studio from the package explorer, open the url file from your event-listing-portletdocrootweb-inf folder. by default, the file opens up in the service builder editor. then click the build services button near the top-right the build services button has an image of a document with the numerical sequence 0101 in front of it make sure to click the build services button and not the build wsdd button building the wsdds won't hurt anything, but you'll generate files for the remote service instead of the local one. about wsdds web service deployment descriptors, please refer to the section on remote liferay services later in this chapter figure 4.4 the overview mode in the editor provides a nested outline which you can expand, a form for editing basic service builder attributes, and buttons for building services or building web service deployment descriptors after running service builder, the plugins sdk prints messages listing the generated files and a message stating build successful. using the terminal open a terminal window, navigate to your portletsevent-listing-project-portlet directory and enter this command when the service has been successfully generated, a build successful message appears in your terminal window. you should also see that a large number of files have been generated in your project. these files include a model layer, service layer, and persistence layer. don't worry about the number of generated filesdevelopers never have to customize more than three of them. the files service builder generated for your event entity after we add some custom service methods to eventlocalserviceimpl and call them from now let's add some local service methods to eventlocalserviceimpl and learn later in this chapter, we'll add some remote service methods to eventserviceimpl and learn how to call those, too.;;
the heart of your service is its -localserviceimpl class, where you put core business logic for working with your model. throughout this chapter, you've been constructing services for the nose-ster event listing example portlet project. start with your services by examining the initial service classes service note that service builder created an eventlocalservice class which is the interface for the local service. it contains the signatures of every method in eventlocalservicebaseimpl and eventlocalserviceimpl. eventlocalservicebaseimpl contains a few automatically generated methods providing common functionality. since the eventlocalservice class is generated, you should never modify it. if you do, your changes will be overwritten the next time you run service builder. should be placed in eventlocalserviceimpl add the following database interaction methods to the eventlocalserviceimpl remember to import the required classes. in order to add an event to the database, you need an id for the event. provides a counter service which you call to obtain a unique id for each new it's possible to use the increment method of liferay's counterlocalserviceutil class but service builder already makes a counterlocalservice instance available to eventlocalservicebaseimpl via spring by dependency injection. since your eventlocalserviceimpl class extends eventlocalservicebaseimpl, you can access this counterlocalservice instance. see eventlocalservicebaseimpl for a list of all the beans that spring makes these include the following beans it's a best practice to use the injected class's increment method rather than calling liferay's counterlocalservice's increment method since using the injected class does not require an extra database transaction. counterlocalserviceutil class, on the other hand, does require an extra we use the generated eventid as the id for the new event eventpersistence is one of the spring beans injected into eventlocalservicebaseimpl by service builder next, we set the attribute fields that we specified for the event. the name and description of the event. then we use the date and time values to lastly, we associate a location with the event then we assign values to the audit fields. first, we set the group, or scope, of in this case the group is the site. the company represents the portal instance. modifieddate of our event to the current time. generated addevent method of eventlocalservicebaseimpl with our event. lastly, we add the event as a resource so that we can apply permissions to it we'll cover the details of adding resources in chapter 12 before you can use any custom methods that you added to eventlocalserviceimpl class, you must add their signatures to the eventlocalservice interface by using developer studio as we did before, open your url file and make sure you are in the overview mode. using the terminal navigate to the root directory of your portlet in the service builder looks through eventlocalserviceimpl and automatically copies the signatures of each method into the interface. the database by invoking the static addevent method that service builder generated in the eventlocalserviceutil utility class. java classes, service builder also generates a url file which next, let's call our newly implemented local service.;;
once service builder has generated your portlet project's services, you can call them in our project's -portlet classes. you can call any methods in your eventlocalserviceutil or locationlocalserviceutil static utility classes from eventlistingportlet and locationlistingportlet. want the event listing portlet to perform create, read, update, and delete crud operations on events and the location listing portlet to perform crud to this end, you'll create the following methods for eventlistingportlet and similar ones for locationlistingportlet replace the contents of url with the following code the event listing portlet's addevent, updateevent, and deleteevent methods now call the appropriate methods from eventlocalserviceutil. paramutil getter methods such as getlong and getstring return default values like 0 or if the specified request parameter is not available from when adding a new event, for example, no event id is portlet's addevent method calls eventlocalserviceutil's addevent method. the event id for the new event is generated at the service layer in the addevent method that you added to the eventlocalserviceimpl class. eventlocalserviceutil generated for us by service builder contains various the methods listed in the figure below are all generated by service builder and can be called by eventlistingportlet figure 4.5 our eventlistingportlet class can access these methods of eventlocalserviceutil, many of which are crud operations portlet classes should have access only to the -localserviceutil classes. -localserviceutil classes, in turn, call their injected -localserviceimpl notice in the figure above that the eventlocalserviceutil utility class has a private instance variable called service. variable of type eventlocalservice gets an instance of of the eventlocalserviceutil utility class internally call corresponding methods of the eventlocalserviceimpl class at runtime we've demonstrated how to call the local services generated by service builder in our project's -portlet classes. next, let's learn how to how to call;;
do you want to transform the look and feel of your liferay portal? themes are hot deployable plugins unique to a site served by with themes, you can alter the user interface so completely that it's difficult or impossible to tell that the site is running on liferay liferay provides a well organized, modular structure to its themes. follow the same philosophy as liferay configuration they are modifications, or because of this, every line of markup and every style has a default value that your theme can fall back on if you have chosen in other words, your theme inherits the styling, images, and templates from any of the built-in themes. your themes smaller and less cluttered, because your theme contains only its own resources, using defaults for the rest, like emoticon graphics for the message in this chapter, you'll learn all about liferay themes liferay themes are easy to create. you can start by making changes only in the when you need to customize themes more extensively, you can change if you hope to become a theme customization guru, there are several technologies to follow the examples in this guide, you should be familiar with the command;;
"custom themes are created by layering your customizations on top of one of the structure of a theme separates different types of resources into easily here's the full structure of our deep blue theme the diffs folder that's created inside the docroot directory of your theme is important; this is where you place your theme's code. must mirror the parent theme's directory structure. the parts of your theme that differ from the parent theme, place only the folders and files you'll customize there the other folders inside docroot were copied over from the parent theme in your liferay bundle when you deployed your theme. for example, to customize the navigation, copy deep-blue-themedocrootdiffstemplates folder you may have to create this you can then open this file and customize it to your liking for custom styles, create a folder named css inside your diffs folder and place a single file there called url. this is where you'll define all because url is loaded last, styles defined here override any styles in the parent theme it's a best practice to add your styles only to the url file. keeps all of your changes in one place and makes future upgrades easier, because you won't have to manually modify your templates to add support for new liferay whenever you modify your theme in developer studio, redeploy it by right-clicking your theme located underneath your server, then selecting figure 5.3 how to redeploy your theme plugin alternatively, redeploy your theme by opening a terminal, navigating to themesdeep-blue-theme and entering the command wait a few seconds until the theme deploys, then refresh your browser to see would you rather see your changes immediately, rather than having to redeploy to let's talk about liferay developer mode to learn how.";;
"do you want to develop liferay resources without having to redeploy to see your are removed, so any changes you make are visible right away. have to reboot the server as often in developer mode before you use developer mode, you'll have to add the url file to your application server's configuration each application server has a different configuration file or ui to specify system properties; so you'll need to find out the specific method for let's demonstrate using the tomcat application server in your url file url in windows, find the catalinaopts variable and add the following to the list of options the following is an example of the catalinaopts variable lines with the external-properties option appended to the end all code must be on one line if you're already using the system property external-properties to load other properties files, add url to the list and use a comma to separate it from other entries note older versions of liferay 6.1 bundled with tomcat use the javaopts this caused some performance issues and was changed to if you have the javaopts variable line in your url or url file, change the variable line to catalinaopts to take full advantage of the performance upgrade. more information on this change can be how does developer mode let you see your changes more quickly? mode, there are several changes to the normal order of operations. key behaviors are listed below, along with the portal property override individual file loading of your styling and behaviors, combined with disabled caching for layout and freemarker templates, let's you see your changes now, when you modify your theme's url file directly in your liferay bundle, you can see your changes applied as you make them! any changes you make back into your diffs folder, or they'll be overwritten let's add a thumbnail image for our theme now.";;
the java ecosystem is known for providing a variety of options for almost any this is advantageous because you can find the tool that best fits your needs and the way you work. comfortable with a tool, you want to keep using it if you're a newcomer, the wide variety of tools available can be overwhelming. throughout this guide, we'll give you the best of both worlds showing you how to develop plugins in two environments that use open source technologies 1 a command-line environment that integrates with a wide variety of tools. easy-to-use ide that minimizes your learning curve while giving you powerful here are those two environments apache ant and the plugins sdk liferay provides a development environment called the plugins sdk that lets you develop plugins of all types by executing a set of predefined commands known as targets, in ant's nomenclature. can use the plugins sdk directly from the command-line and use file editors like emacs, vim, editplus, or even notepad. you can also integrate the plugins sdk with your favorite ide, since most ides provide support for apache ant. chapter describes how to use the plugins sdk eclipse and the liferay ide eclipse is the most popular and well known java ide and it provides a wide variety of features. for eclipse that extends its functionality to facilitate developing all types of liferay ide uses the plugins sdk underneath, but you don't need to know the sdk unless you're performing an advanced operation not directly to develop applications for liferay portal enterprise edition ee, use liferay developer studio which extends liferay ide, providing additional integration plugins such as the kaleo designer for java this guide shows you how to develop for liferay using both the plugins sdk and liferay ide, to benefit you and other developers even if you don't like ides or if you use eclipse, you may want to start reading about liferay ide in chapter 10 first and then go back to reading about the plugins what about if i don't like apache ant and i prefer to use maven? developers prefer other command-line alternatives to apache ant. popular of these alternatives is maven. to support developers that want to use maven we have mavenized liferay artifacts for referencing in your maven see chapter 9 for an in-depth look at developing plugins in maven what if i don't like eclipse and prefer to use netbeans, intellij idea or there are many ides available, and each one has its we built liferay ide on top of eclipse because it's the most popular we also want to make sure you can use the ide of your in fact, many core developers use netbeans and intellij idea. these ides have support for integration with apache ant, so you can use the additionally, there is an extension to netbeans called the portal pack that is explicitly designed for develop plugins for liferay. you can find more about the portal pack at that's it for the introduction. let's get started with real development work!;;
java developers use a wide variety of tools and development environments. liferay makes every effort to remain tool agnostic, so you can choose the tools to that end, we provide a plugins software development kit sdk based on apache ant that can be used along with any editor or integrated development environment ide. much of this guide uses the plugins sdk and a text editor, but use whatever tool you're most comfortable with. alternative to the plugins sdk, in chapter 10 we discuss liferay ide, a plugin for eclipse that simplifies development for liferay tip if you use eclipse and intend to use it from the very beginning, you might want to check out chapter 10 first before reading this chapter we discuss the following topics in this chapter setting up the plugins sdk is easy.;;
"the first thing you should do is install liferay portal. installed a liferay bundle, follow the instructions in the installation and chapter of using liferay portal. many people use the tomcat bundle for development, as it's small, fast, and takes up fewer resources than most other although you can use any application server supported by liferay portal for development, our examples use the tomcat bundle note in liferay developer studio, the sdk is already installed and ready to liferay portal enterprise edition ee comes with liferay developer studio download the plugins sdk from our web site at click the downloads link at the top of the page from the liferay portal 6.1 community edition section, select the unzip the archive to a folder of your choosing. systems have trouble running java applications from folders with names containing spaces, avoid using spaces when naming your folder on windows, to build a plugin's services see chapter 4 on service builder, the plugins sdk and liferay portal instance must be on the same drive. example, if your liferay portal instance is on your c drive, your plugins sdk must also be on your c drive in order for service builder to tip by default, liferay portal community edition comes bundled with many it's common to remove them to speed up the server start-up. navigate to the liferay-portal-versiontomcat-tomcat-versionwebapps directory and delete all its subdirectories except for root and tunnel-web now that you've installed the plugins sdk, let's configure apache ant for use in building projects in the plugins sdk requires that you install ant version 1.7 download the latest version of ant from now that ant is installed, set an anthome environment variable to your ant then put ant's bin directory e.g., anthomebin in we'll give you examples of doing this on linux unix or mac os x and on linux unix or mac os x, if your ant installation directory is javaapache-ant- and your shell is bash, set anthome and adjust your path by specifying the following in.bashprofile or from your terminal on windows, if your ant installation folder is cjavaapache-ant-, set your anthome and path environment variables appropriately in your system select start, then right-select computer properties in the advanced tab, click environment variables... in the system variables section, click new... also in the system variables section, select your path variable and click insert anthomebin; after javahomebin; and click ok click ok to close all system property windows open a new command prompt for your new environment variables to take affect to verify ant is in your path, execute ant -version from your terminal to make sure your output looks similar to this if the version information doesn't display, make sure your ant installation is now that ant is configured, let's set up your plugins sdk environment now we have the proper tools, but we need to configure the plugins sdk to deploy the plugins sdk contains a url file that contains the default settings about the location of your liferay installation and your deployment folder. you can use this file as a reference, but you shouldn't modify it directly in fact, you will see the message do not edit this file at the top if you open it. in order to override the default settings, create a new file named build.username.properties in the same folder, where username is your user id on your machine. user name is jbloggs, your file name would be url edit this file and add the following lines if you are using liferay portal bundled with tomcat 7.0.40 and your bundle is in your cliferay-portal-6.1.30-ee-ga3 folder, you'd specify the since we're using the tomcat app server, we specified tomcat as our app server type and we specified the url property. sdk's url for the name of the app server property that matches next, let's consider the structure of the plugins sdk.";;
each folder in the plugins sdk contains scripts for creating new plugins of that here is the directory structure of the plugins sdk new plugins are placed in their own subdirectory of the appropriate plugin type. for instance, a new portlet called greeting-portlet would reside in there's an ant build file url in each of the plugins directories. are some ant targets you'll commonly use in developing your plugins next, let's consider some best practices for developing plugins using the sdk.;;
the plugins sdk can house all of your plugin projects enterprise-wide, or you can have separate plugins sdk projects for each plugin. an internal intranet using liferay with some custom portlets, you can keep those portlets and themes in their own plugins sdk project in your source code if you also have an external instance of liferay for your public internet web site, you can have a separate plugins sdk that also has those or, you can further separate your projects by having a different plugins sdk project for each portlet or theme project it's also possible to use use the plugins sdk as a simple cross-platform project create a plugin project using the plugins sdk and then copy the resulting project folder to your ide of choice. the ant scripts, but this process makes it possible to create plugins with the plugins sdk while conforming to the strict standards some organizations have for if you've read this far and aren't sure you want to develop your plugins using the plugins sdk, you also have the option to use maven as an alternative to developing plugins using the sdk, you can leverage the you'll be happy to know that we have archetypes to help you build various types of plugins including liferay portlets, themes, and layout templates to learn more about developing plugins using maven, see chapter 9.;;
now your plugins sdk is configured, you know the directory structure and available targets, and you've learned some best practices. next, in chapter 3, we'll start developing portlets!;;
in this chapter we'll create and deploy a simple portlet using the plugins sdk. it will allow a customized greeting to be saved in the portlet's preferences and then display it whenever the portlet is viewed. portlet's urls by adding a friendly url mapping you're free to use any framework you prefer to develop your portlets, including here we'll use the liferay mvcportlet framework, because it's simple, lightweight, and easy to understand you don't have to be a java developer to take advantage of liferay's built-in features such as user and organization management, page building and content an application developed using ruby or php can be deployed as a portlet using the plugins sdk, and it will run seamlessly inside of liferay. examples, check out the liferay-plugins repository from we'll discuss the following topics as we learn about developing portlets for first, let's create the portlet that we'll use throughout this chapter.;;
"portlet creation using the plugins sdk is simple. inside the plugins sdk folder, where your portlet projects reside. thing to do is give your portlet a project name without spaces and a display for the greeting portlet, the project name is my-greeting, and the portlet title is my greeting once you've named your portlet, you're ready to begin creating the project. there are several different ways to create this portlet. liferay developer studio first, then by using the terminal go to file new liferay project fill in the project name and display name with my-greeting-portlet and leave the use default location checkbox checked. default location is set to your current workspace. where your plugin project is saved in your file system, uncheck the box and figure 3.1 creating portlet projects with liferay ide is easy select the ant liferay-plugins-sdk option for your build type. you'd like to use maven for your build type, navigate to the using liferay your configured sdk and liferay runtime should already be selected. haven't yet pointed liferay ide to a plugins sdk, click configure sdks to open the installed plugin sdks management wizard. new server runtime environment wizard if you need to set up your runtime server; just click the new liferay runtime button next to the liferay select portlet as your plugin type in the next window, make sure that the liferay mvc framework is selected with developer studio, you can create a new plugin project or if you already have a project, create a new plugin in an existing project. using the terminal navigate to the portlets directory in the terminal and enter the appropriate command for your operating system you should get a build successful message from ant, and there will now be a new folder inside of the portlets folder in your plugins sdk. this is where you will be implementing your own notice that the plugins sdk automatically appends -portlet to the project name when creating this folder alternatively, if you will not be using the plugins sdk to house your portlet projects, you can copy your newly created portlet project into your ide of if you do this, you will need to make sure the project references some.jar files from your liferay installation, or you may since the ant scripts in the plugins sdk do this for you automatically, you don't get these errors when working with the plugins sdk to resolve the dependencies for portlet projects, see the classpath entries in the url file in the plugins sdk project. the url and url entries, which.jar files are necessary to build your newly created portlet project. configuration, and we encourage you to keep your projects in the plugins sdk tip if you are using a source control system such as subversion, cvs, mercurial, git, etc., this might be a good moment to do an initial check-in of after building the plugin for deployment, several additional files will be generated that should not be handled by the source control system liferay provides a mechanism called auto-deploy that makes deploying portlets and any other plugin types a breeze. all you need to do is drop the plugin's war file into the deploy directory, and the portal makes the necessary changes specific to liferay and then deploys the plugin to the application server. is a method of deployment used throughout this guide note liferay supports a wide variety of application servers. tomcat and jboss, provide a simple way to deploy web applications by just copying a file into a folder and liferay's auto-deploy mechanism takes advantage you should be aware though, that some application servers, such as websphere or weblogic, require the use of specific tools to deploy web applications; liferay's auto-deploy process won't work for them deploying in developer studio drag your portlet project onto your that your plugin was read, registered and is now available for use if at any time you need to redeploy your portlet while in developer studio, right-click your portlet located underneath your server and select redeploy deploying in the terminal open a terminal window in your portletsmy-greeting-portlet directory and enter a build successful message indicates your portlet is now being deployed. switch to the terminal window running liferay, within a few seconds you should see the message 1 portlet for my-greeting-portlet is available for use. in your web browser, log in to the portal as explained earlier. add at the top of the page and click on more. and then click add next to my greeting. figure 3.2 adding the my greeting portlet congratulations, you've just created your first portlet!";;
a portlet project is made up of at least three components when using liferay's plugins sdk, these files are stored in a standard directory the portlet we just created is fully functional and deployable to your liferay by default, new portlets use the mvcportlet framework, a light framework that hides part of the complexity of portlets and makes the most common operations the default mvcportlet project uses separate jsps for each portlet mode each of the registered portlet modes has a corresponding jsp with the for example,' url' is for edit mode and' url' the java source is stored in the docrootweb-infsrc folder the configuration files are stored in the docrootweb-inf folder. stored here include the standard jsr-286 portlet configuration file url, as well as three optional liferay-specific configuration files. the liferay-specific configuration files, while optional, are important if your portlets will be deployed on a liferay portal server. client side files are the.jsp,.css, and.js files that you write to implement your portlet's user interface. docroot folder, either in the root of the folder or in a folder structure that makes sense for your application. remember, with portlets you're only dealing with a portion of the html document that is getting returned to the browser. html code in your client side files must be free of global tags like additionally, namespace all css classes and element ids to prevent liferay provides two tools, a taglib and api methods, to generate a namespace for you if you're new to portlet development, this section will enhance your understanding of portlet configuration options in the plugins sdk, the portlet descriptor's default content looks like this shown using developer studio's portlet application configuration editor figure 3.3 portlet xml file of the my greeting portlet here's a basic summary of what each element represents portlet-name contains the portlet's canonical name. unique within the portlet application that is, within the portlet plugin. liferay portal, this is also referred to as the portlet id display-name contains a short name that's shown by the portal whenever this application needs to be identified. it's used by display-name elements. the display name need not be unique portlet-class contains the fully qualified name of the class that handles init-param contains a namevalue pair as an initialization parameter of expiration-cache indicates the time, in seconds, after which the portlet a value of -1 indicates that the output never expires supports contains the supported mime-type, and indicates the portlet modes supported for a specific content type. the concept of portlet modes is defined by the portlet specification. modes are used to separate certain views the portal is aware of the portlet modes and provides generic ways to navigate between them for example, using links in the box surrounding the portlet when it's added to a page, so they're useful for operations that are common to all or most portlets. is to create an edit screen where each user can specify personal preferences all portlets must support the view mode portlet-info defines information that can be used for the portlet title-bar and for the portal's categorization of the portlet. defines a few resource elements that can be used for these purposes title, you can either include resource elements directly in a portlet-info element or you can place them in resource specifying the information directly into the portlet-info element in your for example, to you could specify a weather portlet's information, like this alternatively, you can specify this same information as resources in a for example, you could create file url, in your portlet project, to specify your portlet's title, short title, and keywords to use the resource bundle, you'd reference it in your url file, in your portlet element just before your portlet-info element as a best practice, if you're not planning on supporting localized title, short title, and keywords values for your portlet, simply specify them within the element in your url file. if you're ready to provide localized values, use a resource bundle for note you should not specify values for a portlet's title, short title, and keywords in both a portlet's element in url but if by accident you do, the values in the resource bundle take precedence over the values in the specifying localized values for your portlet's title, short title, and keywords in resource bundles is easy. for example, if you're supporting german and english locales, you'd create url and url files, respectively, in your portlet's this is the same directory as your german and english resource bundles may look like the following you'd reference your default bundle and these localized bundles in your if you're mavenizing your portlet, make sure to copy your content folder for more information, see the jsr-286 portlet specification, at security-role-ref contains the declaration of a security role reference in the code of the web application. specifically in liferay, the role-name references which roles can access the portlet url in addition to the standard url options, there are optional liferay-specific enhancements for java standard portlets that are installed on a liferay portal server. plugins sdk sets the contents of this descriptor, as shown in developer studio figure 3.4 liferay-portlet xml file of the my greeting portlet here's a basic summary of what some of the elements represent there are many more elements that you should be aware of for more advanced they're all listed in the dtd for this file, which is found in the definitions folder in the liferay portal source code.;;
"let's make our portlet do something useful. first, we'll give it two pages the mvcportlet class handles the rendering of our jsps, so for this example, we won't write a single java class first, since we don't want multiple greetings on the same page, let's make the portlet element already has an instanceable element, change its value from if you don't already have an instanceable element for your now we'll create our jsp templates. start by editing url, found in your replace its current contents with the following next, create url in the same directory as url, with the following deploy the portlet again in developer studio or by entering the command ant deploy in your my-greeting-portlet folder. go back to your web browser and refresh the page; you should now be able to use the portlet to save and display figure 3.5 the view page of my greeting portlet figure 3.6 the edit page of my greeting portlet tip if your portlet deployed successfully, but you don't see any changes in your browser after refreshing the page, tomcat may have failed to rebuild your to fix this, delete the work folder in liferay-portal-versiontomcat-tomcat-version and refresh the page again to there are a few important details to note concerning this implementation. the links between pages are created using the tag, which is defined by the url tag library. only one parameter named mvcpath. this is used by mvcportlet to determine which jsp to render for each request. always use taglibs to generate urls to your portlet, because the portlet doesn't own the whole page, only a fragment of the url must always go to the portal responsible for rendering, and this applies to your portlet and any others that the user might put in the page. portal will be able to interpret the taglib and create a url with enough information to render the whole page second, notice that the form in url has the prefix aui, signifying that it's part of the alloy ui tag library. alloy greatly simplifies the code required to create attractive and accessible forms by providing tags that render both the label and the field at once. you can also use regular html or any other taglibs to create forms based on your own preferences another jsp tag you may have noticed is. specification defined this tag in order to be able to insert a set of implicit variables into the jsp that are useful for portlet developers, including renderrequest, portletconfig, portletpreferences, etc. note that the processaction, processevent, render, and serveresource. defined by the tag are only available to a jsp if the jsp was included during the appropriate phase of the portlet lifecycle. tag makes the following portlet objects available to a the variables made available by the tag reference are the same portlet api objects that are stored in the request object of the jsp. for more information about these objects, please refer to the liferay's portlet 2.0 javadocs at a warning about our newly created portlet for the purpose of making our example easy to follow, we cheated a little bit. doesn't allow setting preferences from a jsp, because they are executed in what there are good reasons for this restriction, and they're explained in the next section.";;
"our portlet needs two execution phases, the action phase and the render phase. multiple execution phases can be confusing to developers used to regular servlet development or used to other environments such as php, python or ruby. once you're acquainted with them, you'll find the action and render phase to be let's talk about why they're necessary before defining each our portlet doesn't own the entire html page, but shares the page with other portlets and the portal itself. the portal generates the page by invoking one or more portlets and adding some additional html around them. an action within a portlet, each of the page's portlets are rendered anew. the portal can't just allow each portlet to repeat its last invocation, and the pretend we have a page with two portlets a navigation portlet and a shopping here's what would happen to a user if portals didn't have two execution first, the user would navigate to an item she wants to buy, and eventually submit the order, charging an amount on her credit card. operation, the portal would also invoke the navigation portlet with its next, say the user clicks a link in the navigation portlet. an http requestresponse cycle, and causes the content of the portlet to but all the parameters are preserved during that cycle, including the ones from the shopping cart! since the portal must also show the content of the shopping portlet, it repeats the last action the one in which the user clicked a button, which causes a new charge on the credit card and the start of a new shipping process! because the portal cannot know at runtime which portlets a obviously, when writing a standard web application, developers can take design it so that certain urls perform actions, and certain since an end user of a portal can add any portlet to a page, the portal must separate actions from a simple re-draw or obviously, we'd like to avoid the situation described in step 2 above, but without the two phases, the portal wouldn't know whether the last operation on a it would have no option but to repeat the last action over and over to obtain the content of the portlet at least until the credit fortunately, that's not how portals work. to prevent situations like the one described above, the portlet specification defines two phases for every request of a portlet, allowing the portal to differentiate when an action is being performed and should not be repeated and when the content is being produced in our example so far, we've used a portlet class called mvcportlet. all the portlet needs if it only has a render phase. custom code that's executed in the action phase and thus is not executed when the portlet is shown again you must create a subclass of mvcportlet or create a subclass of genericportlet directly if you don't want to use liferay's lightweight framework our example above could be enhanced by creating the following class create the above class, and its package, in the directory docrootweb-infsrc the file url must also be changed so that it points to your new class finally, make a minor change in the url file, changing the url to which the form is sent in order to let the portal know to execute the action phase. there are three types of urls that can be generated by a portlet let's change the url file to use an actionurl, using the jsp tag of we'll also remove the previous code that was saving the overwrite the url file contents with the following deploy the portlet again after making these changes; everything should work unless you paid close attention, you may have missed something the portlet no longer shows a message to the user that the preference has been saved after she clicks the save button. information must pass from the action phase to the render phase, so that the jsp knows that the preference has just been saved and can show a message to the";;
welcome to the developer's guide, liferay's official guide for developers. you're interested in developing applications on liferay portal or customizing this guide assumes you already know what a portal is and how to use liferay from an end-user perspective. don't, please read the what is a this chapter summarizes how to to develop applications for liferay and how to customize liferay's built-in applications, themes, and settings. develop liferay plugins to encapsulate these applications and customizations. finally, we'll talk about technologies and tools available to use as you develop this chapter covers the following let's talk about developing applications for liferay.;;
"according to wikipedia a web application is an application that is accessed over a network such as the internet or an intranet. web application that can civilly coexist with other applications. applications leverage functionality provided by the portal platform to reduce development time and deliver a more consistent experience to end users as a developer wanting to run your own applications on top of liferay portal, you probably want to know what's the best and quickest way to do it? supports two main, standards-based technologies for incorporating your applications into liferay portlets and opensocial gadgets portlets are small web applications written in java that run in a portion of a the heart of any portal implementation is its portlets, because they contain the actual functionality. the portlet container just aggregates the set of portlets to appear on each page since they're entirely self-contained, portlets are the least invasive mechanism for extending liferay, and are also the most forward compatible development they are hot-deployed as plugins into liferay instances, resulting in a single plugin can contain multiple portlets, allowing you to split up your functionality into several smaller pieces that can be arranged portlets can be written using any of the java web frameworks that support portlet development, including liferay's specific frameworks mvc portlet and alloy portlet. portlets can be used to build complex applications since they can leverage the full suite of technologies and libraries for the java platform opensocial gadgets are usually small applications, written using browser-side technologies such as html and javascript. provide a standard way to develop applications for a portal environment. technology perspective, one key difference is that they don't mandate a specific back-end technology, such as java ee, php, ruby, python, etc. another difference is that they have been designed specifically to implement social applications, while portlets were designed for any type of application. opensocial gadgets not only provide a set of technologies to develop and run applications, but also a set of apis that allow the application to obtain information from the social environment such as information about a user's profile, his activities, and his friends an opensocial gadget is deployed in liferay as one of the following types once you've saved your new gadget, it appears as an application that administrators can add to their site's pages liferay lets you expose portlets to the outsde world as opensocial gadgets. is, you can develop a portlet and then let anyone with access to your portlet add it as a remote gadget to pages on other portals or social networks what if you already have an existing application that has not been implemented as a portlet or opensocial gadget? you have many options, including there are many more options, each with its own merits. of the scope of this guide; however, the above options are worth considering next let's consider some of the technology frameworks liferay supports liferay, as a platform, strives to provide compatibility with any java technology you may want to use to develop your applications. portlet and java ee specifications, each portlet application can use its own set of libraries and technologies, whether they are used by liferay or not. section refers mainly to portlet plugins; other plugin types are more for example, ext plugins can only use libraries that are compatible with the ones used by the core liferay code since the choice of available frameworks and technologies is very broad, choosing the appropriate one can be daunting. we'll provide some advice to help you choose the best frameworks for your needs, summarized as follows use what you know if you already know a framework, that can be your adapt to your real needs component-based frameworks, such as javaservertm faces jsf, vaadin, and google web toolkit gwt, are especially good for desktop-like applications. when in doubt, pick the simpler solution portlet applications are often more simple to implement than standalone web applications. doubt, use the simpler framework e.g., liferay's mvc portlet or alloy some of the frameworks mentioned above include their own javascript code to provide a high degree of interaction. that is the case with gwt, vaadin, and jsf implementations e.g. icefaces or rich faces. your own javascript code and leverage one of the javascript libraries available. you can use any javascript library with liferay, including jquery, dojo, yui, sencha previously known as extjs, and sproutcore since version 6, however, liferay has its own library called alloy ui which is alloy ui has a large set of components specifically designed for liferay's core portlets make use alloy ui. alloy ui for your custom portlets or use another javascript library, as long as the library does not conflict with libraries referenced by other portlets liferay's service builder automates creating interfaces and classes for database persistence and service layers. it generates most of the common code that implements database access, letting you focus on higher level aspects of you implement the local interface with your business logic, and the remote interface with your permission checks. instance interact with the local interface, while objects outside interact with the remote interface via json, soap, and java rmi in addition to those mentioned above, there are thousands more frameworks and libraries available to you for handling persistence, caching, connections to remote services, and much more. liferay does not impose specific requirements on the use of any of those frameworks. you, the portal developer, choose the best";;
"liferay provides many out-of-the-box features, including a fully featured content management system, a social collaboration suite, and several for most installations, these features are exactly what you need; but sometimes you'll want to extend these features or customize their liferay is designed to be customized. multiple plugins and plugin types can be combined into a single war file. let's take a look at these plugin types and how themes let you dictate your site's look and feel. you'll apply styling for ui elements such as fonts, links, navigation elements, page headers, and page footers, using a combination of css and velocity or freemarker templates. framework, you use a consistent interface to common ui elements that make up this makes it easy to create sites that respond well to the window widths of your users' desktop, tablet, and mobile devices. themes let you focus on designing your site's ui, while leaving its layouts are similar to themes, except they specify the arrangement of portlets on a page rather than their look and feel. templates to arrange portlets just the way you like them. like themes, layout templates are also written in velocity and are hot-deployable hook plugins are how you customize the core functionality of liferay at many hook plugins are used to modify portal properties or to perform custom actions on startup, shutdown, login, logout, session creation, and session destruction. replace any of the core liferay services with a custom implementation. plugins can also replace the jsp templates used by any of the default portlets. best of all, hooks are hot-deployable plugins just like portlets ext plugins provide the largest degree of flexibility in modifying the liferay core, allowing you to replace essentially any class with a custom however, it is highly unlikely that an ext plugin written for one version of liferay will continue to work in the next version without for this reason, ext plugins are only recommended for cases in which an advanced customization is truly necessary, and there is no alternative. make sure you are familiar with the liferay core so your ext plugin doesn't even though ext plugins are deployed as plugins, the server must be restarted for their customizations to take note if you have developed for liferay 5.2 or prior releases, you may be familiar with what was known as the extension environment. introduced in liferay 6.0 to replace the extension environment in order to for instructions on converting an existing extension environment into a plugin, see the section on migrating old extension now that you're familiar with the best options for developing applications on liferay and customizing liferay, let's consider some of the tools you'll be";;
the configuration reference page gives you shortcuts to liferay configuration from here, you can easily check liferay definitions and configuration defaults as you customize your portal describes the configuration defaults for liferay portal describes the system configuration defaults for liferay portal.;;
ddl form screenlet can be used to show a collection of fields so that a user can initial or existing values may be shown in the fields. fields of the following data types are supported ddl form screenlet also supports the following features there are also a few limitations you should be aware of when using ddl form screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods the default theme uses a standard uitableview to show a scrollable list of other themes may use a different component, such as uicollectionview figure 1 ddl form screenlet using the default default theme a theme needs to define a cell view for each field type. file ddlfielddatetablecelldefault is used to render date fields in the if you want a specific field to have a unique appearance, you can customize your field's display by using the following filename pattern, where xxx is your field's name ddlcustomfieldxxxtablecelldefault. you a subscriber? field in screenshot above shows how text fields appear in the if you want to customize this, you don't need to create an entire you just need to create an xib file for the field subscribername. filename is therefore ddlcustomfieldsubscribernametablecelldefault. careful to keep the same components and iboutlet defined in the custom file before using ddl form screenlet, you should make sure that dynamic data lists and data types are configured properly in the portal. sections of the user guide for more details. if workflow is required, it must section of the user guide for details to use ddl form screenlet to add new records, you must grant the add record permission in the dynamic data list in the portal. screenlet to view or edit record values, you must also grant the view and update the add record, view, and update permissions are highlighted by the red boxes in the following screenshot figure 2 the permissions for adding, viewing, and editing ddl records also, if your form includes at least one documents and media field, you must grant permissions in the target repository and folder. repositoryid and folderid attributes below figure 3 the permission for adding a document to a documents and media folder for more details, please see the user guide sections this screenlet supports offline mode so it can function without a network for more information on how offline mode works, see the when loading the form or record, the screenlet supports the following offline when editing the record, the screenlet supports the following offline mode ddl form screenlet delegates some events to an object that conforms with the this protocol lets you implement the - screenletonformloaded called when the form is loaded. parameter record contains only field definitions - screenletonformloaderror called when an error occurs while loading the the nserror object describes the error - screenletonrecordloaded called when a form with values loads. second parameter record contains field definitions and values. onformloadresult is called before onrecordloaded - screenletonrecordloaderror called when an error occurs while loading a - screenletonformsubmitted called when the form values are successfully - screenletonformsubmiterror called when an error occurs while submitting - screenletondocumentfielduploadstarted called when the upload of a documents and media field begins - screenletondocumentfielduploadedbytestotalbytes called when a block of bytes in a documents and media field is uploaded. to track progress of the uploads - screenletondocumentfielduploadresult called when a documents and media - screenletondocumentfielduploaderror called when an error occurs in the documents and media upload process. the nserror object describes the error.;;
the user portrait screenlet shows the user's portrait from liferay portal. the user doesn't have a portrait configured, a placeholder image is shown screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods this screenlet supports offline mode so it can function without a network for more information on how offline mode works, see the when loading the portrait, the screenlet supports the following offline mode when editing the portrait, the screenlet supports the following offline mode the user portrait screenlet delegates some events to an object that conforms to the userportraitscreenletdelegate protocol. this protocol lets you implement - screenletonuserportraitresponseimage called when an image is received you can then apply image filters grayscale, for example and you can return the original image supplied as the argument if you don't want to modify it - screenletonuserportraiterror called when an error occurs in the the nserror object describes the error - screenletonuserportraituploaded called when a new portrait is uploaded you receive the user attributes as a parameter - screenletonuserportraituploaderror called when an error occurs in the the nserror object describes the error.;;
the forgot password screenlet sends emails to registered users with their new passwords or password reset links, depending on the server configuration. the available authentication methods are screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods to use the forgot password screenlet, you must allow users to request new the next sections show you how to do this note that the authentication method configured in the portal can be different from the one used by this screenlet. for example, it's perfectly fine to use screenname for sign in authentication, but allow users to recover their password using the email authentication method password recovery depends on the authentication settings in the portal if both of these options are unchecked, password recovery is disabled. options are checked, an email containing a password reset link is sent when a if only the first option is checked, an email containing a new password is sent when a user requests it for more details on authentication in liferay portal, please refer to the an anonymous request can be made without the user being logged in. authentication is needed to call the api. to allow this operation, the portal administrator should create a specific user with minimal permissions this screenlet doesn't support offline mode. it requires network connectivity the forgot password screenlet delegates some events to an object that conforms to the forgotpasswordscreenletdelegate protocol. implement the following methods - screenletonforgotpasswordsent called when a password reset email is the boolean parameter indicates whether the email contains the new password or a password reset link - screenletonforgotpassworderror called when an error occurs in the the nserror object describes the error.;;
the sign up screenlet creates a new user in your liferay instance a new user of your app can become a new user in your portal. you can also use this screenlet to save the credentials of the new user in their keychain. the screenlet also supports navigation of form fields from the keyboard of the user's device screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods the configuration related to the sign up screenlet can be set in the control panel by clicking portal settings and then authentication for more details, please refer to the configuring portal settings anonymous requests are unauthenticated requests. to allow this operation, the portal administrator should create a specific user with minimal permissions this screenlet doesn't support offline mode. it requires network connectivity the sign up screenlet delegates some events to an object that conforms to the if the autologin attribute is enabled, login events are delegated to an object conforming to the refer to the loginscreenlet documentation the signupscreenletdelegate protocol lets you implement the following methods - screenletonsignupresponseuserattributes called when sign up the user attributes are passed as a dictionary of keys string or nsstrings and values anyobject or nsobject . supported keys are the same as liferay portal's user entity - screenletonsignuperror called when an error occurs in the process. nserror object describes the error.;;
the login screenlet authenticates portal users in your ios app. authentication methods are supported basic uses user login and password according to http basic access authentication specification. depending on the authentication method used by your liferay instance, you need to provide the user's email address, screen name, or user id. cookie uses a cookie to log in. this lets you access documents and images in the portal's document library without the guest view permission in the the other authentication types require this permission to access such for instructions on configuring the screenlet to use these authentication types, when a user successfully authenticates, their attributes are retrieved for use you can use the sessioncontext class to get the current user's note that user credentials and attributes can be stored securely in the keychain see the savecredentials attribute. stored user credentials can be used to automatically log the user in to subsequent sessions. screenlets in liferay screens call the portal's json web services. screenlet calls the following services and methods for instructions on using themes, before using login screenlet, you should make sure your portal is configured with the authentication option you want to use. you can set this in the control panel by selecting for more details, please refer to the to use oauth authentication, first install the oauth provider app from the once it's installed, go to control panel users oauth admin, and add a new application to be used from liferay screens. when the application exists, copy the consumer key and consumer secret values for later use in login screenlet this screenlet doesn't support offline mode. it requires network connectivity. if you need to log in users automatically, even when there's no network connection, you can use the savecredentials attribute together with the the login screenlet delegates some events to an object that conforms to the this protocol lets you implement the - screenletonloginresponseuserattributes called when login successfully the user attributes are passed as a dictionary of keys string or nsstrings and values anyobject or nsobject . the same as the portal's user entity - screenletonloginerror called when an error occurs during login. nserror object describes the error - screenletoncredentialssaveduserattributes called when the user credentials are stored after a successful login - screenletoncredentialsloadeduserattributes called when the user note that this only occurs when the screenlet is used and stored credentials are available when using a cookie to log in to the portal, the sessioncontext class has a for more information about how ios handles challenge-response authentication, see the article authentication challenges and tls chain validation the challenge resolver type is a closure or block that receives two parameters here's an example that sends a basic authorization in response to an;;
liferay screens for ios contains several screenlets that you can use in your ios this section contains the reference documentation for each. looking for instructions on using screens, see the the screens tutorials contain instructions on each screenlet reference document here lists the screenlet's features, compatibility, its module if any, available themes, attributes, delegate the available screenlets are listed here with links to their signs users in to a liferay instance registers new users in a liferay instance sends emails containing a new password or password reset link to users shows the user's portrait picture presents dynamic forms to be filled out by users and submitted back to the server shows a list of records based on a pre-existing ddl in a liferay instance shows a list of assets managed by this includes web content, blog entries, documents, and more shows the web content's html or structured content. shows a list of web contents from a folder, usually based on a pre-existing shows a list of images from a folder. this screenlet also lets users upload this screenlet also lets the user update or shows a list of comments for an asset shows a single comment for an asset lets the user comment on an asset currently, this screenlet can display documents and media library files dlfileentry entities, blogs articles blogsentry entities, and web content articles webcontent entities. shows a single image file from a liferay instance's documents and media shows a single video file from a liferay instance's documents and media shows a single audio file from a liferay instance's documents and media shows a single pdf file from a liferay instance's documents and media library shows a single file from a liferay instance's documents and media library. this screenlet to display file types not covered by the other display you can also customize the web page through injection of local and remote javascript and css files.;;
ddl form screenlet shows a set of fields that can be filled in by the user. initial or existing values can be shown in the fields. the ddl form screenlet also supports the following features there are also a few limitations that you should be aware of when using ddl form screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods the default view uses a standard vertical scrollview to show a scrollable list other views may use different components, such as viewpager or you can find a sample of this implementation in the ddlformscreenletpagerview class figure 1 ddl form screenlet's default left and material right views each field defines an editor type. you must define each editor type's layout by using the following attributes if you don't define the editor type's layout in ddl form screenlet's attributes, the default layout ddlfieldxxxdefault is used, where xxx is the name of it's important to note that you can change the layout used with if you want to have a unique appearance for one specific field, you can customize your field's editor view by calling the screenlet's setcustomfieldlayoutidfieldname, layoutid method, where the first parameter is the name of the field to customize and the second parameter is the layout to you can also create custom editor views. ddl form screenlet needs the following user permissions both are used by the documents and media fields to take a picturevideo and store it locally before uploading it to the portal. fields also need to override the onactivityresult method to receive the here's an example implementation before using ddl form screenlet, you should make sure that dynamic data lists and data types are configured properly in the portal. sections of the user guide for more details. if workflow is required, it must section of the user guide for details to use ddl form screenlet to add new records, you must grant the add record permission in the dynamic data list in the portal. screenlet to view or edit record values, you must also grant the view and update the add record, view, and update permissions are highlighted by the red boxes in the following screenshot figure 2 the permissions for adding, viewing, and editing ddl records also, if your form includes at least one documents and media field, you must grant permissions in the target repository and folder. repositoryid and folderid attributes below figure 3 the permission for adding a document to a documents and media folder for more details, see the user guide sections this screenlet supports offline mode so it can function without a network for more information on how offline mode works, see the when loading the form or record, the screenlet supports the following offline when editing the record, the screenlet supports the following offline mode ddl form screenlet delegates some events to an object that implements to the this interface lets you implement the following onddlformloadedrecord record called when the form definition successfully called when the form record data successfully loads onddlformrecordaddedrecord record called when the form record is onddlformrecordupdatedrecord record called when the form record data errorexception e, string useraction called when an error occurs in the for example, this method is called when an error occurs while loading a form definition or record, or adding or updating a record. variable distinguishes these events onddlformdocumentuploadeddocumentfield field called when a specified document field's upload completes onddlformdocumentuploadfaileddocumentfield field, exception e called when a specified document field's upload fails.;;
the user portrait screenlet shows the users' profile pictures. doesn't have a profile picture, a placeholder image is shown. allows the profile picture to be edited via the editable property screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods the user portrait screenlet needs the following user permissions this screenlet supports offline mode so it can function without a network for more information on how offline mode works, see the when loading the portrait, the screenlet supports the following offline mode when editing the portrait, the screenlet supports the following offline mode note that if you don't set any attributes, the screenlet loads the logged-in the user portrait screenlet delegates some events to an object that implements the userportraitlistener interface. this interface lets you implement the onuserportraitloadreceivedbitmap bitmap called when an image is received you can then apply image filters grayscale, for example and you can return null or the original image supplied as the argument if you don't want to modify it onuserportraituploaded called when the user portrait upload service errorexception e, string useraction called when an error occurs in the for example, an error can occur when receiving or uploading a user the useraction argument distinguishes the specific action in which;;
the forgot password screenlet sends an email to registered users with their new passwords or password reset links, depending on the server configuration. the available authentication methods are screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods to use forgot password screenlet, the portal must be configured to allow users the below sections show you how to do this. also, liferay screens' compatibility plugin the authentication method configured in the portal can be different from the one for example, it's perfectly fine to use screenname for sign in authentication, but allow users to recover their password using the password recovery depends on the authentication settings in the portal if these options are both unchecked, password recovery is disabled. options are checked, an email containing a password reset link is sent when a if only the first option is checked, an email containing a new password is sent when a user requests it for more details on authentication in liferay portal, please refer to the an anonymous request can be made without the user being logged in. authentication is needed to call the api. to allow this operation, the portal administrator should create a specific user with minimal permissions this screenlet doesn't support offline mode. it requires network connectivity the forgot password screenlet delegates some events to an object that implements the forgotpasswordlistener interface. this interface lets you implement the onforgotpasswordrequestsuccessboolean passwordsent called when a password reset email is successfully sent. email contains the new password or a password reset link onforgotpasswordrequestfailureexception e called when an error occurs in;;
the sign up screenlet creates a new user in your liferay instance a new user of your app can become a new user in your portal. you can also use this screenlet to save new users' credentials on their devices. the screenlet also supports navigation of form fields from the screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods sign up screenlet's corresponding configuration in the liferay instance can be set in the control panel by clicking portal settings and then for more details, refer to the configuring portal settings anonymous requests are unauthenticated requests. still required, however, to call the api. to allow this operation, the portal administrator should create a user with minimal permissions. sign up screenlet, you need to use that user in your layout. this screenlet doesn't support offline mode. it requires network connectivity the sign up screenlet delegates some events to an object that implements the this interface lets you implement the following onsignupsuccessuser user called when sign up successfully completes. user parameter contains a set of the created user's attributes. supported keys are the same as those in the portal's user entity onsignupfailureexception e called when an error occurs in the process.;;
this document presents a list of changes in liferay screens for android 2.0 that we try our best to minimize these disruptions, but sometimes they are unavoidable interactors now run in a background process, so you don't need to create or set this means you can write what appear to be synchronous server calls, and liferay screens handles the background threading the interactor's execute method makes the server call. start method in your screenlet class causes execute to run in a background note that you no longer have to handle the exception when making the server the screenlet framework does this for you and propagates any error via the also note that the screenletid is no longer required. framework automatically decorates the event with a screenletid that it this affects all screenlet interactors you must rewrite your interactors. for the most recent instructions on creating an interactor asynchronous calls can be difficult to develop and work with. for you, liferay screens removes this potential source of error and frees you to focus on other parts of your screenlet to use a view set, your app or activity's theme must also inherit that view for example, to use the default view set, your app or activity's this affects any apps or activities that use a view set without inheriting that for example, if you use the default view for a screenlet by setting the screenlet xml's layoutid attribute, your app or activity's theme must now inherit defaulttheme as well. likewise, your app or activity's theme must inherit westerostheme or materialtheme to use the westeros or change your app or activity's theme to inherit the styles of the view set you this code snippet from an app's url tells apptheme.noactionbar to inherit the default view set's styles this lets you change an android theme's colors and styles according to android before, the android themes were hardcoded inside the screenlets the screenlet attribute offlinepolicy is now cachepolicy this affects any screenlets that used the offlinepolicy attribute to set that screenlet's offline mode policy in the app layouts that contain the screenlet, change the offlinepolicy this change was made for consistency throughout liferay screens. class names in the offline mode apis contain cache, as do the offline policies the following error listener methods in ddl form screenlet's ddlformlistener also in ddlformlistener, the method onddlformrecordloaded now takes an additional parameter for the attribute map received from the server this affects any classes that implement ddlformlistener in place of the removed error listeners, use basecachelistener's generic error you must also change any onddlformrecordloaded implementations to account for the old error listener methods were usually implemented the same way by logging multiple error listener methods aren't needed for this. use the new error listener method to log the exception and take any other action that depends on the user action the cache listener methods loadingfromcache, retrievingonline, and storingtocache have been moved to their own listener, cachelistener. this change was introduced in liferay screens 1.4.0 all activity classes that implement a listener if you don't have special behavior in your old cache listener method implementations, you can remove them. otherwise, you must implement the new when implementing cachelistener in an activity or fragment, for example, you should also register a screenlet instance as the cache in the liferay screens test app, the activity userportraitactivity reacting to cache errors via the cache listener methods is a niche use case. because the old cache listener methods were part of the normal listener, developers were forced to implement them whether they needed them or not. putting them in their own listener makes their implementation optional the baselistlistener methods onlistpagefailed and onlistpagereceived no longer have the baselistscreenlet argument source. account for a page's start and end row instead of the page number this affects any classes or interfaces that extend or implement remove the baselistscreenlet argument from your onlistpagefailed and onlistpagereceived implementations. you must also replace the int page argument in onlistpagefailed with an int argument representing the page's likewise, replace the int page argument in onlistpagereceived with two int arguments that represent the page's start row and end row, the baselistscreenlet argument served to disambiguate two instances of the same screenlet in a single activity. forcing the argument on all baselistlistener implementations was unnecessary. if you still need this use case, create a screenlet instance and listener for each screenlet instead of relying on the baselistscreenlet argument in a the start row and end row change was made for consistency with other listeners that also use start row and end row arguments asset list screenlet's package is now url this affects any activities or fragments that use asset list screenlet this allows for other screenlets that work with assets, like asset display for example, the package url now contains asset list screenlet, asset display screenlet, and classes common to the getmodelvalues method for now returns a map instead of a hashmap this affects any code that expects getmodelvalues to return a hashmap change any code that uses getmodelvalues to expect a map instead of a this follows general java conventions private and protected fields in screenlets are no longer prefixed by this affects any code that directly accesses protected fields change your code to use the new variable name. directly accesses a protected screenlet variable named fields, change it to this follows general java naming conventions if you're using a screenlet without view like you might be if you need to log a user in programmatically, you no longer have to call url to initialize the library. this affects any apps that use a screenlet without a view remove your manual call to url this removes the possibility of an error if you forget to call url when using a screenlet without a view.;;
"the ddl list screenlet has the following features screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods the default view uses a standard recyclerview to show the scrollable list. other views may use a different component, such as viewpager or others, to ddls and data types should be configured in the portal before using for more details, see the liferay user guide sections also, liferay screens' compatibility plugin must be installed to allow remote calls without the userid this screenlet supports offline mode so it can function without a network for more information on how offline mode works, see the ddl list screenlet delegates some events to an object or a class that implements the baselistlistener interface. this interface lets you implement the following methods onlistpagefailedint startrow, exception e called when the server call to retrieve a page of items fails. this method's arguments include the exception generated when the server call fails called when the server call to retrieve a page of items succeeds. this method may be called more than once; once for each page received. startrow and endrow change for each page, a startrow of 0 corresponds to the first item on the first page onlistitemselectedrecord records, view view called when an item is this method's arguments include the selected list item errorexception e, string useraction called when an error occurs in the the useraction argument distinguishes the specific action in which";;
pdf display screenlet displays a pdf file from a liferay instance's documents screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods the default view uses android's pdfrenderer to display the pdf. pdfrenderer requires an android api level of 21 or higher figure 1 pdf display screenlet using the default view this screenlet supports offline mode so it can function without a network for more information on how offline mode works, see the here are the offline mode policies that you can use with this screenlet if you don't use entryid, you must use both of the following attributes because pdf files are assets, pdf display screenlet delegates its events to a class that implements assetdisplaylistener. this interface lets you implement onretrieveassetsuccessassetentry assetentry called when the screenlet successfully loads the pdf file errorexception e, string useraction called when an error occurs in the the useraction argument distinguishes the specific action in which;;
blogs entry display screenlet displays a single blog entry. screenlet renders any header image the blogs entry may have screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods the default view uses different components to show a blogs entry blogsentry . for example, it uses an android textview to show the blog's text, and to show the profile picture of the liferay user who posted it. figure 1 blogs entry display screenlet using the default view this screenlet supports offline mode so it can function without a network for more information on how offline mode works, see the here are the offline mode policies that you can use with this screenlet if you don't use entryid, you must use both of the following attributes because a blog entry is an asset, blogs entry display screenlet delegates its events to a class that implements assetdisplaylistener. you implement the following method onretrieveassetsuccessassetentry assetentry called when the screenlet successfully loads the blog entry errorexception e, string useraction called when an error occurs in the the useraction argument distinguishes the specific action in which;;
asset display screenlet can display an asset from a liferay instance. screenlet can currently display documents and media files dlfileentry images, videos, audio files, and pdfs, blogs entries blogsentry and web content asset display screenlet can also display your custom asset types. the listener section of this document screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods figure 1 asset display screenlet using the default view the default view uses different ui elements to show each asset type. example, it displays images with imageview and blogs with textview. that other views may use different ui elements this screenlet can also render other screenlets as inner screenlets these screenlets can also be used alone without asset display screenlet this screenlet supports offline mode so it can function without a network for more information on how offline mode works, see the here are the offline mode policies that you can use with this screenlet instead of entryid, you can use both of the following attributes if you don't use entryid, classname, or classpk, you must use this asset display screenlet delegates some events to a class that implements this interface contains the following methods a second listener, assetdisplayinnerscreenletlistener, also exists for configuring a child screenlet the screenlet rendered inside asset display screenlet or rendering a custom asset called when the child screenlet has been successfully initialized. method to configure or customize the child screenlet. implementation here sets the child screenlet's background color to light gray if the asset is a blog entry entity blogsentry onrendercustomassetassetentry assetentry called to render a custom asset. the following example implementation inflates and returns the custom view necessary to render a user from a liferay instance user;;
comment display screenlet can show one comment of an asset in a liferay it also lets the user update or delete the comment screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods and textview and imagebutton elements to show an asset's comment. views may different components to show the comment figure 1 comment display screenlet using the default view this screenlet supports offline mode so it can function without a network for more information on how offline mode works, see the here are the offline mode policies that you can use with this screenlet comment display screenlet delegates some events to a class that implements this interface lets you implement the following onloadcommentsuccesscommententry commententry called when the screenlet ondeletecommentsuccesscommententry commententry called when the screenlet successfully deletes the comment onupdatecommentsuccesscommententry commententry called when the screenlet successfully updates the comment errorexception e, string useraction called when an error occurs in the the useraction argument distinguishes the specific action in which;;
rating screenlet shows an asset's rating. it also lets users update or delete this screenlet comes with different views that display ratings as screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods other custom views may show the rating with a different android component such as button, imagebutton, or others this screenlet has five different views figure 1 rating screenlet's different views this screenlet supports offline mode so it can function without a network for more information on how offline mode works, see the here are the offline mode policies that you can use with this screenlet if you don't use entryid, you must use both of the following attributes rating screenlet delegates some events to an object or class that implements therefore, rating screenlet's listener methods are as follows;;
"image gallery screenlet shows a list of images from a documents and media folder in a you can also use image gallery screenlet to upload images to and delete images from the same folder. the screenlet implements fluent pagination with configurable page size, and supports i18n in asset values screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods the included views use a standard android recyclerview to show the scrollable other custom views may use a different component, such as viewpager or this screenlet has three different views figure 1 image gallery screenlet using the grid, slideshow, and list views this screenlet supports offline mode so it can function without a network connection when loading or uploading images deleting images while offline is for more information on how offline mode works, see the this screenlet supports the remoteonly, cacheonly, remotefirst, and cachefirst offline mode policies these policies take the following actions when loading images from a liferay these policies take the following actions when uploading an image to a liferay image gallery screenlet delegates some events to an object or class that the baselistlistener interface. therefore, image gallery screenlet's listener methods are as follows onlistpagefailedint startrow, exception e called when the server call to retrieve a page of items fails. this method's arguments include the exception generated when the server call fails called when the server call to retrieve a page of items succeeds. this method may be called more than once; once for each page received. startrow and endrow change for each page, a startrow of 0 corresponds to the first item on the first page onlistitemselectedrecord records, view view called when an item is this method's arguments include the selected list item onimageentrydeletedlong imageentryid called when an item in the list is called when an item is prepared for upload onimageuploadprogressint totalbytes, int totalbytessent called when an onimageuploadendimageentry entry called when an item finishes uploading called when the view for uploading an image is instantiated. behavior is to show the default view in a dialog. this method needs to do is return false. to change the default behavior, use the initializeuploadview method to initialize a custom view that extends then return true to prevent the screenlet from executing the default behavior. for example, the following sample implementation uses initializeuploadview to initialize the custom view it then performs a custom ui action provideimageuploaddetailview called when the screenlet provides the image to inflate the default view, return 0 in this method. alternatively, display this view with a custom layout by returning its layout such a layout must have defaultuploaddetailview as its root class errorexception e, string useraction called when an error occurs in the the useraction argument distinguishes the specific action in which";;
the web content display screenlet shows web content elements in your app, rendering the web content's inner html. the screenlet also supports i18n, rendering contents differently depending on the device's locale screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods the default view uses a standard webview to render the html for the web content display screenlet to function properly, there should be web content in the liferay instance your app connects to. content, see the web content management section of the liferay user guide this screenlet supports offline mode so it can function without a network for more information on how offline mode works, see the here are the offline mode policies that you can use with this screenlet note that if your web content uses you can use templateid or structureid in conjunction with articleid the web content display screenlet delegates some events to an object that implements the webcontentdisplaylistener interface. implement the following methods onwebcontentreceivedwebcontent webcontent called when the web content's html or ddmstructure is received. the html is available by calling the to make some adaptations, the listener may return a modified the original html is rendered if the listener returns onurlclickedstring url called when a url is clicked. replace the default behavior, or false to load the url onwebcontenttouchedview view, motionevent event called when something is return true to replace the default behavior, or false to keep processing the event errorexception e, string useraction called when an error occurs in the the useraction argument distinguishes the specific action in which;;
you can start using screenlets once you've your project to use liferay screens. there are plenty of liferay screenlets available and they're described in the screenlet it is very straightforward to use screenlets. insert screenlets into your android app and configure them. first, in android studio's visual layout editor or your favorite editor, open your app's layout xml file and insert the screenlet in your activity or fragment the following screenshot, for example, shows the login screenlet inserted in an activity's framelayout figure 1 here's the login screenlet in an activity's layout in android studio next, set the screenlet's attributes. if it's a liferay screenlet, refer to the to learn the screenlet's required and supported attributes. shows the attributes of the login screenlet being set figure 2 you can set a screenlet's attributes via the app's layout xml file to configure your app to listen for events the screenlet triggers, implement the screenlet's listener interface in your activity or fragment class. screenlet's documentation to learn its listener interface. activity or fragment as the screenlet's listener. example, in the screenshot below, declares that it implements the login screenlet's loginlistener interface, and it registers itself to listen figure 3 implement the screenlet's listener in your activity or fragment class make sure to implement all methods required by the screenlet's listener for liferay's screenlets, the listener methods are listed in each now you know how to use screenlets in your preparing android projects for liferay screens using views in android screenlets;;
"liferay screens speeds up and simplifies developing native mobile apps that use its power lies in its screenlets. a screenlet is a visual component that you insert into your native app to leverage liferay portal's content and android, screenlets are available to log in to your portal, create accounts, submit forms, display content, and more. you can use any number of screenlets in your app; they're independent, so you can use them in modular fashion. screenlets on android also deliver ui flexibility with pluggable views that screenlets describes each screenlet's features and views you might be thinking, these screenlets sound like the greatest thing since taco tuesdays, but what if they don't fit in with my app's ui? don't behave exactly how i want them to? what if there's no screenlet for what i you can customize screenlets to fit your needs by changing or extending their ui and behavior. what's more, screens seamlessly integrates with your existing figure 1 here's an app that uses a liferay screens sign up screenlet the mobile sdk is a low-level layer on top of the liferay to write your own screenlets, you must familiarize yourself with if no existing screenlet meets your needs, consider customizing an existing screenlet, creating a screenlet, or directly using the mobile sdk. screenlet involves writing mobile sdk calls and constructing the screenlet; if you don't plan to reuse or distribute the implementation then you may want to forgo writing a screenlet and, instead, work with the integrating an existing screenlet into your app, however, is that the mobile sdk's details are abstracted from you these tutorials show you how to use, customize, create, and distribute they show you how to create views too. tutorial that explains the nitty-gritty details of the liferay screens no matter how deep you want to go, you'll use screenlets in no";;
to expand and extend the social capabilities of our site, we want to build a new, radical platform on liferay custom-built lists that users can share and collaborate on with their friends or enemies, depending on their social marketing has come up with a great name for our new service our beautiful url dashboard will give users the power to generate their own lists, see the lists of their friends and tally the results of certain types of lists surveys, anyone?. liferay makes this as simple as throwing some dynamic data list display and form portlets on the public and private pages of users' personal sites when new users log in to url, they are going to want to build a few lists chances are, many of the lists they would want to createto do lists, shopping lists and memos come to mindare already defined in the portal. all the user has to do is create a new list, choose that pre-defined data type, a number of data definitions ship with the portal's default site these include to do, issues tracking, meeting use these on their own to generate new data lists or tweak them to fit your use case if none of the built-in data definitions suits your needs, you can define your perhaps we want to allow our url users who would probably call themselves list-ers or list-ies to create their own data types for lists in this case, they would need to have unfettered access to the content of their private user site where they can create a new data type using data lists to outline a new data model is as simple as point and click. you now have a url account and have been dying to bug your friends and family to sign up for volunteer work helping you move into a new apartment. using an intuitive visual editor, you can quickly draw up the skeleton for that since data lists exemplify a unique type of content for your site, you can find them in the content section site administration area to manage the dynamic data lists of your site, click admin from the dockbar and select content. figure 11.1 you can manage dynamic data lists from the content section of the site administration area of the control panel from the dynamic data lists portlet in the control panel, you can either click add to create a new dynamic data list from an existing data type or you can click manage data definitions to add or edit data definitions. introduced the copy action which copies the ddm templates associated with an you can access the copy button by navigating to manage data definitions and clicking actions copy next to a data the copy menu includes options for copying the form and displaying templates associated with the data definition. we'll discuss how to manage and create form and display templates later in the chapter. the copied data definition can be accessed in the manage data definitions the copy feature lets you create new data definitions based on existing you can use the copied version as a checkpoint and work off of it if you want to use a new data type, you need to create a definition for it. from the dynamic data lists portlet in the control panel, click manage data definitions and click the add button. the first thing you should enter is a name for the definition and a description. create a new data definition called when creating a new data definition, you have a palette of fields to lay out, as well as a blank canvas to construct the definition. interface looks similar to creating and editing web content structures covered let's explore the different data types at our disposal boolean presents a checkbox to the user and stores either a true checked or false unchecked based on state date a preformatted text field that displays a convenient date picker to assist in selecting the desired date. the format for the date is governed by the decimal similar to number, except that it requires a decimal point . documents and media select an existing uploaded document to attach to the also has the ability to upload documents into the document library html an area that uses a wysiwyg editor to enhance the content integer similar to number, except that it constrains user input to link to page inserts a link to another page in the same site number a text box that only accepts numbers as inputs, but puts no constraints on the kind of number entered radio presents the user with a list of options to choose from using radio select a selection of options for the user to choose from using a combo can be configured to allow multiple selections, unlike radio text a simple text field for any string input text box a large text box for long text input figure 11.2 you can combine many different kinds of fields to form a list definition and you can configure various settings and properties for each field using that reference as a nice cheat-sheet, you can now create the data type you need for volunteer work sign-up. tasks your friends and family can volunteer to do for you, use select to allow users to choose from a list of tasks. finally, don't forget a documents and media field users can upload images of themselves. official-feeling and fun is it if you can print out some nifty badges? these fields, drag them from the palette on the left to the work area on the when creating data definitions, you can also customize the appearance of the input fields and provide helpful tips and hints for those entering data. data types have specific configuration options but all have some in common. following properties can be edited in three ways 1 by double-clicking on any field, 2 by clicking the wrench icon in the upper-right corner of the field or 3 by clicking the settings tab when the field is selected. at the properties you can edit for each of these field types type lists the type of field placed in the definition. but is available to reference from a display template field label sets the text that can be displayed with the field. human-readable text that the user sees show label when set to yes, the label is shown with the form field required when set to yes, this field must have data in it for a new entry to be submitted not available for boolean name the name of the field internally, automatically generated. is the variable name that you can read the data from in a display template, you should give a more memorable name here predefined value if you would like example data or a default value for the user to start with, enter it here. the field's value defaults to this when tip each field can have a small help icon, with a tooltip attached that if you would like to provide text for the tooltip indexable when set to yes, liferay is able to index your field for repeatable when set to yes, the field is repeatable. add as many copies of this field as they like width sets the visual width of the form on the page. possible values are small, medium and large not available for boolean, documents and media, radio, and select multiple when set to yes, allows the user to select more than one option. this defaults to no only available for select options changes the options available for selection. remove options as well as edit each individual option's display name and value only available for radio and select figure 11.3 you can edit the properties of data fields. this allows you to, for example, add and edit selectable options for the task drop-down menu on the spring move-in sign up form in addition to dragging the fields around to create your desired forms, you can stack inputs within inputs by dragging a field within another field. organize your data into unlimited levels of hierarchy, creating the clearest, there is also a duplicate button on each field the middle button, allowing you to easily clone any field as many times as you another method to edit your data definition is switching to source mode and manually customizing your structure by editing its xml file. default the view mode is selected. click the source tab to switch to source this method is for the more experienced developers data definitions also have the capability of inheriting characteristics from when a parent data definition is configured, the child definition inherits the parent's fields and settings. helpful when you want to make a similar data definition to one you've already for instance, if you'd like to create an advanced sign-up sheet in addition to a regular sign-up sheet, you can simply inherit the characteristics of the regular sheet and only add the additional fields necessary for the when the advanced sheet is configured, it will display its parent's fields in addition to its own fields after you've saved your data definition, liferay provides a webdav url and a these values access the xml source of your data definition. obtain these values, return to your data definition after it has been saved. learn more about webdav or if you'd like to see webdav in action, visit the document management chapter's webdav access chapter that really covers the basic tools that users of url need to get rolling with an unlimited array of custom types. plus, you can always come back and if you find you needed to add some more information, simply come back to the data definition and fix it. all your data lists that use it are then instantly updated with the new or changed fields all that's left to do is build a new data list and let your users play with it.;;
tutorial shows you how to display from a liferay portal site in your ios app. displaying content is great, but what if you want to display an entire page? you can even customize the page by injecting local or remote javascript and css files. when combined with liferay portal's server-side customization features e.g., web screenlet gives you almost limitless possibilities for displaying web pages in this tutorial, you'll learn how to use web screenlet to display web pages in inserting web screenlet in your app is the same as inserting any screenlet in your app in interface builder, insert a new view uiview in a new view controller. this new view should be nested under the view controller's existing view with the new view selected, open the identity inspector and set the view's set any constraints that you want for the screenlet in the scene the exact steps for configuring web screenlet are unique to web screenlet. first, you'll conform your view controller to web screenlet's delegate protocol to use any screenlet, you must conform the class of the view controller that contains it to the screenlet's delegate protocol. protocol is webscreenletdelegate. follow these steps to conform your view controller to webscreenletdelegate import liferayscreens and set your view controller to adopt the implement the webscreenletdelegate method onwebloadurl. is called when the screenlet loads the page successfully. it depends on what if anything you want to happen upon page load. arguments are the webscreenlet instance and the page url. prints a message to the console indicating that the page was loaded implement the webscreenletdelegate method screenletonerror. method is called when an error occurs loading the page, and therefore this lets you log or print the error. example, this implementation prints a message containing the error's implement the webscreenletdelegate method this method's arguments include the message's namespace and how you implement this method depends on what you want to happen when the message is sent. for example, you could perform a segue and include the message as the segue's sender get a reference to the web screenlet on your storyboard by using interface builder to create an outlet to it in your view controller. practice to name a screenlet outlet after the screenlet it references, or here's an example web screenlet outlet in the view controller's viewdidload method, use the web screenlet reference you just created to set the view controller as the screenlet's to do this, add the following line of code just below the next, you'll use the same web screenlet reference to set the screenlet's web screenlet has webscreenletconfiguration and webscreenletconfigurationbuilder objects that supply the parameters the these parameters include the url of the page to load and the location of any javascript or css files that customize the page. set most of these parameters via webscreenletconfigurationbuilder's methods note for a full list of webscreenletconfigurationbuilder's methods, and a description of each, see the table in of web screenlet's reference doc to set web screenlet's parameters, follow these steps in the viewdidload method of a view controller that uses web screenlet use webscreenletconfigurationbuilder , where is the web page's url string, to create a webscreenletconfigurationbuilder object. the page requires liferay portal authentication, then the user must be or a sessioncontext method, and you must provide a relative url to the page's full url is url, then the constructor's argument is webguestblog. for any other page that doesn't require portal authentication, you must supply the full url to the call the webscreenletconfigurationbuilder methods to set the parameters note if the url you supplied to the webscreenletconfigurationbuilder constructor is to a page that doesn't require liferay portal authentication, then you must call the webscreenletconfigurationbuilder method the default webtype is.liferayauthenticated, which is required to load portal pages that require authentication. you need to set.liferayauthenticated manually, call setwebtype.liferayauthenticated call the webscreenletconfigurationbuilder instance's load method, which returns a webscreenletconfiguration object set the webscreenletconfiguration object to the web screenlet instance's call the web screenlet instance's load method here's an example snippet of these steps in the viewdidload method of a view controller in which the web screenlet instance is webscreenlet, and the webscreenletconfiguration object is webscreenletconfiguration the relative url webwesteros-hybridcompanynews supplied to the webscreenletconfigurationbuilder constructor, and the lack of a setwebtype.other call, indicates that this web screenlet instance loads a liferay portal page that requires authentication. add local css and javascript files, respectively. now you know how to use web screenlet in your ios apps using web screenlet with cordova in your ios app;;
the application display template adt framework allows portal administrators to override the default display templates, removing limitations to the way your with adts, you can define custom display templates used to render asset-centric applications. for example, you may want to show blog entries horizontally instead of vertically, or list your assets in the asset publisher portlet in different sizes let's go through a simple use case to illustrate how creating a custom adt can suppose you're customizing the lunar resort site and want to allow users to communicate with other interested travelers. want to configure the wiki portlet for collaboration with facebook or twitter. with adts, you can launch a template editor, create a custom template, and configure your portlet host that template. portlet and give you ultimate control over its appearance and functionality in before attempting to change the adt for your application, you'll need to select a site for your custom template to reside in. makes your template available across all sites. adt, navigate to the control panel sites and click on a site from the if you select the global context, the application display templates page of the control panel's configuration menu shows you a list of sample templates these sample templates differ from the default templates already configured in the portlets. if you choose a site to host your template, you must create a custom template for that site's portlets figure 8.5 in the control panel, you can choose the context in which your application display template resides if you'd like to add an adt, select the portlet you'd like to customize. list below specifies the portlets that can be customized using adts. to create a new adt, click add and select the template you'd like to create, then enter the name and, optionally, a description and a you can select the language type for your template ftl or lastly, the script option lets you browse your file system for a template on your file system, or you can launch the editor and create one directly. the left side of the template editor, you'll notice a palette of common variables used for making templates. this is a great reference when creating to place one of the variables into the template editor, simply position your cursor where you want it placed, and click the variable name if the variable name doesn't give you enough information on the variable's functionality, you can hover your pointer over it for a more detailed description. kinds of adts, there are also different variables for each adt. template has a different set of variables only applicable for that specific figure 8.6 liferay offers a versatile script editor to customize your adt you can also use the autocomplete feature to add variables to your template. can be invoked by typing which opens a drop-down menu of available by clicking one of the variables, the editor inserts the variable you also have the ability to embed same-type templates into other templates. example, suppose you have an existing wiki adt and would like to create another instead of starting from scratch, you can import the existing wiki adt into your new one and build off of it. in other words, you can utilize adts as generic templates which allow for reusable code to be imported by velocity or freemarker templates in the system. create a custom template, visit the another cool feature is the exportimport functionality. advantage of this feature by clicking the gear icon at the top right of the screen and selecting exportimport. for more information on using this after you've completed the initial set up and saved your adt, you can manage your adt through its actions button. additionally, your adt generates a static url and a webdav url. access the xml source of your template. you can find these urls by clicking the adt from the menu and expanding the details section. administrators are capable of adding, browsing, editing, and deleting adts on a if you'd like to learn more about what the webdav url can do, visit the document management chapter's webdav access note embedding portlets into adts, although possible, is not recommended because this could cause conflicts with other portlets or unexpected behavior e.g., embedding a portlet that aggregates data to the breadcrumb. a portlet into an adt is your only option, make sure it does not interfere with to enable your adt for a portlet, navigate to the portlet you want to modify and in the display settings sub-tab located within the setup tab, select your adt from the display template drop-down menu. you'll notice they're separated by context type. site-specific display templates for your portlet do this by clicking the manage display templates for specificsite link next to the display a window will display with a list of your configured templates only available for your site with options to add new templates or edit figure 8.7 in the configuration menu of a portlet, you can edit and manage available adts now that you know the general functions of adts, let's create our own. brief demonstration will show you just how easy, yet powerful, adts can be for add the media gallery portlet to a page by navigating to add content and applications applications content management select the options gear from the top right corner, then click enable the show actions and show folder menu display settings. click the multiple media link and select two custom photos to display. click save, and navigate back to the main portlet screen notice the default format of the pictures. to change the display template for this portlet, navigate back to the options gear and click configuration from the display template drop-down menu, select carousel. figure 8.8 after applying the carousel adt, your pictures are displayed as a carousel slideshow the media gallery portlet is transformed into a carousel slideshow. time, it's perfectly natural to be experiencing i can conquer the world feelings, just as liferay's mascot, ray, exudes in the image above. have that kind of power to transform your site into an enjoyable and customizing the user interface of liferay's bundled portlets provides the ultimate customization experience for liferay users.;;
"that come with liferay screens cover common use cases for mobile apps that use they authenticate users, interact with dynamic data lists, view assets, however, what if there's no screenlet for your specific use case? extensibility is a key strength of liferay this tutorial explains how to create your own screenlets. references code from the sample that saves bookmarks to liferay's bookmarks portlet in general, you use the following steps to create screenlets determine your screenlet's location. where you create your screenlet depends on how you'll use it create the screenlet's ui its view. although this tutorial presents all the information you need to create a view for your screenlet, you may first want to learn how to for more information on views in general, see the tutorial on using views with screenlets create the screenlet's interactor. interactors are screenlet components that make server calls define the screenlet's attributes. these are the xml attributes the app developer can set when inserting the these attributes control aspects of the screenlet's you'll add functionality to these attributes in the screenlet the screenlet class is the screenlet's central component. screenlet's behavior and is the component the app developer interacts with to understand the components that make up a screenlet, you should first architecture of liferay screens for android without further ado, let the screenlet creation begin! where you should create your screenlet depends on how you plan to use it. don't plan to reuse your screenlet in another app or don't want to redistribute it, create it in a new package inside your android app project. reference and access liferay screens's core, in addition to all the view sets if you want to reuse your screenlet in another app, create it in a new android when your screenlet's project is in place, you can start by creating the screenlet's ui in liferay screens for android, screenlet uis are called views. a view consists of the following components the view model interface defines the methods the view needs to update the ui a layout xml file defines the ui components that the view presents to the end a view class renders the ui, handles user interactions, and communicates with the view class implements the view model interface the screenlet class although technically part of a view, the screenlet class depends on all the other screenlet components. screenlet class until the end of this tutorial the first items to create for a screenlet's view are its view model interface the following steps explain how to define the methods that every screenlet's view class must implement, your view model interface should extend baseviewmodel to define any additional methods needed by your screenlet. setters for the attributes you want to use for example, add bookmark screenlet needs attributes for each bookmark's url its view model interface, addbookmarkviewmodel, therefore, defines getters and setters for these attributes define your screenlet's ui by writing a standard android layout xml file. the layout's root element should be the fully qualified class name of your you'll create that class in the next step, but determine its name now and name the layout's root element after it. add any ui elements your view needs for example, add bookmark screenlet's layout needs two text fields one for entering a bookmark's url and one for entering its title. needs a button for saving the bookmark. the screenlet defines this ui in its next, you'll create your screenlet's view class your screenlet needs a view class to support the layout you just created. class must extend an android layout class e.g. linearlayout, listview , implement your view model interface, and implement a separate listener interface follow these steps to create this view class create a view class that extends the android layout class appropriate for for example, add bookmark screenlet renders its ui components in a single column, so its view class addbookmarkview your view class's constructors should call the parent layout class's add instance variables for your view model's attributes and basescreenlet. for example, add bookmark screenlet needs instance variables for a because all screenlet classes extend the a basescreenlet variable in your view class ensures that your view always has a reference to the screenlet. for example, here are addbookmarkview's implement your view model interface. implement your view model's getter and setter methods to get and set the inner value of each component, for example, here's addbookmarkview's implementation of implement a listener interface to handle user actions in the screenlet. example, add bookmark screenlet must detect when the user presses the save the addbookmarkview class enables this by implementing which defines a single method onclick. implementation gets a reference to the screenlet and calls its performuseraction method you'll create performuseraction in the you can set the listener to the appropriate ui element by implementing an this method should also retrieve and assign any other ui elements from your layout. for example, the onfinishinflate implementation in addbookmarkview retrieves the url and title attributes from the layout, and sets them to the urltext and titletext variables, this method then retrieves the button from the layout and sets this view class as the button's click listener methods showstartoperation, showfinishoperation, showfailedoperation, getscreenlet, and setscreenlet. in the showoperation methods, you can log what happens in your screenlet when the server operation starts, finishes successfully, or fails, respectively. setscreenlet methods, you must get and set the basescreenlet variable, this ensures that the view always has a screenlet reference. for example, add bookmark screenlet implements these methods as follows note that although you must implement the showsomethingoperation methods, you can leave their implementations empty if you don't need to take to see the complete example addbookmarkview class now you're ready to create your screenlet's a screenlet's interactor makes the service call to retrieve the data you need an interactor is made up of several components this class lets you handle communication between the screenlet's components via event objects that contain the server call's for communicating jsonobject and jsonarray results within screenlets, you can create your own event classes by extending you should create your own event classes when you must communicate objects other than jsonobject or jsonarray. bookmark screenlet only needs to communicate jsonobject instances, so it this defines the methods the app developer needs to respond to the screenlet's behavior. defines the onloginsuccess and onloginfailure methods. these methods when login succeeds or fails, respectively. these methods in the activity or fragment class that contains the screenlet, the app developer can respond to login success and failure. example add bookmark screenlet's listener interface defines two methods one for responding to the screenlet's failure to add a bookmark and one for responding to its success to add a bookmark with your listener and event as type arguments. interactor class send the server call's results to any classes that implement in the implementation of the method that makes the server call, use the mobile sdk to make an asynchronous service call. this means you must get a session and then make the server call. server call by creating an instance of the mobile sdk service e.g., bookmarksentryservice that can call the liferay service you need and then the interactor class must also process the event object that contains the call's results and then notify the listener of those results. you do this by implementing the onsuccess and onfailure methods to invoke the corresponding getlistener methods is add bookmark screenlet's interactor class. execute method, which adds a bookmark to a folder in a liferay instance's this method first validates the bookmark's url and it then calls the getjsonobject method to add the bookmark, and concludes by returning a new basicevent object created from the the if statement in the getjsonobject method checks the liferay version so it can create the appropriate bookmarksentryservice instance needed to make the server call. regardless of the liferay version, the getsession method retrieves the existing session created by login the session's addentry method makes the the screenlet calls the onsuccess or onfailure method to notify the listener of the server call's success or failure, respectively. either case, the basicevent object contains the server call's results. since this screenlet doesn't retrieve anything from the server, however, there's no need to process the basicevent object in the onsuccess method; calling the listener's onaddbookmarksuccess method is sufficient. the complete code for addbookmarkinteractor your screenlet's interactor is done. before creating the screenlet class, you should define its attributes. the attributes the app developer can set when inserting the screenlet's xml in an activity or fragment layout. the app developer could insert the following login screenlet xml in an activity the app developer can set the liferay attributes basicauthmethod and layoutid to set login screenlet's authentication method and view, the screenlet class reads these settings to enable the appropriate when creating a screenlet, you can define the attributes you want to make you do this in an xml file inside your android this defines the attributes layoutid, folderid, and defaulttitle. bookmark screenlet's screenlet class adds functionality to these attributes. here's a brief description of what each does layoutid sets the view that displays the screenlet. folderid sets the folder id in the bookmarks portlet where the screenlet defaulttitle sets each bookmark's default title now that you've defined your screenlet's attributes, you're ready to create the the screenlet class is the central hub of a screenlet. for configuring the screenlet's behavior, a reference to the screenlet's view, methods for invoking interactor operations, and more. app developers primarily interact with its screenlet class. screenlet were to become self-aware, it would happen in its screenlet class though we're reasonably confident this won't happen to make all this possible, your screenlet class must implement the interactor's with the view model interface and interactor class as type arguments. screenlet class should also contain instance variables and accompanying getters and setters for the listener and any other attributes that the app developer add bookmark screenlet's screenlet class it also contains instance variables for addbookmarklistener and the bookmark's folder id, and getters and setters for also note the constructors call baselistscreenlet's next, implement the screenlet's listener methods. receive the server call's results and thus act as the listener. should communicate the server call's results to the view via the view model and any other listener instances via the screenlet class's listener instance. for example, here are add bookmark screenlet's listener method implementations these methods are called when the server call succeeds or fails, respectively. they first use getviewmodel to get a view model instance and then call the baseviewmodel methods showfinishoperation and showfailedoperation to send the server call's results to the view. the showfinishoperation call sends null because a successful server call to add a bookmark doesn't return any if a successful server call in your screenlet returns any objects you need to display, then you should send them in this showfinishoperation call. the showfailedoperation call sends the exception that results from a failed this lets you display an informative error to the user. the onaddbookmarksuccess and onaddbookmarkfailure implementations then call the listener instance's method of the same name. results to any other classes that implement the listener interface, such as the activity or fragment that uses the screenlet next, you must implement basescreenlet's abstract methods createscreenletview reads the app developer's screenlet attribute settings, to retrieve the attribute settings. you should set the attribute values to the appropriate variables, and set any default values you need to display via a for example, add bookmark screenlet's createscreenletview method gets the layoutid, defaulttitle, and folderid attributes. used to inflate a view reference view , which is then cast to a view the view model instance's settitle method is then called with defaulttitle to set the bookmark's default title. method concludes by returning the view reference createinteractor instantiates the screenlet's interactor. bookmark screenlet's createinteractor method calls the addbookmarkinteractor constructor to create a new instance of this onuseraction retrieves any data the user has entered in the view, and starts the screenlet's server operation via an interactor instance. screenlet doesn't take user input, this method only needs to do the the example add bookmark screenlet takes user input the bookmark's url and title, so its onuseraction method must retrieve this data. does so via a view model instance it retrieves with the getviewmodel the onuseraction method starts the server operation by calling the interactor's start method with the user input. inherits the start method from the invoking the start method causes the interactor's execute method to run in the same way you would any other. if you created your screenlet in its own project, you can also it via the screens project, jcenter, or maven central to finish the add bookmark screenlet example, the following section shows you it also shows how you can set default attribute although you may not need to do this when using your screenlets, it might come in handy on your way to becoming to use any screenlet, you must follow these insert the screenlet's xml in the activity or fragment layout you want the you can fine-tune the screenlet's behavior by setting implement the screenlet's listener in the activity or fragment class as an example of this, the liferay screens you can find the following add bookmark screenlet note that the layout specified by applayoutid bookmarkdefault matches the layout file of the screenlet's view url . is how you specify the view that displays your screenlet. bookmark screenlet had another view defined in a layout file named url, you could use that layout by specifying bookmarkawesome as the applayoutid attribute's value also note that the appfolderid attribute specifies bookmarkfolder as the bookmark folder's id. way of specifying an attribute's value. instead of specifying the value directly, the test app specifies the value in its this name attribute's value, bookmarkfolder is then used in the screenlet xml to set the appfolderid attribute to 20622 now you know how to use the screenlets you create. convenient way to specify default values for a screenlet's attributes using screenlets in android apps architecture of liferay screens for android";;
you can use a liferay screens view to set a screenlet's look and feel independent of the screenlet's core functionality. with several views, and more are being developed by liferay and the community. the screenlet reference documentation lists the views available for each screenlet included with screens. tutorial shows you how to use views in android screenlets. you'll master using views in no time! before using views, you should know what components make them up. follows is a simple description, sufficient for learning how to use different for a detailed description of the view layer in liferay screens, see the architecture of liferay screens for android a view consists of the following items screenlet class a java class that coordinates and implements the the screenlet class contains attributes for configuring the screenlet's behavior, a reference to the screenlet's view class, methods for invoking server operations, and more view class a java class that implements a view's behavior. usually listens for the ui components' events layout an xml file that defines a view's ui components. usually this file's root element. to use a view, you must specify its layout in the screenlet xml you'll see an example of this shortly note that because it contains a screenlet class and a specific set of ui components, a view can only be used with one particular screenlet. the default view for login screenlet can only be used with login screenlet. multiple views for several screenlets can be combined into a view set. set typically implements a similar look and feel for several screenlets. lets an app use a view set to present a cohesive look and feel. the bank of westeros sample app views with several screenlets to present the red and white motif you can see liferay screens for android comes with the default view set, but liferay makes additional view sets, like material and westeros, available in jcenter. can create view sets and publish them in public repositories like maven central to install view sets besides default, add them as dependencies in your project. the url file code snippet below specifies the material and westeros here are the view sets that liferay currently provides for screens default comes standard with a screenlet. layout id is specified or if no view is found with the layout id. views can be used as parent views for your custom views. material demonstrates views built from scratch. for instructions on creating your own views westeros customizes the behavior and appearance of the now that you know about views and view sets, you're ready to put them to use! to use a view in a screenlet, specify the view's layout as the liferaylayoutid attribute's value when inserting the screenlet xml in an for example, to use login screenlet with its material view, insert the screenlet's xml with liferaylayoutid set to the following links list the view layouts available in each view set if the view you want to use is part of a view set, your app or activity's theme must also inherit the theme that defines that view set's styles. the following code in an app's url tells apptheme.noactionbar to use the material view set as its parent theme to use the default or westeros view set, inherit defaulttheme or now you know how to use views to spruce up your android this opens up a world of possibilities, like preparing android projects for liferay screens using screenlets in android apps;;
"if you've ever launched a web site, you know that as it grows, you can this is the case especially if you've given lots of people access to the site to make whatever changes they need to make. preset limitations, users can display content in any order and in any manner they desire think huge, flashing letters in a font nobody can read. can get stale, especially if those responsible for it don't maintain it like and sometimes, content is published that should never have seen the thankfully, liferay wcm helps you handle all of those situations. structures to define which fields are available to users when they create these can be coupled with templates that define how to display that content won't get stale, because you can take advantage of the scheduling feature to determine when content is displayed and when it's additionally, you can configure liferay's built-in workflow system to set up a review and publishing process so only what you want winds up on the liferay portal gives you the management tools you need to run everything from a simple, one-page web site to an enormous, content-rich site all of this starts with structures structures are the foundation for web content. they determine which fields are available to users as they create new items for display. improve manageability for the administrator, they also make it much easier for for example, say you're managing an online news magazine. to contain the same types of information a title, a subtitle, an author and one or more pages of text and images that comprise the body of the article. liferay only supported simple content as has been described above, you'd have no way to make sure your users entered a title, subtitle, and author. also get articles that don't match the look and feel of your site. supposed to be navy blue but they come in from your writers manually set to light blue, you need to spend time reformatting them before they are published structures give you the ability to provide a format for your content so your users know what needs to be entered to have a complete article. structures, you can provide a form for your users which spells out exactly what is required and can be formatted automatically using a template you create a structure by adding form controls such as text fields, text boxes, text areas html, check boxes, select boxes and multi-selection lists. can add specialized, liferay-specific application fields such as an image uploader and documents and media right onto the structure. move the elements around by dragging them where you want them. easy for you to prototype different orders for your input fields. elements can be grouped together into blocks which can then be repeatable. template writers can then write a template which loops through these blocks and presents your content in innovative ways, such as in sliding navigation bars, content which scrolls with the user and more let's look at how we can create and edit structures through the manage go back to the site administration page and select web content from the the first way to access the manage structures interface is simply by clicking manage structures. the web content structures that exist in your currently selected scope. you can add new web content structures, edit existing ones, manage the templates associated with a structure, edit the permissions of a structure, and copy or copying web content structures can be useful if you'd like to create a new web content structure that's similar to an existing one, but you don't want to start liferay generates a unique portal id for the copied structure, but every other attribute of the copied structure, including the name, is the same once you've copied a web content structure, you should enter a new name for it to avoid confusing it with the original. web content structure, you'll be prompted to choose whether to copy any detail templates or list templates associated with the structure. detail templates and list templates, please refer to the using web forms and dynamic data lists figure 3.1 you can access the manage structures interface by clicking manage structures from the web content page the second way to access the manage structures interface is directly from the the web content page to add another piece of content to your portal. going right for the content, this time we'll first create a structure. the manage structures interface, simply click on select next to the structure heading near the top of the page. to create a new structure in your chosen scope, simply click on the add button in the manage structures popup it's very easy to create and edit structures all you have to do is drag elements into the structure and then give them names. text element and drag it onto the structure. you can do the same with any of to remove it from the structure, simply select the delete icon trash can in the upper right corner of the element. to duplicate the element, which can be done by selecting the duplicate we'll explain the configuration button later web content structures also have the capability of inheriting characteristics when a parent structure is configured, the child structure inherits the parent's fields and settings. helpful when you want to make a similar structure to one that already exists. for example, if you'd like to create an in-depth lunar resort sports article in addition to a regular lunar resort sports article, you can simply inherit the characteristics of the regular article and only add additional fields to the when the in-depth article is configured, it will display its parent's fields in addition to its own fields for liferay 6.2, the webdav url feature was introduced for web content structures and templates so users could upload and organize resources from both a web interface and the file explorer of their desktop operating system. the webdav url, site administrators are capable of adding, browsing, editing, and deleting structures and templates on a remote server. your structure, you can access the webdav url by re-opening the structure or template and clicking the details section. if you'd like the see webdav in note some operating systems require a webdav server to be class level 2 before i.e., to support file locking before allowing files to be read or written. for liferay 6.2, the documents and media library was upgraded to class level 2 but web content structures and templates this means that liferay 6.2's document and media library supports webdav file locking but web content structures and templates do not. on operating systems which require webdav servers to be class level 2, it's possible to avoid the restriction by using third-party webdav clients e.g., another method to edit your structure is switching to source mode and manually customizing your structure by editing its xml file. click the source tab to switch to source mode. method is for the more experienced developers take a moment to add, delete, and rearrange different elements figure 3.2 the structure editor gives you many options to customize your web content liferay supports the following fields in structures boolean adds a checkbox onto your structure, which stores either true checked or false unchecked. template developers can use this as a display date adds a preformatted text field that displays a convenient date picker to assist in selecting the desired data. the format for the date is governed by decimal similar to number, except that it required a decimal point . be documents and media adds an existing uploaded document to attach to the also has the ability to upload documents into the document library html an area that uses a wysiwyg editor to enhance the content image adds the browse image application into your structure integer similar to number, except that it constrains user input to link to page inserts a link to another page in the same site number presents a text box that only accepts numbers as inputs, but puts no constraints on the kind of number entered radio presents the user with a list of options to choose from using radio select presents a selection of options for the user to choose from using a can be configured to allow multiple selections, unlike radio text used for items such as titles and headings text box used for the body of your content or long descriptions these fields provide all you need to model any information type you would liferay customers have used structures to model everything from articles, to video metadata, to databases of wildlife. limited only by your imagination. to fire that imagination, let's look more when creating a new structure, it is essential that you set variable names. template writers can use these variables to refer to elements on your form. you don't set variable names, liferay generates random variable names and these can be difficult for a template writer to follow. you might create this field in your form but the underlying variable name in the structure might look something like textfield4882. template writer needs to create markup for your structure and place the author field in a certain spot in the markup. how will he or she know which field is author when they're all named randomly to solve this problem, all you need to do is set a variable name for each field as you add it to your structure. to change its field label and variable name, you'll need to hover over the field and select the wrench icon that appears in the upper right corner. change the field label value to instructions and the name value variable name to steps. template writer has a variable by which he or she can refer to this field here's a list of all the configurable settings available for a structure's type lists the type of field placed in the definition. but is available to reference from a template field label sets the text that can be displayed with the field. human-readable text that the user sees show label select yes to display the field label required select yes to mark the field required. users must enter a value for it in order to submit content using this structure name the name of the field internally, automatically generated. is the variable name that you can read the data from in a template, you should give a more memorable name here predefined value specifying predefined values for structure forms is a way when a user creates a new web content article based on a structure that has predefined values for various fields, the predefined values appear in the form as defaults for those fields tip each field can have a small help icon, with a tooltip attached that if you would like to provide text for the tooltip indexable select yes to enable liferay to index your field for search repeatable select yes to make your field repeatable. add as many copies of this field as they like. for example, if you're creating a structure for articles, you might want a repeatable author field in case you have multiple authors for a particular article width changes the width of the field. medium, or large not available for boolean, documents and media, image, multiple select yes to enable a multi-selection list only available for options changes the options available for selection. remove options as well as edit each individual option's display name and value only available for radio and select for the lunar resort structure, type something in the tip field that helps users know what to put into the body element example this is an html text area for now, when users hover over the help icon near your structure default values allow you to create one structure that uses common data returning to our newspaper scenario again, let's say you want all sports articles to have the same display page sports page, the same categories, or instead of adding them for each article or wondering if your users are adding them to every web content, you can add these characteristics once for every sports article by creating default values for the creating default values is not part of creating a new structure, so make sure you have an existing structure to edit a structure's default values, go to web content in the content section of the site administration page and click manage structures to see find the actions button for the desired structure and select edit default values from the menu to view a window like the one below. this form allows you to manage the structure settings figure 3.3 you can edit default values via the actions button of the manage structures interface every new web content you create with this structure is preloaded with the setting permissions on structures is done using the same procedure as permissions everywhere else in liferay. most users should not have the ability structures are coupled with templates, which require some web development knowledge to create. this is why only trusted developers should be able to create structures and templates. users, of course, should be able to the view permission enables them to make use of the figure 3.4 you're able to assign structure permissions via the actions button you can grant or deny permissions based on roles and this is the recommended way to handle permissions for structures now that you understand what structures are used for, you need to understand the other half of liferay's web content management system templates developers create templates to display the elements of the structure in the content can then be styled properly using css, because markup is generated consistently by the template when structured content is displayed. in essence, templates are scripts that tell liferay how to display content in any changes to the structure require corresponding changes to the template, because new or deleted fields produce errors on the page. enter content into a structure, it must have a matching template. have options for whether you want your template to be permanently linked to your generic templates are templates that are not tied to a structure, which allows for reusable code that can be imported into other templates. without a template, the portal has no idea how to display content which has been created using a custom structure let's look more closely at the types of templates liferay supports liferay supports templates written in three different templating languages, to support the skill sets of the largest number of developers. chances you can jump right in and use whichever one you've already used before. if you haven't yet been exposed to any of them, your best bet is freemarker or velocity, as they are less chatty than xsl and extremely simple to ftl freemarker template language freemarker is a templating language which could be considered a successor to velocity. velocity for which it sacrifices some simplicity, yet it is still easy to use. if you haven't used any of the template languages before, we recommend using freemarker you'll get up to speed the fastest vm velocity macro velocity is a scripting language that lets you mix this is similar to other scripting languages, such as php, though velocity is much simpler xsl extensible style sheet language xsl is used in liferay templates to transform the underlying xml of a structure into markup suitable for the while it may not be as clean and compact as velocity or ftl, it's widely used for transforming xml into other formats and it's very likely your developers have already been exposed to it liferay wcm makes it easy to create structures, templates, and content from the let's go through the entire flow of how you'd create a structure, link it to a template and then create content using them both. use freemarker for our template and we'll lay out the structure fields systematically to go along with the format we've defined for our content go back to the web content section of the site administration page and click click select next to the structures heading to access the manage structures name the structure news article and add the following fields in the manage structures interface, click choose next to the news article in the new web content form, click select next to the template heading to access the manage templates interface click add, enter the name news article, and add a description make sure freemarker is selected as the script language it's the default if you've written the script beforehand, you can select browse to upload otherwise, you can type the script directly into the exit the manage templates interface and click select next to the template click choose next to the news article template you created on the new web content form, you'll see the title, abstract, image, and body fields that you defined for the news article structure. template should also be selected populate the fields and click publish to publish your news article below is the template script for this structure. this template is small but accomplishes a lot. maximizes the portlet is created. once this is done, the template gets the this is important to avoid url collisions with other after this, the template attempts to get a request parameter called readmore. whether or not this was successful is the key to the rest of the script if the template got the readmore parameter, it displays the abstract and the body below the title which is always displayed if the template didn't get the readmore parameter, it displays the image, the abstract and the link created above, which sets the readmore parameter when this template is rendered, it looks something like this figure 3.5 the initial and expanded views for the lunar resort news article. after clicking read more, you're able to read the full text body note during the creation of a web content article, portal provides a basic preview button that gives you the option to preview your article as a final in some instances, the preview does not give an accurate depiction of the web content article. for example, fields provided by the request variable are not available because the request is not populated until the web content is rendered on a portal page. the article would display errors. use the basic preview functionality with new for liferay 6.2 is the ability to create generic templates that aren't connected to a specific structure. in previous versions of liferay, each template had to be associated with a structure. whether to permanently assign a template to a structure or create a generic template and reuse its code for any structure. in other words, generic templates can be embedded in other templates, which allows for reusable code, js library imports, or macros which will be imported by velocity or freemarker templates in suppose you have three different lunar resort web content articles and structures instead of creating three different templates from scratch, you can use the same generic template for all three and build off of this creates a smarter and more efficient process when creating a multitude of similar web content articles. generic templates are created the same way as regular, structure-based templates. the only setting that differs is the structure option, which you'll need to leave blank to create a generic for cases where you're creating your template within liferay, you can use the on the left side of the template editor, you'll notice a palette of common variables used for making web content templates. great reference when creating your template. to place one of the variables onto the template editor, simply position your cursor where you want the variable placed, and click the variable name. if the variable name doesn't give you sufficient information on the variable's functionality, you can hover your pointer over it for a more detailed description figure 3.6 you can hover your pointer over a variable for a more detailed description the interactive template editor is available for the freemarker and velocity depending on which language you select, the variable content changes so you're always adding content in the language you've chosen. feature for the template editor is the autocomplete feature. by typing which opens a drop-down menu of available variables. one of the variables, the editor inserts the variable into the template editor note templates are the gateway to great power; but with great power comes great responsibility. for security reasons, several useful freemarker and velocity variables and classes are restricted by default. you can manage these properties using a url file in your after you've saved your template, liferay provides a webdav url and static url. these values access the xml source of your structure. returning to your template after it's been saved and expanding the details for more information on webdav and the uses of the webdav url, now that you've created a handsome template and know how to use the template editor, it's time to decide who the lucky people are that get to use your new permissions for templates are similar to permissions for structures. structures, you only want specific developers editing and creating templates. you may, however, want to make the templates viewable to some content creators who understand the template scripting language but are not directly writing the you can determine who views and interacts with the template by navigating to manage templates and selecting permissions from the you can grant or deny permissions based on roles. role with the ability to update the template and create a second role that can liferay portal makes it possible to assign permissions based on the roles and responsibilities within your organization now that you understand the role structures and templates play in creating web content, let's look at how to create rss feeds in liferay.";;
to use liferay screens, you must install it in your android project and then configure it to communicate with your liferay instance. there are three different ways to install screens. with gradle gradle is the build system android studio uses to build android we therefore recommend that you use it to install screens note after installation, you must configure liferay screens to communicate with your liferay portal instance. the last section in this tutorial shows you liferay screens for android includes the component library the screenlets and it requires the following software liferay screens for android uses each screenlet in liferay screens calls one or more of liferay portal's json web services, which are enabled by default. lists the web services that each screenlet calls. services must be enabled in the portal. it's possible, however, to disable the web services needed by screenlets you're not using. portal configuration of json web services to use gradle to install liferay screens in your android studio project, you must edit your app's url file. url files one for the project and another for the app module. can find them under gradle scripts in your android studio project. screenshot highlights the app module's url file figure 1 the app module's url file in the app module's url file, add the following line of code inside note that the symbol tells gradle to install the newest version of screens. if your app relies on a specific version of screens, you can replace the if you're not sure where to add the above lines, see the below screenshot once you edit url, a message appears at the top of the file that asks you to sync your app with its gradle files. incorporates the changes you make to them. syncing also downloads and installs any new dependencies, like the liferay screens dependency that you just added. sync the gradle files now by clicking the sync now link in the message. following screenshot shows the top of an edited url file with the sync now link highlighted by a red box figure 2 after editing the app module's url file, click sync now to incorporate the changes in your app in the case of conflict with the appcompat-v7 or other support libraries explicitly add the versions of the conflicting libraries you want to use. remove the url dependency from your project and use the one embedded in liferay screens exclude the problematic library from liferay screens. ignore the inspection, adding a comment like this ignore the warningliferay screens will work without problems although we strongly recommend that you use gradle to install screens, the following section shows you how to install screens with maven note that we strongly recommend that you use gradle to install screens. possible though to use maven to install screens. configure liferay screens in a maven project add the following dependency to your url force a maven update to download all the dependencies if maven doesn't automatically locate the artifact, you must add jcenter as a new repository in your maven settings e.g., url file although we strongly recommend that you use gradle to install screens automatically, it's possible to use gradle to install screens manually. these steps to use gradle to install screens and its dependencies manually in version of liferay screens for android copy the contents of androidlibrary into a folder outside your project in your project, configure a url file with the paths to the include the required dependencies in your url file you can also configure the.aar binary files in androiddist as local.aar file dependencies. you can download all necessary files from to check your configuration, you can compile and execute a blank activity and import a liferay screens class like login screenlet next, you'll set up communication with liferay before using liferay screens, you must configure it to communicate with your to do this, you must provide screens the following the id of the site your app needs to communicate with your liferay instance's version any other information required by specific screenlets fortunately, this is straightforward. in your android project's resvalues folder, create a new file called url. as the above comment indicates, make sure to change these values to match the server address is suitable for testing with android studio's emulator, because it corresponds to localhost8080 through the emulator. if you're using the genymotion emulator, you should, however, use address 192.168.56.1 instead of localhost the liferaycompanyid value is your liferay instance's id. liferay instance's id is in the instance id column. from your portal to the liferaycompanyid value in url the liferaygroupid value is the id of the site your app needs to communicate since the app needs to communicate with the guestbook portlet, navigate to the site you put the guestbook portlet on. admin site administration configuration from the dockbar. the site id is listed on the site settings tab. from your portal to the liferaygroupid value in url if you're using version 7.0 of liferay portal ce or liferay dxp, you must also set the liferayportalversion attribute in your url to 70. supported values for this attribute are 62 for liferay portal 6.2, and 70 for liferay portal ce 7.0 or liferay dxp 7.0. if you don't set this attribute, you can also configure screenlet properties in your url file. the example properties listed below, liferayrecordsetid and liferayrecordsetfields, enable ddl form screenlet and ddl list screenlet to interact with a liferay instance's ddls. you can see an additional example your android project's ready for liferay screens as you use screens to develop your apps, you may want to refer to some example there are two demo applications available now you're ready to put screens to use. the following tutorials show you using screenlets in android apps using views in android screenlets preparing ios projects for liferay screens;;
"by creating your own views, you can customize your mobile app's layout, style, you can create them from scratch or use an existing view as a views include a view class for implementing screenlet behavior, a screenlet class for notifying listeners and invoking interactors, and an xml the four liferay screens view types support different levels of customization and parent view inheritance. themed view presents the same structure as the current view, but alters the theme colors and tints of the view's resources. all existing views can be themed the view's colors reflect the current value of the if you want to use one view set with another view set's colors, you can use those colors in your app's theme e.g. colorprimarydefault, child view presents the same ui components as its parent view, but lets you change their appearance and position extended view inherits its parent view's functionality and appearance, but lets you add to and modify both full view provides a complete standalone view for a screenlet. view is ideal for implementing completely different functionality and appearance from a screenlet's current theme this tutorial explains how to create all four types of views. view concepts and components, you might want to examine the of liferay screens for android. can help you create or extend any screenlet classes your view requires. ready to create some great views! first, decide whether you'll reuse your view or if it's just for your current if you don't plan to reuse it in another app or don't want to redistribute it, create it in your app project if you want to reuse your view in another app, create it in a new android application module; the tutorial when your view's project is in place, you can start creating it first, you'll learn how to create a themed view screens provides several existing view sets that you can reuse and customize in your app to create a themed view. if you use or override the android color reuse the view set's general structure, but be able to use the new colors also note that you must create themed views inside your app. this is because themed views depend on the app or activity theme each view set has its own android theme. you can easily style all your screenlets by setting your app or activity theme to inherit a view set's android theme. for example, you can use the following code to reuse the styles and layouts from materialtheme in your own theme note that this code overrides the apptheme.noactionbar theme's colors with your own color settings for colorprimary, colorprimarydark, and screenlets will also use these new colors, and tint images and liferay screens uses the default android color palette names from the support library you can also override only the parent view set's theme colors. set a default color palette and override only the view set colors you want. color names for each view set are the default android names, followed by an underscore and the view set's lowercase name default, material, and for example, the following code overrides colorprimary, colorprimarydark, and coloraccent for only the materialtheme liferay screens also lets you use one view set's layout with a screenlet, and use another view set's general style and colors. attribute to a screenlet that is already styled with another view set's theme. the screenlet uses the layout structure specified in layoutid, but inherits the general style and colors from the view set's theme. tells login screenlet to use the default view set's layout structure, but use the styles and colors defined earlier in apptheme.noactionbar next, you'll learn how to create a child view a child view presents the same behavior and ui components as its parent, but can change the ui components' appearance and position. a child view specifies visual changes in its own layout xml file; it inherits the parent's view class and screenlet class. the child view discussed here presents the same ui components as the default view, but uses a more compact layout you can follow these steps to create a child view create a new layout xml file named after the view's screenlet and its a good way to start building your ui is to duplicate the parent's layout xml file and use it as a template. building your ui, name the root element after the parent view's fully-qualified class name and specify the parent's ui components with the in the example here, the child view's layout file url resembles its parent's layout file the layout of the login screenlet's default view. compact describes its use case display the screenlet's components in a the ids of its edittext and button components match its root element uses the parent view class's you can browse other layouts for screens's default views on insert your view's screenlet in any of your activities or fragments, using your new layout's name as the liferaylayoutid attribute's value. example, to use the new logincompact layout, insert loginscreenlet in an activity or fragment and set liferaylayoutid logincompact another good child view layout file to examine is it presents the same ui components and functionality as the sign up screenlet's now you know how to create child views. an extended view inherits the parent view's behavior and appearance, but lets you can do so by writing a custom view class and a an extended view inherits all of the parent view's other classes, including its screenlet, listeners, and interactors. the example extended view discussed here presents the same ui components as the login screenlet's default view, but adds functionality computing password of course, you're not restricted to password strength computations; you can implement anything you want the login screenlet's extended view is called url, because it's based on the login screenlet's default view layout file url and it adds a password strength computation create a new custom view class that extends the parent view class. after the screenlet and the functionality you'll add or override. example view class logincheckpasswordview extends the default view's class, overriding the onclick method to compute password strength rename the layout xml file's root element after your custom view's for example, the root element in url is url.logincheckpasswordview example, to use the new loginpassword layout, insert loginscreenlet in an activity or fragment, and set has a couple of extended views that you can examine. adds a new button to show the password in the clear for the login screenlet. the westeros view set also contains an extended view for the user portrait screenlet; it changes the border color and width of the user's portrait picture and it uses the custom layout file now you know how to create extended views. a full view has a unique screenlet class, a view class, and layout xml file. it's standalone and doesn't inherit from any view. if there's no other view that you can extend to meet your needs or if your screenlet's behavior can only be augmented by customizing its listeners or to create a full view, you must create its screenlet class, view class, and layout xml file. the example full view here for the login screenlet presents a single edittext component for the user name. you can follow these steps to create a full view create a new layout xml file and build your ui in it. building your ui is to duplicate another view's layout xml file and use it name your layout xml file after the view's screenlet and name its root element after the fully-qualified class name of your custom view you'll create this next the test app's full view layout xml file for the login screenlet is called it specifies edittext and button elements copied from the longscreenlet's default view file create a new custom view class named after the layout's root element. tutorial on creating android screenlets explains how to note that you don't have to extend a view class to implement a view model interface, but you might want to for convenience. interface by extending the default to return the androidid, the loginfullview custom view class overrides the getpassword method create a new screenlet class that inherits the base screenlet class. class is where you can add custom behavior to the listeners or call custom and overrides the onuseraction method to log interactor calls westeros view set's full view for the sign up screenlet the custom screenlet class also adds a new user action that calls the base now you know how to create a full view. if you want to distribute or reuse views, you should package them in a module that is then added as an app's project dependency. sub-project as a template for your new to use a packaged view, you must import its module into your project by specifying its location in your the bank of westeros and test-app projects use custom views westeros and these projects exemplify using independent views in a if you want to redistribute your view and let others use it, you can upload it file, after entering your bintray api key you can execute gradlew bintrayupload to upload your project to jcenter. the view as they would any android dependency by adding the repository, artifact, group id, and version to their gradle file now you know how to create and package views in liferay screens for this gives you extensive control over your app's visual design and behavior and also lets you distribute and reuse your views using views in android screenlets architecture of liferay screens for android";;
"liferay screens applies architectural ideas from canonical implementation of these architectures, because it isn't an app, but it borrows from them to separate presentation layers from business-logic. tutorial explains screen's high-level architecture, its components' low-level architecture, and the android screenlet lifecycle. examining screens's building blocks! liferay screens for android is composed of a core, a screenlet layer, a view layer, interactors, and server connectors. interactors are technically part of the core, but are worth covering separately. they facilitate interaction with both local and remote data sources, as well as communication between the figure 1 here are the high-level components of liferay screens for android. the dashed arrow connectors represent a uses relationship, in which a component uses the component its pointing to each component is described below core includes all the base classes for developing other screens components. it's a micro-framework that lets developers write their own screenlets, views, screenlets java view classes for inserting into any activity or fragment they render a selected layout in the runtime and in android studio's visual editor and react to ui events, sending any necessary server you can set a screenlet's properties from its layout xml file and the screenlets bundled with liferay screens are known collectively server connectors a collection of classes that interact with different these classes abstract away the complexity of communicating with different liferay versions. this allows the developer to call api methods and the correct interactor without worrying about the specific liferay version interactors implement specific use cases for communicating with servers. they can use local and remote data sources. to exchange data with a liferay instance. if a user action or use case needs to execute more than one query on a local or remote store, the sequence is done in the corresponding interactor. if a screenlet supports more than one user action or use case, an interactor must be created for each. typically bound to one specific liferay version, and instantiated by a server interactors run in a background thread and can therefore perform intensive operations without blocking the ui thread views a set of layouts and accompanying custom view classes that present next, the core layer is described in detail the core layer is the micro-framework that lets developers write screenlets in a all screenlets share a common structure based on the core classes, but each screenlet can have a unique purpose and communication figure 2 here's the core layer of liferay screens for android here are the core's main components the base class for all liferay portal interactions and use cases that a interactors call services through the liferay mobile sdk and receive responses asynchronously through the eventbus, eventually changing a view's their actions can vary in complexity, from performing simple algorithms to requesting data asynchronously from a server or database. have multiple interactors, each dedicated to supporting a specific operation the base class for all screenlet classes. screenlet's view, instantiates and calls the interactors, and then updates the classes that extend it can override its screenlet view implements the screenlet's ui. screenlet's createscreenletview method. standard layout files and updates the ui with data changes. own views that extend a parent view, you can read the parent screenlet's properties or call its methods from this class eventbus notifies the interactor when asynchronous operations complete. it decouples the asynctask class instance from the activity life cycle, to avoid problems typically associated calls a liferay instance's remote services in a type-safe and transparent way a singleton class that holds the logged in user's session. implicit login, invisible to the user, or a login that relies on explicit user user logins can be implemented with the this is explained in detail here a singleton object that holds server configuration parameters. the url file, or from any other xml file that overrides the specifies the default server, companyid liferay instance id and groupid you can also configure other screens parameters in this file, such as the current liferay version with the attribute liferayportalversion or an alternative serviceversionfactory to access custom backends a singleton object that holds a reference to the application context. an interface that defines all the server operations supported in liferay this is created and accessed through a that creates the server connectors needed to interact with a specific liferay the serviceversionfactory is an implementation of an now that you know what makes up the core layer, you're ready to learn the the screenlet layer contains the screenlets available in liferay screens for the following diagram uses screenlet classes prefixed with myscreenlet to show the screenlet layer's relationship with the core, view, figure 3 this diagram illustrates the android screenlet layer's relationship to other screens components screenlets are comprised of several java classes and an xml descriptor file myscreenletviewmodel an interface that defines the attributes shown in the it typically accounts for all the input and output values presented to the includes attributes like the user name and password. attribute values, invoke interactor operations, and change these values based myscreenlet a class that represents the screenlet component the app it includes the following things myscreenletinteractor implements an end-to-end use case that communicates with a server or consumes a liferay service. for example, it might send a request to a server, compute a local value based on the response, and then send this value to a different on completing an interaction, the interactor must notify its listeners, one of which is typically the screenlet class instance. interactors a screenlet requires depends on the number of server use cases it class only supports one use case log in the user, so it has only one class, however, supports several use cases load the form, load a record, submit the form, etc., so it uses a different interactor class for each use case myscreenletconnector62 and myscreenletconnector70 the classes that create the interactors required to communicate with a specific liferay version. the serviceprovider creates a singleton serviceversionfactory that returns myscreenletdefaultview a class that renders the screenlet's ui with the the class in figure 3, for example, belongs to the default view the view object and the layout file communicate using standard mechanisms, like a findviewbyid method or a listener object. a specified listener for example, onclicklistener and then passed to the screenlet object via the performuseraction method url an xml file that specifies how to render the here's a skeleton of a screenlet's layout xml file next, the view layer's details are described the view layer lets developers set a screenlet's look and feel. liferaylayoutid attribute specifies its view. class, view class, and layout xml file. the layout xml file specifies the ui components, while the screenlet class and view class control the view's by inheriting one or more of these view layer components from another view, the different view types allow varying levels of control over a screenlet's ui design and behavior there are several different view types themed presents the same structure as the current view, but alters the theme colors and tints of the view's resources. all existing views can be themed the view's colors reflect the current value of the if you want to use one view set with another view set's colors, you can use those colors in your app's theme e.g. colorprimarydefault, child presents the same behavior and ui components as its parent, but can change the ui components' appearance and position. changes in its own layout xml file; it inherits the parent's view class and it can't add or remove any ui components. creating a child view is ideal when you only need to make visual for example, you might create a child view for login screenlet's default view to set new positions and sizes for the standard extended inherits the parent view's behavior and appearance, but lets you you can do so by creating a custom view class and a new an extended view inherits all the parent view's other classes, including its screenlet, listeners, and interactors; if you need to customize any of them, you must create a full view to do so. creating an extended view is ideal for adding, removing, or changing an existing view's ui components. extend the login screenlet's default view to present different ui components for the user name and password fields full provides a complete standalone view. it doesn't inherit another view's when creating a full view, you must therefore create its screenlet class, view class, and layout xml file. view when you don't need to inherit another view or when you need to alter the core behavior of a screenlet by customizing its listeners or calling custom for example, you could implement a full view with a new interactor for calling a different liferay portal instance. liferay screens views are organized into view sets that contain views for liferay's available view sets are listed here a mandatory view set supplied by liferay. layout id is specified or if no view is found with the layout id. view set uses a neutral, flat white and blue design with standard ui for example, the default view uses standard text boxes for the user name and password, but the text boxes are styled with the default view's flat white and you can customize this view set's properties, such as its components' colors, positions, and sizes. since the default view set contains full views, you can use them to create your own custom child and extended views the view set containing views that conform to android's material design guidelines the view set containing views for the for information on creating or customizing views, see the tutorial now you know how liferay screens for android is composed. there's something you should know before moving on how screenlets interact with liferay screens automatically saves and restores screenlets' states using the android sdk methods onsaveinstancestate and onrestoreinstancestate. screenlet uses a uniquely generated identifier screenletid to assign action the screenlets' states are restored after the oncreate and onstart methods, as it's a best practice to execute screenlet methods inside the activity's onresume method; this helps assure that actions and tasks find their now you know the nitty gritty architectural details of liferay screens let this tutorial be a resource for you as you work with liferay using screenlets in android apps using views in android screenlets";;
it's very common for mobile apps to display lists. lets you display asset lists and ddl lists in your android app by using screens also includes list screenlets for displaying lists of other liferay entities like web content articles, images, and more. the screenlet reference documentation lists all the screenlets included with liferay screens. screenlet for the entity you want to display in a list, you must create your a list screenlet can display any entity from a liferay instance. example, you can create a list screenlet that displays standard liferay entities like user, or custom entities from custom liferay apps this tutorial uses code from the sample bookmark list screenlet to show you how to create your own list screenlet. this screenlet displays a list of bookmarks from liferay's bookmarks portlet. you can find this screenlet's complete code note that because this tutorial focuses on creating a list screenlet, it doesn't explain general screenlet concepts and components. therefore read the following tutorials you'll create the list screenlet by following these steps first though, you should understand how pagination works with list screenlets to ensure that users can scroll smoothly through large lists of items, list screenlets support fluent pagination. support for this is built into the list you'll see this as you construct your list screenlet entities come back from liferay in json. to work with these results efficiently in your app, you must convert them to model objects that represent the entity in transforms the json entities into map objects for you, you still must convert these into proper entity objects for use in your app. bookmark objects that contain a bookmark's url and other data. access to the url, the constructor that takes a map extracts it from the map and sets it to the url variable. other data, the same constructor sets the entire map to the values variable. besides the getters and setter, the rest of this class implements now that you have your model class, you can create your screenlet's view the basic screenlet creation tutorial that a view defines a screenlet's ui. to accommodate its list, a list screenlet's view is constructed a bit differently than that of a non-list to create a list screenlet's view, you'll create the following first, you'll create the row layout before constructing the rest of the view, you should first define the layout to for example, bookmark list screenlet needs to display a bookmark in each row. is therefore a linearlayout containing a single textview that displays the as you can see, this example is very simple. row layouts, however, can be as simple or complex as you need them to be to display your content next, you'll create the adapter class in the example bookmark list screenlet, the layout url and the content is each list item a url. scrolling smooth, the adapter class should use an to make this easier, you can extend the list screenlet framework's with your model class and view holder as type arguments. baselistadapter, your adapter needs only two methods your view holder should also contain variables for any data each row needs to the view holder must assign these variables to the corresponding row layout elements, and set the appropriate data to them for example, bookmark list screenlet's adapter class bookmarkadapter extends baselistadapter with bookmark and bookmarkadapter.bookmarkviewholder as this class's view holder is an inner class that extends since bookmark list screenlet only needs to display a url in each row, the view holder only needs one variable url. view holder's constructor assigns the textview from url to this the bind method then sets the bookmark's url as the textview's the other methods in bookmarkadapter leverage the view holder. createviewholder method instantiates bookmarkviewholder. method calls the view holder's bind method to set the bookmark's url as the your adapter class is finished. next, you'll create the view class now that your adapter exists, you can create your list screenlet's view class. that the view class is the central hub of any screenlet's ui. handles user interactions, and communicates with the screenlet class. screenlet framework provides most of this functionality for you via the baselistscreenletview class. your view class must extend this class to provide your row layout id and an you'll do this by overriding baselistscreenletview's getitemlayoutid and createlistadapter methods. is the only custom functionality your view class needs. can provide it by creating new methods or overriding other create your view class by extending baselistscreenletview with your model class, view holder, and adapter as type arguments. view class to represent your model objects in a view holder, inside an adapter. for example, bookmark list screenlet's view class bookmarklistview must represent bookmark instances in a bookmarkviewholder inside a the bookmarklistview class must therefore extend baselistscreenletview parameterized with bookmark, bookmarkadapter.bookmarkviewholder, and bookmarkadapter. createlistadapter to return a bookmarkadapter instance, the only other functionality that this view class needs to support is to get the layout for the overridden getitemlayoutid method does this by returning the row layout bookmarkrow next, you'll create your view's main layout although you already created a layout for your list rows, you must still create a layout to define the list as a whole. apart from the view class and styling, this layout's code is the same for all for example, here's bookmark list screenlet's layout warning the androidid values in your view's layout xml must exactly these values are hardcoded into the screens framework and changing them will cause your app to crash next, you'll create your screenlet's that interactors retrieve and process a server call's results. the following components make up an interactor these components perform the same basic functions in list screenlets as they do creating them, however, is a bit different. following sections show you how to create one of these components. library to handle communication within screenlets. therefore communicate with each other by using event classes that contain the your list screenlet's event class must extend parameterized with your model class. your event class should also contain a private instance variable for the model class, a constructor that sets this variable, and a no-argument constructor that calls the superclass constructor. for example, bookmark list screenlet's event class bookmarkevent it therefore extends listevent with bookmark as a type argument, and defines a private bookmark variable that you must also implement listevent's abstract methods in your event class. although these methods are briefly described here, supporting offline mode in your screenlets is addressed in detail in a separate tutorial for example, the getlistkey method in bookmarkevent returns the bookmark's url getmodel unwraps the model entity to the cache by returning the model class for example, the getmodel method in bookmarkevent method returns next, you'll create your screenlet's listener recall that listeners let the app developer respond to events that occur in for example, an app developer using login screenlet in an activity must implement loginlistener in that activity to respond to login success or when creating a list screenlet, however, you don't have to create a developers can use your list screenlet in an activity or for example, to use bookmark list screenlet in an activity, an app developer's activity declaration could look the baselistlistener interface defines the following methods that the app developer can implement in their activity or fragment void onlistpagefailedint startrow, exception e responds to the screenlet's failure to retrieve entities from the server responds to the screenlet's success in retrieving entities from the server void onlistitemselectede element, view view responds to a user selection if these methods meet your list screenlet's needs, then you can move on to the if you want to let app developers respond to more actions, however, you must create your own listener that extends baselistlistener parameterized with your model class. list screenlet contains such a listener bookmarklistlistener. defines a single method that notifies the app developer when the interactor is next, you'll create the interactor class recall that as an interactor's central component, the interactor class makes the service call to retrieve entities from , and processes the results of provides most of the functionality that interactor classes in list screenlets you must, however, extend baselistinteractor to make your service calls and handle their results via your model and event classes. class must therefore extend baselistinteractor, parameterized with baselistinteractorlistener and your event class. bookmark list screenlet's interactor class, bookmarklistinteractor, extends baselistinteractor parameterized with baselistinteractorlistener your interactor must also override the methods needed to make the server call getpagerowsrequest retrieves the specified page of entities. bookmarklistinteractor, this method first uses the args parameter to retrieve the id of the folder to retrieve bookmarks from. comparator more on this shortly if the app developer sets one when inserting the screenlet xml in a fragment or activity. finishes by calling bookmarksentryservice's getentries method to retrieve note that the service call, like the service call in the uses url to check the portal version to make sure the correct service instance is used. this isn't required if you only plan to use your screenlet with one portal version. groupid variable used to make the service calls isn't set anywhere in baselistinteractor, like bookmarklistinteractor, inherit this variable via you'll set it when you create the screenlet class. you might now be asking yourself what a comparator is. class in the instance that sorts a portlet's entities. example, the bookmarks portlet contains several comparators that can sort entities by different criteria. although it's not required, you can develop your list screenlet to use a comparator to sort its entities. screenlet supports comparators, you'll see more of this as you progress getpagerowcountrequest retrieves the number of entities, to enable in the example bookmarklistinteractor, this method first uses the args parameter to get the id of the folder in which to count bookmarks. it then calls bookmarksentryservice's getentriescount method to retrieve createentity returns an instance of your event that contains the server this method receives the results as map, which it uses to instantiate your model class. instance to create the event object. in the example bookmarklistinteractor, this method passes the map to the it then uses the resulting bookmark to create and getidfromargs a boilerplate method that returns the value of the first you must implement this method even if you don't intend to support offline having this method in your interactor class makes it simpler to add offline mode functionality later. to see the complete bookmarklistinteractor class, next, you'll create the screenlet class that the screenlet class serves as your screenlet's focal point. screenlet's behavior and is the primary component the app developer interacts as with non-list screenlets, you should first define any xml attributes that you want to make available to the app developer. screenlet defines the following attributes the screenlet defines these attributes in its url now you're ready to create your screenlet class. provides the basic functionality for all screenlet classes in list screenlets, including methods for pagination and other default behavior, your screenlet class must extend baselistscreenlet with your model class and interactor as for example, bookmark list screenlet's screenlet class bookmarklistscreenlet extends baselistscreenlet parameterized with bookmark and bookmarklistinteractor you must also create instance variables for the xml attributes that you want to for example, recall that the request methods in bookmarklistinteractor receive two object arguments the folder id and the the bookmarklistscreenlet class must therefore contain variables for these parameters so it can pass them to the interactor for constructors, leverage the superclass constructors. bookmarklistscreenlet's constructors now you must implement the error method. this is a boilerplate method that uses a listener in the screenlet framework to propagate any exception, and the user action that produced it, that occurs during the service call. does this by checking for a listener and then calling its error method with next, override the createscreenletview method to read the values of the xml attributes you defined earlier and create the screenlet's view. that this method assigns the attribute values to their corresponding instance for example, the createscreenletview method in bookmarklistscreenlet assigns the folderid and comparator attribute values this method also sets the local variable recall that the screens framework propagates this variable to your finish the createscreenletview method by calling the superclass's this instantiates the view for you next, override the loadrows method to start your interactor and thereby retrieve the list rows from the server. this method takes an instance of your interactor as an argument, which you use to call the interactor's start note that the interactor inherits start from baselistinteractor. can also use the loadrows method to execute any other code that you want to run when the interactor starts. for example, the loadrows method in bookmarklistscreenlet first retrieves a listener instance so it can call the listener's interactorcalled method. it then starts the server operation to retrieve the list rows by calling the interactor's start method with note that if your interactor doesn't require arguments, then you can pass the calling start with no arguments, however, causes lastly, override the createinteractor method to instantiate your interactor. since that's all this method needs to do, call your interactor's constructor and your screenlet is a ready-to-use component that you can use in your and contribute it to the screens project, or distribute it in maven central or you can now use your new list screenlet the same way you use any other screenlet insert the screenlet's xml in the layout of the activity or fragment you want for example, here's bookmark list screenlet's xml note that to set a comparator, you must use its fully qualified class name. the bookmarks portlet's entryurlcomparator, set appcomparator in the screenlet xml as follows implement the screenlet's listener in the activity or fragment class. list screenlet doesn't have a custom listener, then you can do this by implementing baselistlistener parameterized with your model class. if you created a custom listener for your list screenlet, however, then your activity or fragment must implement it instead. example bookmark list screenlet's listener is bookmarklistlistener. this screenlet, you must therefore implement this listener in the class of the activity or fragment that you want to use the screenlet in. now you know how to create list screenlets architecture of liferay screens for android packaging your android screenlets using views in android screenlets using screenlets in android apps;;
mobile users may encounter difficulty getting or maintaining a network connection at certain locations or times of day. screenlets ensures that your app still functions in these situations. note, however, that some difficulties may arise when using an app offline. example, allowing users to edit data in an app when they're offline may cause synchronization conflicts with the portal when they reconnect. offline mode is implemented in liferay screens, this tutorial helps you be aware of such difficulties and know how to handle them screenlets in liferay screens support the following phases the following diagram summarizes these phases figure 1 a screenlet's basic phases when requesting and submitting data to the portal note that not all screenlets need to execute each phase. content display screenlet only needs to retrieve and display portal content. conversely, login screenlet and sign up screenlet only need to handle user only the most complex screenlets, like the ddl form screenlet and the user portrait screenlet, need to do both so what does all this have to do with offline mode? infrastructure is a small layer of code that intercepts information going to and it stores this information in a local data store for use when there's no internet connection. the following diagram illustrates this, with local cache representing the local data store figure 2 this is the same diagram as before, with the addition of the local cache for offline mode with offline mode enabled, any screenlet can persist information exchanged with you can also configure exactly how offline mode works with the policies configure how a screenlet behaves with offline mode when it sends or the screenlet adheres to the policy even if the data operation screenlets support the following policies remote-only the screenlet only uses network connections to load data. screenlets functioned this way prior to the introduction of offline mode. this policy when you want the screenlet always to use remote content. won't work, however, if a network connection is unavailable. this policy tend to be slower due to network lag. succeeds, the screenlet stores the data in the local cache for later use cache-only the screenlet only uses local storage to load data it doesn't use this policy when you want the screenlet to note that in the app's local cache, some portal data may not exist or may be outdated remote-first the screenlet first tries to use the network connection to if this fails, it then tries to load data from local storage. this policy when you want the screenlet to use the latest portal data when there's a connection, but also want to support a fallback mechanism when the note that the screenlet may use outdated information when in many cases, however, this is better than showing your cache-first the screenlet first tries to load data from local storage. this fails, it then tries to use the network connection. you want the screenlet to optimize performance and network efficiency. update data in a background process, or let the user update on-demand via an note that while the information retrieved from local storage may be outdated, loading times and bandwidth consumption are typically these policies behave a bit differently depending on the data's direction. other words, when a screenlet set to a specific policy retrieves information from the portal, it may behave differently than when it submits information to as an example, consider the possible scenarios for user portrait remote-only the screenlet always attempts to load the portrait from if the request fails, the operation also fails cache-only the screenlet always attempts to load the portrait from the operation fails if the portrait doesn't exist there remote-first the screenlet first attempts to load the portrait from if the request succeeds, the screenlet stores the portrait if the request fails, the screenlet tries to load the if the local cache doesn't contain the portrait, the screenlet can't load it, and calls the standard error handling code call the delegate, use the default placeholder, etc... cache-first the screenlet first attempts to load the portrait from if the portrait doesn't exist there, it's then requested remote-only the screenlet first sends the new portrait to the portal. if the submission succeeds, the screenlet also stores the portrait in the if the submission fails, the operation also fails cache-only the screenlet only stores the portrait locally. portrait may be loaded from the cache later, or synchronized with the remote-first the screenlet first tries to send the new portrait to if this fails due to lack of network connectivity, the screenlet stores the portrait in the local cache for later synchronization with the cache-first the screenlet first stores the new portrait locally, then if the submission fails, the screenlet still stores the portrait locally, but the send operation fails synchronization can be a tricky problem to solve. straightforward quickly evolves into scenarios where you're not sure which having offline users complicates things further. following diagram illustrates how the screenlet retrieves and stores portal figure 3 the screenlet requests the resource from the portal and stores it in the app's local cache when a user edits the data in the app, the screenlet needs to send the new data but what happens if the user is offline? data can't reach the portal and the local and portal data are out-of-sync. this scenario, the app has the new data while the portal has the old data. app's data in this synchronization state is called the dirty version. we don't recommend giving your mobile device a bath. this context, dirty means that the data should be synchronized with the portal when the screenlet synchronizes the dirty version, it removes the dirty flag from the local data figure 4 the updated data is said to be dirty when the screenlet can't send it to the portal figure 5 the dirty flag is removed once synchronization completes there are other complicated synchronization states. change while out-of-sync with a screenlet's local data. local data can't overwrite the portal data, and vice versa. the synchronization process produces a conflict when it runs. figure 6 users have changed the data independently in the app and in the portal, causing a synchronization conflict the developer needs to resolve the conflict by choosing the local data or portal synchronization conflicts have four possible resolutions keep the local version the screenlet overwrites the portal data with the this results in the local cache and the portal having the same version of the data version 2 in the above diagram keep remote version the screenlet overwrites the local data with the version of the data version 3 in the above diagram discard the screenlet removes the local data, and the portal data isn't ignore the screenlet doesn't change any data. now that you know how offline mode works, you're ready to put it to use using screenlets in android apps;;
file display screenlet shows a single file from a liferay portal instance's use this screenlet to display file types not covered by the other display screenlets e.g., doc, ppt, xls screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods the default view uses an ios uiwebview for displaying the file figure 1 file display screenlet using the default view this screenlet supports offline mode so it can function without a network for more information on how offline mode works, see the here are the offline mode policies that you can use with this screenlet file display screenlet delegates some events to an object that conforms to the this protocol lets you implement the - screenletonfileassetresponse called when the screenlet receives the - screenletonfileasseterror called when an error occurs in the process. an nserror object describes the error.;;
asset display screenlet can display an asset from a liferay instance. screenlet can currently display documents and media files dlfileentry images, videos, audio files, and pdfs, blogs entries blogsentry and web content asset display screenlet can also display your custom asset types. the delegate section of this document screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods the default theme uses different ui elements to show each asset type. example, it displays images with uiimageview, and blogs with uilabel this screenlet can also render other screenlets these screenlets can also be used alone without asset display screenlet figure 1 asset display screenlet using the default theme this screenlet supports offline mode so it can function without a network for more information on how offline mode works, see the here are the offline mode policies that you can use with this screenlet instead of assetentryid, you can use both of these attributes if you don't use the above attributes, you must use this attribute asset display screenlet delegates some events to an object that conforms to the assetdisplayscreenletdelegate protocol. this protocol lets you implement - screenletonassetresponse called when the screenlet receives the asset - screenletonasseterror called when an error occurs in the process. nserror object describes the error - screenletonconfigurescreenlet called when the child screenlet the screenlet rendered inside asset display screenlet has been successfully use this method to configure or customize it. implementation here sets the child blogs entry display screenlet's background - screenletonasset called to render a custom asset. implementation renders a user from a liferay instance user . is a user, this method instantiates a custom userdisplayviewcontroller to;;
comment add screenlet can add a comment to an asset in a liferay instance screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods the default theme uses the ios elements uitextfield and uibutton to add a other themes may use other components to show the comment figure 1 comment add screenlet using the default theme this screenlet supports offline mode so it can function without a network for more information on how offline mode works, see the here are the offline mode policies that you can use with this screenlet comment add screenlet delegates some events to an object that conforms to the this protocol lets you implement - screenletoncommentadded called when the screenlet adds a comment - screenletonaddcommenterror called when an error occurs while adding a the nserror object describes the error - screenletoncommentupdated called when the screenlet prepares a comment - screenletonupdatecommenterror called when an error occurs while the nserror object describes the error.;;
comment display screenlet can show one comment of an asset in a liferay it also lets the user update or delete the comment screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods and ios uilabel elements to show an asset's comment. different components to show the comment figure 1 comment display screenlet using the default theme this screenlet supports offline mode so it can function without a network for more information on how offline mode works, see the this screenlet supports the remote-only, cache-only, remote-first, and cache-first offline mode policies these policies take the following actions when loading a comment from a liferay these policies take the following actions when updating or deleting a comment in comment display screenlet delegates some events to an object that conforms to the commentdisplayscreenletdelegate protocol. this protocol lets you implement - screenletoncommentloaded called when the screenlet loads the comment - screenletonloadcommenterror called when an error occurs in the process. the nserror object describes the error - screenletonselectedcomment called when a comment is selected - screenletondeletedcomment called when a comment is deleted - screenletoncommentdelete called when the screenlet prepares the comment - screenletonupdatedcomment called when a comment is updated - screenletoncommentupdate called when the screenlet prepares the comment;;
gallery screenlet shows a list of images from a documents and media folder in a you can also use gallery screenlet to upload images to and delete images from the same folder. the screenlet implements fluent pagination with configurable page size, and supports i18n in asset values screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods other custom themes may use a different component, such as uibutton or others, to show the items this screenlet has four different themes figure 1 rating screenlet's different themes this screenlet supports offline mode so it can function without a network for more information on how offline mode works, see the here are the offline mode policies that you can use with this screenlet if you don't use entryid, you must use these attributes rating screenlet delegates some events to an object that conforms to the ratingscreenletdelegate protocol. this protocol lets you implement - screenletonratingretrieve called when the ratings are received - screenletonratingdeleted called when a rating is deleted - screenletonratingupdated called when a rating is updated - screenletonratingerror called when an error occurs in the process. nserror object describes the error.;;
image gallery screenlet shows a list of images from a documents and media folder you can also use image gallery screenlet to upload images to and delete images from the same folder. with configurable page size, and supports i18n in asset values screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods the default theme uses a standard ios uicollectionview to show the scrollable other themes may use a different component, such as this screenlet has three different themes figure 1 image gallery screenlet using the grid, slideshow, and list themes this screenlet supports offline mode so it can function without a network connection when loading or uploading images deleting images while offline is for more information on how offline mode works, see the this screenlet supports the remote-only, cache-only, remote-first, and cache-first offline mode policies these policies take the following actions when loading images from a liferay these policies take the following actions when uploading an image to a liferay image gallery screenlet delegates some events to an object that conforms to the imagegalleryscreenletdelegate protocol. this protocol lets you implement - screenletonimageentriesresponse called when a page of contents is note that this method may be called more than once one call for - screenletonimageentrieserror called when an error occurs in the the nserror object describes the error - screenletonimageentryselected called when an item in the list is - screenletonimageentrydeleted called when an image in the list is - screenletonimageentrydeleteerror called when an error occurs during - screenletonimageuploadstart called when an image is prepared for - screenletonimageuploadprogress called when the image upload progress - screenletonimageuploaderror called when an error occurs in the image - screenletonimageuploaded called when the image upload finishes - screenletonimageuploaddetailviewcreated called when the image upload by default, the screenlet uses a modal view controller you only need to implement this method if you want to this method should present the view, passed as parameter, and then return true. for example, the following example implementation presents imageuploaddetailviewbase as a parameter, and then uses it to customize the view's appearance;;
liferay's asset framework is a system that allows you to add core liferay for example, if you've built an event management application that displays a list of upcoming events, you can use the asset framework to let users add tags, categories, or comments to make entries more tags, categories, and comments are just a few of the features in liferay's you'll also find it easy to use you'll be infusing your application with these features in no time as background, the term asset refers to any type of content in the portal. this could be text, a file, a url, an image, documents, blog entries, bookmarks, wiki pages, or anything you create in your applications the asset framework tutorials assume that you've used liferay's service builder to generate your persistence layer, that you've implemented permissions on the entities that you're persisting, and that you've enabled them for search and if you've yet to do any of those things, you can see how each is done writing a data-driven application, takes you through the fundamentals of enabling an example application's custom entities to use the asset framework. if you haven't traveled through that learning path, we recommend you do so before continuing with the tutorials in the tutorials that follow in this section explore the details of leveraging the asset framework's various features. here are some features that you'll give your users as you implement them in your app at this point, you might be saying, liferay's asset framework sounds great, but how do i leverage all of its awesome features? excellent question, and perfect before diving head first into the tutorials, you must implement a way to let the framework know whenever any of your custom content entries is added, updated, or from that point onward, each tutorial shows you how to leverage a particular asset framework feature in your ui. it's time to start your asset framework training! writing a data-driven application;;
"to use liferay's asset framework with an entity, you must inform the asset framework about each entity instance you create, modify, and delete. this sense, it's similar to informing liferay's permissions framework about a all you have to do is invoke a method of the asset framework that associates an assetentry with the entity so liferay can keep track of when it's time to update the entity, you update the to see how to asset-enable entities in a working example portlet, visit the learning path to leverage assets, you must also implement indexers for your portlet's liferay's asset framework uses indexers to manage assets. creating an indexer in a working example portlet, see the learning path this tutorial shows you how to enable assets for your custom entities and in your project's url file, add an asset entry entity reference for add the following reference tag before your custom now you're ready to implement adding and updating assets! your -localserviceimpl java class inherits from its parent base class an assetentrylocalservice instance; it's assigned to the variable as a liferay asset, you must invoke the assetentrylocalservice's here are descriptions of each of the updateentry method's parameters the following code from an example portlet's -localserviceimpl java class demonstrates invoking the updateentry method on an example entity in your add- method, you invoke updateentry after adding in your update- method, you invoke updateentry after to help show the values assigned to some of the parameters, they're declared in local variables before the invocation immediately after invoking the updateentry method, you must update the respective asset and index the entity instance. the indexer to index or re-index, if updating the entity. tip the current user's id and the scope group id are commonly made if the service context you use contains them, then you can access them in calls like these next, you'll learn what's needed to properly delete an entity that's associated when deleting your entities, you should delete the associated assets and indexes this cleans up stored asset and index information, which keeps the asset publisher from showing information for the entities you've deleted in your -localserviceimpl java class, open your delete- method. code that deletes the entity's resource, you must delete the entity instance's here's some code which deletes an asset entry and an index associated with the in your -localserviceimpl class, you can write similar code. the class name insult however, specify your entity's class name, and instead of using a variable named insult, use a variable that holds your entity's important in order for liferay's asset publisher portlet to show your entity, the entity must have an asset renderer. an asset renderer for your custom entity, refer to learning path note also that an asset renderer is how you show a user the components of your on deploying your portlet with asset, indexer, and asset rendering implementations in place, an asset publisher can show your figure 1 it can be useful to show custom entities, like this example insult entity, in a jsp or in an asset publisher now you know how to add, update, and delete assets in your portlets!";;
it's likely that you'll have messages that you want to localize that aren't already implemented in one of liferay's core language keys. specify these language keys in one or more resource bundles in your plugin. one of your portlets will be used in the control panel and you want to localize its title and description, it's best to use a separate resource bundle for that if none of your portlets will be used in the control panel, then the portlets can share the same resource bundle you can share a resource bundle between portlets by adding a resource bundle to by the end of this tutorial, you'll know how to share a resource bundle between multiple portlets in your project. shows two portlets displaying the same language key from a shared resource figure 1 when portlets share the same resource bundle they can display the same textual elements, based on language keys from that resource bundle let's begin sharing a single resource bundle with multiple portlets! for this tutorial, assume that both portlets you're working with are contained in your project's url file, add here's an example language key in your project's docrootweb-infsrccontent folder, create another translation of the language key file for a language of your choice, and add the same language keys translated to that language for example, if you were translating to spanish, you would create a file url in the docrootweb-infsrccontent folder. you'd enter the same language keys as you did in your url file, here's the example language key from step one you can view liferay's available locales in the language and time section of the portal properties for all the portlets that are to share the language keys, edit their view jsp files to use the language keys for example, to use a language key named you-know-it-is-the-best in a this line brings your translated language key value into your jsp. for an example of how to use a liferay ui message in your jsp make sure to specify any required taglibs you're using to display your for example, to use the liferay-ui taglib, you could declare the following line in your jsp navigate to the url file for your project. portlets have the same resource-bundle specified. the same resource bundle, they're sharing it. snippet below exemplifies what this can look like for two portlets it's important to check that the resource-bundle element is in the proper place in the portlet element when developing your own app. redeploy the plugin project and place the portlets on a page, if verify that they display the same intended messages based on your resource bundle switch your portal's locale to the alternate language by adding the language's two letter abbreviation in the context of the url and refreshing for example, to display the portlets in a spanish context on localhost8080, your url would look like this notice how the portlets display your translated language keys figure 2 this figure displays two portlets sharing a spanish translation of a language key from the same resource bundle. sharing resource bundles between multiple portlets helps you leverage common translated text at this point, any language keys you specify in the language properties files are accessible from all of your plugin project's portlets note it's best to use the liferay naming convention for the language resource bundle file and folder so that your portlets can access the bundle and so that you can use the automatic language building capabilities of liferay ide and the plugins sdk with the bundle in this tutorial, you created language keys, specified the language key values in different languages translations, and shared the new language keys among overriding language properties using a hook;;
alloyui gives you skinnable, scalable ui components, so you can provide a consistent look and feel for your application. javascript extensions to yahoo ui yui that leverages all of yui's modules and adds its own components to help you build terrific uis.;;
liferay ui is a set of taglibs that are fully integrated with liferay portal. they provide powerful ui tags that implement commonly used ui components. they're built on alloyui to give your customers a terrific user experience that is stylish and responsive.;
liferay's asset framework provides a set of features that are common to many web content articles, blog posts, wiki articles, and documents are a few examples of liferay assets. asset types so that they don't have to independently implement functionality liferay's asset framework includes the following for more information on liferay's asset framework, please refer to liferay's in this learning path, you'll integrate the guestbook and guestbook entry entities with liferay's asset framework. comments, ratings, and related assets for guestbooks and guestbook entries. you'll also learn how asset-enabled guestbooks and guestbook entries integrate with liferay core portlets including the asset publisher, tags navigation, tag cloud, and categories navigation portlets.;;
now you have a working guestbook portlet as well as a completed guestbook admin the guestbook portlet allows users to create guestbooks and to add, edit, configure permissions for, and delete guestbook entries. admin portlet allows site administrators to create, edit, configure permissions to increase the usability of the guestbook portlet, especially for situations where many entries have been added to one or more guestbooks, you'll next make guestbook entries searchable. users will be able to enter search queries into a search bar on the guestbook if a search query matches an entry's message or name, the entry will you'll not only add an indexer for guestbook entries, but also for guestbooks although you don't anticipate having so many guestbooks in a single site that searching for them would be useful, creating a guestbook indexer has in a later learning path, you'll asset-enable both guestbook entries and guestbooks themselves. for performance reasons, liferay's asset publisher portlet queries for assets to display via search indexes instead of in order to fully asset-enable an entity, it must have an in this learning path, you'll create a guestbook indexer and update the guestbook service layer to use it since it's a prerequisite for asset-enabling figure 1 you'll add a search bar to the guestbook portlet so that users can search for guestbook entries. if a guestbook entry's message or name matches the search query, it's displayed in the search results.;;
storing your data in a database is really only the first step in creating a once the data is there, most of the time you'll want to make sure that some of that data is protected from the general you'll also want to enable some users such as signed in users to add guestbook entries, while preventing others such as those who aren't signed in from doing so in this learning path, you'll find out how to use liferay's permissions system to implement security in your application. permissions scheme that allows signed in users to enter guestbook entries, while preventing anonymous users from doing so. users with administrative access can add new guestbooks, while regular users cannot. implement security in liferay portal, and be able to add it to your own;;
one of the most common ways to store data in an application is to use a if you've followed the introductory learning path, you learned how to write a liferay application using only the simple api for portlet preferences. while that method allows you to create some simple applications, it doesn't scale well, and the amount of data you can store is limited. picks up where that one left off here, you'll learn how to turn the guestbook into a full-fledged, database-driven application;;
as you're undoubtedly aware, users can sometimes cross the line with what they when users are able to report inappropriate content, a greater sense of community and collaboration develops as users establish what kinds of things will and won't be tolerated by the community. monitoring work off the backs of administrators. fortunately has you coveredyou can leverage it to let users report inappropriate content posted by others. users can click a flag which opens a small form they can fill out, letting administrators know why they find the you've probably seen this flag in liferay's built in for example, each blog in the blogs portlet can be flagged as figure 1 flags for letting users mark objectionable content are enabled in the built in blogs portlet this tutorial shows you how to enable flagging of content in a portlet. prerequisite, you must have assets enabled for your portlet's custom entity before you can enable content flagging. tutorial demonstrates implementing this feature in a custom insults portlet. coming up with great insults is a natural part of comedy, but sometimes things it's for these situations that flagging inappropriate content is you can find the insults portlet complete with the flagging feature now it's time to get on with the flagging! for your entity, you can use flags in the full content view of an asset you can also use flags in any view jsp you create for viewing as an example, the insult portlet's view jsp file url shows an insult entity and the flagging component. to associate the flagging component with your custom entity in your view jsp, you can use paramutil to get the id of the entity from the then you can create an entity object using your now you just need to implement the flagging itself. here's the liferay-uiflags tag for the insults now you have a jsp that lets your users flag inappropriate content in if you haven't already connected your portlet's view to the jsp for your entity, to see how to connect your portlet's main view jsp to your entity's view jsp now redeploy your portlet and refresh the page so that the your plugin's ui the flag icon appears at the bottom of the page figure 2 users can now flag content in your portlet as inappropriate now you know how to let users flag inappropriate content in your asset another thing you might want to do is perform permissions checks to control for example, the add insult and permissions buttons of the insults portlet are wrapped in a permissions check in the for more information on this, see the learning path checking for permissions in the ui;;
social bookmarks in liferay let users share portal content on social networks. when social bookmarks are enabled, a row of icons appears below the content that lets users share it with twitter, facebook, and google plus. seen this before in some of liferay's built-in portlets. the row of share icons appears below each blog entry in the figure 1 social bookmarks are enabled in the built-in blogs portlet since each piece of content in a portlet is an asset, your portlet needs to be before you can add social bookmarks users naturally want to share the greatest of insults with the world! demonstrate this feature, a custom insults portlet is used in this tutorial's you can find the insults portlet complete with social bookmarks you can show social bookmarks in your portlet's view of your custom entity or, if you can show social bookmarks in the full content view in an asset publisher as an example, the insult portlet's view jsp file shows an insult entity with the social bookmarks asset feature in your entity's view jsp, you can use paramutil to get the entity's id then you can create an entity object using your now you need to add the social bookmark component. here's the liferay-uisocial-bookmarks tag there are a some things to take note of in this tag. to horizontal, the flags indicating the number of shares for each button are this is the case in the above screenshot. displaystyle to vertical positions the flags above each share button figure 2 here are the share buttons with displaystyle set to vertical the target attribute is the html target for the link. opens a new browser tab or window. the title attribute is sent to the social service and becomes part of the link you create there, as does the url also, the specific url of the shared content on your site is set with url. url for viewing the content is retrieved using portalutil now you have a jsp that lets your users share content in your portlet if you haven't already connected your portlet's view to the jsp for your entity, to see how to connect your portlet's main view jsp to your entity's view jsp now redeploy your portlet and refresh the page so that the your plugin's ui the social bookmarks ui component now shows in your entity's view figure 3 the new jsp lets users share content in your portlet now you know how to let users share content in your asset enabled another thing you might want to do is perform permissions checks to control for example, the add insult and permissions buttons of the insults portlet are wrapped in a permissions check in for more information on this, see the learning path checking for permissions in the ui;;
liferay's asset framework facilitates discussions on individual pieces of this is great because it lets discuss any posted fortunately, most of the work is already done for you so you don't have to spend time developing a commenting system from scratch figure 1 your jsp lets users comment on content in your portlet in order to implement the comments feature on your custom entity, it must be asset enabled. this tutorial shows you how to add the comment feature for your application's a custom insults portlet is used as an example a community discussion definitely helps to bring about insults of the highest quality! completed insults portlet code that uses this feature is on without any further ado, go ahead and get started enabling comments in your you can display the comments component in your portlet's view you can display it in the full content view in the asset publisher portlet as an example, the insult portlet's view jsp file shows an insult entity and this asset feature in your entity's view jsp, you can use paramutil to get the id of the entity then you can create an entity object using your next, you need to add the code that handles the discussion. a collapsible panel for the comments, so the discussion area doesn't visually take precedence over the content. liferay-uipanel-container and liferay-uipanel tags. your users obscure any potentially long content on a page. is in place, you need to create a url for the discussion. you also need to get the current url from the request object, so that your user can return to the jsp after adding a comment. last, but certainly not least, is the implementation of the discussion itself with the liferay-uidiscussion tag. of code shows the collapsible panel, urls, and the discussion now you have a jsp that lets your users comment on content in your if you haven't already connected your portlet's view to the jsp for your entity, to see how to connect your portlet's main view jsp to your entity's view jsp now redeploy your portlet and refresh the page so that the your plugin's ui the comments section appear at the bottom of the page now you know how to let users comment on content in your asset enabled before moving on, another thing you might want to do is perform permissions checks to control who can access the discussion. with cif tags that only reveal their contents to users that are signed in to this is just one way of controlling access to the discussion. could also perform more specific permissions checks as the insults portlet does for the add insults and permissions buttons in its for more information, see the learning path checking for permissions in the ui;;
liferay's asset framework supports a rating system that lets your users rate you've probably seen this in many of liferay's built-in a great example is the blogs portlet. a row of stars appears, letting the user rate the entry on a scale from one to ratings help users figure out what content is popular. also fosters a sense of community and collaboration among content producers and even better, once your plugin is asset enabled, implementing ratings figure 1 users can now rate instances of your custom entities this tutorial shows you how to add ratings to an asset enabled portlet. tutorial uses code from a custom insults portlet as an example. portlet seemed appropriate, since a truly distinguished writer of insults needs to know how good his or her insults really are in order to implement ratings on your custom entity, it must be asset enabled. the completed insults portlet code that uses this feature is on github, here now go ahead and get started learning how to add ratings to your portlets! for your custom entity, you can display ratings in the full content view you can, of course, also display this asset feature in any view jsp you create for viewing the entity as an example, the insult portlet's view jsp file url shows an insult entity and its ratings. this tutorial shows you how to associate the ratings component with your custom entity in your view jsp you can use paramutil to get the id of the entity from the then you can create an entity object using your after the code that displays your entity, you can add the ratings component using the liferay-uiratings tag. note that the object's id is used to tie the in the code above, the type attribute is given the value stars to use the you can optionally replace the star ratings with a thumbs-up or thumbs-down rating system by changing this value to if you haven't already connected your portlet's view to the jsp for your entity, to see how to connect your portlet's main view jsp to your entity's view jsp now you have the jsp that lets your users rate content now redeploy your portlet and refresh the page so that the your plugin's ui the ratings ui component now appears in your entity's view now you know how to add ratings for content in your asset enabled another thing you might want to do is perform permissions checks to make sure only the proper users can rate content. for example, the add insult and permissions buttons of the insults portlet are wrapped in a permissions check in for more information on this, see the learning path checking for permissions in the ui;;
in addition to that, you should make sure to content authors, however, still can't specify the tags and categories liferay provides a set of jsp tags for showing category and tag inputs in your ui figure 1 adding category and tag input options lets authors aggregate and label custom entities you can use the following tags in the jsps you provide for addingediting custom here's what the tags look like in a the url for a custom insults portlet that's used as an example these category and tag auiinput tags generate form controls that let users browseselect a categories for the entity, browseselect tags, andor create new tags to associate with the entity the liferay-uiasset-categories-error and liferay-uiasset-tags-error tags show messages for errors occurring during the asset category or tag the liferay-uipanel tag uses a container that lets users hide or show the category and tag input options for styling purposes, give the liferay-uipanel an arbitrary id value that once the tags and categories have been entered, you'll want to show them along here's how to display the tags and categories you can also support navigation of tags and categories by specifying a becomes a link containing the portleturl and tag or categoryid parameter to implement this, you need to implement the look-up functionality in do this by reading the values of those two parameters and using assetentryservice to query the database for entries based on the deploy your changes and addedit a custom entity in your ui. categorization and tag input options in a panel that the user can hideshow now you know how to make category and tag input options available to your;;
the ability to relate assets is one of the most powerful features of liferay's by relating assets, you can connect individual pieces of content this helps your users discover related content, particularly when there's an abundance of other available content. assets related to a blog entry appear alongside that entry in the blogs portlet figure 1 you and your users can find it helpful to relate assets to entities, such as this blogs entry this tutorial shows you how to provide a way for authors to relate content. this tutorial assumes that you've asset enabled a custom insults portlet is used as an example. of such a portlet would want to relate their insults to all kinds of content! the completed insults portlet code that uses this feature is on github. now go ahead and get started relating your assets! first, you must make some modifications to your portlet's service layer. must implement persisting your entity's asset relationships. url, put the following line of code below any finder method elements next, you need to modify the add-, delete-, and update- methods in your -localserviceimpl to persist the asset relationships. -localserviceimpl's assetlinklocalservice instance variable to execute when you add and update assets, you must invoke the addinsult and updateinsult methods of insultlocalserviceimpl both utilize the updatelinks invocation in the example insults portlet's to call the updatelinks method, you need to pass in the current user's id, the asset entry's id, the id's of the asset link entries, and the link type. should invoke this method after creating the asset entry. assetentry variable e.g., one called assetentry the value returned from entry's id for updating its asset links. lastly, in order to specify the link type parameter, make sure to import in your -localserviceimpl class' delete- method, you must delete the asset's relationships before deleting the asset. for example, the insults portlet deletes the asset link relationships using the following code your delete- method can look similar, except it requires your entity's class name and your entity's id, instead of the insult class and its id variable insultid that are used in the above code now your portlet's service layer can handle related assets. there's still nothing in your portlet's ui that lets your users to relate you'll take care of that in the next step you typically implement the ui for linking assets in the jsp that you provide users the ability to create and edit your entity, this way only content creators can relate other assets to the entity. in the insults portlet, for example, assets can only be related from its url. related assets are implemented in the jsp by using the liferay ui tag liferay-uiinput-asset-links inside of a collapsible panel. placed inside the auifieldset tags of the jsp. liferay-uiinput-asset-links tag from the example insults portlet is shown you can use similar code, replacing the insult and insultid references with your portlet's entity class and entity id variable. able to relate assets once you add this code and redeploy your portlet the following screenshot shows the related assets menu of the insults note that it is contained in a collapsible panel titled related assets figure 2 your portlet's entity is now shown in the related assets menu even though you've provided a way for authors to assign related assets, the related assets menu shows your entity's fully qualified class name, instead of a to replace the long fully qualified class name shown in the menu with a simplified name for your entity, add a language key that uses the fully qualified class name as the key's name and the new simplified name as the for more documentation on using language properties here's a language key to simplify the label for the insult entity class used upon redeploying your portlet, the value you assigned to the fully qualified class name in your url file shows in the related assets menu figure 3 after deploying with your language key, your entity appears as desired in the related assets menu now content creators and editors can relate the assets of your portlet. the next thing you need to do is reveal any such related assets to the rest of after all, you don't want to give everyone edit access just so they can view related assets! you can show related assets in your portlet's view of that entity or, if you've for your custom entity, you can show related assets in the full content view of your entity for users to view in an asset publisher portlet as an example, the insult portlet's view jsp file shows an insult entity and links to all of its related assets. shows you how to access an entity's asset entry in your entity's view jsp and how to display links to its related assets. when you finish, users can click on the entity instances in your portlet to view any related assets in your entity's view jsp you can use paramutil to get the id of the entity then you can create an entity object using your you can use an entity instance object to get the assetentry object associated with it to show the entity's related assets you use the liferay-uiasset-links tag. you use in your entity's class to get it's class name and the variable holding your instance object to return the its id. the example code below uses the example entity class insult and an instance object variable called ins go ahead and use a the liferay-uiasset-links tag in your jsp. have the jsp that lets your users view related assets if you've already connected your portlet's view to the view jsp for your entity, you can otherwise follow the remainder of this tutorial to learn how to implement that connection now that you've implemented showing off this asset feature, you must connect your portlet's main view jsp to your entity's view jsp. uses a search container to list your entity instances, you can insert a portletrenderurl tag just after the liferay-uisearch-container-row tag. for example, in the insults portlet's next, add to the first search container column an href attribute with the value of the url you just created in the portletrenderurl tag. the value of href that corresponds with the render url created above is now, redeploy your portlet and refresh the page so that your portlet's view jsp click on one to view the your entity's jsp that you made in the previous step of this tutorial related assets, if you've created any yet, should be visible near the bottom of figure 4 any related assets now show in the new jsp you created now you know how to implement related assets in your portlets. another thing you might want to do is investigate permissioning in the ui. example, the insults portlet only allows assets to be related by those with addinsult or update permissions. these permissions are checked in the insults portlet's url and url, respectively. information on this, see the learning path checking for permissions in the ui;;
liferay portal's user interface is designed to be simple and intuitive. the top is what's known as the dockbar, a series of links that appear based on the permissions of the logged-in user. there are four sections in the dockbar admin, my sites, notifications, and the user section the admin section gives you access to liferay portal's site administration interface, as well as to the control panel. both of these are explained in more site administration in particular can be done directly on the page as well, as will be described figure 2.1 the dockbar provides convenient access to liferay portal's functions the my sites section provides a list of the sites which the logged-in user can these appear as a drop down list. notifications icon shows the unread notifications and requests you have. notified upon receiving a private message, an invitation to join a site, a social connection request, or an event reminder. created via the alerts or announcements applications are accessible via the clicking mark as read clears notifications from the list, but leaves each request for you to respond to individually. notifications or requests lets you view further details about each item you've received and lets you configure your preferences for receiving note currently, requests do not appear under the requests section of the any received requests instead appear as regular finally, the user section shows the users name and provides links to the user's profile his or her publicly-accessible pages, dashboard his or her private pages, account settings, and a sign out link on the left side of the page are three icons one for add, one for previews, and one to show or hide the edit controls if you have administrative access to the all of these are explained later in this chapter anything else you see on the page is provided by the theme that is installed. this includes site navigation and application windows, called portlets. jump in and start creating the site we'll use for this book.;;
as you can see, it's hard to describe, because it does so what we've essentially done is say it's a totally awesome content and document managing, user collaborating, socially enabling, application developing, corporate integrating, completely customizable platform for building if we'd said that up front, you'd probably have doubted us. hopefully now, you can see that it's true if you're interested in using liferay portal for your product, continue we'll go through all of these features and more that we couldn't mention throughout the rest of the book.;;
this chapter has provided an introduction to liferay site management and web we've learned how you can use liferay to create multiple sites with different membership types. we've seen how easy it is to create and manage sites and to create and manage pages within a site in liferay. seen how easy it is to create and edit web content using liferay's rich wysiwyg this powerful tool enables users who don't have much experience with html and css to easily create and style web content of any type that you'd like liferay wcm also includes a powerful workflow engine, allowing you to set up custom publishing rules to fit your organization. processes for different sites as well as for different kinds of content within a we'll examine sites in more detail in the advanced web content management we'll also cover some more advanced web content management tools such as web content structures and templates, page templates and site templates, staging, and mobile device rules.;;
"liferay's wcm offers a host of features that makes managing the content of your wysiwyg editor a complete html editor that allow you to modify fonts, add color, insert images and much more structure editor easily add and remove fields you want available to content creators and then dynamically move them around. an entire suite of form controls you can drag and drop onto your structure template editor import template script files that inform the system how to display the content within the fields determined by the structure web content display a portlet that allows you to place web content on a page asset publisher a portlet which can aggregate different types of content scheduler lets you schedule when content is reviewed, displayed and workflow integration run your content through an approval or review staging use a separate staging server or stage your content locally so you can keep your changes separate from the live site liferay's web content management is a powerful and robust tool for creating and organizing content on your web site. let's begin by examining some basic concepts involving sites and pages as you'll see, liferay's wcm is a full-featured solution for managing your web we'll start with an overview of what it has to offer and then we'll dive note that web content is just one kind of asset on other types of content blog posts, wiki articles, message board posts, etc. are also considered assets. liferay provides a general framework for handling assets that includes tags, categories, comments, ratings, and more. section for more information on liferay's asset framework as we've already discussed, content is the reason web sites exist. portal has made it easier than ever to get content published to your site. because liferay portal is so flexible, you can use basic authoring tools right away or take advantage of the more advanced features. we'll begin by creating some simple content using liferay's wysiwyg editor. we'll publish it to the home page of the lunar resort's web site. and straightforward process that demonstrates how easy it is to create and content section in site administration so we can create and publish our first when you manage web content from the site administration page, you can select the location where the content resides. for instance, you can add content that's available to a specific site or globally across the portal. site you wish to add content to, simply navigate to the admin tab on the dockbar and select site administration. conversely, if you need to switch sites or would like to add content globally, navigate to the control panel and from this window, you can change the scope of where you'd like to view, edit, or create content figure 2.14 you can choose where to create content by navigating to the control panel and selecting sites once you have the lunar resort site selected, click on the web content link in you'll see a folder structure containing all of the web content articles that exist in the currently selected scope the lunar resort you can click add folder to create a new folder. with lots of content and web content articles, it can be very useful to use folders to group certain kinds of web content articles together. basic web content to create a new web content article figure 2.15 click add basic web content to create a new simple web content article. to create a new web content article based on an existing web content structure, click add and then click on the name of the structure you'd like to use existing web content structures also appear in the add menu. users with shortcuts for creating specific kinds of web content articles. example, if a web content structure called faq has been created for frequently asked question articles in your currently selected scope, you can create a new click manage structures to view a list of web content structures that have already been created in your chosen scope. web content templates are always associated with a particular web content structure, so you can click actions manage templates to view the web content templates associated with a structure or add a new in the next chapter, we'll cover advanced features such as structures, templates, and content scheduling in detail once you've clicked add basic web content, you'll find a highly customizable form that by default has two fields a title and a powerful wysiwyg we could customize this form to contain whatever fields our content needs but we'll keep things simple for now. already been created in your currently selected scope, you can select one for your new web content article by clicking select next to the structure we discuss web content structures and templates in detail in the next type the words welcome to the lunar resort in the name field. field, add a short sentence announcing the web site is up and running. content can be localized in whatever language you want. localizing your content later on, which can be done after you publish your web getting a new web site up and running is an exciting step for anyone, whether it is a large corporation or a small non-profit charity. momentous achievement at the lunar resort, let's give our announcement some of the pomp and circumstance we think it deserves! using the editor, select all the text and then change the style to heading 1 you could insert an image here or even more text with a different style, as demonstrated in the screenshot below. bullets, numbering, links to another site or custom images. go ahead and add a smiley face to the end of your announcement figure 2.16 view your content changes directly in the editor the wysiwyg editor is a flexible tool that gives you the ability to add text, images, tables, links and more. additionally, you can modify the display to match the purpose of the content. plus it's integrated with the rest of liferay portal for example, when you upload an image to be added to a page, that image can be viewed and manipulated in the documents and media portlet if you're html savvy, liferay wcm doesn't leave you out in the cold. switch from the wysiwyg view by clicking the source button. view, you can view the html content of your web content. figure 2.17 if you've installed and enabled xuggler from the server administration external tools section of the control panel, you can add audio and video to your web content! you can integrate liferay with external services to enable additional for example, if you navigate to the control panel, click on server administration and then on external services, you can install and enabling xuggler allows you to embed audio and video files in installing and enabling xuggler is easy; you can do it right from please refer to the server administration article of this guide for more details once xuggler has been installed and enabled, embedding audio or video files in a from the dockbar, navigate to site content web content and click add basic web content. ckeditor toolbar with audio and video icons. click on either the audio or video button and then click browse server to browse to the audio or video file's location on your portal's documents and media repository. if you haven't already uploaded the audio or video file to the portal, you can do so by clicking on the upload button. select the file and then check that the audio or video component appears in the when your web content is published, users can view or listen to the embedded multimedia! you can also download the web content article in xml format by clicking the this button is available on the edit web content screen, after you've created your web content article figure 2.18 the download button is only available for an article that has a structure and template an xml version of an article is essential when creating content for themes using if you'd like to learn more about importing web content with a theme, visit its note the download button for web content articles comes standard for liferay 6.2 versions ce 6.2 ga4 and ee 6.2 sp10 and later. versions require the resources importer ce can be downloaded from liferay marketplace the right side of the new web content form provides options for customizing your figure 2.19 new web content can be customized in various ways using the menu on the right abstract lets you create a brief summary of the web content. also pair the text with a small image categorization specifies the content type from a list of options. announcements, blogs, general, news, press release, and test. can also create tags to make the content easier to find in a search. these categories are defined by a property in the properties file; see the note the web content type portlet, located within the categorization menu, is deprecated for liferay 6.2 and will be removed in liferay 7.0. will be migrated to a vocabulary with categories schedule customizes the date and time your content publishes andor display page lets you determine where the web contents are displayed when the canonical url can be used here. is unique for articles that redirect the visitor to the article's default imagine you have a newspaper with a sports section and a technology section. add a sports page and a tech page to your site, each one with a specific banner you want the articles to appear in the appropriate pages, but you know in liferay articles are not related to pages. often as you like in different web content display portlets or in configured but if you have a view in context link, where will you show this is where you'd use a default display page. a default display page defined are shown with other related articles in imagine you have 100 sports articles and 100 tech articles. of liferay you'd need to create a page for each article to show it. only one sports page and one tech page, you can show all articles in one place there are two ways of creating a display page. page template, which automatically creates everything you need, or you can the content display page template is found under page templates in the sites section of the control panel to create a display page manually, add an asset publisher to a page. it the default asset publisher for the page. this defines this asset publisher as the one that displays the content if several asset publishers are on the same set this up by clicking configuration on your asset publisher. setup tab, navigate to display settings and check the checkbox labeled set as the default asset publisher for this page once you've given an article its default display page, links to the article redirect the user to its default display page. asset publisher to another page, like the home page of the newspaper, and configure it to view in a specific portlet. you'll be redirected to the default display page of the article you now see that the link looks something like this this is an example of a canonical url, and it's a nice enhancement for search engine optimization seo because the article's url becomes the page url. search engine that's crawling your site, this means that the location of your and if you decide to use the content on another page in the future, the article is still available at this url. search results, in related assets and in asset publishers. on liferay's display pages, see the content display pages related assets enables you to connect any number of assets within a site or across the portal, even if they don't share any tags and aren't in the same you can connect your content to a blogs entry, message boards message, web content, calendar event, bookmarks entry, documents and media document, and figure 2.20 this blog entry has links to three related assets one web content and two message board entries you'll learn how to publish links to related assets using the related assets permissions customize who has access to the content. viewable by anyone guest role. you can limit viewable permissions by selecting any role from the drop-down or in the list. provides the ability to customize permissions in more detail. options link next to the drop down button and you'll find the different activities you can grant or deny to your web content while you can set permissions here, they will be ignored unless web content article permissions are activated in your portal properties. permission check for web content articles you need to set the url file, and restart liferay. permissions you set in the article's configuration will be checked before custom fields customize metadata about the web content. represent anything you like, such as the web content's author or creation date. if custom fields have been defined for web content which can be done from the custom fields page of the control panel, they appear here for more information on custom fields see the for this piece of web content, we don't need to change anything. finished with permissions, click save as draft. once you're satisfied with your changes, select publish. makes the content available for display, but we still have some work to do to in liferay wcm, all content resides in a container, which is one of two portlets web content display or web content list. the most frequently used is the web content display portlet. now that we've created and published our first piece of web content for the lunar resort, it's time to display it. first, add the web content display portlet to our welcome page by selecting the add button from the left palette and selecting the applications tab figure 2.21 adding the web content display portlet once the portlet appears, drag it to the position on the page where you want you can have as many web content display portlets on a page as you need, which gives you the power to lay out your content exactly the to add existing web content, click the select web content button on the lower you will see the message please select a web content from naturally, if your content appears in the list, you can simply select it. there is lots of published content available, you could search for the content by name, id, type, version, content and site click the advanced gear to see you can also show the available locales for your content. you're working on the page for a particular language, you can select the translation of your content that goes with your locale. translating your content, visit the figure 2.22 publishing web content is a snap. at a minimum, you only have to select the content you wish to publish. you can also enable lots of optional features to let your users interact with your content if you have enabled url integration with your portal, you can also this gives your users the ability to download your content in their format of choice. you are running a research or academically oriented site; users can very quickly download pdfs of your content for their research projects note that you also have other options, such as enabling a print button, enabling ratings so users can rate the content, enabling comments and enabling ratings on the print button pops the content up in a separate browser window that contains just the content, without any of the web site navigation. enabling ratings shows one of two ratings interfaces liferay has five stars or thumbs up and thumbs down. properties document for further information enabling comments creates a discussion forum attached to your content which users can use to discuss your content. enabling ratings on comments gives your users the ability to rate the comments. you may decide you want one, some or none of these features, which is why they're all implemented as simple check boxes to be enabled or disabled at need if you click the supported clients tab, you'll see you can choose the type of client to which you want to expose content. screens of users' computers for expansive graphics and lots of special effects or target the small screens of mobile devices with pertinent information and a for now, leave both checked and click the save button. can now close the configuration window to publish new content, select the add button on the lower left of the this launches the same full-featured editor you've already seen in the control panel, which lets you add and edit content in place as you are working this is another example of the flexibility that liferay portal offers. you may want to add content directly into the web content display portlet of the page you're managing, especially if you are in the process of building the page. at other times, you may want to navigate to site administration to create content, because at that moment you're more concerned with the creation of the content and not where the content will later be displayed. editing content that's already been published is just as easy as creating new you'll use the same exact tools once the content is displayedwhether you've selected content or created it in the web content display portletyou can edit the content directly from the web content display portlet or from the control panel. content display portlet, select the edit button to the lower left of the this launches the wysiwyg editor and from there you can make any figure 2.23 the edit, select web content, and add buttons appear when hovering over their icons when you publish updates to a web content that's already being displayed somewhere on your portal e.g., in a web content display portlet or an asset publisher portlet, the content is immediately updated unless, of course, you have a workflow enabled, which we'll discuss below. whether you edit it from a web content display portlet, from the asset publisher, or from the site administration interface note if you want to view your page the way your users will see it i.e., without all those portlet controls and icons, go up to the left palette and this makes all those extra controls you see as you'll also notice the green eye transforms if you need to use those controls again, just select edit controls to return to the original format that's pretty much all there is to simple content creation. but if you want to take advantage of the full power of liferay's wcm, you'll want to use structures and templates found in the advanced web content management next, let's see how you can manage your content with an approval";;
"as stated in the building a site with liferay web content section, a site is a set of pages that can be used to publish content or sites can be independent or they can be associated with an organization and serve as the website for that organization. can create as many different sites as you like within the context of a single you can use sites in liferay to build many different kinds of websites. you're building a large corporate website, a company intranet, or a small site designed to facilitate collaboration among team members, liferay's framework provides all the tools you need. to support different kinds of collaboration and social scenarios, liferay's sites provide three membership types open users can become members of the site at any time. restricted users can request site membership but site administrators must approve requests in order for users to become members. private users are not allowed to join the site or request site membership. private sites don't appear in the my sites portlet. still manually select users and assign them as site members in addition to these memberships, when a site is associated with an organization, all the users of that organization are automatically considered members of a site can be given additional privileges within the site by using it is also possible to assign different roles within the site to different members. this can be done through site roles which are defined equally for all sites or teams which are unique for each as of liferay 6.2, sites can be organized hierarchically, just like the difference between sites and organizations, of course, is that sites are used to organize pages, content, application data, and users via site memberships whereas organizations are only used to group users. sharing is available for sites within the same hierarchy. parent site has a document called lunar goals and objectives and would like for all its subsites to have a copy, the parent site's administrator can enable content sharing to automatically share the document with its subsites, instead of having to send each site the document individually. privileges can be set to let every site administrator share content across sites please refer to the sites admin portlet section of liferay's url file for a list of relevant configurable properties. url property allows you to disable content sharing between sites and subsites, disable it by default while allowing site administrators to enable it per site, or to enable it by default while allowing administrators to disable it per site the sites directory portlet is a configurable portlet that can allow users to view a hierarchy of sites and subsites. it enables users to navigate to any of to use this portlet to display site hierarchies, add it to a page, open its configuration window, and under display style, select list the site map portlet is another configurable portlet that's intended to help users navigate among pages within a site. a site administrator can select a root page and a display depth. can be organized hierarchically, so can the pages within a site. depth of the site map portlet determines how many levels of nested pages to figure 2.3 the site directory portlet can allow users to navigate between sites organized hierarchically. the site map portlet can allow users to navigate among pages of site organized hierarchically liferay's sites have two categories of pages called page sets. kinds of page sets public pages and private pages. pages, only private pages or both. private pages can only be accessed by site public pages can be accessed by anyone, including users who haven't it's possible to restrict access to pages at the page set level or at the level of individual pages through the permission system. private pages have different urls and can have different content, applications, building a corporate intranet is a typical use case for liferay sites. corporate intranet could have sites for all the organizations in the company sales, marketing, information technology, human resources and so on. about the corporate health and fitness center? that's something everybody in the company, regardless of organization, may want to join. candidate for an open and independent site. corporate intranet should probably be placed in an open independent site so any member of the portal can access it tip prior to liferay 6.1, there were two ways of creating sites this has been simplified to provide more ease of use and allow for more flexibility. the main role of organizations is still to organize the users of the portal in a hierarchy but they can also have communities can still be created through independent sites but the new name reflects the fact that sites can be used for many different for other kinds of web sites, you may want to use independent sites to bring users together who share a common interest. if you were building a photo sharing web site, you might have independent sites based on the types of photos people for example, those who enjoy taking pictures of landscapes could join a landscapes site and those who enjoy taking pictures of sunsets could join liferay always provides one default site, which is also known as the main site this site does not have its own name but rather takes the name of by default the portal name is url but this value can be changed through the simple configuration of the setup wizard. can also be changed at any time through the control panel within portal sites can be created through the control panel by a portal administrator. liferay's control panel provides an administrative interface for managing your there are four main sections of the liferay's control panel users, sites, apps, and configuration. in this section, we'll learn how to use the in the next section, we'll learn about using the control panel to manage site templates and page templates. the apps, users, and configuration sections of the control panel, please see the leveraging the liferay marketplace, tip prior to liferay 6.2, the control panel included interfaces both for site administration and for portal administration. interfaces have been separated. if you're signed in as an administrator, you can access the liferay 6.2 control panel by clicking admin control panel. to manage a single site, navigate to the site by clicking on my sites and then click on admin site administration. the site administration interface allows to configure site settings and manage the pages, content, and users of the site to add a site, click on sites under the sites section of the control panel and if there is at least one site template available, a dropdown site templates provide a preconfigured set of pages, portlet applications, and content that can be used as the basis of a site's public or to create a site from scratch, select blank site. select the name of the site template you'd like to use. site from a site template, you have to choose whether to copy the site template's pages as your new site's public or private page set. templates are created, they will appear in the add menu as they become the following figure shows the form that needs to be filled when figure 2.4 the new site window aids in your new site development name is the name of the site you wish to create description describes the site's intended function active determines whether a site is active or inactive. inaccessible but can be activated whenever a site administrator wishes membership type can be open, restricted or private. the my sites portlet and users can join and leave the site whenever they want. restricted site is the same except users must request membership. administrator must then explicitly grant or deny users' requests to join. private site does not appear in the my sites portlet and users must be added to it manually by a site administrator allow manual membership management determines whether to allow or disallow users to be manually added or removed from the site. membership management is enabled. this allows administrators to manually assign it also allows users to join open sites or request membership from restricted sites using the my sites portlet. site membership management is disabled, by default. members to be automatically assigned membership following the organization's also, because manual membership management is disabled for organization sites, by default, the users section of site administration is to activate the users functionality for your organization site, you'll need to check allow manual membership management after creating the organization site by navigating to its site settings menu note it's possible for site memberships to be handled automatically by a the membership policy can check various pieces of information from each user, such as their first names, last names, birthdays, job titles, organizations, and user groups. using this information, the site membership policy can automatically assign members to the site. when the allow manual membership management option is disabled, the users section of site administration site memberships and site teams is hidden, even from administrators directory indexing enabled allows site administrators to browse the site's documents and media files and folders. for example, a site administrator of a site called lunar resort can browse documents at if this option is enabled parent site lets you select a parent site for the site that's being as of liferay 6.2, sites can be organized hierarchically. hierarchical sites provides a simplified way to manage site memberships and site for organizations that have attached sites, the organization hierarchy should match the site hierarchy. when you select a parent site, an additional option appears limit membership to members of the parent site. this option is enabled, the site's membership policy performs a check so that you can only assign members to the current site if they're already members of once you've created a site, it appears in the sites page of the control panel. once the site has been created you can specify more details about the site using three categories basic information, search engine optimization, advanced, and we'll go into more detail for your site's settings in the site settings section later in the chapter when creating a site from a site template, the initial form provides a new option that lets you decide if you want to copy the pages from the template as public pages or as private pages. by default, the site is linked to the site template and changes to the site template propagate to any site based on it. checkbox appears that allows users to unlink the site template if the user has now that our new site is created, lets learn how to create and manage its pages you have a few options for accessing and configuring your site's page editing there are three interfaces to be aware of site pages, page, and these interfaces all deal with your site's pages, however, each interface is configurable in a different place and completes different from the site administration page, your site pages can be accessed and if you're already on your desired site, you can reach the site administration page by navigating to the admin tab in the dockbar and if you're not currently on the site you'd like to edit, go to my sites in the dockbar and select your desired site. you're on the site administration page, select site pages if necessary under the pages tab from the left panel. you can also use the pages shortcut which is also listed under the admin tab figure 2.5 the site pages interface allows you to edit your site pages as a whole to add new pages to your site, click the add icon from the left palette and this is the page interface, which offers a plethora of options for your new page including name, site layout, and site template to manage the specific page of the site you've navigated to, click the edit this will only edit the specific page you're figure 2.6 the edit page interface allows you to edit the current page you're on site pages is an interface to view existing pages, create new pages, view pages and export or import pages using liferay archive lar files. you can switch between managing a set of pages and managing a single page using the left-hand side navigation menu. click on public pages or private pages to manage the group or click on an individual page to manage just that one. switching views like this changes the list of available tabs to the right. default, url, which we renamed to url, contains a single liferay's page groups are always associated with sites. pages are part of their personal sites. all pages belong to one of two types of page sets public pages and private pages. accessible to anyone, even non-logged in users guests. accessible only to users who are members of the site which owns the pages. means the private pages of an organization's site would only be viewable by site members and members of the organization regardless of whether the pages are public or private, liferay uses the same let's look at this interface more closely from the site pages interface in site administration, you can add a page to the site by clicking the add page button. because public pages is selected on the left, clicking add page here adds a top level page next to the welcome you can, however, nest pages as deeply as you like. under the welcome page, select the welcome page first and then create your if you later decide you don't like the order of your pages, you can drag and drop them in the list to put them in whatever order you want. and add another top level page and name it community. the recent bloggers and wiki portlets figure 2.7 you can add a page to your site by giving it a name, page template, and page type when you create a new page, you can create either a blank page or a page prepopulated with portlets from a page template. of the page, you can select from a list of page templates that are currently to view the pages once you add them, click the view pages button. this is how you'd populate your pages with content and applications. covered in succeeding chapters. page types include layout, panel, embedded, link to url, and link to a page of this site. all pages are created as portlet pages but in some situations you might want to layout the pages we're usually talking about. which you can drag and drop portlets into. most of the pages you create will be panel can have any number of portlets on them, as selected by an administrator, but only one will be displayed at a time. portlet they want to use from a menu on the left side of the page and the selected portlet takes up the entire page embedded display content from another website inside of your portal. an administrator can set a url from in the page management interface and that page will appear in the context and within the navigation of your liferay to embed an external website, you must provide the protocol in the url link to url are just redirects to any url specified by an administrator. you can use url pages to create links to pages belonging to other sites of your portal or to pages of an external site. use url pages cautiously since blind redirects create a poor user experience link to a page of this site creates a portal page which functions as an immediate redirect to another page within the same site. page to link to from a dropdown in the page management interface. a link to a page of this site to place a deeply nested page in the primary navigation menu of your site, for example to use the edit page interface to modify an existing page, navigate to the left palette and select the edit icon. notice that it's not possible to add a new this is because you're only managing the current page once you've created pages and populated them with content, liferay provides a way for you to back them up to separate files. next to the add page button on the site pages screen, there are two buttons the export button allows you to export the your site's data as a single file, called a lar liferay archive file. importing data into a site, it's best to use a newly created site to avoid potential conflicts between the existing site data and the data about to be when exporting site data, you can specify exactly what data should be once you've created a lar file, you can import it into a site on another liferay the data included in the lar file, including all the site pages, will exporting and importing lars is a great way to take content from a site in one environment say, a development or qa environment and move it all in one shot to a site on another server. import data onto production servers, but you should not make this a regular if you want to regularly move pages from one server to another, you should use liferay's staging environment, which we discuss in the advanced web content management lars can be a good way to back up your site's content. specific location on your server which is backed up. your site, all you need to do is import the latest lar file. if there's any content that exists both in the lar and in the site that's importing the data, there may be a conflict, and data could be if you'd like to restore a liferay site using a lar file, it's best to delete the site entirely, create a new site with the same name as the old one i.e., re-create the site, and then import the lar file into the new site. this way, there's no chance for there to be a data conflict liferay can handle some kinds of naming collisions when importing a lar file for example, suppose you're importing a lar file into a site and the lar file has a page with a certain friendly url. site has the same friendly url there will be a collision. collision by adding a number to the end of the friendly url and incrementing this behavior takes place for friendly url similarly, if importing a lar into a site causes a category name collision, liferay renames the imported categories note lar files are version dependent. you can't import a lar file that was exported from one version of liferay into a liferay server that's running a also, note that periodically exporting lars is not a complete backup solution; please refer to the section for information on backing up liferay let's be good administrators and export a lar file for backup purposes. the export button and then name the file url. boxes to determine what you'd like to export. for this initial export, select note that if you select one of the choose radio selectors or change links, you're given checkboxes for options to choose. content can also be selected for export, including the documents and media library, message boards, and web content assets. once you click export, your browser prompts you to save the file. have the file, you can copy it to a backup location for safekeeping or import it into another installation of liferay portal. revert back to this version of your site, you can import this file by clicking the import button from the site pages dialog box, browsing to it and next, we'll look at the options on the right side menu, starting with look and when you open site pages from within site administration, it defaults to the on this tab, you're presented with an interface that allows you to choose a theme for the current site. themes can transform the entire look they are created by developers and are easily installed using the since we don't have any themes beyond the default one installed yet, we'll use the default theme for our pages figure 2.8 the look and feel interface allows you to choose a theme for the current site many themes include more than one color scheme. existing look and feel while giving your site a different flavor. color scheme from blue to green by selecting dark under color schemes. you now go back to the site by clicking the left arrow in the top left corner of the dockbar, you'll see some parts of the page are now tinged if you apply a color scheme to a set of public or private pages, it is, by default, applied to each page in the set. if, however, you click the edit page button from the left palette of a specific page, you can select define a specific look and feel for this page from the look and feel tab to make the color scheme apply to this page only. you can use this feature to choose a different color scheme for a particular page than the one defined for the set of public or private pages to which it belongs there are a few more configurable settings for your theme. bullet style between dots and arrows and you can choose whether or not to show starting in liferay 6.2, wap related technologies have been deprecated. particular, the ability to modify themes for regular browsers and mobile devices can now only be accomplished using mobile device rules, which can be found in you can learn more about using mobile device rules in the displaying site pages to mobile devices you can enable the wap functionality for your portal's look and feel section by openingcreating your url file in your liferayhome directory and setting wap functionality will be completely removed from liferay in the next release the css section allows you to enter custom css that will also be served up by in this way, you can tweak a theme in real time by adding new styles the next option configures the logo that appears for your site by default, the liferay logo is used for your site pages' logo. use your own logo for a specific site, use the logo tab. is easy select the logo tab from the site pages interface and browse to the make sure your logo fits the space in the top left corner of the theme you're using for your web site. if you don't, you could wind up with a site that's difficult to navigate, as other page elements are pushed in the logo tab, you can also choose whether or not to display the site name on if you check the box labeled show site name the site name will this option is enabled by default and cannot be disabled if the allow site administrators to set their own logo option is removing the site name is not available for the default site only newly created sites and user pages have the option to have if you click on javascript from the site pages interface for a page set either public pages or private pages, you'll find a window where you can enter javascript code the will be executed at the bottom of every page in the site. if your site's theme uses javascript as is usually the case, it's best to add custom javascript code to the theme and not in this window. your site's javascript code remains in one place using the javascript window of your site's site pages interface may be useful if your site's theme does not use javascript. in this case, the javascript window of your site's site pages interface will contain all of your site's javascript and you can add some dynamic features to your site's pages next, let's look at an advanced feature of the site pages interface merging the current site's pages with the pages of the default site if you click on advanced from the site pages interface for a public page set, you'll find an option to merge the public pages of your portal's default site with the public pages of the current site. if you enable this option, the pages of the default site appear in the current site's navigation bar, along with the also, the pages of the current site appear in the navigation bar of the default site, along with the default site's pages. merging of pages only affects the list of pages in the default site's and the current site's navigation bars. this allows users to more easily navigate from the current site to the default site, and vice versa. enabled for the public pages of both personal sites and regular sites note that this merging of pages is not a hard merge. that the site administrators of twenty different sites on your portal all enabled the merge default site's public pages option. these different sites be merged into each site's navigation bar? instead, the portal keeps track of the current scopegroupid the id of the current site and the previous scopegroupid the id of the if the merge default site's public pages option is enabled for either the current site or the previous site, the pages of the default site are merged in the pages of the other site for example, suppose that your portal has three sites the default site, site a, and site b. all three sites have some public pages. default site's public pages option enabled, site b does not. logs in, he's directed to the default site. the scopegroupid is that of the default site and there is no previous scopegroupid, so no additional pages appear in the default site's navigation bar. then suppose the user navigates to site a. site a has the merge default site's public pages option enabled, so the default site's pages are added to site a's navigation bar. goes back to the default site, site a becomes the previous site so site a's pages are added to the default site's navigation bar. site b, no additional pages appear in site b's navigation bar because site b does not have the merge default site's public pages option enabled. user navigates back to the default site, site b becomes the previous site, and, again, since site b does not have the merge default site's public pages option enabled, no additional pages are added to the default site's navigation menu next, let's examine how to configure individual pages when you use the edit page interface for a single page, some different options details lets you name the page for any localizations you need, set whether the page is hidden on the navigation menu, set an easy to remember, friendly url for the page, and select the page type. plus you can specify how portlets are choose from the available installed templates to modify the it's very easy for developers to define custom layouts and add them to this is covered more thoroughly in both the liferay developer's seo provides several means of optimizing the data the page provides to an indexer that's crawling the page. you can set the various meta tags for description, keywords and robots. there's also a separate robots section that lets you tell indexing robots how frequently the page is updated and how it if the page is localized, you can select a box to make liferay generate canonical links by language. if you want to set some of these settings for the entire site, you can specify them from the sitemaps and robots tabs of the manage site settings dialog box see below note in previous versions of liferay, it was possible that a single page could be indexed multiple times. in liferay 6.1, all urls that direct to the same page will only create one entry in the index. versions of the url which provided additional information about the referring page had different entries in the index. as of liferay 6.1, each asset web point of view, this will make your pages rank higher since any references to variations of a specific url will all be considered references to the same look and feel lets you set a page-specific theme javascript gives you the ability to paste custom javascript code to be custom fields if custom fields have been defined for pages which can be done from the custom fields page of the control panel, they appear here. these are metadata about the page and can be anything you like, such as author advanced contains several optional features. this can become useful to web content templates, which you'll see in the next chapter. you can set a target for the page so that it either pops up in a particularly named window or appears in a frameset. you can set an icon for the page that appears in the navigation menu mobile device rules allows you to apply rules for how this page should be rendered for various mobile devices. you can set these up in the mobile device rules section of site administration embedded portlets only appears if you have embedded one or more portlets on to embed a portlet on a page, first look up its portlet name in url are sometimes referred to as portlet ids. mean by portlet names, url refers to as display names. next, add a web content display content to the page, create a new web content article, switch to source, and paste in the following then add the portlet name id inside of the quotation marks, publish the web content article, and select the article in the web content display portlet. you've selected the new web content article, the embedded portlet appears on the note usually, you don't want the web content display portlet that you're using to embed a portlet to be visible. to make the web content display portlet invisible, click on the gear icon of the web content display portlet, select look and feel, set show borders to no, and click save. refreshed the page, only the embedded portlet will be visible customization settings lets you mark specific sections of the page you want next, we'll run practice modifying page layouts! page layouts allow you to arrange your pages so the content appears the way you liferay comes with many layouts already defined. create more and they can be deployed to your portal for your use to prepare for the portlets we'll soon be adding, let's change the layout of the to access layouts, select the edit icon from the left palette and click the details tab if necessary now, select the 2 columns 7030 layout and click save. return to the page and it'll seem as though nothing has happened. adding portlets, however, you'll notice the page is now equally divided into two you can stack portlets on top of each other in these columns. are, of course, more complicated layouts available and you can play around with them to get the layout you want sometimes a particular layout is almost what you want but not quite. case, use the nested portlets portlet to embed a layout inside another layout. this portlet is a container for other portlets. the layouts installed in liferay, just like the layouts for a page. you virtually unlimited options for laying out your pages the next option we'll explore is page customizations with page customizations, any user with the appropriate permissions can create personalized versions of any public page. before users can create personalized versions of pages, customizations must first be enabled by an administrator. administrators can activate or deactivate customizations for any row or column when users customize a page, they have the option to use either their version or the default version of a page. versions of pages other than their own figure 2.9 during page customization, individual columns change colors to indicate whether they are selected or not to activate page customizations, click the edit page button from the left palette and select the customization settings tab. customizable sections to view and modify sections on your page when an administrator activates page customizations for a page, any portlets that are in a customizable row or column can be moved around the page or users can add new portlets of their own choosing to these columns of the page and can also customize portlet configurations. time users determine they don't like their customizations, they can click reset my customizations to revert their pages back to the default. information about page customizations, please refer to the now that you know how to enable page customizations, let's look at the settings as with site pages, you can access site settings by navigating to site administration and clicking site settings from the configuration section on you can also select the site administration sub-tab configuration from the admin drop-down figure 2.10 the site settings window offers a plethora of options for your site you'll find options to specify details and metadata about your site, set up friendly urls and virtual hosts, configure search engine optimization settings, turn staging on or off and specify a google analytics id. details allows an administrator to change the description and membership type of a site and also to specify tags and categories for the site. membership type can be set as open, restricted or private based on the privacy users can join and leave an open site at will. restricted site, a user has to be added by the site administrator. also request to be added through the sites section of the control panel. private site is like a restricted site but doesn't appear in the sites section of the control panel for users who aren't members categorization allows you to apply categories and tags to the site site url set a friendly url andor a virtual host for your site here. friendly url option lets you manage the path to your site in";;
suppose that you've been assigned the task of building a web site for an innovative new company called lunar resort, inc. you've decided to take advantage of liferay portal and its rapid deployment features as well as its ability to get a fully functional, content-rich web site with integrated social features up and running in little time. through the creation of the lunar resort's web site, starting by creating and publishing some simple content using liferay's built-in wysiwyg editor. next chapter, we'll take advantage of liferay's robust structure editor. we'll use templates to display the content and then explore some of the advanced publishing features such as the built-in workflow and asset publisher if we're going to be the lunar resort, our portal should also be called lunar resort. to set general information about your portal like the name and mail domain, go to the control panel and select portal settings under the configuration heading. you could set up the configuration for the lunar resort as follows figure 2.2 you can change the portal settings by navigating to the control panel and selecting portal settings you can also customize the logo in the top left corner of every page by selecting display settings under the miscellaneous tab on the panel to the once you've made the changes, we can begin creating pages. products, you would learn what the software can do in terms of setting up your users and security model and then start building your system. infrastructure and get your server environment up and running while your developers write the applications that live on your web site. portal, however, you start farther ahead. liferay portal is more than just a container for applications with a robust security model. many of the applications you'll need, out of the box. ready to go and are integrated with the rest of liferay's user management and;;
your ios project to use liferay screens, you can use screenlets in your app. there are plenty of liferay screenlets available, and they're described in the this tutorial shows you how to insert and configure screenlets in ios apps written in swift and objective-c. it also explains how to localize them. be a screenlet master in no time! the first step to using screenlets in your ios project is to add a new uiview to in interface builder, insert a new uiview into your storyboard or figure 1 add a new uiview to your project next, enter the screenlet's name as the custom class. using the login screenlet, then enter login screenlet as the class figure 2 change the custom class to match the screenlet now you need to conform the screenlet's delegate protocol in your for example, the login screenlet's delegate class is this is shown in the code that follows. need to implement the functionality of onloginresponse and onloginerror. this is indicated by the comments in the code here if you're using cocoapods, you need to import liferay screens in your view now that the screenlet's delegate protocol conforms in your viewcontroller class, go back to interface builder and connect the screenlet's delegate to your if the screenlet you're using has more outlets, you can assign note that currently xcode has some connecting outlets to swift source code. to get around this, you can change the delegate data type or assign the outlets in your code. declare an outlet to hold a reference to the screenlet. interface builder without any issues figure 3 connect the outlet with the screenlet reference assign the screenlet's delegate the viewdidload method. the connection typically done in interface builder these steps are shown in the following code for login screenlet's view figure 4 connect the screenlet's delegate in interface builder now you know how to use screenlets in your apps. screenlets from objective-c code, follow the instructions in the next section if you want to invoke screenlet classes from objective-c code, there is an additional header file that you must import. liferayscreens-swift.h in all your objective-c files or configure a the first option involves adding the following import line all of your alternatively, you can configure a precompiler header file by following these create a precompiler header file e.g., url and add it to import liferayscreens-swift.h in the precompiler header file you just edit the following build settings of your target. pathtoyourfile with the path to your url file figure 5 the url configuration in xcode settings you can use the precompiler header file now you know how to use screenlets from objective-c code in your apps to implement localization in your screenlet. note even though a screenlet may support several languages, you must also support those languages in your app. other words, a screenlet's support for a language is only valid if your app to support a language, make sure to add it as a localization in your project's settings figure 6 the xcode localizations in the project's settings you now know how to use screenlets in your ios apps preparing ios projects for liferay screens using screenlets in android apps;;
"using a liferay screens theme, you can set your screenlet's ui components, they let you focus on a screenlet's ui and ux, without having to worry about its core functionality. several themes, and more are being developed by liferay and the community. liferay screenlet's themes are specified in its this tutorial shows you how to use themes in your ios screenlets to install a theme in your ios app's screenlet, you have two options, depending on how the theme has been published if the theme has been packaged as a cocoapods pod dependency, you can install it by adding a line to your podfile make sure to replace liferayscreensthemename with the theme's if the theme isn't available through cocoapods, you can drag and drop the theme's folder into your project. liferay screens detects the new classes and then applies the new design in the runtime and in interface builder figure 1 to install a theme into an xcode project, drag and drop the theme's folder into it to use the installed theme, specify its name in the theme name property field of the base screenlet in interface builder. themes are listed in the themes section of the screenlet's if you leave the theme name property blank or enter a name for a theme that can't be found, the screenlet's default theme is used figure 2 in interface builder, you specify a screenlet's theme by entering its name in the theme name field; this sets the screenlet's themename property the initial release of liferay screens for ios includes the following themes for now you know how to use themes to dress up this opens up a world of possibilitieslike preparing ios projects for liferay screens architecture of liferay screens for ios using views in android screenlets";;
tutorial shows you how to display from a liferay portal site in your android app. displaying content is great, but what if you want to display an entire page? you can even customize the page by injecting local or remote javascript and css files. when combined with liferay portal's server-side customization features e.g., web screenlet gives you almost limitless possibilities for displaying web pages in this tutorial, you'll learn how to use web screenlet to display web pages in inserting web screenlet in your app is the same as inserting any screenlet in your app insert the screenlet's xml in the layout of the activity or fragment you also be sure to set any attributes that you for a list of web screenlet's available attributes, see of the web screenlet reference doc for example, here's web screenlet's xml with the screenlet's layoutid and autoload attributes set to webdefault and false, respectively note that webdefault specifies the screenlet's default view, which is to use a view that is part of a view set, like the default view, the app or activity theme must inherit the theme that sets the view set's styles. the default view set, this is defaulttheme. theme to inherit defaulttheme, open url and set the base app theme's parent to defaulttheme. next, you'll implement web screenlet's listener to use any screenlet in an activity or fragment, you must also implement the screenlet's listener in that activity or fragment's class. follow these steps to implement weblistener change the class declaration to implement weblistener, and import the screenlet loads the page successfully. how you implement it depends on what if anything you want to happen upon page load. onpageloaded implementation displays a toast message indicating success the namespace argument is the source namespace key, and the body argument is the source namespace body. onscriptmessagehandler implementation parses data from the source namespace body if it matches a specific namespace, and then starts a new activity with that data via an intent this method is called when an error occurs in the e argument contains the exception, and the useraction argument distinguishes the specific action in which the error occurred. most cases, you'll use these arguments to log or display the error. example, this error implementation displays a toast message with the get a webscreenlet reference and set the activity or fragment class as its add the following code to the end of the oncreate method note that the findviewbyid references the androidid value set in the next, you'll use the same webscreenlet reference to set the screenlet's web screenlet has webscreenletconfiguration and webscreenletconfiguration.builder objects that supply the parameters the these parameters include the url of the page to load and the location of any javascript or css files that customize the page. set most of these parameters via webscreenletconfiguration.builder's methods note for a full list of webscreenletconfiguration.builder's methods, and a description of each, see the table in of web screenlet's reference doc to set web screenlet's parameters, follow these steps in the method that initializes the activity or fragment containing the screenlet e.g., oncreate you can, however, do this in other use webscreenletconfiguration.builder , where is the web page's url string, to create a webscreenletconfiguration.builder object. if the page requires liferay portal authentication, then the user must be or a sessioncontext method, and you must provide a relative url to the page's full url is url, then the constructor's argument is webguestblog. for any other page that doesn't require portal authentication, you must supply the full url to the call the webscreenletconfiguration.builder methods to set the parameters note if the url you supplied to the webscreenletconfiguration.builder constructor is to a page that doesn't require liferay portal authentication, then you must call the webscreenletconfiguration.builder method is liferayauthenticated, which is required to load portal pages that if you need to set liferayauthenticated manually, call setwebtypewebscreenletconfiguration.webtype.liferayauthenticated call the webscreenletconfiguration.builder instance's load method, which returns a webscreenletconfiguration object use web screenlet's setwebscreenletconfiguration method to set the webscreenletconfiguration object to the web screenlet instance call the web screenlet instance's load method here's an example snippet of these steps in the oncreate method of an activity in which the web screenlet instance is screenlet, and the webscreenletconfiguration object is webscreenletconfiguration the relative url webwesteros-hybridcompanynews supplied to the webscreenletconfiguration.builder constructor, and the lack of a setwebtypewebscreenletconfiguration.webtype.other call, indicates that this web screenlet instance loads a liferay portal page that requires authentication. the addrawcss method adds the css file url from the resraw the addlocalcss and addlocaljs methods add the local files now you know how to use web screenlet in your android apps using web screenlet with cordova in your android app using screenlets in android apps;;
by creating your own themes, you can customize your mobile app's design and you can create them from scratch or use an existing theme as a themes include a view class for implementing screenlet behavior and an xib file for specifying the ui. the three liferay screens theme types support different levels of customization and parent theme inheritance. child theme presents the same ui components as its parent theme, but lets you change their appearance and position extended theme inherits its parent theme's functionality and appearance, but lets you add to and modify both full theme provides a complete standalone view for a screenlet. theme is ideal for implementing functionality and appearance completely different from a screenlet's current theme this tutorial explains how to create all three types. concepts and components, you might want to examine the can help you create any screenlet classes your theme requires. after determining the type of theme to create, you need to decide where to if you want to reuse or redistribute it, you should create it in an empty cocoa touch framework project in xcode. tutorial explains how to package and publish with cocoapods. not planning to reuse or redistribute your theme, you can create it directly the rest of this tutorial explains how to create each type of theme. you'll learn how to create a child theme in a child theme, you leverage a parent theme's behavior and ui components, but you can modify the appearance and position of the ui components. can't add or remove any components and the parent theme must be a full theme. the child theme presents visual changes with its own xib file and inherits the for example, the child theme in figure 1 presents the same ui components as the default theme, but enlarges them for viewing on devices with larger screens figure 1 the ui components are enlarged in the example child theme's xib file you can follow these steps to create a child theme in xcode, create a new xib file that's named after the screenlet's view by convention, an xib file for a screenlet with a view class named fooscreenletview and a theme named bartheme must be named you can use content from the parent theme's xib file as a foundation for your new xib file. change the ui components' visual properties e.g., their position and size. you mustn't change, however, the xib file's custom class, outlet connection, or restorationidentifier these must match those of the parent's xib file the xib file name serves as the theme's xcode name. in figure 1 inherits from the login screenlet's default theme, which uses the view class loginviewdefault. the new child theme is named large because it's purpose is to enlarge the screenlet's ui components. it's assigned the theme name large. url, after the login screenlet's view class and the next, you'll learn how to create an extended theme an extended theme inherits another theme's ui components and behavior, but lets you add to or alter it by extending the parent theme's view class and an extended theme's parent must be a full theme. these steps explain how to create an extended theme in xcode, create a new xib file named after the screenlet's view class and by convention, an xib file for a screenlet with a view class named fooscreenletview and a theme named bartheme must be named you can use the xib file of your parent build your ui changes in your new xib file with figure 2 this example extended theme's xib file extends the login portlet's ui and behavior with a switch that lets the user show or hide the password field value create a new view class that extends the parent theme's view class. should name this class after the xib file you just created. override functionality of the parent theme's view class set your new view class as the custom class for your theme's xib file. if you added or actions, bind them to your class now you know how to create and use an extended theme. a full theme implements unique behavior and appearance for a screenlet, without its view class must inherit screens's and conform to the screenlet's view model protocol. as you create a full theme, you can refer to the tutorial to learn how to create these classes follow these steps to create a full theme create a new xib file and use interface builder to build your ui. convention, an xib file for a screenlet with a view class named fooscreenletview and a theme named bartheme must be named you can use the xib file from the screenlet's default theme as a template figure 3 this full theme for the login screenlet, includes a text field for entering the user name, uses the udid for the password, and adds a sign in button with the same restorationidentifier as the default theme create a new view class for your theme named after the xib file you just as a template, you can use the view class of your screenlet's your new view class must inherit and conform to the screenlet's screenletviewmodel protocol, implementing the corresponding getters and setters. properties or methods you need to bind your ui set your theme's new view class as your xib file's custom class and bind now you know how to create a full theme. note that a full theme can serve as a parent to a child and extended theme architecture of liferay screens for ios;;
"liferay screens separates its presentation and business-logic code using ideas canonical implementation of these architectures because they're designed for screens isn't an app; it's a suite of visual components intended for use this tutorial explains the architecture of liferay screens for ios. with an overview of the high level components that make up the system. includes the core, screenlets, and themes. these components are then described in detail in the sections that follow. after you get done examining screens's building blocks, you'll be ready to create some amazing screenlets and themes! liferay screens for ios is composed of a core, a screenlet layer, a view layer, server connectors are technically part of the core, but are worth describing separately. they facilitate interaction with local and remote data sources and communication between the screenlet layer and the figure 1 the high level components of liferay screens for ios each component is described below core includes all the base classes for developing other screens components. it's a micro-framework that lets developers write their own screenlets, views, screenlets swift classes for inserting into any uiview. selected theme in the runtime and in interface builder. events to start server requests via server connectors, and define a set of properties that can be configured from interface builder. screenlets bundled with liferay screens are known as the screenlet library interactors implement specific use cases for communicating with servers or interactors can use local and remote data sources by using server connectors or custom classes. if a user action or use case needs to execute more than one query on a local or remote store, the sequence is done in if a screenlet supports more than one user action or use case, an interactor must be created for each connectors or server connectors a collection of classes that can interact with local and remote data sources and liferay instances. connectors, liferay connector, use the all server connectors can be run concurrently since they use the it's very easy to define priorities and dependencies between connectors, so you can build your own graph of connectors aka operations that can be resolved by connectors are always created using a so they can be injected by the app developer themes a set of xib files and accompanying uiview classes that present the next section describes the core in detail the core is the micro-framework that lets developers write screenlets in a all screenlets share a common structure based on the core classes, but each screenlet can have a unique purpose and communication figure 2 here's the core layer of liferay screens for ios from right to left, these are the main components the base class for all screenlet view classes. its child classes belong to the view classes use standard xib files to render a ui and then update the basescreenletview class contains template methods that child classes may overwrite. when developing your own theme from a parent theme, you can read the screenlet's properties or call its methods from any user action in the ui is received in this class, and then redirected to the screenlet class the base class for all screenlet classes. screenlet classes receive ui events through the screenletview class, then instantiate interactors to process and when the interactor's result is received, the screenletview the ui is updated accordingly. the base class for all interactors that a screenlet supports. class implements a specific use case supported by the screenlet. screenlet supports several use cases, it needs different interactors. interactor needs to retrieve remote data, it uses a server connector to do so. when the server connector returns the operation's result, the interactor returns the screenlet then changes the screenletview the base class for all liferay connectors that a screenlet supports. retrieve data asynchronously from local or remote data sources. classes instantiate and start these connector classes an object typically a singleton that holds the logged in user's session. can use an implicit login, invisible to the user, or a login that relies on explicit user input to create the session. user logins can be implemented with this is explained in detail here a singleton object that holds server configuration parameters. most screenlets use these parameters as now that you know what the core contains, you're ready to learn the screenlet the screenlet layer contains the available screenlets in liferay screens for the following diagram shows the screenlet layer in relation to the core, interactor, theme, and connector layers. the screenlet classes in the diagram figure 3 this diagram illustrates the ios screenlet layer's relationship to other screens components screenlets are comprised of several swift classes and an xib file myscreenletviewmodel a protocol that defines the attributes shown in the it typically accounts for all the input and output values presented to the includes attributes like the user name and password. configured by reading and validating these values. change these values based on any default values and operation results myscreenlet a class that represents the screenlet component the app it includes the following things myusercaseinteractor each interactor runs the operations that implement these can be local operations, remote operations, or a combination operations can be executed sequentially or in parallel. results are stored in a result object that can be read by the screenlet when the number of interactor classes a screenlet requires depends on the number of use cases it supports myoperationconnector this is related to the interactor, but has one or more if the server connector is a back-end call, then there's typically each server connector is responsible for retrieving a set the results are stored in a result object that can be read by the interactor when notified. the number of server connector classes an interactor requires depends on the number of endpoints you need to query, or even the number of different servers you need to support. you can therefore take advantage of inversion of control. this way, you can implement your own factory class to use to create your own to tell screens to use your factory class, specify it in the in the tutorial on preparing your ios project for screens myscreenletviewthemex a class that belongs to one specific theme. the class renders the screenlet's ui by using the view object and xib file communicate using standard when a user action occurs in the xib file, it's received by basescreenletview and then passed to the screenlet class via the performaction method. to identify different events, the component's restorationidentifier property is passed to the performaction url an xib file that specifies how to render the by convention, a screenlet with a view class named fooscreenletview and a theme named bartheme must have an for more details, refer to the tutorial next, the theme layer of screens for ios is described the theme layer lets developers set a screenlet's look and feel. property themename determines the theme to load. screenlet's theme name field in interface builder. class for screenlet behavior and an xib file for the ui. more of these components from another theme, the different theme types allow varying levels of control over a screenlet's ui design and behavior figure 4 the theme layer of liferay screens for ios there are several different theme types default theme the standard theme provided by liferay. template to create other themes, or as the parent theme of other themes. theme for each screenlet requires a view class. a default theme's view class is named myscreenletviewdefault, where myscreenlet is the screenlet's name. this class is similar to the standard viewcontroller in ios; it receives and handles ui events by using the standard and. class usually uses an xib file to build the ui components. child theme presents the same ui components as the parent theme, but can change the ui components' appearance and position. visual changes in its own xib file; it can't add or remove any ui components. the diagram, the child theme inherits from the default theme. theme is ideal when you only need to make visual changes to an existing theme. for example, you can create a child theme that sets new positions and sizes for the standard text boxes in login screenlet's default theme, but without adding full provides a complete standalone theme. implements unique behavior and appearance for a screenlet. extend screens's basescreenletview class and conform to the screenlet's view it must also specify a new ui in an xib file. extended inherits the parent theme's behavior and appearance, but lets you you can do so by creating a new xib file and a custom view class that extends the parent theme's view class. the extended theme inherits the full theme and extends its screenlet's view for an example of an extended theme themes in liferay screens are organized into sets that contain themes for liferay's available theme sets are listed here a mandatory theme set supplied by liferay. themename isn't specified or is invalid. the default theme uses a neutral, flat white and blue design with standard ui components. uses standard text boxes for the user name and password fields, but uses the default theme's flat white and blue design a collection of themes that use a flat black and green design, and ui for more details on theme creation, see the tutorial now you know the nitty gritty details of liferay screens for ios. information is invaluable when using screens to develop your apps";;
even though liferay developed screens for android with great care, you may still here are solutions and tips for solving these you'll also find answers to common questions about screens for android before delving into specific issues, you should first make sure that you have the latest tools installed and know where to get additional help if you need it. you should use the latest android api level, with the latest version of android although screens can work with eclipse adt or manual gradle builds, android studio is the preferred ide if you're having trouble using liferay screens, it may help to investigate the sample apps developed by liferay. both serve as good examples of how to use when updating an app or screenlet to a new version of liferay screens, make sure this article lists changes to screens that break functionality in prior in most cases, updating your code is relatively straightforward if you get stuck at any point, you can post your question on our if you found a bug or want to suggest an improvement, first to be able to see the project this section contains information on common issues that can occur when using this error occurs when gradle isn't able to find liferay screens or the first, check that the screens version number you're trying to it's also possible that you're using an old gradle plugin that doesn't use jcenter as the default repository. screens uses version 1.2.3 and later. can add jcenter as a new repository by placing this code in your project's liferay screens uses the appcompat library from google, as do all new android projects created with the latest android studio. library uses a custom repository maintained by google, so it must be updated manually using the android sdk manager in the android sdk manager located at tools android sdk manager in android studio, you must install at least version 14 of the android support repository in the extras menu, and version 22.1.1 of the duplicate files copied in apk meta-inf this is a common android error when using libraries. gradle can't merge duplicated files such as license or notice files. prevent this error, add the following code to your url file this error may not happen right away, but may only appear later on in the for this reason, it's recommended that you put the above code in your url file after creating your project connect failed econnrefused connection refused, or this error occurs when liferay screens and the underlying liferay mobile sdk can't connect to the liferay portal instance. you should first check the ip address of the server to make sure it's overridden the default ip address in url, you should check to make sure that you've set it to the correct ip. you're using the genymotion emulator, you must use 192.168.56.1 instead of localhost for your app to communicate with a local liferay instance some screenlets use temporary files to store information, such as when the user portrait screenlet uploads a new portrait, or the ddl form screenlet uploads new files to the portal. your app needs to have the necessary permissions to use a specific screenlet's functionality. the following line to your url if you're using the device's camera, you also need to add the following no json web service action with path this error most commonly occurs if you haven't installed the liferay screens compatibility plugin. this plugin adds new api calls to liferay portal do i have to use android studio no, liferay screens also works with eclipse adt. project manually with gradle or another build system. the compiled aar in your project's lib folder we strongly recommend, however, that you use android studio. studio is the official ide for developing android apps, and eclipse adt is using eclipse adt or compiling manually may cause unexpected issues that are difficult to overcome how does screens handle orientation changes liferay screens uses an event bus, to notify activities when the interactor has finished its work how can i use a liferay feature not available in screens there are several ways you can use liferay features not currently available gives you access to all of liferay's remote apis. custom screenlet to support any features not included in screens by default how do i create a new screenlet screenlet creation is explained in detail how can i customize a screenlet you can customize screenlets by creating new views. does screens have offline support yes, since liferay screens 1.3! preparing android projects for liferay screens;;
want to harness all the power that liferay portal offers from your mobile apps? thanks to liferay's mobile sdk, you can do just that. provides a way to streamline consuming liferay core web services, liferay utilities, and custom portlet web services. it's a low-level layer that wraps liferay json web services, making them easy to call in native mobile apps. takes care of authentication, makes http requests synchronously or asynchronously, parses json results, and handles server-side exceptions so you can concentrate on using the services in your app. bridges the gap between your native app and liferay services. gives you access to the sdk releases, provides the latest sdk news, and has forums for you to engage in mobile app development discussions. mobile sdk is available as separate downloads for android and ios, and is compatible with liferay portal 6.2 and later figure 1 liferay's mobile sdk enables your native app to communicate with liferay there are two different types of mobile sdks that you need to add to your app's project, depending on the remote services you need to call. mobile sdk includes the classes required to construct remote service calls in it also contains the classes required to call the specific remote services of liferay's core portlets. core portlets are included with every liferay installation these are also referred to as out-of-the-box or built-in however, you need to build an additional mobile sdk if you want to leverage your custom portlet's remote services. contains only the classes required to call those services. install it in your app alongside liferay's prebuilt mobile sdk to leverage your custom portlet's remote services note that liferay also provides for constructing mobile apps that connect to liferay. called screenlets to leverage and abstract the mobile sdk's low-level service however, if there's not a screenlet for your use case, or you need more control over the service call, then you may want to use the mobile sdk directly. you should read the screens tutorials in addition to the mobile sdk tutorials here to decide which better fits your needs this section's tutorials cover using the mobile sdk in android and ios app the following tutorials introduce these topics and are followed by in addition, the following tutorial covers building mobile sdks to support your fasten your seatbeltit's time to go mobile with liferay's mobile sdk! creating android apps that use liferay creating ios apps that use liferay displaying site pages to mobile devices;;
you can invoke the remote services of any installed liferay application the same way that you invoke your local services. invoking remote services locally. one reason to invoke a remote service instead of the corresponding local service might be to take advantage of the remote service's permission checks. consider the following common scenario in the above scenario, it's a best practice to invoke the remote service instead doing so ensures that you don't need to duplicate this is the practice followed by the of course, the main reason for creating remote services is to be able to invoke service builder can expose your project's remote web services both via a json api and via soap. by default, running service builder with remote-service set to true for your entities generates a json web services you can access your project's json-based restful services project, visit the following url to view its json web services each entity's available operations are listed on the plugin's json web services you can invoke json web services directly from your browser. example, to view details about your event entity's delete-event service, visit the above url and click on the delete-event link figure 1 you'll see a page displaying the name of the service method, its required parameters, its return type, possible exceptions it can throw, and a form for entering its parameters the only parameter required for the delete-event operation is an event id. test the delete-event remote web service, you could use the event listing then you could check the eventevent table in liferay's database to find your event's event id. could enter the event id value into the eventid field in the execute section of the delete-event jsonws page and click invoke. delete-event service deletes the event that corresponds to the entered event liferay returns feedback from each invocation that indicates, for example, whether the service invocation succeeded or failed finding a portlet's web services is easy with liferay's json web service invoking a portlet's web services via liferay's json web service interface is a great way to test them. you can also examine alternate equivalent methods of calling the soap and json web services via javascript, curl, and service builder can also make your project's web services available via soap after you've built your portlet project's wsdds web service deployment descriptors and deployed the project as a plugin, its services are it's easy to list your plugin's soap web you have two options you can access them in liferay ide or you can point your browser to your application's soap web services url to access your soap web services in liferay ide, right-select your portlet from under it's liferay server in the servers view. if you'd rather view your soap web services from a browser, go to the following liferay portal lists the services available for all your entities and provides for example, clicking on the wsdl link for the event service takes you to the following url this wsdl document lists the event entity's soap web services. service's wsdl is available, any soap web service client can access it invoking liferay services in your android app invoking liferay services in your ios app;;
cover common use cases for mobile apps that use liferay. authenticate users, interact with dynamic data lists, display assets, and more. what if, however, there's no screenlet for your use case? extensibility is a key strength of liferay screens this tutorial explains how to create your own screenlets. references code from the sample that saves bookmarks to liferay's bookmarks portlet in general, you use the following steps to create screenlets plan your screenlet your screenlet's features and use cases determine where you'll create it and the liferay remote services you'll call create your screenlet's ui its theme although this tutorial presents all the information you need to create a theme for your screenlet, you may first for more information on themes in general, see the tutorial on using themes with screenlets create the screenlet's interactor. interactors are screenlet components that the screenlet class is the screenlet's central it controls the screenlet's behavior and is the component the app developer interacts with when inserting a screenlet before getting started, make sure that you're familiar with the architecture of to read the screens architecture tutorial without further ado, let the screenlet creation begin! before creating your screenlet, you must determine what it needs to do and how this determines where you'll create your screenlet and its functionality where you should create your screenlet depends on how you plan to use it. want to reuse or redistribute it, you should create it in an empty cocoa touch you can then use cocoapods to publish it. explains how to publish an ios screenlet. even though that tutorial refers to themes, the steps for preparing screenlets for publication are the same. don't plan to reuse or redistribute your screenlet, create it in your app's you must also determine your screenlet's functionality and what data your this determines the actions your screenlet must support and the liferay remote services it must call. only needs to respond to one action adding a bookmark to liferay's bookmarks to add a bookmark, this screenlet must call the liferay instance's add-entry service for bookmarksentry. if you're running a liferay instance to add a bookmark, this service requires the following groupid the site id in the liferay instance that contains the folderid the folder id in the bookmarks portlet that receives the new description the new bookmark's description add bookmark screenlet must therefore account for each of these parameters. saving a bookmark, the screenlet asks the user to enter the bookmark's url and the user isn't required, however, to enter any other parameters. because the app developer sets the groupid and folderid via the app's code. also, the screenlet's code automatically populates the description and now you're ready to create your screenlet's theme! in liferay screens for ios, a screenlet's ui is called a theme. a theme has the following components an xib file defines the ui components that the theme presents to the end a view class renders the ui, handles user interactions, and communicates first, create a new xib file and use interface builder to construct your in many cases, the screenlet's actions must be triggered from to achieve this, make sure to use a restorationidentifier property to assign a unique id to each ui component that triggers an action. triggers the action by interacting with the ui component. changes the ui's state that is, changes the ui component's properties, then you can associate that component's event to an ibaction method as usual. actions using restorationidentifier are intended for use by actions that need an interactor, such as actions that make server requests or retrieve data from a this ui also needs a button to support the screenlet's action sending the bookmark to a liferay instance. because the button triggers the screenlet's action, it contains figure 1 here's the sample add bookmark screenlet's xib file rendered in interface builder note the screenlet in this tutorial doesn't support multiple themes. want your screenlet to support multiple themes, your view class must also conform a view model protocol that you create. supporting multiple themes in your screenlet now you must create your screenlet's view class. screens provides the default functionality required by all view classes. view class must therefore extend basescreenletview to provide the functionality unique to your screenlet. to support your ui, use standard s and s to connect all your xib's ui components and events you should also implement getters and setters to get values from and set values to the ui components. your view class should also implement any required animations or front-end logic is add bookmark screenlet's view class. this class extends basescreenletview and contains references to the xib's text fields. these references let the theme retrieve the data the user enters into the in interface builder, you must now specify your view class as your xib file's is set as the url file's custom class in interface if you're using cocoapods, make sure to explicitly set a valid module for the custom classthe grayed-out current default value only suggests a module figure 2 in this xib file, the custom class's module is not specified figure 3 the xib file is bound to the custom class name, with the specified module next, you'll create your screenlet's interactor create an interactor class for each of your screenlet's actions. screens provides the default functionality required by all interactor classes. your interactor class must therefore extend interactor to provide the functionality unique to your screenlet note you may wish to make your server call in a connector instead of an doing so provides an additional abstraction layer for your server call, leaving your interactor to instantiate your connector and receive its for instructions on this, see the tutorial create and use a connector with your screenlet interactors work synchronously, but you can use callbacks delegates or connectors to run their operations in the background. the mobile sdk tutorial on invoking liferay services asynchronously. screens bridges this protocol to make it available in swift. class can conform this protocol to make its server calls asynchronously. for example, the sample add bookmark screenlet's interactor class makes the server call that adds a bookmark to a liferay instance. extends the interactor class and conforms the lrcallback protocol. latter ensures that the interactor's server call runs asynchronously to save the server call's results, addbookmarkinteractor defines the public this class also defines public constants for the bookmark's folder id, title, and url. the initializer sets these variables and calls interactor's constructor with a reference to the base screenlet class the addbookmarkinteractor class's start method makes the server call. so, it must first get a session. since login screenlet creates a session automatically upon successful login, the start method retrieves this session asynchronously, the start method must set a callback to this session. addbookmarkinteractor conforms the lrcallback protocol, setting self as the session's callback accomplishes this. the start method must then create a lrbookmarksentryservicev7 instance and call this instance's the latter method calls a liferay instance's the start method therefore provides the groupid, folderid, name, url, description, and servicecontext arguments to addentrywithgroupid. note that this example provides a hard-coded also, the servicecontext is nil because the mobile sdk handles the servicecontext object for you finally, the addbookmarkinteractor class must conform the lrcallback protocol by implementing the onfailure and onsuccess methods. communicates the nserror object that results from a failed server call. does this by calling the base interactor class's callonfailure method with when the server call succeeds, the onsuccess method sets the server call's results the result argument to the resultbookmarkinfo variable. onsuccess method finishes by calling the base interactor class's callonsuccess method to communicate the success status throughout the next, you'll create the screenlet class the screenlet class is the central hub of a screenlet. screenlet's properties, a reference to the screenlet's view class, methods for invoking interactor operations, and more. when using a screenlet, app developers primarily interact with its screenlet class. in other words, if a screenlet were to become self-aware, it would happen in its screenlet class though we're reasonably confident this won't happen is a base screenlet class implementation. since basescreenlet provides most of a screenlet class's required functionality, your screenlet class should extend this lets you focus on your screenlet's unique functionality. your screenlet class must also include any properties your screenlet requires and a reference to your screenlet's view class. your screenlet's action, your screenlet class must override basescreenlet's this method should create an instance of your interactor and then set the interactor's onsuccess and onfailure closures to define what happens when the server call succeeds or fails, respectively is the screenlet class in add bookmark screenlet. basescreenlet and contains an variable for the bookmark the addbookmarkscreenlet class's createinteractor method first gets a reference to the view class addbookmarkviewdefault . then creates an addbookmarkinteractor instance with this screenlet class self , the folderid, the bookmark's title, and the bookmark's url. that the view class reference contains the bookmark title and url that the user the createinteractor method then sets the interactor's onsuccess closure to print a success message when the server call succeeds. likewise, the interactor's onfailure closure is set to print an error message note that you're not restricted to only printing messages here you should set these closures to do whatever is best for your the createinteractor method finishes by returning the interactor here's the complete addbookmarkscreenlet class for reference, the sample add bookmark screenlet's final code is your screenlet is a ready-to-use component that you can add to your to contribute to the screens project or distribute it with cocoapods. know how to create ios screenlets! using and creating progress presenters creating and using your screenlet's model class architecture of liferay screens for ios;;
to develop ios apps with liferay screens, you must first install and configure screens is released as a standard you must therefore install screens via cocoapods. the installation, you must configure your ios project to communicate with your this tutorial walks you through these processes. first, you'll review the requirements for liferay screens liferay screens for ios includes the component library the screenlets and some sample projects written in swift. screens is developed using swift and development techniques that leverage functional swift code and the you can use swift or objective-c with screens, and you can run screens apps on ios 9 and above liferay screens for ios requires the following software each screenlet in liferay screens calls one or more of liferay portal's json web services, which are enabled by default. lists the web services that each screenlet calls. services must be enabled in the portal. it's possible, however, to disable the web services needed by screenlets you're not using. portal configuration of json web services to use cocoapods to prepare your ios 9.0 or above project for liferay screens, in your project's root folder, add the following code to the file named podfile, or create this file if it doesn't exist. your target with your target's name note that liferay screens and some of its dependencies aren't compatible if your ios project is compiled in swift 3.2, then your podfile must specify screens and those dependencies for compilation in the postinstall code in the following podfile does this. must therefore use this podfile if you want to use screens in a swift 3.2 on the terminal, navigate to your project's root folder and run this this ensures you have the latest version of the cocoapods repository on your note that this command can take a while to run still in your project's root folder in the terminal, run this command once this completes, quit xcode and reopen your project by using the .xcworkspace file in your project's root folder. use this file to open your project to configure your project's communication with liferay portal, you can skip the next section and follow the instructions in the final section configuring communication between screenlets and liferay portal is easy. screens uses a property list .plist file to access your portal instance. must include the server's url, the portal's company id, and the site's group id. create a url file and specify values required for communicating with your portal instance. figure 1 here's a property list file, called url the values you need to specify in your url are your ios project is ready for liferay screens preparing android projects for liferay screens;;
"in liferay screens, a connector is a class that interacts asynchronously with local and remote data sources and liferay instances. make asynchronous service calls. so why bother with a connector? provide a layer of abstraction by making your service call outside your the interactor in the screenlet creation tutorial makes the server call and and processes its results via lrcallback. screenlet could instead make its server call in a separate connector class, leaving the interactor to instantiate the connector and receive its results. connectors also let you validate your screenlet's data. tutorial on the architecture of liferay screens for ios this tutorial walks you through the steps required to create and use a connector with your screenlets, using the advanced version of the sample add bookmark screenlet this screenlet contains two actions add bookmark adds a bookmark to the bookmarks portlet in a this tutorial shows you how to create and use a connector for get title retrieves the title from a bookmark url entered by the user. tutorial shows you how to use a pre-existing connector with this action before proceeding, make sure you've read the screenlet creation tutorial. first, you'll learn how to create your connector when you create your connector class, be sure to follow the specified in the best practices tutorial use the following steps to implement your connector class create your connector class by extending the for example, here's the class declaration for add bookmark screenlet's add the properties needed to call the mobile sdk service, then create an initializer that sets those properties. addbookmarkliferayconnector needs properties for the bookmark's folder id, it also needs an initializer to set those properties if you want to validate any of your screenlet's properties, override the validatedata method to implement validation for those properties. for example, the following validatedata implementation in addbookmarkliferayconnector ensures that folderid is greater than 0, and title and url contain values. validationerror to represent the error override the dorun method to call the mobile sdk service you need to this method should retrieve the result from the service and store it in also be sure to handle errors and empty results. example, the following code defines the resultbookmarkinfo property for storing the service's results retrieved in the dorun method. method's service call is identical to the one in the addbookmarkinteractor the dorun method, however, takes the additional step of saving the result to the resultbookmarkinfo property. also note that this dorun method handles errors as nserror objects now you know how to create a connector class. to use a connector, your interactor class must extend the or one of its following subclasses your interactor class should extend this class when implementing an action that retrieves information from a server or data source that writes information to a server or data source when extending serverconnectorinteractor or one of its subclasses, your interactor class only needs to override the createconnector and these methods create a connector instance and recover the connector's result, respectively follow these steps to use a connector in your interactor set your interactor class's superclass to serverconnectorinteractor or one you should also remove any code that conforms a callback for example, add bookmark screenlet's interactor because it writes data to a installation. interactor should contain only the properties and initializer that it override the createconnector method to return an instance of your for example, the createconnector method in addbookmarkinteractor returns an addbookmarkliferayconnector instance created with the folderid, title, and url properties override the completedconnector method to get the result from the connector and store it in the appropriate property. completedconnector method in addbookmarkinteractor first casts its serverconnector argument to addbookmarkliferayconnector. connector's resultbookmarkinfo property and sets it to the interactor's to see the complete example addbookmarkinteractor, if your screenlet uses multiple interactors, follow the same steps to use for interacting with non-liferay url's. to use this connector, set your interactor to use for example, the add bookmark screenlet action that retrieves a url's title doesn't interact with a installation; it retrieves the title directly from the url. it also overrides the createconnector and completedconnector methods to use now you know how to create and use connectors in your screenlets architecture of liferay screens for ios";;
with multiple interactors, it's possible for a screenlet to have multiple you must create an interactor class for each action. your screenlet needs to make two server calls, then you need two interactors your screenlet class's createinteractor method must return an instance of each interactor. also, recall that each action name is given by the restorationidentifier of the ui components that trigger them. set this restorationidentifier to a constant in your screenlet this tutorial walks you through the steps necessary to add an action to your screenlet, and trigger an action programmatically. advanced version of the sample add bookmark screenlet. this screenlet is similar to the sample add bookmark screenlet created in the screenlet creation tutorial. the advanced add bookmark screenlet, however, contains two actions add bookmark adds a bookmark to the bookmarks portlet in a this is the screenlet's main action, created in the screenlet creation tutorial get title retrieves the title from a bookmark url entered by the user. tutorial shows you how to implement this action note that this tutorial doesn't explain screenlet creation in general. proceeding, make sure you've read and without any further ado, it's time to implement your screenlet's action! use the following steps to add an action to your your screenlet create a constant in your screenlet class for each of your screenlet's for example, here are the constants in add bookmark screenlet's in your theme's xib file, add any new ui components that you need to perform for example, add boookmark screenlet's xib file needs a new button for getting the url's title figure 1 the sample add bookmark screenlet's xib file contains a new button next to the title field for retrieving the url's title wire the ui components in your xib file to your view class. class, you must also set each component's restorationidentifier to its for example, the following code in the add bookmark screenlet's view class addbookmarkviewdefault specifies an the didset observer for each property sets the restorationidentifier to the appropriate constant you created in the first update your view class or view model protocol to account for the new action. for example, add bookmark screenlet contains a view model this view model must allow the new action to set its title variable if your screenlet uses a view model, conform your view class to the updated for example, the title variable in add bookmark screenlet's view class addbookmarkviewdefault must implement the setter from the create a new interactor class for the new action. for example, here's the interactor class for add bookmark screenlet's get update your screenlet class's createinteractor method so it returns the correct interactor for each action. for example, the createinteractor method in add bookmark screenlet's screenlet class addbookmarkscreenlet contains a switch statement that returns an addbookmarkinteractor or getwebtitleinteractor instance when the add bookmark or get title action is note that the createaddbookmarkinteractor and creategettitleinteractor methods create these instances. don't have to create your interactor instances in separate methods, doing so now you know how to support multiple actions in your screenlets. section shows you how to trigger your actions programmatically the user triggers add bookmark screenlet's actions when they press buttons in what if you need to trigger the action programmatically? contains a set of useraction methods that you can call in your view class to perform actions programmatically. for example, it's possible to trigger add bookmark screenlet's get title action automatically whenever the user leaves the since basescreenletview is the delegate for all uitextfield objects by default, this is done in the view class addbookmarkviewdefault to call the useraction method with the action name now you know how to trigger your screenlet actions programmatically create and use a connector with your screenlet architecture of liferay screens for ios;;
themes let you present the same screenlet with a different look and feel. example, if you have multiple apps that use the same screenlet, you can use different themes to match the screenlet's appearance to each app's style. screenlet that comes with liferay screens supports the use of multiple themes. for your custom screenlet to support different themes, however, it must contain a view model abstracts the theme used to display the screenlet, thus letting developers use other themes. screenlet class's createinteractor method in the screenlet creation tutorial accesses the view class addbookmarkviewdefault directly when getting a this is all fine and well, except it hard codes the theme defined by to use a different theme, you'd have to rewrite this line of code to use that theme's view class. of making your screenlet take expensive yoga classes, you can abstract the theme's view class via a view model protocol this tutorial shows you how to add a view model to your screenlet. note that you can also follow these steps to add a view model while creating your screenlet follow these steps to add and use a view model in your screenlet create a view model protocol that defines your screenlet's attributes. attributes are the view class properties your screenlet class uses. screenlet class in add bookmark screenlet uses the view class properties title and url. view model protocol addbookmarkviewmodel must therefore define variables conform your view class to your screenlet's view model protocol. getset all the protocol's properties. for example, here's add bookmark screenlet's view class addbookmarkviewdefault conformed to create and use a view model reference in your screenlet class. data from this reference instead of a direct view class reference, you can use your screenlet with other themes. addbookmarkscreenlet class with a viewmodel property instead of a direct reference to addbookmarkviewdefault. method then uses this property to get the title and url properties in the now your screenlet is ready to use other themes that you create for for instructions on creating a theme architecture of liferay screens for ios;;
in this chapter, we finished our overview of liferay's control panel that we we saw how to configure mail host names, email notifications, identification, and portal display settings. add custom fields to various portal entities such as users, pages, documents, wiki articles, message board posts, and more next, we saw how to view and configure overall server settings. view the memory currently being used by the server, as well as how to initiate garbage collection, a thread dump, search engine re-indexing and the clearing of we learned how to debug parts of the portal by changing log levels and by viewing the various properties defined in the portal finally, we learned how to properly notify users that the portal is about to shut down and how to set up external services like openoffice integration. looked at how to create multiple portal instances on a single installation of liferay and we showed how to view currently installed plugins we hope this information helps you become an effective liferay portal;;
"liferay upgrades are fairly straightforward. a consistent set of steps is all you need to follow to upgrade a standard liferay installation. more complicated if your organization has used ext plugins to customize liferay. it's possible that api changes in the new version will break your existing code. this, however, is usually pretty easy for your developers to fix. plugins which use liferay apis should be reviewed and their services rebuilt theme plugins may require some modifications to take advantage of new features, and if they're using liferay apis, they should be much effort has been made to make upgrades as painless as possible; however, this is not a guarantee everything will work without modification. plugins are the most complicating factor in an upgrade, so it is important to as a general rule, you can upgrade from one major release to the next major for example, you can upgrade directly from liferay 5.2.x to 6.0.x, but if you need to upgrade over several major releases, you'll need to run the upgrade procedure for each major release until you reach this doesn't mean you need to run the procedure for every point release or service pack; you only need to run the procedure for the major a good practice is to use the latest version of each major release to now that we've gotten the general philosophy of upgrading out of the way, let's outline the procedure you'll undergo for upgrading a liferay 6.0 installation to if you're running a previous version of liferay and need to upgrade to 6.0 first, please see the instructions in the previous version of there are a few things you should prepare before you actually perform the specifically, you need to make sure you've migrated to permission algorithm 6, reviewed your image gallery usage, reviewed new liferay 6.1 defaults, and cataloged all the plugins you have installed. performed these three tasks, you're ready to upgrade. if your liferay installation has existed for a while, you may be on a different permission algorithm than the one that's available in liferay portal 6.1. permission algorithms 1-5 were deprecated in liferay portal 6.0, and they've now been removed in 6.1, which means you must migrate before you upgrade if you're on liferay 5.2 or below, you need to upgrade to the latest available please follow the instructions in the liferay we will assume for the rest of this section that you have 6.0 running, and that it's configured to use an older algorithm than algorithm 6 the first thing you need to do, if this is not done already, is to upgrade your if you've already done that, great! if not, shut down your server, edit your url file, and modifyadd the following property so that it as liferay starts, it upgrades your permissions algorithm review your system to make sure that your permissions configuration is working properly it should be next, log in as an administrator and navigate to the control panel. administration and select data migration from the menu along the top of the a section entitled legacy permissions migration appears at the figure 17.9 update your permissions algorithm by clicking the execute algorithms 5 and 6 do not support adding permissions at the user level. have permissions set for individual users, the converter can simulate this for to do this, it auto-generates roles for each individual permission, and then assigns those roles to the users who have individualized permissions. you have a lot of these, you'll likely want to go through and clean them up to generate these roles, check the generate if you do not generate the roles, all custom permissions set for individual users are discarded click execute to convert all existing users and roles to algorithm 6. process completes, shut down your server. and modify the algorithm property to show that you're now using algorithm 6 you've successfully migrated your installation to use the latest, highest performing permissions algorithm. you'll need to explicitly set your image gallery storage option liferay 6.1 introduces a major change to how liferay handles files. we have a separate document library and image gallery; instead, these have been combined into documents and media. if you were using liferay's image gallery to store images, these can be migrated over during an upgrade, but you'll have to in liferay 6.0, you had three ways you could store images in the image gallery. you could use the databasehook and store them as blobs in the database; you could use the dlhook to store them in the document library, or you could use the filesystemhook to store them in a folder on your server's file system. before you upgrade, you'll need to set whichever property you were using in your 6.0 url file, because by default, none of them are enabled setting one of the properties triggers the migration during the upgrade below are the three properties; you'll need to set only one of them by default, liferay 6.0 used the filesystemhook. property for your installation, you'd use the filesystemhook property above. if you customized the property, you should know which one you used, and it is likely already in your url file the third thing you need to do to prepare for your upgrade is to review the new the next thing you'll need to look at are the defaults that have changed from these are preserved in url in the source. the 6.1 values have changed to if you don't like the defaults, you can change them back in one shot by adding a system property to your jvm's startup. this differs by application servers. tomcat, you'd modify url url and append the option url to the environment variable the scripts url or url are not delivered with default tomcat, but do exist in the bundles. if they're there, tomcat uses them in the startup process, so it's a nice way to separate your own settings from alternatively, of course, you can override some or all of them in your url along with your other overrides if you're not using tomcat, check your application server's documentation to see how to modify runtime properties. your final task is to catalog all the plugins you have installed, so you can install the new versions in your upgraded system finally, you need to take note of any plugins you have installed. plugins are usually version-specific, so you'll need to obtain new versions of them for the new release of liferay. if you have custom plugins created by your development team, they'll need to build, test, and optionally modify them to work with the new release of liferay. don't attempt an upgrade without collecting all the plugins you'll need first once you've upgraded your permissions algorithm, reviewed your properties, and collected all the plugins you'll need, you're ready to follow the upgrade remember to back up your system before you begin there are two different procedures to upgrade liferay. a liferay bundle, is the most common. the second procedure is for upgrading a liferay installation on an application server. in both cases, liferay auto-detects whether the database requires an upgrade the first time the new version is started. when liferay does this, it upgrades the database to the format required by the new version. liferay must be accessing the database with an id that can create, drop and make sure you have granted these permissions to the id before you and, of course, we'll run the risk of overly let's look at upgrading a bundle, which is the easiest upgrade path if you're running a liferay bundle, the best way to do the upgrade is to follow the new liferay is installed in a newer version of your bundle for example, the liferaytomcat bundle for 6.0 used tomcat 6 by default; the 6.1 bundle uses tomcat 7. we generally recommend you use the latest version of your runtime bundle, as it will be supported the unzip the bundle to an appropriate location on your copy your url file and your data folder to the new review your url file as described above. you're using permissions algorithm 6. if you were using the image gallery, make the necessary modifications so your files are migrated to documents and review the new defaults and decide whether you want to use them. any other modifications you've made watch the console as liferay starts it upgrades the database automatically when the upgrade completes, install any plugins you were using in your old make sure you use the versions of those plugins that if you have your own plugins, your development team will need to migrate the code in these ahead of time and browse around in your new installation and verify everything is working. have your qa team test everything. if all looks good, you can delete the old application server with the old release of liferay in it from the you have a backup of it anyway, right as you can see, upgrading a bundle is generally pretty simple. can use bundles sometimes, specific application servers or application server versions are mandated by the environment you're in or by management. reason, liferay also ships as an installable.war file that can be used on any running a manual upgrade is almost as easy as upgrading a bundle verify your application server is supported by liferay. viewing the appropriate document on the customer portal ee, in chapter 14 because there are installation instructions for it, or on url if your application server isn't supported by liferay 6.1, do not you'll need to upgrade or switch to a supported application obtain the liferay portal.war file and the dependency.jars archive copy your customized url file to a safe place and review it as described above, making all the appropriate changes undeploy the old version of liferay and shut down your application server copy the new versions of liferay's dependency.jars to a location on your server's class path, overwriting the ones you already have for the old this location is documented for your application deploy the new liferay.war file to your application server. deployment instructions in chapter 14 start or, if your app server has a console from which you've installed starts it should upgrade the database automatically. is operating normally, and then install any plugins you were using in your make sure you use the versions of theose plugins if you have your own plugins, your development team will need to migrate the code in these ahead of time and provide.war if all looks good, you're finished most everything is handled by liferay's upgrade note as stated above, if you have to upgrade over several liferay versions, you will need to repeat these steps for each major release.";;
liferay portal is an easy environment to maintain. administrators have all the options they need to view and diagnose a running liferay portal server through its tunable logs patching liferay is easy to do with liferay's patching tool. all the management of available patches, and makes it easy to install and upgrading liferay is also a snap, because liferay does most of the work with easy migration tools and automated database upgrade scripts, you'll have your new version of liferay portal up and running in no time.;;
this chapter is a guide to everything about installing liferay. choose a liferay bundle or an existing application server, liferay portal integrates seamlessly with your enterprise java environment. more application servers than any other portal platform, allowing you to preserve your investment in your application server of choice or giving you the freedom to move to a different application server platform. to providing you this freedom we have 500 test servers certifying our builds with roughly 10,000 tests per version of liferay portal. run on all of our different supported combinations of application servers, databases and operating systems. because of this, you can be sure we are committed to supporting you on your environment of choice. knowing you have the freedom to use the software platform that is best for your organization and that liferay portal runs and performs well on it.;;
"in this chapter, we began to examine liferay's control panel. and teams aren't the only way for portal administrators to group and manage users organizations can be used to arrange users into hierarchical structures and user groups are a flexible way to collect groups of users that transcend you can create roles to define permissions and scope them for the entire portal or for a particular site or organization. can be assigned to roles; in this case, each member of the user group is we also looked at how to configure password policies for users. at the different authentication options provided by liferay. liferay so that users can authenticate via ldap, cas, facebook, ntlm, openid, finally, we examined some general configuration options we'll continue our coverage of liferay's control panel in";;