|
@@ -1,69 +1,69 @@ |
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 |
|
- |
import org.litesoft.GWT.forms.client.components.nonpublic.datepicker.*; |
7 |
|
- |
import org.litesoft.GWT.forms.client.components.nonpublic.datepicker.impl.*; |
8 |
|
- |
import org.litesoft.commonfoundation.typeutils.*; |
9 |
|
- |
|
10 |
|
- |
import com.google.gwt.event.dom.client.*; |
11 |
|
- |
import com.google.gwt.user.client.ui.*; |
12 |
|
- |
|
13 |
|
- |
import java.util.*; |
14 |
|
- |
|
15 |
|
- |
/** |
16 |
|
- |
* TODO: migrate to {@link com.google.gwt.user.datepicker.client.DatePicker} |
17 |
|
- |
*/ |
18 |
|
- |
@SuppressWarnings({"deprecation"}) |
19 |
|
- |
public abstract class ExtendableDatePicker extends DatePicker implements ClickHandler { |
20 |
|
- |
private DialogButtonPanel mDialogButtonPanel; |
21 |
|
- |
|
22 |
|
- |
protected ExtendableDatePicker() { |
23 |
|
- |
showAdjacentMonths( true ); |
24 |
|
- |
showYearMonthListing( true ); |
25 |
|
- |
} |
26 |
|
- |
|
27 |
|
- |
@Override |
28 |
|
- |
public final void showTodayButton( boolean show ) { |
29 |
|
- |
throw new IllegalStateException( "showTodayButton no longer supporter" ); |
30 |
|
- |
} |
31 |
|
- |
|
32 |
|
- |
protected final void addExtensionPanel( Widget pExtensionPanel ) { |
33 |
|
- |
if ( pExtensionPanel != null ) { |
34 |
|
- |
((VerticalPanel) getWidget()).add( pExtensionPanel ); |
35 |
|
- |
} |
36 |
|
- |
} |
37 |
|
- |
|
38 |
|
- |
protected final void addDialogButtonPanel( Button... pButtons ) { |
39 |
|
- |
addExtensionPanel( mDialogButtonPanel = new DialogButtonPanel( this, pButtons ) ); |
40 |
|
- |
} |
41 |
|
- |
|
42 |
|
- |
@Override |
43 |
|
- |
public void onClick( ClickEvent event ) { |
44 |
|
- |
onClick( (Widget) event.getSource() ); |
45 |
|
- |
} |
46 |
|
- |
|
47 |
|
- |
@Override |
48 |
|
- |
public final void onClick( Widget sender ) { |
49 |
|
- |
if ( sender instanceof DatePickerCell ) { |
50 |
|
- |
super.onClick( sender ); |
51 |
|
- |
if ( -1 == Strings.deNull( sender.getStyleName() ).indexOf( "control" ) ) { |
52 |
|
- |
dateSelectedByClick( selectedDate() ); |
53 |
|
- |
} |
54 |
|
- |
} else if ( (mDialogButtonPanel != null) && mDialogButtonPanel.isOurButton( sender ) ) { |
55 |
|
- |
dialogButtonClicked( (Button) sender ); |
56 |
|
- |
} |
57 |
|
- |
} |
58 |
|
- |
|
59 |
|
- |
abstract protected void dialogButtonClicked( Button pButton ); |
60 |
|
- |
|
61 |
|
- |
abstract protected void dateSelectedByClick( Date pDate ); |
62 |
|
- |
|
63 |
|
- |
@Override |
64 |
|
- |
public void show() { |
65 |
|
- |
CommonElementHelper.hide( getElement() ); |
66 |
|
- |
super.show(); |
67 |
|
- |
CommonElementHelper.unhide( getElement() ); |
68 |
|
- |
} |
69 |
|
- |
} |
|
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 |
+ |
import org.litesoft.GWT.forms.client.components.nonpublic.datepicker.*; |
|
7 |
+ |
import org.litesoft.GWT.forms.client.components.nonpublic.datepicker.impl.*; |
|
8 |
+ |
import org.litesoft.commonfoundation.base.*; |
|
9 |
+ |
|
|
10 |
+ |
import com.google.gwt.event.dom.client.*; |
|
11 |
+ |
import com.google.gwt.user.client.ui.*; |
|
12 |
+ |
|
|
13 |
+ |
import java.util.*; |
|
14 |
+ |
|
|
15 |
+ |
/** |
|
16 |
+ |
* TODO: migrate to {@link com.google.gwt.user.datepicker.client.DatePicker} |
|
17 |
+ |
*/ |
|
18 |
+ |
@SuppressWarnings({"deprecation"}) |
|
19 |
+ |
public abstract class ExtendableDatePicker extends DatePicker implements ClickHandler { |
|
20 |
+ |
private DialogButtonPanel mDialogButtonPanel; |
|
21 |
+ |
|
|
22 |
+ |
protected ExtendableDatePicker() { |
|
23 |
+ |
showAdjacentMonths( true ); |
|
24 |
+ |
showYearMonthListing( true ); |
|
25 |
+ |
} |
|
26 |
+ |
|
|
27 |
+ |
@Override |
|
28 |
+ |
public final void showTodayButton( boolean show ) { |
|
29 |
+ |
throw new IllegalStateException( "showTodayButton no longer supporter" ); |
|
30 |
+ |
} |
|
31 |
+ |
|
|
32 |
+ |
protected final void addExtensionPanel( Widget pExtensionPanel ) { |
|
33 |
+ |
if ( pExtensionPanel != null ) { |
|
34 |
+ |
((VerticalPanel) getWidget()).add( pExtensionPanel ); |
|
35 |
+ |
} |
|
36 |
+ |
} |
|
37 |
+ |
|
|
38 |
+ |
protected final void addDialogButtonPanel( Button... pButtons ) { |
|
39 |
+ |
addExtensionPanel( mDialogButtonPanel = new DialogButtonPanel( this, pButtons ) ); |
|
40 |
+ |
} |
|
41 |
+ |
|
|
42 |
+ |
@Override |
|
43 |
+ |
public void onClick( ClickEvent event ) { |
|
44 |
+ |
onClick( (Widget) event.getSource() ); |
|
45 |
+ |
} |
|
46 |
+ |
|
|
47 |
+ |
@Override |
|
48 |
+ |
public final void onClick( Widget sender ) { |
|
49 |
+ |
if ( sender instanceof DatePickerCell ) { |
|
50 |
+ |
super.onClick( sender ); |
|
51 |
+ |
if ( -1 == ConstrainTo.notNull( sender.getStyleName() ).indexOf( "control" ) ) { |
|
52 |
+ |
dateSelectedByClick( selectedDate() ); |
|
53 |
+ |
} |
|
54 |
+ |
} else if ( (mDialogButtonPanel != null) && mDialogButtonPanel.isOurButton( sender ) ) { |
|
55 |
+ |
dialogButtonClicked( (Button) sender ); |
|
56 |
+ |
} |
|
57 |
+ |
} |
|
58 |
+ |
|
|
59 |
+ |
abstract protected void dialogButtonClicked( Button pButton ); |
|
60 |
+ |
|
|
61 |
+ |
abstract protected void dateSelectedByClick( Date pDate ); |
|
62 |
+ |
|
|
63 |
+ |
@Override |
|
64 |
+ |
public void show() { |
|
65 |
+ |
CommonElementHelper.hide( getElement() ); |
|
66 |
+ |
super.show(); |
|
67 |
+ |
CommonElementHelper.unhide( getElement() ); |
|
68 |
+ |
} |
|
69 |
+ |
} |