OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 41 | Rev 67 | 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);
41 ilm 31
 
65 ilm 32
    public LayoutHints(boolean largeWidth, boolean largeHeight, boolean showLabel, boolean separated, boolean fillWidth, boolean fillHeight) {
33
        this.largeWidth = largeWidth;
34
        this.largeHeight = largeHeight;
41 ilm 35
        this.showLabel = showLabel;
36
        this.separated = separated;
65 ilm 37
        this.fillWidth = fillWidth;
38
        this.fillHeight = fillHeight;
41 ilm 39
    }
40
 
65 ilm 41
    public boolean largeWidth() {
42
        return largeWidth;
41 ilm 43
    }
44
 
65 ilm 45
    public boolean largeHeight() {
46
        return largeHeight;
41 ilm 47
    }
48
 
49
    public boolean showLabel() {
50
        return showLabel;
51
    }
52
 
53
    public boolean isSeparated() {
54
        return separated;
55
    }
56
 
65 ilm 57
    public boolean fillWidth() {
58
        return fillWidth;
41 ilm 59
    }
60
 
65 ilm 61
    public boolean fillHeight() {
62
        return fillHeight;
63
    }
64
 
41 ilm 65
    @Override
66
    public String toString() {
67
        String r = "";
65 ilm 68
        if (largeHeight && largeWidth) {
69
            r += "LargeW&H";
41 ilm 70
        } else {
65 ilm 71
            if (largeHeight) {
72
                r += "LargeH";
41 ilm 73
            }
65 ilm 74
            if (largeWidth) {
75
                r += "LargeW";
41 ilm 76
            }
77
        }
78
        if (showLabel && separated) {
79
            r += " SeparatedLabel";
80
        } else {
81
            if (showLabel) {
82
                r += " StdLabel";
83
            } else {
84
                r += " NoLabel";
85
            }
86
 
87
        }
65 ilm 88
        if (fillHeight && fillWidth) {
89
            r += " FillW&H";
90
        } else {
91
            if (fillHeight) {
92
                r += " FillH";
93
            }
94
            if (fillWidth) {
95
                r += " FillW";
96
            }
41 ilm 97
        }
98
        return r;
99
    }
100
}