}
});
}
public void widgetSelected( SelectionEvent e ) {
ViewportModel viewportModel = (ViewportModel) ApplicationGIS.getActiveMap().getViewportModel();
Object source = e.getSource();
if (source.equals(scaleCombo)) {
int index = scaleCombo.getSelectionIndex();
String item = scaleCombo.getItem(index);
String scaleString = item.split(":")[1];
double scale = Double.parseDouble(scaleString);
viewportModel.setScale(scale);
}
if (source.equals(dateTimeCombo)) {
int index = dateTimeCombo.getSelectionIndex();
String item = dateTimeCombo.getItem(index);
DateTime date = ISO_DATE_TIME_PARSER.parseDateTime(item);
viewportModel.setCurrentTimestep(date);
}
if (source.equals(verticalCombo)) {
int index = verticalCombo.getSelectionIndex();
String item = verticalCombo.getItem(index);
try {
double vertical = Double.parseDouble(item);
viewportModel.setCurrentElevation(vertical);
} catch (NumberFormatException e1) {
e1.printStackTrace();
}
}
if (source.equals(verticalDownButton)) {
int selectionIndex = verticalCombo.getSelectionIndex();
selectionIndex++;
if (selectionIndex > verticalCombo.getItemCount() - 1) {
selectionIndex = verticalCombo.getItemCount() - 1;
}
String item = verticalCombo.getItem(selectionIndex);
double vertical = Double.parseDouble(item);
viewportModel.setCurrentElevation(vertical);
verticalCombo.select(selectionIndex);
}
if (source.equals(verticalUpButton)) {
int selectionIndex = verticalCombo.getSelectionIndex();
selectionIndex--;
if (selectionIndex < 0) {
selectionIndex = 0;
}
String item = verticalCombo.getItem(selectionIndex);
double vertical = Double.parseDouble(item);
viewportModel.setCurrentElevation(vertical);
verticalCombo.select(selectionIndex);
}
if (source.equals(scaleDownButton)) {
int selectionIndex = scaleCombo.getSelectionIndex();
selectionIndex--;
if (selectionIndex < 0) {
selectionIndex = 0;
}
String item = scaleCombo.getItem(selectionIndex);
double scale = Double.parseDouble(item.split(":")[1]);
viewportModel.setScale(scale);
scaleCombo.select(selectionIndex);
}
if (source.equals(scaleUpButton)) {
int selectionIndex = scaleCombo.getSelectionIndex();
selectionIndex++;
if (selectionIndex > scaleCombo.getItemCount() - 1) {
selectionIndex = scaleCombo.getItemCount() - 1;
}
String item = scaleCombo.getItem(selectionIndex);
double scale = Double.parseDouble(item.split(":")[1]);
viewportModel.setScale(scale);
scaleCombo.select(selectionIndex);
}
if (source.equals(dtDownButton)) {
int selectionIndex = dateTimeCombo.getSelectionIndex();
selectionIndex--;
if (selectionIndex < 0) {
selectionIndex = 0;
}
String item = dateTimeCombo.getItem(selectionIndex);
DateTime dt = ISO_DATE_TIME_PARSER.parseDateTime(item);
viewportModel.setCurrentTimestep(dt);
dateTimeCombo.select(selectionIndex);
}
if (source.equals(dtUpButton)) {
int selectionIndex = dateTimeCombo.getSelectionIndex();
selectionIndex++;
if (selectionIndex > dateTimeCombo.getItemCount() - 1) {
selectionIndex = dateTimeCombo.getItemCount() - 1;
}
String item = dateTimeCombo.getItem(selectionIndex);
DateTime dt = ISO_DATE_TIME_PARSER.parseDateTime(item);
viewportModel.setCurrentTimestep(dt);
dateTimeCombo.select(selectionIndex);
}
updateData();
}