public static String getFixedExpression(DateIntervalType type) { if (DateIntervalType.SECOND.equals(type)) { return "value + \"\\\"\""; } if (DateIntervalType.MINUTE.equals(type)) { return "value + \"'\""; } if (DateIntervalType.HOUR.equals(type)) { return "value + \"h\""; } if (DateIntervalType.QUARTER.equals(type)) { return "\"Q\" + value"; } return "value"; }
public static String getFixedExpression(DateIntervalType type) { if (DateIntervalType.SECOND.equals(type)) { return "value + \"\\\"\""; } if (DateIntervalType.MINUTE.equals(type)) { return "value + \"'\""; } if (DateIntervalType.HOUR.equals(type)) { return "value + \"h\""; } if (DateIntervalType.QUARTER.equals(type)) { return "\"Q\" + value"; } return "value"; }
private int getIntervalTypeIndex(DateIntervalType type) { for (int i=0; i<ALLOWED_TYPES.size(); i++) { if (ALLOWED_TYPES.get(i).equals(type)) { return i; } } return 0; } }
private int getIntervalTypeIndex(DateIntervalType type) { for (int i=0; i<ALLOWED_TYPES.size(); i++) { if (ALLOWED_TYPES.get(i).equals(type)) { return i; } } return 0; } }
protected String formatDateFixed(DateIntervalType type, String date) { if (date == null) { return null; } int index = Integer.parseInt(date); if (DateIntervalType.DAY_OF_WEEK.equals(type)) { DayOfWeek dayOfWeek = DayOfWeek.getByIndex(index); return getFormatter().formatDayOfWeek(dayOfWeek); } if (DateIntervalType.MONTH.equals(type)) { Month month = Month.getByIndex(index); return getFormatter().formatMonth(month); } return date; }
protected String formatDateFixed(DateIntervalType type, String date) { if (date == null) { return null; } int index = Integer.parseInt(date); if (DateIntervalType.DAY_OF_WEEK.equals(type)) { DayOfWeek dayOfWeek = DayOfWeek.getByIndex(index); return getFormatter().formatDayOfWeek(dayOfWeek); } if (DateIntervalType.MONTH.equals(type)) { Month month = Month.getByIndex(index); return getFormatter().formatMonth(month); } return date; }
protected void initIntervalTypeSelector() { view.clearIntervalTypeSelector(); DateIntervalType current = DateIntervalType.getByName(columnGroup.getIntervalSize()); List<DateIntervalType> entries = getListOfIntervalTypes(); for (int i = 0; i < entries.size(); i++) { DateIntervalType entry = entries.get(i); view.addIntervalTypeItem(entry); if (current != null && current.equals(entry)) { view.setSelectedIntervalTypeIndex(i); } } }
protected void initIntervalTypeSelector() { view.clearIntervalTypeSelector(); DateIntervalType current = DateIntervalType.getByName(columnGroup.getIntervalSize()); List<DateIntervalType> entries = getListOfIntervalTypes(); for (int i = 0; i < entries.size(); i++) { DateIntervalType entry = entries.get(i); view.addIntervalTypeItem(entry); if (current != null && current.equals(entry)) { view.setSelectedIntervalTypeIndex(i); } } }
public T firstMonth(Month month) { DataSetGroup gOp = (DataSetGroup) getCurrentOp(); if (gOp == null || gOp.getColumnGroup() == null) { throw new RuntimeException("group() must be called first."); } ColumnGroup columnGroup = gOp.getColumnGroup(); if (!GroupStrategy.FIXED.equals(columnGroup.getStrategy())) { throw new RuntimeException("A fixed group is required."); } if (!DateIntervalType.MONTH.equals(DateIntervalType.getByName(columnGroup.getIntervalSize()))) { throw new RuntimeException("A fixed MONTH date group is required."); } columnGroup.setFirstMonthOfYear(month); return (T) this; }
public void init(final TimeAmount ta, Command onChangeCommand) { this.onChangeCommand = onChangeCommand; this.timeAmount = ta != null ? ta : new TimeAmount(); view.setQuantity(timeAmount.getQuantity()); view.clearIntervalTypeSelector(); for (int i=0; i< INTERVAL_TYPES.size(); i++) { DateIntervalType type = INTERVAL_TYPES.get(i); view.addIntervalTypeItem(type); if (timeAmount != null && timeAmount.getType().equals(type)) { view.setSelectedTypeIndex(i); } } }
public T firstDay(DayOfWeek dayOfWeek) { DataSetGroup gOp = (DataSetGroup) getCurrentOp(); if (gOp == null || gOp.getColumnGroup() == null) { throw new RuntimeException("group() must be called first."); } ColumnGroup columnGroup = gOp.getColumnGroup(); if (!GroupStrategy.FIXED.equals(columnGroup.getStrategy())) { throw new RuntimeException("A fixed group is required."); } if (!DateIntervalType.DAY_OF_WEEK.equals(DateIntervalType.getByName(columnGroup.getIntervalSize()))) { throw new RuntimeException("A fixed DAY_OF_WEEK date group is required."); } columnGroup.setFirstDayOfWeek(dayOfWeek); return (T) this; }
public void init(final TimeAmount ta, Command onChangeCommand) { this.onChangeCommand = onChangeCommand; this.timeAmount = ta != null ? ta : new TimeAmount(); view.setQuantity(timeAmount.getQuantity()); view.clearIntervalTypeSelector(); for (int i=0; i< INTERVAL_TYPES.size(); i++) { DateIntervalType type = INTERVAL_TYPES.get(i); view.addIntervalTypeItem(type); if (timeAmount != null && timeAmount.getType().equals(type)) { view.setSelectedTypeIndex(i); } } }
public T firstMonth(Month month) { DataSetGroup gOp = (DataSetGroup) getCurrentOp(); if (gOp == null || gOp.getColumnGroup() == null) { throw new RuntimeException("group() must be called first."); } ColumnGroup columnGroup = gOp.getColumnGroup(); if (!GroupStrategy.FIXED.equals(columnGroup.getStrategy())) { throw new RuntimeException("A fixed group is required."); } if (!DateIntervalType.MONTH.equals(DateIntervalType.getByName(columnGroup.getIntervalSize()))) { throw new RuntimeException("A fixed MONTH date group is required."); } columnGroup.setFirstMonthOfYear(month); return (T) this; }
public T firstDay(DayOfWeek dayOfWeek) { DataSetGroup gOp = (DataSetGroup) getCurrentOp(); if (gOp == null || gOp.getColumnGroup() == null) { throw new RuntimeException("group() must be called first."); } ColumnGroup columnGroup = gOp.getColumnGroup(); if (!GroupStrategy.FIXED.equals(columnGroup.getStrategy())) { throw new RuntimeException("A fixed group is required."); } if (!DateIntervalType.DAY_OF_WEEK.equals(DateIntervalType.getByName(columnGroup.getIntervalSize()))) { throw new RuntimeException("A fixed DAY_OF_WEEK date group is required."); } columnGroup.setFirstDayOfWeek(dayOfWeek); return (T) this; }
protected void initIntervalTypeSelector() { view.disableIntervalTypeSelector(); TimeInstant.TimeMode timeMode = timeInstant.getTimeMode(); if (timeMode != null && !timeMode.equals(TimeInstant.TimeMode.NOW)) { view.enableIntervalTypeSelector(); view.clearIntervalTypeSelector(); DateIntervalType current = timeInstant.getIntervalType(); for (int i = 0; i < INTERVAL_TYPES.size(); i++) { DateIntervalType type = INTERVAL_TYPES.get(i); view.addIntervalTypeItem(type); if (current != null && current.equals(type)) { view.setSelectedIntervalTypeIndex(i); } } } }
protected void initIntervalTypeSelector() { view.disableIntervalTypeSelector(); TimeInstant.TimeMode timeMode = timeInstant.getTimeMode(); if (timeMode != null && !timeMode.equals(TimeInstant.TimeMode.NOW)) { view.enableIntervalTypeSelector(); view.clearIntervalTypeSelector(); DateIntervalType current = timeInstant.getIntervalType(); for (int i = 0; i < INTERVAL_TYPES.size(); i++) { DateIntervalType type = INTERVAL_TYPES.get(i); view.addIntervalTypeItem(type); if (current != null && current.equals(type)) { view.setSelectedIntervalTypeIndex(i); } } } }
protected Column _createColumn(ColumnGroup cg) { String sourceId = cg.getSourceId(); String dbColumnId = _columnFromMetadata(metadata, sourceId); ColumnType columnType = metadata.getColumnType(dbColumnId); if (ColumnType.DATE.equals(columnType)) { DateIntervalType intervalType = calculateDateInterval(cg); if (DateIntervalType.DAY_OF_WEEK.equals(intervalType)) { throw new IllegalArgumentException("Group by DAY_OF_WEEK not supported in SQL data sets"); } return SQLFactory.column(dbColumnId, cg.getStrategy(), intervalType); } if (ColumnType.TEXT.equals(columnType)) { throw new IllegalArgumentException("Group by text '" + sourceId + NOT_SUPPORTED); } return SQLFactory.column(dbColumnId); }
protected Column _createColumn(ColumnGroup cg) { String sourceId = cg.getSourceId(); String dbColumnId = _columnFromMetadata(metadata, sourceId); ColumnType columnType = metadata.getColumnType(dbColumnId); if (ColumnType.DATE.equals(columnType)) { DateIntervalType intervalType = calculateDateInterval(cg); if (DateIntervalType.DAY_OF_WEEK.equals(intervalType)) { throw new IllegalArgumentException("Group by DAY_OF_WEEK not supported in SQL data sets"); } return SQLFactory.column(dbColumnId, cg.getStrategy(), intervalType); } if (ColumnType.TEXT.equals(columnType)) { throw new IllegalArgumentException("Group by text '" + sourceId + NOT_SUPPORTED); } return SQLFactory.column(dbColumnId); }