Package com.projity.pm.calendar

Examples of com.projity.pm.calendar.WorkingCalendar


    CalendarService service = CalendarService.getInstance();
    if (get) {
      ComboBoxModel calModel = new DefaultComboBoxModel(service.getBaseCalendars().toArray());
      calendarToCopy.setModel(calModel);
    } else {
      WorkingCalendar toCopy;
      if (makeACopy.isSelected())
        toCopy = (WorkingCalendar) calendarToCopy.getSelectedItem();
      else
        toCopy = CalendarService.getInstance().getDefaultInstance();
      newCalendar = CalendarService.getInstance().makeScratchCopy(toCopy);
View Full Code Here


//    ProjectFactory projectFactory = ((MainFrame)owner).getProjectFactory();
    ProjectFactory projectFactory = GraphicManager.getInstance(this).getProjectFactory();
    ArrayList projCals = projectFactory.getPortfolio().extractCalendars();
    projectCalendars = new ArrayList();
    Iterator i = projCals.iterator();
    WorkingCalendar current;
    while (i.hasNext()) { // add all non base cals that are project cals
      current =(WorkingCalendar)i.next();
      if (!current.isBaseCalendar())
        projectCalendars.add(current);
    }

      newCalendar = new JButton(Messages.getString("ChangeWorkingTimeDialogBox.New")); //$NON-NLS-1$
    addDocHelp("Change_Working_Time_Dialog");
View Full Code Here

      defaultWorkingTime.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){
            setWorkingHours(null);
          CalendarService service=CalendarService.getInstance();
          WorkingCalendar wc=form.getCalendar();
          service.makeDefaultDays(wc,sdCalendar.getSelectedFixedIntervals(), sdCalendar.getSelectedWeekDays());
          dirtyWorkingHours = false;
          updateWorkingHours();
          updateView();
          clearLastSelection();

        }});

      nonWorking.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){
            setWorkingHours(null);
          CalendarService service=CalendarService.getInstance();
          WorkingCalendar wc=form.getCalendar();
          WorkingCalendar copy = wc.makeScratchCopy();
          try {
            // try on copy first
          service.setDaysNonWorking(copy,sdCalendar.getSelectedFixedIntervals(), sdCalendar.getSelectedWeekDays());
            service.setDaysNonWorking(wc,sdCalendar.getSelectedFixedIntervals(), sdCalendar.getSelectedWeekDays());
        } catch (InvalidCalendarException e1) {
          Alert.error(e1.getMessage(),ChangeWorkingTimeDialogBox.this);
          return;
        }
          dirtyWorkingHours = false;
          updateWorkingHours();
          updateView();
              clearLastSelection();
        }});

      working.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){
          CalendarService service=CalendarService.getInstance();
          WorkingCalendar wc=form.getCalendar();

            setWorkingHours(defaultWorkingHours);
          WorkingCalendar copy = wc.makeScratchCopy();

          try {
                    service.setDaysWorkingHours(copy,sdCalendar.getSelectedFixedIntervals(), sdCalendar.getSelectedWeekDays(),defaultWorkingHours);
                    service.setDaysWorkingHours(wc,sdCalendar.getSelectedFixedIntervals(), sdCalendar.getSelectedWeekDays(),defaultWorkingHours);
              dirtyWorkingHours = false;
              updateWorkingHours();
                    updateView();
                } catch (WorkRangeException e1) {
                    e1.printStackTrace();
                } catch (InvalidCalendarException e2) {
                  Alert.error(e2.getMessage(),ChangeWorkingTimeDialogBox.this);
                  return;
        }
                clearLastSelection();
        }});
      sdCalendar.addPropertyChangeListener(new PropertyChangeListener(){
          final CalendarService service=CalendarService.getInstance();
          public void propertyChange(PropertyChangeEvent e){
//            System.out.println("propery change");
              String property=e.getPropertyName();
              if ("lastDisplayedDate".equals(property)||"firstDisplayedDate".equals(property)){ //$NON-NLS-1$ //$NON-NLS-2$
                updateView();
              }else if ("selectedDates".equals(property)){ //$NON-NLS-1$
                updateWorkingHours();
              }
            dirtyWorkingHours = false;
          }
      });
    setCal(form.getCalendar());
    // add listener at end so above setCal won't trigger update
    calendarType.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){
          WorkingCalendar cal = (WorkingCalendar)calendarType.getSelectedItem();
          if (cal != form.getCalendar()) {
            setNewCalendar(cal);
            setEditable(isCalEditable(cal));
          }
        }});
View Full Code Here

                      return;
                  }
              }
          }
        CalendarService service=CalendarService.getInstance();
        WorkingCalendar wc=form.getCalendar();
        WorkingCalendar copy = wc.makeScratchCopy();
        service.setDaysWorkingHours(copy,lastSelection,lastWeekSelection,hours);
        service.setDaysWorkingHours(wc,lastSelection,lastWeekSelection,hours);
        unsaved = false;

        if (saveCalendar) {
View Full Code Here

  }

  private void saveCalendar() {
    unsaved = false;
    CalendarService service=CalendarService.getInstance();
    WorkingCalendar wc=form.getCalendar();
    UndoableEditSupport undoableEditSupport=undoController.getEditSupport();
    if (undoableEditSupport!=null){
      undoableEditSupport.postEdit(new CalendarEdit(editedCalendar,wc));
    }
View Full Code Here


  protected void updateView(){

      CalendarService service=CalendarService.getInstance();
      WorkingCalendar wc=form.getCalendar();
      if (wc.isBaseCalendar()) {
        basedOnText.setText(" "); // a space.  need a space for vertical spacing //$NON-NLS-1$
      } else {
        basedOnText.setText(Messages.getString("ChangeWorkingTimeDialogBox.BasedOn") + wc.getBaseCalendar().getName()); //$NON-NLS-1$
      }

      long first=sdCalendar.getFirstDisplayedDate();
      long last=sdCalendar.getLastDisplayedDate();
      Calendar calendar=DateTime.calendarInstance();
View Full Code Here

      newCalendar.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent e){
            NewBaseCalendarDialog dialog = NewBaseCalendarDialog.getInstance(owner,null);
            if (dialog.doModal()) {
              fillInCalendarNames();
              WorkingCalendar cal = dialog.getNewCalendar();
              setNewCalendar(cal);
            }
              }
       });
View Full Code Here

    //non working days
      Color oldColor=g2.getColor();
      Paint oldPaint=g2.getPaint();
      CoordinatesConverter coord=((GanttParams)graphInfo).getCoord();
      Project project=coord.getProject();
      WorkingCalendar wc=(WorkingCalendar)project.getWorkCalendar();

      if (coord.getTimescaleManager().isShowWholeDays()){
        boolean useScale2=coord.getTimescaleManager().getCurrentScaleIndex()==0; //valid only for current time scales
        TimeIterator i=coord.getTimeIterator(bounds.getX(), bounds.getMaxX(),useScale2);
        long startNonworking=-1L,endNonWorking=-1L;
View Full Code Here

TOP

Related Classes of com.projity.pm.calendar.WorkingCalendar

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.