Example usage for org.joda.time DateTimeField getMaximumValue

List of usage examples for org.joda.time DateTimeField getMaximumValue

Introduction

In this page you can find the example usage for org.joda.time DateTimeField getMaximumValue.

Prototype

public abstract int getMaximumValue();

Source Link

Document

Get the maximum allowable value for this field.

Usage

From source file:com.facebook.util.TimeIntervalType.java

License:Apache License

/**
 * Validates that the specified interval value is valid for this 
 * interval type in the supplied time zone.
 * /*from   w  w  w  .jav  a2 s  .c o  m*/
 * @param timeZone the time zone
 * @param intervalLength the interval length
 */
public void validateValue(DateTimeZone timeZone, long intervalLength) {
    final DateTimeField field = fieldType.getField(TimeUtil.getChronology(timeZone.getID()));
    if (intervalLength < 1 || intervalLength > field.getMaximumValue()) {
        throw new IllegalArgumentException(
                "Supplied value " + intervalLength + " is out of bounds for " + name());
    }
}

From source file:TVShowTimelineMaker.timeConstraints.dayAcceptors.PartialDayAcceptor.java

@Override
public double divFactor() {
    int factor = 1;
    for (DateTimeField curDateTimeField : this.incompleteDate.getFields()) {
        int tempfactor = curDateTimeField.getMaximumValue() - curDateTimeField.getMinimumValue();
        factor = Math.max(factor, tempfactor);
    }/*from  w w w  .j  av a  2s . c  o m*/
    return 1.0 / factor;
}

From source file:TVShowTimelineMaker.ui.ConstraintEditors.IntervalConstraintEditor.java

private void listFieldsValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_listFieldsValueChanged
    DateTimeFieldType mDateTimeFieldType = this.listFields.getSelectedValue();
    Chronology chronology = this.mInterval.getChronology();
    DateTimeField mDateTimeField = mDateTimeFieldType.getField(chronology);
    this.mStartSpinnerNumberModel.setMaximum(mDateTimeField.getMaximumValue());
    this.mStartSpinnerNumberModel.setMinimum(mDateTimeField.getMinimumValue());
    this.mEndSpinnerNumberModel.setMaximum(mDateTimeField.getMaximumValue());
    this.mEndSpinnerNumberModel.setMinimum(mDateTimeField.getMinimumValue());
    this.spinValueStart.setValue(this.mStartDateTime.get(this.listFields.getSelectedValue()));
    this.spinValueEnd.setValue(this.mEndDateTime.get(this.listFields.getSelectedValue()));
}

From source file:TVShowTimelineMaker.ui.ConstraintEditors.PartialTimeConstraintEditor.java

private void listFieldsValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_listFieldsValueChanged
    DateTimeFieldType mDateTimeFieldType = this.listFields.getSelectedValue();
    Chronology chronology = this.mPartial.getChronology();
    DateTimeField mDateTimeField = mDateTimeFieldType.getField(chronology);
    this.mSpinnerNumberModel.setMaximum(mDateTimeField.getMaximumValue());
    this.mSpinnerNumberModel.setMinimum(mDateTimeField.getMinimumValue());
    if ((Integer) this.spinValue.getValue() > mDateTimeField.getMaximumValue()) {
        this.spinValue.setValue(mDateTimeField.getMaximumValue());
    }/* ww w  .  j  av a2  s. c om*/
    if ((Integer) this.spinValue.getValue() < mDateTimeField.getMinimumValue()) {
        this.spinValue.setValue(mDateTimeField.getMinimumValue());
    }
}

From source file:TVShowTimelineMaker.ui.Joda.DateTimeEditor.java

private void listFieldsValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_listFieldsValueChanged
    DateTimeFieldType mDateTimeFieldType = this.listFields.getSelectedValue();
    Chronology chronology = this.mDateTime.getChronology();
    DateTimeField mDateTimeField = mDateTimeFieldType.getField(chronology);
    this.mSpinnerNumberModel.setMaximum(mDateTimeField.getMaximumValue());
    this.mSpinnerNumberModel.setMinimum(mDateTimeField.getMinimumValue());
    this.spinValue.setValue(this.mDateTime.get(this.listFields.getSelectedValue()));
}