Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrated page task to ObjectSummaryPanel.
- Loading branch information
Showing
7 changed files
with
191 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/util/SummaryTagSimple.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!-- | ||
~ Copyright (c) 2015 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. | ||
--> | ||
<wicket:panel xmlns:wicket="http://wicket.apache.org"> | ||
<span class="summary-tag"><span class="summary-tag-icon"><span wicket:id="summaryTagIcon"/></span> <span wicket:id="summaryTagLabel"/><wicket:child /></span> | ||
</wicket:panel> |
137 changes: 137 additions & 0 deletions
137
gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/util/SummaryTagSimple.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
/* | ||
* Copyright (c) 2010-2016 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. | ||
*/ | ||
package com.evolveum.midpoint.web.component.util; | ||
|
||
import com.evolveum.midpoint.prism.PrismObject; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; | ||
import org.apache.wicket.AttributeModifier; | ||
import org.apache.wicket.markup.html.basic.Label; | ||
import org.apache.wicket.markup.html.panel.Panel; | ||
import org.apache.wicket.model.AbstractReadOnlyModel; | ||
import org.apache.wicket.model.IModel; | ||
|
||
/** | ||
* The same as SummaryTag, but based on PrismObject model, not ObjectWrapper one. | ||
* TODO fix somehow | ||
* | ||
* @author semancik | ||
* @author mederly | ||
*/ | ||
public abstract class SummaryTagSimple<O extends ObjectType> extends Panel { | ||
|
||
private static final String ID_TAG_ICON = "summaryTagIcon"; | ||
private static final String ID_TAG_LABEL = "summaryTagLabel"; | ||
|
||
private boolean initialized = false; | ||
private String iconCssClass; | ||
private String label; | ||
private String color = null; | ||
private boolean hideTag = false; | ||
|
||
public SummaryTagSimple(String id, final IModel<PrismObject<O>> model) { | ||
super(id, model); | ||
|
||
Label tagIcon = new Label(ID_TAG_ICON, ""); | ||
tagIcon.add(new AttributeModifier("class", new SummaryTagModel<String>(model) { | ||
@Override | ||
protected String getValue() { | ||
return getIconCssClass(); | ||
} | ||
})); | ||
add(tagIcon); | ||
|
||
add(new Label(ID_TAG_LABEL, new SummaryTagModel<String>(model) { | ||
@Override | ||
protected String getValue() { | ||
return getLabel(); | ||
} | ||
})); | ||
|
||
add(new AttributeModifier("style", new SummaryTagModel<String>(model) { | ||
@Override | ||
protected String getValue() { | ||
if (getColor() == null) { | ||
return null; | ||
} | ||
return "color: " + getColor(); | ||
} | ||
})); | ||
|
||
add(new VisibleEnableBehaviour(){ | ||
@Override | ||
public boolean isVisible(){ | ||
if (!initialized) { | ||
initialize(model.getObject()); | ||
} | ||
return !isHideTag(); | ||
} | ||
}); | ||
} | ||
|
||
public String getIconCssClass() { | ||
return iconCssClass; | ||
} | ||
|
||
public void setIconCssClass(String iconCssClass) { | ||
this.iconCssClass = iconCssClass; | ||
} | ||
|
||
public String getLabel() { | ||
return label; | ||
} | ||
|
||
public void setLabel(String label) { | ||
this.label = label; | ||
} | ||
|
||
public String getColor() { | ||
return color; | ||
} | ||
|
||
public void setColor(String color) { | ||
this.color = color; | ||
} | ||
|
||
public boolean isHideTag() { | ||
return hideTag; | ||
} | ||
|
||
public void setHideTag(boolean hideTag) { | ||
this.hideTag = hideTag; | ||
} | ||
|
||
protected abstract void initialize(PrismObject<O> object); | ||
|
||
abstract class SummaryTagModel<T> extends AbstractReadOnlyModel<T> { | ||
|
||
IModel<PrismObject<O>> objectModel; | ||
|
||
public SummaryTagModel(IModel<PrismObject<O>> objectModel) { | ||
this.objectModel = objectModel; | ||
} | ||
|
||
@Override | ||
public T getObject() { | ||
if (!initialized) { | ||
initialize(objectModel.getObject()); | ||
} | ||
return getValue(); | ||
} | ||
|
||
protected abstract T getValue(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters