Skip to end of banner
Go to start of banner

Pages

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 63 Next »

Getting Started

How to create a page

First of all, create a page in XHTML file format, a file with a .xhtml extension and declared the necessary Namespaces.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
	  xmlns:f="http://java.sun.com/jsf/core"
	  xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
	  xmlns:h="http://java.sun.com/jsf/html"
	  xmlns:fn="http://java.sun.com/jsp/jstl/functions"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
	  xmlns:crm="http://java.sun.com/jsf/composite/crm">

</html>

Define the template of the page in a ui:composition tag.

<ui:composition template=""></ui:composition>

By default a template provides the base interface layout of the page (header, footer, topbar, main menu, content) as well as the following tags:

  • "managedBean" parameter - contains the name of the managed bean that will be used from template
<ui:param name="managedBean" value=""></ui:param>
  • "back-button" placeholder - defines the back button of the page that will be inserted in the left side of the topbar before the title
<ui:define name="back-button"></ui:define>
  • "title" placeholder -  defines the title of the page that will be inserted n the left side of the topbar

<ui:define name="title"></ui:define>	
  • "viewname" placeholder -  defines the view name in breadcrumb of the page

<ui:define name="viewname"></ui:define>	
  • "actions" placeholder - defines the actions of the page that will be inserted in the right side of the topbar

<ui:define name="actions"></ui:define>	
  • "content" placeholder - defines the actual content of the page

<ui:define name="content"></ui:define>	

Namespaces

The following namespaces should be defined in html root element of a page.

Tag Library

URI

Prefix

Contents

XHTML namespacehttp://www.w3.org/1999/xhtml
Tags for xhtml
JavaServer Faces Facelets Tag Libraryhttp://xmlns.jcp.org/jsf/facelets

ui:

Tags for templating
PrimeFaces componentshttp://primefaces.org/ui

p:

Tags for PrimeFaces components
JavaServer Faces Core Tag Libraryhttp://java.sun.com/jsf/core

f:

Tags for JavaServer Faces custom actions that are independent of any particular render kit
Pass-through Attributes Tag Libraryhttp://xmlns.jcp.org/jsf/passthrough

p:

Tags to support HTML5-friendly markup
JavaServer Faces HTML Tag Libraryhttp://java.sun.com/jsf/html

h:

JavaServer Faces component tags for all UIComponent objects
JSTL Functions Tag Libraryhttp://java.sun.com/jsp/jstl/functions

fn:

JSTL 1.2 Functions Tags
JSTL Core Tag Libraryhttp://java.sun.com/jsp/jstl/core

c:

JSTL 1.2 Core Tags
CRM Composite Components Tag Libraryhttp://java.sun.com/jsf/composite/crm

crm:

Tags for CRM Components

Templates

The available templates are:

  • summary_template.xhtml - it is used for a summary page
  • data_entry_template.xhtml - it is used for a data entry page

Managed Bean

A typical JavaServer Faces application includes one or more managed beans, each of which can be associated with the components used in a particular page. 

A managed bean for summary pages must extend SummaryView class and for data entry pages must extend DataEntryView class.

@ManagedBean(name = "summaryManagedBeanView", eager = true)
@ViewScoped
public class SummaryManagedBeanView extends SummaryView {

}

@ManagedBean(name = "dataEntryManagedBeanView", eager = true)
@ViewScoped
public class DataEntryManagedBeanView extends DataEntryView{

}

Class SummaryView 

SummaryView class implements commonly used functions for summary pages.

Class DataEntryView

DataEntryView class implements commonly used functions for data entry pages.

The below list shows functions that can be used from data entry pages:

 public void addCustomFields()

This method adds custom fields on the page.

 public List<SelectItem> getDefinedLanguageOptions()

This method returns a list of languages.

 public String getEditorSuggestions(String entityID,String entityTags)

This method returns a list of editor suggestions based on the specified entity and entity tags.

 public List<SelectItem> getOptionsFromString(String options)

This method returns a list of options from the specified semicolon-seperated String.

 public Boolean isGooglePlacesAutocompleteEnable()

