Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrGasparik committed Aug 27, 2018
2 parents 7ddbd9e + 77a7c93 commit 6e15150
Show file tree
Hide file tree
Showing 147 changed files with 3,926 additions and 3,920 deletions.
Expand Up @@ -120,6 +120,8 @@ public class GuiStyleConstants {
public static final String CLASS_ICON_ASSIGNMENTS = "fa fa-bank";
public static final String CLASS_SHADOW_ICON_REQUEST = "fa fa-pencil-square-o";
public static final String CLASS_ICON_TACHOMETER = "fa fa-tachometer";
public static final String CLASS_ICON_COLLAPSE_CONTAINER = "fa fa-caret-down fa-lg";
public static final String CLASS_ICON_EXPAND_CONTAINER = "fa fa-caret-right fa-lg";

public static final String CLASS_OP_RESULT_STATUS_ICON_UNKNOWN_COLORED = "fa fa-question-circle text-warning";
public static final String CLASS_OP_RESULT_STATUS_ICON_SUCCESS_COLORED = "fa fa-check-circle text-success";
Expand Down Expand Up @@ -163,4 +165,9 @@ public class GuiStyleConstants {

public static final String CLASS_SYSTEM_CONFIGURATION_ICON = "fa fa-cog";
public static final String CLASS_SYSTEM_CONFIGURATION_ICON_COLORED = CLASS_SYSTEM_CONFIGURATION_ICON + " object-shadow-color";

public static final String CLASS_ASSIGN = "fa fa-link";
public static final String CLASS_UNASSIGN = "fa fa-unlink";
public static final String CLASS_RECONCILE = "fa fa-refresh";
public static final String CLASS_CREATE_FOCUS = "fa fa-user-plus";
}
Expand Up @@ -15,6 +15,7 @@
*/
package com.evolveum.midpoint.gui.api.component;

import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.model.api.ModelInteractionService;
import com.evolveum.midpoint.model.api.RoleSelectionSpecification;
import com.evolveum.midpoint.prism.query.ObjectFilter;
Expand Down Expand Up @@ -62,7 +63,11 @@ protected void initParametersPanel(Fragment parametersPanel){
relationContainer.setOutputMarkupId(true);
parametersPanel.add(relationContainer);

relationContainer.add(new RelationDropDownChoicePanel(ID_RELATION, null, AreaCategoryType.ADMINISTRATION));
relationContainer.add(new RelationDropDownChoicePanel(ID_RELATION, null, getSupportedRelations(), false));
}

private List<QName> getSupportedRelations() {
return WebComponentUtil.getCategoryRelationChoices(AreaCategoryType.ADMINISTRATION, getPageBase());
}

@Override
Expand Down
Expand Up @@ -243,11 +243,6 @@ public boolean isVisible(){

}
}

protected PrismObject<O> getNewObjectListObject(){
return null;
}

private void adoptNewObject(PrismObject<O> object) throws SchemaException{
getPageBase().getMidpointApplication().getPrismContext().adopt(object);
}
Expand Down
Expand Up @@ -29,11 +29,6 @@
</div>
<div wicket:id="relationContainer" class="row">
<div class="form-group col-md-12">
<div class="col-md-1">
<div>
<wicket:message key="AssignmentEditorPanel.relation"/>
</div>
</div>
<div class="col-md-3">
<span wicket:id="relation"/>
</div>
Expand Down
Expand Up @@ -85,16 +85,7 @@ public boolean isEnabled(){
});
parametersPanel.add(relationContainer);

relationContainer.add(new RelationDropDownChoicePanel(ID_RELATION, null, AreaCategoryType.ADMINISTRATION){
private static final long serialVersionUID = 1L;

@Override
protected List<QName> getChoicesList(){
return supportedRelationList;
}


});
relationContainer.add(new RelationDropDownChoicePanel(ID_RELATION, null, supportedRelationList, false));
}

