use of com.evolveum.midpoint.web.component.DateLabelComponent in project midpoint by Evolveum.
the class PersonalInfoPanel method initLayout.
protected void initLayout() {
DateLabelComponent lastLoginDate = new DateLabelComponent(ID_LAST_LOGIN_DATE, new IModel<Date>() {
private static final long serialVersionUID = 1L;
@Override
public Date getObject() {
if (getModel() == null) {
return null;
}
PersonalInfoDto dto = getModel().getObject();
return dto == null ? null : dto.getLastLoginDate();
}
}, WebComponentUtil.getLongDateTimeFormat(getPageBase()));
lastLoginDate.setBeforeTextOnDateNull(getPageBase().getString("PersonalInfoPanel.never"));
add(lastLoginDate);
Label lastLoginFrom = new Label(ID_LAST_LOGIN_FROM, new IModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
if (getModel() == null) {
return PersonalInfoPanel.this.getString("PersonalInfoPanel.undefined");
}
PersonalInfoDto dto = getModel().getObject();
return StringUtils.isNotEmpty(dto.getLastLoginFrom()) ? dto.getLastLoginFrom() : PersonalInfoPanel.this.getString("PersonalInfoPanel.undefined");
}
});
add(lastLoginFrom);
DateLabelComponent lastFailDate = new DateLabelComponent(ID_LAST_FAIL_DATE, new IModel<Date>() {
private static final long serialVersionUID = 1L;
@Override
public Date getObject() {
if (getModel() == null) {
return null;
}
PersonalInfoDto dto = getModel().getObject();
return dto == null ? null : dto.getLastFailDate();
}
}, WebComponentUtil.getLongDateTimeFormat(getPageBase()));
lastFailDate.setBeforeTextOnDateNull(getPageBase().getString("PersonalInfoPanel.never"));
add(lastFailDate);
Label lastFailFrom = new Label(ID_LAST_FAIL_FROM, new IModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
if (getModel() == null) {
return PersonalInfoPanel.this.getString("PersonalInfoPanel.undefined");
}
PersonalInfoDto dto = getModel().getObject();
return StringUtils.isNotEmpty(dto.getLastFailFrom()) ? dto.getLastFailFrom() : PersonalInfoPanel.this.getString("PersonalInfoPanel.undefined");
}
});
add(lastFailFrom);
DateLabelComponent passwordExp = new DateLabelComponent(ID_PASSWORD_EXP, new IModel<Date>() {
private static final long serialVersionUID = 1L;
@Override
public Date getObject() {
if (getModel() == null) {
return null;
}
PersonalInfoDto dto = getModel().getObject();
return dto == null ? null : dto.getPasswordExp();
}
}, WebComponentUtil.getLongDateTimeFormat(getPageBase()));
passwordExp.setBeforeTextOnDateNull(getPageBase().getString("PersonalInfoPanel.never"));
add(passwordExp);
}
use of com.evolveum.midpoint.web.component.DateLabelComponent in project midpoint by Evolveum.
the class SystemInfoPanel method initLayout.
private void initLayout() {
final WebMarkupContainer table = new WebMarkupContainer(ID_TABLE);
table.setOutputMarkupId(true);
add(table);
table.add(new AjaxSelfUpdatingTimerBehavior(Duration.milliseconds(10000)));
Label cpuUsage = new Label(ID_CPU_USAGE, new PropertyModel<>(getModel(), SystemInfoDto.F_CPU_USAGE));
table.add(cpuUsage);
Label heapMemory = new Label(ID_HEAP_MEMORY, createMemoryModel(true));
table.add(heapMemory);
Label nonHeapMemory = new Label(ID_NON_HEAP_MEMORY, createMemoryModel(false));
table.add(nonHeapMemory);
Label threads = new Label(ID_THREADS, createThreadModel());
table.add(threads);
Label dbPool = new Label(ID_DB_POOL, createDBPoolModel());
table.add(dbPool);
DateLabelComponent startTime = new DateLabelComponent(ID_START_TIME, createStartTimeModel(), WebComponentUtil.getLongDateTimeFormat(SystemInfoPanel.this.getPageBase()));
table.add(startTime);
Label uptime = new Label(ID_UPTIME, createUptimeModel());
table.add(uptime);
}
Aggregations