Subversion Repository Public Repository

litesoft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package org.litesoft.GWT.client.widgets;

import org.litesoft.core.util.*;

import com.google.gwt.dom.client.Style.*;
import com.google.gwt.user.client.ui.*;

public class Spacer extends Composite
{
    private static final String BLANK_TEXT = " ";

    public Spacer( int pWidth, int pHeight )
    {
        HTML widget = new HTML( BLANK_TEXT );
        widget.getElement().getStyle().setOverflow( Overflow.HIDDEN );
        initWidget( widget );
        //noinspection GWTStyleCheck
        setStyleName( "LayoutSpacer" );

        width( pWidth );
        height( pHeight );
    }

    public Spacer( int pWidthAndHeight )
    {
        this( pWidthAndHeight, pWidthAndHeight );
    }

    public Spacer()
    {
        this( 1 );
    }

    /**
     * add a style "classname", and allow chaining calls.
     *
     * @param pStyle "classname"
     *
     * @return this
     */
    public Spacer style( String pStyle )
    {
        if ( null != (pStyle = UtilsCommon.noEmpty( pStyle )) )
        {
            addStyleName( pStyle );
        }
        return this;
    }

    /**
     * Set the width, and allow chaining calls.
     */
    public Spacer width( String pWidth )
    {
        if ( pWidth != null )
        {
            setWidth( pWidth );
        }
        return this;
    }

    /**
     * Set the height, and allow chaining calls.
     */
    public Spacer height( String pHeight )
    {
        if ( pHeight != null )
        {
            setHeight( pHeight );
        }
        return this;
    }

    /**
     * Set the width & height, and allow chaining calls.
     */
    public Spacer size( String pSize )
    {
        return width( pSize ).height( pSize );
    }

    /**
     * Set the width, and allow chaining calls.
     */
    public Spacer width( int pWidth )
    {
        return width( convertSizePositive( pWidth ) );
    }

    /**
     * Set the height, and allow chaining calls.
     */
    public Spacer height( int pHeight )
    {
        return height( convertSizePositive( pHeight ) );
    }

    /**
     * Set the width & height, and allow chaining calls.
     */
    public Spacer size( int pSize )
    {
        return size( convertSizePositive( pSize ) );
    }

    private static String convertSizePositive( int pSize )
    {
        return (pSize > 0) ? String.valueOf( pSize ) : null;
    }
}

Commits for litesoft/trunk/Java/GWT/Client/src/org/litesoft/GWT/client/widgets/Spacer.java

Diff revisions: vs.
Revision Author Commited Message
749 Diff Diff GeorgeS picture GeorgeS Fri 06 Jul, 2012 00:11:43 +0000
626 GeorgeS picture GeorgeS Wed 11 Apr, 2012 19:39:41 +0000