コード例 #1
0
 /**
  * Copy the given ParamInfo object into the user's editable table
  *
  * @param i the param fino object to copy
  */
 protected void copyToUsers(ParamInfo i) {
   ParamInfo copy = new ParamInfo(i);
   ParamDefaultsTable to = (ParamDefaultsTable) myTables.get(0);
   to.add(copy);
   tableTabbedPane.setSelectedIndex(0);
   to.editRow(copy, true);
 }
コード例 #2
0
 /**
  * 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);
   }
 }