Академический Документы
Профессиональный Документы
Культура Документы
*/
package com.philit.apps;
import com.philit.apps.dao.TblLoginDao;
import com.philit.apps.dao.TblRegistrationDao;
import com.philit.apps.dao.impl.TblLoginDaoImpl;
import com.philit.apps.dao.impl.TblRegistrationDaoImpl;
import com.philit.apps.entity.TblLogin;
import com.philit.apps.entity.TblRegistration;
import com.philit.apps.util.Constant;
import com.vaadin.addon.tableexport.ExcelExport;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.DateField;
import com.vaadin.ui.Form;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Panel;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.TabSheet.Tab;
import com.vaadin.ui.Table;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.TextField;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.themes.BaseTheme;
import com.vaadin.ui.themes.ChameleonTheme;
import java.io.Serializable;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import javax.servlet.annotation.WebServlet;
//@Theme("mytheme")
@Theme("runo")
//@Theme("liferay")
//@Theme("valo")
@SuppressWarnings("serial")
/**
*/
return tblRegistration;
/**
*/
this.tblRegistration = tblRegistration;
/**
*/
return lstTblRegistration;
/**
* @param lstTblRegistration the lstTblRegistration to set
*/
this.lstTblRegistration = lstTblRegistration;
/**
*/
// return tblRegistration;
// }
//
// /**
// */
// this.tblRegistration = tblRegistration;
// }
//STUDENT INFORMATION
//2nd Panel
// 3rd Panel
// 4rt Panel
//Database entities
//Update/delete/Add (Action)
//Query... Implementation
//List Components
//Entity
//Notification
/**
*/
public Notification getNotify() {
return notify;
/**
*/
// return tblLogin;
// }
/**
*/
// this.tblLogin = tblLogin;
// }
/**
*/
// return lstTblRegistration;
// }
/**
*/
// public void setLstTblRegistration(List<TblRegistration> lstTblRegistration) {
// this.lstTblRegistration = lstTblRegistration;
// }
//UI
@Override
// setSizeFull();
// layout.setSizeFull();
layout.setMargin(true);
layout.setSpacing(true);
setContent(layout);
btnSave.setWidth(buttonWidth);
btnSave.addClickListener((Button.ClickListener) this);
btnSearch.setWidth(buttonWidth);
btnSearch.addClickListener((Button.ClickListener) this);
btnDisplayAll.setWidth(buttonWidth);
btnDisplayAll.addClickListener((Button.ClickListener) this);
btnExportExcel1.addListener((Button.ClickListener) this);
btnExportExcel1.setWidth("150px");
pnlTraining.setWidth("90%");
pnlTraining.setSizeFull();
//2nd Horizontal
tfFirstName.setWidth(tfWidth);
tfMiddleName.setWidth(tfWidth);
tfLastName.setWidth("180");
tfEmail.setWidth(tfWidth);
hlStudentName.setSpacing(true);
hlStudentName.addComponent(tfFirstName);
hlStudentName.addComponent(tfMiddleName);
hlStudentName.addComponent(tfLastName);
hlStudentName.addComponent(tfExtensionName);
//1st Horizontal
tfSchoolYear.setWidth("300px");
tfStudentNo.setWidth(tfWidth);
tfCourse.setWidth(tfWidth);
tfBatchNo.setWidth("100");
hlSchoolControlNo.setSpacing(true);
hlSchoolControlNo.addComponent(tfSchoolYear);
hlSchoolControlNo.addComponent(tfStudentNo);
hlSchoolControlNo.addComponent(tfCourse);
hlSchoolControlNo.addComponent(tfBatchNo);
// 3rd Horizontal
tfReligion.setWidth("150px");
tfAge.setWidth("150");
cbGender.setWidth("50");
cbCivilStatus.setWidth("100");
tfSpouse.setWidth(tfWidth);
hlOtherInfo.setSpacing(true);
hlOtherInfo.addComponent(tfReligion);
hlOtherInfo.addComponent(tfAge);
hlOtherInfo.addComponent(cbGender);
hlOtherInfo.addComponent(cbCivilStatus);
hlOtherInfo.addComponent(tfSpouse);
// 4rt Horizontal
tfAdress.setWidth("300px");
tfBarangay.setWidth(tfWidth);
tfDistrict.setWidth(tfWidth);
hlAdresses.setSpacing(true);
hlAdresses.addComponent(tfAdress);
hlAdresses.addComponent(tfBarangay);
hlAdresses.addComponent(tfDistrict);
// 5th Horizontal
tfCityMunicipality.setWidth("300px");
tfProvince.setWidth(tfWidth);
tfRegion.setWidth(tfWidth);
hlAdresses2.setSpacing(true);
hlAdresses2.addComponent(tfCityMunicipality);
hlAdresses2.addComponent(tfProvince);
hlAdresses2.addComponent(tfRegion);
// 6th Horizontal
tfBirthday.setWidth("300px");
tfBirthplace.setWidth(tfWidth);
tfRegion1.setWidth(tfWidth);
tfNationality.setWidth("200");
hlBirth.setSpacing(true);
hlBirth.addComponent(tfBirthday);
hlBirth.addComponent(tfBirthplace);
hlBirth.addComponent(tfRegion1);
hlBirth.addComponent(tfNationality);
// 7th Horizontal
tfMobileNum.setWidth("300px");
tfHomeNum.setWidth(tfWidth);
tfEmailAdd.setWidth(tfWidth);
// tfEmailAdd.setImmediate(true);
// tfEmailAdd.addListener(new TextField.ValueChangeListener(){
// @Override
// if (tfEmailAdd.getvalue() != null
// && tfEmailAdd.getValue().toString().length() > 0
// && tfEmailAdd.getValue().toString().contains("@")
// && tfEmailAdd.getValue().toString().contains(".")) {
// //do nothing
// } else {
// tfEmailAdd.focus();
// }
// }
// });
hlContactNum.setSpacing(true);
hlContactNum.addComponent(tfMobileNum);
hlContactNum.addComponent(tfHomeNum);
hlContactNum.addComponent(tfEmailAdd);
tfAddress.setWidth(tfWidth);
tfContactNo.setWidth(tfWidth);
cbGender.setWidth(tfWidth);
cbGender.addItem("Male");
cbGender.addItem("Female");
cbGender.addItem("Undefined");
cbCivilStatus.addItem("Single");
cbCivilStatus.addItem("Married");
cbCivilStatus.addItem("Separated");
dfBirthDate.setWidth(tfWidth);
vlTraining.setMargin(true);
vlTraining.setSizeUndefined();
vlTraining.addComponent(hlSchoolControlNo);
vlTraining.addComponent(hlStudentName);
vlTraining.addComponent(hlOtherInfo);
vlTraining.addComponent(hlAdresses);
vlTraining.addComponent(hlAdresses2);
vlTraining.addComponent(hlBirth);
vlTraining.addComponent(hlContactNum);
vlTraining.addComponent(btnSave);
pnlTraining.setContent(vlTraining);
pnlAcademic.setWidth("90%");
pnlAcademic.setSizeFull();
// lblHSeduc.setContentMode.Label;
// lblHSeduc.setWidth(tfWidth2);
tfHSeduc.setWidth("600px");
tfTertiaryeduc.setWidth("600px");
hlStudentName11.setSpacing(true);
hlStudentName11.addComponent(tfHSeduc);
hlStudentName11.addComponent(tfTertiaryeduc);
tfHSNameSchool.setWidth(tfWidth);
tfTSNameSchool.setWidth(tfWidth);
hlNameofSchool.setSpacing(true);
hlNameofSchool.addComponent(tfHSNameSchool);
hlNameofSchool.addComponent(tfTSNameSchool);
//Vertical Layout
vlAcademic.setMargin(true);
vlAcademic.setSizeUndefined();
vlAcademic.addComponent(hlStudentName11);
vlAcademic.addComponent(hlNameofSchool);
pnlAcademic.setContent(vlAcademic);
pnlAcademic.setContent(vlAcademic);
pnlFamilyBackground.setWidth("90%");
pnlFamilyBackground.setSizeFull();
tfFather.setWidth("600px");
tfMother.setWidth("600px");
hlParents.addComponent(tfFather);
hlParents.addComponent(tfMother);
// Vertical Layout
vlFamilyBackground.setMargin(true);
vlFamilyBackground.setSizeUndefined();
vlFamilyBackground.addComponent(hlParents);
pnlFamilyBackground.setContent(vlFamilyBackground);
Panel pnlEmergency = new Panel("EMERGENCY CONTACT PERSON (In Case of emergency , please
notify :");
pnlEmergency.setWidth("90%");
pnlEmergency.setSizeFull();
tfEmergencyName.setWidth("600px");
tfRelation.setWidth("600px");
hlEmergency1.addComponent(tfEmergencyName);
hlEmergency1.addComponent(tfRelation);
// Vertical Layout
vlEmergency.setMargin(true);
vlEmergency.setSizeUndefined();
vlEmergency.addComponent(hlEmergency1);
pnlEmergency.setContent(vlEmergency);
// vlSearch.setWidth("100%");
// pnlTraining.setContent(vlSearch);
// pnlTraining.setWidth("90%");
tabSheetSalesDataEntry.setWidth("90%");
tabSheetSalesDataEntry.setSizeFull();
tabSheetSalesDataEntry.setSizeFull();
//layout.addComponent(pnlTraining);
// layout.setComponentAlignment(pnlTraining, Alignment.MIDDLE_CENTER);
// layout.addComponent(pnlAcademic);
// layout.setComponentAlignment(pnlAcademic, Alignment.MIDDLE_CENTER);
// layout.addComponent(pnlFamilyBackground);
// layout.setComponentAlignment(pnlFamilyBackground, Alignment.MIDDLE_CENTER);
// layout.addComponent(pnlEmergency);
// layout.setComponentAlignment(pnlEmergency, Alignment.MIDDLE_CENTER);
layout.addComponent(tabSheetSalesDataEntry);
layout.setComponentAlignment(tabSheetSalesDataEntry, Alignment.MIDDLE_CENTER);
//Logic
////
@Override
public void buttonClick(Button.ClickEvent event) {
if (source == btnSave) {
//tfTicketId.setValue("Ticket Number");
tblRegistrationNew.setRegistrationSchoolYear(tfSchoolYear.getValue()!=null?
tfSchoolYear.getValue().toString():"");
tblRegistrationNew.setRegistrationStudentNo(tfStudentNo.getValue()!=null?
tfStudentNo.getValue().toString():"");
tblRegistrationNew.setRegistrationCourse(tfCourse.getValue()!=null?
tfCourse.getValue().toString():"");
tblRegistrationNew.setRegistrationFirstName(tfFirstName.getValue()!=null?
tfFirstName.getValue().toString():"");
tblRegistrationNew.setRegistrationMiddleName(tfMiddleName.getValue()!=null?
tfMiddleName.getValue().toString():"");
tblRegistrationNew.setRegistrationLastName(tfLastName.getValue() !=null?
tfLastName.getValue().toString():"");
tblRegistrationNew.setRegistrationContactNo(tfContactNo.getValue() !=null?
tfContactNo.getValue().toString():"");
tblRegistrationNew.setRegistrationGender(cbGender.getValue().toString());
tblRegistrationNew.setRegistrationEmail(tfEmail.getValue().toString());
tblRegistrationNew.setRegistrationBirthDate(dfBirthDate.getValue());
tblRegistrationNew.setRegistrationAddress(tfAddress.getValue().toString());
tblRegistrationDao.save(tblRegistrationNew);
refreshTrainingList();
//This will Save Information to Database
//==================================================================
tblRegistrationDao.save(tblRegistrationNew);
//
clearForm();
refreshTrainingList();
getNotify().show(event.getButton().getCaption());
ExcelExport excelExport;
excelExport.excludeCollapsedColumns();
excelExport.setReportTitle("Table Search");
excelExport.export();
refreshTrainingList();
refreshTrainingList();
getNotify().show(event.getButton().getCaption());
} else {
getNotify().show(event.getButton().getCaption());
tblSearch.removeAllItems();
tblSearch.setStyleName(ChameleonTheme.TABLE_STRIPED);
tblSearch.setWidth("100%");
//======================================================================
} else {
// return
o1.getRegistrationLastName().toString().compareTo(o2.getRegistrationLastName().toString());
// }
// });
for (final TblRegistration tblRegistration : getLstTblRegistration()) {
//
//
viewBtn.setData(String.valueOf(tblRegistration.getRegistrationId()));
//
viewBtn.addListener(new Button.ClickListener() {
@Override
//getWindow().showNotification(event.getButton().getData().toString() + ";;;;" +
event.getButton().getDescription().toString());
//// setTblRegistration(tblRegistration);
//// populateForm();
//// refreshThis();
//// getRoot().setPayrollSearchPanelViewTab1(payrollPayrollPeriodPanelView);
});
deleteBtn.setData(String.valueOf(tblRegistration.getRegistrationId()));
deleteBtn.addListener(new Button.ClickListener() {
@Override
// tblRegistrationDao.delete(tblRegistration);
// refreshTrainingList();
});
//
//// statusBtn.setData(String.valueOf(tblPeriod.getPeriodId()));
////
//// @Override
//// tblPeriod.setPeriodModifiedByLoginId(mainRoot.getTblLogin().getLoginId());
//// if (tblPeriod.getPeriodIsActive().equals("Y")) {
//// tblPeriod.setPeriodIsActive("N");
//// } else {
//// tblPeriod.setPeriodIsActive("Y");
//// }
//// tblPeriodDao.save(tblPeriod);
//// refreshActivePayrollPeriodTableList();
//// }
//// });
//
//
tblSearch.addItem(new Object[]{
tblRegistration.getRegistrationId(),//1
tblRegistration.getRegistrationAddress()!=null?tblRegistration.getRegistrationAddress():"",//2
tblRegistration.getRegistrationContactNo()!=null?tblRegistration.getRegistrationContactNo():"",//3
viewBtn,//5
"Test",//5
deleteBtn}, tblRegistration.getRegistrationId());//7
getNotify().show("=====clearForm()======");
tfSchoolYear.setValue("");
tfStudentNo.setValue("");
tfCourse.setValue("");
tfBatchNo.setValue("");
tfFirstName.setValue("");
tfMiddleName.setValue("");
tfLastName.setValue("");
tfExtensionName.setValue("");
tfEmail.setValue("");
tfReligion.setValue("");
tfAge.setValue("");
cbGender.setValue(null);
cbCivilStatus.setValue(null);
tfSpouse.setValue("");
// getNotify().show("=====populateForm()======");
// tfFirstName.setValue(getTblRegistration().getRegistrationFirstName());
// tfLastName.setValue(getTblRegistration().getRegistrationLastName());
// tfMiddleName.setValue(getTblRegistration().getRegistrationMiddleName());
// }
// /**
// */
// return tblRegistration;
// }
// /**
// this.tblRegistration = tblRegistration;