Example #1
0
  /** Set the group list */
  protected void setGroups() {
    AddeServer server = getAddeServer();
    if (server != null) {
      Object selected = groupSelector.getSelectedItem();
      List groups = server.getGroupsWithType(getGroupType());
      GuiUtils.setListData(groupSelector, groups);
      if ((selected != null) && groups.contains(selected)) {
        groupSelector.setSelectedItem(selected);
      }

    } else {
      GuiUtils.setListData(groupSelector, new Vector());
    }
  }
Example #2
0
  /**
   * return the String id of the chosen server name
   *
   * @return the server name
   */
  public String getServer() {
    Object selected = serverSelector.getSelectedItem();
    if (selected == null) {
      return null;
    }
    AddeServer server;
    if (selected instanceof AddeServer) {
      server = (AddeServer) selected;
      return server.getName();
    }
    String serverName = selected.toString();
    server = getIdv().getIdvChooserManager().addAddeServer(serverName);
    addeServers = getIdv().getIdvChooserManager().getAddeServers(getGroupType());

    Object selectedGroup = groupSelector.getSelectedItem();
    AddeServer.Group group = null;
    if (selectedGroup != null) {
      group =
          getIdv()
              .getIdvChooserManager()
              .addAddeServerGroup(server, selectedGroup.toString(), getGroupType());
    }

    boolean old = ignoreStateChangedEvents;
    ignoreStateChangedEvents = true;
    GuiUtils.setListData(serverSelector, addeServers);
    serverSelector.setSelectedItem(server);
    setGroups();
    if (group != null) {
      groupSelector.setSelectedItem(group);
    }
    ignoreStateChangedEvents = old;
    return server.getName();
  }
Example #3
0
  /** _more_ */
  private void setTimesInTimesBox() {
    DateTime[] theTimesArray = this.timesArray;
    if (theTimesArray == null) {
      return;
    }
    boolean oldValue = ignoreTimesCbxEvents;
    try {
      ignoreTimesCbxEvents = true;
      GuiUtils.setListData(timesCbx, theTimesArray);
      timesCbx.setVisible(
          timesCbxVisible && (theTimesArray != null) && (timesCbx.getItemCount() > 0));

    } finally {
      ignoreTimesCbxEvents = oldValue;
    }
  }
Example #4
0
 /** Reload the list of servers if they have changed */
 public void updateServerList() {
   boolean old = ignoreStateChangedEvents;
   ignoreStateChangedEvents = true;
   List newList = getIdv().getIdvChooserManager().getAddeServers(getGroupType());
   if (Misc.equals(newList, this.addeServers)) {
     ignoreStateChangedEvents = old;
     return;
   }
   this.addeServers = getIdv().getIdvChooserManager().getAddeServers(getGroupType());
   Object selected = serverSelector.getSelectedItem();
   GuiUtils.setListData(serverSelector, addeServers);
   if ((selected != null) && addeServers.contains(selected)) {
     serverSelector.setSelectedItem(selected);
   }
   setGroups();
   ignoreStateChangedEvents = old;
 }
Example #5
0
 /**
  * ctor
  *
  * @param pointDataSource the associated data source
  */
 public GridParameters(PointDataSource pointDataSource) {
   super("Grid Parameters");
   this.pointDataSource = pointDataSource;
   gridXFld = new JTextField("" + pointDataSource.gridX, 4);
   gridXFld.setToolTipText("X spacing in spacing units");
   gridYFld = new JTextField("" + pointDataSource.gridY, 4);
   gridYFld.setToolTipText("Y spacing in spacing units");
   gridUnitCmbx = new JComboBox();
   gridUnitCmbx.setToolTipText("Set grid spacing option");
   tfos = TwoFacedObject.createList(SPACING_IDS, SPACING_NAMES);
   GuiUtils.setListData(gridUnitCmbx, tfos);
   gridUnitCmbx.setSelectedItem(TwoFacedObject.findId(pointDataSource.gridUnit, tfos));
   gridUnitCmbx.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent ae) {
           TwoFacedObject tfo = (TwoFacedObject) ((JComboBox) ae.getSource()).getSelectedItem();
           if (tfo != null) {
             useCompute = tfo.getId().equals(SPACING_IDS[0]);
             enableAutoComps(!useCompute);
           }
         }
       });
   gainComp =
       new ValueSliderComponent(
           pointDataSource,
           0,
           1,
           "gridGain",
           "Gain",
           10,
           false,
           "Factor by which scaleLength is reduced for the second pass");
   searchComp =
       new ValueSliderComponent(
           pointDataSource,
           0,
           20,
           "gridSearchRadius",
           "Search Radius",
           1,
           false,
           "Search radius in grid units for weighting");
   numGridPassesFld = new JTextField("" + pointDataSource.numGridPasses, 4);
   numGridPassesFld.setToolTipText("Set the number of passes for the Barnes analysis");
   comps.add(GuiUtils.rLabel("Spacing:"));
   comps.add(GuiUtils.left(gridUnitCmbx));
   comps.add(GuiUtils.rLabel("Grid Size:"));
   sizeComp =
       GuiUtils.left(GuiUtils.hbox(new JLabel("X: "), gridXFld, new JLabel("  Y: "), gridYFld));
   comps.add(sizeComp);
   comps.add(GuiUtils.rLabel("Passes:"));
   comps.add(GuiUtils.left(numGridPassesFld));
   comps.add(GuiUtils.rLabel("Search Radius:"));
   comps.add(GuiUtils.left(searchComp.getContents(false)));
   comps.add(GuiUtils.rLabel("Gain:"));
   comps.add(GuiUtils.left(gainComp.getContents(false)));
   enableAutoComps(!useCompute);
   useDefaultCbx.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent ae) {
           checkEnable();
         }
       });
 }