/** * Sets the active tab of the dashboard to the layer controls and makes the first layer (TODO: fix * that!) of the given ViewManager the active layer. * * @param vm The ViewManager to make active. * @param doShow Whether or not the layer controls should become the active tab in the dashboard. */ private void focusLayerControlsOn(ViewManager vm, boolean doShow) { List<DisplayControlImpl> controls = vm.getControlsForLegend(); if (controls != null && !controls.isEmpty()) { DisplayControlImpl control = controls.get(0); if (doShow) { GuiUtils.showComponentInTabs(control.getOuterContents(), false); } } }
/** * Get the color table, range, etc, from the given display control and save them as the param * defaults for its data choice * * @param displayControl the display control to get state from */ public void saveDefaults(DisplayControlImpl displayControl) { try { List choices = displayControl.getMyDataChoices(); if (choices.size() != 1) { return; } DataChoice dc = (DataChoice) choices.get(0); String name = dc.getName(); String ctName = ((displayControl.getColorTable() != null) ? displayControl.getColorTable().getName() : null); ParamInfo newParamInfo = new ParamInfo( name, ctName, displayControl.getRange(), displayControl.getContourInfo(), displayControl.getDisplayUnit()); ParamDefaultsTable firstTable = getFirstTable(); if (!firstTable.editRow(newParamInfo, false)) { return; } ParamInfo origParamInfo = firstTable.findByName(dc.getName()); if (origParamInfo == null) { firstTable.addBeginning(newParamInfo); firstTable.getSelectionModel().setSelectionInterval(0, 0); } else { origParamInfo.initWith(newParamInfo); firstTable.tableChanged(); firstTable.selectParamInfo(origParamInfo); } saveData(); show(); GuiUtils.showComponentInTabs(firstTable); } catch (Exception exc) { LogUtil.printException(log_, "copying defaults", exc); } }