From 4db105abc10b723371147f7c658e92c31e8db356 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 22 Dec 2018 01:15:33 +0100 Subject: [PATCH] Please cherry-pick: - introduced 2nd parameter for beanHelper.renderBasicData() to include short or long name in view components - also use that method instead of invoking getter in same helper backing-bean - re-aligned some JSF tags to have their attributes in distinct lines (easy to add another) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../helper/FinancialsWebViewHelperBean.java | 19 +++++++++++++------ .../admin_form_branch_office_data.tpl | 2 +- .../department/admin_form_department_data.tpl | 2 +- .../employee/admin_form_employee_data.tpl | 9 +++++++-- .../admin_branch_office_list.xhtml | 15 ++++++++++++--- .../department/admin_department_list.xhtml | 8 ++++++-- web/admin/employee/admin_employee_list.xhtml | 8 ++++++-- 7 files changed, 46 insertions(+), 17 deletions(-) diff --git a/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebViewHelperBean.java b/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebViewHelperBean.java index a2709ec3..811af1a7 100644 --- a/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebViewHelperBean.java +++ b/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebViewHelperBean.java @@ -443,18 +443,25 @@ public class FinancialsWebViewHelperBean extends BaseFinancialsBean implements F /** * Renders data of basic company data *

- * @param basicData Basic company data instance + * @param basicData Basic company data instance + * @param useShortName Whether to use short name or long name of company *

* @return Basic company data as string */ - public String renderBasicData (final BasicData basicData) { + public String renderBasicData (final BasicData basicData, final boolean useShortName) { // Default is empty string, so let's get started final StringBuilder sb = new StringBuilder(30); // Is basic company data set? if (basicData instanceof BasicData) { - // Add company name - sb.append(basicData.getCompanyName()); //NOI18N + // Short or long name? + if (useShortName) { + // Add company's long name + sb.append(basicData.getCompanyShortName()); //NOI18N + } else { + // Add company's long name + sb.append(basicData.getCompanyName()); //NOI18N + } // Is email address set? if (basicData.getCompanyEmailAddress() != null) { @@ -491,7 +498,7 @@ public class FinancialsWebViewHelperBean extends BaseFinancialsBean implements F assert (branchOffice.getBranchCompany() instanceof BasicData) : "branchOffice.branchCompany is null"; //NOI18N // Yes, then append all data - sb.append(branchOffice.getBranchCompany().getCompanyName()); + sb.append(this.renderBasicData(branchOffice.getBranchCompany(), true)); sb.append(", "); //NOI18N sb.append(branchOffice.getBranchStreet()); sb.append(" "); //NOI18N @@ -576,7 +583,7 @@ public class FinancialsWebViewHelperBean extends BaseFinancialsBean implements F // Then create name sb.append(this.getMessageFromBundle(department.getDepartmentI18nKey())); sb.append(" ("); //NOI18N - sb.append(department.getDepartmentCompany().getCompanyName()); + sb.append(this.renderBasicData(department.getDepartmentCompany(), true)); sb.append(")"); //NOI18N } diff --git a/web/WEB-INF/templates/admin/branch_office/admin_form_branch_office_data.tpl b/web/WEB-INF/templates/admin/branch_office/admin_form_branch_office_data.tpl index 90a88a8d..6b4e9f96 100644 --- a/web/WEB-INF/templates/admin/branch_office/admin_form_branch_office_data.tpl +++ b/web/WEB-INF/templates/admin/branch_office/admin_form_branch_office_data.tpl @@ -36,7 +36,7 @@ value="#{basicDataListController.allBasicData}" var="basicData" itemValue="#{basicData}" - itemLabel="#{beanHelper.renderBasicData(basicData)}" + itemLabel="#{beanHelper.renderBasicData(basicData, true)}" /> diff --git a/web/WEB-INF/templates/admin/department/admin_form_department_data.tpl b/web/WEB-INF/templates/admin/department/admin_form_department_data.tpl index 42747902..6d45042d 100644 --- a/web/WEB-INF/templates/admin/department/admin_form_department_data.tpl +++ b/web/WEB-INF/templates/admin/department/admin_form_department_data.tpl @@ -43,7 +43,7 @@ value="#{basicDataListController.allBasicData}" var="basicData" itemValue="#{basicData}" - itemLabel="#{beanHelper.renderBasicData(basicData)}" + itemLabel="#{beanHelper.renderBasicData(basicData, true)}" /> diff --git a/web/WEB-INF/templates/admin/employee/admin_form_employee_data.tpl b/web/WEB-INF/templates/admin/employee/admin_form_employee_data.tpl index be6680b6..2aef9d52 100644 --- a/web/WEB-INF/templates/admin/employee/admin_form_employee_data.tpl +++ b/web/WEB-INF/templates/admin/employee/admin_form_employee_data.tpl @@ -30,13 +30,18 @@ - + diff --git a/web/admin/branch_office/admin_branch_office_list.xhtml b/web/admin/branch_office/admin_branch_office_list.xhtml index f4feb5f8..7edd8391 100644 --- a/web/admin/branch_office/admin_branch_office_list.xhtml +++ b/web/admin/branch_office/admin_branch_office_list.xhtml @@ -107,12 +107,16 @@ value="#{basicDataListController.allBasicData}" var="basicData" itemValue="#{basicData}" - itemLabel="#{beanHelper.renderBasicData(basicData)}" + itemLabel="#{beanHelper.renderBasicData(basicData, true)}" /> - + @@ -226,7 +230,12 @@ - + diff --git a/web/admin/department/admin_department_list.xhtml b/web/admin/department/admin_department_list.xhtml index a5329f06..f9df8cc0 100644 --- a/web/admin/department/admin_department_list.xhtml +++ b/web/admin/department/admin_department_list.xhtml @@ -79,12 +79,16 @@ value="#{basicDataListController.allBasicData}" var="basicData" itemValue="#{basicData}" - itemLabel="#{beanHelper.renderBasicData(basicData)}" + itemLabel="#{beanHelper.renderBasicData(basicData, true)}" /> - + diff --git a/web/admin/employee/admin_employee_list.xhtml b/web/admin/employee/admin_employee_list.xhtml index 12e7bd84..bcff7fd2 100644 --- a/web/admin/employee/admin_employee_list.xhtml +++ b/web/admin/employee/admin_employee_list.xhtml @@ -139,12 +139,16 @@ value="#{basicDataListController.allBasicData}" var="basicData" itemValue="#{basicData}" - itemLabel="#{beanHelper.renderBasicData(basicData)}" + itemLabel="#{beanHelper.renderBasicData(basicData, true)}" /> - + -- 2.39.5