Skip to content

Commit

Permalink
Merge branch 'master' into tmp/mid-6228
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Sep 24, 2020
2 parents 54a15cd + c5f76eb commit c90486d
Show file tree
Hide file tree
Showing 150 changed files with 1,777 additions and 1,660 deletions.
11 changes: 11 additions & 0 deletions dist/src/main/assembly/dist.xml
Expand Up @@ -61,7 +61,18 @@
<fileSet>
<directory>${project.basedir}/src/main/bin</directory>
<outputDirectory>bin</outputDirectory>
<!-- Needed only for build on Windows, on Linux *.sh has already executable flag. -->
<fileMode>0755</fileMode>
<includes>
<include>*.sh</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/src/main/bin</directory>
<outputDirectory>bin</outputDirectory>
<excludes>
<exclude>*.sh</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>${project.basedir}/src/main/var</directory>
Expand Down
Expand Up @@ -58,9 +58,7 @@ protected void onInitialize() {
}

private void initLayout() {
WebMarkupContainer typeImage = new WebMarkupContainer(ID_TYPE_IMAGE);
typeImage.setOutputMarkupId(true);
typeImage.add(AttributeModifier.append("class", createImageModel()));
WebMarkupContainer typeImage = createTypeImagePanel(ID_TYPE_IMAGE);
add(typeImage);

Label name = new Label(ID_DISPLAY_NAME, createHeaderModel());
Expand All @@ -85,6 +83,7 @@ public void onClick(AjaxRequestTarget ajaxRequestTarget) {
}
};
navigateToObject.add(new VisibleBehaviour(() -> DisplayNamePanel.this.getModelObject() instanceof ObjectType &&
StringUtils.isNotEmpty(((ObjectType) DisplayNamePanel.this.getModelObject()).getOid()) &&
WebComponentUtil.getObjectDetailsPage(((ObjectType) DisplayNamePanel.this.getModelObject()).getClass()) != null));
navigateToObject.setOutputMarkupId(true);
add(navigateToObject);
Expand Down Expand Up @@ -116,6 +115,13 @@ protected void populateItem(ListItem<String> item) {
// add(new Label(ID_PENDING_OPERATION, getPendingOperationLabelModel()));
}

protected WebMarkupContainer createTypeImagePanel(String idTypeImage) {
WebMarkupContainer typeImage = new WebMarkupContainer(idTypeImage);
typeImage.setOutputMarkupId(true);
typeImage.add(AttributeModifier.append("class", createImageModel()));
return typeImage;
}

private boolean isObjectPolicyConfigurationType() {
return QNameUtil.match(
ObjectPolicyConfigurationType.COMPLEX_TYPE,
Expand Down
Expand Up @@ -207,6 +207,11 @@ protected Map<IconCssStyle, IconType> getMainButtonLayerIcons() {
if (!isCollectionViewPanelForCompiledView()) {
return null;
}
DisplayType mainButtonDisplayType = getMainButtonDisplayType();
if (mainButtonDisplayType.getIcon() != null && mainButtonDisplayType.getIcon().getCssClass() != null &&
getMainButtonDisplayType().getIcon().getCssClass().contains(GuiStyleConstants.CLASS_ADD_NEW_OBJECT)) {
return null;
}
Map<IconCssStyle, IconType> layerIconMap = new HashMap<>();
layerIconMap.put(IconCssStyle.BOTTOM_RIGHT_STYLE, WebComponentUtil.createIconType(GuiStyleConstants.CLASS_PLUS_CIRCLE, "green"));
return layerIconMap;
Expand Down
Expand Up @@ -801,7 +801,7 @@ private void initHeaderLayout(WebMarkupContainer container) {
menuToggle.add(createUserStatusBehaviour(true));
container.add(menuToggle);

UserMenuPanel rightMenu = new UserMenuPanel(ID_RIGHT_MENU, this);
UserMenuPanel rightMenu = new UserMenuPanel(ID_RIGHT_MENU);
rightMenu.add(createUserStatusBehaviour(true));
container.add(rightMenu);

Expand Down
Expand Up @@ -63,8 +63,8 @@ public interface ItemWrapper<I extends Item, VW extends PrismValueWrapper> exten
List<VW> getValues();
VW getValue() throws SchemaException;

boolean isStripe();
void setStripe(boolean stripe);
// boolean isStripe();
// void setStripe(boolean stripe);

I getItem();

Expand Down
Expand Up @@ -36,7 +36,7 @@ public interface PrismContainerValueWrapper<C extends Containerable> extends Pri
ValueStatus getStatus();
void setStatus(ValueStatus status);

<T extends Containerable> List<PrismContainerWrapper<T>> getContainers();
List<PrismContainerWrapper<? extends Containerable>> getContainers();

List<ItemWrapper<?, ?>> getNonContainers();

Expand Down Expand Up @@ -80,6 +80,8 @@ public interface PrismContainerValueWrapper<C extends Containerable> extends Pri
@Override
PrismContainerValue<C> getNewValue();

PrismContainerWrapper<Containerable> getSelectedChild();
PrismContainerWrapper<? extends Containerable> getSelectedChild();

void addItem(ItemWrapper<?, ?> newItem);
}

Expand Up @@ -34,7 +34,7 @@ public interface PrismContainerWrapper<C extends Containerable> extends ItemWrap
<T extends Containerable> PrismContainerValueWrapper<T> findContainerValue(ItemPath path) throws SchemaException;
<IW extends ItemWrapper> IW findItem(ItemPath path, Class<IW> type) throws SchemaException;

PrismContainerWrapper<Containerable> getSelectedChild();
PrismContainerWrapper<? extends Containerable> getSelectedChild();
}


Expand Up @@ -1395,6 +1395,9 @@ public static String getItemDefinitionDisplayNameOrName(ItemDefinition def, Comp
return nameModel.getString();
}
}
if (def instanceof RefinedAttributeDefinition && StringUtils.isNotEmpty(def.getDisplayName())) {
return def.getDisplayName();
}
return def.getItemName().getLocalPart();
}