This method returns if the google places autocomplete for address registry is enabled, otherwise false.

 public Boolean isInternationalAddressFormatEnabled()

This method returns true if the international address format is enabled, otherwise false.

 public Boolean isModuleRestricted(String moduleid)

This method returns true if the module with the specified id is restricted, otherwise false.

 public void onload()

This method initialize page parameters and is executed on GET request of a page.

 public List<CRMDO> searchCountry(String searchValue)

This method returns a list of countries where country name starts with the specified search value. 

 public void setGoogleAddress(CRMDOContactInfoAddress contactInfoAddress)

This method sets the google address of a contact info address.

 public CRMDO setMandatoryField(CRMDO dto, String xPath, String value)

This method sets as mandatory the field of the specified data object based on the specified xPath and value.

 public void setTranslations()

This method sets the translations of the page's data object.


 public void setTranslations(CRMDO dto)

This method sets the translations of the specified data object

Commonly Used Functions

The below list shows functions that can be used both from summary and data entry pages:

 public void createArchivedFile(String id)

This method creates an archive file with the specified id.

 public Boolean exists(ArrayList<CRMDO> dtoList, CRMDO dto)

This method returns true if the specified data object exists in the specified list, otherwise false.

 public ArrayList<CRMDO> filterDeleted(ArrayList<CRMDO> records)

This method returns a list of non delete items of the specified list.

 public Set filterDeletedSet(Set records)

This method returns a list of non deleted items of the specified set.

 public String formatAmount(CRMDOCurrency currency, BigDecimal amount)

This method formats the specified amount to a . The format of the resulting String is [currency prefix] [amount].

If no currency is specified then the system default currency is used.

The default scale of the amount is 2.

 public String formatAmount(CRMDOCurrency currency, BigDecimal amount, Boolean showCurrency)

This method formats the specified amount to a String. The format of the resulting String is:

  • [currency prefix] [amount] If showCurrency parameter is true, otherwise
  • [amount]

If no currency is specified then the system default currency is used.

The default scale of the amount is 2.

 public String formatAmount(CRMDOCurrency currency, BigDecimal amount, Boolean showCurrency, Integer scale)

This method formats the specified amount to a String. The format of the resulting String is:

  • [currency prefix] [amount] If showCurrency parameter is true, otherwise
  • [amount]

If no currency is specified then the system default currency is used.

If no scale is specified then the default scale of the amount is 2.

 public Object formatDate(Object date)

This method formats the specified date to a String based on the configured system date format.

 public Object formatDateTime(Object date)

This method formats the specified date time to a String based on the configured system date time format.

 public Object formatDateTime(Object date, String format)

This method formats the specified date time to a String based on the specified format.

 public String formatSearchFilter(String searchFilter)

This method formats the specified String, removing special characters such as % and _.

 public TreeNode generateTree(ArrayList<CRMDO> categories)

This method generates a tree based on the specified list.

 public List<Object> getActiveInactiveOptions()

This method returns a list of two options: Active and Inactive.

 public String getAllowedFileTypes()

This method returns a String of allowed file types. The format of the resulting String is: /(\\.|\\/)([comma-seperated file extensions])$/

 public List<SelectItem> getApplicationServerScopeOptions()

This method returns a list of allowed application server scopes.

 public List<SelectItem> getApplicationServersOptions()

This method returns a list of allowed application servers.

 public List<SelectItem> getBillingTermSchemeCodeOptions()

This method returns a list of billing term scheme codes.


 public List<SelectItem> getBillingTermSchemeCodeOptions(BillType billType)

This method returns a list of billing term scheme codes based on the specified bill type.


 public ArrayList<CRMDO> getBillingTermSchemeOptions()

This method returns a list of billing term schemes.


 public List<SelectItem> getCountryOptions()

This method returns a list of countries.


 public List<SelectItem> getCurrencyOptions()

This method returns a list of currencies.


 public Date getCurrentDate()

This method returns the current date without milliseconds.

 public String getCurrentYear()

This method returns the current year.

 public String getDateFormat()

