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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
package com.test.uidesign.client;

import org.litesoft.GWT.client.*;
import org.litesoft.GWT.client.widgets.*;
import org.litesoft.commonfoundation.typeutils.*;
import org.litesoft.commonfoundation.typeutils.gregorian.*;
import org.litesoft.ui.*;

import com.google.gwt.event.dom.client.*;
import com.google.gwt.user.client.*;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.*;

import static org.litesoft.ui.CompassPoint.*;

public class UIdesign extends AbstractClientMainAppEntryPoint {
    private Widget createMainWidget() {
//        AccordionVerticalPairPanel zAVP = new AccordionVerticalPairPanel();
//        SizeableBorderedHorizontalSplitPairPanel zPairPanel = new SizeableBorderedHorizontalSplitPairPanel().stretchable();
//        zPairPanel.add(new SizeableScrollPanel(zAVP));
//        zPairPanel.add(new PersonalInfoForm());
////        return new OrigFormComponents();
////        return new PersonalInfoForm();
////        return new Button( "Test" );
//        SizeableVerticalPanel zPanel = new SizeableVerticalPanel().stretchable();
//        zPanel.add(zPairPanel);
//        zPanel.add(new Spacer(15));
//        zPanel.add(createButtonPanel(zAVP));
//        return new SizeableSimplePanel(zPanel).stretchable().style("MainPageIndent");
        return new SizeableSimplePanel( new PersonalInfoForm() ).stretchable().style( "MainPageIndent" );
    }

    public UIdesign() {
        super( new AppNames( "UIdesign" ) );
    }

    @Override
    public void onAppLoad() {
        super.onAppLoad();

        replaceAppPanel();

        WindowSizingPanel.setContent( createMainWidget() );

        System.err.println( new UtilDateAdaptor() + " | Application Client Ready" );
    }

    private static Widget createSubordinateWidget( int pRows ) {
        if ( pRows == 0 ) {
            return null;
        }
        VerticalPanel zPanel = new VerticalPanel();
        for (; pRows > 0; pRows-- ) {
            zPanel.add( createSubordinateRow( pRows ) );
        }
        return zPanel;
    }

    private static Widget createSubordinateRow( int pRows ) {
        HorizontalPanel zPanel = new HorizontalPanel();
        zPanel.add( new Spacer().width( 15 ) );
        zPanel.add( new Label( Strings.dupChars( '*', pRows ) ) );
        zPanel.add( new Spacer().width( 15 ) );
        return zPanel;
    }

    private static AccordionVerticalPairPanel.WidgetPair createWidgetPair( AccordionVerticalPairPanel pAVP ) {
        int zRows = (int) (System.currentTimeMillis() & 31);
        Widget zSubordinateWidget = createSubordinateWidget( zRows );
        return new AccordionVerticalPairPanel.WidgetPair( createPrimeWidget( pAVP, zRows, zSubordinateWidget ), zSubordinateWidget );
    }

