Пример #1
0
  public boolean execute(Project project, long contentLength, InputStream content)
      throws Throwable {
    Ant ant = (Ant) project.createTask("ant");
    File baseDir = project.getBaseDir();
    if (dir != null) baseDir = new File(dir);
    ant.setDir(baseDir);
    ant.setInheritAll(inheritall);
    ant.setInheritRefs(interitrefs);

    if (target != null) ant.setTarget(target);

    if (antFile != null) ant.setAntfile(antFile);

    Enumeration e = properties.elements();
    PropertyContainer pc = null;
    Property p = null;
    while (e.hasMoreElements()) {
      pc = (PropertyContainer) e.nextElement();
      p = ant.createProperty();
      p.setName(pc.getName());
      p.setValue(pc.getValue());
    }

    e = references.elements();
    ReferenceContainer rc = null;
    Ant.Reference ref = null;
    while (e.hasMoreElements()) {
      rc = (ReferenceContainer) e.nextElement();
      ref = new Ant.Reference();
      ref.setRefId(rc.getRefId());
      ref.setToRefid(rc.getToRefId());
      ant.addReference(ref);
    }

    ant.execute();

    return false;
  }
 @Override
 public String convert(PropertyContainer value, Class<String> type) {
   return (String) value.getProperty("name");
 }
Пример #3
0
  @Override
  protected void initComponents() {
    getAlternativeView().initComponents();
    dataset = new XYIntervalSeriesCollection();
    this.chart =
        ChartFactory.createXYLineChart(
            CHART_TITLE,
            "Path in pixels",
            DEFAULT_SAMPLE_DATASET_NAME,
            dataset,
            PlotOrientation.VERTICAL,
            true,
            true,
            false);
    final XYPlot plot = chart.getXYPlot();

    deviationRenderer = new DeviationRenderer();
    deviationRenderer.setUseFillPaint(true);
    deviationRenderer.setBaseToolTipGenerator(new XYPlotToolTipGenerator());
    deviationRenderer.setSeriesLinesVisible(0, true);
    deviationRenderer.setSeriesShapesVisible(0, false);
    deviationRenderer.setSeriesStroke(0, new BasicStroke(1.0f));
    deviationRenderer.setSeriesPaint(0, StatisticChartStyling.SAMPLE_DATA_PAINT);
    deviationRenderer.setSeriesFillPaint(0, StatisticChartStyling.SAMPLE_DATA_FILL_PAINT);

    pointRenderer = new XYErrorRenderer();
    pointRenderer.setUseFillPaint(true);
    pointRenderer.setBaseToolTipGenerator(new XYPlotToolTipGenerator());
    pointRenderer.setSeriesLinesVisible(0, false);
    pointRenderer.setSeriesShapesVisible(0, true);
    pointRenderer.setSeriesStroke(0, new BasicStroke(1.0f));
    pointRenderer.setSeriesPaint(0, StatisticChartStyling.SAMPLE_DATA_PAINT);
    pointRenderer.setSeriesFillPaint(0, StatisticChartStyling.SAMPLE_DATA_FILL_PAINT);
    pointRenderer.setSeriesShape(0, StatisticChartStyling.SAMPLE_DATA_POINT_SHAPE);

    configureRendererForCorrelativeData(deviationRenderer);
    configureRendererForCorrelativeData(pointRenderer);

    plot.setNoDataMessage(NO_DATA_MESSAGE);
    plot.setAxisOffset(new RectangleInsets(5, 5, 5, 5));
    plot.setRenderer(deviationRenderer);

    final AxisChangeListener axisListener =
        new AxisChangeListener() {
          @Override
          public void axisChanged(AxisChangeEvent event) {
            adjustAxisControlComponents();
          }
        };

    final ValueAxis domainAxis = plot.getDomainAxis();
    final ValueAxis rangeAxis = plot.getRangeAxis();
    // allow transfer from bounds into min/max fields, if auto min/maxis enabled
    domainAxis.setAutoRange(true);
    rangeAxis.setAutoRange(true);

    domainAxis.addChangeListener(axisListener);
    rangeAxis.addChangeListener(axisListener);

    intervalMarkers = new HashSet<IntervalMarker>();

    xAxisRangeControl = new AxisRangeControl("X-Axis");
    yAxisRangeControl = new AxisRangeControl("Y-Axis");

    final PropertyChangeListener changeListener =
        new PropertyChangeListener() {
          @Override
          public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals(PROPERTY_NAME_MARK_SEGMENTS)) {
              updateDataSet();
            }
            if (evt.getPropertyName().equals(PROPERTY_NAME_LOG_SCALED)) {
              updateScalingOfYAxis();
            }
            updateUIState();
          }
        };
    xAxisRangeControl.getBindingContext().addPropertyChangeListener(changeListener);
    xAxisRangeControl
        .getBindingContext()
        .getPropertySet()
        .addProperty(Property.create(PROPERTY_NAME_MARK_SEGMENTS, false));
    xAxisRangeControl
        .getBindingContext()
        .getPropertySet()
        .getDescriptor(PROPERTY_NAME_MARK_SEGMENTS)
        .setDescription("Toggle whether to mark segments");

    yAxisRangeControl.getBindingContext().addPropertyChangeListener(changeListener);
    yAxisRangeControl
        .getBindingContext()
        .getPropertySet()
        .addProperty(Property.create(PROPERTY_NAME_LOG_SCALED, false));
    yAxisRangeControl
        .getBindingContext()
        .getPropertySet()
        .getDescriptor(PROPERTY_NAME_LOG_SCALED)
        .setDescription("Toggle whether to use a logarithmic axis");

    dataSourceConfig = new DataSourceConfig();
    final BindingContext bindingContext =
        new BindingContext(PropertyContainer.createObjectBacked(dataSourceConfig));

    JPanel middlePanel = createMiddlePanel(bindingContext);
    createUI(createChartPanel(chart), middlePanel, bindingContext);

    isInitialized = true;

    updateComponents();
  }