Java 类org.eclipse.draw2d.OrderedLayout 实例源码

项目:bdf2    文件:ColumnFigure.java   
public ColumnFigure() {
    ToolbarLayout layout = new ToolbarLayout();
    setLayoutManager(layout);
    layout.setSpacing(2);
    layout.setStretchMinorAxis(false);
    layout.setMinorAlignment(OrderedLayout.ALIGN_TOPLEFT);
    setOpaque(true);
    setBorder(new ColumnFigureBorder());
    GridLayout gridLayout = new GridLayout(6, false);
    gridLayout.marginHeight = 3;
    gridLayout.marginWidth = 5;
    gridLayout.horizontalSpacing = 5;
    dataFigure.setLayoutManager(gridLayout);
    dataFigure.add(pkFigure);
    dataFigure.add(fkFigure);
    dataFigure.add(firstLabel);
    dataFigure.add(lastLabel);
    dataFigure.add(notNullFigure);
    dataFigure.add(uniqueFigure);
    add(dataFigure);

}
项目:ermasterr    文件:SimpleStyleSupport.java   
/**
 * {@inheritDoc}
 */
@Override
public void initTitleBar(final Figure top) {
    final ToolbarLayout topLayout = new ToolbarLayout();

    topLayout.setMinorAlignment(OrderedLayout.ALIGN_TOPLEFT);
    topLayout.setStretchMinorAxis(true);
    top.setLayoutManager(topLayout);

    nameLabel = new Label();
    nameLabel.setBorder(new MarginBorder(new Insets(5, 20, 5, 20)));
    top.add(nameLabel);

    final Figure separater = new Figure();
    separater.setSize(-1, 1);
    separater.setBackgroundColor(getTextColor());
    separater.setOpaque(true);

    top.add(separater);
}
项目:chrysalix    文件:FocusTreeCanvas.java   
void showIconView( final Column column ) {
    iconViewColumn = column;
    focusLine.setVisible( false );
    for ( final Column col : focusTree.columns ) {
        if ( col != column ) col.cellColumn.setVisible( false );
    }
    column.cellWidthBeforeIconView = 0;
    for ( final Object figure : column.cellColumn.getChildren() ) {
        final Cell cell = ( Cell ) figure;
        if ( column.cellWidthBeforeIconView == 0 ) column.cellWidthBeforeIconView =
            ( ( GridData ) column.cellColumn.getLayoutManager().getConstraint( cell ) ).widthHint;
        cell.icon.setImage( focusTree.viewModel.iconViewIcon( cell.item ) );
        final Dimension size = cell.getPreferredSize( iconViewCellWidth, SWT.DEFAULT );
        cell.setPreferredSize( size );
    }
    final FlowLayout layout = new FlowLayout();
    layout.setMinorAlignment( OrderedLayout.ALIGN_BOTTOMRIGHT );
    layout.setMajorSpacing( columnMargins.width );
    layout.setMinorSpacing( columnMargins.height );
    column.cellColumn.setLayoutManager( layout );
    column.cellColumn.setBorder( new MarginBorder( columnMargins.height, columnMargins.width,
                                                   columnMargins.height, columnMargins.width ) );
    updateIconViewBounds();
}
项目:ermasterr    文件:ModelPropertiesFigure.java   
private void addRow(final String name, final String value, final String tableStyle) {
    final Border border = new MarginBorder(5);

    final ToolbarLayout layout = new ToolbarLayout();
    layout.setMinorAlignment(OrderedLayout.ALIGN_TOPLEFT);
    layout.setStretchMinorAxis(true);

    final Label nameLabel = new Label();

    final Label valueLabel = new Label();

    nameLabel.setBorder(border);
    nameLabel.setText(name);
    nameLabel.setLabelAlignment(PositionConstants.LEFT);
    nameLabel.setForegroundColor(foregroundColor);

    this.add(nameLabel);

    if (!ResourceString.getResourceString("action.title.change.design.simple").equals(tableStyle) && !ResourceString.getResourceString("action.title.change.design.frame").equals(tableStyle)) {
        valueLabel.setBackgroundColor(ColorConstants.white);
        valueLabel.setOpaque(true);
        valueLabel.setForegroundColor(ColorConstants.black);

    } else {
        valueLabel.setOpaque(false);
        valueLabel.setForegroundColor(foregroundColor);
    }

    valueLabel.setBorder(border);
    valueLabel.setText(value);
    valueLabel.setLabelAlignment(PositionConstants.LEFT);

    this.add(valueLabel);
}
项目:ermasterr    文件:NormalColumnFigure.java   
public NormalColumnFigure() {
    final FlowLayout layout = new FlowLayout();
    layout.setMinorAlignment(OrderedLayout.ALIGN_CENTER);
    setLayoutManager(layout);

    setBorder(new MarginBorder(new Insets(0, 5, 0, 0)));
}
项目:ermasterr    文件:FunnyStyleSupport.java   
/**
 * {@inheritDoc}
 */
