Ejemplo n.º 1
0
	/**
	 * Using the given {@link BookView model} fills the fields of this panel:
	 * <ul>
	 * <li>the maximum of {@link #getMinPositionModel() minimum} and {@link
	 * #getMaxPositionModel() maximum} position model,</li>
	 * <li>the maximum of {@link #getMinFrequencyModel() minimum} and {@link
	 * #getMaxFrequencyModel() maximum} frequency model,</li>
	 * <li>the state of {@link #getPreserveRatioCheckBox() preserve zoom ratio
	 * check-box}.</li>
	 * </ul>
	 * @param view the model
	 */
	public void fillPanelFromModel(BookView view) {

		BookPlot plot = view.getPlot();
		StandardBookSegment segment = plot.getSegment();

		if (segment == null) {
			return;
		}

		positionLimit = segment.getSegmentLength();
		frequencyLimit = view.getDocument().getBook().getSamplingFrequency()/2;

		getMinPositionModel().setMaximum(positionLimit - 0.01);
		getMaxPositionModel().setMaximum(positionLimit);

		getMinFrequencyModel().setMaximum(frequencyLimit - 0.01);
		getMaxFrequencyModel().setMaximum(frequencyLimit);

		getMinPositionSpinner().setValue(plot.getMinPosition());
		getMaxPositionSpinner().setValue(plot.getMaxPosition());

		getMinFrequencySpinner().setValue(plot.getMinFrequency());
		getMaxFrequencySpinner().setValue(plot.getMaxFrequency());

		getPreserveRatioCheckBox().setSelected(view.getZoomBookTool().isPreserveRatio());

	}