Java Code Examples for org.netbeans.api.visual.widget.Widget#getPreferredLocation()
The following examples show how to use
org.netbeans.api.visual.widget.Widget#getPreferredLocation() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HierarchicalGraphLayout.java From hottub with GNU General Public License v2.0 | 6 votes |
public VertexWrapper(N node, UniversalGraph<N, E> graph) { this.node = node; this.graph = graph; final VertexWrapper vertex = this; this.slot = new Port() { public Vertex getVertex() { return vertex; } public Point getRelativePosition() { return new Point((int) (vertex.getSize().getWidth() / 2), (int) (vertex.getSize().getHeight() / 2)); } }; Widget w = graph.getScene().findWidget(node); this.position = w.getPreferredLocation(); }
Example 2
Source File: HierarchicalGraphLayout.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public VertexWrapper(N node, UniversalGraph<N, E> graph) { this.node = node; this.graph = graph; final VertexWrapper vertex = this; this.slot = new Port() { public Vertex getVertex() { return vertex; } public Point getRelativePosition() { return new Point((int) (vertex.getSize().getWidth() / 2), (int) (vertex.getSize().getHeight() / 2)); } }; Widget w = graph.getScene().findWidget(node); this.position = w.getPreferredLocation(); }
Example 3
Source File: HierarchicalGraphLayout.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public VertexWrapper(N node, UniversalGraph<N, E> graph) { this.node = node; this.graph = graph; final VertexWrapper vertex = this; this.slot = new Port() { public Vertex getVertex() { return vertex; } public Point getRelativePosition() { return new Point((int) (vertex.getSize().getWidth() / 2), (int) (vertex.getSize().getHeight() / 2)); } }; Widget w = graph.getScene().findWidget(node); this.position = w.getPreferredLocation(); }
Example 4
Source File: HierarchicalGraphLayout.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public VertexWrapper(N node, UniversalGraph<N, E> graph) { this.node = node; this.graph = graph; final VertexWrapper vertex = this; this.slot = new Port() { public Vertex getVertex() { return vertex; } public Point getRelativePosition() { return new Point((int) (vertex.getSize().getWidth() / 2), (int) (vertex.getSize().getHeight() / 2)); } }; Widget w = graph.getScene().findWidget(node); this.position = w.getPreferredLocation(); }
Example 5
Source File: FreePlaceNodesLayouter.java From netbeans with Apache License 2.0 | 6 votes |
public void layoutNodesLocations( PageFlowScene scene, Collection<Page> nodes) { final Collection<Page> allNodes = scene.getNodes(); for( Page node : nodes ) { final Widget nodeWidget = scene.findWidget(node); if( nodeWidget == null ) { return; } if ( nodeWidget.getPreferredLocation() != null ) { /* If the getPreferredLocation has already been set by something else. */ /* The unique ID for a node is it's display name defined by: node.getDisplayName() */ positions.put(node.getDisplayName(), nodeWidget.getPreferredLocation()); } else { Point point = positions.get(node.getDisplayName()); if ( point == null ) { point = getNewComponentLocation(scene, positions, allNodes); } positions.put(node.getDisplayName(), point); nodeWidget.setPreferredLocation(point); } } }
Example 6
Source File: GraphLayout.java From netbeans with Apache License 2.0 | 6 votes |
/** * Should be called to set a new resolved preferred location of a node. * @param graph the universal graph * @param node the node with resolved location * @param newPreferredLocation the new resolved location */ protected final void setResolvedNodeLocation (UniversalGraph<N,E> graph, N node, Point newPreferredLocation) { ObjectScene scene = graph.getScene (); Widget widget = scene.findWidget (node); if (widget == null) return; Point previousPreferredLocation = widget.getPreferredLocation (); if (animated) scene.getSceneAnimator ().animatePreferredLocation (widget, newPreferredLocation); else widget.setPreferredLocation (newPreferredLocation); GraphLayoutListener<N,E>[] listeners = createListenersCopy (); for (GraphLayoutListener<N,E> listener : listeners) listener.nodeLocationChanged (graph, node, previousPreferredLocation, newPreferredLocation); }
Example 7
Source File: HierarchicalGraphLayout.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public VertexWrapper(N node, UniversalGraph<N, E> graph) { this.node = node; this.graph = graph; final VertexWrapper vertex = this; this.slot = new Port() { public Vertex getVertex() { return vertex; } public Point getRelativePosition() { return new Point((int) (vertex.getSize().getWidth() / 2), (int) (vertex.getSize().getHeight() / 2)); } }; Widget w = graph.getScene().findWidget(node); this.position = w.getPreferredLocation(); }
Example 8
Source File: PreferredLocationAnimator.java From netbeans with Apache License 2.0 | 5 votes |
protected void tick (double progress) { for (Map.Entry<Widget, Point> entry : targetLocations.entrySet ()) { Widget widget = entry.getKey (); Point sourceLocation = sourceLocations.get (widget); if (sourceLocation == null) { sourceLocation = widget.getPreferredLocation (); if (sourceLocation == null) { sourceLocation = widget.getLocation (); if (sourceLocation == null) { sourceLocation = new Point (); } } sourceLocations.put (widget, sourceLocation); } Point targetLocation = entry.getValue (); if (targetLocation == null) continue; Point point; if (progress >= 1.0) point = targetLocation; else point = new Point ( (int) (sourceLocation.x + progress * (targetLocation.x - sourceLocation.x)), (int) (sourceLocation.y + progress * (targetLocation.y - sourceLocation.y))); widget.setPreferredLocation (point); } if (progress >= 1.0) { sourceLocations.clear (); targetLocations.clear (); } }
Example 9
Source File: ControlFlowScene.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public void setNewLocation(Widget widget, Point location) { Point originalLocation = getOriginalLocation(widget); int xOffset = location.x - originalLocation.x; int yOffset = location.y - originalLocation.y; for (Widget w : this.selection) { Point p = new Point(w.getPreferredLocation()); p.translate(xOffset, yOffset); w.setPreferredLocation(p); } }
Example 10
Source File: ControlFlowScene.java From hottub with GNU General Public License v2.0 | 5 votes |
public void setNewLocation(Widget widget, Point location) { Point originalLocation = getOriginalLocation(widget); int xOffset = location.x - originalLocation.x; int yOffset = location.y - originalLocation.y; for (Widget w : this.selection) { Point p = new Point(w.getPreferredLocation()); p.translate(xOffset, yOffset); w.setPreferredLocation(p); } }
Example 11
Source File: ControlFlowScene.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public void setNewLocation(Widget widget, Point location) { Point originalLocation = getOriginalLocation(widget); int xOffset = location.x - originalLocation.x; int yOffset = location.y - originalLocation.y; for (Widget w : this.selection) { Point p = new Point(w.getPreferredLocation()); p.translate(xOffset, yOffset); w.setPreferredLocation(p); } }
Example 12
Source File: ControlFlowScene.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void setNewLocation(Widget widget, Point location) { if (selection.contains(widget)) { // move entire selection Point originalLocation = getOriginalLocation(widget); int xOffset = location.x - originalLocation.x; int yOffset = location.y - originalLocation.y; for (Widget w : selection) { Point p = new Point(w.getPreferredLocation()); p.translate(xOffset, yOffset); w.setPreferredLocation(p); } } else { widget.setPreferredLocation(location); } }
Example 13
Source File: ConnectionWidgetLayout.java From netbeans with Apache License 2.0 | 5 votes |
private void layoutSingleChildAt (Point linePoint, ConnectionWidgetLayoutAlignment alignment, ConnectionWidget connectionWidget, Widget childWidget) { Rectangle preferredBounds = childWidget.getPreferredBounds (); Point referencePoint = getReferencePointForAdjustedAlignment (alignment, preferredBounds); Point location = childWidget.getPreferredLocation (); if (location != null) referencePoint.translate (-location.x, -location.y); childWidget.resolveBounds (new Point (linePoint.x - referencePoint.x, linePoint.y - referencePoint.y), preferredBounds); }
Example 14
Source File: ControlFlowScene.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public void setNewLocation(Widget widget, Point location) { Point originalLocation = getOriginalLocation(widget); int xOffset = location.x - originalLocation.x; int yOffset = location.y - originalLocation.y; for (Widget w : this.selection) { Point p = new Point(w.getPreferredLocation()); p.translate(xOffset, yOffset); w.setPreferredLocation(p); } }
Example 15
Source File: ControlFlowScene.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public void setNewLocation(Widget widget, Point location) { Point originalLocation = getOriginalLocation(widget); int xOffset = location.x - originalLocation.x; int yOffset = location.y - originalLocation.y; for (Widget w : this.selection) { Point p = new Point(w.getPreferredLocation()); p.translate(xOffset, yOffset); w.setPreferredLocation(p); } }
Example 16
Source File: DependencyGraphScene.java From netbeans with Apache License 2.0 | 4 votes |
@Override public Point getOriginalLocation(Widget widget) { return widget.getPreferredLocation (); }
Example 17
Source File: ControlFlowScene.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public Point getOriginalLocation(Widget widget) { return widget.getPreferredLocation(); }
Example 18
Source File: ControlFlowScene.java From hottub with GNU General Public License v2.0 | 4 votes |
public Point getOriginalLocation(Widget widget) { return widget.getPreferredLocation(); }
Example 19
Source File: ControlFlowScene.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public Point getOriginalLocation(Widget widget) { return widget.getPreferredLocation(); }
Example 20
Source File: ControlFlowScene.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public Point getOriginalLocation(Widget widget) { return widget.getPreferredLocation(); }