@Override
public void initTitleBar(final Figure top) {
    top.setLayoutManager(new BorderLayout());

    final Figure title = new Figure();
    top.add(title, BorderLayout.TOP);
    final FlowLayout titleLayout = new FlowLayout();
    titleLayout.setMinorAlignment(OrderedLayout.ALIGN_CENTER);
    title.setLayoutManager(titleLayout);

    final ImageFigure image = new ImageFigure();
    image.setBorder(new MarginBorder(new Insets(5, 10, 5, 2)));
    image.setImage(ERDiagramActivator.getImage(getTableFigure().getImageKey()));
    title.add(image);

    nameLabel = new Label();
    nameLabel.setBorder(new MarginBorder(new Insets(5, 0, 5, 20)));
    title.add(nameLabel);

    final Figure separater = new Figure();
    separater.setSize(-1, 1);
    separater.setBackgroundColor(ColorConstants.black);
    separater.setOpaque(true);

    top.add(separater, BorderLayout.BOTTOM);
}
项目:ermasterr    文件:AbstractStyleSupport.java   
protected void initColumnArea(final IFigure columns) {
    final ToolbarLayout layout = new ToolbarLayout();
    layout.setMinorAlignment(OrderedLayout.ALIGN_TOPLEFT);
    layout.setStretchMinorAxis(true);
    layout.setSpacing(0);

    columns.setBorder(new MarginBorder(0, 2, 2, 2));
    columns.setLayoutManager(layout);

    columns.setBackgroundColor(null);
    columns.setOpaque(false);
}
项目:statecharts    文件:CompartmentLayoutEditPolicy.java   
@Override
protected boolean isHorizontal() {
    IFigure figure = ((IGraphicalEditPart) getHost()).getContentPane();
    if (figure.getLayoutManager() instanceof OrderedLayout) {
        return ((OrderedLayout) figure.getLayoutManager()).isHorizontal();
    }
    return true;
}
项目:OpenSPIFe    文件:TreeTimelineHeaderRowEditPart.java   
protected void addTitle(IFigure figure) {
    Object model = getModel();

    final int rowHeight = TimelineUtils.getRowElementHeight(TreeTimelineHeaderRowEditPart.this);
    Figure title = new Figure();
    ToolbarLayout layout = new ToolbarLayout(true);
    layout.setMinorAlignment(OrderedLayout.ALIGN_CENTER);
    title.setLayoutManager(layout);
    layout.setSpacing(6);

    int depth = getDepth();
    TreeTimelineContentProvider cp = getTimelineTreeContentProvider();
    ILabelProvider lp = getLabelProvider();
    String labelText = lp != null ? lp.getText(model) : model + "";
    Image labelImage = lp != null ? lp.getImage(model) : null;

    {   
        levelFigure = new RectangleFigure(); 
        levelFigure.setOutline(false);
        levelFigure.setSize(depth*LEVEL_PADDING, rowHeight);
        levelFigure.setOpaque(true);
        title.add(levelFigure);
    }

    {
        expansionButton = new ArrowButton(PositionConstants.EAST) {

            @Override
            protected void createTriangle() {
                Triangle tri = new Triangle();
                tri.setOutline(true);
                tri.setBackgroundColor(ColorConstants.listForeground);
                tri.setForegroundColor(ColorConstants.listForeground);
                setContents(tri);
            }

        };
        expansionButton.setBorder(null);
        expansionButton.setOpaque(true);
        expansionButton.setPreferredSize(rowHeight,rowHeight);
        expansionButton.setForegroundColor(ColorConstants.black);
        expansionButton.setVisible(cp != null && cp.hasChildren(model));
        expansionButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent event) {
                toggleExpanded();
            }
        });
        title.add(expansionButton);
    }

    {
        titleLabel = new Label();
        titleLabel.setTextAlignment(PositionConstants.CENTER);
        titleLabel.setText(labelText);
        if (labelImage != null) {
            titleLabel.setIcon(labelImage);
        }
        titleLabel.setOpaque(true);
        title.add(titleLabel);
        refreshTitleLabelFont();
    }

    figure.add(title);
}
项目:jive    文件:HierarchicalContourDiagramFigure.java   
private void ensurePositionExists(final IHierarchicalPosition position)
{
  // retrieve the position's section
  final DiagramSection section = position.section();
  // retrieve the position's column
  final int column = position.column();
  // retrieve the position's parent
  final IHierarchicalPosition parent = position.parent();
  // retrieve the container figure associated with this position
  final IFigure containerFigure;
  if (parent != null)
  {
    // make sure the parent figure exists
    ensurePositionExists(parent);
    // the container is the bottom part of the parent figure's container
    containerFigure = (IFigure) positionToFigure().get(parent).getParent().getChildren().get(1);
  }
  else
  {
    // the container is the section figure
    containerFigure = (section == DiagramSection.DS_REACHABLE ? sectionReachable()
        : section == DiagramSection.DS_UNREACHABLE ? sectionUnreachable() : sectionSingletons());
  }
  // make sure the container figure has enough column figures
  while (column >= containerFigure.getChildren().size())
  {
    final IFigure columnFigure = new Figure();
    // columnFigure.setBorder(new LineBorder(1));
    final FlowLayout columnLayout = new FlowLayout(false); // vertical orientation
    columnLayout.setMinorSpacing(20);
    columnLayout.setStretchMinorAxis(true); // all layers have same height
    columnFigure.setLayoutManager(columnLayout);
    containerFigure.add(columnFigure);
    // top part, where the contour goes-- child @0
    final IFigure topFigure = new Figure();
    // topFigure.setBorder(new LineBorder(1));
    final FlowLayout topLayout = new FlowLayout(true); // horizontal orientation
    topLayout.setMinorSpacing(20);
    topLayout.setMajorAlignment(OrderedLayout.ALIGN_CENTER); // center w.r.t. parent
    topFigure.setLayoutManager(topLayout);
    columnFigure.add(topFigure);
    // bottom part, where the subgraph goes-- child @1
    final IFigure bottomFigure = new Figure();
    // bottomFigure.setBorder(new LineBorder(1));
    final FlowLayout bottomLayout = new FlowLayout(true); // horizontal orientation
    bottomLayout.setMinorSpacing(20);
    bottomLayout.setMajorAlignment(OrderedLayout.ALIGN_CENTER); // center w.r.t. parent
    bottomFigure.setLayoutManager(bottomLayout);
    columnFigure.add(bottomFigure);
  }
  // container --> column --> top figure
  final IFigure cellFigure = (IFigure) ((IFigure) containerFigure.getChildren().get(column))
      .getChildren().get(0);
  // make sure the cell figure exists in the map
  positionToFigure().put(position, cellFigure);
}
项目:gef-gwt    文件:OrderedLayoutEditPolicy.java   
/**
 * Returns whether the layout container's layout manager has a horizontal
 * orientation or not.
 * 
 * @return <code>true</code> if the layout container's layout manager has a
 *         horizontal orientation, <code>false</code> otherwise
 * @since 3.7
 */
protected boolean isLayoutHorizontal() {
    IFigure figure = getLayoutContainer();
    return ((OrderedLayout) figure.getLayoutManager()).isHorizontal();
}