org.netbeans.api.visual.widget.Widget.convertLocalToScene()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(88)

本文整理了Java中org.netbeans.api.visual.widget.Widget.convertLocalToScene()方法的一些代码示例,展示了Widget.convertLocalToScene()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Widget.convertLocalToScene()方法的具体详情如下:
包路径:org.netbeans.api.visual.widget.Widget
类名称:Widget
方法名:convertLocalToScene

Widget.convertLocalToScene介绍

[英]Converts a location in the local coordination system to the scene coordination system.
[中]将局部协调系统中的位置转换为场景协调系统。

代码示例

代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual

private void move (Widget widget, Point newLocation) {
  Point sceneLocation = widget.convertLocalToScene (newLocation);
  selectionSceneRectangle.width = sceneLocation.x - selectionSceneRectangle.x;
  selectionSceneRectangle.height = sceneLocation.y - selectionSceneRectangle.y;
  resolveSelectionWidgetLocationBounds ();
}

代码示例来源:origin: in.jlibs/org-netbeans-api-visual

private void move (Widget widget, Point newLocation) {
  Point sceneLocation = widget.convertLocalToScene (newLocation);
  selectionSceneRectangle.width = sceneLocation.x - selectionSceneRectangle.x;
  selectionSceneRectangle.height = sceneLocation.y - selectionSceneRectangle.y;
  resolveSelectionWidgetLocationBounds ();
}

代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual

final void revalidateWidget (Widget widget) {
  Rectangle widgetBounds = widget.getBounds ();
  if (widgetBounds != null) {
    Rectangle sceneBounds = widget.convertLocalToScene (widgetBounds);
    if (repaintRegion == null)
      repaintRegion = sceneBounds;
    else
      repaintRegion.add (sceneBounds);
  }
  repaintWidgets.add (widget);
}

代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual

private boolean move (Widget widget, Point newLocation) {
  if (movingWidget != widget)
    return false;
  initialMouseLocation = null;
  newLocation = widget.convertLocalToScene (newLocation);
  Point location = new Point (originalSceneLocation.x + newLocation.x - dragSceneLocation.x, originalSceneLocation.y + newLocation.y - dragSceneLocation.y);
  provider.setNewLocation (widget, strategy.locationSuggested (widget, originalSceneLocation, location));
  return true;
}

代码示例来源:origin: in.jlibs/org-netbeans-api-visual

private boolean move (Widget widget, Point newLocation) {
  if (movingWidget != widget)
    return false;
  initialMouseLocation = null;
  newLocation = widget.convertLocalToScene (newLocation);
  Point location = new Point (originalSceneLocation.x + newLocation.x - dragSceneLocation.x, originalSceneLocation.y + newLocation.y - dragSceneLocation.y);
  provider.setNewLocation (widget, strategy.locationSuggested (widget, originalSceneLocation, location));
  return true;
}

代码示例来源:origin: in.jlibs/org-netbeans-api-visual

final void revalidateWidget (Widget widget) {
  Rectangle widgetBounds = widget.getBounds ();
  if (widgetBounds != null) {
    Rectangle sceneBounds = widget.convertLocalToScene (widgetBounds);
    if (repaintRegion == null)
      repaintRegion = sceneBounds;
    else
      repaintRegion.add (sceneBounds);
  }
  repaintWidgets.add (widget);
}

代码示例来源:origin: in.jlibs/org-netbeans-api-visual

public java.util.List<Rectangle> getRegions (Widget movingWidget) {
  java.util.List<Widget> children = collectionLayer.getChildren ();
  ArrayList<Rectangle> regions = new ArrayList<Rectangle> (children.size ());
  for (Widget widget : children)
    if (widget != movingWidget)
      regions.add (widget.convertLocalToScene (outerBounds ? widget.getBounds () : widget.getClientArea ()));
  return regions;
}

代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual

public java.util.List<Rectangle> getRegions (Widget movingWidget) {
  java.util.List<Widget> children = collectionLayer.getChildren ();
  ArrayList<Rectangle> regions = new ArrayList<Rectangle> (children.size ());
  for (Widget widget : children)
    if (widget != movingWidget)
      regions.add (widget.convertLocalToScene (outerBounds ? widget.getBounds () : widget.getClientArea ()));
  return regions;
}

代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual

public State mouseDragged (Widget widget, WidgetMouseEvent event) {
  updateForViewPoint (widget.getScene ().convertSceneToView (widget.convertLocalToScene (event.getPoint ())));
  return State.CONSUMED;
}

代码示例来源:origin: in.jlibs/org-netbeans-api-visual

public State mouseDragged (Widget widget, WidgetMouseEvent event) {
  updateForViewPoint (widget.getScene ().convertSceneToView (widget.convertLocalToScene (event.getPoint ())));
  return State.CONSUMED;
}

代码示例来源:origin: in.jlibs/org-netbeans-api-visual

public State mouseMoved (Widget widget, WidgetMouseEvent event) {
  updateForViewPoint (widget.getScene ().convertSceneToView (widget.convertLocalToScene (event.getPoint ())));
  return State.CONSUMED;
}

代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual

public State mouseMoved (Widget widget, WidgetMouseEvent event) {
  updateForViewPoint (widget.getScene ().convertSceneToView (widget.convertLocalToScene (event.getPoint ())));
  return State.CONSUMED;
}

