Skip to content

Commit

Permalink
modifying of display name for multivalue containers and adding of ele…
Browse files Browse the repository at this point in the history
…ment documentation as help button
  • Loading branch information
skublik committed Aug 17, 2018
1 parent 0ce8b25 commit 04ff8e0
Show file tree
Hide file tree
Showing 13 changed files with 198 additions and 31 deletions.
Expand Up @@ -1050,6 +1050,30 @@ public static <C extends Containerable> String getDisplayName(PrismContainerValu
return "ContainerPanel.containerProperties";
}

if(prismContainerValue.canRepresent(LifecycleStateType.class)) {
LifecycleStateType lifecycleStateType = (LifecycleStateType) prismContainerValue.asContainerable();
String name = lifecycleStateType.getDisplayName();
if(name == null || name.isEmpty()) {
Class<C> cvalClass = prismContainerValue.getCompileTimeClass();
name = lifecycleStateType.getName();
}

if(name != null && !name.isEmpty()) {
return name;
}
}

if(prismContainerValue.canRepresent(PropertyConstraintType.class)) {
PropertyConstraintType propertyConstraintType = (PropertyConstraintType) prismContainerValue.asContainerable();
String path = "";
if(propertyConstraintType.getPath() != null) {
path = propertyConstraintType.getPath().getItemPath().toString();
}

if(path != null && !path.isEmpty()) {
return path;
}
}

