Пример #1
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();
         }
       });
 }