public EnterpriseCell() {

    this.enterpriseDAO = Lookup.getDefault().lookup(IEnterpriseBN.class);
    this.personDAO = Lookup.getDefault().lookup(IPersonBN.class);
    txtIdE = new JTextField();
    txtLogo = new JTextField();
    txtLogo.addMouseListener(this);
    txtNameE = new JTextField();
    txtSlogan = new JTextField();

    modelEnter = new DefaultComboBoxModel();
    modelEnter.addElement(" ");
    modelPerson = new DefaultComboBoxModel();
    modelPerson.addElement(" ");
    txtIdE.setText(" ");
    txtNameE.setText(" ");

    // Create model for combobox

    List<Enterprise> list = new ArrayList<Enterprise>();
    list = enterpriseDAO.getAllEnterprise();
    for (Enterprise bean : list) {
      modelEnter.addElement(bean);
    }

    List<Person> list1 = new ArrayList<Person>();
    list1 = personDAO.getAllPerson();
    for (Person bean : list1) {
      modelPerson.addElement(bean);
    }

    cboEnterprise = new JComboBox(modelEnter);
    cboPerson = new JComboBox(modelPerson);
  }
Exemplo n.º 2
0
 public EnterpriseChildren(Enterprise enterprise) {
   this.enterprise = enterprise;
   list = enterpriseBN.getAllEnterprise();
   calculateSPI = new CalculateSPI();
   dateTimeUtils = new DateTimeUtils();
   month1 = dateTimeUtils.getCurrentMonth() + "/" + dateTimeUtils.getCurrentYear();
   month2 = String.valueOf(dateTimeUtils.addMonth(-1)) + "/" + dateTimeUtils.addYearWithMonth(-1);
   month3 = String.valueOf(dateTimeUtils.addMonth(-2)) + "/" + dateTimeUtils.addYearWithMonth(-2);
   year1 = String.valueOf(dateTimeUtils.getCurrentYear());
   year2 = String.valueOf(dateTimeUtils.getCurrentYear() - 1);
 }
Exemplo n.º 3
0
  @Override
  protected void addNotify() {
    list = enterpriseBN.getAllEnterprise();
    super.addNotify();
    Vector instr = new Vector();
    for (int i = 0; i < list.size(); i++) {
      if (list.get(i).getEnterpriseParent().equals(enterprise.getEnterpriseName())) {
        Enterprise enterprise1 = new Enterprise();
        enterprise1.setEnterpriseName(list.get(i).getEnterpriseName());
        enterprise1.setDirector(list.get(i).getDirector());
        enterprise1.setEnterpriseParent(list.get(i).getEnterpriseParent());
        instr.addElement(enterprise1);
      }
    }

    Enterprise[] enterprises = new Enterprise[instr.size()];
    for (int i = 0; i < instr.size(); i++) {
      enterprises[i] = (Enterprise) instr.elementAt(i);
    }
    setKeys(enterprises);
  }
 @Override
 protected void addNotify() {
   count = 0;
   list = enterpriseBN.selectAll();
   super.addNotify();
   Vector instr = new Vector();
   for (int i = 0; i < list.size(); i++) {
     if (list.get(i).getEnterpriseParentIdActual() == (enterprise.getId())) {
       Enterprise enterprise1 = new Enterprise();
       enterprise1.setEnterpriseId(list.get(i).getEnterpriseId());
       enterprise1.setEnterpriseName(list.get(i).getEnterpriseName());
       enterprise1.setDirectorIdActual(list.get(i).getDirectorIdActual());
       enterprise1.setEnterpriseParentIdActual(list.get(i).getEnterpriseParentIdActual());
       instr.addElement(enterprise1);
     }
   }
   Enterprise[] enterprises = new Enterprise[instr.size() + 2];
   enterprises[0] = new Enterprise("", "", 0, 0, null, "");
   enterprises[1] = new Enterprise("", "", 0, 0, null, "");
   for (int i = 2; i < instr.size() + 2; i++) {
     enterprises[i] = (Enterprise) instr.elementAt(i - 2);
   }
   setKeys(enterprises);
 }
 public EnterpriseChildren() {
   list = enterpriseBN.selectAll();
 }
 public EnterpriseChildren(Enterprise enterprise) {
   this.enterprise = enterprise;
   list = enterpriseBN.selectAll();
   calculateSPI = new CalculateSPI();
 }