Search in sources :

Example 1 with ScalableLayeredPane

use of org.eclipse.draw2d.ScalableLayeredPane in project archi by archimatetool.

the class ScalableRootEditPart method createScaledLayers.

/**
 * Creates a scalable layered pane and the layers that should be scaled.
 *
 * @return a new <code>ScalableLayeredPane</code> containing the scalable
 *         layers
 */
protected ScalableLayeredPane createScaledLayers() {
    ScalableLayeredPane layers = new ScalableLayeredPane(useScaledGraphics);
    layers.add(createGridLayer(), GRID_LAYER);
    layers.add(getPrintableLayers(), PRINTABLE_LAYERS);
    layers.add(new FeedbackLayer(), SCALED_FEEDBACK_LAYER);
    return layers;
}
Also used : ScalableLayeredPane(org.eclipse.draw2d.ScalableLayeredPane)

Example 2 with ScalableLayeredPane

use of org.eclipse.draw2d.ScalableLayeredPane in project whole by wholeplatform.

the class RootEditPart method createScaledLayers.

protected ScalableLayeredPane createScaledLayers() {
    ScalableLayeredPane layers = new ScalableLayeredPane() {

        public Dimension superGetMinimumSize(int wHint, int hHint) {
            if (minSize != null)
                return minSize;
            if (getLayoutManager() != null) {
                Dimension d = getLayoutManager().getMinimumSize(this, wHint, hHint);
                if (d != null)
                    return d;
            }
            return getPreferredSize(wHint, hHint);
        }

        public Dimension superGetPreferredSize(int wHint, int hHint) {
            if (prefSize != null)
                return prefSize;
            if (getLayoutManager() != null) {
                Dimension d = getLayoutManager().getPreferredSize(this, wHint, hHint);
                if (d != null)
                    return d;
            }
            return getSize();
        }

        @Override
        public Dimension getMinimumSize(int wHint, int hHint) {
            Dimension d = superGetMinimumSize(wHint == -1 ? -1 : (int) (wHint / getScale()), hHint == -1 ? -1 : (int) (hHint / getScale()));
            int w = getInsets().getWidth();
            int h = getInsets().getHeight();
            return d.getExpanded(-w, -h).scale(getScale()).expand(w, h);
        }

        @Override
        public Dimension getPreferredSize(int wHint, int hHint) {
            Dimension d = superGetPreferredSize(wHint == -1 ? -1 : (int) (wHint / getScale()), hHint == -1 ? -1 : (int) (hHint / getScale()));
            int w = getInsets().getWidth();
            int h = getInsets().getHeight();
            return d.getExpanded(-w, -h).scale(getScale()).expand(w, h);
        }
    };
    layers.add(createGridLayer(), GRID_LAYER);
    layers.add(getPrintableLayers(), PRINTABLE_LAYERS);
    layers.add(new FeedbackLayer(), SCALED_FEEDBACK_LAYER);
    return layers;
}
Also used : ScalableLayeredPane(org.eclipse.draw2d.ScalableLayeredPane) Dimension(org.eclipse.draw2d.geometry.Dimension)

Aggregations

ScalableLayeredPane (org.eclipse.draw2d.ScalableLayeredPane)2 Dimension (org.eclipse.draw2d.geometry.Dimension)1