use of org.apache.wicket.datetime.PatternDateConverter in project midpoint by Evolveum.
the class TaskSummaryPanel method getTitle3Model.
@Override
protected IModel<String> getTitle3Model() {
return new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
if (parentPage.getTaskDto().isWorkflow()) {
String stageInfo = getStageInfo();
if (stageInfo != null) {
return getString("TaskSummaryPanel.stage", stageInfo);
} else {
return null;
}
}
TaskType taskType = getModel().getObject();
if (taskType == null) {
return null;
}
long started = XmlTypeConverter.toMillis(taskType.getLastRunStartTimestamp());
long finished = XmlTypeConverter.toMillis(taskType.getLastRunFinishTimestamp());
if (started == 0) {
return null;
}
if ((TaskExecutionStatus.RUNNABLE.equals(taskType.getExecutionStatus()) && taskType.getNodeAsObserved() != null) || finished == 0 || finished < started) {
PatternDateConverter pdc = new PatternDateConverter(WebComponentUtil.getLocalizedDatePattern(DateLabelComponent.SHORT_MEDIUM_STYLE), true);
String date = pdc.convertToString(new Date(started), WebComponentUtil.getCurrentLocale());
return getString("TaskStatePanel.message.executionTime.notFinished", date, DurationFormatUtils.formatDurationHMS(System.currentTimeMillis() - started));
} else {
PatternDateConverter pdc = new PatternDateConverter(WebComponentUtil.getLocalizedDatePattern(DateLabelComponent.SHORT_MEDIUM_STYLE), true);
String startedDate = pdc.convertToString(new Date(started), WebComponentUtil.getCurrentLocale());
String finishedDate = pdc.convertToString(new Date(finished), WebComponentUtil.getCurrentLocale());
return getString("TaskStatePanel.message.executionTime.finished", startedDate, finishedDate, DurationFormatUtils.formatDurationHMS(finished - started));
}
}
};
}
use of org.apache.wicket.datetime.PatternDateConverter in project qi4j-sdk by Qi4j.
the class DCISampleApplication_a method wicketInit.
public void wicketInit() {
// Tabs and SEO urls
mountPages();
// Show/hide Ajax debugging
getDebugSettings().setDevelopmentUtilitiesEnabled(true);
// Check that components are stateless when required
getComponentPostOnBeforeRenderListeners().add(new StatelessChecker());
// Show/hide wicket tags in html code
getMarkupSettings().setStripWicketTags(true);
// Default date format (we don't care for now about the hour of the day)
((ConverterLocator) getConverterLocator()).set(Date.class, new PatternDateConverter("yyyy-MM-dd", true));
}
use of org.apache.wicket.datetime.PatternDateConverter in project qi4j-sdk by Qi4j.
the class DCISampleApplication_b method wicketInit.
public void wicketInit() {
// Tabs and SEO urls
mountPages();
// Show/hide Ajax debugging
getDebugSettings().setDevelopmentUtilitiesEnabled(true);
// Check that components are stateless when required
getComponentPostOnBeforeRenderListeners().add(new StatelessChecker());
// Show/hide wicket tags in html code
getMarkupSettings().setStripWicketTags(true);
// Default date format (we don't care for now about the hour of the day)
((ConverterLocator) getConverterLocator()).set(Date.class, new PatternDateConverter("yyyy-MM-dd", true));
}
use of org.apache.wicket.datetime.PatternDateConverter in project midpoint by Evolveum.
the class DateInput method newDateTextField.
@Override
protected DateTextField newDateTextField(String id, PropertyModel dateFieldModel) {
String localizedDatePattern = WebComponentUtil.getLocalizedDatePattern(DateLabelComponent.SHORT_NOTIME_STYLE);
if (localizedDatePattern != null && !localizedDatePattern.contains("yyyy")) {
localizedDatePattern = localizedDatePattern.replaceAll("yy", "yyyy");
}
DateTextField dateField = DateTextField.withConverter(id, dateFieldModel, new PatternDateConverter(localizedDatePattern, false));
dateField.add(new EmptyOnChangeAjaxFormUpdatingBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
DateInput.this.setModelObject(computeDateTime());
target.add(DateInput.this);
}
});
return dateField;
}
Aggregations