if (prismContainerValue.canRepresent(AssignmentType.class)) {
AssignmentType assignmentType = (AssignmentType) prismContainerValue.asContainerable();
Expand All @@ -1070,10 +1094,59 @@ public static <C extends Containerable> String getDisplayName(PrismContainerValu
}
if (prismContainerValue.canRepresent(AbstractPolicyConstraintType.class)){
AbstractPolicyConstraintType constraint = (AbstractPolicyConstraintType) prismContainerValue.asContainerable();
String displayName = (StringUtils.isEmpty(constraint.getName()) ? (constraint.asPrismContainerValue().getParent().getPath().last())
: constraint.getName())
+ (StringUtils.isEmpty(constraint.getDescription()) ? "" : (" - " + constraint.getDescription()));
return displayName;
String displayName = constraint.getName();
if(StringUtils.isNotEmpty(displayName)) {
return displayName;
} else {
return constraint.asPrismContainerValue().getParent().getPath().last().toString() + ".details";
}
}
if (prismContainerValue.canRepresent(RichHyperlinkType.class)){
RichHyperlinkType richHyperlink = (RichHyperlinkType) prismContainerValue.asContainerable();
String label = richHyperlink.getLabel();
String description = richHyperlink.getDescription();
String targetUrl = richHyperlink.getTargetUrl();
if(StringUtils.isNotEmpty(label)) {
return label + (StringUtils.isNotEmpty(description) ? (" - " + description) : "");
} else if(StringUtils.isNotEmpty(targetUrl)) {
return targetUrl;
}
}
if (prismContainerValue.canRepresent(UserInterfaceFeatureType.class)){
UserInterfaceFeatureType userInterfaceFeature = (UserInterfaceFeatureType) prismContainerValue.asContainerable();
String identifier = userInterfaceFeature.getIdentifier();
if(StringUtils.isNotEmpty(identifier)) {
return identifier;
}
}
if (prismContainerValue.canRepresent(GuiObjectColumnType.class)){
GuiObjectColumnType guiObjectColumn = (GuiObjectColumnType) prismContainerValue.asContainerable();
String name = guiObjectColumn.getName();
if(StringUtils.isNotEmpty(name)) {
return name;
}
}
if (prismContainerValue.canRepresent(GuiObjectListViewType.class)){
GuiObjectListViewType guiObjectListView = (GuiObjectListViewType) prismContainerValue.asContainerable();
String name = guiObjectListView.getName();
if(StringUtils.isNotEmpty(name)) {
return name;
}
}
if (prismContainerValue.canRepresent(GenericPcpAspectConfigurationType.class)){
GenericPcpAspectConfigurationType genericPcpAspectConfiguration = (GenericPcpAspectConfigurationType) prismContainerValue.asContainerable();
String name = genericPcpAspectConfiguration.getName();
if(StringUtils.isNotEmpty(name)) {
return name;
}
}
if (prismContainerValue.canRepresent(RelationDefinitionType.class)){
RelationDefinitionType relationDefinition = (RelationDefinitionType) prismContainerValue.asContainerable();
String name = (relationDefinition.getRef().getLocalPart());
String description = relationDefinition.getDescription();
if(StringUtils.isNotEmpty(name)) {
return name + (StringUtils.isNotEmpty(description) ? (" - " + description) : "");
}
}
Class<C> cvalClass = prismContainerValue.getCompileTimeClass();
if (cvalClass != null){
Expand Down
Expand Up @@ -24,7 +24,12 @@

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.assignment.AssignmentPanel;
import com.evolveum.midpoint.web.component.form.Form;
import com.evolveum.midpoint.web.component.prism.ItemVisibility;
import com.evolveum.midpoint.web.component.prism.ItemWrapper;
import com.evolveum.midpoint.web.component.prism.ObjectWrapper;
import com.evolveum.midpoint.web.component.prism.PrismPanel;
import com.evolveum.midpoint.web.model.ContainerWrapperListFromObjectWrapperModel;
Expand All @@ -36,6 +41,8 @@
public class SystemConfigPanelNew extends BasePanel<ObjectWrapper<SystemConfigurationType>> {

private static final long serialVersionUID = 1L;

private static final Trace LOGGER = TraceManager.getTrace(SystemConfigPanelNew.class);

private static final String ID_SYSTEM_CONFIG = "basicSystemConfiguration";

Expand All @@ -57,7 +64,7 @@ protected void onInitialize() {
protected void initLayout() {
Form form = new Form<>("form");
PrismPanel<SystemConfigurationType> panel = new PrismPanel<SystemConfigurationType>(ID_SYSTEM_CONFIG,
new ContainerWrapperListFromObjectWrapperModel(getModel(), getVisibleContainers()), null, form, null, getPageBase());
new ContainerWrapperListFromObjectWrapperModel(getModel(), getVisibleContainers()), null, form, itemWrapper -> getBasicTabVisibity(itemWrapper), getPageBase());
add(panel);
}

Expand All @@ -66,4 +73,11 @@ private List<ItemPath> getVisibleContainers() {
paths.addAll(Arrays.asList(ItemPath.EMPTY_PATH));
return paths;
}

private ItemVisibility getBasicTabVisibity(ItemWrapper itemWrapper) {
if(itemWrapper.getPath().isSubPathOrEquivalent(new ItemPath(ItemPath.EMPTY_PATH, SystemConfigurationType.F_DESCRIPTION)) || itemWrapper.getPath().isSubPathOrEquivalent(new ItemPath(ItemPath.EMPTY_PATH, SystemConfigurationType.F_GLOBAL_SECURITY_POLICY_REF))) {
return ItemVisibility.AUTO;
}
return ItemVisibility.HIDDEN;
}
}
Expand Up @@ -17,11 +17,11 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div class="prism-header" wicket:id="header"/>
<div class="prism-properties">
<div wicket:id="properties">
<div class="row prism-property" wicket:id="property"/>
</div>
<div class="container-fluid">
<div class="prism-header" wicket:id="header"/>
<div class="prism-properties" wicket:id="properties">
<div class="row prism-property" wicket:id="property"/>
</div>
</div>
</wicket:panel>
</html>
Expand Up @@ -20,7 +20,7 @@

<wicket:fragment wicket:id="expandCollapseFragment">
<button wicket:id="expandCollapseButton" wicket:message="title:PrismObjectPanel.expandCollapseContainer"
class="btn btn-box-tool text-warning" trigger="hover" style="color:orange;"><i class="fa fa-caret-down"></i></button>
class="btn btn-box-tool text-warning" trigger="hover" style="color:orange; width: 22px; text-align:center;"><i class="fa fa-caret-down"></i></button>
</wicket:fragment>

<button wicket:id="addButton" wicket:message="title:PrismObjectPanel.addChildContainer"
Expand Down
Expand Up @@ -90,7 +90,7 @@ protected WebMarkupContainer initExpandCollapseButton(String contentAreaId) {
Fragment expandCollapseFragment = new Fragment(contentAreaId, ID_EXPAND_COLLAPSE_FRAGMENT, this);

ToggleIconButton expandCollapseButton = new ToggleIconButton(ID_EXPAND_COLLAPSE_BUTTON,
GuiStyleConstants.CLASS_ICON_COLLAPSE_CONTAINER, GuiStyleConstants.CLASS_ICON_EXPAND_CONTAINER) {
GuiStyleConstants.CLASS_ICON_EXPAND_CONTAINER, GuiStyleConstants.CLASS_ICON_COLLAPSE_CONTAINER) {

private static final long serialVersionUID = 1L;

Expand Down
Expand Up @@ -19,7 +19,7 @@
<wicket:extend>
<wicket:fragment wicket:id="expandCollapseFragment">
<button wicket:id="expandCollapseButton" wicket:message="title:PrismObjectPanel.expandCollapseContainer"
class="btn btn-box-tool text-warning" trigger="hover" style="color:orange;"><i class="fa fa-caret-down"></i></button>
class="btn btn-box-tool text-warning" trigger="hover" style="color:orange; width: 22px; text-align:center;"><i class="fa fa-caret-down"></i></button>
</wicket:fragment>
<div class="row">
<div class="col-xs-2">
Expand Down
Expand Up @@ -28,6 +28,7 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.StringResourceModel;
import org.hibernate.validator.internal.engine.ValueContext.ValueState;

import javax.xml.namespace.QName;

Expand All @@ -49,6 +50,7 @@ public class PrismContainerValueHeaderPanel<C extends Containerable> extends Pri
private boolean isChildContainersSelectorPanelVisible = false;

private static final Trace LOGGER = TraceManager.getTrace(PrismContainerValueHeaderPanel.class);

private ItemVisibilityHandler isPanelVisible;

public PrismContainerValueHeaderPanel(String id, IModel<ContainerValueWrapper<C>> model, ItemVisibilityHandler isPanelVisible) {
Expand Down Expand Up @@ -189,7 +191,7 @@ public boolean isVisible(){

DropDownChoicePanel multivalueContainersList = new DropDownChoicePanel<>(ID_CHILD_CONTAINERS_LIST,
Model.of(pathsList.size() > 0 ? pathsList.get(0) : null), Model.ofList(pathsList),
new QNameIChoiceRenderer(getModelObject().getDefinition().getDefaultNamespace()));
new QNameIChoiceRenderer(getModelObject().getContainerValue().getValue().getClass().getSimpleName()));
multivalueContainersList.setOutputMarkupId(true);
multivalueContainersList.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
childContainersSelectorPanel.add(multivalueContainersList);
Expand Down Expand Up @@ -237,6 +239,10 @@ protected void initHeaderLabel(){
if (org.apache.commons.lang3.StringUtils.isEmpty(displayName)) {
displayName = "displayName.not.set";
}

if(getModelObject().getStatus().equals(ValueStatus.ADDED) && getModelObject().getDefinition().isMultiValue() && !getModelObject().getContainer().isShowOnTopLevel()) {
displayName = displayName +".newValue";
}
StringResourceModel headerLabelModel = createStringResource(displayName);
AjaxButton labelComponent = new AjaxButton(ID_LABEL, headerLabelModel) {
private static final long serialVersionUID = 1L;
Expand Down
Expand Up @@ -315,7 +315,10 @@ private String loadHelpText(IModel<IW> model) {
ItemDefinition def = property.getItemDefinition();
String doc = def.getHelp();
if (StringUtils.isEmpty(doc)) {
return null;
doc = def.getDocumentation();
if (StringUtils.isEmpty(doc)) {
return null;
}
}

return PageBase.createStringResourceStatic(this, doc).getString();
Expand Down
73 changes: 57 additions & 16 deletions gui/admin-gui/src/main/resources/localization/Midpoint.properties
Expand Up @@ -4036,22 +4036,22 @@ PageInternals.tab.traces=Traces
PageInternals.tab.counters=Counters
PageAttorneySelection.title=User selection
PageWorkItemsAttorney.title=Attorney work items
PolicyConstraintsType.objectState=Object state
PolicyConstraintsType.assignmentState=Assignment state
PolicyConstraintsType.hasAssignment=Has assignment
PolicyConstraintsType.hasNoAssignment=Has no assignment
PolicyConstraintsType.exclusion=Exclusion
PolicyConstraintsType.minAssignees=Min assignees
PolicyConstraintsType.maxAssignees=Max assignees
PolicyConstraintsType.objectMinAssigneesViolation=Object min assignees violation
PolicyConstraintsType.objectMaxAssigneesViolation=Object max assignees violation
PolicyConstraintsType.modification=Modification
PolicyConstraintsType.assignment=Assignment
PolicyConstraintsType.objectTimeValidity=Object time validity
PolicyConstraintsType.assignmentTimeValidity=Assignment time validity
PolicyConstraintsType.situation=Situation
PolicyConstraintsType.transition=Transition
PolicyConstraintsType.ref=Ref
objectState=Object state
assignmentState=Assignment state
hasAssignment=Has assignment
hasNoAssignment=Has no assignment
exclusion=Exclusion
minAssignees=Min assignees
maxAssignees=Max assignees
objectMinAssigneesViolation=Object min assignees violation
objectMaxAssigneesViolation=Object max assignees violation
modification=Modification
assignment=Assignment
objectTimeValidity=Object time validity
assignmentTimeValidity=Assignment time validity
situation=Situation
transition=Transition
ref=Ref
AssignmentTypeDetailsPanel.containerTitle=Assignment details
ResourceObjectAssociationType.details=Association
ResourceAttributeDefinitionType.details=Attributes
Expand Down Expand Up @@ -4108,3 +4108,44 @@ InternalsCachePanel.button.clearCaches=Clear caches
PageAccountActivation.user.not.found=Unexpected problem occurs. Please contact system administrator.
propertyConstraintValidator.error=Cannot set property constraint without path defined.
ItemPathPanel.button.reset=Reset path
ApprovalPolicyActionType.details.newValue=New approval policy action
LifecycleStateType.details.newValue=New lifecycle state
NotificationPolicyActionType.details.newValue=New notification policy action
PropertyConstraintType.details.newValue=New property constraint
objectState.details.newValue=New object state
assignmentState.details.newValue=New assignment state
hasAssignment.details.newValue=New has assignment
hasNoAssignment.details.newValue=New has no assignment
exclusion.details.newValue=New exclusion
minAssignees.details.newValue=New minimum assignees
maxAssignees.details.newValue=New maximum assignees
modification.details.newValue=New modification
assignment.details.newValue=New assignment
objectTimeValidity.details.newValue=New object time validity
assignmentTimeValidity.details.newValue=New assignment time validity
situation.details.newValue=New policy situation
transition.details.newValue=New transition
ref.details.newValue=New reference
RichHyperlinkType.details.newValue=New rich hyperlink
UserInterfaceFeatureType.details.newValue=New user interface feature
GuiObjectDetailsPageType.details.newValue=New gui object details page
ObjectFormType.details.newValue=New object form
GuiObjectColumnType.details.newValue=New gui object column
GuiObjectListViewType.details.newValue=New gui object list view
DashboardWidgetType.details.newValue=New dashboard widget
GenericPcpAspectConfigurationType.details.newValue=New generic pcp aspect configuration
RelationDefinitionType.details.newValue=New relation definition
objectState.details=Object state
assignmentState.details=Assignment state
hasAssignment.details=Has assignment
hasNoAssignment.details=Has no assignment
exclusion.details=Exclusion
minAssignees.details=Minimum assignees
maxAssignees.details=Maximum assignees
modification.details=Modification
assignment.details=Assignment
objectTimeValidity.details=Object time validity
assignmentTimeValidity.details=Assignment time validity
situation.details=Policy situation
transition.details=Transition
ref.details=Reference
Expand Up @@ -830,6 +830,10 @@ body .treeview-menu > li > span:hover {
padding-bottom: 5px;
}

.prism-property-label {
padding-left: 37px;
}

.prism-value { // DEPRECATED: rework the prism-value vs prism-property-value later
margin-top: 3px;
}
Expand Down
11 changes: 11 additions & 0 deletions infra/schema/src/main/resources/localization/schema.properties
Expand Up @@ -164,6 +164,9 @@ BeforeAfterType.BEFORE=Before
Boolean.FALSE=False
Boolean.NULL=Undefined
Boolean.TRUE=True
ChangeTypeType.MODIFY=Modify
ChangeTypeType.DELETE=Delete
ChangeTypeType.ADD=Add
CapabilitiesType.activation=Activation
CapabilitiesType.activationStatus=Activation Status
CapabilitiesType.activationLockoutStatus=Activation Lockout
Expand Down Expand Up @@ -260,6 +263,7 @@ FormSpecificationType.title=Title
FormSpecificationType.formRef=Reference to form
FormSpecificationType.panelClass=Panel class
FormSpecificationType.panelUri=Panel uri
GenericPcpAspectConfigurationType.name=Name
GlobalPolicyRuleType.details=Global policy rule
GlobalPolicyRuleType.focusSelector=Focus selector
GlobalPolicyRuleType.targetSelector=Target selector
Expand Down Expand Up @@ -304,6 +308,7 @@ LifecycleStateActionType.details=Lifecycle state action
LifecycleStateActionType.name=Name
LifecycleStateActionType.description=Description
LifecycleStateActionType.dataReduction=Data reduction
LifecycleStateModelType.state=Lifecycle state
LifecycleStateType.details=Lifecycle state
LifecycleStateType.name=Name
LifecycleStateType.description=Description
Expand All @@ -314,6 +319,7 @@ LifecycleStateType.activeAssignments=Active assignments
LifecycleStateType.entryAction=Entry action
LifecycleStateType.exitAction=Exit action
LifecycleStateType.transition=Transition
LifecycleStateType.forcedAssignment=Forced assignment
LockoutStatusType.LOCKED=Locked
LockoutStatusType.NORMAL=Normal
LockoutStatusType.UNDEFINED=Undefined
Expand Down Expand Up @@ -395,9 +401,12 @@ ObjectType.AccountType=Account
ObjectType.ConnectorType=Connector
ObjectType.ConnectorHostType=Connector host
ObjectType.FocusType=Focus
ObjectType.FormType=Form
ObjectType.FunctionLibraryType=Function library
ObjectType.GenericObjectType=Generic object
ObjectType.LookupTableType=Lookup table
ObjectType.NodeType=Node
ObjectType.ObjectCollectionType=Object collection
ObjectType.ObjectType=Object
ObjectType.ObjectTemplateType=Object template
ObjectType.OrgManagerType=Org. manager
Expand Down Expand Up @@ -820,6 +829,8 @@ ValuePolicy.minimalOccurrenceNotMet=Minimal occurrence ({0}) of characters ({1})
ValuePolicy.maximalOccurrenceExceeded=Maximal occurrence ({0}) of characters ({1}) was exceeded (occurrence of characters: {2}).
ValuePolicy.firstCharacterNotAllowed=First character is not from allowed set. Allowed set: {0}.
ValuePolicy.charactersNotAllowed=Characters [ {0} ] are not allowed in the value.
VirtualAssignmentSpecificationType.targetType=Target type
VirtualAssignmentSpecificationType.filter=Filter
AbstractRoleType.dataProtection=Data protection
DataProtectionType.controllerName=Controller name
DataProtectionType.controllerContact=Controller contact
Expand Down

0 comments on commit 04ff8e0

Please sign in to comment.