Statistics
| Branch: | Tag: | Revision:

root / src / gr / grnet / pithos / web / client / Const.java @ afb23bf9

History | View | Annotate | Download (3.9 kB)

1 728ff1e4 Christos KK Loverdos
package gr.grnet.pithos.web.client;
2 728ff1e4 Christos KK Loverdos
3 cd2dd1fe Christos KK Loverdos
import com.google.gwt.regexp.shared.RegExp;
4 cd2dd1fe Christos KK Loverdos
5 728ff1e4 Christos KK Loverdos
/**
6 728ff1e4 Christos KK Loverdos
 * Gathers application-wide constants, like <code>X-Auth-Token</code>
7 728ff1e4 Christos KK Loverdos
 */
8 8ddb4627 Christos KK Loverdos
public final class Const {
9 64d3b76b Christos KK Loverdos
    public static final String IF_MODIFIED_SINCE = "If-Modified-Since";
10 64d3b76b Christos KK Loverdos
    public static final String CONTENT_TYPE = "Content-Type";
11 64d3b76b Christos KK Loverdos
    public static final String ACCEPT = "Accept";
12 64d3b76b Christos KK Loverdos
    public static final String CONTENT_LENGTH = "Content-Length";
13 59aa2375 Christos KK Loverdos
    public static final String HTTP_HEADER_SERVER = "Server";
14 59aa2375 Christos KK Loverdos
    public static final String HTTP_HEADER_CONNECTION = "Connection";
15 59aa2375 Christos KK Loverdos
    public static final String HTTP_HEADER_KEEP_ALIVE = "Keep-Alive";
16 59aa2375 Christos KK Loverdos
    public static final String HTTP_HEADER_DATE = "Date";
17 77a99b26 Christos KK Loverdos
    public static final String HTTP_HEADER_VARY = "Vary";
18 afb23bf9 Christos KK Loverdos
    public static final String HTTP_HEADER_CONTENT_LANGUAGE = "Content-Language";
19 afb23bf9 Christos KK Loverdos
    public static final String HTTP_HEADER_CACHE_CONTROL = "Cache-Control";
20 64d3b76b Christos KK Loverdos
21 728ff1e4 Christos KK Loverdos
    public static final String X_AUTH_TOKEN = "X-Auth-Token";
22 64d3b76b Christos KK Loverdos
    public static final String X_OBJECT_SHARING = "X-Object-Sharing";
23 64d3b76b Christos KK Loverdos
    public static final String X_OBJECT_PUBLIC = "X-Object-Public";
24 64d3b76b Christos KK Loverdos
    public static final String X_COPY_FROM = "X-Copy-From";
25 64d3b76b Christos KK Loverdos
    public static final String X_SOURCE_ACCOUNT = "X-Source-Account";
26 64d3b76b Christos KK Loverdos
    public static final String X_MOVE_FROM = "X-Move-From";
27 64d3b76b Christos KK Loverdos
28 64d3b76b Christos KK Loverdos
    public static final String X_ACCOUNT_GROUP_ = "X-Account-Group-";
29 64d3b76b Christos KK Loverdos
30 fa68c84d Christos KK Loverdos
    public static final String OTHER_PROPERTIES = "otherProperties";
31 fa68c84d Christos KK Loverdos
    public static final String LOGIN_URL = "loginUrl";
32 64d3b76b Christos KK Loverdos
33 fa68c84d Christos KK Loverdos
    public static final String PERCENT_100 = "100%";
34 34cd9aff Christos KK Loverdos
    public static final String PERCENT_75 = "75%";
35 34cd9aff Christos KK Loverdos
36 fa68c84d Christos KK Loverdos
    public static final String DATE_FORMAT_1 = "EEE, dd MMM yyyy HH:mm:ss";
37 fa68c84d Christos KK Loverdos
    public static final String AUTH_COOKIE = "authCookie";
38 64d3b76b Christos KK Loverdos
39 64d3b76b Christos KK Loverdos
    public static final RegExp EMAIL_REGEX = RegExp.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+[.][A-Z]{2,4}$", "i");
40 64d3b76b Christos KK Loverdos
41 fa68c84d Christos KK Loverdos
    public static final String HOME_CONTAINER = "pithos";
42 fa68c84d Christos KK Loverdos
    public static final String TRASH_CONTAINER = "trash";
43 64d3b76b Christos KK Loverdos
44 64d3b76b Christos KK Loverdos
    public static final String EQ = "=";
45 64d3b76b Christos KK Loverdos
    public static final String COMMA = ",";
46 64d3b76b Christos KK Loverdos
    public static final String TILDE = "~";
47 64d3b76b Christos KK Loverdos
    public static final String SEMI = ";";
48 87487bbf Christos KK Loverdos
    public static final String COLON = ":";
49 64d3b76b Christos KK Loverdos
    public static final String QUESTION_MARK = "?";
50 64d3b76b Christos KK Loverdos
    public static final String AMPERSAND = "&";
51 64d3b76b Christos KK Loverdos
52 64d3b76b Christos KK Loverdos
    public static final String READ_EQ = "read=";
53 64d3b76b Christos KK Loverdos
    public static final String WRITE_EQ = "write=";
54 64d3b76b Christos KK Loverdos
    public static final String GOTO_EQ = "goto=";
55 64d3b76b Christos KK Loverdos
    public static final String UPDATE_EQ = "update=";
56 64d3b76b Christos KK Loverdos
    public static final String QUESTION_MARK_UPDATE_EQ = QUESTION_MARK + UPDATE_EQ;
57 64d3b76b Christos KK Loverdos
58 f7c37cc8 Christos KK Loverdos
    public static final String TXT_USER = "User";
59 f7c37cc8 Christos KK Loverdos
    public static final String TXT_GROUP = "Group";
60 f7c37cc8 Christos KK Loverdos
    public static final String TXT_ADD_USER = "Add User";
61 f7c37cc8 Christos KK Loverdos
    public static final String TXT_ADD_GROUP = "Add Group";
62 f7c37cc8 Christos KK Loverdos
    public static final String TXT_SHARE_FILE = "Share File";
63 f7c37cc8 Christos KK Loverdos
    public static final String TXT_SHARE_FOLDER = "Share Folder";
64 b551f85b Christos KK Loverdos
    public static final String TXT_PRIVATE_LINK = "Private Link";
65 b551f85b Christos KK Loverdos
    public static final String TXT_PUBLIC_LINK = "Public Link";
66 0a85a75b Christos KK Loverdos
    public static final String TXT_SHARED_WITH_ME = "Shared with me";
67 87487bbf Christos KK Loverdos
68 f7c37cc8 Christos KK Loverdos
    public static final String HTML_NBSP = "&nbsp;";
69 64d3b76b Christos KK Loverdos
70 86432004 Christos KK Loverdos
    public static final String NL = "\n";
71 728ff1e4 Christos KK Loverdos
72 64d3b76b Christos KK Loverdos
    public static final String EVENT_TYPE_KEYDOWN = "keydown";
73 64d3b76b Christos KK Loverdos
74 728ff1e4 Christos KK Loverdos
    private Const() {}
75 728ff1e4 Christos KK Loverdos
76 728ff1e4 Christos KK Loverdos
77 8ddb4627 Christos KK Loverdos
    public static String PurgeContainer(String name) {
78 8ddb4627 Christos KK Loverdos
        return "Purge Container [" + name + "]";
79 8ddb4627 Christos KK Loverdos
    }
80 87487bbf Christos KK Loverdos
81 87487bbf Christos KK Loverdos
    public static String inSpan(String html) {
82 87487bbf Christos KK Loverdos
        return "<span>" + html + "</span>";
83 87487bbf Christos KK Loverdos
    }
84 87487bbf Christos KK Loverdos
85 87487bbf Christos KK Loverdos
    public static String inSpan(String html0, String html1, String ...html) {
86 87487bbf Christos KK Loverdos
        final int knownLength = html0.length() + html1.length();
87 87487bbf Christos KK Loverdos
        final int estimatedLength = knownLength * html.length;
88 87487bbf Christos KK Loverdos
        final StringBuilder sb = new StringBuilder(estimatedLength);
89 87487bbf Christos KK Loverdos
        sb.append(html0);
90 87487bbf Christos KK Loverdos
        sb.append(html1);
91 87487bbf Christos KK Loverdos
        for(String s : html) {
92 87487bbf Christos KK Loverdos
            sb.append(s);
93 87487bbf Christos KK Loverdos
        }
94 87487bbf Christos KK Loverdos
95 87487bbf Christos KK Loverdos
        return inSpan(sb.toString());
96 87487bbf Christos KK Loverdos
    }
97 728ff1e4 Christos KK Loverdos
}