Search in sources :

Example 1 with AutoRefreshDto

use of com.evolveum.midpoint.web.component.refresh.AutoRefreshDto in project midpoint by Evolveum.

the class PageTaskEdit method initLayout.

protected void initLayout() {
    refreshModel = new Model(new AutoRefreshDto());
    refreshModel.getObject().setInterval(getRefreshInterval());
    IModel<PrismObject<TaskType>> prismObjectModel = new AbstractReadOnlyModel<PrismObject<TaskType>>() {

        @Override
        public PrismObject<TaskType> getObject() {
            return objectWrapperModel.getObject().getObject();
        }
    };
    final TaskSummaryPanel summaryPanel = new TaskSummaryPanel(ID_SUMMARY_PANEL, prismObjectModel, refreshModel, this);
    summaryPanel.setOutputMarkupId(true);
    add(summaryPanel);
    mainPanel = new TaskMainPanel(ID_MAIN_PANEL, objectWrapperModel, taskDtoModel, showAdvancedFeaturesModel, this);
    mainPanel.setOutputMarkupId(true);
    add(mainPanel);
    summaryPanel.getRefreshPanel().startRefreshing(this, null);
}
Also used : AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) PrismObject(com.evolveum.midpoint.prism.PrismObject) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) AutoRefreshDto(com.evolveum.midpoint.web.component.refresh.AutoRefreshDto)

Example 2 with AutoRefreshDto

use of com.evolveum.midpoint.web.component.refresh.AutoRefreshDto in project midpoint by Evolveum.

the class PageTaskEdit method refresh.

public void refresh(AjaxRequestTarget target) {
    TaskTabsVisibility tabsVisibilityOld = new TaskTabsVisibility();
    tabsVisibilityOld.computeAll(this);
    TaskButtonsVisibility buttonsVisibilityOld = new TaskButtonsVisibility();
    buttonsVisibilityOld.computeAll(this);
    refreshTaskModels();
    TaskTabsVisibility tabsVisibilityNew = new TaskTabsVisibility();
    tabsVisibilityNew.computeAll(this);
    TaskButtonsVisibility buttonsVisibilityNew = new TaskButtonsVisibility();
    buttonsVisibilityNew.computeAll(this);
    if (!buttonsVisibilityNew.equals(buttonsVisibilityOld)) {
        target.add(mainPanel.getButtonPanel());
    }
    if (tabsVisibilityNew.equals(tabsVisibilityOld)) {
        // soft version
        for (Component component : mainPanel.getTabPanel()) {
            if (component instanceof TaskTabPanel) {
                for (Component c : ((TaskTabPanel) component).getComponentsToUpdate()) {
                    target.add(c);
                }
            }
        }
    } else {
        // hard version
        target.add(mainPanel.getTabPanel());
    }
    target.add(getSummaryPanel());
    AutoRefreshDto refreshDto = refreshModel.getObject();
    refreshDto.recordRefreshed();
    if (isEdit() || !refreshDto.isEnabled()) {
        getRefreshPanel().stopRefreshing(this, target);
    } else {
        getRefreshPanel().startRefreshing(this, target);
    }
}
Also used : Component(org.apache.wicket.Component) AutoRefreshDto(com.evolveum.midpoint.web.component.refresh.AutoRefreshDto)

Aggregations

AutoRefreshDto (com.evolveum.midpoint.web.component.refresh.AutoRefreshDto)2 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 TaskType (com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType)1 Component (org.apache.wicket.Component)1 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)1 IModel (org.apache.wicket.model.IModel)1 Model (org.apache.wicket.model.Model)1