List of usage examples for org.apache.wicket Component setOutputMarkupId
public final Component setOutputMarkupId(final boolean output)
From source file:org.projectforge.web.wicket.components.LabelForPanel.java
License:Open Source License
public LabelForPanel(final String id, final Component field, final String text) { super(id);//from w w w . j a v a2 s . c om field.setOutputMarkupId(true); final Label label = new Label("label", text); label.add(AttributeModifier.replace("for", field.getMarkupId())); add(label); }
From source file:org.projectforge.web.wicket.flowlayout.MyAjaxComponentHolder.java
License:Open Source License
/** * Adds the given component and calls {@link Component#setOutputMarkupId(boolean)}. * @param component/*from w w w . j a va 2 s . c om*/ */ public void register(final Component component) { components.add(component.setOutputMarkupId(true)); }
From source file:org.sakaiproject.gradebookng.tool.actions.ViewGradeSummaryAction.java
License:Educational Community License
@Override public ActionResponse handleEvent(final JsonNode params, final AjaxRequestTarget target) { final String studentUuid = params.get("studentId").asText(); final GradebookUiSettings settings = ((GradebookPage) target.getPage()).getUiSettings(); final GbUser student = businessService.getUser(studentUuid); final Map<String, Object> model = new HashMap<>(); model.put("studentUuid", studentUuid); model.put("groupedByCategoryByDefault", settings.isCategoriesEnabled()); final GradebookPage gradebookPage = (GradebookPage) target.getPage(); final GbModalWindow window = gradebookPage.getStudentGradeSummaryWindow(); final Component content = new StudentGradeSummaryPanel(window.getContentId(), Model.ofMap(model), window); if (window.isShown() && window.isVisible()) { window.replace(content);//from www. j a v a 2 s .c om content.setVisible(true); target.add(content); } else { window.setContent(content); window.show(target); } window.setStudentToReturnFocusTo(studentUuid); content.setOutputMarkupId(true); final String modalTitle = (new StringResourceModel("heading.studentsummary", null, new Object[] { student.getDisplayName(), student.getDisplayId() })).getString(); window.setTitle(modalTitle); window.show(target); target.appendJavaScript(String.format("new GradebookGradeSummary($(\"#%s\"), false, \"%s\");", content.getMarkupId(), modalTitle)); return new EmptyOkResponse(); }
From source file:org.sakaiproject.profile2.tool.components.FocusOnLoadBehaviour.java
License:Educational Community License
@Override public void bind(Component component) { this.component = component; component.setOutputMarkupId(true); }
From source file:org.sakaiproject.profile2.tool.pages.panels.MyBusinessDisplay.java
License:Educational Community License
private void addEditButton(final String id, final UserProfile userProfile) { AjaxFallbackLink editButton = new AjaxFallbackLink("editButton", new ResourceModel("button.edit")) { private static final long serialVersionUID = 1L; public void onClick(AjaxRequestTarget target) { Component newPanel = new MyBusinessEdit(id, userProfile); newPanel.setOutputMarkupId(true); MyBusinessDisplay.this.replaceWith(newPanel); if (target != null) { target.add(newPanel);//from w w w. j ava 2 s . co m // resize iframe target.appendJavaScript("setMainFrameHeight(window.name);"); } } }; editButton.add(new Label("editButtonLabel", new ResourceModel("button.edit"))); editButton.setOutputMarkupId(true); if (userProfile.isLocked() && !sakaiProxy.isSuperUser()) { editButton.setVisible(false); } add(editButton); }
From source file:org.sakaiproject.profile2.tool.pages.panels.MyBusinessEdit.java
License:Educational Community License
private AjaxFallbackButton createCancelChangesButton(final String id, final UserProfile userProfile, Form form) {/*from ww w . j a v a 2s. c om*/ AjaxFallbackButton cancelButton = new AjaxFallbackButton("cancel", new ResourceModel("button.cancel"), form) { private static final long serialVersionUID = 1L; protected void onSubmit(AjaxRequestTarget target, Form form) { // undo any changes in progress for (CompanyProfile profile : companyProfilesToAdd) { userProfile.removeCompanyProfile(profile); } for (CompanyProfile profile : companyProfilesToRemove) { userProfile.addCompanyProfile(profile); } Component newPanel = new MyBusinessDisplay(id, userProfile); newPanel.setOutputMarkupId(true); MyBusinessEdit.this.replaceWith(newPanel); if (target != null) { target.add(newPanel); target.appendJavaScript("setMainFrameHeight(window.name);"); } } }; cancelButton.setDefaultFormProcessing(false); return cancelButton; }
From source file:org.sakaiproject.profile2.tool.pages.panels.MyBusinessEdit.java
License:Educational Community License
private AjaxFallbackButton createSaveChangesButton(final String id, final UserProfile userProfile, Form form, final Label formFeedback) { AjaxFallbackButton submitButton = new AjaxFallbackButton("submit", new ResourceModel("button.save.changes"), form) {/*from w w w .j av a 2s . c om*/ private static final long serialVersionUID = 1L; protected void onSubmit(AjaxRequestTarget target, Form form) { if (save(form)) { // post update event sakaiProxy.postEvent(ProfileConstants.EVENT_PROFILE_BUSINESS_UPDATE, "/profile/" + userProfile.getUserUuid(), true); //post to wall if enabled if (true == sakaiProxy.isWallEnabledGlobally() && false == sakaiProxy.isSuperUserAndProxiedToUser(userProfile.getUserUuid())) { wallLogic.addNewEventToWall(ProfileConstants.EVENT_PROFILE_BUSINESS_UPDATE, sakaiProxy.getCurrentUserId()); } // repaint panel Component newPanel = new MyBusinessDisplay(id, userProfile); newPanel.setOutputMarkupId(true); MyBusinessEdit.this.replaceWith(newPanel); if (target != null) { target.add(newPanel); // resize iframe target.appendJavaScript("setMainFrameHeight(window.name);"); } } else { formFeedback.setDefaultModel(new ResourceModel("error.profile.save.business.failed")); formFeedback.add(new AttributeModifier("class", true, new Model<String>("save-failed-error"))); target.add(formFeedback); } } }; return submitButton; }
From source file:org.sakaiproject.profile2.tool.pages.panels.MyBusinessEdit.java
License:Educational Community License
private AjaxFallbackButton createRemoveCompanyProfileButton(final String id, final UserProfile userProfile, Form form) {/* w w w . j a v a 2s .c om*/ AjaxFallbackButton removeCompanyProfileButton = new AjaxFallbackButton("removeCompanyProfileButton", new ResourceModel("button.business.remove.profile"), form) { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { // if there's nothing to remove if (-1 == companyProfileTabs.getSelectedTab()) { return; } CompanyProfile companyProfileToRemove = userProfile.getCompanyProfiles() .get(companyProfileTabs.getSelectedTab()); userProfile.removeCompanyProfile(companyProfileToRemove); // this check is in case it's been added but never saved if (companyProfilesToAdd.contains(companyProfileToRemove)) { companyProfilesToAdd.remove(companyProfileToRemove); } else { companyProfilesToRemove.add(companyProfileToRemove); } Component newPanel = new MyBusinessEdit(id, userProfile, companyProfilesToAdd, companyProfilesToRemove, TabDisplay.START); newPanel.setOutputMarkupId(true); MyBusinessEdit.this.replaceWith(newPanel); if (target != null) { target.add(newPanel); target.appendJavaScript("setMainFrameHeight(window.name);"); } } }; return removeCompanyProfileButton; }
From source file:org.sakaiproject.profile2.tool.pages.panels.MyBusinessEdit.java
License:Educational Community License
private AjaxFallbackButton createAddCompanyProfileButton(final String id, final UserProfile userProfile, Form form, final Label formFeedback) { AjaxFallbackButton addCompanyProfileButton = new AjaxFallbackButton("addCompanyProfileButton", new ResourceModel("button.business.add.profile"), form) { private static final long serialVersionUID = 1L; @Override/* w w w . j av a 2s .co m*/ protected void onSubmit(AjaxRequestTarget target, Form<?> form) { CompanyProfile companyProfileToAdd = new CompanyProfile(userProfile.getUserUuid(), "", "", ""); companyProfilesToAdd.add(companyProfileToAdd); userProfile.addCompanyProfile(companyProfileToAdd); Component newPanel = new MyBusinessEdit(id, userProfile, companyProfilesToAdd, companyProfilesToRemove, TabDisplay.END); newPanel.setOutputMarkupId(true); MyBusinessEdit.this.replaceWith(newPanel); if (target != null) { target.add(newPanel); // resize iframe target.prependJavaScript("setMainFrameHeight(window.name);"); } } }; return addCompanyProfileButton; }
From source file:org.sakaiproject.profile2.tool.pages.panels.MyContactDisplay.java
License:Educational Community License
public MyContactDisplay(final String id, final UserProfile userProfile) { super(id);//from ww w .j a v a 2 s. com //this panel stuff final Component thisPanel = this; //get info from userProfile since we need to validate it and turn things off if not set. String email = userProfile.getEmail(); String homepage = userProfile.getHomepage(); String workphone = userProfile.getWorkphone(); String homephone = userProfile.getHomephone(); String mobilephone = userProfile.getMobilephone(); String facsimile = userProfile.getFacsimile(); //heading add(new Label("heading", new ResourceModel("heading.contact"))); //email WebMarkupContainer emailContainer = new WebMarkupContainer("emailContainer"); emailContainer.add(new Label("emailLabel", new ResourceModel("profile.email"))); emailContainer.add(new Label("email", email)); add(emailContainer); if (StringUtils.isBlank(email)) { emailContainer.setVisible(false); } else { visibleFieldCount++; } //homepage WebMarkupContainer homepageContainer = new WebMarkupContainer("homepageContainer"); homepageContainer.add(new Label("homepageLabel", new ResourceModel("profile.homepage"))); homepageContainer.add(new ExternalLink("homepage", homepage, homepage)); add(homepageContainer); if (StringUtils.isBlank(homepage)) { homepageContainer.setVisible(false); } else { visibleFieldCount++; } //work phone WebMarkupContainer workphoneContainer = new WebMarkupContainer("workphoneContainer"); workphoneContainer.add(new Label("workphoneLabel", new ResourceModel("profile.phone.work"))); workphoneContainer.add(new Label("workphone", workphone)); add(workphoneContainer); if (StringUtils.isBlank(workphone)) { workphoneContainer.setVisible(false); } else { visibleFieldCount++; } //home phone WebMarkupContainer homephoneContainer = new WebMarkupContainer("homephoneContainer"); homephoneContainer.add(new Label("homephoneLabel", new ResourceModel("profile.phone.home"))); homephoneContainer.add(new Label("homephone", homephone)); add(homephoneContainer); if (StringUtils.isBlank(homephone)) { homephoneContainer.setVisible(false); } else { visibleFieldCount++; } //mobile phone WebMarkupContainer mobilephoneContainer = new WebMarkupContainer("mobilephoneContainer"); mobilephoneContainer.add(new Label("mobilephoneLabel", new ResourceModel("profile.phone.mobile"))); mobilephoneContainer.add(new Label("mobilephone", mobilephone)); add(mobilephoneContainer); if (StringUtils.isBlank(mobilephone)) { mobilephoneContainer.setVisible(false); } else { visibleFieldCount++; } //facsimile WebMarkupContainer facsimileContainer = new WebMarkupContainer("facsimileContainer"); facsimileContainer.add(new Label("facsimileLabel", new ResourceModel("profile.phone.facsimile"))); facsimileContainer.add(new Label("facsimile", facsimile)); add(facsimileContainer); if (StringUtils.isBlank(facsimile)) { facsimileContainer.setVisible(false); } else { visibleFieldCount++; } //edit button AjaxFallbackLink editButton = new AjaxFallbackLink("editButton") { private static final long serialVersionUID = 1L; public void onClick(AjaxRequestTarget target) { Component newPanel = new MyContactEdit(id, userProfile); newPanel.setOutputMarkupId(true); thisPanel.replaceWith(newPanel); if (target != null) { target.add(newPanel); //resize iframe target.appendJavaScript("setMainFrameHeight(window.name);"); } } }; editButton.add(new Label("editButtonLabel", new ResourceModel("button.edit"))); editButton.setOutputMarkupId(true); if (userProfile.isLocked() && !sakaiProxy.isSuperUser()) { editButton.setVisible(false); } add(editButton); //no fields message Label noFieldsMessage = new Label("noFieldsMessage", new ResourceModel("text.no.fields")); add(noFieldsMessage); if (visibleFieldCount > 0) { noFieldsMessage.setVisible(false); } }