<commit_before>/**
 * Copyright (c) 2008-2010 The Sakai Foundation
 *
 * Licensed under the Educational Community License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *             http://www.osedu.org/licenses/ECL-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.sakaiproject.profile2.tool.pages.panels;

import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.DataView;
import org.apache.wicket.model.Model;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.sakaiproject.profile2.logic.SakaiProxy;
import org.sakaiproject.profile2.model.ProfileStatus;
import org.sakaiproject.profile2.model.WallItem;
import org.sakaiproject.profile2.tool.components.ProfileImageRenderer;
import org.sakaiproject.profile2.tool.dataproviders.WallItemDataProvider;
import org.sakaiproject.profile2.tool.pages.ViewProfile;
import org.sakaiproject.profile2.util.ProfileUtils;

/**
 * User's wall panel.
 */
public class MyWallPanel extends Panel {

	private static final long serialVersionUID = 1L;

	@SpringBean(name="org.sakaiproject.profile2.logic.SakaiProxy")
	private SakaiProxy sakaiProxy;
	
//	@SpringBean(name="org.sakaiproject.profile2.logic.ProfileStatusLogic")
//	private ProfileStatusLogic statusLogic;
	
	/**
	 * 
	 */
	public MyWallPanel(String id) {

		super(id);

		WallItemDataProvider provider = new WallItemDataProvider(
				sakaiProxy.getCurrentUserId());

		// container which wraps list
		final WebMarkupContainer wallItemsContainer = new WebMarkupContainer(
				"wallItemsContainer");

		wallItemsContainer.setOutputMarkupId(true);
		
		DataView<WallItem> wallItemsDataView = new DataView<WallItem>(
				"wallItems", provider) {

			private static final long serialVersionUID = 1L;

			@Override
			protected void populateItem(Item<WallItem> item) {

				WallItem wallItem = (WallItem) item.getDefaultModelObject();

				// image wrapper, links to profile
				Link<String> wallItemPhoto = new Link<String>(
						"wallItemPhotoWrap", new Model<String>(wallItem
								.getCreatorUuid())) {

					private static final long serialVersionUID = 1L;

					public void onClick() {
						setResponsePage(new ViewProfile(getModelObject()));
					}
				};

				// image
				wallItemPhoto.add(new ProfileImageRenderer("wallItemPhoto",
						wallItem.getCreatorUuid()));
				item.add(wallItemPhoto);

				// name and link to profile
				Link<String> wallItemProfileLink = new Link<String>(
						"wallItemProfileLink", new Model<String>(wallItem
								.getCreatorUuid())) {

					private static final long serialVersionUID = 1L;

					public void onClick() {
						setResponsePage(new ViewProfile(getModelObject()));
					}

				};
				wallItemProfileLink.add(new Label("wallItemName", wallItem
						.getCreatorName()));
				item.add(wallItemProfileLink);

				item.add(new Label("wallItemText", wallItem.getText()));
				item.add(new Label("wallItemDate", ProfileUtils
						.convertDateToString(wallItem.getDate(),
								"dd MMMMM, h:mm")));

			}
		};
		
		wallItemsDataView.setOutputMarkupId(true);
		//wallItemsDataView.setItemsPerPage(10);
		
		wallItemsContainer.add(wallItemsDataView);
		add(wallItemsContainer);
	}

}
<commit_msg>PRFL-511: code cleanup and fixed displayed time format<commit_after>/**
 * Copyright (c) 2008-2010 The Sakai Foundation
 *
 * Licensed under the Educational Community License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *             http://www.osedu.org/licenses/ECL-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.sakaiproject.profile2.tool.pages.panels;

import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.DataView;
import org.apache.wicket.model.Model;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.sakaiproject.profile2.logic.SakaiProxy;
import org.sakaiproject.profile2.model.WallItem;
import org.sakaiproject.profile2.tool.components.ProfileImageRenderer;
import org.sakaiproject.profile2.tool.dataproviders.WallItemDataProvider;
import org.sakaiproject.profile2.tool.pages.ViewProfile;
import org.sakaiproject.profile2.util.ProfileUtils;

/**
 * User's wall panel.
 */
public class MyWallPanel extends Panel {

	private static final long serialVersionUID = 1L;

	@SpringBean(name="org.sakaiproject.profile2.logic.SakaiProxy")
	private SakaiProxy sakaiProxy;
	
	/**
	 * Creates a new instance of <code>MyWallPanel</code>.
	 */
	public MyWallPanel(String id) {

		super(id);

		WallItemDataProvider provider = new WallItemDataProvider(
				sakaiProxy.getCurrentUserId());

		// container which wraps list
		final WebMarkupContainer wallItemsContainer = new WebMarkupContainer(
				"wallItemsContainer");

		wallItemsContainer.setOutputMarkupId(true);
		
		// TODO haven't decided whether to add a navigator yet
		
		DataView<WallItem> wallItemsDataView = new DataView<WallItem>(
				"wallItems", provider) {

			private static final long serialVersionUID = 1L;

			@Override
			protected void populateItem(Item<WallItem> item) {

				WallItem wallItem = (WallItem) item.getDefaultModelObject();

				// image wrapper, links to profile
				Link<String> wallItemPhoto = new Link<String>(
						"wallItemPhotoWrap", new Model<String>(wallItem
								.getCreatorUuid())) {

					private static final long serialVersionUID = 1L;

					public void onClick() {
						setResponsePage(new ViewProfile(getModelObject()));
					}
				};

				// image
				wallItemPhoto.add(new ProfileImageRenderer("wallItemPhoto",
						wallItem.getCreatorUuid()));
				item.add(wallItemPhoto);

				// name and link to profile
				Link<String> wallItemProfileLink = new Link<String>(
						"wallItemProfileLink", new Model<String>(wallItem
								.getCreatorUuid())) {

					private static final long serialVersionUID = 1L;

					public void onClick() {
						setResponsePage(new ViewProfile(getModelObject()));
					}

				};
				wallItemProfileLink.add(new Label("wallItemName", wallItem
						.getCreatorName()));
				item.add(wallItemProfileLink);

				item.add(new Label("wallItemText", wallItem.getText()));
				item.add(new Label("wallItemDate", ProfileUtils
						.convertDateToString(wallItem.getDate(),
								"dd MMMMM, kk:mm")));

			}
		};
		
		wallItemsDataView.setOutputMarkupId(true);
		//wallItemsDataView.setItemsPerPage(10);
		
		wallItemsContainer.add(wallItemsDataView);
		add(wallItemsContainer);
	}

}

{'fraction_non_alphanumeric': 0.10367142102482832, 'fraction_numerical': 0.007527733755942948, 'mean_word_length': 4.233586731167934, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '21008', 'n_tokens_mistral': 2641, 'n_tokens_neox': 2218, 'n_words': 522}