View | Details | Raw Unified | Return to bug 314819
Collapse All | Expand All

(-)a/zest.core/src/org/eclipse/zest/core/widgets/GraphContainer.java (-12 / +28 lines)
Lines 53-59 public class GraphContainer extends GraphNode implements IContainer { Link Here
53
	private static final double scaledHeight = 200;
53
	private static final double scaledHeight = 200;
54
	private static final int CONTAINER_HEIGHT = 200;
54
	private static final int CONTAINER_HEIGHT = 200;
55
	private static final int MIN_WIDTH = 250;
55
	private static final int MIN_WIDTH = 250;
56
	private static final int ANIMATION_TIME = 100;
56
	protected static final int ANIMATION_TIME = 100;
57
	private static final int SUBLAYER_OFFSET = 2;
57
	private static final int SUBLAYER_OFFSET = 2;
58
58
59
	private ExpandGraphLabel expandGraphLabel;
59
	private ExpandGraphLabel expandGraphLabel;
Lines 203-209 public class GraphContainer extends GraphNode implements IContainer { Link Here
203
		return (node.getBounds().x < right && node.getBounds().x + node.getBounds().width > left);
203
		return (node.getBounds().x < right && node.getBounds().x + node.getBounds().width > left);
204
	}
204
	}
205
205
206
	void pack(Graph g) {
206
	public void pack(Graph g) {
207
		GraphNode highestNode = getHighestNode(g);
207
		GraphNode highestNode = getHighestNode(g);
208
		moveNodesUp(highestNode.getBounds(), highestNode);
208
		moveNodesUp(highestNode.getBounds(), highestNode);
209
	}
209
	}
Lines 232-238 public class GraphContainer extends GraphNode implements IContainer { Link Here
232
	 * @param containerBounds
232
	 * @param containerBounds
233
	 * @param graphContainer
233
	 * @param graphContainer
234
	 */
234
	 */
235
	private void moveNodesUp(Rectangle containerBounds, GraphNode graphContainer) {
235
	public void moveNodesUp(Rectangle containerBounds, GraphNode graphContainer) {
236
236
237
		// Get all nodes below this container, in order
237
		// Get all nodes below this container, in order
238
		List orderedNodesBelowY = getOrderedNodesBelowY(parent.getNodes(), containerBounds.y, graphContainer);
238
		List orderedNodesBelowY = getOrderedNodesBelowY(parent.getNodes(), containerBounds.y, graphContainer);
Lines 320-331 public class GraphContainer extends GraphNode implements IContainer { Link Here
320
320
321
	}
321
	}
322
322
323
	public boolean isExpanded() {
324
		return isExpanded;
325
	}
326
323
	/**
327
	/**
324
	 * 
328
	 * 
325
	 * @param containerBounds
329
	 * @param containerBounds
326
	 * @param graphContainer
330
	 * @param graphContainer
327
	 */
331
	 */
328
	private void moveNodesDown(Rectangle containerBounds, GraphContainer graphContainer) {
332
	public void moveNodesDown(Rectangle containerBounds, GraphContainer graphContainer) {
329
333
330
		// Find all nodes below here
334
		// Find all nodes below here
331
		List nodesBelowHere = getOrderedNodesBelowY(parent.getNodes(), containerBounds.y, graphContainer);
335
		List nodesBelowHere = getOrderedNodesBelowY(parent.getNodes(), containerBounds.y, graphContainer);
Lines 559-577 public class GraphContainer extends GraphNode implements IContainer { Link Here
559
	}
563
	}
560
564
561
	/**
565
	/**
562
	 * Get the scale for this container. This is the scale applied to the children contained within
566
	 * Get the width scale for this container. This is the width scale applied to the children contained within
567
	 * 
568
	 * @return
569
	 */
570
	public double getWidthScale() {
571
		return this.scalledLayer.getWidthScale();
572
	}
573
574
	/**
575
	 * Get the height scale for this container. This is the height scale applied to the children contained within
576
	 * 
563
	 * @return
577
	 * @return
564
	 */
578
	 */
565
	public double getScale() {
579
	public double getHeightScale() {
566
		return this.scalledLayer.getScale();
580
		return this.scalledLayer.getHeightScale();
567
	}
581
	}
568
582
569
	/**
583
	/**
570
	 * Set the scale for this container. This is the scale applied to the children contained within.
584
	 * Set the scale for this container. This is the scale applied to the children contained within.
571
	 * @param scale
585
	 * @param scale
572
	 */
586
	 */
573
	public void setScale(double scale) {
587
	public void setScale(double width, double height) {
574
		this.scalledLayer.setScale(scale);
588
		this.scalledLayer.setScale(width, height);
575
	}
589
	}
576
590
577
	/***************************************************************************
591
	/***************************************************************************
Lines 623-630 public class GraphContainer extends GraphNode implements IContainer { Link Here
623
		dimension.labelHeight = labelHeight;
637
		dimension.labelHeight = labelHeight;
624
		dimension.width = labelWidth;
638
		dimension.width = labelWidth;
625
		dimension.width = Math.max(dimension.width, this.size.width);
639
		dimension.width = Math.max(dimension.width, this.size.width);
626
		dimension.expandedHeight = dimension.labelHeight + childAreaHeight - SUBLAYER_OFFSET;
640
		//		dimension.expandedHeight = dimension.labelHeight + childAreaHeight - SUBLAYER_OFFSET;
627
		dimension.expandedHeight = Math.max(dimension.expandedHeight, this.size.height);
641
		dimension.expandedHeight = Math.max(dimension.labelHeight + CONTAINER_HEIGHT - SUBLAYER_OFFSET, this.size.height);
628
642
629
		return dimension;
643
		return dimension;
630
	}
644
	}
Lines 796-801 public class GraphContainer extends GraphNode implements IContainer { Link Here
796
			size.width = containerDimension.width;
810
			size.width = containerDimension.width;
797
			size.height = containerDimension.labelHeight;
811
			size.height = containerDimension.labelHeight;
798
		}
812
		}
813
		this.size.width = size.width;
814
		this.size.height = size.height;
815
799
		Rectangle bounds = new Rectangle(loc, size);
816
		Rectangle bounds = new Rectangle(loc, size);
800
		nodeFigure.getParent().setConstraint(nodeFigure, bounds);
817
		nodeFigure.getParent().setConstraint(nodeFigure, bounds);
801
		scrollPane.setLocation(new Point(expandGraphLabel.getLocation().x, expandGraphLabel.getLocation().y + containerDimension.labelHeight - SUBLAYER_OFFSET));
818
		scrollPane.setLocation(new Point(expandGraphLabel.getLocation().x, expandGraphLabel.getLocation().y + containerDimension.labelHeight - SUBLAYER_OFFSET));
802
- 

Return to bug 314819