Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/Evolveum/midpoint
- Loading branch information
Showing
43 changed files
with
1,520 additions
and
742 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/FocusSummaryPanel.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,32 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!-- | ||
~ Copyright (c) 2010-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"> | ||
<div class="info-box"> | ||
<div wicket:id="summaryIconBox" class="info-box-icon"> | ||
<span wicket:id="summaryIcon"/> | ||
<img wicket:id="summaryPhoto" class="user-thumbnail"/> | ||
</div> | ||
<div class="info-box-content"> | ||
<span class="info-box-number"> | ||
<span wicket:id="summaryDisplayName"/> (<span wicket:id="summaryIdentifier"/>) | ||
</span> | ||
<span class="info-box-text"> | ||
<span wicket:id="summaryTitle"/> | ||
</span> | ||
</div> | ||
</div> | ||
</wicket:panel> |
117 changes: 117 additions & 0 deletions
117
gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/FocusSummaryPanel.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,117 @@ | ||
/** | ||
* 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; | ||
|
||
import javax.xml.namespace.QName; | ||
|
||
import org.apache.wicket.AttributeModifier; | ||
import org.apache.wicket.markup.html.WebMarkupContainer; | ||
import org.apache.wicket.markup.html.basic.Label; | ||
import org.apache.wicket.markup.html.image.Image; | ||
import org.apache.wicket.markup.html.panel.Panel; | ||
import org.apache.wicket.model.AbstractReadOnlyModel; | ||
import org.apache.wicket.model.IModel; | ||
import org.apache.wicket.request.resource.AbstractResource; | ||
import org.apache.wicket.request.resource.ByteArrayResource; | ||
|
||
import com.evolveum.midpoint.prism.PrismObject; | ||
import com.evolveum.midpoint.web.component.prism.ObjectWrapper; | ||
import com.evolveum.midpoint.web.component.util.PrismPropertyWrapperModel; | ||
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType; | ||
|
||
/** | ||
* @author semancik | ||
* | ||
*/ | ||
public abstract class FocusSummaryPanel<F extends FocusType> extends Panel { | ||
private static final long serialVersionUID = -3755521482914447912L; | ||
|
||
private static final String ID_ICON_BOX = "summaryIconBox"; | ||
private static final String ID_PHOTO = "summaryPhoto"; | ||
private static final String ID_ICON = "summaryIcon"; | ||
private static final String ID_DISPLAY_NAME = "summaryDisplayName"; | ||
private static final String ID_IDENTIFIER = "summaryIdentifier"; | ||
private static final String ID_TITLE = "summaryTitle"; | ||
|
||
private static final String ICON_BOX_CSS_CLASS = "info-box-icon"; | ||
|
||
public FocusSummaryPanel(String id, final IModel<ObjectWrapper<F>> model) { | ||
super(id, model); | ||
|
||
add(new Label(ID_DISPLAY_NAME, new PrismPropertyWrapperModel<>(model, getDisplayNamePropertyName()))); | ||
add(new Label(ID_IDENTIFIER, new PrismPropertyWrapperModel<>(model, getIdentifierPropertyName()))); | ||
if (getTitlePropertyName() == null) { | ||
add(new Label(ID_TITLE, "")); | ||
} else { | ||
add(new Label(ID_TITLE, new PrismPropertyWrapperModel<>(model, getTitlePropertyName()))); | ||
} | ||
|
||
WebMarkupContainer iconBox = new WebMarkupContainer(ID_ICON_BOX); | ||
add(iconBox); | ||
|
||
if (getIconBoxColorCssClass() != null) { | ||
iconBox.add(new AttributeModifier("class", ICON_BOX_CSS_CLASS + " " + getIconBoxColorCssClass())); | ||
} | ||
|
||
Image img = new Image(ID_PHOTO, new AbstractReadOnlyModel<AbstractResource>() { | ||
|
||
@Override | ||
public AbstractResource getObject() { | ||
byte[] jpegPhoto = model.getObject().getObject().asObjectable().getJpegPhoto(); | ||
if(jpegPhoto == null) { | ||
return null; | ||
} else { | ||
return new ByteArrayResource("image/jpeg",jpegPhoto); | ||
} | ||
} | ||
}); | ||
img.add(new VisibleEnableBehaviour(){ | ||
@Override | ||
public boolean isVisible(){ | ||
return model.getObject().getObject().asObjectable().getJpegPhoto() != null; | ||
} | ||
}); | ||
iconBox.add(img); | ||
|
||
Label icon = new Label(ID_ICON,""); | ||
icon.add(new AttributeModifier("class", getIconCssClass())); | ||
icon.add(new VisibleEnableBehaviour(){ | ||
@Override | ||
public boolean isVisible(){ | ||
return model.getObject().getObject().asObjectable().getJpegPhoto() == null; | ||
} | ||
}); | ||
iconBox.add(icon); | ||
} | ||
|
||
protected abstract String getIconCssClass(); | ||
|
||
protected String getIconBoxColorCssClass() { | ||
return null; | ||
} | ||
|
||
protected QName getIdentifierPropertyName() { | ||
return FocusType.F_NAME; | ||
} | ||
|
||
protected abstract QName getDisplayNamePropertyName(); | ||
|
||
protected QName getTitlePropertyName() { | ||
return null; | ||
} | ||
|
||
} |
107 changes: 107 additions & 0 deletions
107
gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/menu/BaseMenuItem.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,107 @@ | ||
/* | ||
* Copyright (c) 2010-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.menu; | ||
|
||
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour; | ||
import org.apache.wicket.markup.html.WebPage; | ||
import org.apache.wicket.model.IModel; | ||
import org.apache.wicket.request.mapper.parameter.PageParameters; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* @author Viliam Repan (lazyman) | ||
*/ | ||
public class BaseMenuItem implements Serializable { | ||
|
||
private IModel<String> name; | ||
private Class<? extends WebPage> page; | ||
private PageParameters params; | ||
private VisibleEnableBehaviour visibleEnable; | ||
private Class<? extends WebPage>[] aliases; | ||
|
||
public BaseMenuItem(IModel<String> name, Class<? extends WebPage> page) { | ||
this(name, page, null, null); | ||
} | ||
|
||
public BaseMenuItem(IModel<String> name, Class<? extends WebPage> page, | ||
PageParameters params, VisibleEnableBehaviour visibleEnable, | ||
Class<? extends WebPage>... aliases) { | ||
this.aliases = aliases; | ||
this.name = name; | ||
this.page = page; | ||
this.params = params; | ||
this.visibleEnable = visibleEnable; | ||
} | ||
|
||
/** | ||
* @return Returns array of {@link WebPage} classes where this menu should be marked as <b>active</b>. | ||
*/ | ||
public Class<? extends WebPage>[] getAliases() { | ||
return aliases; | ||
} | ||
|
||
public IModel<String> getName() { | ||
return name; | ||
} | ||
|
||
public Class<? extends WebPage> getPage() { | ||
return page; | ||
} | ||
|
||
public PageParameters getParams() { | ||
return params; | ||
} | ||
|
||
public VisibleEnableBehaviour getVisibleEnable() { | ||
return visibleEnable; | ||
} | ||
|
||
public boolean isMenuActive(WebPage page) { | ||
if (page == null) { | ||
return false; | ||
} | ||
|
||
Class pageClass = page.getClass(); | ||
|
||
if (this.page == null) { | ||
return false; | ||
} | ||
|
||
boolean isMenuActive = isMenuActive(); | ||
|
||
if (pageClass.equals(this.page)) { | ||
return isMenuActive; | ||
} | ||
|
||
if (aliases == null) { | ||
return false; | ||
} | ||
|
||
for (Class c : aliases) { | ||
if (pageClass.equals(c)) { | ||
return isMenuActive; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
|
||
protected boolean isMenuActive() { | ||
return true; | ||
} | ||
} |
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
Oops, something went wrong.