Package org.pentaho.gwt.widgets.client.utils.TimeUtil

Examples of org.pentaho.gwt.widgets.client.utils.TimeUtil.MonthOfYear


  private ListBox createMonthOfYearListBox() {

    ListBox l = new ListBox();
    for ( int ii = 0; ii < MonthOfYear.length(); ++ii ) {
      MonthOfYear month = MonthOfYear.get( ii );
      l.addItem( month.toString() );
    }

    return l;
  }
View Full Code Here


  public boolean isEveryNDays() {
    return ( temporalState == TemporalValue.DAILY ) && dailyEditor.isEveryNDays();
  }

  public MonthOfYear getSelectedMonth() {
    MonthOfYear selectedMonth = null;
    if ( ( temporalState == TemporalValue.YEARLY ) && yearlyEditor.isNthDayNameOfMonthName() ) {
      selectedMonth = yearlyEditor.getMonthOfYear1();
    } else if ( ( temporalState == TemporalValue.YEARLY ) && yearlyEditor.isEveryMonthOnNthDay() ) {
      selectedMonth = yearlyEditor.getMonthOfYear0();
    }
View Full Code Here

    int startYear = startDate.getYear();
    int startMonth = startDate.getMonth();
    int startDay = startDate.getDate();
    Date startDateTime = new Date( startYear, startMonth, startDay, startHour, startMin );
    Date endDate = scheduleEditorWizardPanel.getEndDate();
    MonthOfYear monthOfYear = scheduleEditor.getRecurrenceEditor().getSelectedMonth();
    List<DayOfWeek> daysOfWeek = scheduleEditor.getRecurrenceEditor().getSelectedDaysOfWeek();
    Integer dayOfMonth = scheduleEditor.getRecurrenceEditor().getSelectedDayOfMonth();
    WeekOfMonth weekOfMonth = scheduleEditor.getRecurrenceEditor().getSelectedWeekOfMonth();

    JSONObject schedule = new JSONObject();
View Full Code Here

    int startMonth = startDate.getMonth();
    int startDay = startDate.getDate();
    Date startDateTime = new Date( startYear, startMonth, startDay, startHour, startMin );

    Date endDate = scheduleEditorWizardPanel.getEndDate();
    MonthOfYear monthOfYear = scheduleEditor.getRecurrenceEditor().getSelectedMonth();
    List<DayOfWeek> daysOfWeek = scheduleEditor.getRecurrenceEditor().getSelectedDaysOfWeek();
    Integer dayOfMonth = scheduleEditor.getRecurrenceEditor().getSelectedDayOfMonth();
    WeekOfMonth weekOfMonth = scheduleEditor.getRecurrenceEditor().getSelectedWeekOfMonth();

    if ( isBlockoutDialog ) {
      jsJobTrigger.setBlockDuration( calculateBlockoutDuration() );
    } else {
      // blockDuration is only valid for blockouts
      jsJobTrigger.setBlockDuration( new Long( -1 ) );
    }

    if ( scheduleType == ScheduleType.RUN_ONCE ) { // Run once types
      jsJobTrigger.setType( "simpleJobTrigger" ); //$NON-NLS-1$
      jsJobTrigger.setRepeatInterval( 0 );
      jsJobTrigger.setRepeatCount( 0 );
      jsJobTrigger.setNativeStartTime( DateTimeFormat.getFormat( PredefinedFormat.ISO_8601 ).format( startDateTime ) );
    } else if ( ( scheduleType == ScheduleType.SECONDS ) || ( scheduleType == ScheduleType.MINUTES )
        || ( scheduleType == ScheduleType.HOURS ) ) {
      int repeatInterval = 0;
      try { // Simple Trigger Types
        repeatInterval = Integer.parseInt( scheduleEditorWizardPanel.getRepeatInterval() );
      } catch ( Exception e ) {
        // ignored
      }
      jsJobTrigger.setType( "simpleJobTrigger" ); //$NON-NLS-1$
      jsJobTrigger.setRepeatInterval( repeatInterval );
      jsJobTrigger.setRepeatCount( -1 );
      jsJobTrigger.setNativeStartTime( DateTimeFormat.getFormat( PredefinedFormat.ISO_8601 ).format( startDateTime ) );
      if ( endDate != null ) {
        jsJobTrigger.setNativeEndTime( DateTimeFormat.getFormat( PredefinedFormat.ISO_8601 ).format( endDate ) );
      }
    } else if ( scheduleType == ScheduleType.DAILY ) {
      if ( scheduleEditor.getRecurrenceEditor().isEveryNDays() ) {
        int repeatInterval = 0;
        try { // Simple Trigger Types
          repeatInterval = Integer.parseInt( scheduleEditorWizardPanel.getRepeatInterval() );
        } catch ( Exception e ) {
          // ignored
        }
        jsJobTrigger.setType( "simpleJobTrigger" ); //$NON-NLS-1$
        jsJobTrigger.setRepeatInterval( repeatInterval );
        jsJobTrigger.setRepeatCount( -1 );
        jsJobTrigger.setNativeStartTime( DateTimeFormat.getFormat( PredefinedFormat.ISO_8601 ).format( startDateTime ) );
        if ( endDate != null ) {
          jsJobTrigger.setNativeEndTime( DateTimeFormat.getFormat( PredefinedFormat.ISO_8601 ).format( endDate ) );
        }
      } else {
        JsArrayInteger jsDaysOfWeek = (JsArrayInteger) JavaScriptObject.createArray();
        int i = 0;
        for ( DayOfWeek dayOfWeek : daysOfWeek ) {
          jsDaysOfWeek.set( i++, dayOfWeek.ordinal() + 1 );
        }
        JsArrayInteger hours = (JsArrayInteger) JavaScriptObject.createArray();
        hours.set( 0, startHour );
        JsArrayInteger minutes = (JsArrayInteger) JavaScriptObject.createArray();
        hours.set( 0, startMin );
        JsArrayInteger seconds = (JsArrayInteger) JavaScriptObject.createArray();
        hours.set( 0, 0 );

        jsJobTrigger.setType( "complexJobTrigger" ); //$NON-NLS-1$
        jsJobTrigger.setDayOfWeekRecurrences( jsDaysOfWeek );
        jsJobTrigger.setHourRecurrences( hours );
        jsJobTrigger.setMinuteRecurrences( minutes );
        jsJobTrigger.setSecondRecurrences( seconds );
        jsJobTrigger.setNativeStartTime( DateTimeFormat.getFormat( PredefinedFormat.ISO_8601 ).format( startDateTime ) );
        if ( endDate != null ) {
          jsJobTrigger.setNativeEndTime( DateTimeFormat.getFormat( PredefinedFormat.ISO_8601 ).format( endDate ) );
        }
      }
    } else if ( scheduleType == ScheduleType.CRON ) { // Cron jobs
      jsJobTrigger.setType( "cronJobTrigger" ); //$NON-NLS-1$
    } else if ( ( scheduleType == ScheduleType.WEEKLY ) && ( daysOfWeek.size() > 0 ) ) {
      JsArrayInteger jsDaysOfWeek = (JsArrayInteger) JavaScriptObject.createArray();
      int i = 0;
      for ( DayOfWeek dayOfWeek : daysOfWeek ) {
        jsDaysOfWeek.set( i++, dayOfWeek.ordinal() + 1 );
      }
      JsArrayInteger hours = (JsArrayInteger) JavaScriptObject.createArray();
      hours.set( 0, startHour );
      JsArrayInteger minutes = (JsArrayInteger) JavaScriptObject.createArray();
      hours.set( 0, startMin );
      JsArrayInteger seconds = (JsArrayInteger) JavaScriptObject.createArray();
      hours.set( 0, 0 );

      jsJobTrigger.setType( "complexJobTrigger" ); //$NON-NLS-1$
      jsJobTrigger.setDayOfWeekRecurrences( jsDaysOfWeek );
      jsJobTrigger.setHourRecurrences( hours );
      jsJobTrigger.setMinuteRecurrences( minutes );
      jsJobTrigger.setSecondRecurrences( seconds );
      jsJobTrigger.setNativeStartTime( DateTimeFormat.getFormat( PredefinedFormat.ISO_8601 ).format( startDateTime ) );
      if ( endDate != null ) {
        jsJobTrigger.setNativeEndTime( DateTimeFormat.getFormat( PredefinedFormat.ISO_8601 ).format( endDate ) );
      }
    } else if ( ( scheduleType == ScheduleType.MONTHLY )
        || ( ( scheduleType == ScheduleType.YEARLY ) && ( monthOfYear != null ) ) ) {
      jsJobTrigger.setType( "complexJobTrigger" ); //$NON-NLS-1$

      if ( dayOfMonth != null ) {
        JsArrayInteger jsDaysOfMonth = (JsArrayInteger) JavaScriptObject.createArray();
        jsDaysOfMonth.set( 0, dayOfMonth );

        JsArrayInteger hours = (JsArrayInteger) JavaScriptObject.createArray();
        hours.set( 0, startHour );
        JsArrayInteger minutes = (JsArrayInteger) JavaScriptObject.createArray();
        hours.set( 0, startMin );
        JsArrayInteger seconds = (JsArrayInteger) JavaScriptObject.createArray();
        hours.set( 0, 0 );

        jsJobTrigger.setType( "complexJobTrigger" ); //$NON-NLS-1$
        if ( monthOfYear != null ) {
          JsArrayInteger jsMonthsOfYear = (JsArrayInteger) JavaScriptObject.createArray();
          jsMonthsOfYear.set( 0, monthOfYear.ordinal() + 1 );
          jsJobTrigger.setMonthlyRecurrences( jsMonthsOfYear );
        }
        jsJobTrigger.setDayOfMonthRecurrences( jsDaysOfMonth );
        jsJobTrigger.setHourRecurrences( hours );
        jsJobTrigger.setMinuteRecurrences( minutes );
        jsJobTrigger.setSecondRecurrences( seconds );
        jsJobTrigger.setNativeStartTime( DateTimeFormat.getFormat( PredefinedFormat.ISO_8601 ).format( startDateTime ) );
        if ( endDate != null ) {
          jsJobTrigger.setNativeEndTime( DateTimeFormat.getFormat( PredefinedFormat.ISO_8601 ).format( endDate ) );
        }
      } else if ( ( daysOfWeek.size() > 0 ) && ( weekOfMonth != null ) ) {
        JsArrayInteger jsDaysOfWeek = (JsArrayInteger) JavaScriptObject.createArray();
        int i = 0;
        for ( DayOfWeek dayOfWeek : daysOfWeek ) {
          jsDaysOfWeek.set( i++, dayOfWeek.ordinal() + 1 );
        }

        JsArrayInteger hours = (JsArrayInteger) JavaScriptObject.createArray();
        hours.set( 0, startHour );
        JsArrayInteger minutes = (JsArrayInteger) JavaScriptObject.createArray();
        hours.set( 0, startMin );
        JsArrayInteger seconds = (JsArrayInteger) JavaScriptObject.createArray();
        hours.set( 0, 0 );

        jsJobTrigger.setType( "complexJobTrigger" ); //$NON-NLS-1$
        if ( monthOfYear != null ) {
          JsArrayInteger jsMonthsOfYear = (JsArrayInteger) JavaScriptObject.createArray();
          jsMonthsOfYear.set( 0, monthOfYear.ordinal() + 1 );
          jsJobTrigger.setMonthlyRecurrences( jsMonthsOfYear );
        }
        jsJobTrigger.setHourRecurrences( hours );
        jsJobTrigger.setMinuteRecurrences( minutes );
        jsJobTrigger.setSecondRecurrences( seconds );
View Full Code Here

TOP

Related Classes of org.pentaho.gwt.widgets.client.utils.TimeUtil.MonthOfYear

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.