Package org.jallinone.scheduler.activities.client

Examples of org.jallinone.scheduler.activities.client.ScheduledActivityController


        if (newApp==null || newApp[1]>=newApp[3]) {
          newApp = null;
          return;
        }

        final ScheduledActivityController c = new ScheduledActivityController(null,null,null,false) {

          /**
           * Method called by the Form panel to insert new data.
           * @param newValueObject value object to save
           * @return an ErrorResponse value object in case of errors, VOResponse if the operation is successfully completed
           */
          public Response insertRecord(ValueObject newPersistentObject) throws Exception {
            Response response = super.insertRecord(newPersistentObject);
            if (!response.isError()) {
              ScheduledActivityVO vo = (ScheduledActivityVO)((VOResponse)response).getVo();
              ScheduledEmployeeVO schEmpVO = new ScheduledEmployeeVO();
              schEmpVO.setCompanyCodeSys01SCH07(vo.getCompanyCodeSys01SCH06());
              schEmpVO.setDescriptionSYS10(empVO.getTaskDescriptionSYS10());
              schEmpVO.setDurationSCH07(vo.getEstimatedDurationSCH06());
              schEmpVO.setEmployeeCodeSCH01(empVO.getEmployeeCodeSCH01());
              schEmpVO.setEndDateSCH07(vo.getEstimatedEndDateSCH06());
              schEmpVO.setProgressiveReg04SCH07(empVO.getProgressiveReg04SCH01());
              schEmpVO.setProgressiveSch06SCH07(vo.getProgressiveSCH06());
              schEmpVO.setStartDateSCH07(vo.getStartDateSCH06());
              schEmpVO.setTaskCodeREG07(empVO.getTaskCodeReg07SCH01());
              ArrayList list = new ArrayList();
              list.add(schEmpVO);
              Response res = ClientUtils.getData("insertScheduledEmployees",list);
              if (res.isError())
                return res;
              else
                setEmployeeVO(empVO);
            }
            return response;
          }

        };
        ScheduledActivityVO vo = (ScheduledActivityVO)c.getDetailFrame().getMainForm().getVOModel().getValueObject();

        int h = newApp[1]/hourH;
        int m = (newApp[1]-h*hourH)*69/hourH;
        Calendar cal = Calendar.getInstance();
        cal.setTime(currentDay);
        cal.set(cal.HOUR_OF_DAY,h);
        cal.set(cal.MINUTE,m);
        vo.setStartDateSCH06(new java.sql.Timestamp(cal.getTimeInMillis()));

        h = newApp[3]/hourH;
        m = (newApp[3]-h*hourH)*60/hourH;
        cal.setTime(currentDay);
        cal.set(cal.HOUR_OF_DAY,h);
        cal.set(cal.MINUTE,m);
        vo.setEstimatedEndDateSCH06(new java.sql.Timestamp(cal.getTimeInMillis()));
        vo.setEstimatedDurationSCH06(new BigDecimal((vo.getEstimatedEndDateSCH06().getTime()-vo.getStartDateSCH06().getTime())/60000));

        c.getDetailFrame().getMainForm().getForm().pull();

        newApp = null;
        repaint();
      }


      public void mouseClicked(MouseEvent e) {
        if (SwingUtilities.isLeftMouseButton(e) &&
            (e.getClickCount()==1 || e.getClickCount()==2)) {
          Enumeration en = appointments.keys();
          int[] app = null;
          selectedApp = null;
          while(en.hasMoreElements()) {
            app = (int[])en.nextElement();
            if (e.getX()>=app[0] && e.getX()<=app[2] && e.getY()>=app[1] && e.getY()<=app[3]) {
              selectedApp = app;
              break;
            }
          }
          Day.this.repaint();
          if (selectedApp!=null && e.getClickCount()==2) {
            EmployeeActivityVO vo = (EmployeeActivityVO)appointments.get(selectedApp);
            ScheduledActivityController c = new ScheduledActivityController(null,null,new ScheduledActivityPK(
              vo.getCompanyCodeSys01SCH06(),
              vo.getProgressiveSCH06()
            ),false) {
              public void afterInsertData() {
                super.afterInsertData();
View Full Code Here


             * Callback method invoked when the user has double clicked on the selected row of the grid.
             * @param rowNumber selected row index
             * @param persistentObject v.o. related to the selected row
             */
            public void doubleClick(int rowNumber,ValueObject persistentObject) {
              new ScheduledActivityController(
                  panel.getGrid(),
                  null,
                  new ScheduledActivityPK(
                    ((GridScheduledActivityVO)persistentObject).getCompanyCodeSys01SCH06(),
                    ((GridScheduledActivityVO)persistentObject).getProgressiveSCH06()
                  ),
                  true
              );
            }


            /**
             * Callback method invoked before saving data when the grid was in INSERT mode (on pressing save button).
             * @return <code>true</code> allows the saving to continue, <code>false</code> the saving is interrupted
             */
            public boolean beforeInsertGrid(GridControl grid) {
              if (super.beforeInsertGrid(grid)) {
                ScheduledActivityController c = new ScheduledActivityController(panel.getGrid(),null,null,true);
                c.getControlSubjectType().setValue(controlSubjectType.getValue());

                if (controlSubjectType.getValue().equals(ApplicationConsts.SUBJECT_ORGANIZATION_CUSTOMER)) {
                  OrganizationCustomerVO model = (OrganizationCustomerVO)customerPanel.getVOModel().getValueObject();
                  c.getControlName_1Subject().setValue(model.getName_1REG04());
                  c.getControlName_2Subject().setValue(model.getName_2REG04());
                  ScheduledActivityVO actVO = (ScheduledActivityVO)c.getVOModel().getValueObject();
                  actVO.setProgressiveReg04SubjectSCH06(model.getProgressiveREG04());
                  c.getDetailFrame().getMainForm().getForm().pull("progressiveReg04SubjectSCH06");
                }
                else {
                  PeopleCustomerVO model = (PeopleCustomerVO)customerPanel.getVOModel().getValueObject();
                  c.getControlName_1Subject().setValue(model.getName_1REG04());
                  c.getControlName_2Subject().setValue(model.getName_2REG04());
                  ScheduledActivityVO actVO = (ScheduledActivityVO)c.getVOModel().getValueObject();
                  actVO.setProgressiveReg04SubjectSCH06(model.getProgressiveREG04());
                  c.getDetailFrame().getMainForm().getForm().pull("progressiveReg04SubjectSCH06");
                }

              }
              return false;
            }
View Full Code Here

             * Callback method invoked when the user has double clicked on the selected row of the grid.
             * @param rowNumber selected row index
             * @param persistentObject v.o. related to the selected row
             */
            public void doubleClick(int rowNumber,ValueObject persistentObject) {
              new ScheduledActivityController(
                  panel.getGrid(),
                  null,
                  new ScheduledActivityPK(
                    ((ScheduledActivityVO)persistentObject).getCompanyCodeSys01SCH06(),
                    ((ScheduledActivityVO)persistentObject).getProgressiveSCH06()
                  ),
                  true
              );
            }


            /**
             * Callback method invoked before saving data when the grid was in INSERT mode (on pressing save button).
             * @return <code>true</code> allows the saving to continue, <code>false</code> the saving is interrupted
             */
            public boolean beforeInsertGrid(GridControl grid) {
              if (super.beforeInsertGrid(grid)) {
                ScheduledActivityController c = new ScheduledActivityController(panel.getGrid(),null,null,true);
                c.getControlSubjectType().setValue(controlSubjectType.getValue());

                if (controlSubjectType.getValue().equals(ApplicationConsts.SUBJECT_ORGANIZATION_CONTACT)) {
                  OrganizationVO model = (OrganizationVO)getCurrentForm().getVOModel().getValueObject();
                  c.getControlName_1Subject().setValue(model.getName_1REG04());
                  c.getControlName_2Subject().setValue(model.getName_2REG04());
                  ScheduledActivityVO actVO = (ScheduledActivityVO)c.getVOModel().getValueObject();
                  actVO.setProgressiveReg04SubjectSCH06(model.getProgressiveREG04());
                  c.getDetailFrame().getMainForm().getForm().pull("progressiveReg04SubjectSCH06");
                }
                else {
                  PeopleVO model = (PeopleVO)getCurrentForm().getVOModel().getValueObject();
                  c.getControlName_1Subject().setValue(model.getName_1REG04());
                  c.getControlName_2Subject().setValue(model.getName_2REG04());
                  ScheduledActivityVO actVO = (ScheduledActivityVO)c.getVOModel().getValueObject();
                  actVO.setProgressiveReg04SubjectSCH06(model.getProgressiveREG04());
                  c.getDetailFrame().getMainForm().getForm().pull("progressiveReg04SubjectSCH06");
                }

              }
              return false;
            }
View Full Code Here

TOP

Related Classes of org.jallinone.scheduler.activities.client.ScheduledActivityController

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.