Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More steps with summary panel. Summary tag componentized.
- Loading branch information
Showing
17 changed files
with
562 additions
and
109 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
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
68 changes: 68 additions & 0 deletions
68
...dmin-gui/src/main/java/com/evolveum/midpoint/web/component/util/AbstractWrapperModel.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,68 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package com.evolveum.midpoint.web.component.util; | ||
|
||
import com.evolveum.midpoint.prism.*; | ||
import com.evolveum.midpoint.prism.path.ItemPath; | ||
import com.evolveum.midpoint.prism.polystring.PolyString; | ||
import com.evolveum.midpoint.util.exception.SchemaException; | ||
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.component.prism.ObjectWrapper; | ||
import com.evolveum.midpoint.web.page.error.PageError; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; | ||
|
||
import org.apache.commons.lang.Validate; | ||
import org.apache.wicket.RestartResponseException; | ||
import org.apache.wicket.model.IModel; | ||
|
||
import javax.xml.namespace.QName; | ||
|
||
/** | ||
* @author semancik | ||
*/ | ||
public abstract class AbstractWrapperModel<O extends ObjectType> implements IModel { | ||
|
||
private IModel<ObjectWrapper<O>> wrapperModel; | ||
|
||
public AbstractWrapperModel(IModel<ObjectWrapper<O>> wrapperModel) { | ||
Validate.notNull(wrapperModel, "Wrapper model must not be null."); | ||
this.wrapperModel = wrapperModel; | ||
} | ||
|
||
public IModel<ObjectWrapper<O>> getWrapperModel() { | ||
return wrapperModel; | ||
} | ||
|
||
public ObjectWrapper<O> getWrapper() { | ||
return wrapperModel.getObject(); | ||
} | ||
|
||
public O getObjectType() { | ||
return wrapperModel.getObject().getObject().asObjectable(); | ||
} | ||
|
||
public PrismObject<O> getPrismObject() { | ||
return wrapperModel.getObject().getObject(); | ||
} | ||
|
||
@Override | ||
public void detach() { | ||
} | ||
|
||
} |
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
51 changes: 51 additions & 0 deletions
51
...dmin-gui/src/main/java/com/evolveum/midpoint/web/component/util/ReadOnlyWrapperModel.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,51 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package com.evolveum.midpoint.web.component.util; | ||
|
||
import com.evolveum.midpoint.prism.*; | ||
import com.evolveum.midpoint.prism.path.ItemPath; | ||
import com.evolveum.midpoint.prism.polystring.PolyString; | ||
import com.evolveum.midpoint.util.exception.SchemaException; | ||
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.component.prism.ObjectWrapper; | ||
import com.evolveum.midpoint.web.page.error.PageError; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; | ||
|
||
import org.apache.commons.lang.Validate; | ||
import org.apache.wicket.RestartResponseException; | ||
import org.apache.wicket.model.IModel; | ||
|
||
import javax.xml.namespace.QName; | ||
|
||
/** | ||
* @author semancik | ||
*/ | ||
public abstract class ReadOnlyWrapperModel<O extends ObjectType> extends AbstractWrapperModel<O> { | ||
|
||
public ReadOnlyWrapperModel(IModel<ObjectWrapper<O>> wrapperModel) { | ||
super(wrapperModel); | ||
} | ||
|
||
@Override | ||
public void setObject(Object object) { | ||
throw new UnsupportedOperationException("Model " + getClass() + | ||
" does not support setObject(Object)"); | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/util/SummaryTag.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> |
113 changes: 113 additions & 0 deletions
113
gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/util/SummaryTag.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,113 @@ | ||
/** | ||
* 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. | ||
*/ | ||
package com.evolveum.midpoint.web.component.util; | ||
|
||
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.IModel; | ||
|
||
import com.evolveum.midpoint.web.component.prism.ObjectWrapper; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; | ||
|
||
/** | ||
* @author semancik | ||
* | ||
*/ | ||
public abstract class SummaryTag<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; | ||
|
||
public SummaryTag(String id, final IModel<ObjectWrapper<O>> model) { | ||
super(id, model); | ||
|
||
Label tagIcon = new Label(ID_TAG_ICON, ""); | ||
tagIcon.add(new AttributeModifier("class", new SummaryTagWrapperModel(model) { | ||
@Override | ||
protected Object getValue() { | ||
return getIconCssClass(); | ||
} | ||
})); | ||
add(tagIcon); | ||
|
||
add(new Label(ID_TAG_LABEL, new SummaryTagWrapperModel(model) { | ||
@Override | ||
protected Object getValue() { | ||
return getLabel(); | ||
} | ||
})); | ||
|
||
add(new AttributeModifier("style", new SummaryTagWrapperModel(model) { | ||
@Override | ||
protected Object getValue() { | ||
if (getColor() == null) { | ||
return null; | ||
} | ||
return "color: " + getColor(); | ||
} | ||
})); | ||
} | ||
|
||
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; | ||
} | ||
|
||
protected abstract void initialize(ReadOnlyWrapperModel<O> model); | ||
|
||
abstract class SummaryTagWrapperModel extends ReadOnlyWrapperModel<O> { | ||
|
||
public SummaryTagWrapperModel(IModel<ObjectWrapper<O>> wrapperModel) { | ||
super(wrapperModel); | ||
} | ||
|
||
@Override | ||
public Object getObject() { | ||
if (!initialized) { | ||
initialize(this); | ||
} | ||
return getValue(); | ||
} | ||
|
||
protected abstract Object getValue(); | ||
|
||
} | ||
} |
Oops, something went wrong.