Skip to content

Commit

Permalink
displayname panel + some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed Aug 17, 2017
1 parent e05a5e0 commit f2e5f51
Show file tree
Hide file tree
Showing 25 changed files with 704 additions and 648 deletions.
Expand Up @@ -149,6 +149,7 @@ public class GuiStyleConstants {
public static final String CLASS_CIRCLE_FULL = "fa fa-circle";

public static final String CLASS_FILE_TEXT = "fa fa-file-text-o";
public static final String CLASS_POLICY_RULES = "fa fa-balance-scale";
public static final String CLASS_POLICY_RULES_ICON = "fa fa-balance-scale";
public static final String CLASS_POLICY_RULES_ICON_COLORED = "fa fa-balance-scale"; //TODO

}
@@ -0,0 +1,31 @@
<!--
~ Copyright (c) 2010-2017 Evolveum
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:wicket="http://wicket.apache.org">
<body>
<wicket:panel>
<div class="row">
<div class="container-fluid prism-container">
<div class="box-header ">
<i wicket:id="typeImage"></i>
<div class="box-title" wicket:id="assignmentName" />
</div>
<div wicket:id="description" />
</div>
</div>
</wicket:panel>
</body>
</html>
@@ -0,0 +1,74 @@
package com.evolveum.midpoint.gui.api.component;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;

import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.prism.Containerable;
import com.evolveum.midpoint.prism.PrismProperty;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AbstractRoleType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;

public class DisplayNamePanel<C extends Containerable> extends BasePanel<C>{

private static final long serialVersionUID = 1L;

private final static String ID_DESCRIPTION = "description";
private final static String ID_TYPE_IMAGE = "typeImage";
private final static String ID_ASSIGNMENT_NAME = "assignmentName";

public DisplayNamePanel(String id, IModel<C> model) {
super(id, model);

initLayout();
}

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

Label name = new Label(ID_ASSIGNMENT_NAME, createHeaderModel());
name.add(AttributeModifier.append("class", getAdditionalNameLabelStyleClass()));
name.setOutputMarkupId(true);
add(name);

add(new Label(ID_DESCRIPTION, new PropertyModel<String>(getModel(), ObjectType.F_DESCRIPTION.getLocalPart())));


}

private String createImageModel() {
if (ObjectType.class.isAssignableFrom(getModelObject().getClass())) {
return WebComponentUtil.createDefaultIcon((ObjectType) getModelObject());
}

return WebComponentUtil.createDefaultColoredIcon(getModelObject().asPrismContainerValue().getContainer().getComplexTypeDefinition().getTypeName());

}

private IModel<String> getAdditionalNameLabelStyleClass() {
return Model.of("text-bold");
}

private IModel<String> createHeaderModel() {
if (ObjectType.class.isAssignableFrom(getModelObject().getClass())) {
return Model.of(WebComponentUtil.getEffectiveName((ObjectType) getModelObject(), AbstractRoleType.F_DISPLAY_NAME));
}
PrismProperty<String> name = getModelObject().asPrismContainerValue().getContainer().findProperty(ObjectType.F_NAME);
if (name == null || name.isEmpty()) {
return Model.of("");
}
return Model.of(name.getRealValue());
}




}

This file was deleted.

This file was deleted.

Expand Up @@ -36,6 +36,10 @@
<wicket:message key="roleMemberPanel.type"/>
</label>
<select class="form-control input-sm" wicket:id="type"/>
<label class="col-md-2">
<wicket:message key="AssignmentEditorPanel.relation"/>
</label>
<div class="col-md-2" wicket:id="relation" />
</div>
</div>
<div wicket:id="countContainer">
Expand Down

0 comments on commit f2e5f51

Please sign in to comment.