Java Code Examples for org.apache.wicket.markup.html.basic.Label#setVisible()
The following examples show how to use
org.apache.wicket.markup.html.basic.Label#setVisible() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HRListEntryPanel.java From projectforge-webapp with GNU General Public License v3.0 | 6 votes |
public HRListEntryPanel(final String id, final HRFilter filter, final BigDecimal plannedDays, final BigDecimal actualDays, final Link< ? > link) { super(id); final BigDecimal planned = filter.isShowPlanning() == true ? plannedDays : null; final BigDecimal actual = filter.isShowBookedTimesheets() == true ? actualDays : null; final Label plannedDaysLabel = new Label("plannedDays", NumberFormatter.format(planned, 2)); add(plannedDaysLabel.setRenderBodyOnly(true)); if (NumberHelper.isNotZero(plannedDays) == false) { plannedDaysLabel.setVisible(false); } add(link); final Label actualDaysLabel = new Label("actualDays", "(" + NumberFormatter.format(actual, 2) + ")"); link.add(actualDaysLabel.setRenderBodyOnly(true)); if (NumberHelper.isNotZero(actualDays) == false) { link.setVisible(false); } }
Example 2
Source File: ReportRunHistoryPanel.java From nextreports-server with Apache License 2.0 | 6 votes |
public ReportRunHistoryPanel(String id, final Report report) { super(id); String text = ""; if (report != null) { text = report.getName(); } Label name = new Label("reportName", new Model<String>(text)); if (report == null) { name.setVisible(false); } add(name); add(new RunHistoryPanel("runHistoryPanel", report)); add(new DeleteHistoryPanel("deleteHistoryPanel", report)); }
Example 3
Source File: CreateWorksitePanel.java From sakai with Educational Community License v2.0 | 6 votes |
private void resetPanel(AjaxRequestTarget target, final TextField<String> siteNameField, final Palette<Person> palette, Label formFeedback) { siteNameField.setModelObject(""); // there is quite possibly a better way of doing this List<Person> remove = new ArrayList<Person>(); for (Person person : palette.getModelCollection()) { remove.add(person); } palette.getModelCollection().removeAll(remove); formFeedback.setVisible(false); target.add(siteNameField); target.appendJavaScript("$('#" + CreateWorksitePanel.this.getMarkupId() + "').slideUp();"); target.appendJavaScript("fixWindowVertical();"); }
Example 4
Source File: CreateWorksitePanel.java From sakai with Educational Community License v2.0 | 6 votes |
private void resetPanel(AjaxRequestTarget target, final TextField<String> siteNameField, final Palette<Person> palette, Label formFeedback) { siteNameField.setModelObject(""); // there is quite possibly a better way of doing this List<Person> remove = new ArrayList<Person>(); for (Person person : palette.getModelCollection()) { remove.add(person); } palette.getModelCollection().removeAll(remove); formFeedback.setVisible(false); target.add(siteNameField); target.appendJavaScript("$('#" + CreateWorksitePanel.this.getMarkupId() + "').slideUp();"); target.appendJavaScript("fixWindowVertical();"); }
Example 5
Source File: AbstractUnsecureBasePage.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
/** * Convenience method for creating a component which is in the mark-up file but should not be visible. * @param wicketId * @return */ public static Label createInvisibleDummyComponent(final String wicketId) { final Label dummyLabel = new Label(wicketId); dummyLabel.setVisible(false); return dummyLabel; }
Example 6
Source File: AbstractWebPage.java From yes-cart with Apache License 2.0 | 5 votes |
@Override protected void onBeforeRender() { super.onBeforeRender(); // need to call super first because components need to perform before render to initialise first addOrReplace(new Label( PAGE_TITLE, getPageTitle())); final Label desc = new Label(DESCRIPTION, ""); final IModel<String> descModel = getDescription(); desc.add(new AttributeAppender("content", descModel, " ")); addOrReplace(desc); desc.setVisible(descModel != null); final Label keywords = new Label(KEYWORDS, ""); final IModel<String> keywordsModel = getKeywords(); keywords.add(new AttributeAppender("content", keywordsModel, " ")); addOrReplace(keywords); keywords.setVisible(keywordsModel != null); Label created = new Label(CREATED, ""); created.add(new AttributeAppender("content", getCreated(), " ")); addOrReplace(created); final Label relCanonical = new Label(CANONICAL, ""); final IModel<String> relCanonicalModel = getRelCanonical(); relCanonical.add(new AttributeAppender("href", relCanonicalModel, " ")); addOrReplace(relCanonical); relCanonical.setVisible(relCanonicalModel != null); determineStatefulComponentOnDev(); }
Example 7
Source File: MyNamePronunciationDisplay.java From sakai with Educational Community License v2.0 | 5 votes |
public MyNamePronunciationDisplay(final String id, final UserProfile userProfile) { super(id); log.debug("MyNamePronunciationDisplay()"); final Component thisPanel = this; this.userProfile = userProfile; //heading add(new Label("heading", new ResourceModel("heading.name.pronunciation"))); addPhoneticPronunciation(); addNameRecord(); AjaxFallbackLink editButton = new AjaxFallbackLink("editButton", new ResourceModel("button.edit")) { public void onClick(AjaxRequestTarget target) { Component newPanel = new MyNamePronunciationEdit(id, userProfile); newPanel.setOutputMarkupId(true); thisPanel.replaceWith(newPanel); if(target != null) { target.add(newPanel); 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); } }
Example 8
Source File: MenuItem.java From sakai with Educational Community License v2.0 | 5 votes |
public MenuItem(String id, IModel itemText, Class itemPageClass, PageParameters pageParameters, boolean first, Class menusCurrentPageClass) { super(id); boolean currentPage = itemPageClass.equals(menusCurrentPageClass); // link version menuItemLinkHolder = new WebMarkupContainer("menuItemLinkHolder"); menuItemLink = new BookmarkablePageLink("menuItemLink", itemPageClass, pageParameters); menuLinkText = new Label("menuLinkText", itemText); menuLinkText.setRenderBodyOnly(true); menuItemLink.add(menuLinkText); menuItemLinkHolder.add(menuItemLink); menuItemLinkHolder.setVisible(!currentPage); add(menuItemLinkHolder); // span version menuItemLabel = new Label("menuItemLabel", itemText); menuItemLabel.setVisible(currentPage); add(menuItemLabel); //add current page styling AttributeModifier currentPageStyling = new AttributeModifier("class", new Model("current")); if(currentPage) { menuItemLabel.add(currentPageStyling); } if(first) { add(new AttributeModifier("class", new Model("firstToolBarItem"))); } }
Example 9
Source File: OrienteerCloudOModulesConfigurationsPanel.java From Orienteer with Apache License 2.0 | 5 votes |
public OrienteerCloudOModulesConfigurationsPanel(String id, final OArtifactsModalWindowPage windowPage, ISortableDataProvider<OArtifact, String> provider) { super(id); setOutputMarkupPlaceholderTag(true); Form orienteerModulesForm = new Form("orienteerCloudOModulesConfigsForm"); Label feedback = new Label("feedback"); feedback.setVisible(false); feedback.setOutputMarkupPlaceholderTag(true); IModel<DisplayMode> modeModel = DisplayMode.VIEW.asModel(); List<IColumn<OArtifact, String>> columns = getColumns(modeModel); OrienteerDataTable<OArtifact, String> table = new OrienteerDataTable<>("availableModules", columns, provider, 10); table.addCommand(new AjaxCommand<OArtifact>(new ResourceModel(BACK_BUT), table) { @Override public void onClick(Optional<AjaxRequestTarget> targetOptional) { windowPage.showOrienteerModulesPanel(false); targetOptional.ifPresent(target->target.add(windowPage)); } @Override protected void onInstantiation() { super.onInstantiation(); setIcon(FAIconType.angle_left); setBootstrapType(BootstrapType.PRIMARY); setAutoNotify(false); } }); table.addCommand(new InstallOModuleCommand(table, windowPage, false, feedback)); table.addCommand(new InstallOModuleCommand(table, windowPage,true, feedback)); orienteerModulesForm.add(table); orienteerModulesForm.add(feedback); add(orienteerModulesForm); }
Example 10
Source File: DynamicParameterRuntimePanel.java From nextreports-server with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") protected void createItem(final ListItem<QueryParameter> item) { super.createItem(item); // add dynamic label and checkbox only for scheduler final QueryParameter parameter = item.getModelObject(); boolean hasDefaultSource = (parameter.getDefaultSource() != null) && (parameter.getDefaultSource().trim().length() > 0); boolean hasSource = (parameter.getSource() != null) && (parameter.getSource().trim().length() > 0); final IModel dynamicModel = new PropertyModel(runtimeModel.getParameters(), parameter.getName() + ".dynamic"); enableItem(item, dynamicModel, null); final CheckBox dynamicChkBox = new CheckBox("dynamicChkBox", dynamicModel); dynamicChkBox.setVisible(!runNow && (hasDefaultSource || hasSource)); dynamicChkBox.add(new AjaxFormComponentUpdatingBehavior("onchange") { protected void onUpdate(AjaxRequestTarget target) { enableItem(item, dynamicModel, target); } }); item.add(dynamicChkBox.setOutputMarkupId(true)); Label dynamicLabel = new Label("dynamicLabel", getString("DynamicParameterRuntimePanel.dynamic")); dynamicLabel.setVisible(!runNow && (hasDefaultSource || hasSource)); item.add(dynamicLabel.setOutputMarkupId(true)); }
Example 11
Source File: Menu.java From sakai with Educational Community License v2.0 | 4 votes |
/** * Render Sakai Menu */ @Override protected void onInitialize() { super.onInitialize(); // current page Class currentPageClass = getPage().getClass(); PageParameters pageParameters = new PageParameters(); if(siteId != null) { pageParameters.set("siteId", siteId); } String realSiteId = Locator.getFacade().getToolManager().getCurrentPlacement().getContext(); boolean isSiteStatsAdminPage = Locator.getFacade().getStatsAuthz().isSiteStatsAdminPage(); boolean isBrowsingThisSite = siteId != null && siteId.equals(realSiteId); // Site display String siteTitle = null; try{ siteTitle = Locator.getFacade().getSiteService().getSite(siteId).getTitle(); }catch(IdUnusedException e){ siteTitle = siteId; } Label siteDisplay = new Label("siteDisplay", siteTitle); boolean siteDisplayVisible = isSiteStatsAdminPage && !isBrowsingThisSite; siteDisplay.setVisible(siteDisplayVisible); add(siteDisplay); // Overview boolean overviewVisible = !AdminPage.class.equals(currentPageClass) && (Locator.getFacade().getStatsManager().getEnableSiteVisits() || Locator.getFacade().getStatsManager().isEnableSiteActivity()); MenuItem overview = new MenuItem("overview", new ResourceModel("menu_overview"), OverviewPage.class, pageParameters, !siteDisplayVisible, currentPageClass); overview.setVisible(overviewVisible); add(overview); // Reports MenuItem reports = new MenuItem("reports", new ResourceModel("menu_reports"), ReportsPage.class, pageParameters, false, currentPageClass); if(!overviewVisible) { reports.add(new AttributeModifier("class", new Model("firstToolBarItem"))); } add(reports); // User Activity MenuItem userActivity = new MenuItem("userActivity", new ResourceModel("menu_useractivity"), UserActivityPage.class, pageParameters, false, currentPageClass); boolean displayUserActivity = siteId != null && Locator.getFacade().getStatsAuthz().canCurrentUserTrackInSite(siteId) && Locator.getFacade().getStatsManager().isDisplayDetailedEvents(); userActivity.setVisible(displayUserActivity); add(userActivity); // Preferences MenuItem preferences = new MenuItem("preferences", new ResourceModel("menu_prefs"), PreferencesPage.class, pageParameters, false, currentPageClass); add(preferences); }
Example 12
Source File: MyStudentDisplay.java From sakai with Educational Community License v2.0 | 4 votes |
public MyStudentDisplay(final String id, final UserProfile userProfile) { super(id); //heading add(new Label("heading", new ResourceModel("heading.student"))); String course = userProfile.getCourse(); String subjects = userProfile.getSubjects(); int visibleFieldCount = 0; //course WebMarkupContainer courseContainer = new WebMarkupContainer("courseContainer"); courseContainer.add(new Label("courseLabel", new ResourceModel("profile.course"))); courseContainer.add(new Label("course", course)); add(courseContainer); if(StringUtils.isBlank(course)) { courseContainer.setVisible(false); } else { visibleFieldCount++; } //subjects WebMarkupContainer subjectsContainer = new WebMarkupContainer("subjectsContainer"); subjectsContainer.add(new Label("subjectsLabel", new ResourceModel("profile.subjects"))); subjectsContainer.add(new Label("subjects", subjects)); add(subjectsContainer); if(StringUtils.isBlank(subjects)) { subjectsContainer.setVisible(false); } else { visibleFieldCount++; } //edit button AjaxFallbackLink editButton = new AjaxFallbackLink("editButton", new ResourceModel("button.edit")) { private static final long serialVersionUID = 1L; public void onClick(AjaxRequestTarget target) { Component newPanel = new MyStudentEdit(id, userProfile); newPanel.setOutputMarkupId(true); MyStudentDisplay.this.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); } }
Example 13
Source File: MyBusinessEdit.java From sakai with Educational Community License v2.0 | 4 votes |
public MyBusinessEdit(final String id, final UserProfile userProfile, List<CompanyProfile> companyProfilesToAdd, List<CompanyProfile> companyProfilesToRemove, TabDisplay tabDisplay) { super(id); log.debug("MyBusinessEdit()"); this.companyProfilesToAdd = companyProfilesToAdd; this.companyProfilesToRemove = companyProfilesToRemove; // heading add(new Label("heading", new ResourceModel("heading.business.edit"))); // setup form Form form = new Form("form", new Model(userProfile)); form.setOutputMarkupId(true); // form submit feedback final Label formFeedback = new Label("formFeedback"); formFeedback.setOutputMarkupPlaceholderTag(true); form.add(formFeedback); // add warning message if superUser and not editing own profile Label editWarning = new Label("editWarning"); editWarning.setVisible(false); if (sakaiProxy.isSuperUserAndProxiedToUser( userProfile.getUserUuid())) { editWarning.setDefaultModel(new StringResourceModel( "text.edit.other.warning", null, new Object[] { userProfile .getDisplayName() })); editWarning.setEscapeModelStrings(false); editWarning.setVisible(true); } form.add(editWarning); // business biography WebMarkupContainer businessBiographyContainer = new WebMarkupContainer( "businessBiographyContainer"); businessBiographyContainer.add(new Label("businessBiographyLabel", new ResourceModel("profile.business.bio"))); TextArea businessBiography = new TextArea( "businessBiography", new PropertyModel<String>(userProfile, "businessBiography")); businessBiography.setMarkupId("businessbioinput"); businessBiography.setOutputMarkupId(true); //businessBiography.setEditorConfig(CKEditorConfig.createCkConfig()); businessBiographyContainer.add(businessBiography); form.add(businessBiographyContainer); // company profiles WebMarkupContainer companyProfileEditsContainer = createCompanyProfileEditsContainer(userProfile, tabDisplay); form.add(companyProfileEditsContainer); AjaxFallbackButton addCompanyProfileButton = createAddCompanyProfileButton( id, userProfile, form, formFeedback); form.add(addCompanyProfileButton); AjaxFallbackButton removeCompanyProfileButton = createRemoveCompanyProfileButton( id, userProfile, form); form.add(removeCompanyProfileButton); AjaxFallbackButton submitButton = createSaveChangesButton(id, userProfile, form, formFeedback); //submitButton.add(new CKEditorTextArea.CKEditorAjaxSubmitModifier()); form.add(submitButton); AjaxFallbackButton cancelButton = createCancelChangesButton(id, userProfile, form); form.add(cancelButton); add(form); }
Example 14
Source File: GalleryImageEdit.java From sakai with Educational Community License v2.0 | 4 votes |
public GalleryImageEdit(String id, final String userId, final GalleryImage image, final long galleryPageIndex) { super(id); log.debug("GalleryImageEdit()"); // feedback label for user alert in event remove/set actions fail final Label formFeedback = new Label("formFeedback"); formFeedback.setOutputMarkupPlaceholderTag(true); add(formFeedback); Form imageEditForm = new Form("galleryImageEditForm"); imageEditForm.setOutputMarkupId(true); add(imageEditForm); imageOptionsContainer = new WebMarkupContainer("galleryImageOptionsContainer"); imageOptionsContainer.setOutputMarkupId(true); imageOptionsContainer.setOutputMarkupPlaceholderTag(true); imageOptionsContainer.add(new Label("removePictureLabel", new ResourceModel("pictures.removepicture"))); AjaxFallbackButton removePictureButton = createRemovePictureButton(imageEditForm); imageOptionsContainer.add(removePictureButton); Label setProfileImageLabel = new Label("setProfileImageLabel", new ResourceModel("pictures.setprofileimage")); imageOptionsContainer.add(setProfileImageLabel); AjaxFallbackButton setProfileImageButton = createSetProfileImageButton(imageEditForm); if ((true == sakaiProxy.isOfficialImageEnabledGlobally() && false == sakaiProxy.isUsingOfficialImageButAlternateSelectionEnabled()) || preferencesLogic.getPreferencesRecordForUser(userId).isUseOfficialImage()) { setProfileImageLabel.setVisible(false); setProfileImageButton.setVisible(false); } imageOptionsContainer.add(setProfileImageButton); imageEditForm.add(imageOptionsContainer); removeConfirmContainer = new WebMarkupContainer("galleryRemoveImageConfirmContainer"); removeConfirmContainer.setOutputMarkupId(true); removeConfirmContainer.setOutputMarkupPlaceholderTag(true); Label removeConfirmLabel = new Label("removePictureConfirmLabel", new ResourceModel("pictures.removepicture.confirm")); removeConfirmContainer.add(removeConfirmLabel); AjaxFallbackButton removeConfirmButton = createRemoveConfirmButton( userId, image, (int) galleryPageIndex, formFeedback, imageEditForm); //removeConfirmButton.add(new FocusOnLoadBehaviour()); removeConfirmContainer.add(removeConfirmButton); AjaxFallbackButton removeCancelButton = createRemoveCancelButton(imageEditForm); removeConfirmContainer.add(removeCancelButton); removeConfirmContainer.setVisible(false); imageEditForm.add(removeConfirmContainer); setProfileImageConfirmContainer = new WebMarkupContainer("gallerySetProfileImageConfirmContainer"); setProfileImageConfirmContainer.setOutputMarkupId(true); setProfileImageConfirmContainer.setOutputMarkupPlaceholderTag(true); Label setProfileImageConfirmLabel = new Label("setProfileImageConfirmLabel", new ResourceModel("pictures.setprofileimage.confirm")); setProfileImageConfirmContainer.add(setProfileImageConfirmLabel); AjaxFallbackButton setProfileImageConfirmButton = createSetProfileImageConfirmButton( userId, image, (int) galleryPageIndex, formFeedback, imageEditForm); //setProfileImageConfirmButton.add(new FocusOnLoadBehaviour()); setProfileImageConfirmContainer.add(setProfileImageConfirmButton); AjaxFallbackButton setProfileImageCancelButton = createSetProfileImageCancelButton(imageEditForm); setProfileImageConfirmContainer.add(setProfileImageCancelButton); setProfileImageConfirmContainer.setVisible(false); imageEditForm.add(setProfileImageConfirmContainer); add(new GalleryImageRenderer("galleryImageMainRenderer", image .getMainResource())); }
Example 15
Source File: AssociationTransformPage.java From ontopia with Apache License 2.0 | 4 votes |
private void createPanel() { Form<Object> form = new Form<Object>("form"); add(form); AssociationType associationType = getAssociationType(); // get used role type combinations Collection<List<RoleType>> roleCombos = associationType.getUsedRoleTypeCombinations(); // then remove the combination that is valid according to declaration List<RoleType> declaredRoleTypes = associationType.getDeclaredRoleTypes(); Collections.sort(declaredRoleTypes, new Comparator<RoleType>() { @Override public int compare(RoleType rt1, RoleType rt2) { return ObjectIdComparator.INSTANCE.compare(rt1.getTopicIF(), rt2.getTopicIF()); } }); roleCombos.remove(declaredRoleTypes); RepeatingView rview = new RepeatingView("combos"); Iterator<List<RoleType>> citer = roleCombos.iterator(); while (citer.hasNext()) { List<RoleType> roleTypes = citer.next(); if (roleTypes.size() != declaredRoleTypes.size()) { citer.remove(); continue; } rview.add(new AssociationTransformerPanel(rview.newChildId(), associationType, roleTypes)); } form.add(rview); Label message = new Label("message", new ResourceModel("transform.association.instances.none")); message.setVisible(roleCombos.isEmpty()); form.add(message); Button button = new Button("button", new ResourceModel("button.ok")); button.setVisible(roleCombos.isEmpty()); button.add(new AjaxFormComponentUpdatingBehavior("onclick") { @Override protected void onUpdate(AjaxRequestTarget target) { Topic t = getAssociationType(); Map<String,String> pageParametersMap = new HashMap<String,String>(); pageParametersMap.put("topicMapId", t.getTopicMap().getId()); pageParametersMap.put("topicId", t.getId()); pageParametersMap.put("ontology", "true"); setResponsePage(InstancePage.class, new PageParameters(pageParametersMap)); } }); form.add(button); }
Example 16
Source File: OrienteerArtifactsManagerWidget.java From Orienteer with Apache License 2.0 | 4 votes |
public OrienteerArtifactsManagerWidget(String id, IModel<OArtifact> model, IModel<ODocument> widgetDocumentModel) { super(id, model, widgetDocumentModel); Form form = new Form("form"); Label feedback = new Label("feedback"); feedback.setOutputMarkupPlaceholderTag(true); feedback.setVisible(false); IModel<DisplayMode> modeModel = DisplayMode.VIEW.asModel(); List<IColumn<OArtifact, String>> columns = getColumns(modeModel); IModel<List<OArtifact>> installedModulesModel = new AbstractListModel<OArtifact>() { @Override protected Collection<OArtifact> getData() { return OrienteerClassLoaderUtil.getOArtifactsMetadataAsList(); } }; ISortableDataProvider<OArtifact, String> installedModulesProvider = new JavaSortableDataProvider<>(installedModulesModel); IModel<List<OArtifact>> availableModulesModel = new AbstractListModel<OArtifact>() { List<OArtifact> downloadedModules; @Override protected Collection<OArtifact> getData() { if(downloadedModules==null || downloadedModules.isEmpty()) { try { downloadedModules = OrienteerClassLoaderUtil.getOrienteerArtifactsFromServer(); } catch (IOException e) { LOG.error("It's not possible to download modules file from the internet", e); error(e.getMessage()); } } return downloadedModules; } }; ISortableDataProvider<OArtifact, String> availableModulesProvider = new JavaSortableDataProvider<>(availableModulesModel); final OrienteerDataTable<OArtifact, String> modulesTable = new OrienteerDataTable<>("oArtifactsTable", columns, installedModulesProvider, 20); modulesTable.addCommand(new AddOArtifactCommand(modulesTable, new OArtifactsModalWindowPage(availableModulesProvider))); modulesTable.addCommand(new EditOArtifactsCommand(modulesTable, modeModel)); modulesTable.addCommand(new SaveOArtifactCommand(modulesTable, modeModel, feedback)); modulesTable.addCommand(new DeleteOArtifactCommand(modulesTable)); modulesTable.addCommand(new ReloadOrienteerCommand(modulesTable, new ResourceModel(RELOAD_ORIENTEER))); form.add(modulesTable); form.add(feedback); add(form); }
Example 17
Source File: ListAccessors.java From sakai with Educational Community License v2.0 | 4 votes |
public ListAccessors() { String userId = sessionManager.getCurrentSessionUserId(); Collection<Accessor> accessors = oAuthService.getAccessAccessorForUser(userId); ListView<Accessor> accessorList = new ListView<Accessor>("accessorlist", new ArrayList<>(accessors)) { @Override protected void populateItem(ListItem<Accessor> components) { try { final Consumer consumer = oAuthService.getConsumer(components.getModelObject().getConsumerId()); ExternalLink consumerHomepage = new ExternalLink("consumerUrl", consumer.getUrl(), consumer.getName()); consumerHomepage.add(new AttributeModifier("target", "_blank")); consumerHomepage.setEnabled(consumer.getUrl() != null && !consumer.getUrl().isEmpty()); components.add(consumerHomepage); components.add(new Label("consumerDescription", consumer.getDescription())); components.add(new Label("creationDate", new StringResourceModel("creation.date", new Model<>(components.getModelObject().getCreationDate())))); components.add(new Label("expirationDate", new StringResourceModel("expiration.date", new Model<>(components.getModelObject().getExpirationDate())))); components.add(new Link<Accessor>("delete", components.getModel()) { @Override public void onClick() { try { oAuthService.revokeAccessor(getModelObject().getToken()); setResponsePage(getPage().getClass()); getSession().info(consumer.getName() + "' token has been removed."); } catch (Exception e) { warn("Couldn't remove " + consumer.getName() + "'s token': " + e.getLocalizedMessage()); } } }); } catch (InvalidConsumerException invalidConsumerException) { // Invalid consumer, it is probably deleted // For security reasons, this token should be revoked oAuthService.revokeAccessor(components.getModelObject().getToken()); components.setVisible(false); } } @Override public boolean isVisible() { return !getModelObject().isEmpty() && super.isVisible(); } }; add(accessorList); Label noAccessorLabel = new Label("noAccessor", new ResourceModel("no.accessor")); noAccessorLabel.setVisible(!accessorList.isVisible()); add(noAccessorLabel); }
Example 18
Source File: MyStudentDisplay.java From sakai with Educational Community License v2.0 | 4 votes |
public MyStudentDisplay(final String id, final UserProfile userProfile) { super(id); //heading add(new Label("heading", new ResourceModel("heading.student"))); String course = userProfile.getCourse(); String subjects = userProfile.getSubjects(); int visibleFieldCount = 0; //course WebMarkupContainer courseContainer = new WebMarkupContainer("courseContainer"); courseContainer.add(new Label("courseLabel", new ResourceModel("profile.course"))); courseContainer.add(new Label("course", course)); add(courseContainer); if(StringUtils.isBlank(course)) { courseContainer.setVisible(false); } else { visibleFieldCount++; } //subjects WebMarkupContainer subjectsContainer = new WebMarkupContainer("subjectsContainer"); subjectsContainer.add(new Label("subjectsLabel", new ResourceModel("profile.subjects"))); subjectsContainer.add(new Label("subjects", subjects)); add(subjectsContainer); if(StringUtils.isBlank(subjects)) { subjectsContainer.setVisible(false); } else { visibleFieldCount++; } //edit button AjaxFallbackLink editButton = new AjaxFallbackLink("editButton", new ResourceModel("button.edit")) { private static final long serialVersionUID = 1L; public void onClick(AjaxRequestTarget target) { Component newPanel = new MyStudentEdit(id, userProfile); newPanel.setOutputMarkupId(true); MyStudentDisplay.this.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); } }
Example 19
Source File: MyBusinessEdit.java From sakai with Educational Community License v2.0 | 4 votes |
public MyBusinessEdit(final String id, final UserProfile userProfile, List<CompanyProfile> companyProfilesToAdd, List<CompanyProfile> companyProfilesToRemove, TabDisplay tabDisplay) { super(id); log.debug("MyBusinessEdit()"); this.companyProfilesToAdd = companyProfilesToAdd; this.companyProfilesToRemove = companyProfilesToRemove; // heading add(new Label("heading", new ResourceModel("heading.business.edit"))); // setup form Form form = new Form("form", new Model(userProfile)); form.setOutputMarkupId(true); // form submit feedback final Label formFeedback = new Label("formFeedback"); formFeedback.setOutputMarkupPlaceholderTag(true); form.add(formFeedback); // add warning message if superUser and not editing own profile Label editWarning = new Label("editWarning"); editWarning.setVisible(false); if (sakaiProxy.isSuperUserAndProxiedToUser( userProfile.getUserUuid())) { editWarning.setDefaultModel(new StringResourceModel( "text.edit.other.warning", null, new Object[] { userProfile .getDisplayName() })); editWarning.setEscapeModelStrings(false); editWarning.setVisible(true); } form.add(editWarning); // business biography WebMarkupContainer businessBiographyContainer = new WebMarkupContainer( "businessBiographyContainer"); businessBiographyContainer.add(new Label("businessBiographyLabel", new ResourceModel("profile.business.bio"))); TextArea businessBiography = new TextArea( "businessBiography", new PropertyModel<String>(userProfile, "businessBiography")); businessBiography.setMarkupId("businessbioinput"); businessBiography.setOutputMarkupId(true); //businessBiography.setEditorConfig(CKEditorConfig.createCkConfig()); businessBiographyContainer.add(businessBiography); form.add(businessBiographyContainer); // company profiles WebMarkupContainer companyProfileEditsContainer = createCompanyProfileEditsContainer(userProfile, tabDisplay); form.add(companyProfileEditsContainer); AjaxFallbackButton addCompanyProfileButton = createAddCompanyProfileButton( id, userProfile, form, formFeedback); form.add(addCompanyProfileButton); AjaxFallbackButton removeCompanyProfileButton = createRemoveCompanyProfileButton( id, userProfile, form); form.add(removeCompanyProfileButton); AjaxFallbackButton submitButton = createSaveChangesButton(id, userProfile, form, formFeedback); //submitButton.add(new CKEditorTextArea.CKEditorAjaxSubmitModifier()); form.add(submitButton); AjaxFallbackButton cancelButton = createCancelChangesButton(id, userProfile, form); form.add(cancelButton); add(form); }
Example 20
Source File: GalleryImageEdit.java From sakai with Educational Community License v2.0 | 4 votes |
public GalleryImageEdit(String id, final String userId, final GalleryImage image, final long galleryPageIndex) { super(id); log.debug("GalleryImageEdit()"); // feedback label for user alert in event remove/set actions fail final Label formFeedback = new Label("formFeedback"); formFeedback.setOutputMarkupPlaceholderTag(true); add(formFeedback); Form imageEditForm = new Form("galleryImageEditForm"); imageEditForm.setOutputMarkupId(true); add(imageEditForm); imageOptionsContainer = new WebMarkupContainer("galleryImageOptionsContainer"); imageOptionsContainer.setOutputMarkupId(true); imageOptionsContainer.setOutputMarkupPlaceholderTag(true); imageOptionsContainer.add(new Label("removePictureLabel", new ResourceModel("pictures.removepicture"))); AjaxFallbackButton removePictureButton = createRemovePictureButton(imageEditForm); imageOptionsContainer.add(removePictureButton); Label setProfileImageLabel = new Label("setProfileImageLabel", new ResourceModel("pictures.setprofileimage")); imageOptionsContainer.add(setProfileImageLabel); AjaxFallbackButton setProfileImageButton = createSetProfileImageButton(imageEditForm); if ((true == sakaiProxy.isOfficialImageEnabledGlobally() && false == sakaiProxy.isUsingOfficialImageButAlternateSelectionEnabled()) || preferencesLogic.getPreferencesRecordForUser(userId).isUseOfficialImage()) { setProfileImageLabel.setVisible(false); setProfileImageButton.setVisible(false); } imageOptionsContainer.add(setProfileImageButton); imageEditForm.add(imageOptionsContainer); removeConfirmContainer = new WebMarkupContainer("galleryRemoveImageConfirmContainer"); removeConfirmContainer.setOutputMarkupId(true); removeConfirmContainer.setOutputMarkupPlaceholderTag(true); Label removeConfirmLabel = new Label("removePictureConfirmLabel", new ResourceModel("pictures.removepicture.confirm")); removeConfirmContainer.add(removeConfirmLabel); AjaxFallbackButton removeConfirmButton = createRemoveConfirmButton( userId, image, (int) galleryPageIndex, formFeedback, imageEditForm); //removeConfirmButton.add(new FocusOnLoadBehaviour()); removeConfirmContainer.add(removeConfirmButton); AjaxFallbackButton removeCancelButton = createRemoveCancelButton(imageEditForm); removeConfirmContainer.add(removeCancelButton); removeConfirmContainer.setVisible(false); imageEditForm.add(removeConfirmContainer); setProfileImageConfirmContainer = new WebMarkupContainer("gallerySetProfileImageConfirmContainer"); setProfileImageConfirmContainer.setOutputMarkupId(true); setProfileImageConfirmContainer.setOutputMarkupPlaceholderTag(true); Label setProfileImageConfirmLabel = new Label("setProfileImageConfirmLabel", new ResourceModel("pictures.setprofileimage.confirm")); setProfileImageConfirmContainer.add(setProfileImageConfirmLabel); AjaxFallbackButton setProfileImageConfirmButton = createSetProfileImageConfirmButton( userId, image, (int) galleryPageIndex, formFeedback, imageEditForm); //setProfileImageConfirmButton.add(new FocusOnLoadBehaviour()); setProfileImageConfirmContainer.add(setProfileImageConfirmButton); AjaxFallbackButton setProfileImageCancelButton = createSetProfileImageCancelButton(imageEditForm); setProfileImageConfirmContainer.add(setProfileImageCancelButton); setProfileImageConfirmContainer.setVisible(false); imageEditForm.add(setProfileImageConfirmContainer); add(new GalleryImageRenderer("galleryImageMainRenderer", image .getMainResource())); }