Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (3.6 kB)

1 a57faaf0 Christos Stathis
/*
2 e6e9f6e6 Christos KK Loverdos
 * Copyright 2011-2013 GRNET S.A. All rights reserved.
3 63366925 Christos Stathis
 *
4 63366925 Christos Stathis
 * Redistribution and use in source and binary forms, with or
5 63366925 Christos Stathis
 * without modification, are permitted provided that the following
6 63366925 Christos Stathis
 * conditions are met:
7 63366925 Christos Stathis
 *
8 63366925 Christos Stathis
 *   1. Redistributions of source code must retain the above
9 63366925 Christos Stathis
 *      copyright notice, this list of conditions and the following
10 63366925 Christos Stathis
 *      disclaimer.
11 63366925 Christos Stathis
 *
12 63366925 Christos Stathis
 *   2. Redistributions in binary form must reproduce the above
13 63366925 Christos Stathis
 *      copyright notice, this list of conditions and the following
14 63366925 Christos Stathis
 *      disclaimer in the documentation and/or other materials
15 63366925 Christos Stathis
 *      provided with the distribution.
16 63366925 Christos Stathis
 *
17 63366925 Christos Stathis
 * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
18 63366925 Christos Stathis
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 63366925 Christos Stathis
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 63366925 Christos Stathis
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
21 63366925 Christos Stathis
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 63366925 Christos Stathis
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 63366925 Christos Stathis
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24 63366925 Christos Stathis
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25 63366925 Christos Stathis
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 63366925 Christos Stathis
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
27 63366925 Christos Stathis
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 63366925 Christos Stathis
 * POSSIBILITY OF SUCH DAMAGE.
29 63366925 Christos Stathis
 *
30 63366925 Christos Stathis
 * The views and conclusions contained in the software and
31 63366925 Christos Stathis
 * documentation are those of the authors and should not be
32 63366925 Christos Stathis
 * interpreted as representing official policies, either expressed
33 63366925 Christos Stathis
 * or implied, of GRNET S.A.
34 a57faaf0 Christos Stathis
 */
35 a57faaf0 Christos Stathis
package gr.grnet.pithos.web.client;
36 a57faaf0 Christos Stathis
37 0bf4cd8e Christos KK Loverdos
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
38 0bf4cd8e Christos KK Loverdos
import com.google.gwt.safehtml.shared.UriUtils;
39 f2ae0948 Christos KK Loverdos
import com.google.gwt.user.client.ui.*;
40 a57faaf0 Christos Stathis
41 a57faaf0 Christos Stathis
/**
42 a57faaf0 Christos Stathis
 * The panel that displays a status bar with quota information.
43 a57faaf0 Christos Stathis
 */
44 a57faaf0 Christos Stathis
public class StatusPanel extends Composite {
45 a57faaf0 Christos Stathis
46 64800147 Christos KK Loverdos
    /**
47 64800147 Christos KK Loverdos
     * The constructor of the status panel.
48 64800147 Christos KK Loverdos
     */
49 64800147 Christos KK Loverdos
    public StatusPanel() {
50 0bf4cd8e Christos KK Loverdos
        final String SYNNEFO_VERSION = Pithos.getFromOtherPropertiesOrDefault("SYNNEFO_VERSION", "");
51 cdc11586 Christos Stathis
52 64800147 Christos KK Loverdos
        HorizontalPanel outer = new HorizontalPanel();
53 64800147 Christos KK Loverdos
        outer.setWidth("100%");
54 64800147 Christos KK Loverdos
        outer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
55 36dc8e18 Christos Stathis
56 36dc8e18 Christos Stathis
        VerticalPanel inner = new VerticalPanel();
57 36dc8e18 Christos Stathis
        inner.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
58 64800147 Christos KK Loverdos
        HorizontalPanel firstLine = new HorizontalPanel();
59 64800147 Christos KK Loverdos
        firstLine.setSpacing(8);
60 0bf4cd8e Christos KK Loverdos
        if(Pithos.isShowCopyrightMessage()) {
61 0bf4cd8e Christos KK Loverdos
            final String COMPANY_URL = Pithos.getFromOtherPropertiesOrDefault("COMPANY_URL", "#");
62 0bf4cd8e Christos KK Loverdos
            final String safeCompanyURL = UriUtils.encode(COMPANY_URL);
63 0bf4cd8e Christos KK Loverdos
            final String COPYRIGHT_MESSAGE = Pithos.getFromOtherPropertiesOrDefault("COPYRIGHT_MESSAGE", "");
64 0bf4cd8e Christos KK Loverdos
            final String safeCopyrightMessage = SafeHtmlUtils.htmlEscape(COPYRIGHT_MESSAGE);
65 0bf4cd8e Christos KK Loverdos
            firstLine.add(new HTML("<a class='grnet-sign' href='" + safeCompanyURL + "'>" + safeCopyrightMessage + "</a>"));
66 0bf4cd8e Christos KK Loverdos
67 0bf4cd8e Christos KK Loverdos
            Pithos.LOG("Showing copyright message");
68 0bf4cd8e Christos KK Loverdos
        }
69 0bf4cd8e Christos KK Loverdos
        else {
70 0bf4cd8e Christos KK Loverdos
            Pithos.LOG("Not showing copyright message");
71 0bf4cd8e Christos KK Loverdos
        }
72 64800147 Christos KK Loverdos
        inner.add(firstLine);
73 36dc8e18 Christos Stathis
74 36dc8e18 Christos Stathis
        HorizontalPanel secondLine = new HorizontalPanel();
75 f2ae0948 Christos KK Loverdos
        secondLine.add(new HTML(
76 64800147 Christos KK Loverdos
            "<div class='software'>" +
77 9eb70525 Christos KK Loverdos
                "Powered by <a href='http://synnefo.orgs'>Synnefo</a>" +
78 9eb70525 Christos KK Loverdos
                "<span class='version'> v" + SYNNEFO_VERSION + "</span>" +
79 64800147 Christos KK Loverdos
            "</div>"));
80 64800147 Christos KK Loverdos
//        secondLine.addStyleName("software");
81 36dc8e18 Christos Stathis
        inner.add(secondLine);
82 36dc8e18 Christos Stathis
        outer.add(inner);
83 bbdd34ef Christos Stathis
        outer.addStyleName("pithos-statusbar");
84 bbdd34ef Christos Stathis
85 64800147 Christos KK Loverdos
        initWidget(outer);
86 64800147 Christos KK Loverdos
    }
87 a57faaf0 Christos Stathis
}