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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
package com.test.uidesign.client;

import java.util.*;

import org.litesoft.GWT.client.*;
import org.litesoft.GWT.client.widgets.Button;
import org.litesoft.GWT.client.widgets.*;
import org.litesoft.GWT.forms.client.components.*;
import org.litesoft.GWT.forms.client.components.impls.input.*;
import org.litesoft.core.simpletypes.temporal.*;
import org.litesoft.core.typeutils.*;
import org.litesoft.core.util.*;

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

public class PersonalInfoForm extends SizeableVerticalPanel
{
    // private static final ResourceKeyNameURL ERROR_RESOURCE = new ResourceKeyNameURL( "VW2", "Volkswagen2", "common/images/misc/tmp/vw.jpg" );

//    private final List<Enableable> mFormComponents = new ArrayList<Enableable>();
//    private Button mEnable, mDisable, mDialog;

    public PersonalInfoForm()
    {
        stretchable();

        HorizontalPanel zHPanel;

//        add( TestTable.create() );
//
//        FormTextarea zFrmTA = new FormTextarea( "Comments are really long", null, "My New Tooltip", false, //
//                                                null, false, //
//                                                null, false );
//        zFrmTA.addFormComponentListener( new MyListener( "ERROR" ) );
//        add( zFrmTA );

        add( zHPanel = new HorizontalPanel() );

//        FormTimestampPicker zTimestampPicker = new FormTimestampPicker( "Timestamp", null, "My New Tooltip", TimeRes.ToMIN, "Cancel", "OK" );
//        zTimestampPicker.addFormComponentListener( new MyListener( new SimpleTimestamp( 1960, 1, 2, 3, 4 ) ) );
//        zHPanel.add( zTimestampPicker );
//
//        FormDatePicker zCalendar = new FormDatePicker( "Calendar", null, "Pick-a-Date", "Cancel", "Today", new DateFormatControl( DateFormatControl.DEFAULT_DATE_FORMAT ) );
//        zCalendar.addFormComponentListener( new MyListener( new SimpleDate( 1957, 1, 4 ) ) );
//        zHPanel.add( zCalendar );
//
//        FormTimePicker zTime = new FormTimePicker( "Time", null, "Pick-a-Time", TimeRes.ToMIN, "Cancel", "OK" );
//        zTime.addFormComponentListener( new MyListener( new SimpleTime( 1, 2 ) ) );
//        zHPanel.add( zTime );
//
        FormComboBox zOptions = new FormComboBox( "Colors *", null, "Pick-a-color", "Red" );
        zOptions.addFormComponentListener( new MyListener( "-Select-" ) );
        zOptions.addItems( "-Select-", //
                           "Red", //
                           "Green", //
                           "Blue" );
        zHPanel.add( zOptions );

//        add( zHPanel = new HorizontalPanel() );
//
//        FormSuggestBox zSuggest = new FormSuggestBox( "Suggestions", null, "Type to filter content", null, null, createSuggestions() );
//        zSuggest.addFormComponentListener( new MyListener( "ERROR" ) );
//
//        String[] zRadioGroupOptions = new String[]{"Option One", "Option Two is a really long, long option", "Option Three",};
//
//        FormTextField zTFfc = new FormTextField( "First Name", null, "My New Tooltip", null, null );
//        zTFfc.addFormComponentListener( new MyListener( "ERROR" ) );
//
//        FormPasswordField zPFfc = new FormPasswordField( "Password", null, "A Tooltip 4 Password Field", null, null );
//        zPFfc.addFormComponentListener( new MyListener( "ERROR" ) );
//
//        final FormRightAlignTextField zTFnumeric = new FormRightAlignTextField( "Security Code", null, "My New Tooltip", null, null );
//        zTFnumeric.addFormComponentListener( new MyListener( "999" ) );
//
//        zHPanel.add( zSuggest );
//        zHPanel.add( new Spacer( 10 ) );
//        zHPanel.add( zTFfc );
//        zHPanel.add( new Spacer( 10 ) );
//        zHPanel.add( zPFfc );
//        zHPanel.add( new Spacer( 10 ) );
//        zHPanel.add( zTFnumeric );
//
//        FormRadioGroup zRGfc = new FormRadioGroup( "Group Uno", null, "Radio Tooltip", zRadioGroupOptions );
//        zRGfc.addFormComponentListener( new MyListener( "N/A" ) );
//        add( zRGfc );
//
//        FormCheckBox zCheck = new FormCheckBox( "Option1", null, "Options Tooltip", false );
//        zCheck.addFormComponentListener( new MyListener( null ) );
//        add( zCheck );
//
//        SizeableBorderedHorizontalSplitPairPanel zHSP2 = new SizeableBorderedHorizontalSplitPairPanel().stretchable();
//        zHSP2.add( createCurrentTasks() );
//        zHSP2.add( createTree() );
//        add( zHSP2 );
//
////        SizeableHorizontalSplitPairPanel zHSP = new SizeableHorizontalSplitPairPanel().stretchable();
////        add( zHSP );
////
////        zHSP.add( zFrmTA );
////        zHSP.add( zHSP2 );
//
//        collectEnableables( mFormComponents, this );
//
//        SizeableHorizontalPanel hBtnPanel = new SizeableHorizontalPanel().stretchableHorizontally();
//        hBtnPanel.add( mEnable = Button.named( "Enable" ).green().text().add( new ClickHandler()
//        {
//            @Override
//            public void onClick( ClickEvent event )
//            {
//                enableDisable( true, mDisable, mEnable );
//            }
//        } ).create() );
//        mEnable.disable();
//
//        hBtnPanel.add( mDisable = Button.named( "Disable" ).red().text().add( new ClickHandler()
//        {
//            @Override
//            public void onClick( ClickEvent event )
//            {
//                enableDisable( false, mEnable, mDisable );
//            }
//        } ).create() );
//        hBtnPanel.add( new SizeableSpacer().stretchableHorizontally() );
////        hBtnPanel.add( mDialog = ScreenBigButton.factory( "Dialog" ).add( new ClickHandler()
////        {
////            @Override
////            public void onClick( ClickEvent event )
////            {
////                AlertManager.alert( "Test", "A Dialog", "The Body" );
////            }
////        } ).create() );
//        add( hBtnPanel );
    }

//    private void enableDisable( boolean pEnable, Enableable pButtonToEnable, Enableable pButtonToDisable )
//    {
//        pButtonToDisable.setEnabled( false );
//        mDialog.setEnabled( pEnable );
//        for ( Enableable zEnableable : mFormComponents )
//        {
//            zEnableable.setEnabled( pEnable );
//        }
//        pButtonToEnable.setEnabled( true );
//    }


//    private void collectEnableables( List<Enableable> pFormComponents, HasWidgets pWidget )
//    {
//        for ( Widget zWidget : pWidget )
//        {
//            if ( (zWidget instanceof Enableable) && !(zWidget instanceof Button) )
//            {
//                pFormComponents.add( (Enableable) zWidget );
//            }
//            if ( zWidget instanceof HasWidgets )
//            {
//                collectEnableables( pFormComponents, (HasWidgets) zWidget );
//            }
//        }
//    }

