DivPanel addressPanel2 = new DivPanel();
addressPanel2.addStyleName(_css.SearchWidgetExamplePanel());
addressPanel.add(addressPanel2);
SpanWidget addressExampleLabel1 = new SpanWidget(
"(ex. \"3rd and pike\" or ");
addressExampleLabel1.addStyleName(_css.SearchWidgetExampleLabel());
addressPanel2.add(addressExampleLabel1);
Anchor addressExampleLabel2 = new Anchor("use the map");
addressExampleLabel2.addStyleName(_css.SearchWidgetExampleLabel());
addressExampleLabel2.addClickHandler(new UseTheMapHandler());
addressPanel2.add(addressExampleLabel2);
SpanWidget addressExampleLabel3 = new SpanWidget(")");
addressExampleLabel3.addStyleName(_css.SearchWidgetExampleLabel());
addressPanel2.add(addressExampleLabel3);
DivPanel buttonPanel = new DivPanel();
buttonPanel.addStyleName(_css.SearchWidgetButtonPanel());
searchPanel.add(buttonPanel);
Button button = new Button("Go");
buttonPanel.add(button);
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent widget) {
handleQuery();
}
});
AddressTextBoxHandler handler = new AddressTextBoxHandler();
_addressTextBox.addKeyPressHandler(handler);
_addressTextBox.addFocusHandler(handler);
_addressTextBox.addBlurHandler(handler);
_optionsButton = new Anchor("Show More Options");
_optionsButton.addStyleName(_css.SearchWidgetShowOptionsButton());
_optionsButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent arg0) {
toggleExpansion();
// TODO : Refresh layout
}
});
buttonPanel.add(_optionsButton);
DivPanel clearPanel = new DivPanel();
clearPanel.addStyleName(_css.ClearPanel());
panel.add(clearPanel);
Image hiddenPixel = new Image(
CommonResources.INSTANCE.getHiddenPixel().getUrl());
clearPanel.add(hiddenPixel);
_optionsPanel = new DivPanel();
_optionsPanel.addStyleName(_css.SearchWidgetOptionsPanel());
_optionsPanel.setVisible(false);
panel.add(_optionsPanel);
Grid optionsGrid = new Grid(2, 4);
optionsGrid.addStyleName(_css.SearchWidgetOptionsGrid());
for (int i = 0; i < 4; i++) {
optionsGrid.getCellFormatter().addStyleName(0, i,
"SearchWidget-OptionsGrid-Column" + i);
optionsGrid.getCellFormatter().addStyleName(1, i,
"SearchWidget-OptionsGrid-Column" + i);
}
_optionsPanel.add(optionsGrid);
SpanWidget timeLabel = new SpanWidget("Start Time:");
optionsGrid.setWidget(0, 0, timeLabel);
DivPanel dateAndTimePanel = new DivPanel();
optionsGrid.setWidget(0, 1, dateAndTimePanel);
_dateTextBox = new TextBox();
_dateTextBox.addStyleName(_css.SearchWidgetStartDateTextBox());
dateAndTimePanel.add(_dateTextBox);
_timeTextBox = new TextBox();
_timeTextBox.addStyleName(_css.SearchWidgetStartTimeTextBox());
dateAndTimePanel.add(_timeTextBox);
SpanWidget maxLengthLabel = new SpanWidget("Trip Time:");
optionsGrid.setWidget(1, 0, maxLengthLabel);
_maxTripLengthBox = new ListBox();
_maxTripLengthBox.addItem("10 mins", "10");
_maxTripLengthBox.addItem("15 mins", "15");
_maxTripLengthBox.addItem("20 mins", "20");
_maxTripLengthBox.addItem("30 mins", "30");
_maxTripLengthBox.addItem("45 mins", "45");
_maxTripLengthBox.addItem("1 hour", "60");
_maxTripLengthBox.addStyleName(_css.SearchWidgetTripLengthList());
optionsGrid.setWidget(1, 1, _maxTripLengthBox);
SpanWidget maxTransfersLabel = new SpanWidget("Transfers:");
optionsGrid.setWidget(0, 2, maxTransfersLabel);
_maxTransfersListBox = new ListBox();
_maxTransfersListBox.addItem("Don't Care", "-1");
_maxTransfersListBox.addItem("0", "0");
_maxTransfersListBox.addItem("1", "1");
_maxTransfersListBox.addItem("2", "2");
optionsGrid.setWidget(0, 3, _maxTransfersListBox);
SpanWidget maxWalkLabel = new SpanWidget("Walk at most:");
optionsGrid.setWidget(1, 2, maxWalkLabel);
_maxWalkDistance = new ListBox();
_maxWalkDistance.addItem("1/4 mile", "1320");
_maxWalkDistance.addItem("1/2 mile", "2640");