예제 #1
0
  private void updateUIState() {
    if (!isInitialized) {
      return;
    }

    xAxisRangeControl
        .getBindingContext()
        .setComponentsEnabled(
            PROPERTY_NAME_MARK_SEGMENTS,
            profileData != null && profileData.getShapeVertices().length > 2);
    xAxisRangeControl.setComponentsEnabled(profileData != null);
    yAxisRangeControl.setComponentsEnabled(profileData != null);
    adjustPlotAxes();

    if (dataSourceConfig.computeInBetweenPoints) {
      chart.getXYPlot().setRenderer(deviationRenderer);
    } else {
      chart.getXYPlot().setRenderer(pointRenderer);
    }

    chart
        .getXYPlot()
        .getRangeAxis()
        .setLabel(
            StatisticChartStyling.getAxisLabel(getRaster(), DEFAULT_SAMPLE_DATASET_NAME, false));

    boolean markSegments =
        (Boolean)
            (xAxisRangeControl
                .getBindingContext()
                .getPropertySet()
                .getValue(PROPERTY_NAME_MARK_SEGMENTS));
    if (markSegments && profileData != null && profileData.getNumShapeVertices() > 1) {
      final int[] shapeVertexIndexes = profileData.getShapeVertexIndexes();
      removeIntervalMarkers();
      for (int i = 0; i < shapeVertexIndexes.length - 1; i++) {
        if (i % 2 != 0) {
          final IntervalMarker marker =
              new IntervalMarker(shapeVertexIndexes[i], shapeVertexIndexes[i + 1]);
          marker.setPaint(new Color(120, 122, 125));
          marker.setAlpha(0.3F);
          chart.getXYPlot().addDomainMarker(marker, Layer.BACKGROUND);
          intervalMarkers.add(marker);
        }
      }
    } else {
      removeIntervalMarkers();
    }

    pointDataSourceEnablement.apply();
    dataFieldEnablement.apply();
  }
예제 #2
0
 private void handleStxChange() {
   if (model.hasStx(createHistogramConfig())) {
     refreshButton.setEnabled(false);
   }
   log10HistEnablement.apply();
   updateLogXAxisCheckBox();
   chart.getXYPlot().setDataset(dataset);
   updateXAxis();
   chart.fireChartChanged();
 }
  @Override
  protected void configure(BindingContext context) {
    Enablement enablementAvgGridSize =
        context.bindEnabledState(
            GraticuleLayerType.PROPERTY_NAME_RES_PIXELS, true,
            GraticuleLayerType.PROPERTY_NAME_RES_AUTO, true);
    Enablement enablementLatStep =
        context.bindEnabledState(
            GraticuleLayerType.PROPERTY_NAME_RES_LAT, true,
            GraticuleLayerType.PROPERTY_NAME_RES_AUTO, false);
    Enablement enablementLonStep =
        context.bindEnabledState(
            GraticuleLayerType.PROPERTY_NAME_RES_LON, true,
            GraticuleLayerType.PROPERTY_NAME_RES_AUTO, false);

    context
        .getPropertySet()
        .getProperty(GraticuleLayerType.PROPERTY_NAME_RES_AUTO)
        .addPropertyChangeListener(
            evt -> {
              enablementAvgGridSize.apply();
              enablementLatStep.apply();
              enablementLonStep.apply();
            });

    Enablement enablementTextBgTransparency =
        context.bindEnabledState(
            GraticuleLayerType.PROPERTY_NAME_TEXT_BG_TRANSPARENCY, true,
            GraticuleLayerType.PROPERTY_NAME_TEXT_ENABLED, true);

    context
        .getPropertySet()
        .getProperty(GraticuleLayerType.PROPERTY_NAME_TEXT_ENABLED)
        .addPropertyChangeListener(
            evt -> {
              enablementTextBgTransparency.apply();
              for (JComponent component : textFgColorComponents) {
                component.setEnabled(((Boolean) evt.getNewValue()));
              }
              for (JComponent component : textBgColorComponents) {
                component.setEnabled(((Boolean) evt.getNewValue()));
              }
            });

    for (JComponent component : textFgColorComponents) {
      component.setEnabled(true);
    }
    for (JComponent component : textBgColorComponents) {
      component.setEnabled(true);
    }
  }
예제 #4
0
 private void updateLogXAxisCheckBox() {
   HistogramPanelModel.HistogramConfig config = createHistogramConfig();
   final boolean enabled =
       dataset != null
           && model.hasStx(config)
           && model.getStx(config).getMinimum() > 0
           && !model.getStx(config).isLogHistogram();
   Binding binding = xAxisRangeControl.getBindingContext().getBinding(PROPERTY_NAME_LOG_SCALED);
   if (!enabled) {
     binding.setPropertyValue(false);
   }
   log10AxisEnablement.apply();
   binding.adjustComponents();
 }