use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.
the class FocusProjectionsTabPanel method initLayout.
private void initLayout(final PageBase page) {
final WebMarkupContainer shadows = new WebMarkupContainer(ID_SHADOWS);
shadows.setOutputMarkupId(true);
add(shadows);
InlineMenu accountMenu = new InlineMenu(ID_SHADOW_MENU, new Model((Serializable) createShadowMenu()));
accountMenu.setVisible(!getObjectWrapper().isReadonly());
shadows.add(accountMenu);
final ListView<FocusSubwrapperDto<ShadowType>> projectionList = new ListView<FocusSubwrapperDto<ShadowType>>(ID_SHADOW_LIST, projectionModel) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<FocusSubwrapperDto<ShadowType>> item) {
PackageResourceReference packageRef;
final FocusSubwrapperDto<ShadowType> dto = item.getModelObject();
final PropertyModel<ObjectWrapper<F>> objectWrapperModel = new PropertyModel<ObjectWrapper<F>>(item.getModel(), "object");
final Panel shadowPanel;
if (dto.isLoadedOK()) {
packageRef = new PackageResourceReference(ImgResources.class, ImgResources.HDD_PRISM);
shadowPanel = new PrismObjectPanel<F>(ID_SHADOW, new PropertyModel<ObjectWrapper<F>>(item.getModel(), "object"), packageRef, getMainForm(), getPageBase());
} else {
shadowPanel = new SimpleErrorPanel<ShadowType>(ID_SHADOW, item.getModel()) {
private static final long serialVersionUID = 1L;
@Override
public void onShowMorePerformed(AjaxRequestTarget target) {
OperationResult fetchResult = dto.getResult();
if (fetchResult != null) {
showResult(fetchResult);
target.add(page.getFeedbackPanel());
}
}
};
}
shadowPanel.setOutputMarkupId(true);
shadowPanel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
FocusSubwrapperDto<ShadowType> shadowWrapperDto = item.getModelObject();
ObjectWrapper<ShadowType> shadowWrapper = shadowWrapperDto.getObject();
return !shadowWrapper.isMinimalized();
}
});
item.add(shadowPanel);
CheckTableHeader<F> shadowHeader = new CheckTableHeader<F>(ID_SHADOW_HEADER, objectWrapperModel) {
private static final long serialVersionUID = 1L;
@Override
protected void onClickPerformed(AjaxRequestTarget target) {
super.onClickPerformed(target);
onExpandCollapse(target, item.getModel());
target.add(shadows);
}
};
if (item.getModel().getObject().getStatus().equals(UserDtoStatus.DELETE)) {
shadowHeader.add(new AttributeModifier("class", "box-header with-border delete"));
}
item.add(shadowHeader);
}
};
AjaxCheckBox accountCheckAll = new AjaxCheckBox(ID_SHADOW_CHECK_ALL, new Model()) {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
for (FocusSubwrapperDto<ShadowType> dto : projectionList.getModelObject()) {
if (dto.isLoadedOK()) {
ObjectWrapper<ShadowType> accModel = dto.getObject();
accModel.setSelected(getModelObject());
}
}
target.add(shadows);
}
};
shadows.add(accountCheckAll);
shadows.add(projectionList);
}
use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.
the class MainMenuPanel method initLayout.
private void initLayout() {
final MainMenuItem menu = getModelObject();
WebMarkupContainer item = new WebMarkupContainer(ID_ITEM);
item.add(AttributeModifier.replace("class", new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
if (menu.isMenuActive((WebPage) getPage())) {
return "active";
}
for (MenuItem item : menu.getItems()) {
if (item.isMenuActive((WebPage) getPage())) {
return "active";
}
}
return !menu.getItems().isEmpty() ? "treeview" : null;
}
}));
add(item);
WebMarkupContainer link;
if (menu.getPageClass() != null) {
link = new AjaxLink(ID_LINK) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
mainMenuPerformed(menu);
}
};
} else if (menu instanceof AdditionalMenuItem) {
link = new AjaxLink(ID_LINK) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
additionalMenuPerformed(menu);
}
};
} else {
link = new WebMarkupContainer(ID_LINK);
}
item.add(link);
WebMarkupContainer icon = new WebMarkupContainer(ID_ICON);
icon.add(AttributeModifier.replace("class", new PropertyModel<>(menu, MainMenuItem.F_ICON_CLASS)));
link.add(icon);
Label label = new Label(ID_LABEL, menu.getNameModel());
link.add(label);
final PropertyModel<String> bubbleModel = new PropertyModel<>(menu, MainMenuItem.F_BUBBLE_LABEL);
Label bubble = new Label(ID_BUBBLE, bubbleModel);
bubble.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return bubbleModel.getObject() != null;
}
});
link.add(bubble);
WebMarkupContainer arrow = new WebMarkupContainer(ID_ARROW);
arrow.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return !menu.getItems().isEmpty() && bubbleModel.getObject() == null;
}
});
link.add(arrow);
WebMarkupContainer submenu = new WebMarkupContainer(ID_SUBMENU);
submenu.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return !menu.getItems().isEmpty();
}
});
item.add(submenu);
ListView<MenuItem> subItem = new ListView<MenuItem>(ID_SUB_ITEM, new Model((Serializable) menu.getItems())) {
@Override
protected void populateItem(ListItem<MenuItem> listItem) {
createSubmenu(listItem);
}
};
submenu.add(subItem);
}
use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.
the class MultiValueTextEditPanel method initLayout.
private void initLayout(final boolean inputEnabled, final boolean showPlaceholder, final NonEmptyModel<Boolean> readOnlyModel) {
WebMarkupContainer placeholderContainer = new WebMarkupContainer(ID_PLACEHOLDER_CONTAINER);
placeholderContainer.setOutputMarkupPlaceholderTag(true);
placeholderContainer.setOutputMarkupPlaceholderTag(true);
placeholderContainer.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return showPlaceholder && (getModel().getObject() == null || getModel().getObject().isEmpty());
}
});
add(placeholderContainer);
AjaxLink placeholderAdd = new AjaxLink(ID_PLACEHOLDER_ADD) {
@Override
public void onClick(AjaxRequestTarget target) {
addValuePerformed(target);
}
};
placeholderAdd.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
if (buttonsDisabled()) {
return " " + CSS_DISABLED;
}
return "";
}
}));
placeholderAdd.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
placeholderAdd.setOutputMarkupId(true);
placeholderAdd.setOutputMarkupPlaceholderTag(true);
placeholderContainer.add(placeholderAdd);
ListView repeater = new ListView<T>(ID_REPEATER, getModel()) {
@Override
protected void populateItem(final ListItem<T> item) {
TextField text = new TextField<>(ID_TEXT, createTextModel(item.getModel()));
text.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
text.add(AttributeAppender.replace("placeholder", createEmptyItemPlaceholder()));
if (selectedModel != null && item.getModelObject() == selectedModel.getObject()) {
// TODO color constant
text.add(AttributeAppender.append("style", "background-color: #FFFFD0;"));
}
if (!inputEnabled) {
text.add(new AttributeModifier("disabled", "disabled"));
}
item.add(text);
WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
item.add(buttonGroup);
initButtons(buttonGroup, item, readOnlyModel);
}
};
repeater.setOutputMarkupId(true);
repeater.setOutputMarkupPlaceholderTag(true);
repeater.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return getModel().getObject() != null && !getModel().getObject().isEmpty();
}
});
add(repeater);
}
use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.
the class MainPopupDialog method setBody.
private void setBody(Component component) {
WebMarkupContainer content = (WebMarkupContainer) get(getContentId());
content.addOrReplace(component);
}
use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.
the class AceEditorFormGroup method initLayout.
private void initLayout(IModel<String> label, final String tooltipKey, boolean isTooltipInModal, String labelSize, String textSize, boolean required, int rowNumber) {
WebMarkupContainer labelContainer = new WebMarkupContainer(ID_LABEL_CONTAINER);
add(labelContainer);
Label l = new Label(ID_LABEL, label);
if (StringUtils.isNotEmpty(labelSize)) {
labelContainer.add(AttributeAppender.prepend("class", labelSize));
}
labelContainer.add(l);
Label tooltipLabel = new Label(ID_TOOLTIP, new Model<>());
tooltipLabel.add(new AttributeAppender("data-original-title", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return getString(tooltipKey);
}
}));
tooltipLabel.add(new InfoTooltipBehavior(isTooltipInModal));
tooltipLabel.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return tooltipKey != null;
}
});
tooltipLabel.setOutputMarkupId(true);
tooltipLabel.setOutputMarkupPlaceholderTag(true);
labelContainer.add(tooltipLabel);
WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
if (StringUtils.isNotEmpty(textSize)) {
textWrapper.add(AttributeAppender.prepend("class", textSize));
}
add(textWrapper);
AceEditor text = new AceEditor(ID_TEXT, getModel());
text.add(new AttributeModifier("rows", rowNumber));
text.setOutputMarkupId(true);
text.setRequired(required);
text.setLabel(label);
text.add(AttributeAppender.replace("placeholder", label));
textWrapper.add(text);
}
Aggregations