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
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
package org.litesoft.GWT.client.nonpublic;

import java.util.*;

import com.google.gwt.user.client.*;
import com.google.gwt.user.client.ui.*;
import org.litesoft.GWT.client.*;
import org.litesoft.GWT.client.widgets.*;
import org.litesoft.GWT.client.widgets.nonpublic.*;
import org.litesoft.GWT.client.widgets.nonpublic.external.*;
import org.litesoft.core.util.*;
import org.litesoft.logger.*;
import org.litesoft.logger.nonpublic.*;

public abstract class AbstractFloaterPanel extends AbstractSizeablePanel
        implements UiPositionAndSizeAdjustable,
                   IndexedPanel,
                   SizeableSingleWidgetContainer
{
    public static final int BORDER_T_H = 7;
    public static final int BORDER_B_H = 7;

    public static final int BORDER_L_W = 7;
    public static final int BORDER_R_W = 7;

    protected static final Logger LOGGER = LoggerFactory.getLogger( AbstractFloaterPanel.class );

    protected AbstractLogger mLogger = LOGGER.trace;

    protected String mBaseCSSclassname;
    protected String mForm;
    private WidgetCollection mChildren = new WidgetCollection( this );
    protected TitleBarPanel mTitleBarPanel;
    protected Controller mDragController;
    private ContentPanel mContent;
    private Element mTR_Pining, mTR_RightAchoring, mTR_BottomAchoring;

    protected AbstractFloaterPanel( String pForm )
    {
        initializeElements( getHelper().create_OeTable_SeIeTBody(), null );

        /*
        * Bug 2454: vz's lose their edge! Force overflow:visible so that outer
        * table will not clip its children if wider than its parent container's
        * width (FFox, Opera). Currently commented out b/c it breaks pickled
        * sizing in Firefox.
        */
        // DOM.setStyleAttribute(getHelper().getStyleElement(), "overflow", "visible");

        addStyleName( mBaseCSSclassname = "litesoft-NoSizeAffectingCSS-" + (mForm = pForm) );

        mTitleBarPanel = new TitleBarPanel( "litesoft-" + pForm + "TitleBar" );
        mContent = new ContentPanel( pForm );

        LLstretchable();
    }

    protected DragGesture createTitleBarDragGesture( UiPositionable pUiPositionable )
    {
        return new DragPositionableController( pUiPositionable );
    }

    private static class ContentPanel extends ClippingSimplePanel
    {
        public ContentPanel( String pForm )
        {
            super( "litesoft-NoSizeAffectingCSS-" + pForm + "ContentPane" );
        }
    }

    public void relayout()
    {
        mLogger.log( "relayout" );
        mWidthHandler.relayout();
        mHeightHandler.relayout();
    }

    public boolean isSizingPending()
    {
        return mWidthHandler.isPendingAny() || mHeightHandler.isPendingAny();
    }

    public Element getTR_Pinning()
    {
        return mTR_Pining;
    }

    public Element getTR_RightAnchoring()
    {
        return mTR_RightAchoring;
    }

    public Element getTR_BottomAnchoring()
    {
        return mTR_BottomAchoring;
    }

    public int getTitleBarHeight()
    {
        return mTitleBarPanel.getOffsetHeight();
    }

    public String getTitle()
    {
        FloaterTitleBar zTitleBar = getTitleBar();
        return (zTitleBar != null) ? zTitleBar.getTitleBarTitle() : null;
    }
//    public String getTitle()
//    {
//        FloaterPanelTitleBar zTitleBar = getTitleBar();
//        return (zTitleBar != null) ? zTitleBar.getTitleBarTitle() : null;
//    }

    public void setTitle( String title )
    {
        FloaterTitleBar zTitleBar = getTitleBar();
        if ( zTitleBar == null )
        {
            setTitleBar( zTitleBar = new OurTextOnlyTitleBar() );
        }
        zTitleBar.setTitleBarTitle( title );
    }
//    public void setTitle( String title )
//    {
//        FloaterPanelTitleBar zTitleBar = getTitleBar();
//        if ( zTitleBar == null )
//        {
//            setTitleBar( zTitleBar = new OurTextOnlyTitleBar() );
//        }
//        zTitleBar.setTitleBarTitle( title );
//    }

    public void setPosition( int pLeft, int pTop )
    {
        setPosLeft( pLeft );
        setPosTop( pTop );
    }

    public SizeWidthHeight getContentSize()
    {
        Widget w = getWidget();
        return (w != null) ? new SizeWidthHeight( w.getOffsetWidth(), w.getOffsetHeight() ) : null;
    }

    /**
     * Gets the panel's child widget.
     *
     * @return the child widget, or <code>null</code> if none is present
     */
    public Widget getWidget()
    {
        return mContent.getWidget();
    }

    /**
     * Sets this panel's widget. Any existing child widget will be removed.
     */
    public void setWidget( Widget pWidget )
    {
        mContent.setWidget( pWidget );
        reinitializeSize();
    }

    public FloaterTitleBar getTitleBar()
    {
        return (FloaterTitleBar) mTitleBarPanel.getWidget();
    }

//    public FloaterPanelTitleBar getTitleBar()
//    {
//        return (FloaterPanelTitleBar) mTitleBarPanel.getWidget();
//    }
//
//    public void setTitleBar( FloaterPanelTitleBar pWidget )
//    {
//        mTitleBarPanel.setWidget( pWidget );
//        reinitializeSize();
//    }

    public void setTitleBar( FloaterTitleBar pWidget )
    {
        mTitleBarPanel.setWidget( pWidget );
        reinitializeSize();
    }

    public void initializeSize()
    {
        initializeWidth();
        initializeHeight();
    }

    protected void reinitializeSize()
    {
        mWidthHandler.reinitializeDimension();
        mHeightHandler.reinitializeDimension();
    }

    private boolean mSizingWorking = false;

    public void setSizingWorking()
    {
        mSizingWorking = true;
        setVisible( true );
    }

    public boolean isSizingWorking()
    {
        return mSizingWorking;
    }

    private int getPrefferredWidth( SizeableSimplePanel pOurWrapper )
    {
        if ( pOurWrapper != null )
        {
            Widget widget = pOurWrapper.getWidget();
            if ( widget != null )
            {
                return widget.getOffsetWidth();
            }
        }
        return 0;
    }

    private int getPrefferredWidth( ContentPanel pOurWrapper )
    {
        if ( pOurWrapper != null )
        {
            Widget widget = pOurWrapper.getWidget();
            if ( widget != null )
            {
                return widget.getOffsetWidth();
            }
        }
        return 0;
    }

    private int getPrefferredHeight( SizeableSimplePanel pOurWrapper )
    {
        if ( pOurWrapper != null )
        {
            Widget widget = pOurWrapper.getWidget();
            if ( widget != null )
            {
                return widget.getOffsetHeight();
            }
        }
        return 0;
    }

    private int getPrefferredHeight( ContentPanel pOurWrapper )
    {
        if ( pOurWrapper != null )
        {
            Widget widget = pOurWrapper.getWidget();
            if ( widget != null )
            {
                return widget.getOffsetHeight();
            }
        }
        return 0;
    }

    public boolean setPrefferredWidth()
    {
        int w1 = getPrefferredWidth( mTitleBarPanel );
        int w2 = getPrefferredWidth( mContent );
        return (w1 > 0) && (w2 > 0) && setWidths( Math.max( w1, w2 ) );
    }

    public boolean adjustWidthBy( int pDelta )
    {
        // System.out.println( "adjustSizeBy(" + pDelta + ")" );
        if ( pDelta != 0 )
        {
            int curWidth = mContent.getOffsetWidth();
            int newWidthContent = curWidth + pDelta;
            if ( (curWidth <= 0) || ((pDelta < 0) && (newWidthContent < MinContentWidth)) )
            {
                return false;
            }
            setWidths( newWidthContent );
        }
        return true;
    }

    public void initializeWidth()
    {
        mWidthHandler.initializeDimension();
    }

    public void setWidth( String pWidth )
    {
        mWidthHandler.setDimension( pWidth );
    }

    protected int getMaxPotentialWidth()
    {
        return -1;
    }

    private FloaterPositionHandler createWidthPositionHandler()
    {
        return new FloaterPositionHandler()
        {
            public int getPos()
            {
                return getPosLeft();
            }

            public void setPos( int pNewPos )
            {
                setPosLeft( pNewPos );
            }

            public int getMaxPotentialSize()
            {
                return getMaxPotentialWidth();
            }
        };
    }

    protected DeferableFloaterDimensionHandler mWidthHandler = //
            new DeferableFloaterDimensionHandler( this, mLogger, getWidthHelper(),
                                                  createWidthPositionHandler() );

    public boolean setPrefferredHeight()
    {
        return setTitleBarPrefferredHeight() & setContentPrefferredHeight();
    }

    public boolean adjustHeightBy( int pDelta )
    {
        if ( pDelta != 0 )
        {
            int curHeight = mContent.getOffsetHeight();
            int newHeightContent = curHeight + pDelta;
            if ( (curHeight <= 0) || ((pDelta < 0) && (newHeightContent < MinContentHeight)) )
            {
                return false;
            }
            setContentHeight( newHeightContent );
        }
        return true;
    }

    public void initializeHeight()
    {
        mHeightHandler.initializeDimension();
    }

    public void setHeight( String pHeight )
    {
        mHeightHandler.setDimension( pHeight );
    }

    protected int getMaxPotentialHeight()
    {
        return -1;
    }

    private FloaterPositionHandler createHeightPositionHandler()
    {
        return new FloaterPositionHandler()
        {
            public int getPos()
            {
                return getPosTop();
            }

            public void setPos( int pNewPos )
            {
                setPosTop( pNewPos );
            }

            public int getMaxPotentialSize()
            {
                return getMaxPotentialHeight();
            }
        };
    }

    protected DeferableFloaterDimensionHandler mHeightHandler = //
            new DeferableFloaterDimensionHandler( this, mLogger, getHeightHelper(),
                                                  createHeightPositionHandler() );

    private boolean setTitleBarPrefferredHeight()
    {
        int height = getPrefferredHeight( mTitleBarPanel );
        if ( height > 0 )
        {
            setHeightOn( mTitleBarPanel, height, mTsLeftTitleBar, mTsRightTitleBar );
            return true;
        }
        return false;
    }

    private boolean setContentPrefferredHeight()
    {
        int height = getPrefferredHeight( mContent );
        if ( height > 0 )
        {
            setContentHeight( height );
            return true;
        }
        return false;
    }

    private void setContentHeight( int pHeight )
    {
        mHeightHandler.LLsetDimension( mTitleBarPanel.getOffsetHeight() + BORDER_TB_H +
                                       setHeightOn( mContent, pHeight, mTsLeftContent, mTsRightContent ) );
    }

    private int setHeightOn( Widget pWidget, int pHeight, Widget pLeftBorder, Widget pRightBorder )
    {
        int zBorderHeight = pHeight - CplusSize;
        if ( zBorderHeight < 1 )
        {
            pHeight = CplusSize + (zBorderHeight = 1); // MinContentHeight
        }
        pWidget.setHeight( "" + pHeight );
        pLeftBorder.setHeight( "" + zBorderHeight );
        pRightBorder.setHeight( "" + zBorderHeight );
        return pHeight;
    }

    protected void distributeToChildrenChangedWidth()
    {
        setWidths( getOurInnerSize( getWidthHelper() ) - BORDER_LR_W );
    }

    protected void distributeToChildrenChangedHeight()
    {
        int size = getOurInnerSize( getHeightHelper() ) - BORDER_TB_H;
        setContentHeight( size - mTitleBarPanel.getOffsetHeight() );
    }

    private int getOurInnerSize( ISizeableDimensionHelper pDimensionHelper )
    {
        return pDimensionHelper.getDimension() - pDimensionHelper.getDecorationSize();
    }

    private boolean setWidths( int pDesiredWidth )
    {
        int zBorderWidth = pDesiredWidth - CplusSize2;
        if ( zBorderWidth < 1 )
        {
            pDesiredWidth = CplusSize + (zBorderWidth = 1); // MinContentWidth
        }

        mTsTop.setWidth( "" + zBorderWidth );
        mTsBottom.setWidth( "" + zBorderWidth );
        mTitleBarPanel.setWidth( "" + pDesiredWidth );
        mContent.setWidth( "" + pDesiredWidth );
        mWidthHandler.LLsetDimension( pDesiredWidth + BORDER_LR_W );
        return true;
    }

    /**
     * Adds a widget to this panel.
     *
     * @param w the child widget to be added
     */
    public void add( Widget w )
    {
        throw new IllegalStateException( "Use setWidget()" );
    }

    public boolean remove( Widget w )
    {
        throw new IllegalStateException( "Use setWidget()" );
    }

    public boolean anyChildren()
    {
        return (mChildren.size() != 0);
    }

    public Iterator<Widget> iterator()
    {
        return mChildren.iterator();
    }

    public Widget getWidget( int index )
    {
        return mChildren.get( index );
    }

    public int getWidgetCount()
    {
        return mChildren.size();
    }

    public int getWidgetIndex( Widget child )
    {
        return mChildren.indexOf( child );
    }

    public boolean remove( int index )
    {
        return false;
    }

    private static class OurTextOnlyTitleBar extends FloaterTitleBar
//    private static class OurTextOnlyTitleBar extends FloaterPanelTitleBar
    {
        private SizeableLabel mLabel = new SizeableLabel( "", false ).stretchableHorizontally();

        public OurTextOnlyTitleBar()
        {
            add( mLabel );
            add( new SizeableSpacer().width( 10 ).stretchableHorizontally() );
        }

        public String getTitleBarTitle()
        {
            return mLabel.getText();
        }

        public void setTitleBarTitle( String pTitle )
        {
            mLabel.setText( pTitle );
        }
    }

    private abstract static class AbstractResizer extends AbstractDragger
    {
        private static final String MINIMUM_SIZE_REACHED = "Resizing Terminated, Minimum Size Reached";

        private final UiPositionAndSizeAdjustable mTarget;

        public AbstractResizer( UiPositionAndSizeAdjustable pTarget )
        {
            mTarget = pTarget;
        }

        public UiPositionAndSizeAdjustable getTarget()
        {
            return mTarget;
        }

        protected boolean adjustPositionBy( int pDeltaX, int pDeltaY )
        {
            // System.out.println( "adjustPositionBy(" + pDeltaX + "," + pDeltaY + ")" );
            getTarget().setPosition( getTarget().getPosLeft() + pDeltaX, getTarget().getPosTop() + pDeltaY );
            return true;
        }

        protected boolean adjustSizeBy( int pDeltaX, int pDeltaY )
        {
            // System.out.println( "adjustSizeBy(" + pDeltaX + "," + pDeltaY + ")" );
            return getTarget().adjustWidthBy( pDeltaX ) && getTarget().adjustHeightBy( pDeltaY );
        }

        public void start( MouseEvent e )
        {
            super.start( e );
            StatusBar.remove( MINIMUM_SIZE_REACHED );
        }

        protected final boolean dragBy( int pDeltaX, int pDeltaY )
        {
            boolean success = dragByInner( pDeltaX, pDeltaY );
            if ( !success )
            {
                StatusBar.add( MINIMUM_SIZE_REACHED );
            }
            return success;
        }

        abstract protected boolean dragByInner( int pDeltaX, int pDeltaY );
    }

    private static class ResizerTopLeft extends AbstractResizer
    {
        public ResizerTopLeft( UiPositionAndSizeAdjustable pTarget )
        {
            super( pTarget );
        }

        protected boolean dragByInner( int pDeltaX, int pDeltaY )
        {
            return adjustSizeBy( -pDeltaX, -pDeltaY ) && adjustPositionBy( pDeltaX, pDeltaY );
        }
    }

    private static class ResizerTopRight extends AbstractResizer
    {
        public ResizerTopRight( UiPositionAndSizeAdjustable pTarget )
        {
            super( pTarget );
        }

        protected boolean dragByInner( int pDeltaX, int pDeltaY )
        {
            return adjustSizeBy( pDeltaX, -pDeltaY ) && adjustPositionBy( 0, pDeltaY );
        }
    }

    private static class ResizerBottomRight extends AbstractResizer
    {
        public ResizerBottomRight( UiPositionAndSizeAdjustable pTarget )
        {
            super( pTarget );
        }

        protected boolean dragByInner( int pDeltaX, int pDeltaY )
        {
            return adjustSizeBy( pDeltaX, pDeltaY );
        }
    }

    private static class ResizerBottomLeft extends AbstractResizer
    {
        public ResizerBottomLeft( UiPositionAndSizeAdjustable pTarget )
        {
            super( pTarget );
        }

        protected boolean dragByInner( int pDeltaX, int pDeltaY )
        {
            return adjustSizeBy( -pDeltaX, pDeltaY ) && adjustPositionBy( pDeltaX, 0 );
        }
    }

    private static class ResizerTop extends AbstractResizer
    {
        public ResizerTop( UiPositionAndSizeAdjustable pTarget )
        {
            super( pTarget );
        }

        protected boolean dragByInner( int pDeltaX, int pDeltaY )
        {
            return adjustSizeBy( 0, -pDeltaY ) && adjustPositionBy( 0, pDeltaY );
        }
    }

    private static class ResizerBottom extends AbstractResizer
    {
        public ResizerBottom( UiPositionAndSizeAdjustable pTarget )
        {
            super( pTarget );
        }

        protected boolean dragByInner( int pDeltaX, int pDeltaY )
        {
            return adjustSizeBy( 0, pDeltaY );
        }
    }

    private static class ResizerRight extends AbstractResizer
    {
        public ResizerRight( UiPositionAndSizeAdjustable pTarget )
        {
            super( pTarget );
        }

        protected boolean dragByInner( int pDeltaX, int pDeltaY )
        {
            return adjustSizeBy( pDeltaX, 0 );
        }
    }

    private static class ResizerLeft extends AbstractResizer
    {
        public ResizerLeft( UiPositionAndSizeAdjustable pTarget )
        {
            super( pTarget );
        }

        protected boolean dragByInner( int pDeltaX, int pDeltaY )
        {
            return adjustSizeBy( -pDeltaX, 0 ) && adjustPositionBy( pDeltaX, 0 );
        }
    }

    private Element LLaddTD( Element pTR, Widget pWidget )
    {
        mChildren.add( pWidget );

        Element zTD = DOM.createTD();
        DOM.appendChild( pTR, zTD );

        adopt( pWidget, zTD );

        return zTD;
    }

    private Element addTDWithColSpan3( Element pTR, Widget pWidget )
    {
        Element zTD = LLaddTD( pTR, pWidget );

        DOM.setElementPropertyInt( zTD, "colSpan", 3 );

        return zTD;
    }

    private void addTD( Element pTR, Widget pWidget )
    {
        Element zTD = addTDWithColSpan3( pTR, pWidget );
        DOM.setElementPropertyInt( zTD, "rowSpan", 2 );
    }

    private Widget addTD( Element pTR, String pBorderID, String pClassPlus, int pWidth, int pHeight,
                          DragGesture pResizer )
    {
        Border border = new Border( "litesoft-" + mForm + "Border" + pBorderID + pClassPlus );
        border.addController( createBorderDragController( pResizer ) );
        border.addController( PreventSelectionController.getInstance() );

        LLaddTD( pTR, border );

        if ( pWidth > 0 )
        {
            border.setWidth( "" + pWidth );
        }
        if ( pHeight > 0 )
        {
            border.setHeight( "" + pHeight );
        }
        return border;
    }

    private void addTDCorner( Element pTR, String pBorderID, int pWidth, int pHeight, DragGesture pResizer )
    {
        addTD( pTR, pBorderID, "", pWidth, pHeight, pResizer );
    }

    private Widget addTDHorizontal( Element pTR, String pBorderID, int pHeight, DragGesture pResizer )
    {
        return addTD( pTR, pBorderID, "", 0, pHeight, pResizer );
    }

    private Widget addTDVertical( Element pTR, String pBorderID, String pClassPlus, int pWidth,
                                  DragGesture pResizer )
    {
        return addTD( pTR, pBorderID, pClassPlus, pWidth, 0, pResizer );
    }

    abstract protected DragController createBorderDragController( DragGesture pResizer );

    protected void finishContainerTable( UiPositionAndSizeAdjustable pTarget )
    {
        Element zTR, tBody = getContainerElement();

        DragGesture resizerTopLeft = new ResizerTopLeft( pTarget );
        DragGesture resizerTop = new ResizerTop( pTarget );
        DragGesture resizerTopRight = new ResizerTopRight( pTarget );
        DragGesture resizerRight = new ResizerRight( pTarget );
        DragGesture resizerBottomRight = new ResizerBottomRight( pTarget );
        DragGesture resizerBottom = new ResizerBottom( pTarget );
        DragGesture resizerBottomLeft = new ResizerBottomLeft( pTarget );
        DragGesture resizerLeft = new ResizerLeft( pTarget );

        DOM.appendChild( tBody, mTR_Pining = DOM.createTR() );
        addTDCorner( mTR_Pining, "CornerTopLeft", BORDER_L_W, BORDER_T_H, resizerTopLeft );
        addTDCorner( mTR_Pining, "CornerTopLeftUp", CplusSize, BORDER_T_H, resizerTopLeft );
        mTsTop = addTDHorizontal( mTR_Pining, "StraightTop", BORDER_T_H, resizerTop );
        addTDCorner( mTR_Pining, "CornerTopRightUp", CplusSize, BORDER_T_H, resizerTopRight );
        addTDCorner( mTR_Pining, "CornerTopRight", BORDER_R_W, BORDER_T_H, resizerTopRight );

        DOM.appendChild( tBody, zTR = DOM.createTR() );
        addTDCorner( zTR, "CornerTopLeftDown", BORDER_L_W, CplusSize, resizerTopLeft );
        addTD( zTR, mTitleBarPanel );
        addTDCorner( zTR, "CornerTopRightDown", BORDER_R_W, CplusSize, resizerTopRight );

        DOM.appendChild( tBody, zTR = DOM.createTR() );
        mTsLeftTitleBar = addTDVertical( zTR, "StraightLeft", CPT, BORDER_L_W, resizerLeft );
        mTsRightTitleBar = addTDVertical( zTR, "StraightRight", CPT, BORDER_R_W, resizerRight );

        DOM.appendChild( tBody, zTR = DOM.createTR() );
        mTsLeftContent = addTDVertical( zTR, "StraightLeft", CPC, BORDER_L_W, resizerLeft );
        addTD( zTR, mContent );
        mTsRightContent = addTDVertical( zTR, "StraightRight", CPC, BORDER_R_W, resizerRight );

        DOM.appendChild( tBody, mTR_RightAchoring = zTR = DOM.createTR() );
        addTDCorner( zTR, "CornerBottomLeftUp", BORDER_L_W, CplusSize, resizerBottomLeft );
        addTDCorner( zTR, "CornerBottomRightUp", BORDER_R_W, CplusSize, resizerBottomRight );

        DOM.appendChild( tBody, mTR_BottomAchoring = DOM.createTR() );
        addTDCorner( mTR_BottomAchoring, "CornerBottomLeft", BORDER_L_W, BORDER_B_H, resizerBottomLeft );
        addTDCorner( mTR_BottomAchoring, "CornerBottomLeftDown", CplusSize, BORDER_B_H, resizerBottomLeft );
        mTsBottom = addTDHorizontal( mTR_BottomAchoring, "StraightBottom", BORDER_B_H, resizerBottom );
        addTDCorner( mTR_BottomAchoring, "CornerBottomRightDown", CplusSize, BORDER_B_H, resizerBottomRight );
        addTDCorner( mTR_BottomAchoring, "CornerBottomRight", BORDER_R_W, BORDER_B_H, resizerBottomRight );
    }

    private static final String CPT = "Caption";
    private static final String CPC = "Content";

    private static final int BORDER_TB_H = BORDER_T_H + BORDER_B_H;

    private static final int BORDER_LR_W = BORDER_L_W + BORDER_R_W;

    private static final int CplusSize = 5;

    private static final int CplusSize2 = CplusSize + CplusSize;

    private static final int MinContentWidth = CplusSize2 + 1;
    private static final int MinContentHeight = CplusSize + 1;

    private Widget mTsTop, mTsBottom, mTsLeftTitleBar, mTsRightTitleBar, mTsLeftContent, mTsRightContent;

    private static class Border extends CWrapper
    {
        public Border( String pStyle )
        {
            super( new SimplePanel() );
            SimplePanel panel = (SimplePanel) getWidget();
            panel.setWidget( new Spacer( 0 ) );
            setStyleName( pStyle );
        }
    }

    protected boolean allowDragging()
    {
        return true;
    }

    protected DragController createDragController( DragGesture pDragGesture )
    {
        return new DragController( new MousePerformanceFilter( new MouseDragHandler( pDragGesture ) ) )
        {
            public void onBrowserEvent( Widget widget, Event event )
            {
                if ( allowDragging() )
                {
                    super.onBrowserEvent( widget, event );
                }
            }
        };
    }

    protected DragGesture createThresholdFilter( DragGesture pDragGesture )
    {
        /*
        * using a 1px drag tolerance prevents drag style from being applied
        * (and scrollbar flickering in FF) when a window is brought to front
        */
        return new DragThresholdFilter( 1, pDragGesture );
    }
}

Commits for litesoft/trunk/Java/GWT/Client/src/org/litesoft/GWT/client/nonpublic/AbstractFloaterPanel.java

Diff revisions: vs.
Revision Author Commited Message
2 GeorgeS picture GeorgeS Sun 07 Feb, 2010 12:50:58 +0000