use of org.knime.timeseries.util.SettingsModelCalendar in project knime-core by knime.
the class DateGeneratorNodeDialog method createStartingPointModel.
/**
* @return the calendar model for the starting point
*/
static SettingsModelCalendar createStartingPointModel() {
Calendar c = Calendar.getInstance(DateAndTimeCell.UTC_TIMEZONE);
c.setTimeInMillis(System.currentTimeMillis() + TimeZone.getDefault().getOffset(System.currentTimeMillis()));
c.roll(Calendar.YEAR, false);
return new SettingsModelCalendar("starting-point", c, true, true, false);
}
use of org.knime.timeseries.util.SettingsModelCalendar in project knime-core by knime.
the class DateShiftConfigure method createCalendarModel.
/*
* Models...
*/
/**
* @return settings model for the selected time
*/
public static SettingsModelCalendar createCalendarModel() {
Calendar cal = DateAndTimeCell.getUTCCalendar();
cal.setTimeInMillis(System.currentTimeMillis());
SettingsModelCalendar smc = new SettingsModelCalendar(CFG_TIME, cal);
smc.setEnabled(false);
return smc;
}
use of org.knime.timeseries.util.SettingsModelCalendar in project knime-core by knime.
the class DateGeneratorNodeDialog method createEndPointModel.
/**
* @return the calendar model for the end point
*/
static SettingsModelCalendar createEndPointModel() {
Calendar c = Calendar.getInstance(DateAndTimeCell.UTC_TIMEZONE);
c.setTimeInMillis(System.currentTimeMillis() + TimeZone.getDefault().getOffset(System.currentTimeMillis()));
return new SettingsModelCalendar("end-point", c, true, true, false);
}
use of org.knime.timeseries.util.SettingsModelCalendar in project knime-core by knime.
the class DateGeneratorNodeModel method validateSettings.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
m_from.validateSettings(settings);
m_to.validateSettings(settings);
m_noOfRows.validateSettings(settings);
// we only validate the true date if we do not use the execution time
boolean checkFrom = true;
try {
SettingsModelBoolean useEx = m_useExecution.createCloneWithValidatedValue(settings);
if (useEx.getBooleanValue()) {
checkFrom = false;
}
} catch (Exception e) {
// Do nothing, backward compatibility
}
if (checkFrom) {
SettingsModelCalendar from = m_from.createCloneWithValidatedValue(settings);
validateDates(from);
}
SettingsModelCalendar to = m_to.createCloneWithValidatedValue(settings);
validateDates(to);
}
use of org.knime.timeseries.util.SettingsModelCalendar in project knime-core by knime.
the class ExtractTimeWindowNodeModel method validateSettings.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
// first do the basic checking
m_columnName.validateSettings(settings);
m_fromDate.validateSettings(settings);
m_toDate.validateSettings(settings);
// check whether the from date is equal or later than the to date
Calendar from = ((SettingsModelCalendar) m_fromDate.createCloneWithValidatedValue(settings)).getCalendar();
Calendar to = ((SettingsModelCalendar) m_toDate.createCloneWithValidatedValue(settings)).getCalendar();
if (to.before(from)) {
throw new InvalidSettingsException("The starting point must be before the end point!");
}
}
Aggregations