final DateTextFieldWithPicker completionDateInput = new DateTextFieldWithPicker( "completion", "Completion", this );
completionDateInput.earliestDate( new LocalDate() );
add( completionDateInput.setLabel( Model.of( "Completion" ) ) );
HandlingQueries fetch = new HandlingQueries();
// Tracking id
trackingIdInput = new TextField<String>( "trackingIdInput", new PropertyModel<String>( this, "trackingId" ) );
add( trackingIdInput.setRequired( true ).setLabel( Model.of( "Cargo" ) ).setOutputMarkupId( true ) );
trackingIdSelector = new DropDownChoice<String>( "trackingIdSelector",
new PropertyModel<String>( this, "trackingIdSelected" ),
fetch.cargoIds() );
trackingIdSelector.add( new AjaxFormComponentUpdatingBehavior( "onchange" )
{
@Override
protected void onUpdate( AjaxRequestTarget target )
{
trackingId = trackingIdSelected;
target.add( feedback, trackingIdInput, trackingIdSelector );
}
} );
add( trackingIdSelector.setOutputMarkupId( true ) );
// Event Type
eventTypeInput = new TextField<String>( "eventTypeInput", new PropertyModel<String>( this, "eventType" ) );
add( eventTypeInput.setRequired( true ).setLabel( Model.of( "Event Type" ) ).setOutputMarkupId( true ) );
eventTypeSelector = new DropDownChoice<String>( "eventTypeSelector",
new PropertyModel<String>( this, "eventTypeSelected" ),
fetch.eventTypes() );
eventTypeSelector.add( new AjaxFormComponentUpdatingBehavior( "onchange" )
{
@Override
protected void onUpdate( AjaxRequestTarget target )
{
eventType = eventTypeSelected;
target.add( feedback, eventTypeInput, eventTypeSelector );
}
} );
add( eventTypeSelector.setOutputMarkupId( true ) );
// Voyage (optional in some cases)
voyageInput = new TextField<String>( "voyageInput", new PropertyModel<String>( this, "voyageNumber" ) );
add( voyageInput.setLabel( Model.of( "Voyage" ) ).setOutputMarkupId( true ) );
voyageSelector = new DropDownChoice<String>( "voyageSelector",
new PropertyModel<String>( this, "voyageSelected" ),
fetch.voyages() );
voyageSelector.add( new AjaxFormComponentUpdatingBehavior( "onchange" )
{
@Override
protected void onUpdate( AjaxRequestTarget target )
{