    private Widget createButtonPanel( final AccordionVerticalPairPanel pAVP ) {
        SizeableHorizontalPanel zPanel = new SizeableHorizontalPanel().stretchableHorizontally();
        zPanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_BOTTOM );
        zPanel.add( new Button( "Clear", new ClickHandler() {
            @Override
            public void onClick( ClickEvent event ) {
                pAVP.clear();
            }
        } ) );
        zPanel.add( new SizeableSpacer().stretchableHorizontally() );
        zPanel.add( new CssInlineImageTestPanel( "Add" ) );
        zPanel.add( new Spacer( 4 ) );
        zPanel.add( new CssInlineImageTestPanel( "Subtract" ) );
        zPanel.add( new SizeableSpacer().stretchableHorizontally() );
        zPanel.add( new Button( "Add", new ClickHandler() {
            @Override
            public void onClick( ClickEvent event ) {
                pAVP.add( createWidgetPair( pAVP ) );
            }
        } ) );
        return zPanel;
    }

    private static Widget createPrimeWidget( final AccordionVerticalPairPanel pAVP, int pRows, final Widget pSubordinateWidget ) {
        final HorizontalPanel zPanel = new HorizontalPanel();
        zPanel.add( new Spacer().width( 15 ) );
        zPanel.add( new Button( "Remove", new ClickHandler() {
            @Override
            public void onClick( ClickEvent event ) {
                int zIndex = (pSubordinateWidget != null) ? pAVP.indexOfSubordinateWidget( pSubordinateWidget ) : pAVP.indexOfPrimeWidget( zPanel );
                pAVP.remove( zIndex );
            }
        } ) );
        zPanel.add( new Spacer().width( 5 ) );
        zPanel.add( new Label( "Row: " + pAVP.size() ) );
        zPanel.add( new Spacer().width( 15 ) );
        if ( pSubordinateWidget == null ) {
            zPanel.add( new Label( "No Details" ) );
        } else {
            zPanel.add( new Label( "(" + pRows + ")" ) );
            zPanel.add( new Spacer().width( 5 ) );
            zPanel.add( createShowHideButton( pAVP, pSubordinateWidget ) );
        }
        zPanel.add( new Spacer().width( 15 ) );

        return zPanel;
    }

    private static Button createShowHideButton( final AccordionVerticalPairPanel pAVP, final Widget pSubordinateWidget ) {
        final Button zButton = new Button( "Details" );
        zButton.addClickHandler( new ClickHandler() {
            private boolean mShowing;

            @Override
            public void onClick( ClickEvent event ) {
                pAVP.show( pSubordinateWidget, mShowing = !mShowing );
                zButton.setText( mShowing ? "Hide" : "Details" );
            }
        } );
        return zButton;
    }

    private static class CssInlineImageTestPanel extends Composite {
        private Element styleElement;

        public CssInlineImageTestPanel( String name ) {
            SimplePanel panel =
                    new SimplePanel( new NcellBorderedWidgets( "DataImgButton", new TransparentImage( "BgImageCell" ), new Spacer( 5 ), new TextCell( name ) ) );
            styleElement = panel.getElement();
            HorizontalPanel wrapper = new HorizontalPanel();
            wrapper.add( panel );
            wrapper.setStyleName( "Test" + name );
            initWidget( wrapper );
        }

        @Override
        protected Element getStyleElement() {
            return styleElement;
        }

        private static class TextCell extends Label {
            public TextCell( String text ) {
                super( text );
                setStyleName( "TextCell" );
            }
        }

        private static class NcellBorderedWidgets extends Composite {
            public NcellBorderedWidgets( String cssClassName, Widget... centerWidgets ) {
                String id = HTMLPanel.createUniqueId();
                StringBuilder sb = new StringBuilder( "<table cellpadding='0' cellspacing='0'>" );
                addRow( sb, NW, N, NE );
                addRow( sb, W, center, id, E );
                addRow( sb, SW, S, SE );
                sb.append( "</table>" );
                HTMLPanel panel = new HTMLPanel( sb.toString() );
                initWidget( panel );
                panel.add( createCenterWidget( centerWidgets ), id );
                setStyleName( cssClassName );
            }

            private void addRow( StringBuilder sb, CompassPoint... cps ) {
                sb.append( "<tr>" );
                for ( CompassPoint cp : cps ) {
                    addCell( sb, cp );
                }
                sb.append( "</tr>" );
            }

            private void addRow( StringBuilder sb, CompassPoint w, CompassPoint center, String id, CompassPoint e ) {
                sb.append( "<tr>" );
                addCell( sb, w );
                addCell( sb, center, id );
                addCell( sb, e );
                sb.append( "</tr>" );
            }

            private void addCell( StringBuilder sb, CompassPoint cp ) {
                sb.append( "<td class='CP_" ).append( cp.name() ).append( "'><img src='" ).append( TransparentImage.URL ).append( "'></td>" );
            }

            private void addCell( StringBuilder sb, CompassPoint cp, String id ) {
                sb.append( "<td class='CP_" ).append( cp.name() ).append( "' id='" ).append( id ).append( "'></td>" );
            }

            private Widget createCenterWidget( Widget[] centerWidgets ) {
                HorizontalPanel panel = new HorizontalPanel();
                panel.setVerticalAlignment( HasVerticalAlignment.ALIGN_MIDDLE );
                for ( Widget widget : centerWidgets ) {
                    panel.add( widget );
                }
                return panel;
            }
        }
    }
}

Commits for litesoft/trunk/GWT_Sandbox/UIdesign/src/com/test/uidesign/client/UIdesign.java

Diff revisions: vs.
Revision Author Commited Message
948 Diff Diff GeorgeS picture GeorgeS Sat 07 Jun, 2014 23:42:39 +0000

Jusefuls Formatter Updated to New Code Format

942 Diff Diff GeorgeS picture GeorgeS Mon 02 Jun, 2014 23:41:46 +0000

Extracting commonfoundation

939 Diff Diff GeorgeS picture GeorgeS Mon 02 Jun, 2014 21:30:31 +0000

Extracting commonfoundation

799 Diff Diff GeorgeS picture GeorgeS Wed 15 Aug, 2012 03:32:04 +0000
607 Diff Diff GeorgeS picture GeorgeS Mon 05 Mar, 2012 02:51:31 +0000
596 Diff Diff GeorgeS picture GeorgeS Mon 30 Jan, 2012 02:04:58 +0000
587 Diff Diff GeorgeS picture GeorgeS Fri 02 Dec, 2011 11:55:12 +0000

Accordion...

377 GeorgeS picture GeorgeS Sat 13 Aug, 2011 00:08:16 +0000