• R/O
  • SSH
  • HTTPS

wicket-ja: Commit


Commit MetaInfo

Revision32 (tree)
Time2008-02-27 16:37:10
Authoryoshiori

Log Message

MagicNB の消去。Collection じゃないののに List を名乗っていたクラスを修正。

Change Summary

Incremental Difference

--- trunk/wicket-ja/src/main/java/org/wicketja/site/links/CategoryList.java (revision 31)
+++ trunk/wicket-ja/src/main/java/org/wicketja/site/links/CategoryList.java (nonexistent)
@@ -1,42 +0,0 @@
1-package org.wicketja.site.links;
2-
3-import java.util.ArrayList;
4-import java.util.List;
5-import java.io.Serializable;
6-
7-public class CategoryList implements Serializable {
8- /**
9- *
10- */
11- private static final long serialVersionUID = 8113325699095124323L;
12-
13- public List<Category> findAll(){
14- List<Category> list = new ArrayList<Category>();
15- list.add(createCategory(1l, "団体"));
16- list.add(createCategory(2l, "個人"));
17- list.add(createCategory(3l, "企業"));
18- list.add(createCategory(4l, "事例"));
19- return list;
20- }
21-
22- private Category createCategory(long id, String title){
23- Category category = new Category();
24- category.setId(id);
25- category.setTitle(title);
26- return category;
27- }
28-
29- public Category findById(long id){
30- if(id == 1l){
31- return createCategory(1l, "団体");
32- }else if(id == 2l){
33- return createCategory(2l, "個人");
34- }else if(id == 3l){
35- return createCategory(3l, "企業");
36- }else if(id == 4l){
37- return createCategory(4l, "事例");
38- }
39- return null;
40- }
41-
42-}
--- trunk/wicket-ja/src/main/java/org/wicketja/site/links/LinkList.java (revision 31)
+++ trunk/wicket-ja/src/main/java/org/wicketja/site/links/LinkList.java (nonexistent)
@@ -1,72 +0,0 @@
1-package org.wicketja.site.links;
2-
3-import java.io.Serializable;
4-import java.util.ArrayList;
5-import java.util.Calendar;
6-import java.util.List;
7-
8-/**
9- * リンク集ページに表示するリンクの一覧を取得するためのクラス
10- *
11- * @author s_tonouchi
12- *
13- */
14-public class LinkList implements Serializable {
15- /**
16- *
17- */
18- private static final long serialVersionUID = -6751878280769437868L;
19-
20- /**
21- * リンクの一覧を取得します。
22- *
23- * @return リンク一覧
24- */
25- public List<LinkItem> findAll() {
26- List<LinkItem> links = new ArrayList<LinkItem>();
27-
28- Calendar calendar1 = Calendar.getInstance();
29- calendar1.set(2008, Calendar.FEBRUARY, 11);
30- links.add(createLink("Apache Wicket", "http://wicket.apache.org/",
31- "Wicketを開発している団体です。", 1l, "", calendar1));
32-
33- Calendar calendar2 = Calendar.getInstance();
34- calendar2.set(2008, Calendar.FEBRUARY, 18);
35- links.add(createLink("Wicket Stuff wiki",
36- "http://wicketstuff.org/confluence/display/STUFFWIKI/Wiki",
37- "Wicketの様々なComponentが公開されています。", 1l, "", calendar2));
38-
39- return links;
40- }
41-
42- /**
43- * リンクを作成するメソッドです。
44- *
45- * @param name
46- * リンク先の名前
47- * @param url
48- * リンク先のURL
49- * @param excerpt
50- * リンク先の説明
51- * @param categoryId
52- * リンク先のカテゴリーID
53- * @param feedUrl
54- * RSSのURL
55- * @param registered
56- * 登録日付
57- * @return 作成されたリンクアイテム
58- */
59- private LinkItem createLink(String name, String url, String excerpt,
60- long categoryId, String feedUrl, Calendar registered) {
61- LinkItem link = new LinkItem();
62- link.setName(name);
63- link.setUrl(url);
64- link.setExcerpt(excerpt);
65- link.setCategoryId(categoryId);
66- link.setCategory(new CategoryList().findById(categoryId));
67- link.setFeedUrl(feedUrl);
68- link.setRegistered(registered);
69- return link;
70- }
71-
72-}
--- trunk/wicket-ja/src/main/java/org/wicketja/site/links/LinkDao.java (nonexistent)
+++ trunk/wicket-ja/src/main/java/org/wicketja/site/links/LinkDao.java (revision 32)
@@ -0,0 +1,14 @@
1+package org.wicketja.site.links;
2+
3+import java.util.List;
4+
5+public interface LinkDao {
6+
7+ /**
8+ * リンクの一覧を取得します。
9+ *
10+ * @return リンク一覧
11+ */
12+ public abstract List<LinkItem> findAll();
13+
14+}
\ No newline at end of file
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- trunk/wicket-ja/src/main/java/org/wicketja/site/links/LinkDaoImpl.java (nonexistent)
+++ trunk/wicket-ja/src/main/java/org/wicketja/site/links/LinkDaoImpl.java (revision 32)
@@ -0,0 +1,40 @@
1+package org.wicketja.site.links;
2+
3+import java.io.Serializable;
4+import java.util.ArrayList;
5+import java.util.Calendar;
6+import java.util.List;
7+
8+/**
9+ * リンク集ページに表示するリンクの一覧を取得するためのクラス
10+ *
11+ * @author s_tonouchi
12+ *
13+ */
14+public class LinkDaoImpl implements Serializable, LinkDao{
15+ /**
16+ *
17+ */
18+ private static final long serialVersionUID = -6751878280769437868L;
19+
20+ /* (non-Javadoc)
21+ * @see org.wicketja.site.links.LinkDao#findAll()
22+ */
23+ public List<LinkItem> findAll() {
24+ List<LinkItem> links = new ArrayList<LinkItem>();
25+
26+ Calendar calendar1 = Calendar.getInstance();
27+ calendar1.set(2008, Calendar.FEBRUARY, 11);
28+ links.add(new LinkItem("Apache Wicket", "http://wicket.apache.org/",
29+ "Wicketを開発している団体です。", Category.COMMUNITY, "", calendar1));
30+
31+ Calendar calendar2 = Calendar.getInstance();
32+ calendar2.set(2008, Calendar.FEBRUARY, 18);
33+ links.add(new LinkItem("Wicket Stuff wiki",
34+ "http://wicketstuff.org/confluence/display/STUFFWIKI/Wiki",
35+ "Wicketの様々なComponentが公開されています。", Category.COMMUNITY, "", calendar2));
36+
37+ return links;
38+ }
39+
40+}
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- trunk/wicket-ja/src/main/java/org/wicketja/site/links/LinkItem.java (revision 31)
+++ trunk/wicket-ja/src/main/java/org/wicketja/site/links/LinkItem.java (revision 32)
@@ -5,8 +5,9 @@
55
66 /**
77 * 1件のリンクを表します。
8+ *
89 * @author s_tonouchi
9- *
10+ *
1011 */
1112 public class LinkItem implements Serializable {
1213 /**
@@ -18,76 +19,87 @@
1819 * リンクしたサイトの名前
1920 */
2021 private String name;
21-
22+
2223 /**
2324 * リンクした先のURL
2425 */
2526 private String url;
26-
27+
2728 /**
2829 * リンク先の紹介文
2930 */
3031 private String excerpt;
31-
32+
3233 /**
33- * カテゴリーID
34+ * カテゴリー
3435 */
35- private long categoryId;
36-
37- /**
38- * カテゴリーIDに紐づくカテゴリーインスタンス
39- */
4036 private Category category;
41-
37+
4238 /**
4339 * リンクが登録された日付
4440 */
4541 private Calendar registered;
46-
42+
4743 /**
4844 * RSSへのURL
4945 */
5046 private String feedUrl;
51-
47+
48+ public LinkItem(String name, String url, String excerpt, Category category,
49+ String feedUrl, Calendar registered) {
50+ super();
51+ this.category = category;
52+ this.excerpt = excerpt;
53+ this.feedUrl = feedUrl;
54+ this.name = name;
55+ this.registered = registered;
56+ this.url = url;
57+ }
58+
5259 public String getName() {
5360 return name;
5461 }
62+
5563 void setName(String name) {
5664 this.name = name;
5765 }
66+
5867 public String getUrl() {
5968 return url;
6069 }
70+
6171 void setUrl(String url) {
6272 this.url = url;
6373 }
74+
6475 public String getExcerpt() {
6576 return excerpt;
6677 }
78+
6779 void setExcerpt(String excerpt) {
6880 this.excerpt = excerpt;
6981 }
70- public long getCategoryId() {
71- return categoryId;
72- }
73- public void setCategoryId(long categoryId) {
74- this.categoryId = categoryId;
75- }
82+
7683 public Category getCategory() {
7784 return category;
7885 }
86+
7987 public void setCategory(Category category) {
8088 this.category = category;
8189 }
90+
8291 public String getFeedUrl() {
8392 return feedUrl;
8493 }
94+
8595 public void setFeedUrl(String feedUrl) {
8696 this.feedUrl = feedUrl;
8797 }
98+
8899 public Calendar getRegistered() {
89100 return registered;
90101 }
102+
91103 public void setRegistered(Calendar registered) {
92104 this.registered = registered;
93105 }
--- trunk/wicket-ja/src/main/java/org/wicketja/site/links/Category.java (revision 31)
+++ trunk/wicket-ja/src/main/java/org/wicketja/site/links/Category.java (revision 32)
@@ -1,26 +1,30 @@
11 package org.wicketja.site.links;
22
3-import java.io.Serializable;
3+/**
4+ * @author yoshiori
5+ *
6+ */
7+public enum Category {
8+
9+ COMMUNITY(1L,"団体"),
10+ PERSON(2L,"個人"),
11+ COMPANY(3L,"企業"),
12+ CASES(4L,"事例");
13+
14+ private Long id;
15+ private String title;
16+
17+ private Category(Long id, String title) {
18+ this.id = id;
19+ this.title = title;
20+ }
421
5-public class Category implements Serializable {
6- /**
7- *
8- */
9- private static final long serialVersionUID = -1875465488138638306L;
10- private long id;
11- private String title;
12- public long getId() {
22+ public Long getId() {
1323 return id;
1424 }
15- public void setId(long id) {
16- this.id = id;
17- }
25+
1826 public String getTitle() {
1927 return title;
2028 }
21- public void setTitle(String title) {
22- this.title = title;
23- }
2429
25-
2630 }
--- trunk/wicket-ja/src/main/java/org/wicketja/site/LinksPage.java (revision 31)
+++ trunk/wicket-ja/src/main/java/org/wicketja/site/LinksPage.java (revision 32)
@@ -6,11 +6,11 @@
66 import org.apache.wicket.PageParameters;
77 import org.apache.wicket.markup.html.basic.Label;
88 import org.apache.wicket.markup.html.link.ExternalLink;
9-import org.apache.wicket.markup.html.link.PopupSettings;
109 import org.apache.wicket.markup.html.list.ListItem;
1110 import org.apache.wicket.markup.html.list.ListView;
11+import org.wicketja.site.links.LinkDao;
12+import org.wicketja.site.links.LinkDaoImpl;
1213 import org.wicketja.site.links.LinkItem;
13-import org.wicketja.site.links.LinkList;
1414
1515 /**
1616 * リンク集を掲載するページクラスです。
@@ -24,6 +24,11 @@
2424 */
2525 private static final long serialVersionUID = 8466391021167259458L;
2626
27+ // DI導入したら修正
28+ //@SpringBean
29+ //private LinkDao linkDao;
30+ private LinkDao linkDao = new LinkDaoImpl();
31+
2732 /**
2833 * このオブジェクトが生成される時に呼び出されます。
2934 *
@@ -32,7 +37,7 @@
3237 */
3338 public LinksPage(PageParameters params) {
3439 super();
35- add(new ListView("linkList", new LinkList().findAll()) {
40+ add(new ListView("linkList", linkDao.findAll()) {
3641 /**
3742 *
3843 */
@@ -41,16 +46,7 @@
4146 @Override
4247 protected void populateItem(ListItem item) {
4348 LinkItem linkItem = (LinkItem) item.getModelObject();
44-
45- PopupSettings popup = new PopupSettings(
46- PopupSettings.LOCATION_BAR | PopupSettings.MENU_BAR
47- | PopupSettings.RESIZABLE
48- | PopupSettings.SCROLLBARS
49- | PopupSettings.STATUS_BAR
50- | PopupSettings.TOOL_BAR);
51-
52- item.add(new ExternalLink("title", linkItem.getUrl(), linkItem
53- .getName()).setPopupSettings(popup));
49+ item.add(new ExternalLink("title",linkItem.getUrl(),linkItem.getName()));
5450 item.add(new Label("excerpt", linkItem.getExcerpt()));
5551 item.add(new Label("registered", DateFormat.getDateInstance(
5652 DateFormat.FULL, Locale.JAPAN).format(
Show on old repository browser