From 7867cd61c382ac822e545c8dcca9e68b945c2158 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 --- .../beans/helper/JobsWebViewHelperBean.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 | 14 ++++++++------ web/admin/employee/admin_employee_list.xhtml | 14 ++++++++------ 7 files changed, 50 insertions(+), 25 deletions(-) diff --git a/src/java/org/mxchange/jjobs/beans/helper/JobsWebViewHelperBean.java b/src/java/org/mxchange/jjobs/beans/helper/JobsWebViewHelperBean.java index 6c506324..7a842607 100644 --- a/src/java/org/mxchange/jjobs/beans/helper/JobsWebViewHelperBean.java +++ b/src/java/org/mxchange/jjobs/beans/helper/JobsWebViewHelperBean.java @@ -443,18 +443,25 @@ public class JobsWebViewHelperBean extends BaseJobsBean implements JobsWebViewHe /** * 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 JobsWebViewHelperBean extends BaseJobsBean implements JobsWebViewHe 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 JobsWebViewHelperBean extends BaseJobsBean implements JobsWebViewHe // 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 290b73ff..1d42dbe8 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 310934e5..b7abea68 100644 --- a/web/admin/branch_office/admin_branch_office_list.xhtml +++ b/web/admin/branch_office/admin_branch_office_list.xhtml @@ -102,12 +102,16 @@ value="#{basicDataListController.allBasicData}" var="basicData" itemValue="#{basicData}" - itemLabel="#{beanHelper.renderBasicData(basicData)}" + itemLabel="#{beanHelper.renderBasicData(basicData, true)}" /> - + @@ -221,7 +225,12 @@ - + diff --git a/web/admin/department/admin_department_list.xhtml b/web/admin/department/admin_department_list.xhtml index 6f49671c..f9df8cc0 100644 --- a/web/admin/department/admin_department_list.xhtml +++ b/web/admin/department/admin_department_list.xhtml @@ -79,16 +79,18 @@ 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 b2e7f4f8..5d16be5f 100644 --- a/web/admin/employee/admin_employee_list.xhtml +++ b/web/admin/employee/admin_employee_list.xhtml @@ -134,16 +134,18 @@ value="#{basicDataListController.allBasicData}" var="basicData" itemValue="#{basicData}" - itemLabel="#{beanHelper.renderBasicData(basicData)}" + itemLabel="#{beanHelper.renderBasicData(basicData, true)}" /> - - - - - + + + -- 2.39.5