use of com.evolveum.midpoint.web.component.data.column.LinkIconPanel in project midpoint by Evolveum.
the class AutoRefreshPanel method initLayout.
private void initLayout(final Refreshable refreshable, boolean inSummaryPanel) {
final LinkIconPanel refreshNow = new LinkIconPanel(ID_REFRESH_NOW, new Model("fa fa-refresh"), createStringResource("autoRefreshPanel.refreshNow")) {
@Override
protected void onClickPerformed(AjaxRequestTarget target) {
refreshable.refresh(target);
}
};
refreshNow.setRenderBodyOnly(true);
add(refreshNow);
final LinkIconPanel resumeRefreshing = new LinkIconPanel(ID_START, new Model("fa fa-play"), createStringResource("autoRefreshPanel.resumeRefreshing")) {
@Override
protected void onClickPerformed(AjaxRequestTarget target) {
getModelObject().setEnabled(true);
refreshable.refresh(target);
startRefreshing(refreshable, target);
}
};
resumeRefreshing.setRenderBodyOnly(true);
resumeRefreshing.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !getModelObject().isEnabled();
}
});
add(resumeRefreshing);
final LinkIconPanel pauseRefreshing = new LinkIconPanel(ID_PAUSE, new Model("fa fa-pause"), createStringResource("autoRefreshPanel.pauseRefreshing")) {
@Override
protected void onClickPerformed(AjaxRequestTarget target) {
getModelObject().setEnabled(false);
refreshable.refresh(target);
stopRefreshing(refreshable, target);
}
};
pauseRefreshing.setRenderBodyOnly(true);
pauseRefreshing.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return getModelObject().isEnabled();
}
});
add(pauseRefreshing);
final Label status = new Label(ID_STATUS, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
AutoRefreshDto dto = getModelObject();
if (dto.isEnabled()) {
return createStringResource("autoRefreshPanel.refreshingEach", dto.getInterval() / 1000).getString();
} else {
return createStringResource("autoRefreshPanel.noRefreshing").getString();
}
}
});
status.setRenderBodyOnly(true);
add(status);
if (inSummaryPanel) {
add(new AttributeModifier("class", "summary-tag"));
}
}
use of com.evolveum.midpoint.web.component.data.column.LinkIconPanel in project midpoint by Evolveum.
the class LiveSyncHandlerPanel method initLayout.
private void initLayout(final PageTaskEdit parentPage) {
WebMarkupContainer tokenContainer = new WebMarkupContainer(ID_TOKEN_CONTAINER);
tokenContainer.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
//TODO
return true;
}
});
tokenContainer.add(new Label(ID_TOKEN, new PropertyModel<>(getModel(), LiveSyncHandlerDto.F_TOKEN)));
LinkIconPanel deleteTokenPanel = new LinkIconPanel(ID_DELETE_TOKEN, new Model("fa fa-fw fa-trash-o fa-lg text-danger"), createStringResource("LiveSyncHandlerPanel.deleteToken")) {
@Override
protected void onClickPerformed(AjaxRequestTarget target) {
parentPage.getController().deleteSyncTokenPerformed(target);
}
};
deleteTokenPanel.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
// TODO ... and security
return !parentPage.isEdit() && getModelObject().hasToken();
}
});
deleteTokenPanel.setRenderBodyOnly(true);
tokenContainer.add(deleteTokenPanel);
add(tokenContainer);
WebMarkupContainer retryContainer = new WebMarkupContainer(ID_TOKEN_RETRY_CONTAINER);
add(retryContainer);
WebMarkupContainer retryCheckboxContainer = new WebMarkupContainer(ID_TOKEN_RETRY_CHECKBOX_CONTAINER);
retryContainer.add(retryCheckboxContainer);
CheckBox retryCheckbox = new CheckBox(ID_TOKEN_RETRY_CHECKBOX, new PropertyModel<Boolean>(getModel(), ResourceRelatedHandlerDto.F_TOKEN_RETRY_UNHANDLED_ERR));
retryCheckbox.add(enabledIfEdit);
retryCheckboxContainer.add(retryCheckbox);
}
Aggregations