* EJB for general financial income purposes
*/
@EJB (lookup = "java:global/jfinancials-ejb/financialIncome!org.mxchange.jfinancials.model.income.FinancialIncomeSessionBeanRemote")
- private FinancialIncomeSessionBeanRemote financialBean;
+ private FinancialIncomeSessionBeanRemote financialIncomeBean;
+
+ /**
+ * Whether the income is enabled
+ */
+ private Boolean incomeEnabled;
/**
* Income interval
}
// Now that all required data has been entered, prepare new income instance
- final BillableIncome income = new FinancialIncome(this.getIncomeTitle(), this.getIncomeSingleAmount(), this.getIncomeInterval(), this.userLoginController.getLoggedInUser());
+ final BillableIncome income = new FinancialIncome(
+ this.getIncomeTitle(),
+ this.getIncomeSingleAmount(),
+ this.getIncomeInterval(),
+ this.userLoginController.getLoggedInUser(),
+ this.getIncomeEnabled()
+ );
// Handle it over to the EJB
// @TODO Use updated income instance, e.g. fire event
- final BillableIncome updatedIncome = this.financialBean.addIncome(income);
+ final BillableIncome updatedIncome = this.financialIncomeBean.addIncome(income);
}
/**
return Arrays.asList(FinancialInterval.values());
}
+ /**
+ * Getter for incomeEnabled flag
+ * <p>
+ * @return incomeEnabled flag
+ */
+ public Boolean getIncomeEnabled () {
+ return this.incomeEnabled;
+ }
+
+ /**
+ * Setter for incomeEnabled flag
+ * <p>
+ * @param incomeEnabled incomeEnabled flag
+ */
+ public void setIncomeEnabled (final Boolean incomeEnabled) {
+ this.incomeEnabled = incomeEnabled;
+ }
+
/**
* Getter for income interval
* <p>
<ui:define name="content">
<h:form>
- <h:panelGroup layout="block">
- <div class="table-header">
- <h:outputText value="#{project.LOGIN_FINANCIAL_ADD_INCOME_FORM_TITLE}" />
- </div>
-
- <h:panelGroup styleClass="table-row" layout="block">
- <div class="table-left-medium">
- <p:outputLabel for="incomeTitle" value="#{project.LOGIN_FINANCIAL_INCOME_TITLE}" />
- </div>
+ <h:panelGroup
+ styleClass="table-header"
+ layout="block"
+ >
+ <h:outputText value="#{project.LOGIN_FINANCIAL_ADD_INCOME_FORM_TITLE}" />
+ </h:panelGroup>
- <div class="table-right-medium">
- <p:inputText id="incomeTitle" size="2" maxlength="10" value="#{financialIncomeController.incomeTitle}" required="true" requiredMessage="#{project.FIELD_FINANCIAL_INCOME_TITLE_REQUIRED}">
- <f:validator validatorId="IncomeTitleValidator" />
- </p:inputText>
- </div>
- </h:panelGroup>
+ <p:panelGrid
+ columns="2"
+ layout="grid"
+ >
+ <p:outputLabel for="incomeTitle" value="#{project.LOGIN_FINANCIAL_INCOME_TITLE}" />
+ <p:inputText id="incomeTitle" size="2" maxlength="10" value="#{financialIncomeController.incomeTitle}" required="true" requiredMessage="#{project.FIELD_FINANCIAL_INCOME_TITLE_REQUIRED}">
+ <f:validator validatorId="IncomeTitleValidator" />
+ </p:inputText>
- <h:panelGroup styleClass="table-row" layout="block">
- <div class="table-left-medium">
- <p:outputLabel for="incomeInterval" value="#{project.LOGIN_FINANCIAL_INCOME_INTERVAL}" />
- </div>
+ <p:outputLabel for="incomeInterval" value="#{project.LOGIN_FINANCIAL_INCOME_INTERVAL}" />
+ <p:selectOneMenu
+ id="incomeInterval"
+ value="#{financialIncomeController.incomeInterval}"
+ filter="true"
+ filterMatchMode="contains"
+ required="true"
+ requiredMessage="#{project.FIELD_FINANCIAL_INCOME_REQUIRED}"
+ >
+ <f:selectItems
+ value="#{financialIncomeController.allIncomeIntervals()}"
+ var="incomeInterval"
+ itemValue="#{incomeInterval}"
+ itemLabel="#{msg[incomeInterval.concat('_INTERVAL')]}"
+ />
+ </p:selectOneMenu>
- <div class="table-right-medium">
- <p:selectOneMenu
- id="incomeInterval"
- value="#{financialIncomeController.incomeInterval}"
- filter="true"
- filterMatchMode="contains"
- required="true"
- requiredMessage="#{project.FIELD_FINANCIAL_INCOME_REQUIRED}"
- >
- <f:selectItems
- value="#{financialIncomeController.allIncomeIntervals()}"
- var="incomeInterval"
- itemValue="#{incomeInterval}"
- itemLabel="#{msg[incomeInterval.concat('_INTERVAL')]}"
- />
- </p:selectOneMenu>
- </div>
- </h:panelGroup>
+ <p:outputLabel for="incomeSingleValue" value="#{project.LOGIN_FINANCIAL_INCOME_SINGLE_VALUE}" />
+ <p:inputText id="incomeSingleValue" size="5" maxlength="20" value="#{financialIncomeController.incomeSingleAmount}" required="true" requiredMessage="#{project.FIELD_FINANCIAL_INCOME_SINGLE_VALUE_REQUIRED}">
+ <f:validator validatorId="CurrencyAmountValidator" />
+ </p:inputText>
- <h:panelGroup styleClass="table-row" layout="block">
- <div class="table-left-medium">
- <p:outputLabel for="incomeSingleValue" value="#{project.LOGIN_FINANCIAL_INCOME_SINGLE_VALUE}" />
- </div>
+ <p:outputLabel for="incomeEnabled" value="#{project.ADMIN_ENABLE_INCOME}" />
+ <p:selectBooleanCheckbox
+ id="incomeEnabled"
+ value="#{financialIncomeController.incomeEnabled}"
+ required="true"
+ requiredMessage="#{project.ADMIN_ENABLE_INCOME_REQUIRED}"
+ title="#{project.ADMIN_ENABLE_INCOME_TITLE}"
+ />
+ </p:panelGrid>
- <div class="table-right-medium">
- <p:inputText id="incomeSingleValue" size="5" maxlength="20" value="#{financialIncomeController.incomeSingleAmount}" required="true" requiredMessage="#{project.FIELD_FINANCIAL_INCOME_SINGLE_VALUE_REQUIRED}">
- <f:validator validatorId="CurrencyAmountValidator" />
- </p:inputText>
- </div>
- </h:panelGroup>
+ <p:panelGrid columns="2" layout="grid">
+ <p:commandButton
+ type="reset"
+ value="#{msg.BUTTON_RESET_FORM}"
+ />
- <p:panelGrid columns="2" layout="grid">
- <p:commandButton
- type="reset"
- value="#{msg.BUTTON_RESET_FORM}"
- />
-
- <p:commandButton
- type="submit"
- value="#{project.BUTTON_LOGIN_FINANCIAL_ADD_INCOME}"
- action="#{financialIncomeController.addIncome()}"
- />
- </p:panelGrid>
- </h:panelGroup>
+ <p:commandButton
+ type="submit"
+ value="#{project.BUTTON_LOGIN_FINANCIAL_ADD_INCOME}"
+ action="#{financialIncomeController.addIncome()}"
+ />
+ </p:panelGrid>
</h:form>
</ui:define>
</ui:composition>