OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 65 | Rev 73 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
41 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.ui.group;
15
 
16
public class LayoutHints {
17
 
65 ilm 18
    private boolean largeWidth;
19
    private boolean largeHeight;
20
 
41 ilm 21
    private boolean showLabel;
22
    private boolean separated;
65 ilm 23
    private boolean fillWidth;
24
    private boolean fillHeight;
25
    public static final LayoutHints DEFAULT_FIELD_HINTS = new LayoutHints(false, false, true, false, false, false);
26
    public static final LayoutHints DEFAULT_LARGE_FIELD_HINTS = new LayoutHints(false, false, true, false, true, false);
27
    public static final LayoutHints DEFAULT_VERY_LARGE_FIELD_HINTS = new LayoutHints(true, false, true, false, false, false);
28
    public static final LayoutHints DEFAULT_LIST_HINTS = new LayoutHints(true, true, false, true, true, true);
29
    public static final LayoutHints DEFAULT_GROUP_HINTS = new LayoutHints(true, false, false, false, true, true);
30
    public static final LayoutHints DEFAULT_SEPARATED_GROUP_HINTS = new LayoutHints(true, false, true, true, true, true);
67 ilm 31
    public static final LayoutHints DEFAULT_NOLABEL_SEPARATED_GROUP_HINTS = new LayoutHints(true, false, false, true, true, true);
41 ilm 32
 
65 ilm 33
    public LayoutHints(boolean largeWidth, boolean largeHeight, boolean showLabel, boolean separated, boolean fillWidth, boolean fillHeight) {
34
        this.largeWidth = largeWidth;
35
        this.largeHeight = largeHeight;
41 ilm 36
        this.showLabel = showLabel;
37
        this.separated = separated;
65 ilm 38
        this.fillWidth = fillWidth;
39
        this.fillHeight = fillHeight;
41 ilm 40
    }
41
 
67 ilm 42
    public LayoutHints(LayoutHints localHint) {
43
        this.largeWidth = localHint.largeWidth;
44
        this.largeHeight = localHint.largeHeight;
45
        this.showLabel = localHint.showLabel;
46
        this.separated = localHint.separated;
47
        this.fillWidth = localHint.fillWidth;
48
        this.fillHeight = localHint.fillHeight;
49
    }
50
 
65 ilm 51
    public boolean largeWidth() {
52
        return largeWidth;
41 ilm 53
    }
54
 
67 ilm 55
    public void setLargeWidth(boolean largeWidth) {
56
        this.largeWidth = largeWidth;
57
    }
58
 
65 ilm 59
    public boolean largeHeight() {
60
        return largeHeight;
41 ilm 61
    }
62
 
67 ilm 63
    public void setLargeHeight(boolean largeHeight) {
64
        this.largeHeight = largeHeight;
65
    }
66
 
41 ilm 67
    public boolean showLabel() {
68
        return showLabel;
69
    }
70
 
67 ilm 71
    public void setShowLabel(boolean showLabel) {
72
        this.showLabel = showLabel;
73
    }
74
 
41 ilm 75
    public boolean isSeparated() {
76
        return separated;
77
    }
78
 
67 ilm 79
    public void setSeparated(boolean separated) {
80
        this.separated = separated;
81
    }
82
 
65 ilm 83
    public boolean fillWidth() {
84
        return fillWidth;
41 ilm 85
    }
86
 
67 ilm 87
    public void setFillWidth(boolean fillWidth) {
88
        this.fillWidth = fillWidth;
89
    }
90
 
65 ilm 91
    public boolean fillHeight() {
92
        return fillHeight;
93
    }
94
 
67 ilm 95
    public void setFillHeight(boolean fillHeight) {
96
        this.fillHeight = fillHeight;
97
    }
98
 
41 ilm 99
    @Override
100
    public String toString() {
101
        String r = "";
65 ilm 102
        if (largeHeight && largeWidth) {
103
            r += "LargeW&H";
41 ilm 104
        } else {
65 ilm 105
            if (largeHeight) {
106
                r += "LargeH";
41 ilm 107
            }
65 ilm 108
            if (largeWidth) {
109
                r += "LargeW";
41 ilm 110
            }
111
        }
112
        if (showLabel && separated) {
113
            r += " SeparatedLabel";
114
        } else {
115
            if (showLabel) {
116
                r += " StdLabel";
117
            } else {
118
                r += " NoLabel";
119
            }
120
 
121
        }
65 ilm 122
        if (fillHeight && fillWidth) {
123
            r += " FillW&H";
124
        } else {
125
            if (fillHeight) {
126
                r += " FillH";
127
            }
128
            if (fillWidth) {
129
                r += " FillW";
130
            }
41 ilm 131
        }
132
        return r;
133
    }
134
}