use of com.evolveum.midpoint.web.component.data.column.AjaxLinkPanel in project midpoint by Evolveum.
the class ResourceDetailsTabPanel method initLayout.
protected void initLayout() {
// PrismObject<ResourceType> resourceObject = getObjectWrapper().getObject();
// ResourceType resource = resourceObject.asObjectable();
add(createLastAvailabilityStatusInfo());
add(createSourceTargetInfo());
add(createSchemaStatusInfo());
CapabilitiesPanel capabilities = new CapabilitiesPanel(PANEL_CAPABILITIES, capabilitiesModel);
add(capabilities);
ListDataProvider<ResourceConfigurationDto> resourceConfigProvider = new ListDataProvider<>(ResourceDetailsTabPanel.this, createResourceConfigListModel());
List<IColumn<SelectableBeanImpl<ResourceType>, String>> tableColumns = new ArrayList<>();
tableColumns.add(ColumnUtils.createPropertyColumn(new ColumnTypeDto<>("ShadowType.kind", "objectTypeDefinition.kind", ShadowType.F_KIND.getLocalPart())));
tableColumns.add(new PropertyColumn<>(createStringResource("ShadowType.objectClass"), "objectTypeDefinition.objectClass") {
@Override
public IModel<?> getDataModel(IModel<SelectableBeanImpl<ResourceType>> rowModel) {
IModel<QName> model = (IModel<QName>) super.getDataModel(rowModel);
if (model.getObject() != null) {
return () -> model.getObject().getLocalPart();
}
return model;
}
});
List<ColumnTypeDto<String>> columns = Arrays.asList(new ColumnTypeDto<>("ShadowType.intent", "objectTypeDefinition.intent", ShadowType.F_INTENT.getLocalPart()), new ColumnTypeDto<>("ResourceType.isSync", "sync", null));
tableColumns.addAll(ColumnUtils.createColumns(columns));
PropertyColumn tasksColumn = new PropertyColumn(PageBase.createStringResourceStatic(this, "ResourceType.tasks"), "definedTasks") {
@Override
public void populateItem(Item item, String componentId, final IModel rowModel) {
ResourceConfigurationDto conf = (ResourceConfigurationDto) rowModel.getObject();
RepeatingView repeater = new RepeatingView(componentId);
for (final TaskType task : conf.getDefinedTasks()) {
repeater.add(new AjaxLinkPanel(repeater.newChildId(), new Model<>(task.getName().getOrig())) {
@Override
public void onClick(AjaxRequestTarget target) {
ResourceDetailsTabPanel.this.taskDetailsPerformed(target, task.getOid());
}
});
}
item.add(repeater);
}
};
tableColumns.add(tasksColumn);
BoxedTablePanel<ResourceConfigurationDto> resourceConfig = new BoxedTablePanel("resourceConfig", resourceConfigProvider, tableColumns);
resourceConfig.setAdditionalBoxCssClasses("box-success");
add(resourceConfig);
}
use of com.evolveum.midpoint.web.component.data.column.AjaxLinkPanel in project midpoint by Evolveum.
the class SceneItemValuePanel method initLayout.
private void initLayout() {
final VisibleEnableBehaviour visibleIfReference = new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
SceneItemValue object = getModelObject();
return hasValidReferenceValue(object);
}
};
final VisibleEnableBehaviour visibleIfNotReference = new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
SceneItemValue object = getModelObject();
return !hasValidReferenceValue(object);
}
};
IModel<DisplayType> displayModel = (IModel) () -> {
ObjectTypeGuiDescriptor guiDescriptor = getObjectTypeDescriptor();
String cssClass = ObjectTypeGuiDescriptor.ERROR_ICON;
String title = null;
if (guiDescriptor != null) {
cssClass = guiDescriptor.getBlackIcon();
title = createStringResource(guiDescriptor.getLocalizationKey()).getObject();
}
return GuiDisplayTypeUtil.createDisplayType(cssClass, "", title);
};
final ImagePanel icon = new ImagePanel(ID_ICON, displayModel);
icon.add(visibleIfReference);
add(icon);
final Label label = new Label(ID_LABEL, new LabelModel());
label.add(visibleIfNotReference);
add(label);
final AjaxLinkPanel link = new AjaxLinkPanel(ID_LINK, new LabelModel()) {
@Override
public void onClick(AjaxRequestTarget target) {
if (!(getModelObject().getSourceValue() instanceof PrismReferenceValue)) {
return;
}
PrismReferenceValue refValue = (PrismReferenceValue) getModelObject().getSourceValue();
if (refValue == null) {
return;
}
ObjectReferenceType ort = new ObjectReferenceType();
ort.setupReferenceValue(refValue);
WebComponentUtil.dispatchToObjectDetailsPage(ort, getPageBase(), false);
}
};
link.add(visibleIfReference);
add(link);
final Label additionalText = new Label(ID_ADDITIONAL_TEXT, new IModel<String>() {
@Override
public String getObject() {
return getModelObject() != null ? getModelObject().getAdditionalText() : null;
}
});
add(additionalText);
}
use of com.evolveum.midpoint.web.component.data.column.AjaxLinkPanel in project midpoint by Evolveum.
the class SearchObjectCollectionPanel method initSearchItemField.
protected void initSearchItemField(WebMarkupContainer searchItemContainer) {
IModel<String> nameModel = super.createLabelModel();
String oid = null;
ObjectCollectionSearchItem item = getModelObject();
if (item != null && item.getObjectCollectionView().getCollection() != null && item.getObjectCollectionView().getCollection().getCollectionRef() != null) {
oid = item.getObjectCollectionView().getCollection().getCollectionRef().getOid();
}
String finalOid = oid;
AjaxLinkPanel ajaxLinkPanel = new AjaxLinkPanel(ID_CLICKABLE_NAME, nameModel) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
WebComponentUtil.dispatchToObjectDetailsPage(ObjectCollectionType.class, finalOid, this, true);
}
@Override
public boolean isEnabled() {
return StringUtils.isNotEmpty(finalOid) && WebComponentUtil.isAuthorized(ObjectCollectionType.class);
}
};
ajaxLinkPanel.setOutputMarkupId(true);
searchItemContainer.add(ajaxLinkPanel);
}
Aggregations