Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
blob: ad125399d47a4a6932595e1653626a2034ac3c71 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*******************************************************************************
 * Copyright (c) 2001, 2006 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.wst.xsd.ui.internal.design.figures;

import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.LineBorder;
import org.eclipse.draw2d.MarginBorder;
import org.eclipse.draw2d.ScrollPane;
import org.eclipse.draw2d.ToolbarLayout;
import org.eclipse.draw2d.Viewport;
import org.eclipse.draw2d.ViewportLayout;
import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.HeadingFigure;
import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.RoundedLineBorder;
import org.eclipse.wst.xsd.ui.internal.design.layouts.FillLayout;

public class CategoryFigure extends Figure
{
  protected ScrollPane scrollpane;
  protected Figure outerPane;
  public HeadingFigure headingFigure;
  Figure contentPane;

  public CategoryFigure(int type)
  {
    super();

    outerPane = new Figure();
    outerPane.setBorder(new RoundedLineBorder(1, 6));

    ToolbarLayout layout = new ToolbarLayout(false);
    layout.setVertical(true);
    layout.setStretchMinorAxis(true);
    FillLayout fillLayout = new FillLayout(3);
    fillLayout.setHorizontal(false);

    FillLayout outerLayout = new FillLayout();
    outerPane.setLayoutManager(outerLayout);

    add(outerPane);

    headingFigure = new HeadingFigure();
    outerPane.add(headingFigure);

    Figure line = new Figure();
    line.setBorder(new LineBorder(1));
    ToolbarLayout lineLayout = new ToolbarLayout(false);
    lineLayout.setVertical(true);
    lineLayout.setStretchMinorAxis(true);
    line.setLayoutManager(lineLayout);
    outerPane.add(line);

    scrollpane = new ScrollPane();
    scrollpane.setForegroundColor(ColorConstants.black);
    scrollpane.setVerticalScrollBarVisibility(ScrollPane.AUTOMATIC);
    outerPane.add(scrollpane);

    Figure pane = new Figure();
    pane.setBorder(new MarginBorder(5, 8, 5, 8));
    ToolbarLayout toolbarLayout = new ToolbarLayout(false);
    toolbarLayout.setSpacing(3);
    pane.setLayoutManager(toolbarLayout); // good

    Viewport viewport = new Viewport();
    viewport.setContentsTracksHeight(true);
    ViewportLayout viewportLayout = new ViewportLayout();
    viewport.setLayoutManager(viewportLayout);

    scrollpane.setViewport(viewport);
    scrollpane.setContents(pane);
  }

  public HeadingFigure getHeadingFigure()
  {
    return headingFigure;
  }

  public ScrollPane getScrollPane()
  {
    return scrollpane;
  }

  public IFigure getContentPane()
  {
    return scrollpane.getContents();
  }

}

Back to the top