protected ObjectDelta prepareDelta(){
Expand Down
Expand Up @@ -27,7 +27,7 @@
import com.evolveum.midpoint.util.logging.LoggingUtils;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.page.admin.users.component.AbstractRoleMemberPanel;
import com.evolveum.midpoint.web.page.admin.roles.AbstractRoleMemberPanel;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import org.apache.wicket.ajax.AjaxRequestTarget;
Expand Down
Expand Up @@ -5,12 +5,19 @@
import javax.xml.namespace.QName;

import com.evolveum.midpoint.prism.ItemDefinition;
import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.prism.PrismObjectDefinition;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.prism.path.ItemPathSegment;
import com.evolveum.midpoint.prism.path.NameItemPathSegment;
import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import com.evolveum.prism.xml.ns._public.types_3.ItemPathType;

public class ItemPathDto implements Serializable{
private static final long serialVersionUID = 1L;

private QName objectType;
private QName objectType = FocusType.COMPLEX_TYPE;

private ItemPathDto parentPath;

Expand All @@ -22,10 +29,16 @@ public ItemPathDto() {
// TODO Auto-generated constructor stub
}

public ItemPathDto(ItemPathType itemPathType) {
if (itemPathType == null) {
return;
}
this.path = itemPathType.getItemPath();
}

public ItemPathDto(ItemPathDto parentPath) {
this.parentPath = parentPath;
this.path = parentPath.toItemPath();
// this.parent = parentPath.toItemPath();
}


Expand Down Expand Up @@ -73,6 +86,10 @@ public ItemPath toItemPath() {
return path;

}

public boolean isPathDefined() {
return (path != null && itemDef == null && parentPath == null);
}



Expand Down
Expand Up @@ -17,9 +17,18 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div wicket:id="namespace"/>
<div wicket:id="definition"/>
<a class="btn" wicket:id="plus"><label>+</label></a>
<a class="btn" wicket:id="minus"><label>-</label></a>
<div wicket:id="itemPath">
<div wicket:id="namespace"/>
<div wicket:id="definition"/>
<button wicket:id="plus" class="btn btn-box-tool" trigger="hover"><i class="fa fa-plus-circle"></i></button>
<button wicket:id="minus" class="btn btn-box-tool" trigger="hover"><i class="fa fa-minus-circle"></i></button>
</div>

<div wicket:id="itemPathContainer">
<div>
<span wicket:id="itemPathLabel"></span>
<a wicket:id="change" class="btn btn-primary btn-xs"></a>
</div>
</div>
</wicket:panel>
</html>
Expand Up @@ -9,6 +9,7 @@

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
Expand All @@ -21,38 +22,75 @@
import com.evolveum.midpoint.prism.Definition;
import com.evolveum.midpoint.prism.ItemDefinition;
import com.evolveum.midpoint.prism.PrismContainerDefinition;
import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.prism.PrismObjectDefinition;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.web.component.AjaxButton;
import com.evolveum.midpoint.web.component.input.DropDownChoicePanel;
import com.evolveum.midpoint.web.component.input.QNameChoiceRenderer;
import com.evolveum.midpoint.web.component.input.TextPanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import com.evolveum.prism.xml.ns._public.types_3.ItemPathType;

public class ItemPathPanel extends BasePanel<ItemPathDto> {

private static final long serialVersionUID = 1L;

private static final String ID_ITEM_PATH = "itemPath";
private static final String ID_NAMESPACE = "namespace";
private static final String ID_DEFINITION = "definition";

private static final String ID_ITEM_PATH_CONTAINER = "itemPathContainer";
private static final String ID_ITEM_PATH_LABEL = "itemPathLabel";
private static final String ID_CHANGE = "change";

private static final String ID_PLUS = "plus";
private static final String ID_MINUS = "minus";

public ItemPathPanel(String id, IModel<ItemPathDto> model, PageBase parent) {
public ItemPathPanel(String id, IModel<ItemPathDto> model) {
super(id, model);

setParent(parent);


}

@Override
protected void onInitialize() {
super.onInitialize();
initLayout();

}

public ItemPathPanel(String id, ItemPathDto model, PageBase parent) {
this(id, Model.of(model), parent);
public ItemPathPanel(String id, ItemPathDto model) {
this(id, Model.of(model));

}

public ItemPathPanel(String id, ItemPathType itemPath) {
this(id, Model.of(new ItemPathDto(itemPath)));

}

private void initLayout() {
initItemPathPanel();

initItemPathLabel();

setOutputMarkupId(true);
}

private void initItemPathPanel() {
WebMarkupContainer itemPathPanel = new WebMarkupContainer(ID_ITEM_PATH);
itemPathPanel.setOutputMarkupId(true);
add(itemPathPanel);
itemPathPanel.add(new VisibleEnableBehaviour() {

private static final long serialVersionUID = 1L;

@Override
public boolean isVisible() {
return !getModelObject().isPathDefined();
}

});

ItemPathSegmentPanel itemDefPanel = new ItemPathSegmentPanel(ID_DEFINITION,
new AbstractReadOnlyModel<ItemPathDto>() {

Expand All @@ -70,7 +108,7 @@ protected Map<QName, Collection<ItemDefinition<?>>> getSchemaDefinitionMap() {
}
};
itemDefPanel.setOutputMarkupId(true);
add(itemDefPanel);
itemPathPanel.add(itemDefPanel);

AjaxButton plusButton = new AjaxButton(ID_PLUS) {
private static final long serialVersionUID = 1L;
Expand All @@ -94,20 +132,14 @@ public boolean isVisible() {
}
});
plusButton.setOutputMarkupId(true);
add(plusButton);
itemPathPanel.add(plusButton);

AjaxButton minusButton = new AjaxButton(ID_MINUS) {
private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
ItemPathDto path = ItemPathPanel.this.getModelObject();
// ItemPathDto parent = null;
// if (path.getItemDef() == null){
// parent = path.getParentPath();
// } else {
// parent = path;
// }
refreshItemPathPanel(path, false, target);

}
Expand All @@ -121,7 +153,7 @@ public boolean isVisible() {
}
});
minusButton.setOutputMarkupId(true);
add(minusButton);
itemPathPanel.add(minusButton);

DropDownChoicePanel<QName> namespacePanel = new DropDownChoicePanel<>(ID_NAMESPACE,
new PropertyModel<>(getModel(), "objectType"),
Expand All @@ -147,11 +179,48 @@ public boolean isVisible() {
}
});
namespacePanel.setOutputMarkupId(true);
add(namespacePanel);
itemPathPanel.add(namespacePanel);
}

private void initItemPathLabel() {
WebMarkupContainer itemPathLabel = new WebMarkupContainer(ID_ITEM_PATH_CONTAINER);
itemPathLabel.setOutputMarkupId(true);
add(itemPathLabel);
itemPathLabel.add(new VisibleEnableBehaviour() {

private static final long serialVersionUID = 1L;

@Override
public boolean isVisible() {
return getModelObject().isPathDefined();
}

});

TextPanel<ItemPath> textPanel = new TextPanel<>(ID_ITEM_PATH_LABEL, new PropertyModel<>(getModel(), "path"));
textPanel.setEnabled(false);
textPanel.setOutputMarkupId(true);
itemPathLabel.add(textPanel);

AjaxButton change = new AjaxButton(ID_CHANGE, createStringResource("ItemPathPanel.button.reset")) {

private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
ItemPathDto newPath = new ItemPathDto();
ItemPathPanel.this.getModel().setObject(newPath);
target.add(ItemPathPanel.this);
onUpdate(newPath);
}
};

change.setOutputMarkupId(true);
itemPathLabel.add(change);
}

private void refreshItemPathPanel(ItemPathDto itemPathDto, boolean isAdd, AjaxRequestTarget target) {
ItemPathSegmentPanel pathSegmentPanel = (ItemPathSegmentPanel) get(ID_DEFINITION);
ItemPathSegmentPanel pathSegmentPanel = (ItemPathSegmentPanel) get(createComponentPath(ID_ITEM_PATH, ID_DEFINITION));
if (isAdd && !pathSegmentPanel.validate()) {
return;
}
Expand All @@ -172,9 +241,11 @@ private void refreshItemPathPanel(ItemPathDto itemPathDto, boolean isAdd, AjaxRe
itemPathDto = resultingItem;
}
// pathSegmentPanel.refreshModel(itemPathDto);

this.getModel().setObject(itemPathDto);

target.add(this);
onUpdate(itemPathDto);
// target.add(pathSegmentPanel);

}
Expand All @@ -183,6 +254,8 @@ private void refreshItemPath(ItemPathDto itemPathDto, AjaxRequestTarget target)

this.getModel().setObject(itemPathDto);
target.add(this);

onUpdate(itemPathDto);
}

private Map<QName, Collection<ItemDefinition<?>>> initNamspaceDefinitionMap() {
Expand All @@ -206,5 +279,10 @@ private Map<QName, Collection<ItemDefinition<?>>> initNamspaceDefinitionMap() {
}
return schemaDefinitionsMap;
}


protected void onUpdate(ItemPathDto itemPathDto) {

}

}
Expand Up @@ -7,6 +7,7 @@
import javax.xml.namespace.QName;

import org.apache.commons.lang.StringUtils;
import org.apache.wicket.Component;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
Expand Down Expand Up @@ -131,5 +132,11 @@ public boolean validate() {

// return autocompletePanel.getBaseFormComponent().getModelObject() != null;
}

public Component getBaseFormComponent() {
return get(ID_DEFINITION);
}



}

0 comments on commit 6e15150

Please sign in to comment.