Search in sources :

Example 6 with DateLabelComponent

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);
}
Also used : PersonalInfoDto(com.evolveum.midpoint.web.page.admin.home.dto.PersonalInfoDto) Label(org.apache.wicket.markup.html.basic.Label) DateLabelComponent(com.evolveum.midpoint.web.component.DateLabelComponent) Date(java.util.Date)

Example 7 with DateLabelComponent

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);
}
Also used : Label(org.apache.wicket.markup.html.basic.Label) DateLabelComponent(com.evolveum.midpoint.web.component.DateLabelComponent) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxSelfUpdatingTimerBehavior(org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior)

Aggregations

DateLabelComponent (com.evolveum.midpoint.web.component.DateLabelComponent)7 Label (org.apache.wicket.markup.html.basic.Label)6 IModel (org.apache.wicket.model.IModel)4 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)3 Date (java.util.Date)3 ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)3 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)3 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)2 PersonalInfoDto (com.evolveum.midpoint.web.page.admin.home.dto.PersonalInfoDto)2 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)2 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 CheckBoxHeaderColumn (com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn)1 EnumPropertyColumn (com.evolveum.midpoint.web.component.data.column.EnumPropertyColumn)1 InlineMenuable (com.evolveum.midpoint.web.component.data.column.InlineMenuable)1 ButtonInlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)1 DownloadButtonPanel (com.evolveum.midpoint.web.page.admin.reports.component.DownloadButtonPanel)1 ObjectTypeGuiDescriptor (com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor)1 TooltipBehavior (com.evolveum.midpoint.web.util.TooltipBehavior)1 MetadataType (com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType)1