Expand Down Expand Up @@ -3492,7 +3495,7 @@ public static <O extends ObjectType> DisplayType getDisplayTypeForObject(O obj,
//TODO unify createAccountIcon with createCompositeIconForObject
public static <O extends ObjectType> CompositedIcon createCompositeIconForObject(O obj, OperationResult result, PageBase pageBase) {
if (obj instanceof ShadowType) {
return createAccountIcon((ShadowType) obj, pageBase);
return createAccountIcon((ShadowType) obj, pageBase, true);
}

DisplayType basicIconDisplayType = getDisplayTypeForObject(obj, result, pageBase);
Expand Down Expand Up @@ -3522,22 +3525,31 @@ public static <O extends ObjectType> CompositedIcon createCompositeIconForObject
return builder.build();
}

public static CompositedIcon createAccountIcon(ShadowType shadow, PageBase pageBase) {
public static CompositedIcon createAccountIcon(ShadowType shadow, PageBase pageBase, boolean isColumn) {
List<TriggerType> triggerType = shadow.getTrigger();
String iconCssClass = WebComponentUtil.createShadowIcon(shadow.asPrismObject());
CompositedIconBuilder builder = new CompositedIconBuilder();
String title = createTriggerTooltip(triggerType, pageBase);
if (StringUtils.isNotBlank(title)) {
IconType icon = new IconType();
icon.setCssClass("fa fa-clock-o " + GuiStyleConstants.BLUE_COLOR);
builder.appendLayerIcon(icon, IconCssStyle.TOP_RIGHT_FOR_COLUMN_STYLE);
if (isColumn) {
builder.appendLayerIcon(icon, IconCssStyle.TOP_RIGHT_FOR_COLUMN_STYLE);
} else {
builder.appendLayerIcon(icon, IconCssStyle.TOP_RIGHT_STYLE);
}

}
builder.setBasicIcon(iconCssClass, IconCssStyle.BOTTOM_RIGHT_FOR_COLUMN_STYLE);

if (BooleanUtils.isTrue(shadow.isDead())) {
IconType icon = new IconType();
icon.setCssClass("fa fa-times-circle " + GuiStyleConstants.RED_COLOR);
builder.appendLayerIcon(icon, IconCssStyle.BOTTOM_RIGHT_FOR_COLUMN_STYLE);
if (isColumn) {
builder.setBasicIcon(icon, IconCssStyle.BOTTOM_RIGHT_FOR_COLUMN_STYLE);
} else {
builder.setBasicIcon(icon, IconCssStyle.BOTTOM_RIGHT_STYLE);
}
builder.setTitle(pageBase.createStringResource("FocusProjectionsTabPanel.deadShadow").getString()
+ (StringUtils.isNotBlank(title) ? ("\n" + title) : ""));
return builder.build();
Expand All @@ -3556,7 +3568,11 @@ public static CompositedIcon createAccountIcon(ShadowType shadow, PageBase pageB
|| (lockoutExpirationTimestamp != null && pageBase.getClock().isPast((lockoutExpirationTimestamp)))) {
IconType icon = new IconType();
icon.setCssClass("fa fa-lock " + GuiStyleConstants.RED_COLOR);
builder.appendLayerIcon(icon, IconCssStyle.BOTTOM_RIGHT_FOR_COLUMN_STYLE);
if (isColumn) {
builder.setBasicIcon(icon, IconCssStyle.BOTTOM_RIGHT_FOR_COLUMN_STYLE);
} else {
builder.setBasicIcon(icon, IconCssStyle.BOTTOM_RIGHT_STYLE);
}
builder.setTitle(pageBase.createStringResource("LockoutStatusType.LOCKED").getString()
+ (StringUtils.isNotBlank(title) ? ("\n" + title) : ""));
return builder.build();
Expand All @@ -3572,10 +3588,18 @@ public static CompositedIcon createAccountIcon(ShadowType shadow, PageBase pageB

switch (value) {
case DISABLED:
appendIcon(builder, "fe fe-slash " + GuiStyleConstants.RED_COLOR, IconCssStyle.CENTER_FOR_COLUMN_STYLE);
if (isColumn) {
appendIcon(builder, "fe fe-slash " + GuiStyleConstants.RED_COLOR, IconCssStyle.CENTER_FOR_COLUMN_STYLE);
} else {
appendIcon(builder, "fe fe-slash " + GuiStyleConstants.RED_COLOR, IconCssStyle.CENTER_STYLE);
}
return builder.build();
case ARCHIVED:
appendIcon(builder, "fa fa-archive " + GuiStyleConstants.RED_COLOR, IconCssStyle.BOTTOM_RIGHT_FOR_COLUMN_STYLE);
if (isColumn) {
appendIcon(builder, "fa fa-archive " + GuiStyleConstants.RED_COLOR, IconCssStyle.BOTTOM_RIGHT_FOR_COLUMN_STYLE);
} else {
appendIcon(builder, "fa fa-archive " + GuiStyleConstants.RED_COLOR, IconCssStyle.BOTTOM_RIGHT_STYLE);
}
return builder.build();
}

Expand Down
Expand Up @@ -47,13 +47,13 @@ protected void onInitialize() {

private void initLayout() {

addBasicContainerValuePanel(ID_BASIC_PANEL);
add(getSpecificContainers(ID_SPECIFIC_CONTAINERS_PANEL));

DisplayNamePanel<C> displayNamePanel = createDisplayNamePanel(ID_DISPLAY_NAME);

displayNamePanel.setOutputMarkupId(true);
add(displayNamePanel);

addBasicContainerValuePanel(ID_BASIC_PANEL);
add(getSpecificContainers(ID_SPECIFIC_CONTAINERS_PANEL));
}

protected WebMarkupContainer getSpecificContainers(String contentAreaId) {
Expand Down
Expand Up @@ -12,7 +12,7 @@
<div class="container-fluid prism-container">
<div class="info-box info-box-ethereal">
<div class="info-box-icon info-box-icon-ethereal">
<i class="info-box-icon-ethereal-image" wicket:id="typeImage"></i>
<i wicket:id="typeImage"></i>
</div>
<div class="info-box-content">
<span class="info-box-number">
Expand Down
Expand Up @@ -9,6 +9,8 @@
import java.util.ArrayList;
import java.util.List;

import com.evolveum.midpoint.gui.impl.component.data.column.CompositedIconPanel;

import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.model.IModel;

Expand Down Expand Up @@ -72,10 +74,10 @@ protected IModel<List<String>> getDescriptionLabelsModel() {
}

@Override
protected String createImageModel() {
protected WebMarkupContainer createTypeImagePanel(String idTypeImage) {
if (getModelObject() == null) {
return "";
return super.createTypeImagePanel(idTypeImage);
}
return WebComponentUtil.createShadowIcon(getModelObject().asPrismObject());
return new CompositedIconPanel(idTypeImage, WebComponentUtil.createAccountIcon(getModelObject(), getPageBase(), false));
}
}
Expand Up @@ -9,6 +9,10 @@
import javax.annotation.PostConstruct;
import javax.xml.datatype.XMLGregorianCalendar;

import com.evolveum.midpoint.xml.ns._public.common.common_3.ScheduleType;

import com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType;

import org.apache.wicket.extensions.yui.calendar.DateTimeField;
import org.apache.wicket.markup.html.form.Form;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -47,13 +51,21 @@ protected InputPanel getPanel(PrismPropertyPanelContext<XMLGregorianCalendar> pa
DatePanel panel = new DatePanel(panelCtx.getComponentId(), panelCtx.getRealValueModel());

Form<?> form = Form.findForm(panelCtx.getForm());
DateValidator validator = WebComponentUtil.getRangeValidator(form, SchemaConstants.PATH_ACTIVATION);
if (ActivationType.F_VALID_FROM.equals(panelCtx.getDefinitionName())) {
DateValidator validator;
String validatorErrorMessageKey;
if (ScheduleType.F_EARLIEST_START_TIME.equals(panelCtx.getDefinitionName()) || ScheduleType.F_LATEST_START_TIME.equals(panelCtx.getDefinitionName())) {
validator = WebComponentUtil.getRangeValidator(form, TaskType.F_SCHEDULE);
validatorErrorMessageKey = "ScheduleType.dateValidator.errorMessage";
} else {
validator = WebComponentUtil.getRangeValidator(form, SchemaConstants.PATH_ACTIVATION);
validatorErrorMessageKey = "DateValidator.message.fromAfterTo";
}
if (ActivationType.F_VALID_FROM.equals(panelCtx.getDefinitionName()) || ScheduleType.F_EARLIEST_START_TIME.equals(panelCtx.getDefinitionName())) {
validator.setDateFrom((DateTimeField) panel.getBaseFormComponent());
} else if (ActivationType.F_VALID_TO.equals(panelCtx.getDefinitionName())) {
} else if (ActivationType.F_VALID_TO.equals(panelCtx.getDefinitionName()) || ScheduleType.F_LATEST_START_TIME.equals(panelCtx.getDefinitionName())) {
validator.setDateTo((DateTimeField) panel.getBaseFormComponent());
}

validator.setMessageKey(validatorErrorMessageKey);
return panel;
}
}
Expand Up @@ -22,7 +22,7 @@ public SystemConfigurationSummaryPanel(String id, Class type, IModel<SystemConfi
}

@Override
protected String getIconCssClass() {
protected String getDefaultIconCssClass() {
return GuiStyleConstants.CLASS_SYSTEM_CONFIGURATION_ICON;
}

Expand Down
Expand Up @@ -11,10 +11,8 @@

<div class="prism-properties">
<div wicket:id="propertiesLabel">
<div wicket:id="properties">
<wicket:enclosure child="property">
<div class="row prism-property" wicket:id="property"/>
</wicket:enclosure>
<div class="property-stripe" wicket:id="properties">
<div class="row prism-property" wicket:id="property"/>
</div>

<div class="row">
Expand Down
Expand Up @@ -13,7 +13,6 @@
import javax.xml.namespace.QName;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.WebMarkupContainer;
Expand Down Expand Up @@ -53,13 +52,9 @@ protected void onInitialize() {
}

private void initLayout() {
// WebMarkupContainer defaultPanel = new WebMarkupContainer(id);
// defaultPanel.add(createNonContainersPanel());
createNonContainersPanel();
createContainersPanel();
setOutputMarkupId(true);
// defaultPanel.add(createContainersPanel());
// return defaultPanel;
}

private void createNonContainersPanel() {
Expand Down Expand Up @@ -148,23 +143,7 @@ protected void populateItem(final ListItem<PrismContainerWrapper<?>> item) {
ItemWrapperComparator<?> comparator = new ItemWrapperComparator<>(collator, getModelObject().isSorted());
if (CollectionUtils.isNotEmpty(nonContainers)) {
nonContainers.sort((Comparator) comparator);

int visibleProperties = 0;

for (ItemWrapper<?,?> item : nonContainers) {
if (item.isVisible(getModelObject(), getVisibilityHandler())) {
visibleProperties++;
}

if (visibleProperties % 2 == 0) {
item.setStripe(false);
} else {
item.setStripe(true);
}

}
}

return nonContainers;
}

Expand All @@ -180,7 +159,6 @@ private void populateNonContainer(ListItem<? extends ItemWrapper<?, ?>> item) {
ItemPanelSettings settings = getSettings() != null ? getSettings().copy() : null;
Panel panel = getPageBase().initItemPanel("property", typeName, item.getModel(), settings);
panel.setOutputMarkupId(true);
panel.add(AttributeModifier.append("class", appendStyleClassModel(item.getModel())));
item.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
Expand Down Expand Up @@ -209,7 +187,7 @@ private void populateContainer(ListItem<PrismContainerWrapper<?>> container) {
ItemPanelSettings settings = getSettings() != null ? getSettings().copy() : null;
Panel panel = getPageBase().initItemPanel("container", itemWrapper.getTypeName(), container.getModel(), settings);
panel.setOutputMarkupId(true);
panel.add(new VisibleEnableBehaviour() {
container.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return itemWrapper.isVisible(getModelObject(), getVisibilityHandler());
Expand Down Expand Up @@ -237,20 +215,7 @@ private void onShowEmptyClick(AjaxRequestTarget target) {
CVW wrapper = getModelObject();
wrapper.setShowEmpty(!wrapper.isShowEmpty());
target.add(DefaultContainerablePanel.this);
// target.add(getPageBase().getFeedbackPanel());
// target.add(findParent(PrismContainerValuePanel.class));
}

private <IW extends ItemWrapper<?,?>> IModel<String> appendStyleClassModel(final IModel<IW> wrapper) {
return new IModel<String>() {
private static final long serialVersionUID = 1L;

@Override
public String getObject() {
ItemWrapper<?, ?> property = wrapper.getObject();
return property.isStripe() ? "stripe" : null;
}
};
}

private ItemPanelSettings getSettings() {
Expand Down

0 comments on commit c90486d

Please sign in to comment.