|
@@ -1,49 +1,49 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.forms.client.components.nonpublic; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.GWT.client.widgets.Button; |
5 |
|
- |
import org.litesoft.GWT.client.widgets.nonpublic.*; |
6 |
|
- |
|
7 |
|
- |
import com.google.gwt.event.dom.client.*; |
8 |
|
- |
import com.google.gwt.user.client.ui.*; |
9 |
|
- |
|
10 |
|
- |
public abstract class ExtendableDialogPicker extends DialogBox implements ClickHandler { |
11 |
|
- |
private DialogButtonPanel mDialogButtonPanel; |
12 |
|
- |
|
13 |
|
- |
protected ExtendableDialogPicker() { |
14 |
|
- |
super( true, false ); |
15 |
|
- |
VerticalPanel panel = new VerticalPanel(); |
16 |
|
- |
panel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER ); |
17 |
|
- |
setWidget( panel ); // actually set into the FlexTable |
18 |
|
- |
} |
19 |
|
- |
|
20 |
|
- |
protected final void addExtensionPanel( Widget pExtensionPanel ) { |
21 |
|
- |
if ( pExtensionPanel != null ) { |
22 |
|
- |
((VerticalPanel) getWidget()).add( pExtensionPanel ); |
23 |
|
- |
} |
24 |
|
- |
} |
25 |
|
- |
|
26 |
|
- |
protected final void addDialogButtonPanel( Button... pButtons ) { |
27 |
|
- |
addExtensionPanel( mDialogButtonPanel = new DialogButtonPanel( this, pButtons ) ); |
28 |
|
- |
} |
29 |
|
- |
|
30 |
|
- |
@Override |
31 |
|
- |
public void onClick( ClickEvent event ) { |
32 |
|
- |
onClick( (Widget) event.getSource() ); |
33 |
|
- |
} |
34 |
|
- |
|
35 |
|
- |
public final void onClick( Widget sender ) { |
36 |
|
- |
if ( (mDialogButtonPanel != null) && mDialogButtonPanel.isOurButton( sender ) ) { |
37 |
|
- |
dialogButtonClicked( (Button) sender ); |
38 |
|
- |
} |
39 |
|
- |
} |
40 |
|
- |
|
41 |
|
- |
abstract protected void dialogButtonClicked( Button pButton ); |
42 |
|
- |
|
43 |
|
- |
@Override |
44 |
|
- |
public void show() { |
45 |
|
- |
CommonElementHelper.hide( getElement() ); |
46 |
|
- |
super.show(); |
47 |
|
- |
CommonElementHelper.unhide( getElement() ); |
48 |
|
- |
} |
49 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.forms.client.components.nonpublic; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.GWT.client.widgets.Button; |
|
5 |
+ |
import org.litesoft.GWT.client.widgets.nonpublic.*; |
|
6 |
+ |
|
|
7 |
+ |
import com.google.gwt.event.dom.client.*; |
|
8 |
+ |
import com.google.gwt.user.client.ui.*; |
|
9 |
+ |
|
|
10 |
+ |
public abstract class ExtendableDialogPicker extends DialogBox implements ClickHandler { |
|
11 |
+ |
private DialogButtonPanel mDialogButtonPanel; |
|
12 |
+ |
|
|
13 |
+ |
protected ExtendableDialogPicker() { |
|
14 |
+ |
super( true, false ); |
|
15 |
+ |
VerticalPanel panel = new VerticalPanel(); |
|
16 |
+ |
panel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER ); |
|
17 |
+ |
setWidget( panel ); // actually set into the FlexTable |
|
18 |
+ |
} |
|
19 |
+ |
|
|
20 |
+ |
protected final void addExtensionPanel( Widget pExtensionPanel ) { |
|
21 |
+ |
if ( pExtensionPanel != null ) { |
|
22 |
+ |
((VerticalPanel) getWidget()).add( pExtensionPanel ); |
|
23 |
+ |
} |
|
24 |
+ |
} |
|
25 |
+ |
|
|
26 |
+ |
protected final void addDialogButtonPanel( Button... pButtons ) { |
|
27 |
+ |
addExtensionPanel( mDialogButtonPanel = new DialogButtonPanel( this, pButtons ) ); |
|
28 |
+ |
} |
|
29 |
+ |
|
|
30 |
+ |
@Override |
|
31 |
+ |
public void onClick( ClickEvent event ) { |
|
32 |
+ |
onClick( (Widget) event.getSource() ); |
|
33 |
+ |
} |
|
34 |
+ |
|
|
35 |
+ |
public final void onClick( Widget sender ) { |
|
36 |
+ |
if ( (mDialogButtonPanel != null) && mDialogButtonPanel.isOurButton( sender ) ) { |
|
37 |
+ |
dialogButtonClicked( (Button) sender ); |
|
38 |
+ |
} |
|
39 |
+ |
} |
|
40 |
+ |
|
|
41 |
+ |
abstract protected void dialogButtonClicked( Button pButton ); |
|
42 |
+ |
|
|
43 |
+ |
@Override |
|
44 |
+ |
public void show() { |
|
45 |
+ |
CommonElementHelper.hide( getElement() ); |
|
46 |
+ |
super.show(); |
|
47 |
+ |
CommonElementHelper.unhide( getElement() ); |
|
48 |
+ |
} |
|
49 |
+ |
} |