OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
25 ilm 1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
10
 *
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
13
 
14
 package org.openconcerto.sql.element;
15
 
16
public class LayoutHints {
17
 
18
    private boolean maximizeWidth;
19
    private boolean maximizeHeight;
20
    private boolean showLabel;
21
    private boolean separatedLabel;
22
    private boolean fill;
23
    public static final LayoutHints DEFAULT_FIELD_HINTS = new LayoutHints(false, false, true, false);
24
    public static final LayoutHints DEFAULT_LARGE_FIELD_HINTS = new LayoutHints(true, false, true, false);
25
    public static final LayoutHints DEFAULT_LIST_HINTS = new LayoutHints(true, true, false, false, true);
26
    public static final LayoutHints DEFAULT_GROUP_HINTS = new LayoutHints(false, false, false, false);
27
    public static final LayoutHints DEFAULT_LARGE_GROUP_HINTS = new LayoutHints(true, false, false, false);
28
 
29
    public LayoutHints(boolean maximizeWidth, boolean maximizeHeight, boolean showLabel, boolean separatedLabel) {
30
        this.maximizeWidth = maximizeWidth;
31
        this.maximizeHeight = maximizeHeight;
32
        this.showLabel = showLabel;
33
        this.separatedLabel = separatedLabel;
34
        this.fill = false;
35
    }
36
 
37
    public LayoutHints(boolean maximizeWidth, boolean maximizeHeight, boolean showLabel, boolean separatedLabel, boolean fill) {
38
        this.maximizeWidth = maximizeWidth;
39
        this.maximizeHeight = maximizeHeight;
40
        this.showLabel = showLabel;
41
        this.separatedLabel = separatedLabel;
42
        this.fill = fill;
43
    }
44
 
45
    public boolean maximizeWidth() {
46
        return maximizeWidth;
47
    }
48
 
49
    public boolean maximizeHeight() {
50
        return maximizeHeight;
51
    }
52
 
53
    public boolean showLabel() {
54
        return showLabel;
55
    }
56
 
57
    public boolean separatedLabel() {
58
        return separatedLabel;
59
    }
60
 
61
    public boolean fill() {
62
        return fill;
63
    }
64
 
65
    @Override
66
    public String toString() {
67
        String r = "";
68
        if (maximizeHeight && maximizeWidth) {
69
            r += "MaxW&H";
70
        } else {
71
            if (maximizeHeight) {
72
                r += "MaxH";
73
            }
74
            if (maximizeWidth) {
75
                r += "MaxW";
76
            }
77
        }
78
        if (showLabel && separatedLabel) {
79
            r += " SeparatedLabel";
80
        } else {
81
            if (showLabel) {
82
                r += " StdLabel";
83
            } else {
84
                r += " NoLabel";
85
            }
86
 
87
        }
88
        if (fill) {
89
            r += " Fill";
90
        }
91
        return r;
92
    }
93
}