01: package ru.emdev.EmForge.wiki.web.bean;
02:
03: import org.apache.commons.lang.StringUtils;
04:
05: import ru.emdev.EmForge.web.bean.MainMenuController.MainMenuItem;
06:
07: /**
08: * Trail item "Crumb"
09: *
10: * @author spopov
11: */
12: public class Crumb {
13:
14: public static final int MAXCHARACTERS = 26;
15:
16: private String m_displayName;
17: private String m_url;
18:
19: /**
20: * @param i_item
21: */
22: public Crumb(MainMenuItem i_item) {
23:
24: this (i_item.getTitle(), i_item.getName());
25: }
26:
27: /**
28: * @param i_displayName
29: * @param i_url
30: */
31: public Crumb(String i_displayName, String i_url) {
32:
33: m_displayName = i_displayName;
34: m_url = i_url;
35: }
36:
37: /**
38: * @see java.lang.Object#equals(java.lang.Object)
39: */
40: public boolean equals(Object i_crumb) {
41:
42: return m_displayName.equals(((Crumb) i_crumb)
43: .getFullDisplayName())
44: && m_url.equals(((Crumb) i_crumb).getUrl());
45: }
46:
47: /**
48: * @return
49: */
50: public String getFullDisplayName() {
51:
52: return m_displayName;
53: }
54:
55: /**
56: * @return
57: */
58: public String getDisplayName() {
59:
60: if (m_displayName.length() > MAXCHARACTERS) {
61: return StringUtils.substring(m_displayName, 0,
62: MAXCHARACTERS - 3)
63: + "...";
64: }
65: return m_displayName;
66: }
67:
68: /**
69: * @return
70: */
71: public String getUrl() {
72:
73: return m_url;
74: }
75:
76: }
|