Skip to content

Commit

Permalink
using summaryTagSimple for resource summary panel
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Nov 6, 2018
1 parent 7394a45 commit 99f29bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Expand Up @@ -33,7 +33,7 @@
<span wicket:id="summaryOrganization" class="summary-panel-organization">
</span>
</span>
<span wicket:id="summaryTagBox" class="col-xs-12 col-sm-6 col-md-4 col-lg-3 summary-tag-box" style="max-width: 170px;">
<span wicket:id="summaryTagBox" class="col-xs-12 col-sm-6 col-md-4 col-lg-3 summary-tag-box" style="max-width: 200px;">
<wicket:child />
</span>
</span>
Expand Down
Expand Up @@ -28,10 +28,13 @@
import com.evolveum.midpoint.web.component.prism.ObjectWrapper;
import com.evolveum.midpoint.web.component.util.ObjectWrapperUtil;
import com.evolveum.midpoint.web.component.util.SummaryTag;
import com.evolveum.midpoint.web.component.util.SummaryTagSimple;
import com.evolveum.midpoint.web.model.ContainerableFromPrismObjectModel;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType;

public class ResourceSummaryPanel extends ObjectSummaryPanel<ResourceType> {
private static final long serialVersionUID = 1L;
Expand All @@ -49,20 +52,18 @@ public ResourceSummaryPanel(String id, IModel<PrismObject<ResourceType>> model,
protected void onBeforeRender() {
super.onBeforeRender();
boolean down = ResourceTypeUtil.isDown(model.getObject().asObjectable());
ObjectWrapper<ResourceType> objectWrapper = ObjectWrapperUtil.createObjectWrapper("resourceType", "", model.getObject(), ContainerStatus.MODIFYING,
getPageBase().createSimpleTask("createResourceObjectWrapper"), getPageBase());
SummaryTag<ResourceType> summaryTag = new SummaryTag<ResourceType>(ID_UP_DOWN_TAG, new Model(objectWrapper)) {
IModel<ResourceType> containerModel = new ContainerableFromPrismObjectModel<>(model);
SummaryTagSimple<ResourceType> summaryTag = new SummaryTagSimple<ResourceType>(ID_UP_DOWN_TAG, containerModel) {
private static final long serialVersionUID = 1L;

@Override
protected void initialize(ObjectWrapper<ResourceType> wrapper) {
protected void initialize(ResourceType object) {
if (!down) {
setIconCssClass(GuiStyleConstants.CLASS_ICON_ACTIVATION_ACTIVE);
setLabel(getString("ResourceSummaryPanel.UP"));
} else {
setIconCssClass(GuiStyleConstants.CLASS_ICON_ACTIVATION_INACTIVE);
setLabel(getString("ResourceSummaryPanel.DOWN"));
setCssClass(GuiStyleConstants.CLASS_ICON_STYLE_DISABLED);
}
}
};
Expand Down

0 comments on commit 99f29bd

Please sign in to comment.