Hi smiletolead,
When I prepare testcase I noticed that problem coming from button scale medium.
Medium scale has bug, but small scale no problem. it is working chrome and firefox successfully.
Entry point:
Code:
public class MyEntryPoint implements EntryPoint
{
public void onModuleLoad()
{
ToolBar bar = new ToolBar();
Button button = new Button( "Test Button" );
button.setScale( ButtonScale.MEDIUM );
bar.add( button );
bar.add( new MonthChooserField() );
RootPanel.get().add( bar );
GXT.hideLoadingPanel( "loading" );
}
}
MultiField class:
Code:
import java.util.Date;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
import com.extjs.gxt.ui.client.widget.form.MultiField;
import com.extjs.gxt.ui.client.widget.form.SimpleComboBox;
import com.google.gwt.i18n.client.DateTimeFormat;
@SuppressWarnings( "rawtypes" )
public class MonthChooserField extends MultiField
{
private SimpleComboBox<String> cbMonth;
private SimpleComboBox<String> cbYear;
DateTimeFormat formatter = DateTimeFormat.getFormat( "MMMM yyyy" );
DateTimeFormat monthFormat = DateTimeFormat.getFormat( "MMMM" );
DateTimeFormat yearFormat = DateTimeFormat.getFormat( "yyyy" );
@SuppressWarnings( "unchecked" )
public MonthChooserField()
{
setFieldLabel( "Tarih" );
setSpacing( 5 );
cbMonth = new SimpleComboBox<String>();
cbMonth.setWidth( 80 );
cbMonth.setAllowBlank( false );
cbMonth.setTypeAhead( true );
cbMonth.setForceSelection( true );
cbMonth.setTriggerAction( TriggerAction.ALL );
cbMonth.add( "Ocak" );
cbMonth.add( "Şubat" );
cbMonth.add( "Mart" );
cbMonth.add( "Nisan" );
cbMonth.add( "Mayıs" );
cbMonth.add( "Haziran" );
cbMonth.add( "Temmuz" );
cbMonth.add( "Ağustos" );
cbMonth.add( "Eylül" );
cbMonth.add( "Ekim" );
cbMonth.add( "Kasım" );
cbMonth.add( "Aralık" );
add( cbMonth );
cbYear = new SimpleComboBox<String>();
cbYear.setWidth( 70 );
cbYear.setAllowBlank( false );
cbYear.setTypeAhead( true );
cbYear.setForceSelection( true );
cbYear.setTriggerAction( TriggerAction.ALL );
cbYear.add( "2011" );
cbYear.add( "2012" );
cbYear.add( "2013" );
cbYear.add( "2014" );
add( cbYear );
setValue( new Date() );
}
public void setValue( Date date)
{
String month = monthFormat.format( date );
String year = yearFormat.format( date );
cbMonth.setSimpleValue( month );
cbYear.setSimpleValue( year );
}
public Date getValue()
{
String month = cbMonth.getSimpleValue();
String year = cbYear.getSimpleValue();
return formatter.parse( month + " " + year );
}
/**
* for validate city and town field at the same time
*/
@Override
public boolean isValid( boolean silent)
{
cbYear.isValid();
return super.isValid( silent );
}
public SimpleComboBox<String> getCbMonth()
{
return cbMonth;
}
public SimpleComboBox<String> getCbYear()
{
return cbYear;
}
}