use of com.evolveum.midpoint.gui.api.model.ReadOnlyModel in project midpoint by Evolveum.
the class DetailsNavigationPanel method getMenuItemIconClass.
private IModel<String> getMenuItemIconClass(IModel<ContainerPanelConfigurationType> item) {
return new ReadOnlyModel<>(() -> {
ContainerPanelConfigurationType config = item.getObject();
if (config == null || config.getDisplay() == null) {
return GuiStyleConstants.CLASS_CIRCLE_FULL;
}
String iconCss = WebComponentUtil.getIconCssClass(config.getDisplay());
return StringUtils.isNoneEmpty(iconCss) ? iconCss : GuiStyleConstants.CLASS_CIRCLE_FULL;
});
}
use of com.evolveum.midpoint.gui.api.model.ReadOnlyModel in project midpoint by Evolveum.
the class DetailsNavigationPanel method createNavigationDetailsStyleModel.
private IModel<String> createNavigationDetailsStyleModel(ListItem<ContainerPanelConfigurationType> item) {
return new ReadOnlyModel<>(() -> {
ContainerPanelConfigurationType storageConfig = getConfigurationFromStorage();
ContainerPanelConfigurationType itemModelObject = item.getModelObject();
if (isMenuActive(storageConfig, itemModelObject)) {
return "active open";
}
if (hasActiveSubmenu(storageConfig, itemModelObject)) {
return "open";
}
return "";
});
}
use of com.evolveum.midpoint.gui.api.model.ReadOnlyModel in project midpoint by Evolveum.
the class PrismPropertyWrapperColumnPanel method createLink.
@Override
protected Panel createLink(String id, IModel<PrismPropertyValueWrapper<T>> object) {
String humanReadableLinkName = getHumanReadableLinkName(object);
IModel labelModel;
if (StringUtils.isEmpty(humanReadableLinkName)) {
labelModel = getPageBase().createStringResource("feedbackMessagePanel.message.undefined");
} else {
labelModel = new ReadOnlyModel(() -> humanReadableLinkName);
}
AjaxLinkPanel ajaxLinkPanel = new AjaxLinkPanel(id, labelModel) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
PrismPropertyWrapperColumnPanel.this.onClick(target, getModelObject().getParent());
}
};
return ajaxLinkPanel;
}
use of com.evolveum.midpoint.gui.api.model.ReadOnlyModel in project midpoint by Evolveum.
the class ResourceDetailsTabPanel method createAvailabilityStatusInfoBoxModel.
private ReadOnlyModel<InfoBoxType> createAvailabilityStatusInfoBoxModel() {
return new ReadOnlyModel<>(() -> {
String messageKey = "PageResource.resource.availabilityUnknown";
String backgroundColor = "bg-gray";
String icon = "fa fa-question";
ResourceType resource = getObjectDetailsModels().getObjectType();
OperationalStateType operationalState = resource.getOperationalState();
AdministrativeOperationalStateType administrativeOperationalState = resource.getAdministrativeOperationalState();
boolean inMaintenance = false;
if (administrativeOperationalState != null) {
AdministrativeAvailabilityStatusType administrativeAvailabilityStatus = administrativeOperationalState.getAdministrativeAvailabilityStatus();
if (administrativeAvailabilityStatus == AdministrativeAvailabilityStatusType.MAINTENANCE) {
messageKey = "PageResource.resource.maintenance";
backgroundColor = "bg-gray";
icon = "fa fa-wrench";
inMaintenance = true;
}
}
if (operationalState != null && !inMaintenance) {
AvailabilityStatusType lastAvailabilityStatus = operationalState.getLastAvailabilityStatus();
if (lastAvailabilityStatus != null) {
if (lastAvailabilityStatus == AvailabilityStatusType.UP) {
messageKey = "PageResource.resource.up";
backgroundColor = "bg-green";
icon = "fa fa-power-off";
} else if (lastAvailabilityStatus == AvailabilityStatusType.DOWN) {
backgroundColor = "bg-red";
messageKey = "PageResource.resource.down";
icon = "fa fa-ban";
} else if (lastAvailabilityStatus == AvailabilityStatusType.BROKEN) {
backgroundColor = "bg-yellow";
messageKey = "PageResource.resource.broken";
icon = "fa fa-warning";
}
}
}
InfoBoxType infoBoxType = new InfoBoxType(backgroundColor, icon, getPageBase().getString(messageKey));
ConnectorType connectorType = getConnectorType(resource);
if (connectorType == null) {
// Connector not found. Probably bad connectorRef reference.
infoBoxType.setNumber("--");
infoBoxType.setDescription("--");
} else {
String connectorName = StringUtils.substringAfterLast(WebComponentUtil.getEffectiveName(connectorType, ConnectorType.F_CONNECTOR_TYPE), ".");
String connectorVersion = connectorType.getConnectorVersion();
infoBoxType.setNumber(connectorName);
infoBoxType.setDescription(connectorVersion);
}
return infoBoxType;
});
}
use of com.evolveum.midpoint.gui.api.model.ReadOnlyModel in project midpoint by Evolveum.
the class ResourceSchemaHandlingPanel method createMultivalueContainerDetailsPanel.
private MultivalueContainerDetailsPanel<ResourceObjectTypeDefinitionType> createMultivalueContainerDetailsPanel(String panelId, IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> model) {
return new MultivalueContainerDetailsPanel<>(panelId, model, true) {
@Override
protected ItemVisibility getBasicTabVisibity(ItemWrapper<?, ?> itemWrapper) {
if (itemWrapper instanceof PrismContainerWrapper) {
return ItemVisibility.HIDDEN;
}
return ItemVisibility.AUTO;
}
@Override
@NotNull
protected List<ITab> createTabs() {
List<ITab> tabs = new ArrayList<>();
tabs.add(new PanelTab(createStringResource("ResourceSchemaHandlingPanel.tab.attributes")) {
@Override
public WebMarkupContainer createPanel(String panelId) {
return new ResourceAttributePanel(panelId, PrismContainerWrapperModel.fromContainerValueWrapper(getModel(), ResourceObjectTypeDefinitionType.F_ATTRIBUTE), getPanelConfiguration());
}
});
return tabs;
}
@Override
protected DisplayNamePanel<ResourceObjectTypeDefinitionType> createDisplayNamePanel(String displayNamePanelId) {
return new DisplayNamePanel<>(displayNamePanelId, new ItemRealValueModel<>(getModel())) {
@Override
protected IModel<String> createHeaderModel() {
return new ReadOnlyModel<>(() -> loadHeaderModel(getModelObject()));
}
@Override
protected IModel<List<String>> getDescriptionLabelsModel() {
return new ReadOnlyModel<>(() -> loadDescriptionModel(getModelObject()));
}
};
}
};
}
Aggregations