This method returns a String for the configured system date format.

 public String getDateTimeFormat()

This method returns a String for the configured system date time format.

 public String getDayOfWeekLabel(Integer dayOfWeek)

This method returns the day-of-week label of the specified Int value.

 public List<SelectItem> getDaysOfMonthOptions()

This method returns a list of days of months.

 public String getDecimalSeperatorSymbol()

This method returns the configued system decimal seperator symbol.

 public String getDefaultHomePageName(String defaultHomePageId)

This method returns the default home page name based on the specified page id.

 public List<SelectItem> getHomePageOptions()

This method returns a list of home pages.


 public List<SelectItem> getHourOptions()

This method returns a list of hour options.


 public List<SelectItem> getJobTypeOptions()

This method returns a list of job type options.

 public List<SelectItem> getLanguageOptions()

This method returns a list of languages.

 public String getMaxFileSize()

This method return a String of the configured system maximum file size.

 public String getMenuoption(List<Menuoption> menuoptions, String menuoptionid)

This method returns the menu option with the specified id that exists in the specified list.

 public List<SelectItem> getMinuteOptions()

This method returns a list of minutes.


 public List<SelectItem> getMinuteOptions(Integer number)

This method returns a list of minutes with the specified interval number between minute options. 

 public String getMonthLabel(Integer month)

This method returns  the month label of the specified Int value.

 public List<SelectItem> getMonthNumberOptions()

This method returns a list of month numbers.

 public List<SelectItem> getMonthOptions()

This method returns a list of months.

 public List<SelectItem> getNormalBillingTermSchemeCodeOptions()

This method returns  a list of normal billing term scheme codes.

 public String getNumberOfDecimalDigits()

This method returns a String of the configured system number of decimal digits.

 public String getPaymentGatewayCardBrandIcon(String brand)

This method return an icon class of the specified payment gateway card brand.

 public ArrayList<SelectItem> getProductCriterionTypeOptions()

This method returns a list of product criterion types.

 public List<SelectItem> getRecurrenceScopeOptions()

This method returns a list of recurrence scopes.

 public ArrayList<CRMDO> getSubscriptionTypeOptions()

This method returns a list of subscription types.


 public String getThousandSeperatorSymbol()

This method returns a String for the configured system thousand seperator symbol.

 public String getTimeLabel(Integer hour, Integer minutes)

This method returns the time label of the specified hour and minutes. The format of the resulting String is [hour]:[minutes].

 public String getTimeLabel(Integer hour, Integer minutes, Integer seconds)

This method returns the time label of the specified hour, minutes and seconds. The format of the resulting String is [hour]:[minutes]:[seconds].

 public String getTimestamp()

This method returns the current timestamp.

 public List<SelectItem> getTimezoneOptions()

This method returns a list of available time zones.


 public String getTranslation(String label)

This method returns the translation of the specified key label.

 public List<SelectItem> getUnitOfTimeOptions()

This method returns a list of unit times.

 public String getValueTranslation(String value)

This method returns the translation of the specified value.

 public List<SelectItem> getWeekdayOptions()

This method returns a list of week days.

 public List<SelectItem> getYearOptions()

This method returns a list of years, starting from 1900 until the current year.

 public List<Object> getYesNoOptions()

This method returns a list with two options: Yes and No.

 public List<SelectItem> loadPrintoutExportTypeOptions()

This method returns a list of printout export types.

 public void navigateToHomePage()

This method navigates the user to home page.

 public void refresh()

This method refresh the page.

 public List<CRMDOCommunity> searchCommunities(String searchValue)

This method returns a list of communities where community name starts with the specified search value. 

 public List<CRMDO> searchGroups(String searchValue)

This method returns a list of unit groups where unit group name starts with the specified search value. 

 public List<CRMDO> searchUnits(String searchValue)

This method returns a list of units where unit name starts with the specified search value. 

 public List<CRMDO> searchUsers(String query)

This method returns a list of users where user username starts with the specified search value. 

 public String setContactOrderBy()

This method return a String for contact order by clause based on the active name display rule.


Template Pages







  • No labels