    private static class MyListener implements IFormComponent.Listener
    {
        protected IFormComponent mComponent;
        private Object mErrorValue;
        protected Object mOrigValue, mCurValue;
        private String mWhat;

        public MyListener( Object pErrorValue )
        {
            mErrorValue = pErrorValue;
        }

        @Override
        public void add( IFormComponent pComponent )
        {
            mComponent = pComponent;
            mOrigValue = mCurValue = mComponent.getCurrentValue();
            mWhat = Objects.justClassNameOf( mComponent );
        }

        @Override
        public void remove( IFormComponent pComponent )
        {
        }

        @Override
        public void changeOccurred()
        {
            mCurValue = mComponent.getCurrentValue();
//            System.out.println( mWhat + " Change: '" + mCurValue + "'" );
            printToStatusbar( mWhat + " Change: '" + mCurValue + "'" );
            mComponent.setValueChanged( !Objects.areNonArraysEqual( mOrigValue, mCurValue ) );
            mComponent.setError( null );
        }

        @Override
        public void blurOccurred()
        {
//            System.out.println( mWhat + " Blur" );
            printToStatusbar( mWhat + " Blur" );
            mComponent.setFocused( false );
            mComponent.setError( Objects.areNonArraysEqual( mErrorValue, mCurValue ) ? "Error!" : null );
        }

        @Override
        public void focusOccured()
        {
            mComponent.setFocused( true );
//            System.out.println( mWhat + " Focus" );
            printToStatusbar( mWhat + " Focus" );
        }

