Skip to content

Commit

Permalink
Merge branch 'feature/gui-wrapper' of https://github.com/Evolveum/mid…
Browse files Browse the repository at this point in the history
…point into feature/gui-wrapper
  • Loading branch information
KaterynaHonchar committed May 31, 2019
2 parents a815340 + 208354c commit c342d02
Show file tree
Hide file tree
Showing 16 changed files with 460 additions and 32 deletions.
Expand Up @@ -208,5 +208,7 @@ public class GuiStyleConstants {
public static final String GREEN_COLOR = "color-green";
public static final String YELLOW_COLOR = "color-yellow";
public static final String RED_COLOR = "color-red";
public static final String BLUE_COLOR = "color-blue";


}
Expand Up @@ -105,6 +105,7 @@
import com.evolveum.midpoint.web.component.prism.ValueStatus;
import com.evolveum.midpoint.web.component.util.VisibleBehaviour;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.model.PrismContainerWrapperModel;
import com.evolveum.midpoint.web.page.admin.PageAdmin;
import com.evolveum.midpoint.web.page.admin.PageAdminFocus;
import com.evolveum.midpoint.web.page.admin.PageAdminObjectList;
Expand Down Expand Up @@ -2681,7 +2682,6 @@ private Class<?> getWrapperPanel(QName typeName) {

public <IW extends ItemWrapper> Panel initItemPanel(String panelId, QName typeName, IModel<IW> wrapperModel, ItemVisibilityHandler visibilityHandler) throws SchemaException{
Class<?> panelClass = getWrapperPanel(typeName);

if (panelClass == null) {
ErrorPanel errorPanel = new ErrorPanel(panelId, () -> "Cannot create panel for " + typeName);
errorPanel.add(new VisibleBehaviour(() -> getApplication().usesDevelopmentConfig()));
Expand Down
@@ -0,0 +1,61 @@
/*
* Copyright (c) 2010-2019 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.gui.impl.component.data.column;

import com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon;
import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.export.IExportableColumn;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

/**
* @author skublik
*/
public abstract class CompositedIconColumn<T> extends AbstractColumn<T, String> implements IExportableColumn<T, String> {
private static final long serialVersionUID = 1L;

public CompositedIconColumn(IModel<String> displayModel) {
super(displayModel);
}

@Override
public String getCssClass() {
IModel<String> display = getDisplayModel();
if (display != null && StringUtils.isNotEmpty(display.getObject())) {
return null;
}

return "composited-icon";
}

@Override
public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId, IModel<T> rowModel) {
cellItem.add(new CompositedIconPanel(componentId, getCompositedIcon(rowModel)));
}

protected abstract CompositedIcon getCompositedIcon(final IModel<T> rowModel);

@Override
public IModel<String> getDataModel(IModel<T> rowModel) {
return Model.of("");
}


}
@@ -0,0 +1,25 @@
<!--
~ Copyright (c) 2010-2013 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.
-->

<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div style="position: relative;" wicket:id="layeredIcon">
<i wicket:id="basicIcon"/>
<i wicket:id="layerIcons"/>
</div>
</wicket:panel>
</html>
@@ -0,0 +1,116 @@
/*
* Copyright (c) 2010-2013 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.gui.impl.component.data.column;

import com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon;
import com.evolveum.midpoint.xml.ns._public.common.common_3.IconType;

import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.WebComponent;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.model.IModel;

/**
* @author skublik
*/
public class CompositedIconPanel extends Panel {

private static final long serialVersionUID = 1L;

private static final String ID_LAYERED_ICON = "layeredIcon";
private static final String ID_BASIC_ICON = "basicIcon";
private static final String ID_LAYER_ICONS = "layerIcons";

private CompositedIcon compositedIcon;

public CompositedIconPanel(String id, CompositedIcon compositedIcon){
super(id);
this.compositedIcon = compositedIcon;
}

@Override
protected void onInitialize(){
super.onInitialize();
initLayout();
}

private void initLayout(){
WebMarkupContainer layeredIcon = new WebMarkupContainer(ID_LAYERED_ICON);
if(org.apache.commons.lang3.StringUtils.isNotBlank(compositedIcon.getTitle())) {
layeredIcon.add(AttributeAppender.append("title", compositedIcon.getTitle()));
}
add(layeredIcon);
WebComponent basicIcon = new WebComponent(ID_BASIC_ICON);
if(compositedIcon.hasBasicIcon()) {
basicIcon.add(AttributeAppender.append("class", compositedIcon.getBasicIcon()));
if (compositedIcon.hasBasicIconHtmlColor()){
basicIcon.add(AttributeAppender.append("style", compositedIcon.getBasicIconHtmlColor()));
}
}
layeredIcon.add(basicIcon);


RepeatingView listItems = new RepeatingView(ID_LAYER_ICONS);
for(IconType layerIcon : compositedIcon.getLayerIcons()) {
if (layerIcon == null){
continue;
}
if (StringUtils.isNotEmpty(layerIcon.getCssClass())) {
WebComponent icon = new WebComponent(listItems.newChildId());
icon.add(AttributeAppender.append("class", layerIcon.getCssClass()));
if (StringUtils.isNotEmpty(layerIcon.getColor())) {
icon.add(AttributeAppender.append("style", layerIcon.getColor()));
}
listItems.add(icon);
}
}
layeredIcon.add(listItems);

// ListView<IconType> layerIcons = new ListView<IconType>(ID_LAYER_ICONS, new IModel<List<IconType>>(){
//
// @Override
// public List<IconType> getObject() {
// return compositedIcon.getLayerIcons();
// }
//
// })
// {
//
// private static final long serialVersionUID = 1L;
//
// @Override
// protected void populateItem(ListItem<IconType> item) {
// if (item.getModelObject() == null){
// return;
// }
// if (StringUtils.isNotEmpty(item.getModelObject().getCssClass())) {
// add(AttributeAppender.append("class", item.getModelObject().getCssClass()));
// if (StringUtils.isNotEmpty(item.getModelObject().getColor())) {
// add(AttributeAppender.append("style", item.getModelObject().getColor()));
// }
// }
// }
// };
}
}
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2010-2018 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.gui.impl.component.icon;

/**
* @author skublik
*/
public class BottomLeftForColumnIconCssStyle implements LayeredIconCssStyle {

@Override
public String getBasicCssClass() {
return "icon-basic-transparent-for-column";
}

@Override
public String getBasicLayerCssClass() {
return "icon-basic-layer-for-column";
}

@Override
public String getLayerCssClass() {
return "bottom-left-layer-for-column";
}

@Override
public String getStrokeLayerCssClass() {
return "icon-stroke-layer";
}

}
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2010-2018 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.gui.impl.component.icon;

/**
* @author skublik
*/
public class BottomRightForColumnIconCssStyle implements LayeredIconCssStyle {

@Override
public String getBasicCssClass() {
return "icon-basic-transparent-for-column";
}

@Override
public String getBasicLayerCssClass() {
return "icon-basic-layer-for-column";
}

@Override
public String getLayerCssClass() {
return "bottom-right-layer-for-column";
}

@Override
public String getStrokeLayerCssClass() {
return "icon-stroke-layer";
}

}
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2010-2018 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.gui.impl.component.icon;

/**
* @author skublik
*/
public class CenterForColumnIconCssStyle implements LayeredIconCssStyle {

@Override
public String getBasicCssClass() {
return "icon-basic-transparent";
}

@Override
public String getBasicLayerCssClass() {
return "icon-basic-layer";
}

@Override
public String getLayerCssClass() {
return "center-layer-for-column";
}

@Override
public String getStrokeLayerCssClass() {
return "center-icon-stroke-layer";
}

}
Expand Up @@ -23,17 +23,17 @@ public class CenterIconCssStyle implements LayeredIconCssStyle {

@Override
public String getBasicCssClass() {
return "icon-basic-transparent";
return "icon-basic-transparent-for-column";
}

@Override
public String getBasicLayerCssClass() {
return "icon-basic-layer";
return "icon-basic-layer-for-column";
}

@Override
public String getLayerCssClass() {
return "center-layer";
return "center-layer-for-column";
}

@Override
Expand Down

0 comments on commit c342d02

Please sign in to comment.