use of org.apache.wicket.markup.html.panel.Panel in project midpoint by Evolveum.
the class OperationResultPanel method initParams.
private void initParams(WebMarkupContainer operationContent, final IModel<OpResult> model, Page parentPage) {
Label paramsLabel = new Label("paramsLabel", parentPage.getString("FeedbackAlertMessageDetails.params"));
paramsLabel.setOutputMarkupId(true);
paramsLabel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return CollectionUtils.isNotEmpty(model.getObject().getParams());
}
});
operationContent.add(paramsLabel);
ListView<Param> params = new ListView<Param>(ID_PARAMS, createParamsModel(model)) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<Param> item) {
item.add(new Label("paramName", new PropertyModel<Object>(item.getModel(), "name")));
item.add(new Label("paramValue", new PropertyModel<Object>(item.getModel(), "value")));
}
};
params.setOutputMarkupId(true);
params.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return CollectionUtils.isNotEmpty(model.getObject().getParams());
}
});
operationContent.add(params);
ListView<OpResult> subresults = new ListView<OpResult>("subresults", createSubresultsModel(model)) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<OpResult> item) {
Panel subresult = new OperationResultPanel("subresult", item.getModel(), getPage());
subresult.setOutputMarkupId(true);
item.add(subresult);
}
};
subresults.setOutputMarkupId(true);
subresults.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return CollectionUtils.isNotEmpty(model.getObject().getSubresults());
}
});
operationContent.add(subresults);
}
use of org.apache.wicket.markup.html.panel.Panel 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.panel.Panel in project midpoint by Evolveum.
the class PrismValuePanel method initLayout.
private void initLayout(IModel<String> labelModel, Form form, String valueCssClass, String inputCssClass) {
//container
WebMarkupContainer valueContainer = new WebMarkupContainer(ID_VALUE_CONTAINER);
valueContainer.setOutputMarkupId(true);
valueContainer.add(new AttributeModifier("class", valueCssClass));
add(valueContainer);
//feedback
FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK);
feedback.setOutputMarkupId(true);
add(feedback);
//input
Panel input = createInputComponent(ID_INPUT, labelModel, form);
input.add(new AttributeModifier("class", inputCssClass));
if (input instanceof InputPanel) {
initAccessBehaviour((InputPanel) input);
feedback.setFilter(new ComponentFeedbackMessageFilter(((InputPanel) input).getBaseFormComponent()));
} else if (input instanceof LockoutStatusPanel) {
feedback.setFilter(new ComponentFeedbackMessageFilter(input));
} else if (input instanceof ValueChoosePanel) {
feedback.setFilter(new ComponentFeedbackMessageFilter(input));
} else if (input instanceof AssociationValueChoicePanel) {
feedback.setFilter(new ComponentFeedbackMessageFilter(((AssociationValueChoicePanel) input).getTextComponent()));
}
valueContainer.add(input);
//buttons
AjaxLink addButton = new AjaxLink(ID_ADD_BUTTON) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
addValue(target);
}
};
addButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isAddButtonVisible();
}
});
valueContainer.add(addButton);
AjaxLink removeButton = new AjaxLink(ID_REMOVE_BUTTON) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
removeValue(target);
}
};
removeButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isRemoveButtonVisible();
}
});
valueContainer.add(removeButton);
}
use of org.apache.wicket.markup.html.panel.Panel in project wicket by apache.
the class ComponentQueueingTest method nestedPanels.
/**
* test with inner panels
*/
@Test
public void nestedPanels() {
MarkupContainer r = new R(), s = new S();
Panel innerPanel = new InnerPanel("inner");
innerPanel.queue(s);
Panel outerPanel = new OuterPanel("outer");
outerPanel.queue(r, innerPanel);
TestPage p = new TestPage();
p.setPageMarkup("<html><head></head><body><p wicket:id='outer'></p></body></html>");
p.queue(outerPanel);
tester.startPage(p);
assertThat(p, hasPath(new Path(outerPanel, r)));
assertThat(p, hasPath(new Path(outerPanel, innerPanel, s)));
// contributed by <wicket:head> in outer
tester.assertContains("<meta/>");
// contributed by <wicket:head> in inner
tester.assertContains("<meta2/>");
}
use of org.apache.wicket.markup.html.panel.Panel in project wicket by apache.
the class MarkupFragmentTest method panelWithAutoComponent.
/**
* @see href http://issues.apache.org/jira/browse/WICKET-3111
*
* @throws Exception
*/
@Test
public void panelWithAutoComponent() throws Exception {
Page page = new MyPage();
Panel panel = new MyPanelWithAutoComponent("panel");
page.add(panel);
// Get the associated markup file
IMarkupFragment markup = panel.getAssociatedMarkup();
compareMarkupWithFile(markup, "MyPanelWithAutoComponent_ExpectedResult.html", MyPage.class);
// The Page is missing the tag to "call" the panel
assertNull(panel.getMarkup());
// Create a Page with proper markup for the panel
page = new MyPanelWithAutoComponentPage();
panel = (Panel) page.get("panel");
// getMarkup() returns the "calling" tags
markup = panel.getMarkup();
compareMarkupWithString(markup, "<span wicket:id=\"panel\">test</span>");
// getMarkup(null) returns the markup which is used to find a child component
markup = panel.getMarkup(null);
compareMarkupWithString(markup, "<wicket:panel><a href=\"something\"><span wicket:id=\"label\">text</span></a></wicket:panel>");
}
Aggregations