コード例 #1
0
  public void updateModelForExtent() {

    double zoomFactor = DiagramEditorUtil.getCurrentZoomFactor();
    if (getExtent() != null) {
      setPosition(new Point(X_ORIGIN, (int) (extent.getOffset() / zoomFactor)));

      if (getExtent().getMappingReference() instanceof StagingTable) {
        setSize(
            new Dimension(
                (int) (ST_EXTENT_WIDTH / zoomFactor), (int) (extent.getHeight() / zoomFactor)));
      } else
      // jh: Defect 20609: provide a wider space to let SummaryExtent's 'arrowhead' show
      if (getExtent() instanceof SummaryExtent) {
        setSize(
            new Dimension(
                (int) (SM_EXTENT_WIDTH / zoomFactor), (int) (extent.getHeight() / zoomFactor)));
      } else {
        // let it default to MappingExtent; must check for SummaryExtent first as it is a subclass
        // of MappingExtent
        setSize(
            new Dimension(
                (int) (MC_EXTENT_WIDTH / zoomFactor), (int) (extent.getHeight() / zoomFactor)));
      }
    }
  }
コード例 #2
0
  public void setExtentPosition(int newYOrigin) {
    double zoomFactor = DiagramEditorUtil.getCurrentZoomFactor();
    if (getExtent() != null) {
      int iExtentOffset = (int) getExtent().getOffset();
      int newY = (int) (iExtentOffset / zoomFactor) + (int) (newYOrigin / zoomFactor);

      setPosition(new Point(X_ORIGIN, newY));
    } else setPosition(new Point(X_ORIGIN, (int) (newYOrigin / zoomFactor)));
  }