Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/gui-wrapper' into featur…
Browse files Browse the repository at this point in the history
…e/gui-wrapper
  • Loading branch information
mederly committed Jun 12, 2019
2 parents 3219db7 + c82db3d commit 3321094
Show file tree
Hide file tree
Showing 29 changed files with 503 additions and 376 deletions.

Large diffs are not rendered by default.

Expand Up @@ -47,7 +47,7 @@ public OrgTreeAssignmentPopupTabPanel(String id){
protected void onInitialize() {
super.onInitialize();
OrgTreeAssignablePanel orgTreePanel = new OrgTreeAssignablePanel(
ID_ORG_TREE_VIEW_PANEL, true, getPageBase()) {
ID_ORG_TREE_VIEW_PANEL, true) {
private static final long serialVersionUID = 1L;

@Override
Expand Down
Expand Up @@ -45,7 +45,7 @@ public OrgTreeMemberPopupTabPanel(String id, List<QName> availableRelationList){
protected void onInitialize() {
super.onInitialize();
OrgTreeAssignablePanel orgTreePanel = new OrgTreeAssignablePanel(
ID_ORG_TREE_VIEW_PANEL, true, getPageBase()) {
ID_ORG_TREE_VIEW_PANEL, true) {
private static final long serialVersionUID = 1L;

@Override
Expand Down
Expand Up @@ -152,7 +152,7 @@ protected void onInitialize() {
tablesContainer.add(listServicePanel);

OrgTreeAssignablePanel orgTreePanel = new OrgTreeAssignablePanel(
ID_ORG_TREE_VIEW_PANEL, true, getPageBase()) {
ID_ORG_TREE_VIEW_PANEL, true) {
private static final long serialVersionUID = 1L;

@Override
Expand Down
Expand Up @@ -49,6 +49,8 @@ public WebMarkupContainer getPanel(String panelId) {
panel = createPanel(panelId);
}

panel.setOutputMarkupId(true);
panel.setOutputMarkupPlaceholderTag(true);
return panel;
}

Expand Down
Expand Up @@ -1136,14 +1136,17 @@ public String getObject() {

WebMarkupContainer feedbackContainer = new WebMarkupContainer(ID_FEEDBACK_CONTAINER);
feedbackContainer.setOutputMarkupId(true);
feedbackContainer.setOutputMarkupPlaceholderTag(true);
add(feedbackContainer);

FeedbackAlerts feedbackList = new FeedbackAlerts(ID_FEEDBACK);
feedbackList.setOutputMarkupId(true);
feedbackList.setOutputMarkupPlaceholderTag(true);
feedbackContainer.add(feedbackList);

MainPopupDialog mainPopup = new MainPopupDialog(ID_MAIN_POPUP);
mainPopup.setOutputMarkupId(true);
mainPopup.setOutputMarkupPlaceholderTag(true);
add(mainPopup);
}

Expand Down Expand Up @@ -1174,15 +1177,22 @@ public MainPopupDialog getMainPopup() {
}

public String getMainPopupBodyId() {
return ID_MAIN_POPUP_BODY;
return getMainPopup().getContentId();
}

public void setMainPopupTitle(IModel<String> title) {
getMainPopup().setTitle(title);
}

public void showMainPopup(Popupable popupable, AjaxRequestTarget target) {
getMainPopup().setBody(popupable);
getMainPopup().setTitle(popupable.getTitle());
getMainPopup().setInitialHeight(popupable.getHeight());
getMainPopup().setInitialWidth(popupable.getWidth());
getMainPopup().setHeightUnit(popupable.getHeightUnit());
getMainPopup().setWidthUnit(popupable.getWidthUnit());
getMainPopup().setContent(popupable.getComponent());
getMainPopup().setResizable(false);
getMainPopup().setMaskType(ModalWindow.MaskType.TRANSPARENT);
getMainPopup().show(target);
}

Expand Down
Expand Up @@ -3503,7 +3503,7 @@ public static CompositedIconBuilder getAssignmentRelationIconBuilder(PageBase pa
if (actionButtonIcon == null){
return null;
}
builder.setBasicIcon(actionButtonIcon, IconCssStyle.CENTER_STYLE_WITH_RIGHT_SHIFT)
builder.setBasicIcon(actionButtonIcon, IconCssStyle.IN_ROW_STYLE)
.appendColorHtmlValue(actionButtonIcon.getColor());
return builder;
}
Expand Down Expand Up @@ -3532,12 +3532,12 @@ public static CompositedIconBuilder getAssignmentRelationIconBuilder(PageBase pa
objectTypeDisplay.getIcon().setCssClass(WebComponentUtil.createDefaultBlackIcon(objectType));
}
if (StringUtils.isNotEmpty(WebComponentUtil.getIconCssClass(objectTypeDisplay))) {
builder.setBasicIcon(objectTypeDisplay.getIcon(), IconCssStyle.CENTER_STYLE_WITH_RIGHT_SHIFT)
builder.setBasicIcon(objectTypeDisplay.getIcon(), IconCssStyle.IN_ROW_STYLE)
.appendColorHtmlValue(WebComponentUtil.getIconColor(objectTypeDisplay))
.appendLayerIcon(actionButtonIcon, IconCssStyle.BOTTOM_RIGHT_STYLE)
.appendLayerIcon(relationIcon, IconCssStyle.TOP_RIGHT_STYLE);
} else {
builder.setBasicIcon(actionButtonIcon, IconCssStyle.CENTER_STYLE_WITH_RIGHT_SHIFT)
builder.setBasicIcon(actionButtonIcon, IconCssStyle.IN_ROW_STYLE)
.appendColorHtmlValue(actionButtonIcon.getColor());
}
return builder;
Expand Down Expand Up @@ -3812,7 +3812,7 @@ public static String getLocalizedPolyStringValue(PolyString polyString){
return null;
}
if ((polyString.getTranslation() == null || StringUtils.isEmpty(polyString.getTranslation().getKey())) &&
(polyString.getLang() == null || polyString.getLang() == null || polyString.getLang().isEmpty())){
(polyString.getLang() == null || polyString.getLang().isEmpty())){
return null;
}
if (polyString.getLang() != null && !polyString.getLang().isEmpty()){
Expand Down
Expand Up @@ -157,12 +157,17 @@ private void initLayout() {
private void initListPanel() {
WebMarkupContainer itemsContainer = new WebMarkupContainer(ID_ITEMS);
itemsContainer.setOutputMarkupId(true);
itemsContainer.setOutputMarkupPlaceholderTag(true);
add(itemsContainer);

BoxedTablePanel<PrismContainerValueWrapper<C>> itemTable = initItemTable();
itemTable.setOutputMarkupId(true);
itemTable.setOutputMarkupPlaceholderTag(true);
itemsContainer.add(itemTable);

WebMarkupContainer searchContainer = getSearchPanel(ID_SEARCH_ITEM_PANEL);
searchContainer.setOutputMarkupId(true);
searchContainer.setOutputMarkupPlaceholderTag(true);
itemsContainer.add(searchContainer);
itemsContainer.add(new VisibleEnableBehaviour() {

Expand Down
Expand Up @@ -86,15 +86,12 @@ public CompositedIconBuilder setBasicIcon(String icon, LayeredIconCssStyle style
return this;
}

public CompositedIconBuilder setBasicIcon(IconType icon, LayeredIconCssStyle style) {
public <ICS extends IconCssStyle> CompositedIconBuilder setBasicIcon(IconType icon, ICS style) {
Validate.notNull(icon, "no icon object");
Validate.notNull(icon.getCssClass(), "no icon class");
Validate.notNull(style, "no icon style");

setBasicIcon(icon.getCssClass(), style.getBasicCssClass());
StringBuilder sb = new StringBuilder(icon.getCssClass());
sb.append(" ").append(style.getBasicLayerCssClass());
appendLayerIcon(0, WebComponentUtil.createIconType(sb.toString(), icon.getColor()));
return this;
}

Expand Down
Expand Up @@ -16,23 +16,6 @@

package com.evolveum.midpoint.gui.impl.prism;

import java.util.List;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.FormComponent;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LambdaModel;

import com.evolveum.midpoint.gui.api.factory.GuiComponentFactory;
import com.evolveum.midpoint.gui.api.prism.PrismObjectWrapper;
import com.evolveum.midpoint.gui.impl.error.ErrorPanel;
Expand All @@ -47,6 +30,21 @@
import com.evolveum.midpoint.web.component.prism.InputPanel;
import com.evolveum.midpoint.web.util.ExpressionValidator;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.FormComponent;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LambdaModel;

import java.util.List;

/**
* @author katkav
Expand Down Expand Up @@ -181,6 +179,8 @@ protected void onError(AjaxRequestTarget target, RuntimeException e) {

});
}


}
if (component == null) {
WebMarkupContainer cont = new WebMarkupContainer(ID_INPUT);
Expand Down
Expand Up @@ -109,10 +109,12 @@ public Integer getObject() {
};

WebMarkupContainer tabsContainer = newTabsContainer(ID_TABS_CONTAINER);
tabsContainer.setOutputMarkupId(true);
tabsContainer.setOutputMarkupPlaceholderTag(true);
add(tabsContainer);

// add the loop used to generate tab names
tabsContainer.add(new Loop(ID_TABS, tabCount) {
Loop loop = new Loop(ID_TABS, tabCount) {
private static final long serialVersionUID = 1L;

@Override
Expand All @@ -123,41 +125,50 @@ protected void populateItem(final LoopItem item) {
final WebMarkupContainer titleLink = newLink(ID_LINK, index);

titleLink.add(newTitle(ID_TITLE, tab.getTitle(), index));
titleLink.setOutputMarkupPlaceholderTag(true);
titleLink.setOutputMarkupId(true);
item.add(titleLink);

final IModel<String> countModel;
if (tab instanceof CountModelProvider) {
countModel = ((CountModelProvider)tab).getCountModel();
countModel = ((CountModelProvider)tab).getCountModel();
} else {
countModel = null;
countModel = null;
}
Label countLabel = new Label(ID_COUNT, countModel);
countLabel.setVisible(countModel != null);
countLabel.setOutputMarkupId(true);
countLabel.add(AttributeModifier.append("class", new IModel<String>() {
private static final long serialVersionUID = 1L;

@Override
public String getObject() {
if (countModel == null) {
return GuiStyleConstants.CLASS_BADGE_PASSIVE;
}
String count = countModel.getObject();
if ("0".equals(count)) {
return GuiStyleConstants.CLASS_BADGE_PASSIVE;
} else {
return GuiStyleConstants.CLASS_BADGE_ACTIVE;
}
}
}));
Label countLabel = new Label(ID_COUNT, countModel);
countLabel.setVisible(countModel != null);
countLabel.setOutputMarkupId(true);
countLabel.setOutputMarkupPlaceholderTag(true);
countLabel.add(AttributeModifier.append("class", new IModel<String>() {
private static final long serialVersionUID = 1L;

@Override
public String getObject() {
if (countModel == null) {
return GuiStyleConstants.CLASS_BADGE_PASSIVE;
}
String count = countModel.getObject();
if ("0".equals(count)) {
return GuiStyleConstants.CLASS_BADGE_PASSIVE;
} else {
return GuiStyleConstants.CLASS_BADGE_ACTIVE;
}
}
}));
titleLink.add(countLabel);
}

@Override
protected LoopItem newItem(final int iteration) {
return newTabContainer(iteration);
}
});
};

loop.setOutputMarkupId(true);
loop.setOutputMarkupPlaceholderTag(true);


tabsContainer.add(loop);

WebMarkupContainer rightSideTabItem = new WebMarkupContainer(RIGHT_SIDE_TAB_ITEM_ID);
Component rightSideTabPanel = rightSideItemProvider != null ? rightSideItemProvider.createRightSideItem(RIGHT_SIDE_TAB_ID) : null;
Expand Down Expand Up @@ -192,6 +203,7 @@ protected IModel<?> initModel() {
protected WebMarkupContainer newTabsContainer(final String id) {
WebMarkupContainer tabs = new WebMarkupContainer(id);
tabs.setOutputMarkupId(true);
tabs.setOutputMarkupPlaceholderTag(true);
return tabs;
}

Expand Down Expand Up @@ -399,6 +411,8 @@ private void setCurrentTab(int index) {
"]. You must always return a panel with id equal to the provided panelId parameter. TabbedPanel [" +
getPath() + "] ITab index [" + currentTab + "]");
}
component.setOutputMarkupPlaceholderTag(true);
component.setOutputMarkupId(true);

addOrReplace(component);
}
Expand Down
Expand Up @@ -549,6 +549,7 @@ protected boolean isOrgTreeTabVisible(){
}
};
popupPanel.setOutputMarkupId(true);
popupPanel.setOutputMarkupPlaceholderTag(true);
getPageBase().showMainPopup(popupPanel, target);
}

Expand Down
Expand Up @@ -233,7 +233,7 @@ public void onClick(AjaxRequestTarget target) {
int count = WebModelServiceUtils.countObjects(OrgType.class, null, getPageBase());
if (count > 0) {
OrgTreeAssignablePanel orgTreePanel = new OrgTreeAssignablePanel(
getPageBase().getMainPopupBodyId(), true, getPageBase()) {
getPageBase().getMainPopupBodyId(), true) {
private static final long serialVersionUID = 1L;

@Override
Expand Down

0 comments on commit 3321094

Please sign in to comment.