public TransportInfoScreen() {
setTitle("Transport Info");
// Regions to display "Availability" status in the left column and
// "Coverage" status in the right column
final HorizontalFieldManager hfm =
new HorizontalFieldManager(Manager.NO_VERTICAL_SCROLL);
final VerticalFieldManager lVfm =
new HalfWidthVerticalFieldManager(Manager.NO_HORIZONTAL_SCROLL
| Field.FIELD_LEFT);
final VerticalFieldManager rVfm =
new HalfWidthVerticalFieldManager(Manager.NO_HORIZONTAL_SCROLL
| Field.FIELD_RIGHT);
// Calculate column with (half of screen width)
final int halfDisplayWidth = Display.getWidth() / 2;
// Display "Availability" status for all transports
_availabilityCheckboxes = new CheckboxField[NUM_TRANSPORTS];
_coverageCheckboxes = new CheckboxField[NUM_TRANSPORTS];
lVfm.add(new FixedWidthLabelField("Availability", halfDisplayWidth));
for (int i = 0; i < NUM_TRANSPORTS; i++) {
final int currentTransport = i + 1;
final String transportName =
TransportInfo.getTransportTypeName(currentTransport);
final boolean transportAvailable =
TransportInfo.isTransportTypeAvailable(currentTransport);
_availabilityCheckboxes[i] =
new CheckboxField(transportName, transportAvailable,
Field.NON_FOCUSABLE);
_availabilityCheckboxes[i].setEnabled(false);
lVfm.add(_availabilityCheckboxes[i]);
}
// Display "Coverage" status for all transports
rVfm.add(new FixedWidthLabelField("Coverage", halfDisplayWidth));
for (int i = 0; i < NUM_TRANSPORTS; i++) {
final int currentTransport = i + 1;
final String transportName =
TransportInfo.getTransportTypeName(currentTransport);
final boolean coverageAvailable =
TransportInfo.hasSufficientCoverage(currentTransport);
_coverageCheckboxes[i] =
new CheckboxField(transportName, coverageAvailable,
Field.NON_FOCUSABLE);
_coverageCheckboxes[i].setEnabled(false);
rVfm.add(_coverageCheckboxes[i]);
}
hfm.add(lVfm);
hfm.add(rVfm);
add(hfm);
add(new SeparatorField());