use of org.eclipse.zest.core.widgets.internal.ExpandGraphLabel in project archi by archimatetool.
the class GraphContainer method createContainerFigure.
private IFigure createContainerFigure() {
GraphContainer node = this;
IFigure containerFigure = new ContainerFigure();
containerFigure.setOpaque(true);
containerFigure.addLayoutListener(LayoutAnimator.getDefault());
containerFigure.setLayoutManager(new FreeformLayout());
expandGraphLabel = new ExpandGraphLabel(this, node.getText(), node.getImage(), false);
expandGraphLabel.setText(getText());
expandGraphLabel.setImage(getImage());
ContainerDimension containerDimension = computeContainerSize();
scrollPane = new ScrollPane();
scrollPane.addLayoutListener(LayoutAnimator.getDefault());
Viewport viewport = new FreeformViewport();
/*
* This is the code that helps remove the scroll bars moving when the
* nodes are dragged.
*
* viewport.setHorizontalRangeModel(new DefaultRangeModel() { public
* void setAll(int min, int ext, int max) { System.out.println("Max: " +
* max + " : current Max: " + getMaximum()); if (max < getMaximum()) {
* max = getMaximum(); } super.setAll(min, ext, max); }
*
* public void setMaximum(int maximum) { // TODO Auto-generated method
* stub System.out.println("Max: " + maximum + " : current Max: " +
* getMaximum()); if (maximum < getMaximum()) { return; }
* super.setMaximum(maximum); } });
*/
scrollPane.setViewport(viewport);
viewport.addLayoutListener(LayoutAnimator.getDefault());
scrollPane.setScrollBarVisibility(ScrollPane.AUTOMATIC);
// scalledLayer = new ScalableFreeformLayeredPane();
// $NON-NLS-1$
scalledLayer = new AspectRatioFreeformLayer("debug label");
scalledLayer.addLayoutListener(LayoutAnimator.getDefault());
// scalledLayer.setScale(computeChildScale());
scalledLayer.setScale(computeWidthScale(), computeHeightScale());
// container = new FreeformLayer();
// edgeLayer = new FreeformLayer();
zestLayer = new ZestRootLayer();
zestLayer.addLayoutListener(LayoutAnimator.getDefault());
// container.addLayoutListener(LayoutAnimator.getDefault());
// edgeLayer.addLayoutListener(LayoutAnimator.getDefault());
// scalledLayer.add(edgeLayer);
// scalledLayer.add(container);
scalledLayer.add(zestLayer);
// container.setLayoutManager(new FreeformLayout());
zestLayer.setLayoutManager(new FreeformLayout());
scrollPane.setSize(computeChildArea());
scrollPane.setLocation(new Point(0, containerDimension.labelHeight - SUBLAYER_OFFSET));
scrollPane.setForegroundColor(ColorConstants.gray);
expandGraphLabel.setBackgroundColor(getBackgroundColor());
expandGraphLabel.setForegroundColor(getForegroundColor());
expandGraphLabel.setLocation(new Point(0, 0));
containerFigure.add(scrollPane);
containerFigure.add(expandGraphLabel);
scrollPane.getViewport().setContents(scalledLayer);
scrollPane.setBorder(new LineBorder());
return containerFigure;
}
Aggregations