        public void setCurrentValue( String pNewValue )
        {
            mComponent.setCurrentValue( pNewValue );
            mCurValue = mOrigValue = mComponent.getCurrentValue();
            mComponent.setValueChanged( false );
            mComponent.setError( null );
        }

        @Override
        public void enterPressed( KeyboardKeyModifier pModifiers )
        {
        }
    }

//    private static class MyDecimalFormatListener implements IFormComponent.Listener
//    {
//        private IFormComponent mComponent;
//        private Object mErrorValue;
//        private Object mOrigValue, mCurValue;
//        private String mWhat;
//
//        public MyDecimalFormatListener( Object pErrorValue )
//        {
//            mErrorValue = pErrorValue;
//        }
//
//        @Override
//        public void add( IFormComponent pComponent )
//        {
//            mComponent = pComponent;
//            mOrigValue = mComponent.getCurrentValue();
//            mWhat = UtilsCommon.justClassNameOf( mComponent );
//        }
//
//        @Override
//        public void remove( IFormComponent pComponent )
//        {
//        }
//
//        @Override
//        public void changeOccurred()
//        {
//            mCurValue = mComponent.getCurrentValue();
////            System.out.println( mWhat + " Change: '" + mCurValue + "'" );
//            printToStatusbar( mWhat + " Change: '" + mCurValue + "'" );
//            mComponent.setValueChanged( !UtilsGwt.areNonArraysEqual( mOrigValue, mCurValue ) );
//            mComponent.setError( null );
//        }
//
//        @Override
//        public void blurOccurred()
//        {
//            mComponent.setFocused( false );
//
//            mCurValue = mComponent.getCurrentValue();
//            String zStrVal = mCurValue.toString();
//            NumberFormat zFormat = NumberFormat.getDecimalFormat();
//
////            double zDouble = Double.parseDouble( zStrVal );
////            String zFormattedValue = zFormat.format( zDouble );
////            mComponent.setCurrentValue( zFormattedValue );
////            mComponent.setError( UtilsGwt.areNonArraysEqual( mErrorValue, mCurValue ) ? "Error!" : null );
//        }
//
//        @Override
//        public void focusOccured()
//        {
//            mComponent.setFocused( true );
////            System.out.println( mWhat + " Focus" );
//            printToStatusbar( mWhat + " Focus" );
//        }
//
//        public void setCurrentValue( String pNewValue )
//        {
//            mComponent.setCurrentValue( pNewValue );
//            mCurValue = mOrigValue = mComponent.getCurrentValue();
//            mComponent.setValueChanged( false );
//            mComponent.setError( null );
//        }
//
//        @Override
//        public void enterPressed( KeyboardKeyModifier pModifiers )
//        {
//        }
//    }

//    private static class MyCurrencyFormatListener implements IFormComponent.Listener
//    {
//        private IFormComponent mComponent;
//        private Object mErrorValue;
//        private Object mOrigValue, mCurValue;
//        private String mWhat;
//
//        public MyCurrencyFormatListener( Object pErrorValue )
//        {
//            mErrorValue = pErrorValue;
//        }
//
//        @Override
//        public void add( IFormComponent pComponent )
//        {
//            mComponent = pComponent;
//            mOrigValue = mComponent.getCurrentValue();
//            mWhat = UtilsCommon.justClassNameOf( mComponent );
//        }
//
//        @Override
//        public void remove( IFormComponent pComponent )
//        {
//        }
//
//        @Override
//        public void changeOccurred()
//        {
//            mCurValue = mComponent.getCurrentValue();
////            System.out.println( mWhat + " Change: '" + mCurValue + "'" );
//            printToStatusbar( mWhat + " Change: '" + mCurValue + "'" );
//            mComponent.setValueChanged( !UtilsGwt.areNonArraysEqual( mOrigValue, mCurValue ) );
//            mComponent.setError( null );
//        }
//
//        @Override
//        public void blurOccurred()
//        {
//            mComponent.setFocused( false );
//
//            mCurValue = mComponent.getCurrentValue();
//            String zStrVal = mCurValue.toString();
//            NumberFormat zFormat = NumberFormat.getCurrencyFormat();
//
//            Double zDouble = Double.valueOf( zStrVal );
//            String zFormattedValue = zFormat.format( zDouble.doubleValue() );
//            mComponent.setCurrentValue( zFormattedValue );
////            mComponent.setError( UtilsGwt.areNonArraysEqual( mErrorValue, mCurValue ) ? "Error!" : null );
//        }
//
//        @Override
//        public void focusOccured()
//        {
//            mComponent.setFocused( true );
////            System.out.println( mWhat + " Focus" );
//            printToStatusbar( mWhat + " Focus" );
//        }
//
//        public void setCurrentValue( String pNewValue )
//        {
//            mComponent.setCurrentValue( pNewValue );
//            mCurValue = mOrigValue = mComponent.getCurrentValue();
//            mComponent.setValueChanged( false );
//            mComponent.setError( null );
//        }
//
//        @Override
//        public void enterPressed( KeyboardKeyModifier pModifiers )
//        {
//        }
//    }

//    private static class MyResourceProvider implements ResourceKeyNameURLprovider
//    {
//        @Override
//        public ResourceKeyNameURL[] getLocalResourceKeyNameURLs()
//        {
//            return new ResourceKeyNameURL[]{new ResourceKeyNameURL( "AU", "Audi", "common/images/misc/tmp/audi.jpg" ),//
//                                            new ResourceKeyNameURL( "BM", "BMW", "common/images/misc/tmp/bmw.jpg" ),//
//                                            new ResourceKeyNameURL( "CH", "Chevrolet", "common/images/misc/tmp/chevy.jpg" ),//
//                                            new ResourceKeyNameURL( "FD", "Ford", "common/images/misc/tmp/ford.jpg" ),//
//                                            new ResourceKeyNameURL( "JA", "Jaguar", "common/images/misc/tmp/jag.jpg" ),//
//                                            new ResourceKeyNameURL( "MZ", "Mazda", "common/images/misc/tmp/mazda.jpg" ),//
//                                            new ResourceKeyNameURL( "MB", "Mercedes-Benz", "common/images/misc/tmp/mbenz.jpg" ),//
//                                            new ResourceKeyNameURL( "NS", "Nissan", "common/images/misc/tmp/nissan.jpg" ),//
//                                            new ResourceKeyNameURL( "TT", "Tata", "common/images/misc/tmp/tata.jpg" ),//
//                                            new ResourceKeyNameURL( "VW", "Volkswagen", "common/images/misc/tmp/vw.jpg" ),//
//                                            ERROR_RESOURCE,//
//            };
//        }
//
//        @Override
//        public void requestResourceKeyNameURLs( ResourceKeyNameURLsAvailableCallback pCallback )
//                throws UnsupportedOperationException
//        {
//            //To change body of implemented methods use File | Settings | File Templates.
//        }
//    }

