List of usage examples for org.apache.wicket.markup.html.basic Label setRenderBodyOnly
public final Component setRenderBodyOnly(final boolean renderTag)
From source file:com.evolveum.midpoint.gui.api.component.form.CheckBoxPanel.java
License:Apache License
public CheckBoxPanel(String id, IModel<Boolean> checkboxModel, final IModel<Boolean> visibilityModel, IModel<String> labelModel, IModel<String> tooltipModel) { super(id);//from w w w.j ava 2 s.c o m WebMarkupContainer container = new WebMarkupContainer(ID_CONTAINER); add(container); AjaxCheckBox check = new AjaxCheckBox(ID_CHECK, checkboxModel) { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { CheckBoxPanel.this.onUpdate(target); } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { CheckBoxPanel.this.updateAjaxAttributes(attributes); } }; check.setOutputMarkupId(true); if (visibilityModel != null) { check.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isEnabled() { return visibilityModel.getObject(); } }); } container.add(check); Label label = new Label(ID_LABEL, labelModel); label.setRenderBodyOnly(true); container.add(label); if (tooltipModel != null) { container.add(new AttributeModifier("title", tooltipModel)); } }
From source file:com.evolveum.midpoint.gui.api.component.PendingOperationPanel.java
License:Apache License
private void initLayout() { ListView<PendingOperationType> operation = new ListView<PendingOperationType>(ID_OPERATION, getModel()) { private static final long serialVersionUID = 1L; @Override// w w w . java 2 s . co m protected void populateItem(ListItem<PendingOperationType> item) { item.setRenderBodyOnly(true); WebMarkupContainer label = new WebMarkupContainer(ID_LABEL); item.add(label); Label text = new Label(ID_TEXT, createLabelText(item.getModel())); text.setRenderBodyOnly(true); label.add(text); label.add(AttributeAppender.append("class", createTextClass(item.getModel()))); label.add(AttributeModifier.replace("title", createTextTooltipModel(item.getModel()))); label.add(new InfoTooltipBehavior() { @Override public String getCssClass() { return null; } }); } }; add(operation); }
From source file:com.evolveum.midpoint.gui.api.page.PageBase.java
License:Apache License
private void initTitleLayout() { WebMarkupContainer pageTitleContainer = new WebMarkupContainer(ID_PAGE_TITLE_CONTAINER); pageTitleContainer.add(createUserStatusBehaviour(true)); add(pageTitleContainer);// w ww .ja v a2 s.co m WebMarkupContainer pageTitle = new WebMarkupContainer(ID_PAGE_TITLE); pageTitleContainer.add(pageTitle); Label pageTitleReal = new Label(ID_PAGE_TITLE_REAL, createPageTitleModel()); pageTitleReal.setRenderBodyOnly(true); pageTitle.add(pageTitleReal); ListView breadcrumbs = new ListView<Breadcrumb>(ID_BREADCRUMB, new AbstractReadOnlyModel<List<Breadcrumb>>() { private static final long serialVersionUID = 1L; @Override public List<Breadcrumb> getObject() { return getSessionStorage().getBreadcrumbs(); } }) { @Override protected void populateItem(ListItem<Breadcrumb> item) { final Breadcrumb dto = item.getModelObject(); AjaxLink bcLink = new AjaxLink(ID_BC_LINK) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { redirectBackToBreadcrumb(dto); } }; item.add(bcLink); bcLink.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isEnabled() { return dto.isUseLink(); } }); WebMarkupContainer bcIcon = new WebMarkupContainer(ID_BC_ICON); bcIcon.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return dto.getIcon() != null && dto.getIcon().getObject() != null; } }); bcIcon.add(AttributeModifier.replace("class", dto.getIcon())); bcLink.add(bcIcon); Label bcName = new Label(ID_BC_NAME, dto.getLabel()); bcLink.add(bcName); item.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return dto.isVisible(); } }); } }; add(breadcrumbs); }
From source file:com.evolveum.midpoint.gui.api.page.PageBase.java
License:Apache License
private void initLayout() { AjaxLink logo = new AjaxLink(ID_LOGO) { private static final long serialVersionUID = 1L; @Override//w w w . j av a 2 s. co m public void onClick(AjaxRequestTarget target) { SessionStorage storage = MidPointAuthWebSession.getSession().getSessionStorage(); storage.clearBreadcrumbs(); Class<? extends Page> page = MidPointApplication.get().getHomePage(); setResponsePage(page); } }; add(logo); Label title = new Label(ID_TITLE, createPageTitleModel()); title.setRenderBodyOnly(true); add(title); initHeaderLayout(); initTitleLayout(); initDebugBarLayout(); List<SideBarMenuItem> menuItems = createMenuItems(); SideBarMenuPanel sidebarMenu = new SideBarMenuPanel(ID_SIDEBAR_MENU, new Model((Serializable) menuItems)); sidebarMenu.add(createUserStatusBehaviour(true)); add(sidebarMenu); WebMarkupContainer version = new WebMarkupContainer(ID_VERSION) { private static final long serialVersionUID = 1L; @Deprecated public String getDescribe() { return PageBase.this.getDescribe(); } }; version.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return RuntimeConfigurationType.DEVELOPMENT.equals(getApplication().getConfigurationType()); } }); add(version); WebMarkupContainer feedbackContainer = new WebMarkupContainer(ID_FEEDBACK_CONTAINER); feedbackContainer.setOutputMarkupId(true); add(feedbackContainer); FeedbackAlerts feedbackList = new FeedbackAlerts(ID_FEEDBACK); feedbackList.setOutputMarkupId(true); feedbackContainer.add(feedbackList); MainPopupDialog mainPopup = new MainPopupDialog(ID_MAIN_POPUP); mainPopup.setOutputMarkupId(true); add(mainPopup); }
From source file:com.evolveum.midpoint.web.component.assignment.MultipleAssignmentSelector.java
License:Apache License
private void initLayout(PageBase pageBase) { setOutputMarkupId(true);//ww w.j av a 2s. c om WebMarkupContainer filterButtonContainer = new WebMarkupContainer(ID_FILTER_BUTTON_CONTAINER); AjaxLink<String> filterByUserButton = new AjaxLink<String>(ID_FILTER_BY_USER_BUTTON) { @Override public void onClick(AjaxRequestTarget target) { if (showDialog) { labelValue = createStringResource("MultipleAssignmentSelector.filterByUser").getString(); initUserDialog(createStringResource("MultipleAssignmentSelector.filterByUser"), target); } showDialog = true; } }; filterButtonContainer.add(filterByUserButton); labelValue = pageBase.createStringResource("MultipleAssignmentSelector.filterByUser").getString(); Label label = new Label(ID_LABEL, createLabelModel()); label.setRenderBodyOnly(true); filterByUserButton.add(label); AjaxLink deleteButton = new AjaxLink(ID_DELETE_BUTTON) { @Override public void onClick(AjaxRequestTarget target) { labelValue = createStringResource("MultipleAssignmentSelector.filterByUser").getString(); showDialog = false; deleteFilterPerformed(target); } }; filterByUserButton.add(deleteButton); add(filterButtonContainer); initSearchPanel(); add(initTablePanel()); }
From source file:com.evolveum.midpoint.web.component.assignment.RoleCatalogItemButton.java
License:Apache License
private void initLayout() { setOutputMarkupId(true);/*from w ww . j av a2 s. c o m*/ WebMarkupContainer itemButtonContainer = new WebMarkupContainer(ID_ITEM_BUTTON_CONTAINER); itemButtonContainer.setOutputMarkupId(true); itemButtonContainer.add(new AttributeAppender("class", getBackgroundClass(getModelObject()))); add(itemButtonContainer); AjaxLink inner = new AjaxLink(ID_INNER) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget ajaxRequestTarget) { targetObjectDetailsPerformed(RoleCatalogItemButton.this.getModelObject(), ajaxRequestTarget); } }; inner.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isEnabled() { return isMultiUserRequest() || canAssign(RoleCatalogItemButton.this.getModelObject()); } }); inner.add(new AttributeAppender("title", getModelObject().getName())); itemButtonContainer.add(inner); Label nameLabel = new Label(ID_INNER_LABEL, getModelObject().getName()); inner.add(nameLabel); Label descriptionLabel = new Label(ID_INNER_DESCRIPTION, getModelObject().getTargetRef() != null ? getModelObject().getTargetRef().getDescription() : ""); descriptionLabel.setOutputMarkupId(true); inner.add(descriptionLabel); AjaxLink detailsLink = new AjaxLink(ID_DETAILS_LINK) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget ajaxRequestTarget) { assignmentDetailsPerformed(RoleCatalogItemButton.this.getModelObject(), ajaxRequestTarget); } }; detailsLink.add(getFooterLinksEnableBehaviour()); detailsLink.add(AttributeAppender.append("title", AssignmentsUtil.getShoppingCartAssignmentsLimitReachedTitleModel(getPageBase()))); detailsLink.add(AttributeAppender.append("class", new LoadableModel<String>() { @Override protected String load() { return detailsLink.isEnabled() ? "shopping-cart-item-button-details" : "shopping-cart-item-button-details-disabled"; } })); itemButtonContainer.add(detailsLink); Label detailsLinkLabel = new Label(ID_DETAILS_LINK_LABEL, createStringResource("MultiButtonPanel.detailsLink")); detailsLinkLabel.setRenderBodyOnly(true); detailsLink.add(detailsLinkLabel); AjaxLink detailsLinkIcon = new AjaxLink(ID_DETAILS_LINK_ICON) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { } }; detailsLinkIcon.add(getFooterLinksEnableBehaviour()); detailsLink.add(detailsLinkIcon); AjaxLink addToCartLink = new AjaxLink(ID_ADD_TO_CART_LINK) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget ajaxRequestTarget) { addAssignmentPerformed(RoleCatalogItemButton.this.getModelObject(), ajaxRequestTarget); } }; addToCartLink.add(getFooterLinksEnableBehaviour()); addToCartLink.add(AttributeAppender.append("title", AssignmentsUtil.getShoppingCartAssignmentsLimitReachedTitleModel(getPageBase()))); addToCartLink.add(AttributeAppender.append("class", new LoadableModel<String>() { @Override protected String load() { return addToCartLink.isEnabled() ? "shopping-cart-item-button-add" : "shopping-cart-item-button-add-disabled"; } })); itemButtonContainer.add(addToCartLink); AjaxLink addToCartLinkIcon = new AjaxLink(ID_ADD_TO_CART_LINK_ICON) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { } }; addToCartLinkIcon.add(getFooterLinksEnableBehaviour()); addToCartLink.add(addToCartLinkIcon); WebMarkupContainer icon = new WebMarkupContainer(ID_TYPE_ICON); icon.add(new AttributeAppender("class", WebComponentUtil.createDefaultBlackIcon(getModelObject().getType().getQname()))); itemButtonContainer.add(icon); WebMarkupContainer alreadyAssignedIcon = new WebMarkupContainer(ID_ALREADY_ASSIGNED_ICON); alreadyAssignedIcon.add(new AttributeAppender("title", getAlreadyAssignedIconTitleModel(getModelObject()))); alreadyAssignedIcon.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return !isMultiUserRequest() && getModelObject().isAlreadyAssigned(); } }); itemButtonContainer.add(alreadyAssignedIcon); }
From source file:com.evolveum.midpoint.web.component.assignment.UserSelectionButton.java
License:Apache License
private void initLayout() { AjaxLink<String> userSelectionButton = new AjaxLink<String>(ID_USER_SELECTION_BUTTON) { private static final long serialVersionUID = 1L; @Override//from www . ja v a2 s . c o m protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); attributes.setEventPropagation(AjaxRequestAttributes.EventPropagation.BUBBLE); } @Override public void onClick(AjaxRequestTarget target) { if (showUserSelectionPopup) { initUserSelectionPopup(target); } showUserSelectionPopup = true; } }; userSelectionButton.add(AttributeModifier.append("class", getTargetUserButtonClass())); userSelectionButton.setOutputMarkupId(true); userSelectionButton.add(new AttributeAppender("title", new IModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { return getUserSelectionButtonTitle(); } })); add(userSelectionButton); Label label = new Label(ID_USER_SELECTION_BUTTON_LABEL, new IModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { return getUserButtonLabel(); } }); label.setRenderBodyOnly(true); userSelectionButton.add(label); AjaxLink deleteButton = new AjaxLink(ID_DELETE_SELECTED_USER_BUTTON) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { UserSelectionButton.this.onDeleteSelectedUsersPerformed(target); } }; deleteButton.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return isDeleteButtonVisible(); } }); userSelectionButton.add(deleteButton); }
From source file:com.evolveum.midpoint.web.component.menu.top.UserMenuPanel.java
License:Apache License
@Override protected void initLayout() { Label username = new Label(ID_USERNAME, new AbstractReadOnlyModel<String>() { @Override/* w w w . ja va2s. c o m*/ public String getObject() { return getShortUserName(); } }); username.setRenderBodyOnly(true); add(username); ExternalLink logoutLink = new ExternalLink(ID_LOGOUT_LINK, new Model<String>(RequestCycle.get().getRequest().getContextPath() + "/j_spring_security_logout"), createStringResource("UserMenuPanel.logout")); add(logoutLink); // LabeledBookmarkableLink editProfile = new LabeledBookmarkableLink(ID_EDIT_PROFILE, // new MenuItem(createStringResource("UserMenuPanel.editProfile"), PageDashboard.class)); // add(editProfile); LabeledBookmarkableLink resetPasswords = new LabeledBookmarkableLink(ID_RESET_PASSWORDS, new MenuItem(createStringResource("UserMenuPanel.resetPasswords"), PageMyPasswords.class)); add(resetPasswords); }
From source file:com.evolveum.midpoint.web.component.menu.UserMenuPanel.java
License:Apache License
private void initLayout() { WebMarkupContainer iconBox = new WebMarkupContainer(ID_ICON_BOX); add(iconBox);/* ww w . j a va 2 s. c om*/ NonCachingImage img = new NonCachingImage(ID_PHOTO, new AbstractReadOnlyModel<AbstractResource>() { @Override public AbstractResource getObject() { if (jpegPhoto == null) { return null; } else { return new ByteArrayResource("image/jpeg", jpegPhoto); } } }); img.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { if (userModel != null && userModel.getObject() == null) { loadModel(null); } return jpegPhoto != null; } }); iconBox.add(img); ContextImage icon = new ContextImage(ID_ICON, "img/placeholder.png"); icon.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { if (userModel != null && userModel.getObject() == null) { loadModel(null); } return jpegPhoto == null; } }); iconBox.add(icon); Label usernameLink = new Label(ID_USERNAME_LINK, new AbstractReadOnlyModel<String>() { @Override public String getObject() { return getShortUserName(); } }); add(usernameLink); WebMarkupContainer panelIconBox = new WebMarkupContainer(ID_PANEL_ICON_BOX); add(panelIconBox); NonCachingImage panelImg = new NonCachingImage(ID_PANEL_PHOTO, new AbstractReadOnlyModel<AbstractResource>() { @Override public AbstractResource getObject() { if (jpegPhoto == null) { return null; } else { return new ByteArrayResource("image/jpeg", jpegPhoto); } } }); panelImg.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { if (userModel != null && userModel.getObject() == null) { loadModel(null); } return jpegPhoto != null; } }); panelIconBox.add(panelImg); ContextImage panelIcon = new ContextImage(ID_PANEL_ICON, "img/placeholder.png"); panelIcon.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { if (userModel != null && userModel.getObject() == null) { loadModel(null); } return jpegPhoto == null; } }); panelIconBox.add(panelIcon); Label username = new Label(ID_USERNAME, new AbstractReadOnlyModel<String>() { @Override public String getObject() { return getShortUserName(); } }); username.setRenderBodyOnly(true); add(username); ExternalLink logoutLink = new ExternalLink(ID_LOGOUT_LINK, new Model<>(RequestCycle.get().getRequest().getContextPath() + "/j_spring_security_logout"), createStringResource("UserMenuPanel.logout")); add(logoutLink); AjaxButton editPasswordQ = new AjaxButton(ID_PASSWORD_QUESTIONS, createStringResource("UserMenuPanel.editPasswordQuestions")) { @Override public void onClick(AjaxRequestTarget target) { PageMyPasswordQuestions myPasswordQuestions = new PageMyPasswordQuestions( passwordQuestionsDtoIModel); setResponsePage(myPasswordQuestions); } }; add(editPasswordQ); if (!isPasswordModelLoaded) { passwordQuestionsDtoIModel = new LoadableModel<PasswordQuestionsDto>(false) { private static final long serialVersionUID = 1L; @Override protected PasswordQuestionsDto load() { return loadModel(null); } }; isPasswordModelLoaded = true; } securityPolicyQuestionsModel = new LoadableModel<List<SecurityQuestionDefinitionType>>(false) { @Override protected List<SecurityQuestionDefinitionType> load() { return loadSecurityPloicyQuestionsModel(); } }; editPasswordQ.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { if (securityPolicyQuestionsModel == null || securityPolicyQuestionsModel.getObject() == null) { loadSecurityPloicyQuestionsModel(); } return hasQuestions() || (securityPolicyQuestionsModel.getObject() != null && securityPolicyQuestionsModel.getObject().size() > 0); } }); }
From source file:com.evolveum.midpoint.web.component.message2.FeedbackAlertMessage.java
License:Apache License
@Override protected void initLayout() { Label message = new Label(ID_MESSAGE, new PropertyModel<>(getModel(), "message")); message.setRenderBodyOnly(true); add(message);/*from w ww .j a va 2s . com*/ Label type = new Label(ID_TYPE, createTypeModel()); add(type); //todo "show more" link only for operation result messages }