Subversion Repository Public Repository

litesoft

Diff Revisions 949 vs 950 for /trunk/Java/GWT/Client/src/org/litesoft/GWT/client/widgets/nonpublic/AbstractLowLevelSizeableComposite.java

Diff revisions: vs.
  @@ -1,67 +1,67 @@
1 - // This Source Code is in the Public Domain per: http://unlicense.org
2 - package org.litesoft.GWT.client.widgets.nonpublic;
3 -
4 - import com.google.gwt.user.client.*;
5 - import com.google.gwt.user.client.ui.*;
6 -
7 - public abstract class AbstractLowLevelSizeableComposite extends AbstractSizeableWidget implements WidgetCompositor {
8 - private Widget mWidget;
9 -
10 - @Override
11 - public Element getElement() {
12 - if ( mWidget == null ) {
13 - throw new IllegalStateException( "initWidget() was never called in " + getClass().getName() );
14 - }
15 - return super.getElement();
16 - }
17 -
18 - @Override
19 - public Widget[] getCompositedWidgets() {
20 - return new Widget[]{mWidget};
21 - }
22 -
23 - /**
24 - * Sets the widget to be wrapped by the composite. The wrapped widget must be
25 - * set before calling any {@link Widget} methods on this object, or adding it
26 - * to a panel. This method may only be called once for a given composite.
27 - *
28 - * @param pWidget the widget to be wrapped
29 - */
30 - protected void LLinitWidget( Widget pWidget ) {
31 - // Make sure the widget is not being set twice.
32 - if ( mWidget != null ) {
33 - throw new IllegalStateException( "Composite.initWidget() may only be called once." );
34 - }
35 -
36 - pWidget.removeFromParent();
37 -
38 - // Use the contained widget's element as the composite's element,
39 - // effectively merging them within the DOM.
40 - setElement( pWidget.getElement() );
41 -
42 - //noinspection NonJREEmulationClassesInClientCode
43 - BackDoorToWidget.setParent( mWidget = pWidget, this ); // The Composite now owns this widget.
44 -
45 - initialize();
46 - }
47 -
48 - @Override
49 - protected void onAttach() {
50 - super.onAttach();
51 -
52 - //noinspection NonJREEmulationClassesInClientCode
53 - BackDoorToWidget.onAttach( mWidget ); // Call onAttach() on behalf of the contained widget.
54 - }
55 -
56 - @Override
57 - protected void onDetach() {
58 - super.onDetach();
59 -
60 - //noinspection NonJREEmulationClassesInClientCode
61 - BackDoorToWidget.onDetach( mWidget ); // Call onDetach() on behalf of the contained widget.
62 - }
63 -
64 - public Widget LLgetWidget() {
65 - return mWidget;
66 - }
67 - }
1 + // This Source Code is in the Public Domain per: http://unlicense.org
2 + package org.litesoft.GWT.client.widgets.nonpublic;
3 +
4 + import com.google.gwt.user.client.*;
5 + import com.google.gwt.user.client.ui.*;
6 +
7 + public abstract class AbstractLowLevelSizeableComposite extends AbstractSizeableWidget implements WidgetCompositor {
8 + private Widget mWidget;
9 +
10 + @Override
11 + public Element getElement() {
12 + if ( mWidget == null ) {
13 + throw new IllegalStateException( "initWidget() was never called in " + getClass().getName() );
14 + }
15 + return super.getElement();
16 + }
17 +
18 + @Override
19 + public Widget[] getCompositedWidgets() {
20 + return new Widget[]{mWidget};
21 + }
22 +
23 + /**
24 + * Sets the widget to be wrapped by the composite. The wrapped widget must be
25 + * set before calling any {@link Widget} methods on this object, or adding it
26 + * to a panel. This method may only be called once for a given composite.
27 + *
28 + * @param pWidget the widget to be wrapped
29 + */
30 + protected void LLinitWidget( Widget pWidget ) {
31 + // Make sure the widget is not being set twice.
32 + if ( mWidget != null ) {
33 + throw new IllegalStateException( "Composite.initWidget() may only be called once." );
34 + }
35 +
36 + pWidget.removeFromParent();
37 +
38 + // Use the contained widget's element as the composite's element,
39 + // effectively merging them within the DOM.
40 + setElement( pWidget.getElement() );
41 +
42 + //noinspection NonJREEmulationClassesInClientCode
43 + BackDoorToWidget.setParent( mWidget = pWidget, this ); // The Composite now owns this widget.
44 +
45 + initialize();
46 + }
47 +
48 + @Override
49 + protected void onAttach() {
50 + super.onAttach();
51 +
52 + //noinspection NonJREEmulationClassesInClientCode
53 + BackDoorToWidget.onAttach( mWidget ); // Call onAttach() on behalf of the contained widget.
54 + }
55 +
56 + @Override
57 + protected void onDetach() {
58 + super.onDetach();
59 +
60 + //noinspection NonJREEmulationClassesInClientCode
61 + BackDoorToWidget.onDetach( mWidget ); // Call onDetach() on behalf of the contained widget.
62 + }
63 +
64 + public Widget LLgetWidget() {
65 + return mWidget;
66 + }
67 + }