    private static void printToStatusbar( String pMessage )
    {
        System.out.println( pMessage );
        String current = StatusBar.get();
        StatusBar.set( pMessage + " | " + current );
    }

//    private TreeNode mTI2, mTI;
//    private int mAddIndex = 0;
//
//    private void addTo( SizeableTree zTree )
//    {
//        switch ( (mAddIndex++ & 7) )
//        {
//            case 0:
//                mTI = zTree.addChild( augment( "One" ) );
//                break;
//            case 1:
//                mTI2 = mTI.addChild( augment( "A" ) );
//                mTI.addChild( augment( "B" ) );
//                mTI.addChild( augment( "C" ) );
//                break;
//            case 2:
//                mTI2.addChild( augment( "I" ) );
//                mTI2.addChild( augment( "II" ) );
//                mTI2.addChild( augment( "III" ) );
//                mTI2.addChild( augment( "IV" ) );
//                mTI2.addChild( augment( "V" ) );
//                break;
//            case 3:
//                mTI = zTree.addChild( augment( "Two" ) );
//                break;
//            case 4:
//                mTI.addChild( augment( "A" ) );
//                mTI2 = mTI.addChild( augment( "B" ) );
//                mTI.addChild( augment( "C" ) );
//                break;
//            case 5:
//                mTI2.addChild( augment( "I" ) );
//                mTI2.addChild( augment( "II" ) );
//                mTI2.addChild( augment( "III" ) );
//                mTI2.addChild( augment( "IV" ) );
//                mTI2.addChild( augment( "V" ) );
//                break;
//            case 6:
//                mTI = zTree.addChild( augment( "Three" ) );
//                break;
//            case 7:
//                mTI.addChild( augment( "A" ) );
//                mTI.addChild( augment( "B" ) );
//                mTI2 = mTI.addChild( augment( "C" ) );
//                mTI2.addChild( augment( "I" ) );
//                mTI2.addChild( augment( "II" ) );
//                mTI2.addChild( augment( "III" ) );
//                mTI2.addChild( augment( "IV" ) );
//                mTI2.addChild( augment( "V" ) );
//                break;
//        }
//    }
//
//    private String augment( String pBaseName )
//    {
//        return pBaseName + "-" + mAddIndex;
//    }
//
//    private Widget createTree()
//    {
//        Button zOpenAll = FolderOpenButton.factory().create();
//        Button zCloseAll = FolderClosedButton.factory().create();
//        final SizeableTree zTree = SizeableTree.withFolders();
//        zTree.connectOpenCloseButtons( zOpenAll, zCloseAll );
//        zTree.setAnimationEnabled( true );
//        zTree.addTreeSelectionListener( new TreeSelectionListener()
//        {
//            @Override
//            public void selected( Object pSelected )
//            {
//                System.out.println( "Tree Selected: " + pSelected );
//            }
//        } );
//        zTree.addTreeOpenCloseListener( new TreeOpenCloseListener()
//        {
//            @Override
//            public void openStateChanged( Boolean pOpened )
//            {
//                System.out.println( "Tree Opened: " + pOpened + " - " + zTree.areAnyOpen() );
//            }
//        } );
//
//        SizeableHorizontalPanel hPanel = new SizeableHorizontalPanel().stretchableHorizontally();
//        hPanel.add( zOpenAll );
//        hPanel.add( zCloseAll );
//        hPanel.add( new Spacer( 10 ) );
//        hPanel.add( new Label( "Some Text" ) );
//        hPanel.add( Button.named( "Add" ).blue().text().add( new ClickHandler()
//        {
//            @Override
//            public void onClick( ClickEvent event )
//            {
//                addTo( zTree );
//            }
//        } ).create() );
//        hPanel.add( Button.named( "Remove" ).blue().text().add( new ClickHandler()
//        {
//            @Override
//            public void onClick( ClickEvent event )
//            {
//                if ( !zTree.isEmpty() )
//                {
//                    Object zUserObject = zTree.getSelected();
//                    if ( zUserObject == null )
//                    {
//                        zUserObject = zTree.iterator().next();
//                    }
//                    zTree.removeDescendant( zUserObject );
//                }
//            }
//        } ).create() );
//        hPanel.add( Button.named( "Remove1st" ).blue().text().add( new ClickHandler()
//        {
//            @Override
//            public void onClick( ClickEvent event )
//            {
//                if ( !zTree.isEmpty() )
//                {
//                    Object zUserObject = zTree.iterator().next();
//                    zTree.removeChild( zUserObject );
//                }
//            }
//        } ).create() );
//
//        SizeableVerticalPanel vPanel = new SizeableVerticalPanel().stretchable();
//        vPanel.add( hPanel );
//        vPanel.add( zTree );
//
//        return vPanel;
//    }

//    private Widget createCurrentTasks()
//    {
//        return new CurrentTasks();
//    }
}

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

Diff revisions: vs.
Revision Author Commited Message
922 Diff Diff GeorgeS picture GeorgeS Tue 18 Feb, 2014 16:18:01 +0000

Mini App ready for packaging...

898 Diff Diff GeorgeS picture GeorgeS Sun 17 Mar, 2013 21:46:33 +0000

Temporal!!!

860 Diff Diff GeorgeS picture GeorgeS Mon 05 Nov, 2012 01:39:02 +0000
858 Diff Diff GeorgeS picture GeorgeS Sun 04 Nov, 2012 18:40:40 +0000
811 Diff Diff GeorgeS picture GeorgeS Sat 18 Aug, 2012 13:45:18 +0000
804 Diff Diff GeorgeS picture GeorgeS Wed 15 Aug, 2012 12:48:51 +0000
613 Diff Diff GeorgeS picture GeorgeS Thu 15 Mar, 2012 13:38:15 +0000

Table Fix

611 Diff Diff GeorgeS picture GeorgeS Wed 14 Mar, 2012 02:21:21 +0000

Date Picker...

610 Diff Diff GeorgeS picture GeorgeS Mon 12 Mar, 2012 00:54:00 +0000
607 GeorgeS picture GeorgeS Mon 05 Mar, 2012 02:51:31 +0000