JSF completed, I feel alive
This commit is contained in:
parent
af597b18d1
commit
229f114b3f
@ -24,6 +24,16 @@ public class EmployeeController implements Serializable {
|
||||
private String employeeFirst;
|
||||
private String employeeLast;
|
||||
private String employeeTitle;
|
||||
private String employeeLastToDelete;
|
||||
|
||||
public String getEmployeeLastToDelete() {
|
||||
return employeeLastToDelete;
|
||||
}
|
||||
|
||||
public void setEmployeeLastToDelete(String employeeLastToDelete) {
|
||||
this.employeeLastToDelete = employeeLastToDelete;
|
||||
}
|
||||
|
||||
|
||||
private boolean validateInsertion;
|
||||
|
||||
@ -124,7 +134,8 @@ public class EmployeeController implements Serializable {
|
||||
FacesMessage facesMsg = null;
|
||||
if (b) {
|
||||
facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO,
|
||||
"Employee Successfully Added", null);
|
||||
"Successfully Added Employee: " + this.employeeFirst + " " + this.employeeLast, null);
|
||||
System.out.println("Successfully Added Employee: " + this.employeeFirst + " " + this.employeeLast);
|
||||
this.employeeFirst = "";
|
||||
this.employeeLast = "";
|
||||
this.employeeTitle = "";
|
||||
@ -139,12 +150,13 @@ public class EmployeeController implements Serializable {
|
||||
boolean de = false;
|
||||
FacesMessage facesMsg = null;
|
||||
for (int i = 0; i < company.getEmployees().size(); ++i) {
|
||||
if (company.getEmployees().get(i).getEmployeeLast().toLowerCase().equals(this.getEmployeeLast().toLowerCase())) {
|
||||
if (company.getEmployees().get(i).getEmployeeLast().toLowerCase().equals(this.getEmployeeLastToDelete().toLowerCase())) {
|
||||
Employee employeeToDelete = company.getEmployees().get(i);
|
||||
company.getDeletedEmployees().add(employeeToDelete);
|
||||
company.removeEmployee(employeeToDelete);
|
||||
facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO,
|
||||
"Employee Successfully Deleted", null);
|
||||
"Successfully Deleted Employee: " + company.getEmployees().get(i), null);
|
||||
System.out.println("Successfully Deleted Employee: " + company.getEmployees().get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,8 @@ public Company() {
|
||||
|
||||
@Override
|
||||
public List<Employee> getEmployees(){return employeeList;}
|
||||
|
||||
@Override
|
||||
public List<Employee> getDeletedEmployees(){return deletedEmployeeList;}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ public class Employee {
|
||||
private String employeeTitle;
|
||||
private String photo;
|
||||
|
||||
|
||||
public Employee(String employeeFirst, String employeeLast, String employeeTitle, String photo)
|
||||
{
|
||||
this.employeeFirst = employeeFirst;
|
||||
@ -107,4 +108,9 @@ public class Employee {
|
||||
this.employeeFirst = employeeFirst;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Employee{" + "employeeFirst=" + employeeFirst + ", employeeLast=" + employeeLast + ", employeeTitle=" + employeeTitle + ", photo=" + photo + '}';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
<h:body>
|
||||
<h:form id="employeeForm">
|
||||
<h:panelGrid id="outer" columns="2">
|
||||
<h:column style="vertical-align: top;">
|
||||
<h:column>
|
||||
<h1>Java Developer Employee Information</h1>
|
||||
<br/>
|
||||
<h:messages globalOnly="true" errorStyle="color: red"
|
||||
@ -40,7 +40,7 @@
|
||||
|
||||
<h:column id="imageCol">
|
||||
<f:facet name="header">Photo</f:facet>
|
||||
<h:graphicImage library="images" name="#{emp.photo}"/>
|
||||
<h:graphicImage height="50px" width="50px" class="image" library="images" name="#{emp.photo}"/>
|
||||
</h:column>
|
||||
|
||||
</h:dataTable>
|
||||
@ -49,14 +49,14 @@
|
||||
|
||||
<h:outputLabel for="employeeFirst" value="First:" />
|
||||
<h:inputText id="employeeFirst"
|
||||
value="#{employeeController.employeeFirst}" disabled="#{employeeController.validateInsertion}">
|
||||
<f:validateLength minimum="3" maximum="30"/>
|
||||
value="#{employeeController.employeeFirst}" >
|
||||
<f:validateLength minimum="3" maximum="30" disabled="#{employeeController.validateInsertion}"/>
|
||||
</h:inputText>
|
||||
<h:message for="employeeFirst" errorStyle="color:red"/>
|
||||
|
||||
<h:outputLabel for="employeeLast" value="Last: " />
|
||||
<h:inputText id="employeeLast" value="#{employeeController.employeeLast}" disabled="#{employeeController.validateInsertion}">
|
||||
<f:validateLength minimum="3" maximum="30"/>
|
||||
<h:inputText id="employeeLast" value="#{employeeController.employeeLast}" >
|
||||
<f:validateLength minimum="3" maximum="30" disabled="#{employeeController.validateInsertion}"/>
|
||||
</h:inputText>
|
||||
<h:message for="employeeLast" errorStyle="color:red"/>
|
||||
|
||||
@ -93,9 +93,19 @@
|
||||
</f:facet>
|
||||
|
||||
<h:column id="empDeletedName">
|
||||
<f:facet name="header">Name</f:facet>
|
||||
<f:facet name="header">Employee</f:facet>
|
||||
<h:outputText id="empNameDelete"
|
||||
value=""/>
|
||||
value="#{emp.getEmployeeFirst()} #{emp.employeeLast}"/>
|
||||
</h:column>
|
||||
|
||||
<h:column id="deletedTitleCol">
|
||||
<f:facet name="header">Title</f:facet>
|
||||
<h:outputText id="deletedTitle" value="#{emp.employeeTitle}"/>
|
||||
</h:column>
|
||||
|
||||
<h:column id="imageCol">
|
||||
<f:facet name="header">Photo</f:facet>
|
||||
<h:graphicImage height="50px" width="50px" class="image" library="images" name="#{emp.photo}"/>
|
||||
</h:column>
|
||||
|
||||
</h:dataTable>
|
||||
@ -104,8 +114,8 @@
|
||||
|
||||
|
||||
<h:outputLabel for="employeeLastToDelete" value="Last: " />
|
||||
<h:inputText id="employeeLastToDelete" value="#{employeeController.employeeLast}">
|
||||
<f:validateLength minimum="3" maximum="30" disabled="#{!employeeController.validateInsertion}"/>
|
||||
<h:inputText id="employeeLastToDelete" value="#{employeeController.employeeLastToDelete}">
|
||||
<!--f:validateLength minimum="3" maximum="30" disabled="#{!employeeController.validateInsertion}"/!-->
|
||||
</h:inputText>
|
||||
<h:message for="employeeLastToDelete" errorStyle="color:red"/>
|
||||
|
||||
@ -115,13 +125,13 @@
|
||||
|
||||
|
||||
|
||||
<h:commandButton id="delete"
|
||||
action="#{employeeController.delete}"
|
||||
value="Delete Employee"/>
|
||||
<h:commandButton id="delete"
|
||||
action="#{employeeController.delete}"
|
||||
value="Delete Employee"/>
|
||||
</h:column>
|
||||
|
||||
</h:panelGrid>
|
||||
|
||||
|
||||
|
||||
</h:form>
|
||||
</h:body>
|
||||
|
@ -13,4 +13,9 @@ td {
|
||||
padding-bottom: 20px;
|
||||
padding-left: 30px;
|
||||
padding-right: 40px;
|
||||
}
|
||||
|
||||
.image {
|
||||
width: 50px;
|
||||
height: auto;
|
||||
}
|
BIN
Semester 2/ZIPs/LabJuneauValidateUserInput_CalebFontenot.zip
Normal file
BIN
Semester 2/ZIPs/LabJuneauValidateUserInput_CalebFontenot.zip
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user