JSF completed, I feel alive
This commit is contained in:
parent
af597b18d1
commit
229f114b3f
Semester 2
LabJuneauValidateUserInput_CalebFontenot/src/main
ZIPs
@ -24,6 +24,16 @@ public class EmployeeController implements Serializable {
|
|||||||
private String employeeFirst;
|
private String employeeFirst;
|
||||||
private String employeeLast;
|
private String employeeLast;
|
||||||
private String employeeTitle;
|
private String employeeTitle;
|
||||||
|
private String employeeLastToDelete;
|
||||||
|
|
||||||
|
public String getEmployeeLastToDelete() {
|
||||||
|
return employeeLastToDelete;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmployeeLastToDelete(String employeeLastToDelete) {
|
||||||
|
this.employeeLastToDelete = employeeLastToDelete;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean validateInsertion;
|
private boolean validateInsertion;
|
||||||
|
|
||||||
@ -124,7 +134,8 @@ public class EmployeeController implements Serializable {
|
|||||||
FacesMessage facesMsg = null;
|
FacesMessage facesMsg = null;
|
||||||
if (b) {
|
if (b) {
|
||||||
facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO,
|
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.employeeFirst = "";
|
||||||
this.employeeLast = "";
|
this.employeeLast = "";
|
||||||
this.employeeTitle = "";
|
this.employeeTitle = "";
|
||||||
@ -139,12 +150,13 @@ public class EmployeeController implements Serializable {
|
|||||||
boolean de = false;
|
boolean de = false;
|
||||||
FacesMessage facesMsg = null;
|
FacesMessage facesMsg = null;
|
||||||
for (int i = 0; i < company.getEmployees().size(); ++i) {
|
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);
|
Employee employeeToDelete = company.getEmployees().get(i);
|
||||||
company.getDeletedEmployees().add(employeeToDelete);
|
company.getDeletedEmployees().add(employeeToDelete);
|
||||||
company.removeEmployee(employeeToDelete);
|
company.removeEmployee(employeeToDelete);
|
||||||
facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO,
|
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
|
@Override
|
||||||
public List<Employee> getEmployees(){return employeeList;}
|
public List<Employee> getEmployees(){return employeeList;}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<Employee> getDeletedEmployees(){return deletedEmployeeList;}
|
public List<Employee> getDeletedEmployees(){return deletedEmployeeList;}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ public class Employee {
|
|||||||
private String employeeTitle;
|
private String employeeTitle;
|
||||||
private String photo;
|
private String photo;
|
||||||
|
|
||||||
|
|
||||||
public Employee(String employeeFirst, String employeeLast, String employeeTitle, String photo)
|
public Employee(String employeeFirst, String employeeLast, String employeeTitle, String photo)
|
||||||
{
|
{
|
||||||
this.employeeFirst = employeeFirst;
|
this.employeeFirst = employeeFirst;
|
||||||
@ -107,4 +108,9 @@ public class Employee {
|
|||||||
this.employeeFirst = employeeFirst;
|
this.employeeFirst = employeeFirst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Employee{" + "employeeFirst=" + employeeFirst + ", employeeLast=" + employeeLast + ", employeeTitle=" + employeeTitle + ", photo=" + photo + '}';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<h:body>
|
<h:body>
|
||||||
<h:form id="employeeForm">
|
<h:form id="employeeForm">
|
||||||
<h:panelGrid id="outer" columns="2">
|
<h:panelGrid id="outer" columns="2">
|
||||||
<h:column style="vertical-align: top;">
|
<h:column>
|
||||||
<h1>Java Developer Employee Information</h1>
|
<h1>Java Developer Employee Information</h1>
|
||||||
<br/>
|
<br/>
|
||||||
<h:messages globalOnly="true" errorStyle="color: red"
|
<h:messages globalOnly="true" errorStyle="color: red"
|
||||||
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
<h:column id="imageCol">
|
<h:column id="imageCol">
|
||||||
<f:facet name="header">Photo</f:facet>
|
<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:column>
|
||||||
|
|
||||||
</h:dataTable>
|
</h:dataTable>
|
||||||
@ -49,14 +49,14 @@
|
|||||||
|
|
||||||
<h:outputLabel for="employeeFirst" value="First:" />
|
<h:outputLabel for="employeeFirst" value="First:" />
|
||||||
<h:inputText id="employeeFirst"
|
<h:inputText id="employeeFirst"
|
||||||
value="#{employeeController.employeeFirst}" disabled="#{employeeController.validateInsertion}">
|
value="#{employeeController.employeeFirst}" >
|
||||||
<f:validateLength minimum="3" maximum="30"/>
|
<f:validateLength minimum="3" maximum="30" disabled="#{employeeController.validateInsertion}"/>
|
||||||
</h:inputText>
|
</h:inputText>
|
||||||
<h:message for="employeeFirst" errorStyle="color:red"/>
|
<h:message for="employeeFirst" errorStyle="color:red"/>
|
||||||
|
|
||||||
<h:outputLabel for="employeeLast" value="Last: " />
|
<h:outputLabel for="employeeLast" value="Last: " />
|
||||||
<h:inputText id="employeeLast" value="#{employeeController.employeeLast}" disabled="#{employeeController.validateInsertion}">
|
<h:inputText id="employeeLast" value="#{employeeController.employeeLast}" >
|
||||||
<f:validateLength minimum="3" maximum="30"/>
|
<f:validateLength minimum="3" maximum="30" disabled="#{employeeController.validateInsertion}"/>
|
||||||
</h:inputText>
|
</h:inputText>
|
||||||
<h:message for="employeeLast" errorStyle="color:red"/>
|
<h:message for="employeeLast" errorStyle="color:red"/>
|
||||||
|
|
||||||
@ -93,9 +93,19 @@
|
|||||||
</f:facet>
|
</f:facet>
|
||||||
|
|
||||||
<h:column id="empDeletedName">
|
<h:column id="empDeletedName">
|
||||||
<f:facet name="header">Name</f:facet>
|
<f:facet name="header">Employee</f:facet>
|
||||||
<h:outputText id="empNameDelete"
|
<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:column>
|
||||||
|
|
||||||
</h:dataTable>
|
</h:dataTable>
|
||||||
@ -104,8 +114,8 @@
|
|||||||
|
|
||||||
|
|
||||||
<h:outputLabel for="employeeLastToDelete" value="Last: " />
|
<h:outputLabel for="employeeLastToDelete" value="Last: " />
|
||||||
<h:inputText id="employeeLastToDelete" value="#{employeeController.employeeLast}">
|
<h:inputText id="employeeLastToDelete" value="#{employeeController.employeeLastToDelete}">
|
||||||
<f:validateLength minimum="3" maximum="30" disabled="#{!employeeController.validateInsertion}"/>
|
<!--f:validateLength minimum="3" maximum="30" disabled="#{!employeeController.validateInsertion}"/!-->
|
||||||
</h:inputText>
|
</h:inputText>
|
||||||
<h:message for="employeeLastToDelete" errorStyle="color:red"/>
|
<h:message for="employeeLastToDelete" errorStyle="color:red"/>
|
||||||
|
|
||||||
@ -115,9 +125,9 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h:commandButton id="delete"
|
<h:commandButton id="delete"
|
||||||
action="#{employeeController.delete}"
|
action="#{employeeController.delete}"
|
||||||
value="Delete Employee"/>
|
value="Delete Employee"/>
|
||||||
</h:column>
|
</h:column>
|
||||||
|
|
||||||
</h:panelGrid>
|
</h:panelGrid>
|
||||||
|
@ -14,3 +14,8 @@ td {
|
|||||||
padding-left: 30px;
|
padding-left: 30px;
|
||||||
padding-right: 40px;
|
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