Ejemplo n.º 1
0
  public void initStepDat() {
    Viewport port = ((FigureCanvas) getControl()).getViewport();
    stepData.minX = port.getHorizontalRangeModel().getMinimum();
    stepData.maxX = port.getHorizontalRangeModel().getMaximum();
    stepData.valueX = port.getHorizontalRangeModel().getValue();
    stepData.extendX = port.getHorizontalRangeModel().getExtent();

    stepData.minY = port.getVerticalRangeModel().getMinimum();
    stepData.maxY = port.getVerticalRangeModel().getMaximum();
    stepData.valueY = port.getVerticalRangeModel().getValue();
    stepData.extendY = port.getVerticalRangeModel().getExtent();
  }
Ejemplo n.º 2
0
 /**
  * Sets zoom to the passed string. The string must be composed of numeric characters only with the
  * exception of a decimal point and a '%' as the last character. If the zoom level contribution
  * list has been set, this method should be overridden to provide the appropriate zoom
  * implementation for the new zoom levels.
  *
  * @param zoomString The new zoom level
  */
 public void setZoomAsText(String zoomString) {
   currentZoomContant = null;
   if (zoomString.equalsIgnoreCase(FIT_HEIGHT)) {
     currentZoomContant = FIT_HEIGHT;
     primSetZoom(getFitHeightZoomLevel());
     viewport.getUpdateManager().performUpdate();
     viewport.setViewLocation(
         viewport.getHorizontalRangeModel().getValue(),
         viewport.getVerticalRangeModel().getMinimum());
   } else if (zoomString.equalsIgnoreCase(FIT_ALL)) {
     currentZoomContant = FIT_ALL;
     primSetZoom(getFitPageZoomLevel());
     viewport.getUpdateManager().performUpdate();
     viewport.setViewLocation(
         viewport.getHorizontalRangeModel().getMinimum(),
         viewport.getVerticalRangeModel().getMinimum());
   } else if (zoomString.equalsIgnoreCase(FIT_WIDTH)) {
     currentZoomContant = FIT_WIDTH;
     primSetZoom(getFitWidthZoomLevel());
     viewport.getUpdateManager().performUpdate();
     viewport.setViewLocation(
         viewport.getHorizontalRangeModel().getMinimum(),
         viewport.getVerticalRangeModel().getValue());
   } else {
     try {
       // Trim off the '%'
       if (zoomString.charAt(zoomString.length() - 1) == '%') {
         zoomString = zoomString.substring(0, zoomString.length() - 1);
       }
       double newZoom = Double.parseDouble(zoomString) / 100;
       setZoom(newZoom / multiplier);
     } catch (Exception e) {
       Display.getCurrent().beep();
     }
   }
 }