代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual

private boolean move (Widget widget, Point point) {
  if (sourceWidget != widget)
    return false;
  Point targetSceneLocation = widget.convertLocalToScene (point);
  targetWidget = resolveTargetWidgetCore (interractionLayer.getScene (), targetSceneLocation);
  Anchor targetAnchor = null;
  if (targetWidget != null)
    targetAnchor = decorator.createTargetAnchor (targetWidget);
  if (targetAnchor == null)
    targetAnchor = decorator.createFloatAnchor (targetSceneLocation);
  connectionWidget.setTargetAnchor (targetAnchor);
  return true;
}

代码示例来源:origin: in.jlibs/org-netbeans-api-visual

private boolean move (Widget widget, Point point) {
  if (sourceWidget != widget)
    return false;
  Point targetSceneLocation = widget.convertLocalToScene (point);
  targetWidget = resolveTargetWidgetCore (interractionLayer.getScene (), targetSceneLocation);
  Anchor targetAnchor = null;
  if (targetWidget != null)
    targetAnchor = decorator.createTargetAnchor (targetWidget);
  if (targetAnchor == null)
    targetAnchor = decorator.createFloatAnchor (targetSceneLocation);
  connectionWidget.setTargetAnchor (targetAnchor);
  return true;
}

代码示例来源:origin: in.jlibs/org-netbeans-api-visual

public State mousePressed (Widget widget, WidgetMouseEvent event) {
  if (isLocked ())
    return State.createLocked (widget, this);
  if (event.getButton () == MouseEvent.BUTTON1  &&  event.getClickCount () == 1) {
    movingWidget = widget;
    initialMouseLocation = event.getPoint ();
    originalSceneLocation = provider.getOriginalLocation (widget);
    if (originalSceneLocation == null)
      originalSceneLocation = new Point ();
    dragSceneLocation = widget.convertLocalToScene (event.getPoint ());
    provider.movementStarted (widget);
    return State.createLocked (widget, this);
  }
  return State.REJECTED;
}

代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual

private boolean pan (Widget widget, Point newLocation) {
  if (scrollPane == null  ||  scene != widget.getScene ())
    return false;
  newLocation = scene.convertSceneToView (widget.convertLocalToScene (newLocation));
  SwingUtilities.convertPointToScreen (newLocation, scene.getView ());
  JComponent view = scene.getView ();
  Rectangle rectangle = view.getVisibleRect ();
  rectangle.x += lastLocation.x - newLocation.x;
  rectangle.y += lastLocation.y - newLocation.y;
  view.scrollRectToVisible (rectangle);
  lastLocation = newLocation;
  return true;
}

代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual

public State mousePressed (Widget widget, WidgetMouseEvent event) {
  if (isLocked ())
    return State.createLocked (widget, this);
  if (event.getButton () == MouseEvent.BUTTON1  &&  event.getClickCount () == 1) {
    selectionWidget = decorator.createSelectionWidget ();
    assert selectionWidget != null;
    interractionLayer.addChild (selectionWidget);
    selectionSceneRectangle = new Rectangle (widget.convertLocalToScene (event.getPoint ()));
    move (widget, event.getPoint ());
    return State.createLocked (widget, this);
  }
  return State.REJECTED;
}

代码示例来源:origin: in.jlibs/org-netbeans-api-visual

private boolean pan (Widget widget, Point newLocation) {
  if (scrollPane == null  ||  scene != widget.getScene ())
    return false;
  newLocation = scene.convertSceneToView (widget.convertLocalToScene (newLocation));
  SwingUtilities.convertPointToScreen (newLocation, scene.getView ());
  JComponent view = scene.getView ();
  Rectangle rectangle = view.getVisibleRect ();
  rectangle.x += lastLocation.x - newLocation.x;
  rectangle.y += lastLocation.y - newLocation.y;
  view.scrollRectToVisible (rectangle);
  lastLocation = newLocation;
  return true;
}

代码示例来源:origin: in.jlibs/org-netbeans-api-visual

public State mousePressed (Widget widget, WidgetMouseEvent event) {
  if (isLocked ())
    return State.createLocked (widget, this);
  if (event.getButton () == MouseEvent.BUTTON1  &&  event.getClickCount () == 1) {
    selectionWidget = decorator.createSelectionWidget ();
    assert selectionWidget != null;
    interractionLayer.addChild (selectionWidget);
    selectionSceneRectangle = new Rectangle (widget.convertLocalToScene (event.getPoint ()));
    move (widget, event.getPoint ());
    return State.createLocked (widget, this);
  }
  return State.REJECTED;
}

代码示例来源:origin: in.jlibs/org-netbeans-api-visual

public State mousePressed (Widget widget, WidgetMouseEvent event) {
  if (isLocked ())
    return State.createLocked (widget, this);
  if (event.getButton () == MouseEvent.BUTTON2) {
    scene = widget.getScene ();
    scrollPane = findScrollPane (scene.getView ());
    if (scrollPane != null) {
      lastLocation = scene.convertSceneToView (widget.convertLocalToScene (event.getPoint ()));
      SwingUtilities.convertPointToScreen (lastLocation, scene.getView ());
      return State.createLocked (widget, this);
    }
  }
  return State.REJECTED;
}

相关文章