import javax.enterprise.context.RequestScoped;
import javax.enterprise.event.Event;
import javax.enterprise.inject.Any;
+import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;
import org.mxchange.jcontacts.events.contact.created.CreatedContactEvent;
import org.mxchange.jcontacts.events.contact.created.ObservableCreatedContactEvent;
import org.mxchange.jcontacts.model.contact.Contact;
+import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
import org.mxchange.jfinancials.beans.BaseFinancialsBean;
import org.mxchange.jfinancials.beans.contact.FinancialsAdminContactWebRequestController;
import org.mxchange.jfinancials.beans.phone.FinancialsAdminPhoneWebRequestController;
this.userCreatedEvent.fire(new CreatedUserEvent(this.getUser()));
}
+ /**
+ * Returns the branch office's full address. If null is provided, an empty
+ * string is returned.
+ * <p>
+ * @param branchOffice Branch office instance
+ * <p>
+ * @return Branch office's address
+ */
+ public String renderBranchOffice (final BranchOffice branchOffice) {
+ // Default is empty string, so let's get started
+ final StringBuilder sb = new StringBuilder(30);
+
+ // Is a branch office instance given?
+ if (branchOffice instanceof BranchOffice) {
+ // Yes, then append all data
+ sb.append(", ");
+ sb.append(branchOffice.getBranchStreet());
+ sb.append(" ");
+ sb.append(branchOffice.getBranchHouseNumber());
+ sb.append(", ");
+ sb.append(branchOffice.getBranchCountry().getCountryCode());
+ sb.append(" ");
+ sb.append(branchOffice.getBranchZipCode());
+ sb.append(branchOffice.getBranchCity());
+ }
+
+ // Return it
+ return sb.toString();
+ }
+
+ /**
+ * Returns the contact's personal title, family name and name. If null is
+ * provided, an empty string is returned.
+ * <p>
+ * @param contact Contact instance
+ * <p>
+ * @return Contact's name
+ */
+ public String renderContact (final Contact contact) {
+ // Default is empty string, so let's get started
+ final StringBuilder sb = new StringBuilder(20);
+
+ // Is contact set?
+ if (contact instanceof Contact) {
+ // Then create name
+ sb.append(String.format(FacesContext.getCurrentInstance().getViewRoot().getLocale(), "{0} {1}, {2}", this.getMessageFromBundle(contact.getContactPersonalTitle().getMessageKey()), contact.getContactFamilyName(), contact.getContactFirstName())); //NOI18N
+ }
+
+ // Return it
+ return sb.toString();
+ }
+
/**
* Set's all given contact's phone instances: land-line, mobile and
* faxNumber
<h:doctype rootElement="html" public="-//W3C//DTD XHTML 1.0 Transitional//EN" system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<html lang="#{localizationController.locale.language}" xml:lang="#{localizationController.locale.language}" xmlns="http://www.w3.org/1999/xhtml">
- <f:view locale="#{localizationController.locale}" contentType="text/html" />
-
- <h:head>
- <f:facet name="first">
- <ui:insert name="metadata" />
-
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
- <meta name="apple-mobile-web-app-capable" content="yes" />
- </f:facet>
-
- <f:loadBundle var="msg" basename="org.mxchange.localization.bundle" />
- <f:loadBundle var="project" basename="org.mxchange.localization.project" />
-
- <h:outputStylesheet name="/css/default.css" />
- <h:outputStylesheet name="/css/layout.css" />
-
- <title>
- <h:outputText value="#{initParam['project_title']}" />
- <h:outputText value=" - " />
- <ui:insert name="title">
- <h:outputText value="Default title" />
- </ui:insert>
- </title>
- </h:head>
-
- <h:body>
- <pm:header>
- <div id="page-header">
- <h1>
- <h:outputText value="#{initParam['project_title']} - " />
-
- <ui:insert name="title">
- <h:outputText value="Default title" />
- </ui:insert>
- </h1>
- </div>
- </pm:header>
-
- <h:panelGroup id="menu-content-wrapper" layout="block">
- <div id="left-menu-container">
- <ui:insert name="menu">
- <h:outputText value="Default menu" />
+ <f:view locale="#{localizationController.locale}" contentType="text/html">
+ <h:head>
+ <f:facet name="first">
+ <ui:insert name="metadata" />
+
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
+ <meta name="apple-mobile-web-app-capable" content="yes" />
+ </f:facet>
+
+ <f:loadBundle var="msg" basename="org.mxchange.localization.bundle" />
+ <f:loadBundle var="project" basename="org.mxchange.localization.project" />
+
+ <h:outputStylesheet name="/css/default.css" />
+ <h:outputStylesheet name="/css/layout.css" />
+
+ <title>
+ <h:outputText value="#{initParam['project_title']}" />
+ <h:outputText value=" - " />
+ <ui:insert name="title">
+ <h:outputText value="Default title" />
</ui:insert>
-
- <ui:include src="/WEB-INF/templates/widgets/locale_change_widget.tpl" />
- </div>
-
- <h:panelGroup id="content_outer" class="content-container" layout="block">
- <div id="content-header">
- <ui:insert name="content_header">
- <h:outputText value="Default content header" />
- </ui:insert>
+ </title>
+ </h:head>
+
+ <h:body>
+ <pm:header>
+ <div id="page-header">
+ <h1>
+ <h:outputText value="#{initParam['project_title']} - " />
+
+ <ui:insert name="title">
+ <h:outputText value="Default title" />
+ </ui:insert>
+ </h1>
</div>
+ </pm:header>
- <div id="content">
- <ui:insert name="content">
- <h:outputText value="Default content" />
+ <h:panelGroup id="menu-content-wrapper" layout="block">
+ <div id="left-menu-container">
+ <ui:insert name="menu">
+ <h:outputText value="Default menu" />
</ui:insert>
+
+ <ui:include src="/WEB-INF/templates/widgets/locale_change_widget.tpl" />
</div>
+
+ <h:panelGroup id="content_outer" class="content-container" layout="block">
+ <div id="content-header">
+ <ui:insert name="content_header">
+ <h:outputText value="Default content header" />
+ </ui:insert>
+ </div>
+
+ <div id="content">
+ <ui:insert name="content">
+ <h:outputText value="Default content" />
+ </ui:insert>
+ </div>
+ </h:panelGroup>
</h:panelGroup>
- </h:panelGroup>
-
- <h:panelGroup id="page-footer" layout="block">
- <ui:insert name="footer">
- <h:outputText value="Default footer" />
- </ui:insert>
- </h:panelGroup>
-
- <h:panelGroup styleClass="error-container" layout="block">
- <p:growl autoUpdate="true" showDetail="true" sticky="true" />
-
- <p:ajaxExceptionHandler type="javax.faces.application.ViewExpiredException"
- update="exceptionDialog"
- onexception="PF('exceptionDialog').show();" />
-
- <p:dialog id="exceptionDialog" closable="true" closeOnEscape="true" header="Exception '#{pfExceptionHandler.type}' occured!" widgetVar="exceptionDialog"
- height="500px">
- <div class="para">
- <h:outputText value="#{msg.EXCEPTION_MESSAGE}:" />
- <h:outputText value="#{pfExceptionHandler.message}" />
- </div>
- <div class="para">
- <h:outputText value="#{msg.EXCEPTION_STACK_TRACE}:" />
- <h:outputText value="#{pfExceptionHandler.formattedStackTrace}" escape="false" />
- </div>
+ <h:panelGroup id="page-footer" layout="block">
+ <ui:insert name="footer">
+ <h:outputText value="Default footer" />
+ </ui:insert>
+ </h:panelGroup>
- <div class="para">
- <p:button onclick="window.location.href = document.location.href;"
- value="#{msg.RELOAD_PAGE}"
- rendered="#{pfExceptionHandler.type == 'javax.faces.application.ViewExpiredException'}" />
- </div>
- </p:dialog>
- </h:panelGroup>
- </h:body>
+ <h:panelGroup styleClass="error-container" layout="block">
+ <p:growl autoUpdate="true" showDetail="true" sticky="true" />
+
+ <p:ajaxExceptionHandler type="javax.faces.application.ViewExpiredException"
+ update="exceptionDialog"
+ onexception="PF('exceptionDialog').show();" />
+
+ <p:dialog id="exceptionDialog" closable="true" closeOnEscape="true" header="Exception '#{pfExceptionHandler.type}' occured!" widgetVar="exceptionDialog"
+ height="500px">
+ <div class="para">
+ <h:outputText value="#{msg.EXCEPTION_MESSAGE}:" />
+ <h:outputText value="#{pfExceptionHandler.message}" />
+ </div>
+
+ <div class="para">
+ <h:outputText value="#{msg.EXCEPTION_STACK_TRACE}:" />
+ <h:outputText value="#{pfExceptionHandler.formattedStackTrace}" escape="false" />
+ </div>
+
+ <div class="para">
+ <p:button onclick="window.location.href = document.location.href;"
+ value="#{msg.RELOAD_PAGE}"
+ rendered="#{pfExceptionHandler.type == 'javax.faces.application.ViewExpiredException'}" />
+ </div>
+ </p:dialog>
+ </h:panelGroup>
+ </h:body>
+ </f:view>
</html>
</ui:composition>